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

211
types/auth.ts Normal file
View File

@@ -0,0 +1,211 @@
/**
* Types d'authentification pour BTP Xpress
* Synchronisé avec le backend Java et Keycloak
*/
// Énumération des rôles utilisateur (synchronisée avec UserRole.java)
export enum UserRole {
ADMIN = 'ADMIN',
MANAGER = 'MANAGER',
CHEF_CHANTIER = 'CHEF_CHANTIER',
OUVRIER = 'OUVRIER',
COMPTABLE = 'COMPTABLE',
GESTIONNAIRE_PROJET = 'GESTIONNAIRE_PROJET',
CLIENT = 'CLIENT'
}
// Statut utilisateur (synchronisé avec UserStatus.java)
export enum UserStatus {
PENDING = 'PENDING',
APPROVED = 'APPROVED',
REJECTED = 'REJECTED',
SUSPENDED = 'SUSPENDED',
ACTIVE = 'ACTIVE',
INACTIVE = 'INACTIVE'
}
// Interface utilisateur complète
export interface User {
id: string;
email: string;
nom: string;
prenom: string;
username: string;
firstName?: string;
lastName?: string;
fullName?: string;
role: UserRole;
roles: string[];
permissions: string[];
highestRole?: string;
actif: boolean;
status: UserStatus;
telephone?: string;
adresse?: string;
codePostal?: string;
ville?: string;
entreprise?: string;
siret?: string;
secteurActivite?: string;
effectif?: number;
commentaireAdmin?: string;
dateCreation: Date;
dateModification: Date;
derniereConnexion?: Date;
// Propriétés calculées pour la compatibilité
isAdmin: boolean;
isManager: boolean;
isEmployee: boolean;
isClient: boolean;
}
// Interface pour les informations utilisateur simplifiées (AuthContext)
export interface UserInfo {
id: string;
username: string;
email: string;
firstName?: string;
lastName?: string;
fullName?: string;
roles: string[];
permissions: string[];
highestRole?: string;
isAdmin: boolean;
isManager: boolean;
isEmployee: boolean;
isClient: boolean;
}
// État d'authentification
export interface AuthState {
isAuthenticated: boolean;
isLoading: boolean;
user: UserInfo | null;
token: string | null;
refreshToken: string | null;
error: string | null;
}
// Contexte d'authentification
export interface AuthContextType extends AuthState {
login: () => Promise<void>;
logout: () => Promise<void>;
refreshAuth: () => Promise<void>;
hasRole: (role: string) => boolean;
hasAnyRole: (roles: string[]) => boolean;
hasPermission: (permission: string) => boolean;
isRoleHigher: (role: string) => boolean;
updateToken: (minValidity?: number) => Promise<boolean>;
}
// Permissions système
export interface Permission {
id: string;
name: string;
description: string;
resource: string;
action: string;
}
// Données de connexion
export interface LoginCredentials {
email: string;
password: string;
}
// Réponse d'authentification
export interface AuthResponse {
user: UserInfo;
token: string;
refreshToken: string;
expiresIn: number;
}
// Données d'inscription
export interface RegisterData {
email: string;
nom: string;
prenom: string;
password: string;
telephone?: string;
adresse?: string;
codePostal?: string;
ville?: string;
entreprise?: string;
siret?: string;
secteurActivite?: string;
effectif?: number;
}
// Données de profil utilisateur
export interface UserProfile {
id: string;
email: string;
nom: string;
prenom: string;
telephone?: string;
adresse?: string;
codePostal?: string;
ville?: string;
entreprise?: string;
siret?: string;
secteurActivite?: string;
effectif?: number;
}
// Changement de mot de passe
export interface PasswordChangeData {
currentPassword: string;
newPassword: string;
confirmPassword: string;
}
// Reset de mot de passe
export interface PasswordResetData {
email: string;
}
export interface PasswordResetConfirmData {
token: string;
newPassword: string;
confirmPassword: string;
}
// Utilitaires de rôles
export const RoleHierarchy: Record<UserRole, number> = {
[UserRole.ADMIN]: 1,
[UserRole.MANAGER]: 2,
[UserRole.GESTIONNAIRE_PROJET]: 3,
[UserRole.CHEF_CHANTIER]: 4,
[UserRole.COMPTABLE]: 4,
[UserRole.OUVRIER]: 5,
[UserRole.CLIENT]: 6
};
export const RoleDisplayNames: Record<UserRole, string> = {
[UserRole.ADMIN]: 'Administrateur',
[UserRole.MANAGER]: 'Manager',
[UserRole.GESTIONNAIRE_PROJET]: 'Gestionnaire de projet',
[UserRole.CHEF_CHANTIER]: 'Chef de chantier',
[UserRole.COMPTABLE]: 'Comptable',
[UserRole.OUVRIER]: 'Ouvrier',
[UserRole.CLIENT]: 'Client'
};
// Fonctions utilitaires
export const isRoleHigher = (role1: UserRole, role2: UserRole): boolean => {
return RoleHierarchy[role1] < RoleHierarchy[role2];
};
export const isManagementRole = (role: UserRole): boolean => {
return [UserRole.ADMIN, UserRole.MANAGER, UserRole.GESTIONNAIRE_PROJET].includes(role);
};
export const isFieldRole = (role: UserRole): boolean => {
return [UserRole.CHEF_CHANTIER, UserRole.OUVRIER].includes(role);
};
export const isAdministrativeRole = (role: UserRole): boolean => {
return [UserRole.ADMIN, UserRole.COMPTABLE].includes(role);
};

561
types/btp-extended.ts Normal file
View File

