WIP: Implement profile editing

This commit is contained in:
Björn Fromme
2023-10-02 12:39:52 +02:00
parent d776d37cd5
commit 953aa9c8e0
27 changed files with 598 additions and 43 deletions
+5 -21
View File
@@ -2,23 +2,6 @@
{% block title %}Mein Profil{% endblock %}
{% macro formErrors(form) %}
<ul>
{% for child in form.children %}
{% for error in child.vars.errors %}
<li>
{{ 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">
@@ -71,10 +54,10 @@
<div class="lg:col-span-2">
{% if not form.vars.valid %}
<div class="border border-red-500 rounded-md p-4 text-red-500 mb-8">
{{ _self.formErrors(form) }}
{{ _self.formErrors(form.address) }}
{{ _self.formErrors(form.communication) }}
{{ _self.formErrors(form.bankAccount) }}
{% include '_partials/_form_errors.html.twig' with { 'form': form } %}
{% include '_partials/_form_errors.html.twig' with { 'form': form.address } %}
{% include '_partials/_form_errors.html.twig' with { 'form': form.communication } %}
{% include '_partials/_form_errors.html.twig' with { 'form': form.bankAccount } %}
</div>
{% elseif errors|length > 0 %}
<div class="border border-red-500 rounded-md p-4 text-red-500 mb-8">
@@ -183,6 +166,7 @@
{% include '_partials/_upload_collection_form.html.twig' with {
'endpoint_upload': path('_uploader_upload_photo'),
'upload_session_params': form.vars.upload_session_params,
'accepted_files': 'image/jpg,image/jpeg',
} %}
</div>
@@ -0,0 +1,25 @@
{{ form_start(form) }}
{% if not form.vars.valid %}
<div class="border border-red-500 rounded-md p-4 text-red-500 mb-4">
{% include '_partials/_form_errors.html.twig' with { 'form': form } %}
</div>
{% endif %}
<div class="flex flex-col space-y-4 pb-8">
{{ form_row(form.type) }}
{{ form_row(form.date) }}
<div>
<label class="block font-bold pb-2">
Nachweis hochladen (PDF)
</label>
{% include '_partials/_upload_collection_form.html.twig' with {
'endpoint_upload': path('_uploader_upload_certificate'),
'upload_session_params': form.vars.upload_session_params,
'accepted_files': 'application/pdf',
} %}
</div>
</div>
<button type="submit" class="btn">
Speichern
</button>
{{ form_rest(form) }}
{{ form_end(form) }}
+29
View File
@@ -3,4 +3,33 @@
{% block title %}Meine Jobprofile & Skills{% endblock %}
{% block content %}
<h2 class="text-xl font-bold pb-2">
Lizenzen
</h2>
<div class="flex flex-col space-x-4 pb-8">
{% for license in teamer.licenses %}
<div class="flex items-center space-x-2">
{{ icon(license.type, 'w-5 h-5') }}
<span>{{ license.date|date('m.Y') }}</span>
{% if is_granted('DOWNLOAD', license.certificate) %}
<a href="{{ path('app_common_download', { 'uuid': license.certificate.uuid }) }}" target="_blank">
{{ icon('download', 'w-4 h-4') }}
</a>
{% endif %}
</div>
{% else %}
<div class="text-sm pb-8">
Du hast bisher keine Lizenzen hinterlegt
</div>
{% endfor %}
</div>
<button type="button"
class="btn"
{{ stimulus_controller('modal-button', [], [], {'ajax-modal': '#ajax-modal'}) }}
{{ stimulus_action('modal-button', 'ajax', null, {
'title': 'Lizenz hinzufügen',
'url': path('app_teamer_profile_license_add')
}) }}>
Lizenz hinzufügen
</button>
{% endblock %}