fix: Resolve TypeScript errors in page.tsx and phases-chantier/page.tsx
This commit is contained in:
@@ -18,6 +18,7 @@ import { ProgressBar } from 'primereact/progressbar';
|
||||
import { factureService } from '../../../../services/api';
|
||||
import { formatDate, formatCurrency } from '../../../../utils/formatters';
|
||||
import type { Facture } from '../../../../types/btp';
|
||||
import { StatutFacture } from '../../../../types/btp';
|
||||
import factureActionsService from '../../../../services/factureActionsService';
|
||||
|
||||
const FacturesRetardPage = () => {
|
||||
@@ -66,12 +67,12 @@ const FacturesRetardPage = () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const data = await factureService.getAll();
|
||||
// Filtrer les factures en retard (échéance dépassée + statut EN_RETARD)
|
||||
// Filtrer les factures en retard (échéance dépassée + statut ECHUE)
|
||||
const facturesEnRetard = data.filter(facture => {
|
||||
const today = new Date();
|
||||
const echeanceDate = new Date(facture.dateEcheance);
|
||||
return (facture.statut === 'EN_RETARD' ||
|
||||
(echeanceDate < today && facture.statut !== 'PAYEE' && !facture.datePaiement));
|
||||
return (facture.statut === StatutFacture.ECHUE ||
|
||||
(echeanceDate < today && facture.statut !== StatutFacture.PAYEE && !facture.datePaiement));
|
||||
});
|
||||
setFactures(facturesEnRetard);
|
||||
} catch (error) {
|
||||
@@ -155,11 +156,12 @@ const FacturesRetardPage = () => {
|
||||
break;
|
||||
|
||||
case 'legal_notice':
|
||||
const delaiJours = Math.ceil((legalNoticeData.deadline.getTime() - Date.now()) / (1000 * 60 * 60 * 24));
|
||||
await factureActionsService.sendMiseEnDemeure({
|
||||
factureId: selectedFacture.id,
|
||||
delaiPaiement: legalNoticeData.delai,
|
||||
mentionsLegales: legalNoticeData.mentions,
|
||||
fraisDossier: legalNoticeData.frais
|
||||
delaiPaiement: delaiJours,
|
||||
mentionsLegales: legalNoticeData.content,
|
||||
fraisDossier: 0
|
||||
});
|
||||
message = 'Mise en demeure émise avec succès';
|
||||
break;
|
||||
@@ -535,6 +537,7 @@ ACTIONS RECOMMANDÉES:
|
||||
value={factures}
|
||||
selection={selectedFactures}
|
||||
onSelectionChange={(e) => setSelectedFactures(e.value)}
|
||||
selectionMode="checkbox"
|
||||
dataKey="id"
|
||||
paginator
|
||||
rows={10}
|
||||
|
||||
Reference in New Issue
Block a user