diff --git a/src/Controller/MemberController.php b/src/Controller/MemberController.php new file mode 100644 index 0000000..b485392 --- /dev/null +++ b/src/Controller/MemberController.php @@ -0,0 +1,174 @@ +navLinks = NavList::LIST; + } + + #[Route('/list-members/{id}', name: 'app_case_members')] + public function listMembers(Request $request, #[CurrentUser()] User $user, string $id): Response + { + $case = $this->entityManager->getRepository(MemberCase::class)->find($id); + $members = $this->entityManager->getRepository(Member::class)->getCaseMembersByName($case); + + return $this->render( + 'internal/cases/members/list-members.html.twig', + array_merge( + $this->navLinks, + [ + 'breadcrumbs' => [ + 'Case', + 'Members' + ], + 'notifications' => $user->retrieveUnreadNotifications(), + 'case' => $case, + 'members' => $members, + ] + ) + ); + } + + #[Route('/add-member/{id}', name: 'app_case_add_member')] + public function addMember(Request $request, #[CurrentUser()] User $user, string $id): Response + { + /** @var MemberCase $case */ + $case = $this->entityManager->getRepository(MemberCase::class)->find($id); + + $member = new Member(); + $form = $this->createForm(MemberFormType::class, $member); + + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $member->setCaseId($case) + ->setFirstName($form->get('firstName')->getData()) + ->setLastName($form->get('lastName')->getData()) + ->setDob($form->get('dob')->getData()) + ->setGender($form->get('gender')->getData()) + ->setRace($form->get('race')->getData()) + ->setLanguage($form->get('language')->getData()) + ->setPersonalId($form->get('personalId')->getData()) + ->setEmergencyContact($form->get('emergencyContact')->getData()) + ->setEmail($form->get('email')->getData()) + ->setAddress($form->get('address')->getData()) + ->setCity($form->get('city')->getData()) + ->setState($form->get('state')->getData()) + ->setZip($form->get('zip')->getData()) + ->setPhone($form->get('phone')->getData()) + ->setRelationship($form->get('relationship')->getData()) + ->setDayPhone($form->get('dayPhone')->getData()) + ->setEveningPhone($form->get('eveningPhone')->getData()) + ->setCellPhone($form->get('cellPhone')->getData()) + ->setSchool($form->get('school')->getData()) + ->setMaritalStatus($form->get('maritalStatus')->getData()) + ->setChild($form->get('isChild')->getData()) + ->setParent($form->get('isParent')->getData()) + ->setAdultChild($form->get('isAdultChild')->getData()) + ->setLegalGuardian($form->get('isLegalGuardian')->getData()) + ->setParentsLiveTogether($form->get('parentsLiveTogether')->getData()) + ->setDcsApproved($form->get('dcsApproved')->getData()) + ; + + $this->entityManager->persist($member); + $this->entityManager->flush(); + + return $this->redirectToRoute('app_case_members', ['id' => $case->getId()]); + } + + return $this->render( + 'internal/cases/members/add-member.html.twig', + array_merge( + $this->navLinks, + [ + 'breadcrumbs' => [ + 'Case', + 'Members', + 'Add Member' + ], + 'notifications' => $user->retrieveUnreadNotifications(), + 'case' => $case, + 'form' => $form->createView(), + ] + ) + ); + } + + #[Route('/case/{caseId}/edit-member/{memberId}', name: 'app_case_edit_member')] + public function editMember(Request $request, #[CurrentUser()] User $user, string $caseId, string $memberId): Response + { + $member = $this->entityManager->getRepository(Member::class)->find($memberId); + + $form = $this->createForm(MemberFormType::class, $member); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $member->setFirstName($form->get('firstName')->getData()) + ->setLastName($form->get('lastName')->getData()) + ->setDob($form->get('dob')->getData()) + ->setGender($form->get('gender')->getData()) + ->setRace($form->get('race')->getData()) + ->setLanguage($form->get('language')->getData()) + ->setPersonalId($form->get('personalId')->getData()) + ->setEmergencyContact($form->get('emergencyContact')->getData()) + ->setEmail($form->get('email')->getData()) + ->setAddress($form->get('address')->getData()) + ->setCity($form->get('city')->getData()) + ->setState($form->get('state')->getData()) + ->setZip($form->get('zip')->getData()) + ->setPhone($form->get('phone')->getData()) + ->setRelationship($form->get('relationship')->getData()) + ->setDayPhone($form->get('dayPhone')->getData()) + ->setEveningPhone($form->get('eveningPhone')->getData()) + ->setCellPhone($form->get('cellPhone')->getData()) + ->setSchool($form->get('school')->getData()) + ->setMaritalStatus($form->get('maritalStatus')->getData()) + ->setChild($form->get('isChild')->getData()) + ->setParent($form->get('isParent')->getData()) + ->setAdultChild($form->get('isAdultChild')->getData()) + ->setLegalGuardian($form->get('isLegalGuardian')->getData()) + ->setParentsLiveTogether($form->get('parentsLiveTogether')->getData()) + ->setDcsApproved($form->get('dcsApproved')->getData()) + ; + + $this->entityManager->flush(); + + return $this->redirectToRoute('app_case_members', ['id' => $caseId]); + } + + return $this->render( + 'internal/cases/members/edit-member.html.twig', + array_merge( + $this->navLinks, + [ + 'breadcrumbs' => [ + 'Case', + 'Members', + 'Edit Member' + ], + 'notifications' => $user->retrieveUnreadNotifications(), + 'member' => $member, + 'form' => $form->createView(), + 'caseId' => $caseId, + ] + ) + ); + } +} diff --git a/templates/internal/cases/members/add-member.html.twig b/templates/internal/cases/members/add-member.html.twig new file mode 100644 index 0000000..f0dac29 --- /dev/null +++ b/templates/internal/cases/members/add-member.html.twig @@ -0,0 +1,184 @@ +{% extends 'base.html.twig' %} + +{% block body %} + {{ block('nav', 'internal/libs/nav.html.twig') }} + +
+ {{ block('topnav', 'internal/libs/top-nav.html.twig') }} + +
+ +
+
+

