From cd78e45097a789141d84a3c99a025d1bc17bc483 Mon Sep 17 00:00:00 2001 From: Tom Brooks <100007843+OddTomBrooks@users.noreply.github.com> Date: Fri, 26 Jan 2024 13:03:39 -0500 Subject: [PATCH] [EASI-3691] Geography questions updates (#918) * [EASI-3691] Backend updates to geography question feature branch (#902) * initial schema draft for feature * feat: updated data model, migration, and store sql * updated postman collection, tests, and resolvers * chore: cleaned up old comment * [EASI-3738] FE work for geography questions updates (#890) * initial schema draft for feature * feat: updated data model, migration, and store sql * update STATE enum translation * update REGION enum translation * changed the order to match figma * remove the arrayhelper * using new util to make sure read only matches figma order * remove arrayhelper * using new util to render the list according to figma * update snasps * Add geograpghiesTargetedRegionTypes FE, types * renamed region enum and added state enum * making geographiesRegionTypes and geographiesStatesAndTerritories optional * updating name and remove comment * change the multisleect for states * add geographiesStatesAndTerritories & geographiesRegionTypes to queries * updated postman collection, tests, and resolvers * split the side by side view * temp wip * redo the way the readonly renders mjlti list * add optionsrelatedinfo to geographytype * formatOtherList items too * update snaps * add to the mock * textarea -> textinput and remove bold * textarea -> textinput and remove bold * update snaps * add to csv export * adding a empty region state to read only * Add Geography region types label * add more query and types * passing null instead of rendering more copy --------- Co-authored-by: Tom Brooks * chore: regenerated snapshots * fix: missed merge file * Renamed migration --------- Co-authored-by: Gary Zhao Co-authored-by: Patrick Segura --- MINT.postman_collection.json | 4 +- ...Territories_And_GeographiesRegionTypes.sql | 75 +++ pkg/graph/generated/generated.go | 544 ++++++++++++++++++ pkg/graph/gqlresolvers/schema.resolvers.go | 12 + .../plan_general_characteristics_test.go | 17 +- pkg/graph/schema.graphql | 70 +++ pkg/models/plan_general_characteristics.go | 76 +++ .../plan_general_characteristics/create.sql | 6 + .../get_by_id.sql | 2 + .../get_by_model_plan_id_LOADER.sql | 2 + .../plan_general_characteristics/update.sql | 2 + .../__snapshots__/index.test.tsx.snap | 296 +++++----- src/data/mock/readonly.ts | 13 +- .../GetAllGeneralCharacteristics.ts | 2 + .../GetTargetsAndOptions.ts | 2 + src/gql/gen/graphql.ts | 78 ++- .../gen/types/GetAllGeneralCharacteristics.ts | 4 +- src/gql/gen/types/GetTargetsAndOptions.ts | 4 +- .../en-US/modelPlan/generalCharacteristics.ts | 92 ++- src/queries/GetAllModelData.ts | 2 + src/queries/GetAllSingleModelPlan.ts | 2 + src/queries/types/GetAllModelData.ts | 4 +- src/queries/types/GetAllSingleModelData.ts | 4 +- src/types/graphql-global-types.ts | 68 +++ src/types/translation.ts | 4 + src/utils/export/CsvData.ts | 2 + .../__snapshots__/index.test.tsx.snap | 148 ++--- .../ReadOnly/GeneralCharacteristics/index.tsx | 89 ++- .../_components/ReadOnlySection/index.tsx | 8 +- .../__snapshots__/index.test.tsx.snap | 162 +++--- .../TargetsAndOptions/index.test.tsx | 2 + .../TargetsAndOptions/index.tsx | 202 +++++-- 32 files changed, 1610 insertions(+), 388 deletions(-) create mode 100644 migrations/V142__Add_GeographiesStatesAndTerritories_And_GeographiesRegionTypes.sql diff --git a/MINT.postman_collection.json b/MINT.postman_collection.json index 1d2db6743f..6b568b6d56 100644 --- a/MINT.postman_collection.json +++ b/MINT.postman_collection.json @@ -256,8 +256,8 @@ "body": { "mode": "graphql", "graphql": { - "query": "mutation updatePlanGeneralCharacteristics ($id: UUID!, $changes: PlanGeneralCharacteristicsChanges!) {\n updatePlanGeneralCharacteristics (id: $id, changes: $changes) {\n id\n modelPlanID\n isNewModel\n currentModelPlanID\n existingModelID\n resemblesExistingModel\n resemblesExistingModelHow\n resemblesExistingModelNote\n hasComponentsOrTracks\n hasComponentsOrTracksDiffer\n hasComponentsOrTracksNote\n alternativePaymentModelTypes\n alternativePaymentModelNote\n keyCharacteristics\n keyCharacteristicsOther\n keyCharacteristicsNote\n collectPlanBids\n collectPlanBidsNote\n managePartCDEnrollment\n managePartCDEnrollmentNote\n planContractUpdated\n planContractUpdatedNote\n careCoordinationInvolved\n careCoordinationInvolvedDescription\n careCoordinationInvolvedNote\n additionalServicesInvolved\n additionalServicesInvolvedDescription\n additionalServicesInvolvedNote\n communityPartnersInvolved\n communityPartnersInvolvedDescription\n communityPartnersInvolvedNote\n geographiesTargeted\n geographiesTargetedTypes\n geographiesTargetedTypesOther\n geographiesTargetedAppliedTo\n geographiesTargetedAppliedToOther\n geographiesTargetedNote\n participationOptions\n participationOptionsNote\n agreementTypes\n agreementTypesOther\n multiplePatricipationAgreementsNeeded\n multiplePatricipationAgreementsNeededNote\n rulemakingRequired\n rulemakingRequiredDescription\n rulemakingRequiredNote\n authorityAllowances\n authorityAllowancesOther\n authorityAllowancesNote\n waiversRequired\n waiversRequiredTypes\n waiversRequiredNote\n createdBy\n createdDts\n modifiedBy\n modifiedDts\n readyForReviewBy\n readyForReviewDts\n readyForClearanceBy\n readyForClearanceDts\n status\n\n createdByUserAccount \n {\n commonName\n } \n modifiedByUserAccount\n {\n commonName\n } \n readyForReviewByUserAccount \n {\n commonName\n }\n readyForClearanceByUserAccount \n {\n commonName\n } \n }\n}", - "variables": "{\n \"id\": \"{{generalCharacteristicsID}}\",\n \"changes\": {\n \"isNewModel\": true,\n \"currentModelPlanID\": null,\n \"existingModelID\": null,\n \"resemblesExistingModel\": true,\n \"resemblesExistingModelHow\": \"\",\n \"resemblesExistingModelNote\": \"\",\n \"hasComponentsOrTracks\": true,\n \"hasComponentsOrTracksDiffer\": \"\",\n \"hasComponentsOrTracksNote\": \"\",\n \"alternativePaymentModelTypes\": [\n \"\"\n ],\n \"alternativePaymentModelNote\": \"\",\n \"keyCharacteristics\": [\n \"\"\n ],\n \"keyCharacteristicsOther\": \"\",\n \"keyCharacteristicsNote\": \"\",\n \"collectPlanBids\": true,\n \"collectPlanBidsNote\": \"\",\n \"managePartCDEnrollment\": true,\n \"managePartCDEnrollmentNote\": \"\",\n \"planContractUpdated\": true,\n \"planContractUpdatedNote\": \"\",\n \"careCoordinationInvolved\": true,\n \"careCoordinationInvolvedDescription\": \"\",\n \"careCoordinationInvolvedNote\": \"\",\n \"additionalServicesInvolved\": true,\n \"additionalServicesInvolvedDescription\": \"\",\n \"additionalServicesInvolvedNote\": \"\",\n \"communityPartnersInvolved\": true,\n \"communityPartnersInvolvedDescription\": \"\",\n \"communityPartnersInvolvedNote\": \"\",\n \"geographiesTargeted\": true,\n \"geographiesTargetedTypes\": [\n \"\"\n ],\n \"geographiesTargetedTypesOther\": \"\",\n \"geographiesTargetedAppliedTo\": [\n \"\"\n ],\n \"geographiesTargetedAppliedToOther\": \"\",\n \"geographiesTargetedNote\": \"\",\n \"participationOptions\": true,\n \"participationOptionsNote\": \"\",\n \"agreementTypes\": [\n \"\"\n ],\n \"agreementTypesOther\": \"\",\n \"multiplePatricipationAgreementsNeeded\": true,\n \"multiplePatricipationAgreementsNeededNote\": \"\",\n \"rulemakingRequired\": true,\n \"rulemakingRequiredDescription\": \"\",\n \"rulemakingRequiredNote\": \"\",\n \"authorityAllowances\": [\n \"\"\n ],\n \"authorityAllowancesOther\": \"\",\n \"authorityAllowancesNote\": \"\",\n \"waiversRequired\": true,\n \"waiversRequiredTypes\": [\n \"\"\n ],\n \"waiversRequiredNote\": \"\",\n \"status\": \"\"\n }\n}" + "query": "mutation updatePlanGeneralCharacteristics ($id: UUID!, $changes: PlanGeneralCharacteristicsChanges!) {\n updatePlanGeneralCharacteristics (id: $id, changes: $changes) {\n id\n modelPlanID\n isNewModel\n currentModelPlanID\n existingModelID\n resemblesExistingModel\n resemblesExistingModelHow\n resemblesExistingModelNote\n hasComponentsOrTracks\n hasComponentsOrTracksDiffer\n hasComponentsOrTracksNote\n alternativePaymentModelTypes\n alternativePaymentModelNote\n keyCharacteristics\n keyCharacteristicsOther\n keyCharacteristicsNote\n collectPlanBids\n collectPlanBidsNote\n managePartCDEnrollment\n managePartCDEnrollmentNote\n planContractUpdated\n planContractUpdatedNote\n careCoordinationInvolved\n careCoordinationInvolvedDescription\n careCoordinationInvolvedNote\n additionalServicesInvolved\n additionalServicesInvolvedDescription\n additionalServicesInvolvedNote\n communityPartnersInvolved\n communityPartnersInvolvedDescription\n communityPartnersInvolvedNote\n geographiesTargeted\n geographiesTargetedTypes\n geographiesStatesAndTerritories\n geographiesRegionTypes\n geographiesTargetedTypesOther\n geographiesTargetedAppliedTo\n geographiesTargetedAppliedToOther\n geographiesTargetedNote\n participationOptions\n participationOptionsNote\n agreementTypes\n agreementTypesOther\n multiplePatricipationAgreementsNeeded\n multiplePatricipationAgreementsNeededNote\n rulemakingRequired\n rulemakingRequiredDescription\n rulemakingRequiredNote\n authorityAllowances\n authorityAllowancesOther\n authorityAllowancesNote\n waiversRequired\n waiversRequiredTypes\n waiversRequiredNote\n createdBy\n createdDts\n modifiedBy\n modifiedDts\n readyForReviewBy\n readyForReviewDts\n readyForClearanceBy\n readyForClearanceDts\n status\n\n createdByUserAccount \n {\n commonName\n } \n modifiedByUserAccount\n {\n commonName\n } \n readyForReviewByUserAccount \n {\n commonName\n }\n readyForClearanceByUserAccount \n {\n commonName\n } \n }\n}", + "variables": "{\n \"id\": \"{{generalCharacteristicsID}}\",\n \"changes\": {\n \"isNewModel\": true,\n \"currentModelPlanID\": null,\n \"existingModelID\": null,\n \"resemblesExistingModel\": true,\n \"resemblesExistingModelHow\": \"\",\n \"resemblesExistingModelNote\": \"\",\n \"hasComponentsOrTracks\": true,\n \"hasComponentsOrTracksDiffer\": \"\",\n \"hasComponentsOrTracksNote\": \"\",\n \"alternativePaymentModelTypes\": [\n \"\"\n ],\n \"alternativePaymentModelNote\": \"\",\n \"keyCharacteristics\": [\n \"\"\n ],\n \"keyCharacteristicsOther\": \"\",\n \"keyCharacteristicsNote\": \"\",\n \"collectPlanBids\": true,\n \"collectPlanBidsNote\": \"\",\n \"managePartCDEnrollment\": true,\n \"managePartCDEnrollmentNote\": \"\",\n \"planContractUpdated\": true,\n \"planContractUpdatedNote\": \"\",\n \"careCoordinationInvolved\": true,\n \"careCoordinationInvolvedDescription\": \"\",\n \"careCoordinationInvolvedNote\": \"\",\n \"additionalServicesInvolved\": true,\n \"additionalServicesInvolvedDescription\": \"\",\n \"additionalServicesInvolvedNote\": \"\",\n \"communityPartnersInvolved\": true,\n \"communityPartnersInvolvedDescription\": \"\",\n \"communityPartnersInvolvedNote\": \"\",\n \"geographiesTargeted\": true,\n \"geographiesTargetedTypes\": [\n \"\"\n ],\n \"geographiesStatesAndTerritories\": [\n \"FL\",\n \"NY\"\n ],\n \"geographiesRegionTypes\": [\n \"CBSA\",\n \"HRR\"\n ],\n \"geographiesTargetedTypesOther\": \"\",\n \"geographiesTargetedAppliedTo\": [\n \"\"\n ],\n \"geographiesTargetedAppliedToOther\": \"\",\n \"geographiesTargetedNote\": \"\",\n \"participationOptions\": true,\n \"participationOptionsNote\": \"\",\n \"agreementTypes\": [\n \"\"\n ],\n \"agreementTypesOther\": \"\",\n \"multiplePatricipationAgreementsNeeded\": true,\n \"multiplePatricipationAgreementsNeededNote\": \"\",\n \"rulemakingRequired\": true,\n \"rulemakingRequiredDescription\": \"\",\n \"rulemakingRequiredNote\": \"\",\n \"authorityAllowances\": [\n \"\"\n ],\n \"authorityAllowancesOther\": \"\",\n \"authorityAllowancesNote\": \"\",\n \"waiversRequired\": true,\n \"waiversRequiredTypes\": [\n \"\"\n ],\n \"waiversRequiredNote\": \"\",\n \"status\": \"\"\n }\n}" } }, "url": { diff --git a/migrations/V142__Add_GeographiesStatesAndTerritories_And_GeographiesRegionTypes.sql b/migrations/V142__Add_GeographiesStatesAndTerritories_And_GeographiesRegionTypes.sql new file mode 100644 index 0000000000..60ec379ece --- /dev/null +++ b/migrations/V142__Add_GeographiesStatesAndTerritories_And_GeographiesRegionTypes.sql @@ -0,0 +1,75 @@ +-- Create the StatesAndTerritories type +CREATE TYPE STATES_AND_TERRITORIES AS ENUM ( + 'AL', + 'AK', + 'AZ', + 'AR', + 'CA', + 'CO', + 'CT', + 'DE', + 'DC', + 'FL', + 'GA', + 'HI', + 'ID', + 'IL', + 'IN', + 'IA', + 'KS', + 'KY', + 'LA', + 'ME', + 'MD', + 'MA', + 'MI', + 'MN', + 'MS', + 'MO', + 'MT', + 'NE', + 'NV', + 'NH', + 'NJ', + 'NM', + 'NY', + 'NC', + 'ND', + 'OH', + 'OK', + 'OR', + 'PA', + 'RI', + 'SC', + 'SD', + 'TN', + 'TX', + 'UT', + 'VT', + 'VA', + 'WA', + 'WV', + 'WI', + 'WY', + 'AS', + 'GU', + 'MP', + 'PR', + 'UM', + 'VI' +); + +-- Create a new column in the plan_general_characteristics table to hold array of states or territories of the plan +ALTER TABLE plan_general_characteristics + ADD COLUMN geographies_states_and_territories STATES_AND_TERRITORIES[]; + +-- Create the GEOGRAPHIES_REGION_TYPE type +CREATE TYPE GEOGRAPHIES_REGION_TYPE AS ENUM ( + 'CBSA', + 'HRR', + 'MSA' +); + +-- Create a new column in the plan_general_characteristics table to hold the array of region types of the plan +ALTER TABLE plan_general_characteristics + ADD COLUMN geographies_region_types GEOGRAPHIES_REGION_TYPE[]; diff --git a/pkg/graph/generated/generated.go b/pkg/graph/generated/generated.go index c2fce789c2..c62a3637c9 100644 --- a/pkg/graph/generated/generated.go +++ b/pkg/graph/generated/generated.go @@ -538,6 +538,8 @@ type ComplexityRoot struct { ExistingModel func(childComplexity int) int ExistingModelID func(childComplexity int) int ExistingModelPlan func(childComplexity int) int + GeographiesRegionTypes func(childComplexity int) int + GeographiesStatesAndTerritories func(childComplexity int) int GeographiesTargeted func(childComplexity int) int GeographiesTargetedAppliedTo func(childComplexity int) int GeographiesTargetedAppliedToOther func(childComplexity int) int @@ -1143,6 +1145,8 @@ type PlanGeneralCharacteristicsResolver interface { KeyCharacteristics(ctx context.Context, obj *models.PlanGeneralCharacteristics) ([]model.KeyCharacteristic, error) GeographiesTargetedTypes(ctx context.Context, obj *models.PlanGeneralCharacteristics) ([]model.GeographyType, error) + GeographiesStatesAndTerritories(ctx context.Context, obj *models.PlanGeneralCharacteristics) ([]models.StatesAndTerritories, error) + GeographiesRegionTypes(ctx context.Context, obj *models.PlanGeneralCharacteristics) ([]models.GeographyRegionType, error) GeographiesTargetedAppliedTo(ctx context.Context, obj *models.PlanGeneralCharacteristics) ([]model.GeographyApplication, error) @@ -4208,6 +4212,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.PlanGeneralCharacteristics.ExistingModelPlan(childComplexity), true + case "PlanGeneralCharacteristics.geographiesRegionTypes": + if e.complexity.PlanGeneralCharacteristics.GeographiesRegionTypes == nil { + break + } + + return e.complexity.PlanGeneralCharacteristics.GeographiesRegionTypes(childComplexity), true + + case "PlanGeneralCharacteristics.geographiesStatesAndTerritories": + if e.complexity.PlanGeneralCharacteristics.GeographiesStatesAndTerritories == nil { + break + } + + return e.complexity.PlanGeneralCharacteristics.GeographiesStatesAndTerritories(childComplexity), true + case "PlanGeneralCharacteristics.geographiesTargeted": if e.complexity.PlanGeneralCharacteristics.GeographiesTargeted == nil { break @@ -7996,6 +8014,8 @@ type PlanGeneralCharacteristics { # Page 4 geographiesTargeted: Boolean geographiesTargetedTypes: [GeographyType!]! + geographiesStatesAndTerritories: [StatesAndTerritories!]! + geographiesRegionTypes: [GeographyRegionType!]! geographiesTargetedTypesOther: String geographiesTargetedAppliedTo: [GeographyApplication!]! geographiesTargetedAppliedToOther: String @@ -8080,6 +8100,8 @@ input PlanGeneralCharacteristicsChanges @goModel(model: "map[string]interface{}" # Page 4 geographiesTargeted: Boolean geographiesTargetedTypes: [GeographyType!] + geographiesStatesAndTerritories: [StatesAndTerritories!] + geographiesRegionTypes: [GeographyRegionType!] geographiesTargetedTypesOther: String geographiesTargetedAppliedTo: [GeographyApplication!] geographiesTargetedAppliedToOther: String @@ -10107,6 +10129,72 @@ enum GainshareArrangementEligibility { enum YesNoType { YES, NO +} + +enum StatesAndTerritories { + AL, + AK, + AZ, + AR, + CA, + CO, + CT, + DE, + DC, + FL, + GA, + HI, + ID, + IL, + IN, + IA, + KS, + KY, + LA, + ME, + MD, + MA, + MI, + MN, + MS, + MO, + MT, + NE, + NV, + NH, + NJ, + NM, + NY, + NC, + ND, + OH, + OK, + OR, + PA, + RI, + SC, + SD, + TN, + TX, + UT, + VT, + VA, + WA, + WV, + WI, + WY, + AS, + GU, + MP, + PR, + UM, + VI +} + +enum GeographyRegionType { + CBSA, + HRR, + MSA }`, BuiltIn: false}, } var parsedSchema = gqlparser.MustLoadSchema(sources...) @@ -15837,6 +15925,10 @@ func (ec *executionContext) fieldContext_ModelPlan_generalCharacteristics(ctx co return ec.fieldContext_PlanGeneralCharacteristics_geographiesTargeted(ctx, field) case "geographiesTargetedTypes": return ec.fieldContext_PlanGeneralCharacteristics_geographiesTargetedTypes(ctx, field) + case "geographiesStatesAndTerritories": + return ec.fieldContext_PlanGeneralCharacteristics_geographiesStatesAndTerritories(ctx, field) + case "geographiesRegionTypes": + return ec.fieldContext_PlanGeneralCharacteristics_geographiesRegionTypes(ctx, field) case "geographiesTargetedTypesOther": return ec.fieldContext_PlanGeneralCharacteristics_geographiesTargetedTypesOther(ctx, field) case "geographiesTargetedAppliedTo": @@ -18362,6 +18454,10 @@ func (ec *executionContext) fieldContext_Mutation_updatePlanGeneralCharacteristi return ec.fieldContext_PlanGeneralCharacteristics_geographiesTargeted(ctx, field) case "geographiesTargetedTypes": return ec.fieldContext_PlanGeneralCharacteristics_geographiesTargetedTypes(ctx, field) + case "geographiesStatesAndTerritories": + return ec.fieldContext_PlanGeneralCharacteristics_geographiesStatesAndTerritories(ctx, field) + case "geographiesRegionTypes": + return ec.fieldContext_PlanGeneralCharacteristics_geographiesRegionTypes(ctx, field) case "geographiesTargetedTypesOther": return ec.fieldContext_PlanGeneralCharacteristics_geographiesTargetedTypesOther(ctx, field) case "geographiesTargetedAppliedTo": @@ -33759,6 +33855,94 @@ func (ec *executionContext) fieldContext_PlanGeneralCharacteristics_geographiesT return fc, nil } +func (ec *executionContext) _PlanGeneralCharacteristics_geographiesStatesAndTerritories(ctx context.Context, field graphql.CollectedField, obj *models.PlanGeneralCharacteristics) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PlanGeneralCharacteristics_geographiesStatesAndTerritories(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.PlanGeneralCharacteristics().GeographiesStatesAndTerritories(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]models.StatesAndTerritories) + fc.Result = res + return ec.marshalNStatesAndTerritories2ᚕgithubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐStatesAndTerritoriesᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PlanGeneralCharacteristics_geographiesStatesAndTerritories(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PlanGeneralCharacteristics", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type StatesAndTerritories does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PlanGeneralCharacteristics_geographiesRegionTypes(ctx context.Context, field graphql.CollectedField, obj *models.PlanGeneralCharacteristics) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PlanGeneralCharacteristics_geographiesRegionTypes(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.PlanGeneralCharacteristics().GeographiesRegionTypes(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]models.GeographyRegionType) + fc.Result = res + return ec.marshalNGeographyRegionType2ᚕgithubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐGeographyRegionTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PlanGeneralCharacteristics_geographiesRegionTypes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PlanGeneralCharacteristics", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type GeographyRegionType does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _PlanGeneralCharacteristics_geographiesTargetedTypesOther(ctx context.Context, field graphql.CollectedField, obj *models.PlanGeneralCharacteristics) (ret graphql.Marshaler) { fc, err := ec.fieldContext_PlanGeneralCharacteristics_geographiesTargetedTypesOther(ctx, field) if err != nil { @@ -61341,6 +61525,78 @@ func (ec *executionContext) _PlanGeneralCharacteristics(ctx context.Context, sel continue } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "geographiesStatesAndTerritories": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._PlanGeneralCharacteristics_geographiesStatesAndTerritories(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "geographiesRegionTypes": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._PlanGeneralCharacteristics_geographiesRegionTypes(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "geographiesTargetedTypesOther": out.Values[i] = ec._PlanGeneralCharacteristics_geographiesTargetedTypesOther(ctx, field, obj) @@ -67758,6 +68014,83 @@ func (ec *executionContext) marshalNGeographyApplication2ᚕgithubᚗcomᚋcmsgo return ret } +func (ec *executionContext) unmarshalNGeographyRegionType2githubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐGeographyRegionType(ctx context.Context, v interface{}) (models.GeographyRegionType, error) { + tmp, err := graphql.UnmarshalString(v) + res := models.GeographyRegionType(tmp) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNGeographyRegionType2githubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐGeographyRegionType(ctx context.Context, sel ast.SelectionSet, v models.GeographyRegionType) graphql.Marshaler { + res := graphql.MarshalString(string(v)) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNGeographyRegionType2ᚕgithubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐGeographyRegionTypeᚄ(ctx context.Context, v interface{}) ([]models.GeographyRegionType, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]models.GeographyRegionType, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNGeographyRegionType2githubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐGeographyRegionType(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalNGeographyRegionType2ᚕgithubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐGeographyRegionTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []models.GeographyRegionType) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNGeographyRegionType2githubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐGeographyRegionType(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + func (ec *executionContext) unmarshalNGeographyType2githubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋgraphᚋmodelᚐGeographyType(ctx context.Context, v interface{}) (model.GeographyType, error) { var res model.GeographyType err := res.UnmarshalGQL(v) @@ -70235,6 +70568,83 @@ func (ec *executionContext) marshalNStakeholdersType2ᚕgithubᚗcomᚋcmsgovᚋ return ret } +func (ec *executionContext) unmarshalNStatesAndTerritories2githubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐStatesAndTerritories(ctx context.Context, v interface{}) (models.StatesAndTerritories, error) { + tmp, err := graphql.UnmarshalString(v) + res := models.StatesAndTerritories(tmp) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNStatesAndTerritories2githubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐStatesAndTerritories(ctx context.Context, sel ast.SelectionSet, v models.StatesAndTerritories) graphql.Marshaler { + res := graphql.MarshalString(string(v)) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNStatesAndTerritories2ᚕgithubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐStatesAndTerritoriesᚄ(ctx context.Context, v interface{}) ([]models.StatesAndTerritories, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]models.StatesAndTerritories, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNStatesAndTerritories2githubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐStatesAndTerritories(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalNStatesAndTerritories2ᚕgithubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐStatesAndTerritoriesᚄ(ctx context.Context, sel ast.SelectionSet, v []models.StatesAndTerritories) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNStatesAndTerritories2githubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐStatesAndTerritories(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { res, err := graphql.UnmarshalString(v) return res, graphql.ErrorOnPath(ctx, err) @@ -72474,6 +72884,73 @@ func (ec *executionContext) marshalOGeographyApplication2ᚕgithubᚗcomᚋcmsgo return ret } +func (ec *executionContext) unmarshalOGeographyRegionType2ᚕgithubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐGeographyRegionTypeᚄ(ctx context.Context, v interface{}) ([]models.GeographyRegionType, error) { + if v == nil { + return nil, nil + } + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]models.GeographyRegionType, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNGeographyRegionType2githubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐGeographyRegionType(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalOGeographyRegionType2ᚕgithubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐGeographyRegionTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []models.GeographyRegionType) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNGeographyRegionType2githubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐGeographyRegionType(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + func (ec *executionContext) unmarshalOGeographyType2ᚕgithubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋgraphᚋmodelᚐGeographyTypeᚄ(ctx context.Context, v interface{}) ([]model.GeographyType, error) { if v == nil { return nil, nil @@ -74124,6 +74601,73 @@ func (ec *executionContext) marshalOStakeholdersType2ᚕgithubᚗcomᚋcmsgovᚋ return ret } +func (ec *executionContext) unmarshalOStatesAndTerritories2ᚕgithubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐStatesAndTerritoriesᚄ(ctx context.Context, v interface{}) ([]models.StatesAndTerritories, error) { + if v == nil { + return nil, nil + } + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]models.StatesAndTerritories, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNStatesAndTerritories2githubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐStatesAndTerritories(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalOStatesAndTerritories2ᚕgithubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐStatesAndTerritoriesᚄ(ctx context.Context, sel ast.SelectionSet, v []models.StatesAndTerritories) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNStatesAndTerritories2githubᚗcomᚋcmsgovᚋmintᚑappᚋpkgᚋmodelsᚐStatesAndTerritories(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { res, err := graphql.UnmarshalString(v) return res, graphql.ErrorOnPath(ctx, err) diff --git a/pkg/graph/gqlresolvers/schema.resolvers.go b/pkg/graph/gqlresolvers/schema.resolvers.go index e8744adf5f..865458d6b7 100644 --- a/pkg/graph/gqlresolvers/schema.resolvers.go +++ b/pkg/graph/gqlresolvers/schema.resolvers.go @@ -690,6 +690,18 @@ func (r *planGeneralCharacteristicsResolver) GeographiesTargetedTypes(ctx contex return geographyTypes, nil } +// GeographiesStatesAndTerritories is the resolver for the geographiesStatesAndTerritories field. +func (r *planGeneralCharacteristicsResolver) GeographiesStatesAndTerritories(ctx context.Context, obj *models.PlanGeneralCharacteristics) ([]models.StatesAndTerritories, error) { + statesAndTerritories := models.ConvertEnums[models.StatesAndTerritories](obj.GeographiesStatesAndTerritories) + return statesAndTerritories, nil +} + +// GeographiesRegionTypes is the resolver for the geographiesRegionTypes field. +func (r *planGeneralCharacteristicsResolver) GeographiesRegionTypes(ctx context.Context, obj *models.PlanGeneralCharacteristics) ([]models.GeographyRegionType, error) { + geographyRegionTypes := models.ConvertEnums[models.GeographyRegionType](obj.GeographiesRegionTypes) + return geographyRegionTypes, nil +} + // GeographiesTargetedAppliedTo is the resolver for the geographiesTargetedAppliedTo field. func (r *planGeneralCharacteristicsResolver) GeographiesTargetedAppliedTo(ctx context.Context, obj *models.PlanGeneralCharacteristics) ([]model.GeographyApplication, error) { geographyApplications := models.ConvertEnums[model.GeographyApplication](obj.GeographiesTargetedAppliedTo) diff --git a/pkg/graph/resolvers/plan_general_characteristics_test.go b/pkg/graph/resolvers/plan_general_characteristics_test.go index 32b49f5267..c74d1956b8 100644 --- a/pkg/graph/resolvers/plan_general_characteristics_test.go +++ b/pkg/graph/resolvers/plan_general_characteristics_test.go @@ -80,6 +80,8 @@ func (suite *ResolverSuite) TestFetchPlanGeneralCharacteristicsByModelPlanID() { suite.Nil(gc.CommunityPartnersInvolvedNote) suite.Nil(gc.GeographiesTargeted) suite.Nil(gc.GeographiesTargetedTypes) + suite.Nil(gc.GeographiesStatesAndTerritories) + suite.Nil(gc.GeographiesRegionTypes) suite.Nil(gc.GeographiesTargetedTypesOther) suite.Nil(gc.GeographiesTargetedAppliedTo) suite.Nil(gc.GeographiesTargetedAppliedToOther) @@ -108,12 +110,15 @@ func (suite *ResolverSuite) TestUpdatePlanGeneralCharacteristics() { suite.NoError(err) changes := map[string]interface{}{ - "hasComponentsOrTracks": true, - "hasComponentsOrTracksDiffer": "One track does something one way, the other does it another way", - "hasComponentsOrTracksNote": "Look at the tracks carefully", - "alternativePaymentModelTypes": []string{model.AlternativePaymentModelTypeMips.String(), model.AlternativePaymentModelTypeAdvanced.String()}, - "AlternativePaymentModelNote": "Has 2 APM types!", + "hasComponentsOrTracks": true, + "hasComponentsOrTracksDiffer": "One track does something one way, the other does it another way", + "hasComponentsOrTracksNote": "Look at the tracks carefully", + "alternativePaymentModelTypes": []string{model.AlternativePaymentModelTypeMips.String(), model.AlternativePaymentModelTypeAdvanced.String()}, + "AlternativePaymentModelNote": "Has 2 APM types!", + "GeographiesStatesAndTerritories": []string{"AL", "AK", "AZ"}, + "GeographiesRegionTypes": []string{"CBSA", "HRR"}, } + updatedGeneralCharacteristics, err := UpdatePlanGeneralCharacteristics(suite.testConfigs.Logger, gc.ID, changes, suite.testConfigs.Principal, suite.testConfigs.Store) suite.NoError(err) suite.EqualValues(suite.testConfigs.Principal.UserAccount.ID, *updatedGeneralCharacteristics.ModifiedBy) @@ -125,6 +130,8 @@ func (suite *ResolverSuite) TestUpdatePlanGeneralCharacteristics() { suite.EqualValues([]string{model.AlternativePaymentModelTypeMips.String(), model.AlternativePaymentModelTypeAdvanced.String()}, updatedGeneralCharacteristics.AlternativePaymentModelTypes) suite.EqualValues("Has 2 APM types!", *updatedGeneralCharacteristics.AlternativePaymentModelNote) suite.EqualValues(models.TaskInProgress, updatedGeneralCharacteristics.Status) + suite.EqualValues([]string{"AL", "AK", "AZ"}, updatedGeneralCharacteristics.GeographiesStatesAndTerritories) + suite.EqualValues([]string{"CBSA", "HRR"}, updatedGeneralCharacteristics.GeographiesRegionTypes) // Assert that no other fields got updated suite.Nil(updatedGeneralCharacteristics.IsNewModel) diff --git a/pkg/graph/schema.graphql b/pkg/graph/schema.graphql index 38136a5c84..a6edd0d2b0 100644 --- a/pkg/graph/schema.graphql +++ b/pkg/graph/schema.graphql @@ -566,6 +566,8 @@ type PlanGeneralCharacteristics { # Page 4 geographiesTargeted: Boolean geographiesTargetedTypes: [GeographyType!]! + geographiesStatesAndTerritories: [StatesAndTerritories!]! + geographiesRegionTypes: [GeographyRegionType!]! geographiesTargetedTypesOther: String geographiesTargetedAppliedTo: [GeographyApplication!]! geographiesTargetedAppliedToOther: String @@ -650,6 +652,8 @@ input PlanGeneralCharacteristicsChanges @goModel(model: "map[string]interface{}" # Page 4 geographiesTargeted: Boolean geographiesTargetedTypes: [GeographyType!] + geographiesStatesAndTerritories: [StatesAndTerritories!] + geographiesRegionTypes: [GeographyRegionType!] geographiesTargetedTypesOther: String geographiesTargetedAppliedTo: [GeographyApplication!] geographiesTargetedAppliedToOther: String @@ -2677,4 +2681,70 @@ enum GainshareArrangementEligibility { enum YesNoType { YES, NO +} + +enum StatesAndTerritories { + AL, + AK, + AZ, + AR, + CA, + CO, + CT, + DE, + DC, + FL, + GA, + HI, + ID, + IL, + IN, + IA, + KS, + KY, + LA, + ME, + MD, + MA, + MI, + MN, + MS, + MO, + MT, + NE, + NV, + NH, + NJ, + NM, + NY, + NC, + ND, + OH, + OK, + OR, + PA, + RI, + SC, + SD, + TN, + TX, + UT, + VT, + VA, + WA, + WV, + WI, + WY, + AS, + GU, + MP, + PR, + UM, + VI +} + +enum GeographyRegionType { + CBSA, + HRR, + MSA } \ No newline at end of file diff --git a/pkg/models/plan_general_characteristics.go b/pkg/models/plan_general_characteristics.go index c31bfd5b47..60500469f4 100644 --- a/pkg/models/plan_general_characteristics.go +++ b/pkg/models/plan_general_characteristics.go @@ -47,6 +47,8 @@ type PlanGeneralCharacteristics struct { // Page 4 GeographiesTargeted *bool `json:"geographiesTargeted" db:"geographies_targeted" statusWeight:"1"` GeographiesTargetedTypes pq.StringArray `json:"geographiesTargetedTypes" db:"geographies_targeted_types"` + GeographiesStatesAndTerritories pq.StringArray `json:"geographiesStatesAndTerritories" db:"geographies_states_and_territories"` + GeographiesRegionTypes pq.StringArray `json:"geographiesRegionTypes" db:"geographies_region_types"` GeographiesTargetedTypesOther *string `json:"geographiesTargetedTypesOther" db:"geographies_targeted_types_other"` GeographiesTargetedAppliedTo pq.StringArray `json:"geographiesTargetedAppliedTo" db:"geographies_targeted_applied_to"` GeographiesTargetedAppliedToOther *string `json:"geographiesTargetedAppliedToOther" db:"geographies_targeted_applied_to_other"` @@ -76,3 +78,77 @@ func NewPlanGeneralCharacteristics(tls baseTaskListSection) *PlanGeneralCharacte baseTaskListSection: tls, } } + +// StatesAndTerritories represents the possible values for the "States and Territories" field +type StatesAndTerritories string + +// These constants represent the different values of StatesAndTerritories +const ( + StatesAndTerritoriesAL StatesAndTerritories = "AL" + StatesAndTerritoriesAK StatesAndTerritories = "AK" + StatesAndTerritoriesAZ StatesAndTerritories = "AZ" + StatesAndTerritoriesAR StatesAndTerritories = "AR" + StatesAndTerritoriesCA StatesAndTerritories = "CA" + StatesAndTerritoriesCO StatesAndTerritories = "CO" + StatesAndTerritoriesCT StatesAndTerritories = "CT" + StatesAndTerritoriesDE StatesAndTerritories = "DE" + StatesAndTerritoriesDC StatesAndTerritories = "DC" + StatesAndTerritoriesFL StatesAndTerritories = "FL" + StatesAndTerritoriesGA StatesAndTerritories = "GA" + StatesAndTerritoriesHI StatesAndTerritories = "HI" + StatesAndTerritoriesID StatesAndTerritories = "ID" + StatesAndTerritoriesIL StatesAndTerritories = "IL" + StatesAndTerritoriesIN StatesAndTerritories = "IN" + StatesAndTerritoriesIA StatesAndTerritories = "IA" + StatesAndTerritoriesKS StatesAndTerritories = "KS" + StatesAndTerritoriesKY StatesAndTerritories = "KY" + StatesAndTerritoriesLA StatesAndTerritories = "LA" + StatesAndTerritoriesME StatesAndTerritories = "ME" + StatesAndTerritoriesMD StatesAndTerritories = "MD" + StatesAndTerritoriesMA StatesAndTerritories = "MA" + StatesAndTerritoriesMI StatesAndTerritories = "MI" + StatesAndTerritoriesMN StatesAndTerritories = "MN" + StatesAndTerritoriesMS StatesAndTerritories = "MS" + StatesAndTerritoriesMO StatesAndTerritories = "MO" + StatesAndTerritoriesMT StatesAndTerritories = "MT" + StatesAndTerritoriesNE StatesAndTerritories = "NE" + StatesAndTerritoriesNV StatesAndTerritories = "NV" + StatesAndTerritoriesNH StatesAndTerritories = "NH" + StatesAndTerritoriesNJ StatesAndTerritories = "NJ" + StatesAndTerritoriesNM StatesAndTerritories = "NM" + StatesAndTerritoriesNY StatesAndTerritories = "NY" + StatesAndTerritoriesNC StatesAndTerritories = "NC" + StatesAndTerritoriesND StatesAndTerritories = "ND" + StatesAndTerritoriesOH StatesAndTerritories = "OH" + StatesAndTerritoriesOK StatesAndTerritories = "OK" + StatesAndTerritoriesOR StatesAndTerritories = "OR" + StatesAndTerritoriesPA StatesAndTerritories = "PA" + StatesAndTerritoriesRI StatesAndTerritories = "RI" + StatesAndTerritoriesSC StatesAndTerritories = "SC" + StatesAndTerritoriesSD StatesAndTerritories = "SD" + StatesAndTerritoriesTN StatesAndTerritories = "TN" + StatesAndTerritoriesTX StatesAndTerritories = "TX" + StatesAndTerritoriesUT StatesAndTerritories = "UT" + StatesAndTerritoriesVT StatesAndTerritories = "VT" + StatesAndTerritoriesVA StatesAndTerritories = "VA" + StatesAndTerritoriesWA StatesAndTerritories = "WA" + StatesAndTerritoriesWV StatesAndTerritories = "WV" + StatesAndTerritoriesWI StatesAndTerritories = "WI" + StatesAndTerritoriesWY StatesAndTerritories = "WY" + StatesAndTerritoriesAS StatesAndTerritories = "AS" + StatesAndTerritoriesGU StatesAndTerritories = "GU" + StatesAndTerritoriesMP StatesAndTerritories = "MP" + StatesAndTerritoriesPR StatesAndTerritories = "PR" + StatesAndTerritoriesUM StatesAndTerritories = "UM" + StatesAndTerritoriesVI StatesAndTerritories = "VI" +) + +// GeographyRegionType represents the possible values for the "Geography Region Type" field +type GeographyRegionType string + +// These constants represent the different values of GeographyRegionType +const ( + GeographyRegionTypeCBSA GeographyRegionType = "CBSA" + GeographyRegionTypeHRR GeographyRegionType = "HRR" + GeographyRegionTypeMSA GeographyRegionType = "MSA" +) diff --git a/pkg/storage/SQL/plan_general_characteristics/create.sql b/pkg/storage/SQL/plan_general_characteristics/create.sql index 47f863ff96..1e2cb29014 100644 --- a/pkg/storage/SQL/plan_general_characteristics/create.sql +++ b/pkg/storage/SQL/plan_general_characteristics/create.sql @@ -32,6 +32,8 @@ INSERT INTO plan_general_characteristics ( community_partners_involved_note, geographies_targeted, geographies_targeted_types, + geographies_states_and_territories, + geographies_region_types, geographies_targeted_types_other, geographies_targeted_applied_to, geographies_targeted_applied_to_other, @@ -93,6 +95,8 @@ VALUES ( :community_partners_involved_note, :geographies_targeted, :geographies_targeted_types, + :geographies_states_and_territories, + :geographies_region_types, :geographies_targeted_types_other, :geographies_targeted_applied_to, :geographies_targeted_applied_to_other, @@ -153,6 +157,8 @@ community_partners_involved_description, community_partners_involved_note, geographies_targeted, geographies_targeted_types, +geographies_states_and_territories, +geographies_region_types, geographies_targeted_types_other, geographies_targeted_applied_to, geographies_targeted_applied_to_other, diff --git a/pkg/storage/SQL/plan_general_characteristics/get_by_id.sql b/pkg/storage/SQL/plan_general_characteristics/get_by_id.sql index be55a9fbf1..043978d185 100644 --- a/pkg/storage/SQL/plan_general_characteristics/get_by_id.sql +++ b/pkg/storage/SQL/plan_general_characteristics/get_by_id.sql @@ -31,6 +31,8 @@ SELECT community_partners_involved_description, community_partners_involved_note, geographies_targeted, + geographies_states_and_territories, + geographies_region_types, geographies_targeted_types, geographies_targeted_types_other, geographies_targeted_applied_to, diff --git a/pkg/storage/SQL/plan_general_characteristics/get_by_model_plan_id_LOADER.sql b/pkg/storage/SQL/plan_general_characteristics/get_by_model_plan_id_LOADER.sql index ce2ff53f28..d5283325a2 100644 --- a/pkg/storage/SQL/plan_general_characteristics/get_by_model_plan_id_LOADER.sql +++ b/pkg/storage/SQL/plan_general_characteristics/get_by_model_plan_id_LOADER.sql @@ -39,6 +39,8 @@ SELECT gc.community_partners_involved_description, gc.community_partners_involved_note, gc.geographies_targeted, + gc.geographies_states_and_territories, + gc.geographies_region_types, gc.geographies_targeted_types, gc.geographies_targeted_types_other, gc.geographies_targeted_applied_to, diff --git a/pkg/storage/SQL/plan_general_characteristics/update.sql b/pkg/storage/SQL/plan_general_characteristics/update.sql index 900859d2ff..ac4e3e1cd1 100644 --- a/pkg/storage/SQL/plan_general_characteristics/update.sql +++ b/pkg/storage/SQL/plan_general_characteristics/update.sql @@ -30,6 +30,8 @@ SET community_partners_involved_description = :community_partners_involved_description, community_partners_involved_note = :community_partners_involved_note, geographies_targeted = :geographies_targeted, + geographies_states_and_territories = :geographies_states_and_territories, + geographies_region_types = :geographies_region_types, geographies_targeted_types = :geographies_targeted_types, geographies_targeted_types_other = :geographies_targeted_types_other, geographies_targeted_applied_to = :geographies_targeted_applied_to, diff --git a/src/components/ShareExport/__snapshots__/index.test.tsx.snap b/src/components/ShareExport/__snapshots__/index.test.tsx.snap index 235a8a2ac0..67438c3681 100644 --- a/src/components/ShareExport/__snapshots__/index.test.tsx.snap +++ b/src/components/ShareExport/__snapshots__/index.test.tsx.snap @@ -1415,87 +1415,101 @@ exports[`ShareExportModal > matches the snapshot 1`] = `
-
-
+
    +
  • -

    +

      +
    • - Geography type is -

      -
        +
      +
    • + Region +
    • +
        +
      • +
      • + Core-based statistical areas (CBSAs) +
      • +
      +
    • + Other +
    • +
        +
      • -
      • - Other -
      • -
          -
        • - Geography type other -
        • -
        -
      -
-
+ Geography type other + + +
+
+
-
-
+
    +
  • -

    - Geographies are applied to -

    -
      +
    • + Other +
    • +
        +
      • -
      • - Beneficiaries -
      • -
      • - Other -
      • -
          -
        • - Geography applied other -
        • -
        -
      -
-
+ Geography applied other + + +
matches the snapshot 2`] = `
-
-
+
    +
  • -

    +

      +
    • - Geography type is -

      -
        +
      +
    • + Region +
    • +
        +
      • +
      • + Core-based statistical areas (CBSAs) +
      • +
      +
    • + Other +
    • +
        +
      • -
      • - Other -
      • -
          -
        • - Geography type other -
        • -
        -
      -
-
+ Geography type other + + +
+
+
-
-
+
    +
  • -

    - Geographies are applied to -

    -
      +
    • + Other +
    • +
        +
      • -
      • - Beneficiaries -
      • -
      • - Other -
      • -
          -
        • - Geography applied other -
        • -
        -
      -
-
+ Geography applied other + + +
; existingModelID?: Maybe; existingModelPlan?: Maybe; + geographiesRegionTypes: Array; + geographiesStatesAndTerritories: Array; geographiesTargeted?: Maybe; geographiesTargetedAppliedTo: Array; geographiesTargetedAppliedToOther?: Maybe; @@ -1602,6 +1610,8 @@ export type PlanGeneralCharacteristicsChanges = { communityPartnersInvolvedNote?: InputMaybe; currentModelPlanID?: InputMaybe; existingModelID?: InputMaybe; + geographiesRegionTypes?: InputMaybe>; + geographiesStatesAndTerritories?: InputMaybe>; geographiesTargeted?: InputMaybe; geographiesTargetedAppliedTo?: InputMaybe>; geographiesTargetedAppliedToOther?: InputMaybe; @@ -2583,6 +2593,66 @@ export enum StakeholdersType { STATES = 'STATES' } +export enum StatesAndTerritories { + AK = 'AK', + AL = 'AL', + AR = 'AR', + AS = 'AS', + AZ = 'AZ', + CA = 'CA', + CO = 'CO', + CT = 'CT', + DC = 'DC', + DE = 'DE', + FL = 'FL', + GA = 'GA', + GU = 'GU', + HI = 'HI', + IA = 'IA', + ID = 'ID', + IL = 'IL', + IN = 'IN', + KS = 'KS', + KY = 'KY', + LA = 'LA', + MA = 'MA', + MD = 'MD', + ME = 'ME', + MI = 'MI', + MN = 'MN', + MO = 'MO', + MP = 'MP', + MS = 'MS', + MT = 'MT', + NC = 'NC', + ND = 'ND', + NE = 'NE', + NH = 'NH', + NJ = 'NJ', + NM = 'NM', + NV = 'NV', + NY = 'NY', + OH = 'OH', + OK = 'OK', + OR = 'OR', + PA = 'PA', + PR = 'PR', + RI = 'RI', + SC = 'SC', + SD = 'SD', + TN = 'TN', + TX = 'TX', + UM = 'UM', + UT = 'UT', + VA = 'VA', + VI = 'VI', + VT = 'VT', + WA = 'WA', + WI = 'WI', + WV = 'WV', + WY = 'WY' +} + export type Subscription = { __typename: 'Subscription'; onLockTaskListSectionContext: TaskListSectionLockStatusChanged; @@ -2937,7 +3007,7 @@ export type GetAllGeneralCharacteristicsQueryVariables = Exact<{ }>; -export type GetAllGeneralCharacteristicsQuery = { __typename: 'Query', modelPlan: { __typename: 'ModelPlan', id: UUID, existingModelLinks: Array<{ __typename: 'ExistingModelLink', id?: UUID | null, existingModel?: { __typename: 'ExistingModel', id?: number | null, modelName?: string | null } | null, currentModelPlan?: { __typename: 'ModelPlan', id: UUID, modelName: string } | null }>, generalCharacteristics: { __typename: 'PlanGeneralCharacteristics', id: UUID, isNewModel?: boolean | null, existingModel?: string | null, resemblesExistingModel?: boolean | null, resemblesExistingModelHow?: string | null, resemblesExistingModelNote?: string | null, hasComponentsOrTracks?: boolean | null, hasComponentsOrTracksDiffer?: string | null, hasComponentsOrTracksNote?: string | null, alternativePaymentModelTypes: Array, alternativePaymentModelNote?: string | null, keyCharacteristics: Array, keyCharacteristicsOther?: string | null, keyCharacteristicsNote?: string | null, collectPlanBids?: boolean | null, collectPlanBidsNote?: string | null, managePartCDEnrollment?: boolean | null, managePartCDEnrollmentNote?: string | null, planContractUpdated?: boolean | null, planContractUpdatedNote?: string | null, careCoordinationInvolved?: boolean | null, careCoordinationInvolvedDescription?: string | null, careCoordinationInvolvedNote?: string | null, additionalServicesInvolved?: boolean | null, additionalServicesInvolvedDescription?: string | null, additionalServicesInvolvedNote?: string | null, communityPartnersInvolved?: boolean | null, communityPartnersInvolvedDescription?: string | null, communityPartnersInvolvedNote?: string | null, geographiesTargeted?: boolean | null, geographiesTargetedTypes: Array, geographiesTargetedTypesOther?: string | null, geographiesTargetedAppliedTo: Array, geographiesTargetedAppliedToOther?: string | null, geographiesTargetedNote?: string | null, participationOptions?: boolean | null, participationOptionsNote?: string | null, agreementTypes: Array, agreementTypesOther?: string | null, multiplePatricipationAgreementsNeeded?: boolean | null, multiplePatricipationAgreementsNeededNote?: string | null, rulemakingRequired?: boolean | null, rulemakingRequiredDescription?: string | null, rulemakingRequiredNote?: string | null, authorityAllowances: Array, authorityAllowancesOther?: string | null, authorityAllowancesNote?: string | null, waiversRequired?: boolean | null, waiversRequiredTypes: Array, waiversRequiredNote?: string | null, status: TaskStatus } } }; +export type GetAllGeneralCharacteristicsQuery = { __typename: 'Query', modelPlan: { __typename: 'ModelPlan', id: UUID, existingModelLinks: Array<{ __typename: 'ExistingModelLink', id?: UUID | null, existingModel?: { __typename: 'ExistingModel', id?: number | null, modelName?: string | null } | null, currentModelPlan?: { __typename: 'ModelPlan', id: UUID, modelName: string } | null }>, generalCharacteristics: { __typename: 'PlanGeneralCharacteristics', id: UUID, isNewModel?: boolean | null, existingModel?: string | null, resemblesExistingModel?: boolean | null, resemblesExistingModelHow?: string | null, resemblesExistingModelNote?: string | null, hasComponentsOrTracks?: boolean | null, hasComponentsOrTracksDiffer?: string | null, hasComponentsOrTracksNote?: string | null, alternativePaymentModelTypes: Array, alternativePaymentModelNote?: string | null, keyCharacteristics: Array, keyCharacteristicsOther?: string | null, keyCharacteristicsNote?: string | null, collectPlanBids?: boolean | null, collectPlanBidsNote?: string | null, managePartCDEnrollment?: boolean | null, managePartCDEnrollmentNote?: string | null, planContractUpdated?: boolean | null, planContractUpdatedNote?: string | null, careCoordinationInvolved?: boolean | null, careCoordinationInvolvedDescription?: string | null, careCoordinationInvolvedNote?: string | null, additionalServicesInvolved?: boolean | null, additionalServicesInvolvedDescription?: string | null, additionalServicesInvolvedNote?: string | null, communityPartnersInvolved?: boolean | null, communityPartnersInvolvedDescription?: string | null, communityPartnersInvolvedNote?: string | null, geographiesTargeted?: boolean | null, geographiesTargetedTypes: Array, geographiesStatesAndTerritories: Array, geographiesRegionTypes: Array, geographiesTargetedTypesOther?: string | null, geographiesTargetedAppliedTo: Array, geographiesTargetedAppliedToOther?: string | null, geographiesTargetedNote?: string | null, participationOptions?: boolean | null, participationOptionsNote?: string | null, agreementTypes: Array, agreementTypesOther?: string | null, multiplePatricipationAgreementsNeeded?: boolean | null, multiplePatricipationAgreementsNeededNote?: string | null, rulemakingRequired?: boolean | null, rulemakingRequiredDescription?: string | null, rulemakingRequiredNote?: string | null, authorityAllowances: Array, authorityAllowancesOther?: string | null, authorityAllowancesNote?: string | null, waiversRequired?: boolean | null, waiversRequiredTypes: Array, waiversRequiredNote?: string | null, status: TaskStatus } } }; export type GetAuthorityQueryVariables = Exact<{ id: Scalars['UUID']['input']; @@ -2972,7 +3042,7 @@ export type GetTargetsAndOptionsQueryVariables = Exact<{ }>; -export type GetTargetsAndOptionsQuery = { __typename: 'Query', modelPlan: { __typename: 'ModelPlan', id: UUID, modelName: string, generalCharacteristics: { __typename: 'PlanGeneralCharacteristics', id: UUID, geographiesTargeted?: boolean | null, geographiesTargetedTypes: Array, geographiesTargetedTypesOther?: string | null, geographiesTargetedAppliedTo: Array, geographiesTargetedAppliedToOther?: string | null, geographiesTargetedNote?: string | null, participationOptions?: boolean | null, participationOptionsNote?: string | null, agreementTypes: Array, agreementTypesOther?: string | null, multiplePatricipationAgreementsNeeded?: boolean | null, multiplePatricipationAgreementsNeededNote?: string | null }, operationalNeeds: Array<{ __typename: 'OperationalNeed', id: UUID, modifiedDts?: Time | null }> } }; +export type GetTargetsAndOptionsQuery = { __typename: 'Query', modelPlan: { __typename: 'ModelPlan', id: UUID, modelName: string, generalCharacteristics: { __typename: 'PlanGeneralCharacteristics', id: UUID, geographiesTargeted?: boolean | null, geographiesTargetedTypes: Array, geographiesStatesAndTerritories: Array, geographiesRegionTypes: Array, geographiesTargetedTypesOther?: string | null, geographiesTargetedAppliedTo: Array, geographiesTargetedAppliedToOther?: string | null, geographiesTargetedNote?: string | null, participationOptions?: boolean | null, participationOptionsNote?: string | null, agreementTypes: Array, agreementTypesOther?: string | null, multiplePatricipationAgreementsNeeded?: boolean | null, multiplePatricipationAgreementsNeededNote?: string | null }, operationalNeeds: Array<{ __typename: 'OperationalNeed', id: UUID, modifiedDts?: Time | null }> } }; export type UpdateExistingModelLinksMutationVariables = Exact<{ modelPlanID: Scalars['UUID']['input']; @@ -4477,6 +4547,8 @@ export const GetAllGeneralCharacteristicsDocument = gql` communityPartnersInvolvedNote geographiesTargeted geographiesTargetedTypes + geographiesStatesAndTerritories + geographiesRegionTypes geographiesTargetedTypesOther geographiesTargetedAppliedTo geographiesTargetedAppliedToOther @@ -4771,6 +4843,8 @@ export const GetTargetsAndOptionsDocument = gql` id geographiesTargeted geographiesTargetedTypes + geographiesStatesAndTerritories + geographiesRegionTypes geographiesTargetedTypesOther geographiesTargetedAppliedTo geographiesTargetedAppliedToOther diff --git a/src/gql/gen/types/GetAllGeneralCharacteristics.ts b/src/gql/gen/types/GetAllGeneralCharacteristics.ts index efec383b7f..ba7089edd4 100644 --- a/src/gql/gen/types/GetAllGeneralCharacteristics.ts +++ b/src/gql/gen/types/GetAllGeneralCharacteristics.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AlternativePaymentModelType, KeyCharacteristic, GeographyType, GeographyApplication, AgreementType, AuthorityAllowance, WaiverType, TaskStatus } from "./../../../types/graphql-global-types"; +import { AlternativePaymentModelType, KeyCharacteristic, GeographyType, StatesAndTerritories, GeographyRegionType, GeographyApplication, AgreementType, AuthorityAllowance, WaiverType, TaskStatus } from "./../../../types/graphql-global-types"; // ==================================================== // GraphQL query operation: GetAllGeneralCharacteristics @@ -61,6 +61,8 @@ export interface GetAllGeneralCharacteristics_modelPlan_generalCharacteristics { communityPartnersInvolvedNote: string | null; geographiesTargeted: boolean | null; geographiesTargetedTypes: GeographyType[]; + geographiesStatesAndTerritories: StatesAndTerritories[]; + geographiesRegionTypes: GeographyRegionType[]; geographiesTargetedTypesOther: string | null; geographiesTargetedAppliedTo: GeographyApplication[]; geographiesTargetedAppliedToOther: string | null; diff --git a/src/gql/gen/types/GetTargetsAndOptions.ts b/src/gql/gen/types/GetTargetsAndOptions.ts index fc4d0dc175..279edc9940 100644 --- a/src/gql/gen/types/GetTargetsAndOptions.ts +++ b/src/gql/gen/types/GetTargetsAndOptions.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { GeographyType, GeographyApplication, AgreementType } from "./../../../types/graphql-global-types"; +import { GeographyType, StatesAndTerritories, GeographyRegionType, GeographyApplication, AgreementType } from "./../../../types/graphql-global-types"; // ==================================================== // GraphQL query operation: GetTargetsAndOptions @@ -14,6 +14,8 @@ export interface GetTargetsAndOptions_modelPlan_generalCharacteristics { id: UUID; geographiesTargeted: boolean | null; geographiesTargetedTypes: GeographyType[]; + geographiesStatesAndTerritories: StatesAndTerritories[]; + geographiesRegionTypes: GeographyRegionType[]; geographiesTargetedTypesOther: string | null; geographiesTargetedAppliedTo: GeographyApplication[]; geographiesTargetedAppliedToOther: string | null; diff --git a/src/i18n/en-US/modelPlan/generalCharacteristics.ts b/src/i18n/en-US/modelPlan/generalCharacteristics.ts index 6d456fd78f..191f9f46ef 100644 --- a/src/i18n/en-US/modelPlan/generalCharacteristics.ts +++ b/src/i18n/en-US/modelPlan/generalCharacteristics.ts @@ -325,10 +325,98 @@ export const generalCharacteristics: TranslationGeneralCharacteristics = { dataType: 'enum', formType: 'checkbox', options: { - REGION: 'Region (CBSA, MSA, HRR, etc.)', - STATE: 'State', + STATE: 'States and territories', + REGION: 'Region', OTHER: 'Other' }, + optionsRelatedInfo: { + STATE: 'geographiesStatesAndTerritories', + REGION: 'geographiesRegionTypes', + OTHER: 'geographiesTargetedTypesOther' + }, + filterGroups: ['iddoc', 'pbg'] + }, + geographiesStatesAndTerritories: { + gqlField: 'geographiesStatesAndTerritories', + goField: 'GeographiesStatesAndTerritories', + dbField: 'geographies_states_and_territories', + label: 'Which states and territories?', + multiSelectLabel: 'States and territories', + dataType: 'enum', + formType: 'multiSelect', + options: { + AL: 'AL - Alabama', + AK: 'AK - Alaska', + AZ: 'AZ - Arizona', + AR: 'AR - Arkansas', + CA: 'CA - California', + CO: 'CO - Colorado', + CT: 'CT - Connecticut', + DE: 'DE - Delaware', + DC: 'DC - District of Columbia', + FL: 'FL - Florida', + GA: 'GA - Georgia', + HI: 'HI - Hawaii', + ID: 'ID - Idaho', + IL: 'IL - Illinois', + IN: 'IN - Indiana', + IA: 'IA - Iowa', + KS: 'KS - Kansas', + KY: 'KY - Kentucky', + LA: 'LA - Louisiana', + ME: 'ME - Maine', + MD: 'MD - Maryland', + MA: 'MA - Massachusetts', + MI: 'MI - Michigan', + MN: 'MN - Minnesota', + MS: 'MS - Mississippi', + MO: 'MO - Missouri', + MT: 'MT - Montana', + NE: 'NE - Nebraska', + NV: 'NV - Nevada', + NH: 'NH - New Hampshire', + NJ: 'NJ - New Jersey', + NM: 'NM - New Mexico', + NY: 'NY - New York', + NC: 'NC - North Carolina', + ND: 'ND - North Dakota', + OH: 'OH - Ohio', + OK: 'OK - Oklahoma', + OR: 'OR - Oregon', + PA: 'PA - Pennsylvania', + RI: 'RI - Rhode Island', + SC: 'SC - South Carolina', + SD: 'SD - South Dakota', + TN: 'TN - Tennessee', + TX: 'TX - Texas', + UT: 'UT - Utah', + VT: 'VT - Vermont', + VA: 'VA - Virginia', + WA: 'WA - Washington', + WV: 'WV - West Virginia', + WI: 'WI - Wisconsin', + WY: 'WY - Wyoming', + AS: 'AS - American Samoa', + GU: 'GU - Guam', + MP: 'MP - Northern Mariana Islands', + PR: 'PR - Puerto Rico', + UM: 'UM - U.S. Minor Outlying Islands', + VI: 'VI - U.S. Virgin Islands' + }, + filterGroups: ['iddoc', 'pbg'] + }, + geographiesRegionTypes: { + gqlField: 'geographiesRegionTypes', + goField: 'GeographiesRegionTypes', + dbField: 'geographies_region_types', + label: 'Geography region types', + dataType: 'enum', + formType: 'checkbox', + options: { + CBSA: 'Core-based statistical areas (CBSAs)', + HRR: 'Hospital Referral Regions (HRR)', + MSA: 'Metropolitan Statistical Areas (MSAs)' + }, filterGroups: ['iddoc', 'pbg'] }, geographiesTargetedTypesOther: { diff --git a/src/queries/GetAllModelData.ts b/src/queries/GetAllModelData.ts index 417275f219..968ce0d89f 100644 --- a/src/queries/GetAllModelData.ts +++ b/src/queries/GetAllModelData.ts @@ -86,6 +86,8 @@ export default gql` planContractUpdatedNote geographiesTargeted geographiesTargetedTypes + geographiesStatesAndTerritories + geographiesRegionTypes geographiesTargetedTypesOther geographiesTargetedAppliedTo geographiesTargetedAppliedToOther diff --git a/src/queries/GetAllSingleModelPlan.ts b/src/queries/GetAllSingleModelPlan.ts index 4e082898a6..cfe670c910 100644 --- a/src/queries/GetAllSingleModelPlan.ts +++ b/src/queries/GetAllSingleModelPlan.ts @@ -85,6 +85,8 @@ export default gql` planContractUpdatedNote geographiesTargeted geographiesTargetedTypes + geographiesStatesAndTerritories + geographiesRegionTypes geographiesTargetedTypesOther geographiesTargetedAppliedTo geographiesTargetedAppliedToOther diff --git a/src/queries/types/GetAllModelData.ts b/src/queries/types/GetAllModelData.ts index d84023bd15..0d0aed7dd8 100644 --- a/src/queries/types/GetAllModelData.ts +++ b/src/queries/types/GetAllModelData.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ModelStatus, ModelCategory, CMSCenter, CMMIGroup, ModelType, TaskStatus, AuthorityAllowance, WaiverType, AlternativePaymentModelType, KeyCharacteristic, GeographyType, GeographyApplication, AgreementType, FrequencyType, ParticipantCommunicationType, ParticipantRiskType, GainshareArrangementEligibility, ParticipantsIDType, ConfidenceType, RecruitmentType, ParticipantSelectionType, ParticipantsType, ProviderAddType, ProviderLeaveType, OverlapType, BeneficiariesType, SelectionMethodType, TriStateAnswer, YesNoType, CcmInvolvmentType, YesNoOtherType, DataStartsType, EvaluationApproachType, DataForMonitoringType, DataToSendParticipantsType, DataFullTimeOrIncrementalType, MonitoringFileType, ModelLearningSystemType, AgencyOrStateHelpType, StakeholdersType, ContractorSupportType, BenchmarkForPerformanceType, PayType, ClaimsBasedPayType, ComplexityCalculationLevelType, FundingSource, PayRecipient, NonClaimsBasedPayType, TeamRole, DiscussionUserRole } from "./../../types/graphql-global-types"; +import { ModelStatus, ModelCategory, CMSCenter, CMMIGroup, ModelType, TaskStatus, AuthorityAllowance, WaiverType, AlternativePaymentModelType, KeyCharacteristic, GeographyType, StatesAndTerritories, GeographyRegionType, GeographyApplication, AgreementType, FrequencyType, ParticipantCommunicationType, ParticipantRiskType, GainshareArrangementEligibility, ParticipantsIDType, ConfidenceType, RecruitmentType, ParticipantSelectionType, ParticipantsType, ProviderAddType, ProviderLeaveType, OverlapType, BeneficiariesType, SelectionMethodType, TriStateAnswer, YesNoType, CcmInvolvmentType, YesNoOtherType, DataStartsType, EvaluationApproachType, DataForMonitoringType, DataToSendParticipantsType, DataFullTimeOrIncrementalType, MonitoringFileType, ModelLearningSystemType, AgencyOrStateHelpType, StakeholdersType, ContractorSupportType, BenchmarkForPerformanceType, PayType, ClaimsBasedPayType, ComplexityCalculationLevelType, FundingSource, PayRecipient, NonClaimsBasedPayType, TeamRole, DiscussionUserRole } from "./../../types/graphql-global-types"; // ==================================================== // GraphQL query operation: GetAllModelData @@ -97,6 +97,8 @@ export interface GetAllModelData_modelPlanCollection_generalCharacteristics { planContractUpdatedNote: string | null; geographiesTargeted: boolean | null; geographiesTargetedTypes: GeographyType[]; + geographiesStatesAndTerritories: StatesAndTerritories[]; + geographiesRegionTypes: GeographyRegionType[]; geographiesTargetedTypesOther: string | null; geographiesTargetedAppliedTo: GeographyApplication[]; geographiesTargetedAppliedToOther: string | null; diff --git a/src/queries/types/GetAllSingleModelData.ts b/src/queries/types/GetAllSingleModelData.ts index bd7849dfd4..f47522ccf7 100644 --- a/src/queries/types/GetAllSingleModelData.ts +++ b/src/queries/types/GetAllSingleModelData.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ModelStatus, ModelCategory, CMSCenter, CMMIGroup, ModelType, TaskStatus, AuthorityAllowance, WaiverType, AlternativePaymentModelType, KeyCharacteristic, GeographyType, GeographyApplication, AgreementType, FrequencyType, ParticipantCommunicationType, ParticipantRiskType, GainshareArrangementEligibility, ParticipantsIDType, ConfidenceType, RecruitmentType, ParticipantSelectionType, ParticipantsType, ProviderAddType, ProviderLeaveType, OverlapType, BeneficiariesType, SelectionMethodType, TriStateAnswer, YesNoType, CcmInvolvmentType, YesNoOtherType, DataStartsType, EvaluationApproachType, DataForMonitoringType, DataToSendParticipantsType, DataFullTimeOrIncrementalType, MonitoringFileType, ModelLearningSystemType, AgencyOrStateHelpType, StakeholdersType, ContractorSupportType, BenchmarkForPerformanceType, PayType, ClaimsBasedPayType, ComplexityCalculationLevelType, FundingSource, PayRecipient, NonClaimsBasedPayType, TeamRole, DiscussionUserRole } from "./../../types/graphql-global-types"; +import { ModelStatus, ModelCategory, CMSCenter, CMMIGroup, ModelType, TaskStatus, AuthorityAllowance, WaiverType, AlternativePaymentModelType, KeyCharacteristic, GeographyType, StatesAndTerritories, GeographyRegionType, GeographyApplication, AgreementType, FrequencyType, ParticipantCommunicationType, ParticipantRiskType, GainshareArrangementEligibility, ParticipantsIDType, ConfidenceType, RecruitmentType, ParticipantSelectionType, ParticipantsType, ProviderAddType, ProviderLeaveType, OverlapType, BeneficiariesType, SelectionMethodType, TriStateAnswer, YesNoType, CcmInvolvmentType, YesNoOtherType, DataStartsType, EvaluationApproachType, DataForMonitoringType, DataToSendParticipantsType, DataFullTimeOrIncrementalType, MonitoringFileType, ModelLearningSystemType, AgencyOrStateHelpType, StakeholdersType, ContractorSupportType, BenchmarkForPerformanceType, PayType, ClaimsBasedPayType, ComplexityCalculationLevelType, FundingSource, PayRecipient, NonClaimsBasedPayType, TeamRole, DiscussionUserRole } from "./../../types/graphql-global-types"; // ==================================================== // GraphQL query operation: GetAllSingleModelData @@ -97,6 +97,8 @@ export interface GetAllSingleModelData_modelPlan_generalCharacteristics { planContractUpdatedNote: string | null; geographiesTargeted: boolean | null; geographiesTargetedTypes: GeographyType[]; + geographiesStatesAndTerritories: StatesAndTerritories[]; + geographiesRegionTypes: GeographyRegionType[]; geographiesTargetedTypesOther: string | null; geographiesTargetedAppliedTo: GeographyApplication[]; geographiesTargetedAppliedToOther: string | null; diff --git a/src/types/graphql-global-types.ts b/src/types/graphql-global-types.ts index 0823129435..0e6ed1db51 100644 --- a/src/types/graphql-global-types.ts +++ b/src/types/graphql-global-types.ts @@ -226,6 +226,12 @@ export enum GeographyApplication { PROVIDERS = "PROVIDERS", } +export enum GeographyRegionType { + CBSA = "CBSA", + HRR = "HRR", + MSA = "MSA", +} + export enum GeographyType { OTHER = "OTHER", REGION = "REGION", @@ -577,6 +583,66 @@ export enum StakeholdersType { STATES = "STATES", } +export enum StatesAndTerritories { + AK = "AK", + AL = "AL", + AR = "AR", + AS = "AS", + AZ = "AZ", + CA = "CA", + CO = "CO", + CT = "CT", + DC = "DC", + DE = "DE", + FL = "FL", + GA = "GA", + GU = "GU", + HI = "HI", + IA = "IA", + ID = "ID", + IL = "IL", + IN = "IN", + KS = "KS", + KY = "KY", + LA = "LA", + MA = "MA", + MD = "MD", + ME = "ME", + MI = "MI", + MN = "MN", + MO = "MO", + MP = "MP", + MS = "MS", + MT = "MT", + NC = "NC", + ND = "ND", + NE = "NE", + NH = "NH", + NJ = "NJ", + NM = "NM", + NV = "NV", + NY = "NY", + OH = "OH", + OK = "OK", + OR = "OR", + PA = "PA", + PR = "PR", + RI = "RI", + SC = "SC", + SD = "SD", + TN = "TN", + TX = "TX", + UM = "UM", + UT = "UT", + VA = "VA", + VI = "VI", + VT = "VT", + WA = "WA", + WI = "WI", + WV = "WV", + WY = "WY", +} + export enum TaskListSection { BASICS = "BASICS", BENEFICIARIES = "BENEFICIARIES", @@ -842,6 +908,8 @@ export interface PlanGeneralCharacteristicsChanges { communityPartnersInvolvedNote?: string | null; geographiesTargeted?: boolean | null; geographiesTargetedTypes?: GeographyType[] | null; + geographiesStatesAndTerritories?: StatesAndTerritories[] | null; + geographiesRegionTypes?: GeographyRegionType[] | null; geographiesTargetedTypesOther?: string | null; geographiesTargetedAppliedTo?: GeographyApplication[] | null; geographiesTargetedAppliedToOther?: string | null; diff --git a/src/types/translation.ts b/src/types/translation.ts index b633a47b29..e28a0763de 100644 --- a/src/types/translation.ts +++ b/src/types/translation.ts @@ -25,6 +25,7 @@ import { FundingSource, GainshareArrangementEligibility, GeographyApplication, + GeographyRegionType, GeographyType, KeyCharacteristic, ModelCategory, @@ -46,6 +47,7 @@ import { RecruitmentType, SelectionMethodType, StakeholdersType, + StatesAndTerritories, TaskStatus, TeamRole, TriStateAnswer, @@ -181,6 +183,8 @@ export type TranslationGeneralCharacteristics = { geographiesTargeted: TranslationFieldPropertiesWithOptions; geographiesTargetedTypes: TranslationFieldPropertiesWithOptions; geographiesTargetedTypesOther: TranslationFieldProperties; + geographiesStatesAndTerritories: TranslationFieldPropertiesWithOptions; + geographiesRegionTypes: TranslationFieldPropertiesWithOptions; geographiesTargetedAppliedTo: TranslationFieldPropertiesWithOptions; geographiesTargetedAppliedToOther: TranslationFieldProperties; geographiesTargetedNote: TranslationFieldProperties; diff --git a/src/utils/export/CsvData.ts b/src/utils/export/CsvData.ts index 7f3e66326e..b7ddc35ba0 100644 --- a/src/utils/export/CsvData.ts +++ b/src/utils/export/CsvData.ts @@ -94,6 +94,8 @@ const csvFields = [ 'generalCharacteristics.planContractUpdatedNote', 'generalCharacteristics.geographiesTargeted', 'generalCharacteristics.geographiesTargetedTypes', // array + 'generalCharacteristics.geographiesStatesAndTerritories', // array + 'generalCharacteristics.geographiesRegionTypes', // array 'generalCharacteristics.geographiesTargetedTypesOther', 'generalCharacteristics.geographiesTargetedAppliedTo', // array 'generalCharacteristics.geographiesTargetedAppliedToOther', diff --git a/src/views/ModelPlan/ReadOnly/GeneralCharacteristics/__snapshots__/index.test.tsx.snap b/src/views/ModelPlan/ReadOnly/GeneralCharacteristics/__snapshots__/index.test.tsx.snap index 95e9c38e16..1a22fe97e0 100644 --- a/src/views/ModelPlan/ReadOnly/GeneralCharacteristics/__snapshots__/index.test.tsx.snap +++ b/src/views/ModelPlan/ReadOnly/GeneralCharacteristics/__snapshots__/index.test.tsx.snap @@ -570,87 +570,101 @@ exports[`Read Only Model Plan Summary -- General Characteristics > matches snaps
-
-
+
    +
  • -

    +

      +
    • - Geography type is -

      -
        +
      +
    • + Region +
    • +
        +
      • +
      • + Core-based statistical areas (CBSAs) +
      • +
      +
    • + Other +
    • +
        +
      • -
      • - Other -
      • -
          -
        • - Geography type other -
        • -
        -
      -
-
+ Geography type other + + +
+
+
-
-
+
    +
  • -

    - Geographies are applied to -

    -
      +
    • + Other +
    • +
        +
      • -
      • - Beneficiaries -
      • -
      • - Other -
      • -
          -
        • - Geography applied other -
        • -
        -
      -
-
+ Geography applied other + + +
- generalCharacteristicsT( - `geographiesTargetedTypes.options.${type}` - ) - ), - listOtherItem: geographiesTargetedTypesOther - }} - secondSection={{ - heading: generalCharacteristicsT( - 'geographiesTargetedAppliedTo.label' - ), - list: true, - listItems: geographiesTargetedAppliedTo?.map((type): string => - generalCharacteristicsT( - `geographiesTargetedAppliedTo.options.${type}` - ) - ), - listOtherItem: geographiesTargetedAppliedToOther - }} + + generalCharacteristicsT( + `geographiesStatesAndTerritories.options.${state}` + ).split(' - ')[1] + ) + .join(', '), + geographiesRegionTypes: + geographiesRegionTypes?.length !== 0 && + geographiesRegionTypes?.map(region => { + return ( +
  • + {generalCharacteristicsT( + `geographiesRegionTypes.options.${region}` + )} +
  • + ); + }), + geographiesTargetedTypesOther + } + )} + /> + )} + + {checkGroupMap( + isViewingFilteredView, + filteredQuestions, + 'geographiesTargetedTypes', + )} + {checkGroupMap( isViewingFilteredView, filteredQuestions, diff --git a/src/views/ModelPlan/ReadOnly/_components/ReadOnlySection/index.tsx b/src/views/ModelPlan/ReadOnly/_components/ReadOnlySection/index.tsx index bbf63c92b9..ae0eac65e6 100644 --- a/src/views/ModelPlan/ReadOnly/_components/ReadOnlySection/index.tsx +++ b/src/views/ModelPlan/ReadOnly/_components/ReadOnlySection/index.tsx @@ -14,7 +14,9 @@ export type ReadOnlySectionProps = { list?: boolean; listItems?: (string | number | React.ReactElement)[]; listOtherItem?: string | null; - listOtherItems?: (string | null | undefined)[] | undefined; + listOtherItems?: + | (string | null | undefined | React.ReactElement[])[] + | undefined; tooltips?: (string | null | undefined)[]; notes?: string | null; }; @@ -156,7 +158,7 @@ const ReadOnlySection = ({ ); }; -/* +/* Util function for prepping data to listItems prop of ReadOnlySection Using translation config instead of raw data allows us to ensure a predetermined order of render */ @@ -169,7 +171,7 @@ export const formatListItems = ( .map((option): string => config.options[option]); }; -/* +/* Util function for prepping data to listOtherItems prop of ReadOnlySection Using translation config instead of raw data allows us to ensure a predetermined order of render */ diff --git a/src/views/ModelPlan/TaskList/GeneralCharacteristics/TargetsAndOptions/__snapshots__/index.test.tsx.snap b/src/views/ModelPlan/TaskList/GeneralCharacteristics/TargetsAndOptions/__snapshots__/index.test.tsx.snap index c9771b1076..a3541f22e0 100644 --- a/src/views/ModelPlan/TaskList/GeneralCharacteristics/TargetsAndOptions/__snapshots__/index.test.tsx.snap +++ b/src/views/ModelPlan/TaskList/GeneralCharacteristics/TargetsAndOptions/__snapshots__/index.test.tsx.snap @@ -151,95 +151,99 @@ exports[`Model Plan Characteristics > matches snapshot 1`] = `
    -
    - -

    -

    -
    - - -

    -

    -
    - -
    +
    - Other - -

    -

    -
    -
    +
    - Please specify what the other geography type is. - - + + +

    +

    +
    + + +