From 847af5341c9dfe8dae79b5fb591f8b8d57afe2bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Sat, 21 Oct 2023 16:41:57 +0200 Subject: [PATCH] Task: Improve layout --- migrations/Version20231021133634.php | 35 ++++++ src/Entity/Application.php | 15 +++ src/Repository/AssignmentRepository.php | 14 ++- .../_partials/_assignment_info.html.twig | 106 +++++++++++------- .../_assignment_info_compact.html.twig | 91 ++++++++------- .../_assignment_requirements_info.html.twig | 2 +- .../_partials/_description_list.html.twig | 12 ++ templates/_partials/_errorbox.html.twig | 4 + templates/_partials/_infobox.html.twig | 4 + templates/admin/assignment/detail.html.twig | 4 +- templates/teamer/application/index.html.twig | 33 +++--- templates/teamer/assignment/index.html.twig | 53 +++++---- templates/teamer/disposition/detail.html.twig | 63 ++++------- templates/teamer/index.html.twig | 16 ++- 14 files changed, 278 insertions(+), 174 deletions(-) create mode 100644 migrations/Version20231021133634.php create mode 100644 templates/_partials/_description_list.html.twig create mode 100644 templates/_partials/_errorbox.html.twig create mode 100644 templates/_partials/_infobox.html.twig diff --git a/migrations/Version20231021133634.php b/migrations/Version20231021133634.php new file mode 100644 index 0000000..c0bb06d --- /dev/null +++ b/migrations/Version20231021133634.php @@ -0,0 +1,35 @@ +addSql('ALTER TABLE application ADD remarks_by_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE application ADD CONSTRAINT FK_A45BDDC1DF01D017 FOREIGN KEY (remarks_by_id) REFERENCES user (id)'); + $this->addSql('CREATE INDEX IDX_A45BDDC1DF01D017 ON application (remarks_by_id)'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE application DROP FOREIGN KEY FK_A45BDDC1DF01D017'); + $this->addSql('DROP INDEX IDX_A45BDDC1DF01D017 ON application'); + $this->addSql('ALTER TABLE application DROP remarks_by_id'); + } +} diff --git a/src/Entity/Application.php b/src/Entity/Application.php index 3b342d7..801d8a2 100644 --- a/src/Entity/Application.php +++ b/src/Entity/Application.php @@ -40,6 +40,9 @@ class Application implements TimestampableEntityInterface #[ORM\Column(type: Types::TEXT, nullable: true)] private ?string $remarks = null; + #[ORM\ManyToOne] + private ?User $remarksBy = null; + public function __construct(Assignment $assignment, Teamer $teamer) { $this->uuid = Uuid::v4(); @@ -143,4 +146,16 @@ class Application implements TimestampableEntityInterface return $count === $requiredTrainings->count(); } + + public function getRemarksBy(): ?User + { + return $this->remarksBy; + } + + public function setRemarksBy(?User $remarksBy): static + { + $this->remarksBy = $remarksBy; + + return $this; + } } diff --git a/src/Repository/AssignmentRepository.php b/src/Repository/AssignmentRepository.php index 4244686..543f407 100644 --- a/src/Repository/AssignmentRepository.php +++ b/src/Repository/AssignmentRepository.php @@ -2,6 +2,7 @@ namespace App\Repository; +use App\Entity\Application; use App\Entity\Assignment; use App\Entity\Teamer; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; @@ -37,14 +38,15 @@ class AssignmentRepository extends ServiceEntityRepository if (null !== $teamer) { $qb - ->leftJoin('assignment.applications', 'application', Join::WITH, 'application.teamer = :teamer') - ->leftJoin('assignment.dispositions', 'disposition', Join::WITH, 'disposition.teamer = :teamer') + ->leftJoin('assignment.applications', 'application', Join::WITH, $qb->expr()->eq('application.teamer', ':teamer')) + ->leftJoin('assignment.dispositions', 'disposition', Join::WITH, $qb->expr()->eq('disposition.teamer', ':teamer')) ->setParameter('teamer', $teamer) ; } else { $qb - ->leftJoin('assignment.applications', 'application') + ->leftJoin('assignment.applications', 'application', Join::WITH, $qb->expr()->neq('application.status', ':status')) ->leftJoin('assignment.dispositions', 'disposition') + ->setParameter('status', Application::STATUS_REJECTED) ; } @@ -59,9 +61,9 @@ class AssignmentRepository extends ServiceEntityRepository ->select('assignment', 'destination', 'job_profile', 'application', 'disposition') ->innerJoin('assignment.destination', 'destination') ->innerJoin('assignment.jobProfile', 'job_profile') - ->innerJoin('assignment.teamers', 'teamer', Join::WITH, 'teamer = :teamer') - ->leftJoin('assignment.applications', 'application', Join::WITH, 'application.teamer = :teamer') - ->leftJoin('assignment.dispositions', 'disposition', Join::WITH, 'disposition.teamer = :teamer') + ->innerJoin('assignment.teamers', 'teamer', Join::WITH, $qb->expr()->eq('teamer', ':teamer')) + ->leftJoin('assignment.applications', 'application', Join::WITH, $qb->expr()->eq('application.teamer', ':teamer')) + ->leftJoin('assignment.dispositions', 'disposition', Join::WITH, $qb->expr()->eq('disposition.teamer', ':teamer')) ->where($qb->expr()->isNull('assignment.deletedAt')) ->setParameter('teamer', $teamer) ; diff --git a/templates/_partials/_assignment_info.html.twig b/templates/_partials/_assignment_info.html.twig index 76078bb..ed4f2d4 100644 --- a/templates/_partials/_assignment_info.html.twig +++ b/templates/_partials/_assignment_info.html.twig @@ -1,52 +1,76 @@ -
-
- Jobprofil +
+
+
+ Jobprofil +
+
+ {{ assignment.jobProfile.name }} +
-
- {{ assignment.jobProfile.name }} +
+
+ Destination +
+
+ {{ assignment.destination.product }}, {{ assignment.destination.hotel }} +
-
- Destination -
-
- {{ assignment.destination.product }} -
- {{ assignment.destination.hotel }} -
-
- Einsatztermin -
-
- {{ assignment.effectivePeriod.start|date('d.m.Y') }} - {{ assignment.effectivePeriod.end|date('d.m.Y') }} +
+
+ Einsatztermin +
+
+ {{ assignment.effectivePeriod.start|date('d.m.Y') }} - {{ assignment.effectivePeriod.end|date('d.m.Y') }} +
{% if assignment.pickup and assignment.pickupDate %} -
- Busabfahrt +
+
+ Busabfahrt +
+
+ {{ assignment.pickupDate|date('d.m.Y') }} +
-
- {{ assignment.pickupDate|date('d.m.Y') }} -
-
- Busbegleitung -
-
- {{ assignment.pickup|bpn_pickup_label }} +
+
+ Busbegleitung +
+
+ {{ assignment.pickup|bpn_pickup_label }} +
{% endif %} -
- Du bekommst -
-
- {{ assignment.benefits|nl2list }} +
+
+ Du bekommst +
+
+ {{ assignment.benefits|nl2list }} +
{% if assignment.fees|length %} -
- Honorar -
-
- {% for fee in assignment.fees %} - {{ fee.name }} {{ fee.value|format_money }} - {% endfor %} +
+
+ Honorar +
+
+ {% for fee in assignment.fees %} + {{ fee.name }} {{ fee.value|format_money }} + {% endfor %} +
{% endif %} -
+ {% if additional is defined %} + {% for item in additional %} +
+
+ {{ item.type }} +
+
+ {{ item.description|raw }} +
+
+ {% endfor %} + {% endif %} +
diff --git a/templates/_partials/_assignment_info_compact.html.twig b/templates/_partials/_assignment_info_compact.html.twig index cb17070..32f8474 100644 --- a/templates/_partials/_assignment_info_compact.html.twig +++ b/templates/_partials/_assignment_info_compact.html.twig @@ -1,49 +1,62 @@
-
- Jobprofil {{ assignment.jobProfile.name }} -
-
-
- Destination +
+
+
+ Jobprofil +
+
+ {{ assignment.jobProfile.name }} +
-
- {{ assignment.destination.product }} -
- {{ assignment.destination.hotel }} +
+
+ Destination +
+
+ {{ assignment.destination.product }}, {{ assignment.destination.hotel }} +
-
- Einsatztermin +
+
+ Einsatztermin +
+
+ {{ assignment.effectivePeriod.start|date('d.m.Y') }} - {{ assignment.effectivePeriod.end|date('d.m.Y') }} +
-
- {{ assignment.effectivePeriod.start|date('d.m.Y') }} - {{ assignment.effectivePeriod.end|date('d.m.Y') }} -
-
-
+
+
{% if assignment.pickup and assignment.pickupDate %} -
- Busabfahrt +
+
+ Busabfahrt +
+
+ {{ assignment.pickupDate|date('d.m.Y') }} +
-
- {{ assignment.pickupDate|date('d.m.Y') }} -
-
- Busbegleitung -
-
- {{ assignment.pickup|bpn_pickup_label }} +
+
+ Busbegleitung +
+
+ {{ assignment.pickup|bpn_pickup_label }} +
{% endif %} -
- Honorar +
+
+ Honorar +
+
+ {% if assignment.fees|length %} + {% for fee in assignment.fees %} + {{ fee.name }} {{ fee.value|format_money }} + {% endfor %} + {% else %} + - + {% endif %} +
-
- {% if assignment.fees|length %} - {% for fee in assignment.fees %} - {{ fee.name }} {{ fee.value|format_money }} - {% endfor %} - {% else %} - - - {% endif %} -
-
+
diff --git a/templates/_partials/_assignment_requirements_info.html.twig b/templates/_partials/_assignment_requirements_info.html.twig index 472fc99..c72f046 100644 --- a/templates/_partials/_assignment_requirements_info.html.twig +++ b/templates/_partials/_assignment_requirements_info.html.twig @@ -1,5 +1,5 @@