From 8bd863b0c39f8b9bb542145170447397b409da55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Rialland?= Date: Thu, 24 Mar 2022 17:12:20 +0100 Subject: [PATCH] Cache certains choix dans le form S1 --- .../Simulateurs/ExonerationCovid/Table.tsx | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/site/source/pages/Simulateurs/ExonerationCovid/Table.tsx b/site/source/pages/Simulateurs/ExonerationCovid/Table.tsx index c9f72df7a..7b0fcadfa 100644 --- a/site/source/pages/Simulateurs/ExonerationCovid/Table.tsx +++ b/site/source/pages/Simulateurs/ExonerationCovid/Table.tsx @@ -154,10 +154,29 @@ export const Row = ({ const choice = (node.dottedName + (percent ? ' ' + percent : '')) as keyof typeof choices - return choices[choice].map((text, i) => ({ - key: (node.dottedName as string) + `.${i}`, - text, - })) + const lieu = engine.evaluate("lieu d'exercice").nodeValue + + return choices[choice] + .filter((_, i) => { + const hideChoice1 = !( + i === 1 && + choice.startsWith('LFSS 600') && + ((lieu === 'métropole' && + ['mois . juin 2021', 'mois . juillet 2021'].includes( + actualMonth + )) || + (lieu === 'outre-mer' && + ['mois . octobre 2021', 'mois . novembre 2021'].includes( + actualMonth + ))) + ) + + return hideChoice1 + }) + .map((text, i) => ({ + key: (node.dottedName as string) + `.${i}`, + text, + })) }) .filter((x: T | null): x is T => Boolean(x))