From 7753b84dd9f211b849c9fa2a786b08c41449246f Mon Sep 17 00:00:00 2001 From: Hugo Lextrait Date: Fri, 14 Apr 2023 16:53:39 +0200 Subject: [PATCH] :sparkles: page existing client and new client --- .../DesignSystem/CheckBox/classes.module.scss | 4 +- .../DesignSystem/RadioBox/classes.module.scss | 4 +- .../DesignSystem/RadioBox/index.tsx | 4 +- .../AddClientToFolder/classes.module.scss | 22 ++++ .../Layouts/AddClientToFolder/index.tsx | 102 ++++++++++++++++++ src/pages/dossier/ajouter-client.tsx | 5 + src/pages/{dossier.tsx => dossier/index.tsx} | 0 7 files changed, 136 insertions(+), 5 deletions(-) create mode 100644 src/front/Components/Layouts/AddClientToFolder/classes.module.scss create mode 100644 src/front/Components/Layouts/AddClientToFolder/index.tsx create mode 100644 src/pages/dossier/ajouter-client.tsx rename src/pages/{dossier.tsx => dossier/index.tsx} (100%) diff --git a/src/front/Components/DesignSystem/CheckBox/classes.module.scss b/src/front/Components/DesignSystem/CheckBox/classes.module.scss index ed6985ed..a5e980a7 100644 --- a/src/front/Components/DesignSystem/CheckBox/classes.module.scss +++ b/src/front/Components/DesignSystem/CheckBox/classes.module.scss @@ -10,7 +10,7 @@ background-color: transparent; width: 16px; height: 16px; - border: 1px solid var(green-flash); + border: 1px solid $green-flash; border-radius: 2px; margin-right: 16px; display: grid; @@ -23,7 +23,7 @@ display: grid; width: 16px; height: 16px; - background-color: var(green-flash); + background-color: $green-flash; border-radius: 2px; transform: scale(0); } diff --git a/src/front/Components/DesignSystem/RadioBox/classes.module.scss b/src/front/Components/DesignSystem/RadioBox/classes.module.scss index f6fecf6c..2790b0ab 100644 --- a/src/front/Components/DesignSystem/RadioBox/classes.module.scss +++ b/src/front/Components/DesignSystem/RadioBox/classes.module.scss @@ -11,7 +11,7 @@ background-color: transparent; width: 16px; height: 16px; - border: 1px solid var(green-flash); + border: 1px solid $green-flash; border-radius: 100px; margin-right: 16px; display: grid; @@ -24,7 +24,7 @@ content: ""; width: 10px; height: 10px; - background-color: var(green-flash); + background-color: $green-flash; border-radius: 100px; transform: scale(0); } diff --git a/src/front/Components/DesignSystem/RadioBox/index.tsx b/src/front/Components/DesignSystem/RadioBox/index.tsx index 96cff62b..8119888b 100644 --- a/src/front/Components/DesignSystem/RadioBox/index.tsx +++ b/src/front/Components/DesignSystem/RadioBox/index.tsx @@ -7,6 +7,8 @@ type IProps = { children: React.ReactNode; name: string; toolTip?: string; + defaultChecked?: boolean; + onChange?: (event: React.ChangeEvent) => void; }; export default class RadioBox extends React.Component { @@ -14,7 +16,7 @@ export default class RadioBox extends React.Component { return ( diff --git a/src/front/Components/Layouts/AddClientToFolder/classes.module.scss b/src/front/Components/Layouts/AddClientToFolder/classes.module.scss new file mode 100644 index 00000000..cfe30f82 --- /dev/null +++ b/src/front/Components/Layouts/AddClientToFolder/classes.module.scss @@ -0,0 +1,22 @@ +@import "@Themes/constants.scss"; + +.root { + display: flex; + flex-direction: column; + min-height: 100%; + + .radiobox-container{ + margin: 32px 0; + } + .button-container{ + margin-top: 24px; + :first-child{ + margin-right: 32px; + } + } + .new-client{ + >:not(:last-child){ + margin-bottom: 24px; + } + } +} \ No newline at end of file diff --git a/src/front/Components/Layouts/AddClientToFolder/index.tsx b/src/front/Components/Layouts/AddClientToFolder/index.tsx new file mode 100644 index 00000000..54435a55 --- /dev/null +++ b/src/front/Components/Layouts/AddClientToFolder/index.tsx @@ -0,0 +1,102 @@ +import DefaultNotaryDashboard, { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard"; +import BasePage from "../Base"; +import classes from "./classes.module.scss"; +import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography"; +import RadioBox from "@Front/Components/DesignSystem/RadioBox"; +import MultiSelect from "@Front/Components/DesignSystem/MultiSelect"; +import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button"; +import { ActionMeta, MultiValue } from "react-select"; +import { IOption } from "@Front/Components/DesignSystem/Select"; +import InputField from "@Front/Components/DesignSystem/Form/Elements/InputField"; +import Form from "@Front/Components/DesignSystem/Form"; + +type IProps = {}; +type IState = { + selectedFolder: IDashBoardFolder | null; + isExistingClientSelected: boolean; + isNewClientSelected: boolean; + hasNewClientSelected: boolean; +}; +export default class AddClientToFolder extends BasePage{ + constructor(props: IProps) { + super(props); + this.state = { + selectedFolder: null, + isExistingClientSelected: true, + isNewClientSelected: false, + hasNewClientSelected: false, + }; + this.onSelectedFolder = this.onSelectedFolder.bind(this); + this.onExistingClientSelected = this.onExistingClientSelected.bind(this); + this.onNewClientSelected = this.onNewClientSelected.bind(this); + this.onMutiSelectChange = this.onMutiSelectChange.bind(this); + } + + public override render(): JSX.Element { + const selectOptions = [ + { value: "adazzdsqaad", label: "john Doe" }, + { value: "adazzqsdaad", label: "jane Doe" }, + { value: "adazzqsdaad", label: "Marcelino Doe" }, + ]; + console.log("this.state.hasNewClientSelected", this.state.hasNewClientSelected) + return ( + +
+ Associer un ou plusieurs client(s) +
+
+ + Client existant + + + Nouveau client + +
+ + + {this.state.isExistingClientSelected &&
+ +
+ + +
+
+ } + + {this.state.isNewClientSelected &&
+ + + + +
+ + +
+
} +
+
+
+ ); + } + + private onMutiSelectChange(newValue: MultiValue, actionMeta: ActionMeta): void { + console.log(newValue.length <= 0) + if (newValue.length <= 0) { + this.setState({ hasNewClientSelected: false }); + return; + } + this.setState({ hasNewClientSelected: true }); + } + + private onSelectedFolder(folder: IDashBoardFolder): void { + this.setState({ selectedFolder: folder }); + } + + private onExistingClientSelected(): void { + this.setState({ isExistingClientSelected: true, isNewClientSelected: false }); + } + + private onNewClientSelected(): void { + this.setState({ isExistingClientSelected: false, isNewClientSelected: true }); + } +} diff --git a/src/pages/dossier/ajouter-client.tsx b/src/pages/dossier/ajouter-client.tsx new file mode 100644 index 00000000..cbc96d2b --- /dev/null +++ b/src/pages/dossier/ajouter-client.tsx @@ -0,0 +1,5 @@ +import AddClientToFolder from "@Front/Components/Layouts/AddClientToFolder"; + +export default function Route() { + return ; +} diff --git a/src/pages/dossier.tsx b/src/pages/dossier/index.tsx similarity index 100% rename from src/pages/dossier.tsx rename to src/pages/dossier/index.tsx