✨ Nouvelles fonctionnalités - Page de gestion des avenants (/staff/avenants) - Page de détail d'un avenant (/staff/avenants/[id]) - Création d'avenants (objet, durée, rémunération) - Génération automatique de PDF d'avenant - Signature électronique via DocuSeal (employeur puis salarié) - Changement manuel du statut d'un avenant - Suppression d'avenants 🔧 Routes API - POST /api/staff/amendments/create - Créer un avenant - POST /api/staff/amendments/generate-pdf - Générer le PDF - POST /api/staff/amendments/[id]/send-signature - Envoyer en signature - POST /api/staff/amendments/[id]/change-status - Changer le statut - POST /api/webhooks/docuseal-amendment - Webhook après signature employeur - GET /api/signatures-electroniques/avenants - Liste des avenants en signature 📧 Système email universel v2 - Migration vers le système universel v2 pour les emails d'avenants - Template 'signature-request-employee-amendment' pour salariés - Insertion automatique dans DynamoDB pour la Lambda - Mise à jour automatique du statut dans Supabase 🗄️ Base de données - Table 'avenants' avec tous les champs (objet, durée, rémunération) - Colonnes de notification (last_employer_notification_at, last_employee_notification_at) - Liaison avec cddu_contracts 🎨 Composants - AvenantDetailPageClient - Détail complet d'un avenant - ChangeStatusModal - Changement de statut manuel - SendSignatureModal - Envoi en signature - DeleteAvenantModal - Suppression avec confirmation - AvenantSuccessModal - Confirmation de création 📚 Documentation - AVENANT_EMAIL_SYSTEM_MIGRATION.md - Guide complet de migration 🐛 Corrections - Fix parsing défensif dans Lambda AWS - Fix récupération des données depuis DynamoDB - Fix statut MFA !== 'verified' au lieu de === 'unverified'
133 lines
3.6 KiB
TypeScript
133 lines
3.6 KiB
TypeScript
// Types pour la gestion des avenants aux contrats de travail
|
|
|
|
export type AmendmentElementType =
|
|
| "objet" // Objet du contrat (profession, production)
|
|
| "duree" // Durée de l'engagement (dates, nb repré/répét)
|
|
| "lieu_horaire" // Lieu et horaires
|
|
| "remuneration"; // Rémunération
|
|
|
|
export type ContractType = "CDDU" | "RG";
|
|
|
|
export type AmendmentStatus =
|
|
| "draft" // Brouillon
|
|
| "pending" // En attente de signature
|
|
| "signed" // Signé
|
|
| "cancelled"; // Annulé
|
|
|
|
// Données de l'avenant à l'objet du contrat
|
|
export interface AmendmentObjetData {
|
|
profession_code?: string;
|
|
profession_label?: string;
|
|
production_name?: string;
|
|
production_numero_objet?: string;
|
|
}
|
|
|
|
// Données de l'avenant à la durée
|
|
export interface AmendmentDureeData {
|
|
date_debut?: string; // YYYY-MM-DD
|
|
date_fin?: string; // YYYY-MM-DD
|
|
nb_representations?: number;
|
|
nb_repetitions?: number;
|
|
nb_heures?: number; // Pour techniciens
|
|
dates_representations?: string;
|
|
dates_repetitions?: string;
|
|
jours_travail?: string;
|
|
}
|
|
|
|
// Données de l'avenant au lieu et horaires
|
|
export interface AmendmentLieuHoraireData {
|
|
lieu?: string;
|
|
horaires?: string;
|
|
adresse?: string;
|
|
}
|
|
|
|
// Données de l'avenant à la rémunération
|
|
export interface AmendmentRemunerationData {
|
|
gross_pay?: number;
|
|
precisions_salaire?: string;
|
|
type_salaire?: "Brut" | "Net avant PAS" | "Coût total employeur" | "Minimum conventionnel";
|
|
}
|
|
|
|
// Structure complète d'un avenant
|
|
export interface Amendment {
|
|
id?: string;
|
|
contract_id: string;
|
|
contract_number?: string;
|
|
employee_name?: string;
|
|
organization_name?: string;
|
|
|
|
// Métadonnées
|
|
date_effet: string; // Date d'effet de l'avenant (YYYY-MM-DD)
|
|
date_signature?: string; // Date de signature (YYYY-MM-DD)
|
|
status: AmendmentStatus;
|
|
|
|
// Éléments avenantés (au moins un doit être présent)
|
|
elements: AmendmentElementType[];
|
|
|
|
// Données selon les éléments avenantés
|
|
objet_data?: AmendmentObjetData;
|
|
duree_data?: AmendmentDureeData;
|
|
lieu_horaire_data?: AmendmentLieuHoraireData;
|
|
remuneration_data?: AmendmentRemunerationData;
|
|
|
|
// Signature électronique
|
|
signature_status?: "not_sent" | "pending_employer" | "pending_employee" | "signed";
|
|
last_employer_notification_at?: string;
|
|
last_employee_notification_at?: string;
|
|
|
|
// Timestamps
|
|
created_at?: string;
|
|
updated_at?: string;
|
|
created_by?: string;
|
|
}
|
|
|
|
// Données du contrat d'origine (pour pré-remplissage)
|
|
export interface OriginalContractData {
|
|
id: string;
|
|
contract_number: string;
|
|
employee_id: string;
|
|
employee_name: string;
|
|
employee_matricule?: string;
|
|
org_id: string;
|
|
organization_name?: string;
|
|
type_de_contrat: string;
|
|
categorie_pro?: string;
|
|
|
|
// Objet
|
|
profession?: string;
|
|
production_name?: string;
|
|
numero_objet?: string;
|
|
|
|
// Durée
|
|
start_date: string;
|
|
end_date: string;
|
|
nb_representations?: number;
|
|
nb_repetitions?: number;
|
|
nb_heures?: number;
|
|
dates_representations?: string;
|
|
dates_repetitions?: string;
|
|
jours_travail?: string;
|
|
|
|
// Lieu
|
|
lieu_travail?: string;
|
|
|
|
// Rémunération
|
|
gross_pay?: number;
|
|
precisions_salaire?: string;
|
|
type_salaire?: string;
|
|
}
|
|
|
|
// Pour la recherche de contrats dans le modal
|
|
export interface ContractSearchResult {
|
|
id: string;
|
|
contract_number: string;
|
|
employee_name: string;
|
|
employee_matricule?: string;
|
|
organization_name?: string;
|
|
structure?: string; // L'API peut retourner 'structure' au lieu de 'organization_name'
|
|
type_de_contrat: string;
|
|
start_date: string;
|
|
end_date: string;
|
|
profession?: string;
|
|
production_name?: string;
|
|
}
|