counter_main.jinja 1.32 KB
Newer Older
Skia's avatar
Skia committed
1 2
{% extends "core/base.jinja" %}

Skia's avatar
Skia committed
3 4 5 6 7 8 9 10
{% macro barman_logout_link(user) %}
<form method="post" action="{{ url('counter:logout', counter_id=counter.id) }}" class="inline">
    {% csrf_token %}
    <input type="hidden" name="user_id" value="{{ user.id }}">
    <button type="submit" name="submit_param" value="submit_value" class="link-button">{{ user.get_display_name() }}</button>
</form>
{% endmacro %}

Skia's avatar
Skia committed
11 12 13 14 15
{% block content %}
    <h3>Counter</h3>
    <h4>{{ counter }}</h4>
    <p><strong>Club: </strong> {{ counter.club }}</p>
    <p><strong>Products: </strong> {{ counter.products.all() }}</p>
Skia's avatar
Skia committed
16

Skia's avatar
Skia committed
17 18 19 20 21 22 23 24 25 26 27 28 29

    <div>
        {% if barmen %}
        <p>Enter client code:</p>
        <form method="post" action="{{ url('counter:click', counter_id=counter.id) }}">
            {% csrf_token %}
            {{ form.as_p() }}
        <input type="submit" value="CLICK" />
        </form>
        {% else %}
        <p>Please, login</p>
        {% endif %}
    </div>
Skia's avatar
Skia committed
30 31 32 33 34 35 36 37 38 39 40 41 42
    <div>
        <h3>Barman: </h3>
        <ul>
        {% for b in barmen %}
            <li>{{ barman_logout_link(b) }}</li>
        {% endfor %}
        </ul>
        <form method="post" action="{{ url('counter:login', counter_id=counter.id) }}">
            {% csrf_token %}
            {{ login_form.as_p() }}
        <input type="submit" value="login" />
        </form>
    </div>
Skia's avatar
Skia committed
43 44 45 46
{% endblock %}