WIP: Extend and improve profile editing

This commit is contained in:
Björn Fromme
2023-10-01 16:39:32 +02:00
parent 6595fbec8a
commit d776d37cd5
27 changed files with 553 additions and 375 deletions
+62 -21
View File
@@ -7,13 +7,30 @@
{% for child in form.children %}
{% for error in child.vars.errors %}
<li>
{{error.message}}
{{ error.message }}
</li>
{% endfor %}
{%endfor%}
{% for error in form.vars.errors %}
<li>
{{ error.message }}
</li>
{% endfor %}
</ul>
{% endmacro %}
{% 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 %}
{% block content %}
{{ form_start(form) }}
@@ -41,7 +58,12 @@
</li>
<li>
<button type="button" class="hover:bg-gray-50 block rounded-md py-2 pr-2 pl-10 w-full text-left text-sm leading-6 font-semibold text-gray-700" {{ stimulus_target('tabs', 'button') }} {{ stimulus_action('tabs', 'select', null, { 'tab': 3 }) }}>
Sonstiges/Foto
Sonstiges
</button>
</li>
<li>
<button type="button" class="hover:bg-gray-50 block rounded-md py-2 pr-2 pl-10 w-full text-left text-sm leading-6 font-semibold text-gray-700" {{ stimulus_target('tabs', 'button') }} {{ stimulus_action('tabs', 'select', null, { 'tab': 4 }) }}>
Foto
</button>
</li>
</ul>
@@ -70,6 +92,7 @@
Persönliche Daten
</h2>
<div class="flex flex-col space-y-4">
{{ form_row(form.status) }}
{{ form_row(form.salutation) }}
{{ form_row(form.academicTitle) }}
{{ form_row(form.firstName) }}
@@ -119,30 +142,48 @@
<div class="flex flex-col space-y-4 pb-8">
{{ form_row(form.taxId) }}
{{ form_row(form.healthInsuranceCompany) }}
{{ form_row(form.language) }}
{{ form_row(form.size) }}
{{ form_row(form.remarks) }}
</div>
<div {{ stimulus_controller('form-collection', { 'prototype': _self.collectionRow(form.pickups.vars.prototype)|json_encode }) }}>
<h4 class="font-bold">
Buszustiege
</h4>
<div {{ stimulus_target('form-collection', 'fields')}} class="flex flex-col space-y-4 mb-4">
{% do form.pickups.setRendered %}
{%- for pickup in form.pickups -%}{{- _self.collectionRow(pickup) -}}{%- endfor -%}
</div>
<div class="flex justify-end">
<button type="button"
{{ stimulus_action('form-collection', 'addItem') }}
title="Zustieg hinzufügen">
{{ icon('plus', 'w-4 h-4 pointer-events-none') }}
</button>
</div>
</div>
</div>
<div class="pb-8" {{ stimulus_target('tabs', 'tab') }}>
{% if teamer.photo %}
<div class="pb-8">
<h2 class="text-xl font-bold pb-2">
Mein Foto
</h2>
<img src="{{ asset(teamer.photo.filename | imagine_filter('profile')) }}"
class="w-48 h-auto border-2 border-primary"
alt="{{ teamer.firstName }}">
</div>
{% endif %}
<h2 class="text-xl font-bold pb-2">
Fotoupload
</h2>
<div class="grid md:grid-cols-2 gap-8">
<div>
{% include '_partials/_upload_collection_form.html.twig' with {
'endpoint_upload': path('_uploader_upload_photo'),
'upload_session_params': form.vars.upload_session_params,
} %}
</div>
<div>
{% if teamer.photo %}
<img src="{{ asset(teamer.photo.filename | imagine_filter('profile')) }}"
class="w-full h-auto rounded-full border-2 border-primary"
alt="{{ teamer.firstName }}">
{% else %}
<svg class="w-full h-auto text-gray-300" viewBox="0 0 10 10" fill="currentColor">
<circle r="5" cx="5" cy="5"/>
</svg>
{% endif %}
</div>
</div>
{% include '_partials/_upload_collection_form.html.twig' with {
'endpoint_upload': path('_uploader_upload_photo'),
'upload_session_params': form.vars.upload_session_params,
} %}
</div>
<button type="submit" class="btn">