Skip to content

Commit

Permalink
fix: declaration values of zero in csp (#2271)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonat75 authored May 2, 2024
1 parent abe295a commit 07309ee
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const EditButton = ({ déclaration, year }: PropsWithChildren<Props>) =>
// Save in storage (savePageData is not used because we want to save commencer page and declaration-existante).
saveFormData(newData);

router.push(funnelConfig(newData)["declarant"].next().url);
router.push(funnelConfig(newData)["commencer"].next().url);
} catch (error: unknown) {
console.error("Unexpected API error", error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export const Indic2or3Form = ({ indicateur }: Indic2or3FormProps) => {
description={
<p>
La notion d’augmentation individuelle correspond à une augmentation individuelle du salaire de base du
salarié concerné y compris celle liée à une promotion. L’indicateur n’est pas calculable:
salarié concerné en excluant celle liée à une promotion. L’indicateur n’est pas calculable:
<br />
<ul>
<li>s’il n’a eu aucune augmentation au cours de la période de référence</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export const EffectifsForm = () => {
<FormProvider {...methods}>
<form noValidate onSubmit={handleSubmit(onSubmit)}>
<RadioButtons
legend="Tranche d'effectifs assujettis de l'entreprise ou de l'unité économique et sociale (UES)"
legend="Tranche d'effectifs assujettis de l'entreprise ou de l'unité économique et sociale (UES) *"
state={errors.workforceRange && "error"}
stateRelatedMessage={errors.workforceRange?.message}
options={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export const Indic1Form = () => {
render={({ field }) => {
return (
<RadioButtons
legend="Modalité de calcul choisie pour cet indicateur"
legend="Modalité de calcul choisie pour cet indicateur*"
options={[
...[
RemunerationsMode.Enum.CSP,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export const Indic2and3Form = () => {
) : (
<>
<RadioOuiNon
legend="Y a-t-il eu des augmentations individuelles durant la période de référence ?"
legend="Y a-t-il eu des augmentations individuelles durant la période de référence ?*"
name="calculable"
triggerValidation={true}
/>
Expand All @@ -185,7 +185,7 @@ export const Indic2and3Form = () => {
<Container className={cx(fr.cx("fr-px-md-3v", "fr-px-2v", "fr-mb-6w"), style["form-input-card"])}>
<Grid haveGutters>
<GridCol className={style["form-input-card-title"]}>
<Text text="Nombre de salariés augmentés" inline variant={["xl", "bold"]} mb="auto" />
<Text text="Nombre de salariés augmentés*" inline variant={["xl", "bold"]} mb="auto" />
<Button
title="Information indicateur écart de taux d'augmentation"
iconId="fr-icon-information-fill"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export const Indic4Form = () => {
</GridCol>
<GridCol sm={12}>
<Input
label="Total des salariées de retour de congé maternité"
label="Total des salariées de retour de congé maternité*"
hintText="Indiquez le nombre total de salariées revenues de congé maternité pendant la période de référence. Doivent être retenues les salariées qui sont revenues de congé maternité pendant la période de référence, si au moins une augmentation salariale a été faite pendant leur congé."
state={whenCalculableErrors.count?.total && "error"}
stateRelatedMessage={whenCalculableErrors.count?.total?.message}
Expand All @@ -193,7 +193,7 @@ export const Indic4Form = () => {
</GridCol>
<GridCol sm={12}>
<Input
label="Nombre de salariées augmentées à leur retour"
label="Nombre de salariées augmentées à leur retour*"
hintText={
hasTotal ? (
count.total === 0 ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ export const Indic5Form = () => {
<NumberPairInputs<Indic5FormType>
first={{
formKey: "women",
label: "Nombre de femmes parmi les 10 plus hautes rémunérations",
label: "Nombre de femmes parmi les 10 plus hautes rémunérations*",
}}
second={{
formKey: "men",
label: "Nombre d'hommes parmi les 10 plus hautes rémunérations",
label: "Nombre d'hommes parmi les 10 plus hautes rémunérations*",
}}
options={{
max: 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class PromotionsIndicator extends AbstractIndicator<PromotionsIndicatorPr
}

public fromJson(json: EntityPropsToJson<PromotionsIndicatorProps>): this {
const categories = json.categories.map(cat => (cat ? new SimpleNumber(cat) : null));
const categories = json.categories.map(cat => (typeof cat === "number" ? new SimpleNumber(cat) : null));
const props: PromotionsIndicatorProps = {
categories,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class SalaryRaisesIndicator extends AbstractIndicator<SalaryRaisesIndicat
}

public fromJson(json: EntityPropsToJson<SalaryRaisesIndicatorProps>): this {
const categories = json.categories.map(cat => (cat ? new SimpleNumber(cat) : null));
const categories = json.categories.map(cat => (typeof cat === "number" ? new SimpleNumber(cat) : null));
const props: SalaryRaisesIndicatorProps = {
categories,
};
Expand Down
32 changes: 16 additions & 16 deletions packages/app/src/common/core-domain/mappers/declarationMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,37 +393,37 @@ export const declarationMap: Required<Mapper<Declaration, DeclarationDTO, Declar
{
nom: "ouv",
tranches: {
[AgeRange.Enum.LESS_THAN_30]: remunerations.categories[0].ranges?.[":29"]?.getValue() || "",
[AgeRange.Enum.FROM_30_TO_39]: remunerations.categories[0].ranges?.["30:39"]?.getValue() || "",
[AgeRange.Enum.FROM_40_TO_49]: remunerations.categories[0].ranges?.["40:49"]?.getValue() || "",
[AgeRange.Enum.FROM_50_TO_MORE]: remunerations.categories[0].ranges?.["50:"]?.getValue() || "",
[AgeRange.Enum.LESS_THAN_30]: remunerations.categories[0].ranges?.[":29"]?.getValue() ?? "",
[AgeRange.Enum.FROM_30_TO_39]: remunerations.categories[0].ranges?.["30:39"]?.getValue() ?? "",
[AgeRange.Enum.FROM_40_TO_49]: remunerations.categories[0].ranges?.["40:49"]?.getValue() ?? "",
[AgeRange.Enum.FROM_50_TO_MORE]: remunerations.categories[0].ranges?.["50:"]?.getValue() ?? "",
},
},
{
nom: "emp",
tranches: {
[AgeRange.Enum.LESS_THAN_30]: remunerations.categories[1].ranges?.[":29"]?.getValue() || "",
[AgeRange.Enum.FROM_30_TO_39]: remunerations.categories[1].ranges?.["30:39"]?.getValue() || "",
[AgeRange.Enum.FROM_40_TO_49]: remunerations.categories[1].ranges?.["40:49"]?.getValue() || "",
[AgeRange.Enum.FROM_50_TO_MORE]: remunerations.categories[1].ranges?.["50:"]?.getValue() || "",
[AgeRange.Enum.LESS_THAN_30]: remunerations.categories[1].ranges?.[":29"]?.getValue() ?? "",
[AgeRange.Enum.FROM_30_TO_39]: remunerations.categories[1].ranges?.["30:39"]?.getValue() ?? "",
[AgeRange.Enum.FROM_40_TO_49]: remunerations.categories[1].ranges?.["40:49"]?.getValue() ?? "",
[AgeRange.Enum.FROM_50_TO_MORE]: remunerations.categories[1].ranges?.["50:"]?.getValue() ?? "",
},
},
{
nom: "tam",
tranches: {
[AgeRange.Enum.LESS_THAN_30]: remunerations.categories[2].ranges?.[":29"]?.getValue() || "",
[AgeRange.Enum.FROM_30_TO_39]: remunerations.categories[2].ranges?.["30:39"]?.getValue() || "",
[AgeRange.Enum.FROM_40_TO_49]: remunerations.categories[2].ranges?.["40:49"]?.getValue() || "",
[AgeRange.Enum.FROM_50_TO_MORE]: remunerations.categories[2].ranges?.["50:"]?.getValue() || "",
[AgeRange.Enum.LESS_THAN_30]: remunerations.categories[2].ranges?.[":29"]?.getValue() ?? "",
[AgeRange.Enum.FROM_30_TO_39]: remunerations.categories[2].ranges?.["30:39"]?.getValue() ?? "",
[AgeRange.Enum.FROM_40_TO_49]: remunerations.categories[2].ranges?.["40:49"]?.getValue() ?? "",
[AgeRange.Enum.FROM_50_TO_MORE]: remunerations.categories[2].ranges?.["50:"]?.getValue() ?? "",
},
},
{
nom: "ic",
tranches: {
[AgeRange.Enum.LESS_THAN_30]: remunerations.categories[3].ranges?.[":29"]?.getValue() || "",
[AgeRange.Enum.FROM_30_TO_39]: remunerations.categories[3].ranges?.["30:39"]?.getValue() || "",
[AgeRange.Enum.FROM_40_TO_49]: remunerations.categories[3].ranges?.["40:49"]?.getValue() || "",
[AgeRange.Enum.FROM_50_TO_MORE]: remunerations.categories[3].ranges?.["50:"]?.getValue() || "",
[AgeRange.Enum.LESS_THAN_30]: remunerations.categories[3].ranges?.[":29"]?.getValue() ?? "",
[AgeRange.Enum.FROM_30_TO_39]: remunerations.categories[3].ranges?.["30:39"]?.getValue() ?? "",
[AgeRange.Enum.FROM_40_TO_49]: remunerations.categories[3].ranges?.["40:49"]?.getValue() ?? "",
[AgeRange.Enum.FROM_50_TO_MORE]: remunerations.categories[3].ranges?.["50:"]?.getValue() ?? "",
},
},
],
Expand Down

0 comments on commit 07309ee

Please sign in to comment.