feat: additional receipts as attachments to teamer invoices

addresses #869dv97u9
This commit is contained in:
2026-09-09 11:10:57 +02:00
parent 16d847137d
commit 52926ec6cc
29 changed files with 682 additions and 23 deletions
+47
View File
@@ -0,0 +1,47 @@
{# Belege backing the Honorarnote. Rendered both while the invoice can still be uploaded and while
it is being checked - the window is MANAGE_RECEIPTS, not a workflow transition. Must not be
placed inside the invoice form: the triggers below are their own forms. #}
{% set receipts = disposition.documentsByType('receipt') %}
<div class="pt-8">
<h3 class="text-lg font-bold pb-2">
Belege
</h3>
<div class="text-sm pb-4">
Hast du Auslagen in deiner Honorarnote aufgeführt? Dann lade die zugehörigen Belege hier
hoch. Sie werden nach der Prüfung deiner Honorarnote automatisch gelöscht.
</div>
<ul class="list-disc pl-4 pb-4">
{% for receipt in receipts %}
<li>
<div class="flex items-center space-x-4">
<span>{{ receipt }}</span>
<a href="{{ path('app_common_download', { 'uuid': receipt.uuid, 'inline': true }) }}"
target="_blank"
title="Beleg öffnen">
{{ icon('download', 'w-4 h-4') }}
</a>
<button type="button"
class="text-red-500"
title="Beleg löschen"
hx-get="{{ path('app_teamer_disposition_receipt_delete', { 'uuid': receipt.uuid }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('delete', 'w-4 h-4') }}
</button>
</div>
</li>
{% else %}
<li class="text-sm">
Du hast bisher keine Belege hochgeladen
</li>
{% endfor %}
</ul>
<button type="button"
class="btn"
title="Beleg hinzufügen"
hx-get="{{ path('app_teamer_disposition_receipt_upload', { 'uuid': disposition.uuid }) }}"
hx-target="body"
hx-swap="beforeend">
Belege hinzufügen
</button>
</div>
@@ -13,6 +13,26 @@
</h2>
{{ icon('eye') }}
</a>
{# Belege backing this Honorarnote. Opened inline so the download route does not mark them
as downloaded - that marking is meant for the invoice itself. They are deleted as soon as
the invoice is accepted. #}
{% if receipts is not empty %}
<div class="pb-4">
<div class="font-bold pb-1">Belege</div>
<ul class="list-disc pl-4">
{% for receipt in receipts %}
<li>
<a href="{{ path('app_common_download', { 'uuid': receipt.uuid, 'inline': true }) }}"
target="_blank"
class="underline"
title="Beleg öffnen">
{{ receipt }}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
<div class="flex flex-col space-y-4 pb-4">
{{ form_row(form.status) }}
{% if form.specialAgreements is defined %}
@@ -122,6 +122,11 @@
<twig:MessageBox message="{{ blocker.message }}"/>
{% endfor %}
{% endif %}
{# Outside the invoice form above - the receipt triggers are their own forms. #}
{% if is_granted('MANAGE_RECEIPTS', disposition) %}
{% include '_partials/_receipts.html.twig' %}
{% endif %}
{% endif %}
{# Contract uploaded #}
@@ -189,6 +194,10 @@
</div>
{% endif %}
{% endif %}
{% if is_granted('MANAGE_RECEIPTS', disposition) %}
{% include '_partials/_receipts.html.twig' %}
{% endif %}
{% endif %}
{# Invoice paid #}
@@ -0,0 +1,7 @@
{% extends 'htmx_confirmation_modal.html.twig' %}
{% block content %}
<div>
Möchtest du den Beleg <em>{{ receipt }}</em> wirklich löschen?
</div>
{% endblock %}
@@ -0,0 +1,24 @@
{% extends 'htmx_modal.html.twig' %}
{% block title %}Belege 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 die Belege zu den Auslagen hoch, die du in deiner Honorarnote aufführst.
</div>
<div class="pb-4">
{% include '_partials/_upload_collection_form.html.twig' with {
'endpoint_upload': path('_uploader_upload_receipt'),
'max_filesize': 5,
'max_files': 10,
'accepted_files': 'image/jpg,image/jpeg,application/pdf',
} %}
</div>
<button type="submit" class="btn" {{ stimulus_target('form-upload-guard', 'submit') }}>
Belege speichern
</button>
{{ form_rest(form) }}
{{ form_end(form) }}
{% endblock %}