index.html 5.87 KB
Newer Older
1
{% extends "pizzas/base.html" %}
2
3
{% load i18n staticfiles %}

4
{% block title %}{{ event.title }} — {% trans "Pizzas"|capfirst %} — {{ block.super }}{% endblock %}
5

6
7
8
9
10
11
12
{% block header_image_container %}
    {% if event.just_ended %}
        <div class="header-image container {{ order.paid|yesno:'paid,unpaid' }}">
        </div>
    {% else %}
        {{ block.super }}
    {% endif %}
13
14
15
16
17
{% endblock %}

{% block body %}
{% if event %}
    {% if event.just_ended and order %}
18
19
    <div class="text-center">
        <span class="product-name">
20
21
22
23
24
25
26
            {{ order.product.name }}
        </span>
        <br>
        <br>
        <span style="font-size: 24px;">
            {{ member.get_full_name }}
        </span>
27
    </div>
28
29
    {% endif %}
    <h1>
Jim Driessen's avatar
Jim Driessen committed
30
        {% blocktrans with title=event.title %}Order food for {{ title }}{% endblocktrans %}
31
32
33
34
35
36
37
    </h1>
{% else %}
    <h1>
        {% trans "There is no current event for which you can order food" %}
    </h1>
{% endif %}
<div id="button-container">
38
39
40
    {% if perms.pizzas.change_product %}
        <a href="{% url 'admin:pizzas_product_changelist' %}" class="btn btn-style1 pull-right">{% trans "All products" %}</a>
    {% endif %}
41
    {% if perms.pizzas.change_pizzaevent %}
42
        <a href="{% url 'admin:pizzas_pizzaevent_changelist' %}" class="btn btn-style1 pull-right">{% trans "All events" %}</a>
43
44
    {% endif %}
    {% if perms.pizzas.change_order and event %}
45
        <a href="{% url 'pizzas:orders' event.pk %}" class="btn btn-style1 pull-right">{% trans "All orders" %}</a>
46
47
48
49
50
51
    {% endif %}
    <br><br>
</div>
{% if event %}
    {% if event.in_the_future %}
        <h2>
Jim Driessen's avatar
Jim Driessen committed
52
            {% blocktrans with start=event.start|date:"Y-m-d H:i:s" %}It will be possible to order from {{ start }}.{% endblocktrans %}
53
54
55
56
        </h2>
    {% else %}
        {% if event.just_ended %}
        <h2>
Jim Driessen's avatar
Jim Driessen committed
57
            {% blocktrans with end=event.end|date:"Y-m-d H:i:s" %}It was possible to order until {{ end }}.{% endblocktrans %}
58
59
60
        </h2>
        {% else %}
        <h2>
Jim Driessen's avatar
Jim Driessen committed
61
            {% blocktrans with end=event.end|date:"Y-m-d H:i:s" %}It is possible to order until {{ end }}.{% endblocktrans %}
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
        </h2>
        {% endif %}
        {% if order %}
            {% if order.paid %}
            <div class="alert alert-success">{% trans "The order has been paid for." %}</div>
            {% else %}
            <div class="alert alert-error">{% trans "The order has not yet been paid for." %}</div>
            {% endif %}
            <h4>{% trans "Current order" %}</h4>
            <div style="overflow-x: auto;">
                <table class="table table-striped table-bordered table-hover">
                    <tr>
                        <th>{% trans "Name" %}</th>
                        <th>{% trans "Description" %}</th>
                        <th>{% trans "Price" %}</th>
                        <th>{% trans "Cancel" %}</th>
                    </tr>
                    <tr>
                        <td>{{ order.product.name }}</td>
                        <td>{{ order.product.description }}</td>
                        <td>&euro; {{ order.product.price }}</td>
                        <td>
84
                            {% if not order.can_be_changed %}
85
86
87
88
89
90
91
92
93
94
95
96
                                {% trans "You can no longer cancel." %}
                            {% else %}
                                <form class="form-horizontal pizza-order-form" method="post" action="{% url 'pizzas:cancel-order' %}">
                                    {% csrf_token %}
                                    <input type='hidden' name='order' value='{{ order.pk }}' />
                                    <input type='submit' value='{% trans "Cancel" %}' class='btn btn-style1' onclick="return confirm('{% trans "Are you sure you want to cancel your order?" %}')" />
                                </form>
                            {% endif %}
                        </td>
                    </tr>
                </table>
            </div>
97
            {% if not event.just_ended %}
98
99
100
101
102
                <h4>{% trans "Changing your order" %}</h4>
            {% endif %}
        {% elif event.just_ended %}
            {% trans "You did not place an order." %}
        {% endif %}
103
104
105
106
        {% if not event.has_ended %}
            {% if order == None or order.can_be_changed %}
                <div style="overflow-x: auto;">
                    <table class="category table table-striped table-bordered table-hover">
107
                        <tr>
108
109
110
111
                            <th>{% trans "Name" %}</th>
                            <th>{% trans "Description" %}</th>
                            <th>{% trans "Price" %}</th>
                            <th>{% if order %}{% trans "Modify" %}{% else %}{% trans "Order" context "pizzas" %}{% endif %}</th>
112
                        </tr>
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
                        {% for product in products %}
                            <tr>
                                <td>{{ product.name }}</td>
                                <td>{{ product.description }}</td>
                                <td>&euro; {{ product.price }}</td>
                                <td>
                                    <form class="form-horizontal pizza-order-form" method="post" action="{% url 'pizzas:order' %}">
                                        {% csrf_token %}
                                        <input type="hidden" name="product" value="{{ product.pk }}" />
                                        <input type="submit" class="btn btn-style1" {% if order %}value='{% trans "Modify" %}' onclick="return confirm('{% trans "Are you sure you want to modify your order?" %}')"{% else %}value='{% trans "Order" context "pizzas" %}'{% endif %} />
                                    </form>
                                </td>
                            </tr>
                        {% endfor %}
                    </table>
                </div>
            {% endif %}
130
131
132
133
        {% endif %}
    {% endif %}
{% endif %}
{% endblock %}