326 lines
6.7 KiB
TypeScript
326 lines
6.7 KiB
TypeScript
/**
|
|
* Types TypeScript pour le Dashboard - Correspondance exacte avec les DTOs backend
|
|
* Backend: DashboardResource.java
|
|
*/
|
|
|
|
// === DASHBOARD PRINCIPAL ===
|
|
|
|
export interface DashboardPrincipalResponse {
|
|
chantiers: {
|
|
total: number;
|
|
actifs: number;
|
|
tauxActivite: number;
|
|
};
|
|
equipes: {
|
|
total: number;
|
|
disponibles: number;
|
|
tauxDisponibilite: number;
|
|
};
|
|
employes: {
|
|
total: number;
|
|
actifs: number;
|
|
tauxActivite: number;
|
|
};
|
|
materiel: {
|
|
total: number;
|
|
disponible: number;
|
|
tauxDisponibilite: number;
|
|
};
|
|
maintenance: {
|
|
enRetard: number;
|
|
planifiees: number;
|
|
alerteRetard: boolean;
|
|
};
|
|
planning: {
|
|
evenementsAujourdhui: number;
|
|
disponibilitesEnAttente: number;
|
|
};
|
|
documents: {
|
|
total: number;
|
|
recents: DocumentRecent[];
|
|
};
|
|
derniereMAJ: string; // ISO DateTime
|
|
}
|
|
|
|
export interface DocumentRecent {
|
|
id: string;
|
|
nom: string;
|
|
type: string;
|
|
dateCreation: string; // ISO DateTime
|
|
}
|
|
|
|
// === DASHBOARD CHANTIERS ===
|
|
|
|
export interface DashboardChantiersResponse {
|
|
statistiques: ChantierStatistiques;
|
|
chantiersActifs: ChantierActifDTO[];
|
|
chantiersEnRetard: ChantierEnRetardDTO[];
|
|
}
|
|
|
|
export interface ChantierStatistiques {
|
|
total: number;
|
|
enCours: number;
|
|
planifies: number;
|
|
termines: number;
|
|
annules: number;
|
|
tauxReussite: number;
|
|
budgetTotal: number;
|
|
coutReelTotal: number;
|
|
margeGlobale: number;
|
|
}
|
|
|
|
export interface ChantierActifDTO {
|
|
id: string;
|
|
nom: string;
|
|
adresse: string;
|
|
dateDebut: string; // ISO Date
|
|
dateFinPrevue: string; // ISO Date
|
|
statut: string;
|
|
client: string;
|
|
budget: number;
|
|
coutReel: number;
|
|
avancement: number; // 0-100
|
|
}
|
|
|
|
export interface ChantierEnRetardDTO {
|
|
id: string;
|
|
nom: string;
|
|
dateFinPrevue: string; // ISO Date
|
|
joursRetard: number;
|
|
}
|
|
|
|
// === DASHBOARD MAINTENANCE ===
|
|
|
|
export interface DashboardMaintenanceResponse {
|
|
statistiques: MaintenanceStatistiques;
|
|
maintenancesEnRetard: MaintenanceEnRetardDTO[];
|
|
prochainesMaintenances: ProchaineMaintenanceDTO[];
|
|
}
|
|
|
|
export interface MaintenanceStatistiques {
|
|
total: number;
|
|
enRetard: number;
|
|
planifiees: number;
|
|
terminees: number;
|
|
tauxRealisation: number;
|
|
}
|
|
|
|
export interface MaintenanceEnRetardDTO {
|
|
id: string;
|
|
materiel: string;
|
|
type: string;
|
|
datePrevue: string; // ISO Date
|
|
joursRetard: number;
|
|
priorite: string;
|
|
}
|
|
|
|
export interface ProchaineMaintenanceDTO {
|
|
id: string;
|
|
materiel: string;
|
|
type: string;
|
|
datePrevue: string; // ISO Date
|
|
joursRestants: number;
|
|
}
|
|
|
|
// === DASHBOARD RESSOURCES ===
|
|
|
|
export interface DashboardRessourcesResponse {
|
|
statsEquipes: EquipeStatistiques;
|
|
statsEmployes: EmployeStatistiques;
|
|
statsMateriel: MaterielStatistiques;
|
|
disponibilitesActuelles: DisponibiliteDTO[];
|
|
disponibilitesEnAttente: DisponibiliteDTO[];
|
|
}
|
|
|
|
export interface EquipeStatistiques {
|
|
total: number;
|
|
disponibles: number;
|
|
occupees: number;
|
|
enConge: number;
|
|
tauxUtilisation: number;
|
|
}
|
|
|
|
export interface EmployeStatistiques {
|
|
total: number;
|
|
actifs: number;
|
|
enConge: number;
|
|
disponibles: number;
|
|
tauxActivite: number;
|
|
}
|
|
|
|
export interface MaterielStatistiques {
|
|
total: number;
|
|
disponible: number;
|
|
enUtilisation: number;
|
|
enMaintenance: number;
|
|
horsService: number;
|
|
tauxUtilisation: number;
|
|
}
|
|
|
|
export interface DisponibiliteDTO {
|
|
id: string;
|
|
employe: string;
|
|
dateDebut: string; // ISO Date
|
|
dateFin: string; // ISO Date
|
|
type: string;
|
|
statut: string;
|
|
}
|
|
|
|
// === DASHBOARD ALERTES ===
|
|
|
|
export interface DashboardAlertesResponse {
|
|
maintenancesEnRetard: MaintenanceEnRetardDTO[];
|
|
chantiersEnRetard: ChantierEnRetardDTO[];
|
|
disponibilitesEnAttente: DisponibiliteDTO[];
|
|
conflitsPlanifies: ConflitPlanningDTO[];
|
|
alertesCritiques: AlerteCritiqueDTO[];
|
|
}
|
|
|
|
export interface ConflitPlanningDTO {
|
|
id: string;
|
|
type: string;
|
|
description: string;
|
|
dateConflit: string; // ISO Date
|
|
ressourcesConcernees: string[];
|
|
}
|
|
|
|
export interface AlerteCritiqueDTO {
|
|
id: string;
|
|
type: 'MAINTENANCE' | 'CHANTIER' | 'PLANNING' | 'RESSOURCE';
|
|
severite: 'CRITIQUE' | 'HAUTE' | 'MOYENNE' | 'BASSE';
|
|
titre: string;
|
|
description: string;
|
|
dateCreation: string; // ISO DateTime
|
|
}
|
|
|
|
// === DASHBOARD FINANCES ===
|
|
|
|
export interface DashboardFinancesResponse {
|
|
chiffreAffaires: {
|
|
realise: number;
|
|
prevu: number;
|
|
objectif: number;
|
|
tauxRealisation: number;
|
|
};
|
|
depenses: {
|
|
total: number;
|
|
parCategorie: CategorieDepenseDTO[];
|
|
};
|
|
rentabilite: {
|
|
margeGlobale: number;
|
|
tauxMarge: number;
|
|
beneficeNet: number;
|
|
};
|
|
factures: {
|
|
total: number;
|
|
payees: number;
|
|
enAttente: number;
|
|
enRetard: number;
|
|
montantTotal: number;
|
|
montantPaye: number;
|
|
montantEnAttente: number;
|
|
};
|
|
devis: {
|
|
total: number;
|
|
acceptes: number;
|
|
enAttente: number;
|
|
refuses: number;
|
|
tauxAcceptation: number;
|
|
montantTotal: number;
|
|
};
|
|
}
|
|
|
|
export interface CategorieDepenseDTO {
|
|
categorie: string;
|
|
montant: number;
|
|
pourcentage: number;
|
|
}
|
|
|
|
// === DASHBOARD PERFORMANCE ===
|
|
|
|
export interface DashboardPerformanceResponse {
|
|
periodeJours: number;
|
|
dateDebut: string; // ISO Date
|
|
dateFin: string; // ISO Date
|
|
chantiers: {
|
|
tauxReussite: number;
|
|
termines: number;
|
|
total: number;
|
|
};
|
|
maintenance: {
|
|
tauxRealisation: number;
|
|
realisees: number;
|
|
total: number;
|
|
};
|
|
equipes: {
|
|
tauxUtilisation: number;
|
|
occupees: number;
|
|
total: number;
|
|
};
|
|
calculeLe: string; // ISO DateTime
|
|
}
|
|
|
|
// === TYPES POUR LE HOOK useDashboard ===
|
|
|
|
export interface DashboardMetrics {
|
|
totalChantiers: number;
|
|
chantiersActifs: number;
|
|
chantiersEnRetard: number;
|
|
chantiersTermines: number;
|
|
totalEquipes: number;
|
|
equipesDisponibles: number;
|
|
totalMateriel: number;
|
|
materielDisponible: number;
|
|
materielEnMaintenance: number;
|
|
totalDocuments: number;
|
|
totalPhotos: number;
|
|
budgetTotal: number;
|
|
coutReel: number;
|
|
chiffreAffaires: number;
|
|
objectifCA: number;
|
|
tauxReussite: number;
|
|
satisfactionClient: number;
|
|
}
|
|
|
|
export interface ChantierActif {
|
|
id: string;
|
|
nom: string;
|
|
client: string | { nom: string; prenom?: string };
|
|
avancement: number;
|
|
dateDebut: string;
|
|
dateFinPrevue: string;
|
|
statut: 'EN_COURS' | 'EN_RETARD' | 'PLANIFIE' | 'TERMINE';
|
|
budget: number;
|
|
coutReel: number;
|
|
equipe?: {
|
|
id: string;
|
|
nom: string;
|
|
nombreMembres: number;
|
|
};
|
|
}
|
|
|
|
export interface ActiviteRecente {
|
|
id: string;
|
|
type: 'CHANTIER' | 'MAINTENANCE' | 'DOCUMENT' | 'EQUIPE';
|
|
titre: string;
|
|
description: string;
|
|
date: string;
|
|
utilisateur: string;
|
|
statut: 'SUCCESS' | 'WARNING' | 'ERROR' | 'INFO';
|
|
}
|
|
|
|
export interface TacheUrgente {
|
|
id: string;
|
|
titre: string;
|
|
description: string;
|
|
priorite: 'HAUTE' | 'MOYENNE' | 'BASSE';
|
|
echeance: string;
|
|
assignee: string;
|
|
statut: 'A_FAIRE' | 'EN_COURS' | 'TERMINEE';
|
|
chantier?: {
|
|
id: string;
|
|
nom: string;
|
|
};
|
|
}
|
|
|