WIP: Implement document handling

This commit is contained in:
Björn Fromme
2023-10-12 10:41:31 +02:00
parent 3e7ca7e166
commit 46915955b0
18 changed files with 529 additions and 49 deletions
@@ -1,3 +1,15 @@
{% macro collectionRow(form) %}
<div {{ stimulus_target('form-collection', 'field') }}>
<div class="flex items-center space-x-4">
{{ form_widget(form) }}
<button type="button" {{ stimulus_action('form-collection', 'removeItem') }}>
{{ icon('delete', 'w-4 h-4 mt-2 pointer-events-none') }}
</button>
</div>
{{ form_errors(form) }}
</div>
{% endmacro %}
{{ form_start(form) }}
<div class="flex flex-col space-y-4 pb-8">
<div class="grid lg:grid-cols-5 gap-x-8 gap-y-4">
@@ -25,6 +37,22 @@
</div>
<div class="grid lg:grid-cols-2 gap-x-8 gap-y-4">
{{ form_row(form.remarks) }}
<div {{ stimulus_controller('form-collection', { 'prototype': _self.collectionRow(form.documents.vars.prototype)|json_encode }) }}>
<h4 class="font-bold pb-2">
Dokumente
</h4>
<div {{ stimulus_target('form-collection', 'fields')}} class="flex flex-col space-y-4 mb-4">
{% do form.documents.setRendered %}
{%- for document in form.documents -%}{{- _self.collectionRow(document) -}}{%- endfor -%}
</div>
<div class="flex justify-end">
<button type="button"
{{ stimulus_action('form-collection', 'addItem') }}
title="Dokument hinzufügen">
{{ icon('plus', 'w-4 h-4 pointer-events-none') }}
</button>
</div>
</div>
</div>
</div>
<div class="flex items-center space-x-2">