✨ Cancel button working
This commit is contained in:
parent
4687b4bfe1
commit
078137be63
@ -1,4 +1,7 @@
|
||||
import PlusIcon from "@Assets/Icons/plus.svg";
|
||||
import Deeds from "@Front/Api/LeCoffreApi/SuperAdmin/Deeds/Deeds";
|
||||
import Documents from "@Front/Api/LeCoffreApi/SuperAdmin/Documents/Documents";
|
||||
import DocumentTypes from "@Front/Api/LeCoffreApi/SuperAdmin/DocumentTypes/DocumentTypes";
|
||||
import Folders from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders";
|
||||
import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
||||
import CheckBox from "@Front/Components/DesignSystem/CheckBox";
|
||||
@ -9,16 +12,13 @@ import { IOption } from "@Front/Components/DesignSystem/Select";
|
||||
import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography";
|
||||
import BackArrow from "@Front/Components/Elements/BackArrow";
|
||||
import DefaultNotaryDashboard from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
|
||||
import Module from "@Front/Config/Module";
|
||||
import { OfficeFolder } from "le-coffre-resources/dist/Customer";
|
||||
import { NextRouter, useRouter } from "next/router";
|
||||
import React from "react";
|
||||
|
||||
import BasePage from "../../Base";
|
||||
import classes from "./classes.module.scss";
|
||||
import Documents from "@Front/Api/LeCoffreApi/SuperAdmin/Documents/Documents";
|
||||
import Module from "@Front/Config/Module";
|
||||
import { OfficeFolder } from "le-coffre-resources/dist/Customer";
|
||||
import Deeds from "@Front/Api/LeCoffreApi/SuperAdmin/Deeds/Deeds";
|
||||
import DocumentTypes from "@Front/Api/LeCoffreApi/SuperAdmin/DocumentTypes/DocumentTypes";
|
||||
|
||||
type IProps = {};
|
||||
type IPropsClass = IProps & {
|
||||
@ -57,10 +57,13 @@ class AskDocumentsClass extends BasePage<IPropsClass, IState> {
|
||||
}
|
||||
|
||||
public override render(): JSX.Element {
|
||||
const backUrl = Module.getInstance()
|
||||
.get()
|
||||
.modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", this.props.folderUid);
|
||||
return (
|
||||
<DefaultNotaryDashboard title={"Demander des documents"} onSelectedFolder={() => {}}>
|
||||
<div className={classes["root"]}>
|
||||
<BackArrow />
|
||||
<BackArrow url={backUrl} />
|
||||
<Typography typo={ITypo.H1} color={ITypoColor.BLACK} className={classes["title"]}>
|
||||
Demander des documents
|
||||
</Typography>
|
||||
@ -87,9 +90,11 @@ class AskDocumentsClass extends BasePage<IPropsClass, IState> {
|
||||
</Button>
|
||||
</div>
|
||||
<div className={classes["buttons-container"]}>
|
||||
<a href={backUrl}>
|
||||
<Button variant={EButtonVariant.GHOST} onClick={this.cancel}>
|
||||
Annuler
|
||||
</Button>
|
||||
</a>
|
||||
<Button type="submit">Valider</Button>
|
||||
</div>
|
||||
</div>
|
||||
@ -146,8 +151,8 @@ class AskDocumentsClass extends BasePage<IPropsClass, IState> {
|
||||
include: {
|
||||
depositor: true,
|
||||
document_type: true,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!folder) return;
|
||||
@ -161,19 +166,23 @@ class AskDocumentsClass extends BasePage<IPropsClass, IState> {
|
||||
}
|
||||
|
||||
private async getAvailableDocuments(folder: OfficeFolder): Promise<IOption[]> {
|
||||
const userDocumentTypesUids = folder.documents!.filter((document) => document.depositor!.uid! === this.props.customerUid!).map((document) => {
|
||||
const userDocumentTypesUids = folder
|
||||
.documents!.filter((document) => document.depositor!.uid! === this.props.customerUid!)
|
||||
.map((document) => {
|
||||
return document.document_type!.uid!;
|
||||
});
|
||||
const documentTypes = folder.deed!.deed_has_document_types!.filter((documentType) => {
|
||||
if(userDocumentTypesUids.includes(documentType.document_type!.uid!)) return false;
|
||||
if (userDocumentTypesUids.includes(documentType.document_type!.uid!)) return false;
|
||||
return true;
|
||||
});
|
||||
|
||||
if (!documentTypes) return [];
|
||||
|
||||
const documentTypesOptions: IOption[] = documentTypes.filter((documentType) => {
|
||||
const documentTypesOptions: IOption[] = documentTypes
|
||||
.filter((documentType) => {
|
||||
return true;
|
||||
}).map((documentType) => {
|
||||
})
|
||||
.map((documentType) => {
|
||||
return {
|
||||
label: documentType.document_type!.name!,
|
||||
value: documentType.document_type!.uid!,
|
||||
|
Loading…
x
Reference in New Issue
Block a user