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
@@ -1,6 +1,6 @@
<?php <?php
namespace App\Controller\Teamer; namespace App\Controller\Teamer\Assignment;
use App\Controller\Traits\ReturnUrlTrait; use App\Controller\Traits\ReturnUrlTrait;
use App\Entity\Assignment; use App\Entity\Assignment;
@@ -13,7 +13,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Symfony\Component\Security\Http\Attribute\IsGranted;
class AssignmentController extends AbstractController class DetailController extends AbstractController
{ {
use ReturnUrlTrait; use ReturnUrlTrait;
@@ -23,7 +23,7 @@ class AssignmentController extends AbstractController
) { ) {
} }
#[Route('/teamer/assignment/{uuid}', name: 'app_teamer_assignment')] #[Route('/teamer/assignment/{uuid}', name: 'app_teamer_assignment_detail')]
#[IsGranted('ROLE_TEAMER')] #[IsGranted('ROLE_TEAMER')]
public function index(Assignment $assignment, Request $request): Response public function index(Assignment $assignment, Request $request): Response
{ {
@@ -49,7 +49,7 @@ class AssignmentController extends AbstractController
$isBookmarked = $teamer->getBookmarks()->contains($assignment); $isBookmarked = $teamer->getBookmarks()->contains($assignment);
return $this->render('teamer/assignment/index.html.twig', [ return $this->render('teamer/assignment/detail.html.twig', [
'teamer' => $teamer, 'teamer' => $teamer,
'assignment' => $assignment, 'assignment' => $assignment,
'disposition' => $disposition, 'disposition' => $disposition,
@@ -0,0 +1,61 @@
<?php
namespace App\Controller\Teamer\Assignment;
use App\Entity\User;
use App\Repository\AssignmentRepository;
use App\Service\Common\AssignmentFilterHandler;
use Knp\Component\Pager\PaginatorInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Validator\Validator\ValidatorInterface;
class IndexController extends AbstractController
{
public function __construct(
private readonly ValidatorInterface $validator,
private readonly AssignmentFilterHandler $filterHandler,
private readonly PaginatorInterface $paginator,
private readonly AssignmentRepository $assignmentRepository
) {
}
#[Route('/teamer/assignment', name: 'app_teamer_assignment_index')]
#[IsGranted('ROLE_TEAMER')]
public function index(Request $request): Response
{
/** @var User $user */
$user = $this->getUser();
$teamer = $user->getTeamer();
// Validate teamer data to show missing data right away
$errors = $this->validator->validate($teamer, null, ['profile_preflight']);
$filterDto = $this->filterHandler->getFilterSettings();
$query = $this
->assignmentRepository
->getListQueryForTeamer($teamer, $filterDto)
;
$pagination = $this->paginator->paginate(
$query,
$request->query->getInt('page', 1),
10,
[
'defaultSortFieldName' => 'destination.dateFrom',
'defaultSortDirection' => 'asc',
]
);
return $this->render('teamer/assignment/index.html.twig', [
'teamer' => $teamer,
'errors' => $errors,
'pagination' => $pagination,
'filterDto' => $filterDto,
]);
}
}
+11 -34
View File
@@ -2,60 +2,37 @@
namespace App\Controller\Teamer; namespace App\Controller\Teamer;
use App\Entity\Assignment;
use App\Entity\User; use App\Entity\User;
use App\Repository\AssignmentRepository; use Doctrine\ORM\EntityManagerInterface;
use App\Service\Common\AssignmentFilterHandler;
use Knp\Component\Pager\PaginatorInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Validator\Validator\ValidatorInterface;
class IndexController extends AbstractController class IndexController extends AbstractController
{ {
public function __construct( public function __construct(private readonly EntityManagerInterface $entityManager)
private readonly ValidatorInterface $validator, {
private readonly AssignmentFilterHandler $filterHandler,
private readonly PaginatorInterface $paginator,
private readonly AssignmentRepository $assignmentRepository
) {
} }
#[Route('/teamer', name: 'app_teamer_index')] #[Route('/teamer', name: 'app_teamer_index')]
#[IsGranted('ROLE_TEAMER')] #[IsGranted('ROLE_TEAMER')]
public function index(Request $request): Response public function index(): Response
{ {
/** @var User $user */ /** @var User $user */
$user = $this->getUser(); $user = $this->getUser();
$teamer = $user->getTeamer(); $teamer = $user->getTeamer();
$availabilities = $teamer->getAllAvailabilities()->toArray();
// Validate teamer data to show missing data right away $matchingAssignments = $this
$errors = $this->validator->validate($teamer, null, ['profile_preflight']); ->entityManager
->getRepository(Assignment::class)
$filterDto = $this->filterHandler->getFilterSettings(); ->getNewMatchingTeamerProfile($teamer, $availabilities)
$query = $this
->assignmentRepository
->getListQueryForTeamer($teamer, $filterDto)
; ;
$pagination = $this->paginator->paginate(
$query,
$request->query->getInt('page', 1),
10,
[
'defaultSortFieldName' => 'destination.dateFrom',
'defaultSortDirection' => 'asc',
]
);
return $this->render('teamer/index.html.twig', [ return $this->render('teamer/index.html.twig', [
'teamer' => $teamer, 'matchingAssignments' => $matchingAssignments,
'errors' => $errors,
'pagination' => $pagination,
'filterDto' => $filterDto,
]); ]);
} }
} }
+16 -1
View File
@@ -103,7 +103,7 @@ class Teamer implements TimestampableEntityInterface
#[ORM\OneToMany(mappedBy: 'teamer', targetEntity: License::class, cascade: ['remove'])] #[ORM\OneToMany(mappedBy: 'teamer', targetEntity: License::class, cascade: ['remove'])]
private Collection $licenses; private Collection $licenses;
#[ORM\ManyToMany(targetEntity: JobProfile::class, orphanRemoval: true)] #[ORM\ManyToMany(targetEntity: JobProfile::class)]
private Collection $jobProfiles; private Collection $jobProfiles;
#[ORM\ManyToMany(targetEntity: Assignment::class, inversedBy: 'teamers')] #[ORM\ManyToMany(targetEntity: Assignment::class, inversedBy: 'teamers')]
@@ -439,6 +439,21 @@ class Teamer implements TimestampableEntityInterface
return $this; return $this;
} }
public function getAllAvailabilities(): Collection
{
$allAvailabilities = new ArrayCollection();
foreach ($this->getAvailabilities() as $availability) {
$allAvailabilities->add($availability);
}
foreach ($this->getCustomAvailabilities() as $availability) {
$allAvailabilities->add($availability);
}
return $allAvailabilities;
}
public function getPhoto(): ?Upload public function getPhoto(): ?Upload
{ {
return $this->photo; return $this->photo;
+7 -2
View File
@@ -11,12 +11,17 @@ class TeamerMenuBuilder extends AbstractMenuBuilder
$menuItems = [ $menuItems = [
[ [
'route' => 'app_teamer_index', 'route' => 'app_teamer_index',
'title' => 'Dashboard',
'icon' => 'chart',
],
[
'route' => 'app_teamer_assignment_index',
'title' => 'Einsatzübersicht', 'title' => 'Einsatzübersicht',
'icon' => 'calendar', 'icon' => 'calendar',
'hideChildren' => true, 'hideChildren' => true,
'children' => [ 'children' => [
[ [
'route' => 'app_teamer_assignment', 'route' => 'app_teamer_assignment_detail',
'title' => 'Einsatzdetails', 'title' => 'Einsatzdetails',
'routeParameters' => $this->getDefaultRouteParameters('uuid'), 'routeParameters' => $this->getDefaultRouteParameters('uuid'),
] ]
@@ -51,7 +56,7 @@ class TeamerMenuBuilder extends AbstractMenuBuilder
'title' => 'Merkliste', 'title' => 'Merkliste',
'children' => [ 'children' => [
[ [
'route' => 'app_teamer_assignment', 'route' => 'app_teamer_assignment_detail',
'title' => 'Einsatzdetails', 'title' => 'Einsatzdetails',
'routeParameters' => $this->getDefaultRouteParameters('uuid'), 'routeParameters' => $this->getDefaultRouteParameters('uuid'),
] ]
+32
View File
@@ -202,4 +202,36 @@ class AssignmentRepository extends ServiceEntityRepository
->getResult() ->getResult()
; ;
} }
public function getNewMatchingTeamerProfile(Teamer $teamer, array $availabilities, int $limit = 5): array
{
$qb = $this->createQueryBuilder('assignment');
$qb
->select('assignment', 'destination', 'job_profile')
->innerJoin('assignment.destination', 'destination')
->innerJoin('assignment.jobProfile', 'job_profile')
->leftJoin('assignment.applications', 'application', Join::WITH, $qb->expr()->neq('application.teamer', ':teamer'))
->where($qb->expr()->andX(
$qb->expr()->in('assignment.jobProfile', ':jobProfiles'),
$qb->expr()->isNull('application')
))
->setParameter('jobProfiles', $teamer->getJobProfiles())
->setParameter('teamer', $teamer)
;
foreach ($availabilities as $availability) {
$qb->orWhere($qb->expr()->andX(
$qb->expr()->eq('assignment.dateFrom', ':dateFrom'),
$qb->expr()->eq('assignment.dateTo', ':dateTo')
));
}
return $qb
->orderBy('assignment.createdAt', 'DESC')
->setMaxResults($limit)
->getQuery()
->getResult()
;
}
} }
-1
View File
@@ -111,5 +111,4 @@
</ul> </ul>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
+2 -2
View File
@@ -38,12 +38,12 @@
{% if application.status == constant('App\\Entity\\Application::STATUS_REJECTED') %} {% if application.status == constant('App\\Entity\\Application::STATUS_REJECTED') %}
{% set icon = 'close' %} {% set icon = 'close' %}
{% set class = 'bg-gray-100 text-gray-800 hover:bg-gray-50' %} {% set class = 'bg-gray-100 text-gray-800 hover:bg-gray-50' %}
{% set url = path('app_teamer_assignment', { 'uuid': assignment.uuid, 'r': return_url() }) %} {% set url = path('app_teamer_assignment_detail', { 'uuid': assignment.uuid, 'r': return_url() }) %}
{% set label = 'Bewerbung abgelehnt' %} {% set label = 'Bewerbung abgelehnt' %}
{% else %} {% else %}
{% set icon = 'hourglass' %} {% set icon = 'hourglass' %}
{% set class = 'bg-yellow-100 text-yellow-800 hover:bg-yellow-50' %} {% set class = 'bg-yellow-100 text-yellow-800 hover:bg-yellow-50' %}
{% set url = path('app_teamer_assignment', { 'uuid': assignment.uuid, 'r': return_url() }) %} {% set url = path('app_teamer_assignment_detail', { 'uuid': assignment.uuid, 'r': return_url() }) %}
{% set label = 'in Bearbeitung' %} {% set label = 'in Bearbeitung' %}
{% endif %} {% endif %}
<a href="{{ url }}" <a href="{{ url }}"
@@ -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 title %}Einsatzübersicht{% endblock %}
{% block content %} {% block content %}
<h1 class="text-2xl font-bold pb-8"> <div class="flex items-start justify-between pb-4">
Einsatzübersicht <h1 class="text-2xl font-bold">
</h1> Einsatz&shy;übersicht
<div class="grid lg:grid-cols-2 gap-8 items-start"> </h1>
{% include '_partials/_assignment_info.html.twig' %} <div class="flex flex-col items-end space-y-2 md:flex-row md:items-center md:space-x-2 md:space-y-0">
<div> <button type="button"
<h2 class="text-xl font-bold pb-2"> class="{{ html_classes('btn btn--small', { 'btn--secondary': filterDto.active }) }}"
Voraussetzungen für diesen Einsatz {{ stimulus_controller('modal-button', [], [], {'ajax-modal': '#ajax-modal'}) }}
</h2> {{ stimulus_action('modal-button', 'ajax', null, {
{% include '_partials/_assignment_requirements_info.html.twig' %} 'title': 'Einsätze filtern',
<div class="flex flex-col items-start space-y-4"> 'url': path('app_common_assignment_filter', { 'r': return_url() })
{% if disposition is not null %} }) }}>
{% include '_partials/_infobox.html.twig' with { <div class="flex items-center space-x-1">
'message': 'Du wurdest am ' ~ disposition.createdAt|date('d.m.Y') ~ 'für diesen Einsatz eingeteilt.' {{ icon('filter', 'w-4 h-4 shrink-0') }}
} %} {% if filterDto.active %}
{% elseif application is not null %} <span class="whitespace-nowrap">{{ filterDto.activeFiltersCount }} Filter aktiv</span>
{% 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 %} {% else %}
{% include '_partials/_infobox.html.twig' with { <span>Filter</span>
'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 %} {% endif %}
{% else %} </div>
<div> </button>
Erfüllst du mehrere oder alle Voraussetzungen für diesen Einsatz? {% if filterDto.active %}
</div> <a href="{{ path('app_common_assignment_filter_reset', { 'r': return_url() }) }}" class="btn btn--small btn--secondary">
<a href="{{ path('app_teamer_application_create', { 'uuid': assignment.uuid }) }}" class="btn"> Reset
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> </a>
</div> {% endif %}
</div> </div>
</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 %} {% endblock %}
+2 -2
View File
@@ -37,7 +37,7 @@
{% if assignment.applications|length %} {% if assignment.applications|length %}
{% set icon = 'hourglass' %} {% set icon = 'hourglass' %}
{% set class = 'bg-yellow-100 text-yellow-800 hover:bg-yellow-50' %} {% set class = 'bg-yellow-100 text-yellow-800 hover:bg-yellow-50' %}
{% set url = path('app_teamer_assignment', { 'uuid': assignment.uuid, 'r': return_url() }) %} {% set url = path('app_teamer_assignment_detail', { 'uuid': assignment.uuid, 'r': return_url() }) %}
{% set label = 'in Bearbeitung' %} {% set label = 'in Bearbeitung' %}
{% elseif assignment.dispositions|length %} {% elseif assignment.dispositions|length %}
{% set icon = 'check' %} {% set icon = 'check' %}
@@ -47,7 +47,7 @@
{% else %} {% else %}
{% set icon = 'hand' %} {% set icon = 'hand' %}
{% set class = 'btn--info' %} {% set class = 'btn--info' %}
{% set url = path('app_teamer_assignment', { 'uuid': assignment.uuid, 'r': return_url() }) %} {% set url = path('app_teamer_assignment_detail', { 'uuid': assignment.uuid, 'r': return_url() }) %}
{% set label = 'bewerben' %} {% set label = 'bewerben' %}
{% endif %} {% endif %}
<a href="{{ url }}" <a href="{{ url }}"
+39 -92
View File
@@ -1,103 +1,50 @@
{% extends 'teamer/layout.html.twig' %} {% extends 'teamer/layout.html.twig' %}
{% block title %}Einsatzübersicht{% endblock %} {% block title %}Dashboard{% endblock %}
{% block content %} {% block content %}
<div class="flex items-start justify-between pb-4"> <div class="flex items-start justify-between pb-4">
<h1 class="text-2xl font-bold"> <h1 class="text-2xl font-bold">
Einsatz&shy;übersicht Dashboard
</h1> </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"> </div>
<button type="button" <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
class="{{ html_classes('btn btn--small', { 'btn--secondary': filterDto.active }) }}" <div class="bg-gray-100 border border-gray-200 rounded-md px-4 py-2">
{{ stimulus_controller('modal-button', [], [], {'ajax-modal': '#ajax-modal'}) }} <h2 class="font-bold text-lg">
{{ stimulus_action('modal-button', 'ajax', null, { Meine Bewerbungen
'title': 'Einsätze filtern', </h2>
'url': path('app_common_assignment_filter', { 'r': return_url() }) <ul class="divide-y divide-gray-200">
}) }}> </ul>
<div class="flex items-center space-x-1"> </div>
{{ icon('filter', 'w-4 h-4 shrink-0') }} <div class="bg-gray-100 border border-gray-200 rounded-md px-4 py-2">
{% if filterDto.active %} <h2 class="font-bold text-lg">
<span class="whitespace-nowrap">{{ filterDto.activeFiltersCount }} Filter aktiv</span> Meine Dokumente
{% else %} </h2>
<span>Filter</span> <ul class="divide-y divide-gray-200">
{% endif %} </ul>
</div> </div>
</button> <div class="bg-gray-100 border border-gray-200 rounded-md px-4 py-2">
{% if filterDto.active %} <h2 class="font-bold text-lg">
<a href="{{ path('app_common_assignment_filter_reset', { 'r': return_url() }) }}" class="btn btn--small btn--secondary"> Mein Feedback
Reset </h2>
</a> <ul class="divide-y divide-gray-200">
{% endif %} </ul>
</div>
<div class="bg-gray-100 border border-gray-200 rounded-md px-4 py-2">
<h2 class="font-bold text-lg">
Meine Einsätze
</h2>
<ul class="divide-y divide-gray-200">
</ul>
</div>
<div class="bg-gray-100 border border-gray-200 rounded-md px-4 py-2">
<h2 class="font-bold text-lg">
Mögliche Einsätze
</h2>
<ul class="divide-y divide-gray-200">
{{ matchingAssignments|length }}
</ul>
</div> </div>
</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', { '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', { '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', { '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 %} {% endblock %}