{% extends "base.html" %}
{% load static %}
{% block title %}
    {{ title }}
{% endblock title %}
{% block content %}
    <form method="post" enctype="multipart/form-data">
        <table class="mx-auto">
            {% csrf_token %}
            {{ form.as_table }}
            <tr>
                <td></td>
                <td>
                    <input type="submit" name="submit" value="Submit" />
                </td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <input type="submit"
                           name="submit_and_redirect"
                           value="Submit & Create Session" />
                </td>
            </tr>
            {% if purchase_id %}
                <tr>
                    <td></td>
                    <td>
                        <a href="{% url 'delete_purchase' purchase_id %}"
                           class="text-red-600"
                           onclick="return confirm('Are you sure you want to delete this purchase?');">Delete</a>
                    </td>
                </tr>
            {% endif %}
        </table>
    </form>
{% endblock content %}
{% block scripts %}
    {% if script_name %}
        <script type="module" src="{% static 'js/'|add:script_name %}"></script>
    {% endif %}
{% endblock scripts %}