127 lines
4.3 KiB
PHP
127 lines
4.3 KiB
PHP
<?php
|
|
include('include/headscript.php');
|
|
|
|
$db = DBHandlerSelect::getInstance();
|
|
$pdo = $db->getConnection();
|
|
|
|
$userId = (int)($iduserlogin ?? 0);
|
|
|
|
// Carica le preferenze correnti dell'utente
|
|
$prefs = ['notify_export_email' => 1];
|
|
if ($userId > 0) {
|
|
$s = $pdo->prepare("SELECT notify_export_email FROM auth_users WHERE id = ? LIMIT 1");
|
|
$s->execute([$userId]);
|
|
$row = $s->fetch(PDO::FETCH_ASSOC);
|
|
if ($row) {
|
|
$prefs['notify_export_email'] = (int)($row['notify_export_email'] ?? 1);
|
|
}
|
|
}
|
|
|
|
// Flash message post-save (via querystring)
|
|
$saved = isset($_GET['saved']) && $_GET['saved'] === '1';
|
|
?>
|
|
<!doctype html>
|
|
<html lang="it">
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="icon" href="assets/images/favicon-32x32.png" type="image/png" />
|
|
<?php include('cssinclude.php'); ?>
|
|
<title>SmartTRF - Notifiche</title>
|
|
<style>
|
|
.notif-row {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
justify-content: space-between;
|
|
gap: 16px;
|
|
padding: 16px 0;
|
|
border-bottom: 1px solid #eef0f2;
|
|
}
|
|
|
|
.notif-row:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.notif-text {
|
|
max-width: 640px;
|
|
}
|
|
|
|
.notif-text h6 {
|
|
margin: 0 0 4px;
|
|
font-size: 15px;
|
|
}
|
|
|
|
.notif-text p {
|
|
margin: 0;
|
|
font-size: 13px;
|
|
color: #6c757d;
|
|
}
|
|
|
|
.form-switch .form-check-input {
|
|
width: 2.6em;
|
|
height: 1.4em;
|
|
cursor: pointer;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="wrapper">
|
|
<?php include('include/navbar.php'); ?>
|
|
<?php include('include/topbar.php'); ?>
|
|
<div class="page-wrapper">
|
|
<div class="page-content">
|
|
|
|
<div class="card radius-10">
|
|
<div class="card-header">
|
|
<div>
|
|
<h6 class="mb-0">Preferenze notifiche</h6>
|
|
<small class="text-muted">Scegli quali email vuoi ricevere da SmartTRF.</small>
|
|
</div>
|
|
</div>
|
|
<div class="card-body">
|
|
|
|
<?php if ($saved): ?>
|
|
<div class="alert alert-success py-2" role="alert">
|
|
<i class="fas fa-check-circle me-1"></i> Preferenze salvate.
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<form action="update_notification_prefs.php" method="POST">
|
|
<input type="hidden" name="iduserlogin" value="<?= htmlspecialchars((string)$userId, ENT_QUOTES, 'UTF-8') ?>">
|
|
|
|
<!-- Notifica: commesse esportate -->
|
|
<div class="notif-row">
|
|
<div class="notif-text">
|
|
<h6>Ricezione email commesse esportate</h6>
|
|
<p>Ricevi un riepilogo via email al termine di ogni esportazione verso il LIMS (singola o in blocco), con l'esito di ciascuna commessa.</p>
|
|
</div>
|
|
<div class="form-check form-switch">
|
|
<input class="form-check-input" type="checkbox" role="switch"
|
|
id="notify_export_email" name="notify_export_email" value="1"
|
|
<?= $prefs['notify_export_email'] === 1 ? 'checked' : '' ?>>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Qui in futuro altre notifiche, stessa struttura .notif-row -->
|
|
|
|
<div class="mt-4">
|
|
<button type="submit" class="btn btn-primary">
|
|
<i class="fas fa-save me-1"></i> Salva preferenze
|
|
</button>
|
|
</div>
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="overlay toggle-icon"></div>
|
|
<?php include('include/footer.php'); ?>
|
|
</div>
|
|
<?php include('jsinclude.php'); ?>
|
|
</body>
|
|
|
|
</html>
|