From 40d4edbf9660a02a57b46157b923001b23b3420b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Wed, 18 Oct 2023 18:56:26 +0200 Subject: [PATCH] Feat: Show icon representing application or disposition status --- assets/images/icons.svg | 4 ++++ assets/styles/components/button.css | 6 +++++- src/Controller/Teamer/IndexController.php | 2 +- src/Repository/AssignmentRepository.php | 13 +++++++++---- templates/teamer/index.html.twig | 19 ++++++++++++++----- 5 files changed, 33 insertions(+), 11 deletions(-) diff --git a/assets/images/icons.svg b/assets/images/icons.svg index f0dcfe4..bda3176 100644 --- a/assets/images/icons.svg +++ b/assets/images/icons.svg @@ -159,6 +159,10 @@ + + + + diff --git a/assets/styles/components/button.css b/assets/styles/components/button.css index 7bdd8a6..6528066 100644 --- a/assets/styles/components/button.css +++ b/assets/styles/components/button.css @@ -2,10 +2,14 @@ @apply inline-flex justify-center rounded-lg text-sm uppercase font-semibold py-2.5 px-4 bg-primary text-white hover:bg-primary/80 shadow-md; } +.btn--small { + @apply py-1 px-2 rounded-sm; +} + .btn--secondary { @apply bg-secondary text-gray-800 hover:bg-secondary/80; } .btn--active { @apply shadow-none; -} \ No newline at end of file +} diff --git a/src/Controller/Teamer/IndexController.php b/src/Controller/Teamer/IndexController.php index c72f536..ea718b8 100644 --- a/src/Controller/Teamer/IndexController.php +++ b/src/Controller/Teamer/IndexController.php @@ -34,7 +34,7 @@ class IndexController extends AbstractController $query = $this ->assignmentRepository - ->getListQuery() + ->getListQuery($teamer) ; $pagination = $this->paginator->paginate( diff --git a/src/Repository/AssignmentRepository.php b/src/Repository/AssignmentRepository.php index fd26356..5d3660e 100644 --- a/src/Repository/AssignmentRepository.php +++ b/src/Repository/AssignmentRepository.php @@ -6,6 +6,7 @@ use App\Entity\Assignment; use App\Entity\Teamer; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\ORM\Query; +use Doctrine\ORM\Query\Expr\Join; use Doctrine\Persistence\ManagerRegistry; /** @@ -31,15 +32,19 @@ class AssignmentRepository extends ServiceEntityRepository ->select('assignment', 'destination', 'job_profile', 'application', 'disposition') ->innerJoin('assignment.destination', 'destination') ->innerJoin('assignment.jobProfile', 'job_profile') - ->leftJoin('assignment.applications', 'application') - ->leftJoin('assignment.dispositions', 'disposition') ; if (null !== $teamer) { $qb - ->where($qb->expr()->eq('application.teamer', ':teamer')) + ->leftJoin('assignment.applications', 'application', Join::WITH, 'application.teamer = :teamer') + ->leftJoin('assignment.dispositions', 'disposition', Join::WITH, 'disposition.teamer = :teamer') ->setParameter('teamer', $teamer) ; + } else { + $qb + ->leftJoin('assignment.applications', 'application') + ->leftJoin('assignment.dispositions', 'disposition') + ; } return $qb->getQuery(); @@ -51,7 +56,7 @@ class AssignmentRepository extends ServiceEntityRepository $qb ->select('assignment', 'destination', 'job_profile') - ->innerJoin('assignment.teamers', 'teamer', 'WITH', 'teamer = :teamer') + ->innerJoin('assignment.teamers', 'teamer', Join::WITH, 'teamer = :teamer') ->innerJoin('assignment.destination', 'destination') ->innerJoin('assignment.jobProfile', 'job_profile') ->leftJoin('assignment.applications', 'application') diff --git a/templates/teamer/index.html.twig b/templates/teamer/index.html.twig index 9a95eba..8e8842c 100644 --- a/templates/teamer/index.html.twig +++ b/templates/teamer/index.html.twig @@ -65,11 +65,20 @@ {{ assignment.effectivePickupDate ? assignment.effectivePickupDate|date('d.m.Y') : '' }} - + {% if assignment.applications|length %} + {% set icon = 'hourglass' %} + {% set class = 'bg-yellow-100 text-yellow-800 hover:bg-yellow-50' %} + {% elseif assignment.dispositions|length %} + {% set icon = 'check' %} + {% set class = 'bg-green-100 text-green-700 hover:bg-green-50' %} + {% else %} + {% set icon = 'info' %} + {% set class = 'btn--info' %} + {% endif %} + + {{ icon(icon, 'w-4 h-4') }} + {% else %}