Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Maciej Szewczyk committed Dec 23, 2024
1 parent ed9fe9c commit 90af108
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 16 deletions.
8 changes: 7 additions & 1 deletion src/frontend/src/__generated__/graphql.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const AllPaymentsForTable = gql`
id
unicefId
status
vulnerabilityScore
household {
id
unicefId
Expand All @@ -40,6 +41,11 @@ export const AllPaymentsForTable = gql`
id
name
}
headOfHousehold {
id
unicefId
fullName
}
individuals {
edges {
node {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
) || [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<TargetPopulationHouseholdTable
id={id}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import TableCell from '@mui/material/TableCell';
import { HouseholdNode } from '@generated/graphql';
import { PaymentNode } from '@generated/graphql';
import { ClickableTableRow } from '@components/core/Table/ClickableTableRow';
import { AnonTableCell } from '@components/core/Table/AnonTableCell';
import { BlackLink } from '@components/core/BlackLink';
import { useBaseUrl } from '@hooks/useBaseUrl';
import { ReactElement } from 'react';

interface TargetPopulationPeopleTableRowProps {
household: HouseholdNode;
payment: PaymentNode;
canViewDetails?: boolean;
}

export function TargetPopulationPeopleTableRow({
household,
payment,
canViewDetails,
}): ReactElement<TargetPopulationPeopleTableRowProps> {
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) {
Expand All @@ -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}
>
<TableCell align="left">
{canViewDetails ? (
<BlackLink to={householdDetailsPath}>
{household.headOfHousehold.unicefId}
{payment.household.headOfHousehold.unicefId}
</BlackLink>
) : (
household.unicefId
payment.household.unicefId
)}
</TableCell>
<AnonTableCell>{household.headOfHousehold?.fullName}</AnonTableCell>
<TableCell align="left">{household.adminArea?.name || '-'}</TableCell>
<AnonTableCell>
{payment.household.headOfHousehold.fullName}
</AnonTableCell>
<TableCell align="left">
{household.selection?.vulnerabilityScore == null
{payment.household.admin2?.name || '-'}
</TableCell>
<TableCell align="left">
{payment?.vulnerabilityScore == null
? '-'
: household.selection?.vulnerabilityScore}
: payment?.vulnerabilityScore}
</TableCell>
</ClickableTableRow>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function TargetPopulationPeopleTable({
renderRow={(row) => (
<TargetPopulationPeopleTableRow
key={row.id}
household={row}
payment={row}
canViewDetails={canViewDetails}
/>
)}
Expand Down
1 change: 0 additions & 1 deletion src/frontend/src/utils/targetingUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 90af108

Please sign in to comment.