From 9303bac13201834433fc028e5faee4a9f5b30f7f Mon Sep 17 00:00:00 2001 From: fcarraUniSa Date: Tue, 17 Feb 2026 10:42:04 +0100 Subject: [PATCH] Update AgentDashboard.tsx --- components/AgentDashboard.tsx | 287 ++++++++++++++++++++++++++++++++-- 1 file changed, 273 insertions(+), 14 deletions(-) diff --git a/components/AgentDashboard.tsx b/components/AgentDashboard.tsx index 8fac102..f476feb 100644 --- a/components/AgentDashboard.tsx +++ b/components/AgentDashboard.tsx @@ -575,11 +575,10 @@ export const AgentDashboard: React.FC = ({ const handleSaveSettings = () => { setIsSaving(true); - // Simulate API call + // Simulate API call using prop + updateSettings(tempSettings); setTimeout(() => { - updateSettings(tempSettings); setIsSaving(false); - showToast("Impostazioni salvate con successo!", 'success'); }, 800); }; @@ -759,6 +758,81 @@ export const AgentDashboard: React.FC = ({
+ {/* SYSTEM SETTINGS TAB */} + {settingsTab === 'system' && canManageGlobalSettings && ( +
+

Limiti e Quote di Sistema

+
+
+ + setTempSettings({...tempSettings, features: {...tempSettings.features, maxKbArticles: parseInt(e.target.value)}})} /> +
+
+ + setTempSettings({...tempSettings, features: {...tempSettings.features, maxAgents: parseInt(e.target.value)}})} /> +
+
+ + setTempSettings({...tempSettings, features: {...tempSettings.features, maxSupervisors: parseInt(e.target.value)}})} /> +
+
+ + setTempSettings({...tempSettings, features: {...tempSettings.features, maxAiGeneratedArticles: parseInt(e.target.value)}})} /> +
+
+
+ setTempSettings({...tempSettings, features: {...tempSettings.features, kbEnabled: e.target.checked}})} /> + +
+
+ setTempSettings({...tempSettings, features: {...tempSettings.features, aiKnowledgeAgentEnabled: e.target.checked}})} /> + +
+
+ )} + + {/* GENERAL (BRANDING) TAB */} + {settingsTab === 'general' && canManageGlobalSettings && ( +
+

Personalizzazione Branding

+
+ + setTempSettings({...tempSettings, branding: {...tempSettings.branding, appName: e.target.value}})} /> +
+
+ +
+ setTempSettings({...tempSettings, branding: {...tempSettings.branding, primaryColor: e.target.value}})} /> + setTempSettings({...tempSettings, branding: {...tempSettings.branding, primaryColor: e.target.value}})} /> +
+
+
+ + setTempSettings({...tempSettings, branding: {...tempSettings.branding, logoUrl: e.target.value}})} /> +
+
+ )} + {/* AI CONFIG TAB */} {settingsTab === 'ai' && canManageTeam && (
@@ -832,18 +906,203 @@ export const AgentDashboard: React.FC = ({
)} + + {/* USERS TAB */} + {settingsTab === 'users' && canManageTeam && ( +
+
+

Gestione Utenti Frontend

+ +
+ +
+

{editingUser ? 'Modifica Utente' : 'Aggiungi Nuovo Utente'}

+
+ setNewUserForm({...newUserForm, name: e.target.value})} /> + setNewUserForm({...newUserForm, email: e.target.value})} /> + setNewUserForm({...newUserForm, company: e.target.value})} /> + +
+
+ {editingUser && } + +
+
+ +
+ + + + {clientUsers.map(user => ( + + + + + + + + ))} + +
NomeEmailAziendaStatoAzioni
{user.name}{user.email}{user.company || '-'}{user.status} + + + +
+
+
+ )} + + {/* AGENTS TAB */} + {settingsTab === 'agents' && canManageTeam && ( +
+
+

Team di Supporto

+ {isAgentQuotaFull ? Quota Agenti Raggiunta : ( + + )} +
+ +
+

{editingAgent ? 'Modifica Profilo Agente' : 'Nuovo Membro del Team'}

+
+
+ handleAvatarSaved(img, cfg, !!editingAgent)} + /> +
+
+
+ setNewAgentForm({...newAgentForm, name: e.target.value})} /> + setNewAgentForm({...newAgentForm, email: e.target.value})} /> +
+
+ + setNewAgentForm({...newAgentForm, password: e.target.value})} /> +
+ +
+ +
+ {queues.map(q => ( + + ))} +
+
+ +
+ {editingAgent && } + +
+
+
+
+ +
+ {agents.map(agent => ( +
+
+ {agent.name} +
+
+
+

{agent.name}

+ {agent.role} +
+

{agent.email}

+
+ {agent.queues.map(q => {q})} +
+
+ + {agent.role !== 'superadmin' && } +
+
+
+ ))} +
+
+ )} - {settingsTab !== 'ai' && ( - <> - {settingsTab === 'system' && canManageGlobalSettings && ( -

Limiti e Quote di Sistema

Configura i limiti globali.

- )} - {settingsTab === 'general' && canManageGlobalSettings &&

Personalizzazione Branding

{/* ... */}
} - {settingsTab === 'users' && canManageTeam &&

Gestione Utenti Frontend

{/* ... */}
} - {settingsTab === 'agents' && canManageTeam &&

Gestione Team di Supporto

{/* ... */}
} - {settingsTab === 'queues' && canManageTeam &&

Code di Smistamento

{/* ... */}
} - {settingsTab === 'email' && canManageGlobalSettings &&

Notifiche & Email

{/* ... */}
} - + {/* QUEUES TAB */} + {settingsTab === 'queues' && canManageTeam && ( +
+

Code di Smistamento

+
+
+ + setNewQueueForm({...newQueueForm, name: e.target.value})} /> +
+
+ + setNewQueueForm({...newQueueForm, description: e.target.value})} /> +
+ +
+ +
+ {queues.map(q => ( +
+
+

+ + {q.name} +

+

{q.description}

+
+ +
+ ))} +
+
+ )} + + {settingsTab === 'email' && canManageGlobalSettings && ( +
+

Configurazione SMTP

+
+
+ + setTempSettings({...tempSettings, smtp: {...tempSettings.smtp, host: e.target.value}})} /> +
+
+ + setTempSettings({...tempSettings, smtp: {...tempSettings.smtp, port: parseInt(e.target.value)}})} /> +
+
+ + setTempSettings({...tempSettings, smtp: {...tempSettings.smtp, user: e.target.value}})} /> +
+
+ + setTempSettings({...tempSettings, smtp: {...tempSettings.smtp, pass: e.target.value}})} /> +
+
+
+ +
+
)} {settingsTab !== 'users' && settingsTab !== 'agents' && settingsTab !== 'queues' && (