Clean up unused modal

This commit is contained in:
omaroughriss 2025-10-23 16:43:10 +02:00
parent 6d736e3668
commit eaf5b653e9

View File

@ -869,551 +869,46 @@ export default function FoldersPage() {
>
<X className="h-4 w-4 text-gray-100" />
</Button>
</div>
<div className="space-y-6">
<div className="bg-gray-800 border border-gray-700 rounded-lg p-4">
<div className="flex items-center space-x-3">
<FileCheck className="h-8 w-8 text-blue-400" />
<div>
<h4 className="font-semibold text-blue-200">Certificats des documents</h4>
<p className="text-sm text-blue-300">
Téléchargez les certificats blockchain individuels des documents de ce dossier
</p>
</div>
</div>
</div>
<div className="grid grid-cols-1 gap-4">
{actionModal.folder.documents?.map((doc) => (
<div key={doc.id} className="border border-gray-700 rounded-lg p-4 bg-gray-900">
<div className="flex items-center justify-between">
<div className="flex items-center space-x-3">
<FileText className="h-8 w-8 text-gray-300" />
<div>
<h5 className="font-medium text-gray-100">{doc.name}</h5>
{doc.hasCertificate && doc.certificateId && (
<p className="text-sm text-gray-400">ID: {doc.certificateId}</p>
)}
)}
</div>
</div>
) : (
<div className="space-y-4">
{/* Folder list */}
<div className="space-y-2">
{sortedFolders.map((folder) => (
<Card key={folder.folderNumber} className="hover:shadow-md transition-shadow bg-gray-800 border border-gray-700">
<CardContent className="p-4">
<div className="flex items-center justify-between">
<div className="flex items-center space-x-3">
<Folder className="h-5 w-5 text-blue-600" />
<div>
<h3 className="font-medium text-gray-100">{folder.name}</h3>
<p className="text-sm text-gray-400">{folder.description}</p>
<div className="flex items-center space-x-4 mt-1">
<span className="text-xs text-gray-400">#{folder.folderNumber}</span>
<span className="text-xs text-gray-400">
<Clock className="h-3 w-3 inline mr-1" />
{new Date(folder.updated_at).toLocaleDateString()}
</span>
</div>
</div>
<div className="flex items-center space-x-2">
{doc.hasCertificate ? (
<>
<Badge className="bg-green-800 text-green-100">Certifié</Badge>
<Button
variant="outline"
size="sm"
onClick={() => {
showNotification("info", `Téléchargement du certificat pour ${doc.name}...`)
setTimeout(() => {
showNotification("success", `Certificat de ${doc.name} téléchargé`)
sendFolderChatNotification(
actionModal.folder!.id.toString(),
`📜 Certificat du document "${doc.name}" téléchargé`,
"document_certificate_download",
)
}, 1500)
}}
>
<Download className="h-4 w-4 mr-2" />
Télécharger
</Button>
</>
) : (
<Badge variant="outline" className="bg-gray-700 text-gray-300">
Non certifié
</Badge>
)}
</div>
</div>
<div className="flex items-center space-x-2">
{folder.notes.length > 0 && (
<Badge variant="outline">{folder.notes.length} notes</Badge>
)}
</div>
</div>
))}
</div>
<div className="bg-gray-800 p-4 rounded-lg border border-gray-700">
<h5 className="font-medium text-gray-100 mb-3">Actions groupées</h5>
<div className="flex space-x-3">
<Button
variant="outline"
onClick={() => {
const certifiedDocs = actionModal.folder!.documents?.filter((doc) => doc.hasCertificate) || []
showNotification("info", `Téléchargement de ${certifiedDocs.length} certificat(s)...`)
setTimeout(() => {
showNotification("success", `${certifiedDocs.length} certificat(s) téléchargé(s)`)
sendFolderChatNotification(
actionModal.folder!.id.toString(),
`📦 Archive des certificats téléchargée (${certifiedDocs.length} documents)`,
"bulk_certificates_download",
)
}, 2000)
}}
>
<Archive className="h-4 w-4 mr-2" />
Télécharger tous les certificats (.zip)
</Button>
<Button
variant="outline"
onClick={() => {
showNotification("info", "Vérification en ligne des certificats...")
setTimeout(() => {
showNotification("success", "Tous les certificats sont valides")
}, 3000)
}}
>
<ShieldCheck className="h-4 w-4 mr-2" />
Vérifier tous en ligne
</Button>
</div>
</div>
</div>
</>
)}
{/* Storage Config Modal */}
{actionModal.type === "storage_config" && actionModal.folder && (
<>
<div className="flex items-center justify-between mb-4">
<h3 className="text-lg font-semibold text-gray-100">
Configuration du stockage temporaire
</h3>
<Button
variant="ghost"
size="sm"
onClick={() => setActionModal({ type: null, folder: null, folders: [] })}
>
<X className="h-4 w-4 text-gray-100" />
</Button>
</div>
<div className="space-y-4">
<div className="bg-gray-800 p-3 rounded-lg border border-gray-700">
<div className="flex items-center space-x-2 mb-2">
<Timer className="h-5 w-5 text-orange-400" />
<span className="font-medium text-orange-300">
Configuration du stockage temporaire
</span>
</div>
<p className="text-sm text-orange-200">
Configurez la durée de conservation et les informations d'usage pour le dossier{" "}
<strong>{actionModal.folder.name}</strong> en stockage temporaire.
</p>
</div>
<div>
<Label htmlFor="storageDuration" className="text-gray-100">Durée de conservation (en jours)</Label>
<Select value={storageDuration} onValueChange={setStorageDuration}>
<SelectTrigger className="bg-gray-900 text-gray-100 border-gray-700">
<SelectValue />
</SelectTrigger>
<SelectContent className="bg-gray-900 text-gray-100 border-gray-700">
<SelectItem value="7">7 jours</SelectItem>
<SelectItem value="15">15 jours</SelectItem>
<SelectItem value="30">30 jours</SelectItem>
<SelectItem value="60">60 jours</SelectItem>
<SelectItem value="90">90 jours</SelectItem>
<SelectItem value="180">180 jours</SelectItem>
<SelectItem value="365">1 an</SelectItem>
</SelectContent>
</Select>
<p className="text-xs text-gray-400 mt-1">
Durée pendant laquelle les données seront conservées en stockage temporaire avant archivage automatique
</p>
</div>
<div>
<Label htmlFor="dataUsage" className="text-gray-100">Usage de la donnée</Label>
<Textarea
id="dataUsage"
value={dataUsage}
onChange={(e) => setDataUsage(e.target.value)}
placeholder="Décrivez l'usage prévu de ces données (ex: analyses commerciales, rapports internes, documentation projet...)"
rows={3}
className="bg-gray-900 text-gray-100 border-gray-700"
/>
<p className="text-xs text-gray-400 mt-1">
Description de l'utilisation prévue des données contenues dans ce dossier
</p>
</div>
<div>
<Label htmlFor="thirdPartyAccess" className="text-gray-100">Tiers pouvant avoir accès</Label>
<Textarea
id="thirdPartyAccess"
value={thirdPartyAccess}
onChange={(e) => setThirdPartyAccess(e.target.value)}
placeholder="Listez les tiers externes qui pourraient avoir accès à ces données (ex: consultants, partenaires, auditeurs...)"
rows={3}
className="bg-gray-900 text-gray-100 border-gray-700"
/>
<p className="text-xs text-gray-400 mt-1">
Liste des parties externes qui pourraient être amenées à consulter ces données
</p>
</div>
<div className="bg-gray-800 p-3 rounded-lg border border-gray-700">
<div className="flex items-center space-x-2 mb-2">
<Info className="h-4 w-4 text-blue-400" />
<span className="font-medium text-blue-200">Information RGPD</span>
</div>
<p className="text-xs text-blue-300">
Ces informations sont utilisées pour assurer la conformité RGPD et la traçabilité des données.
Elles seront incluses dans le registre des traitements.
</p>
</div>
<div className="flex justify-end space-x-2">
<Button
variant="outline"
onClick={() => setActionModal({ type: null, folder: null, folders: [] })}
>
Annuler
</Button>
<Button onClick={confirmStorageConfig}>
<Timer className="h-4 w-4 mr-2" />
Enregistrer la configuration
</Button>
</div>
</div>
</>
)}
{/* Certificate Modal */}
{actionModal.type === "certificate" && actionModal.folder && (
<>
<div className="flex items-center justify-between mb-4">
<h3 className="text-lg font-semibold text-gray-100">
Certificat de validation du dossier
</h3>
<Button
variant="ghost"
size="sm"
onClick={() => setActionModal({ type: null, folder: null, folders: [] })}
>
<X className="h-4 w-4 text-gray-100" />
</Button>
</div>
<div className="space-y-6">
<div className="bg-gray-800 border border-green-700 rounded-lg p-4">
<div className="flex items-center space-x-3">
<ShieldCheck className="h-8 w-8 text-green-400" />
<div>
<h4 className="font-semibold text-green-300">Dossier certifié</h4>
<p className="text-sm text-green-200">
Ce dossier et tous ses documents ont é validés et certifiés numériquement
</p>
</div>
</div>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div className="bg-gray-900 p-4 rounded-lg border border-gray-700">
<h5 className="font-medium text-gray-100 mb-3">Informations du dossier</h5>
<div className="space-y-2 text-sm text-gray-300">
<div className="flex justify-between">
<span className="text-gray-400">Nom :</span>
<span className="font-medium">{actionModal.folder.name}</span>
</div>
<div className="flex justify-between">
<span className="text-gray-400">Documents :</span>
<span className="font-medium">{actionModal.folder.documentsCount}</span>
</div>
<div className="flex justify-between">
<span className="text-gray-400">Taille totale :</span>
<span className="font-medium">{actionModal.folder.size}</span>
</div>
<div className="flex justify-between">
<span className="text-gray-400">Type :</span>
<span className="font-medium capitalize">{actionModal.folder.type}</span>
</div>
<div className="flex justify-between">
<span className="text-gray-400">Hash du dossier :</span>
<span className="font-mono text-xs bg-gray-800 p-1 rounded break-all text-gray-200">
{Math.random().toString(36).substring(2, 15) +
Math.random().toString(36).substring(2, 15)}
</span>
</div>
</div>
</div>
<div className="bg-gray-900 p-4 rounded-lg border border-gray-700">
<h5 className="font-medium text-gray-100 mb-3">Certificat numérique</h5>
<div className="space-y-2 text-sm text-gray-300">
<div className="flex justify-between">
<span className="text-gray-400">Émis le :</span>
<span className="font-medium">{actionModal.folder.modified.toLocaleDateString("fr-FR")}</span>
</div>
<div className="flex justify-between">
<span className="text-gray-400">Validé par :</span>
<span className="font-medium">{actionModal.folder.owner}</span>
</div>
<div className="flex justify-between">
<span className="text-gray-400">Autorité :</span>
<span className="font-medium">DocV Folder Certification</span>
</div>
<div className="flex justify-between">
<span className="text-gray-400">ID Certificat :</span>
<span className="font-mono text-xs bg-gray-800 p-1 rounded text-gray-200">
FOLDER-CERT-{actionModal.folder.id}-{new Date().getFullYear()}
</span>
</div>
<div className="flex justify-between">
<span className="text-gray-400">Validité :</span>
<span className="font-medium text-green-400">
{new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toLocaleDateString("fr-FR")}
</span>
</div>
</div>
</div>
</div>
<div className="bg-gray-800 border border-blue-700 rounded-lg p-4">
<h5 className="font-medium text-blue-300 mb-3">Validation du dossier complet</h5>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 text-gray-300">
<div className="space-y-2 text-sm">
<div className="flex items-center space-x-2">
<CheckCircle className="h-4 w-4 text-green-400" />
<span>Intégrité de tous les documents vérifiée</span>
</div>
<div className="flex items-center space-x-2">
<CheckCircle className="h-4 w-4 text-green-400" />
<span>Structure du dossier validée</span>
</div>
<div className="flex items-center space-x-2">
<CheckCircle className="h-4 w-4 text-green-400" />
<span>Permissions et accès contrôlés</span>
</div>
</div>
<div className="space-y-2 text-sm">
<div className="flex items-center space-x-2">
<CheckCircle className="h-4 w-4 text-green-400" />
<span>Horodatage certifié pour tous les fichiers</span>
</div>
<div className="flex items-center space-x-2">
<CheckCircle className="h-4 w-4 text-green-400" />
<span>Conformité RGPD du dossier</span>
</div>
<div className="flex items-center space-x-2">
<CheckCircle className="h-4 w-4 text-green-400" />
<span>Traçabilité complète des modifications</span>
</div>
</div>
</div>
</div>
<div className="bg-gray-900 border border-green-700 rounded-lg p-4">
<h5 className="font-medium text-gray-100 mb-3">Chaîne de confiance distribuée</h5>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 text-gray-300">
<div className="space-y-2 text-sm">
<div className="flex items-center space-x-2">
<div className="w-3 h-3 bg-green-500 rounded-full"></div>
<span>Block #{Math.floor(Math.random() * 1000000)} - Dossier principal</span>
</div>
<div className="flex items-center space-x-2">
<div className="w-3 h-3 bg-blue-500 rounded-full"></div>
<span>{actionModal.folder.documentsCount} documents liés dans la blockchain</span>
</div>
<div className="flex items-center space-x-2">
<div className="w-3 h-3 bg-purple-500 rounded-full"></div>
<span>Réplication sur {Math.floor(Math.random() * 5) + 3} nœuds souverains</span>
</div>
</div>
<div className="space-y-2 text-sm">
<div className="flex items-center space-x-2">
<div className="w-3 h-3 bg-orange-500 rounded-full"></div>
<span>Stockage {actionModal.folder.storageType === "permanent" ? "permanent" : "temporaire"} certifié</span>
</div>
<div className="flex items-center space-x-2">
<div className="w-3 h-3 bg-red-500 rounded-full"></div>
<span>{Math.floor(Math.random() * 100) + 50} confirmations réseau</span>
</div>
<div className="flex items-center space-x-2">
<div className="w-3 h-3 bg-indigo-500 rounded-full"></div>
<span>Audit de sécurité: {new Date().toLocaleDateString("fr-FR")}</span>
</div>
</div>
</div>
</div>
{actionModal.folder.expectedDocuments.length > 0 && (
<div className="bg-gray-800 border border-yellow-700 rounded-lg p-4">
<h5 className="font-medium text-yellow-300 mb-3">Documents attendus - Statut de validation</h5>
<div className="space-y-2 text-gray-300 text-sm">
{actionModal.folder.expectedDocuments.map((doc, index) => (
<div key={index} className="flex items-center justify-between">
<div className="flex items-center space-x-2">
<FileText className="h-4 w-4 text-gray-400" />
<span>{doc.name}</span>
{doc.required && <span className="text-red-500 text-xs">*</span>}
</div>
<div className="flex items-center space-x-2">
<Badge
className={
doc.status === "received"
? "bg-green-700 text-green-200"
: doc.status === "pending"
? "bg-orange-700 text-orange-200"
: "bg-red-700 text-red-200"
}
>
{doc.status === "received"
? "✓ Validé"
: doc.status === "pending"
? "⏳ En attente"
: "❌ Manquant"}
</Badge>
</div>
</div>
))}
</div>
</div>
)}
<div className="flex justify-end space-x-3 pt-4 border-t border-gray-700">
<Button
variant="outline"
onClick={() => {
showNotification("success", `Certificat du dossier ${actionModal.folder!.name} téléchargé`);
sendFolderChatNotification(
actionModal.folder!.id.toString(),
`📜 Certificat de validation du dossier téléchargé`,
"folder_certificate_download",
);
}}
>
<Download className="h-4 w-4 mr-2" />
Télécharger le certificat (.pdf)
</Button>
<Button
variant="outline"
onClick={() => {
showNotification("info", "Vérification en ligne du certificat du dossier...");
setTimeout(() => {
showNotification("success", "Certificat du dossier vérifié avec succès");
}, 3000);
}}
>
<ShieldCheck className="h-4 w-4 mr-2" />
Vérifier en ligne
</Button>
<Button
variant="outline"
onClick={() => {
showNotification("info", "Préparation de l'archive certifiée...");
setTimeout(() => {
showNotification(
"success",
`Archive certifiée du dossier ${actionModal.folder!.name} téléchargée`,
);
sendFolderChatNotification(
actionModal.folder!.id.toString(),
`📦 Archive certifiée complète téléchargée (${actionModal.folder!.documentsCount} documents)`,
"certified_archive_download",
);
}, 4000);
}}
>
<Archive className="h-4 w-4 mr-2" />
Archive certifiée (.zip)
</Button>
</div>
</div>
</>
)}
{/* Request Document Modal */}
{actionModal.type === "request_document" && actionModal.folder && (
<>
<div className="flex items-center justify-between mb-4">
<h3 className="text-lg font-semibold text-gray-100">Demander un document</h3>
<Button
variant="ghost"
size="sm"
onClick={() => setActionModal({ type: null, folder: null, folders: [] })}
>
<X className="h-4 w-4 text-gray-100" />
</Button>
</div>
<div className="space-y-4">
<div className="bg-gray-800 p-3 rounded-lg">
<p className="text-sm text-blue-300">
Sélectionnez un document attendu pour le dossier <strong>{actionModal.folder.name}</strong> et
envoyez une demande à la personne responsable.
</p>
</div>
<div>
<Label htmlFor="selectedDocument" className="text-gray-100">Document à demander</Label>
<Select value={selectedDocument} onValueChange={setSelectedDocument}>
<SelectTrigger className="bg-gray-900 text-gray-100 border-gray-700">
<SelectValue placeholder="Choisir un document" />
</SelectTrigger>
<SelectContent className="bg-gray-900 text-gray-100 border-gray-700">
{actionModal.folder.expectedDocuments.map((doc) => (
<SelectItem key={doc.name} value={doc.name}>
<div className="flex items-center justify-between w-full">
<div className="flex items-center space-x-2">
<FileText className="h-4 w-4 text-gray-300" />
<span>{doc.name}</span>
{doc.required && <span className="text-red-500">*</span>}
</div>
<div className="flex items-center space-x-2">
<Badge
className={
doc.status === "received"
? "bg-green-700 text-green-200"
: doc.status === "pending"
? "bg-orange-700 text-orange-200"
: "bg-red-700 text-red-200"
}
>
{doc.status === "received"
? "Reçu"
: doc.status === "pending"
? "En attente"
: "Manquant"}
</Badge>
<span className="text-xs text-gray-400">({doc.assignedRole})</span>
</div>
</div>
</SelectItem>
))}
</SelectContent>
</Select>
</div>
<div>
<Label htmlFor="requestMessage" className="text-gray-100">Message de demande</Label>
<Textarea
id="requestMessage"
value={requestMessage}
onChange={(e) => setRequestMessage(e.target.value)}
placeholder="Ajouter un message pour expliquer votre demande..."
rows={3}
className="bg-gray-900 text-gray-100 border-gray-700 placeholder-gray-500"
/>
</div>
<div className="flex justify-end space-x-2">
<Button
variant="outline"
onClick={() => setActionModal({ type: null, folder: null, folders: [] })}
>
Annuler
</Button>
<Button onClick={confirmRequestDocument} disabled={!selectedDocument}>
<FileQuestion className="h-4 w-4 mr-2" />
Envoyer la demande
</Button>
</div>
</div>
</>
)}
</div>
</CardContent>
</Card>
))}
</div>
</div>
)}
</div>
)}
</div>
{/* Modals */}
{isModalOpen && (