chrono/chrono/manager/templates/chrono/manager_resource_month_view...

71 lines
2.9 KiB
HTML

{% extends "chrono/manager_resource_detail.html" %}
{% load i18n %}
{% block bodyargs %}class="monthview"{% endblock %}
{% block breadcrumb %}
{{ block.super }}
<a>{{ view.date|date:"F Y" }}</a>
{% endblock %}
{% block appbar-title %}
<h2>
<a href="{{ view.get_previous_month_url }}"></a>
<span class="date-title">{{ view.date|date:"F Y" }}</span>
{% with selected_month=view.date|date:"n" selected_year=view.date|date:"Y" %}
<div class="date-picker" style="display: none">
<select name="month">{% for month, month_label in view.get_months %}<option value="{{ month }}" {% if selected_month == month %}selected{% endif %}>{{ month_label }}</option>{% endfor %}</select>
<select name="year">{% for year in view.get_years %}<option value="{{ year }}" {% if selected_year == year %}selected{% endif %}>{{year}}</option>{% endfor %}</select>
<button>{% trans 'Set Date' %}</button>
</div>
{% endwith %}
<a href="{{ view.get_next_month_url }}"></a>
</h2>
{% endblock %}
{% block appbar-extras %}
<a href="{% url 'chrono-manager-resource-day-view' pk=resource.pk year=view.date|date:"Y" month=view.date|date:"n" day=1 %}">{% trans 'Day view' %}</a>
{% endblock %}
{% block content %}
{% for week_days in view.get_timetable_infos %}
{% if forloop.first %}
<table class="agenda-table month-view single-desk">
<tbody>
{% endif %}
<tr>
<th></th>
{% for day in week_days.days %}
<th class="weekday {% if day.today %}today{% endif %}">{% if not day.other_month %}<a href="{% url 'chrono-manager-resource-day-view' pk=resource.pk year=day.date|date:"Y" month=day.date|date:"m" day=day.date|date:"j" %}">{{ day.date|date:"l j" }}</a>{% endif %}</th>
{% endfor %}
</tr>
{% for hour in week_days.periods %}
<tr class="{% cycle 'odd' 'even' %}">
<th class="hour">{{ hour|date:"TIME_FORMAT" }}</th>
{% for day in week_days.days %}
<td class="{% if day.other_month %}other-month{% endif %} {% if day.today %}today{% endif %}">
{% if forloop.parentloop.first %}
{% for slot in day.infos.booked_slots %}
<div class="booking" style="height:{{ slot.css_height|stringformat:".1f" }}%;min-height:{{ slot.css_height|stringformat:".1f" }}%;top:{{ slot.css_top|stringformat:".1f" }}%">
<span class="start-time">{{ slot.booking.event.start_datetime|date:"TIME_FORMAT" }}</span>
<a {% if slot.booking.get_backoffice_url %}href="{{ slot.booking.get_backoffice_url }}"{% endif %}>{{ slot.booking.get_user_block }}</a>
</div>
{% endfor %}
{% endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
{% if forloop.last %}
</tbody>
</table>
{% endif %}
{% empty %}
<div class="closed-for-the-day">
<p>{% trans "No bookings this month." %}</p>
</div>
{% endfor %}
{% endblock %}