@@ -0,0 +1,561 @@
/**
* 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;
}

530
types/btp.ts Normal file
View File

@@ -0,0 +1,530 @@
/**
* 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;
}

155
types/chantier-form.ts Normal file
View File

@@ -0,0 +1,155 @@
/**
* Types pour les formulaires de chantier avec gestion avancée des types et phases
*/
import { TypeChantier } from './chantier-templates';
// Interface pour le formulaire de création/modification de chantier
export interface ChantierFormData {
nom: string;
description?: string;
adresse: string;
codePostal?: string;
ville?: string;
dateDebut: string;
dateFinPrevue?: string;
montantPrevu?: number;
clientId: string;
// Nouveaux champs avancés
typeChantier: TypeChantier;
surface?: number;
nombreNiveaux?: number;
autoGenererPhases: boolean;
inclureSousPhases: boolean;
ajusterDelais: boolean;
// Spécificités et contraintes
specificites?: string[];
contraintes?: string;
accesPMR?: boolean;
performanceEnergetique?: string;
// Informations techniques
natureTerrain?: string;
presenceReseaux?: boolean;
accessibiliteChantier?: 'FACILE' | 'MOYENNE' | 'DIFFICILE';
stockagePossible?: boolean;
// Réglementation
permisRequis?: boolean;
numeroPermis?: string;
dateObtentionPermis?: string;
controleUrbanismeRequis?: boolean;
// Options de planification
margeSecurite?: number; // en jours
periodesTravailRestreintes?: Array<{
dateDebut: string;
dateFin: string;
motif: string;
}>;
// Équipes et ressources préférées
equipePrefereId?: string;
materielsRequis?: string[];
}
// Interface pour la prévisualisation du projet
export interface ChantierPreview {
typeChantier: TypeChantier;
nom: string;
dureeEstimee: number;
dateFinEstimee: Date;
complexite: {
niveau: 'SIMPLE' | 'MOYEN' | 'COMPLEXE' | 'TRES_COMPLEXE';
score: number;
facteurs: string[];
};
phasesCount: number;
sousePhasesCount: number;
specificites: string[];
reglementations: string[];
coutEstime?: number;
}
// Interface pour les options de génération de phases
export interface PhaseGenerationOptions {
inclureSousPhases: boolean;
ajusterDelais: boolean;
margeSecurite: number;
personnaliserDurees: boolean;
conserverOrdreStandard: boolean;
genererMateriels: boolean;
genererFournisseurs: boolean;
calculerAnalysePrix: boolean;
}
// Interface pour les contraintes temporelles
export interface ContrainteTemporelle {
id?: string;
nom: string;
dateDebut: string;
dateFin: string;
type: 'INTEMPERIE' | 'CONGE' | 'AUTRE_CHANTIER' | 'MAINTENANCE' | 'REGLEMENTATION';
description?: string;
impactPhases?: string[]; // IDs des phases impactées
}
// Interface pour la validation du formulaire
export interface ChantierFormValidation {
isValid: boolean;
errors: {
[key in keyof ChantierFormData]?: string;
};
warnings: string[];
recommendations: string[];
}
// Interface pour les données calculées
export interface ChantierCalculatedData {
dureeEstimee: number;
dateFinCalculee: Date;
coutEstimeTotal?: number;
coutEstimeParPhase?: { [phaseId: string]: number };
ressourcesRequises: {
equipes: number;
materiels: string[];
competences: string[];
};
jalonsImportants: Array<{
nom: string;
date: Date;
critique: boolean;
}>;
}
// Types pour les options de projet
export type AccessibiliteChantier = 'FACILE' | 'MOYENNE' | 'DIFFICILE';
export type NatureTerrain = 'PLAT' | 'PENTE_LEGERE' | 'PENTE_FORTE' | 'ROCHEUX' | 'HUMIDE' | 'INSTABLE';
export type PerformanceEnergetique = 'RT2012' | 'RT2020' | 'RE2020' | 'PASSIF' | 'POSITIF' | 'STANDARD';
// Constantes pour les options
export const ACCESSIBILITE_OPTIONS = [
{ value: 'FACILE', label: 'Facile - Accès direct, terrain plat' },
{ value: 'MOYENNE', label: 'Moyenne - Quelques contraintes d\'accès' },
{ value: 'DIFFICILE', label: 'Difficile - Accès restreint, terrain complexe' }
] as const;
export const NATURE_TERRAIN_OPTIONS = [
{ value: 'PLAT', label: 'Terrain plat' },
{ value: 'PENTE_LEGERE', label: 'Pente légère' },
{ value: 'PENTE_FORTE', label: 'Pente forte' },
{ value: 'ROCHEUX', label: 'Terrain rocheux' },
{ value: 'HUMIDE', label: 'Terrain humide' },
{ value: 'INSTABLE', label: 'Terrain instable' }
] as const;
export const PERFORMANCE_ENERGETIQUE_OPTIONS = [
{ value: 'STANDARD', label: 'Standard (réglementation minimale)' },
{ value: 'RT2012', label: 'RT 2012' },
{ value: 'RT2020', label: 'RT 2020' },
{ value: 'RE2020', label: 'RE 2020 (obligatoire neuf)' },
{ value: 'PASSIF', label: 'Bâtiment passif' },
{ value: 'POSITIF', label: 'Bâtiment à énergie positive' }
] as const;

303
types/chantier-templates.ts Normal file
View File

