From 90af1088b864bfdfcbd77e20ae1ea78089eceaff Mon Sep 17 00:00:00 2001 From: Maciej Szewczyk Date: Mon, 23 Dec 2024 16:21:09 +0100 Subject: [PATCH] bug fixes --- src/frontend/src/__generated__/graphql.tsx | 8 +++++- .../queries/payments/AllPaymentsForTable.ts | 6 +++++ .../TargetPopulationTableFilters.tsx | 12 +++++++-- .../targeting/TargetingHouseholds.tsx | 1 + .../TargetPopulationPeopleRow.tsx | 26 +++++++++++-------- .../TargetPopulationPeopleTable.tsx | 2 +- src/frontend/src/utils/targetingUtils.ts | 1 - 7 files changed, 40 insertions(+), 16 deletions(-) diff --git a/src/frontend/src/__generated__/graphql.tsx b/src/frontend/src/__generated__/graphql.tsx index 73fbd851b6..4cd8b2d015 100644 --- a/src/frontend/src/__generated__/graphql.tsx +++ b/src/frontend/src/__generated__/graphql.tsx @@ -9156,7 +9156,7 @@ export type AllPaymentsForTableQueryVariables = Exact<{ }>; -export type AllPaymentsForTableQuery = { __typename?: 'Query', allPayments?: { __typename?: 'PaymentNodeConnection', totalCount?: number | null, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null, endCursor?: string | null }, edges: Array<{ __typename?: 'PaymentNodeEdge', cursor: string, node?: { __typename?: 'PaymentNode', id: string, unicefId?: string | null, status: PaymentStatus, entitlementQuantity?: number | null, entitlementQuantityUsd?: number | null, currency?: string | null, deliveredQuantity?: number | null, deliveredQuantityUsd?: number | null, paymentPlanHardConflicted?: boolean | null, paymentPlanSoftConflicted?: boolean | null, fspAuthCode?: string | null, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, size?: number | null, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null, individuals?: { __typename?: 'IndividualNodeConnection', edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string } | null } | null> } | null }, paymentPlanHardConflictedData?: Array<{ __typename?: 'PaymentConflictDataNode', paymentPlanUnicefId?: string | null, paymentPlanId?: string | null, paymentPlanStartDate?: string | null, paymentPlanEndDate?: string | null, paymentPlanStatus?: string | null, paymentId?: string | null, paymentUnicefId?: string | null } | null> | null, paymentPlanSoftConflictedData?: Array<{ __typename?: 'PaymentConflictDataNode', paymentPlanUnicefId?: string | null, paymentPlanId?: string | null, paymentPlanStartDate?: string | null, paymentPlanEndDate?: string | null, paymentPlanStatus?: string | null, paymentId?: string | null, paymentUnicefId?: string | null } | null> | null, collector: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, financialServiceProvider?: { __typename?: 'FinancialServiceProviderNode', id: string, name: string } | null } | null } | null> } | null }; +export type AllPaymentsForTableQuery = { __typename?: 'Query', allPayments?: { __typename?: 'PaymentNodeConnection', totalCount?: number | null, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null, endCursor?: string | null }, edges: Array<{ __typename?: 'PaymentNodeEdge', cursor: string, node?: { __typename?: 'PaymentNode', id: string, unicefId?: string | null, status: PaymentStatus, vulnerabilityScore?: number | null, entitlementQuantity?: number | null, entitlementQuantityUsd?: number | null, currency?: string | null, deliveredQuantity?: number | null, deliveredQuantityUsd?: number | null, paymentPlanHardConflicted?: boolean | null, paymentPlanSoftConflicted?: boolean | null, fspAuthCode?: string | null, household: { __typename?: 'HouseholdNode', id: string, unicefId?: string | null, size?: number | null, admin2?: { __typename?: 'AreaNode', id: string, name: string } | null, headOfHousehold?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string } | null, individuals?: { __typename?: 'IndividualNodeConnection', edges: Array<{ __typename?: 'IndividualNodeEdge', node?: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string } | null } | null> } | null }, paymentPlanHardConflictedData?: Array<{ __typename?: 'PaymentConflictDataNode', paymentPlanUnicefId?: string | null, paymentPlanId?: string | null, paymentPlanStartDate?: string | null, paymentPlanEndDate?: string | null, paymentPlanStatus?: string | null, paymentId?: string | null, paymentUnicefId?: string | null } | null> | null, paymentPlanSoftConflictedData?: Array<{ __typename?: 'PaymentConflictDataNode', paymentPlanUnicefId?: string | null, paymentPlanId?: string | null, paymentPlanStartDate?: string | null, paymentPlanEndDate?: string | null, paymentPlanStatus?: string | null, paymentId?: string | null, paymentUnicefId?: string | null } | null> | null, collector: { __typename?: 'IndividualNode', id: string, unicefId?: string | null, fullName: string }, financialServiceProvider?: { __typename?: 'FinancialServiceProviderNode', id: string, name: string } | null } | null } | null> } | null }; export type IndividualPhotosQueryVariables = Exact<{ id: Scalars['ID']['input']; @@ -17493,6 +17493,7 @@ export const AllPaymentsForTableDocument = gql` id unicefId status + vulnerabilityScore household { id unicefId @@ -17501,6 +17502,11 @@ export const AllPaymentsForTableDocument = gql` id name } + headOfHousehold { + id + unicefId + fullName + } individuals { edges { node { diff --git a/src/frontend/src/apollo/queries/payments/AllPaymentsForTable.ts b/src/frontend/src/apollo/queries/payments/AllPaymentsForTable.ts index 419faf3ce3..35e354d319 100644 --- a/src/frontend/src/apollo/queries/payments/AllPaymentsForTable.ts +++ b/src/frontend/src/apollo/queries/payments/AllPaymentsForTable.ts @@ -32,6 +32,7 @@ export const AllPaymentsForTable = gql` id unicefId status + vulnerabilityScore household { id unicefId @@ -40,6 +41,11 @@ export const AllPaymentsForTable = gql` id name } + headOfHousehold { + id + unicefId + fullName + } individuals { edges { node { diff --git a/src/frontend/src/components/targeting/TargetPopulationTableFilters.tsx b/src/frontend/src/components/targeting/TargetPopulationTableFilters.tsx index cd122a0184..a81e88b7d4 100644 --- a/src/frontend/src/components/targeting/TargetPopulationTableFilters.tsx +++ b/src/frontend/src/components/targeting/TargetPopulationTableFilters.tsx @@ -54,15 +54,23 @@ export const TargetPopulationTableFilters = ({ }; const allowedStatusChoices = [ + 'ASSIGNED', + PaymentPlanStatus.Draft, PaymentPlanStatus.TpOpen, PaymentPlanStatus.TpLocked, - PaymentPlanStatus.Finished, + PaymentPlanStatus.Processing, + PaymentPlanStatus.SteficonRun, + PaymentPlanStatus.SteficonWait, + PaymentPlanStatus.SteficonCompleted, ]; const { data: statusChoicesData } = usePaymentPlanStatusChoicesQueryQuery(); const preparedStatusChoices = - statusChoicesData?.paymentPlanStatusChoices?.filter((el) => + [ + { name: 'Assigned', value: 'ASSIGNED' }, + ...(statusChoicesData?.paymentPlanStatusChoices || []), + ]?.filter((el) => allowedStatusChoices.includes(el.value as PaymentPlanStatus), ) || []; diff --git a/src/frontend/src/components/targeting/TargetingHouseholds.tsx b/src/frontend/src/components/targeting/TargetingHouseholds.tsx index 7b4667b01d..b382c214c9 100644 --- a/src/frontend/src/components/targeting/TargetingHouseholds.tsx +++ b/src/frontend/src/components/targeting/TargetingHouseholds.tsx @@ -6,6 +6,7 @@ import { ReactElement } from 'react'; export function TargetingHouseholds({ id, canViewDetails }): ReactElement { const { businessArea } = useBaseUrl(); + //TODO: display HH data here from allpayments query return ( { const { baseUrl } = useBaseUrl(); - const householdDetailsPath = `/${baseUrl}/population/people/${household.headOfHousehold.id}`; + const householdDetailsPath = `/${baseUrl}/population/people/${payment.household.household?.headOfHousehold?.id}`; const handleClick = (): void => { const win = window.open(householdDetailsPath, '_blank'); if (win != null) { @@ -30,23 +30,27 @@ export function TargetPopulationPeopleTableRow({ onClick={canViewDetails ? handleClick : undefined} role="checkbox" data-cy="target-population-people-row" - key={household.id} + key={payment.household.id} > {canViewDetails ? ( - {household.headOfHousehold.unicefId} + {payment.household.headOfHousehold.unicefId} ) : ( - household.unicefId + payment.household.unicefId )} - {household.headOfHousehold?.fullName} - {household.adminArea?.name || '-'} + + {payment.household.headOfHousehold.fullName} + - {household.selection?.vulnerabilityScore == null + {payment.household.admin2?.name || '-'} + + + {payment?.vulnerabilityScore == null ? '-' - : household.selection?.vulnerabilityScore} + : payment?.vulnerabilityScore} ); diff --git a/src/frontend/src/containers/tables/targeting/TargetPopulationPeopleTable/TargetPopulationPeopleTable.tsx b/src/frontend/src/containers/tables/targeting/TargetPopulationPeopleTable/TargetPopulationPeopleTable.tsx index ae76c29605..963971a607 100644 --- a/src/frontend/src/containers/tables/targeting/TargetPopulationPeopleTable/TargetPopulationPeopleTable.tsx +++ b/src/frontend/src/containers/tables/targeting/TargetPopulationPeopleTable/TargetPopulationPeopleTable.tsx @@ -37,7 +37,7 @@ export function TargetPopulationPeopleTable({ renderRow={(row) => ( )} diff --git a/src/frontend/src/utils/targetingUtils.ts b/src/frontend/src/utils/targetingUtils.ts index 4ff5901082..bbf5478c8c 100644 --- a/src/frontend/src/utils/targetingUtils.ts +++ b/src/frontend/src/utils/targetingUtils.ts @@ -209,7 +209,6 @@ export function formatCriteriaFilters(filters) { return filters.map((each) => { let comparisonMethod; let values; - console.log('each', each); switch (each?.fieldAttribute?.type || each?.type) { case 'SELECT_ONE': comparisonMethod = 'EQUALS';