From 0a897124890978adf0fdbb59a39db2d8d6b2e8f9 Mon Sep 17 00:00:00 2001 From: Vins Date: Mon, 9 Dec 2024 10:12:44 +0100 Subject: [PATCH] Fixing delete client popup --- .../FolderInformation/ClientView/ClientBox/index.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/ClientBox/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/ClientBox/index.tsx index a99ad14d..45394578 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/ClientBox/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/ClientBox/index.tsx @@ -12,6 +12,7 @@ import { useCallback } from "react"; import { AnchorStatus } from "../.."; import classes from "./classes.module.scss"; import DeleteCustomerModal from "./DeleteCustomerModal"; +import Documents from "@Front/Api/LeCoffreApi/Notary/Documents/Documents"; type IProps = { customer: Customer; @@ -28,8 +29,12 @@ export default function ClientBox(props: IProps) { const { isOpen: isErrorModalOpen, open: openErrorModal, close: closeErrorModal } = useOpenable(); const handleDelete = useCallback( - (customerUid: string) => { - if (customer.documents && customer.documents.length > 0) { + async (customerUid: string) => { + console.log(customer); + const documents = await Documents.getInstance().get({ where: { depositor_uid: customerUid, folder_uid: folderUid } }); + console.log(documents); + + if (documents && documents.length > 0) { closeDeleteModal(); openErrorModal(); return;