@@ -0,0 +1,303 @@
/**
* Types et templates pour la gestion automatique des phases de chantier BTP
* Système de pré-configuration des phases selon le type de chantier
*/
// Types de chantiers BTP avec classification métier complète
export type TypeChantier =
// Bâtiment résidentiel
| 'MAISON_INDIVIDUELLE'
| 'IMMEUBLE_COLLECTIF'
| 'RENOVATION_RESIDENTIELLE'
| 'EXTENSION_RESIDENTIELLE'
// Bâtiment tertiaire
| 'BUREAU_COMMERCIAL'
| 'CENTRE_COMMERCIAL'
| 'ETABLISSEMENT_SCOLAIRE'
| 'ETABLISSEMENT_SANTE'
| 'ETABLISSEMENT_SPORTIF'
| 'ENTREPOT_LOGISTIQUE'
// Infrastructure
| 'VOIRIE_URBAINE'
| 'AUTOROUTE'
| 'PONT_VIADUC'
| 'TUNNEL'
| 'PARKING'
| 'AIRE_AMENAGEE'
// Industriel
| 'USINE_INDUSTRIELLE'
| 'CENTRALE_ENERGIE'
| 'STATION_EPURATION'
| 'INSTALLATION_CHIMIQUE'
// Spécialisé
| 'PISCINE'
| 'COURT_TENNIS'
| 'TERRAIN_SPORT'
| 'MONUMENT_HISTORIQUE'
| 'OUVRAGE_ART';
// Interface pour une phase template
export interface PhaseTemplate {
id: string;
nom: string;
description: string;
ordreExecution: number;
dureePrevueJours: number;
critique: boolean;
prerequis?: string[];
sousPhases?: SousPhaseTemplate[];
materielsTypes?: string[];
competencesRequises?: string[];
controleQualite?: string[];
}
// Interface pour une sous-phase template
export interface SousPhaseTemplate {
id: string;
nom: string;
description: string;
ordreExecution: number;
dureePrevueJours: number;
materielsTypes?: string[];
competencesRequises?: string[];
}
// Interface pour un template de chantier complet
export interface ChantierTemplate {
typeChantier: TypeChantier;
nom: string;
description: string;
dureeMoyenneJours: number;
phases: PhaseTemplate[];
specificites?: string[];
reglementations?: string[];
}
// Libellés pour les types de chantiers
export const TYPE_CHANTIER_LABELS: Record<TypeChantier, string> = {
// Résidentiel
MAISON_INDIVIDUELLE: 'Maison individuelle',
IMMEUBLE_COLLECTIF: 'Immeuble collectif',
RENOVATION_RESIDENTIELLE: 'Rénovation résidentielle',
EXTENSION_RESIDENTIELLE: 'Extension résidentielle',
// Tertiaire
BUREAU_COMMERCIAL: 'Bureau / Commerce',
CENTRE_COMMERCIAL: 'Centre commercial',
ETABLISSEMENT_SCOLAIRE: 'Établissement scolaire',
ETABLISSEMENT_SANTE: 'Établissement de santé',
ETABLISSEMENT_SPORTIF: 'Établissement sportif',
ENTREPOT_LOGISTIQUE: 'Entrepôt / Logistique',
// Infrastructure
VOIRIE_URBAINE: 'Voirie urbaine',
AUTOROUTE: 'Autoroute',
PONT_VIADUC: 'Pont / Viaduc',
TUNNEL: 'Tunnel',
PARKING: 'Parking',
AIRE_AMENAGEE: 'Aire aménagée',
// Industriel
USINE_INDUSTRIELLE: 'Usine industrielle',
CENTRALE_ENERGIE: 'Centrale énergétique',
STATION_EPURATION: 'Station d\'épuration',
INSTALLATION_CHIMIQUE: 'Installation chimique',
// Spécialisé
PISCINE: 'Piscine',
COURT_TENNIS: 'Court de tennis',
TERRAIN_SPORT: 'Terrain de sport',
MONUMENT_HISTORIQUE: 'Monument historique',
OUVRAGE_ART: 'Ouvrage d\'art'
};
// Catégories de chantiers pour l'organisation
export const CATEGORIES_CHANTIER = {
RESIDENTIEL: {
label: 'Résidentiel',
types: ['MAISON_INDIVIDUELLE', 'IMMEUBLE_COLLECTIF', 'RENOVATION_RESIDENTIELLE', 'EXTENSION_RESIDENTIELLE'] as TypeChantier[]
},
TERTIAIRE: {
label: 'Tertiaire',
types: ['BUREAU_COMMERCIAL', 'CENTRE_COMMERCIAL', 'ETABLISSEMENT_SCOLAIRE', 'ETABLISSEMENT_SANTE', 'ETABLISSEMENT_SPORTIF', 'ENTREPOT_LOGISTIQUE'] as TypeChantier[]
},
INFRASTRUCTURE: {
label: 'Infrastructure',
types: ['VOIRIE_URBAINE', 'AUTOROUTE', 'PONT_VIADUC', 'TUNNEL', 'PARKING', 'AIRE_AMENAGEE'] as TypeChantier[]
},
INDUSTRIEL: {
label: 'Industriel',
types: ['USINE_INDUSTRIELLE', 'CENTRALE_ENERGIE', 'STATION_EPURATION', 'INSTALLATION_CHIMIQUE'] as TypeChantier[]
},
SPECIALISE: {
label: 'Spécialisé',
types: ['PISCINE', 'COURT_TENNIS', 'TERRAIN_SPORT', 'MONUMENT_HISTORIQUE', 'OUVRAGE_ART'] as TypeChantier[]
}
} as const;
// Templates de phases communes à tous les types de chantiers
export const PHASES_COMMUNES: PhaseTemplate[] = [
{
id: 'etudes-preliminaires',
nom: 'Études préliminaires et définition du projet',
description: 'Analyse de faisabilité, études de sol, définition du programme',
ordreExecution: 1,
dureePrevueJours: 30,
critique: true,
sousPhases: [
{
id: 'analyse-faisabilite',
nom: 'Analyse de faisabilité',
description: 'Étude technique, économique et réglementaire',
ordreExecution: 1,
dureePrevueJours: 10,
competencesRequises: ['Bureau d\'études', 'Économiste']
},
{
id: 'releves-topographiques',
nom: 'Relevés topographiques',
description: 'Levés de terrain et cartographie',
ordreExecution: 2,
dureePrevueJours: 5,
materielsTypes: ['Matériel topographique'],
competencesRequises: ['Géomètre']
},
{
id: 'etudes-geotechniques',
nom: 'Études géotechniques',
description: 'Étude de sol et recommandations fondations',
ordreExecution: 3,
dureePrevueJours: 10,
materielsTypes: ['Foreuse', 'Équipement laboratoire'],
competencesRequises: ['Géotechnicien']
},
{
id: 'analyse-environnementale',
nom: 'Analyse environnementale',
description: 'Impact environnemental et contraintes réglementaires',
ordreExecution: 4,
dureePrevueJours: 5,
competencesRequises: ['Expert environnemental']
}
],
competencesRequises: ['Maître d\'œuvre', 'Bureau d\'études'],
controleQualite: ['Validation études géotechniques', 'Conformité réglementaire']
},
{
id: 'conception-projet',
nom: 'Conception du projet',
description: 'Avant-projets, plans détaillés, demandes d\'autorisation',
ordreExecution: 2,
dureePrevueJours: 45,
critique: true,
prerequis: ['etudes-preliminaires'],
sousPhases: [
{
id: 'avant-projet-sommaire',
nom: 'Avant-projet sommaire (APS)',
description: 'Définition générale du projet',
ordreExecution: 1,
dureePrevueJours: 15,
competencesRequises: ['Architecte', 'Bureau d\'études']
},
{
id: 'avant-projet-definitif',
nom: 'Avant-projet définitif (APD)',
description: 'Finalisation conception et dimensionnement',
ordreExecution: 2,
dureePrevueJours: 20,
competencesRequises: ['Architecte', 'Bureau d\'études', 'Économiste']
},
{
id: 'plans-detailles',
nom: 'Plans détaillés d\'exécution',
description: 'Plans techniques et spécifications',
ordreExecution: 3,
dureePrevueJours: 10,
competencesRequises: ['Dessinateur', 'Bureau d\'études']
}
],
competencesRequises: ['Architecte', 'Bureau d\'études'],
controleQualite: ['Validation architecturale', 'Conformité technique']
},
{
id: 'preparation-chantier',
nom: 'Préparation du chantier',
description: 'Organisation du site, approvisionnements, coordination',
ordreExecution: 3,
dureePrevueJours: 20,
critique: true,
prerequis: ['conception-projet'],
sousPhases: [
{
id: 'organisation-site',
nom: 'Organisation du site',
description: 'Plan d\'installation de chantier (PIC)',
ordreExecution: 1,
dureePrevueJours: 5,
competencesRequises: ['Conducteur de travaux']
},
{
id: 'implantation-terrain',
nom: 'Implantation sur le terrain',
description: 'Piquetage et marquage',
ordreExecution: 2,
dureePrevueJours: 3,
materielsTypes: ['Matériel topographique'],
competencesRequises: ['Géomètre', 'Chef d\'équipe']
},
{
id: 'installation-bases-vie',
nom: 'Installation des bases vie',
description: 'Espaces de travail, sanitaires, stockage',
ordreExecution: 3,
dureePrevueJours: 5,
materielsTypes: ['Bungalows', 'Clôtures', 'Raccordements'],
competencesRequises: ['Équipe installation']
},
{
id: 'approvisionnement-logistique',
nom: 'Approvisionnement et logistique',
description: 'Commandes matériaux et planification livraisons',
ordreExecution: 4,
dureePrevueJours: 7,
competencesRequises: ['Responsable logistique']
}
],
competencesRequises: ['Conducteur de travaux', 'Chef de chantier'],
controleQualite: ['Plan de sécurité validé', 'Autorisations administratives']
}
];
// Export des constantes utiles
export const DUREE_MOYENNE_PAR_TYPE: Record<TypeChantier, number> = {
MAISON_INDIVIDUELLE: 270,
IMMEUBLE_COLLECTIF: 540,
RENOVATION_RESIDENTIELLE: 180,
EXTENSION_RESIDENTIELLE: 120,
BUREAU_COMMERCIAL: 360,
CENTRE_COMMERCIAL: 720,
ETABLISSEMENT_SCOLAIRE: 600,
ETABLISSEMENT_SANTE: 900,
ETABLISSEMENT_SPORTIF: 480,
ENTREPOT_LOGISTIQUE: 240,
VOIRIE_URBAINE: 150,
AUTOROUTE: 1080,
PONT_VIADUC: 900,
TUNNEL: 1440,
PARKING: 120,
AIRE_AMENAGEE: 90,
USINE_INDUSTRIELLE: 720,
CENTRALE_ENERGIE: 1800,
STATION_EPURATION: 540,
INSTALLATION_CHIMIQUE: 960,
PISCINE: 90,
COURT_TENNIS: 45,
TERRAIN_SPORT: 60,
MONUMENT_HISTORIQUE: 720,
OUVRAGE_ART: 540
};

