// ECO-PANNEAU.FR - _react/clients/_clients_settings.jsx // 1. - MODALE : GESTIONNAIRE DE FICHIERS (QUOTA) const FileManagerModal = ({ onClose, showToast, refreshData }) => { const { useState, useEffect } = React; const { isMounted, safeFetch } = window.pano_useSafeFetch(); const [files, setFiles] = useState([]); const [isLoading, setIsLoading] = useState(true); const [isDeleting, setIsDeleting] = useState(false); const { Trash2Icon, FileTextIcon, ShieldIcon, LoaderIcon, AlertTriangleIcon } = window.pano_getIcons(); const { Button, Modal } = window.pano_getComponents(); const fetchFiles = async () => { setIsLoading(true); const d = await safeFetch('clients/files/list', { method: 'GET', silent: true }); if (!isMounted.current) return; if (d && d.status === 'success') { setFiles(d.data || []); } setIsLoading(false); }; useEffect(() => { fetchFiles(); }, []); const handleDelete = async (fileId) => { const d = await safeFetch('clients/files/delete', { body: { file_id: fileId }, setLoading: setIsDeleting, successMessage: "Fichier supprimé avec succès. Espace libéré." }); if (!isMounted.current) return; if (d) { await fetchFiles(); if (refreshData) refreshData(); } }; return ( ( )} >

Retrouvez ici l'ensemble des fichiers stockés sur votre compte. Les documents légaux (ex: Arrêtés, D.O.E) ne peuvent pas être supprimés manuellement pour des raisons de conformité.

{isLoading ? (
Analyse de l'espace...
) : files.length === 0 ? (
Aucun fichier volumineux trouvé sur votre compte.
) : (
{files.map(f => ( ))}
Fichier Emplacement Taille Action

{f.name}

{new Date(f.created_at).toLocaleDateString('fr-FR')}

{f.context_label} {parseFloat(f.size_mb).toFixed(2)} Mo {f.is_legal ? (
) : (
)}
); }; // 2. - MODALE : UPSELL DE FORFAIT (STORAGE PLAN) const StoragePlanModal = ({ onClose, showToast, refreshData, clientData, adminData }) => { const { useState } = React; const { isMounted, safeFetch } = window.pano_useSafeFetch(); const [isSaving, setIsSaving] = useState(false); const { HardDriveIcon, MinusIcon, PlusIcon, LoaderIcon, AlertTriangleIcon } = window.pano_getIcons(); const { Button, Modal } = window.pano_getComponents(); // Récupération des constantes d'admin const baseQuota = parseInt(adminData.settings?.quota_global_mb || 5000, 10); const stepGb = parseInt(adminData.settings?.quota_step_gb || 10, 10); const stepPrice = parseFloat(adminData.prices?.storage || 5); // Données client const usedMb = parseFloat(clientData.storage_used_mb || 0); const currentSteps = parseInt(clientData.storage_extra_gb || 0, 10) / stepGb; const [selectedSteps, setSelectedSteps] = useState(isNaN(currentSteps) ? 0 : Math.floor(currentSteps)); // Calculs dynamiques const newTotalMb = baseQuota + (selectedSteps * stepGb * 1024); const newPrice = selectedSteps * stepPrice; const canDowngrade = newTotalMb >= usedMb; const handleSave = async () => { if (!canDowngrade) return; const extraGb = selectedSteps * stepGb; const d = await safeFetch('clients/profile/update_storage_plan', { body: { extra_gb: extraGb, price_mo: newPrice }, setLoading: setIsSaving, successMessage: "Votre forfait de stockage a été mis à jour avec succès." }); if (!isMounted.current) return; if (d) { if (refreshData) refreshData(); onClose(); } }; return ( ( <> )} >

Augmentez votre capacité de stockage pour conserver plus de photos, de D.O.E et d'historiques de messagerie. Sans engagement de durée.

Forfait de base (Inclus) {(baseQuota / 1024).toFixed(2)} Go
Paliers supplémentaires +{stepGb} Go / {stepPrice} € HT mois

Nouveau Total

{(newTotalMb / 1024).toFixed(2)} Go

Facturation

+{newPrice.toFixed(2)} € HT/mo

{!canDowngrade && (

Vous consommez actuellement {(usedMb / 1024).toFixed(2)} Go. Vous devez d'abord supprimer des fichiers via le gestionnaire pour pouvoir revenir à ce forfait inférieur.

)}
); }; // 3. - CONTENEUR PRINCIPAL (WRAPPER) window.pano_ClientSettingsView = ({ data, refreshData, initialTab }) => { const { useState, useEffect } = React; const [activeDialog, setActiveDialog] = useState(null); const { SettingsIcon, UserIcon } = window.pano_getIcons(); const { ClientSettingsProfile } = window.pano_getComponents(); // Le fichier précédent const myClientData = data.clients?.[0] || {}; const adminData = { settings: data.settings, prices: data.prices }; const openLocalDialog = (id) => setActiveDialog(id); const closeCurrentLayer = () => setActiveDialog(null); // Fonction simulée de Toast pour l'exemple const showToast = (msg, type) => { if (window.pano_showToast) window.pano_showToast(msg, type); }; return (

Mon Compte

Paramètres, facturation et stockage

{/* Inclusion du profil client (Le fichier précédent) */} {ClientSettingsProfile && ( )}
{/* MODALES EXTERNES APPELLÉES PAR LE PROFIL */} {activeDialog === 'file_manager' && ( )} {activeDialog === 'storage_plan' && ( )}
); }; /* EOF ========== [_react/clients/_clients_settings.jsx] */