push notification setting and update pages with PDO
This commit is contained in:
+421
-474
@@ -1,521 +1,468 @@
|
||||
<?php require_once('include/headscript.php'); ?>
|
||||
<?php if (isset($_POST['classinsert'])) { $formclass='Y'; } else { $formclass='N'; }
|
||||
if (isset($_GET['message'])) { $message=$_GET['message']; } else { $message='N'; }
|
||||
?>
|
||||
<?php
|
||||
if ($formclass=='Y') {
|
||||
$InsertQuery = new WA_MySQLi_Query($bkngstm);
|
||||
$InsertQuery->Action = "insert";
|
||||
$InsertQuery->Table = "service";
|
||||
$InsertQuery->bindColumn("servicename", "s", "".((isset($_POST["servicename"]))?$_POST["servicename"]:"") ."", "WA_DEFAULT");
|
||||
$InsertQuery->bindColumn("wpcatalognumber", "i", "".((isset($_POST["wpcatalognumber"]))?$_POST["wpcatalognumber"]:"") ."", "WA_DEFAULT");
|
||||
$InsertQuery->bindColumn("day", "s", "".((isset($_POST["classdayday"]))?$_POST["classdayday"]:"") ."", "WA_DEFAULT");
|
||||
$InsertQuery->bindColumn("time", "s", "".((isset($_POST["classtime"]))?$_POST["classtime"]:"") ."", "WA_DEFAULT");
|
||||
$InsertQuery->bindColumn("category", "i", "".((isset($_POST["servicecategory"]))?$_POST["servicecategory"]:"") ."", "WA_DEFAULT");
|
||||
$InsertQuery->bindColumn("maxcapacity", "i", "".((isset($_POST["maxcapacity"]))?$_POST["maxcapacity"]:"") ."", "WA_DEFAULT");
|
||||
$InsertQuery->bindColumn("colorclass", "s", "".((isset($_POST["colorclass"]))?$_POST["colorclass"]:"") ."", "WA_DEFAULT");
|
||||
$InsertQuery->bindColumn("classduration", "d", "".((isset($_POST["classduration"]))?$_POST["classduration"]:"") ."", "WA_DEFAULT");
|
||||
$InsertQuery->saveInSession("");
|
||||
$InsertQuery->execute();
|
||||
$InsertGoTo = "";
|
||||
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo?rel2abs($InsertGoTo,dirname(__FILE__)):"";
|
||||
$InsertQuery->redirect($InsertGoTo);
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
$servicesclass = new WA_MySQLi_RS("servicesclass",$bkngstm,0);
|
||||
$servicesclass->setQuery("SELECT * FROM service LEFT JOIN servicecategory on service.category=servicecategory.idservicecategory");
|
||||
$servicesclass->execute();
|
||||
?>
|
||||
<?php
|
||||
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
require_once('include/headscript.php');
|
||||
|
||||
// Controlla la connessione
|
||||
if ($conn->connect_error) {
|
||||
die("Connessione fallita: " . $conn->connect_error);
|
||||
/**
|
||||
* Connessione unica PDO (singleton).
|
||||
*/
|
||||
$pdo = DBHandlerSelect::getInstance()->getConnection();
|
||||
|
||||
function e($value): string
|
||||
{
|
||||
return htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
// Query per ottenere le categorie dal database
|
||||
$query = "SELECT idservicecategory, namecategory FROM servicecategory";
|
||||
$result = $conn->query($query);
|
||||
$message = $_GET['message'] ?? 'N';
|
||||
$insertFeedback = null;
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Inserimento nuova classe (POST) con prepared statement
|
||||
* ---------------------------------------------------------------------- */
|
||||
if (isset($_POST['classinsert']) && $_POST['classinsert'] === 'Y') {
|
||||
$servicename = trim($_POST['servicename'] ?? '');
|
||||
$wpcatalog = $_POST['wpcatalognumber'] ?? '';
|
||||
$day = trim($_POST['classdayday'] ?? '');
|
||||
$time = trim($_POST['classtime'] ?? '');
|
||||
$category = $_POST['servicecategory'] ?? '';
|
||||
$maxcapacity = $_POST['maxcapacity'] ?? '';
|
||||
$colorclass = trim($_POST['colorclass'] ?? '');
|
||||
$classduration = $_POST['classduration'] ?? '';
|
||||
|
||||
if ($servicename === '') {
|
||||
$insertFeedback = ['type' => 'error', 'text' => 'La descrizione della classe è obbligatoria.'];
|
||||
} else {
|
||||
$sql = "INSERT INTO service
|
||||
(servicename, wpcatalognumber, day, time, category, maxcapacity, colorclass, classduration)
|
||||
VALUES
|
||||
(:servicename, :wpcatalog, :day, :time, :category, :maxcapacity, :colorclass, :classduration)";
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$ok = $stmt->execute([
|
||||
':servicename' => $servicename,
|
||||
':wpcatalog' => $wpcatalog !== '' ? (int) $wpcatalog : null,
|
||||
':day' => $day,
|
||||
':time' => $time,
|
||||
':category' => $category !== '' ? (int) $category : null,
|
||||
':maxcapacity' => $maxcapacity !== '' ? (int) $maxcapacity : null,
|
||||
':colorclass' => $colorclass,
|
||||
':classduration' => $classduration !== '' ? (float) $classduration : null,
|
||||
]);
|
||||
|
||||
if ($ok) {
|
||||
// Redirect per evitare re-invio del form al refresh (pattern PRG)
|
||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?message=inserted');
|
||||
exit;
|
||||
}
|
||||
$insertFeedback = ['type' => 'error', 'text' => 'Errore durante l\'inserimento della classe. Riprova.'];
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Categorie per il dropdown
|
||||
* ---------------------------------------------------------------------- */
|
||||
$categories = $pdo->query("SELECT idservicecategory, namecategory FROM servicecategory ORDER BY namecategory")->fetchAll();
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Elenco classi esistenti
|
||||
* ---------------------------------------------------------------------- */
|
||||
$services = $pdo->query(
|
||||
"SELECT service.*, servicecategory.namecategory
|
||||
FROM service
|
||||
LEFT JOIN servicecategory ON service.category = servicecategory.idservicecategory
|
||||
ORDER BY service.servicename"
|
||||
)->fetchAll();
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<html lang="it">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>YogiBook - Prenotazioni YogaSoul</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="YogiBook - Prenotazione facile YogaSOul" name="description" />
|
||||
<meta content="Advanced Creative Solutions" name="author" />
|
||||
<!-- App favicon -->
|
||||
<title>YogiBook - Inserimento e Propagazione Classi</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="YogiBook - Prenotazione facile YogaSoul" name="description" />
|
||||
<meta content="Advanced Creative Solutions" name="author" />
|
||||
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
||||
|
||||
<!-- Bootstrap Css -->
|
||||
<link href="assets/css/bootstrap.min.css" id="bootstrap-style" rel="stylesheet" type="text/css" />
|
||||
<!-- Icons Css -->
|
||||
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
||||
<!-- App Css-->
|
||||
<link href="assets/css/app.min.css" id="app-style" rel="stylesheet" type="text/css" />
|
||||
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.1/spectrum.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
||||
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.1/spectrum.min.css">
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.1/spectrum.min.js"></script>
|
||||
|
||||
|
||||
<!-- Includi le librerie jQuery e jQuery UI prima di includere lo script per il calendario -->
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.1/spectrum.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Initialize datepickers
|
||||
$(".datepicker").datepicker();
|
||||
|
||||
$(".calendar-form").on("submit", function() {
|
||||
// Allow the form to be submitted
|
||||
return true;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.calendar-input {
|
||||
width: 30%;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.expanded-row {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.expanded {
|
||||
display: table-row;
|
||||
transition: display 0.3s ease;
|
||||
}
|
||||
</style>
|
||||
.admin-card {
|
||||
border: none;
|
||||
border-radius: 14px;
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
|
||||
.admin-card .card-body {
|
||||
padding: 26px 30px;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
color: #6b7280;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.section-lead {
|
||||
color: #9ca3af;
|
||||
font-size: 14px;
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
|
||||
.form-label {
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
color: #374151;
|
||||
}
|
||||
|
||||
.form-control,
|
||||
.form-select {
|
||||
border-radius: 8px;
|
||||
border: 1px solid #e2e4e9;
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
.form-control:focus,
|
||||
.form-select:focus {
|
||||
border-color: #1ebf73;
|
||||
box-shadow: 0 0 0 3px rgba(30, 191, 115, 0.12);
|
||||
}
|
||||
|
||||
.btn-save {
|
||||
border-radius: 8px;
|
||||
padding: 10px 26px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.class-table thead th {
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.03em;
|
||||
color: #6b7280;
|
||||
border-bottom: 2px solid #eef0f3;
|
||||
}
|
||||
|
||||
.class-table td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.color-dot {
|
||||
display: inline-block;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
vertical-align: middle;
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
.expanded-row {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.expanded-row.expanded {
|
||||
display: table-row;
|
||||
}
|
||||
|
||||
.expanded-content {
|
||||
background: #f8fbf9;
|
||||
border-radius: 10px;
|
||||
padding: 18px 20px;
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
.action-btns .btn {
|
||||
margin: 2px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
|
||||
<!-- <body data-layout="horizontal"> -->
|
||||
|
||||
<!-- Begin page -->
|
||||
<div id="layout-wrapper">
|
||||
|
||||
<!-- Top Bar -->
|
||||
<header id="page-topbar" class="isvertical-topbar">
|
||||
<div class="navbar-header">
|
||||
<div class="d-flex">
|
||||
<!-- LOGO -->
|
||||
<?php include('include/logoarea.php'); ?>
|
||||
|
||||
<button type="button" class="btn btn-sm px-3 font-size-24 header-item waves-effect vertical-menu-btn">
|
||||
<i class="bx bx-menu align-middle"></i>
|
||||
</button>
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="page-title-box align-self-center d-none d-md-block">
|
||||
<h4 class="page-title mb-0">Inserimento e Propagazione Classi</h4>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<body>
|
||||
<div id="layout-wrapper">
|
||||
<header id="page-topbar" class="isvertical-topbar">
|
||||
<div class="navbar-header">
|
||||
<div class="d-flex">
|
||||
<?php include('include/logoarea.php'); ?>
|
||||
<button type="button" class="btn btn-sm px-3 font-size-24 header-item waves-effect vertical-menu-btn">
|
||||
<i class="bx bx-menu align-middle"></i>
|
||||
</button>
|
||||
<div class="page-title-box align-self-center d-none d-md-block">
|
||||
<h4 class="page-title mb-0">Inserimento e Propagazione Classi</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<?php include('include/languageselection.php'); ?>
|
||||
<?php include('include/profiletopbar.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<?php include('include/sidebar.php'); ?>
|
||||
<header class="ishorizontal-topbar">
|
||||
<div class="navbar-header">
|
||||
<div class="d-flex"></div>
|
||||
</div>
|
||||
<div class="topnav">
|
||||
<div class="container-fluid">
|
||||
<nav class="navbar navbar-light navbar-expand-lg topnav-menu"></nav>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="d-flex">
|
||||
|
||||
<?php include('include/languageselection.php'); ?>
|
||||
<div class="main-content">
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="dropdown d-inline-block">
|
||||
<button type="button" class="btn header-item noti-icon"
|
||||
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="bx bx-search icon-sm align-middle"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-end p-0">
|
||||
<form class="p-2">
|
||||
<div class="search-box">
|
||||
<div class="position-relative">
|
||||
<input type="text" class="form-control rounded bg-light border-0" placeholder="Search...">
|
||||
<i class="bx bx-search search-icon"></i>
|
||||
<?php if ($message === 'inserted') : ?>
|
||||
<div class="alert alert-success" role="alert">Classe inserita con successo.</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($message === 'success') : ?>
|
||||
<div class="alert alert-success" role="alert">Propagazione avvenuta con successo.</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($insertFeedback) : ?>
|
||||
<div class="alert alert-<?php echo $insertFeedback['type'] === 'success' ? 'success' : 'danger'; ?>" role="alert">
|
||||
<?php echo e($insertFeedback['text']); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Form inserimento classe -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card admin-card mb-4">
|
||||
<div class="card-body">
|
||||
<div class="section-title">Nuova classe</div>
|
||||
<p class="section-lead">Inserisci i dettagli della classe da aggiungere al catalogo.</p>
|
||||
|
||||
<form method="post" name="insertclass" id="insertclass">
|
||||
<input type="hidden" name="classinsert" value="Y">
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="servicename" class="form-label">Descrizione classe</label>
|
||||
<input type="text" class="form-control" placeholder="Es. Hatha Yoga" id="servicename" name="servicename" required>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="mb-3">
|
||||
<label for="wpcatalognumber" class="form-label">WP catalog number</label>
|
||||
<input type="text" class="form-control" placeholder="WP Number" id="wpcatalognumber" name="wpcatalognumber">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="mb-3">
|
||||
<label for="classdayday" class="form-label">Giorno</label>
|
||||
<select class="form-select" id="classdayday" name="classdayday">
|
||||
<option value="">Seleziona</option>
|
||||
<option value="Monday">Lunedì</option>
|
||||
<option value="Tuesday">Martedì</option>
|
||||
<option value="Wednesday">Mercoledì</option>
|
||||
<option value="Thursday">Giovedì</option>
|
||||
<option value="Friday">Venerdì</option>
|
||||
<option value="Saturday">Sabato</option>
|
||||
<option value="Sunday">Domenica</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-4">
|
||||
<div class="mb-3">
|
||||
<label for="classtime" class="form-label">Ora</label>
|
||||
<input type="text" class="form-control" placeholder="Es. 18:30" id="classtime" name="classtime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="mb-3">
|
||||
<label for="classduration" class="form-label">Durata (ore)</label>
|
||||
<input type="text" class="form-control" placeholder="Es. 1.5" id="classduration" name="classduration">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="mb-3">
|
||||
<label for="servicecategory" class="form-label">Categoria</label>
|
||||
<select name="servicecategory" id="servicecategory" class="form-select">
|
||||
<option value="">Seleziona</option>
|
||||
<?php foreach ($categories as $cat) : ?>
|
||||
<option value="<?php echo e($cat['idservicecategory']); ?>">
|
||||
<?php echo e($cat['namecategory']); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-4">
|
||||
<div class="mb-3">
|
||||
<label for="maxcapacity" class="form-label">Capacità massima</label>
|
||||
<input type="text" class="form-control" placeholder="Es. 12" id="maxcapacity" name="maxcapacity">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="mb-3">
|
||||
<label for="colorclass" class="form-label">Colore classe</label>
|
||||
<input type="text" class="form-control" id="colorclass" name="colorclass" value="#1ebf73">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary btn-save">Inserisci classe</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php include('include/profiletopbar.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<?php include('include/sidebar.php'); ?>
|
||||
|
||||
<header class="ishorizontal-topbar">
|
||||
<div class="navbar-header">
|
||||
<div class="d-flex">
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- Elenco classi -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card admin-card">
|
||||
<div class="card-body">
|
||||
<div class="section-title">Classi esistenti</div>
|
||||
<p class="section-lead">Propaga una classe sul calendario, associala o modificane i dettagli.</p>
|
||||
|
||||
<div class="topnav">
|
||||
<div class="container-fluid">
|
||||
<nav class="navbar navbar-light navbar-expand-lg topnav-menu">
|
||||
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- Start right Content here -->
|
||||
<!-- ============================================================== -->
|
||||
<div class="main-content">
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5>Benvenuta/o </h5>
|
||||
<p>Di seguito puoi vedere lo stato delle tue prenotazioni</p>
|
||||
<form method="post" name="insertclass" id="insertclass">
|
||||
<div class="mb-3">
|
||||
<label for="formrow-firstname-input" class="form-label">Descrizione classe</label>
|
||||
<input type="text" class="form-control" placeholder="Classe" id="servicename" name="servicename">
|
||||
<input type="hidden" class="form-control" id="classinsert" name="classinsert" value="Y">
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="mb-3">
|
||||
<label for="formrow-email-input" class="form-label">Inserisci il WP catalog number</label>
|
||||
<input type="text" class="form-control" placeholder="WP Number" id="wpcatalognumber" name="wpcatalognumber">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="mb-3">
|
||||
<label for="choices-single-default" class="form-label font-size-13 text-muted">Seleziona il giorno</label>
|
||||
<select class="form-select" id="classdayday" name="classdayday">
|
||||
<option value="">Seleziona</option>
|
||||
<option value="Monday">Lunedì</option>
|
||||
<option value="Tuesday">Martedì</option>
|
||||
<option value="Wednesday">Mercoledì</option>
|
||||
<option value="Thursday">Giovedì</option>
|
||||
<option value="Friday">Venerdì</option>
|
||||
<option value="Saturday">Sabato</option>
|
||||
<option value="Sunday">Domenica</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-4">
|
||||
<div class="mb-3">
|
||||
<label for="formrow-inputCity" class="form-label">Ora</label>
|
||||
<input type="text" class="form-control" placeholder="Ora" id="classtime" name="classtime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="mb-3">
|
||||
<label for="formrow-inputZip" class="form-label">Durata</label>
|
||||
<input type="text" class="form-control" placeholder="Durata" id="classduration" name="classduration">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="mb-3">
|
||||
<label for="servicecategory">Seleziona una categoria:</label>
|
||||
<select name="servicecategory" id="servicecategory" class="form-select">
|
||||
<?php
|
||||
// Popola il dropdown con le opzioni dalla query
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$idservicecategory = $row['idservicecategory'];
|
||||
$namecategory = $row['namecategory'];
|
||||
echo "<option value='$idservicecategory'>$namecategory</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-4">
|
||||
<div class="mb-3">
|
||||
<label for="formrow-inputCity" class="form-label">Capacità Massima</label>
|
||||
<input type="text" class="form-control" placeholder="Max Capacity" id="maxcapacity" name="maxcapacity">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="mb-3">
|
||||
<label for="color-picker" class="form-label">Seleziona e modifica un colore</label>
|
||||
<input type="color" class="form-control color-picker" id="color-picker" name="color-picker">
|
||||
<input type="text" class="form-control color-code" id="color-code" name="color-code" maxlength="7" pattern="#[0-9A-Fa-f]{6}">
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const colorPicker = document.querySelector('.color-picker');
|
||||
const colorCodeInput = document.querySelector('.color-code');
|
||||
|
||||
colorPicker.addEventListener('input', function(event) {
|
||||
colorCodeInput.value = event.target.value;
|
||||
});
|
||||
|
||||
colorCodeInput.addEventListener('input', function(event) {
|
||||
const colorCode = event.target.value;
|
||||
if (colorCode.match(/^#[0-9A-Fa-f]{6}$/)) {
|
||||
colorPicker.value = colorCode;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary w-md">Inserisci</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table class-table align-middle mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Classe</th>
|
||||
<th>Giorno</th>
|
||||
<th>Orario</th>
|
||||
<th>Durata</th>
|
||||
<th>Categoria</th>
|
||||
<th class="text-end">Azioni</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($services)) : ?>
|
||||
<tr>
|
||||
<td colspan="6" class="text-center text-muted py-4">Nessuna classe presente.</td>
|
||||
</tr>
|
||||
<?php else : ?>
|
||||
<?php foreach ($services as $svc) : ?>
|
||||
<tr>
|
||||
<td>
|
||||
<span class="color-dot" style="background-color: <?php echo e($svc['colorclass'] ?: '#ccc'); ?>;"></span>
|
||||
<span class="font-size-14"><?php echo e($svc['servicename']); ?></span>
|
||||
</td>
|
||||
<td><?php echo e($svc['day']); ?></td>
|
||||
<td><?php echo e($svc['time']); ?></td>
|
||||
<td>
|
||||
<i class="mdi mdi-clock-time-nine-outline align-middle font-size-16 me-1"></i>
|
||||
<?php echo e($svc['classduration']); ?>
|
||||
</td>
|
||||
<td><?php echo e($svc['namecategory']); ?></td>
|
||||
<td class="text-end action-btns">
|
||||
<button type="button" class="btn btn-primary btn-sm toggle-form">Propaga</button>
|
||||
<a href="associate-services.php?id=<?php echo (int) $svc['idservice']; ?>">
|
||||
<button type="button" class="btn btn-info btn-sm">Associa</button>
|
||||
</a>
|
||||
<a href="updateservice.php?idservice=<?php echo (int) $svc['idservice']; ?>">
|
||||
<button type="button" class="btn btn-warning btn-sm">
|
||||
<i class="mdi mdi-lead-pencil font-size-16 align-middle"></i>
|
||||
</button>
|
||||
</a>
|
||||
<a href="cancelservice.php?idservice=<?php echo (int) $svc['idservice']; ?>">
|
||||
<button type="button" class="btn btn-danger btn-sm">
|
||||
<i class="bx bx-block font-size-16 align-middle"></i>
|
||||
</button>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="expanded-row">
|
||||
<td colspan="6">
|
||||
<div class="expanded-content">
|
||||
<form class="calendar-form" method="post" action="nextdateclass.php">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Data inizio</label>
|
||||
<input type="text" class="datepicker form-control" name="propagatestartdate" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Data fine</label>
|
||||
<input type="text" class="datepicker form-control" name="propagateenddate" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="idservice" value="<?php echo (int) $svc['idservice']; ?>">
|
||||
<input type="hidden" name="timeclass" value="<?php echo e($svc['time']); ?>">
|
||||
<input type="hidden" name="dayclass" value="<?php echo e($svc['day']); ?>">
|
||||
<input type="hidden" name="durationtime" value="<?php echo e($svc['classduration']); ?>">
|
||||
<button type="submit" class="btn btn-primary btn-save">Propaga sul calendario</button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<?php if ($message=='success') { ?>
|
||||
<div class="alert alert-success" role="alert">
|
||||
Propagazione avvenuta con successo
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-nowrap align-middle mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Classe</th>
|
||||
<th>Giorno</th>
|
||||
<th>Orario</th>
|
||||
<th>Durata</th>
|
||||
<th>Categoria</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$wa_startindex = 0;
|
||||
while (!$servicesclass->atEnd()) {
|
||||
$wa_startindex = $servicesclass->Index;
|
||||
?>
|
||||
<tr>
|
||||
<td style="width: 40px;"></td>
|
||||
<td>
|
||||
<h5 class="text-truncate font-size-14 m-0">
|
||||
<a href="javascript: void(0);" class="text-dark">
|
||||
<?php echo ($servicesclass->getColumnVal("servicename")); ?>
|
||||
</a>
|
||||
</h5>
|
||||
</td>
|
||||
<td>
|
||||
<p class="mb-0"><?php echo ($servicesclass->getColumnVal("day")); ?></p>
|
||||
</td>
|
||||
<td>
|
||||
<p class="mb-0"><?php echo ($servicesclass->getColumnVal("time")); ?></p>
|
||||
</td>
|
||||
<td>
|
||||
<p class="mb-0">
|
||||
<i class="mdi mdi-clock-time-nine-outline align-middle font-size-16 me-1"></i>
|
||||
<?php echo ($servicesclass->getColumnVal("classduration")); ?>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p class="mb-0"><?php echo ($servicesclass->getColumnVal("namecategory")); ?></p>
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-primary toggle-form">
|
||||
Propaga
|
||||
</button>
|
||||
<a href="associate-services.php?id=<?php echo ($servicesclass->getColumnVal("idservice")); ?>"><button type="button" class="btn btn-info toggle-form">
|
||||
Associa
|
||||
</button></a>
|
||||
<?php $idservice=$servicesclass->getColumnVal("idservice"); ?>
|
||||
<a href="updateservice.php?idservice=<?php echo $idservice; ?>"><button type="button" class="btn btn-warning waves-effect waves-light">
|
||||
<i class="mdi mdi-lead-pencil font-size-16 align-middle me-2"></i>
|
||||
</button>
|
||||
<a href="cancelservice.php?idservice=<?php echo ($servicesclass->getColumnVal("idservice")); ?>"><button type="button" class="btn btn-danger waves-effect waves-light">
|
||||
<i class="bx bx-block font-size-16 align-middle me-2"></i>
|
||||
</button></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="expanded-row">
|
||||
<td colspan="7">
|
||||
<div class="expanded-content">
|
||||
<form id="calendar-form" name="calendar-form" class="calendar-form" method="post" action="nextdateclass.php">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="mb-3">
|
||||
<label for="propagatestartdate">Start Date:</label>
|
||||
<input type="text" class="datepicker propagatestartdate form-control" name="propagatestartdate" required>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="mb-3">
|
||||
<label for="propagateenddate">End Date:</label>
|
||||
<input type="text" class="datepicker propagateenddate form-control" name="propagateenddate" required>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<input type="hidden" class="idservice" name="idservice" value='<?php echo $servicesclass->getColumnVal("idservice"); ?>'>
|
||||
<input type="hidden" class="timeclass" name="timeclass" value='<?php echo $servicesclass->getColumnVal("time"); ?>'>
|
||||
<input type="hidden" class="dayclass" name="dayclass" value='<?php echo $servicesclass->getColumnVal("day"); ?>'>
|
||||
<input type="hidden" class="durationtime" name="durationtime" value='<?php echo $servicesclass->getColumnVal("classduration"); ?>'>
|
||||
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary w-md">Invia</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$servicesclass->moveNext();
|
||||
}
|
||||
$servicesclass->moveFirst(); //return RS to the first record
|
||||
unset($wa_startindex);
|
||||
unset($wa_repeatcount);
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<?php include('include/footer.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="assets/libs/metismenujs/metismenujs.min.js"></script>
|
||||
<script src="assets/libs/simplebar/simplebar.min.js"></script>
|
||||
<script src="assets/libs/eva-icons/eva.min.js"></script>
|
||||
<script src="assets/js/app.js"></script>
|
||||
|
||||
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
<!-- End Page-content -->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Datepicker sui campi di propagazione
|
||||
$(".datepicker").datepicker({
|
||||
dateFormat: "yy-mm-dd"
|
||||
});
|
||||
|
||||
<?php include('include/footer.php'); ?>
|
||||
</div>
|
||||
<!-- end main content-->
|
||||
|
||||
</div>
|
||||
<!-- END layout-wrapper -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const toggleButtons = document.querySelectorAll(".toggle-form");
|
||||
|
||||
toggleButtons.forEach(button => {
|
||||
button.addEventListener("click", function() {
|
||||
const row = this.closest("tr");
|
||||
const expandedRow = row.nextElementSibling;
|
||||
const expandedContent = expandedRow.querySelector(".expanded-content");
|
||||
|
||||
if (expandedRow.classList.contains("expanded")) {
|
||||
expandedRow.classList.remove("expanded");
|
||||
} else {
|
||||
expandedRow.classList.add("expanded");
|
||||
// Aggiungi qui il codice per popolare il contenuto espanso
|
||||
// Puoi utilizzare AJAX per ottenere i dati dinamicamente se necessario
|
||||
// Color picker spectrum collegato al VERO campo colorclass (ora viene salvato)
|
||||
$('#colorclass').spectrum({
|
||||
preferredFormat: 'hex',
|
||||
showInput: true,
|
||||
showPalette: true,
|
||||
palette: [
|
||||
["#FF0000", "#00FF00", "#0000FF"],
|
||||
["#1ebf73", "#f39c12", "#8e44ad"]
|
||||
],
|
||||
change: function(color) {
|
||||
$('#colorclass').val(color.toHexString());
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- JAVASCRIPT -->
|
||||
<script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="assets/libs/metismenujs/metismenujs.min.js"></script>
|
||||
<script src="assets/libs/simplebar/simplebar.min.js"></script>
|
||||
<script src="assets/libs/eva-icons/eva.min.js"></script>
|
||||
|
||||
<script src="assets/js/app.js"></script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#colorclass').spectrum({
|
||||
preferredFormat: 'hex', // Il formato del codice del colore (es. esadecimale)
|
||||
showInput: true, // Mostra l'input per inserire il codice del colore manualmente
|
||||
showPalette: true, // Mostra una tavolozza di colori predefiniti
|
||||
palette: [ // Esempi di colori predefiniti nella tavolozza
|
||||
"#FF0000", "#00FF00", "#0000FF"
|
||||
// Aggiungi altri colori se necessario
|
||||
],
|
||||
change: function(color) {
|
||||
$('#colorclass').val(color.toHexString()); // Imposta il valore dell'input con il codice del colore
|
||||
}
|
||||
// Espansione riga propagazione
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
document.querySelectorAll(".toggle-form").forEach(function(button) {
|
||||
button.addEventListener("click", function() {
|
||||
var row = this.closest("tr");
|
||||
var expandedRow = row.nextElementSibling;
|
||||
if (expandedRow && expandedRow.classList.contains("expanded-row")) {
|
||||
expandedRow.classList.toggle("expanded");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user