fix: Resolve TypeScript errors in page.tsx and phases-chantier/page.tsx
This commit is contained in:
@@ -59,7 +59,8 @@ const PhasesChantierPage: Page = () => {
|
||||
budgetPrevu: 0,
|
||||
statut: 'PLANIFIEE' as StatutPhase,
|
||||
critique: false,
|
||||
notes: ''
|
||||
notes: '',
|
||||
ordreExecution: 1
|
||||
});
|
||||
|
||||
const statutOptions = [
|
||||
@@ -106,7 +107,8 @@ const PhasesChantierPage: Page = () => {
|
||||
budgetPrevu: 0,
|
||||
statut: 'PLANIFIEE',
|
||||
critique: false,
|
||||
notes: ''
|
||||
notes: '',
|
||||
ordreExecution: 1
|
||||
});
|
||||
setSubmitted(false);
|
||||
setPhaseDialog(true);
|
||||
@@ -122,7 +124,8 @@ const PhasesChantierPage: Page = () => {
|
||||
budgetPrevu: phase.budgetPrevu || 0,
|
||||
statut: phase.statut,
|
||||
critique: phase.critique || false,
|
||||
notes: phase.notes || ''
|
||||
notes: phase.notes || '',
|
||||
ordreExecution: phase.ordreExecution || 1
|
||||
});
|
||||
setSubmitted(false);
|
||||
setPhaseDialog(true);
|
||||
@@ -136,7 +139,7 @@ const PhasesChantierPage: Page = () => {
|
||||
const deletePhase = async () => {
|
||||
try {
|
||||
if (currentPhase?.id) {
|
||||
await phaseChantierService.delete(currentPhase.id);
|
||||
await phaseChantierService.delete(Number(currentPhase.id));
|
||||
await loadPhases();
|
||||
toast.current?.show({
|
||||
severity: 'success',
|
||||
@@ -175,11 +178,12 @@ const PhasesChantierPage: Page = () => {
|
||||
...formData,
|
||||
dateDebutPrevue: formData.dateDebutPrevue?.toISOString(),
|
||||
dateFinPrevue: formData.dateFinPrevue?.toISOString(),
|
||||
chantierId: 1 // ID exemple - en production, viendrait du contexte
|
||||
chantierId: '1', // ID exemple - en production, viendrait du contexte
|
||||
ordreExecution: formData.ordreExecution || 1
|
||||
};
|
||||
|
||||
if (currentPhase?.id) {
|
||||
await phaseChantierService.update(currentPhase.id, phaseData);
|
||||
await phaseChantierService.update(Number(currentPhase.id), phaseData);
|
||||
} else {
|
||||
await phaseChantierService.create(phaseData);
|
||||
}
|
||||
@@ -224,7 +228,7 @@ const PhasesChantierPage: Page = () => {
|
||||
const startPhase = async (phase: PhaseChantier) => {
|
||||
try {
|
||||
if (phase.id) {
|
||||
await phaseChantierService.start(phase.id);
|
||||
await phaseChantierService.start(Number(phase.id));
|
||||
await loadPhases();
|
||||
toast.current?.show({
|
||||
severity: 'success',
|
||||
@@ -246,7 +250,7 @@ const PhasesChantierPage: Page = () => {
|
||||
const completePhase = async (phase: PhaseChantier) => {
|
||||
try {
|
||||
if (phase.id) {
|
||||
await phaseChantierService.complete(phase.id);
|
||||
await phaseChantierService.complete(Number(phase.id));
|
||||
await loadPhases();
|
||||
toast.current?.show({
|
||||
severity: 'success',
|
||||
@@ -268,7 +272,7 @@ const PhasesChantierPage: Page = () => {
|
||||
const suspendPhase = async (phase: PhaseChantier) => {
|
||||
try {
|
||||
if (phase.id) {
|
||||
await phaseChantierService.suspend(phase.id);
|
||||
await phaseChantierService.suspend(Number(phase.id));
|
||||
await loadPhases();
|
||||
toast.current?.show({
|
||||
severity: 'success',
|
||||
@@ -371,10 +375,9 @@ const PhasesChantierPage: Page = () => {
|
||||
|
||||
const retard = phaseChantierService.calculateRetard(rowData);
|
||||
return (
|
||||
<Badge
|
||||
value={`${retard}j`}
|
||||
<Badge
|
||||
value={`${retard}j`}
|
||||
severity="danger"
|
||||
tooltip="Jours de retard"
|
||||
/>
|
||||
);
|
||||
};
|
||||
@@ -492,6 +495,7 @@ const PhasesChantierPage: Page = () => {
|
||||
value={phases}
|
||||
selection={selectedPhases}
|
||||
onSelectionChange={(e) => setSelectedPhases(e.value as PhaseChantier[])}
|
||||
selectionMode="checkbox"
|
||||
dataKey="id"
|
||||
paginator
|
||||
rows={10}
|
||||
|
||||
Reference in New Issue
Block a user