diff --git a/src/front/Components/DesignSystem/Modal/Confirm/index.tsx b/src/front/Components/DesignSystem/Modal/Confirm/index.tsx index 4c7ad6a6..2a6c9236 100644 --- a/src/front/Components/DesignSystem/Modal/Confirm/index.tsx +++ b/src/front/Components/DesignSystem/Modal/Confirm/index.tsx @@ -9,7 +9,7 @@ type IProps = IPropsModal & { cancelText: string | JSX.Element; confirmText: string | JSX.Element; showCancelButton: boolean; - isConfirmButtonDisabled: boolean; + canConfirm: boolean; }; type IState = {}; @@ -19,7 +19,7 @@ export default class Confirm extends React.Component { showCancelButton: true, cancelText: "Cancel", confirmText: "Confirm", - isConfirmButtonDisabled: false, + canConfirm: false, ...Modal.defaultProps, }; @@ -46,7 +46,7 @@ export default class Confirm extends React.Component { )} - diff --git a/src/front/Components/DesignSystem/Modal/index.tsx b/src/front/Components/DesignSystem/Modal/index.tsx index a2d22bc7..6726b19b 100644 --- a/src/front/Components/DesignSystem/Modal/index.tsx +++ b/src/front/Components/DesignSystem/Modal/index.tsx @@ -51,9 +51,7 @@ export default class Modal extends React.Component { data-side-background={this.props.withSideBackground} data-will-close={this.state.willClose.toString()}>
-
+
{this.props.closeBtn && (
Unplugged diff --git a/src/front/Components/Layouts/Folder/AskDocuments/classes.module.scss b/src/front/Components/Layouts/Folder/AskDocuments/classes.module.scss index cdfe52a9..ce64fe4e 100644 --- a/src/front/Components/Layouts/Folder/AskDocuments/classes.module.scss +++ b/src/front/Components/Layouts/Folder/AskDocuments/classes.module.scss @@ -29,4 +29,10 @@ .buttons-container { margin-top: 32px; } + + .add-document-form-container { + display: flex; + flex-direction: column; + gap: 24px; + } } diff --git a/src/front/Components/Layouts/Folder/AskDocuments/index.tsx b/src/front/Components/Layouts/Folder/AskDocuments/index.tsx index ec6499f2..84a2be86 100644 --- a/src/front/Components/Layouts/Folder/AskDocuments/index.tsx +++ b/src/front/Components/Layouts/Folder/AskDocuments/index.tsx @@ -2,6 +2,7 @@ import PlusIcon from "@Assets/Icons/plus.svg"; import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button"; import CheckBox from "@Front/Components/DesignSystem/CheckBox"; import Form, { IApiFormErrors } from "@Front/Components/DesignSystem/Form"; +import InputField from "@Front/Components/DesignSystem/Form/Elements/InputField"; import Confirm from "@Front/Components/DesignSystem/Modal/Confirm"; import Select, { IOption } from "@Front/Components/DesignSystem/Select"; import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography"; @@ -16,6 +17,8 @@ type IProps = {}; type IState = { actType: IOption | null; isCreateDocumentModalVisible: boolean; + documentName: string; + visibleDescription: string; }; export default class AskDocuments extends BasePage { @@ -45,6 +48,8 @@ export default class AskDocuments extends BasePage { this.state = { actType: null, isCreateDocumentModalVisible: false, + documentName: "", + visibleDescription: "", }; this.onActTypeChange = this.onActTypeChange.bind(this); @@ -52,11 +57,15 @@ export default class AskDocuments extends BasePage { this.closeModal = this.closeModal.bind(this); this.openModal = this.openModal.bind(this); this.cancel = this.cancel.bind(this); + this.onVisibleDescriptionChange = this.onVisibleDescriptionChange.bind(this); + this.onDocumentNameChange = this.onDocumentNameChange.bind(this); + this.addDocument = this.addDocument.bind(this); + this.canAddDocument = this.canAddDocument.bind(this); } public override render(): JSX.Element { return ( - +
@@ -101,33 +110,83 @@ export default class AskDocuments extends BasePage { {}} + onAccept={this.addDocument} + canConfirm={this.canAddDocument()} closeBtn header={"Créer un type de document"} cancelText={"Annuler"} confirmText={"Ajouter"}> - Blabla +
+ + +
); } + private canAddDocument() { + if (this.state.documentName === "" || this.state.visibleDescription === "") { + return false; + } + return true; + } + + private addDocument() { + console.log(this.state.documentName); + console.log(this.state.visibleDescription); + this.setState({ + isCreateDocumentModalVisible: false, + documentName: "", + visibleDescription: "", + }); + } + + private onVisibleDescriptionChange(e: React.ChangeEvent) { + this.setState({ + visibleDescription: e.target.value, + }); + } + + private onDocumentNameChange(e: React.ChangeEvent) { + this.setState({ + documentName: e.target.value, + }); + } + private cancel() { this.setState({ actType: null, + visibleDescription: "", + documentName: "", }); } private openModal() { this.setState({ isCreateDocumentModalVisible: true, + visibleDescription: "", + documentName: "", }); } private closeModal() { this.setState({ isCreateDocumentModalVisible: false, + visibleDescription: "", + documentName: "", }); }