From cc5cbab4a87b5be9bf3dafd5c37f1c63644caa80 Mon Sep 17 00:00:00 2001 From: Garrett Edmonds <43251554+edmondsgarrett@users.noreply.github.com> Date: Fri, 15 Nov 2024 10:52:58 -0600 Subject: [PATCH] bug/WP-741: Missed bugs follow on (#359) * Import get_registration db util functions to view * Front-end fixes: Add/Remove Entity/Contacts button wrapping, Entity/Contact header styling, add initial value + initial touched for state field * Add style class for bolding nested headers on form * Add some padding above labels for entity and contact entries * Data transfer bugs when pre-loading data to form: for self value now goes to form as string rather than bool, and type display value is mapped to the database value --------- Co-authored-by: Chandra Y --- apcd-cms/src/apps/registrations/views.py | 8 +- .../Forms/Registrations/FormContact.tsx | 2 +- .../Forms/Registrations/FormEntity.tsx | 18 +- .../Registrations/RegistrationForm.module.css | 14 ++ .../Forms/Registrations/RegistrationForm.tsx | 188 +++++++++--------- .../client/src/hooks/registrations/index.ts | 13 +- 6 files changed, 135 insertions(+), 108 deletions(-) diff --git a/apcd-cms/src/apps/registrations/views.py b/apcd-cms/src/apps/registrations/views.py index aae25b68..a614e052 100644 --- a/apcd-cms/src/apps/registrations/views.py +++ b/apcd-cms/src/apps/registrations/views.py @@ -1,4 +1,4 @@ -from apps.utils.apcd_database import create_registration, create_registration_entity, create_registration_contact +from apps.utils.apcd_database import create_registration, create_registration_entity, create_registration_contact, get_registrations, get_registration_entities, get_registration_contacts from apps.utils.apcd_groups import has_apcd_group from apps.utils.registrations_data_formatting import _set_registration from apps.submitter_renewals_listing.views import get_submitter_code @@ -30,10 +30,10 @@ def get(self, request): try: response = get_submitter_code(request.user) submitter_code = json.loads(response.content)['submitter_code'] - submitter_registrations = apcd_database.get_registrations(submitter_code=submitter_code) + submitter_registrations = get_registrations(submitter_code=submitter_code) registration_content = [registration for registration in submitter_registrations if registration[0] == int(reg_id)][0] - registration_entities = apcd_database.get_registration_entities(reg_id=reg_id) - registration_contacts = apcd_database.get_registration_contacts(reg_id=reg_id) + registration_entities = get_registration_entities(reg_id=reg_id) + registration_contacts = get_registration_contacts(reg_id=reg_id) renew = True formatted_reg_data = _set_registration(registration_content, registration_entities, registration_contacts) except Exception as exception: diff --git a/apcd-cms/src/client/src/components/Forms/Registrations/FormContact.tsx b/apcd-cms/src/client/src/components/Forms/Registrations/FormContact.tsx index 3a2beff6..c7a2881f 100644 --- a/apcd-cms/src/client/src/components/Forms/Registrations/FormContact.tsx +++ b/apcd-cms/src/client/src/components/Forms/Registrations/FormContact.tsx @@ -8,7 +8,7 @@ import FieldWrapper from 'core-wrappers/FieldWrapperFormik/FieldWrapperFormik'; export const RegistrationContact: React.FC<{ index: number }> = ({ index }) => { return (
-
Contact {index + 1}
+
CONTACT {index + 1}
= ({ index }) => { return (
-
Entity {index + 1}
+
ENTITY {index + 1}
= ({ index }) => { helpText="Enter in format 12-3456789." /> - + = ({ index }) => { -
Type of Plan
+
Type of Plan
= ({ index }) => { -
File Submission
+
File Submission
= ({ index }) => { -
+
Coverage Estimates {' '} diff --git a/apcd-cms/src/client/src/components/Forms/Registrations/RegistrationForm.module.css b/apcd-cms/src/client/src/components/Forms/Registrations/RegistrationForm.module.css index 18061274..d893ebb8 100644 --- a/apcd-cms/src/client/src/components/Forms/Registrations/RegistrationForm.module.css +++ b/apcd-cms/src/client/src/components/Forms/Registrations/RegistrationForm.module.css @@ -8,3 +8,17 @@ .isRequired { color: red; } + +.contactsAndEntitiesButtons { + background-color: var(--global-color-accent--normal); + border-color: var(--global-color-accent--normal); + color: var(--global-color-primary--xx-light); +} + +.boldedHeader { + font-weight: bold; +} + +.spacedHeader { + margin-top: 2rem; +} \ No newline at end of file diff --git a/apcd-cms/src/client/src/components/Forms/Registrations/RegistrationForm.tsx b/apcd-cms/src/client/src/components/Forms/Registrations/RegistrationForm.tsx index 5de6da7d..557cbe5a 100644 --- a/apcd-cms/src/client/src/components/Forms/Registrations/RegistrationForm.tsx +++ b/apcd-cms/src/client/src/components/Forms/Registrations/RegistrationForm.tsx @@ -128,6 +128,7 @@ const initialValues: RegistrationFormValues = { business_name: '', mailing_address: '', city: '', + state: 'AL', zip_code: '', reg_id: -1, entities: [ @@ -165,21 +166,22 @@ const initialValues: RegistrationFormValues = { }; const initialTouched = { - on_behalf_of: true, - type: true, - entities: [ - { - types_of_plans_commercial: true, - types_of_plans_medicare: true, - types_of_plans_medicaid: true, - types_of_files_eligibility_enrollment: true, - types_of_files_provider: true, - types_of_files_medical: true, - types_of_files_pharmacy: true, - types_of_files_dental: true, - }, - ], -}; + on_behalf_of: true, + type: true, + state: true, + entities: [ + { + types_of_plans_commercial: true, + types_of_plans_medicare: true, + types_of_plans_medicaid: true, + types_of_files_eligibility_enrollment: true, + types_of_files_provider: true, + types_of_files_medical: true, + types_of_files_pharmacy: true, + types_of_files_dental: true, + } + ] +} export const RegistrationForm: React.FC<{ isEdit?: boolean; @@ -404,87 +406,91 @@ export const RegistrationForm: React.FC<{ (displayed after submitting this form).

)} - {' '} - +
+ {' '} + +

Contact Information

{values.contacts.map((contact, index) => ( ))} - {' '} - +
+ {' '} + +