260
types/demo.d.ts vendored Normal file
View File

@@ -0,0 +1,260 @@
import { ColorPicker } from 'primereact/colorpicker';
// FullCalendar Types
import { EventApi, EventInput } from '@fullcalendar/core';
// Chart.js Types
import { ChartData, ChartOptions } from 'chart.js';
// Custom Types
type InventoryStatus = 'INSTOCK' | 'LOWSTOCK' | 'OUTOFSTOCK';
type Status = 'DELIVERED' | 'PENDING' | 'RETURNED' | 'CANCELLED';
type SmallFolder = Omit<BaseFolder, 'icon'> & { icon: 'pi pi-folder' | 'pi pi-images' | 'pi pi-folder-open' };
type LargeFolder = Omit<BaseFolder, 'icon'> & { icon: 'pi pi-folder' | 'pi pi-image' | 'pi pi-folder-open' };
type Icon = 'pi pi-image' | 'pi pi-file-excel' | 'pi pi-file-pdf' | 'pi pi-ellipsis-v' | 'pi pi-folder' | 'pi pi-images' | 'pi pi-folder-open';
type Color = 'bg-yellow-500' | 'bg-pink-500' | 'bg-green-500' | 'bg-indigo-500';
type MailKeys = 'important' | 'starred' | 'trash' | 'spam' | 'archived' | 'sent';
// Exported Types
export type LayoutType = 'list' | 'grid';
export type SortOrderType = 1 | 0 | -1;
// Interfaces
export interface CustomEvent {
name?: string;
status?: 'Ordered' | 'Processing' | 'Shipped' | 'Delivered';
date?: string;
color?: string;
icon?: string;
image?: string;
}
interface ShowOptions {
severity?: string;
content?: string;
summary?: string;
detail?: string;
life?: number;
}
export interface ChartDataState {
barData?: ChartData;
pieData?: ChartData;
lineData?: ChartData;
polarData?: ChartData;
radarData?: ChartData;
}
export interface ChartOptionsState {
barOptions?: ChartOptions;
pieOptions?: ChartOptions;
lineOptions?: ChartOptions;
polarOptions?: ChartOptions;
radarOptions?: ChartOptions;
}
export interface AppMailProps {
mails: Demo.Mail[];
}
export interface AppMailSidebarItem {
label: string;
icon: string;
to?: string;
badge?: number;
badgeValue?: number;
}
export interface AppMailReplyProps {
content: Demo.Mail | null;
hide: () => void;
}
// Demo Namespace
declare namespace Demo {
// Interfaces
interface Base {
name: string;
icon: Icon;
objectURL?: string;
}
interface IFile extends Base {
date: string;
fileSize: string;
}
interface Metric {
title: string;
icon: string;
color_light: string;
color_dark: string;
textContent: MetricContent[];
color?: string;
fieldColor?: string;
files?: string;
fileSize?: string;
}
interface BaseFolder extends Base {
size: string;
}
interface Task {
id?: number;
name?: string;
description?: string;
completed?: boolean;
status?: string;
comments?: string;
attachments?: string;
members?: Member[];
startDate?: string;
endDate?: string;
}
interface Member {
name: string;
image: string;
}
interface DialogConfig {
visible: boolean;
header: string;
newTask: boolean;
}
interface Mail {
id: number;
from: string;
to: string;
email: string;
image: string;
title: string;
message: string;
date: string;
important: boolean;
starred: boolean;
trash: boolean;
spam: boolean;
archived: boolean;
sent: boolean;
}
interface User {
id: number;
name: string;
image: string;
status: string;
messages: Message[];
lastSeen: string;
}
interface Message {
text: string;
ownerId: number;
createdAt: number;
}
interface MetricContent {
amount: string;
text: string;
}
//ProductService
type Product = {
id?: string;
code?: string;
name: string;
description: string;
image?: string;
price?: number | string;
category?: string;
quantity?: number;
inventoryStatus?: InventoryStatus;
rating?: number;
orders?: ProductOrder[];
[key: string]: string | string[] | number | boolean | undefined | ProductOrder[] | InventoryStatus | File[];
};
type ProductOrder = {
id?: string;
productCode?: string;
date?: string;
amount?: number;
quantity?: number;
customer?: string;
status?: Status;
};
type Payment = {
name: string;
amount: number;
paid: boolean;
date: string;
};
//CustomerService
type Customer = {
id?: number;
name?: string;
country?: ICountryObject;
company?: string;
date: Date;
status?: string;
activity?: number;
balance?: number | string;
verified?: boolean;
amount?: number;
price?: number;
rating?: number;
image?: string;
orders?: Demo.Customer[];
inventoryStatus?: string;
representative: {
name: string;
image: string;
};
};
// EventService
interface Event extends EventInput {
location?: string;
description?: string;
tag?: {
name: string;
color: string;
};
}
// PhotoService
type Photo = {
title: string;
itemImageSrc?: string | undefined;
thumbnailImageSrc?: string | undefined;
alt?: string | undefined;
};
type Country = {
name: string;
code: string;
};
// IconService
type Icon = {
icon?: {
paths?: string[];
attrs?: [{}];
isMulticolor?: boolean;
isMulticolor2?: boolean;
grid?: number;
tags?: string[];
};
attrs?: [{}];
properties?: {
order?: number;
id: number;
name: string;
prevSize?: number;
code?: number;
};
setIdx?: number;
setId?: number;
iconIdx?: number;
};
}

