Added new design to modals

This commit is contained in:
2026-02-08 14:16:55 +01:00
parent ccff904464
commit ff6201a42c
15 changed files with 1134 additions and 435 deletions

View File

@@ -145,7 +145,7 @@ export default function ChauffeursTable() {
const getStatusColor = (status: string) => {
switch (status) {
case 'Disponible':
return 'bg-lgreen text-white';
return 'bg-lblue text-white';
case 'Vacances':
return 'bg-lblue text-white';
case 'Arrêt Maladie':
@@ -1018,31 +1018,38 @@ export default function ChauffeursTable() {
/>
)}
{/* Modal vue détaillée */}
{/* Modal vue détaillée - Design épuré */}
{viewingChauffeur && (
<div className="fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-fadeIn">
<div className="bg-white rounded-lg shadow-xl max-w-3xl w-full max-h-[90vh] overflow-hidden flex flex-col animate-slideUp border border-gray-200">
{/* Header sobre */}
<div className="border-b border-gray-200 px-6 py-5 bg-white">
<div className="flex items-center justify-between">
<div className="flex items-center gap-4">
<div className="w-12 h-12 rounded-full bg-gray-100 flex items-center justify-center text-gray-700 font-semibold text-lg border-2 border-gray-200">
<div className="bg-white rounded-xl shadow-2xl max-w-5xl w-full max-h-[95vh] overflow-hidden flex flex-col animate-slideUp border border-gray-200">
{/* Header épuré */}
<div className="border-b border-gray-200 px-8 py-6 bg-white">
<div className="flex items-start justify-between">
<div className="flex items-center gap-5">
<div className="w-16 h-16 rounded-full bg-lblue flex items-center justify-center text-white font-bold text-xl border-4 border-lblue/10 shadow-sm">
{getInitials(viewingChauffeur.nom, viewingChauffeur.prenom)}
</div>
<div>
<h2 className="text-xl font-semibold text-gray-900">
<h2 className="text-2xl font-bold text-gray-900 mb-1">
{viewingChauffeur.prenom} {viewingChauffeur.nom}
</h2>
<p className="text-sm text-gray-500 mt-0.5">
<p className="text-gray-500 text-sm mb-2">
Informations détaillées du chauffeur
</p>
{viewingChauffeur.status && (
<div>
<span className={`px-3 py-1 text-xs font-semibold rounded-full ${getStatusColor(viewingChauffeur.status)}`}>
{viewingChauffeur.status}
</span>
</div>
)}
</div>
</div>
<button
onClick={() => setViewingChauffeur(null)}
className="text-gray-400 hover:text-gray-600 transition-colors p-1.5 hover:bg-gray-100 rounded"
className="text-gray-400 hover:text-gray-600 transition-colors p-2 hover:bg-gray-100 rounded-lg"
>
<svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
@@ -1050,155 +1057,187 @@ export default function ChauffeursTable() {
</div>
{/* Contenu scrollable */}
<div className="flex-1 overflow-y-auto px-6 py-6">
{/* Section Informations personnelles */}
<div className="mb-8">
<h3 className="text-sm font-semibold text-gray-900 mb-4 uppercase tracking-wide">
Informations personnelles
</h3>
<div className="space-y-3">
<div className="flex items-center py-3 border-b border-gray-100">
<div className="w-32 flex-shrink-0">
<span className="text-xs font-medium text-gray-500 uppercase tracking-wide">Date de naissance</span>
</div>
<div className="flex-1 flex items-center gap-2">
<svg className="h-4 w-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
</svg>
<span className="text-sm text-gray-900 font-medium">{formatDate(viewingChauffeur.dateNaissance)}</span>
</div>
</div>
<div className="flex items-center py-3 border-b border-gray-100">
<div className="w-32 flex-shrink-0">
<span className="text-xs font-medium text-gray-500 uppercase tracking-wide">Téléphone</span>
</div>
<div className="flex-1 flex items-center gap-2">
<svg className="h-4 w-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" />
</svg>
<a href={`tel:${viewingChauffeur.telephone}`} className="text-sm text-gray-900 font-medium hover:text-lblue transition-colors">
{viewingChauffeur.telephone}
</a>
</div>
</div>
<div className="flex items-center py-3 border-b border-gray-100">
<div className="w-32 flex-shrink-0">
<span className="text-xs font-medium text-gray-500 uppercase tracking-wide">Email</span>
</div>
<div className="flex-1 flex items-center gap-2">
<svg className="h-4 w-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
</svg>
<a href={`mailto:${viewingChauffeur.email}`} className="text-sm text-gray-900 font-medium hover:text-lblue transition-colors break-all">
{viewingChauffeur.email}
</a>
</div>
</div>
<div className="flex items-start py-3 border-b border-gray-100">
<div className="w-32 flex-shrink-0">
<span className="text-xs font-medium text-gray-500 uppercase tracking-wide">Adresse</span>
</div>
<div className="flex-1 flex items-start gap-2">
<svg className="h-4 w-4 text-gray-400 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" />
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 11a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
<span className="text-sm text-gray-900 font-medium">{viewingChauffeur.adresse}</span>
</div>
</div>
<div className="flex-1 overflow-y-auto">
<div className="p-8">
{/* Actions rapides */}
<div className="mb-8 flex flex-wrap gap-3">
<a
href={`tel:${viewingChauffeur.telephone}`}
className="flex items-center gap-2 px-4 py-2 bg-gray-50 text-gray-700 border border-gray-200 rounded-lg hover:bg-gray-100 hover:border-lblue transition-colors"
>
<svg className="w-5 h-5 text-lblue" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" />
</svg>
<span className="text-sm font-medium">Appeler</span>
</a>
<a
href={`mailto:${viewingChauffeur.email}`}
className="flex items-center gap-2 px-4 py-2 bg-gray-50 text-gray-700 border border-gray-200 rounded-lg hover:bg-gray-100 hover:border-lblue transition-colors"
>
<svg className="w-5 h-5 text-lblue" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
</svg>
<span className="text-sm font-medium">Envoyer un email</span>
</a>
</div>
</div>
{/* Section Contrat */}
<div className="mb-8">
<h3 className="text-sm font-semibold text-gray-900 mb-4 uppercase tracking-wide">
Informations contractuelles
</h3>
<div className="space-y-3">
<div className="flex items-center py-3 border-b border-gray-100">
<div className="w-32 flex-shrink-0">
<span className="text-xs font-medium text-gray-500 uppercase tracking-wide">Contrat d'heure</span>
</div>
<div className="flex-1 flex items-center gap-2">
<svg className="h-4 w-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<span className="text-sm text-gray-900 font-semibold">{viewingChauffeur.heuresContrat}h</span>
</div>
</div>
<div className="flex items-center py-3 border-b border-gray-100">
<div className="w-32 flex-shrink-0">
<span className="text-xs font-medium text-gray-500 uppercase tracking-wide">Date de début</span>
</div>
<div className="flex-1 flex items-center gap-2">
<svg className="h-4 w-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
</svg>
<span className="text-sm text-gray-900 font-medium">{formatDate(viewingChauffeur.dateDebutContrat)}</span>
</div>
</div>
{viewingChauffeur.dateFinContrat && (
<div className="flex items-center py-3 border-b border-gray-100">
<div className="w-32 flex-shrink-0">
<span className="text-xs font-medium text-gray-500 uppercase tracking-wide">Date de fin</span>
</div>
<div className="flex-1 flex items-center gap-2">
<svg className="h-4 w-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
{/* Carte Informations personnelles */}
<div className="bg-white rounded-xl border border-gray-200 p-6 shadow-sm">
<div className="flex items-center gap-3 mb-6 pb-4 border-b border-gray-200">
<div className="w-10 h-10 rounded-lg bg-lblue/10 flex items-center justify-center">
<svg className="w-5 h-5 text-lblue" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
</svg>
<span className="text-sm text-gray-900 font-medium">{formatDate(viewingChauffeur.dateFinContrat)}</span>
</div>
<h3 className="text-lg font-semibold text-gray-900">
Informations personnelles
</h3>
</div>
)}
{viewingChauffeur.heuresRestantes !== undefined && (
<div className="flex items-center py-3 border-b border-gray-100">
<div className="w-32 flex-shrink-0">
<span className="text-xs font-medium text-gray-500 uppercase tracking-wide">Heures restantes</span>
</div>
<div className="flex-1">
<div className="flex items-center justify-between mb-2">
<span className="text-sm text-gray-900 font-medium">
{viewingChauffeur.heuresRestantes}h / {viewingChauffeur.heuresContrat}h
</span>
<div className="space-y-4">
<div className="flex items-start gap-4">
<div className="w-10 h-10 rounded-lg bg-gray-100 flex items-center justify-center flex-shrink-0">
<svg className="w-5 h-5 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
</svg>
</div>
<div className="w-full bg-gray-100 rounded-full h-1.5">
<div
className="bg-lblue h-1.5 rounded-full"
style={{ width: `${getProgressPercentage(viewingChauffeur.heuresRestantes || viewingChauffeur.heuresContrat, viewingChauffeur.heuresContrat)}%` }}
></div>
<div className="flex-1 min-w-0">
<p className="text-xs font-medium text-gray-500 uppercase tracking-wide mb-1">Date de naissance</p>
<p className="text-sm font-semibold text-gray-900">{formatDate(viewingChauffeur.dateNaissance)}</p>
</div>
</div>
<div className="flex items-start gap-4">
<div className="w-10 h-10 rounded-lg bg-gray-100 flex items-center justify-center flex-shrink-0">
<svg className="w-5 h-5 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" />
</svg>
</div>
<div className="flex-1 min-w-0">
<p className="text-xs font-medium text-gray-500 uppercase tracking-wide mb-1">Téléphone</p>
<a href={`tel:${viewingChauffeur.telephone}`} className="text-sm font-semibold text-lblue hover:text-dblue transition-colors">
{viewingChauffeur.telephone}
</a>
</div>
</div>
<div className="flex items-start gap-4">
<div className="w-10 h-10 rounded-lg bg-gray-100 flex items-center justify-center flex-shrink-0">
<svg className="w-5 h-5 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
</svg>
</div>
<div className="flex-1 min-w-0">
<p className="text-xs font-medium text-gray-500 uppercase tracking-wide mb-1">Email</p>
<a href={`mailto:${viewingChauffeur.email}`} className="text-sm font-semibold text-lblue hover:text-dblue transition-colors break-all">
{viewingChauffeur.email}
</a>
</div>
</div>
<div className="flex items-start gap-4">
<div className="w-10 h-10 rounded-lg bg-gray-100 flex items-center justify-center flex-shrink-0">
<svg className="w-5 h-5 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" />
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 11a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
</div>
<div className="flex-1 min-w-0">
<p className="text-xs font-medium text-gray-500 uppercase tracking-wide mb-1">Adresse</p>
<p className="text-sm font-semibold text-gray-900">{viewingChauffeur.adresse}</p>
</div>
</div>
</div>
)}
</div>
{viewingChauffeur.status && (
<div className="flex items-center py-3">
<div className="w-32 flex-shrink-0">
<span className="text-xs font-medium text-gray-500 uppercase tracking-wide">Status</span>
</div>
<div className="flex-1 flex items-center gap-2">
<span className={`px-2.5 py-1 text-xs font-medium rounded ${getStatusColor(viewingChauffeur.status)}`}>
{viewingChauffeur.status}
</span>
{/* Carte Informations contractuelles */}
<div className="bg-white rounded-xl border border-gray-200 p-6 shadow-sm">
<div className="flex items-center gap-3 mb-6 pb-4 border-b border-gray-200">
<div className="w-10 h-10 rounded-lg bg-lblue/10 flex items-center justify-center">
<svg className="w-5 h-5 text-lblue" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
</div>
<h3 className="text-lg font-semibold text-gray-900">
Informations contractuelles
</h3>
</div>
)}
<div className="space-y-4">
<div className="flex items-start gap-4">
<div className="w-10 h-10 rounded-lg bg-gray-100 flex items-center justify-center flex-shrink-0">
<svg className="w-5 h-5 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
<div className="flex-1 min-w-0">
<p className="text-xs font-medium text-gray-500 uppercase tracking-wide mb-1">Contrat d'heure</p>
<p className="text-lg font-bold text-gray-900">{viewingChauffeur.heuresContrat}h</p>
</div>
</div>
<div className="flex items-start gap-4">
<div className="w-10 h-10 rounded-lg bg-gray-100 flex items-center justify-center flex-shrink-0">
<svg className="w-5 h-5 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
</svg>
</div>
<div className="flex-1 min-w-0">
<p className="text-xs font-medium text-gray-500 uppercase tracking-wide mb-1">Date de début</p>
<p className="text-sm font-semibold text-gray-900">{formatDate(viewingChauffeur.dateDebutContrat)}</p>
</div>
</div>
{viewingChauffeur.dateFinContrat && (
<div className="flex items-start gap-4">
<div className="w-10 h-10 rounded-lg bg-gray-100 flex items-center justify-center flex-shrink-0">
<svg className="w-5 h-5 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
</svg>
</div>
<div className="flex-1 min-w-0">
<p className="text-xs font-medium text-gray-500 uppercase tracking-wide mb-1">Date de fin</p>
<p className="text-sm font-semibold text-gray-900">{formatDate(viewingChauffeur.dateFinContrat)}</p>
</div>
</div>
)}
{viewingChauffeur.heuresRestantes !== undefined && (
<div className="pt-2">
<div className="flex items-center justify-between mb-3">
<p className="text-xs font-medium text-gray-500 uppercase tracking-wide">Heures restantes</p>
<span className="text-lg font-bold text-gray-900">
{viewingChauffeur.heuresRestantes}h <span className="text-sm font-normal text-gray-500">/ {viewingChauffeur.heuresContrat}h</span>
</span>
</div>
<div className="relative w-full bg-gray-200 rounded-full h-3 overflow-hidden">
<div
className={`h-3 rounded-full transition-all duration-500 ${
(viewingChauffeur.heuresRestantes / viewingChauffeur.heuresContrat) < 0.2
? 'bg-orange-500'
: (viewingChauffeur.heuresRestantes / viewingChauffeur.heuresContrat) < 0.5
? 'bg-orange-400'
: 'bg-lblue'
}`}
style={{ width: `${(viewingChauffeur.heuresRestantes / viewingChauffeur.heuresContrat) * 100}%` }}
></div>
</div>
<p className="text-xs text-gray-500 mt-2">
{Math.round((viewingChauffeur.heuresRestantes / viewingChauffeur.heuresContrat) * 100)}% d'heures restantes
</p>
</div>
)}
</div>
</div>
</div>
</div>
</div>
{/* Footer sobre */}
<div className="border-t border-gray-200 px-6 py-4 bg-gray-50/50">
<div className="flex justify-end gap-3">
{/* Footer avec actions */}
<div className="border-t border-gray-200 px-8 py-5 bg-white">
<div className="flex items-center justify-between">
<button
onClick={() => setViewingChauffeur(null)}
className="px-4 py-2 text-sm font-medium text-gray-700 hover:text-gray-900 transition-colors"
className="px-5 py-2.5 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors"
>
Fermer
</button>
@@ -1207,12 +1246,12 @@ export default function ChauffeursTable() {
setViewingChauffeur(null);
handleEdit(viewingChauffeur);
}}
className="px-4 py-2 bg-lblue text-white text-sm font-medium rounded hover:bg-dblue transition-colors flex items-center gap-2"
className="px-6 py-2.5 bg-lblue text-white text-sm font-semibold rounded-lg hover:bg-dblue transition-colors flex items-center gap-2"
>
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" />
</svg>
Modifier
Modifier le chauffeur
</button>
</div>
</div>