Skip to content

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Maciej Szewczyk committed Dec 13, 2024
1 parent fc2f569 commit b5afdf0
Show file tree
Hide file tree
Showing 34 changed files with 438 additions and 174 deletions.
134 changes: 117 additions & 17 deletions src/frontend/src/__generated__/graphql.tsx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { gql } from '@apollo/client';

export const COPY_TARGETING_CRITERIA_MUTATION = gql`
mutation CopyTargetingCriteriaMutation(
mutation CopyTargetingCriteria(
$name: String!
$paymentPlanId: ID!
$programCycleId: ID!
Expand Down
93 changes: 93 additions & 0 deletions src/frontend/src/apollo/queries/paymentmodule/PaymentPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ export const PAYMENT_PLAN_QUERY = gql`
version
unicefId
status
buildStatus
canCreateFollowUp
backgroundActionStatus
canCreatePaymentVerificationPlan
availablePaymentRecordsCount
bankReconciliationSuccess
bankReconciliationError
exchangeRate
programCycle {
id
title
}
excludedIds
createdBy {
id
firstName
Expand Down Expand Up @@ -264,6 +270,93 @@ export const PAYMENT_PLAN_QUERY = gql`
title
file
}
targetingCriteria {
__typename
id
flagExcludeIfActiveAdjudicationTicket
flagExcludeIfOnSanctionList
householdIds
individualIds
rules {
__typename
id
householdIds
individualIds
individualsFiltersBlocks {
__typename
individualBlockFilters {
__typename
id
fieldName
flexFieldClassification
roundNumber
arguments
comparisonMethod
fieldAttribute {
__typename
id
name
labelEn
type
choices {
value
labelEn
}
pduData {
id
subtype
numberOfRounds
roundsNames
}
}
}
}
collectorsFiltersBlocks {
__typename
id
createdAt
updatedAt
collectorBlockFilters {
__typename
id
createdAt
updatedAt
fieldName
comparisonMethod
flexFieldClassification
arguments
labelEn
}
}
householdsFiltersBlocks {
__typename
id
fieldName
flexFieldClassification
roundNumber
arguments
comparisonMethod
fieldAttribute {
__typename
id
name
labelEn
type
choices {
value
labelEn
}
pduData {
id
subtype
numberOfRounds
roundsNames
}
}
}
}
}
}
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { gql } from '@apollo/client';

export const AllActiveTargetPopulations = gql`
query AllActiveTargetPopulations(
$after: String
$before: String
$first: Int
$last: Int
$orderBy: String
$name: String
$status: String
$totalHouseholdsCountWithValidPhoneNoMin: Int
$totalHouseholdsCountWithValidPhoneNoMax: Int
$totalHouseholdsCountMin: Int
$totalHouseholdsCountMax: Int
$businessArea: String
$program: ID
$createdAtRange: String
$statusNot: String
) {
allPaymentPlans(
after: $after
before: $before
first: $first
last: $last
orderBy: $orderBy
name: $name
status: $status
totalHouseholdsCountWithValidPhoneNoMin: $totalHouseholdsCountWithValidPhoneNoMin
totalHouseholdsCountWithValidPhoneNoMax: $totalHouseholdsCountWithValidPhoneNoMax
totalHouseholdsCountMin: $totalHouseholdsCountMin
totalHouseholdsCountMax: $totalHouseholdsCountMax
businessArea: $businessArea
program: $program
createdAtRange: $createdAtRange
statusNot: $statusNot
) {
edges {
node {
id
name
status
program {
id
name
}
totalHouseholdsCount
totalHouseholdsCountWithValidPhoneNo
createdAt
updatedAt
createdBy {
id
email
firstName
lastName
}
}
cursor
}
totalCount
edgeCount
}
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export const AllTargetPopulationForChoices = gql`
$orderBy: String
$name: String
$businessArea: String!
$program: String!
$paymentPlanApplicable: Boolean
) {
allPaymentPlans(
after: $after
Expand All @@ -18,6 +20,8 @@ export const AllTargetPopulationForChoices = gql`
orderBy: $orderBy
name: $name
businessArea: $businessArea
program: $program
paymentPlanApplicable: $paymentPlanApplicable
) {
edges {
node {
Expand Down
5 changes: 2 additions & 3 deletions src/frontend/src/apollo/queries/targeting/TargetPopulation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ export const TARGET_POPULATION_QUERY = gql`
id
name
status
buildStatus
adminUrl
buildStatus
totalHouseholdsCount
totalIndividualsCount
finalizedBy
changeDate
finalizedAt
statusDate
excludedIds
exclusionReason
vulnerabilityScoreMin
Expand Down
13 changes: 11 additions & 2 deletions src/frontend/src/components/payments/VerifyManual.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { FormikRadioGroup } from '@shared/Formik/FormikRadioGroup';
import { FormikTextField } from '@shared/Formik/FormikTextField';
import {
PaymentVerificationStatus,
//WE DONT KNOW NOW
useUpdatePaymentVerificationReceivedAndReceivedAmountMutation,
} from '@generated/graphql';
import { AutoSubmitFormOnEnter } from '@core/AutoSubmitFormOnEnter';
Expand Down Expand Up @@ -100,8 +101,16 @@ export function VerifyManual({
label="Status"
style={{ flexDirection: 'row' }}
choices={[
{ value: 'RECEIVED', name: t('Received'), dataCy: 'choice-received' },
{ value: 'NOT_RECEIVED', name: t('Not Received'), dataCy: 'choice-not-received' },
{
value: 'RECEIVED',
name: t('Received'),
dataCy: 'choice-received',
},
{
value: 'NOT_RECEIVED',
name: t('Not Received'),
dataCy: 'choice-not-received',
},
]}
component={FormikRadioGroup}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { AutoSubmitFormOnEnter } from '@core/AutoSubmitFormOnEnter';
import { PaymentPlanQuery, useUpdateTpMutation } from '@generated/graphql';
import {
PaymentPlanQuery,
PaymentPlanStatus,
useUpdatePpMutation,
} from '@generated/graphql';
import { useBaseUrl } from '@hooks/useBaseUrl';
import { useSnackbar } from '@hooks/useSnackBar';
import { Box, Divider, Grid, Typography } from '@mui/material';
Expand Down Expand Up @@ -33,6 +37,7 @@ export const EditTargetPopulation = ({
}: EditTargetPopulationProps): ReactElement => {
const navigate = useNavigate();
const { t } = useTranslation();
//UPDATE PP MUTATION
const initialValues = {
id: paymentPlan.id,
name: paymentPlan.name || '',
Expand All @@ -50,7 +55,8 @@ export const EditTargetPopulation = ({
name: paymentPlan.programCycle.title,
},
};
const [mutate, { loading }] = useUpdateTpMutation();

const [mutate, { loading }] = useUpdatePpMutation();
const { showMessage } = useSnackbar();
const { baseUrl } = useBaseUrl();
const { selectedProgram, isSocialDctType, isStandardDctType } =
Expand Down Expand Up @@ -86,11 +92,11 @@ export const EditTargetPopulation = ({
await mutate({
variables: {
input: {
id: values.id,
paymentPlanId: values.id,
excludedIds: values.excludedIds,
exclusionReason: values.exclusionReason,
programCycleId: values.programCycleId.value,
...(paymentPlan.status === TargetPopulationStatus.Open && {
...(paymentPlan.status === PaymentPlanStatus.Open && {
name: values.name,
}),
...getTargetingCriteriaVariables({
Expand Down Expand Up @@ -124,7 +130,7 @@ export const EditTargetPopulation = ({
values={values}
loading={loading}
baseUrl={baseUrl}
targetPopulation={targetPopulation}
targetPopulation={paymentPlan}
data-cy="edit-target-population-header"
/>
<PaperContainer data-cy="paper-container">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Pie } from 'react-chartjs-2';
import { useTranslation } from 'react-i18next';
import styled from 'styled-components';
import {
PaymentPlanQuery,
TargetPopulationBuildStatus,
TargetPopulationQuery,

Check failure on line 8 in src/frontend/src/components/targeting/ResultsForHouseholds.tsx

View workflow job for this annotation

GitHub Actions / frontend_tests

'TargetPopulationQuery' is defined but never used

Check failure on line 8 in src/frontend/src/components/targeting/ResultsForHouseholds.tsx

View workflow job for this annotation

GitHub Actions / frontend_tests

'TargetPopulationQuery' is defined but never used
} from '@generated/graphql';
Expand Down Expand Up @@ -60,6 +61,7 @@ export function ResultsForHouseholds({
const { t } = useTranslation();
const { selectedProgram } = useProgramContext();
const beneficiaryGroup = selectedProgram?.beneficiaryGroup;
//TODO CHECK MAPPING FILE FROM PAVLO

if (targetPopulation.buildStatus !== TargetPopulationBuildStatus.Ok) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { hasPermissions, PERMISSIONS } from '../../config/permissions';
import { UniversalActivityLogTable } from '@containers/tables/UniversalActivityLogTable';
import {
PaymentPlanQuery,
TargetPopulationBuildStatus,
PaymentPlanBuildStatus,
useTargetPopulationHouseholdsQuery,
} from '@generated/graphql';
import { PaperContainer } from './PaperContainer';
Expand Down Expand Up @@ -71,7 +71,7 @@ export const TargetPopulationCore = ({
);

const recordInfo =
targetPopulation.buildStatus === TargetPopulationBuildStatus.Ok ? (
targetPopulation.buildStatus === PaymentPlanBuildStatus.Ok ? (
recordsTable
) : (
<PaperContainer>
Expand Down
7 changes: 4 additions & 3 deletions src/frontend/src/components/targeting/TargetingHouseholds.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { TargetPopulationHouseholdTable } from '@containers/tables/targeting/TargetPopulationHouseholdTable';
import { useTargetPopulationHouseholdsQuery } from '@generated/graphql';
import { useAllPaymentsForTableQuery } from '@generated/graphql';
import { useBaseUrl } from '@hooks/useBaseUrl';
import { ReactElement } from 'react';

export function TargetingHouseholds({ id, canViewDetails }): ReactElement {
const { businessArea } = useBaseUrl();

//TODO: PP - list of payments - take hh info from there
return (
<TargetPopulationHouseholdTable
id={id}
query={useTargetPopulationHouseholdsQuery}
queryObjectName="targetPopulationHouseholds"
query={useAllPaymentsForTableQuery}
queryObjectName="allPayments"
canViewDetails={canViewDetails}
variables={{ businessArea }}
/>
Expand Down
Loading

0 comments on commit b5afdf0

Please sign in to comment.