65
types/index.d.ts vendored Normal file
View File

@@ -0,0 +1,65 @@
import React, { ReactNode } from 'react';
import {
Page,
AppBreadcrumbProps,
Breadcrumb,
BreadcrumbItem,
ColorScheme,
MenuProps,
MenuModal,
AppSubMenuProps,
LayoutConfig,
LayoutState,
AppBreadcrumbState,
Breadcrumb,
LayoutContextProps,
MailContextProps,
MenuContextProps,
ChatContextProps,
TaskContextProps,
AppConfigProps,
NodeRef,
AppTopbarRef,
MenuModalItem,
AppMenuItemProps,
UseSubmenuOverlayPositionProps
} from './layout';
import type { Demo, LayoutType, SortOrderType, CustomEvent, ChartDataState, ChartOptionsState, AppMailSidebarItem, AppMailReplyProps, AppMailProps, MailKeys } from './demo';
type ChildContainerProps = {
children: ReactNode;
};
export type {
Page,
AppBreadcrumbProps,
Breadcrumb,
BreadcrumbItem,
ColorScheme,
MenuProps,
MenuModal,
MailKeys,
LayoutConfig,
LayoutState,
Breadcrumb,
LayoutContextProps,
MailContextProps,
MenuContextProps,
ChatContextProps,
TaskContextProps,
AppConfigProps,
NodeRef,
AppTopbarRef,
AppMenuItemProps,
UseSubmenuOverlayPositionProps,
ChildContainerProps,
Demo,
LayoutType,
SortOrderType,
CustomEvent,
ChartDataState,
ChartOptionsState,
AppMailSidebarItem,
AppMailReplyProps,
AppMailProps
};

