From 223a57f89265ca26fe01e0440d574aa4279b0f72 Mon Sep 17 00:00:00 2001 From: Vins Date: Fri, 22 Nov 2024 09:12:24 +0100 Subject: [PATCH 1/7] View document notary --- .../DocumentsNotary/DocumentsNotary.ts | 12 + .../Api/LeCoffreApi/Customer/Files/Files.ts | 10 + .../ReceivedDocuments/index.tsx | 31 ++- .../ViewDocumentsNotary/classes.module.scss | 77 ++++++ .../ViewDocumentsNotary/index.tsx | 242 ++++++++++++++++++ src/front/Config/Module/development.json | 7 + src/front/Config/Module/preprod.json | 7 + src/front/Config/Module/production.json | 7 + src/front/Config/Module/staging.json | 7 + .../documentNotary/[documentUid]/index.tsx | 5 + 10 files changed, 401 insertions(+), 4 deletions(-) create mode 100644 src/front/Components/Layouts/ClientDashboard/ViewDocumentsNotary/classes.module.scss create mode 100644 src/front/Components/Layouts/ClientDashboard/ViewDocumentsNotary/index.tsx create mode 100644 src/pages/client-dashboard/[folderUid]/documentNotary/[documentUid]/index.tsx diff --git a/src/front/Api/LeCoffreApi/Customer/DocumentsNotary/DocumentsNotary.ts b/src/front/Api/LeCoffreApi/Customer/DocumentsNotary/DocumentsNotary.ts index 508ffd71..00036c2d 100644 --- a/src/front/Api/LeCoffreApi/Customer/DocumentsNotary/DocumentsNotary.ts +++ b/src/front/Api/LeCoffreApi/Customer/DocumentsNotary/DocumentsNotary.ts @@ -35,4 +35,16 @@ export default class DocumentsNotary extends BaseCustomer { return Promise.reject(err); } } + + public async getByUid(uid: string, q?: any): Promise { + const url = new URL(this.baseURl.concat(`/${uid}`)); + const query = { q }; + Object.entries(query).forEach(([key, value]) => url.searchParams.set(key, JSON.stringify(value))); + try { + return await this.getRequest(url); + } catch (err) { + this.onError(err); + return Promise.reject(err); + } + } } diff --git a/src/front/Api/LeCoffreApi/Customer/Files/Files.ts b/src/front/Api/LeCoffreApi/Customer/Files/Files.ts index 6ae12cf0..75aebd53 100644 --- a/src/front/Api/LeCoffreApi/Customer/Files/Files.ts +++ b/src/front/Api/LeCoffreApi/Customer/Files/Files.ts @@ -90,4 +90,14 @@ export default class Files extends BaseCustomer { return Promise.reject(err); } } + + public async download(uid: string): Promise { + const url = new URL(this.baseURl.concat(`/download/${uid}`)); + try { + return await this.getRequest(url); + } catch (err) { + this.onError(err); + return Promise.reject(err); + } + } } diff --git a/src/front/Components/Layouts/ClientDashboard/ReceivedDocuments/index.tsx b/src/front/Components/Layouts/ClientDashboard/ReceivedDocuments/index.tsx index 7c7f49fd..014498a4 100644 --- a/src/front/Components/Layouts/ClientDashboard/ReceivedDocuments/index.tsx +++ b/src/front/Components/Layouts/ClientDashboard/ReceivedDocuments/index.tsx @@ -9,7 +9,7 @@ import BackArrow from "@Front/Components/Elements/BackArrow"; import DefaultTemplate from "@Front/Components/LayoutTemplates/DefaultTemplate"; import Module from "@Front/Config/Module"; import JwtService from "@Front/Services/JwtService/JwtService"; -import { ArrowDownTrayIcon } from "@heroicons/react/24/outline"; +import { ArrowDownTrayIcon, EyeIcon } from "@heroicons/react/24/outline"; import { saveAs } from "file-saver"; import JSZip from "jszip"; import DocumentNotary from "le-coffre-resources/dist/Notary/DocumentNotary"; @@ -17,6 +17,7 @@ import { useRouter } from "next/router"; import React, { useCallback, useEffect, useState } from "react"; import classes from "./classes.module.scss"; +import Link from "next/link"; const header: readonly IHead[] = [ { @@ -100,7 +101,7 @@ export default function ReceivedDocuments() { Un document vous a été envoyé - +
+ + + + )} + {(!this.state.selectedFile || !this.state.documentNotary) && !this.state.isLoading && ( +
+ + Document non trouvé + +
+ )} + + ); + } + + override async componentDidMount() { + try { + const documentNotary = await DocumentsNotary.getInstance().getByUid(this.props.documentUid, { + files: true, + folder: true, + depositor: true, + }); + console.log(documentNotary); + + this.setState( + { + documentNotary, + selectedFileIndex: 0, + selectedFile: documentNotary.files![0]!, + isLoading: false, + }, + () => { + this.getFilePreview(); + }, + ); + } catch (e) { + this.setState({ + isLoading: false, + }); + console.error(e); + } + } + + private async getFilePreview(): Promise { + try { + const fileBlob: Blob = await FilesNotary.getInstance().download(this.state.selectedFile?.uid as string, this.props.documentUid); + + this.setState({ + fileBlob, + }); + } catch (e) { + console.error(e); + } + } + + private downloadFile() { + if (!this.state.fileBlob) return; + const url = window.URL.createObjectURL(this.state.fileBlob); + const a = document.createElement("a"); + a.style.display = "none"; + a.href = url; + // the filename you want + a.download = this.state.selectedFile?.file_name as string; + document.body.appendChild(a); + a.click(); + window.URL.revokeObjectURL(url); + } + + private goToPrevious() { + const index = this.state.selectedFileIndex - 1; + if (this.hasPrevious()) { + this.setState( + { + selectedFile: this.state.documentNotary!.files![index]!, + selectedFileIndex: index, + fileBlob: null, + }, + () => { + this.getFilePreview(); + }, + ); + } + } + + private goToNext() { + if (this.hasNext()) { + const index = this.state.selectedFileIndex + 1; + this.setState( + { + selectedFile: this.state.documentNotary!.files![index]!, + selectedFileIndex: index, + fileBlob: null, + }, + () => { + this.getFilePreview(); + }, + ); + } + } + + private hasPrevious() { + const index = this.state.selectedFileIndex - 1; + return index >= 0; + } + + private hasNext() { + const index = this.state.selectedFileIndex + 1; + return index < this.state.documentNotary!.files!.length; + } +} + +export default function ViewDocumentsNotary(props: IProps) { + const router = useRouter(); + let { folderUid, documentUid } = router.query; + documentUid = documentUid as string; + folderUid = folderUid as string; + return ; +} diff --git a/src/front/Config/Module/development.json b/src/front/Config/Module/development.json index e6628aad..12e7eb49 100644 --- a/src/front/Config/Module/development.json +++ b/src/front/Config/Module/development.json @@ -38,6 +38,13 @@ "labelKey": "client-dashboard" }, "pages": { + "ViewDocuments": { + "enabled": true, + "props": { + "path": "/client-dashboard/[folderUid]/documentNotary/[documentUid]", + "labelKey": "view_documents" + } + }, "ReceiveDocuments": { "enabled": true, "props": { diff --git a/src/front/Config/Module/preprod.json b/src/front/Config/Module/preprod.json index e6628aad..12e7eb49 100644 --- a/src/front/Config/Module/preprod.json +++ b/src/front/Config/Module/preprod.json @@ -38,6 +38,13 @@ "labelKey": "client-dashboard" }, "pages": { + "ViewDocuments": { + "enabled": true, + "props": { + "path": "/client-dashboard/[folderUid]/documentNotary/[documentUid]", + "labelKey": "view_documents" + } + }, "ReceiveDocuments": { "enabled": true, "props": { diff --git a/src/front/Config/Module/production.json b/src/front/Config/Module/production.json index e6628aad..12e7eb49 100644 --- a/src/front/Config/Module/production.json +++ b/src/front/Config/Module/production.json @@ -38,6 +38,13 @@ "labelKey": "client-dashboard" }, "pages": { + "ViewDocuments": { + "enabled": true, + "props": { + "path": "/client-dashboard/[folderUid]/documentNotary/[documentUid]", + "labelKey": "view_documents" + } + }, "ReceiveDocuments": { "enabled": true, "props": { diff --git a/src/front/Config/Module/staging.json b/src/front/Config/Module/staging.json index e6628aad..12e7eb49 100644 --- a/src/front/Config/Module/staging.json +++ b/src/front/Config/Module/staging.json @@ -38,6 +38,13 @@ "labelKey": "client-dashboard" }, "pages": { + "ViewDocuments": { + "enabled": true, + "props": { + "path": "/client-dashboard/[folderUid]/documentNotary/[documentUid]", + "labelKey": "view_documents" + } + }, "ReceiveDocuments": { "enabled": true, "props": { diff --git a/src/pages/client-dashboard/[folderUid]/documentNotary/[documentUid]/index.tsx b/src/pages/client-dashboard/[folderUid]/documentNotary/[documentUid]/index.tsx new file mode 100644 index 00000000..904ab317 --- /dev/null +++ b/src/pages/client-dashboard/[folderUid]/documentNotary/[documentUid]/index.tsx @@ -0,0 +1,5 @@ +import ViewDocumentsNotary from "@Front/Components/Layouts/ClientDashboard/ViewDocumentsNotary"; + +export default function Route() { + return ; +} From a5cf8ec31047f9a6598a3a8664dcbadd99796840 Mon Sep 17 00:00:00 2001 From: Vins Date: Mon, 25 Nov 2024 09:58:36 +0100 Subject: [PATCH 2/7] Customer document status --- .../classes.module.scss | 4 +++ .../DepositDocumentComponent/index.tsx | 34 ++++++++++++++----- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/front/Components/Layouts/ClientDashboard/DepositDocumentComponent/classes.module.scss b/src/front/Components/Layouts/ClientDashboard/DepositDocumentComponent/classes.module.scss index dc156ed8..ec485b20 100644 --- a/src/front/Components/Layouts/ClientDashboard/DepositDocumentComponent/classes.module.scss +++ b/src/front/Components/Layouts/ClientDashboard/DepositDocumentComponent/classes.module.scss @@ -17,6 +17,10 @@ text-decoration: underline !important; cursor: pointer; } + + .date { + color: var(--color-primary-500); + } } @media screen and (max-width: $screen-s) { diff --git a/src/front/Components/Layouts/ClientDashboard/DepositDocumentComponent/index.tsx b/src/front/Components/Layouts/ClientDashboard/DepositDocumentComponent/index.tsx index c0599f9c..645c60a3 100644 --- a/src/front/Components/Layouts/ClientDashboard/DepositDocumentComponent/index.tsx +++ b/src/front/Components/Layouts/ClientDashboard/DepositDocumentComponent/index.tsx @@ -72,18 +72,32 @@ export default function DepositDocumentComponent(props: IProps) { {document.document_type?.name ?? "_"} - Demandé le: {document.created_at ? new Date(document.created_at).toLocaleDateString() : "_"} + Demandé le:{" "} + {document.created_at ? new Date(document.created_at).toLocaleDateString() : "_"} {document.document_status === "REFUSED" && (
- Refusé le : {document.updated_at ? new Date(document.updated_at).toLocaleDateString() : "_"} + Refusé le :{" "} + + {document.updated_at ? new Date(document.updated_at).toLocaleDateString() : "_"} + Document non-conforme{" : "} Voir le motif de refus
)} + {document.document_status === "VALIDATED" && ( + + )} - + {document.document_status !== "VALIDATED" && ( + + )} ); } From 5f28aa926814a98013fa7e9ec08f96ccf5ccea9f Mon Sep 17 00:00:00 2001 From: Vins Date: Tue, 26 Nov 2024 10:21:27 +0100 Subject: [PATCH 3/7] Fixed notary doc on customer delete --- .../Folder/FolderInformation/ClientView/index.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/index.tsx index cddbb40e..fd9a3c22 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/index.tsx @@ -14,6 +14,7 @@ import classes from "./classes.module.scss"; import ClientBox from "./ClientBox"; import DocumentTables from "./DocumentTables"; import EmailReminder from "./EmailReminder"; +import DocumentsNotary from "@Front/Api/LeCoffreApi/Notary/DocumentsNotary/DocumentsNotary"; type IProps = { folder: OfficeFolder; @@ -57,8 +58,19 @@ export default function ClientView(props: IProps) { ); const handleClientDelete = useCallback( - (customerUid: string) => { + async (customerUid: string) => { if (!folder.uid) return; + const documentsNotary = await DocumentsNotary.getInstance().get({ + where: { customer: { uid: customerUid }, folder: { uid: folder.uid } }, + }); + console.log(documentsNotary); + + if (documentsNotary.length > 0) { + documentsNotary.forEach(async (doc) => { + await DocumentsNotary.getInstance().delete(doc.uid!); + }); + } + Folders.getInstance().put( folder.uid, OfficeFolder.hydrate({ From 0cb1b1709b3ddc88003b4dc510f83a2a1a5d1896 Mon Sep 17 00:00:00 2001 From: Vins Date: Thu, 28 Nov 2024 11:26:01 +0100 Subject: [PATCH 4/7] Reminders pagination --- .../DocumentReminders/DocumentReminders.ts | 16 ++ .../DesignSystem/Table/MuiTable/index.tsx | 5 +- .../classes.module.scss | 74 ++++++++- .../Folder/DocumentsReminderHistory/index.tsx | 153 +++++++++++++++++- 4 files changed, 236 insertions(+), 12 deletions(-) diff --git a/src/front/Api/LeCoffreApi/Notary/DocumentReminders/DocumentReminders.ts b/src/front/Api/LeCoffreApi/Notary/DocumentReminders/DocumentReminders.ts index 36b55ee2..2566eac9 100644 --- a/src/front/Api/LeCoffreApi/Notary/DocumentReminders/DocumentReminders.ts +++ b/src/front/Api/LeCoffreApi/Notary/DocumentReminders/DocumentReminders.ts @@ -7,6 +7,12 @@ export interface IGetDocumentRemindersparams { where?: {}; include?: {}; orderBy?: {}; + skip?: number; + take?: number; +} + +export interface IGetDocumentRemindersCountresponse { + count: number; } // TODO Type getbyuid query params @@ -38,4 +44,14 @@ export default class DocumentReminders extends BaseNotary { return Promise.reject(err); } } + + public count = async (): Promise => { + const url = new URL(this.baseURl.concat("/count")); + try { + return await this.getRequest(url); + } catch (err) { + this.onError(err); + return Promise.reject(err); + } + }; } diff --git a/src/front/Components/DesignSystem/Table/MuiTable/index.tsx b/src/front/Components/DesignSystem/Table/MuiTable/index.tsx index d02667a8..afcfb122 100644 --- a/src/front/Components/DesignSystem/Table/MuiTable/index.tsx +++ b/src/front/Components/DesignSystem/Table/MuiTable/index.tsx @@ -53,7 +53,7 @@ export default function MuiTable(props: IProps) { + sx={{ height: "45vh", overflowY: "auto", overflowX: "hidden", backgroundColor: "var(--table-background-default)" }}>
+ color={ETypoColor.COLOR_NEUTRAL_900}> {cell.value && typeof cell.value === "object" && "content" in cell.value ? cell.value.content : cell.value} diff --git a/src/front/Components/Layouts/Folder/DocumentsReminderHistory/classes.module.scss b/src/front/Components/Layouts/Folder/DocumentsReminderHistory/classes.module.scss index 38c6566e..974b2c85 100644 --- a/src/front/Components/Layouts/Folder/DocumentsReminderHistory/classes.module.scss +++ b/src/front/Components/Layouts/Folder/DocumentsReminderHistory/classes.module.scss @@ -8,11 +8,11 @@ align-items: flex-start; gap: var(--spacing-xl, 32px); - .table{ + .table { width: 100%; } - .customer-filter{ + .customer-filter { width: 472px; } @@ -23,4 +23,74 @@ @media screen and (max-width: $screen-s) { padding: var(--spacing-2); } + + .pagination { + display: flex; + align-items: center; + gap: 6px; /* Adds gap between each button */ + + .active { + background-color: var(--color-primary-800); /* Dark blue for active button */ + border-color: var(--color-primary-800); /* Dark blue border for active button */ + color: white; /* White text for active button */ + } + + button { + width: 50px; /* Fixed width */ + height: 50px; /* Fixed height */ + font-size: 14px; + text-align: center; + cursor: pointer; + transition: background-color 0.3s; + } + } + + // .pagination button { + // width: 40px; + // height: 40px; + // background-color: var(--color-primary-500); /* Light blue background for inactive buttons */ + // border: 1px solid var(--color-primary-500); /* Light blue border */ + // color: #ffffff; /* Text color for inactive buttons */ + // padding: 8px 16px; + // font-size: 14px; + // cursor: pointer; + // transition: background-color 0.3s; + + // &:hover { + // background-color: #b2ebf2; /* Lighter blue on hover */ + // } + + // &.active { + // background-color: var(--color-primary-800); /* Dark blue for active button */ + // border-color: var(--color-primary-800); /* Dark blue border for active button */ + // color: white; /* White text for active button */ + // } + + // &.disabled { + // background-color: #f1f1f1; /* Light gray background for disabled buttons */ + // color: #9e9e9e; /* Gray text for disabled buttons */ + // cursor: not-allowed; + // } + // } + + // .pagination button.prev, + // .pagination button.next { + // background-color: var(--color-primary-50); /* Dark teal background for Prev/Next buttons */ + // color: var(--color-primary-500); /* White text for Prev/Next buttons */ + // padding: 5px 10px; + // border-radius: 8px; /* Make the Prev/Next buttons circular */ + // font-size: 14px; + // border: none; /* Remove the border for a cleaner look */ + // } + + // .pagination button.prev:hover, + // .pagination button.next:hover { + // border-color: var(--button-contained-neutral-hovered-border); + // background: var(--button-contained-neutral-hovered-background); + // } + + // .pagination span { + // color: #00796b; /* Color for ellipsis */ + // font-size: 14px; + // } } diff --git a/src/front/Components/Layouts/Folder/DocumentsReminderHistory/index.tsx b/src/front/Components/Layouts/Folder/DocumentsReminderHistory/index.tsx index 8d637bc4..c5b1884e 100644 --- a/src/front/Components/Layouts/Folder/DocumentsReminderHistory/index.tsx +++ b/src/front/Components/Layouts/Folder/DocumentsReminderHistory/index.tsx @@ -16,6 +16,7 @@ import { useRouter } from "next/router"; import React, { useCallback, useEffect, useMemo, useState } from "react"; import classes from "./classes.module.scss"; +import Button, { EButtonstyletype, EButtonVariant } from "@Front/Components/DesignSystem/Button"; type IProps = {}; @@ -50,8 +51,21 @@ export default function DocumentsReminderHistory(props: IProps) { const [customers, setCustomers] = useState(null); const [customerOption, setCustomerOption] = useState(null); const router = useRouter(); + const [page, setPage] = useState(1); // Current page number + const [pageSize, setPageSize] = useState(10); // Number of items per page + const [totalPages, setTotalPages] = useState(1); // Total number of pages let { folderUid } = router.query; + const fetchTotalPages = useCallback(() => { + DocumentReminders.getInstance() + .count() + .then((response) => { + const totalPages = Math.ceil(response.count / pageSize); + setTotalPages(totalPages); + }) + .catch((e) => console.warn(e)); + }, [pageSize]); + const fetchReminders = useCallback(() => { DocumentReminders.getInstance() .get({ @@ -69,10 +83,14 @@ export default function DocumentsReminderHistory(props: IProps) { }, }, orderBy: { reminder_date: "desc" }, + skip: (page - 1) * pageSize, // Skip based on the page number + take: pageSize, // Take the number of items for the page + }) + .then((response) => { + setReminders(response); // Set the reminders }) - .then((reminders) => setReminders(reminders)) .catch((e) => console.warn(e)); - }, [customerOption]); + }, [customerOption, page, pageSize]); // Update on page change const fetchCustomers = useCallback(async () => { if (!folderUid) return; @@ -108,13 +126,64 @@ export default function DocumentsReminderHistory(props: IProps) { }, [customers]); useEffect(() => { + fetchTotalPages(); fetchReminders(); fetchCustomers(); - }, [fetchCustomers, fetchReminders]); + }, [fetchTotalPages, fetchCustomers, fetchReminders]); - const onSelectionChange = useCallback((option: IOption | null) => { - setCustomerOption(option ?? null); - }, []); + const generatePageNumbers = (currentPage: number, totalPages: number) => { + const pageNumbers = []; + const maxPagesToShow = 7; // Maximum number of page buttons, including ellipsis + + // Case 1: If total pages are <= 5, show all pages + if (totalPages <= 5) { + for (let i = 1; i <= totalPages; i++) { + pageNumbers.push(i); + } + } + // Case 2: If current page is <= 3, and totalPages > 5, show the first 4 pages + ellipsis + else if (currentPage <= 3) { + for (let i = 1; i <= 4; i++) { + pageNumbers.push(i); + } + pageNumbers.push("..."); + } + // Case 3: If current page is in the middle, show ellipses and surrounding pages + else if (currentPage > 3 && currentPage < totalPages - 2) { + pageNumbers.push("..."); + pageNumbers.push(currentPage - 1); + pageNumbers.push(currentPage); + pageNumbers.push(currentPage + 1); + pageNumbers.push("..."); + } + // Case 4: If current page is near the end, show ellipsis and last 4 pages + else if (currentPage >= totalPages - 2) { + pageNumbers.push("..."); + for (let i = totalPages - 3; i <= totalPages; i++) { + pageNumbers.push(i); + } + } + + // Ensure the pagination length is exactly maxPagesToShow (counting ellipses as one) + if (pageNumbers.length > maxPagesToShow) { + // Remove ellipsis at the start or end if pagination exceeds max length + if (pageNumbers[0] === "...") { + pageNumbers.shift(); // Remove first ellipsis if it's the first item + } + if (pageNumbers.length > maxPagesToShow && pageNumbers[pageNumbers.length - 1] === "...") { + pageNumbers.pop(); // Remove last ellipsis if it's the last item + } + } + + return pageNumbers; + }; + + // Handle page change + const handlePageChange = (newPage: number) => { + if (newPage >= 1 && newPage <= totalPages) { + setPage(newPage); + } + }; return ( @@ -131,11 +200,81 @@ export default function DocumentsReminderHistory(props: IProps) { setCustomerOption(option ?? null)} selectedOption={customerOption ?? customersOptions?.[0]} label="Client" /> + {/* Page Size Selector */} + { + setPageSize(parseInt(option.id, 10)); // Update the page size + setPage(1); // Reset the page to 1 + }} + label="Items par page" + /> +
+ +
+ {/* Left Arrow (Prev) */} + + {/* */} + + {/* Page numbers */} + {generatePageNumbers(page, totalPages).map((pageNum, index) => ( + + {pageNum === "..." ? ( + + ) : ( + + // + )} + + ))} + + {/* Right Arrow (Next) */} + + {/* */} +
); From 9c7fdd2eb9509ed9f865ccff93ca4dddf59f902f Mon Sep 17 00:00:00 2001 From: Vins Date: Sat, 30 Nov 2024 10:35:29 +0100 Subject: [PATCH 5/7] Fixed Add document popup --- src/front/Components/DesignSystem/Modal/classes.module.scss | 4 ++++ src/front/Components/DesignSystem/Modal/index.tsx | 4 +++- .../Folder/AskDocuments/ParameterDocuments/index.tsx | 6 ++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/front/Components/DesignSystem/Modal/classes.module.scss b/src/front/Components/DesignSystem/Modal/classes.module.scss index 66c25655..c8306d0e 100644 --- a/src/front/Components/DesignSystem/Modal/classes.module.scss +++ b/src/front/Components/DesignSystem/Modal/classes.module.scss @@ -46,6 +46,10 @@ min-width: 85vw; padding: 0; } + + &.fullheight { + min-height: 75vh; + } } .backdrop { diff --git a/src/front/Components/DesignSystem/Modal/index.tsx b/src/front/Components/DesignSystem/Modal/index.tsx index c2c6e229..91d7bb44 100644 --- a/src/front/Components/DesignSystem/Modal/index.tsx +++ b/src/front/Components/DesignSystem/Modal/index.tsx @@ -17,10 +17,11 @@ type IProps = { secondButton?: IButtonProps; fullwidth?: boolean; fullscreen?: boolean; + fullheight?: boolean; }; export default function Modal(props: IProps) { - const { isOpen, onClose, children, className, title, firstButton, secondButton, fullwidth, fullscreen } = props; + const { isOpen, onClose, children, className, title, firstButton, secondButton, fullwidth, fullscreen, fullheight } = props; if (!isOpen) return null; return ( @@ -33,6 +34,7 @@ export default function Modal(props: IProps) { className, fullwidth && classes["fullwidth"], fullscreen && classes["fullscreen"], + fullheight && classes["fullheight"], )}>
{title && {title}} diff --git a/src/front/Components/Layouts/Folder/AskDocuments/ParameterDocuments/index.tsx b/src/front/Components/Layouts/Folder/AskDocuments/ParameterDocuments/index.tsx index 7b457cfa..d96314ff 100644 --- a/src/front/Components/Layouts/Folder/AskDocuments/ParameterDocuments/index.tsx +++ b/src/front/Components/Layouts/Folder/AskDocuments/ParameterDocuments/index.tsx @@ -56,7 +56,6 @@ export default function ParameterDocuments(props: IProps) { }, []); const handleClose = useCallback(() => { - setFormattedOptions([]); setSelectedDocuments([]); setAddOrEditDocument("edit"); setVisibleDescription(""); @@ -83,6 +82,7 @@ export default function ParameterDocuments(props: IProps) { //await this.loadData(); handleClose(); + window.location.reload(); } catch (e) { console.error(e); } @@ -98,6 +98,7 @@ export default function ParameterDocuments(props: IProps) { //await this.loadData(); handleClose(); + window.location.reload(); } catch (e) { console.error(e); } @@ -122,7 +123,8 @@ export default function ParameterDocuments(props: IProps) { onClose={handleClose} firstButton={{ children: "Annuler", onClick: handleClose }} secondButton={{ children: "Ajouter", onClick: addDocument }} - title={"Ajouter un document"}> + title={"Ajouter un document"} + fullheight>
Date: Wed, 4 Dec 2024 08:57:27 +0100 Subject: [PATCH 6/7] Fixes --- .../DepositOtherDocument/index.tsx | 2 +- .../DepositDocumentComponent/index.tsx | 12 +++- .../Layouts/ClientDashboard/index.tsx | 66 +++++++++---------- .../ClientView/NoDocument/classes.module.scss | 1 + .../InformationSection/index.tsx | 10 ++- 5 files changed, 52 insertions(+), 39 deletions(-) diff --git a/src/front/Components/DesignSystem/DepositOtherDocument/index.tsx b/src/front/Components/DesignSystem/DepositOtherDocument/index.tsx index c91f55c9..e9b89df1 100644 --- a/src/front/Components/DesignSystem/DepositOtherDocument/index.tsx +++ b/src/front/Components/DesignSystem/DepositOtherDocument/index.tsx @@ -161,7 +161,7 @@ export default class DepositOtherDocument extends React.Component Ajouter un document diff --git a/src/front/Components/Layouts/ClientDashboard/DepositDocumentComponent/index.tsx b/src/front/Components/Layouts/ClientDashboard/DepositDocumentComponent/index.tsx index 645c60a3..a9d3c824 100644 --- a/src/front/Components/Layouts/ClientDashboard/DepositDocumentComponent/index.tsx +++ b/src/front/Components/Layouts/ClientDashboard/DepositDocumentComponent/index.tsx @@ -72,9 +72,19 @@ export default function DepositDocumentComponent(props: IProps) { {document.document_type?.name ?? "_"} - Demandé le:{" "} + Demandé le :{" "} {document.created_at ? new Date(document.created_at).toLocaleDateString() : "_"} + {document.document_status === "DEPOSITED" && ( + + )} {document.document_status === "REFUSED" && (
diff --git a/src/front/Components/Layouts/ClientDashboard/index.tsx b/src/front/Components/Layouts/ClientDashboard/index.tsx index 32ec9b31..d381df76 100644 --- a/src/front/Components/Layouts/ClientDashboard/index.tsx +++ b/src/front/Components/Layouts/ClientDashboard/index.tsx @@ -3,7 +3,7 @@ import Documents, { IGetDocumentsparams } from "@Front/Api/LeCoffreApi/Customer/ import Typography, { ETypo, ETypoColor } from "@Front/Components/DesignSystem/Typography"; -import Customer, { Document } from "le-coffre-resources/dist/Customer"; +import Customer, { Document, DocumentType } from "le-coffre-resources/dist/Customer"; import React, { useCallback, useEffect, useMemo, useState } from "react"; import { DocumentNotary, type OfficeFolder as OfficeFolderNotary } from "le-coffre-resources/dist/Notary"; @@ -15,7 +15,7 @@ import Folders from "@Front/Api/LeCoffreApi/Customer/Folders/Folders"; import Tag, { ETagColor } from "@Front/Components/DesignSystem/Tag"; import DefaultCustomerDashboard from "@Front/Components/LayoutTemplates/DefaultCustomerDashboard"; -import { EButtonstyletype, EButtonVariant } from "@Front/Components/DesignSystem/Button"; +import Button, { EButtonstyletype, EButtonVariant } from "@Front/Components/DesignSystem/Button"; import DepositDocumentComponent from "./DepositDocumentComponent"; import Module from "@Front/Config/Module"; import Separator, { ESeperatorColor, ESeperatorDirection } from "@Front/Components/DesignSystem/Separator"; @@ -23,7 +23,7 @@ import NotificationBox from "@Front/Components/DesignSystem/NotificationBox"; import ContactBox from "./ContactBox"; import DocumentsNotary from "@Front/Api/LeCoffreApi/Customer/DocumentsNotary/DocumentsNotary"; import { EDocumentNotaryStatus } from "le-coffre-resources/dist/Notary/DocumentNotary"; -// import DepositOtherDocument from "@Front/Components/DesignSystem/DepositOtherDocument"; +import DepositOtherDocument from "@Front/Components/DesignSystem/DepositOtherDocument"; type IProps = {}; @@ -35,7 +35,7 @@ export default function ClientDashboard(props: IProps) { const [customer, setCustomer] = useState(null); const [folder, setFolder] = useState(null); const [documentsNotary, setDocumentsNotary] = useState([]); - // const [isAddDocumentModalVisible, setIsAddDocumentModalVisible] = useState(false); + const [isAddDocumentModalVisible, setIsAddDocumentModalVisible] = useState(false); const fetchFolderAndCustomer = useCallback(async () => { let jwt: ICustomerJwtPayload | undefined; @@ -120,33 +120,31 @@ export default function ClientDashboard(props: IProps) { [documentsNotary], ); - // const onCloseModalAddDocument = useCallback(() => { - // setIsAddDocumentModalVisible(false); - // fetchFolderAndCustomer(); - // }, [fetchFolderAndCustomer]); + const onCloseModalAddDocument = useCallback(() => { + setIsAddDocumentModalVisible(false); + fetchFolderAndCustomer(); + }, [fetchFolderAndCustomer]); - // const onOpenModalAddDocument = useCallback(() => { - // setIsAddDocumentModalVisible(true); - // }, []); + const onOpenModalAddDocument = useCallback(() => { + setIsAddDocumentModalVisible(true); + }, []); - // const renderBox = useCallback(() => { - // console.log(folder!.office!.uid); - - // return ( - // ({ - // document_type: DocumentType.hydrate({ - // name: "Autres documents", - // office: folder!.office!, - // }), - // })} - // /> - // ); - // }, [customer, folderUid, isAddDocumentModalVisible, onCloseModalAddDocument]); + const renderBox = useCallback(() => { + return ( + ({ + document_type: DocumentType.hydrate({ + name: "Autres documents", + office: folder!.office!, + }), + })} + /> + ); + }, [customer, folderUid, isAddDocumentModalVisible, onCloseModalAddDocument]); return ( @@ -234,18 +232,18 @@ export default function ClientDashboard(props: IProps) { ))}
- {/*Documents supplémentaires (facultatif)*/} - {/* + Documents supplémentaires (facultatif) + Vous souhaitez envoyer d'autres documents à votre notaire ? - */} - {/* - {isAddDocumentModalVisible && renderBox()} */} + {isAddDocumentModalVisible && renderBox()}
); diff --git a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/NoDocument/classes.module.scss b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/NoDocument/classes.module.scss index 0594b1b7..5c3c3336 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/NoDocument/classes.module.scss +++ b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/NoDocument/classes.module.scss @@ -4,4 +4,5 @@ display: flex; flex-direction: column; gap: var(--spacing-xl, 32px); + width: 100%; } diff --git a/src/front/Components/Layouts/Folder/FolderInformation/InformationSection/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/InformationSection/index.tsx index 75d9e95e..6dff266c 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/InformationSection/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/InformationSection/index.tsx @@ -148,9 +148,13 @@ export default function InformationSection(props: IProps) { } variant={EIconButtonVariant.NEUTRAL} /> - - } variant={EIconButtonVariant.NEUTRAL} /> - + {/* If the folder is not archived, we can display the archive button */} + {anchorStatus !== "VERIFIED_ON_CHAIN" && ( + + } variant={EIconButtonVariant.NEUTRAL} /> + + )} + {!isArchived && } variant={EIconButtonVariant.ERROR} />}
From 8ec3030063d50cacb1511c57f2579b53821d0b44 Mon Sep 17 00:00:00 2001 From: Vins Date: Wed, 4 Dec 2024 15:31:19 +0100 Subject: [PATCH 7/7] Auto refresh on send other doc --- src/front/Components/DesignSystem/DepositOtherDocument/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/front/Components/DesignSystem/DepositOtherDocument/index.tsx b/src/front/Components/DesignSystem/DepositOtherDocument/index.tsx index e9b89df1..15f143a7 100644 --- a/src/front/Components/DesignSystem/DepositOtherDocument/index.tsx +++ b/src/front/Components/DesignSystem/DepositOtherDocument/index.tsx @@ -242,6 +242,7 @@ export default class DepositOtherDocument extends React.Component