combo/combo/apps/family/templates/combo/family/weekly_agenda.html

59 lines
2.8 KiB
HTML

{% load i18n %}
{% block cell-content %}
{% if json.data %}
{% if cell.title %}
<h2>
{{ cell.title }}
</h2>
{% endif %}
<div class="weekly-agenda-cell weekly-agenda-cell-{{ cell.pk }}" data-cell-id="{{ cell.pk }}">
{% with first_monday=json.data.0.date|date|adjust_to_week_monday last_item=json.data|last %}
{% with last_day=last_item.date|date|adjust_to_week_monday|add_days:6 %}
{% now 'Y-m-W' as current_week %}
{% spaceless %}
<button class="weekly-agenda-cell--previous-week"></button>
<div class="weekly-agenda-cell--week-list">
<div class="weekly-agenda-cell--slider">
{% for day in first_monday|iterate_days_until:last_day %}
{% if day.weekday == 0 %}
{% with sunday=day|add_days:6 %}
<div class="weekly-agenda-cell--week-title {% if current_week == day|date:'Y-m-W' %}current{% endif %}"
{% if booking_form_url %}data-edit-url="{{ booking_form_url }}{% if '?' in booking_form_url %}&{% else %}?{% endif %}current={{ day|adjust_to_week_monday|date:'Y-m-d' }}"{% endif %}>
{% blocktrans with day_date=day|date:'d/m' sunday_date=sunday|date:'d/m' %}Week<br class="weekbreak"> of {{ day_date }} to {{ sunday_date }}{% endblocktrans %}
</div>
{% endwith %}
{% endif %}
<div class="weekly-agenda-cell--day-item" data-weekday="{{ day.weekday }}">
<div class="weekly-agenda-cell--day-title" >
{{ day|date:"l d/m" }}
</div>
{% with day_str=day|date:"Y-m-d" %}
{% for item in json.data %}
{% if item.date == day_str %}
<div class="weekly-agenda-cell--activity-item {% if item.disabled %}disabled{% endif %}">
<div class="weekly-agenda-cell--activity-status {{ item.status }}"/></div>
<div class="weekly-agenda-cell--activity-label"/>{{ item.label }}</div>
</div>
{% endif %}
{% endfor %}
{% endwith %}
<div class="weekly-agenda-cell--day-no-activity">{% trans "No activity this week" %}</div>
</div>
{% endfor %}
</div>
</div>
<button class="weekly-agenda-cell--next-week"></button>
{% if booking_form_url %}
<a class="pk-button weekly-agenda-cell--edit-btn">
{% trans "Update bookings" %}
</a>
{% endif %}
{% endspaceless %}
{% endwith %}
{% endwith %}
</div>
{% endif %}
{% endblock %}