186
types/layout.d.ts vendored Normal file
View File

@@ -0,0 +1,186 @@
import React, { ReactElement, Dispatch, SetStateAction, HTMLAttributeAnchorTarget, ReactNode } from 'react';
import { NextPage } from 'next';
import type { Demo } from './demo';
import { Toast } from 'primereact/toast';
/* Next & Layout Types */
type Page<P = {}> = NextPage<P> & {
getLayout?: (page: ReactElement) => ReactNode;
};
/* Exported types */
export type MenuMode = 'static' | 'overlay' | 'horizontal' | 'slim' | 'slim-plus' | 'reveal' | 'drawer';
export type ColorScheme = 'light' | 'dark' | 'dim';
/* Breadcrumb Types */
export interface AppBreadcrumbProps {
className?: string;
}
export interface Breadcrumb {
labels?: string[];
to?: string;
}
export interface BreadcrumbItem {
label?: string;
to?: string;
items?: BreadcrumbItem[];
}
/* Context Types */
export type LayoutState = {
staticMenuDesktopInactive: boolean;
overlayMenuActive: boolean;
rightMenuVisible: boolean;
overlaySubmenuActive: boolean;
configSidebarVisible: boolean;
staticMenuMobileActive: boolean;
menuHoverActive: boolean;
searchBarActive: boolean;
resetMenu: boolean;
sidebarActive: boolean;
anchored: boolean;
rightMenuActive: boolean;
};
export type LayoutConfig = {
ripple: boolean;
inputStyle: string;
menuMode: MenuMode;
colorScheme: ColorScheme;
theme: string;
scale: number;
};
export interface LayoutContextProps {
layoutConfig: LayoutConfig;
setLayoutConfig: Dispatch<SetStateAction<LayoutConfig>>;
layoutState: LayoutState;
setLayoutState: Dispatch<SetStateAction<LayoutState>>;
showRightSidebar: () => void;
onMenuToggle: (event: React.MouseEvent<HTMLButtonElement>) => void;
isSlimPlus: () => boolean;
isSlim: () => boolean;
isHorizontal: () => boolean;
isDesktop: () => boolean;
breadcrumbs?: Breadcrumb[];
setBreadcrumbs: Dispatch<SetStateAction<Breadcrumb[]>>;
onSearchHide: (event: React.KeyboardEvent<HTMLInputElement>) => void;
toggleSearch: (event: React.MouseEvent<HTMLAnchorElement>) => void;
showConfigSidebar: () => void;
showSidebar: () => void;
}
export interface MailContextProps {
mails: Demo.Mail[];
toastRef: React.RefObject<Toast>;
updateMails: (data: Demo.Mail[]) => void;
clearMailActions: (mail: Demo.Mail) => void;
onStar: (id: number) => void;
onArchive: (id: number) => void;
onBookmark: (id: number) => void;
onDelete: (id: number) => void;
onDeleteMultiple: (mailArray: Demo.Mail[]) => void;
onArchiveMultiple: (mailArray: Demo.Mail[]) => void;
onSpamMultiple: (mailArray: Demo.Mail[]) => void;
onTrash: (id: number) => void;
onSend: (mail: Demo.Mail) => void;
}
export interface MenuContextProps {
activeMenu: string;
setActiveMenu: Dispatch<SetStateAction<string>>;
}
export interface ChatContextProps {
users: Demo.User[];
setUsers: Dispatch<SetStateAction<Demo.User[]>>;
activeUser: Demo.User;
setActiveUser: Dispatch<SetStateAction<User>>;
getChatData: () => Promise<Demo.User[]>;
changeActiveChat: (user: Demo.User) => void;
sendMessage: (message: Demo.Message) => void;
}
export interface TaskContextProps {
dialogConfig: Demo.DialogConfig;
selectedTask: Demo.Task | null;
tasks: Demo.Task[];
members: Demo.Member[];
setTasks: Dispatch<SetStateAction<Demo.Task[]>>;
setMembers: Dispatch<SetStateAction<Demo.Member[]>>;
setDialogConfig: Dispatch<SetStateAction<DialogConfig>>;
setSelectedTask: Dispatch<SetStateAction<Demo.Task | null>>;
getTasks: () => Promise<Demo.Task[]>;
getMembers: () => Promise<Demo.Member[]>;
addTask: (task: Demo.Task) => void;
editTask: (task: Demo.Task) => void;
removeTask: (id: number) => void;
onTaskSelect: (task: Demo.Task) => void;
markAsCompleted: (task: Demo.Task) => void;
showDialog: (header: string, newTask: boolean) => void;
closeDialog: () => void;
}
/* AppConfig Types */
export interface AppConfigProps {
minimal?: boolean;
}
/* AppTopbar Types */
export type NodeRef = MutableRefObject<ReactNode>;
export interface AppTopbarRef {
menubutton?: HTMLButtonElement | null;
topbarmenu?: HTMLDivElement | null;
topbarmenubutton?: HTMLButtonElement | null;
}
/* AppMenu Types */
type CommandProps = {
originalEvent: React.MouseEvent<HTMLAnchorElement, MouseEvent>;
item: MenuModalItem;
};
export interface MenuProps {
model: MenuModal[];
}
export interface MenuModal {
label?: string;
icon?: string;
items?: MenuModal[];
to?: string;
url?: string;
target?: HTMLAttributeAnchorTarget;
separator?: boolean;
requiredRoles?: import('./auth').UserRole[];
requiredPermissions?: string[];
}
export interface UseSubmenuOverlayPositionProps {
target: HTMLElement | null;
overlay: HTMLElement | null;
container: HTMLElement | null;
when?: any;
}
export interface AppMenuItem extends MenuModal {
items?: AppMenuItem[];
badgeClass?: string;
class?: string;
preventExact?: boolean;
visible?: boolean;
disabled?: boolean;
replaceUrl?: boolean;
command?: ({ originalEvent, item }: CommandProps) => void;
}
export interface AppMenuItemProps {
item?: AppMenuItem;
parentKey?: string;
index?: number;
root?: boolean;
className?: string;
}

