Files
myep-team/templates/teamer/profile/availability/index.html.twig
T

91 lines
3.9 KiB
Twig

{% extends 'teamer/layout.html.twig' %}
{% block title %}Meine Verfügbarkeit{% endblock %}
{#
The periods grouped by year and month; `selected` decides whether a row offers removing the
period or adding it.
#}
{% macro periods(years, selected) %}
{% for year, months in years %}
<h3 class="pt-4 pb-1 text-lg font-bold first:pt-0">
{{ year }}
</h3>
{% for month, availabilities in months %}
<h4 class="pt-2 text-xs font-bold uppercase tracking-wide text-muted">
{{ month }}
</h4>
<ul class="divide-y divide-line">
{% for availability in availabilities %}
<li class="flex items-center justify-between gap-x-4 py-2">
<span>{{ availability }}{% if availability.description %} <span class="text-muted">({{ availability.description }})</span>{% endif %}</span>
{% if selected %}
{% if is_granted('DELETE', availability) %}
<button type="button"
class="text-red-700 hover:text-red-900"
title="Zeitraum entfernen/löschen"
hx-get="{{ path('app_teamer_profile_availability_delete', { 'id': availability.id }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('delete', 'w-5 h-5') }}
</button>
{% endif %}
{% else %}
<a href="{{ path('app_teamer_profile_availability_add', { 'id': availability.id }) }}"
class="text-brand hover:text-brand-dark"
title="Zeitraum hinzufügen">
{{ icon('plus', 'w-5 h-5') }}
</a>
{% endif %}
</li>
{% endfor %}
</ul>
{% endfor %}
{% endfor %}
{% endmacro %}
{% block content %}
<h1 class="text-2xl font-bold pb-4">
Meine Verfügbarkeit
</h1>
<p class="max-w-prose pb-6">
Hier kannst du angeben, wann du allgemein Zeit und Lust hättest, Einsätze zu absolvieren. Wenn wir in diesem
Zeitraum einen Einsatz zu vergeben haben, dann nehmen wir telefonisch oder per E-Mail Kontakt zu dir auf.
</p>
<div class="grid gap-6 lg:grid-cols-2 items-start">
<section class="card p-5">
<h2 class="section-title pb-3">
Ich bin verfügbar
</h2>
{% if selectedAvailabilities is empty %}
<p class="text-muted">Du hast bisher keine Verfügbarkeiten hinterlegt.</p>
{% else %}
{{ _self.periods(selectedAvailabilities, true) }}
{% endif %}
</section>
<section class="card p-5">
<h2 class="section-title pb-3">
Weitere Verfügbarkeiten
</h2>
{% if selectableAvailabilities is empty %}
<p class="pb-4 text-muted">Es sind keine weiteren Zeiträume verfügbar.</p>
{% else %}
<div class="pb-4">
{{ _self.periods(selectableAvailabilities, false) }}
</div>
{% endif %}
<button type="button"
class="btn btn--small btn--secondary"
title="Eigenen Zeitraum hinzufügen"
hx-get="{{ path('app_teamer_profile_availability_create') }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('plus', 'w-4 h-4 shrink-0') }}
<span>Eigenen Zeitraum hinzufügen</span>
</button>
</section>
</div>
{% endblock %}