Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Maciej Szewczyk committed Dec 17, 2024
1 parent eb2cdc8 commit 9c1dd4b
Show file tree
Hide file tree
Showing 24 changed files with 801 additions and 1,849 deletions.
5 changes: 3 additions & 2 deletions src/frontend/data/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2498,7 +2498,7 @@ type PaymentNode implements Node {
vulnerabilityScore: Float
followUps(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection!
householdSnapshot: PaymentHouseholdSnapshotNode
paymentVerification: PaymentVerificationNode
paymentVerifications(offset: Int, before: String, after: String, first: Int, last: Int): PaymentVerificationNodeConnection!
ticketComplaintDetails(offset: Int, before: String, after: String, first: Int, last: Int): TicketComplaintDetailsNodeConnection!
ticketSensitiveDetails(offset: Int, before: String, after: String, first: Int, last: Int): TicketSensitiveDetailsNodeConnection!
adminUrl: String
Expand Down Expand Up @@ -2636,6 +2636,7 @@ type PaymentPlanNode implements Node {
canSplit: Boolean
supportingDocuments: [PaymentPlanSupportingDocumentNode]
program: ProgramNode
totalHouseholdsCountWithValidPhoneNo: Int
}

type PaymentPlanNodeConnection {
Expand Down Expand Up @@ -3124,7 +3125,7 @@ type Query {
sampleSize(input: GetCashplanVerificationSampleSizeInput): GetCashplanVerificationSampleSizeObject
allPaymentVerificationLogEntries(offset: Int, before: String, after: String, first: Int, last: Int, objectId: UUID, user: ID, businessArea: String!, search: String, module: String, userId: String, programId: String): PaymentVerificationLogEntryNodeConnection
paymentPlan(id: ID!): PaymentPlanNode
allPaymentPlans(offset: Int, before: String, after: String, first: Int, last: Int, businessArea: String!, search: String, status: [String], totalEntitledQuantityFrom: Float, totalEntitledQuantityTo: Float, dispersionStartDate: Date, dispersionEndDate: Date, isFollowUp: Boolean, isPaymentPlan: Boolean, isTargetPopulation: Boolean, sourcePaymentPlanId: String, program: String, programCycle: String, name: String, paymentPlanApplicable: Boolean, totalHouseholdsCountMin: Int, totalHouseholdsCountMax: Int, createdAtRange: String, orderBy: String): PaymentPlanNodeConnection
allPaymentPlans(offset: Int, before: String, after: String, first: Int, last: Int, businessArea: String!, search: String, status: [String], totalEntitledQuantityFrom: Float, totalEntitledQuantityTo: Float, dispersionStartDate: Date, dispersionEndDate: Date, isFollowUp: Boolean, isPaymentPlan: Boolean, isTargetPopulation: Boolean, sourcePaymentPlanId: String, program: String, programCycle: String, name: String, paymentPlanApplicable: Boolean, totalHouseholdsCountMin: Int, totalHouseholdsCountMax: Int, totalHouseholdsCountWithValidPhoneNoMax: Int, totalHouseholdsCountWithValidPhoneNoMin: Int, createdAtRange: String, orderBy: String): PaymentPlanNodeConnection
paymentPlanStatusChoices: [ChoiceObject]
currencyChoices: [ChoiceObject]
allDeliveryMechanisms: [ChoiceObject]
Expand Down
6 changes: 6 additions & 0 deletions src/frontend/fixtures/paymentmodule/fakeApolloPaymentPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@ export const fakeApolloPaymentPlan: PaymentPlanQuery['paymentPlan'] = {
__typename: 'ReconciliationSummaryNode',
},
__typename: 'PaymentPlanNode',
excludedIds: '',
programCycle: {
__typename: 'ProgramCycleNode',
id: '',
title: '',
},
};

export const fakeApolloPaymentPlanWithWrongBackgroundActionStatus: PaymentPlanQuery['paymentPlan'] =
Expand Down
4 changes: 3 additions & 1 deletion src/frontend/fixtures/programs/fakeApolloAllPrograms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ export const fakeApolloAllPrograms = [
startDate: '2020-01-20',
endDate: '2020-08-19',
status: 'ACTIVE',
caId: '123-21-PRG-00001',
internalData: {
caId: '123-21-PRG-00001',
},
description:
'Purpose she occur lose new wish day per little because east like bill.',
budget: '691946197.49',
Expand Down
2,350 changes: 658 additions & 1,692 deletions src/frontend/src/__generated__/graphql.tsx

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/frontend/src/apollo/queries/paymentmodule/PaymentPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ export const PAYMENT_PLAN_QUERY = gql`
id
name
caId
caHashId
isSocialWorkerProgram
}
vulnerabilityScoreMin
vulnerabilityScoreMax
adminUrl
currency
currencyName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ export const query = gql`
query PaymentVerificationPlan($id: ID!) {
paymentVerificationPlan(id: $id) {
id
# cashPlan{
# id
# caHashId
# }
}
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ export const AllActiveTargetPopulations = gql`
$last: Int
$orderBy: String
$name: String
$status: String
$status: String[]
$totalHouseholdsCountWithValidPhoneNoMin: Int
$totalHouseholdsCountWithValidPhoneNoMax: Int
$totalHouseholdsCountMin: Int
$totalHouseholdsCountMax: Int
$businessArea: String
$program: ID
$businessArea: String!
$program: String
$createdAtRange: String
$statusNot: String
) {
allPaymentPlans(
after: $after
Expand All @@ -33,7 +32,6 @@ export const AllActiveTargetPopulations = gql`
businessArea: $businessArea
program: $program
createdAtRange: $createdAtRange
statusNot: $statusNot
) {
edges {
node {
Expand Down
6 changes: 4 additions & 2 deletions src/frontend/src/apollo/queries/targeting/TargetPopulation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ export const TARGET_POPULATION_QUERY = gql`
status
buildStatus
adminUrl
buildStatus
totalHouseholdsCount
totalIndividualsCount
statusDate
femaleChildrenCount
femaleAdultsCount
maleChildrenCount
maleAdultsCount
excludedIds
exclusionReason
vulnerabilityScoreMin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export const LookUpPaymentRecordDisplay = ({
const renderPaymentRecords = (): ReactElement => {
if (values.selectedPaymentRecords.length) {
return values.selectedPaymentRecords.map((record) => (
<BlueText key={record.caId} data-cy="payment-record">
{record.caId}
<BlueText key={record.internalData.caId} data-cy="payment-record">
{record.internalData.caId}
</BlueText>
));
}
Expand Down
5 changes: 4 additions & 1 deletion src/frontend/src/components/grievances/PaymentIds.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Box, Typography } from '@mui/material';
import { useTranslation } from 'react-i18next';
import { PaymentRecordAndPaymentNode, PaymentVerificationNode } from '@generated/graphql';
import {
PaymentRecordAndPaymentNode,
PaymentVerificationNode,
} from '@generated/graphql';
import { useBaseUrl } from '@hooks/useBaseUrl';
import { ContentLink } from '@core/ContentLink';
import { Title } from '@core/Title';
Expand Down
55 changes: 26 additions & 29 deletions src/frontend/src/components/payments/VerifyManual.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,9 @@ import { DialogActions } from '@containers/dialogs/DialogActions';
import { DialogContainer } from '@containers/dialogs/DialogContainer';
import { DialogFooter } from '@containers/dialogs/DialogFooter';
import { DialogTitleWrapper } from '@containers/dialogs/DialogTitleWrapper';
import { useSnackbar } from '@hooks/useSnackBar';
import { FormikRadioGroup } from '@shared/Formik/FormikRadioGroup';
import { FormikTextField } from '@shared/Formik/FormikTextField';
import {
PaymentVerificationStatus,
//WE DONT KNOW NOW
useUpdatePaymentVerificationReceivedAndReceivedAmountMutation,
} from '@generated/graphql';
import { PaymentVerificationStatus } from '@generated/graphql';
import { AutoSubmitFormOnEnter } from '@core/AutoSubmitFormOnEnter';

export interface Props {
Expand All @@ -32,30 +27,32 @@ export function VerifyManual({
}: Props): ReactElement {
const { t } = useTranslation();
const [verifyManualDialogOpen, setVerifyManualDialogOpen] = useState(false);
const { showMessage } = useSnackbar();
const [mutate, { error }] =
useUpdatePaymentVerificationReceivedAndReceivedAmountMutation();
// const { showMessage } = useSnackbar();
//TODO: WE DONT KNOW NOW
// const [mutate, { error }] =
// useUpdatePaymentVerificationReceivedAndReceivedAmountMutation();

const submit = async (values): Promise<void> => {
try {
await mutate({
variables: {
paymentVerificationId,
received: values.status === 'RECEIVED',
receivedAmount:
values.status === 'RECEIVED'
? parseFloat(values.receivedAmount).toFixed(2)
: 0,
},
});
} catch (e) {
e.graphQLErrors.map((x) => showMessage(x.message));
return;
}
if (!error) {
setVerifyManualDialogOpen(false);
showMessage(t('Payment has been verified.'));
}
const submit = (values): void => {
console.log(values);
// try {
// await mutate({
// variables: {
// paymentVerificationId,
// received: values.status === 'RECEIVED',
// receivedAmount:
// values.status === 'RECEIVED'
// ? parseFloat(values.receivedAmount).toFixed(2)
// : 0,
// },
// });
// } catch (e) {
// e.graphQLErrors.map((x) => showMessage(x.message));
// return;
// }
// if (!error) {
// setVerifyManualDialogOpen(false);
// showMessage(t('Payment has been verified.'));
// }
};

const initialValues = {
Expand Down
25 changes: 10 additions & 15 deletions src/frontend/src/components/targeting/ResultsForHouseholds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import { Grid, Typography } from '@mui/material';
import { Pie } from 'react-chartjs-2';
import { useTranslation } from 'react-i18next';
import styled from 'styled-components';
import {
PaymentPlanQuery,
TargetPopulationBuildStatus,
TargetPopulationQuery,
} from '@generated/graphql';
import { PaymentPlanBuildStatus, PaymentPlanQuery } from '@generated/graphql';
import { MiśTheme } from '../../theme';
import { FieldBorder } from '@core/FieldBorder';
import { LabelizedField } from '@core/LabelizedField';
Expand Down Expand Up @@ -61,9 +57,8 @@ export function ResultsForHouseholds({
const { t } = useTranslation();
const { selectedProgram } = useProgramContext();
const beneficiaryGroup = selectedProgram?.beneficiaryGroup;
//TODO CHECK MAPPING FILE FROM PAVLO

if (targetPopulation.buildStatus !== TargetPopulationBuildStatus.Ok) {
if (targetPopulation.buildStatus !== PaymentPlanBuildStatus.Ok) {
return null;
}
return (
Expand All @@ -80,31 +75,31 @@ export function ResultsForHouseholds({
<FieldBorder color={colors.femaleChildren}>
<LabelizedField
label={t('Female Children')}
value={targetPopulation.childFemaleCount}
value={targetPopulation.femaleChildrenCount}
/>
</FieldBorder>
</Grid>
<Grid item xs={6}>
<FieldBorder color={colors.femaleAdult}>
<LabelizedField
label={t('Female Adults')}
value={targetPopulation.adultFemaleCount}
value={targetPopulation.femaleAdultsCount}
/>
</FieldBorder>
</Grid>
<Grid item xs={6}>
<FieldBorder color={colors.maleChildren}>
<LabelizedField
label={t('Male Children')}
value={targetPopulation.childMaleCount}
value={targetPopulation.maleChildrenCount}
/>
</FieldBorder>
</Grid>
<Grid item xs={6}>
<FieldBorder color={colors.maleAdult}>
<LabelizedField
label={t('Male Adults')}
value={targetPopulation.adultMaleCount}
value={targetPopulation.maleAdultsCount}
/>
</FieldBorder>
</Grid>
Expand Down Expand Up @@ -139,10 +134,10 @@ export function ResultsForHouseholds({
datasets: [
{
data: [
targetPopulation.childFemaleCount,
targetPopulation.adultFemaleCount,
targetPopulation.childMaleCount,
targetPopulation.adultMaleCount,
targetPopulation.femaleChildrenCount,
targetPopulation.femaleAdultsCount,
targetPopulation.maleChildrenCount,
targetPopulation.maleAdultsCount,
],
backgroundColor: [
colors.femaleChildren,
Expand Down
23 changes: 10 additions & 13 deletions src/frontend/src/components/targeting/ResultsForPeople.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { Grid, Typography } from '@mui/material';
import { useTranslation } from 'react-i18next';
import styled from 'styled-components';
import {
TargetPopulationBuildStatus,
TargetPopulationQuery,
} from '@generated/graphql';
import { MiśTheme } from '../../theme';
import { LabelizedField } from '@core/LabelizedField';
import { PaperContainer } from './PaperContainer';
import { FieldBorder } from '@core/FieldBorder';
import { Pie } from 'react-chartjs-2';
import { ReactElement } from 'react';
import { PaymentPlanBuildStatus, PaymentPlanQuery } from '@generated/graphql';

const colors = {
femaleChildren: '#5F02CF',
Expand Down Expand Up @@ -57,7 +54,7 @@ export function ResultsForPeople({
targetPopulation,
}: ResultsProps): ReactElement {
const { t } = useTranslation();
if (targetPopulation.buildStatus !== TargetPopulationBuildStatus.Ok) {
if (targetPopulation.buildStatus !== PaymentPlanBuildStatus.Ok) {
return null;
}
return (
Expand All @@ -74,31 +71,31 @@ export function ResultsForPeople({
<FieldBorder color={colors.femaleChildren}>
<LabelizedField
label={t('Female Children')}
value={targetPopulation.childFemaleCount}
value={targetPopulation.femaleChildrenCount}
/>
</FieldBorder>
</Grid>
<Grid item xs={6}>
<FieldBorder color={colors.femaleAdult}>
<LabelizedField
label={t('Female Adults')}
value={targetPopulation.adultFemaleCount}
value={targetPopulation.femaleAdultsCount}
/>
</FieldBorder>
</Grid>
<Grid item xs={6}>
<FieldBorder color={colors.maleChildren}>
<LabelizedField
label={t('Male Children')}
value={targetPopulation.childMaleCount}
value={targetPopulation.maleChildrenCount}
/>
</FieldBorder>
</Grid>
<Grid item xs={6}>
<FieldBorder color={colors.maleAdult}>
<LabelizedField
label={t('Male Adults')}
value={targetPopulation.adultMaleCount}
value={targetPopulation.maleAdultsCount}
/>
</FieldBorder>
</Grid>
Expand Down Expand Up @@ -133,10 +130,10 @@ export function ResultsForPeople({
datasets: [
{
data: [
targetPopulation.childFemaleCount,
targetPopulation.adultFemaleCount,
targetPopulation.childMaleCount,
targetPopulation.adultMaleCount,
targetPopulation.femaleChildrenCount,
targetPopulation.femaleAdultsCount,
targetPopulation.maleChildrenCount,
targetPopulation.maleAdultsCount,
],
backgroundColor: [
colors.femaleChildren,
Expand Down
Loading

0 comments on commit 9c1dd4b

Please sign in to comment.