feat: redesign the timeline as day columns with a bar per placement
This commit is contained in:
1 parent
4e50f23558
commit
e976342c09
8 files changed
+413
-190
No files matched your search
@@ -2,129 +2,138 @@
|
||||
|
||||
{% block title %}Zeitleiste{% endblock %}
|
||||
|
||||
{% macro cell(item, colspan) %}
|
||||
<td class="{{ html_classes('border border-gray-700', {
|
||||
'bg-gray-100': item.state == 'open',
|
||||
'bg-blue-500 text-gray-50': item.state == 'pending',
|
||||
'bg-green-500 text-gray-50': item.state == 'staffed',
|
||||
}) }}" colspan="{{ colspan }}">
|
||||
{% if item.type == 'disposition' %}
|
||||
<div class="flex items-center space-x-2">
|
||||
{% if is_granted('ROLE_HOUSE_MANAGER') %}
|
||||
<span class="inline-block text-xs font-semibold">{{ item.jobProfile }}</span>
|
||||
{% else %}
|
||||
<a href="{{ path('app_administrative_assignment_detail', { 'uuid': item.assignmentUuid, 'r': return_url() }) }}"
|
||||
class="inline-block text-xs font-semibold">
|
||||
{{ item.jobProfile }}
|
||||
</a>
|
||||
{% endif %}
|
||||
<span>|</span>
|
||||
<button type="button"
|
||||
class="flex items-center space-x-2"
|
||||
title="Teamer:inneninfo {{ item.teamerName }}"
|
||||
hx-get="{{ path('app_administrative_teamer_info', { 'uuid': item.teamerUuid, 'r': return_url() }) }}"
|
||||
hx-target="body"
|
||||
hx-swap="beforeend">
|
||||
<span class="text-xs font-semibold">{{ item.teamerName }}</span>
|
||||
</button>
|
||||
</div>
|
||||
{% else %}
|
||||
{% if is_granted('ROLE_HOUSE_MANAGER') %}
|
||||
<span class="text-xs font-semibold">{{ item.jobProfile }}</span>
|
||||
{% else %}
|
||||
<a href="{{ path('app_administrative_assignment_detail', { 'uuid': item.assignmentUuid, 'r': return_url() }) }}"
|
||||
class="text-xs font-semibold">
|
||||
{{ item.jobProfile }}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% set state_labels = { open: 'offen', pending: 'in Bewerbung', staffed: 'besetzt' } %}
|
||||
|
||||
{% macro bar(item, row, state_labels) %}
|
||||
{% set is_disposition = item.type == 'disposition' %}
|
||||
<div class="timeline-bar timeline-bar--{{ item.state }}"
|
||||
style="grid-row: {{ row }}; grid-column: {{ item.column + 1 }} / span {{ item.span }}"
|
||||
title="{{ item.jobProfile }}{{ is_disposition ? ' · ' ~ item.teamerName }} · {{ item.dateRange }} · {{ state_labels[item.state] }}">
|
||||
<span class="sr-only">{{ state_labels[item.state] }}:</span>
|
||||
{% if not is_disposition and item.state == 'open' %}
|
||||
<span class="font-bold uppercase">offen</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% if is_granted('ROLE_HOUSE_MANAGER') %}
|
||||
<span class="truncate">{{ item.jobProfile }}</span>
|
||||
{% else %}
|
||||
<a href="{{ path('app_administrative_assignment_detail', { 'uuid': item.assignmentUuid, 'r': return_url() }) }}"
|
||||
class="truncate hover:underline">{{ item.jobProfile }}</a>
|
||||
{% endif %}
|
||||
{% if is_disposition %}
|
||||
<span aria-hidden="true">·</span>
|
||||
<button type="button"
|
||||
class="truncate font-bold hover:underline"
|
||||
title="Teamer:inneninfo {{ item.teamerName }}"
|
||||
hx-get="{{ path('app_administrative_teamer_info', { 'uuid': item.teamerUuid, 'r': return_url() }) }}"
|
||||
hx-target="body"
|
||||
hx-swap="beforeend">{{ item.teamerName }}</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% block content %}
|
||||
<div class="flex items-start justify-between pb-4">
|
||||
<h1 class="text-2xl font-bold">
|
||||
Zeitleiste
|
||||
</h1>
|
||||
<div class="flex flex-col items-end space-y-2 md:flex-row md:items-center md:space-x-2 md:space-y-0">
|
||||
<button type="button"
|
||||
class="{{ html_classes('btn btn--small', { 'btn--secondary': filterDto.active }) }}"
|
||||
title="Filter"
|
||||
hx-get="{{ path('app_common_timeline_filter', { 'r': return_url() }) }}"
|
||||
hx-target="body"
|
||||
hx-swap="beforeend">
|
||||
{{ icon('filter', 'w-4 h-4 shrink-0') }}
|
||||
<div {{ stimulus_controller('timeline-scroll') }}>
|
||||
<div class="flex items-start justify-between pb-4">
|
||||
<h1 class="text-2xl font-bold">
|
||||
Zeitleiste
|
||||
</h1>
|
||||
<div class="flex flex-col items-end space-y-2 md:flex-row md:items-center md:space-x-2 md:space-y-0">
|
||||
<button type="button"
|
||||
class="btn btn--small btn--secondary"
|
||||
{{ stimulus_action('timeline-scroll', 'scrollToToday') }}>
|
||||
{{ icon('calendar', 'w-4 h-4 shrink-0') }}
|
||||
<span>Heute</span>
|
||||
</button>
|
||||
<button type="button"
|
||||
class="{{ html_classes('btn btn--small', { 'btn--secondary': filterDto.active }) }}"
|
||||
title="Filter"
|
||||
hx-get="{{ path('app_common_timeline_filter', { 'r': return_url() }) }}"
|
||||
hx-target="body"
|
||||
hx-swap="beforeend">
|
||||
{{ icon('filter', 'w-4 h-4 shrink-0') }}
|
||||
{% if filterDto.active %}
|
||||
<span class="whitespace-nowrap">{{ filterDto.activeFiltersCount }} Filter aktiv</span>
|
||||
{% else %}
|
||||
<span>Filter</span>
|
||||
{% endif %}
|
||||
</button>
|
||||
{% if filterDto.active %}
|
||||
<span class="whitespace-nowrap">{{ filterDto.activeFiltersCount }} Filter aktiv</span>
|
||||
{% else %}
|
||||
<span>Filter</span>
|
||||
<a href="{{ path('app_common_timeline_filter_reset', { 'r': return_url() }) }}" class="btn btn--small btn--secondary">
|
||||
Reset
|
||||
</a>
|
||||
{% endif %}
|
||||
</button>
|
||||
{% if filterDto.active %}
|
||||
<a href="{{ path('app_common_timeline_filter_reset', { 'r': return_url() }) }}" class="btn btn--small btn--secondary">
|
||||
Reset
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="scroll-container border border-gray-300 mb-4" {{ stimulus_controller('timeline-scroll') }}>
|
||||
<table>
|
||||
<tr class="[&_th]:sticky [&_th]:top-0 [&_th]:z-10">
|
||||
<th></th>
|
||||
{% for day in filterDto.period %}
|
||||
<th{% if day|date('Y-m-d') == 'now'|date('Y-m-d') %} {{ stimulus_target('timeline-scroll', 'today') }}{% endif %}>
|
||||
{{ day | date('d.m.Y') }}
|
||||
</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% for hotelCode, rows in data %}
|
||||
<tr class="border-t-2 border-gray-700">
|
||||
<td class="border border-gray-700 bg-gray-200 align-middle font-bold sticky left-0 z-10" rowspan="{{ rows | length }}">
|
||||
{{ hotelCode }}
|
||||
</td>
|
||||
{% for day in filterDto.period %}
|
||||
{% if colspan is defined and colspan > 1 %}
|
||||
{% set colspan = colspan - 1 %}
|
||||
{% elseif rows[0][day|date('Ymd')] is defined %}
|
||||
{% set item = rows[0][day|date('Ymd')] %}
|
||||
{% set colspan = item.numberOfDays %}
|
||||
{{ _self.cell(item, colspan) }}
|
||||
{% else %}
|
||||
<td class="border border-gray-700"></td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% for row in rows[1:] %}
|
||||
<tr>
|
||||
{% for day in filterDto.period %}
|
||||
{% if colspan is defined and colspan > 1 %}
|
||||
{% set colspan = colspan - 1 %}
|
||||
{% elseif row[day|date('Ymd')] is defined %}
|
||||
{% set item = row[day|date('Ymd')] %}
|
||||
{% set colspan = item.numberOfDays %}
|
||||
{{ _self.cell(item, colspan) }}
|
||||
{% else %}
|
||||
<td class="border border-gray-700"></td>
|
||||
|
||||
{% if houses is empty %}
|
||||
<div class="card p-4 mb-4 text-muted">Keine Ergebnisse</div>
|
||||
{% else %}
|
||||
<div class="timeline card mb-4"
|
||||
style="--timeline-days: {{ calendar.days|length }}"
|
||||
{{ stimulus_target('timeline-scroll', 'scroller') }}>
|
||||
<div class="relative w-max min-w-full">
|
||||
{# weekends, month boundaries and today, behind the bars #}
|
||||
<div class="timeline-grid timeline-background" aria-hidden="true">
|
||||
{% for day in calendar.days %}
|
||||
{% if day.weekend or day.today or day.monthStart %}
|
||||
<div class="{{ html_classes({
|
||||
'bg-page': day.weekend,
|
||||
'border-l border-slate-300': day.monthStart and day.column > 1,
|
||||
}) }}" style="grid-column: {{ day.column + 1 }}">
|
||||
{% if day.today %}
|
||||
<div class="mx-auto h-full w-0.5 bg-brand-bright"></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<td colspan="{{ filterDto.period | length }}">
|
||||
Keine Ergebnisse
|
||||
</td>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
<div class="flex space-x-2">
|
||||
<div class="flex items-center space-x-2 bg-gray-100 px-4 py-1">
|
||||
<span>Bedarf</span>
|
||||
</div>
|
||||
<div class="flex items-center space-x-2 bg-blue-500 text-gray-50 px-4 py-1">
|
||||
<span>in Bewerbung</span>
|
||||
</div>
|
||||
<div class="flex items-center space-x-2 bg-green-500 text-gray-50 px-4 py-1">
|
||||
<span>besetzt</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="timeline-grid timeline-header">
|
||||
<div class="timeline-corner" style="grid-row: 1 / span 2"></div>
|
||||
{% for month in calendar.months %}
|
||||
<div class="{{ html_classes('truncate px-2 py-1 text-xs font-bold uppercase tracking-wide text-brand', { 'border-l border-slate-300': not loop.first }) }}"
|
||||
style="grid-row: 1; grid-column: {{ month.column + 1 }} / span {{ month.span }}">
|
||||
{{ month.label }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% for day in calendar.days %}
|
||||
<div class="{{ html_classes('flex flex-col items-center py-1 text-[11px] leading-tight', {
|
||||
'text-muted': day.weekend and not day.today,
|
||||
'bg-brand-bright text-white font-bold': day.today,
|
||||
}) }}"
|
||||
style="grid-row: 2; grid-column: {{ day.column + 1 }}"
|
||||
{% if day.today %}{{ stimulus_target('timeline-scroll', 'today') }}{% endif %}>
|
||||
<span class="font-bold">{{ day.date.day }}</span>
|
||||
<span>{{ day.date.isoFormat('dd') }}</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% for house in houses %}
|
||||
<div class="timeline-grid timeline-house">
|
||||
<div class="timeline-house-label" style="grid-row: 1 / span {{ house.rows|length }}">
|
||||
<span class="block truncate font-bold">{{ house.name ?? house.code }}</span>
|
||||
<span class="block text-xs text-muted">
|
||||
{{ house.code }}{% if house.openSlots > 0 %} · <span class="font-bold text-ink">{{ house.openSlots }} offen</span>{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
{% for row in house.rows %}
|
||||
{% set row_number = loop.index %}
|
||||
{% for item in row %}
|
||||
{{ _self.bar(item, row_number, state_labels) }}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<ul class="flex flex-wrap gap-x-6 gap-y-2 text-xs" aria-label="Legende">
|
||||
<li class="flex items-center gap-x-2"><span class="timeline-bar timeline-bar--staffed w-10 h-5"></span> besetzt</li>
|
||||
<li class="flex items-center gap-x-2"><span class="timeline-bar timeline-bar--pending w-10 h-5"></span> in Bewerbung oder Vertrag in Prüfung</li>
|
||||
<li class="flex items-center gap-x-2"><span class="timeline-bar timeline-bar--open w-10 h-5"></span> offen, noch keine Bewerbung</li>
|
||||
<li class="flex items-center gap-x-2"><span class="inline-block h-5 w-0.5 bg-brand-bright"></span> heute</li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user