Add Case Member

+

{{ case.caseName }}

+
+
+
+ {{ form_errors(form) }} + + {{ form_start(form) }} +
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+    + +
+ +
+    + +
+ +
+    + +
+ +
+    + +
+ +
+    + +
+ +
+ + +
+
+
+
+
+ +
+
+ {{ form_end(form) }} +
+
+
+
+
+{% endblock %} diff --git a/templates/internal/cases/members/edit-member.html.twig b/templates/internal/cases/members/edit-member.html.twig new file mode 100644 index 0000000..19c2a69 --- /dev/null +++ b/templates/internal/cases/members/edit-member.html.twig @@ -0,0 +1,185 @@ +{% extends 'base.html.twig' %} + +{% block body %} + {{ block('nav', 'internal/libs/nav.html.twig') }} + +
+ {{ block('topnav', 'internal/libs/top-nav.html.twig') }} + +
+ +
+
+

Edit Case Member

+

+ {{ member.firstName }} + {{ member.lastName }} +

+
+
+
+ {{ form_errors(form) }} + + {{ form_start(form) }} + +
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + +
+ +
+    + +
+ +
+    + +
+ +
+    + +
+ +
+    + +
+ +
+    + +
+ +
+    + +
+
+
+
+
+ +
+
+ {{ form_end(form) }} +
+
+
+
+
+{% endblock %} diff --git a/templates/internal/cases/members/list-members.html.twig b/templates/internal/cases/members/list-members.html.twig new file mode 100644 index 0000000..189f103 --- /dev/null +++ b/templates/internal/cases/members/list-members.html.twig @@ -0,0 +1,92 @@ +{% extends 'base.html.twig' %} + +{% block title %}Case Member List +{% endblock %} + +{% block body %} + {{ block('nav', 'internal/libs/nav.html.twig') }} + +
+ {{ block('topnav', 'internal/libs/top-nav.html.twig') }} + +
+
+
+
+
+
+
+
Member List
+
+
+ +
+
+
+
+
+ + + + + + + + + + + + {% for member in members %} + {% set age = '' %} + + + + + + + + {% endfor %} + +
NameDOBRelationshipPhone
+
+
+
+ + {% if not member.isChild %} + {% if member.dcsApproved %}thumb_up{% else %}thumb_down + {% endif %} + {% endif %} + + {{ member.firstName }} + {{ member.lastName }} + ({{ date().diff(date(member.dob)).y }}) +
+

+ {{ member.email }} +

+
+
+
+

+ {{ member.dob|date("F j, Y") }} +

+
+

{{ member.relationship.value }}

+
+ {% if member.phone %} + {{ member.getFormattedPhone() }} + {% endif %} + + + edit + +
+
+
+
+
+
+
+ +
+{% endblock %}