add message link to staff note signature notifications

This commit is contained in:
Ryan Prather 2025-01-01 06:00:46 +00:00
parent c3bc40561b
commit 81ba235b08
4 changed files with 37 additions and 10 deletions

View File

@ -202,6 +202,7 @@ class StaffController extends AbstractController
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
/** @var StaffNote $note */
$note = $form->getData(); $note = $form->getData();
$note->setMemberCase($case); $note->setMemberCase($case);
@ -209,9 +210,12 @@ class StaffController extends AbstractController
$sup = $this->entityManager->getRepository(Supervision::class)->findOneBy(['worker' => $user]); $sup = $this->entityManager->getRepository(Supervision::class)->findOneBy(['worker' => $user]);
$msg = MessageFactory::createStaffing($user, $sup->getSupervisor()); $msg = MessageFactory::createStaffing($user, $sup->getSupervisor());
$this->entityManager->persist($msg);
$this->entityManager->persist($note); $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->entityManager->flush();
$this->addFlash('info', 'Staff note added'); $this->addFlash('info', 'Staff note added');
@ -256,7 +260,7 @@ class StaffController extends AbstractController
$note = $this->entityManager->getRepository(StaffNote::class)->find($noteId); $note = $this->entityManager->getRepository(StaffNote::class)->find($noteId);
$case = $note->getMemberCase(); $case = $note->getMemberCase();
if ($note->supervisorSignDateTime || $note->workerSignDateTime) { if ($note->getSupervisorSignDateTime() || $note->getWorkerSignDateTime()) {
$this->addFlash('error', 'This note has already been signed'); $this->addFlash('error', 'This note has already been signed');
return $this->redirectToRoute('app_staff_view_note', ['noteId' => $noteId]); return $this->redirectToRoute('app_staff_view_note', ['noteId' => $noteId]);
} }
@ -362,10 +366,10 @@ class StaffController extends AbstractController
$note->setSupervisorSignDateTime(new \DateTimeImmutable()); $note->setSupervisorSignDateTime(new \DateTimeImmutable());
/** @var UserCase $uc */ /** @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 = MessageFactory::createSupervisorSignStaffNote($user, $uc->getUser(), $case);
$msg->setLink('/staff/sign-my-note/' . $note->getId());
$this->entityManager->persist($msg); $this->entityManager->persist($msg);
$this->entityManager->flush(); $this->entityManager->flush();

View File

@ -41,6 +41,9 @@ class Messages
#[ORM\JoinColumn(nullable: false)] #[ORM\JoinColumn(nullable: false)]
private ?User $sender = null; private ?User $sender = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $link = null;
public function getId(): ?Uuid public function getId(): ?Uuid
{ {
return $this->id; return $this->id;
@ -141,4 +144,16 @@ class Messages
'message' => $this->message 'message' => $this->message
]; ];
} }
public function getLink(): ?string
{
return $this->link;
}
public function setLink(?string $link): static
{
$this->link = $link;
return $this;
}
} }

View File

@ -36,6 +36,11 @@
<input type='date' name='{{ field_name(form.date) }}' value='{{ field_value(form.date) }}' id='note_form_date' class='form-control'/> <input type='date' name='{{ field_name(form.date) }}' value='{{ field_value(form.date) }}' id='note_form_date' class='form-control'/>
</div> </div>
<div class='input-group input-group-outline mb-3 is-filled'>
<label for='note_form_recommendations' class='form-label'>Recommendations</label>
<input type='text' name='note_form_recommendations' value='{{ note.recommendations }}' disabled='disabled' class='form-control'/>
</div>
<div class='input-group input-group-outline mb-3'> <div class='input-group input-group-outline mb-3'>
{{ form_row(form.servicesProvided) }} {{ form_row(form.servicesProvided) }}
</div> </div>

View File

@ -17,11 +17,14 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class='col'> <div class='col'>
<div class='input-group input-group-outline mb-3'> <div>
<p>Supervisor Signed: <div>Supervisor:
{{ note.supervisorSignDateTime|date("F j, Y h:i a") }}</p> {{ note.supervisorSignDateTime|date("F j, Y h:i a") }}</div>
<p>Case Worker Signed: <div>Case Worker:
{{ note.workerSignDatetime|date("F j, Y h:i a") }}</p> {% if note.workerSignDatetime %}
{{ note.workerSignDatetime|date("F j, Y h:i a") }}{% else %}Unsigned
{% endif %}
</div>
</div> </div>
<div class='input-group input-group-outline mb-3'> <div class='input-group input-group-outline mb-3'>