527 lines
23 KiB
PHP
527 lines
23 KiB
PHP
<?php require_once('Connections/bkngstm.php'); ?>
|
|
<?php require_once('webassist/mysqli/rsobj.php'); ?>
|
|
<?php require_once('webassist/mysqli/queryobj.php'); ?>
|
|
<?php if (isset($_POST['classinsert'])) { $formclass='Y'; } else { $formclass='N'; } ?>
|
|
<?php
|
|
if (isset($_GET['idservice'])) {
|
|
$idservice = $_GET['idservice'];
|
|
if ($formclass == 'Y') {
|
|
|
|
|
|
$UpdateQuery = new WA_MySQLi_Query($bkngstm);
|
|
$UpdateQuery->Action = "update";
|
|
$UpdateQuery->Table = "service";
|
|
$UpdateQuery->bindColumn("servicename", "s", isset($_POST["servicename"]) ? $_POST["servicename"] : "", "WA_DEFAULT");
|
|
$UpdateQuery->bindColumn("wpcatalognumber", "i", isset($_POST["wpcatalognumber"]) ? $_POST["wpcatalognumber"] : "", "WA_DEFAULT");
|
|
$UpdateQuery->bindColumn("day", "s", isset($_POST["classdayday"]) ? $_POST["classdayday"] : "", "WA_DEFAULT");
|
|
$UpdateQuery->bindColumn("time", "s", isset($_POST["classtime"]) ? $_POST["classtime"] : "", "WA_DEFAULT");
|
|
$UpdateQuery->bindColumn("category", "i", isset($_POST["servicecategory"]) ? $_POST["servicecategory"] : "", "WA_DEFAULT");
|
|
$UpdateQuery->bindColumn("maxcapacity", "i", isset($_POST["maxcapacity"]) ? $_POST["maxcapacity"] : "", "WA_DEFAULT");
|
|
$UpdateQuery->bindColumn("colorclass", "s", isset($_POST["colorclass"]) ? $_POST["colorclass"] : "", "WA_DEFAULT");
|
|
$UpdateQuery->bindColumn("classduration", "d", isset($_POST["classduration"]) ? $_POST["classduration"] : "", "WA_DEFAULT");
|
|
|
|
$UpdateQuery->addFilter("idservice", "=", "s", $idservice);
|
|
|
|
$UpdateQuery->saveInSession("");
|
|
$UpdateQuery->execute();
|
|
|
|
$UpdateGoTo = "";
|
|
if (function_exists("rel2abs")) {
|
|
$UpdateGoTo = $UpdateGoTo ? rel2abs($UpdateGoTo, dirname(__FILE__)) : "";
|
|
}
|
|
$UpdateQuery->redirect($UpdateGoTo);
|
|
}
|
|
}
|
|
?>
|
|
|
|
<?php
|
|
$servicesclass = new WA_MySQLi_RS("servicesclass",$bkngstm,0);
|
|
$servicesclass->setQuery("SELECT * FROM service LEFT JOIN servicecategory on service.category=servicecategory.idservicecategory WHERE service.idservice='$idservice'");
|
|
$servicesclass->execute();
|
|
?>
|
|
<?php
|
|
$categoryclass = new WA_MySQLi_RS("categoryclass",$bkngstm,0);
|
|
$categoryclass->setQuery("SELECT * FROM servicecategory");
|
|
$categoryclass->execute();
|
|
?>
|
|
<?php
|
|
|
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
|
|
|
// Controlla la connessione
|
|
if ($conn->connect_error) {
|
|
die("Connessione fallita: " . $conn->connect_error);
|
|
}
|
|
|
|
// Query per ottenere le categorie dal database
|
|
$query = "SELECT idservicecategory, namecategory FROM servicecategory";
|
|
$result = $conn->query($query);
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
|
<title>Starter Page | webadmin - Admin & Dashboard Template</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta content="Premium Multipurpose Admin & Dashboard Template" name="description" />
|
|
<meta content="Themesdesign" name="author" />
|
|
<!-- App favicon -->
|
|
<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">
|
|
|
|
|
|
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.1/spectrum.min.css">
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.1/spectrum.min.js"></script>
|
|
<script>
|
|
$(document).ready(function() {
|
|
$("#datepicker").datepicker(); // Inizializza il calendario
|
|
|
|
$("#calendar-form").on("submit", function(event) {
|
|
event.preventDefault();
|
|
|
|
// Ottieni il valore della data selezionata
|
|
const selectedDate = $("input[name='selectedDate']").val();
|
|
|
|
// Esegui qui le azioni necessarie con la data selezionata
|
|
|
|
// Ad esempio, puoi inviare la data al server tramite AJAX
|
|
// $.ajax({
|
|
// url: "url_del_server",
|
|
// type: "POST",
|
|
// data: { selectedDate: selectedDate },
|
|
// success: function(response) {
|
|
// // Aggiorna la visualizzazione dei dati o effettua altre azioni
|
|
// },
|
|
// error: function(error) {
|
|
// // Gestisci l'errore
|
|
// }
|
|
// });
|
|
});
|
|
});
|
|
</script>
|
|
<style>
|
|
.calendar-input {
|
|
width: 30%;
|
|
}
|
|
</style>
|
|
<style>
|
|
.expanded-row {
|
|
display: none;
|
|
}
|
|
|
|
.expanded {
|
|
display: table-row;
|
|
transition: display 0.3s ease;
|
|
}
|
|
</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 -->
|
|
|
|
</div>
|
|
|
|
<div class="d-flex">
|
|
|
|
<?php include('include/languageselection.php'); ?>
|
|
|
|
<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>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</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>
|
|
|
|
<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>Modifica il tuo servizio</p>
|
|
|
|
<?php
|
|
|
|
?>
|
|
|
|
<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" value="<?php echo ($servicesclass->getColumnVal("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" value="<?php echo ($servicesclass->getColumnVal("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" <?php if ($servicesclass->getColumnVal("day") === "Monday") echo "selected"; ?>>Lunedì</option>
|
|
<option value="Tuesday" <?php if ($servicesclass->getColumnVal("day") === "Tuesday") echo "selected"; ?>>Martedì</option>
|
|
<option value="Wednesday" <?php if ($servicesclass->getColumnVal("day") === "Wednesday") echo "selected"; ?>>Mercoledì</option>
|
|
<option value="Thursday" <?php if ($servicesclass->getColumnVal("day") === "Thursday") echo "selected"; ?>>Giovedì</option>
|
|
<option value="Friday" <?php if ($servicesclass->getColumnVal("day") === "Friday") echo "selected"; ?>>Venerdì</option>
|
|
<option value="Saturday" <?php if ($servicesclass->getColumnVal("day") === "Saturday") echo "selected"; ?>>Sabato</option>
|
|
<option value="Sunday" <?php if ($servicesclass->getColumnVal("day") === "Sunday") echo "selected"; ?>>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" value="<?php echo ($servicesclass->getColumnVal("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" value="<?php echo ($servicesclass->getColumnVal("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 ($rowcat = $result->fetch_assoc()) {
|
|
$idservicecategory = $rowcat['idservicecategory'];
|
|
$namecategory = $rowcat['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" value="<?php echo ($servicesclass->getColumnVal("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" value="<?php echo ($servicesclass->getColumnVal("colorclass")); ?>">
|
|
<input type="text" class="form-control color-code" id="color-code" name="color-code" maxlength="7" pattern="#[0-9A-Fa-f]{6}" value="<?php echo ($servicesclass->getColumnVal("colorclass")); ?>">
|
|
</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>
|
|
</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">
|
|
<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>
|
|
<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" method="post" action="nextdateclass.php">
|
|
<div class="form-group">
|
|
<label for="datepicker">Seleziona una data:</label>
|
|
<input type="text" id="datepicker" name="propagateenddate" class="form-control calenda-input" required>
|
|
<input type="hidden" id="idservice" name="idservice" value='<?php echo $servicesclass->getColumnVal("idservice"); ?>'>
|
|
<input type="hidden" id="timeclass" name="timeclass" value='<?php echo $servicesclass->getColumnVal("time"); ?>'>
|
|
<input type="hidden" id="dayclass" name="dayclass" value='<?php echo $servicesclass->getColumnVal("day"); ?>'>
|
|
<input type="hidden" id="durationtime" name="durationtime" value='<?php echo $servicesclass->getColumnVal("classduration"); ?>'>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary">Invia</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
$servicesclass->moveNext();
|
|
}
|
|
$servicesclass->moveFirst(); //return RS to the first record
|
|
unset($wa_startindex);
|
|
unset($wa_repeatcount);
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<!-- container-fluid -->
|
|
</div>
|
|
<!-- End Page-content -->
|
|
|
|
<?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
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</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
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|