fix: NoteController
Save members * get note members working, still need to setup editing
This commit is contained in:
parent
09ae2756c2
commit
df29fd0d99
@ -84,7 +84,7 @@ class NoteController extends AbstractController
|
|||||||
$referral = $this->entityManager->getRepository(Referral::class)->find($referralId);
|
$referral = $this->entityManager->getRepository(Referral::class)->find($referralId);
|
||||||
$this->entityManager->getRepository(Referral::class)->populateNotes($referral);
|
$this->entityManager->getRepository(Referral::class)->populateNotes($referral);
|
||||||
|
|
||||||
$members = $this->entityManager->getRepository(Member::class)->findBy(['caseId' => $referral->getMemberCase()]);
|
$members = $this->entityManager->getRepository(Member::class)->findBy(['memberCase' => $referral->getMemberCase()]);
|
||||||
$defaultMethod = NoteMethod::BILLABLE;
|
$defaultMethod = NoteMethod::BILLABLE;
|
||||||
$defaultLocation = NoteLocation::COMMUNITY_OUTING;
|
$defaultLocation = NoteLocation::COMMUNITY_OUTING;
|
||||||
$form = $this->createForm(StandardNoteFormType::class, null, ['members' => $members]);
|
$form = $this->createForm(StandardNoteFormType::class, null, ['members' => $members]);
|
||||||
@ -113,6 +113,27 @@ class NoteController extends AbstractController
|
|||||||
$this->entityManager->persist($note);
|
$this->entityManager->persist($note);
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
|
||||||
|
if ($form->get('members')->getData()) {
|
||||||
|
foreach ($form->get('members')->getData() as $mem) {
|
||||||
|
if ($referral->getServiceCode() == ReferralServiceType::VS_THBB) {
|
||||||
|
$nm = new VisitNoteMembers();
|
||||||
|
$nm->setVisitNote($note)
|
||||||
|
->setPerson($mem)
|
||||||
|
;
|
||||||
|
} else {
|
||||||
|
$nm = new StandardNoteMember();
|
||||||
|
$nm->setStandardNote($note)
|
||||||
|
->setPerson($mem)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->entityManager->persist($nm);
|
||||||
|
$this->entityManager->flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->addFlash('success', 'Note added successfully');
|
||||||
|
|
||||||
return $this->redirectToRoute('app_list_notes');
|
return $this->redirectToRoute('app_list_notes');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,6 +148,7 @@ class NoteController extends AbstractController
|
|||||||
'notifications' => Libs::getMessages($user, $this->entityManager),
|
'notifications' => Libs::getMessages($user, $this->entityManager),
|
||||||
'referral' => $referral,
|
'referral' => $referral,
|
||||||
'form' => $form,
|
'form' => $form,
|
||||||
|
'members' => $members,
|
||||||
'default_method' => $defaultMethod,
|
'default_method' => $defaultMethod,
|
||||||
'default_location' => $defaultLocation,
|
'default_location' => $defaultLocation,
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user