561 lines
17 KiB
TypeScript
Executable File
561 lines
17 KiB
TypeScript
Executable File
/**
|
|
* Types TypeScript étendus pour les entités BTP
|
|
* Version complète avec toutes les nouvelles fonctionnalités
|
|
*/
|
|
|
|
// Énumérations communes
|
|
export type TypeFournisseur = 'MATERIEL' | 'SERVICE' | 'SOUS_TRAITANT' | 'LOCATION' | 'TRANSPORT' | 'CONSOMMABLE';
|
|
export type StatutCommande = 'BROUILLON' | 'ENVOYEE' | 'CONFIRMEE' | 'PARTIELLEMENT_LIVREE' | 'LIVREE' | 'FACTUREE' | 'ANNULEE';
|
|
export type StatutLivraison = 'PROGRAMMEE' | 'EN_COURS' | 'LIVREE' | 'RECEPTIONNEE' | 'REFUSEE';
|
|
export type StatutPhase = 'PLANIFIEE' | 'EN_ATTENTE' | 'EN_COURS' | 'EN_PAUSE' | 'TERMINEE' | 'ANNULEE' | 'EN_RETARD';
|
|
export type StatutSituation = 'BROUILLON' | 'ETABLIE' | 'ENVOYEE' | 'VALIDEE' | 'FACTUREE' | 'PAYEE' | 'CONTESTEE' | 'ANNULEE';
|
|
export type TypeDocument = 'PLAN' | 'PERMIS' | 'DEVIS' | 'FACTURE' | 'CONTRAT' | 'PHOTO_CHANTIER' | 'RAPPORT_VISITE' | 'PV_RECEPTION' | 'FICHE_TECHNIQUE' | 'CERTIFICAT' | 'ASSURANCE' | 'MANUEL' | 'GARANTIE' | 'COMPTE_RENDU' | 'EMAIL' | 'COURRIER' | 'BON_LIVRAISON' | 'BON_COMMANDE' | 'AUTRE';
|
|
export type TypeMouvement = 'ENTREE_ACHAT' | 'ENTREE_RETOUR' | 'ENTREE_CORRECTION' | 'ENTREE_TRANSFERT' | 'SORTIE_CHANTIER' | 'SORTIE_VENTE' | 'SORTIE_PERTE' | 'SORTIE_CORRECTION' | 'SORTIE_TRANSFERT' | 'INVENTAIRE';
|
|
export type TypeAlerte = 'STOCK_MINIMUM' | 'STOCK_ZERO' | 'STOCK_NEGATIF' | 'PEREMPTION_PROCHE' | 'PEREMPTION_DEPASSEE' | 'CONSOMMATION_ANORMALE' | 'IMMOBILISATION_LONGUE';
|
|
export type NiveauSeverite = 'INFO' | 'WARNING' | 'CRITICAL' | 'URGENT';
|
|
export type TypeJalon = 'DEBUT_PHASE' | 'FIN_PHASE' | 'LIVRAISON' | 'VALIDATION_CLIENT' | 'CONTROLE_QUALITE' | 'RECEPTION_TRAVAUX' | 'PAIEMENT' | 'AUTORISATION' | 'FORMATION' | 'AUTRE';
|
|
export type StatutJalon = 'PLANIFIE' | 'EN_COURS' | 'ATTEINT' | 'EN_RETARD' | 'REPORTE' | 'ANNULE';
|
|
export type TypePointage = 'TRAVAIL' | 'DEPLACEMENT' | 'FORMATION' | 'REUNION' | 'MAINTENANCE' | 'ARRET_TECHNIQUE' | 'INTEMPERIES' | 'AUTRE';
|
|
|
|
// Interfaces pour la gestion des fournisseurs
|
|
export interface Fournisseur {
|
|
id?: number;
|
|
nom: string;
|
|
siret?: string;
|
|
numeroTva?: string;
|
|
email?: string;
|
|
telephone?: string;
|
|
fax?: string;
|
|
adresse?: string;
|
|
codePostal?: string;
|
|
ville?: string;
|
|
pays?: string;
|
|
contactPrincipal?: string;
|
|
type: TypeFournisseur;
|
|
notes?: string;
|
|
actif?: boolean;
|
|
delaiPaiementJours?: number;
|
|
conditionsPaiement?: string;
|
|
dateCreation?: Date;
|
|
dateModification?: Date;
|
|
nombreCommandes?: number;
|
|
nombreArticlesCatalogue?: number;
|
|
}
|
|
|
|
export interface CommandeFournisseur {
|
|
id?: number;
|
|
numeroCommande: string;
|
|
fournisseur: Fournisseur;
|
|
chantier?: any; // Import du type Chantier existant
|
|
dateCommande: Date;
|
|
dateLivraisonPrevue?: Date;
|
|
dateLivraisonReelle?: Date;
|
|
statut: StatutCommande;
|
|
montantHT: number;
|
|
montantTVA: number;
|
|
montantTTC: number;
|
|
adresseLivraison?: string;
|
|
notes?: string;
|
|
referenceFournisseur?: string;
|
|
dateCreation?: Date;
|
|
dateModification?: Date;
|
|
lignes?: LigneCommandeFournisseur[];
|
|
livraisons?: LivraisonFournisseur[];
|
|
}
|
|
|
|
export interface LigneCommandeFournisseur {
|
|
id?: number;
|
|
commandeFournisseur: CommandeFournisseur;
|
|
materiel?: any; // Import du type Materiel existant
|
|
designation: string;
|
|
reference?: string;
|
|
quantite: number;
|
|
unite: string;
|
|
prixUnitaireHT: number;
|
|
tauxTVA: number;
|
|
quantiteLivree?: number;
|
|
notes?: string;
|
|
montantHT?: number;
|
|
montantTVA?: number;
|
|
montantTTC?: number;
|
|
}
|
|
|
|
export interface LivraisonFournisseur {
|
|
id?: number;
|
|
numeroLivraison: string;
|
|
commandeFournisseur: CommandeFournisseur;
|
|
dateLivraison: Date;
|
|
nomLivreur?: string;
|
|
numeroBonLivraison?: string;
|
|
adresseLivraison?: string;
|
|
statut: StatutLivraison;
|
|
notes?: string;
|
|
receptionneePar?: string;
|
|
dateReception?: Date;
|
|
conforme?: boolean;
|
|
notesReception?: string;
|
|
dateCreation?: Date;
|
|
dateModification?: Date;
|
|
lignes?: LigneLivraisonFournisseur[];
|
|
}
|
|
|
|
export interface LigneLivraisonFournisseur {
|
|
id?: number;
|
|
livraisonFournisseur: LivraisonFournisseur;
|
|
ligneCommande: LigneCommandeFournisseur;
|
|
quantiteLivree: number;
|
|
quantiteAcceptee?: number;
|
|
quantiteRefusee?: number;
|
|
motifRefus?: string;
|
|
notes?: string;
|
|
}
|
|
|
|
export interface CatalogueItem {
|
|
id?: number;
|
|
fournisseur: Fournisseur;
|
|
materiel?: any; // Import du type Materiel existant
|
|
designation: string;
|
|
referenceFournisseur?: string;
|
|
codeEAN?: string;
|
|
description?: string;
|
|
unite: string;
|
|
prixUnitaireHT?: number;
|
|
tauxTVA?: number;
|
|
delaiLivraisonJours?: number;
|
|
quantiteMinimumCommande?: number;
|
|
conditionnement?: number;
|
|
marque?: string;
|
|
modele?: string;
|
|
urlFicheTechnique?: string;
|
|
actif?: boolean;
|
|
derniereMiseAJourPrix?: Date;
|
|
dateCreation?: Date;
|
|
dateModification?: Date;
|
|
categories?: string[];
|
|
}
|
|
|
|
// Interfaces pour la gestion des phases de chantier
|
|
export interface PhaseChantier {
|
|
id?: string;
|
|
nom: string;
|
|
description?: string;
|
|
chantier?: any; // Import du type Chantier existant
|
|
chantierId?: string;
|
|
phaseParent?: string; // ID de la phase parent
|
|
sousPhases?: PhaseChantier[];
|
|
ordreExecution: number;
|
|
dateDebutPrevue: string; // ISO string format
|
|
dateFinPrevue: string; // ISO string format
|
|
dateDebutReelle?: string;
|
|
dateFinReelle?: string;
|
|
statut: StatutPhase;
|
|
pourcentageAvancement?: number;
|
|
budgetPrevu?: number;
|
|
coutReel?: number;
|
|
responsable?: any; // Import du type Employe existant
|
|
equipes?: any[]; // Import du type Equipe existant
|
|
prerequis?: string;
|
|
livrables?: string;
|
|
risques?: string;
|
|
notes?: string;
|
|
critique?: boolean;
|
|
dateCreation?: string; // ISO string format
|
|
dateModification?: string; // ISO string format
|
|
actif?: boolean;
|
|
// Propriétés étendues pour la création de phases
|
|
dureeEstimeeHeures?: number;
|
|
priorite?: string; // ou enum selon votre système
|
|
prerequisPhases?: string[]; // Liste des IDs des phases prérequises
|
|
competencesRequises?: string[];
|
|
materielsNecessaires?: string[];
|
|
fournisseursRecommandes?: string[];
|
|
jalons?: JalonPhase[];
|
|
pointages?: PointagePhase[];
|
|
// Nouveaux champs pour la gestion avancée des coûts et matériels
|
|
materielsRequis?: MaterielPhase[];
|
|
fournisseursAssocies?: FournisseurPhase[];
|
|
coutMateriau?: number;
|
|
coutMainOeuvre?: number;
|
|
coutSousTraitance?: number;
|
|
coutAutres?: number;
|
|
margePrevieweBrute?: number;
|
|
margePrevueNette?: number;
|
|
margeReelle?: number;
|
|
tauxMarge?: number;
|
|
prixVenteUnitaire?: number;
|
|
quantitePrevue?: number;
|
|
quantiteReelle?: number;
|
|
unite?: string;
|
|
}
|
|
|
|
export interface JalonPhase {
|
|
id?: number;
|
|
nom: string;
|
|
description?: string;
|
|
phase: PhaseChantier;
|
|
typeJalon: TypeJalon;
|
|
datePrevue: Date;
|
|
dateReelle?: Date;
|
|
statut: StatutJalon;
|
|
critique?: boolean;
|
|
responsable?: string;
|
|
livrablesRequis?: string;
|
|
criteresValidation?: string;
|
|
notesValidation?: string;
|
|
validePar?: string;
|
|
dateValidation?: Date;
|
|
notes?: string;
|
|
dateCreation?: Date;
|
|
dateModification?: Date;
|
|
}
|
|
|
|
export interface PointagePhase {
|
|
id?: number;
|
|
phase: PhaseChantier;
|
|
employe: any; // Import du type Employe existant
|
|
date: Date;
|
|
heureDebut?: string;
|
|
heureFin?: string;
|
|
heuresTravaillees?: number;
|
|
heuresSupplementaires?: number;
|
|
typePointage: TypePointage;
|
|
description?: string;
|
|
tauxHoraire?: number;
|
|
coutTotal?: number;
|
|
valide?: boolean;
|
|
validePar?: string;
|
|
dateValidation?: Date;
|
|
facture?: boolean;
|
|
factureAssociee?: any; // Import du type Facture existant
|
|
notes?: string;
|
|
dateCreation?: Date;
|
|
}
|
|
|
|
// Interfaces pour la gestion avancée des matériels et fournisseurs de phases
|
|
export interface MaterielPhase {
|
|
id?: number;
|
|
phase: PhaseChantier;
|
|
materiel?: any; // Import du type Materiel existant
|
|
designation: string;
|
|
reference?: string;
|
|
quantitePrevue: number;
|
|
quantiteUtilisee?: number;
|
|
unite: string;
|
|
prixUnitaireCatalogue?: number;
|
|
prixUnitaireNegocie?: number;
|
|
coutTotal?: number;
|
|
fournisseurPrincipal?: Fournisseur;
|
|
fournisseursAlternatifs?: FournisseurPhase[];
|
|
delaiLivraison?: number;
|
|
enStock?: boolean;
|
|
quantiteStock?: number;
|
|
seuilCritique?: number;
|
|
categorie?: string;
|
|
specifications?: string;
|
|
dateCreation?: Date;
|
|
dateModification?: Date;
|
|
}
|
|
|
|
export interface FournisseurPhase {
|
|
id?: number;
|
|
phase: PhaseChantier;
|
|
fournisseur: Fournisseur;
|
|
materielPhase?: MaterielPhase;
|
|
typeContribution: 'MATERIEL' | 'SERVICE' | 'SOUS_TRAITANCE' | 'LOCATION' | 'TRANSPORT';
|
|
prixCatalogue?: number;
|
|
prixNegocie?: number;
|
|
remise?: number;
|
|
tauxRemise?: number;
|
|
delaiLivraison?: number;
|
|
conditionsPaiement?: string;
|
|
garantie?: string;
|
|
notes?: string;
|
|
priorite?: number; // 1 = principal, 2 = alternatif, etc.
|
|
valide?: boolean;
|
|
dateNegociation?: Date;
|
|
validePar?: string;
|
|
dateCreation?: Date;
|
|
dateModification?: Date;
|
|
}
|
|
|
|
export interface AnalysePrixPhase {
|
|
id?: number;
|
|
phase: PhaseChantier;
|
|
coutMateriauxTotal: number;
|
|
coutMainOeuvreTotal: number;
|
|
coutSousTraitanceTotal: number;
|
|
coutAutresTotal: number;
|
|
coutTotalDirect: number;
|
|
fraisGeneraux?: number;
|
|
tauxFraisGeneraux?: number;
|
|
coutTotalAvecFrais: number;
|
|
margeObjectif?: number;
|
|
tauxMargeObjectif?: number;
|
|
prixVenteCalcule: number;
|
|
prixVentePropose?: number;
|
|
prixVenteAccepte?: number;
|
|
rentabilitePrevisionnelle?: number;
|
|
rentabiliteReelle?: number;
|
|
dateAnalyse?: Date;
|
|
analysePar?: string;
|
|
validee?: boolean;
|
|
dateValidation?: Date;
|
|
validePar?: string;
|
|
commentaires?: string;
|
|
}
|
|
|
|
// Interfaces pour la gestion financière avancée
|
|
export interface SituationTravaux {
|
|
id?: number;
|
|
numeroSituation: string;
|
|
chantier: any; // Import du type Chantier existant
|
|
periodeDebut: Date;
|
|
periodeFin: Date;
|
|
dateEtablissement: Date;
|
|
dateEnvoi?: Date;
|
|
dateValidationClient?: Date;
|
|
statut: StatutSituation;
|
|
montantHTTravaux?: number;
|
|
montantRevisions?: number;
|
|
montantAvenants?: number;
|
|
montantTotalHT?: number;
|
|
montantTVA?: number;
|
|
montantTTC?: number;
|
|
tauxRetenueGarantie?: number;
|
|
montantRetenueGarantie?: number;
|
|
montantAcomptesPrecedents?: number;
|
|
montantNetAPayer?: number;
|
|
pourcentageAvancement?: number;
|
|
observations?: string;
|
|
etabliPar?: string;
|
|
valideParClient?: string;
|
|
delaiPaiementJours?: number;
|
|
dateEcheancePaiement?: Date;
|
|
dateCreation?: Date;
|
|
dateModification?: Date;
|
|
lignes?: LigneSituationTravaux[];
|
|
factureGeneree?: any; // Import du type Facture existant
|
|
}
|
|
|
|
export interface LigneSituationTravaux {
|
|
id?: number;
|
|
situationTravaux: SituationTravaux;
|
|
ligneDevis?: any; // Import du type LigneDevis existant
|
|
designation: string;
|
|
quantitePrevue?: number;
|
|
quantiteRealisee?: number;
|
|
quantitePrecedente?: number;
|
|
quantitePeriode?: number;
|
|
unite: string;
|
|
prixUnitaireHT: number;
|
|
tauxTVA: number;
|
|
pourcentageAvancement?: number;
|
|
observations?: string;
|
|
montantHT?: number;
|
|
montantTVA?: number;
|
|
montantTTC?: number;
|
|
montantHTPrecedent?: number;
|
|
montantHTPeriode?: number;
|
|
}
|
|
|
|
// Interfaces pour la gestion du stock avancée
|
|
export interface MouvementStock {
|
|
id?: number;
|
|
materiel: any; // Import du type Materiel existant
|
|
typeMouvement: TypeMouvement;
|
|
quantite: number;
|
|
prixUnitaire?: number;
|
|
chantier?: any; // Import du type Chantier existant
|
|
employe?: any; // Import du type Employe existant
|
|
fournisseur?: Fournisseur;
|
|
commandeFournisseur?: CommandeFournisseur;
|
|
referenceDocument?: string;
|
|
emplacement?: string;
|
|
motif?: string;
|
|
utilisateur: string;
|
|
stockAvant?: number;
|
|
stockApres?: number;
|
|
valeurMouvement?: number;
|
|
dateMouvement?: Date;
|
|
annule?: boolean;
|
|
dateAnnulation?: Date;
|
|
annulePar?: string;
|
|
motifAnnulation?: string;
|
|
}
|
|
|
|
export interface AlerteStock {
|
|
id?: number;
|
|
materiel: any; // Import du type Materiel existant
|
|
typeAlerte: TypeAlerte;
|
|
niveauSeverite: NiveauSeverite;
|
|
message: string;
|
|
quantiteActuelle?: number;
|
|
seuil?: number;
|
|
active?: boolean;
|
|
acquittee?: boolean;
|
|
dateAcquittement?: Date;
|
|
acquitteePar?: string;
|
|
actionsEntreprises?: string;
|
|
dateCreation?: Date;
|
|
dateModification?: Date;
|
|
dateDerniereNotification?: Date;
|
|
nombreNotifications?: number;
|
|
}
|
|
|
|
// Interfaces pour la gestion documentaire
|
|
export interface Document {
|
|
id?: number;
|
|
nom: string;
|
|
description?: string;
|
|
typeDocument: TypeDocument;
|
|
cheminFichier: string;
|
|
nomFichier: string;
|
|
typeMime?: string;
|
|
tailleFichier?: number;
|
|
version?: number;
|
|
numeroVersion?: string;
|
|
estVersionCourante?: boolean;
|
|
chantier?: any; // Import du type Chantier existant
|
|
client?: any; // Import du type Client existant
|
|
fournisseur?: Fournisseur;
|
|
employe?: any; // Import du type Employe existant
|
|
documentParent?: Document;
|
|
versions?: Document[];
|
|
confidentiel?: boolean;
|
|
dateExpiration?: Date;
|
|
motsCles?: string;
|
|
checksum?: string;
|
|
dateCreation?: Date;
|
|
dateModification?: Date;
|
|
creePar?: string;
|
|
modifiePar?: string;
|
|
}
|
|
|
|
// Interfaces pour les libellés et options
|
|
export interface TypeFournisseurOption {
|
|
value: TypeFournisseur;
|
|
label: string;
|
|
}
|
|
|
|
export interface StatutOption {
|
|
value: string;
|
|
label: string;
|
|
color?: string;
|
|
}
|
|
|
|
// Constantes pour les libellés
|
|
export const TYPE_FOURNISSEUR_LABELS: Record<TypeFournisseur, string> = {
|
|
MATERIEL: 'Matériel',
|
|
SERVICE: 'Service',
|
|
SOUS_TRAITANT: 'Sous-traitant',
|
|
LOCATION: 'Location',
|
|
TRANSPORT: 'Transport',
|
|
CONSOMMABLE: 'Consommable'
|
|
};
|
|
|
|
export const STATUT_COMMANDE_LABELS: Record<StatutCommande, string> = {
|
|
BROUILLON: 'Brouillon',
|
|
ENVOYEE: 'Envoyée',
|
|
CONFIRMEE: 'Confirmée',
|
|
PARTIELLEMENT_LIVREE: 'Partiellement livrée',
|
|
LIVREE: 'Livrée',
|
|
FACTUREE: 'Facturée',
|
|
ANNULEE: 'Annulée'
|
|
};
|
|
|
|
export const STATUT_PHASE_LABELS: Record<StatutPhase, string> = {
|
|
PLANIFIEE: 'Planifiée',
|
|
EN_ATTENTE: 'En attente',
|
|
EN_COURS: 'En cours',
|
|
EN_PAUSE: 'En pause',
|
|
TERMINEE: 'Terminée',
|
|
ANNULEE: 'Annulée',
|
|
EN_RETARD: 'En retard'
|
|
};
|
|
|
|
export const NIVEAU_SEVERITE_LABELS: Record<NiveauSeverite, string> = {
|
|
INFO: 'Information',
|
|
WARNING: 'Attention',
|
|
CRITICAL: 'Critique',
|
|
URGENT: 'Urgent'
|
|
};
|
|
|
|
export const NIVEAU_SEVERITE_COLORS: Record<NiveauSeverite, string> = {
|
|
INFO: '#17a2b8',
|
|
WARNING: '#ffc107',
|
|
CRITICAL: '#dc3545',
|
|
URGENT: '#dc3545'
|
|
};
|
|
|
|
// Types pour les réponses API
|
|
export interface ApiResponse<T> {
|
|
data: T;
|
|
message?: string;
|
|
errors?: string[];
|
|
}
|
|
|
|
export interface PaginatedResponse<T> {
|
|
data: T[];
|
|
total: number;
|
|
page: number;
|
|
size: number;
|
|
totalPages: number;
|
|
}
|
|
|
|
// Types pour les formulaires
|
|
export interface FournisseurFormData extends Omit<Fournisseur, 'id' | 'dateCreation' | 'dateModification' | 'nombreCommandes' | 'nombreArticlesCatalogue'> {}
|
|
|
|
export interface CommandeFournisseurFormData extends Omit<CommandeFournisseur, 'id' | 'numeroCommande' | 'dateCreation' | 'dateModification' | 'lignes' | 'livraisons'> {}
|
|
|
|
export interface PhaseChantierFormData extends Omit<PhaseChantier, 'id' | 'dateCreation' | 'dateModification' | 'jalons' | 'pointages' | 'sousPhases'> {
|
|
chantierId?: string;
|
|
phaseParentId?: string;
|
|
}
|
|
|
|
// Alias for compatibility
|
|
export interface PhaseFormData extends PhaseChantierFormData {}
|
|
|
|
// Types pour les filtres et recherches
|
|
export interface FournisseurFilters {
|
|
nom?: string;
|
|
type?: TypeFournisseur;
|
|
ville?: string;
|
|
actif?: boolean;
|
|
}
|
|
|
|
export interface CommandeFilters {
|
|
numeroCommande?: string;
|
|
fournisseurId?: number;
|
|
chantierId?: number;
|
|
statut?: StatutCommande;
|
|
dateDebutCommande?: Date;
|
|
dateFinCommande?: Date;
|
|
}
|
|
|
|
export interface PhaseFilters {
|
|
chantierId?: number;
|
|
statut?: StatutPhase;
|
|
responsableId?: number;
|
|
critique?: boolean;
|
|
enRetard?: boolean;
|
|
}
|
|
|
|
// Types pour les statistiques et tableaux de bord
|
|
export interface StatistiquesFournisseur {
|
|
totalFournisseurs: number;
|
|
fournisseursActifs: number;
|
|
repartitionParType: Record<TypeFournisseur, number>;
|
|
totalCommandes: number;
|
|
montantTotalCommandes: number;
|
|
}
|
|
|
|
export interface StatistiquesChantier {
|
|
totalPhases: number;
|
|
phasesEnCours: number;
|
|
phasesEnRetard: number;
|
|
phasesTerminees: number;
|
|
avancementMoyen: number;
|
|
budgetTotal: number;
|
|
coutReel: number;
|
|
ecartBudget: number;
|
|
} |