<section id="admin-myaccount">
    <h2>My Account</h2>

    <form id="admin-myaccount-form" method="post" action="/admin?change=account" accept-charset="UTF-8">
        <label for="admin-myaccount-username">Username: </label>
        <input id="admin-myaccount-username" type="text" name="username" value="{{ authuser.name }}" /><br/>

        <label for="admin-myaccount-email">E-Mail: </label>
        <input id="admin-myaccount-email" type="text" name="email" value="{% if authuser.email is not none %}{{ authuser.email }}{% endif %}" /><br/>

        <label for="admin-myaccount-receipt-pref">Receipts: </label>
        <select id="admin-myaccount-receipt-pref" name="receipt_pref">
            {% for pref in receipt_preference_class %}
            <option value="{{ pref.value }}" {% if authuser.receipt_pref == pref %} selected="selected" {% endif %}>{{ pref.human_readable }}</option>
            {% endfor %}
        </select>
        {% if config_smtp_enabled != '1' %}Sending receipts is disabled by your administrator.{% endif %}
        <br/>

        <label for="admin-myaccount-ismember">Member: </label>
        <input id="admin-myaccount-ismember" type="checkbox" disabled="disabled" {% if authuser.is_member %} checked="checked" {% endif %}/><br/>

        <label for="admin-myaccount-isadmin">Admin: </label>
        <input id="admin-myaccount-isadmin" type="checkbox" disabled="disabled" {% if authuser.is_admin %} checked="checked" {% endif %}/><br/>

        <label for="admin-myaccount-logout-after-purchase">Logout after purchase: </label>
        <input id="admin-myaccount-logout-after-purchase" type="checkbox" name="logout_after_purchase" {% if authuser.logout_after_purchase %} checked="checked" {% endif %}/><br/>

        <input type="submit" value="Save changes" />
    </form>
</section>

<section id="admin-avatar">
    <h2>Avatar</h2>

    <form id="admin-avatar-form" method="post" action="/admin?change=avatar" enctype="multipart/form-data" accept-charset="UTF-8">
        <img src="/static/upload/thumbnails/users/{{ authuser.id }}.png?cacheBuster={{ now }}" alt="Avatar of {{ authuser.name }}" /><br/>

        <label for="admin-avatar-avatar">Upload new file: </label>
        <input id="admin-avatar-avatar" type="file" name="avatar" accept="image/*" /><br/>

        <input type="submit" value="Save changes" />
    </form>
</section>

<section id="admin-password">
    <h2>Password</h2>

    <form id="admin-password-form" method="post" action="/admin?change=password" accept-charset="UTF-8">
        <label for="admin-password-oldpass">Current password: </label>
        <input id="admin-password-oldpass" type="password" name="oldpass" /><br/>

        <label for="admin-password-newpass">New password: </label>
        <input id="admin-password-newpass" type="password" name="newpass" /><br/>

        <label for="admin-password-newpass2">Repeat password: </label>
        <input id="admin-password-newpass2" type="password" name="newpass2" /><br/>

        <input type="submit" value="Save changes" />
    </form>
</section>

<section id="admin-touchkey">
    <h2>Touchkey</h2>

    <form id="admin-touchkey-form" method="post" action="/admin?change=touchkey" accept-charset="UTF-8">
        Draw a new touchkey (leave empty to disable):
        <br/>
        <svg id="touchkey-svg" width="400" height="400"></svg>
        <br/>
        <input id="admin-touchkey-touchkey" type="hidden" name="touchkey" value="" />

        <input type="submit" value="Save changes" />
    </form>

    <script src="/static/js/touchkey.js" ></script>
    <script>
        initTouchkey(true, 'touchkey-svg', null, 'admin-touchkey-touchkey');
    </script>
</section>