From 99d76381b9e9ede7a2a11c949ab60b4d0fbef744 Mon Sep 17 00:00:00 2001 From: Lea Renaux Date: Tue, 12 Mar 2024 13:06:42 +0100 Subject: [PATCH] add style and rightsManagement fields --- src/pages/CreateContactPage.tsx | 43 ++++++---- src/ui/Contact/ContactFormDialog.tsx | 78 ++++++++++++++++++- .../CreateContact/InformationsForm.tsx | 34 ++------ .../CreateContact/RightsManagementForm.tsx | 68 +++++++++++++++- 4 files changed, 178 insertions(+), 45 deletions(-) diff --git a/src/pages/CreateContactPage.tsx b/src/pages/CreateContactPage.tsx index b7d6cfb..980d647 100644 --- a/src/pages/CreateContactPage.tsx +++ b/src/pages/CreateContactPage.tsx @@ -6,12 +6,14 @@ import { Row } from "../ui/Row"; import Button from "@mui/material/Button"; import PersonAddAltOutlinedIcon from "@mui/icons-material/PersonAddAltOutlined"; import Typography from "@mui/material/Typography"; -import { Step, StepLabel, Stepper, Divider } from "@mui/material"; +import { Step, StepLabel, Stepper, Divider, Card } from "@mui/material"; import { InformationsForm } from "../ui/Contact/CreateContact/InformationsForm"; -import { AddressForm } from "../ui/Contact/CreateContact/AddressForm"; import { RightsManagementForm } from "../ui/Contact/CreateContact/RightsManagementForm"; +import { Breadcrumbs } from "../ui/Breadcrumbs"; -const steps = ["Informations du contact", "Adresse du contact", "Gestion des droits"]; +// const steps = ["Informations du contact", "Adresse du contact", "Gestion des droits"]; + +const steps = ["Informations du contact", "Gestion des droits"]; export const CreateContactPage = () => { const { register, control, errors } = useForm(schema); @@ -41,44 +43,57 @@ export const CreateContactPage = () => { handleNext(); }; + const breadcrumbs = [ + { href: "/", title: "Accueil" }, + { href: "/search", title: "Recherche" }, + "Nouveau contact", + ]; + return ( - + Nouveau contact - + {steps.map(label => { return ( - + {label} ); })} - - + +
{activeStep === 0 && ( )} - {activeStep === 1 && } - {activeStep === 2 && } - - - + -
+
); diff --git a/src/ui/Contact/ContactFormDialog.tsx b/src/ui/Contact/ContactFormDialog.tsx index 3cd453e..0c0412e 100644 --- a/src/ui/Contact/ContactFormDialog.tsx +++ b/src/ui/Contact/ContactFormDialog.tsx @@ -1,5 +1,15 @@ -import { Box, Button, Dialog, DialogActions, DialogContent, DialogTitle, Divider } from "@mui/material"; -import { z } from "zod"; +import { + Box, + Button, + Checkbox, + Dialog, + DialogActions, + DialogContent, + DialogTitle, + Divider, + FormControlLabel, +} from "@mui/material"; +import { Schema, z } from "zod"; import { useForm } from "../../hooks/useForm.ts"; import { APISchemas } from "../../types/api.ts"; import { Field } from "../Form/Field.tsx"; @@ -8,6 +18,7 @@ import { Row } from "../Row.tsx"; import StarIcon from "@mui/icons-material/Star"; import { useFetchMutation } from "../../hooks/useFetchQuery.ts"; import { AddressFormFields } from "../Form/AddressFormFields.tsx"; +import { UseFormRegister, UseFormReturn } from "react-hook-form"; type Props = { open: boolean; @@ -234,3 +245,66 @@ export const ContactFormDialog = ({ open, onClose, contact, onSave }: Props) => ); }; + +type FormContentProps = { + errors: any; + register: UseFormRegister>; + control?: UseFormReturn["control"]; + contact?: APISchemas["ContactFirstLoginDto"]; +}; + +export const FormContent = ({ errors, register, control, contact }: FormContentProps) => { + return ( + + + + + + + + + + + + + + + + + + + {contact === undefined && ( + } + label="L’adresse du contact est identique à l’adresse de l’unité enquêtée" + /> + )} + + + + ); +}; diff --git a/src/ui/Contact/CreateContact/InformationsForm.tsx b/src/ui/Contact/CreateContact/InformationsForm.tsx index 31da6e0..77e5c14 100644 --- a/src/ui/Contact/CreateContact/InformationsForm.tsx +++ b/src/ui/Contact/CreateContact/InformationsForm.tsx @@ -1,8 +1,8 @@ -import { FormGroup, Stack } from "@mui/material"; +import { Stack } from "@mui/material"; import Typography from "@mui/material/Typography"; -import { Field } from "../../Form/Field"; import { UseFormRegister, UseFormReturn } from "react-hook-form"; import { Schema, z } from "zod"; +import { FormContent } from "../ContactFormDialog"; type Props = { errors: any; @@ -10,35 +10,13 @@ type Props = { control?: UseFormReturn["control"]; }; -const civilities = [ - { label: "Madame", value: "Female" }, - { label: "Monsieur", value: "Male" }, -]; - export const InformationsForm = ({ errors, register, control }: Props) => { return ( - Informations du contact - - - - - - - - + + Informations du contact + + ); }; diff --git a/src/ui/Contact/CreateContact/RightsManagementForm.tsx b/src/ui/Contact/CreateContact/RightsManagementForm.tsx index aab8e82..610548b 100644 --- a/src/ui/Contact/CreateContact/RightsManagementForm.tsx +++ b/src/ui/Contact/CreateContact/RightsManagementForm.tsx @@ -1,5 +1,71 @@ +import Stack from "@mui/material/Stack"; import Typography from "@mui/material/Typography"; +import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined"; +import { Row } from "../../Row"; +import { InputLabel, TextField } from "@mui/material"; export const RightsManagementForm = () => { - return Ajouter des droits; + return ( + + + Ajouter des droits + + + + + La sélection de l’identifiant de l’unité enquêtée, d’une source, d’un millésime
et d’une + période est nécessaire pour l’ajout de droits +
+
+
+ + + + Identifiant du compte + + + + + + Identifiant de l’unité enquêtée + + + + + + Source + + + + + + Millésime + + + + + + Période + + + + +
+
+ ); };