diff --git a/src/Controller/DocumentController.php b/src/Controller/DocumentController.php new file mode 100644 index 0000000..8af1018 --- /dev/null +++ b/src/Controller/DocumentController.php @@ -0,0 +1,44 @@ +navLinks = NavList::LIST; + } + + #[Route('/case/{caseId}/doc/{docId}', name: 'app_display_case_doc')] + public function displayCaseDocument(string $caseId, string $docId, #[CurrentUser()] User $user): Response + { + $msgs = Libs::getMessages($user, $this->entityManager); + + $case = $this->entityManager->getRepository(MemberCase::class)->find($caseId); + $doc = $this->entityManager->getRepository(CompanyDocument::class)->find($docId); + $caseDoc = $this->entityManager->getRepository(CaseDocument::class)->getCaseDocument($case, $doc); + + return $this->render( + 'internal/cases/documents/display-case-doc.html.twig', + array_merge( + $this->navLinks, + [ + 'msgs' => $msgs, + 'notificationCount' => count($msgs), + 'breadcrumbs' => [] + ] + ) + ); + } +} \ No newline at end of file diff --git a/src/Form/CaseDocumentFormType.php b/src/Form/CaseDocumentFormType.php new file mode 100644 index 0000000..9284f2a --- /dev/null +++ b/src/Form/CaseDocumentFormType.php @@ -0,0 +1,38 @@ +add('document', EntityType::class, [ + 'class' => CompanyDocument::class, + 'choices' => $docs, + 'multiple' => true, + 'expanded' => true, + 'choice_label' => 'title', + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => CaseDocument::class, + 'docs' => [], + ]); + } +} diff --git a/src/Form/CompanyDocumentFormType.php b/src/Form/CompanyDocumentFormType.php new file mode 100644 index 0000000..70bb287 --- /dev/null +++ b/src/Form/CompanyDocumentFormType.php @@ -0,0 +1,36 @@ +add('title') + ->add('text', TextareaType::class) + ->add('extras', EnumType::class, [ + 'class' => DocumentExtras::class, + 'multiple' => true, + 'expanded' => true, + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => CompanyDocument::class, + ]); + } +} diff --git a/src/Form/MemberCaseFormType.php b/src/Form/MemberCaseFormType.php index caa395e..ac4d765 100644 --- a/src/Form/MemberCaseFormType.php +++ b/src/Form/MemberCaseFormType.php @@ -2,12 +2,14 @@ namespace App\Form; +use App\Entity\CompanyDocument; use App\Entity\MemberCase; use App\Entity\ReferralSource; use App\Enums\CaseLevel; use App\Enums\County; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\EnumType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; @@ -60,6 +62,11 @@ class MemberCaseFormType extends AbstractType ->add('county', EnumType::class, [ 'class' => County::class, ]) + ->add('docs', ChoiceType::class, [ + 'data_class' => CompanyDocument::class, + 'multiple' => true, + 'expanded' => true, + ]) ; } @@ -67,6 +74,7 @@ class MemberCaseFormType extends AbstractType { $resolver->setDefaults([ 'data_class' => MemberCase::class, + 'docs' => [], 'csrf_protection' => true, 'csrf_field_name' => '_token', 'csrf_token_id' => 'member_case',