<section class="flex flex-col gap-4">
    {% include 'lib/alert.twig' %}
    <form action="/admin/transactions/add" method="post" class="flex flex-col gap-4">
        {% if session.last_post.confirm %}
            Confirm
            <input type="hidden" name="confirm" id="confirm" value="{{ session.last_post.confirm }}">
            {% endif %}
            {% if session.last_post.amount is defined %}
                {{ session.last_post.amount }}
                {{ session.last_post.currency }}
                <input
            type="hidden" name="amount" id="amount" value="{{ session.last_post.amount }}" />
                {% else %}
                {% include 'lib/inputs/number.twig' with { 
                id: 'amount', 
                name: 'amount', 
                label: 'Amount', 
                placeholder: 'Enter the amount', 
                value: session.last_post.amount,
                required: true 
            } %}
            {% endif %}
            {% if session.last_post.currency %}
                <input
            type="hidden" name="currency" id="currency" value="{{ session.last_post.currency }}" />
                {% else %}
                {% include 'lib/inputs/select.twig' with { 
                id: 'currency', 
                name: 'currency', 
                label: 'Currency',
                value: session.last_post.currency,
                options: [
                    { 'value': 'sats', 'text': 'Sats' },
                    { 'value': 'cents', 'text': 'Cents' }
                ],
                required: true
            } %}
            {% endif %}
            {% if session.last_post.user_identifier is defined %}
                {% if session.last_post.email is defined %}
                    {{ session.last_post.id }}
                    {{ session.last_post.email }}
                {% endif %}
                <input
            type="hidden" name="user_identifier" id="user_identifier" value="{{ session.last_post.user_identifier }}" />
                {% else %}
                {% include 'lib/inputs/text.twig' with { 
                type: 'text', 
                name: 'user_identifier', 
                label: 'User Identifier', 
                placeholder: 'Enter email or user index',
                value: session.last_post.user_identifier 
            } %}
            {% endif %}
            {% include 'lib/button.twig' with { 
            label: 'Submit', 
            onclick: 'this.parentNode.submit()' 
        } %}
        </form>
        {% if session.last_post %}
            {% include 'lib/button.twig' with { 
            label: 'Cancel', 
            href: '/admin/transactions/reset' 
        } %}
        {% endif %}
    </section>
    