106
types/phases.d.ts vendored Normal file
View File

@@ -0,0 +1,106 @@
export enum StatutPhaseChantier {
PLANIFIEE = 'PLANIFIEE',
EN_ATTENTE = 'EN_ATTENTE',
EN_COURS = 'EN_COURS',
SUSPENDUE = 'SUSPENDUE',
EN_CONTROLE = 'EN_CONTROLE',
TERMINEE = 'TERMINEE',
BLOQUEE = 'BLOQUEE',
ABANDONNEE = 'ABANDONNEE',
REPORTEE = 'REPORTEE'
}
export enum TypePhaseChantier {
PREPARATION = 'PREPARATION',
TERRASSEMENT = 'TERRASSEMENT',
FONDATIONS = 'FONDATIONS',
GROS_OEUVRE = 'GROS_OEUVRE',
CHARPENTE = 'CHARPENTE',
COUVERTURE = 'COUVERTURE',
CLOISONS = 'CLOISONS',
MENUISERIE_EXTERIEURE = 'MENUISERIE_EXTERIEURE',
ISOLATION = 'ISOLATION',
PLOMBERIE = 'PLOMBERIE',
ELECTRICITE = 'ELECTRICITE',
CHAUFFAGE = 'CHAUFFAGE',
VENTILATION = 'VENTILATION',
CLIMATISATION = 'CLIMATISATION',
MENUISERIE_INTERIEURE = 'MENUISERIE_INTERIEURE',
REVETEMENTS_SOLS = 'REVETEMENTS_SOLS',
REVETEMENTS_MURS = 'REVETEMENTS_MURS',
PEINTURE = 'PEINTURE',
CARRELAGE = 'CARRELAGE',
SANITAIRES = 'SANITAIRES',
CUISINE = 'CUISINE',
PLACARDS = 'PLACARDS',
FINITIONS = 'FINITIONS',
VRD = 'VRD',
ESPACES_VERTS = 'ESPACES_VERTS',
NETTOYAGE = 'NETTOYAGE',
RECEPTION = 'RECEPTION',
GARANTIE = 'GARANTIE',
AUTRE = 'AUTRE'
}
export enum PrioritePhase {
TRES_BASSE = 'TRES_BASSE',
BASSE = 'BASSE',
NORMALE = 'NORMALE',
HAUTE = 'HAUTE',
CRITIQUE = 'CRITIQUE'
}
export interface PhaseChantier {
id?: string;
nom: string;
description?: string;
type?: TypePhaseChantier;
chantier: {
id: string;
nom: string;
};
statut: StatutPhaseChantier;
ordreExecution: number;
dateDebutPrevue?: string;
dateFinPrevue?: string;
dateDebutReelle?: string;
dateFinReelle?: string;
dureePrevueJours?: number;
dureeReelleJours?: number;
pourcentageAvancement?: number;
budgetPrevu?: number;
coutReel?: number;
priorite?: PrioritePhase;
equipeResponsable?: {
id: string;
nom: string;
};
chefEquipe?: {
id: string;
nom: string;
prenom: string;
};
prerequis?: string;
livrablesAttendus?: string;
commentaires?: string;
risquesIdentifies?: string;
mesuresSecurite?: string;
materielRequis?: string;
competencesRequises?: string;
conditionsMeteoRequises?: string;
bloquante?: boolean;
facturable?: boolean;
dateCreation?: string;
dateModification?: string;
creePar?: string;
modifiePar?: string;
}
export interface PhaseStatistiques {
total: number;
parStatut: Record<StatutPhaseChantier, number>;
parType: Record<TypePhaseChantier, number>;
enRetard: number;
critiques: number;
avancementMoyen: number;
}

57
types/phases.ts Normal file
View File

@@ -0,0 +1,57 @@
/**
* Types pour les phases de chantiers
*/
export interface PhaseChantier {
id: string;
nom: string;
description?: string;
statut: StatutPhase;
dateDebutPrevue: string;
dateFinPrevue: string;
dateDebutReelle?: string;
dateFinReelle?: string;
pourcentageAvancement: number;
budgetPrevu?: number;
coutReel?: number;
critique: boolean;
responsable?: {
id: string;
nom: string;
prenom: string;
};
phaseParent?: {
id: string;
nom: string;
};
}
export type StatutPhase =
| 'PLANIFIEE'
| 'EN_ATTENTE'
| 'EN_COURS'
| 'EN_PAUSE'
| 'TERMINEE'
| 'ANNULEE'
| 'EN_RETARD';
export interface PhaseFormData {
nom: string;
description?: string;
dateDebutPrevue: string;
dateFinPrevue: string;
budgetPrevu?: number;
critique: boolean;
responsableId?: string;
phaseParentId?: string;
chantierId: string;
}
export interface PhaseStats {
total: number;
planifiees: number;
enCours: number;
terminees: number;
enRetard: number;
avancementMoyen: number;
}

162
types/stocks.d.ts vendored Normal file
View File

