Skip to content

Commit

Permalink
chore(admin-react+website): updated mandatory field error message fro…
Browse files Browse the repository at this point in the history
…m "Ce champe est obligatoire" to "Merci de remplir ce champ"
  • Loading branch information
agarbe committed Jul 2, 2024
1 parent ff7277f commit 821505f
Show file tree
Hide file tree
Showing 25 changed files with 52 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as z from "zod";
import { useCommercialInformationPage } from "./commercialInformationPage.hook";

const schema = z.object({
nom: z.string().min(1, "Ce champ est obligatoire"),
nom: z.string().min(1, "Merci de remplir ce champ"),
telephone: z.string().optional().default(""),
siteInternet: z.string().optional().default(""),
emailContact: z
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { z } from "zod";

export const modalitesAccompagnementFormSchema = z
.object({
nom: z.string().min(1, "Ce champ est obligatoire"),
nom: z.string().min(1, "Merci de remplir ce champ"),
telephone: z.string().optional().default(""),
siteInternet: z.string().optional().default(""),
emailContact: z
Expand Down Expand Up @@ -69,7 +69,7 @@ export const modalitesAccompagnementFormSchema = z
if (!fieldValue) {
addIssue({
path: [fieldName],
message: "Ce champ est obligatoire",
message: "Merci de remplir ce champ",
code: z.ZodIssueCode.custom,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import { z } from "zod";

const schema = z
.object({
managerFirstname: z.string().min(1, "Ce champ est obligatoire."),
managerLastname: z.string().min(1, "Ce champ est obligatoire."),
managerFirstname: z.string().min(1, "Merci de remplir ce champ."),
managerLastname: z.string().min(1, "Merci de remplir ce champ."),
attestationURSSAF: z.object({
0: z.instanceof(File, { message: "Ce champ est obligatoire" }),
0: z.instanceof(File, { message: "Merci de remplir ce champ" }),
}),
justificatifIdentiteDirigeant: z.object({
0: z.instanceof(File, { message: "Ce champ est obligatoire" }),
0: z.instanceof(File, { message: "Merci de remplir ce champ" }),
}),

delegataire: z.boolean(),
Expand All @@ -42,14 +42,14 @@ const schema = z
if (!lettreDeDelegation?.[0]) {
addIssue({
path: ["lettreDeDelegation[0]"],
message: "Ce champ est obligatoire",
message: "Merci de remplir ce champ",
code: z.ZodIssueCode.custom,
});
}
if (!justificatifIdentiteDelegataire?.[0]) {
addIssue({
path: ["justificatifIdentiteDelegataire[0]"],
message: "Ce champ est obligatoire",
message: "Merci de remplir ce champ",
code: z.ZodIssueCode.custom,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import { ActiveDropoutReasons, useDropout } from "./useDropout";

const schema = z.object({
otherReasonContent: z.string().optional(),
dropOutReasonId: z.string().min(1, "Ce champ est obligatoire"),
dropOutReasonId: z.string().min(1, "Merci de remplir ce champ"),
hasConfirmedWrittenConsent: z
.boolean()
.refine((val) => val, "Ce champ est obligatoire"),
.refine((val) => val, "Merci de remplir ce champ"),
});

export const DropoutForm = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const schema = z
["unknownAdmissibility", "alreadyAdmissible", "notAlreadyAdmissible"],
{
errorMap: (issue, ctx) => {
return { message: "Ce champ est obligatoire" };
return { message: "Merci de remplir ce champ" };
},
},
),
Expand All @@ -31,7 +31,7 @@ const schema = z
data.admissibilityStatus === "notAlreadyAdmissible" ||
data.expiresAt !== "",
{
message: "Ce champ est obligatoire",
message: "Merci de remplir ce champ",
path: ["expiresAt"],
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const dossierDeValidationSchema = z.object({
}),
}),
dossierDeValidationFile: z.object({
0: z.instanceof(File, { message: "Ce champ est obligatoire" }),
0: z.instanceof(File, { message: "Merci de remplir ce champ" }),
}),

dossierDeValidationOtherFiles: z
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
const schema = z
.object({
idCard: z.object({
0: z.instanceof(File, { message: "Ce champ est obligatoire" }),
0: z.instanceof(File, { message: "Merci de remplir ce champ" }),
}),
equivalenceOrExemptionProof: z
.object({
Expand All @@ -40,7 +40,7 @@ const schema = z
if (!idCard?.[0]) {
addIssue({
path: ["idCard"],
message: "Ce champ est obligatoire",
message: "Merci de remplir ce champ",
code: z.ZodIssueCode.custom,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const schema = z.object({
firstForeignLanguage: z.string(),
secondForeignlanguage: z.string(),
completion: z.enum(["PARTIAL", "COMPLETE"], {
invalid_type_error: "Ce champ est obligatoire",
invalid_type_error: "Merci de remplir ce champ",
}),
competenceBlocs: z.any().array(),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const schema = z.object({
.object({
competenceId: z.string(),
label: z.string(),
text: z.string().min(1, "Ce champ est obligatoire"),
text: z.string().min(1, "Merci de remplir ce champ"),
})
.array(),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const schema = z.object({
prerequisites: z.array(
z.object({
id: z.string().optional(),
label: z.string().min(1, "Ce champ est obligatoire"),
label: z.string().min(1, "Merci de remplir ce champ"),
state: z.enum(["ACQUIRED", "IN_PROGRESS", "RECOMMENDED"]).optional(),
}),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ import {
const schema = z
.object({
swornStatement: z.object({
0: z.instanceof(File, { message: "Ce champ est obligatoire" }),
0: z.instanceof(File, { message: "Merci de remplir ce champ" }),
}),
})
.superRefine(({ swornStatement }, { addIssue }) => {
if (!swornStatement?.[0]) {
addIssue({
path: ["idCard"],
message: "Ce champ est obligatoire",
message: "Merci de remplir ce champ",
code: z.ZodIssueCode.custom,
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { z } from "zod";

export const paymentRequestUniFvaeInvoiceSchema = z.object({
invoiceNumber: z.string().min(1, "Ce champ est obligatoire"),
invoiceNumber: z.string().min(1, "Merci de remplir ce champ"),
individualEffectiveHourCount: z.number().default(0),
individualEffectiveCost: z.number().default(0),
collectiveEffectiveHourCount: z.number().default(0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import { useQueryClient } from "@tanstack/react-query";

const paymentRequestUniFvaeUploadSchema = z.object({
invoiceFile: z.object({
0: z.instanceof(File, { message: "Ce champ est obligatoire" }),
0: z.instanceof(File, { message: "Merci de remplir ce champ" }),
}),

certificateOfAttendanceFile: z.object({
0: z.instanceof(File, { message: "Ce champ est obligatoire" }),
0: z.instanceof(File, { message: "Merci de remplir ce champ" }),
}),
contractorInvoiceFiles: z
.object({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { z } from "zod";

export const paymentRequestUniRevaInvoiceSchema = z.object({
invoiceNumber: z.string().min(1, "Ce champ est obligatoire"),
invoiceNumber: z.string().min(1, "Merci de remplir ce champ"),
individualEffectiveHourCount: z.number().default(0),
individualEffectiveCost: z.number().default(0),
collectiveEffectiveHourCount: z.number().default(0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import { useKeycloakContext } from "@/components/auth/keycloakContext";

const paymentRequestUniRevaUploadSchema = z.object({
invoiceFile: z.object({
0: z.instanceof(File, { message: "Ce champ est obligatoire" }),
0: z.instanceof(File, { message: "Merci de remplir ce champ" }),
}),

appointmentFile: z.object({
0: z.instanceof(File, { message: "Ce champ est obligatoire" }),
0: z.instanceof(File, { message: "Merci de remplir ce champ" }),
}),
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ const durationToString: {
};

export const schema = z.object({
title: z.string().min(1, "Ce champ est obligatoire"),
title: z.string().min(1, "Merci de remplir ce champ"),
description: z.string(),
startedAt: z.string().min(1, "Ce champ est obligatoire"),
startedAt: z.string().min(1, "Merci de remplir ce champ"),
duration: z.enum(durationValues),
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { deserializeStringToPhoneNumberStructure } from "@/utils";
import { isBefore, sub } from "date-fns";
import { z } from "zod";

const defaultErrorMessage = "Ce champ est obligatoire";
const defaultErrorMessage = "Merci de remplir ce champ";

export const candidateInformationSchema = z
.object({
Expand Down Expand Up @@ -79,7 +79,7 @@ export const candidateInformationSchema = z
if (data.countryIsFrance && !data.birthDepartment?.length) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "Ce champ est obligatoire",
message: "Merci de remplir ce champ",
path: ["birthDepartment"],
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { useForm } from "react-hook-form";
import { z } from "zod";

export const schema = z.object({
highestDegreeId: z.string().min(1, "Ce champ est obligatoire"),
highestDegreeId: z.string().min(1, "Merci de remplir ce champ"),
highestDegreeLabel: z.string(),
niveauDeFormationLePlusEleveDegreeId: z
.string()
.min(1, "Ce champ est obligatoire"),
.min(1, "Merci de remplir ce champ"),
});

type FormData = z.infer<typeof schema>;
Expand Down Expand Up @@ -134,7 +134,9 @@ export const useCandidateProfilePageLogic = () => {
!highestDegreeLevel ||
(highestDegreeLevel > 1 && !highestDegreeLabel)
) {
setError("highestDegreeLabel", { message: "Ce champ est obligatoire" });
setError("highestDegreeLabel", {
message: "Merci de remplir ce champ",
});
} else {
await updateCandidateProfile.mutateAsync({
candidateId: candidate?.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const trainingFormSchema = z.object({
otherTraining: z.string(),
certificationScope: z.enum(["PARTIAL", "COMPLETE"], {
errorMap: () => ({
message: "Ce champ est obligatoire",
message: "Merci de remplir ce champ",
}),
}),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { useForm } from "react-hook-form";
import { z } from "zod";

const schema = z.object({
codeRncp: z.string().min(1, "Ce champ est obligatoire"),
label: z.string().min(1, "Ce champ est obligatoire"),
codeRncp: z.string().min(1, "Merci de remplir ce champ"),
label: z.string().min(1, "Merci de remplir ce champ"),
expiresAt: z.string(),
availableAt: z.string(),
typeDiplomeId: z.string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useForm } from "react-hook-form";
import { z } from "zod";

const schema = z.object({
decisionComment: z.string().min(1, "Ce champ est obligatoire"),
decisionComment: z.string().min(1, "Merci de remplir ce champ"),
});

export type DossierDeValidationProblemFormData = z.infer<typeof schema>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const schema = z
.object({
decision: z.enum(["Admissible", "Rejected", "Incomplete"], {
errorMap: () => {
return { message: "Ce champ est obligatoire" };
return { message: "Merci de remplir ce champ" };
},
}),
comment: z.string(),
Expand All @@ -26,7 +26,7 @@ const schema = z
minimum: 1,
type: "string",
inclusive: true,
message: "Ce champ est obligatoire",
message: "Merci de remplir ce champ",
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ interface DepartmentOption {
}

const zodSchema = z.object({
firstname: z.string().min(1, "Ce champ est obligatoire"),
lastname: z.string().min(1, "Ce champ est obligatoire"),
firstname: z.string().min(1, "Merci de remplir ce champ"),
lastname: z.string().min(1, "Merci de remplir ce champ"),
phone: z.string().min(10, "Veuillez entrer un numéro de téléphone valide"),
email: z.string().email("Format attendu : [email protected]"),
departmentId: z.string().min(1, "Ce champ est obligatoire"),
departmentId: z.string().min(1, "Merci de remplir ce champ"),
});

export type CandidateRegistrationFormSchema = z.infer<typeof zodSchema>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ export const AccountInfoStepForm = () => {
} = useProfessionalSpaceSubscriptionContext();

const zodSchema = z.object({
accountFirstname: z.string().min(1, "Ce champ est obligatoire"),
accountLastname: z.string().min(1, "Ce champ est obligatoire"),
accountFirstname: z.string().min(1, "Merci de remplir ce champ"),
accountLastname: z.string().min(1, "Merci de remplir ce champ"),
accountEmail: z.string().email("L'adresse email est incomplète"),
accountPhoneNumber: z.string().min(1, "Ce champ est obligatoire"),
accountPhoneNumber: z.string().min(1, "Merci de remplir ce champ"),
delegataire: z.boolean(),
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,26 @@ export const CompanyDocumentsStepForm = () => {
}) => {
let formValid = true;
if (!attestationURSSAF?.[0]) {
setError("attestationURSSAF", { message: "Ce champ est obligatoire" });
setError("attestationURSSAF", { message: "Merci de remplir ce champ" });
formValid = false;
}
if (!justificatifIdentiteDirigeant?.[0]) {
setError("justificatifIdentiteDirigeant", {
message: "Ce champ est obligatoire",
message: "Merci de remplir ce champ",
});
formValid = false;
}

if (delegataire) {
if (!lettreDeDelegation?.[0]) {
setError("lettreDeDelegation", {
message: "Ce champ est obligatoire",
message: "Merci de remplir ce champ",
});
formValid = false;
}
if (!justificatifIdentiteDelegataire?.[0]) {
setError("justificatifIdentiteDelegataire", {
message: "Ce champ est obligatoire",
message: "Merci de remplir ce champ",
});
formValid = false;
}
Expand Down

0 comments on commit 821505f

Please sign in to comment.