530 lines
11 KiB
TypeScript
Executable File
530 lines
11 KiB
TypeScript
Executable File
/**
|
|
* Types TypeScript pour les entités BTP
|
|
*/
|
|
|
|
export interface Client {
|
|
id: string;
|
|
nom: string;
|
|
prenom: string;
|
|
entreprise?: string;
|
|
email?: string;
|
|
telephone?: string;
|
|
adresse?: string;
|
|
codePostal?: string;
|
|
ville?: string;
|
|
numeroTVA?: string;
|
|
siret?: string;
|
|
dateCreation: string;
|
|
dateModification: string;
|
|
actif: boolean;
|
|
nomComplet?: string;
|
|
adresseComplete?: string;
|
|
// Relations pour la gestion de projet
|
|
gestionnairePrincipalId?: string; // ID du gestionnaire principal
|
|
gestionnairesSecondaires?: string[]; // IDs des gestionnaires secondaires
|
|
compteClientId?: string; // ID du compte utilisateur CLIENT associé
|
|
}
|
|
|
|
export interface Chantier {
|
|
id: string;
|
|
nom: string;
|
|
description?: string;
|
|
adresse: string;
|
|
codePostal?: string;
|
|
ville?: string;
|
|
dateDebut: string;
|
|
dateFinPrevue?: string;
|
|
dateFinReelle?: string;
|
|
statut: StatutChantier;
|
|
montantPrevu?: number;
|
|
montantReel?: number;
|
|
dateCreation: string;
|
|
dateModification: string;
|
|
actif: boolean;
|
|
client: Client;
|
|
devis?: Devis[];
|
|
factures?: Facture[];
|
|
// Nouveaux champs pour la gestion avancée
|
|
typeChantier?: string; // TypeChantier depuis chantier-templates.ts
|
|
surface?: number;
|
|
nombreNiveaux?: number;
|
|
dureeEstimeeJours?: number;
|
|
complexite?: 'SIMPLE' | 'MOYEN' | 'COMPLEXE' | 'TRES_COMPLEXE';
|
|
specificites?: string[];
|
|
reglementationsApplicables?: string[];
|
|
phasesAutoGenerees?: boolean;
|
|
}
|
|
|
|
export interface Devis {
|
|
id: string;
|
|
numero: string;
|
|
objet: string;
|
|
description?: string;
|
|
dateEmission: string;
|
|
dateValidite: string;
|
|
statut: StatutDevis;
|
|
montantHT?: number;
|
|
tauxTVA: number;
|
|
montantTVA?: number;
|
|
montantTTC?: number;
|
|
conditionsPaiement?: string;
|
|
delaiExecution?: number;
|
|
dateCreation: string;
|
|
dateModification: string;
|
|
actif: boolean;
|
|
client: Client;
|
|
chantier?: Chantier;
|
|
lignes?: LigneDevis[];
|
|
}
|
|
|
|
export interface LigneDevis {
|
|
id: string;
|
|
designation: string;
|
|
description?: string;
|
|
quantite: number;
|
|
unite: string;
|
|
prixUnitaire: number;
|
|
montantLigne?: number;
|
|
ordre: number;
|
|
dateCreation: string;
|
|
dateModification: string;
|
|
devis: Devis;
|
|
}
|
|
|
|
export interface Facture {
|
|
id: string;
|
|
numero: string;
|
|
objet: string;
|
|
description?: string;
|
|
dateEmission: string;
|
|
dateEcheance: string;
|
|
datePaiement?: string;
|
|
statut: StatutFacture;
|
|
montantHT?: number;
|
|
tauxTVA: number;
|
|
montantTVA?: number;
|
|
montantTTC?: number;
|
|
montantPaye?: number;
|
|
conditionsPaiement?: string;
|
|
typeFacture: TypeFacture;
|
|
dateCreation: string;
|
|
dateModification: string;
|
|
actif: boolean;
|
|
client: Client;
|
|
chantier?: Chantier;
|
|
devis?: Devis;
|
|
lignes?: LigneFacture[];
|
|
}
|
|
|
|
export interface LigneFacture {
|
|
id: string;
|
|
designation: string;
|
|
description?: string;
|
|
quantite: number;
|
|
unite: string;
|
|
prixUnitaire: number;
|
|
montantLigne?: number;
|
|
ordre: number;
|
|
dateCreation: string;
|
|
dateModification: string;
|
|
facture: Facture;
|
|
}
|
|
|
|
// Enums
|
|
export enum StatutChantier {
|
|
PLANIFIE = 'PLANIFIE',
|
|
EN_COURS = 'EN_COURS',
|
|
TERMINE = 'TERMINE',
|
|
ANNULE = 'ANNULE',
|
|
SUSPENDU = 'SUSPENDU'
|
|
}
|
|
|
|
export enum StatutDevis {
|
|
BROUILLON = 'BROUILLON',
|
|
ENVOYE = 'ENVOYE',
|
|
ACCEPTE = 'ACCEPTE',
|
|
REFUSE = 'REFUSE',
|
|
EXPIRE = 'EXPIRE'
|
|
}
|
|
|
|
export enum StatutFacture {
|
|
BROUILLON = 'BROUILLON',
|
|
ENVOYEE = 'ENVOYEE',
|
|
PAYEE = 'PAYEE',
|
|
PARTIELLEMENT_PAYEE = 'PARTIELLEMENT_PAYEE',
|
|
ECHUE = 'ECHUE',
|
|
ANNULEE = 'ANNULEE'
|
|
}
|
|
|
|
export enum TypeFacture {
|
|
FACTURE = 'FACTURE',
|
|
AVOIR = 'AVOIR',
|
|
ACOMPTE = 'ACOMPTE'
|
|
}
|
|
|
|
// Types utilitaires pour le dashboard
|
|
export interface DashboardStats {
|
|
totalClients: number;
|
|
totalChantiers: number;
|
|
chantiersEnCours: number;
|
|
chantiersPlanifies: number;
|
|
chantiersTermines: number;
|
|
totalDevis: number;
|
|
devisAcceptes: number;
|
|
devisEnAttente: number;
|
|
totalFactures: number;
|
|
facturesPayees: number;
|
|
facturesEnRetard: number;
|
|
chiffreAffaires: number;
|
|
chiffreAffairesMois: number;
|
|
chiffreAffairesAnnee: number;
|
|
}
|
|
|
|
export interface ChantierRecent {
|
|
id: string;
|
|
nom: string;
|
|
client: string;
|
|
statut: StatutChantier;
|
|
dateDebut: string;
|
|
montantPrevu?: number;
|
|
}
|
|
|
|
export interface FactureEnRetard {
|
|
id: string;
|
|
numero: string;
|
|
client: string;
|
|
montantTTC: number;
|
|
dateEcheance: string;
|
|
joursRetard: number;
|
|
}
|
|
|
|
export interface DevisEnAttente {
|
|
id: string;
|
|
numero: string;
|
|
client: string;
|
|
montantTTC: number;
|
|
dateEmission: string;
|
|
dateValidite: string;
|
|
joursRestants: number;
|
|
}
|
|
|
|
// Types pour les filtres et recherches
|
|
export interface FilterOptions {
|
|
statut?: string[];
|
|
dateDebut?: string;
|
|
dateFin?: string;
|
|
client?: string;
|
|
montantMin?: number;
|
|
montantMax?: number;
|
|
}
|
|
|
|
export interface SearchResult<T> {
|
|
data: T[];
|
|
total: number;
|
|
page: number;
|
|
size: number;
|
|
}
|
|
|
|
export interface ApiResponse<T> {
|
|
data: T;
|
|
message?: string;
|
|
success: boolean;
|
|
}
|
|
|
|
// Types pour la planification
|
|
export interface Employe {
|
|
id: string;
|
|
nom: string;
|
|
prenom: string;
|
|
email?: string;
|
|
telephone?: string;
|
|
poste: string;
|
|
specialites: string[];
|
|
tauxHoraire?: number;
|
|
dateEmbauche: string;
|
|
statut: StatutEmploye;
|
|
equipe?: Equipe;
|
|
planning?: PlanningEvent[];
|
|
competences: Competence[];
|
|
disponibilites: Disponibilite[];
|
|
dateCreation: string;
|
|
dateModification: string;
|
|
actif: boolean;
|
|
}
|
|
|
|
export interface Equipe {
|
|
id: string;
|
|
nom: string;
|
|
description?: string;
|
|
chef: Employe;
|
|
membres: Employe[];
|
|
specialites: string[];
|
|
statut: StatutEquipe;
|
|
chantiers?: Chantier[];
|
|
planning?: PlanningEvent[];
|
|
dateCreation: string;
|
|
dateModification: string;
|
|
actif: boolean;
|
|
}
|
|
|
|
export interface Materiel {
|
|
id: string;
|
|
nom: string;
|
|
marque?: string;
|
|
modele?: string;
|
|
numeroSerie?: string;
|
|
type: TypeMateriel;
|
|
description?: string;
|
|
dateAchat?: string;
|
|
valeurAchat?: number;
|
|
valeurActuelle?: number;
|
|
statut: StatutMateriel;
|
|
localisation?: string;
|
|
proprietaire?: string; // Entreprise ou location
|
|
coutUtilisation?: number; // Coût par jour/heure
|
|
maintenances: MaintenanceMateriel[];
|
|
planning?: PlanningEvent[];
|
|
dateCreation: string;
|
|
dateModification: string;
|
|
actif: boolean;
|
|
}
|
|
|
|
export interface MaintenanceMateriel {
|
|
id: string;
|
|
materiel: Materiel;
|
|
type: TypeMaintenance;
|
|
description: string;
|
|
datePrevue: string;
|
|
dateRealisee?: string;
|
|
cout?: number;
|
|
statut: StatutMaintenance;
|
|
technicien?: string;
|
|
notes?: string;
|
|
prochaineMaintenance?: string;
|
|
dateCreation: string;
|
|
dateModification: string;
|
|
}
|
|
|
|
export interface PlanningEvent {
|
|
id: string;
|
|
titre: string;
|
|
description?: string;
|
|
dateDebut: string;
|
|
dateFin: string;
|
|
type: TypePlanningEvent;
|
|
statut: StatutPlanningEvent;
|
|
priorite: PrioritePlanningEvent;
|
|
chantier?: Chantier;
|
|
equipe?: Equipe;
|
|
employes: Employe[];
|
|
materiels: Materiel[];
|
|
notes?: string;
|
|
couleur?: string;
|
|
recurrence?: RecurrencePlanningEvent;
|
|
rappels: RappelPlanningEvent[];
|
|
dateCreation: string;
|
|
dateModification: string;
|
|
actif: boolean;
|
|
}
|
|
|
|
export interface Disponibilite {
|
|
id: string;
|
|
employe: Employe;
|
|
dateDebut: string;
|
|
dateFin: string;
|
|
type: TypeDisponibilite;
|
|
motif?: string;
|
|
approuvee: boolean;
|
|
dateCreation: string;
|
|
dateModification: string;
|
|
}
|
|
|
|
export interface Competence {
|
|
id: string;
|
|
nom: string;
|
|
niveau: NiveauCompetence;
|
|
certifiee: boolean;
|
|
dateObtention?: string;
|
|
dateExpiration?: string;
|
|
description?: string;
|
|
}
|
|
|
|
export interface RappelPlanningEvent {
|
|
id: string;
|
|
delai: number; // en minutes avant l'événement
|
|
type: TypeRappel;
|
|
actif: boolean;
|
|
}
|
|
|
|
export interface RecurrencePlanningEvent {
|
|
type: TypeRecurrence;
|
|
intervalle: number;
|
|
joursSemaine?: number[]; // 0=dimanche, 1=lundi...
|
|
dateFin?: string;
|
|
occurrences?: number;
|
|
}
|
|
|
|
// Enums pour la planification
|
|
export enum StatutEmploye {
|
|
ACTIF = 'ACTIF',
|
|
INACTIF = 'INACTIF',
|
|
CONGE = 'CONGE',
|
|
ARRET_MALADIE = 'ARRET_MALADIE',
|
|
FORMATION = 'FORMATION'
|
|
}
|
|
|
|
export enum StatutEquipe {
|
|
ACTIVE = 'ACTIVE',
|
|
INACTIVE = 'INACTIVE',
|
|
EN_FORMATION = 'EN_FORMATION',
|
|
DISPONIBLE = 'DISPONIBLE',
|
|
OCCUPEE = 'OCCUPEE'
|
|
}
|
|
|
|
export enum TypeMateriel {
|
|
VEHICULE = 'VEHICULE',
|
|
OUTIL_ELECTRIQUE = 'OUTIL_ELECTRIQUE',
|
|
OUTIL_MANUEL = 'OUTIL_MANUEL',
|
|
ECHAFAUDAGE = 'ECHAFAUDAGE',
|
|
BETONIERE = 'BETONIERE',
|
|
GRUE = 'GRUE',
|
|
COMPRESSEUR = 'COMPRESSEUR',
|
|
GENERATEUR = 'GENERATEUR',
|
|
ENGIN_CHANTIER = 'ENGIN_CHANTIER',
|
|
MATERIEL_MESURE = 'MATERIEL_MESURE',
|
|
EQUIPEMENT_SECURITE = 'EQUIPEMENT_SECURITE',
|
|
AUTRE = 'AUTRE'
|
|
}
|
|
|
|
export enum StatutMateriel {
|
|
DISPONIBLE = 'DISPONIBLE',
|
|
UTILISE = 'UTILISE',
|
|
MAINTENANCE = 'MAINTENANCE',
|
|
HORS_SERVICE = 'HORS_SERVICE',
|
|
RESERVE = 'RESERVE',
|
|
EN_REPARATION = 'EN_REPARATION'
|
|
}
|
|
|
|
export enum TypeMaintenance {
|
|
PREVENTIVE = 'PREVENTIVE',
|
|
CORRECTIVE = 'CORRECTIVE',
|
|
REVISION = 'REVISION',
|
|
CONTROLE_TECHNIQUE = 'CONTROLE_TECHNIQUE',
|
|
NETTOYAGE = 'NETTOYAGE'
|
|
}
|
|
|
|
export enum StatutMaintenance {
|
|
PLANIFIEE = 'PLANIFIEE',
|
|
EN_COURS = 'EN_COURS',
|
|
TERMINEE = 'TERMINEE',
|
|
REPORTEE = 'REPORTEE',
|
|
ANNULEE = 'ANNULEE'
|
|
}
|
|
|
|
export enum TypePlanningEvent {
|
|
CHANTIER = 'CHANTIER',
|
|
REUNION = 'REUNION',
|
|
FORMATION = 'FORMATION',
|
|
MAINTENANCE = 'MAINTENANCE',
|
|
CONGE = 'CONGE',
|
|
RENDEZ_VOUS_CLIENT = 'RENDEZ_VOUS_CLIENT',
|
|
LIVRAISON = 'LIVRAISON',
|
|
INSPECTION = 'INSPECTION',
|
|
AUTRE = 'AUTRE'
|
|
}
|
|
|
|
export enum StatutPlanningEvent {
|
|
PLANIFIE = 'PLANIFIE',
|
|
CONFIRME = 'CONFIRME',
|
|
EN_COURS = 'EN_COURS',
|
|
TERMINE = 'TERMINE',
|
|
ANNULE = 'ANNULE',
|
|
REPORTE = 'REPORTE'
|
|
}
|
|
|
|
export enum PrioritePlanningEvent {
|
|
BASSE = 'BASSE',
|
|
NORMALE = 'NORMALE',
|
|
HAUTE = 'HAUTE',
|
|
CRITIQUE = 'CRITIQUE'
|
|
}
|
|
|
|
export enum TypeDisponibilite {
|
|
CONGE_PAYE = 'CONGE_PAYE',
|
|
CONGE_SANS_SOLDE = 'CONGE_SANS_SOLDE',
|
|
ARRET_MALADIE = 'ARRET_MALADIE',
|
|
FORMATION = 'FORMATION',
|
|
ABSENCE = 'ABSENCE',
|
|
HORAIRE_REDUIT = 'HORAIRE_REDUIT'
|
|
}
|
|
|
|
export enum NiveauCompetence {
|
|
DEBUTANT = 'DEBUTANT',
|
|
INTERMEDIAIRE = 'INTERMEDIAIRE',
|
|
AVANCE = 'AVANCE',
|
|
EXPERT = 'EXPERT'
|
|
}
|
|
|
|
export enum TypeRappel {
|
|
EMAIL = 'EMAIL',
|
|
SMS = 'SMS',
|
|
NOTIFICATION = 'NOTIFICATION'
|
|
}
|
|
|
|
export enum TypeRecurrence {
|
|
QUOTIDIENNE = 'QUOTIDIENNE',
|
|
HEBDOMADAIRE = 'HEBDOMADAIRE',
|
|
MENSUELLE = 'MENSUELLE',
|
|
ANNUELLE = 'ANNUELLE',
|
|
PERSONNALISEE = 'PERSONNALISEE'
|
|
}
|
|
|
|
// Types pour les vues de planification
|
|
export interface PlanningCalendrierView {
|
|
events: PlanningEvent[];
|
|
equipes: Equipe[];
|
|
materiels: Materiel[];
|
|
chantiers: Chantier[];
|
|
conflicts: PlanningConflict[];
|
|
}
|
|
|
|
export interface PlanningConflict {
|
|
id: string;
|
|
type: TypeConflitPlanification;
|
|
description: string;
|
|
events: PlanningEvent[];
|
|
ressources: (Employe | Materiel | Equipe)[];
|
|
gravite: GraviteConflict;
|
|
suggestions: string[];
|
|
}
|
|
|
|
export enum TypeConflitPlanification {
|
|
RESSOURCE_DOUBLE_RESERVATION = 'RESSOURCE_DOUBLE_RESERVATION',
|
|
EMPLOYE_INDISPONIBLE = 'EMPLOYE_INDISPONIBLE',
|
|
MATERIEL_MAINTENANCE = 'MATERIEL_MAINTENANCE',
|
|
CHEVAUCHEMENT_HORAIRES = 'CHEVAUCHEMENT_HORAIRES',
|
|
COMPETENCE_MANQUANTE = 'COMPETENCE_MANQUANTE'
|
|
}
|
|
|
|
export enum GraviteConflict {
|
|
INFO = 'INFO',
|
|
ATTENTION = 'ATTENTION',
|
|
ERREUR = 'ERREUR',
|
|
CRITIQUE = 'CRITIQUE'
|
|
}
|
|
|
|
// Types pour les statistiques de planification
|
|
export interface PlanningStats {
|
|
totalEmployes: number;
|
|
employesActifs: number;
|
|
employesDisponibles: number;
|
|
totalEquipes: number;
|
|
equipesActives: number;
|
|
totalMateriels: number;
|
|
materielsDisponibles: number;
|
|
materielsEnMaintenance: number;
|
|
evenementsMois: number;
|
|
conflitsPlanification: number;
|
|
tauxUtilisationEquipes: number;
|
|
tauxUtilisationMateriels: number;
|
|
} |