dashboard
This commit is contained in:
+186
-199
@@ -1,258 +1,247 @@
|
|||||||
<?php
|
<?php
|
||||||
// Forza la visualizzazione degli errori
|
// Forza la visualizzazione degli errori (solo dev)
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
ini_set('display_startup_errors', 1);
|
ini_set('display_startup_errors', 1);
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
include('include/headscript.php');
|
include('include/headscript.php');
|
||||||
|
|
||||||
// Connessione al database
|
// Connessione DB
|
||||||
$dbHandler = DBHandlerSelect::getInstance();
|
$dbHandler = DBHandlerSelect::getInstance();
|
||||||
$pdo = $dbHandler->getConnection();
|
$pdo = $dbHandler->getConnection();
|
||||||
|
|
||||||
// Verifica che iduserlogin sia definito
|
// Verifica utente loggato
|
||||||
if (!isset($iduserlogin)) {
|
if (!isset($iduserlogin)) {
|
||||||
die("Errore: ID utente non definito.");
|
header("Location: login.php");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recupera i dati della scuola in base all'utente loggato
|
// Controlla se esiste almeno un salone
|
||||||
$stmt = $pdo->prepare("SELECT id, name FROM schools WHERE owner_id = ?");
|
$stmt = $pdo->prepare("SELECT COUNT(*) FROM shops WHERE owner_id = ?");
|
||||||
$stmt->execute([$iduserlogin]);
|
$stmt->execute([$iduserlogin]);
|
||||||
$school = $stmt->fetch();
|
if ($stmt->fetchColumn() === 0) {
|
||||||
if (!$school) {
|
header("Location: onboarding_salon.php");
|
||||||
die("Errore: Nessuna scuola trovata per l'utente loggato.");
|
exit;
|
||||||
}
|
}
|
||||||
$school_id = $school['id'];
|
|
||||||
$school_name = $school['name'];
|
|
||||||
|
|
||||||
// Gestione delle azioni (aggiunta, modifica, cancellazione)
|
// Prendi il primo salone (o quello attivo – puoi aggiungere switcher dopo)
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
$stmt = $pdo->prepare("
|
||||||
if (isset($_POST['action'])) {
|
SELECT id, name
|
||||||
$action = $_POST['action'];
|
FROM shops
|
||||||
|
WHERE owner_id = ?
|
||||||
|
ORDER BY created_at ASC
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
$stmt->execute([$iduserlogin]);
|
||||||
|
$shop = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
// Aggiunta di un giorno di chiusura
|
if (!$shop) {
|
||||||
if ($action === 'add') {
|
die("Errore: salone non trovato.");
|
||||||
$start_date = $_POST['start_date'] ?? '';
|
}
|
||||||
$end_date = $_POST['end_date'] ?? '';
|
|
||||||
$description = $_POST['description'] ?? null;
|
|
||||||
|
|
||||||
// Validazione: assicurarsi che end_date >= start_date
|
$shop_id = $shop['id'];
|
||||||
if (empty($start_date) || empty($end_date)) {
|
$shop_name = $shop['name'];
|
||||||
$error = "Le date di inizio e fine sono obbligatorie.";
|
|
||||||
} elseif (strtotime($end_date) < strtotime($start_date)) {
|
// =========================================================================
|
||||||
$error = "La data di fine non può essere precedente alla data di inizio.";
|
// Gestione POST (add / edit / delete)
|
||||||
} else {
|
// =========================================================================
|
||||||
|
$success_message = '';
|
||||||
|
$error_message = '';
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'])) {
|
||||||
|
$action = $_POST['action'];
|
||||||
|
|
||||||
|
if ($action === 'add' || $action === 'edit') {
|
||||||
|
$start_date = trim($_POST['start_date'] ?? '');
|
||||||
|
$end_date = trim($_POST['end_date'] ?? '');
|
||||||
|
$description = trim($_POST['description'] ?? '');
|
||||||
|
$id = ($action === 'edit') ? (int)($_POST['id'] ?? 0) : 0;
|
||||||
|
|
||||||
|
// Validazioni
|
||||||
|
if (empty($start_date) || empty($end_date)) {
|
||||||
|
$error_message = "Le date di inizio e fine sono obbligatorie.";
|
||||||
|
} elseif (strtotime($end_date) < strtotime($start_date)) {
|
||||||
|
$error_message = "La data di fine non può essere precedente alla data di inizio.";
|
||||||
|
} else {
|
||||||
|
if ($action === 'add') {
|
||||||
$stmt = $pdo->prepare("
|
$stmt = $pdo->prepare("
|
||||||
INSERT INTO day_off (school_id, start_date, end_date, description)
|
INSERT INTO shop_day_off (shop_id, date, title, description, is_recurring, created_at)
|
||||||
VALUES (?, ?, ?, ?)
|
VALUES (?, ?, ?, ?, 0, NOW())
|
||||||
");
|
");
|
||||||
$success = $stmt->execute([
|
$ok = $stmt->execute([$shop_id, $start_date, $description ?: 'Chiusura', $description]);
|
||||||
$school_id,
|
$success_message = $ok ? "Giorno di chiusura aggiunto!" : "Errore durante l'aggiunta.";
|
||||||
$start_date,
|
} else { // edit
|
||||||
$end_date,
|
|
||||||
$description
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($success) {
|
|
||||||
$success_message = "Giorno di chiusura aggiunto con successo!";
|
|
||||||
} else {
|
|
||||||
$error = "Errore durante l'aggiunta del giorno di chiusura.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Modifica di un giorno di chiusura
|
|
||||||
if ($action === 'edit') {
|
|
||||||
$id = $_POST['id'] ?? 0;
|
|
||||||
$start_date = $_POST['start_date'] ?? '';
|
|
||||||
$end_date = $_POST['end_date'] ?? '';
|
|
||||||
$description = $_POST['description'] ?? null;
|
|
||||||
|
|
||||||
// Validazione: assicurarsi che end_date >= start_date
|
|
||||||
if (empty($start_date) || empty($end_date)) {
|
|
||||||
$error = "Le date di inizio e fine sono obbligatorie.";
|
|
||||||
} elseif (strtotime($end_date) < strtotime($start_date)) {
|
|
||||||
$error = "La data di fine non può essere precedente alla data di inizio.";
|
|
||||||
} else {
|
|
||||||
$stmt = $pdo->prepare("
|
$stmt = $pdo->prepare("
|
||||||
UPDATE day_off
|
UPDATE shop_day_off
|
||||||
SET start_date = ?, end_date = ?, description = ?
|
SET date = ?, title = ?, description = ?, updated_at = NOW()
|
||||||
WHERE id = ? AND school_id = ?
|
WHERE id = ? AND shop_id = ?
|
||||||
");
|
");
|
||||||
$success = $stmt->execute([
|
$ok = $stmt->execute([$start_date, $description ?: 'Chiusura', $description, $id, $shop_id]);
|
||||||
$start_date,
|
$success_message = $ok ? "Giorno di chiusura aggiornato!" : "Errore durante l'aggiornamento.";
|
||||||
$end_date,
|
|
||||||
$description,
|
|
||||||
$id,
|
|
||||||
$school_id
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($success) {
|
|
||||||
$success_message = "Giorno di chiusura aggiornato con successo!";
|
|
||||||
} else {
|
|
||||||
$error = "Errore durante l'aggiornamento del giorno di chiusura.";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Cancellazione di un giorno di chiusura
|
if ($action === 'delete') {
|
||||||
if ($action === 'delete') {
|
$id = (int)($_POST['id'] ?? 0);
|
||||||
$id = $_POST['id'] ?? 0;
|
if ($id > 0) {
|
||||||
$stmt = $pdo->prepare("DELETE FROM day_off WHERE id = ? AND school_id = ?");
|
$stmt = $pdo->prepare("DELETE FROM shop_day_off WHERE id = ? AND shop_id = ?");
|
||||||
$success = $stmt->execute([$id, $school_id]);
|
$ok = $stmt->execute([$id, $shop_id]);
|
||||||
|
$success_message = $ok ? "Giorno di chiusura eliminato!" : "Errore durante l'eliminazione.";
|
||||||
if ($success) {
|
|
||||||
$success_message = "Giorno di chiusura eliminato con successo!";
|
|
||||||
} else {
|
|
||||||
$error = "Errore durante l'eliminazione del giorno di chiusura.";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Reindirizza per evitare il doppio invio del form
|
// Evita doppio submit
|
||||||
header("Location: day_off.php");
|
if ($success_message || $error_message) {
|
||||||
|
header("Location: day_off.php" . ($success_message ? "?msg=success" : "?msg=error"));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recupera tutti i giorni di chiusura della scuola
|
// Recupera tutti i giorni di chiusura
|
||||||
$stmt = $pdo->prepare("
|
$stmt = $pdo->prepare("
|
||||||
SELECT *
|
SELECT id, date, title, description, is_recurring
|
||||||
FROM day_off
|
FROM shop_day_off
|
||||||
WHERE school_id = ?
|
WHERE shop_id = ?
|
||||||
ORDER BY start_date
|
ORDER BY date ASC
|
||||||
");
|
");
|
||||||
$stmt->execute([$school_id]);
|
$stmt->execute([$shop_id]);
|
||||||
$days_off = $stmt->fetchAll();
|
$days_off = $stmt->fetchAll();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="it">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<!-- Required meta tags -->
|
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<!--favicon-->
|
|
||||||
<link rel="icon" href="assets/images/favicon-32x32.png" type="image/png" />
|
<link rel="icon" href="assets/images/favicon-32x32.png" type="image/png" />
|
||||||
<?php include('cssinclude.php'); ?>
|
<?php include('cssinclude.php'); ?>
|
||||||
<?php include('siteinfo.php'); ?>
|
<?php include('siteinfo.php'); ?>
|
||||||
|
<title>Giorni di Chiusura - <?= htmlspecialchars($shop_name) ?></title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<!--wrapper-->
|
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<!--sidebar wrapper -->
|
|
||||||
<?php include('include/navbar.php'); ?>
|
<?php include('include/navbar.php'); ?>
|
||||||
<!--end sidebar wrapper -->
|
|
||||||
<!--start header -->
|
|
||||||
<?php include('include/topbar.php'); ?>
|
<?php include('include/topbar.php'); ?>
|
||||||
<!--end header -->
|
|
||||||
<!--start page wrapper -->
|
|
||||||
<div class="page-wrapper">
|
<div class="page-wrapper">
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<div class="card radius-10">
|
<div class="card radius-10">
|
||||||
<div class="card-header">
|
<div class="card-header bg-light d-flex align-items-center justify-content-between">
|
||||||
<div class="d-flex align-items-center">
|
<h6 class="mb-0">Giorni di Chiusura - <?= htmlspecialchars($shop_name) ?></h6>
|
||||||
<div>
|
<div>
|
||||||
<h6 class="mb-0">Giorni di Chiusura - <?php echo htmlspecialchars($school_name); ?></h6>
|
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addDayOffModal">
|
||||||
</div>
|
<i class="bx bx-plus me-1"></i> Aggiungi Chiusura
|
||||||
<div class="ms-auto">
|
</button>
|
||||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addDayOffModal">
|
<a href="salon_dashboard.php" class="btn btn-outline-secondary ms-2">
|
||||||
Aggiungi Giorno di Chiusura
|
<i class="bx bx-arrow-back me-1"></i> Dashboard
|
||||||
</button>
|
</a>
|
||||||
<a href="school_dashboard.php" class="btn btn-secondary ms-2">Torna alla Dashboard</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<?php if (isset($success_message)): ?>
|
<?php if (isset($_GET['msg'])): ?>
|
||||||
<div class="alert alert-success" role="alert">
|
<?php if ($_GET['msg'] === 'success'): ?>
|
||||||
<?php echo $success_message; ?>
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||||
</div>
|
<?= htmlspecialchars($success_message) ?>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||||
|
</div>
|
||||||
|
<?php elseif ($_GET['msg'] === 'error'): ?>
|
||||||
|
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||||
|
<?= htmlspecialchars($error_message) ?>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if (isset($error)): ?>
|
|
||||||
<div class="alert alert-danger" role="alert">
|
<?php if (empty($days_off)): ?>
|
||||||
<?php echo $error; ?>
|
<div class="alert alert-info text-center py-4">
|
||||||
|
Non hai ancora impostato giorni di chiusura.<br>
|
||||||
|
Aggiungine uno per bloccare le prenotazioni in quei giorni.
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php else: ?>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table id="daysOffTable" class="table table-striped table-bordered">
|
<table id="daysOffTable" class="table table-striped table-hover table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
|
||||||
<th>Data Inizio</th>
|
|
||||||
<th>Data Fine</th>
|
|
||||||
<th>Descrizione</th>
|
|
||||||
<th>Azioni</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php foreach ($days_off as $day_off): ?>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo htmlspecialchars($day_off['start_date']); ?></td>
|
<th>Data</th>
|
||||||
<td><?php echo htmlspecialchars($day_off['end_date']); ?></td>
|
<th>Titolo / Descrizione</th>
|
||||||
<td><?php echo htmlspecialchars($day_off['description'] ?? ''); ?></td>
|
<th>Ricorrente</th>
|
||||||
<td>
|
<th>Azioni</th>
|
||||||
<button type="button" class="btn btn-sm btn-warning" data-bs-toggle="modal" data-bs-target="#editDayOffModal"
|
|
||||||
onclick='fillEditDayOffModal(<?php echo json_encode([
|
|
||||||
"id" => $day_off['id'],
|
|
||||||
"start_date" => $day_off['start_date'],
|
|
||||||
"end_date" => $day_off['end_date'],
|
|
||||||
"description" => htmlspecialchars($day_off['description'] ?? '', ENT_QUOTES)
|
|
||||||
]); ?>)'>
|
|
||||||
Modifica
|
|
||||||
</button>
|
|
||||||
<form action="" method="POST" style="display:inline;" onsubmit="return confirm('Sei sicuro di voler eliminare questo giorno di chiusura?');">
|
|
||||||
<input type="hidden" name="action" value="delete">
|
|
||||||
<input type="hidden" name="id" value="<?php echo $day_off['id']; ?>">
|
|
||||||
<button type="submit" class="btn btn-sm btn-danger">Elimina</button>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
</table>
|
<?php foreach ($days_off as $day): ?>
|
||||||
</div>
|
<tr>
|
||||||
|
<td><?= htmlspecialchars($day['date']) ?></td>
|
||||||
|
<td><?= htmlspecialchars($day['title'] ?: $day['description'] ?: 'Chiusura') ?></td>
|
||||||
|
<td>
|
||||||
|
<?php if ($day['is_recurring']): ?>
|
||||||
|
<span class="badge bg-success">Sì (ogni anno)</span>
|
||||||
|
<?php else: ?>
|
||||||
|
<span class="badge bg-secondary">No</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="button" class="btn btn-sm btn-warning me-1"
|
||||||
|
data-bs-toggle="modal" data-bs-target="#editDayOffModal"
|
||||||
|
onclick='fillEditModal(<?= json_encode([
|
||||||
|
"id" => $day['id'],
|
||||||
|
"date" => $day['date'],
|
||||||
|
"title" => htmlspecialchars($day['title'] ?? '', ENT_QUOTES),
|
||||||
|
"description" => htmlspecialchars($day['description'] ?? '', ENT_QUOTES)
|
||||||
|
]) ?>)'>
|
||||||
|
<i class="bx bx-edit"></i> Modifica
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<form action="" method="POST" style="display:inline;"
|
||||||
|
onsubmit="return confirm('Confermi l\'eliminazione?');">
|
||||||
|
<input type="hidden" name="action" value="delete">
|
||||||
|
<input type="hidden" name="id" value="<?= $day['id'] ?>">
|
||||||
|
<button type="submit" class="btn btn-sm btn-danger">
|
||||||
|
<i class="bx bx-trash"></i> Elimina
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--end page wrapper -->
|
|
||||||
<!--start overlay-->
|
|
||||||
<div class="overlay toggle-icon"></div>
|
|
||||||
<!--end overlay-->
|
|
||||||
<!--Start Back To Top Button-->
|
|
||||||
<a href="javaScript:;" class="back-to-top"><i class='bx bxs-up-arrow-alt'></i></a>
|
|
||||||
<!--End Back To Top Button-->
|
|
||||||
<?php include('include/footer.php'); ?>
|
<?php include('include/footer.php'); ?>
|
||||||
</div>
|
</div>
|
||||||
<!--end wrapper-->
|
|
||||||
|
|
||||||
<!-- Modale per aggiungere un giorno di chiusura -->
|
<!-- Modal Aggiungi -->
|
||||||
<div class="modal fade" id="addDayOffModal" tabindex="-1" aria-labelledby="addDayOffModalLabel" aria-hidden="true">
|
<div class="modal fade" id="addDayOffModal" tabindex="-1" aria-labelledby="addDayOffModalLabel">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header bg-primary text-white">
|
||||||
<h5 class="modal-title" id="addDayOffModalLabel">Aggiungi Giorno di Chiusura</h5>
|
<h5 class="modal-title" id="addDayOffModalLabel">Aggiungi Giorno di Chiusura</h5>
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
||||||
</div>
|
</div>
|
||||||
<form action="" method="POST">
|
<form action="" method="POST">
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<input type="hidden" name="action" value="add">
|
<input type="hidden" name="action" value="add">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="add_day_off_start_date" class="form-label">Data Inizio</label>
|
<label class="form-label fw-bold">Data <span class="text-danger">*</span></label>
|
||||||
<input type="date" class="form-control" id="add_day_off_start_date" name="start_date" required>
|
<input type="date" class="form-control" name="start_date" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="add_day_off_end_date" class="form-label">Data Fine</label>
|
<label class="form-label fw-bold">Descrizione / Motivo</label>
|
||||||
<input type="date" class="form-control" id="add_day_off_end_date" name="end_date" required>
|
<input type="text" class="form-control" name="description"
|
||||||
</div>
|
placeholder="Es: Ferragosto, Ferie estive, Corso formazione">
|
||||||
<div class="mb-3">
|
|
||||||
<label for="add_day_off_description" class="form-label">Descrizione</label>
|
|
||||||
<input type="text" class="form-control" id="add_day_off_description" name="description" placeholder="Es. Natale">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Chiudi</button>
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Annulla</button>
|
||||||
<button type="submit" class="btn btn-primary">Aggiungi</button>
|
<button type="submit" class="btn btn-primary">Aggiungi</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@@ -260,34 +249,31 @@ $days_off = $stmt->fetchAll();
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Modale per modificare un giorno di chiusura -->
|
<!-- Modal Modifica -->
|
||||||
<div class="modal fade" id="editDayOffModal" tabindex="-1" aria-labelledby="editDayOffModalLabel" aria-hidden="true">
|
<div class="modal fade" id="editDayOffModal" tabindex="-1" aria-labelledby="editDayOffModalLabel">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header bg-warning text-dark">
|
||||||
<h5 class="modal-title" id="editDayOffModalLabel">Modifica Giorno di Chiusura</h5>
|
<h5 class="modal-title" id="editDayOffModalLabel">Modifica Giorno di Chiusura</h5>
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||||
</div>
|
</div>
|
||||||
<form action="" method="POST">
|
<form action="" method="POST">
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<input type="hidden" name="action" value="edit">
|
<input type="hidden" name="action" value="edit">
|
||||||
<input type="hidden" name="id" id="edit_day_off_id">
|
<input type="hidden" name="id" id="edit_id">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="edit_day_off_start_date" class="form-label">Data Inizio</label>
|
<label class="form-label fw-bold">Data <span class="text-danger">*</span></label>
|
||||||
<input type="date" class="form-control" id="edit_day_off_start_date" name="start_date" required>
|
<input type="date" class="form-control" name="start_date" id="edit_date" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="edit_day_off_end_date" class="form-label">Data Fine</label>
|
<label class="form-label fw-bold">Descrizione / Motivo</label>
|
||||||
<input type="date" class="form-control" id="edit_day_off_end_date" name="end_date" required>
|
<input type="text" class="form-control" name="description" id="edit_description"
|
||||||
</div>
|
placeholder="Es: Ferie natalizie">
|
||||||
<div class="mb-3">
|
|
||||||
<label for="edit_day_off_description" class="form-label">Descrizione</label>
|
|
||||||
<input type="text" class="form-control" id="edit_day_off_description" name="description" placeholder="Es. Natale">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Chiudi</button>
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Annulla</button>
|
||||||
<button type="submit" class="btn btn-primary">Salva Modifiche</button>
|
<button type="submit" class="btn btn-warning">Salva Modifiche</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -296,21 +282,22 @@ $days_off = $stmt->fetchAll();
|
|||||||
|
|
||||||
<?php include('jsinclude.php'); ?>
|
<?php include('jsinclude.php'); ?>
|
||||||
|
|
||||||
<!-- Script per inizializzare DataTables e gestire i modali -->
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#daysOffTable').DataTable({
|
$('#daysOffTable').DataTable({
|
||||||
"language": {
|
language: {
|
||||||
"url": "//cdn.datatables.net/plug-ins/1.10.25/i18n/Italian.json"
|
url: '//cdn.datatables.net/plug-ins/1.13.6/i18n/it-IT.json'
|
||||||
}
|
},
|
||||||
|
order: [
|
||||||
|
[0, 'asc']
|
||||||
|
]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function fillEditDayOffModal(data) {
|
function fillEditModal(data) {
|
||||||
document.getElementById('edit_day_off_id').value = data.id;
|
document.getElementById('edit_id').value = data.id;
|
||||||
document.getElementById('edit_day_off_start_date').value = data.start_date;
|
document.getElementById('edit_date').value = data.date;
|
||||||
document.getElementById('edit_day_off_end_date').value = data.end_date;
|
document.getElementById('edit_description').value = data.description || '';
|
||||||
document.getElementById('edit_day_off_description').value = data.description;
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ $photouser = $_SESSION["photouser"];
|
|||||||
|
|
||||||
|
|
||||||
// include school settings
|
// include school settings
|
||||||
include('schoolid_select.php');
|
//include('schoolid_select.php');
|
||||||
|
|
||||||
|
|
||||||
// include school settings
|
// include school settings
|
||||||
include('school_settings_loader.php');
|
//include('school_settings_loader.php');
|
||||||
|
|||||||
+108
-147
@@ -1,135 +1,129 @@
|
|||||||
<?php
|
|
||||||
// Recupera logo e nome scuola corrente (da sessione)
|
|
||||||
$school_logo_path = null;
|
|
||||||
$school_display_name = 'Nessuna scuola selezionata';
|
|
||||||
|
|
||||||
if (!empty($_SESSION['school_id'])) {
|
|
||||||
$school_id = (int)$_SESSION['school_id'];
|
|
||||||
|
|
||||||
$stmt_school = $pdo->prepare("SELECT name, logo FROM schools WHERE id = ?");
|
|
||||||
$stmt_school->execute([$school_id]);
|
|
||||||
$current_school = $stmt_school->fetch(PDO::FETCH_ASSOC);
|
|
||||||
echo $current_school['name'];
|
|
||||||
echo "Ciao";
|
|
||||||
if ($current_school) {
|
|
||||||
$school_display_name = $current_school['name'];
|
|
||||||
|
|
||||||
$logoRaw = trim($current_school['logo'] ?? '');
|
|
||||||
if (!empty($logoRaw)) {
|
|
||||||
$physicalPath = __DIR__ . '/../' . $logoRaw; // adatta path se necessario
|
|
||||||
if (file_exists($physicalPath)) {
|
|
||||||
$school_logo_path = '/' . $logoRaw; // path web root-relative
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<style>
|
<style>
|
||||||
.school-info {
|
.salon-info {
|
||||||
background: #f8f9fa;
|
background: #f8f9fa;
|
||||||
border-bottom: 1px solid #dee2e6;
|
border-bottom: 1px solid #dee2e6;
|
||||||
|
padding: 15px 10px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.school-info img {
|
.salon-info img {
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: 50%;
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.school-info .fw-bold {
|
.salon-info .fw-bold {
|
||||||
|
font-size: 1.1rem;
|
||||||
color: #343a40;
|
color: #343a40;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
max-width: 180px;
|
||||||
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="sidebar-wrapper" data-simplebar="true">
|
<div class="sidebar-wrapper" data-simplebar="true">
|
||||||
<div class="sidebar-header">
|
<div class="sidebar-header">
|
||||||
<div>
|
<div>
|
||||||
<img src="assets/images/logo-icon.png" class="logo-icon" alt="logo icon">
|
<img src="assets/images/logo-icon.png" class="logo-icon" alt="logo">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h4 class="logo-text">YogiBoook</h4>
|
<h4 class="logo-text">HairBook</h4> <!-- ← Cambia nome app qui -->
|
||||||
</div>
|
</div>
|
||||||
<div class="toggle-icon ms-auto"><i class='bx bx-arrow-back'></i>
|
<div class="toggle-icon ms-auto">
|
||||||
|
<i class='bx bx-arrow-back'></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--navigation-->
|
|
||||||
<ul class="metismenu" id="menu">
|
|
||||||
<!-- Logo e nome scuola corrente -->
|
|
||||||
<!-- Logo e nome scuola corrente (rettangolare, naturale) -->
|
|
||||||
<div class="school-info text-center py-3 px-2 border-bottom">
|
|
||||||
<?php if ($logoRaw): ?>
|
|
||||||
<img src="<?= htmlspecialchars($logoRaw) ?>"
|
|
||||||
alt="Logo <?= htmlspecialchars($school_display_name) ?>"
|
|
||||||
class="img-fluid mb-2"
|
|
||||||
style="max-height: 80px; width: auto; object-fit: contain; border-radius: 8px; border: 1px solid #e9ecef; box-shadow: 0 2px 6px rgba(0,0,0,0.08);">
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="bg-light d-inline-block p-3 mb-2 rounded-3" style="width: 60px; height: 60px;">
|
|
||||||
<i class="bx bx-building-house bx-md text-muted"></i>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="fw-bold text-truncate" style="font-size: 1rem; max-width: 180px; margin: 0 auto;">
|
<!-- Logo e nome salone corrente -->
|
||||||
<?= htmlspecialchars($school_display_name) ?>
|
<div class="salon-info">
|
||||||
</div>
|
<?php if (!empty($shop['logo'])): ?>
|
||||||
|
<img src="<?= htmlspecialchars($shop['logo']) ?>" alt="Logo Salone">
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="fw-bold">
|
||||||
|
<?= htmlspecialchars($shop_name ?? 'Il mio salone') ?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
</div>
|
||||||
//menù user
|
|
||||||
if ((Auth::user()->hasRole('User')) || (Auth::user()->hasRole('Admin'))) : ?>
|
<!-- Navigation -->
|
||||||
<li class="menu-label">Utente</li>
|
<ul class="metismenu" id="menu">
|
||||||
|
|
||||||
|
<!-- Cliente / Utente loggato -->
|
||||||
|
<?php if (Auth::user()->hasRole('User') || Auth::user()->hasRole('Admin')): ?>
|
||||||
|
<li class="menu-label">Cliente</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="user_dashboard.php">
|
<a href="user_dashboard.php">
|
||||||
<div class="parent-icon"><i class="bx bx-home"></i></div>
|
<div class="parent-icon"><i class="bx bx-home"></i></div>
|
||||||
<div class="menu-title">Dashboard Utente</div>
|
<div class="menu-title">Dashboard</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="my_lessons.php">
|
<a href="my_appointments.php">
|
||||||
|
<div class="parent-icon"><i class="bx bx-calendar-check"></i></div>
|
||||||
|
<div class="menu-title">I miei appuntamenti</div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="shop.php">
|
||||||
<div class="parent-icon"><i class="bx bx-store"></i></div>
|
<div class="parent-icon"><i class="bx bx-store"></i></div>
|
||||||
<div class="menu-title">Le mie prenotazioni</div>
|
<div class="menu-title">Prodotti & Servizi</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="my_certificates.php">
|
<a href="cart.php">
|
||||||
<div class="parent-icon"><i class="bx bx-store"></i></div>
|
|
||||||
<div class="menu-title">Certificati</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<?php if (!empty($schoolSettings['portal_purchases_enabled'])): ?>
|
|
||||||
<li>
|
|
||||||
<a href="shop-school.php">
|
|
||||||
<div class="parent-icon"><i class="bx bx-store"></i></div>
|
|
||||||
<div class="menu-title">Shop</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<?php endif; ?>
|
|
||||||
<li>
|
|
||||||
<a href="checkout.php">
|
|
||||||
<div class="parent-icon"><i class="bx bx-cart"></i></div>
|
<div class="parent-icon"><i class="bx bx-cart"></i></div>
|
||||||
<div class="menu-title">Carrello</div>
|
<div class="menu-title">Carrello</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="user-settings.php">
|
<a href="profile.php">
|
||||||
<div class="parent-icon"><i class="bx bx-cog"></i></div>
|
<div class="parent-icon"><i class="bx bx-user"></i></div>
|
||||||
<div class="menu-title">Impostazioni</div>
|
<div class="menu-title">Il mio profilo</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php
|
<!-- Titolare Salone -->
|
||||||
//menù school_owner
|
<?php if (Auth::user()->hasRole('Owner') || Auth::user()->hasRole('Admin')): ?>
|
||||||
if ((Auth::user()->hasRole('school_owner')) || (Auth::user()->hasRole('Admin'))) : ?>
|
<li class="menu-label">Titolare Salone</li>
|
||||||
<li class="menu-label">Proprietario Scuola</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href="school_dashboard.php">
|
<a href="salon_dashboard.php">
|
||||||
<div class="parent-icon"><i class="bx bx-chalkboard"></i></div>
|
<div class="parent-icon"><i class="bx bx-home-heart"></i></div>
|
||||||
<div class="menu-title">Dashboard Scuola</div>
|
<div class="menu-title">Dashboard Salone</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="future_sessions.php">
|
<a href="appointments.php">
|
||||||
<div class="parent-icon"><i class="bx bx-chalkboard"></i></div>
|
<div class="parent-icon"><i class="bx bx-calendar-check"></i></div>
|
||||||
<div class="menu-title">Calendario Lezioni</div>
|
<div class="menu-title">Appuntamenti</div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="customers.php">
|
||||||
|
<div class="parent-icon"><i class="bx bx-user"></i></div>
|
||||||
|
<div class="menu-title">Clienti</div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="staff.php">
|
||||||
|
<div class="parent-icon"><i class="bx bx-group"></i></div>
|
||||||
|
<div class="menu-title">Staff / Parrucchieri</div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="services.php">
|
||||||
|
<div class="parent-icon"><i class="bx bx-cut"></i></div>
|
||||||
|
<div class="menu-title">Servizi</div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="finances.php">
|
||||||
|
<div class="parent-icon"><i class="bx bx-dollar"></i></div>
|
||||||
|
<div class="menu-title">Incassi & Cassa</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@@ -139,77 +133,44 @@ if (!empty($_SESSION['school_id'])) {
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="school_settings.php">
|
<a href="day_off.php">
|
||||||
|
<div class="parent-icon"><i class="bx bx-calendar-x"></i></div>
|
||||||
|
<div class="menu-title">Giorni chiusi</div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="salon_settings.php">
|
||||||
<div class="parent-icon"><i class="bx bx-cog"></i></div>
|
<div class="parent-icon"><i class="bx bx-cog"></i></div>
|
||||||
<div class="menu-title">Impostazioni</div>
|
<div class="menu-title">Impostazioni Salone</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<li class="menu-label">Insegnanti</li>
|
|
||||||
<?php
|
|
||||||
//menù teacher
|
|
||||||
|
|
||||||
if ((Auth::user()->hasRole('school_owner')) || (Auth::user()->hasRole('Admin'))) : ?>
|
|
||||||
|
|
||||||
|
<!-- Admin only -->
|
||||||
|
<?php if (Auth::user()->hasRole('Admin')): ?>
|
||||||
|
<li class="menu-label">Amministrazione</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="teacher_list.php">
|
<a href="admin_users.php">
|
||||||
<div class="parent-icon"><i class="bx bx-chalkboard"></i></div>
|
<div class="parent-icon"><i class="bx bx-user-circle"></i></div>
|
||||||
<div class="menu-title">Profilo insegnanti</div>
|
<div class="menu-title">Gestione Utenti</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<!-- ... altre voci admin ... -->
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php
|
<!-- Voci generiche -->
|
||||||
if ((Auth::user()->hasRole('school_owner')) || (Auth::user()->hasRole('Admin')) || (Auth::user()->hasRole('teacher'))) : ?>
|
<li class="menu-label">Altro</li>
|
||||||
|
<li>
|
||||||
<li>
|
<a href="https://your-site.com/support" target="_blank">
|
||||||
<a href="teacher_page.php">
|
<div class="parent-icon"><i class="bx bx-support"></i></div>
|
||||||
<div class="parent-icon"><i class="bx bx-chalkboard"></i></div>
|
<div class="menu-title">Supporto</div>
|
||||||
<div class="menu-title">Il mio profilo</div>
|
</a>
|
||||||
</a>
|
</li>
|
||||||
</li>
|
<li>
|
||||||
|
<a href="logout.php">
|
||||||
<?php endif; ?>
|
<div class="parent-icon"><i class="bx bx-log-out"></i></div>
|
||||||
|
<div class="menu-title">Esci</div>
|
||||||
|
</a>
|
||||||
<?php
|
</li>
|
||||||
//menù admin only
|
|
||||||
if ((Auth::user()->hasRole('Admin'))) : ?>
|
|
||||||
<li class="menu-label">Subscription Area</li>
|
|
||||||
<li>
|
|
||||||
<a href="admin_subscriptions.php" target="">
|
|
||||||
<div class="parent-icon"><i class="bx bx-layout"></i></div>
|
|
||||||
<div class="menu-title">Subscription</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="admin_subscription_plans.php" target="">
|
|
||||||
<div class="parent-icon"><i class="bx bx-layout"></i></div>
|
|
||||||
<div class="menu-title">Subscription Plan</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li class="menu-label">Others</li>
|
|
||||||
<li>
|
|
||||||
<a href="template/index.html" target="_blank">
|
|
||||||
<div class="parent-icon"><i class="bx bx-layout"></i></div>
|
|
||||||
<div class="menu-title">Template</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="https://codervent.com/rocker/documentation/index.html" target="_blank">
|
|
||||||
<div class="parent-icon"><i class="bx bx-book"></i></div>
|
|
||||||
<div class="menu-title">Documentation</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="https://themeforest.net/user/codervent" target="_blank">
|
|
||||||
<div class="parent-icon"><i class="bx bx-support"></i></div>
|
|
||||||
<div class="menu-title">Support</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<?php endif; ?>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--end navigation-->
|
|
||||||
</div>
|
</div>
|
||||||
@@ -0,0 +1,200 @@
|
|||||||
|
<?php
|
||||||
|
include('include/headscript.php');
|
||||||
|
|
||||||
|
$dbHandler = DBHandlerSelect::getInstance();
|
||||||
|
$pdo = $dbHandler->getConnection();
|
||||||
|
|
||||||
|
if (!isset($iduserlogin)) {
|
||||||
|
header("Location: login.php"); // o la tua pagina di login
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Se ha già un salone → torna alla dashboard
|
||||||
|
$stmt = $pdo->prepare("SELECT id FROM shops WHERE owner_id = ? LIMIT 1");
|
||||||
|
$stmt->execute([$iduserlogin]);
|
||||||
|
if ($stmt->fetch()) {
|
||||||
|
header("Location: salon_dashboard.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$errors = [];
|
||||||
|
$success = false;
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$name = trim($_POST['name'] ?? '');
|
||||||
|
$address = trim($_POST['address'] ?? '');
|
||||||
|
$city = trim($_POST['city'] ?? '');
|
||||||
|
$province = strtoupper(trim($_POST['province'] ?? ''));
|
||||||
|
$zip_code = trim($_POST['zip_code'] ?? '');
|
||||||
|
$phone = trim($_POST['phone'] ?? '');
|
||||||
|
$email = trim($_POST['email'] ?? '');
|
||||||
|
|
||||||
|
// Validazioni minime
|
||||||
|
if (empty($name)) $errors[] = "Il nome del salone è obbligatorio";
|
||||||
|
if (empty($city)) $errors[] = "La città è obbligatoria";
|
||||||
|
if (empty($phone) && empty($email)) {
|
||||||
|
$errors[] = "Inserisci almeno telefono oppure email";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
// Slug generico ma unico abbastanza
|
||||||
|
$slug_base = strtolower(preg_replace('/[^a-z0-9]+/', '-', $name));
|
||||||
|
$slug = $slug_base . '-' . substr(md5(time()), 0, 6);
|
||||||
|
|
||||||
|
$stmt = $pdo->prepare("
|
||||||
|
INSERT INTO shops (
|
||||||
|
owner_id, name, slug, address, city, province, zip_code,
|
||||||
|
phone, email, active, created_at, updated_at
|
||||||
|
) VALUES (
|
||||||
|
?, ?, ?, ?, ?, ?, ?, ?, ?, 1, NOW(), NOW()
|
||||||
|
)
|
||||||
|
");
|
||||||
|
|
||||||
|
$ok = $stmt->execute([
|
||||||
|
$iduserlogin,
|
||||||
|
$name,
|
||||||
|
$slug,
|
||||||
|
$address,
|
||||||
|
$city,
|
||||||
|
$province,
|
||||||
|
$zip_code,
|
||||||
|
$phone,
|
||||||
|
$email
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($ok) {
|
||||||
|
$success = true;
|
||||||
|
// Opzionale: crea orari di default
|
||||||
|
$new_shop_id = $pdo->lastInsertId();
|
||||||
|
|
||||||
|
// Esempio orari base (lun-ven 9-19, sab 9-13, dom chiuso)
|
||||||
|
$default_hours = [
|
||||||
|
['day_of_week' => 1, 'is_open' => 1, 'open_time' => '09:00:00', 'close_time' => '19:00:00'],
|
||||||
|
['day_of_week' => 2, 'is_open' => 1, 'open_time' => '09:00:00', 'close_time' => '19:00:00'],
|
||||||
|
['day_of_week' => 3, 'is_open' => 1, 'open_time' => '09:00:00', 'close_time' => '19:00:00'],
|
||||||
|
['day_of_week' => 4, 'is_open' => 1, 'open_time' => '09:00:00', 'close_time' => '19:00:00'],
|
||||||
|
['day_of_week' => 5, 'is_open' => 1, 'open_time' => '09:00:00', 'close_time' => '19:00:00'],
|
||||||
|
['day_of_week' => 6, 'is_open' => 1, 'open_time' => '09:00:00', 'close_time' => '13:00:00'],
|
||||||
|
['day_of_week' => 0, 'is_open' => 0],
|
||||||
|
];
|
||||||
|
|
||||||
|
$stmt_hour = $pdo->prepare("
|
||||||
|
INSERT INTO shop_hours (shop_id, day_of_week, is_open, open_time, close_time)
|
||||||
|
VALUES (?, ?, ?, ?, ?)
|
||||||
|
");
|
||||||
|
foreach ($default_hours as $h) {
|
||||||
|
$stmt_hour->execute([
|
||||||
|
$new_shop_id,
|
||||||
|
$h['day_of_week'],
|
||||||
|
$h['is_open'],
|
||||||
|
$h['open_time'] ?? null,
|
||||||
|
$h['close_time'] ?? null
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reindirizza dopo 2 secondi
|
||||||
|
header("Refresh: 2; url=salon_dashboard.php");
|
||||||
|
} else {
|
||||||
|
$errors[] = "Errore durante la creazione del salone. Riprova.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="it">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<?php include('cssinclude.php'); ?>
|
||||||
|
<title>Benvenuto - Crea il tuo Salone</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="bg-light d-flex align-items-center min-vh-100">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-lg-6 col-xl-5">
|
||||||
|
<div class="card shadow border-0">
|
||||||
|
<div class="card-header bg-primary text-white text-center py-4">
|
||||||
|
<h3 class="mb-1">Benvenuto nel tuo gestionale!</h3>
|
||||||
|
<p class="mb-0">Crea il tuo salone per iniziare</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body p-4 p-md-5">
|
||||||
|
<?php if ($success): ?>
|
||||||
|
<div class="alert alert-success text-center py-4">
|
||||||
|
<i class="bx bx-check-circle bx-lg mb-3 d-block"></i>
|
||||||
|
<h4>Salone creato con successo!</h4>
|
||||||
|
<p>Stai per essere reindirizzato alla dashboard...</p>
|
||||||
|
<div class="spinner-border text-primary mt-3" role="status"></div>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php if ($errors): ?>
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<?php foreach ($errors as $err): ?>
|
||||||
|
<div>× <?= htmlspecialchars($err) ?></div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<form method="POST" class="needs-validation" novalidate>
|
||||||
|
<div class="mb-4">
|
||||||
|
<label class="form-label fw-bold">Nome salone <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" name="name" class="form-control form-control-lg" required
|
||||||
|
value="<?= htmlspecialchars($_POST['name'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<label class="form-label fw-bold">Città <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" name="city" class="form-control form-control-lg" required
|
||||||
|
value="<?= htmlspecialchars($_POST['city'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label">Indirizzo</label>
|
||||||
|
<input type="text" name="address" class="form-control"
|
||||||
|
value="<?= htmlspecialchars($_POST['address'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label">CAP</label>
|
||||||
|
<input type="text" name="zip_code" class="form-control"
|
||||||
|
value="<?= htmlspecialchars($_POST['zip_code'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row g-3 mt-3">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label">Provincia</label>
|
||||||
|
<input type="text" name="province" class="form-control text-uppercase" maxlength="2"
|
||||||
|
placeholder="MI" value="<?= htmlspecialchars($_POST['province'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<label class="form-label">Telefono o Email <span class="text-danger">*</span></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="tel" name="phone" class="form-control" placeholder="Telefono"
|
||||||
|
value="<?= htmlspecialchars($_POST['phone'] ?? '') ?>">
|
||||||
|
<input type="email" name="email" class="form-control" placeholder="Email"
|
||||||
|
value="<?= htmlspecialchars($_POST['email'] ?? '') ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-grid mt-5">
|
||||||
|
<button type="submit" class="btn btn-primary btn-lg">
|
||||||
|
Crea il mio salone
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php include('jsinclude.php'); ?>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,336 @@
|
|||||||
|
<?php
|
||||||
|
// Forza la visualizzazione degli errori (solo in dev!)
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
include('include/headscript.php');
|
||||||
|
|
||||||
|
// Connessione DB
|
||||||
|
$dbHandler = DBHandlerSelect::getInstance();
|
||||||
|
$pdo = $dbHandler->getConnection();
|
||||||
|
|
||||||
|
// Verifica utente loggato
|
||||||
|
if (!isset($iduserlogin)) {
|
||||||
|
die("Errore: ID utente non definito.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// =========================================================================
|
||||||
|
// Controllo se l'utente ha almeno un salone
|
||||||
|
// =========================================================================
|
||||||
|
$stmt = $pdo->prepare("SELECT COUNT(*) FROM shops WHERE owner_id = ?");
|
||||||
|
$stmt->execute([$iduserlogin]);
|
||||||
|
$hasShop = $stmt->fetchColumn() > 0;
|
||||||
|
|
||||||
|
if (!$hasShop) {
|
||||||
|
// Nessun salone → vai alla creazione
|
||||||
|
header("Location: onboarding_salon.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// =========================================================================
|
||||||
|
// Carichiamo il salone (prendiamo il primo creato o quello più recente)
|
||||||
|
// =========================================================================
|
||||||
|
$stmt = $pdo->prepare("
|
||||||
|
SELECT
|
||||||
|
id, name, slug, address, city, province, zip_code,
|
||||||
|
phone, email, instagram, logo, description, active
|
||||||
|
FROM shops
|
||||||
|
WHERE owner_id = ?
|
||||||
|
ORDER BY created_at ASC
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
$stmt->execute([$iduserlogin]);
|
||||||
|
$shop = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if (!$shop) {
|
||||||
|
// Dovrebbe essere impossibile, ma per sicurezza
|
||||||
|
die("Errore: salone non trovato nonostante il conteggio dicesse di sì.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$shop_id = $shop['id'];
|
||||||
|
$shop_name = $shop['name'];
|
||||||
|
|
||||||
|
// Servizi attivi
|
||||||
|
$stmt = $pdo->prepare("
|
||||||
|
SELECT id, name, duration_minutes, price, category, color_hex
|
||||||
|
FROM services
|
||||||
|
WHERE shop_id = ? AND is_active = 1
|
||||||
|
ORDER BY category, `order`, name
|
||||||
|
");
|
||||||
|
$stmt->execute([$shop_id]);
|
||||||
|
$services = $stmt->fetchAll();
|
||||||
|
|
||||||
|
// Staff attivo e visibile online
|
||||||
|
$stmt = $pdo->prepare("
|
||||||
|
SELECT s.id, s.first_name, s.last_name, s.nickname, s.color_hex,
|
||||||
|
u.avatar
|
||||||
|
FROM staff s
|
||||||
|
LEFT JOIN auth_users u ON s.user_id = u.id
|
||||||
|
WHERE s.shop_id = ? AND s.is_active = 1 AND s.can_book_online = 1
|
||||||
|
ORDER BY s.first_name, s.last_name
|
||||||
|
");
|
||||||
|
$stmt->execute([$shop_id]);
|
||||||
|
$staff_members = $stmt->fetchAll();
|
||||||
|
|
||||||
|
// Intervallo appuntamenti (default: oggi)
|
||||||
|
$start_date = $_GET['start_date'] ?? date('Y-m-d');
|
||||||
|
$end_date = $_GET['end_date'] ?? $start_date;
|
||||||
|
|
||||||
|
// Appuntamenti
|
||||||
|
$stmt = $pdo->prepare("
|
||||||
|
SELECT
|
||||||
|
a.id,
|
||||||
|
a.start_at,
|
||||||
|
a.end_at,
|
||||||
|
a.status,
|
||||||
|
a.notes,
|
||||||
|
a.price_paid,
|
||||||
|
c.first_name AS customer_first,
|
||||||
|
c.last_name AS customer_last,
|
||||||
|
c.phone AS customer_phone,
|
||||||
|
s.name AS service_name,
|
||||||
|
s.color_hex AS service_color,
|
||||||
|
st.first_name AS staff_first,
|
||||||
|
st.last_name AS staff_last,
|
||||||
|
st.color_hex AS staff_color
|
||||||
|
FROM appointments a
|
||||||
|
LEFT JOIN customers c ON a.customer_id = c.id
|
||||||
|
LEFT JOIN services s ON a.service_id = s.id
|
||||||
|
LEFT JOIN staff st ON a.staff_id = st.id
|
||||||
|
WHERE a.shop_id = ?
|
||||||
|
AND DATE(a.start_at) BETWEEN ? AND ?
|
||||||
|
ORDER BY a.start_at
|
||||||
|
");
|
||||||
|
$stmt->execute([$shop_id, $start_date, $end_date]);
|
||||||
|
$appointments = $stmt->fetchAll();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!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'); ?>
|
||||||
|
<?php include('siteinfo.php'); ?>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.15/main.min.css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="wrapper">
|
||||||
|
<?php include('include/navbar.php'); ?>
|
||||||
|
<?php include('include/topbar.php'); ?>
|
||||||
|
|
||||||
|
<div class="page-wrapper">
|
||||||
|
<div class="page-content">
|
||||||
|
|
||||||
|
<!-- Info Salone -->
|
||||||
|
<div class="card radius-10 mb-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="d-flex align-items-center flex-wrap gap-4">
|
||||||
|
<div>
|
||||||
|
<img src="<?= htmlspecialchars($shop['logo'] ?: 'assets/images/default-salon.png') ?>"
|
||||||
|
alt="Logo" class="rounded-circle" style="width:100px;height:100px;object-fit:cover;">
|
||||||
|
</div>
|
||||||
|
<div class="flex-grow-1">
|
||||||
|
<h5 class="mb-1"><?= htmlspecialchars($shop_name) ?></h5>
|
||||||
|
<p class="mb-1">
|
||||||
|
<strong>Indirizzo:</strong>
|
||||||
|
<?= htmlspecialchars(implode(', ', array_filter([
|
||||||
|
$shop['address'],
|
||||||
|
$shop['city'],
|
||||||
|
$shop['zip_code'],
|
||||||
|
$shop['province']
|
||||||
|
]))) ?: '—' ?>
|
||||||
|
</p>
|
||||||
|
<p class="mb-1"><strong>Telefono:</strong> <?= htmlspecialchars($shop['phone'] ?: '—') ?></p>
|
||||||
|
<?php if ($shop['instagram']): ?>
|
||||||
|
<p><strong>IG:</strong> @<?= htmlspecialchars($shop['instagram']) ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex gap-2 flex-wrap">
|
||||||
|
<a href="salon_profile.php" class="btn btn-warning">Modifica Salone</a>
|
||||||
|
<a href="day_off.php" class="btn btn-danger">Giorni Chiusi</a>
|
||||||
|
<a href="services.php" class="btn btn-primary">Servizi</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Pulsanti rapidi -->
|
||||||
|
<div class="row mb-4">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="d-flex flex-wrap justify-content-center gap-3">
|
||||||
|
<a href="customers.php" class="btn btn-primary px-4 py-3"><i class="bx bx-user me-2"></i> Clienti</a>
|
||||||
|
<a href="appointments.php" class="btn btn-success px-4 py-3"><i class="bx bx-calendar-check me-2"></i> Appuntamenti</a>
|
||||||
|
<a href="staff.php" class="btn btn-info px-4 py-3"><i class="bx bx-group me-2"></i> Staff</a>
|
||||||
|
<a href="finances.php" class="btn btn-warning px-4 py-3"><i class="bx bx-euro me-2"></i> Incassi</a>
|
||||||
|
<a href="new_appointment.php" class="btn btn-dark px-4 py-3"><i class="bx bx-plus-medical me-2"></i> Nuovo Appuntamento</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Tabella Appuntamenti -->
|
||||||
|
<div class="card radius-10">
|
||||||
|
<div class="card-header bg-light d-flex justify-content-between align-items-center flex-wrap gap-3">
|
||||||
|
<h6 class="mb-0">
|
||||||
|
Appuntamenti <?= ($start_date == $end_date) ? date('d/m/Y', strtotime($start_date)) : "dal " . date('d/m', strtotime($start_date)) . " al " . date('d/m/Y', strtotime($end_date)) ?>
|
||||||
|
</h6>
|
||||||
|
<div class="d-flex gap-2 align-items-center flex-wrap">
|
||||||
|
<form action="" method="GET" class="d-flex gap-2 align-items-center">
|
||||||
|
<input type="date" name="start_date" class="form-control form-control-sm" value="<?= $start_date ?>">
|
||||||
|
<span>–</span>
|
||||||
|
<input type="date" name="end_date" class="form-control form-control-sm" value="<?= $end_date ?>">
|
||||||
|
<button type="submit" class="btn btn-primary btn-sm">Filtra</button>
|
||||||
|
</form>
|
||||||
|
<a href="?start_date=<?= date('Y-m-d') ?>&end_date=<?= date('Y-m-d') ?>" class="btn btn-outline-secondary btn-sm">Oggi</a>
|
||||||
|
<button class="btn btn-success btn-sm" data-bs-toggle="modal" data-bs-target="#calendarModal">
|
||||||
|
<i class="bx bx-calendar"></i> Calendario
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table id="appTable" class="table table-striped table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Orario</th>
|
||||||
|
<th>Cliente</th>
|
||||||
|
<th>Servizio</th>
|
||||||
|
<th>Stylist</th>
|
||||||
|
<th>Stato</th>
|
||||||
|
<th>Note</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php if (empty($appointments)): ?>
|
||||||
|
<tr>
|
||||||
|
<td colspan="7" class="text-center py-4 text-muted">Nessun appuntamento trovato</td>
|
||||||
|
</tr>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($appointments as $a): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= date('H:i', strtotime($a['start_at'])) ?> – <?= date('H:i', strtotime($a['end_at'])) ?></td>
|
||||||
|
<td>
|
||||||
|
<strong><?= htmlspecialchars($a['customer_first'] . ' ' . $a['customer_last']) ?></strong><br>
|
||||||
|
<small><?= htmlspecialchars($a['customer_phone'] ?: '—') ?></small>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span class="badge" style="background:<?= htmlspecialchars($a['service_color'] ?: '#6c757d') ?>">
|
||||||
|
<?= htmlspecialchars($a['service_name']) ?>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td><?= htmlspecialchars($a['staff_first'] . ' ' . $a['staff_last']) ?></td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
$status_map = [
|
||||||
|
'pending' => ['bg-warning', 'In attesa'],
|
||||||
|
'confirmed' => ['bg-info', 'Confermato'],
|
||||||
|
'completed' => ['bg-success', 'Fatto'],
|
||||||
|
'cancelled' => ['bg-danger', 'Annullato'],
|
||||||
|
'no_show' => ['bg-secondary', 'No-show']
|
||||||
|
];
|
||||||
|
$st = $a['status'] ?? 'pending';
|
||||||
|
echo '<span class="badge ' . ($status_map[$st][0] ?? 'bg-secondary') . '">' . ($status_map[$st][1] ?? ucfirst($st)) . '</span>';
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td><?= htmlspecialchars(substr($a['notes'] ?? '', 0, 50)) . (strlen($a['notes'] ?? '') > 50 ? '...' : '') ?></td>
|
||||||
|
<td>
|
||||||
|
<a href="appointment_edit.php?id=<?= $a['id'] ?>" class="btn btn-sm btn-warning"><i class="bx bx-edit"></i></a>
|
||||||
|
<!-- Aggiungi form delete se vuoi -->
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal Calendario -->
|
||||||
|
<div class="modal fade" id="calendarModal" tabindex="-1">
|
||||||
|
<div class="modal-dialog modal-xl modal-dialog-scrollable" style="max-width:95vw;">
|
||||||
|
<div class="modal-content" style="height:90vh;">
|
||||||
|
<div class="modal-header bg-primary text-white">
|
||||||
|
<h5 class="modal-title">Calendario Appuntamenti</h5>
|
||||||
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body p-0">
|
||||||
|
<div id="calendar" style="height:100%;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php include('include/footer.php'); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php include('jsinclude.php'); ?>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.15/main.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.15/locales/it.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#appTable').DataTable({
|
||||||
|
language: {
|
||||||
|
url: '//cdn.datatables.net/plug-ins/1.13.6/i18n/it-IT.json'
|
||||||
|
},
|
||||||
|
order: [
|
||||||
|
[0, 'asc']
|
||||||
|
]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
var calendarEl = document.getElementById('calendar');
|
||||||
|
var modal = document.getElementById('calendarModal');
|
||||||
|
var cal;
|
||||||
|
|
||||||
|
function initCal() {
|
||||||
|
if (cal) cal.destroy();
|
||||||
|
cal = new FullCalendar.Calendar(calendarEl, {
|
||||||
|
locale: 'it',
|
||||||
|
initialView: 'timeGridWeek',
|
||||||
|
headerToolbar: {
|
||||||
|
left: 'prev,next today',
|
||||||
|
center: 'title',
|
||||||
|
right: 'dayGridMonth,timeGridWeek'
|
||||||
|
},
|
||||||
|
height: '100%',
|
||||||
|
slotMinTime: '08:00:00',
|
||||||
|
slotMaxTime: '21:00:00',
|
||||||
|
events: <?= json_encode(array_map(function ($a) {
|
||||||
|
$title = $a['service_name'] . ' • ' . $a['customer_first'] . ' ' . substr($a['customer_last'], 0, 1) . '.';
|
||||||
|
$color = $a['service_color'] ?: '#3788d8';
|
||||||
|
return [
|
||||||
|
'title' => $title,
|
||||||
|
'start' => $a['start_at'],
|
||||||
|
'end' => $a['end_at'],
|
||||||
|
'color' => $color,
|
||||||
|
'id' => $a['id']
|
||||||
|
];
|
||||||
|
}, $appointments)) ?>,
|
||||||
|
eventClick: function(info) {
|
||||||
|
window.location = 'appointment_edit.php?id=' + info.event.id;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
cal.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
modal.addEventListener('shown.bs.modal', function() {
|
||||||
|
initCal();
|
||||||
|
setTimeout(() => cal.updateSize(), 200);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user