Skip to content

Commit 836fcf1

Browse files
committed
feat(admin):don't show post-jury flat fee in funding request in feasibility is rejected
1 parent bb18430 commit 836fcf1

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

packages/reva-admin-react/src/app/(aap)/candidacies/[candidacyId]/funding/_components/ParcoursPersonnaliseBlock.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Candidacy } from "@/graphql/generated/graphql";
22
import Input from "@codegouvfr/react-dsfr/Input";
3+
import { useMemo } from "react";
34
import { useFormContext } from "react-hook-form";
45

56
export const ParcoursPersonnaliseBlock = ({
@@ -17,7 +18,9 @@ export const ParcoursPersonnaliseBlock = ({
1718
formState: { errors },
1819
} = useFormContext();
1920

20-
const forfaitCost = 300;
21+
const forfaitCost = useMemo(() => {
22+
return candidacy?.feasibility?.decision === "REJECTED" ? 200 : 300;
23+
}, [candidacy]);
2124
const individualHourCount = watch("individualHourCount") || 0;
2225
const individualCost = watch("individualCost") || 0;
2326
const collectiveHourCount = watch("collectiveHourCount") || 0;
@@ -59,8 +62,12 @@ export const ParcoursPersonnaliseBlock = ({
5962
<span>Forfait</span>
6063
<span className="font-medium">Forfait d’étude de faisabilité</span>
6164
<span className="font-medium">200€ net</span>
62-
<span className="font-medium">Forfait entretien post-jury</span>
63-
<span className="font-medium">100€ net</span>
65+
{candidacy.feasibility?.decision !== "REJECTED" && (
66+
<>
67+
<span className="font-medium">Forfait entretien post-jury</span>
68+
<span className="font-medium">100€ net</span>
69+
</>
70+
)}
6471
<p className="flex text-dsfr-orange-500 mt-4 col-span-2 text-sm">
6572
<span className="fr-icon-warning-fill fr-icon--sm mr-1" aria-hidden />
6673
Le forfait de faisabilité ne pourra être demandé que si l’étude a été

packages/reva-admin-react/src/app/(aap)/candidacies/[candidacyId]/funding/_components/useCandidacyFunding.hook.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ const getCandidacyByIdFunding = graphql(`
4949
status
5050
isActive
5151
}
52+
feasibility {
53+
decision
54+
}
5255
candidacyDropOut {
5356
createdAt
5457
}

packages/reva-admin-react/src/app/(aap)/candidacies/[candidacyId]/payment/unifvae/invoice/page.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ const PaymentRequestUniFvaeInvoicePage = () => {
110110
otherTrainingEffectiveCost,
111111
} = useWatch({ control });
112112

113-
const feasibilityPackageCostTotal = 300;
113+
const feasibilityPackageCostTotal = useMemo(() => {
114+
return candidacy?.feasibility?.decision === "REJECTED" ? 200 : 300;
115+
}, [candidacy]);
114116

115117
const supportHourCountTotal =
116118
(individualEffectiveHourCount || 0) + (collectiveEffectiveHourCount || 0);
@@ -272,8 +274,14 @@ const PaymentRequestUniFvaeInvoicePage = () => {
272274
Forfait d’étude de faisabilité
273275
</span>
274276
<span className="font-medium">200€ net</span>
275-
<span className="font-medium">Forfait entretien post-jury</span>
276-
<span className="font-medium">100€ net</span>
277+
{candidacy.feasibility?.decision !== "REJECTED" && (
278+
<>
279+
<span className="font-medium">
280+
Forfait entretien post-jury
281+
</span>
282+
<span className="font-medium">100€ net</span>
283+
</>
284+
)}
277285
<p className="flex text-dsfr-orange-500 mt-4 col-span-2 text-sm">
278286
<span
279287
className="fr-icon-warning-fill fr-icon--sm mr-1"

packages/reva-admin-react/src/app/(aap)/candidacies/[candidacyId]/payment/unifvae/invoice/paymentRequestUniFvaeInvoice.hook.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ const getCandidacyQuery = graphql(`
1212
lastname
1313
gender
1414
}
15+
feasibility {
16+
decision
17+
}
1518
certification {
1619
label
1720
}

0 commit comments

Comments
 (0)