From 82d3015568dad81962f8201c27e5f03d3fce071b Mon Sep 17 00:00:00 2001 From: Maciej Szewczyk Date: Fri, 20 Dec 2024 16:01:01 +0100 Subject: [PATCH] fix pp queries --- src/frontend/src/__generated__/graphql.tsx | 13 ++++++- .../paymentmodule/AllPaymentPlansForTable.ts | 4 +++ .../targeting/TargetPopulationDetails.tsx | 35 ------------------- ...okUpTargetPopulationTableCommunication.tsx | 1 + .../LookUpTargetPopulationTableSurveys.tsx | 1 + .../PaymentPlansTable/PaymentPlansTable.tsx | 1 + .../PeoplePaymentPlansTable.tsx | 1 + .../TargetPopulationHouseholdTable.tsx | 2 -- src/frontend/src/utils/utils.ts | 1 - 9 files changed, 20 insertions(+), 39 deletions(-) diff --git a/src/frontend/src/__generated__/graphql.tsx b/src/frontend/src/__generated__/graphql.tsx index aa40f60484..6684c6faa1 100644 --- a/src/frontend/src/__generated__/graphql.tsx +++ b/src/frontend/src/__generated__/graphql.tsx @@ -1190,6 +1190,11 @@ export type DeleteHouseholdApproveMutation = { grievanceTicket?: Maybe; }; +export type DeletePaymentPlanMutation = { + __typename?: 'DeletePaymentPlanMutation'; + paymentPlan?: Maybe; +}; + export type DeletePaymentVerificationPlan = { __typename?: 'DeletePaymentVerificationPlan'; paymentPlan?: Maybe; @@ -8662,6 +8667,8 @@ export type SetSteficonRuleOnTargetPopulationMutationVariables = Exact<{ }>; +export type SetSteficonRuleOnTargetPopulationMutation = { __typename?: 'Mutations', setSteficonRuleOnTargetPopulation?: { __typename?: 'SetSteficonRuleOnTargetPopulationMutation', paymentPlan?: { __typename?: 'PaymentPlanNode', id: string, name?: string | null } | null } | null }; + export type UpdateTpMutationVariables = Exact<{ input: UpdatePaymentPlanInput; }>; @@ -16590,7 +16597,7 @@ export type AllDeliveryMechanismsLazyQueryHookResult = ReturnType; export type AllDeliveryMechanismsQueryResult = Apollo.QueryResult; export const AllPaymentPlansForTableDocument = gql` - query AllPaymentPlansForTable($after: String, $before: String, $first: Int, $last: Int, $orderBy: String, $businessArea: String!, $search: String, $status: [String], $totalEntitledQuantityFrom: Float, $totalEntitledQuantityTo: Float, $dispersionStartDate: Date, $dispersionEndDate: Date, $isFollowUp: Boolean, $program: String, $programCycle: String, $totalHouseholdsCountWithValidPhoneNoMin: Int, $totalHouseholdsCountWithValidPhoneNoMax: Int, $createdAtRange: String, $statusNot: String) { + query AllPaymentPlansForTable($after: String, $before: String, $first: Int, $last: Int, $orderBy: String, $businessArea: String!, $search: String, $status: [String], $totalEntitledQuantityFrom: Float, $totalEntitledQuantityTo: Float, $dispersionStartDate: Date, $dispersionEndDate: Date, $isFollowUp: Boolean, $program: String, $programCycle: String, $totalHouseholdsCountWithValidPhoneNoMin: Int, $totalHouseholdsCountWithValidPhoneNoMax: Int, $createdAtRange: String, $statusNot: String, $isPaymentPlan: Boolean, $isTargetPopulation: Boolean) { allPaymentPlans( after: $after before: $before @@ -16611,6 +16618,8 @@ export const AllPaymentPlansForTableDocument = gql` totalHouseholdsCountWithValidPhoneNoMax: $totalHouseholdsCountWithValidPhoneNoMax createdAtRange: $createdAtRange statusNot: $statusNot + isPaymentPlan: $isPaymentPlan + isTargetPopulation: $isTargetPopulation ) { pageInfo { hasNextPage @@ -16700,6 +16709,8 @@ export const AllPaymentPlansForTableDocument = gql` * totalHouseholdsCountWithValidPhoneNoMax: // value for 'totalHouseholdsCountWithValidPhoneNoMax' * createdAtRange: // value for 'createdAtRange' * statusNot: // value for 'statusNot' + * isPaymentPlan: // value for 'isPaymentPlan' + * isTargetPopulation: // value for 'isTargetPopulation' * }, * }); */ diff --git a/src/frontend/src/apollo/queries/paymentmodule/AllPaymentPlansForTable.ts b/src/frontend/src/apollo/queries/paymentmodule/AllPaymentPlansForTable.ts index a2b09fc096..74d878055d 100644 --- a/src/frontend/src/apollo/queries/paymentmodule/AllPaymentPlansForTable.ts +++ b/src/frontend/src/apollo/queries/paymentmodule/AllPaymentPlansForTable.ts @@ -21,6 +21,8 @@ export const AllPaymentPlansForTable = gql` $totalHouseholdsCountWithValidPhoneNoMax: Int $createdAtRange: String $statusNot: String + $isPaymentPlan: Boolean + $isTargetPopulation: Boolean ) { allPaymentPlans( after: $after @@ -42,6 +44,8 @@ export const AllPaymentPlansForTable = gql` totalHouseholdsCountWithValidPhoneNoMax: $totalHouseholdsCountWithValidPhoneNoMax createdAtRange: $createdAtRange statusNot: $statusNot + isPaymentPlan: $isPaymentPlan + isTargetPopulation: $isTargetPopulation ) { pageInfo { hasNextPage diff --git a/src/frontend/src/components/targeting/TargetPopulationDetails.tsx b/src/frontend/src/components/targeting/TargetPopulationDetails.tsx index 5ab1fbd5ae..8706c2ebf2 100644 --- a/src/frontend/src/components/targeting/TargetPopulationDetails.tsx +++ b/src/frontend/src/components/targeting/TargetPopulationDetails.tsx @@ -21,20 +21,6 @@ export function TargetPopulationDetails({ const { createdBy, program, programCycle } = targetPopulation; const { t } = useTranslation(); - //TODO: ?? replace it with some other? - // const closeDate = changeDate ? ( - // {changeDate} - // ) : ( - // '-' - // ); - // const sendBy = sentForFinanceReleaseBy - // ? `${sentForFinanceReleaseBy.firstName} ${sentForFinanceReleaseBy.lastName}` - // : '-'; - // const sendDate = sentForFinanceReleaseDate ? ( - // {sentForFinanceReleaseDate} - // ) : ( - // '-' - // ); const programName = program?.name ? program.name : '-'; return ( @@ -60,13 +46,6 @@ export function TargetPopulationDetails({ value={`${createdBy.firstName} ${createdBy.lastName}`} /> - {/* - - */} - {/* - - - - - */} diff --git a/src/frontend/src/containers/tables/Communication/LookUpTargetPopulationTableCommunication/LookUpTargetPopulationTableCommunication.tsx b/src/frontend/src/containers/tables/Communication/LookUpTargetPopulationTableCommunication/LookUpTargetPopulationTableCommunication.tsx index fa69b96f58..00d996d20f 100644 --- a/src/frontend/src/containers/tables/Communication/LookUpTargetPopulationTableCommunication/LookUpTargetPopulationTableCommunication.tsx +++ b/src/frontend/src/containers/tables/Communication/LookUpTargetPopulationTableCommunication/LookUpTargetPopulationTableCommunication.tsx @@ -53,6 +53,7 @@ export const LookUpTargetPopulationTableCommunication = ({ max: filter.createdAtRangeMax || null, }), statusNot: PaymentPlanStatus.Open, + isTargetPopulation: true, }; const handleRadioChange = (id: string): void => { diff --git a/src/frontend/src/containers/tables/Surveys/LookUpTargetPopulationTableSurveys/LookUpTargetPopulationTableSurveys.tsx b/src/frontend/src/containers/tables/Surveys/LookUpTargetPopulationTableSurveys/LookUpTargetPopulationTableSurveys.tsx index 1e0ccceaff..f9ec700050 100644 --- a/src/frontend/src/containers/tables/Surveys/LookUpTargetPopulationTableSurveys/LookUpTargetPopulationTableSurveys.tsx +++ b/src/frontend/src/containers/tables/Surveys/LookUpTargetPopulationTableSurveys/LookUpTargetPopulationTableSurveys.tsx @@ -54,6 +54,7 @@ export function LookUpTargetPopulationTableSurveys({ max: filter.createdAtRangeMax || null, }), statusNot: PaymentPlanStatus.Open, + isTargetPopulation: true, }; const handleRadioChange = (id: string): void => { diff --git a/src/frontend/src/containers/tables/paymentmodule/PaymentPlansTable/PaymentPlansTable.tsx b/src/frontend/src/containers/tables/paymentmodule/PaymentPlansTable/PaymentPlansTable.tsx index e4cda0f291..d784ae7ed5 100644 --- a/src/frontend/src/containers/tables/paymentmodule/PaymentPlansTable/PaymentPlansTable.tsx +++ b/src/frontend/src/containers/tables/paymentmodule/PaymentPlansTable/PaymentPlansTable.tsx @@ -36,6 +36,7 @@ export function PaymentPlansTable({ dispersionEndDate: filter.dispersionEndDate || null, isFollowUp: filter.isFollowUp ? true : null, program: programId, + isPaymentPlan: true, }; const replacements = { totalHouseholdsCount: (_beneficiaryGroup) => diff --git a/src/frontend/src/containers/tables/paymentmodulePeople/PeoplePaymentPlansTable/PeoplePaymentPlansTable.tsx b/src/frontend/src/containers/tables/paymentmodulePeople/PeoplePaymentPlansTable/PeoplePaymentPlansTable.tsx index a1b9cff5e3..7d3bf2d519 100644 --- a/src/frontend/src/containers/tables/paymentmodulePeople/PeoplePaymentPlansTable/PeoplePaymentPlansTable.tsx +++ b/src/frontend/src/containers/tables/paymentmodulePeople/PeoplePaymentPlansTable/PeoplePaymentPlansTable.tsx @@ -31,6 +31,7 @@ export const PeoplePaymentPlansTable = ({ dispersionEndDate: filter.dispersionEndDate || null, isFollowUp: filter.isFollowUp ? true : null, program: programId, + isPaymentPlan: true, }; return ( diff --git a/src/frontend/src/containers/tables/targeting/TargetPopulationHouseholdTable/TargetPopulationHouseholdTable.tsx b/src/frontend/src/containers/tables/targeting/TargetPopulationHouseholdTable/TargetPopulationHouseholdTable.tsx index b95012962b..987b13dd29 100644 --- a/src/frontend/src/containers/tables/targeting/TargetPopulationHouseholdTable/TargetPopulationHouseholdTable.tsx +++ b/src/frontend/src/containers/tables/targeting/TargetPopulationHouseholdTable/TargetPopulationHouseholdTable.tsx @@ -43,8 +43,6 @@ export function TargetPopulationHouseholdTable({ replacements, ); - //TODO: adjust headcells and renderRow - return (