From 3a2532805a08cb2504fd76640d1ad136e3a8781b Mon Sep 17 00:00:00 2001 From: frakarr Date: Sun, 7 Dec 2025 16:29:20 +0100 Subject: [PATCH] feat: Add email alerts tab to settings Introduces a new tab in the settings section dedicated to configuring email alerts. This allows administrators to manage automatic email notifications for various events within the Condopay application. --- .dockerignore | Bin 81 -> 105 bytes Dockerfile | 14 ------- nginx.conf | 21 +---------- pages/Settings.tsx | 92 ++++++++++++++++++++++++++++++++++++++++++++- server/Dockerfile | 8 +--- 5 files changed, 93 insertions(+), 42 deletions(-) diff --git a/.dockerignore b/.dockerignore index 10c5075f1f010ae3f81113205ea3014be510d60b..b3e90c29e43ec3e8cab67b74444927db2400e19e 100644 GIT binary patch literal 105 zcmaFAfA9PKd*gsOOBP6k196$QZXS>-;ZOpS>_7}e3=m2?147F|C { { id: 'users', label: 'Utenti', icon: }, { id: 'notices', label: 'Bacheca', icon: }, { id: 'alerts', label: 'Avvisi Email', icon: }, - { id: 'smtp', label: 'Impostazioni Posta', icon: } + { id: 'smtp', label: 'SMTP', icon: } ); } @@ -741,6 +741,54 @@ export const SettingsPage: React.FC = () => { )} + {/* ALERTS TAB */} + {isAdmin && activeTab === 'alerts' && ( +
+
+

Avvisi Automatici

Configura email automatiche per scadenze.

+ +
+
+ {alerts.map(alert => ( +
+

{alert.subject}

+

{alert.body}

+
+ Offset: {alert.daysOffset} giorni ({alert.offsetType}) + Ore: {alert.sendHour}:00 + {alert.active ? 'Attivo' : 'Inattivo'} +
+
+ + +
+
+ ))} + {alerts.length === 0 &&
Nessun alert configurato.
} +
+
+ )} + + {/* SMTP TAB */} + {isAdmin && activeTab === 'smtp' && ( +
+

Configurazione SMTP

+
+
+
setGlobalSettings(prev => prev ? {...prev, smtpConfig: {...(prev.smtpConfig || {}), host: e.target.value} as any} : null)} className="w-full border p-2.5 rounded-lg text-slate-700"/>
+
setGlobalSettings(prev => prev ? {...prev, smtpConfig: {...(prev.smtpConfig || {}), port: parseInt(e.target.value)} as any} : null)} className="w-full border p-2.5 rounded-lg text-slate-700"/>
+
+
+
setGlobalSettings(prev => prev ? {...prev, smtpConfig: {...(prev.smtpConfig || {}), user: e.target.value} as any} : null)} className="w-full border p-2.5 rounded-lg text-slate-700"/>
+
setGlobalSettings(prev => prev ? {...prev, smtpConfig: {...(prev.smtpConfig || {}), pass: e.target.value} as any} : null)} className="w-full border p-2.5 rounded-lg text-slate-700"/>
+
+
setGlobalSettings(prev => prev ? {...prev, smtpConfig: {...(prev.smtpConfig || {}), fromEmail: e.target.value} as any} : null)} className="w-full border p-2.5 rounded-lg text-slate-700"/>
+
setGlobalSettings(prev => prev ? {...prev, smtpConfig: {...(prev.smtpConfig || {}), secure: e.target.checked} as any} : null)} className="w-4 h-4"/>
+
{successMsg}
+
+
+ )} + {/* ALERT MODAL */} {showAlertModal && (
@@ -778,6 +826,48 @@ export const SettingsPage: React.FC = () => {
)} + {/* NOTICE MODAL */} + {showNoticeModal && ( +
+
+

{editingNotice ? 'Modifica Avviso' : 'Nuovo Avviso'}

+
+ setNoticeForm({...noticeForm, title: e.target.value})} required /> +