fix: Update PrimeReact to v10.8.3 and fix all compilation errors

This commit is contained in:
dahoud
2025-10-13 03:01:36 +00:00
parent 2a2e54c0e3
commit 30cad6220b
85 changed files with 928 additions and 2020 deletions

View File

@@ -47,14 +47,16 @@ const ChantiersPageContent = () => {
nom: '',
description: '',
adresse: '',
dateDebut: new Date(),
dateFinPrevue: new Date(),
dateDebut: new Date().toISOString().split('T')[0],
dateFinPrevue: new Date().toISOString().split('T')[0],
dateFinReelle: null,
statut: 'PLANIFIE',
statut: 'PLANIFIE' as any,
montantPrevu: 0,
montantReel: 0,
actif: true,
client: null
client: null,
dateCreation: new Date().toISOString(),
dateModification: new Date().toISOString()
});
const [submitted, setSubmitted] = useState(false);
const toast = useRef<Toast>(null);
@@ -119,14 +121,16 @@ const ChantiersPageContent = () => {
nom: '',
description: '',
adresse: '',
dateDebut: new Date(),
dateFinPrevue: new Date(),
dateDebut: new Date().toISOString().split('T')[0],
dateFinPrevue: new Date().toISOString().split('T')[0],
dateFinReelle: null,
statut: 'PLANIFIE',
statut: 'PLANIFIE' as any,
montantPrevu: 0,
montantReel: 0,
actif: true,
client: null
client: null,
dateCreation: new Date().toISOString(),
dateModification: new Date().toISOString()
});
setSubmitted(false);
setChantierDialog(true);
@@ -157,8 +161,8 @@ const ChantiersPageContent = () => {
nom: chantier.nom.trim(),
description: chantier.description || '',
adresse: chantier.adresse.trim(),
dateDebut: chantier.dateDebut instanceof Date ? chantier.dateDebut.toISOString().split('T')[0] : chantier.dateDebut,
dateFinPrevue: chantier.dateFinPrevue instanceof Date ? chantier.dateFinPrevue.toISOString().split('T')[0] : chantier.dateFinPrevue,
dateDebut: chantier.dateDebut,
dateFinPrevue: chantier.dateFinPrevue,
statut: chantier.statut,
montantPrevu: Number(chantier.montantPrevu) || 0,
montantReel: Number(chantier.montantReel) || 0,
@@ -168,7 +172,7 @@ const ChantiersPageContent = () => {
// Ajouter dateFinReelle seulement si elle existe
if (chantier.dateFinReelle) {
chantierToSave.dateFinReelle = chantier.dateFinReelle instanceof Date ? chantier.dateFinReelle.toISOString().split('T')[0] : chantier.dateFinReelle;
chantierToSave.dateFinReelle = chantier.dateFinReelle;
}
// Ne pas envoyer l'id lors de la création
@@ -210,15 +214,17 @@ const ChantiersPageContent = () => {
nom: '',
description: '',
adresse: '',
dateDebut: new Date(),
dateFinPrevue: new Date(),
dateDebut: new Date().toISOString().split('T')[0],
dateFinPrevue: new Date().toISOString().split('T')[0],
dateFinReelle: null,
statut: 'PLANIFIE',
statut: 'PLANIFIE' as any,
montantPrevu: 0,
montantReel: 0,
actif: true,
client: null
});
client: null,
dateCreation: new Date().toISOString(),
dateModification: new Date().toISOString()
});
} catch (error: any) {
// Utiliser le message enrichi par l'intercepteur
const errorMessage = error?.userMessage || error?.message || 'Impossible de sauvegarder le chantier';
@@ -236,7 +242,7 @@ const ChantiersPageContent = () => {
const editChantier = (chantier: Chantier) => {
setChantier({
...chantier,
client: chantier.client?.id || null
client: chantier.client || null
});
setChantierDialog(true);
};
@@ -389,7 +395,7 @@ const ChantiersPageContent = () => {
switch (status) {
case 'PLANIFIE': return 'info';
case 'EN_COURS': return 'success';
case 'TERMINE': return 'secondary';
case 'TERMINE': return 'info';
case 'ANNULE': return 'danger';
case 'SUSPENDU': return 'warning';
default: return 'info';
@@ -572,6 +578,7 @@ const ChantiersPageContent = () => {
value={chantiers}
selection={selectedChantiers}
onSelectionChange={(e) => setSelectedChantiers(e.value)}
selectionMode="multiple"
dataKey="id"
paginator
rows={10}
@@ -659,23 +666,23 @@ const ChantiersPageContent = () => {
<div className="field col-12 md:col-6">
<label htmlFor="dateDebut">Date de début</label>
<Calendar
id="dateDebut"
value={chantier.dateDebut}
onChange={(e) => onDateChange(e, 'dateDebut')}
dateFormat="dd/mm/yy"
showIcon
<Calendar
id="dateDebut"
value={chantier.dateDebut ? new Date(chantier.dateDebut) : null}
onChange={(e) => onDateChange(e, 'dateDebut')}
dateFormat="dd/mm/yy"
showIcon
/>
</div>
<div className="field col-12 md:col-6">
<label htmlFor="dateFinPrevue">Date de fin prévue</label>
<Calendar
id="dateFinPrevue"
value={chantier.dateFinPrevue}
onChange={(e) => onDateChange(e, 'dateFinPrevue')}
dateFormat="dd/mm/yy"
showIcon
<Calendar
id="dateFinPrevue"
value={chantier.dateFinPrevue ? new Date(chantier.dateFinPrevue) : null}
onChange={(e) => onDateChange(e, 'dateFinPrevue')}
dateFormat="dd/mm/yy"
showIcon
/>
</div>
@@ -706,12 +713,12 @@ const ChantiersPageContent = () => {
<>
<div className="field col-12 md:col-6">
<label htmlFor="dateFinReelle">Date de fin réelle</label>
<Calendar
id="dateFinReelle"
value={chantier.dateFinReelle}
onChange={(e) => onDateChange(e, 'dateFinReelle')}
dateFormat="dd/mm/yy"
showIcon
<Calendar
id="dateFinReelle"
value={chantier.dateFinReelle ? new Date(chantier.dateFinReelle) : null}
onChange={(e) => onDateChange(e, 'dateFinReelle')}
dateFormat="dd/mm/yy"
showIcon
/>
</div>
@@ -868,4 +875,8 @@ const ChantiersPage = () => {
);
};
export default ChantiersPage;
export default ChantiersPage;