From 6039f5f778df1aed542a32b9b7035c74309f2d41 Mon Sep 17 00:00:00 2001 From: Vins Date: Thu, 10 Apr 2025 16:29:16 +0200 Subject: [PATCH] Fixed historique de relance --- .../DocumentReminders/DocumentReminders.ts | 6 ++++-- .../Folder/DocumentsReminderHistory/index.tsx | 21 ++++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/front/Api/LeCoffreApi/Notary/DocumentReminders/DocumentReminders.ts b/src/front/Api/LeCoffreApi/Notary/DocumentReminders/DocumentReminders.ts index 2566eac9..4b331da3 100644 --- a/src/front/Api/LeCoffreApi/Notary/DocumentReminders/DocumentReminders.ts +++ b/src/front/Api/LeCoffreApi/Notary/DocumentReminders/DocumentReminders.ts @@ -45,13 +45,15 @@ export default class DocumentReminders extends BaseNotary { } } - public count = async (): Promise => { + public async count(q: IGetDocumentRemindersparams): Promise { const url = new URL(this.baseURl.concat("/count")); + 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/Components/Layouts/Folder/DocumentsReminderHistory/index.tsx b/src/front/Components/Layouts/Folder/DocumentsReminderHistory/index.tsx index c5b1884e..932fb846 100644 --- a/src/front/Components/Layouts/Folder/DocumentsReminderHistory/index.tsx +++ b/src/front/Components/Layouts/Folder/DocumentsReminderHistory/index.tsx @@ -58,7 +58,17 @@ export default function DocumentsReminderHistory(props: IProps) { const fetchTotalPages = useCallback(() => { DocumentReminders.getInstance() - .count() + .count({ + where: { + ...(folderUid && { + document: { + folder: { + uid: folderUid as string, + }, + }, + }), + }, + }) .then((response) => { const totalPages = Math.ceil(response.count / pageSize); setTotalPages(totalPages); @@ -70,6 +80,15 @@ export default function DocumentsReminderHistory(props: IProps) { DocumentReminders.getInstance() .get({ ...(customerOption && customerOption.id !== "tous" && { where: { document: { depositor: { uid: customerOption.id } } } }), + where: { + ...(folderUid && { + document: { + folder: { + uid: folderUid as string, + }, + }, + }), + }, include: { document: { include: {