diff --git a/src/Controller/Admin/Teamer/InfoController.php b/src/Controller/Admin/Teamer/InfoController.php index a02f115..ae28c16 100644 --- a/src/Controller/Admin/Teamer/InfoController.php +++ b/src/Controller/Admin/Teamer/InfoController.php @@ -4,17 +4,27 @@ namespace App\Controller\Admin\Teamer; use App\Entity\Teamer; use App\Model\AjaxModalResponseDto; +use App\Repository\DispositionRepository; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\Routing\Annotation\Route; class InfoController extends AbstractController { + public function __construct(private readonly DispositionRepository $dispositionRepository) + {} + #[Route('/admin/teamer/info/{uuid}', name: 'app_admin_teamer_info')] public function index(Teamer $teamer): JsonResponse { - $response = new AjaxModalResponseDto(); + $recentDispositions = $this->dispositionRepository->getRecentByTeamer($teamer); + $response = new AjaxModalResponseDto(); + $response->setContent($this->renderView('admin/teamer/info.html.twig', [ + 'teamer' => $teamer, + 'recentDispositions' => $recentDispositions, + ])); + return $this->json($response); } } \ No newline at end of file diff --git a/src/Repository/DispositionRepository.php b/src/Repository/DispositionRepository.php index ca935b3..b25a46b 100644 --- a/src/Repository/DispositionRepository.php +++ b/src/Repository/DispositionRepository.php @@ -2,7 +2,6 @@ namespace App\Repository; -use App\Entity\Application; use App\Entity\Assignment; use App\Entity\Disposition; use App\Entity\Teamer; @@ -94,4 +93,20 @@ class DispositionRepository extends ServiceEntityRepository ->getResult() ; } + + public function getRecentByTeamer(Teamer $teamer, int $limit = 5): array + { + $qb = $this->createQueryBuilder('disposition'); + + return $qb + ->select('disposition', 'assignment', 'destination') + ->innerJoin('disposition.assignment', 'assignment') + ->innerJoin('assignment.destination', 'destination') + ->where($qb->expr()->eq('disposition.teamer', ':teamer')) + ->setParameter('teamer', $teamer) + ->orderBy('destination.dateFrom', 'DESC') + ->getQuery() + ->getResult() + ; + } } diff --git a/templates/_partials/_assignment_info.html.twig b/templates/_partials/_assignment_info.html.twig index 20c1cfc..13d2695 100644 --- a/templates/_partials/_assignment_info.html.twig +++ b/templates/_partials/_assignment_info.html.twig @@ -30,7 +30,7 @@ Busbegleitung
- ab {{ assignment.pickup|bpn_pickup_label }} + {{ assignment.pickup|bpn_pickup_label }}
{% endif %}
diff --git a/templates/_partials/_assignment_info_compact.html.twig b/templates/_partials/_assignment_info_compact.html.twig index 8c44310..cb17070 100644 --- a/templates/_partials/_assignment_info_compact.html.twig +++ b/templates/_partials/_assignment_info_compact.html.twig @@ -30,7 +30,7 @@ Busbegleitung
- ab {{ assignment.pickup|bpn_pickup_label }} + {{ assignment.pickup|bpn_pickup_label }}
{% endif %}
diff --git a/templates/_partials/_teamer_license_info.html.twig b/templates/_partials/_teamer_license_info.html.twig new file mode 100644 index 0000000..25d19e3 --- /dev/null +++ b/templates/_partials/_teamer_license_info.html.twig @@ -0,0 +1,26 @@ +

+ Lizenzen +

+ diff --git a/templates/_partials/_teamer_training_info.html.twig b/templates/_partials/_teamer_training_info.html.twig new file mode 100644 index 0000000..e7b5374 --- /dev/null +++ b/templates/_partials/_teamer_training_info.html.twig @@ -0,0 +1,17 @@ +

+ Fortbildungen +

+ diff --git a/templates/admin/assignment/detail.html.twig b/templates/admin/assignment/detail.html.twig index 9b45b2f..e8089bf 100644 --- a/templates/admin/assignment/detail.html.twig +++ b/templates/admin/assignment/detail.html.twig @@ -34,9 +34,16 @@ {% for application in applications %} - - {{ application.teamer }} - + {{ application.requests|nl2br|default('-') }} @@ -117,9 +124,16 @@ {% for disposition in dispositions %} - - {{ disposition.teamer }} - + {{ disposition.remarks|nl2br|default('-') }} diff --git a/templates/admin/teamer/info.html.twig b/templates/admin/teamer/info.html.twig new file mode 100644 index 0000000..1c08e53 --- /dev/null +++ b/templates/admin/teamer/info.html.twig @@ -0,0 +1,43 @@ +
+
+ {% include '_partials/_teamer_training_info.html.twig' %} + {% include '_partials/_teamer_license_info.html.twig' %} +

+ Zustiege +

+
    + {% for pickup in teamer.pickups %} +
  • + {{ pickup|bpn_pickup_label }} +
  • + {% endfor %} +
+

+ Letzte Einsätze +

+
    + {% for disposition in recentDispositions %} + {% set destination = disposition.assignment.destination %} +
  • + {{ destination.product }} + {{ destination.dateFrom|date('d.m.y') }} -
    {{ destination.dateTo|date('d.m.y') }}
    +
  • + {% else %} +
  • + - +
  • + {% endfor %} +
+
+
+ {% if teamer.photo %} + {{ teamer.firstName }} + {% else %} +
+ {{ icon('user', 'w-32 h-32 text-gray-200') }} +
+ {% endif %} +
+
diff --git a/templates/admin/teamer/skills.html.twig b/templates/admin/teamer/skills.html.twig index 7c70dab..42df112 100644 --- a/templates/admin/teamer/skills.html.twig +++ b/templates/admin/teamer/skills.html.twig @@ -50,30 +50,8 @@ {% endfor %} - + + {% include '_partials/_teamer_license_info.html.twig' %}