382 lines
14 KiB
PHP
382 lines
14 KiB
PHP
<?php require_once('include/headscript.php'); ?>
|
|
|
|
<?php if (isset($_POST['classinsert'])) { $formclass='Y'; } else { $formclass='N'; } ?>
|
|
<?php if (isset($_GET['id'])) { $idmain=$_GET['id']; } ?>
|
|
<?php if (isset($_POST['idservice'])) { $idservice=$_POST['idservice'];
|
|
$idmain=$idservice; }
|
|
?>
|
|
<?php if (isset($_POST['formclass'])) { $formclass=$_POST['formclass']; } ?>
|
|
|
|
<?php
|
|
if ($formclass=='Y') {
|
|
$InsertQuery = new WA_MySQLi_Query($bkngstm);
|
|
$InsertQuery->Action = "insert";
|
|
$InsertQuery->Table = "associateclass";
|
|
$InsertQuery->bindColumn("idmainservice", "i", "".((isset($_POST["idmainservice"]))?$_POST["idmainservice"]:"") ."", "WA_DEFAULT");
|
|
$InsertQuery->bindColumn("idassociateservice", "i", "".((isset($_POST["servicelist"]))?$_POST["servicelist"]:"") ."", "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 WHERE service.idservice='$idmain'");
|
|
$servicesclass->execute();
|
|
?>
|
|
<?php
|
|
$associatedclasses = new WA_MySQLi_RS("associatedclasses",$bkngstm,0);
|
|
$associatedclasses->setQuery("SELECT * FROM associateclass LEFT JOIN service on service.idservice=associateclass.idassociateservice WHERE associateclass.idmainservice='$idmain'");
|
|
$associatedclasses->execute();
|
|
?>
|
|
|
|
<!doctype html>
|
|
<html lang="en">
|
|
|
|
<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 -->
|
|
<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://cdn.jsdelivr.net/npm/spectrum-colorpicker@1.8.1/dist/spectrum.min.css">
|
|
<script src="https://cdn.jsdelivr.net/npm/spectrum-colorpicker@1.8.1/dist/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">Associazione Servizi</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>Servizio: <?php echo ($servicesclass->getColumnVal("servicename")); ?></p>
|
|
<form method="post" name="insertclass" id="insertclass">
|
|
<div class="row">
|
|
<div class="col-lg-4">
|
|
<div class="mb-3">
|
|
<label for="formrow-inputState" class="form-label">Categoria</label>
|
|
<select id="servicelist" name="servicelist" class="form-select">
|
|
<option selected="">Seleziona...</option>
|
|
<?php
|
|
// Connessione al database
|
|
|
|
|
|
// Creazione della connessione
|
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
|
|
|
// Verifica della connessione
|
|
if ($conn->connect_error) {
|
|
die("Connessione al database fallita: " . $conn->connect_error);
|
|
}
|
|
|
|
// Query per selezionare dati dalla tabella service
|
|
$query = "SELECT idservice, servicename FROM service";
|
|
$result = $conn->query($query);
|
|
|
|
// Popolamento del dropdown con i dati dalla tabella service
|
|
while ($row = $result->fetch_assoc()) {
|
|
echo '<option value="' . $row['idservice'] . '">' . $row['servicename'] . '</option>';
|
|
}
|
|
|
|
// Chiusura della connessione
|
|
$conn->close();
|
|
?>
|
|
</select>
|
|
<input type="hidden" id="idmainservice" name="idmainservice" value="<?php echo $idmain; ?>" />
|
|
<input type="hidden" id="formclass" name="formclass" value="Y" />
|
|
</div>
|
|
</div>
|
|
</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>Associated Class</th>
|
|
<th>Cancel</th>
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$wa_startindex = 0;
|
|
while (!$associatedclasses->atEnd()) {
|
|
$wa_startindex = $associatedclasses->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 ($associatedclasses->getColumnVal("servicename")); ?>
|
|
</a>
|
|
</h5>
|
|
</td>
|
|
|
|
|
|
|
|
|
|
<td>
|
|
<a href="cancelassociate.php?idassociateclass=<?php echo ($associatedclasses->getColumnVal("idassociateclass")); ?>&id=<?php echo $idmain; ?>"<button type="button" class="btn btn-danger toggle-form">
|
|
Rimuovi
|
|
</button>
|
|
|
|
</td>
|
|
</tr>
|
|
|
|
<?php
|
|
$associatedclasses->moveNext();
|
|
}
|
|
$associatedclasses->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).ready(function() {
|
|
$("#colorclass").spectrum({
|
|
preferredFormat: "hex", // Formato del colore preferito
|
|
showInput: true, // Mostra il campo di input per inserire il codice del colore manualmente
|
|
showInitial: true, // Mostra il colore iniziale
|
|
chooseText: "Scegli", // Testo del pulsante "Scegli"
|
|
cancelText: "Annulla", // Testo del pulsante "Annulla"
|
|
change: function(color) {
|
|
// Questa funzione verrà chiamata quando il colore viene cambiato
|
|
$("#colorclass").val(color.toHexString()); // Imposta il valore del colore selezionato nell'input "Colore"
|
|
$("#colorpicker-hidden").val(color.toHexString()); // Imposta il valore del colore selezionato nel campo nascosto
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
|
|
|
|
|
|
<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>
|
|
|
|
</body>
|
|
|
|
</html>
|