feat: show upcoming assignments of teamers for administrative users
closes #869b9vkp4
This commit is contained in:
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller\Administrative\Teamer;
|
||||||
|
|
||||||
|
use App\Entity\Teamer;
|
||||||
|
use App\Repository\DispositionRepository;
|
||||||
|
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\Attribute\Route;
|
||||||
|
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||||
|
|
||||||
|
class UpcomingAssignmentsController extends AbstractController
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private readonly DispositionRepository $dispositionRepository,
|
||||||
|
private readonly PaginatorInterface $paginator,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/administrative/teamer/upcoming-assignments/{uuid}', name: 'app_administrative_teamer_upcoming_assignments')]
|
||||||
|
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||||
|
public function index(Teamer $teamer, Request $request): Response
|
||||||
|
{
|
||||||
|
$query = $this
|
||||||
|
->dispositionRepository
|
||||||
|
->getUpcomingDispositionsByTeamerQuery($teamer)
|
||||||
|
;
|
||||||
|
|
||||||
|
$pagination = $this->paginator->paginate(
|
||||||
|
$query,
|
||||||
|
$request->query->getInt('page', 1),
|
||||||
|
10,
|
||||||
|
[
|
||||||
|
'defaultSortFieldName' => 'destination.dateFrom',
|
||||||
|
'defaultSortDirection' => 'asc',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
return $this->render('administrative/teamer/upcoming_assignments.html.twig', [
|
||||||
|
'teamer' => $teamer,
|
||||||
|
'pagination' => $pagination,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -317,6 +317,13 @@ class AdminMenuBuilder extends AbstractMenuBuilder
|
|||||||
'title' => 'Vergangene Einsätze',
|
'title' => 'Vergangene Einsätze',
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
$menu->addChild('Bevorstehende Einsätze', [
|
||||||
|
'route' => 'app_administrative_teamer_upcoming_assignments',
|
||||||
|
'routeParameters' => $this->getDefaultRouteParameters('uuid'),
|
||||||
|
'linkAttributes' => [
|
||||||
|
'title' => 'Bevorstehende Einsätze',
|
||||||
|
],
|
||||||
|
]);
|
||||||
$menu->addChild('Anmerkungen (intern)', [
|
$menu->addChild('Anmerkungen (intern)', [
|
||||||
'route' => 'app_admin_teamer_remarks_internal',
|
'route' => 'app_admin_teamer_remarks_internal',
|
||||||
'routeParameters' => $this->getDefaultRouteParameters('uuid'),
|
'routeParameters' => $this->getDefaultRouteParameters('uuid'),
|
||||||
|
|||||||
@@ -196,6 +196,13 @@ class ManagerMenuBuilder extends AbstractMenuBuilder
|
|||||||
'title' => 'Vergangene Einsätze',
|
'title' => 'Vergangene Einsätze',
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
$menu->addChild('Bevorstehende Einsätze', [
|
||||||
|
'route' => 'app_administrative_teamer_upcoming_assignments',
|
||||||
|
'routeParameters' => $this->getDefaultRouteParameters('uuid'),
|
||||||
|
'linkAttributes' => [
|
||||||
|
'title' => 'Bevorstehende Einsätze',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
$this->addDivider($menu);
|
$this->addDivider($menu);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
{% extends 'administrative/layout.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}Bevorstehende Einsätze {{ teamer }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="grid lg:grid-cols-3 gap-y-8 lg:gap-y-0 lg:gap-x-8">
|
||||||
|
<div>
|
||||||
|
{% if is_granted('ROLE_MANAGER') %}
|
||||||
|
{{ knp_menu_render(knp_menu_get('manager_teamer')) }}
|
||||||
|
{% elseif is_granted('ROLE_ADMIN') %}
|
||||||
|
{{ knp_menu_render(knp_menu_get('admin_teamer')) }}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="lg:col-span-2">
|
||||||
|
<h1 class="text-2xl font-bold pb-8">
|
||||||
|
Bevorstehende Einsätze {{ teamer }}
|
||||||
|
</h1>
|
||||||
|
<div class="data-table-wrapper">
|
||||||
|
<div class="data-table-wrapper__inner">
|
||||||
|
<table class="data-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Zeitraum
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Einsatz
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Jobprofil
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for disposition in pagination %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{ disposition.assignment.effectivePeriod.start|date('d.m.Y') }} - {{ disposition.assignment.effectivePeriod.end|date('d.m.Y') }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ disposition.assignment.destination.product }}
|
||||||
|
<br>
|
||||||
|
{{ disposition.assignment.destination.hotel }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ disposition.assignment.jobProfile.name }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% else %}
|
||||||
|
<td colspan="3">
|
||||||
|
Keine Daten...
|
||||||
|
</td>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{{ knp_pagination_render(pagination) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user