Import initail de calcul-astreintes v0.9.4 pour passage en paycheck 1.0

This commit is contained in:
2026-01-19 14:25:43 +01:00
commit cad0b2768a
44 changed files with 4183 additions and 0 deletions

21
internal/models/import.go Normal file
View File

@@ -0,0 +1,21 @@
package models
// Agent = une personne trouvée dans le fichier (affichage + clé matricule)
type Agent struct {
Matricule string `json:"matricule"`
Nom string `json:"nom"`
Prenom string `json:"prenom"`
Display string `json:"display"` // "NOM Prenom (matricule)"
}
// AgentTotals = les totaux "Total Agent" (ligne du dessus)
type AgentTotals struct {
Matricule string `json:"matricule"`
Q471 float64 `json:"q471"` // Total heures astreinte (col G)
Q456 float64 `json:"q456"` // Intervention jour (col L)
Q459 float64 `json:"q459"` // Intervention nuit (col M)
Q458 float64 `json:"q458"` // Intervention dimanche/ferié (col N)
// ✅ Nouveau: nombre de dimanches / jours fériés détectés via les lignes P_DIM-JF
NbDimFerie int `json:"nbDimFerie"`
}

57
internal/models/models.go Normal file
View File

@@ -0,0 +1,57 @@
package models
// GlobalRules = constantes communes à tous les utilisateurs.
type GlobalRules struct {
// ForfaitDimFerie = forfait par dimanche / jour férié (€/jour)
ForfaitDimFerie float64 `json:"forfait_dim_ferie"`
}
// Profile = taux dépendants de la personne (grade, etc.)
type Profile struct {
ID string `json:"id"`
Label string `json:"label"`
Matricule string `json:"matricule,omitempty"` // ✅ pour auto-match avec l'agent importé
// Taux horaires (€/h)
T456 float64 `json:"t456"` // Interventions jour hors dimanche/férié
T458 float64 `json:"t458"` // Interventions dimanche/jour férié
T459 float64 `json:"t459"` // Interventions nuit hors dimanche/férié
T471 float64 `json:"t471"` // Astreinte: heures totales du mois
}
// ProfileListItem = ce qu'on expose à l'UI (id + label + matricule pour auto-match)
type ProfileListItem struct {
ID string `json:"id"`
Label string `json:"label"`
Matricule string `json:"matricule,omitempty"`
}
// CalculateRequest = saisies mensuelles par l'utilisateur.
type CalculateRequest struct {
ProfileID string `json:"profileId"`
// Quantités en heures
Q456 float64 `json:"q456"` // heures interventions jour hors dim/férié
Q458 float64 `json:"q458"` // heures interventions dimanche/férié
Q459 float64 `json:"q459"` // heures interventions nuit hors dim/férié
Q471 float64 `json:"q471"` // heures totales astreinte du mois
// ✅ Nombre de dimanches / jours fériés "au forfait" (auto-rempli à l'import, modifiable)
NbDimFerie int `json:"nbDimFerie"`
}
// Line = une ligne de la grille (456/458/459/471/480).
type Line struct {
Code string `json:"code"`
Label string `json:"label"`
Rate float64 `json:"rate"`
Quantity float64 `json:"quantity"`
Amount float64 `json:"amount"`
Unit string `json:"unit"` // "h" ou "j"
}
// CalculateResponse = résultat du calcul (lignes + total)
type CalculateResponse struct {
Lines []Line `json:"lines"`
Total float64 `json:"total"`
}

24
internal/models/pdf.go Normal file
View File

@@ -0,0 +1,24 @@
package models
// ExportPDFMeta = métadonnées utilisées pour nommer le fichier et afficher l'entête du PDF.
//
// YearMonth doit être au format YYYY-MM.
type ExportPDFMeta struct {
YearMonth string `json:"yearMonth"`
Nom string `json:"nom"`
Prenom string `json:"prenom"`
Matricule string `json:"matricule"`
}
// ExportPDFRequest = données nécessaires à la génération du PDF.
//
// Note: on envoie les inputs (CalculateRequest) et on recalcule côté backend
// pour garantir que le PDF correspond exactement aux règles/taux du profil.
type ExportPDFRequest struct {
Meta ExportPDFMeta `json:"meta"`
Request CalculateRequest `json:"request"`
}
type ExportPDFResponse struct {
Path string `json:"path"`
}