Initial commit

This commit is contained in:
dahoud
2025-10-01 01:39:07 +00:00
commit b430bf3b96
826 changed files with 255287 additions and 0 deletions

View File

@@ -0,0 +1,871 @@
'use client';
import React, { useState, useEffect, useRef } from 'react';
import { DataTable } from 'primereact/datatable';
import { Column } from 'primereact/column';
import { Button } from 'primereact/button';
import { InputText } from 'primereact/inputtext';
import { Card } from 'primereact/card';
import { Dialog } from 'primereact/dialog';
import { Toast } from 'primereact/toast';
import { Toolbar } from 'primereact/toolbar';
import { Tag } from 'primereact/tag';
import { ProgressBar } from 'primereact/progressbar';
import { Dropdown } from 'primereact/dropdown';
import { Calendar } from 'primereact/calendar';
import { InputTextarea } from 'primereact/inputtextarea';
import { InputNumber } from 'primereact/inputnumber';
import phaseService from '../../../services/phaseService';
import chantierService from '../../../services/chantierService';
import clientService from '../../../services/clientService';
import { PhaseChantier } from '../../../types/btp-extended';
import type { Chantier } from '../../../types/btp';
import {
ActionButtonGroup,
ViewButton,
EditButton,
DeleteButton,
ActionButton
} from '../../../components/ui/ActionButton';
import RoleProtectedPage from '@/components/RoleProtectedPage';
const ChantiersPageContent = () => {
const [chantiers, setChantiers] = useState<Chantier[]>([]);
const [clients, setClients] = useState<any[]>([]);
const [loading, setLoading] = useState(true);
const [globalFilter, setGlobalFilter] = useState('');
const [selectedChantiers, setSelectedChantiers] = useState<Chantier[]>([]);
const [chantierDialog, setChantierDialog] = useState(false);
const [deleteChantierDialog, setDeleteChantierDialog] = useState(false);
const [permanentDelete, setPermanentDelete] = useState(false);
const [deleteChantierssDialog, setDeleteChantierssDialog] = useState(false);
const [phasesDialog, setPhasesDialog] = useState(false);
const [selectedChantierPhases, setSelectedChantierPhases] = useState<PhaseChantier[]>([]);
const [currentChantier, setCurrentChantier] = useState<Chantier | null>(null);
const [chantier, setChantier] = useState<Chantier>({
id: '',
nom: '',
description: '',
adresse: '',
dateDebut: new Date(),
dateFinPrevue: new Date(),
dateFinReelle: null,
statut: 'PLANIFIE',
montantPrevu: 0,
montantReel: 0,
actif: true,
client: null
});
const [submitted, setSubmitted] = useState(false);
const toast = useRef<Toast>(null);
const dt = useRef<DataTable<Chantier[]>>(null);
const statuts = [
{ label: 'Planifié', value: 'PLANIFIE' },
{ label: 'En cours', value: 'EN_COURS' },
{ label: 'Terminé', value: 'TERMINE' },
{ label: 'Annulé', value: 'ANNULE' },
{ label: 'Suspendu', value: 'SUSPENDU' }
];
// États workflow BTP
const workflowTransitions = {
'PLANIFIE': ['EN_COURS', 'ANNULE'],
'EN_COURS': ['TERMINE', 'SUSPENDU', 'ANNULE'],
'SUSPENDU': ['EN_COURS', 'ANNULE'],
'TERMINE': [], // Statut final
'ANNULE': [] // Statut final
};
useEffect(() => {
loadChantiers();
loadClients();
}, []);
const loadChantiers = async () => {
try {
setLoading(true);
const data = await chantierService.getAll();
setChantiers(data);
} catch (error: any) {
const errorMessage = error?.userMessage || error?.message || 'Impossible de charger les chantiers';
toast.current?.show({
severity: 'error',
summary: 'Erreur de chargement',
detail: errorMessage,
life: 5000
});
} finally {
setLoading(false);
}
};
const loadClients = async () => {
try {
const data = await clientService.getAll();
setClients(data.map(client => ({
label: `${client.prenom} ${client.nom}${client.entreprise ? ' - ' + client.entreprise : ''}`,
value: client.id,
client: client
})));
} catch (error) {
console.warn('Erreur lors du chargement des clients:', error);
}
};
const openNew = () => {
setChantier({
id: '',
nom: '',
description: '',
adresse: '',
dateDebut: new Date(),
dateFinPrevue: new Date(),
dateFinReelle: null,
statut: 'PLANIFIE',
montantPrevu: 0,
montantReel: 0,
actif: true,
client: null
});
setSubmitted(false);
setChantierDialog(true);
};
const hideDialog = () => {
setSubmitted(false);
setChantierDialog(false);
};
const hideDeleteChantierDialog = () => {
setDeleteChantierDialog(false);
};
const hideDeleteChantierssDialog = () => {
setDeleteChantierssDialog(false);
};
const saveChantier = async () => {
setSubmitted(true);
if (chantier.nom.trim() && chantier.client && chantier.adresse.trim()) {
try {
let updatedChantiers = [...chantiers];
// Préparer les données pour l'envoi
const chantierToSave: any = {
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,
statut: chantier.statut,
montantPrevu: Number(chantier.montantPrevu) || 0,
montantReel: Number(chantier.montantReel) || 0,
actif: chantier.actif !== undefined ? chantier.actif : true,
clientId: chantier.client // Envoyer l'ID du client directement
};
// Ajouter dateFinReelle seulement si elle existe
if (chantier.dateFinReelle) {
chantierToSave.dateFinReelle = chantier.dateFinReelle instanceof Date ? chantier.dateFinReelle.toISOString().split('T')[0] : chantier.dateFinReelle;
}
// Ne pas envoyer l'id lors de la création
if (chantier.id) {
chantierToSave.id = chantier.id;
}
console.log('Données à envoyer:', chantierToSave);
if (chantier.id) {
// Mise à jour
const updatedChantier = await chantierService.update(chantier.id, chantierToSave);
const index = chantiers.findIndex(c => c.id === chantier.id);
updatedChantiers[index] = updatedChantier;
toast.current?.show({
severity: 'success',
summary: 'Succès',
detail: 'Chantier mis à jour',
life: 3000
});
} else {
// Créer le nouveau chantier
const newChantier = await chantierService.create(chantierToSave);
updatedChantiers.push(newChantier);
toast.current?.show({
severity: 'success',
summary: 'Succès',
detail: 'Chantier créé',
life: 3000
});
}
setChantiers(updatedChantiers);
setChantierDialog(false);
setChantier({
id: '',
nom: '',
description: '',
adresse: '',
dateDebut: new Date(),
dateFinPrevue: new Date(),
dateFinReelle: null,
statut: 'PLANIFIE',
montantPrevu: 0,
montantReel: 0,
actif: true,
client: null
});
} catch (error: any) {
// Utiliser le message enrichi par l'intercepteur
const errorMessage = error?.userMessage || error?.message || 'Impossible de sauvegarder le chantier';
toast.current?.show({
severity: 'error',
summary: 'Erreur de sauvegarde',
detail: errorMessage,
life: 5000
});
}
}
};
const editChantier = (chantier: Chantier) => {
setChantier({
...chantier,
client: chantier.client?.id || null
});
setChantierDialog(true);
};
const confirmDeleteChantier = (chantier: Chantier, permanent: boolean = false) => {
setChantier(chantier);
setPermanentDelete(permanent);
setDeleteChantierDialog(true);
};
const deleteChantier = async () => {
try {
await chantierService.delete(chantier.id, permanentDelete);
let updatedChantiers = chantiers.filter(c => c.id !== chantier.id);
setChantiers(updatedChantiers);
setDeleteChantierDialog(false);
setPermanentDelete(false);
toast.current?.show({
severity: 'success',
summary: 'Succès',
detail: 'Chantier supprimé',
life: 3000
});
} catch (error: any) {
const errorMessage = error?.userMessage || error?.message || 'Impossible de supprimer le chantier';
const statusCode = error?.statusCode;
// Message d'erreur plus détaillé selon le code de statut
let detail = errorMessage;
if (statusCode === 409) {
detail = 'Ce chantier ne peut pas être supprimé (peut-être en cours ou terminé)';
} else if (statusCode === 404) {
detail = 'Ce chantier n\'existe plus';
} else if (statusCode === 403) {
detail = 'Vous n\'avez pas les droits pour supprimer ce chantier';
}
toast.current?.show({
severity: 'error',
summary: 'Erreur de suppression',
detail: detail,
life: 5000
});
}
};
const exportCSV = () => {
dt.current?.exportCSV();
};
const onInputChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>, name: string) => {
const val = (e.target && e.target.value) || '';
let _chantier = { ...chantier };
(_chantier as any)[name] = val;
setChantier(_chantier);
};
const onDateChange = (e: any, name: string) => {
let _chantier = { ...chantier };
(_chantier as any)[name] = e.value;
setChantier(_chantier);
};
const onNumberChange = (e: any, name: string) => {
let _chantier = { ...chantier };
(_chantier as any)[name] = e.value;
setChantier(_chantier);
};
const onDropdownChange = (e: any, name: string) => {
let _chantier = { ...chantier };
(_chantier as any)[name] = e.value;
setChantier(_chantier);
};
const leftToolbarTemplate = () => {
return (
<div className="my-2">
<Button
label="Nouveau"
icon="pi pi-plus"
severity="success"
className="mr-2 p-button-text p-button-rounded"
onClick={openNew}
/>
<Button
label="Supprimer"
icon="pi pi-trash"
severity="danger"
className="p-button-text p-button-rounded"
onClick={() => setDeleteChantierssDialog(true)}
disabled={!selectedChantiers || selectedChantiers.length === 0}
/>
</div>
);
};
const rightToolbarTemplate = () => {
return (
<Button
label="Exporter"
icon="pi pi-upload"
severity="help"
className="p-button-text p-button-rounded"
onClick={exportCSV}
/>
);
};
const voirPhasesChantier = async (chantier: Chantier) => {
try {
setCurrentChantier(chantier);
const phases = await phaseService.getByChantier(chantier.id);
setSelectedChantierPhases(phases || []);
setPhasesDialog(true);
} catch (error) {
console.warn('Erreur lors du chargement des phases:', error);
toast.current?.show({
severity: 'error',
summary: 'Erreur',
detail: 'Impossible de charger les phases du chantier',
life: 3000
});
}
};
const actionBodyTemplate = (rowData: Chantier) => {
return (
<ActionButtonGroup>
<ActionButton
icon="pi pi-sitemap"
tooltip="Gérer les phases"
onClick={() => window.location.href = `/chantiers/${rowData.id}/phases`}
color="blue"
/>
<EditButton
tooltip="Modifier"
onClick={() => editChantier(rowData)}
/>
<DeleteButton
tooltip="Supprimer"
onClick={() => confirmDeleteChantier(rowData, true)}
/>
</ActionButtonGroup>
);
};
const statusBodyTemplate = (rowData: Chantier) => {
const getSeverity = (status: string) => {
switch (status) {
case 'PLANIFIE': return 'info';
case 'EN_COURS': return 'success';
case 'TERMINE': return 'secondary';
case 'ANNULE': return 'danger';
case 'SUSPENDU': return 'warning';
default: return 'info';
}
};
const getLabel = (status: string) => {
switch (status) {
case 'PLANIFIE': return 'Planifié';
case 'EN_COURS': return 'En cours';
case 'TERMINE': return 'Terminé';
case 'ANNULE': return 'Annulé';
case 'SUSPENDU': return 'Suspendu';
default: return status;
}
};
return (
<Tag
value={getLabel(rowData.statut)}
severity={getSeverity(rowData.statut)}
/>
);
};
const actifBodyTemplate = (rowData: Chantier) => {
return (
<Tag
value={rowData.actif ? 'Actif' : 'Inactif'}
severity={rowData.actif ? 'success' : 'danger'}
icon={rowData.actif ? 'pi pi-check' : 'pi pi-times'}
/>
);
};
const progressBodyTemplate = (rowData: Chantier) => {
if (rowData.statut === 'TERMINE') {
return <ProgressBar value={100} style={{ height: '6px' }} />;
}
if (rowData.statut === 'ANNULE') {
return <ProgressBar value={0} style={{ height: '6px' }} color="#ef4444" />;
}
// Calcul approximatif basé sur les dates
const now = new Date();
const start = new Date(rowData.dateDebut);
const end = new Date(rowData.dateFinPrevue);
const totalDays = (end.getTime() - start.getTime()) / (1000 * 60 * 60 * 24);
const elapsedDays = (now.getTime() - start.getTime()) / (1000 * 60 * 60 * 24);
const progress = Math.min(Math.max((elapsedDays / totalDays) * 100, 0), 100);
return <ProgressBar value={progress} style={{ height: '6px' }} />;
};
const clientBodyTemplate = (rowData: Chantier) => {
if (!rowData.client) return '';
return `${rowData.client.prenom} ${rowData.client.nom}`;
};
const dateBodyTemplate = (rowData: Chantier, field: string) => {
const date = (rowData as any)[field];
return date ? formatDate(date) : '';
};
const header = (
<div className="flex flex-column md:flex-row md:justify-content-between md:align-items-center">
<h5 className="m-0">Gestion des Chantiers</h5>
<span className="block mt-2 md:mt-0 p-input-icon-left">
<i className="pi pi-search" />
<InputText
type="search"
placeholder="Rechercher..."
onInput={(e) => setGlobalFilter(e.currentTarget.value)}
/>
</span>
</div>
);
const chantierDialogFooter = (
<>
<Button label="Annuler" icon="pi pi-times" text onClick={hideDialog} />
<Button label="Sauvegarder" icon="pi pi-check" text onClick={saveChantier} />
</>
);
const deleteChantierDialogFooter = (
<>
<Button label="Non" icon="pi pi-times" text onClick={hideDeleteChantierDialog} />
<Button label="Oui" icon="pi pi-check" text onClick={deleteChantier} />
</>
);
const phaseDialogFooter = (
<div className="flex justify-content-between">
<div className="flex gap-2">
<Button
label="Nouvelle Phase"
icon="pi pi-plus"
onClick={() => {
if (currentChantier) {
window.location.href = `/chantiers/${currentChantier.id}/phases`;
}
}}
className="p-button-text p-button-rounded p-button-success"
tooltip="Aller à la page de gestion des phases"
/>
<Button
label="Gérer les Phases"
icon="pi pi-sitemap"
onClick={() => {
if (currentChantier) {
window.location.href = `/chantiers/${currentChantier.id}/phases`;
}
}}
className="p-button-text p-button-rounded p-button-info"
tooltip="Interface complète de gestion des phases"
/>
</div>
<Button label="Fermer" icon="pi pi-times" onClick={() => setPhasesDialog(false)} />
</div>
);
const phaseAvancementTemplate = (phase: PhaseChantier) => {
const avancement = phase.pourcentageAvancement || 0;
return (
<div className="flex align-items-center gap-2">
<ProgressBar
value={avancement}
className="w-6rem"
style={{ height: '0.5rem' }}
/>
<span className="text-sm font-medium">{avancement}%</span>
</div>
);
};
const phaseStatutTemplate = (phase: PhaseChantier) => {
return (
<Tag
value={phaseService.getStatutLabel(phase.statut)}
style={{
backgroundColor: phaseService.getStatutColor(phase.statut),
color: 'white'
}}
/>
);
};
const phaseBudgetTemplate = (phase: PhaseChantier) => {
return new Intl.NumberFormat('fr-FR', {
style: 'currency',
currency: 'EUR',
notation: 'compact'
}).format(phase.budgetPrevu || 0);
};
const formatDate = (dateString: string | Date | null) => {
if (!dateString) return '';
const date = new Date(dateString);
return date.toLocaleDateString('fr-FR');
};
const formatCurrency = (amount: number) => {
return new Intl.NumberFormat('fr-FR', {
style: 'currency',
currency: 'EUR'
}).format(amount);
};
return (
<div className="grid">
<div className="col-12">
<Card>
<Toast ref={toast} />
<Toolbar className="mb-4" left={leftToolbarTemplate} right={rightToolbarTemplate} />
<DataTable
ref={dt}
value={chantiers}
selection={selectedChantiers}
onSelectionChange={(e) => setSelectedChantiers(e.value)}
dataKey="id"
paginator
rows={10}
rowsPerPageOptions={[5, 10, 25]}
className="datatable-responsive"
paginatorTemplate="FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink CurrentPageReport RowsPerPageDropdown"
currentPageReportTemplate="Affichage de {first} à {last} sur {totalRecords} chantiers"
globalFilter={globalFilter}
emptyMessage="Aucun chantier trouvé."
header={header}
responsiveLayout="scroll"
loading={loading}
>
<Column selectionMode="multiple" headerStyle={{ width: '4rem' }} />
<Column field="nom" header="Nom" sortable headerStyle={{ minWidth: '12rem' }} />
<Column field="client" header="Client" body={clientBodyTemplate} sortable headerStyle={{ minWidth: '12rem' }} />
<Column field="adresse" header="Adresse" sortable headerStyle={{ minWidth: '12rem' }} />
<Column field="dateDebut" header="Date début" body={(rowData) => dateBodyTemplate(rowData, 'dateDebut')} sortable headerStyle={{ minWidth: '10rem' }} />
<Column field="dateFinPrevue" header="Date fin prévue" body={(rowData) => dateBodyTemplate(rowData, 'dateFinPrevue')} sortable headerStyle={{ minWidth: '10rem' }} />
<Column field="statut" header="Statut" body={statusBodyTemplate} sortable headerStyle={{ minWidth: '8rem' }} />
<Column field="actif" header="État" body={actifBodyTemplate} sortable headerStyle={{ minWidth: '7rem' }} />
<Column field="progress" header="Progression" body={progressBodyTemplate} headerStyle={{ minWidth: '10rem' }} />
<Column field="montantPrevu" header="Montant prévu" body={(rowData) => formatCurrency(rowData.montantPrevu)} sortable headerStyle={{ minWidth: '10rem' }} />
<Column body={actionBodyTemplate} headerStyle={{ minWidth: '10rem' }} />
</DataTable>
<Dialog
visible={chantierDialog}
style={{ width: '600px' }}
header="Détails du Chantier"
modal
className="p-fluid"
footer={chantierDialogFooter}
onHide={hideDialog}
>
<div className="formgrid grid">
<div className="field col-12">
<label htmlFor="nom">Nom du chantier</label>
<InputText
id="nom"
value={chantier.nom}
onChange={(e) => onInputChange(e, 'nom')}
required
className={submitted && !chantier.nom ? 'p-invalid' : ''}
/>
{submitted && !chantier.nom && <small className="p-invalid">Le nom est requis.</small>}
</div>
<div className="field col-12">
<label htmlFor="client">Client</label>
<Dropdown
id="client"
value={chantier.client}
options={clients}
onChange={(e) => onDropdownChange(e, 'client')}
placeholder="Sélectionnez un client"
required
className={submitted && !chantier.client ? 'p-invalid' : ''}
/>
{submitted && !chantier.client && <small className="p-invalid">Le client est requis.</small>}
</div>
<div className="field col-12">
<label htmlFor="description">Description</label>
<InputTextarea
id="description"
value={chantier.description}
onChange={(e) => onInputChange(e, 'description')}
rows={3}
/>
</div>
<div className="field col-12">
<label htmlFor="adresse">Adresse</label>
<InputTextarea
id="adresse"
value={chantier.adresse}
onChange={(e) => onInputChange(e, 'adresse')}
rows={2}
required
className={submitted && !chantier.adresse ? 'p-invalid' : ''}
/>
{submitted && !chantier.adresse && <small className="p-invalid">L'adresse est requise.</small>}
</div>
<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
/>
</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
/>
</div>
<div className="field col-12 md:col-6">
<label htmlFor="statut">Statut</label>
<Dropdown
id="statut"
value={chantier.statut}
options={statuts}
onChange={(e) => onDropdownChange(e, 'statut')}
placeholder="Sélectionnez un statut"
/>
</div>
<div className="field col-12 md:col-6">
<label htmlFor="montantPrevu">Montant prévu (€)</label>
<InputNumber
id="montantPrevu"
value={chantier.montantPrevu}
onValueChange={(e) => onNumberChange(e, 'montantPrevu')}
mode="currency"
currency="EUR"
locale="fr-FR"
/>
</div>
{chantier.statut === 'TERMINE' && (
<>
<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
/>
</div>
<div className="field col-12 md:col-6">
<label htmlFor="montantReel">Montant réel (€)</label>
<InputNumber
id="montantReel"
value={chantier.montantReel}
onValueChange={(e) => onNumberChange(e, 'montantReel')}
mode="currency"
currency="EUR"
locale="fr-FR"
/>
</div>
</>
)}
</div>
</Dialog>
<Dialog
visible={deleteChantierDialog}
style={{ width: '450px' }}
header="Confirmer la suppression"
modal
footer={deleteChantierDialogFooter}
onHide={hideDeleteChantierDialog}
>
<div className="flex align-items-center justify-content-center">
<i className="pi pi-exclamation-triangle mr-3" style={{ fontSize: '2rem' }} />
{chantier && (
<span>
Êtes-vous sûr de vouloir supprimer le chantier <b>{chantier.nom}</b> ?
</span>
)}
</div>
</Dialog>
{/* Dialog des phases du chantier */}
<Dialog
visible={phasesDialog}
style={{ width: '90vw', height: '80vh' }}
header={`Phases du chantier: ${currentChantier?.nom}`}
modal
className="p-fluid"
footer={phaseDialogFooter}
onHide={() => setPhasesDialog(false)}
maximizable
>
<div className="grid mb-3">
<div className="col-12 md:col-3">
<Card>
<div className="text-center">
<div className="text-2xl font-bold text-blue-500">{selectedChantierPhases.length}</div>
<div className="text-color-secondary">Total phases</div>
</div>
</Card>
</div>
<div className="col-12 md:col-3">
<Card>
<div className="text-center">
<div className="text-2xl font-bold text-green-500">
{selectedChantierPhases.filter(p => p.statut === 'EN_COURS').length}
</div>
<div className="text-color-secondary">En cours</div>
</div>
</Card>
</div>
<div className="col-12 md:col-3">
<Card>
<div className="text-center">
<div className="text-2xl font-bold text-purple-500">
{selectedChantierPhases.filter(p => p.statut === 'TERMINEE').length}
</div>
<div className="text-color-secondary">Terminées</div>
</div>
</Card>
</div>
<div className="col-12 md:col-3">
<Card>
<div className="text-center">
<div className="text-2xl font-bold text-red-500">
{selectedChantierPhases.filter(p => phaseService.isEnRetard(p)).length}
</div>
<div className="text-color-secondary">En retard</div>
</div>
</Card>
</div>
</div>
<DataTable
value={selectedChantierPhases}
paginator
rows={10}
dataKey="id"
className="datatable-responsive"
emptyMessage="Aucune phase définie pour ce chantier"
responsiveLayout="scroll"
>
<Column field="nom" header="Phase" sortable style={{ minWidth: '12rem' }} />
<Column
header="Statut"
body={phaseStatutTemplate}
sortable
style={{ minWidth: '8rem' }}
/>
<Column
header="Avancement"
body={phaseAvancementTemplate}
style={{ minWidth: '10rem' }}
/>
<Column
field="dateDebutPrevue"
header="Début prévu"
body={(rowData) => formatDate(rowData.dateDebutPrevue)}
sortable
style={{ minWidth: '10rem' }}
/>
<Column
field="dateFinPrevue"
header="Fin prévue"
body={(rowData) => formatDate(rowData.dateFinPrevue)}
sortable
style={{ minWidth: '10rem' }}
/>
<Column
header="Budget"
body={phaseBudgetTemplate}
style={{ minWidth: '8rem' }}
/>
<Column
header="Critique"
body={(rowData) => rowData.critique ?
<Tag value="Oui" severity="danger" /> :
<Tag value="Non" severity="success" />
}
style={{ minWidth: '6rem' }}
/>
</DataTable>
</Dialog>
</Card>
</div>
</div>
);
};
const ChantiersPage = () => {
return (
<RoleProtectedPage
requiredPage="CHANTIERS"
fallbackMessage="Vous devez avoir accès aux chantiers pour consulter cette page."
>
<ChantiersPageContent />
</RoleProtectedPage>
);
};
export default ChantiersPage;