Fixed historique de relance

This commit is contained in:
Vins 2025-04-10 16:29:16 +02:00
parent 2ca4015399
commit 6039f5f778
2 changed files with 24 additions and 3 deletions

View File

@ -45,13 +45,15 @@ export default class DocumentReminders extends BaseNotary {
} }
} }
public count = async (): Promise<IGetDocumentRemindersCountresponse> => { public async count(q: IGetDocumentRemindersparams): Promise<IGetDocumentRemindersCountresponse> {
const url = new URL(this.baseURl.concat("/count")); 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 { try {
return await this.getRequest<IGetDocumentRemindersCountresponse>(url); return await this.getRequest<IGetDocumentRemindersCountresponse>(url);
} catch (err) { } catch (err) {
this.onError(err); this.onError(err);
return Promise.reject(err); return Promise.reject(err);
} }
}; }
} }

View File

@ -58,7 +58,17 @@ export default function DocumentsReminderHistory(props: IProps) {
const fetchTotalPages = useCallback(() => { const fetchTotalPages = useCallback(() => {
DocumentReminders.getInstance() DocumentReminders.getInstance()
.count() .count({
where: {
...(folderUid && {
document: {
folder: {
uid: folderUid as string,
},
},
}),
},
})
.then((response) => { .then((response) => {
const totalPages = Math.ceil(response.count / pageSize); const totalPages = Math.ceil(response.count / pageSize);
setTotalPages(totalPages); setTotalPages(totalPages);
@ -70,6 +80,15 @@ export default function DocumentsReminderHistory(props: IProps) {
DocumentReminders.getInstance() DocumentReminders.getInstance()
.get({ .get({
...(customerOption && customerOption.id !== "tous" && { where: { document: { depositor: { uid: customerOption.id } } } }), ...(customerOption && customerOption.id !== "tous" && { where: { document: { depositor: { uid: customerOption.id } } } }),
where: {
...(folderUid && {
document: {
folder: {
uid: folderUid as string,
},
},
}),
},
include: { include: {
document: { document: {
include: { include: {