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