diff --git a/src/Controller/StaffController.php b/src/Controller/StaffController.php index b407f3f..791b06a 100644 --- a/src/Controller/StaffController.php +++ b/src/Controller/StaffController.php @@ -202,6 +202,7 @@ class StaffController extends AbstractController $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { + /** @var StaffNote $note */ $note = $form->getData(); $note->setMemberCase($case); @@ -209,9 +210,12 @@ class StaffController extends AbstractController $sup = $this->entityManager->getRepository(Supervision::class)->findOneBy(['worker' => $user]); $msg = MessageFactory::createStaffing($user, $sup->getSupervisor()); - - $this->entityManager->persist($msg); $this->entityManager->persist($note); + $this->entityManager->persist($msg); + $this->entityManager->flush(); + + $msg->setLink("/staff/sup-sign-note/" . $note->getId()); + $this->entityManager->persist($msg); $this->entityManager->flush(); $this->addFlash('info', 'Staff note added'); @@ -256,7 +260,7 @@ class StaffController extends AbstractController $note = $this->entityManager->getRepository(StaffNote::class)->find($noteId); $case = $note->getMemberCase(); - if ($note->supervisorSignDateTime || $note->workerSignDateTime) { + if ($note->getSupervisorSignDateTime() || $note->getWorkerSignDateTime()) { $this->addFlash('error', 'This note has already been signed'); return $this->redirectToRoute('app_staff_view_note', ['noteId' => $noteId]); } @@ -362,10 +366,10 @@ class StaffController extends AbstractController $note->setSupervisorSignDateTime(new \DateTimeImmutable()); /** @var UserCase $uc */ - $uc = $this->entityManager->getRepository(UserCase::class)->findOneBy(['case' => $case]); + $uc = $this->entityManager->getRepository(UserCase::class)->findOneBy(['memberCase' => $case]); $msg = MessageFactory::createSupervisorSignStaffNote($user, $uc->getUser(), $case); - + $msg->setLink('/staff/sign-my-note/' . $note->getId()); $this->entityManager->persist($msg); $this->entityManager->flush(); diff --git a/src/Entity/Messages.php b/src/Entity/Messages.php index 906e35d..bfe4ad0 100644 --- a/src/Entity/Messages.php +++ b/src/Entity/Messages.php @@ -41,6 +41,9 @@ class Messages #[ORM\JoinColumn(nullable: false)] private ?User $sender = null; + #[ORM\Column(length: 255, nullable: true)] + private ?string $link = null; + public function getId(): ?Uuid { return $this->id; @@ -141,4 +144,16 @@ class Messages 'message' => $this->message ]; } + + public function getLink(): ?string + { + return $this->link; + } + + public function setLink(?string $link): static + { + $this->link = $link; + + return $this; + } } diff --git a/templates/internal/staff/notes/sign-note.html.twig b/templates/internal/staff/notes/sign-note.html.twig index 32f6448..8bdb112 100644 --- a/templates/internal/staff/notes/sign-note.html.twig +++ b/templates/internal/staff/notes/sign-note.html.twig @@ -36,6 +36,11 @@ +
Supervisor Signed: - {{ note.supervisorSignDateTime|date("F j, Y h:i a") }}
-Case Worker Signed: - {{ note.workerSignDatetime|date("F j, Y h:i a") }}
+