feat: refactor user settings part 1

This commit is contained in:
Valentin Weber 2024-12-07 21:07:15 +01:00 committed by weva
parent dd65b5c4d0
commit 9a1c220813

View file

@ -25,37 +25,57 @@
<h2>My Account</h2> <h2>My Account</h2>
<form id="settings-myaccount-form" method="post" action="/settings?change=account" accept-charset="UTF-8"> <form id="settings-myaccount-form" method="post" action="/settings?change=account" accept-charset="UTF-8">
<label class="form-label" for="settings-myaccount-username">Username: </label> <div class="row g-2">
<input class="form-control" id="settings-myaccount-username" type="text" name="username" value="{{ authuser.name }}" /><br/> <div class="col-md">
<div class="form-floating">
<label class="form-label" for="settings-myaccount-email">E-Mail: </label> <input class="form-control" id="settings-myaccount-username" type="text" name="username" value="{{ authuser.name }}">
<input class="form-control" id="settings-myaccount-email" type="text" name="email" value="{% if authuser.email is not none %}{{ authuser.email }}{% endif %}" /><br/> <label for="settings-myaccount-username">Username</label>
</div>
<label class="form-label" for="settings-myaccount-receipt-pref">Receipts: </label> </div>
<select class="form-select" id="settings-myaccount-receipt-pref" name="receipt_pref"> <div class="col-md">
{% for pref in receipt_preference_class %} <div class="form-floating">
<option value="{{ pref.value }}" {% if authuser.receipt_pref == pref %} selected="selected" {% endif %}>{{ pref.human_readable }}</option> <input class="form-control" id="settings-myaccount-email" type="email" name="email" value="{% if authuser.email is not none %}{{ authuser.email }}{% endif %}">
{% endfor %} <label for="settings-myaccount-email">E-Mail</label>
</select> </div>
{% if config_smtp_enabled != '1' %}Sending receipts is disabled by your administrator.{% endif %} </div>
<br/> {% if config_smtp_enabled == '1' %}
<div class="col-md">
<div class="form-check"> <div class="form-floating">
<input class="form-check-input" id="settings-myaccount-ismember" type="checkbox" disabled="disabled" {% if authuser.is_member %} checked="checked" {% endif %}/> <select class="form-select" id="settings-myaccount-receipt-pref" name="receipt_pref">
<label class="form-check-label" for="settings-myaccount-ismember">Member</label> {% for pref in receipt_preference_class %}
<option value="{{ pref.value }}" {% if authuser.receipt_pref == pref %} selected {% endif %}>{{ pref.human_readable }}</option>
{% endfor %}
</select>
<label for="settings-myaccount-receipt-pref">Receipts</label>
</div>
</div>
{% endif %}
</div> </div>
<div class="row g-2">
<div class="form-check"> <div class="col">
<input class="form-check-input" id="settings-myaccount-isadmin" type="checkbox" disabled="disabled" {% if authuser.is_admin %} checked="checked" {% endif %}/> <div class="form-check">
<label class="form-check-label" for="settings-myaccount-isadmin">Admin</label> <input class="form-check-input" id="settings-myaccount-ismember" type="checkbox" disabled="disabled" {% if authuser.is_member %} checked="checked" {% endif %}>
<label class="form-check-label" for="settings-myaccount-ismember">Member</label>
</div>
</div>
<div class="col">
<div class="form-check">
<input class="form-check-input" id="settings-myaccount-isadmin" type="checkbox" disabled="disabled" {% if authuser.is_admin %} checked="checked" {% endif %}>
<label class="form-check-label" for="settings-myaccount-isadmin">Admin</label>
</div>
</div>
<div class="col">
<div class="form-check">
<input class="form-check-input" id="settings-myaccount-logout-after-purchase" type="checkbox" name="logout_after_purchase" {% if authuser.logout_after_purchase %} checked="checked" {% endif %}>
<label class="form-check-label" for="settings-myaccount-logout-after-purchase">Logout after purchase</label>
</div>
</div>
</div> </div>
<div class="row g-2">
<div class="form-check"> <div class="col">
<input class="form-check-input" id="settings-myaccount-logout-after-purchase" type="checkbox" name="logout_after_purchase" {% if authuser.logout_after_purchase %} checked="checked" {% endif %}/> <input class="btn btn-primary" type="submit" value="Save changes">
<label class="form-check-label" for="settings-myaccount-logout-after-purchase">Logout after purchase</label> </div>
</div> </div>
<input class="btn btn-primary" type="submit" value="Save changes" />
</form> </form>
<h2>Avatar</h2> <h2>Avatar</h2>