From 6bde369bcdba0656de7a430717726c86f44ec1d5 Mon Sep 17 00:00:00 2001 From: Ryan Prather Date: Sun, 8 Dec 2024 17:07:54 -0500 Subject: [PATCH] Add Enums and formtypes --- src/Enums/GenderType.php | 11 +++++ src/Enums/RaceType.php | 20 ++++++++ src/Enums/RelationshipType.php | 28 +++++++++++ src/Form/EditUserFormType.php | 59 +++++++++++++++++++++++ src/Form/MemberCaseFormType.php | 72 ++++++++++++++++++++++++++++ src/Form/MemberFormType.php | 80 +++++++++++++++++++++++++++++++ src/Form/UserCaseFormType.php | 30 ++++++++++++ src/Form/UserFormType.php | 83 +++++++++++++++++++++++++++++++++ 8 files changed, 383 insertions(+) create mode 100644 src/Enums/GenderType.php create mode 100644 src/Enums/RaceType.php create mode 100644 src/Enums/RelationshipType.php create mode 100644 src/Form/EditUserFormType.php create mode 100644 src/Form/MemberCaseFormType.php create mode 100644 src/Form/MemberFormType.php create mode 100644 src/Form/UserCaseFormType.php create mode 100644 src/Form/UserFormType.php diff --git a/src/Enums/GenderType.php b/src/Enums/GenderType.php new file mode 100644 index 0000000..ce5aa87 --- /dev/null +++ b/src/Enums/GenderType.php @@ -0,0 +1,11 @@ +add('name', TextType::class, [ + 'required' => true, + 'label' => 'Name', + 'attr' => [ + 'class' => 'form-control', + 'placeholder' => 'Name', + ], + ]) + ->add('email', EmailType::class, [ + 'required' => true, + 'label' => 'Email', + 'attr' => [ + 'class' => 'form-control', + 'placeholder' => 'Email', + ], + ]) + ->add('caseWorker', CheckboxType::class) + ->add('caseManager', CheckboxType::class) + ->add('therapist', CheckboxType::class) + ->add('su', CheckboxType::class, ['label' => 'Admin']) + ->add('rateType', EnumType::class, [ + 'class' => RateType::class + ]) + ->add('rate', NumberType::class) + ->add('level', EnumType::class, [ + 'class' => CaseLevel::class, + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => User::class, + ]); + } +} diff --git a/src/Form/MemberCaseFormType.php b/src/Form/MemberCaseFormType.php new file mode 100644 index 0000000..46b893f --- /dev/null +++ b/src/Form/MemberCaseFormType.php @@ -0,0 +1,72 @@ +add('caseNumber', TextType::class, [ + 'required' => true + ]) + ->add('firstName', TextType::class, [ + 'required' => true + ]) + ->add('lastName', TextType::class, [ + 'required' => true + ]) + ->add('referralType') + ->add('admitDate', null, [ + 'widget' => 'single_text', + 'required' => true, + ]) + ->add('closeDate', null, [ + 'widget' => 'single_text', + ]) + ->add('dcsCaseId', TextType::class, [ + 'required' => true + ]) + ->add('insurance') + ->add('medicaid') + ->add('caseEmail') + ->add('level', EnumType::class, [ + 'class' => CaseLevel::class, + ]) + ->add('referralSource', EntityType::class, [ + 'class' => ReferralSource::class, + 'choice_label' => 'name', + ]) + ->add('referralSource2', EntityType::class, [ + 'class' => ReferralSource::class, + 'choice_label' => 'name', + ]) + ->add('address') + ->add('address2') + ->add('city') + ->add('state') + ->add('zip') + ->add('county', EnumType::class, [ + 'class' => County::class, + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => MemberCase::class, + ]); + } +} diff --git a/src/Form/MemberFormType.php b/src/Form/MemberFormType.php new file mode 100644 index 0000000..406e051 --- /dev/null +++ b/src/Form/MemberFormType.php @@ -0,0 +1,80 @@ +add('lastName', null, ['required' => true]) + ->add('firstName', null, ['required' => true]) + ->add('personalId', null, ['required' => true]) + ->add('dob', DateType::class, [ + 'widget' => 'single_text', + 'required' => true + ]) + ->add('emergencyContact') + ->add('phone') + ->add('dayPhone') + ->add('eveningPhone') + ->add('cellPhone') + ->add('email', EmailType::class) + ->add('school') + ->add('address') + ->add('city') + ->add('state') + ->add('zip') + ->add('maritalStatus') + ->add('relationship', EnumType::class, [ + 'class' => RelationshipType::class, + 'required' => true + ]) + ->add('gender', EnumType::class, [ + 'class' => GenderType::class, + 'required' => true + ]) + ->add('race', EnumType::class, [ + 'class' => RaceType::class + ]) + ->add('language') + ->add('isChild', CheckboxType::class, [ + 'mapped' => false + ]) + ->add('isParent', CheckboxType::class, [ + 'mapped' => false + ]) + ->add('isAdultChild', CheckboxType::class, [ + 'mapped' => false + ]) + ->add('isLegalGuardian', CheckboxType::class, [ + 'mapped' => false + ]) + ->add('parentsLiveTogether', CheckboxType::class, [ + 'mapped' => false + ]) + ->add('dcsApproved', CheckboxType::class, [ + 'mapped' => false + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Member::class, + ]); + } +} diff --git a/src/Form/UserCaseFormType.php b/src/Form/UserCaseFormType.php new file mode 100644 index 0000000..7f121d8 --- /dev/null +++ b/src/Form/UserCaseFormType.php @@ -0,0 +1,30 @@ +add('user', EntityType::class, [ + 'class' => User::class, + 'choice_label' => 'name', + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => UserCase::class, + ]); + } +} diff --git a/src/Form/UserFormType.php b/src/Form/UserFormType.php new file mode 100644 index 0000000..04f763c --- /dev/null +++ b/src/Form/UserFormType.php @@ -0,0 +1,83 @@ +add('name', TextType::class, [ + 'label' => 'Name', + 'attr' => [ + 'placeholder' => 'Name', + ], + ]) + ->add('username', TextType::class, [ + 'label' => 'Username', + 'attr' => [ + 'placeholder' => 'Username', + ], + ]) + ->add('email', EmailType::class, [ + 'label' => 'Email', + 'attr' => [ + 'placeholder' => 'Email', + ], + ]) + ->add('password', PasswordType::class, [ + // instead of being set onto the object directly, + // this is read and encoded in the controller + 'mapped' => false, + 'attr' => ['autocomplete' => 'new-password'], + 'constraints' => [ + new NotBlank([ + 'message' => 'Please enter a password', + ]), + new Length([ + 'min' => 6, + 'minMessage' => 'Your password should be at least {{ limit }} characters', + // max length allowed by Symfony for security reasons + 'max' => 4096, + ]), + ], + ]) + ->add('caseWorker', CheckboxType::class) + ->add('caseManager', CheckboxType::class) + ->add('therapist', CheckboxType::class) + ->add('su', CheckboxType::class, [ + 'label' => 'Admin', + ]) + ->add('level', EnumType::class, [ + 'class' => CaseLevel::class, + ]) + ->add('rateType', EnumType::class, [ + 'class' => RateType::class, + ]) + ->add('rate', NumberType::class) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => User::class, + ]); + } +}