feat: dashboard for role manager
This commit is contained in:
@@ -2,45 +2,35 @@
|
|||||||
|
|
||||||
namespace App\Controller\Manager;
|
namespace App\Controller\Manager;
|
||||||
|
|
||||||
use App\Entity\Assignment;
|
use App\Entity\Upload;
|
||||||
use App\Model\AssignmentFilterDto;
|
use App\Repository\DispositionRepository;
|
||||||
use App\Repository\AssignmentRepository;
|
use App\Repository\UploadRepository;
|
||||||
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\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
|
||||||
class IndexController extends AbstractController
|
class IndexController extends AbstractController
|
||||||
{
|
{
|
||||||
public function __construct(private readonly AssignmentRepository $assignmentRepository, private readonly PaginatorInterface $paginator)
|
public function __construct(
|
||||||
{
|
private readonly DispositionRepository $dispositionRepository,
|
||||||
|
private readonly UploadRepository $uploadRepository,
|
||||||
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/management', name: 'app_manager_index')]
|
#[Route('/management', name: 'app_manager_index')]
|
||||||
public function index(Request $request): Response
|
public function index(): Response
|
||||||
{
|
{
|
||||||
$filterDto = new AssignmentFilterDto();
|
$dispositions = $this->dispositionRepository->getNew();
|
||||||
$filterDto->setStatus(Assignment::STATUS_UNSTAFFED);
|
|
||||||
|
|
||||||
$query = $this
|
$documents = $this->uploadRepository->getNew();
|
||||||
->assignmentRepository
|
$newDocumentsCount = $this->uploadRepository->getCountByStatus(Upload::STATUS_NEW);
|
||||||
->getListQuery($filterDto)
|
$pendingDocumentsCount = $this->uploadRepository->getCountByStatus(Upload::STATUS_PENDING);
|
||||||
;
|
|
||||||
|
|
||||||
$pagination = $this->paginator->paginate(
|
|
||||||
$query,
|
|
||||||
$request->query->getInt('page', 1),
|
|
||||||
10,
|
|
||||||
[
|
|
||||||
'wrap-queries' => true, // Required for query with 'having' clause
|
|
||||||
'defaultSortFieldName' => 'destination.dateFrom',
|
|
||||||
'defaultSortDirection' => 'desc',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->render('manager/index.html.twig', [
|
return $this->render('manager/index.html.twig', [
|
||||||
'pagination' => $pagination,
|
'dispositions' => $dispositions,
|
||||||
|
'documents' => $documents,
|
||||||
|
'newDocumentsCount' => $newDocumentsCount,
|
||||||
|
'pendingDocumentsCount' => $pendingDocumentsCount,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -245,4 +245,22 @@ class DispositionRepository extends ServiceEntityRepository
|
|||||||
->getResult()
|
->getResult()
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNew(int $limit = 5): array
|
||||||
|
{
|
||||||
|
$qb = $this->createQueryBuilder('disposition');
|
||||||
|
|
||||||
|
return $qb
|
||||||
|
->select('disposition', 'assignment', 'destination', 'job_profile')
|
||||||
|
->innerJoin('disposition.assignment', 'assignment')
|
||||||
|
->innerJoin('assignment.destination', 'destination')
|
||||||
|
->innerJoin('assignment.jobProfile', 'job_profile')
|
||||||
|
->where($qb->expr()->gt('destination.dateFrom', ':dateFrom'))
|
||||||
|
->orderBy('disposition.createdAt', 'DESC')
|
||||||
|
->setParameter('dateFrom', new \DateTimeImmutable())
|
||||||
|
->setMaxResults($limit)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,144 +1,67 @@
|
|||||||
{% extends 'manager/layout.html.twig' %}
|
{% extends 'manager/layout.html.twig' %}
|
||||||
|
|
||||||
{% block title %}Offene Einsätze{% endblock %}
|
{% macro dispositionData(disposition) %}
|
||||||
|
{% set assignment = disposition.assignment %}
|
||||||
|
<span class="whitespace-nowrap">{{ disposition.teamer.fullName(true) }}</span>
|
||||||
|
{% include '_partials/_dot.html.twig' %}
|
||||||
|
<span class="whitespace-nowrap">{{ assignment.effectivePeriod.start|date('d.m.y') }} - {{ assignment.effectivePeriod.end|date('d.m.y') }}</span>
|
||||||
|
{% include '_partials/_dot.html.twig' %}
|
||||||
|
<span class="whitespace-nowrap">{{ assignment.destination.hotel }}</span>
|
||||||
|
{% include '_partials/_dot.html.twig' %}
|
||||||
|
<span class="whitespace-nowrap">{{ assignment.jobProfile.name }}</span>
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="flex items-start justify-between pb-4">
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
|
||||||
<h1 class="text-2xl font-bold">
|
<div class="bg-gray-100 border border-gray-200 rounded-md px-4 py-2">
|
||||||
Offene Einsätze
|
<h2 class="font-bold text-lg pb-2">
|
||||||
</h1>
|
Neue Dokumente
|
||||||
</div>
|
</h2>
|
||||||
|
{% if newDocumentsCount > 0 or pendingDocumentsCount > 0 %}
|
||||||
<div class="data-table-wrapper">
|
<h3 class="font-bold pb-2">
|
||||||
<div class="data-table-wrapper__inner">
|
{{ newDocumentsCount }} neu {{ pendingDocumentsCount }} in Bearbeitung
|
||||||
<table class="data-table">
|
</h3>
|
||||||
<thead>
|
{% endif %}
|
||||||
<tr>
|
<ul class="divide-y divide-gray-200">
|
||||||
<th>
|
{% for document in documents %}
|
||||||
Status
|
<li class="py-2 first:pt-0 last:pb-0">
|
||||||
</th>
|
<button type="button"
|
||||||
<th>
|
class="flex items-center space-x-1 truncate"
|
||||||
{{ knp_pagination_sortable(pagination, 'Einsatz­zeitraum', 'destination.dateFrom') }}
|
hx-get="{{ path('app_administrative_document_check', { 'uuid': document.uuid, 'r': return_url() }) }}"
|
||||||
</th>
|
hx-target="body"
|
||||||
<th>
|
hx-swap="beforeend">
|
||||||
{{ knp_pagination_sortable(pagination, 'Destination', 'destination.product') }}
|
{{ icon('download', 'w-4 h-4 shrink-0') }}
|
||||||
</th>
|
<span>{{ document.owner.teamer.fullName(true) }}</span>
|
||||||
<th>
|
{% include '_partials/_dot.html.twig' %}
|
||||||
{{ knp_pagination_sortable(pagination, 'Jobprofil', 'job_profile.name') }}
|
<span>{{ document.typeLabel }}</span>
|
||||||
</th>
|
</button>
|
||||||
<th>
|
</li>
|
||||||
{{ knp_pagination_sortable(pagination, 'Bus', 'assignment.pickup') }}
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Einteilungen
|
|
||||||
</th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for assignment in pagination %}
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<div class="flex flex-col items-center space-y-2">
|
|
||||||
{% if assignment.status == 'draft' %}
|
|
||||||
<svg viewBox="0 0 5 5" class="h-4 w-4 fill-current text-gray-100">
|
|
||||||
<circle cx="3" cy="3" r="2" />
|
|
||||||
</svg>
|
|
||||||
{{ icon('edit', 'w-4 h-4') }}
|
|
||||||
{% else %}
|
|
||||||
{% if assignment.staffed %}
|
|
||||||
<svg viewBox="0 0 5 5" class="h-4 w-4 fill-current text-green-500">
|
|
||||||
<circle cx="3" cy="3" r="2" />
|
|
||||||
</svg>
|
|
||||||
{% elseif assignment.partlyStaffed %}
|
|
||||||
<svg viewBox="0 0 5 5" class="h-4 w-4 fill-current text-yellow-500">
|
|
||||||
<circle cx="3" cy="3" r="2" />
|
|
||||||
</svg>
|
|
||||||
{% elseif assignment.staffing %}
|
|
||||||
<svg viewBox="0 0 5 5" class="h-4 w-4 fill-current text-blue-500">
|
|
||||||
<circle cx="3" cy="3" r="2" />
|
|
||||||
</svg>
|
|
||||||
{% else %}
|
|
||||||
<svg viewBox="0 0 5 5" class="h-4 w-4 fill-current text-gray-100">
|
|
||||||
<circle cx="3" cy="3" r="2" />
|
|
||||||
</svg>
|
|
||||||
{% endif %}
|
|
||||||
{% if assignment.status == 'closed' %}
|
|
||||||
{{ icon('locked', 'w-4 h-4 text-red-500') }}
|
|
||||||
{% else %}
|
|
||||||
{{ icon('unlocked', 'w-4 h-4') }}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="{{ path('app_administrative_assignment_detail', { 'uuid': assignment.uuid, 'r': return_url() }) }}">
|
|
||||||
{{ assignment.effectivePeriod.start|date('d.m.Y') }} -
|
|
||||||
<br>
|
|
||||||
{{ assignment.effectivePeriod.end|date('d.m.Y') }}
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="{{ path('app_administrative_assignment_detail', { 'uuid': assignment.uuid, 'r': return_url() }) }}"
|
|
||||||
class="flex items-start space-x-2">
|
|
||||||
{{ icon('flag-' ~ assignment.destination.country, 'w-5 h-5 shrink-0') }}
|
|
||||||
<div class="flex-1">
|
|
||||||
{{ assignment.destination.hotel }}
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="{{ path('app_administrative_assignment_detail', { 'uuid': assignment.uuid, 'r': return_url() }) }}">
|
|
||||||
{{ assignment.jobProfile.name }}
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{% if assignment.pickup %}
|
|
||||||
{% set pickup = assignment.destination.pickup(assignment.pickup) %}
|
|
||||||
{% if pickup %}
|
|
||||||
<a href="{{ path('app_administrative_assignment_detail', { 'uuid': assignment.uuid, 'r': return_url() }) }}">
|
|
||||||
<span class="whitespace-nowrap">ab {{ pickup.city }}</span>
|
|
||||||
<br>
|
|
||||||
{{ pickup.time }}
|
|
||||||
</a>
|
|
||||||
{% else %}
|
|
||||||
<span class="text-red-500">ungültiger Zustieg</span>
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
|
||||||
-
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<span>{{ assignment.dispositions|length }}/{{ assignment.availableDispositions }}</span>
|
|
||||||
<ul>
|
|
||||||
{% for disposition in assignment.dispositions %}
|
|
||||||
<li>
|
|
||||||
<div role="button"
|
|
||||||
title="Teamer:innen-Info anzeigen"
|
|
||||||
aria-label="Teamer:innen-Info anzeigen"
|
|
||||||
hx-get="{{ path('app_administrative_teamer_info', { 'uuid': disposition.teamer.uuid }) }}"
|
|
||||||
hx-target="body"
|
|
||||||
hx-swap="beforeend">
|
|
||||||
<span class="whitespace-nowrap">{{ disposition.teamer }}</span>
|
|
||||||
<twig:RatingStars rating="{{ disposition.teamer.averageRating }}" />
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<tr>
|
<li class="py-2 first:pt-0 last:pb-0">
|
||||||
<td colspan="8">
|
-
|
||||||
Keine Daten...
|
</li>
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</ul>
|
||||||
</table>
|
</div>
|
||||||
{{ knp_pagination_render(pagination) }}
|
<div class="bg-gray-100 border border-gray-200 rounded-md px-4 py-2">
|
||||||
|
<h2 class="font-bold text-lg pb-2">
|
||||||
|
Neue Einteilungen
|
||||||
|
</h2>
|
||||||
|
<ul class="divide-y divide-gray-200">
|
||||||
|
{% for disposition in dispositions %}
|
||||||
|
{% set assignment = disposition.assignment %}
|
||||||
|
<li class="py-2 first:pt-0 last:pb-0">
|
||||||
|
<a href="{{ path('app_administrative_assignment_detail', { 'uuid': assignment.uuid }) }}" class="flex items-center space-x-1 truncate">
|
||||||
|
{{ icon('hand', 'w-4 h-4 shrink-0') }}
|
||||||
|
{{ _self.dispositionData(disposition) }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% else %}
|
||||||
|
<li class="py-2 first:pt-0 last:pb-0">
|
||||||
|
-
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ label:
|
|||||||
checking_contract: in Bearbeitung
|
checking_contract: in Bearbeitung
|
||||||
checking_invoice: in Bearbeitung
|
checking_invoice: in Bearbeitung
|
||||||
confirmed: bestätigt
|
confirmed: bestätigt
|
||||||
|
ended: beendet
|
||||||
completed: abgeschlossen
|
completed: abgeschlossen
|
||||||
document:
|
document:
|
||||||
type:
|
type:
|
||||||
|
|||||||
Reference in New Issue
Block a user