@@ -0,0 +1,162 @@
export enum CategorieStock {
MATERIAUX_CONSTRUCTION = 'MATERIAUX_CONSTRUCTION',
OUTILLAGE = 'OUTILLAGE',
QUINCAILLERIE = 'QUINCAILLERIE',
EQUIPEMENTS_SECURITE = 'EQUIPEMENTS_SECURITE',
EQUIPEMENTS_TECHNIQUES = 'EQUIPEMENTS_TECHNIQUES',
CONSOMMABLES = 'CONSOMMABLES',
VEHICULES_ENGINS = 'VEHICULES_ENGINS',
FOURNITURES_BUREAU = 'FOURNITURES_BUREAU',
PRODUITS_CHIMIQUES = 'PRODUITS_CHIMIQUES',
PIECES_DETACHEES = 'PIECES_DETACHEES',
EQUIPEMENTS_MESURE = 'EQUIPEMENTS_MESURE',
MOBILIER = 'MOBILIER',
AUTRE = 'AUTRE'
}
export enum UniteMesure {
UNITE = 'UNITE',
PAIRE = 'PAIRE',
LOT = 'LOT',
JEU = 'JEU',
KIT = 'KIT',
ENSEMBLE = 'ENSEMBLE',
GRAMME = 'GRAMME',
KILOGRAMME = 'KILOGRAMME',
TONNE = 'TONNE',
MILLIMETRE = 'MILLIMETRE',
CENTIMETRE = 'CENTIMETRE',
METRE = 'METRE',
METRE_LINEAIRE = 'METRE_LINEAIRE',
KILOMETRE = 'KILOMETRE',
CENTIMETRE_CARRE = 'CENTIMETRE_CARRE',
METRE_CARRE = 'METRE_CARRE',
HECTARE = 'HECTARE',
CENTIMETRE_CUBE = 'CENTIMETRE_CUBE',
DECIMETRE_CUBE = 'DECIMETRE_CUBE',
METRE_CUBE = 'METRE_CUBE',
LITRE = 'LITRE',
MILLILITRE = 'MILLILITRE',
HEURE = 'HEURE',
JOUR = 'JOUR',
SEMAINE = 'SEMAINE',
MOIS = 'MOIS',
SAC = 'SAC',
PALETTE = 'PALETTE',
ROULEAU = 'ROULEAU',
PLAQUE = 'PLAQUE',
BARRE = 'BARRE',
TUBE = 'TUBE',
PROFILE = 'PROFILE',
PANNEAU = 'PANNEAU',
BIDON = 'BIDON',
CARTOUCHE = 'CARTOUCHE',
METRE_CABLE = 'METRE_CABLE',
BOBINE = 'BOBINE',
AUTRE = 'AUTRE'
}
export enum StatutStock {
ACTIF = 'ACTIF',
INACTIF = 'INACTIF',
OBSOLETE = 'OBSOLETE',
SUPPRIME = 'SUPPRIME',
EN_COMMANDE = 'EN_COMMANDE',
EN_TRANSIT = 'EN_TRANSIT',
EN_CONTROLE = 'EN_CONTROLE',
QUARANTAINE = 'QUARANTAINE',
DEFECTUEUX = 'DEFECTUEUX',
PERDU = 'PERDU',
RESERVE = 'RESERVE',
EN_REPARATION = 'EN_REPARATION'
}
export interface Stock {
id?: string;
reference: string;
designation: string;
description?: string;
categorie: CategorieStock;
sousCategorie?: string;
uniteMesure: UniteMesure;
quantiteStock: number;
quantiteMinimum?: number;
quantiteMaximum?: number;
quantiteSecurite?: number;
quantiteReservee?: number;
quantiteEnCommande?: number;
prixUnitaireHT?: number;
coutMoyenPondere?: number;
coutDerniereEntree?: number;
tauxTVA?: number;
emplacementStockage?: string;
codeZone?: string;
codeAllee?: string;
codeEtagere?: string;
fournisseurPrincipal?: {
id: string;
nom: string;
};
chantier?: {
id: string;
nom: string;
};
marque?: string;
modele?: string;
referenceFournisseur?: string;
codeBarre?: string;
codeEAN?: string;
poidsUnitaire?: number;
longueur?: number;
largeur?: number;
hauteur?: number;
volume?: number;
dateDerniereEntree?: string;
dateDerniereSortie?: string;
datePeremption?: string;
dateDerniereInventaire?: string;
statut: StatutStock;
gestionParLot?: boolean;
traçabiliteRequise?: boolean;
articlePerissable?: boolean;
controleQualiteRequis?: boolean;
articleDangereux?: boolean;
classeDanger?: string;
commentaires?: string;
notesStockage?: string;
conditionsStockage?: string;
temperatureStockageMin?: number;
temperatureStockageMax?: number;
humiditeMax?: number;
dateCreation?: string;
dateModification?: string;
creePar?: string;
modifiePar?: string;
// Propriétés calculées
quantiteDisponible?: number;
valeurStock?: number;
enRupture?: boolean;
sousQuantiteMinimum?: boolean;
sousQuantiteSecurite?: boolean;
perime?: boolean;
}
export interface MouvementStock {
stockId: string;
quantite: number;
coutUnitaire?: number;
motif?: string;
chantierId?: string;
reference?: string;
}
export interface StockStatistiques {
total: number;
parCategorie: Record<CategorieStock, number>;
parStatut: Record<StatutStock, number>;
articlesEnRupture: number;
articlesSousMinimum: number;
articlesPerimes: number;
valeurTotaleStock: number;
}

53
types/stocks.ts Normal file
View File

@@ -0,0 +1,53 @@
/**
* Types pour la gestion des stocks
*/
export interface Stock {
id: string;
nom: string;
description?: string;
quantite: number;
quantiteMin: number;
quantiteMax: number;
unite: string;
prixUnitaire: number;
dateCreation: string;
dateModification: string;
actif: boolean;
fournisseur?: {
id: string;
nom: string;
};
categorie?: {
id: string;
nom: string;
};
}
export interface StockMovement {
id: string;
type: 'ENTREE' | 'SORTIE';
quantite: number;
dateMovement: string;
motif: string;
utilisateur: string;
chantier?: {
id: string;
nom: string;
};
}
export interface StockAlert {
id: string;
type: 'STOCK_BAS' | 'STOCK_CRITIQUE' | 'PEREMPTION';
message: string;
dateCreation: string;
traite: boolean;
}
export interface StockStats {
totalArticles: number;
valeurTotale: number;
articlesEnRupture: number;
articlesEnAlerte: number;
}