Merge branch 'feature/front-services' into dev
This commit is contained in:
commit
cd06158e83
92
src/front/Api/LeCoffreApi/SuperAdmin/DeedTypes/DeedTypes.ts
Normal file
92
src/front/Api/LeCoffreApi/SuperAdmin/DeedTypes/DeedTypes.ts
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
import { Service } from "typedi";
|
||||||
|
import { Deed, DeedType } from "le-coffre-resources/dist/Notary";
|
||||||
|
import BaseSuperAdmin from "../BaseSuperAdmin";
|
||||||
|
|
||||||
|
// TODO Type get query params -> Where + inclue + orderby
|
||||||
|
export interface IGetDeedTypesParams {
|
||||||
|
q?: {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Type getbyuid query params
|
||||||
|
|
||||||
|
export type IPutDeedTypesParams = {
|
||||||
|
uid?: DeedType["uid"];
|
||||||
|
name?: DeedType["name"];
|
||||||
|
description?: DeedType["description"];
|
||||||
|
deed?: DeedType["deed"];
|
||||||
|
office?: DeedType["office"];
|
||||||
|
archived_at?: DeedType["archived_at"];
|
||||||
|
deed_type_has_document_types?: DeedType["deed_type_has_document_types"];
|
||||||
|
};
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export default class DeedTypes extends BaseSuperAdmin {
|
||||||
|
private static instance: DeedTypes;
|
||||||
|
private readonly baseURl = this.namespaceUrl.concat("/deed-types");
|
||||||
|
|
||||||
|
private constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getInstance() {
|
||||||
|
if (!this.instance) {
|
||||||
|
return new this();
|
||||||
|
} else {
|
||||||
|
return this.instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : Get all DeedTypes
|
||||||
|
*/
|
||||||
|
public async get(q: IGetDeedTypesParams): Promise<DeedType[]> {
|
||||||
|
const url = new URL(this.baseURl);
|
||||||
|
Object.entries(q).forEach(([key, value]) => url.searchParams.set(key, JSON.stringify(value)));
|
||||||
|
try {
|
||||||
|
return await this.getRequest<DeedType[]>(url);
|
||||||
|
} catch (err) {
|
||||||
|
this.onError(err);
|
||||||
|
return Promise.reject(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : Get a folder by uid
|
||||||
|
*/
|
||||||
|
public async getByUid(uid: string, q?: any): Promise<DeedType> {
|
||||||
|
const url = new URL(this.baseURl.concat(`/${uid}`));
|
||||||
|
if (q) Object.entries(q).forEach(([key, value]) => url.searchParams.set(key, JSON.stringify(value)));
|
||||||
|
try {
|
||||||
|
return await this.getRequest<DeedType>(url);
|
||||||
|
} catch (err) {
|
||||||
|
this.onError(err);
|
||||||
|
return Promise.reject(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : Create a deed
|
||||||
|
*/
|
||||||
|
// public async post(body: IPostDeedTypesParams): Promise<OfficeFolder> {
|
||||||
|
// const url = new URL(this.baseURl);
|
||||||
|
// try {
|
||||||
|
// return await this.postRequest<OfficeFolder>(url, body);
|
||||||
|
// } catch (err) {
|
||||||
|
// this.onError(err);
|
||||||
|
// return Promise.reject(err);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : Update the folder description
|
||||||
|
*/
|
||||||
|
public async put(uid: string, body: IPutDeedTypesParams): Promise<DeedType> {
|
||||||
|
const url = new URL(this.baseURl.concat(`/${uid}`));
|
||||||
|
try {
|
||||||
|
return await this.putRequest<DeedType>(url, body);
|
||||||
|
} catch (err) {
|
||||||
|
this.onError(err);
|
||||||
|
return Promise.reject(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
91
src/front/Api/LeCoffreApi/SuperAdmin/Deeds/Deeds.ts
Normal file
91
src/front/Api/LeCoffreApi/SuperAdmin/Deeds/Deeds.ts
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
import { Service } from "typedi";
|
||||||
|
import { Deed, OfficeFolder } from "le-coffre-resources/dist/Notary";
|
||||||
|
import BaseSuperAdmin from "../BaseSuperAdmin";
|
||||||
|
|
||||||
|
// TODO Type get query params -> Where + inclue + orderby
|
||||||
|
export interface IGetDeedsParams {
|
||||||
|
q?: {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Type getbyuid query params
|
||||||
|
|
||||||
|
export type IPutDeedsParams = {
|
||||||
|
uid?: OfficeFolder["uid"];
|
||||||
|
folder_number?: OfficeFolder["folder_number"];
|
||||||
|
name?: OfficeFolder["name"];
|
||||||
|
description?: OfficeFolder["description"];
|
||||||
|
archived_description?: OfficeFolder["archived_description"];
|
||||||
|
status?: OfficeFolder["status"];
|
||||||
|
};
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export default class Deeds extends BaseSuperAdmin {
|
||||||
|
private static instance: Deeds;
|
||||||
|
private readonly baseURl = this.namespaceUrl.concat("/deeds");
|
||||||
|
|
||||||
|
private constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getInstance() {
|
||||||
|
if (!this.instance) {
|
||||||
|
return new this();
|
||||||
|
} else {
|
||||||
|
return this.instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : Get all deeds
|
||||||
|
*/
|
||||||
|
public async get(q: IGetDeedsParams): Promise<Deed[]> {
|
||||||
|
const url = new URL(this.baseURl);
|
||||||
|
Object.entries(q).forEach(([key, value]) => url.searchParams.set(key, JSON.stringify(value)));
|
||||||
|
try {
|
||||||
|
return await this.getRequest<Deed[]>(url);
|
||||||
|
} catch (err) {
|
||||||
|
this.onError(err);
|
||||||
|
return Promise.reject(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : Get a folder by uid
|
||||||
|
*/
|
||||||
|
public async getByUid(uid: string, q?: any): Promise<Deed> {
|
||||||
|
const url = new URL(this.baseURl.concat(`/${uid}`));
|
||||||
|
if (q) Object.entries(q).forEach(([key, value]) => url.searchParams.set(key, JSON.stringify(value)));
|
||||||
|
try {
|
||||||
|
return await this.getRequest<Deed>(url);
|
||||||
|
} catch (err) {
|
||||||
|
this.onError(err);
|
||||||
|
return Promise.reject(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : Create a deed
|
||||||
|
*/
|
||||||
|
// public async post(body: IPostDeedsParams): Promise<OfficeFolder> {
|
||||||
|
// const url = new URL(this.baseURl);
|
||||||
|
// try {
|
||||||
|
// return await this.postRequest<OfficeFolder>(url, body);
|
||||||
|
// } catch (err) {
|
||||||
|
// this.onError(err);
|
||||||
|
// return Promise.reject(err);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : Update the folder description
|
||||||
|
*/
|
||||||
|
public async put(uid: string, body: IPutDeedsParams): Promise<Deed> {
|
||||||
|
const url = new URL(this.baseURl.concat(`/${uid}`));
|
||||||
|
try {
|
||||||
|
return await this.putRequest<Deed>(url, body);
|
||||||
|
} catch (err) {
|
||||||
|
this.onError(err);
|
||||||
|
return Promise.reject(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,19 @@ export interface IGetFoldersParams {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Type getbyuid query params
|
// TODO Type getbyuid query searchParams
|
||||||
|
export type IPostFoldersParams = {
|
||||||
|
folder_number: OfficeFolder["folder_number"];
|
||||||
|
name: OfficeFolder["name"];
|
||||||
|
description: OfficeFolder["description"];
|
||||||
|
archived_description: OfficeFolder["archived_description"];
|
||||||
|
status: OfficeFolder["status"];
|
||||||
|
deed: OfficeFolder["deed"];
|
||||||
|
office: OfficeFolder["office"];
|
||||||
|
office_folder_has_customers?: OfficeFolder["office_folder_has_customers"];
|
||||||
|
office_folder_has_stakeholder?: OfficeFolder["office_folder_has_stakeholder"];
|
||||||
|
documents?: OfficeFolder["documents"];
|
||||||
|
};
|
||||||
|
|
||||||
export type IPutFoldersParams = {
|
export type IPutFoldersParams = {
|
||||||
uid?: OfficeFolder["uid"];
|
uid?: OfficeFolder["uid"];
|
||||||
@ -70,15 +82,15 @@ export default class Folders extends BaseSuperAdmin {
|
|||||||
/**
|
/**
|
||||||
* @description : Create a folder
|
* @description : Create a folder
|
||||||
*/
|
*/
|
||||||
// public async post(body: IPostFoldersParams): Promise<OfficeFolder> {
|
public async post(body: any): Promise<OfficeFolder> {
|
||||||
// const url = new URL(this.baseURl);
|
const url = new URL(this.baseURl);
|
||||||
// try {
|
try {
|
||||||
// return await this.postRequest<OfficeFolder>(url, body);
|
return await this.postRequest<OfficeFolder>(url, body);
|
||||||
// } catch (err) {
|
} catch (err) {
|
||||||
// this.onError(err);
|
this.onError(err);
|
||||||
// return Promise.reject(err);
|
return Promise.reject(err);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description : Update the folder description
|
* @description : Update the folder description
|
||||||
|
@ -85,6 +85,7 @@ export default function FolderBoxInformation(props: IProps) {
|
|||||||
|
|
||||||
function formatDate(date: Date | null): string {
|
function formatDate(date: Date | null): string {
|
||||||
if (!date) return "...";
|
if (!date) return "...";
|
||||||
|
if (!(date instanceof Date)) date = new Date(date);
|
||||||
return date.toLocaleDateString("fr-FR", {
|
return date.toLocaleDateString("fr-FR", {
|
||||||
year: "numeric",
|
year: "numeric",
|
||||||
month: "long",
|
month: "long",
|
||||||
|
@ -28,7 +28,7 @@ class FolderListClass extends React.Component<IPropsClass, IState> {
|
|||||||
return (
|
return (
|
||||||
<div className={classes["root"]}>
|
<div className={classes["root"]}>
|
||||||
{this.props.folders.sort((folder) => {
|
{this.props.folders.sort((folder) => {
|
||||||
const pendingDocuments = folder.documents!.filter((document) => document.document_status === "PENDING");
|
const pendingDocuments = (folder.documents ?? []).filter((document) => document.document_status === "PENDING");
|
||||||
return pendingDocuments.length >= 1 ? -1 : 1;
|
return pendingDocuments.length >= 1 ? -1 : 1;
|
||||||
}).map((folder) => {
|
}).map((folder) => {
|
||||||
return (
|
return (
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React, { ReactNode } from "react";
|
import React, { ReactNode } from "react";
|
||||||
import BaseField, { IError, IProps as IBaseFieldProps } from "./Elements/BaseField";
|
|
||||||
|
import BaseField, { IProps as IBaseFieldProps, IError } from "./Elements/BaseField";
|
||||||
|
|
||||||
export type IBaseField = BaseField<IBaseFieldProps>;
|
export type IBaseField = BaseField<IBaseFieldProps>;
|
||||||
|
|
||||||
@ -90,13 +91,41 @@ export default class Form extends React.Component<IProps, IState> {
|
|||||||
|
|
||||||
if (this.props.onValidated) this.props.onValidated();
|
if (this.props.onValidated) this.props.onValidated();
|
||||||
|
|
||||||
const elementsValues = this.getAllChildrenFields(e).reduce(
|
const allChildren = this.getAllChildrenFields(e);
|
||||||
|
const elementsValues = allChildren
|
||||||
|
.filter((e) => {
|
||||||
|
return e.getAttribute("type") !== "radio" && e.getAttribute("type") !== "checkbox";
|
||||||
|
})
|
||||||
|
.reduce((obj, element) => ({ ...obj, [element.getAttribute("name") ?? ""]: (element as any).value }), {});
|
||||||
|
|
||||||
|
const radioInputs = allChildren.filter((e) => e.getAttribute("type") === "radio").filter((e) => (e as any).checked);
|
||||||
|
const radioInputsValues = radioInputs.reduce(
|
||||||
(obj, element) => ({ ...obj, [element.getAttribute("name") ?? ""]: (element as any).value }),
|
(obj, element) => ({ ...obj, [element.getAttribute("name") ?? ""]: (element as any).value }),
|
||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const checkBoxesInput = allChildren.filter((e) => e.getAttribute("type") === "checkbox").filter((e) => (e as any).checked);
|
||||||
|
const checkBoxesValues = checkBoxesInput.reduce((obj, element) => {
|
||||||
|
const inputName = element.getAttribute("name") ?? "";
|
||||||
|
const inputValue = (element as any).value as string;
|
||||||
|
const newValue = (obj as any)[inputName] as string[] ?? [];
|
||||||
|
newValue.push(inputValue);
|
||||||
|
return {
|
||||||
|
...obj,
|
||||||
|
[inputName]: newValue,
|
||||||
|
};
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
const allInputs = {
|
||||||
|
...elementsValues,
|
||||||
|
...radioInputsValues,
|
||||||
|
...checkBoxesValues,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Deleting empty input
|
||||||
|
delete (allInputs as any)[""];
|
||||||
if (this.props.onSubmit) {
|
if (this.props.onSubmit) {
|
||||||
this.props.onSubmit(e, elementsValues, this.onSubmitErrorApi);
|
this.props.onSubmit(e, allInputs, this.onSubmitErrorApi);
|
||||||
}
|
}
|
||||||
|
|
||||||
return { values: elementsValues };
|
return { values: elementsValues };
|
||||||
|
@ -43,7 +43,7 @@ export default class NotificationModal extends React.Component<IProps, IState> {
|
|||||||
{Toasts.getInstance().toasts.length === 0 ? (
|
{Toasts.getInstance().toasts.length === 0 ? (
|
||||||
<div className={classes["missing-notification"]}>
|
<div className={classes["missing-notification"]}>
|
||||||
<Typography typo={ITypo.P_18} color={ITypoColor.GREY}>
|
<Typography typo={ITypo.P_18} color={ITypoColor.GREY}>
|
||||||
Vous n’avez pas de notifications.
|
Vous n'avez pas de notifications.
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
@ -14,6 +14,7 @@ type IProps = {
|
|||||||
hasBorderRightCollapsed?: boolean;
|
hasBorderRightCollapsed?: boolean;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
|
name?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type IOption = {
|
export type IOption = {
|
||||||
@ -50,6 +51,7 @@ export default class Select extends React.Component<IProps, IState> {
|
|||||||
const selectedOption = this.state.selectedOption ?? this.props.selectedOption;
|
const selectedOption = this.state.selectedOption ?? this.props.selectedOption;
|
||||||
return (
|
return (
|
||||||
<div className={classNames(classes["root"], this.props.className)} ref={this.rootRef}>
|
<div className={classNames(classes["root"], this.props.className)} ref={this.rootRef}>
|
||||||
|
{selectedOption && <input type="text" defaultValue={selectedOption.value as string} name={this.props.name} hidden />}
|
||||||
<label
|
<label
|
||||||
className={classNames(classes["container-label"])}
|
className={classNames(classes["container-label"])}
|
||||||
data-open={this.state.isOpen}
|
data-open={this.state.isOpen}
|
||||||
|
@ -6,8 +6,6 @@ import FolderListContainer from "@Front/Components/DesignSystem/FolderListContai
|
|||||||
import Header from "@Front/Components/DesignSystem/Header";
|
import Header from "@Front/Components/DesignSystem/Header";
|
||||||
import Version from "@Front/Components/DesignSystem/Version";
|
import Version from "@Front/Components/DesignSystem/Version";
|
||||||
import BackArrow from "@Front/Components/Elements/BackArrow";
|
import BackArrow from "@Front/Components/Elements/BackArrow";
|
||||||
import { folders } from "@Front/Components/Layouts/DesignSystem/dummyData";
|
|
||||||
import { foldersArchived } from "@Front/Components/Layouts/DesignSystem/dummyData";
|
|
||||||
import WindowStore from "@Front/Stores/WindowStore";
|
import WindowStore from "@Front/Stores/WindowStore";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { OfficeFolder } from "le-coffre-resources/dist/Customer";
|
import { OfficeFolder } from "le-coffre-resources/dist/Customer";
|
||||||
@ -15,7 +13,8 @@ import Image from "next/image";
|
|||||||
import React, { ReactNode } from "react";
|
import React, { ReactNode } from "react";
|
||||||
|
|
||||||
import classes from "./classes.module.scss";
|
import classes from "./classes.module.scss";
|
||||||
|
import Folders, { IGetFoldersParams } from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders";
|
||||||
|
import { EFolderStatus } from "le-coffre-resources/dist/Customer/OfficeFolder";
|
||||||
|
|
||||||
type IProps = {
|
type IProps = {
|
||||||
title: string;
|
title: string;
|
||||||
@ -42,6 +41,7 @@ export type IDashBoardFolder = {
|
|||||||
created_at: OfficeFolder["created_at"];
|
created_at: OfficeFolder["created_at"];
|
||||||
office_folder_has_customers?: OfficeFolder["office_folder_has_customers"];
|
office_folder_has_customers?: OfficeFolder["office_folder_has_customers"];
|
||||||
archived_description: OfficeFolder["archived_description"];
|
archived_description: OfficeFolder["archived_description"];
|
||||||
|
status: OfficeFolder["status"];
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class DefaultNotaryDashboard extends React.Component<IProps, IState> {
|
export default class DefaultNotaryDashboard extends React.Component<IProps, IState> {
|
||||||
@ -108,17 +108,23 @@ export default class DefaultNotaryDashboard extends React.Component<IProps, ISta
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override componentDidMount(): void {
|
public override async componentDidMount() {
|
||||||
this.onWindowResize = WindowStore.getInstance().onResize((window) => this.onResize(window));
|
this.onWindowResize = WindowStore.getInstance().onResize((window) => this.onResize(window));
|
||||||
/**
|
let targetedStatus: EFolderStatus = EFolderStatus["LIVE" as keyof typeof EFolderStatus];
|
||||||
* We set folders state according to the isArchived props
|
if (this.props.isArchived) targetedStatus = EFolderStatus.ARCHIVED;
|
||||||
* TODO: Front connexion we need to get from bdd
|
const query: IGetFoldersParams = {
|
||||||
*/
|
q: {
|
||||||
if (this.props.isArchived) {
|
where: { status: targetedStatus },
|
||||||
this.setState({ folders: foldersArchived });
|
include: {
|
||||||
} else {
|
deed: { include: { deed_type: true } },
|
||||||
this.setState({ folders: folders });
|
office: true,
|
||||||
}
|
office_folder_has_customers: { include: { customer: { include: { contact: true } } } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const folders = await Folders.getInstance().get(query);
|
||||||
|
this.setState({ folders: folders });
|
||||||
}
|
}
|
||||||
public override componentWillUnmount() {
|
public override componentWillUnmount() {
|
||||||
this.onWindowResize();
|
this.onWindowResize();
|
||||||
|
@ -24,7 +24,6 @@ import Toasts, { IToast } from "@Front/Stores/Toasts";
|
|||||||
import classes from "./classes.module.scss";
|
import classes from "./classes.module.scss";
|
||||||
import { customer2, document, documentDeposited, documentPending, folder, folders, folderWithPendingDocument } from "./dummyData";
|
import { customer2, document, documentDeposited, documentPending, folder, folders, folderWithPendingDocument } from "./dummyData";
|
||||||
|
|
||||||
|
|
||||||
type IState = {
|
type IState = {
|
||||||
isModalDisplayed: boolean;
|
isModalDisplayed: boolean;
|
||||||
selectedOption?: IOption;
|
selectedOption?: IOption;
|
||||||
@ -203,7 +202,7 @@ export default class DesignSystem extends BasePage<IProps, IState> {
|
|||||||
<Select
|
<Select
|
||||||
options={selectOptions}
|
options={selectOptions}
|
||||||
onChange={this.onSelectedOption}
|
onChange={this.onSelectedOption}
|
||||||
placeholder={"Type d’acte"}
|
placeholder={"Type d'acte"}
|
||||||
selectedOption={this.state.selectedOption}
|
selectedOption={this.state.selectedOption}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -66,7 +66,7 @@ export default class AskDocuments extends BasePage<IProps, IState> {
|
|||||||
<div className={classes["form-container"]}>
|
<div className={classes["form-container"]}>
|
||||||
<div className={classes["checkbox-container"]}>
|
<div className={classes["checkbox-container"]}>
|
||||||
{this.documentsType.map((documentType) => (
|
{this.documentsType.map((documentType) => (
|
||||||
<CheckBox toolTip="Checkbox with tooltip" option={documentType} key={documentType.value as string} />
|
<CheckBox name="documents_type" toolTip="Checkbox with tooltip" option={documentType} key={documentType.value as string} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className={classes["add-document-container"]}>
|
<div className={classes["add-document-container"]}>
|
||||||
|
@ -14,9 +14,11 @@ import { ActionMeta, MultiValue } from "react-select";
|
|||||||
import BasePage from "../../Base";
|
import BasePage from "../../Base";
|
||||||
import classes from "./classes.module.scss";
|
import classes from "./classes.module.scss";
|
||||||
import { Deed, DeedType, OfficeFolder, OfficeFolderHasStakeholder } from "le-coffre-resources/dist/Notary";
|
import { Deed, DeedType, OfficeFolder, OfficeFolderHasStakeholder } from "le-coffre-resources/dist/Notary";
|
||||||
// import DeedTypes from "@Front/Api/LeCoffreApi/SuperAdmin/DeedTypes/DeedTypes";
|
import DeedTypes from "@Front/Api/LeCoffreApi/SuperAdmin/DeedTypes/DeedTypes";
|
||||||
import Users from "@Front/Api/LeCoffreApi/SuperAdmin/Users/Users";
|
import Users from "@Front/Api/LeCoffreApi/SuperAdmin/Users/Users";
|
||||||
import User from "le-coffre-resources/dist/Notary";
|
import User from "le-coffre-resources/dist/Notary";
|
||||||
|
import Folders, { IPostFoldersParams } from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders";
|
||||||
|
import { EFolderStatus } from "le-coffre-resources/dist/Customer/OfficeFolder";
|
||||||
|
|
||||||
type IFormValues = {
|
type IFormValues = {
|
||||||
folder_number: number;
|
folder_number: number;
|
||||||
@ -127,14 +129,18 @@ export default class CreateFolder extends BasePage<IProps, IState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override async componentDidMount() {
|
public override async componentDidMount() {
|
||||||
// const deedTypes = await DeedTypes.getInstance().get({ q: {} });
|
const deedTypes = await DeedTypes.getInstance().get({ q: {} });
|
||||||
|
|
||||||
// TODO SETUP userStore and get the user's office membership -> Replace IwJ70M471c by the user's office membership uid
|
// TODO SETUP userStore and get the user's office membership -> Replace IwJ70M471c by the user's office membership uid
|
||||||
|
const usersMock = await Users.getInstance().get({ q: { include: { office_membership: true } } });
|
||||||
|
const userMock = usersMock[0];
|
||||||
|
// -------------------
|
||||||
const collaborators = await Users.getInstance().get({
|
const collaborators = await Users.getInstance().get({
|
||||||
q: { where: { office_membership: { uid: "IwJ70M471c" } }, include: { contact: true } },
|
q: { where: { office_membership: { uid: userMock?.office_membership.uid } }, include: { contact: true } },
|
||||||
});
|
});
|
||||||
this.setState({
|
this.setState({
|
||||||
// deedTypes,
|
deedTypes,
|
||||||
// deedTypesOptions: this.mapDeedOptions(deedTypes),
|
deedTypesOptions: this.mapDeedOptions(deedTypes),
|
||||||
collaborators,
|
collaborators,
|
||||||
collaboratorsOptions: this.mapUsersOptions(collaborators),
|
collaboratorsOptions: this.mapUsersOptions(collaborators),
|
||||||
});
|
});
|
||||||
@ -199,7 +205,7 @@ export default class CreateFolder extends BasePage<IProps, IState> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private onFormSubmit(
|
private async onFormSubmit(
|
||||||
e: React.FormEvent<HTMLFormElement> | null,
|
e: React.FormEvent<HTMLFormElement> | null,
|
||||||
values: {
|
values: {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
@ -219,16 +225,54 @@ export default class CreateFolder extends BasePage<IProps, IState> {
|
|||||||
const deed = Deed.hydrate<Deed>({
|
const deed = Deed.hydrate<Deed>({
|
||||||
deed_type: selectedDeedType,
|
deed_type: selectedDeedType,
|
||||||
});
|
});
|
||||||
const office_folder_has_customers = collaborators.map((collaborator) => {
|
let office_folder_has_stakeholders = collaborators.map((collaborator) => {
|
||||||
return OfficeFolderHasStakeholder.hydrate<OfficeFolderHasStakeholder>({
|
return OfficeFolderHasStakeholder.hydrate<OfficeFolderHasStakeholder>({
|
||||||
office_folder: new OfficeFolder(),
|
office_folder: new OfficeFolder(),
|
||||||
user_stakeholder: collaborator,
|
user_stakeholder: collaborator,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.state.folder_access === "select_collaborators") {
|
||||||
|
office_folder_has_stakeholders = office_folder_has_stakeholders.filter((collaborator) => {
|
||||||
|
return this.state.formValues.collaborators?.some((selectedCollaborator) => {
|
||||||
|
return selectedCollaborator.value === collaborator.user_stakeholder.uid;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const usersMock = await Users.getInstance().get({ q: { include: { office_membership: true } } });
|
||||||
|
const userMock = usersMock[0];
|
||||||
|
|
||||||
values["deed"] = deed;
|
values["deed"] = deed;
|
||||||
values["office_folder_has_customers"] = office_folder_has_customers;
|
values["archived_description"] = "";
|
||||||
console.log(values);
|
values["status"] = EFolderStatus.LIVE;
|
||||||
|
values["office"] = userMock?.office_membership;
|
||||||
|
values["office_folder_has_stakeholder"] = values["office_folder_has_stakeholders"] = office_folder_has_stakeholders;
|
||||||
|
|
||||||
|
const newobject = {
|
||||||
|
folder_number: "12312",
|
||||||
|
name: "Mon folder",
|
||||||
|
description: "dazdazf",
|
||||||
|
deed: {
|
||||||
|
deed_type: {
|
||||||
|
uid: "neNTaiiNVp",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
office: {
|
||||||
|
uid: "R34T9DZ5ov",
|
||||||
|
},
|
||||||
|
office_folder_has_stakeholder: [
|
||||||
|
{
|
||||||
|
user_stakeholder: {
|
||||||
|
uid: "WYBnSyguqP",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log(newobject);
|
||||||
|
const created = await Folders.getInstance().post(newobject as any);
|
||||||
|
console.log(">>> ", created);
|
||||||
}
|
}
|
||||||
|
|
||||||
private isFormSubmittable(): boolean {
|
private isFormSubmittable(): boolean {
|
||||||
|
@ -33,7 +33,7 @@ export default class ClientSection extends React.Component<IProps, IState> {
|
|||||||
<div className={classes["no-client"]}>
|
<div className={classes["no-client"]}>
|
||||||
<div className={classes["title"]}>
|
<div className={classes["title"]}>
|
||||||
<Typography typo={ITypo.P_18} color={ITypoColor.GREY}>
|
<Typography typo={ITypo.P_18} color={ITypoColor.GREY}>
|
||||||
Aucun client n’est associé au dossier.
|
Aucun client n'est associé au dossier.
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
<Link href={navigatePath}>
|
<Link href={navigatePath}>
|
||||||
@ -57,6 +57,7 @@ export default class ClientSection extends React.Component<IProps, IState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private doesFolderHaveCustomer(): boolean {
|
private doesFolderHaveCustomer(): boolean {
|
||||||
return this.props.folder.office_folder_has_customers !== undefined;
|
if (!this.props.folder?.office_folder_has_customers) return false;
|
||||||
|
return this.props.folder?.office_folder_has_customers!.length > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,20 +7,21 @@ import InputField from "@Front/Components/DesignSystem/Form/Elements/InputField"
|
|||||||
import Confirm from "@Front/Components/DesignSystem/Modal/Confirm";
|
import Confirm from "@Front/Components/DesignSystem/Modal/Confirm";
|
||||||
import QuantityProgressBar from "@Front/Components/DesignSystem/QuantityProgressBar";
|
import QuantityProgressBar from "@Front/Components/DesignSystem/QuantityProgressBar";
|
||||||
import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography";
|
import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography";
|
||||||
import { folders } from "@Front/Components/Layouts/DesignSystem/dummyData";
|
|
||||||
import DefaultNotaryDashboard, { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
|
import DefaultNotaryDashboard, { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
|
||||||
import Module from "@Front/Config/Module";
|
import Module from "@Front/Config/Module";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
import { NextRouter, useRouter } from "next/router";
|
||||||
import BasePage from "../../Base";
|
import BasePage from "../../Base";
|
||||||
import classes from "./classes.module.scss";
|
import classes from "./classes.module.scss";
|
||||||
import ClientSection from "./ClientSection";
|
import ClientSection from "./ClientSection";
|
||||||
import { EDocumentStatus } from "le-coffre-resources/dist/Notary/Document";
|
import { EDocumentStatus } from "le-coffre-resources/dist/Notary/Document";
|
||||||
|
import Folders from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders";
|
||||||
|
import { OfficeFolder } from "le-coffre-resources/dist/Customer";
|
||||||
|
|
||||||
type IProps = {};
|
type IProps = {};
|
||||||
|
|
||||||
type IPropsClass = IProps & {
|
type IPropsClass = IProps & {
|
||||||
|
router: NextRouter;
|
||||||
selectedFolderUid: string;
|
selectedFolderUid: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -38,6 +39,7 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
this.onSelectedFolder = this.onSelectedFolder.bind(this);
|
this.onSelectedFolder = this.onSelectedFolder.bind(this);
|
||||||
this.openArchivedModal = this.openArchivedModal.bind(this);
|
this.openArchivedModal = this.openArchivedModal.bind(this);
|
||||||
this.closeArchivedModal = this.closeArchivedModal.bind(this);
|
this.closeArchivedModal = this.closeArchivedModal.bind(this);
|
||||||
|
this.onArchivedModalAccepted = this.onArchivedModalAccepted.bind(this);
|
||||||
this.getCompletionNumber = this.getCompletionNumber.bind(this);
|
this.getCompletionNumber = this.getCompletionNumber.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,6 +89,7 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
</div>
|
</div>
|
||||||
<Confirm
|
<Confirm
|
||||||
isOpen={this.state.isArchivedModalOpen}
|
isOpen={this.state.isArchivedModalOpen}
|
||||||
|
onAccept={this.onArchivedModalAccepted}
|
||||||
onClose={this.closeArchivedModal}
|
onClose={this.closeArchivedModal}
|
||||||
closeBtn
|
closeBtn
|
||||||
header={"Archiver le dossier ?"}
|
header={"Archiver le dossier ?"}
|
||||||
@ -113,12 +116,9 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
public override async componentDidMount() {
|
public override async componentDidMount() {
|
||||||
for (const folder of folders) {
|
this.setState({
|
||||||
if (folder.uid === this.props.selectedFolderUid) {
|
selectedFolder: await this.getFolder(),
|
||||||
this.setState({ selectedFolder: folder });
|
});
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private getCompletionNumber(){
|
private getCompletionNumber(){
|
||||||
@ -132,7 +132,8 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private doesFolderHaveCustomer(): boolean {
|
private doesFolderHaveCustomer(): boolean {
|
||||||
return this.state.selectedFolder?.office_folder_has_customers !== undefined;
|
if (!this.state.selectedFolder?.office_folder_has_customers) return false;
|
||||||
|
return this.state.selectedFolder?.office_folder_has_customers!.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private onSelectedFolder(folder: IDashBoardFolder): void {
|
private onSelectedFolder(folder: IDashBoardFolder): void {
|
||||||
@ -146,11 +147,30 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
private closeArchivedModal(): void {
|
private closeArchivedModal(): void {
|
||||||
this.setState({ isArchivedModalOpen: false });
|
this.setState({ isArchivedModalOpen: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async onArchivedModalAccepted() {
|
||||||
|
if (!this.state.selectedFolder) return;
|
||||||
|
await Folders.getInstance().archive(this.state.selectedFolder.uid, this.state.selectedFolder);
|
||||||
|
this.closeArchivedModal();
|
||||||
|
this.props.router.push(Module.getInstance().get().modules.pages.Folder.props.path);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async getFolder(): Promise<OfficeFolder> {
|
||||||
|
const query = {
|
||||||
|
q: {
|
||||||
|
deed: { include: { deed_type: true } },
|
||||||
|
office: true,
|
||||||
|
office_folder_has_customers: { include: { customer: { include: { contact: true } } } },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const folder = await Folders.getInstance().getByUid(this.props.selectedFolderUid, query);
|
||||||
|
return folder;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function FolderInformation(props: IProps) {
|
export default function FolderInformation(props: IProps) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
let { folderUid } = router.query;
|
let { folderUid } = router.query;
|
||||||
folderUid = folderUid as string;
|
folderUid = folderUid as string;
|
||||||
return <FolderInformationClass {...props} selectedFolderUid={folderUid} />;
|
return <FolderInformationClass {...props} selectedFolderUid={folderUid} router={router} />;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ class UpdateFolderCollaboratorsClass extends BasePage<IPropsClass, IState> {
|
|||||||
<Form className={classes["form"]}>
|
<Form className={classes["form"]}>
|
||||||
<div className={classes["content"]}>
|
<div className={classes["content"]}>
|
||||||
<RadioBox name="office" value={ERadioBoxValue.ALL} defaultChecked onChange={this.onSelectedOptionAllOffice}>
|
<RadioBox name="office" value={ERadioBoxValue.ALL} defaultChecked onChange={this.onSelectedOptionAllOffice}>
|
||||||
Tout l’office
|
Tout l'office
|
||||||
</RadioBox>
|
</RadioBox>
|
||||||
<RadioBox name="office" value={ERadioBoxValue.SELECTION} onChange={this.onSelectedOptionSpecific}>
|
<RadioBox name="office" value={ERadioBoxValue.SELECTION} onChange={this.onSelectedOptionSpecific}>
|
||||||
Sélectionner des collaborateurs
|
Sélectionner des collaborateurs
|
||||||
|
@ -1,33 +1,40 @@
|
|||||||
|
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 Form from "@Front/Components/DesignSystem/Form";
|
import Form from "@Front/Components/DesignSystem/Form";
|
||||||
import InputField from "@Front/Components/DesignSystem/Form/Elements/InputField";
|
import InputField from "@Front/Components/DesignSystem/Form/Elements/InputField";
|
||||||
import Select, { IOption } from "@Front/Components/DesignSystem/Select";
|
import Select, { IOption } from "@Front/Components/DesignSystem/Select";
|
||||||
import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography";
|
import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography";
|
||||||
import BackArrow from "@Front/Components/Elements/BackArrow";
|
import BackArrow from "@Front/Components/Elements/BackArrow";
|
||||||
import { folders } from "@Front/Components/Layouts/DesignSystem/dummyData";
|
|
||||||
import DefaultNotaryDashboard, { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
|
import DefaultNotaryDashboard, { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
|
||||||
import Module from "@Front/Config/Module";
|
import Module from "@Front/Config/Module";
|
||||||
|
import { OfficeFolder } from "le-coffre-resources/dist/Notary";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
import BasePage from "../../Base";
|
import BasePage from "../../Base";
|
||||||
import classes from "./classes.module.scss";
|
import classes from "./classes.module.scss";
|
||||||
|
|
||||||
type IProps = {
|
import "reflect-metadata";
|
||||||
folder: IDashBoardFolder | null;
|
|
||||||
|
type IProps = {};
|
||||||
|
|
||||||
|
type IPropsClass = IProps & {
|
||||||
|
folderUid: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type IState = {
|
type IState = {
|
||||||
selectedFolder: IDashBoardFolder | null;
|
selectedFolder: IDashBoardFolder | null;
|
||||||
selectedOption?: IOption;
|
selectedOption?: IOption;
|
||||||
};
|
};
|
||||||
class UpdateFolderMetadataClass extends BasePage<IProps, IState> {
|
class UpdateFolderMetadataClass extends BasePage<IPropsClass, IState> {
|
||||||
constructor(props: IProps) {
|
constructor(props: IPropsClass) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
selectedFolder: null,
|
selectedFolder: null,
|
||||||
};
|
};
|
||||||
this.onSelectedFolder = this.onSelectedFolder.bind(this);
|
this.onSelectedFolder = this.onSelectedFolder.bind(this);
|
||||||
this.onSelectedOption = this.onSelectedOption.bind(this);
|
this.onSelectedOption = this.onSelectedOption.bind(this);
|
||||||
|
this.getFolder = this.getFolder.bind(this);
|
||||||
}
|
}
|
||||||
public override render(): JSX.Element {
|
public override render(): JSX.Element {
|
||||||
const selectOptions = [
|
const selectOptions = [
|
||||||
@ -37,7 +44,7 @@ class UpdateFolderMetadataClass extends BasePage<IProps, IState> {
|
|||||||
];
|
];
|
||||||
const backwardPath = Module.getInstance()
|
const backwardPath = Module.getInstance()
|
||||||
.get()
|
.get()
|
||||||
.modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", this.props.folder?.uid!);
|
.modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", this.state.selectedFolder?.uid!);
|
||||||
return (
|
return (
|
||||||
<DefaultNotaryDashboard title={"Ajouter client(s)"} onSelectedFolder={this.onSelectedFolder}>
|
<DefaultNotaryDashboard title={"Ajouter client(s)"} onSelectedFolder={this.onSelectedFolder}>
|
||||||
<div className={classes["root"]}>
|
<div className={classes["root"]}>
|
||||||
@ -48,23 +55,24 @@ class UpdateFolderMetadataClass extends BasePage<IProps, IState> {
|
|||||||
|
|
||||||
<Form className={classes["form"]}>
|
<Form className={classes["form"]}>
|
||||||
<div className={classes["content"]}>
|
<div className={classes["content"]}>
|
||||||
<InputField name="input field" fakeplaceholder="Intitulé du dossier" defaultValue={this.props.folder?.name} />
|
<InputField name="input field" fakeplaceholder="Intitulé du dossier" defaultValue={this.state.selectedFolder?.name} />
|
||||||
<InputField
|
<InputField
|
||||||
name="input field"
|
name="input field"
|
||||||
fakeplaceholder="Numéro de dossier"
|
fakeplaceholder="Numéro de dossier"
|
||||||
defaultValue={this.props.folder?.folder_number}
|
defaultValue={this.state.selectedFolder?.folder_number}
|
||||||
/>
|
/>
|
||||||
<Select
|
<Select
|
||||||
options={selectOptions}
|
options={selectOptions}
|
||||||
onChange={this.onSelectedOption}
|
onChange={this.onSelectedOption}
|
||||||
placeholder={"Type d’acte"}
|
placeholder={"Type d'acte"}
|
||||||
selectedOption={this.state.selectedOption}
|
selectedOption={this.state.selectedOption}
|
||||||
/>
|
/>
|
||||||
<InputField
|
{/* <InputField
|
||||||
name="input field"
|
name="input field"
|
||||||
|
type="date"
|
||||||
fakeplaceholder="Ouverture du dossier"
|
fakeplaceholder="Ouverture du dossier"
|
||||||
defaultValue={formatDate(this.props.folder?.created_at!)}
|
defaultValue={this.state.selectedFolder?.created_at?.toString() as string}
|
||||||
/>
|
/> */}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={classes["button-container"]}>
|
<div className={classes["button-container"]}>
|
||||||
@ -79,13 +87,27 @@ class UpdateFolderMetadataClass extends BasePage<IProps, IState> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override componentDidMount(): void {
|
public override async componentDidMount() {
|
||||||
|
const folder = await this.getFolder();
|
||||||
this.setState({
|
this.setState({
|
||||||
|
selectedFolder: folder,
|
||||||
selectedOption: {
|
selectedOption: {
|
||||||
label: this.props.folder?.deed.deed_type?.name ?? "",
|
label: folder?.deed.deed_type?.name ?? "",
|
||||||
value: this.props.folder?.deed.deed_type?.uid ?? "",
|
value: folder?.deed.deed_type?.uid ?? "",
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private async getFolder(): Promise<OfficeFolder> {
|
||||||
|
const query = {
|
||||||
|
q: {
|
||||||
|
deed: { include: { deed_type: true } },
|
||||||
|
office: true,
|
||||||
|
office_folder_has_customers: { include: { customer: { include: { contact: true } } } },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const folder = await Folders.getInstance().getByUid(this.props.folderUid, query);
|
||||||
|
return folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private onSelectedOption(option: IOption) {
|
private onSelectedOption(option: IOption) {
|
||||||
@ -99,19 +121,9 @@ class UpdateFolderMetadataClass extends BasePage<IProps, IState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function UpdateFolderMetadata() {
|
export default function UpdateFolderMetadata(props: IProps) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
let { folderUid } = router.query;
|
let { folderUid } = router.query;
|
||||||
folderUid = folderUid as string;
|
folderUid = folderUid as string;
|
||||||
const folder = folders.find((folder) => folder.uid === folderUid) ?? null;
|
return <UpdateFolderMetadataClass folderUid={folderUid} />;
|
||||||
return <UpdateFolderMetadataClass folder={folder} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatDate(date: Date | null): string {
|
|
||||||
if (!date) return "...";
|
|
||||||
return date.toLocaleDateString("fr-FR", {
|
|
||||||
year: "numeric",
|
|
||||||
month: "long",
|
|
||||||
day: "numeric",
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
@ -5,17 +5,20 @@ import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
|||||||
import FolderBoxInformation, { EFolderBoxInformationType } from "@Front/Components/DesignSystem/FolderBoxInformation";
|
import FolderBoxInformation, { EFolderBoxInformationType } from "@Front/Components/DesignSystem/FolderBoxInformation";
|
||||||
import QuantityProgressBar from "@Front/Components/DesignSystem/QuantityProgressBar";
|
import QuantityProgressBar from "@Front/Components/DesignSystem/QuantityProgressBar";
|
||||||
import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography";
|
import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography";
|
||||||
import { folders } from "@Front/Components/Layouts/DesignSystem/dummyData";
|
|
||||||
import DefaultNotaryDashboard, { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
|
import DefaultNotaryDashboard, { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
|
||||||
import { useRouter } from "next/router";
|
import { NextRouter, useRouter } from "next/router";
|
||||||
|
|
||||||
import BasePage from "../../Base";
|
import BasePage from "../../Base";
|
||||||
import classes from "./classes.module.scss";
|
import classes from "./classes.module.scss";
|
||||||
import ClientSection from "./ClientSection";
|
import ClientSection from "./ClientSection";
|
||||||
|
import { OfficeFolder } from "le-coffre-resources/dist/Customer";
|
||||||
|
import Folders from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders";
|
||||||
|
import Module from "@Front/Config/Module";
|
||||||
|
|
||||||
type IProps = {};
|
type IProps = {};
|
||||||
|
|
||||||
type IPropsClass = IProps & {
|
type IPropsClass = IProps & {
|
||||||
|
router: NextRouter;
|
||||||
selectedFolderUid: string;
|
selectedFolderUid: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -33,6 +36,7 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
this.onSelectedFolder = this.onSelectedFolder.bind(this);
|
this.onSelectedFolder = this.onSelectedFolder.bind(this);
|
||||||
this.openArchivedModal = this.openArchivedModal.bind(this);
|
this.openArchivedModal = this.openArchivedModal.bind(this);
|
||||||
this.closeArchivedModal = this.closeArchivedModal.bind(this);
|
this.closeArchivedModal = this.closeArchivedModal.bind(this);
|
||||||
|
this.restoreFolder = this.restoreFolder.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Message if the user has not created any folder yet
|
// TODO: Message if the user has not created any folder yet
|
||||||
@ -101,13 +105,8 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
public override async componentDidMount() {
|
public override async componentDidMount() {
|
||||||
// TODO : GET Current folder from the api
|
const folder = await this.getFolder();
|
||||||
for (const folder of folders) {
|
this.setState({ selectedFolder: folder });
|
||||||
if (folder.uid === this.props.selectedFolderUid) {
|
|
||||||
this.setState({ selectedFolder: folder });
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private doesFolderHaveCustomer(): boolean {
|
private doesFolderHaveCustomer(): boolean {
|
||||||
@ -118,8 +117,12 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
this.setState({ selectedFolder: folder });
|
this.setState({ selectedFolder: folder });
|
||||||
}
|
}
|
||||||
|
|
||||||
private restoreFolder() {}
|
private async restoreFolder() {
|
||||||
// should call the api to restore the folder
|
if (!this.state.selectedFolder) return;
|
||||||
|
await Folders.getInstance().restore(this.state.selectedFolder.uid, this.state.selectedFolder);
|
||||||
|
this.props.router.push(Module.getInstance().get().modules.pages.Folder.pages.FolderArchived.props.path);
|
||||||
|
}
|
||||||
|
|
||||||
private openArchivedModal(): void {
|
private openArchivedModal(): void {
|
||||||
this.setState({ isArchivedModalOpen: true });
|
this.setState({ isArchivedModalOpen: true });
|
||||||
}
|
}
|
||||||
@ -127,11 +130,23 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
private closeArchivedModal(): void {
|
private closeArchivedModal(): void {
|
||||||
this.setState({ isArchivedModalOpen: false });
|
this.setState({ isArchivedModalOpen: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async getFolder(): Promise<OfficeFolder> {
|
||||||
|
const query = {
|
||||||
|
q: {
|
||||||
|
deed: { include: { deed_type: "true" } },
|
||||||
|
office: "true",
|
||||||
|
office_folder_has_customers: { include: { customer: { include: { contact: true } } } },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const folder = await Folders.getInstance().getByUid(this.props.selectedFolderUid, query);
|
||||||
|
return folder;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function FolderInformation(props: IProps) {
|
export default function FolderInformation(props: IProps) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
let { folderUid } = router.query;
|
let { folderUid } = router.query;
|
||||||
folderUid = folderUid as string;
|
folderUid = folderUid as string;
|
||||||
return <FolderInformationClass {...props} selectedFolderUid={folderUid} />;
|
return <FolderInformationClass {...props} selectedFolderUid={folderUid} router={router} />;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ class UpdateFolderMetadataClass extends BasePage<IProps, IState> {
|
|||||||
<Select
|
<Select
|
||||||
options={selectOptions}
|
options={selectOptions}
|
||||||
onChange={this.onSelectedOption}
|
onChange={this.onSelectedOption}
|
||||||
placeholder={"Type d’acte"}
|
placeholder={"Type d'acte"}
|
||||||
selectedOption={this.state.selectedOption}
|
selectedOption={this.state.selectedOption}
|
||||||
/>
|
/>
|
||||||
<InputField name="input field" fakeplaceholder="Ouverture du dossier" />
|
<InputField name="input field" fakeplaceholder="Ouverture du dossier" />
|
||||||
|
@ -17,11 +17,11 @@ export default class LoginClass extends BasePage {
|
|||||||
<Typography typo={ITypo.H1}>
|
<Typography typo={ITypo.H1}>
|
||||||
<div className={classes["title"]}>Connexion espace professionnel</div>
|
<div className={classes["title"]}>Connexion espace professionnel</div>
|
||||||
</Typography>
|
</Typography>
|
||||||
<Button onClick={this.redirectUserOnConnection}>S’identifier avec ID.not</Button>
|
<Button onClick={this.redirectUserOnConnection}>S'identifier avec ID.not</Button>
|
||||||
<Typography typo={ITypo.P_18}>
|
<Typography typo={ITypo.P_18}>
|
||||||
<div className={classes["forget-password"]}>Vous n’arrivez pas à vous connecter ?</div>
|
<div className={classes["forget-password"]}>Vous n'arrivez pas à vous connecter ?</div>
|
||||||
</Typography>
|
</Typography>
|
||||||
<Button variant={EButtonVariant.LINE}>Contacter l’administrateur</Button>
|
<Button variant={EButtonVariant.LINE}>Contacter l'administrateur</Button>
|
||||||
</div>
|
</div>
|
||||||
</DefaultDoubleSidePage>
|
</DefaultDoubleSidePage>
|
||||||
);
|
);
|
||||||
|
@ -32,11 +32,11 @@ type IPropsClass = {};
|
|||||||
// <Loader />
|
// <Loader />
|
||||||
// <Typography typo={ITypo.P_18}>
|
// <Typography typo={ITypo.P_18}>
|
||||||
// <div className={classes["forget-password"]}>
|
// <div className={classes["forget-password"]}>
|
||||||
// Vous n’arrivez pas à vous connecter ?
|
// Vous n'arrivez pas à vous connecter ?
|
||||||
// </div>
|
// </div>
|
||||||
// </Typography>
|
// </Typography>
|
||||||
// <Button variant={EButtonVariant.LINE}>
|
// <Button variant={EButtonVariant.LINE}>
|
||||||
// Contacter l’administrateur
|
// Contacter l'administrateur
|
||||||
// </Button>
|
// </Button>
|
||||||
// </div>
|
// </div>
|
||||||
// </DefaultDoubleSidePage>
|
// </DefaultDoubleSidePage>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user