WIP: Implement teamer dashboard

This commit is contained in:
Björn Fromme
2023-11-12 16:41:28 +01:00
parent f8207b6731
commit 286064c739
12 changed files with 335 additions and 196 deletions
@@ -0,0 +1,69 @@
{% extends 'teamer/layout.html.twig' %}
{% block title %}Einsatzübersicht{% endblock %}
{% block content %}
<h1 class="text-2xl font-bold pb-8">
Einsatzübersicht
</h1>
<div class="grid lg:grid-cols-2 gap-8 items-start">
{% include '_partials/_assignment_info.html.twig' %}
<div>
<h2 class="text-xl font-bold pb-2">
Voraussetzungen für diesen Einsatz
</h2>
{% include '_partials/_assignment_requirements_info.html.twig' %}
<div class="flex flex-col items-start space-y-4">
{% if disposition is not null %}
{% include '_partials/_infobox.html.twig' with {
'message': 'Du wurdest am ' ~ disposition.createdAt|date('d.m.Y') ~ 'für diesen Einsatz eingeteilt.'
} %}
{% elseif application is not null %}
{% if application.status == constant('App\\Entity\\Application::STATUS_REJECTED') %}
{% include '_partials/_errorbox.html.twig' with {
'message': 'Deine Bewerbung wurde leider abgelehnt.'
} %}
{% if application.comment and application.commentVisible %}
<strong>Begründung:</strong> {{ application.comment|nl2br}}
{% endif %}
{% elseif application.status == constant('App\\Entity\\Application::STATUS_PENDING') %}
{% include '_partials/_infobox.html.twig' with {
'message': 'Deine Bewerbung befindet sich in Bearbeitung.'
} %}
{% if application.comment and application.commentVisible %}
<strong>Begründung:</strong> {{ application.comment|nl2br}}
{% endif %}
{% else %}
{% include '_partials/_infobox.html.twig' with {
'message': 'Du hast dich am ' ~ application.createdAt|date('d.m.Y') ~ 'auf diesen Einsatz beworben.'
} %}
<button type="button"
class="btn btn--secondary"
title="Bewerbung zurückziehen"
{{ stimulus_controller('modal-button', [], [], {'confirmation-modal': '#confirmation-modal'}) }}
{{ stimulus_action('modal-button', 'confirmation', null, {
'title': 'Bist du sicher?',
'content': 'Möchtest du die Bewerbing wirklich zurückziehen?',
'target-url': path('app_teamer_application_withdraw', { 'uuid': application.uuid })
}) }}>
Bewerbung zurückziehen
</button>
{% endif %}
{% else %}
<div>
Erfüllst du mehrere oder alle Voraussetzungen für diesen Einsatz?
</div>
<a href="{{ path('app_teamer_application_create', { 'uuid': assignment.uuid }) }}" class="btn">
Hier bewerben!
</a>
<a href="{{ path('app_teamer_bookmark_toggle', { 'uuid': assignment.uuid, 'r': return_url() }) }}" class="underline">
{% if not isBookmarked %}auf die Merkliste setzen{% else %}von der Merkliste löschen{% endif %}
</a>
{% endif %}
<a href="{{ returnUrl }}" class="underline">
zurück
</a>
</div>
</div>
</div>
{% endblock %}
+92 -58
View File
@@ -3,67 +3,101 @@
{% block title %}Einsatzübersicht{% endblock %}
{% block content %}
<h1 class="text-2xl font-bold pb-8">
Einsatzübersicht
</h1>
<div class="grid lg:grid-cols-2 gap-8 items-start">
{% include '_partials/_assignment_info.html.twig' %}
<div>
<h2 class="text-xl font-bold pb-2">
Voraussetzungen für diesen Einsatz
</h2>
{% include '_partials/_assignment_requirements_info.html.twig' %}
<div class="flex flex-col items-start space-y-4">
{% if disposition is not null %}
{% include '_partials/_infobox.html.twig' with {
'message': 'Du wurdest am ' ~ disposition.createdAt|date('d.m.Y') ~ 'für diesen Einsatz eingeteilt.'
} %}
{% elseif application is not null %}
{% if application.status == constant('App\\Entity\\Application::STATUS_REJECTED') %}
{% include '_partials/_errorbox.html.twig' with {
'message': 'Deine Bewerbung wurde leider abgelehnt.'
} %}
{% if application.comment and application.commentVisible %}
<strong>Begründung:</strong> {{ application.comment|nl2br}}
{% endif %}
{% elseif application.status == constant('App\\Entity\\Application::STATUS_PENDING') %}
{% include '_partials/_infobox.html.twig' with {
'message': 'Deine Bewerbung befindet sich in Bearbeitung.'
} %}
{% if application.comment and application.commentVisible %}
<strong>Begründung:</strong> {{ application.comment|nl2br}}
{% endif %}
<div class="flex items-start justify-between pb-4">
<h1 class="text-2xl font-bold">
Einsatz&shy;übersicht
</h1>
<div class="flex flex-col items-end space-y-2 md:flex-row md:items-center md:space-x-2 md:space-y-0">
<button type="button"
class="{{ html_classes('btn btn--small', { 'btn--secondary': filterDto.active }) }}"
{{ stimulus_controller('modal-button', [], [], {'ajax-modal': '#ajax-modal'}) }}
{{ stimulus_action('modal-button', 'ajax', null, {
'title': 'Einsätze filtern',
'url': path('app_common_assignment_filter', { 'r': return_url() })
}) }}>
<div class="flex items-center space-x-1">
{{ icon('filter', 'w-4 h-4 shrink-0') }}
{% if filterDto.active %}
<span class="whitespace-nowrap">{{ filterDto.activeFiltersCount }} Filter aktiv</span>
{% else %}
{% include '_partials/_infobox.html.twig' with {
'message': 'Du hast dich am ' ~ application.createdAt|date('d.m.Y') ~ 'auf diesen Einsatz beworben.'
} %}
<button type="button"
class="btn btn--secondary"
title="Bewerbung zurückziehen"
{{ stimulus_controller('modal-button', [], [], {'confirmation-modal': '#confirmation-modal'}) }}
{{ stimulus_action('modal-button', 'confirmation', null, {
'title': 'Bist du sicher?',
'content': 'Möchtest du die Bewerbing wirklich zurückziehen?',
'target-url': path('app_teamer_application_withdraw', { 'uuid': application.uuid })
}) }}>
Bewerbung zurückziehen
</button>
<span>Filter</span>
{% endif %}
{% else %}
<div>
Erfüllst du mehrere oder alle Voraussetzungen für diesen Einsatz?
</div>
<a href="{{ path('app_teamer_application_create', { 'uuid': assignment.uuid }) }}" class="btn">
Hier bewerben!
</a>
<a href="{{ path('app_teamer_bookmark_toggle', { 'uuid': assignment.uuid, 'r': return_url() }) }}" class="underline">
{% if not isBookmarked %}auf die Merkliste setzen{% else %}von der Merkliste löschen{% endif %}
</a>
{% endif %}
<a href="{{ returnUrl }}" class="underline">
zurück
</div>
</button>
{% if filterDto.active %}
<a href="{{ path('app_common_assignment_filter_reset', { 'r': return_url() }) }}" class="btn btn--small btn--secondary">
Reset
</a>
</div>
{% endif %}
</div>
</div>
{{ knp_pagination_render(pagination, 'paginator/sliding_boxes.html.twig') }}
<div class="grid sm:grid-cols-2 md:grid-cols-3 gap-4 py-4">
{% for assignment in pagination %}
<div class="relative flex flex-col justify-between rounded-md border border-gray-200 bg-gray-100 p-4">
<div class="flex flex-col space-y-2 pb-2">
<div class="flex items-start space-x-2">
{{ icon('flag-' ~ assignment.destination.country, 'w-5 h-5 shrink-0') }}
<span class="flex-1 font-bold">{{ assignment.destination.product }}</span>
</div>
<div class="flex items-start space-x-2">
{{ icon('calendar', 'w-5 h-5 shrink-0') }}
<span class="flex-1">{{ assignment.effectivePeriod.start|date('d.m.Y') }} - {{ assignment.effectivePeriod.end|date('d.m.Y') }}</span>
</div>
<div class="flex items-start space-x-2">
{{ icon('profile', 'w-5 h-5 shrink-0') }}
<span class="flex-1">{{ assignment.jobProfile.name }}</span>
</div>
<div class="flex items-start space-x-2">
{{ icon('house', 'w-5 h-5 shrink-0') }}
<span class="flex-1">{{ assignment.destination.hotel }}</span>
</div>
{% if assignment.pickup %}
<div class="flex items-start space-x-2">
{{ icon('bus', 'w-5 h-5 shrink-0') }}
<span>{{ assignment.pickup|bpn_pickup_label|default('-') }} {{ assignment.effectivePickupDate ? assignment.effectivePickupDate|date('d.m.Y') : '' }}</span>
</div>
{% endif %}
</div>
<div>
{% if assignment.applications|length %}
{% set application = assignment.applications[0] %}
{% if application.status == constant('App\\Entity\\Application::STATUS_REJECTED') %}
<a href="{{ path('app_teamer_assignment_detail', { 'uuid': assignment.uuid, 'r': return_url() }) }}"
class="btn btn--small flex items-center space-x-2 bg-gray-100 text-gray-800 hover:bg-gray-50">
{{ icon('close', 'w-4 h-4 shrink-0') }}
<span>Bewerbung abgelehnt</span>
</a>
{% else %}
<a href="{{ path('app_teamer_assignment_detail', { 'uuid': assignment.uuid, 'r': return_url() }) }}"
class="btn btn--small flex items-center space-x-2 bg-yellow-100 text-yellow-800 hover:bg-yellow-50">
{{ icon('hourglass', 'w-4 h-4 shrink-0') }}
<span>in Bearbeitung</span>
</a>
{% endif %}
{% elseif assignment.dispositions|length %}
<a href="{{ path('app_teamer_disposition_detail', { 'uuid': assignment.dispositions[0].uuid }) }}"
class="btn btn--small flex items-center space-x-2 bg-green-100 text-green-700 hover:bg-green-50">
{{ icon('check', 'w-4 h-4 shrink-0') }}
<span>eingeteilt</span>
</a>
{% elseif is_granted('APPLY', assignment) %}
<a href="{{ path('app_teamer_assignment_detail', { 'uuid': assignment.uuid, 'r': return_url() }) }}"
class="btn btn--small flex items-center space-x-2">
{{ icon('hand', 'w-4 h-4 shrink-0') }}
<span>bewerben</span>
</a>
{% endif %}
</div>
{% set isBookmarked = teamer.bookmarks.contains(assignment) %}
<a href="{{ path('app_teamer_bookmark_toggle', { 'uuid': assignment.uuid, 'r': return_url() }) }}"
class="absolute top-0 right-0 mt-2 mr-2"
title="{{ isBookmarked ? 'Von der Merkliste löschen' : 'Auf die Merkliste setzen' }}">
{{ icon('star', html_classes('w-5 h-5', { 'text-yellow-500': isBookmarked, 'text-gray-200': not isBookmarked } )) }}
</a>
</div>
{% endfor %}
</div>
{{ knp_pagination_render(pagination, 'paginator/sliding_boxes.html.twig') }}
{% endblock %}