feat: import work hours from SaaS and exchange signed time sheet

This commit is contained in:
fromme committed 2026-09-26 12:13:59 +02:00
1 parent 7cf39850e6
commit 1a7c272414
73 files changed
+10488 -72

No files matched your search

+146
View File
@@ -0,0 +1,146 @@
{% extends 'admin/layout.html.twig' %}
{% block title %}Arbeitszeiten{% endblock %}
{% block content %}
<div class="flex items-start justify-between pb-4">
<h1 class="text-2xl font-bold">
Arbeitszeiten
</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="Arbeitszeiten filtern"
hx-get="{{ path('app_common_work_month_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 %}
<a href="{{ path('app_common_work_month_filter_reset', { 'r': return_url() }) }}" class="btn btn--small btn--secondary">
Reset
</a>
{% endif %}
</div>
</div>
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
<th>{{ knp_pagination_sortable(pagination, 'Name', 'teamer.lastName') }}</th>
<th>Vorname</th>
<th>{{ knp_pagination_sortable(pagination, 'Monat', 'work_month.year') }}</th>
<th class="text-right">Stunden</th>
<th>Status</th>
<th>Nachweis</th>
<th></th>
</tr>
</thead>
<tbody>
{% for workMonth in pagination %}
<tr>
<td>
<a href="{{ path('app_administrative_teamer_profile', { 'uuid': workMonth.teamer.uuid, 'r': return_url() }) }}">
<span class="whitespace-nowrap">{{ workMonth.teamer.lastName }}</span>
</a>
</td>
<td>
<span class="whitespace-nowrap">{{ workMonth.teamer.firstName }}</span>
</td>
<td>
<span class="whitespace-nowrap">{{ workMonth.periodLabel }}</span>
</td>
<td class="text-right">
<span class="whitespace-nowrap">{{ workMonth.totalMinutes|duration_hm }}</span>
{% if workMonth.hasMismatch %}
<div class="text-xs text-red-600 whitespace-nowrap"
title="Die SaaS meldet inzwischen andere Stunden für diesen bereits eingereichten Monat.">
jetzt {{ workMonth.mismatchTotalMinutes|duration_hm }}
</div>
{% endif %}
{% if workMonth.warnings is not empty %}
<div class="text-xs text-amber-700 whitespace-nowrap"
title="{{ workMonth.warnings|join(' | ') }}">
{{ workMonth.warnings|length }} Hinweis(e)
</div>
{% endif %}
</td>
<td>
<span class="upload-status-badge {{ workMonth.status.badgeClass }}">
{{ workMonth.status.label }}
</span>
</td>
<td>
{% if workMonth.currentDocument %}
<a href="{{ path('app_common_download', { 'uuid': workMonth.currentDocument.uuid }) }}"
class="flex items-center space-x-1">
{{ icon('download', 'w-4 h-4 shrink-0') }}
<span class="whitespace-nowrap">{{ workMonth.submittedAt|date('d.m.Y') }}</span>
</a>
{% else %}
<span class="text-gray-400">–</span>
{% endif %}
</td>
<td>
<twig:DropDown>
<a href="{{ path('app_admin_work_month_pdf', { 'uuid': workMonth.uuid }) }}"
class="text-gray-700 hover:text-primary block px-4 py-2 text-sm"
role="menuitem"
tabindex="-1"
target="_blank">
Nachweis ansehen
</a>
{% if workMonth.status.value == 'submitted' %}
<a href="{{ path('app_admin_work_month_review', { 'uuid': workMonth.uuid, 'r': return_url() }) }}"
class="text-gray-700 hover:text-primary block px-4 py-2 text-sm"
role="menuitem"
tabindex="-1"
hx-get="{{ path('app_admin_work_month_review', { 'uuid': workMonth.uuid, 'r': return_url() }) }}"
hx-target="body"
hx-swap="beforeend">
Prüfen
</a>
{% endif %}
<form method="post" action="{{ path('app_admin_work_month_sync', { 'uuid': workMonth.uuid, 'r': return_url() }) }}">
<button type="submit"
class="w-full text-left text-gray-700 hover:text-primary block px-4 py-2 text-sm"
role="menuitem"
tabindex="-1">
Erneut abrufen
</button>
</form>
{% if workMonth.status.value in ['submitted', 'approved'] %}
<form method="post" action="{{ path('app_admin_work_month_unlock', { 'uuid': workMonth.uuid, 'r': return_url() }) }}">
<button type="submit"
class="w-full text-left text-gray-700 hover:text-primary block px-4 py-2 text-sm"
role="menuitem"
tabindex="-1"
onclick="return confirm('Der Monat wird wieder geöffnet und muss neu unterschrieben werden. Fortfahren?')">
Wieder öffnen
</button>
</form>
{% endif %}
</twig:DropDown>
</td>
</tr>
{% else %}
<tr>
<td colspan="7" class="text-gray-500">
Keine Arbeitszeiten gefunden.
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{{ knp_pagination_render(pagination) }}
{% endblock %}
@@ -0,0 +1,49 @@
{% extends 'htmx_modal.html.twig' %}
{% block title %}Arbeitszeitnachweis prüfen{% endblock %}
{% block content %}
{{ form_start(form, { 'attr': { 'hx-post': app.request.uri, 'hx-target': '#htmx-modal', 'hx-swap': 'outerHTML' } }) }}
<div class="pb-4">
<div class="font-bold">
{{ workMonth.teamer }} &middot; {{ workMonth.periodLabel }}
</div>
<div class="text-sm text-gray-500">
{{ workMonth.totalMinutes|duration_hm }} Stunden an {{ workMonth.workedDays }} Tagen,
eingereicht am {{ workMonth.submittedAt|date('d.m.Y') }}
</div>
{% if workMonth.hasMismatch %}
<div class="text-sm text-red-600 pt-2">
Achtung: die SaaS meldet für diesen Monat inzwischen
{{ workMonth.mismatchTotalMinutes|duration_hm }} Stunden.
</div>
{% endif %}
</div>
<div class="flex flex-col space-y-1 pb-4">
{% if workMonth.currentDocument %}
<a href="{{ path('app_common_download', { 'uuid': workMonth.currentDocument.uuid }) }}"
class="flex items-center space-x-1">
{{ icon('download') }}
<span class="flex-shrink-0">Hochgeladenen Nachweis ansehen</span>
</a>
{% endif %}
<a href="{{ path('app_admin_work_month_pdf', { 'uuid': workMonth.uuid }) }}"
class="flex items-center space-x-1"
target="_blank">
{{ icon('pdf') }}
<span class="flex-shrink-0">Nachweis aus den Daten erzeugen</span>
</a>
</div>
<div class="flex flex-col space-y-2 pb-4">
{{ form_row(form.status) }}
{{ form_row(form.comment) }}
</div>
<button type="submit" class="btn">
Speichern
</button>
{{ form_rest(form) }}
{{ form_end(form) }}
{% endblock %}
@@ -0,0 +1,20 @@
{% extends 'htmx_modal.html.twig' %}
{% block title %}Arbeitszeiten filtern{% endblock %}
{% block content %}
{{ form_start(filterForm, { 'attr': { 'hx-post': app.request.uri, 'hx-target': '#htmx-modal', 'hx-swap': 'outerHTML'} }) }}
<div class="flex flex-col space-y-2 pb-2">
{{ form_row(filterForm.teamerName) }}
{{ form_row(filterForm.period) }}
{{ form_row(filterForm.statuses) }}
{{ form_row(filterForm.includeApproved) }}
{{ form_row(filterForm.includeMismatchedOnly) }}
</div>
<div class="flex items-center space-x-2">
{{ form_widget(filterForm.apply, { 'attr': { 'class': 'btn' } }) }}
{{ form_widget(filterForm.reset, { 'attr': { 'class': 'btn btn--secondary' } }) }}
</div>
{{ form_rest(filterForm) }}
{{ form_end(filterForm) }}
{% endblock %}
+139
View File
@@ -0,0 +1,139 @@
{#
The Arbeitszeitnachweis: one month of working time for one teamer, to be printed,
signed and uploaded again.
Rendered by App\Service\Pdf\WorkMonthRenderer through Dompdf, not by the FPDI renderers
the contract and the invoice use - a table of 28 to 31 rows is exactly what coordinate
stamping cannot do. Styles have to be inline and simple: Dompdf supports little beyond
CSS 2.1, and nothing may be loaded from outside the document.
#}
<style>
@page { margin: 18mm 15mm 20mm 15mm; }
body { font-family: "DejaVu Sans", sans-serif; font-size: 9pt; color: #000; }
h1 { font-size: 14pt; margin: 0 0 2mm 0; }
/* A table rather than a float: Dompdf lays tables out reliably, floats less so. */
table.letterhead { width: 100%; border-collapse: collapse; margin-bottom: 4mm; }
table.letterhead td { padding: 0; vertical-align: top; }
table.letterhead td.mark { text-align: right; width: 42mm; }
table.letterhead img { width: 38mm; height: 11.6mm; }
.meta { width: 100%; margin-bottom: 6mm; font-size: 9pt; }
.meta td { padding: 0.6mm 0; vertical-align: top; }
.meta .label { color: #444; width: 32mm; }
table.days { width: 100%; border-collapse: collapse; }
table.days th,
table.days td { border: 0.3pt solid #999; padding: 1.2mm 1.6mm; }
table.days th { background-color: #eee; font-size: 8.5pt; text-align: left; }
table.days td.num { text-align: right; }
table.days tr.weekend td { background-color: #f6f6f6; }
table.days tr.total td { font-weight: bold; background-color: #eee; }
.signature { margin-top: 14mm; }
.signature td { padding-top: 12mm; font-size: 8pt; color: #444; }
.signature .line { border-top: 0.4pt solid #000; width: 70mm; }
.note { margin-top: 6mm; font-size: 7.5pt; color: #555; }
</style>
<table class="letterhead">
<tr>
<td><h1>Arbeitszeitnachweis</h1></td>
<td class="mark">
{% if logo|default(null) %}
<img src="{{ logo }}" alt="E&amp;P Reisen Events">
{% endif %}
</td>
</tr>
</table>
<table class="meta">
<tr>
<td class="label">Teamer:in</td>
<td>{{ teamer.fullName }}</td>
</tr>
{% if workMonth.department %}
<tr>
<td class="label">Abteilung</td>
<td>{{ workMonth.department }}</td>
</tr>
{% endif %}
<tr>
<td class="label">Monat</td>
<td>{{ workMonth.period|format_datetime(pattern='LLLL yyyy', locale='de') }}</td>
</tr>
<tr>
<td class="label">Sollstunden</td>
<td>{{ workMonth.targetMinutes|duration_hm }}</td>
</tr>
<tr>
<td class="label">Iststunden</td>
<td><strong>{{ workMonth.totalMinutes|duration_hm }}</strong></td>
</tr>
<tr>
<td class="label">Saldo</td>
<td>{{ workMonth.balanceMinutes > 0 ? '+' : '' }}{{ workMonth.balanceMinutes|duration_hm }}</td>
</tr>
<tr>
<td class="label">Pausen gesamt</td>
<td>{{ workMonth.breakMinutes|duration_hm }}</td>
</tr>
<tr>
<td class="label">Arbeitstage</td>
<td>{{ workMonth.workedDays }}{% if workMonth.absenceDays > 0 %}, freie Tage: {{ workMonth.absenceDays }}{% endif %}</td>
</tr>
</table>
<table class="days">
<thead>
<tr>
<th style="width: 21mm;">Datum</th>
<th style="width: 13mm;">Tag</th>
<th style="width: 15mm;">Beginn</th>
<th style="width: 15mm;">Ende</th>
<th style="width: 15mm;">Pause</th>
<th style="width: 18mm;">Stunden</th>
<th>Abwesenheit</th>
</tr>
</thead>
<tbody>
{% for day in days %}
<tr{% if day.weekend %} class="weekend"{% endif %}>
<td>{{ day.date|date('d.m.Y') }}</td>
<td>{{ day.date|format_datetime(pattern='EEE', locale='de') }}</td>
<td class="num">{{ day.startTime ?? '' }}</td>
<td class="num">{{ day.endTime ?? '' }}</td>
<td class="num">{{ day.breakMinutes > 0 ? day.breakMinutes|duration_hm : '' }}</td>
<td class="num">{{ day.minutes|duration_hm }}</td>
<td>{{ day.absence ?? '' }}</td>
</tr>
{% endfor %}
<tr class="total">
<td colspan="4">Gesamt</td>
<td class="num">{{ workMonth.breakMinutes|duration_hm }}</td>
<td class="num">{{ workMonth.totalMinutes|duration_hm }}</td>
<td></td>
</tr>
</tbody>
</table>
<table class="signature">
<tr>
<td style="width: 50%;">
<div class="line"></div>
Ort, Datum
</td>
<td style="width: 50%;">
<div class="line"></div>
Unterschrift {{ teamer.fullName }}
</td>
</tr>
</table>
<p class="note">
Bitte den Nachweis unterschrieben wieder im Team-Portal hochladen.
Stand der Daten: {{ workMonth.syncedAt|date('d.m.Y H:i') }} Uhr.
</p>
@@ -0,0 +1,80 @@
{% extends 'teamer/layout.html.twig' %}
{% block title %}Arbeitszeiten{% endblock %}
{% block content %}
<div class="max-w-screen-md mx-auto">
<h1 class="text-2xl font-bold pb-2">
Arbeitszeiten
</h1>
<p class="pb-8 text-gray-700">
Hier findest du für jeden abgerechneten Monat deinen Arbeitszeitnachweis.
Bitte lade ihn herunter, unterschreibe ihn und lade ihn anschließend wieder hoch.
</p>
{% if workMonths is empty %}
<div class="text-gray-500">
Es liegen noch keine Arbeitszeiten vor. Ein Monat erscheint hier, sobald er
abgerechnet wurde.
</div>
{% else %}
<dl class="divide-y divide-gray-100">
{% for workMonth in workMonths %}
<div class="py-6 first:pt-0 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="font-bold leading-6 text-gray-900">
{{ workMonth.period|format_datetime(pattern='LLLL yyyy', locale='de') }}
<div class="text-sm font-normal text-gray-500">
{{ workMonth.totalMinutes|duration_hm }} Stunden
an {{ workMonth.workedDays }} Tagen
</div>
</dt>
<dd class="mt-1 text-sm leading-6 sm:mt-0 sm:col-span-2">
<div class="pb-2">
<span class="upload-status-badge {{ workMonth.status.badgeClass }}">
{{ workMonth.status.label }}
</span>
</div>
{% if workMonth.status.value == 'rejected' and workMonth.reviewComment %}
<div class="pb-2 text-red-600">
{{ workMonth.reviewComment }}
</div>
{% endif %}
<div class="flex flex-col space-y-1">
<a href="{{ path('app_teamer_work_month_pdf', { 'uuid': workMonth.uuid }) }}"
class="flex items-center space-x-1">
{{ icon('download') }}
<span class="flex-shrink-0">Nachweis herunterladen</span>
</a>
{% if workMonth.status.value != 'approved' %}
<a href="{{ path('app_teamer_work_month_upload', { 'uuid': workMonth.uuid }) }}"
class="flex items-center space-x-1"
hx-get="{{ path('app_teamer_work_month_upload', { 'uuid': workMonth.uuid }) }}"
hx-target="#htmx-modal"
hx-swap="outerHTML">
{{ icon('upload') }}
<span class="flex-shrink-0">
{{ workMonth.currentDocument ? 'Erneut hochladen' : 'Unterschrieben hochladen' }}
</span>
</a>
{% endif %}
{% if workMonth.currentDocument %}
<a href="{{ path('app_common_download', { 'uuid': workMonth.currentDocument.uuid }) }}"
class="flex items-center space-x-1 text-gray-500">
{{ icon('document') }}
<span class="flex-shrink-0">
Hochgeladen am {{ workMonth.submittedAt|date('d.m.Y') }}
</span>
</a>
{% endif %}
</div>
</dd>
</div>
{% endfor %}
</dl>
{% endif %}
</div>
{% endblock %}
@@ -0,0 +1,26 @@
{% extends 'htmx_modal.html.twig' %}
{% block title %}Arbeitszeitnachweis hochladen{% endblock %}
{% block content %}
{% set formAttr = stimulus_controller('form-upload-guard')|stimulus_action('form-upload-guard', 'guard', 'submit') %}
{{ form_start(form, { 'attr': { 'hx-post': app.request.uri, 'hx-target': '#htmx-modal', 'hx-swap': 'outerHTML' }|merge(formAttr.toArray()) }) }}
<div class="pb-4">
Lade hier deinen unterschriebenen Arbeitszeitnachweis für
{{ workMonth.period|format_datetime(pattern='LLLL yyyy', locale='de') }} hoch.
Ein Foto genügt, solange alles lesbar ist.
</div>
<div class="pb-4">
{% include '_partials/_upload_collection_form.html.twig' with {
'endpoint_upload': path('_uploader_upload_work_month'),
'max_filesize': 5,
'max_files': 2,
'accepted_files': 'image/jpg,image/jpeg,application/pdf',
} %}
</div>
<button type="submit" class="btn" {{ stimulus_target('form-upload-guard', 'submit') }}>
Nachweis speichern
</button>
{{ form_rest(form) }}
{{ form_end(form) }}
{% endblock %}