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);
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();

View File

@ -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;
}
}

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'/>
</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'>
{{ form_row(form.servicesProvided) }}
</div>

View File

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