Sith/launderette/templates/launderette/launderette_book.jinja

59 lines
2.2 KiB
Django/Jinja

{% extends "core/base.jinja" %}
{% from "core/macros.jinja" import show_slots, show_tokens %}
{% block title %}
{% trans %}Launderette{% endtrans %}
{% endblock %}
{% macro choose(date) %}
<form method="post" action="{{ url('launderette:book_slot', launderette_id=launderette.id) }}" class="inline" style="display:inline">
{% csrf_token %}
<input type="hidden" name="slot_type" value="{{ slot_type }}">
<button type="submit" name="slot" value="{{ date.isoformat() }}">{% trans %}Choose{% endtrans %}</button>
</form>
{% endmacro %}
{% block content %}
<h3>{{ launderette }}</h3>
<p>
<form method="post" action="{{ url('launderette:book_slot', launderette_id=launderette.id) }}"
class="inline" style="display:inline">
{% csrf_token %}
<button type="submit" name="slot_type" value="BOTH" {% if slot_type == "BOTH" -%}style="background: #FF0"{% endif %}>{% trans %}Washing and drying{% endtrans %}</button>
</form>
<form method="post" action="{{ url('launderette:book_slot', launderette_id=launderette.id) }}" class="inline" style="display:inline">
{% csrf_token %}
<button type="submit" name="slot_type" value="WASHING" {% if slot_type == "WASHING" -%}style="background: #FF0"{% endif %}>{% trans %}Washing{% endtrans %}</button>
</form>
<form method="post" action="{{ url('launderette:book_slot', launderette_id=launderette.id) }}" class="inline" style="display:inline">
{% csrf_token %}
<button type="submit" name="slot_type" value="DRYING" {% if slot_type == "DRYING" -%}style="background: #FF0"{% endif %}>{% trans %}Drying{% endtrans %}</button>
</form>
</p>
<table>
<thead>
<tr>
{% for day in planning.keys() %}
<th>{{ day|date('l') }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for i in range(0, 24) %}
<tr>
{% for hours in planning.values() %}
<td>
{% if hours[i] %}
{{ hours[i]|time(TIME_FORMAT) }} {{ choose(hours[i]) }}
{% endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{{ show_slots(user) }}
{{ show_tokens(user) }}
{% endblock %}