Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
Maciej Szewczyk committed Dec 12, 2024
1 parent f425928 commit fc2f569
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { TARGET_POPULATION_QUERY } from '../../../apollo/queries/targeting/Targe
import { useSnackbar } from '@hooks/useSnackBar';
import {
PaymentPlanQuery,
PaymentPlanStatus,
useAllSteficonRulesQuery,
useSetSteficonRuleOnTargetPopulationMutation,
useUpdateTpMutation,
Expand Down Expand Up @@ -143,16 +144,16 @@ export function VulnerabilityScoreComponent({
return null;
}
const disabled =
targetPopulation.status === TargetPopulationStatus.ReadyForCashAssist;
targetPopulation.status === PaymentPlanStatus.ReadyForCashAssist;
if (
![
TargetPopulationStatus.Locked,
TargetPopulationStatus.Processing,
TargetPopulationStatus.SteficonWait,
TargetPopulationStatus.SteficonRun,
TargetPopulationStatus.SteficonCompleted,
TargetPopulationStatus.SteficonError,
TargetPopulationStatus.ReadyForCashAssist,
PaymentPlanStatus.Locked,
PaymentPlanStatus.Processing,
PaymentPlanStatus.SteficonWait,
PaymentPlanStatus.SteficonRun,
PaymentPlanStatus.SteficonCompleted,
PaymentPlanStatus.SteficonError,
PaymentPlanStatus.ReadyForCashAssist,
].includes(targetPopulation?.status)
) {
return null;
Expand Down Expand Up @@ -230,7 +231,7 @@ export function VulnerabilityScoreComponent({
await updateTargetPopulation({
variables: {
input: {
id: targetPopulation.id,
paymentPlanId: targetPopulation.id,
vulnerabilityScoreMin: vulnerabilityScoreMinValue,
vulnerabilityScoreMax: vulnerabilityScoreMaxValue,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Button, DialogContent, DialogTitle } from '@mui/material';
import { useTranslation } from 'react-i18next';
import { LoadingButton } from '@components/core/LoadingButton';
import { useSnackbar } from '@hooks/useSnackBar';
import { Action, useFinalizeTpMutation } from '@generated/graphql';
import { Action } from '@generated/graphql';
import { Dialog } from '../Dialog';
import { DialogActions } from '../DialogActions';
import { DialogDescription } from '../DialogDescription';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function prepareVariables(
return {
input: {
households: values.households,
targetPopulation: values.targetPopulation,
paymentPlan: values.targetPopulation,
registrationDataImport: values.registrationDataImport,
samplingType:
selectedSampleSizeType === 0
Expand Down Expand Up @@ -265,7 +265,7 @@ export const CreateCommunicationPage = (): ReactElement => {
): CreateAccountabilityCommunicationMessageMutationVariables => ({
input: {
households: values.households,
targetPopulation: values.targetPopulation,
paymentPlan: values.targetPopulation,
registrationDataImport: values.registrationDataImport,
samplingType:
selectedSampleSizeType === 0
Expand Down Expand Up @@ -550,8 +550,14 @@ export const CreateCommunicationPage = (): ReactElement => {
{ value: 'FEMALE', name: t('Female') },
{ value: 'MALE', name: t('Male') },
{ value: 'OTHER', name: t('Other') },
{ value: 'NOT_COLLECTED', name: t('Not Collected') },
{ value: 'NOT_ANSWERED', name: t('Not Answered') },
{
value: 'NOT_COLLECTED',
name: t('Not Collected'),
},
{
value: 'NOT_ANSWERED',
name: t('Not Answered'),
},
]}
component={FormikSelectField}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function prepareVariables(
): AccountabilitySampleSizeQueryVariables {
return {
input: {
targetPopulation: values.targetPopulation,
paymentPlan: values.targetPopulation,
program: values.program,
samplingType: selectedSampleSizeType === 0 ? 'FULL_LIST' : 'RANDOM',
fullListArguments:
Expand Down Expand Up @@ -294,7 +294,7 @@ export const CreateSurveyPage = (): ReactElement => {
title: matchTitle(values),
body: values.body,
category: values.category,
targetPopulation: values.targetPopulation,
paymentPlan: values.targetPopulation,
program: values.program,
samplingType:
selectedSampleSizeType === 0
Expand Down Expand Up @@ -576,8 +576,14 @@ export const CreateSurveyPage = (): ReactElement => {
{ value: 'FEMALE', name: t('Female') },
{ value: 'MALE', name: t('Male') },
{ value: 'OTHER', name: t('Other') },
{ value: 'NOT_COLLECTED', name: t('Not Collected') },
{ value: 'NOT_ANSWERED', name: t('Not Answered') },
{
value: 'NOT_COLLECTED',
name: t('Not Collected'),
},
{
value: 'NOT_ANSWERED',
name: t('Not Answered'),
},
]}
component={FormikSelectField}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ReactElement, useState } from 'react';
import styled from 'styled-components';
import {
BusinessAreaDataQuery,
TargetPopulationQuery,
PaymentPlanQuery,
useCashAssistUrlPrefixQuery,
} from '@generated/graphql';
import { LoadingComponent } from '@components/core/LoadingComponent';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import { LoadingButton } from '@components/core/LoadingButton';
import { useSnackbar } from '@hooks/useSnackBar';
import {
BusinessAreaDataQuery,
PaymentPlanQuery,
ProgramStatus,
TargetPopulationQuery,
useUnlockTpMutation,
} from '@generated/graphql';
import { DuplicateTargetPopulation } from '../../dialogs/targetPopulation/DuplicateTargetPopulation';
import { FinalizeTargetPopulation } from '../../dialogs/targetPopulation/FinalizeTargetPopulation';
import { FinalizeTargetPopulationPaymentPlan } from '../../dialogs/targetPopulation/FinalizeTargetPopulationPaymentPlan';
import { useProgramContext } from '../../../programContext';

Expand Down Expand Up @@ -138,21 +136,12 @@ export function LockedTargetPopulationHeaderButtons({
setOpen={setOpenDuplicate}
targetPopulationId={targetPopulation.id}
/>
{isPaymentPlanApplicable ? (
<FinalizeTargetPopulationPaymentPlan
open={openFinalizePaymentPlan}
setOpen={setOpenFinalizePaymentPlan}
targetPopulationId={targetPopulation.id}
totalHouseholds={targetPopulation.totalHouseholdsCount}
/>
) : (
<FinalizeTargetPopulation
open={openFinalize}
setOpen={setOpenFinalize}
targetPopulationId={targetPopulation.id}
totalHouseholds={targetPopulation.totalHouseholdsCount}
/>
)}
<FinalizeTargetPopulationPaymentPlan
open={openFinalizePaymentPlan}
setOpen={setOpenFinalizePaymentPlan}
targetPopulationId={targetPopulation.id}
totalHouseholds={targetPopulation.totalHouseholdsCount}
/>
</Box>
);
}

0 comments on commit fc2f569

Please sign in to comment.