WIP: Implement profile editing
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<div class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 px-4 shadow w-full max-w-xl">
|
||||
<div class="bg-white p-8">
|
||||
<div class="flex justify-between pb-4">
|
||||
<div class="text-lg font-medium" {{ stimulus_target('ajax-modal', 'title') }}></div>
|
||||
<div class="text-2xl font-bold" {{ stimulus_target('ajax-modal', 'title') }}></div>
|
||||
<button type="button"
|
||||
class="inline-block"
|
||||
{{ stimulus_action('ajax-modal', 'hide') }}>
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<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>
|
||||
@@ -36,6 +36,8 @@
|
||||
<div class="flex items-center space-x-2">
|
||||
{% for license in jobProfile.requiredLicenses %}
|
||||
{{ icon(license, 'w-5 h-5') }}
|
||||
{% else %}
|
||||
-
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
{%- endblock form_row -%}
|
||||
|
||||
{%- block form_label -%}
|
||||
{% set class = ' font-bold' %}
|
||||
{% set class = 'block font-bold pb-2' %}
|
||||
{% if errors|length %}
|
||||
{% set class = class ~ ' text-red-500' %}
|
||||
{% endif %}
|
||||
@@ -35,7 +35,7 @@
|
||||
{%- block form_widget_simple -%}
|
||||
{%- set type = type|default('text') -%}
|
||||
{%- if type != 'hidden' -%}
|
||||
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' mt-2 block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6')|trim }) -%}
|
||||
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6')|trim }) -%}
|
||||
{%- if errors|length -%}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%}
|
||||
{% else %}
|
||||
@@ -52,7 +52,7 @@
|
||||
{%- endblock form_widget_simple -%}
|
||||
|
||||
{%- block textarea_widget -%}
|
||||
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' mt-2 block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6')|trim }) -%}
|
||||
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6')|trim }) -%}
|
||||
{%- if errors|length -%}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%}
|
||||
{% else %}
|
||||
@@ -68,7 +68,7 @@
|
||||
{%- endblock textarea_widget -%}
|
||||
|
||||
{%- block choice_widget_collapsed -%}
|
||||
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' mt-2 block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6')|trim }) -%}
|
||||
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6')|trim }) -%}
|
||||
{%- if errors|length -%}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%}
|
||||
{% else %}
|
||||
@@ -115,6 +115,19 @@
|
||||
</div>
|
||||
{%- endblock -%}
|
||||
|
||||
{% block abbreviated_date_widget %}
|
||||
{%- set class = 'flex items-center space-x-1 ' ~ attr.class|default('') -%}
|
||||
{%- do form.setRendered -%}
|
||||
{%- if errors|length -%}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%}
|
||||
{%- endif -%}
|
||||
<div class="{{ class }}">
|
||||
{{ form_widget(form.month, { 'attr': attr })}}
|
||||
<span>/</span>
|
||||
{{ form_widget(form.year, { 'attr': attr })}}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{%- block money_widget -%}
|
||||
{% set currency_class = 'absolute top-1/2 transform -translate-y-1/2 right-0 mr-2' %}
|
||||
{% if errors|length %}
|
||||
@@ -127,3 +140,24 @@
|
||||
<span class="{{ currency_class }}">€</span>
|
||||
</div>
|
||||
{%- endblock money_widget -%}
|
||||
|
||||
{%- block datepicker_widget -%}
|
||||
{%- set minDate = form.vars.min_date ? form.vars.min_date | date('Y-m-d') : null -%}
|
||||
{%- set maxDate = form.vars.max_date ? form.vars.max_date | date('Y-m-d') : null -%}
|
||||
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6')|trim }) -%}
|
||||
{%- if errors|length -%}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%}
|
||||
{% else %}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-gray-400 focus:ring-primary' }) -%}
|
||||
{%- endif -%}
|
||||
{%- if disabled is defined and disabled == true -%}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' cursor-not-allowed' }) -%}
|
||||
{%- endif -%}
|
||||
<div {{ stimulus_controller('datepicker', { 'minDate': minDate, 'maxDate': maxDate, 'disableWeekends': form.vars.disable_weekends }) }}>
|
||||
<input type="text" name="{{ form.vars.full_name }}" value="{{ value }}" {{ block('widget_attributes') }}
|
||||
{{ stimulus_target('datepicker', 'field') }} />
|
||||
</div>
|
||||
{%- if disabled is defined and disabled == true -%}
|
||||
<input type="hidden" name="{{ form.vars.full_name }}" value="{{ form.vars.value }}">
|
||||
{%- endif -%}
|
||||
{%- endblock datepicker_widget %}
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
<div class="flex items-center space-x-4">
|
||||
{% if app.user.teamer.photo %}
|
||||
<a href="{{ path('app_teamer_profile_index') }}" title="Mein Profil">
|
||||
<img src="{{ asset(teamer.photo.filename | imagine_filter('profile')) }}"
|
||||
<img src="{{ asset(app.user.teamer.photo.filename | imagine_filter('profile')) }}"
|
||||
class="h-8 w-auto rounded-full border-2 border-primary"
|
||||
alt="{{ teamer.firstName }}">
|
||||
alt="{{ app.user.teamer.firstName }}">
|
||||
</a>
|
||||
{% endif %}
|
||||
<a href="{{ path('app_security_logout') }}" class="hidden lg:block">
|
||||
|
||||
@@ -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) }}
|
||||
@@ -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 %}
|
||||
Reference in New Issue
Block a user