Fix some bugs - continue
This commit is contained in:
parent
5ad6465b74
commit
ccc0a1620c
@ -92,4 +92,17 @@ export default class CustomerService {
|
|||||||
}).catch(reject);
|
}).catch(reject);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static updateCustomer(process: any, newData: any): Promise<void> {
|
||||||
|
return new Promise<void>((resolve: () => void, reject: (error: string) => void) => {
|
||||||
|
this.messageBus.updateProcess(process.processId, newData, [], null).then((processUpdated: any) => {
|
||||||
|
const newStateId: string = processUpdated.diffs[0]?.state_id;
|
||||||
|
this.messageBus.notifyUpdate(process.processId, newStateId).then(() => {
|
||||||
|
this.messageBus.validateState(process.processId, newStateId).then((_stateValidated) => {
|
||||||
|
resolve();
|
||||||
|
}).catch(reject);
|
||||||
|
}).catch(reject);
|
||||||
|
}).catch(reject);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,8 @@ import React, { useEffect, useState } from "react";
|
|||||||
|
|
||||||
import DefaultDashboardWithList, { IPropsDashboardWithList } from "../DefaultDashboardWithList";
|
import DefaultDashboardWithList, { IPropsDashboardWithList } from "../DefaultDashboardWithList";
|
||||||
|
|
||||||
|
import FolderService from "src/common/Api/LeCoffreApi/sdk/FolderService";
|
||||||
|
|
||||||
type IProps = IPropsDashboardWithList & {};
|
type IProps = IPropsDashboardWithList & {};
|
||||||
|
|
||||||
export default function DefaultCustomerDashboard(props: IProps) {
|
export default function DefaultCustomerDashboard(props: IProps) {
|
||||||
@ -19,6 +21,7 @@ export default function DefaultCustomerDashboard(props: IProps) {
|
|||||||
const jwt = JwtService.getInstance().decodeCustomerJwt();
|
const jwt = JwtService.getInstance().decodeCustomerJwt();
|
||||||
if (!jwt) return;
|
if (!jwt) return;
|
||||||
|
|
||||||
|
/*
|
||||||
Folders.getInstance()
|
Folders.getInstance()
|
||||||
.get({
|
.get({
|
||||||
q: {
|
q: {
|
||||||
@ -42,6 +45,14 @@ export default function DefaultCustomerDashboard(props: IProps) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((folders) => setFolders(folders));
|
.then((folders) => setFolders(folders));
|
||||||
|
*/
|
||||||
|
|
||||||
|
FolderService.getFolders().then((processes: any[]) => {
|
||||||
|
if (processes.length > 0) {
|
||||||
|
const folders: any[] = processes.map((process: any) => process.processData);
|
||||||
|
setFolders(folders);
|
||||||
|
}
|
||||||
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onSelectedBlock = (block: IBlock) => {
|
const onSelectedBlock = (block: IBlock) => {
|
||||||
@ -53,7 +64,7 @@ export default function DefaultCustomerDashboard(props: IProps) {
|
|||||||
.modules.pages.ClientDashboard.props.path.replace("[folderUid]", folder.uid ?? ""),
|
.modules.pages.ClientDashboard.props.path.replace("[folderUid]", folder.uid ?? ""),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
return <DefaultDashboardWithList {...props} onSelectedBlock={onSelectedBlock} blocks={getBlocks(folders)} headerConnected={false}/>;
|
return <DefaultDashboardWithList {...props} onSelectedBlock={onSelectedBlock} blocks={getBlocks(folders)} headerConnected={false} />;
|
||||||
|
|
||||||
function getBlocks(folders: OfficeFolder[]): IBlock[] {
|
function getBlocks(folders: OfficeFolder[]): IBlock[] {
|
||||||
return folders.map((folder) => {
|
return folders.map((folder) => {
|
||||||
|
@ -47,9 +47,11 @@ export default function ContactBox(props: IProps) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!folder?.office?.uid) return;
|
if (!folder?.office?.uid) return;
|
||||||
|
/* TODO: review
|
||||||
OfficeRib.getInstance()
|
OfficeRib.getInstance()
|
||||||
.getRibStream(folder.office.uid)
|
.getRibStream(folder.office.uid)
|
||||||
.then((blob) => setRibUrl(URL.createObjectURL(blob)));
|
.then((blob) => setRibUrl(URL.createObjectURL(blob)));
|
||||||
|
*/
|
||||||
}, [folder]);
|
}, [folder]);
|
||||||
|
|
||||||
const downloadRib = useCallback(async () => {
|
const downloadRib = useCallback(async () => {
|
||||||
|
@ -27,11 +27,12 @@ import DepositOtherDocument from "@Front/Components/DesignSystem/DepositOtherDoc
|
|||||||
|
|
||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
|
|
||||||
import MessageBus from "src/sdk/MessageBus";
|
|
||||||
|
|
||||||
import MapUtils from "src/sdk/MapUtils";
|
|
||||||
import AuthModal from "src/sdk/AuthModal";
|
import AuthModal from "src/sdk/AuthModal";
|
||||||
import FormModal from "./FormModal";
|
//import FormModal from "./FormModal";
|
||||||
|
|
||||||
|
import FolderService from "src/common/Api/LeCoffreApi/sdk/FolderService";
|
||||||
|
import DocumentService from "src/common/Api/LeCoffreApi/sdk/DocumentService";
|
||||||
|
import DocumentTypeService from "src/common/Api/LeCoffreApi/sdk/DocumentTypeService";
|
||||||
|
|
||||||
type IProps = {};
|
type IProps = {};
|
||||||
|
|
||||||
@ -48,40 +49,52 @@ export default function ClientDashboard(props: IProps) {
|
|||||||
const [isAddDocumentModalVisible, setIsAddDocumentModalVisible] = useState<boolean>(false);
|
const [isAddDocumentModalVisible, setIsAddDocumentModalVisible] = useState<boolean>(false);
|
||||||
|
|
||||||
const [isAuthModalOpen, setIsAuthModalOpen] = useState(false);
|
const [isAuthModalOpen, setIsAuthModalOpen] = useState(false);
|
||||||
const [isFormModalOpen, setIsFormModalOpen] = useState(false);
|
//const [isFormModalOpen, setIsFormModalOpen] = useState(false);
|
||||||
|
|
||||||
const fetchFolderAndCustomer = useCallback(async () => {
|
const fetchFolderAndCustomer = useCallback(async () => {
|
||||||
// TODO: review
|
// TODO: review
|
||||||
const { folder, customer, file } = await new Promise<any>((resolve) => {
|
const { folder, customer, file } = await new Promise<any>((resolve) => {
|
||||||
MessageBus.getInstance().isReady().then(() => {
|
FolderService.getFolderByUid(folderUid as string).then((process: any) => {
|
||||||
setTimeout(() => {
|
if (process) {
|
||||||
MessageBus.getInstance().getFolders().then(async (folders) => {
|
const folder: any = process.processData;
|
||||||
const folder: any = folders.find((folder: any) => folder.processData.uid === folderUid as string);
|
|
||||||
if (folder) {
|
|
||||||
const customer = folder.processData.customers
|
|
||||||
.map((customer: any) => MapUtils.toJson(customer))
|
|
||||||
.find((customer: any) => customer.uid === profileUid as string);
|
|
||||||
|
|
||||||
const file = await new Promise<any>((resolve: (file: any) => void) => {
|
const customers: any[] = folder.customers;
|
||||||
MessageBus.getInstance().getFiles().then((files: any) => {
|
const customer: any = customers.find((customer: any) => customer.uid === profileUid as string);
|
||||||
if (!files || files.length === 0) {
|
if (customer) {
|
||||||
resolve(null);
|
|
||||||
} else {
|
|
||||||
const file: any = files.find((file: any) => file.processData.folderUid === folderUid as string && file.processData.profileUid === profileUid as string);
|
|
||||||
if (file) {
|
|
||||||
resolve(file);
|
|
||||||
} else {
|
|
||||||
resolve(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).catch(() => resolve(null));
|
|
||||||
});
|
|
||||||
|
|
||||||
resolve({ folder: folder.processData, customer, file: file ? file.processData : null });
|
|
||||||
}
|
resolve({ folder: folder, customer, file: null });
|
||||||
});
|
}
|
||||||
}, 2500);
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
MessageBus.getInstance().getFolders().then(async (folders) => {
|
||||||
|
const folder: any = folders.find((folder: any) => folder.processData.uid === folderUid as string);
|
||||||
|
if (folder) {
|
||||||
|
const customer = folder.processData.customers
|
||||||
|
.map((customer: any) => MapUtils.toJson(customer))
|
||||||
|
.find((customer: any) => customer.uid === profileUid as string);
|
||||||
|
|
||||||
|
const file = await new Promise<any>((resolve: (file: any) => void) => {
|
||||||
|
MessageBus.getInstance().getFiles().then((files: any) => {
|
||||||
|
if (!files || files.length === 0) {
|
||||||
|
resolve(null);
|
||||||
|
} else {
|
||||||
|
const file: any = files.find((file: any) => file.processData.folderUid === folderUid as string && file.processData.profileUid === profileUid as string);
|
||||||
|
if (file) {
|
||||||
|
resolve(file);
|
||||||
|
} else {
|
||||||
|
resolve(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(() => resolve(null));
|
||||||
|
});
|
||||||
|
|
||||||
|
resolve({ folder: folder.processData, customer, file: file ? file.processData : null });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
*/
|
||||||
});
|
});
|
||||||
|
|
||||||
setCustomer(customer);
|
setCustomer(customer);
|
||||||
@ -135,6 +148,7 @@ export default function ClientDashboard(props: IProps) {
|
|||||||
|
|
||||||
const fetchDocuments = useCallback(
|
const fetchDocuments = useCallback(
|
||||||
(customerUid: string | undefined) => {
|
(customerUid: string | undefined) => {
|
||||||
|
/*
|
||||||
const query: IGetDocumentsparams = {
|
const query: IGetDocumentsparams = {
|
||||||
where: { depositor: { uid: customerUid }, folder_uid: folderUid as string },
|
where: { depositor: { uid: customerUid }, folder_uid: folderUid as string },
|
||||||
include: {
|
include: {
|
||||||
@ -157,6 +171,20 @@ export default function ClientDashboard(props: IProps) {
|
|||||||
return Documents.getInstance()
|
return Documents.getInstance()
|
||||||
.get(query)
|
.get(query)
|
||||||
.then((documents) => setDocuments(documents));
|
.then((documents) => setDocuments(documents));
|
||||||
|
*/
|
||||||
|
|
||||||
|
return DocumentService.getDocuments().then(async (processes: any[]) => {
|
||||||
|
if (processes.length > 0) {
|
||||||
|
const documents: any[] = processes.map((process: any) => process.processData);
|
||||||
|
|
||||||
|
for (const document of documents) {
|
||||||
|
const p: any = await DocumentTypeService.getDocumentTypeByUid(document.document_type.uid);
|
||||||
|
document.document_type = p.processData;
|
||||||
|
}
|
||||||
|
|
||||||
|
setDocuments(documents);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
[folderUid],
|
[folderUid],
|
||||||
);
|
);
|
||||||
@ -336,12 +364,15 @@ export default function ClientDashboard(props: IProps) {
|
|||||||
isOpen={isAuthModalOpen}
|
isOpen={isAuthModalOpen}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
setIsAuthModalOpen(false);
|
setIsAuthModalOpen(false);
|
||||||
|
/*
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setIsFormModalOpen(true);
|
setIsFormModalOpen(true);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
*/
|
||||||
}}
|
}}
|
||||||
/>}
|
/>}
|
||||||
|
|
||||||
|
{/*
|
||||||
<FormModal
|
<FormModal
|
||||||
isOpen={isFormModalOpen}
|
isOpen={isFormModalOpen}
|
||||||
onClose={() => setIsFormModalOpen(false)}
|
onClose={() => setIsFormModalOpen(false)}
|
||||||
@ -366,6 +397,7 @@ export default function ClientDashboard(props: IProps) {
|
|||||||
file: fileBlob
|
file: fileBlob
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/ *
|
||||||
MessageBus.getInstance().isReady().then(() => {
|
MessageBus.getInstance().isReady().then(() => {
|
||||||
MessageBus.getInstance().createFile(fileData, [], []).then((processCreated: any) => {
|
MessageBus.getInstance().createFile(fileData, [], []).then((processCreated: any) => {
|
||||||
MessageBus.getInstance().notifyUpdate(processCreated.processId, processCreated.process.states[0].state_id).then(() => {
|
MessageBus.getInstance().notifyUpdate(processCreated.processId, processCreated.process.states[0].state_id).then(() => {
|
||||||
@ -375,12 +407,14 @@ export default function ClientDashboard(props: IProps) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
* /
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
reader.readAsArrayBuffer(file);
|
reader.readAsArrayBuffer(file);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
*/}
|
||||||
</div>
|
</div>
|
||||||
</DefaultCustomerDashboard>
|
</DefaultCustomerDashboard>
|
||||||
);
|
);
|
||||||
|
@ -13,9 +13,10 @@ import BasePage from "../../Base";
|
|||||||
import classes from "./classes.module.scss";
|
import classes from "./classes.module.scss";
|
||||||
import Customer from "le-coffre-resources/dist/Customer";
|
import Customer from "le-coffre-resources/dist/Customer";
|
||||||
import Note from "le-coffre-resources/dist/Customer/Note";
|
import Note from "le-coffre-resources/dist/Customer/Note";
|
||||||
import Folders from "@Front/Api/LeCoffreApi/Customer/Folders/Folders";
|
|
||||||
import Notes from "@Front/Api/LeCoffreApi/Customer/Notes/Notes";
|
import Notes from "@Front/Api/LeCoffreApi/Customer/Notes/Notes";
|
||||||
import Customers from "@Front/Api/LeCoffreApi/Notary/Customers/Customers";
|
|
||||||
|
import FolderService from "src/common/Api/LeCoffreApi/sdk/FolderService";
|
||||||
|
import CustomerService from "src/common/Api/LeCoffreApi/sdk/CustomerService";
|
||||||
|
|
||||||
type IProps = {};
|
type IProps = {};
|
||||||
|
|
||||||
@ -76,9 +77,25 @@ class CreateCustomerNoteClass extends BasePage<IPropsClass, IState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override async componentDidMount() {
|
public override async componentDidMount() {
|
||||||
|
/* TODO: review
|
||||||
// const note = await Notes.getInstance().getByUid(this.props.noteUid, query);
|
// const note = await Notes.getInstance().getByUid(this.props.noteUid, query);
|
||||||
const folder = await Folders.getInstance().getByUid(this.props.folderUid, { note: true });
|
const folder = await Folders.getInstance().getByUid(this.props.folderUid, { note: true });
|
||||||
const customer = await Customers.getInstance().getByUid(this.props.customerUid);
|
const customer = await Customers.getInstance().getByUid(this.props.customerUid);
|
||||||
|
*/
|
||||||
|
|
||||||
|
const folder: any = await FolderService.getFolderByUid(this.props.folderUid).then((process: any) => {
|
||||||
|
if (process) {
|
||||||
|
const folder: any = process.processData;
|
||||||
|
return folder;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const customer: any = await CustomerService.getCustomerByUid(this.props.customerUid).then((process: any) => {
|
||||||
|
if (process) {
|
||||||
|
const customer: any = process.processData;
|
||||||
|
return customer;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//get the note of the folder that has customer_uid = this.props.customer.uid
|
//get the note of the folder that has customer_uid = this.props.customer.uid
|
||||||
// const folderNote = folder.notes?.find((note) => note.customer?.uid === this.props.customerUid);
|
// const folderNote = folder.notes?.find((note) => note.customer?.uid === this.props.customerUid);
|
||||||
|
@ -6,7 +6,8 @@ import Image from "next/image";
|
|||||||
import React, { useCallback, useState } from "react";
|
import React, { useCallback, useState } from "react";
|
||||||
|
|
||||||
import classes from "./classes.module.scss";
|
import classes from "./classes.module.scss";
|
||||||
import MessageBus from "src/sdk/MessageBus";
|
|
||||||
|
import FolderService from "src/common/Api/LeCoffreApi/sdk/FolderService";
|
||||||
|
|
||||||
type IProps = {
|
type IProps = {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
@ -23,25 +24,17 @@ export default function AnchoringModal(props: IProps) {
|
|||||||
setIsAnchoring(true);
|
setIsAnchoring(true);
|
||||||
|
|
||||||
// TODO: review
|
// TODO: review
|
||||||
MessageBus.getInstance().isReady().then(() => {
|
FolderService.getFolderByUid(folderUid as string).then((process: any) => {
|
||||||
MessageBus.getInstance().getFolders().then((folders: any) => {
|
if (process) {
|
||||||
const folder = folders.find((folder: any) => folder.processData.uid === folderUid);
|
FolderService.updateFolder(process, { status: '' }).then(() => {
|
||||||
if (folder) {
|
setIsAnchoring(false);
|
||||||
MessageBus.getInstance().updateProcess(folder.processId, { isArchived: 'true' }, [], null).then((processUpdated: any) => {
|
|
||||||
const newStateId: string = processUpdated.diffs[0]?.state_id;
|
|
||||||
MessageBus.getInstance().notifyUpdate(folder.processId, newStateId).then(() => {
|
|
||||||
MessageBus.getInstance().validateState(folder.processId, newStateId).then((_updatedProcess) => {
|
|
||||||
setIsAnchoring(false);
|
|
||||||
|
|
||||||
onAnchorSuccess();
|
onAnchorSuccess();
|
||||||
if (onClose) {
|
if (onClose) {
|
||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -50,7 +43,7 @@ export default function AnchoringModal(props: IProps) {
|
|||||||
setTimeout(resolve, timeoutDelay);
|
setTimeout(resolve, timeoutDelay);
|
||||||
});
|
});
|
||||||
setIsAnchoring(true);
|
setIsAnchoring(true);
|
||||||
|
|
||||||
return OfficeFolderAnchors.getInstance()
|
return OfficeFolderAnchors.getInstance()
|
||||||
.post(folderUid)
|
.post(folderUid)
|
||||||
.then(() => timeoutPromise)
|
.then(() => timeoutPromise)
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import backgroundImage from "@Assets/images/background_refonte.svg";
|
import backgroundImage from "@Assets/images/background_refonte.svg";
|
||||||
import Customers from "@Front/Api/LeCoffreApi/Notary/Customers/Customers";
|
|
||||||
import Button, { EButtonstyletype, EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
import Button, { EButtonstyletype, EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
||||||
import Form, { IBaseField } from "@Front/Components/DesignSystem/Form";
|
import Form, { IBaseField } from "@Front/Components/DesignSystem/Form";
|
||||||
import TextField from "@Front/Components/DesignSystem/Form/TextField";
|
import TextField from "@Front/Components/DesignSystem/Form/TextField";
|
||||||
@ -17,8 +16,7 @@ import { useRouter } from "next/router";
|
|||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import classes from "./classes.module.scss";
|
import classes from "./classes.module.scss";
|
||||||
|
|
||||||
import MessageBus from "src/sdk/MessageBus";
|
import CustomerService from "src/common/Api/LeCoffreApi/sdk/CustomerService";
|
||||||
import MapUtils from "src/sdk/MapUtils";
|
|
||||||
|
|
||||||
export default function UpdateClient() {
|
export default function UpdateClient() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@ -37,32 +35,14 @@ export default function UpdateClient() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchCustomer = async () => {
|
const fetchCustomer = async () => {
|
||||||
try {
|
try {
|
||||||
// TODO: review
|
CustomerService.getCustomerByUid(customerUid as string).then((process: any) => {
|
||||||
MessageBus.getInstance().isReady().then(() => {
|
if (process) {
|
||||||
MessageBus.getInstance().getFolders().then((folders: any) => {
|
const customer: any = process.processData;
|
||||||
const folder = folders.find((folder: any) => folder.processData.uid === folderUid as string);
|
if (customer) {
|
||||||
if (folder) {
|
setCustomer(customer);
|
||||||
const customers: any[] = folder.processData.customers.map((customer: any) => MapUtils.toJson(customer));
|
|
||||||
const customer: any = customers.find((customer: any) => customer.uid === customerUid as string);
|
|
||||||
if (customer) {
|
|
||||||
setCustomer(customer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
const customerData = await Customers.getInstance().getByUid(customerUid as string, {
|
|
||||||
contact: {
|
|
||||||
include: {
|
|
||||||
address: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
if (customerData) {
|
|
||||||
setCustomer(customerData);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to fetch customer", error);
|
console.error("Failed to fetch customer", error);
|
||||||
}
|
}
|
||||||
@ -89,34 +69,15 @@ export default function UpdateClient() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// TODO: review
|
|
||||||
MessageBus.getInstance().isReady().then(() => {
|
|
||||||
MessageBus.getInstance().getFolders().then((folders: any) => {
|
|
||||||
const folder = folders.find((folder: any) => folder.processData.uid === folderUid as string);
|
|
||||||
if (folder) {
|
|
||||||
const customers: any[] = folder.processData.customers.map((customer: any) => MapUtils.toJson(customer));
|
|
||||||
const customer: any = customers.find((customer: any) => customer.uid === customerUid as string);
|
|
||||||
if (customer) {
|
|
||||||
customer.contact = contact; // Update the contact
|
|
||||||
|
|
||||||
MessageBus.getInstance().updateProcess(folder.processId, { customers: customers }, [], null).then((processUpdated: any) => {
|
|
||||||
const newStateId: string = processUpdated.diffs[0]?.state_id;
|
|
||||||
MessageBus.getInstance().notifyUpdate(folder.processId, newStateId).then(() => {
|
|
||||||
MessageBus.getInstance().validateState(folder.processId, newStateId).then((_stateValidated) => {
|
|
||||||
router.push(backwardPath);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
|
||||||
await contact.validateOrReject?.({ groups: ["createCustomer"], forbidUnknownValues: false });
|
await contact.validateOrReject?.({ groups: ["createCustomer"], forbidUnknownValues: false });
|
||||||
await Customers.getInstance().put(customerUid as string, { contact });
|
CustomerService.getCustomerByUid(customerUid as string).then((process: any) => {
|
||||||
router.push(backwardPath);
|
if (process) {
|
||||||
*/
|
// TODO: review - address
|
||||||
|
CustomerService.updateCustomer(process, { contact: contact }).then(() => {
|
||||||
|
router.push(backwardPath);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
} catch (validationErrors) {
|
} catch (validationErrors) {
|
||||||
if (Array.isArray(validationErrors)) {
|
if (Array.isArray(validationErrors)) {
|
||||||
setValidationError(validationErrors as ValidationError[]);
|
setValidationError(validationErrors as ValidationError[]);
|
||||||
|
@ -18,6 +18,8 @@ import DefaultDoubleSidePage from "@Front/Components/LayoutTemplates/DefaultDoub
|
|||||||
import TextAreaField from "@Front/Components/DesignSystem/Form/TextareaField";
|
import TextAreaField from "@Front/Components/DesignSystem/Form/TextareaField";
|
||||||
import { isArray } from "class-validator";
|
import { isArray } from "class-validator";
|
||||||
|
|
||||||
|
import FolderService from "src/common/Api/LeCoffreApi/sdk/FolderService";
|
||||||
|
|
||||||
export default function UpdateFolderMetadata() {
|
export default function UpdateFolderMetadata() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
@ -63,6 +65,8 @@ export default function UpdateFolderMetadata() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!folderUid || isArray(folderUid)) return;
|
if (!folderUid || isArray(folderUid)) return;
|
||||||
|
|
||||||
|
/* TODO: review
|
||||||
const query = {
|
const query = {
|
||||||
q: {
|
q: {
|
||||||
deed: { include: { deed_type: true } },
|
deed: { include: { deed_type: true } },
|
||||||
@ -73,6 +77,14 @@ export default function UpdateFolderMetadata() {
|
|||||||
Folders.getInstance()
|
Folders.getInstance()
|
||||||
.getByUid(folderUid, query)
|
.getByUid(folderUid, query)
|
||||||
.then((folder) => setSelectedFolder(folder));
|
.then((folder) => setSelectedFolder(folder));
|
||||||
|
*/
|
||||||
|
|
||||||
|
FolderService.getFolderByUid(folderUid).then((process: any) => {
|
||||||
|
if (process) {
|
||||||
|
const folder: any = process.processData;
|
||||||
|
setSelectedFolder(folder);
|
||||||
|
}
|
||||||
|
});
|
||||||
}, [folderUid]);
|
}, [folderUid]);
|
||||||
|
|
||||||
const backwardPath = Module.getInstance()
|
const backwardPath = Module.getInstance()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user