fixed color class

This commit is contained in:
2026-09-03 16:15:08 +02:00
parent 956faf92f8
commit 2dfbbad7d4
2 changed files with 399 additions and 393 deletions
+9 -6
View File
@@ -367,10 +367,8 @@ $services = $pdo->query(
<a href="associate-services.php?id=<?php echo (int) $svc['idservice']; ?>"> <a href="associate-services.php?id=<?php echo (int) $svc['idservice']; ?>">
<button type="button" class="btn btn-info btn-sm">Associa</button> <button type="button" class="btn btn-info btn-sm">Associa</button>
</a> </a>
<a href="updateservice.php?idservice=<?php echo (int) $svc['idservice']; ?>"> <a href="updateservice.php?idservice=<?php echo (int) $svc['idservice']; ?>" class="btn btn-warning btn-sm">
<button type="button" class="btn btn-warning btn-sm">
<i class="mdi mdi-lead-pencil font-size-16 align-middle"></i> <i class="mdi mdi-lead-pencil font-size-16 align-middle"></i>
</button>
</a> </a>
<a href="cancelservice.php?idservice=<?php echo (int) $svc['idservice']; ?>"> <a href="cancelservice.php?idservice=<?php echo (int) $svc['idservice']; ?>">
<button type="button" class="btn btn-danger btn-sm"> <button type="button" class="btn btn-danger btn-sm">
@@ -443,9 +441,14 @@ $services = $pdo->query(
palette: [ palette: [
["#FF0000", "#00FF00", "#0000FF"], ["#FF0000", "#00FF00", "#0000FF"],
["#1ebf73", "#f39c12", "#8e44ad"] ["#1ebf73", "#f39c12", "#8e44ad"]
], ]
change: function(color) { });
$('#colorclass').val(color.toHexString());
// Forza il valore del colore nel campo prima dell'invio del form
$('#insertclass').on('submit', function() {
var col = $('#colorclass').spectrum('get');
if (col) {
$('#colorclass').val(col.toHexString());
} }
}); });
}); });
+45 -42
View File
@@ -1,11 +1,16 @@
<?php require_once('include/headscript.php'); ?>
<?php require_once('Connections/bkngstm.php'); ?> <?php require_once('Connections/bkngstm.php'); ?>
<?php require_once('webassist/mysqli/rsobj.php'); ?> <?php require_once('webassist/mysqli/rsobj.php'); ?>
<?php require_once('webassist/mysqli/queryobj.php'); ?> <?php require_once('webassist/mysqli/queryobj.php'); ?>
<?php if (isset($_POST['classinsert'])) { $formclass='Y'; } else { $formclass='N'; } ?> <?php if (isset($_POST['classinsert'])) {
$formclass = 'Y';
} else {
$formclass = 'N';
} ?>
<?php <?php
if (isset($_GET['idservice'])) { if (isset($_GET['idservice'])) {
$idservice = $_GET['idservice']; $idservice = $_GET['idservice'];
if ($formclass == 'Y') { if ($formclass == 'Y') {
$UpdateQuery = new WA_MySQLi_Query($bkngstm); $UpdateQuery = new WA_MySQLi_Query($bkngstm);
@@ -25,28 +30,26 @@ if ($formclass == 'Y') {
$UpdateQuery->saveInSession(""); $UpdateQuery->saveInSession("");
$UpdateQuery->execute(); $UpdateQuery->execute();
$UpdateGoTo = ""; $UpdateQuery->execute();
if (function_exists("rel2abs")) { header('Location: admin-services.php?message=updated');
$UpdateGoTo = $UpdateGoTo ? rel2abs($UpdateGoTo, dirname(__FILE__)) : ""; exit;
}
$UpdateQuery->redirect($UpdateGoTo);
} }
} }
?> ?>
<?php <?php
$servicesclass = new WA_MySQLi_RS("servicesclass",$bkngstm,0); $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->setQuery("SELECT * FROM service LEFT JOIN servicecategory on service.category=servicecategory.idservicecategory WHERE service.idservice='$idservice'");
$servicesclass->execute(); $servicesclass->execute();
?> ?>
<?php <?php
$categoryclass = new WA_MySQLi_RS("categoryclass",$bkngstm,0); $categoryclass = new WA_MySQLi_RS("categoryclass", $bkngstm, 0);
$categoryclass->setQuery("SELECT * FROM servicecategory"); $categoryclass->setQuery("SELECT * FROM servicecategory");
$categoryclass->execute(); $categoryclass->execute();
?> ?>
<?php <?php
$conn = new mysqli($servername, $username, $password, $dbname); $conn = new mysqli($servername, $username, $password, $dbname);
// Controlla la connessione // Controlla la connessione
if ($conn->connect_error) { if ($conn->connect_error) {
@@ -60,7 +63,7 @@ $result = $conn->query($query);
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>Starter Page | webadmin - Admin & Dashboard Template</title> <title>Starter Page | webadmin - Admin & Dashboard Template</title>
@@ -76,16 +79,16 @@ $result = $conn->query($query);
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
<!-- App Css--> <!-- App Css-->
<link href="assets/css/app.min.css" id="app-style" rel="stylesheet" type="text/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" 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/ui/1.12.1/jquery-ui.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.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"> <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 type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.1/spectrum.min.js"></script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$("#datepicker").datepicker(); // Inizializza il calendario $("#datepicker").datepicker(); // Inizializza il calendario
@@ -111,12 +114,12 @@ $result = $conn->query($query);
// }); // });
}); });
}); });
</script> </script>
<style> <style>
.calendar-input { .calendar-input {
width: 30%; width: 30%;
} }
</style> </style>
<style> <style>
.expanded-row { .expanded-row {
display: none; display: none;
@@ -126,13 +129,13 @@ $result = $conn->query($query);
display: table-row; display: table-row;
transition: display 0.3s ease; transition: display 0.3s ease;
} }
</style> </style>
</head> </head>
<body> <body>
<!-- <body data-layout="horizontal"> --> <!-- <body data-layout="horizontal"> -->
@@ -224,11 +227,11 @@ $result = $conn->query($query);
<h5>Benvenuta/o </h5> <h5>Benvenuta/o </h5>
<p>Modifica il tuo servizio</p> <p>Modifica il tuo servizio</p>
<?php <?php
?> ?>
<form method="post" name="insertclass" id="insertclass"> <form method="post" name="insertclass" id="insertclass">
<div class="mb-3"> <div class="mb-3">
<label for="formrow-firstname-input" class="form-label">Descrizione classe</label> <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="text" class="form-control" placeholder="Classe" id="servicename" name="servicename" value="<?php echo ($servicesclass->getColumnVal("servicename")); ?>">
@@ -256,7 +259,7 @@ $result = $conn->query($query);
<option value="Saturday" <?php if ($servicesclass->getColumnVal("day") === "Saturday") echo "selected"; ?>>Sabato</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> <option value="Sunday" <?php if ($servicesclass->getColumnVal("day") === "Sunday") echo "selected"; ?>>Domenica</option>
</select> </select>
</div> </div>
</div> </div>
</div> </div>
@@ -265,8 +268,7 @@ $result = $conn->query($query);
<div class="col-lg-4"> <div class="col-lg-4">
<div class="mb-3"> <div class="mb-3">
<label for="formrow-inputCity" class="form-label">Ora</label> <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")); ?>"> <input type="text" class="form-control" placeholder="Ora" id="classtime" name="classtime" value="<?php echo ($servicesclass->getColumnVal("time")); ?>">
</div>
</div> </div>
<div class="col-lg-4"> <div class="col-lg-4">
<div class="mb-3"> <div class="mb-3">
@@ -279,11 +281,12 @@ $result = $conn->query($query);
<label for="servicecategory">Seleziona una categoria:</label> <label for="servicecategory">Seleziona una categoria:</label>
<select name="servicecategory" id="servicecategory" class="form-select"> <select name="servicecategory" id="servicecategory" class="form-select">
<?php <?php
// Popola il dropdown con le opzioni dalla query $catattuale = $servicesclass->getColumnVal("category");
while ($rowcat = $result->fetch_assoc()) { while ($rowcat = $result->fetch_assoc()) {
$idservicecategory = $rowcat['idservicecategory']; $idservicecategory = $rowcat['idservicecategory'];
$namecategory = $rowcat['namecategory']; $namecategory = $rowcat['namecategory'];
echo "<option value='$idservicecategory'>$namecategory</option>"; $sel = ($idservicecategory == $catattuale) ? "selected" : "";
echo "<option value='$idservicecategory' $sel>$namecategory</option>";
} }
?> ?>
</select> </select>
@@ -304,10 +307,10 @@ $result = $conn->query($query);
<div class="mb-3"> <div class="mb-3">
<label for="color-picker" class="form-label">Seleziona e modifica un colore</label> <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="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")); ?>"> <input type="text" class="form-control color-code" id="color-code" name="colorclass" maxlength="7" pattern="#[0-9A-Fa-f]{6}" value="<?php echo ($servicesclass->getColumnVal("colorclass")); ?>">
</div> </div>
<script> <script>
const colorPicker = document.querySelector('.color-picker'); const colorPicker = document.querySelector('.color-picker');
const colorCodeInput = document.querySelector('.color-code'); const colorCodeInput = document.querySelector('.color-code');
@@ -321,11 +324,11 @@ $result = $conn->query($query);
colorPicker.value = colorCode; colorPicker.value = colorCode;
} }
}); });
</script> </script>
</div> </div>
@@ -359,12 +362,12 @@ $result = $conn->query($query);
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-xl-12"> <div class="col-xl-12">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-nowrap align-middle mb-0"> <table class="table table-nowrap align-middle mb-0">
<thead class="table-light"> <thead class="table-light">
<tr> <tr>
<th></th> <th></th>
@@ -413,9 +416,9 @@ $result = $conn->query($query);
<a href="associate-services.php?id=<?php echo ($servicesclass->getColumnVal("idservice")); ?>"><button type="button" class="btn btn-info toggle-form"> <a href="associate-services.php?id=<?php echo ($servicesclass->getColumnVal("idservice")); ?>"><button type="button" class="btn btn-info toggle-form">
Associa Associa
</button></a> </button></a>
<button type="button" class="btn btn-warning waves-effect waves-light"> <a href="updateservice.php?idservice=<?php echo ($servicesclass->getColumnVal("idservice")); ?>" class="btn btn-warning waves-effect waves-light">
<i class="mdi mdi-lead-pencil font-size-16 align-middle me-2"></i> <i class="mdi mdi-lead-pencil font-size-16 align-middle me-2"></i>
</button> </a>
<a href="cancelservice.php?idservice=<?php echo ($servicesclass->getColumnVal("idservice")); ?>"><button type="button" class="btn btn-danger waves-effect waves-light"> <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> <i class="bx bx-block font-size-16 align-middle me-2"></i>
</button></a> </button></a>
@@ -446,13 +449,13 @@ $result = $conn->query($query);
unset($wa_repeatcount); unset($wa_repeatcount);
?> ?>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@@ -491,7 +494,7 @@ $result = $conn->query($query);
}); });
}); });
}); });
</script> </script>
@@ -519,9 +522,9 @@ $result = $conn->query($query);
} }
}); });
}); });
</script> </script>
</body> </body>
</html> </html>