Compare commits
3 Commits
754c5f93f0
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 2392a267d1 | |||
| 9fdb56c7ed | |||
| aff67bc496 |
@@ -31,7 +31,6 @@ MAIL_USERNAME=info@yogasoul.it
|
|||||||
MAIL_PASSWORD=!Testolina88
|
MAIL_PASSWORD=!Testolina88
|
||||||
MAIL_ENCRYPTION=ssl
|
MAIL_ENCRYPTION=ssl
|
||||||
|
|
||||||
|
|
||||||
PUSHER_APP_ID=
|
PUSHER_APP_ID=
|
||||||
PUSHER_APP_KEY=
|
PUSHER_APP_KEY=
|
||||||
PUSHER_APP_SECRET=
|
PUSHER_APP_SECRET=
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
<?php phpinfo();
|
||||||
@@ -9,10 +9,10 @@ $dotenv = Dotenv::createImmutable(__DIR__ . '/../../');
|
|||||||
$dotenv->load();
|
$dotenv->load();
|
||||||
|
|
||||||
// Prende i valori dal .env
|
// Prende i valori dal .env
|
||||||
$hostname_bkngstm = $_ENV['DB_HOST'] ?? 'localhost';
|
$hostname_bkngstm = $_ENV['DB_HOST'];
|
||||||
$database_bkngstm = $_ENV['DB_DATABASE'] ?? 'yogibookaury';
|
$database_bkngstm = $_ENV['DB_DATABASE'];
|
||||||
$username_bkngstm = $_ENV['DB_USERNAME'] ?? 'root';
|
$username_bkngstm = $_ENV['DB_USERNAME'];
|
||||||
$password_bkngstm = $_ENV['DB_PASSWORD'] ?? '';
|
$password_bkngstm = $_ENV['DB_PASSWORD'];
|
||||||
|
|
||||||
$servername = $hostname_bkngstm;
|
$servername = $hostname_bkngstm;
|
||||||
$username = $username_bkngstm;
|
$username = $username_bkngstm;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use PHPMailer\PHPMailer\PHPMailer;
|
use PHPMailer\PHPMailer\PHPMailer;
|
||||||
use PHPMailer\PHPMailer\Exception;
|
use PHPMailer\PHPMailer\Exception;
|
||||||
?>
|
?>
|
||||||
@@ -8,106 +9,95 @@ include('include/headscript.php');
|
|||||||
|
|
||||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
|
||||||
// Recupera il parametro "idbookingclass" dalla richiesta GET
|
// Recupera il parametro "idbookingclass" dalla richiesta GET
|
||||||
if (isset($_GET['idbookingclass'])) {
|
if (isset($_GET['idbookingclass'])) {
|
||||||
$idbookingclass = $_GET['idbookingclass'];
|
$idbookingclass = $_GET['idbookingclass'];
|
||||||
|
|
||||||
// Aggiorna lo status a "booked" nella tabella "bookingclass"
|
// Aggiorna lo status a "booked" e is_reprogrammed a "Y" nella tabella "bookingclass"
|
||||||
$query = "UPDATE bookingclass SET status = 'booked' WHERE idbookingclass = ?";
|
$query = "UPDATE bookingclass SET status = 'booked', is_reprogrammed = 'Y' WHERE idbookingclass = ?";
|
||||||
$stmt = $conn->prepare($query);
|
$stmt = $conn->prepare($query);
|
||||||
|
|
||||||
if ($stmt) {
|
if ($stmt) {
|
||||||
$stmt->bind_param("i", $idbookingclass);
|
$stmt->bind_param("i", $idbookingclass);
|
||||||
if ($stmt->execute())
|
if ($stmt->execute()) {
|
||||||
|
// Query per recuperare i dettagli della prenotazione
|
||||||
//query
|
$query = "SELECT bookingclass.*, auth_users.*, service.*
|
||||||
$query = "SELECT bookingclass.*, auth_users.*, service.*
|
FROM bookingclass
|
||||||
FROM bookingclass
|
LEFT JOIN auth_users ON bookingclass.iduser = auth_users.id
|
||||||
LEFT JOIN auth_users ON bookingclass.iduser = auth_users.id
|
LEFT JOIN service ON bookingclass.idservice = service.idservice
|
||||||
LEFT JOIN service ON bookingclass.idservice = service.idservice
|
WHERE bookingclass.idbookingclass = $idbookingclass";
|
||||||
WHERE bookingclass.idbookingclass = $idbookingclass";
|
|
||||||
|
|
||||||
$result = $conn->query($query);
|
$result = $conn->query($query);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
// Elabora i risultati
|
// Elabora i risultati
|
||||||
while ($row = $result->fetch_assoc()) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
// Ora puoi accedere ai dati delle tabelle
|
// Ora puoi accedere ai dati delle tabelle
|
||||||
$newtime = $row['bookingstart'];
|
$newtime = $row['bookingstart'];
|
||||||
$emailuser = $row['email'];
|
$emailuser = $row['email'];
|
||||||
$firstname = $row['first_name'];
|
$firstname = $row['first_name'];
|
||||||
|
|
||||||
|
|
||||||
$newtimeformat = date("d-m-Y H:i", strtotime($newtime));
|
|
||||||
require 'phpmailer/src/Exception.php';
|
|
||||||
require 'phpmailer/src/PHPMailer.php';
|
|
||||||
require 'phpmailer/src/SMTP.php';
|
|
||||||
//mail to client
|
|
||||||
$messageedit=" <p style='font-size: 14px; line-height: 190%;'><span style='font-size: 18px; line-height: 34.2px;'><strong><span style='line-height: 34.2px; font-size: 18px;'> Ciao $firstname , </span></strong></span></p>
|
|
||||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>La tua richiesta di riprogrammazione è stata accettata! </span></p>
|
|
||||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Ecco il dettaglio della riprogrammazione $newtimeformat</span></p>
|
|
||||||
<br>
|
|
||||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Per vedere e gestire le tue lezioni clicca qui: https://yogibook.yogasoul.it </span></p>
|
|
||||||
<br>
|
|
||||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Per il primo accesso devi per prima cosa resettare la password cliccando di seguito</span></p>
|
|
||||||
<br>
|
|
||||||
<a href='https://yogibook.yogasoul.it/public/password/reset' target='_blank' class='v-button v-font-size' style='box-sizing: border-box;display: inline-block;text-decoration: none;-webkit-text-size-adjust: none;text-align: center;color: #FFFFFF; background-color: #3AAEE0; border-radius: 4px;-webkit-border-radius: 4px; -moz-border-radius: 4px; width:auto; max-width:100%; overflow-wrap: break-word; word-break: break-word; word-wrap:break-word; mso-border-alt: none;font-size: 14px;'>
|
|
||||||
<span style='display:block;padding:10px 20px;line-height:120%;'><span style='line-height: 16.8px;'>Reset Password</span></span>
|
|
||||||
</a>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Ci vediamo sul tappetino!</span></p>
|
|
||||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Il Team Yogasoul</span></p>";
|
|
||||||
|
|
||||||
$buttonedit="<a href='https://yogibook.yogasoul.it/' target='_blank' class='v-button v-font-size' style='box-sizing: border-box;display: inline-block;text-decoration: none;-webkit-text-size-adjust: none;text-align: center;color: #FFFFFF; background-color: #3AAEE0; border-radius: 4px;-webkit-border-radius: 4px; -moz-border-radius: 4px; width:auto; max-width:100%; overflow-wrap: break-word; word-break: break-word; word-wrap:break-word; mso-border-alt: none;font-size: 14px;'>
|
$newtimeformat = date("d-m-Y H:i", strtotime($newtime));
|
||||||
<span style='display:block;padding:10px 20px;line-height:120%;'><span style='line-height: 16.8px;'>YogiBook - YogaSoul</span></span>
|
require 'phpmailer/src/Exception.php';
|
||||||
</a>";
|
require 'phpmailer/src/PHPMailer.php';
|
||||||
|
require 'phpmailer/src/SMTP.php';
|
||||||
|
// Mail to client
|
||||||
|
$messageedit = "
|
||||||
|
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 18px; line-height: 34.2px;'><strong><span style='line-height: 34.2px; font-size: 18px;'> Ciao $firstname , </span></strong></span></p>
|
||||||
|
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>La tua richiesta di riprogrammazione è stata accettata! </span></p>
|
||||||
|
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Ecco il dettaglio della riprogrammazione $newtimeformat</span></p>
|
||||||
|
<br>
|
||||||
|
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Per vedere e gestire le tue lezioni clicca qui: https://yogibook.yogasoul.it </span></p>
|
||||||
|
<br>
|
||||||
|
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Per il primo accesso devi per prima cosa resettare la password cliccando di seguito</span></p>
|
||||||
|
<br>
|
||||||
|
<a href='https://yogibook.yogasoul.it/public/password/reset' target='_blank' class='v-button v-font-size' style='box-sizing: border-box;display: inline-block;text-decoration: none;-webkit-text-size-adjust: none;text-align: center;color: #FFFFFF; background-color: #3AAEE0; border-radius: 4px;-webkit-border-radius: 4px; -moz-border-radius: 4px; width:auto; max-width:100%; overflow-wrap: break-word; word-break: break-word; word-wrap:break-word; mso-border-alt: none;font-size: 14px;'>
|
||||||
|
<span style='display:block;padding:10px 20px;line-height:120%;'><span style='line-height: 16.8px;'>Reset Password</span></span>
|
||||||
|
</a>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Ci vediamo sul tappetino!</span></p>
|
||||||
|
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Il Team Yogasoul</span></p>";
|
||||||
|
|
||||||
|
$buttonedit = "<a href='https://yogibook.yogasoul.it/' target='_blank' class='v-button v-font-size' style='box-sizing: border-box;display: inline-block;text-decoration: none;-webkit-text-size-adjust: none;text-align: center;color: #FFFFFF; background-color: #3AAEE0; border-radius: 4px;-webkit-border-radius: 4px; -moz-border-radius: 4px; width:auto; max-width:100%; overflow-wrap: break-word; word-break: break-word; word-wrap:break-word; mso-border-alt: none;font-size: 14px;'>
|
||||||
|
<span style='display:block;padding:10px 20px;line-height:120%;'><span style='line-height: 16.8px;'>YogiBook - YogaSoul</span></span>
|
||||||
|
</a>";
|
||||||
|
|
||||||
$mail = new PHPMailer(true);
|
$mail = new PHPMailer(true);
|
||||||
|
|
||||||
$mail->isSMTP(); // Set mailer to use SMTP
|
$mail->isSMTP(); // Set mailer to use SMTP
|
||||||
$mail->Host = 'mail.yogasoul.it'; // Specify main and backup server
|
$mail->Host = 'mail.yogasoul.it'; // Specify main and backup server
|
||||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||||
$mail->Username = 'info@yogasoul.it'; // SMTP username
|
$mail->Username = 'info@yogasoul.it'; // SMTP username
|
||||||
$mail->Password = '!Testolina88'; // SMTP password
|
$mail->Password = '!Testolina88'; // SMTP password
|
||||||
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
|
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
|
||||||
$mail->Port = '587';
|
$mail->Port = '587';
|
||||||
|
|
||||||
|
|
||||||
include('mail/emailtemplate2.php');
|
include('mail/emailtemplate2.php');
|
||||||
// Email body content
|
// Email body content
|
||||||
|
$htmlContent = $mailmessage1;
|
||||||
|
|
||||||
//$trfnmbmail=$appformn.'r'.$revnumb;
|
$mail->From = 'info@yogasoul.it';
|
||||||
$htmlContent = $mailmessage1;
|
$mail->FromName = 'YogiBook [YogaSoul]';
|
||||||
|
$mail->addAddress($emailuser); // Add a recipient
|
||||||
|
|
||||||
$mail->From = 'info@yogasoul.it';
|
|
||||||
$mail->FromName = 'YogiBook [YogaSoul]';
|
|
||||||
$mail->addAddress($emailuser); // Add a recipient
|
|
||||||
|
|
||||||
|
|
||||||
|
$mail->Subject = "YogiBook - Lezione riprogrammata con successo!";
|
||||||
|
$mail->Body = $htmlContent;
|
||||||
|
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
||||||
|
|
||||||
$mail->Subject = "YogiBook - Lezione riprogrammata con successo!";
|
$mail->send();
|
||||||
$mail->Body = $htmlContent;
|
}
|
||||||
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
|
||||||
|
|
||||||
$mail->send();
|
// Reindirizza alla pagina "pendingbookedclass.php" dopo l'aggiornamento
|
||||||
|
header("Location: pendingbookedclass.php");
|
||||||
//mail sent
|
exit(); // Assicura che il codice successivo non venga eseguito dopo il reindirizzamento
|
||||||
}
|
} else {
|
||||||
|
echo "Errore durante l'esecuzione della query: " . $conn->error;
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
// Reindirizza alla pagina "pendingbookedclass.php" dopo l'aggiornamento
|
|
||||||
header("Location: pendingbookedclass.php");
|
|
||||||
exit(); // Assicura che il codice successivo non venga eseguito dopo il reindirizzamento
|
|
||||||
} else {
|
} else {
|
||||||
echo "Errore durante l'esecuzione della query: " . $stmt->error;
|
echo "Errore durante l'esecuzione della query: " . $stmt->error;
|
||||||
}
|
}
|
||||||
$stmt->close();
|
|
||||||
} else {
|
} else {
|
||||||
echo "Errore nella preparazione della query: " . $conn->error;
|
echo "Errore nella preparazione della query: " . $conn->error;
|
||||||
}
|
}
|
||||||
@@ -117,10 +107,4 @@ $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
|||||||
|
|
||||||
// Chiudi la connessione al database
|
// Chiudi la connessione al database
|
||||||
$conn->close();
|
$conn->close();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+478
-515
File diff suppressed because it is too large
Load Diff
+140
-82
@@ -1,107 +1,165 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use PHPMailer\PHPMailer\PHPMailer;
|
use PHPMailer\PHPMailer\PHPMailer;
|
||||||
use PHPMailer\PHPMailer\Exception;
|
use PHPMailer\PHPMailer\Exception;
|
||||||
?>
|
|
||||||
<?php
|
require_once('include/headscript.php');
|
||||||
|
require 'phpmailer/src/Exception.php';
|
||||||
|
require 'phpmailer/src/PHPMailer.php';
|
||||||
|
require 'phpmailer/src/SMTP.php';
|
||||||
|
|
||||||
|
// Abilita il reporting degli errori per il debug
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
// Recupera i parametri GET
|
||||||
|
$idorder = isset($_GET['idorder']) ? (int)$_GET['idorder'] : 0;
|
||||||
require_once('include/headscript.php');
|
$idnewbooking = isset($_GET['idnewbooking']) ? (int)$_GET['idnewbooking'] : 0;
|
||||||
if (isset($_GET['idorder'])) { $idorder = $_GET['idorder']; }
|
$iduser = isset($_GET['iduser']) ? (int)$_GET['iduser'] : 0;
|
||||||
if (isset($_GET['idnewbooking'])) { $idnewbooking = $_GET['idnewbooking']; }
|
$idservicenew = isset($_GET['idservicenew']) ? (int)$_GET['idservicenew'] : 0;
|
||||||
if (isset($_GET['iduser'])) { $iduser = $_GET['iduser']; }
|
|
||||||
if (isset($_GET['idservicenew'])) { $idservicenew = $_GET['idservicenew']; }
|
|
||||||
|
|
||||||
// Effettua la cancellazione del record nella tabella bookingclass
|
// Valida i parametri richiesti
|
||||||
// Sostituisci questi passaggi con il codice reale per connettersi al database e eseguire la query di cancellazione
|
if ($idorder === 0 || $idnewbooking === 0 || $iduser === 0 || $idservicenew === 0) {
|
||||||
|
die("Errore: Parametri mancanti.");
|
||||||
|
}
|
||||||
|
|
||||||
// Recupera i valori di bookingstart e idserviceschedule dalla tabella bookingclass
|
// Crea la connessione al database
|
||||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
die("Connessione al database fallita: " . $conn->connect_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recupera dateschedule e servicename
|
||||||
$sqlnewbook = "SELECT dateschedule FROM serviceschedule WHERE idserviceschedule = $idnewbooking";
|
$query = "SELECT serviceschedule.dateschedule, service.servicename
|
||||||
$resultnew = $conn->query($sqlnewbook);
|
FROM serviceschedule
|
||||||
|
LEFT JOIN service ON service.idservice = ?
|
||||||
|
WHERE serviceschedule.idserviceschedule = ?";
|
||||||
|
$stmt = $conn->prepare($query);
|
||||||
|
$stmt->bind_param("ii", $idservicenew, $idnewbooking);
|
||||||
|
$stmt->execute();
|
||||||
|
$resultnew = $stmt->get_result();
|
||||||
|
|
||||||
// Estrai il risultato e memorizzalo in $newtime
|
if ($resultnew->num_rows > 0) {
|
||||||
$rownew = $resultnew->fetch_assoc();
|
$rownew = $resultnew->fetch_assoc();
|
||||||
$newtime = $rownew["dateschedule"];
|
$newtime = $rownew['dateschedule'];
|
||||||
|
$servicename = $rownew['servicename'] ?? 'N/D';
|
||||||
|
} else {
|
||||||
|
$stmt->close();
|
||||||
|
$conn->close();
|
||||||
|
die("Errore: Nessun orario trovato per idserviceschedule = $idnewbooking.");
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
// Formatta la data per l'email
|
||||||
|
$newtimeformat = date("d-m-Y H:i", strtotime($newtime));
|
||||||
|
|
||||||
|
// Inserisce la nuova prenotazione in bookingclass
|
||||||
|
$insertQuery = "INSERT INTO bookingclass (idserviceschedule, iduser, prevbookingstart, idprevserviceschedule, idservice, idorder, bookingstart, status)
|
||||||
|
VALUES (?, ?, '0', '0', ?, ?, ?, 'pending')";
|
||||||
|
$stmt = $conn->prepare($insertQuery);
|
||||||
|
$stmt->bind_param("iiiis", $idnewbooking, $iduser, $idservicenew, $idorder, $newtime);
|
||||||
|
if (!$stmt->execute()) {
|
||||||
|
$stmt->close();
|
||||||
|
$conn->close();
|
||||||
|
die("Errore durante l'inserimento della nuova prenotazione: " . $conn->error);
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
// Effettua l'inserimento del nuovo record nella tabella bookingclass
|
// Aggiorna una prenotazione cancellata a pending (se esiste)
|
||||||
$insertQuery = "INSERT INTO bookingclass (idserviceschedule, iduser, prevbookingstart, idprevserviceschedule, idservice, idorder, bookingstart, status)
|
$updateQuery = "UPDATE bookingclass
|
||||||
VALUES ($idnewbooking, $iduser, '0', '0', $idservicenew, $idorder, '$newtime', 'pending')";
|
SET status = 'pending'
|
||||||
$conn->query($insertQuery);
|
WHERE iduser = ? AND idorder = ? AND status = 'cancelled'
|
||||||
|
LIMIT 1";
|
||||||
|
$stmt = $conn->prepare($updateQuery);
|
||||||
|
$stmt->bind_param("ii", $iduser, $idorder);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
// Chiudi la connessione al database
|
// Chiudi la connessione al database
|
||||||
$conn->close();
|
$conn->close();
|
||||||
$newtimeformat = date("d-m-Y H:i", strtotime($newtime));
|
|
||||||
require 'phpmailer/src/Exception.php';
|
// Configura il contenuto dell'email
|
||||||
require 'phpmailer/src/PHPMailer.php';
|
$messageedit = "
|
||||||
require 'phpmailer/src/SMTP.php';
|
<p style='font-size: 14px; line-height: 190%;'>
|
||||||
//mail to client
|
<span style='font-size: 18px; line-height: 34.2px;'>
|
||||||
$messageedit=" <p style='font-size: 14px; line-height: 190%;'><span style='font-size: 18px; line-height: 34.2px;'><strong><span style='line-height: 34.2px; font-size: 18px;'> Ciao $firstname , </span></strong></span></p>
|
<strong>Ciao $firstname,</strong>
|
||||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Hai inviato una richiesta di riprogrammazione della tua lezione </span></p>
|
</span>
|
||||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Ecco il dettaglio della riprogrammazione $newtimeformat</span></p>
|
</p>
|
||||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>La tua richiesta è in fase di accettazione! Verrai avvisata se la riprogrammazione è stata accettata</span></p>
|
<p style='font-size: 14px; line-height: 190%;'>
|
||||||
<br>
|
<span style='font-size: 16px; line-height: 30.4px;'>
|
||||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Per vedere e gestire le tue lezioni clicca qui: https://yogibook.yogasoul.it </span></p>
|
Hai inviato una richiesta di riprogrammazione della tua lezione per il servizio <strong>$servicename</strong>.
|
||||||
<br>
|
</span>
|
||||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Per il primo accesso devi per prima cosa resettare la password cliccando di seguito</span></p>
|
</p>
|
||||||
<br>
|
<p style='font-size: 14px; line-height: 190%;'>
|
||||||
<a href='https://yogibook.yogasoul.it/public/password/reset' target='_blank' class='v-button v-font-size' style='box-sizing: border-box;display: inline-block;text-decoration: none;-webkit-text-size-adjust: none;text-align: center;color: #FFFFFF; background-color: #3AAEE0; border-radius: 4px;-webkit-border-radius: 4px; -moz-border-radius: 4px; width:auto; max-width:100%; overflow-wrap: break-word; word-break: break-word; word-wrap:break-word; mso-border-alt: none;font-size: 14px;'>
|
<span style='font-size: 16px; line-height: 30.4px;'>
|
||||||
<span style='display:block;padding:10px 20px;line-height:120%;'><span style='line-height: 16.8px;'>Reset Password</span></span>
|
Ecco il dettaglio della riprogrammazione: $newtimeformat
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
<p style='font-size: 14px; line-height: 190%;'>
|
||||||
|
<span style='font-size: 16px; line-height: 30.4px;'>
|
||||||
|
La tua richiesta è in fase di accettazione! Verrai avvisata/o se la riprogrammazione è stata accettata.
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
<br>
|
||||||
|
<p style='font-size: 14px; line-height: 190%;'>
|
||||||
|
<span style='font-size: 16px; line-height: 30.4px;'>
|
||||||
|
Per vedere e gestire le tue lezioni clicca qui:
|
||||||
|
<a href='https://yogibook.yogasoul.it'>YogiBook</a>
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
<br>
|
||||||
|
<p style='font-size: 14px; line-height: 190%;'>
|
||||||
|
<span style='font-size: 16px; line-height: 30.4px;'>
|
||||||
|
Per il primo accesso devi prima resettare la password cliccando qui:
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
<br>
|
||||||
|
<a href='https://yogibook.yogasoul.it/public/password/reset' target='_blank' style='box-sizing: border-box; display: inline-block; text-decoration: none; text-align: center; color: #FFFFFF; background-color: #3AAEE0; border-radius: 4px; width: auto; max-width: 100%; font-size: 14px;'>
|
||||||
|
<span style='display: block; padding: 10px 20px; line-height: 120%;'>Reset Password</span>
|
||||||
</a>
|
</a>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Ci vediamo sul tappetino!</span></p>
|
<p style='font-size: 14px; line-height: 190%;'>
|
||||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Il Team Yogasoul</span></p>";
|
<span style='font-size: 16px; line-height: 30.4px;'>
|
||||||
|
Ci vediamo sul tappetino!
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
<p style='font-size: 14px; line-height: 190%;'>
|
||||||
|
<span style='font-size: 16px; line-height: 30.4px;'>
|
||||||
|
Il Team Yogasoul
|
||||||
|
</span>
|
||||||
|
</p>";
|
||||||
|
|
||||||
$buttonedit="<a href='https://yogibook.yogasoul.it/' target='_blank' class='v-button v-font-size' style='box-sizing: border-box;display: inline-block;text-decoration: none;-webkit-text-size-adjust: none;text-align: center;color: #FFFFFF; background-color: #3AAEE0; border-radius: 4px;-webkit-border-radius: 4px; -moz-border-radius: 4px; width:auto; max-width:100%; overflow-wrap: break-word; word-break: break-word; word-wrap:break-word; mso-border-alt: none;font-size: 14px;'>
|
$buttonedit = "<a href='https://yogibook.yogasoul.it/' target='_blank' class='v-button v-font-size' style='box-sizing: border-box; display: inline-block; text-decoration: none; text-align: center; color: #FFFFFF; background-color: #3AAEE0; border-radius: 4px; width: auto; max-width: 100%; font-size: 14px;'>
|
||||||
<span style='display:block;padding:10px 20px;line-height:120%;'><span style='line-height: 16.8px;'>YogiBook - YogaSoul</span></span>
|
<span style='display: block; padding: 10px 20px; line-height: 120%;'>YogiBook - YogaSoul</span>
|
||||||
</a>";
|
</a>";
|
||||||
|
|
||||||
|
|
||||||
$mail = new PHPMailer(true);
|
|
||||||
|
|
||||||
$mail->isSMTP(); // Set mailer to use SMTP
|
|
||||||
$mail->Host = 'mail.yogasoul.it'; // Specify main and backup server
|
|
||||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
|
||||||
$mail->Username = 'info@yogasoul.it'; // SMTP username
|
|
||||||
$mail->Password = '!Testolina88'; // SMTP password
|
|
||||||
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
|
|
||||||
$mail->Port = '587';
|
|
||||||
|
|
||||||
|
|
||||||
|
// Integra $messageedit in $mailmessage1
|
||||||
include('mail/emailtemplate2.php');
|
include('mail/emailtemplate2.php');
|
||||||
// Email body content
|
|
||||||
|
|
||||||
//$trfnmbmail=$appformn.'r'.$revnumb;
|
// Configura l'email
|
||||||
$htmlContent = $mailmessage1;
|
$mail = new PHPMailer(true);
|
||||||
|
try {
|
||||||
|
$mail->isSMTP();
|
||||||
$mail->From = 'info@yogasoul.it';
|
$mail->Host = 'mail.yogasoul.it';
|
||||||
$mail->FromName = 'YogiBook [YogaSoul]';
|
$mail->SMTPAuth = true;
|
||||||
$mail->addAddress($emailuser); // Add a recipient
|
$mail->Username = 'info@yogasoul.it';
|
||||||
|
$mail->Password = '!Testolina88';
|
||||||
|
$mail->SMTPSecure = 'tls';
|
||||||
|
$mail->Port = 587;
|
||||||
|
|
||||||
|
$mail->setFrom('info@yogasoul.it', 'YogiBook [YogaSoul]');
|
||||||
|
$mail->addAddress($emailuser);
|
||||||
|
|
||||||
$mail->Subject = "Proposta di riprogrammazione!";
|
$mail->Subject = "Proposta di riprogrammazione!";
|
||||||
$mail->Body = $htmlContent;
|
$mail->Body = $mailmessage1;
|
||||||
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
$mail->AltBody = 'Hai inviato una richiesta di riprogrammazione della tua lezione per il servizio ' . $servicename . ' il ' . $newtimeformat . '. La tua richiesta è in fase di accettazione.';
|
||||||
|
|
||||||
$mail->send();
|
$mail->send();
|
||||||
|
} catch (Exception $e) {
|
||||||
//mail sent
|
die("Errore durante l'invio dell'email: " . $mail->ErrorInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Esegui il reindirizzamento
|
// Esegui il reindirizzamento
|
||||||
header("Location: userpanel.php?reprogram=Y");
|
header("Location: userpanel.php?reprogram=Y");
|
||||||
exit();
|
exit();
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
ini_set('display_errors', '1');
|
||||||
|
ini_set('display_startup_errors', '1');
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
include('Connections/bkngstm.php');
|
||||||
|
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
die(json_encode(['error' => 'Connessione al database fallita']));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['idorder'])) {
|
||||||
|
$idorder = $_GET['idorder'];
|
||||||
|
|
||||||
|
// Recupera i dati necessari dall'ordine
|
||||||
|
$order_query = "SELECT idservice, quantityclass, first_lesson_date FROM orderbook WHERE idorderbook = ?";
|
||||||
|
$stmt_order = $conn->prepare($order_query);
|
||||||
|
$stmt_order->bind_param("i", $idorder);
|
||||||
|
$stmt_order->execute();
|
||||||
|
$order_result = $stmt_order->get_result();
|
||||||
|
|
||||||
|
if ($order_result->num_rows > 0) {
|
||||||
|
$order_row = $order_result->fetch_assoc();
|
||||||
|
$service_id = $order_row['idservice'];
|
||||||
|
$quantity_class = $order_row['quantityclass'];
|
||||||
|
$first_lesson_date = $order_row['first_lesson_date'];
|
||||||
|
|
||||||
|
// Recupera expirylessons da expiryparameter
|
||||||
|
$expiry_lessons_query = "SELECT expirylessons FROM expiryparameter WHERE quantityclass = ?";
|
||||||
|
$stmt_expiry_lessons = $conn->prepare($expiry_lessons_query);
|
||||||
|
$stmt_expiry_lessons->bind_param("i", $quantity_class);
|
||||||
|
$stmt_expiry_lessons->execute();
|
||||||
|
$expiry_lessons_result = $stmt_expiry_lessons->get_result();
|
||||||
|
|
||||||
|
if ($expiry_lessons_result->num_rows > 0) {
|
||||||
|
$expiry_row = $expiry_lessons_result->fetch_assoc();
|
||||||
|
$expirylessons = $expiry_row['expirylessons'];
|
||||||
|
|
||||||
|
// Calcola la data della expirylessons-esima lezione
|
||||||
|
$expiry_date_query = "SELECT dateschedule FROM serviceschedule WHERE idservice = ? AND dateschedule >= ? ORDER BY dateschedule LIMIT ?, 1";
|
||||||
|
$stmt_expiry_date = $conn->prepare($expiry_date_query);
|
||||||
|
$offset = $expirylessons - 1;
|
||||||
|
$stmt_expiry_date->bind_param("isi", $service_id, $first_lesson_date, $offset);
|
||||||
|
$stmt_expiry_date->execute();
|
||||||
|
$expiry_date_result = $stmt_expiry_date->get_result();
|
||||||
|
|
||||||
|
if ($expiry_date_result->num_rows > 0) {
|
||||||
|
$date_row = $expiry_date_result->fetch_assoc();
|
||||||
|
$expireon = $date_row['dateschedule'];
|
||||||
|
echo json_encode(['expiry_date' => $expireon]);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['error' => 'Non abbastanza lezioni disponibili per calcolare la scadenza']);
|
||||||
|
}
|
||||||
|
$stmt_expiry_date->close();
|
||||||
|
} else {
|
||||||
|
echo json_encode(['error' => 'Nessun record in expiryparameter per quantityclass: ' . $quantity_class]);
|
||||||
|
}
|
||||||
|
$stmt_expiry_lessons->close();
|
||||||
|
} else {
|
||||||
|
echo json_encode(['error' => 'Ordine non trovato']);
|
||||||
|
}
|
||||||
|
$stmt_order->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn->close();
|
||||||
@@ -273,8 +273,8 @@ file_put_contents($logFile, $logMessage, FILE_APPEND);
|
|||||||
confirmButtonText: "Cancella Lezione",
|
confirmButtonText: "Cancella Lezione",
|
||||||
cancelButtonText: "Riprogramma Lezione",
|
cancelButtonText: "Riprogramma Lezione",
|
||||||
showDenyButton: true,
|
showDenyButton: true,
|
||||||
denyButtonText: "Torna al Portale",
|
denyButtonText: "Riprogramma Lezione",
|
||||||
denyButtonColor: "#6c757d"
|
denyButtonColor: "#e47c06ff"
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
console.log("Cliccato 'Cancella Lezione' per ID <?php echo $idbookingclass; ?>");
|
console.log("Cliccato 'Cancella Lezione' per ID <?php echo $idbookingclass; ?>");
|
||||||
@@ -302,7 +302,7 @@ file_put_contents($logFile, $logMessage, FILE_APPEND);
|
|||||||
alert("Errore: impossibile reindirizzare a rebook-from-cancel.php. Controlla la console del browser.");
|
alert("Errore: impossibile reindirizzare a rebook-from-cancel.php. Controlla la console del browser.");
|
||||||
}
|
}
|
||||||
} else if (result.isDenied) {
|
} else if (result.isDenied) {
|
||||||
console.log("Cliccato 'Torna al Portale', reindirizzamento a: https://yogibook.yogasoul.it");
|
console.log("Cliccato 'Riprogramma Lezione', reindirizzamento a: https://yogibook.yogasoul.it");
|
||||||
window.location.replace("rebook-from-cancel.php?idbookingclass=<?php echo $idbookingclass; ?>&token=<?php echo urlencode($token); ?>");
|
window.location.replace("rebook-from-cancel.php?idbookingclass=<?php echo $idbookingclass; ?>&token=<?php echo urlencode($token); ?>");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
Esecuzione cancellazione: 2025-10-13 14:36:02
|
||||||
|
Accesso a modale per ID 4, token: f596e67a-a517-11f0-afe1-145afc4aef92, opzione riprogrammazione: rebook-from-cancel.php?idbookingclass=4&token=f596e67a-a517-11f0-afe1-145afc4aef92
|
||||||
|
Esecuzione cancellazione: 2025-10-13 14:37:22
|
||||||
|
Accesso a modale per ID 4, token: f596e67a-a517-11f0-afe1-145afc4aef92, opzione riprogrammazione: rebook-from-cancel.php?idbookingclass=4&token=f596e67a-a517-11f0-afe1-145afc4aef92
|
||||||
|
Esecuzione cancellazione: 2025-10-13 14:38:20
|
||||||
|
Accesso a modale per ID 4, token: f596e67a-a517-11f0-afe1-145afc4aef92, opzione riprogrammazione: rebook-from-cancel.php?idbookingclass=4&token=f596e67a-a517-11f0-afe1-145afc4aef92
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,173 @@
|
|||||||
|
<?php
|
||||||
|
require_once('Connections/bkngstm.php');
|
||||||
|
require_once('webassist/mysqli/rsobj.php');
|
||||||
|
include('include/headscript.php'); // $iduserlogin
|
||||||
|
|
||||||
|
/***********************
|
||||||
|
* LOG (mail + debug)
|
||||||
|
***********************/
|
||||||
|
$logDir = __DIR__ . '/logs';
|
||||||
|
if (!is_dir($logDir)) {
|
||||||
|
@mkdir($logDir, 0755, true);
|
||||||
|
}
|
||||||
|
$mailLogFile = $logDir . '/mail_cancel.log';
|
||||||
|
|
||||||
|
function mail_log($file, $msg)
|
||||||
|
{
|
||||||
|
@file_put_contents($file, "[" . date("Y-m-d H:i:s") . "] " . $msg . PHP_EOL, FILE_APPEND);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************
|
||||||
|
* INPUT
|
||||||
|
***********************/
|
||||||
|
if (!isset($_GET['id'])) {
|
||||||
|
die("ID non fornito.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = (int)$_GET['id'];
|
||||||
|
$userId = (int)$iduserlogin;
|
||||||
|
|
||||||
|
/***********************
|
||||||
|
* DB
|
||||||
|
***********************/
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
die("Connessione fallita: " . $conn->connect_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************
|
||||||
|
* 1) USER INFO (auth_users)
|
||||||
|
***********************/
|
||||||
|
$stmt = $conn->prepare("SELECT email, first_name, last_name FROM auth_users WHERE id = ? LIMIT 1");
|
||||||
|
$stmt->bind_param("i", $userId);
|
||||||
|
$stmt->execute();
|
||||||
|
$res = $stmt->get_result();
|
||||||
|
$u = $res->fetch_assoc();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
$userEmail = $u['email'] ?? '';
|
||||||
|
$userName = trim(($u['first_name'] ?? '') . ' ' . ($u['last_name'] ?? ''));
|
||||||
|
|
||||||
|
/***********************
|
||||||
|
* 2) BOOKING INFO (nome classe + data) + ownership check
|
||||||
|
***********************/
|
||||||
|
$stmt = $conn->prepare("
|
||||||
|
SELECT
|
||||||
|
bc.idbookingclass,
|
||||||
|
s.servicename,
|
||||||
|
ss.dateschedule
|
||||||
|
FROM bookingclass bc
|
||||||
|
LEFT JOIN service s ON bc.idservice = s.idservice
|
||||||
|
LEFT JOIN serviceschedule ss ON bc.idserviceschedule = ss.idserviceschedule
|
||||||
|
WHERE bc.idbookingclass = ? AND bc.iduser = ?
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
$stmt->bind_param("ii", $id, $userId);
|
||||||
|
$stmt->execute();
|
||||||
|
$res = $stmt->get_result();
|
||||||
|
$bk = $res->fetch_assoc();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
if (!$bk) {
|
||||||
|
$conn->close();
|
||||||
|
header("Location: userpanel.php?deleted=0&err=notfound");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$className = $bk['servicename'] ?? 'Lezione';
|
||||||
|
$classDateRaw = $bk['dateschedule'] ?? null;
|
||||||
|
|
||||||
|
$classDateTxt = $classDateRaw ? date("d-m-Y H:i", strtotime($classDateRaw)) : 'N/D';
|
||||||
|
$cancelDateTxt = date("d-m-Y H:i");
|
||||||
|
|
||||||
|
/***********************
|
||||||
|
* 3) DELETE (safe)
|
||||||
|
***********************/
|
||||||
|
$stmt = $conn->prepare("DELETE FROM bookingclass WHERE idbookingclass = ? AND iduser = ?");
|
||||||
|
$stmt->bind_param("ii", $id, $userId);
|
||||||
|
|
||||||
|
if (!$stmt->execute()) {
|
||||||
|
$err = $stmt->error;
|
||||||
|
$stmt->close();
|
||||||
|
$conn->close();
|
||||||
|
die("Errore durante la cancellazione del record: " . htmlspecialchars($err));
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->close();
|
||||||
|
$conn->close();
|
||||||
|
|
||||||
|
/***********************
|
||||||
|
* 4) EMAIL (TO utente + CC info@yogasoul.it)
|
||||||
|
* Usa le chiavi del tuo .env: MAIL_HOST, MAIL_PORT, MAIL_USERNAME, ...
|
||||||
|
***********************/
|
||||||
|
try {
|
||||||
|
// Carica vendor/autoload + dotenv (il tuo file esistente)
|
||||||
|
require_once(__DIR__ . '/class/mailer.php');
|
||||||
|
|
||||||
|
$mail = new \PHPMailer\PHPMailer\PHPMailer(true);
|
||||||
|
|
||||||
|
// Legge le variabili in stile Laravel (con trim per eventuali virgolette)
|
||||||
|
$host = trim($_ENV['MAIL_HOST'] ?? 'mail.yogasoul.it', "\" \t\n\r\0\x0B");
|
||||||
|
$port = (int)($_ENV['MAIL_PORT'] ?? 465);
|
||||||
|
$user = $_ENV['MAIL_USERNAME'] ?? '';
|
||||||
|
$pass = $_ENV['MAIL_PASSWORD'] ?? '';
|
||||||
|
$enc = strtolower(trim($_ENV['MAIL_ENCRYPTION'] ?? 'ssl', "\" \t\n\r\0\x0B"));
|
||||||
|
|
||||||
|
$fromEmail = trim($_ENV['MAIL_FROM_ADDRESS'] ?? 'info@yogasoul.it', "\" \t\n\r\0\x0B");
|
||||||
|
$fromName = trim($_ENV['MAIL_FROM_NAME'] ?? 'YogiBook', "\" \t\n\r\0\x0B");
|
||||||
|
|
||||||
|
// Config SMTP
|
||||||
|
$mail->isSMTP();
|
||||||
|
$mail->Host = $host;
|
||||||
|
$mail->SMTPAuth = true;
|
||||||
|
$mail->Username = $user;
|
||||||
|
$mail->Password = $pass;
|
||||||
|
$mail->Port = $port;
|
||||||
|
|
||||||
|
if (in_array($enc, ['tls', 'ssl'], true)) {
|
||||||
|
$mail->SMTPSecure = $enc;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Timeout (utile su SMTP hosting)
|
||||||
|
$mail->Timeout = 20;
|
||||||
|
|
||||||
|
$mail->setFrom($fromEmail, $fromName);
|
||||||
|
$mail->CharSet = 'UTF-8';
|
||||||
|
$mail->isHTML(true);
|
||||||
|
|
||||||
|
// Destinatari
|
||||||
|
if (!empty($userEmail)) {
|
||||||
|
$mail->addAddress($userEmail, $userName ?: '');
|
||||||
|
}
|
||||||
|
$mail->addCC('info@yogasoul.it');
|
||||||
|
|
||||||
|
// Log impostazioni usate (senza password)
|
||||||
|
mail_log($mailLogFile, "SMTP in uso host={$host} porta={$port} enc={$enc} user={$user}");
|
||||||
|
|
||||||
|
// Contenuto (ITALIANO)
|
||||||
|
$mail->Subject = "Lezione cancellata - {$className}";
|
||||||
|
$mail->Body = "
|
||||||
|
<div style='font-family:Arial,sans-serif;font-size:14px;color:#222'>
|
||||||
|
<p>Ciao " . htmlspecialchars($userName ?: 'Yogi') . ",</p>
|
||||||
|
<p>La tua lezione è stata <b>cancellata</b>.</p>
|
||||||
|
<p>
|
||||||
|
<b>Lezione:</b> " . htmlspecialchars($className) . "<br>
|
||||||
|
<b>Data/ora prevista:</b> " . htmlspecialchars($classDateTxt) . "<br>
|
||||||
|
<b>Data/ora cancellazione:</b> " . htmlspecialchars($cancelDateTxt) . "<br>
|
||||||
|
<b>ID prenotazione:</b> #{$id}
|
||||||
|
</p>
|
||||||
|
<p>Grazie,<br>— " . htmlspecialchars($fromName) . "</p>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
|
||||||
|
$mail->send();
|
||||||
|
|
||||||
|
mail_log($mailLogFile, "OK inviata. booking_id={$id} user_id={$userId} to={$userEmail} lezione='" . $className . "' prevista='{$classDateTxt}' cancellata='{$cancelDateTxt}'");
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
mail_log($mailLogFile, "ERRORE invio. booking_id={$id} user_id={$userId} to={$userEmail} :: " . $e->getMessage());
|
||||||
|
error_log("Mailer error (delete booking #{$id}, user #{$userId}): " . $e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Redirect
|
||||||
|
header("Location: userpanel.php?deleted=1");
|
||||||
|
exit();
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
ob_start();
|
||||||
|
require_once('include/headscript.php');
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
ob_end_clean();
|
||||||
|
echo json_encode(['error' => 'Connessione al database fallita: ' . $conn->connect_error]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = "SELECT
|
||||||
|
ss.idserviceschedule,
|
||||||
|
s.servicename,
|
||||||
|
COALESCE(s.maxcapacity, 0) AS maxcapacity,
|
||||||
|
DATE_FORMAT(ss.dateschedule, '%d %M %Y %H:%i') AS display_dateschedule,
|
||||||
|
DATE_FORMAT(ss.dateschedule, '%Y-%m-%d %H:%i') AS iso_dateschedule,
|
||||||
|
(SELECT COUNT(*)
|
||||||
|
FROM bookingclass bc
|
||||||
|
WHERE bc.idserviceschedule = ss.idserviceschedule
|
||||||
|
AND bc.status != 'cancelled') AS occupied_seats
|
||||||
|
FROM serviceschedule ss
|
||||||
|
LEFT JOIN service s ON ss.idservice = s.idservice
|
||||||
|
ORDER BY ss.dateschedule ASC";
|
||||||
|
|
||||||
|
$result = $conn->query($query);
|
||||||
|
|
||||||
|
$classes = [];
|
||||||
|
if ($result) {
|
||||||
|
$italianMonths = [
|
||||||
|
'January' => 'Gennaio',
|
||||||
|
'February' => 'Febbraio',
|
||||||
|
'March' => 'Marzo',
|
||||||
|
'April' => 'Aprile',
|
||||||
|
'May' => 'Maggio',
|
||||||
|
'June' => 'Giugno',
|
||||||
|
'July' => 'Luglio',
|
||||||
|
'August' => 'Agosto',
|
||||||
|
'September' => 'Settembre',
|
||||||
|
'October' => 'Ottobre',
|
||||||
|
'November' => 'Novembre',
|
||||||
|
'December' => 'Dicembre'
|
||||||
|
];
|
||||||
|
|
||||||
|
while ($row = $result->fetch_assoc()) {
|
||||||
|
// Traduci il mese in italiano
|
||||||
|
foreach ($italianMonths as $en => $it) {
|
||||||
|
$row['display_dateschedule'] = str_replace($en, $it, $row['display_dateschedule']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assicura che maxcapacity sia positivo
|
||||||
|
if ($row['maxcapacity'] <= 0) {
|
||||||
|
$row['maxcapacity'] = 1; // Valore positivo di fallback, cambialo se necessario
|
||||||
|
}
|
||||||
|
|
||||||
|
$classes[] = $row;
|
||||||
|
}
|
||||||
|
ob_end_clean();
|
||||||
|
echo json_encode(['classes' => $classes]);
|
||||||
|
} else {
|
||||||
|
ob_end_clean();
|
||||||
|
echo json_encode(['error' => 'Errore nella query: ' . $conn->error]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn->close();
|
||||||
@@ -0,0 +1,211 @@
|
|||||||
|
<?php require_once('include/headscript.php'); ?>
|
||||||
|
<?php
|
||||||
|
// Connessione al database
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
die("Connessione fallita: " . $conn->connect_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ID dell'utente (esempio, da sostituire con l'utente loggato)
|
||||||
|
$userid = 1; // Sostituisci con l'ID utente corrente, ad esempio da sessione
|
||||||
|
|
||||||
|
// Query per ottenere il valore di lessonnotification
|
||||||
|
$query = "SELECT lessonnotification FROM auth_users WHERE id = ?";
|
||||||
|
$stmt = $conn->prepare($query);
|
||||||
|
$stmt->bind_param("i", $userid);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
|
if ($result->num_rows > 0) {
|
||||||
|
$row = $result->fetch_assoc();
|
||||||
|
$lessonnotification = $row['lessonnotification'];
|
||||||
|
} else {
|
||||||
|
$lessonnotification = 'Y'; // Valore di default se l'utente non esiste
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->close();
|
||||||
|
$conn->close();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>YogiBook - Opzioni</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta content="YogiBook - Opzioni 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" />
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.custom-card {
|
||||||
|
margin: 20px auto;
|
||||||
|
max-width: 600px;
|
||||||
|
background-color: white;
|
||||||
|
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-card h2 {
|
||||||
|
font-size: 24px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-check {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-check-label {
|
||||||
|
margin-left: 10px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.save-button {
|
||||||
|
background-color: #1ebf73;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 8px 16px;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.save-button:hover {
|
||||||
|
background-color: #18a060;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#lessonnotification').on('change', function() {
|
||||||
|
var isChecked = $(this).is(':checked') ? 'Y' : 'N';
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: 'update_lessonnotification.php',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
userid: <?php echo $userid; ?>,
|
||||||
|
lessonnotification: isChecked
|
||||||
|
},
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(response) {
|
||||||
|
if (response.success) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Successo!',
|
||||||
|
text: 'Impostazione notifiche lezione aggiornata con successo.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Errore!',
|
||||||
|
text: 'Errore durante l\'aggiornamento: ' + response.error,
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonText: 'OK'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Errore!',
|
||||||
|
text: 'Errore durante la richiesta AJAX.',
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonText: 'OK'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<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">Opzioni</h4>
|
||||||
|
</div>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<div class="main-content">
|
||||||
|
<div class="page-content">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xl-12">
|
||||||
|
<div class="custom-card">
|
||||||
|
<h2>Impostazioni Notifiche</h2>
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="checkbox" id="lessonnotification" <?php echo $lessonnotification === 'Y' ? 'checked' : ''; ?>>
|
||||||
|
<label class="form-check-label" for="lessonnotification">
|
||||||
|
Abilita notifiche per le lezioni
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php include('include/footer.php'); ?>
|
||||||
|
</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>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -62,6 +62,13 @@
|
|||||||
<span class="menu-item" data-key="t-email">Profilo utente</span>
|
<span class="menu-item" data-key="t-email">Profilo utente</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="options.php" class="">
|
||||||
|
<i class="bx bx-user-circle icon nav-icon"></i>
|
||||||
|
<span class="menu-item" data-key="t-email">Opzioni</span>
|
||||||
|
</a>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="userprofiledoc.php" class="">
|
<a href="userprofiledoc.php" class="">
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
require_once('Connections/bkngstm.php');
|
||||||
|
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
die(json_encode(['success' => false, 'error' => 'Connessione fallita: ' . $conn->connect_error]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['userid']) && isset($_POST['lessonnotification'])) {
|
||||||
|
$userid = $_POST['userid'];
|
||||||
|
$lessonnotification = $_POST['lessonnotification'];
|
||||||
|
|
||||||
|
// Validate lessonnotification value
|
||||||
|
if (!in_array($lessonnotification, ['Y', 'N'])) {
|
||||||
|
echo json_encode(['success' => false, 'error' => 'Valore lessonnotification non valido']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = "UPDATE auth_users SET lessonnotification = ? WHERE id = ?";
|
||||||
|
$stmt = $conn->prepare($query);
|
||||||
|
$stmt->bind_param("si", $lessonnotification, $userid);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
echo json_encode(['success' => true]);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['success' => false, 'error' => $conn->error]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->close();
|
||||||
|
} else {
|
||||||
|
echo json_encode(['success' => false, 'error' => 'Parametri mancanti']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn->close();
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
[2026-02-18 13:43:57] ERROR sending. booking_id=29 user_id=2 to=info@claudiosironi.com :: SMTP Error: Could not connect to SMTP host. Failed to connect to server
|
||||||
|
[2026-02-18 13:46:10] ERROR sending. booking_id=30 user_id=2 to=info@claudiosironi.com :: SMTP Error: Could not connect to SMTP host. Failed to connect to server
|
||||||
@@ -0,0 +1,212 @@
|
|||||||
|
<?php require_once('include/headscript.php'); ?>
|
||||||
|
<?php
|
||||||
|
// Connessione al database
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
die("Connessione fallita: " . $conn->connect_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ID dell'utente (esempio, da sostituire con l'utente loggato)
|
||||||
|
$userid = 1; // Sostituisci con l'ID utente corrente, ad esempio da sessione
|
||||||
|
|
||||||
|
// Query per ottenere il valore di lessonnotification
|
||||||
|
$query = "SELECT lessonnotification FROM auth_users WHERE id = ?";
|
||||||
|
$stmt = $conn->prepare($query);
|
||||||
|
$stmt->bind_param("i", $userid);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
|
if ($result->num_rows > 0) {
|
||||||
|
$row = $result->fetch_assoc();
|
||||||
|
$lessonnotification = $row['lessonnotification'];
|
||||||
|
} else {
|
||||||
|
$lessonnotification = 'Y'; // Valore di default se l'utente non esiste
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->close();
|
||||||
|
$conn->close();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>YogiBook - Opzioni</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta content="YogiBook - Opzioni 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" />
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.custom-card {
|
||||||
|
margin: 20px auto;
|
||||||
|
max-width: 600px;
|
||||||
|
background-color: white;
|
||||||
|
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-card h2 {
|
||||||
|
font-size: 24px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-check {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-check-label {
|
||||||
|
margin-left: 10px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.save-button {
|
||||||
|
background-color: #1ebf73;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 8px 16px;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.save-button:hover {
|
||||||
|
background-color: #18a060;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#lessonnotification').on('change', function() {
|
||||||
|
var isChecked = $(this).is(':checked') ? 'Y' : 'N';
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: 'update_lessonnotification.php',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
userid: <?php echo $userid; ?>,
|
||||||
|
lessonnotification: isChecked
|
||||||
|
},
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(response) {
|
||||||
|
if (response.success) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Successo!',
|
||||||
|
text: 'Impostazione notifiche lezione aggiornata con successo.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Errore!',
|
||||||
|
text: 'Errore durante l\'aggiornamento: ' + response.error,
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonText: 'OK'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Errore!',
|
||||||
|
text: 'Errore durante la richiesta AJAX.',
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonText: 'OK'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<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">Opzioni</h4>
|
||||||
|
</div>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<div class="main-content">
|
||||||
|
<div class="page-content">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xl-12">
|
||||||
|
<div class="custom-card">
|
||||||
|
<h2>Impostazioni Notifiche</h2>
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="checkbox" id="lessonnotification" <?php echo $lessonnotification === 'Y' ? 'checked' : ''; ?>>
|
||||||
|
<label class="form-check-label" for="lessonnotification">
|
||||||
|
Abilita notifiche per le lezioni
|
||||||
|
</label>
|
||||||
|
<p>con questa notifica riceverai un promemoria qualche ora prima della lezione, che ti permetterà , entro i limiti consentiti, di cancellare o riprogrammare la lezione</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php include('include/footer.php'); ?>
|
||||||
|
</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>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -272,7 +272,7 @@ if (!$result) {
|
|||||||
echo "<td>" . $row['iduser'] . "</td>";
|
echo "<td>" . $row['iduser'] . "</td>";
|
||||||
echo "<td>" . $row['cod'] . "</td>";
|
echo "<td>" . $row['cod'] . "</td>";
|
||||||
echo "<td>" . $row['quantityclass'] . "</td>";
|
echo "<td>" . $row['quantityclass'] . "</td>";
|
||||||
echo "<td>" . "<a href='propagatesingleorder.php?idorder=" . $row['idorderbook'] . "'><button type='button' class='btn btn-success waves-effect btn-label waves-light'><i class='bx bx-check-double label-icon'></i> Propaga</button></a>" . "</td>";
|
echo "<td><button type='button' class='btn btn-success waves-effect btn-label waves-light propagate-btn' data-idorder='" . $row['idorderbook'] . "'><i class='bx bx-check-double label-icon'></i> Propaga</button></td>";
|
||||||
echo "<td>" . "<a href='cancelsingleorder.php?idorder=" . $row['idorderbook'] . "'><button type='button' class='btn btn-danger waves-effect waves-light'><i class='bx bx-block font-size-16 align-middle me-2'></i> Cancella</button></a>" . "</td>";
|
echo "<td>" . "<a href='cancelsingleorder.php?idorder=" . $row['idorderbook'] . "'><button type='button' class='btn btn-danger waves-effect waves-light'><i class='bx bx-block font-size-16 align-middle me-2'></i> Cancella</button></a>" . "</td>";
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
}
|
}
|
||||||
@@ -381,6 +381,55 @@ if (!$result) {
|
|||||||
<script src="assets/libs/simplebar/simplebar.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/libs/eva-icons/eva.min.js"></script>
|
||||||
<script src="assets/js/app.js"></script>
|
<script src="assets/js/app.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.propagate-btn').on('click', function() {
|
||||||
|
var idorder = $(this).data('idorder');
|
||||||
|
|
||||||
|
// Chiama AJAX per calcolare la scadenza
|
||||||
|
$.ajax({
|
||||||
|
url: 'calculate_expiry.php',
|
||||||
|
method: 'GET',
|
||||||
|
data: {
|
||||||
|
idorder: idorder
|
||||||
|
},
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(data) {
|
||||||
|
if (data.error) {
|
||||||
|
Swal.fire('Errore', data.error, 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var calculatedExpiry = data.expiry_date;
|
||||||
|
|
||||||
|
// Mostra modal di conferma
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Conferma Scadenza',
|
||||||
|
html: `
|
||||||
|
<p>Data di scadenza calcolata: <strong>${calculatedExpiry}</strong></p>
|
||||||
|
<label for="expiry-date">Modifica scadenza (se necessario):</label>
|
||||||
|
<input type="date" id="expiry-date" class="swal2-input" value="${calculatedExpiry}">
|
||||||
|
`,
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Conferma e Propaga',
|
||||||
|
cancelButtonText: 'Annulla',
|
||||||
|
preConfirm: () => {
|
||||||
|
return document.getElementById('expiry-date').value;
|
||||||
|
}
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
var expiryDate = result.value || calculatedExpiry; // Usa modificata o originale
|
||||||
|
window.location.href = `propagatesingleorder.php?idorder=${idorder}&expiry_date=${expiryDate}`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
Swal.fire('Errore', 'Impossibile calcolare la scadenza', 'error');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
+178
-104
@@ -1,69 +1,92 @@
|
|||||||
<?php require_once('include/headscript.php'); ?>
|
|
||||||
<?php
|
<?php
|
||||||
// optionquery
|
// Abilita visualizzazione errori PHP (solo per debug)
|
||||||
$optionquery = new WA_MySQLi_RS("optionquery", $bkngstm, 0);
|
ini_set('display_errors', 1);
|
||||||
$optionquery->setQuery("SELECT * FROM option");
|
ini_set('display_startup_errors', 1);
|
||||||
$optionquery->execute();
|
error_reporting(E_ALL);
|
||||||
?>
|
|
||||||
|
require_once('include/headscript.php');
|
||||||
|
|
||||||
|
// Inizializza log
|
||||||
|
$logFile = 'dashboard_log.txt';
|
||||||
|
$logMessage = "Esecuzione dashboard: " . date('Y-m-d H:i:s') . "\n";
|
||||||
|
|
||||||
<?php
|
|
||||||
// Verifica se è stato inviato un modulo
|
// Verifica se è stato inviato un modulo
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
if (isset($_FILES["fileToUpload"]) && $_FILES["fileToUpload"]["error"] === UPLOAD_ERR_OK) {
|
if (isset($_FILES["fileToUpload"]) && $_FILES["fileToUpload"]["error"] === UPLOAD_ERR_OK) {
|
||||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
if ($conn->connect_error) {
|
if ($conn->connect_error) {
|
||||||
|
$logMessage .= "Connessione al database fallita: " . $conn->connect_error . "\n";
|
||||||
|
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||||
die("Connessione al database fallita: " . $conn->connect_error);
|
die("Connessione al database fallita: " . $conn->connect_error);
|
||||||
}
|
}
|
||||||
$iduserlogin = $_POST["iduserlogin"];
|
$iduserlogin = filter_var($_POST["iduserlogin"], FILTER_VALIDATE_INT);
|
||||||
|
$logMessage .= "ID utente ricevuto dal form: $iduserlogin\n";
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
} else {
|
||||||
|
$logMessage .= "Errore caricamento file o iduserlogin non valido\n";
|
||||||
|
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
||||||
<?php
|
// Connessione al database
|
||||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
if ($conn->connect_error) {
|
if ($conn->connect_error) {
|
||||||
|
$logMessage .= "Connessione al database fallita: " . $conn->connect_error . "\n";
|
||||||
|
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||||
die("Connessione al database fallita: " . $conn->connect_error);
|
die("Connessione al database fallita: " . $conn->connect_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Query per selezionare i dati filtrati per iduser
|
$logMessage .= "Database connesso: $dbname\n";
|
||||||
$query = "SELECT o.*, s.servicename, s.day, s.time
|
|
||||||
|
// Query per selezionare i dati filtrati per iduser, inclusi maxreschedule e reprogrammed
|
||||||
|
$iduserlogin = $iduserlogin; // Sostituisci con $iduserlogin in produzione
|
||||||
|
$query = "SELECT o.idorderbook, o.order_id, o.idservice, o.order_date_created, o.quantityclass, o.first_lesson_date, o.expireon, o.maxreschedule, o.reprogrammed, s.servicename, s.day, s.time
|
||||||
FROM orderbook o
|
FROM orderbook o
|
||||||
LEFT JOIN service s ON o.idservice = s.idservice
|
LEFT JOIN service s ON o.idservice = s.idservice
|
||||||
WHERE o.iduser = '$iduserlogin'";
|
WHERE o.iduser = ?";
|
||||||
$result = $conn->query($query);
|
$stmt = $conn->prepare($query);
|
||||||
|
$stmt->bind_param("i", $iduserlogin);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
$documents = array();
|
$documents = array();
|
||||||
while ($row = $result->fetch_assoc()) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
// Get lesson details for each order
|
// Get lesson details for each order
|
||||||
$order_id = $row['order_id'];
|
$idorderbook = $row['idorderbook'];
|
||||||
echo "<!-- Debug: order_id usato: $order_id -->";
|
$logMessage .= "Elaborazione ordine: idorderbook = $idorderbook, order_id = {$row['order_id']}\n";
|
||||||
$lesson_query = "SELECT bc.bookingstart, bc.status, bc.lostlesson, bc.expirylesson, s.servicename
|
|
||||||
|
$lesson_query = "SELECT bc.idbookingclass, bc.bookingstart, bc.status, bc.lostlesson, bc.expirylesson, bc.idservice, bc.is_reprogrammed, s.servicename
|
||||||
FROM bookingclass bc
|
FROM bookingclass bc
|
||||||
LEFT JOIN service s ON bc.idservice = s.idservice
|
LEFT JOIN service s ON bc.idservice = s.idservice
|
||||||
WHERE bc.idorder = '$order_id'";
|
WHERE bc.idorder = ?";
|
||||||
$lesson_result = $conn->query($lesson_query);
|
$lesson_stmt = $conn->prepare($lesson_query);
|
||||||
|
$lesson_stmt->bind_param("i", $idorderbook);
|
||||||
|
$lesson_stmt->execute();
|
||||||
|
$lesson_result = $lesson_stmt->get_result();
|
||||||
|
|
||||||
$lessons = array();
|
$lessons = array();
|
||||||
echo "<!-- Debug: Query per order_id $order_id: $lesson_query -->";
|
$logMessage .= "Query lezioni per idorderbook $idorderbook: $lesson_query\n";
|
||||||
if ($lesson_result) {
|
if ($lesson_result) {
|
||||||
echo "<!-- Debug: Numero di righe restituite: " . $lesson_result->num_rows . " -->";
|
$logMessage .= "Numero di lezioni trovate per idorderbook $idorderbook: " . $lesson_result->num_rows . "\n";
|
||||||
while ($lesson_row = $lesson_result->fetch_assoc()) {
|
while ($lesson_row = $lesson_result->fetch_assoc()) {
|
||||||
$lesson_row['bookingstart'] = date('c', strtotime($lesson_row['bookingstart'])); // Formato ISO 8601
|
$lesson_row['bookingstart'] = date('c', strtotime($lesson_row['bookingstart']));
|
||||||
$lessons[] = $lesson_row;
|
$lessons[] = $lesson_row;
|
||||||
echo "<!-- Debug: Lezione aggiunta: " . json_encode($lesson_row) . " -->";
|
$logMessage .= "Lezione aggiunta: " . json_encode($lesson_row) . "\n";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "<!-- Debug: Errore nella query per order_id $order_id: " . $conn->error . " -->";
|
$logMessage .= "Errore nella query per idorderbook $idorderbook: " . $conn->error . "\n";
|
||||||
}
|
}
|
||||||
$row['lessons'] = $lessons;
|
$row['lessons'] = $lessons;
|
||||||
$documents[] = $row;
|
$documents[] = $row;
|
||||||
echo "<!-- Debug: Lezioni per order_id " . $row['order_id'] . ": " . count($lessons) . " -->";
|
$logMessage .= "Lezioni per idorderbook $idorderbook: " . count($lessons) . "\n";
|
||||||
|
$lesson_stmt->close();
|
||||||
}
|
}
|
||||||
|
$stmt->close();
|
||||||
|
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="it">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
@@ -76,7 +99,7 @@ while ($row = $result->fetch_assoc()) {
|
|||||||
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/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://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
<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/jquery-3.6.0.min.js"></script>
|
<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 src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
||||||
@@ -89,10 +112,11 @@ while ($row = $result->fetch_assoc()) {
|
|||||||
// Handle order click for popup
|
// Handle order click for popup
|
||||||
$('.order-row').click(function() {
|
$('.order-row').click(function() {
|
||||||
var lessons = $(this).data('lessons');
|
var lessons = $(this).data('lessons');
|
||||||
console.log('Lezioni ricevute:', lessons); // Debug
|
console.log('Lezioni ricevute:', lessons);
|
||||||
var total = $(this).data('total');
|
var total = $(this).data('total');
|
||||||
var orderId = $(this).data('order-id');
|
var orderId = $(this).data('order-id');
|
||||||
var isExpired = $(this).data('is-expired');
|
var isExpired = $(this).data('is-expired') === true; // Converti in booleano
|
||||||
|
var expireOn = $(this).data('expireon');
|
||||||
|
|
||||||
// Calcolo delle date
|
// Calcolo delle date
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
@@ -111,6 +135,12 @@ while ($row = $result->fetch_assoc()) {
|
|||||||
}).length;
|
}).length;
|
||||||
var toSchedule = total - (booked + completed + lost + expired);
|
var toSchedule = total - (booked + completed + lost + expired);
|
||||||
|
|
||||||
|
// Se l'ordine è scaduto, sposta le lezioni "Da Programmare" in "Scadute"
|
||||||
|
if (isExpired) {
|
||||||
|
expired += toSchedule;
|
||||||
|
toSchedule = 0;
|
||||||
|
}
|
||||||
|
|
||||||
console.log({
|
console.log({
|
||||||
booked: booked,
|
booked: booked,
|
||||||
completed: completed,
|
completed: completed,
|
||||||
@@ -120,51 +150,61 @@ while ($row = $result->fetch_assoc()) {
|
|||||||
total: total
|
total: total
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var expireOnFormatted = expireOn ? new Date(expireOn).toLocaleDateString('it-IT', {
|
||||||
|
day: '2-digit',
|
||||||
|
month: '2-digit',
|
||||||
|
year: 'numeric'
|
||||||
|
}) : 'Non specificata';
|
||||||
|
|
||||||
var htmlContent = `
|
var htmlContent = `
|
||||||
<h4 style="margin-bottom: 20px; color: #333; font-weight: 600;">
|
<h4 style="margin-bottom: 20px; color: #333; font-weight: 600;">
|
||||||
Dettagli Ordine #${orderId}
|
Dettagli Ordine #${orderId}
|
||||||
<span class="badge ${isExpired ? 'bg-danger' : 'bg-primary'}" style="margin-left: 10px; color: white;">
|
<span class="badge ${isExpired ? 'bg-danger' : 'bg-primary'}" style="margin-left: 10px; color: white;">
|
||||||
${isExpired ? 'Scaduto' : 'Attivo'}
|
${isExpired ? 'Scaduto' : 'Attivo'}
|
||||||
</span>
|
</span>
|
||||||
</h4>
|
</h4>
|
||||||
<div style="display: flex; justify-content: space-around; margin-bottom: 30px; gap: 10px;">
|
<div style="display: flex; justify-content: space-around; margin-bottom: 30px; gap: 10px;">
|
||||||
<div class="stat-box" style="background-color: #d1e7dd; border: 1px solid #a3cfbb;">
|
<div class="stat-box" style="background-color: #d1e7dd; border: 1px solid #a3cfbb;" title="Numero di lezioni acquistate per questo ordine">
|
||||||
<h5 style="margin: 0; color: #0f5132; font-size: 14px;">Totale</h5>
|
<h5 style="margin: 0; color: #0f5132; font-size: 14px;">Totale</h5>
|
||||||
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #0f5132;">${total}</p>
|
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #0f5132;">${total}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-box" style="background-color: #d4edda; border: 1px solid #b1d4b6;">
|
<div class="stat-box" style="background-color: #d4edda; border: 1px solid #b1d4b6;" title="Lezioni già praticate">
|
||||||
<h5 style="margin: 0; color: #155724; font-size: 14px;">Fatte</h5>
|
<h5 style="margin: 0; color: #155724; font-size: 14px;">Praticate</h5>
|
||||||
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #155724;">${completed}</p>
|
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #155724;">${completed}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-box" style="background-color: #f8d7da; border: 1px solid #f1aeb5;">
|
<div class="stat-box" style="background-color: #f8d7da; border: 1px solid #f1aeb5;" title="Lezioni non praticate e non riprogrammate in tempo">
|
||||||
<h5 style="margin: 0; color: #721c24; font-size: 14px;">Perse</h5>
|
<h5 style="margin: 0; color: #721c24; font-size: 14px;">Perse</h5>
|
||||||
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #721c24;">${lost}</p>
|
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #721c24;">${lost}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-box" style="background-color: #fff3cd; border: 1px solid #ffecb5;">
|
<div class="stat-box" style="background-color: #fff3cd; border: 1px solid #ffecb5;" title="Lezioni non riprogrammate entro la data di scadenza dell'ordine">
|
||||||
<h5 style="margin: 0; color: #856404; font-size: 14px;">Scadute</h5>
|
<h5 style="margin: 0; color: #856404; font-size: 14px;">Scadute</h5>
|
||||||
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #856404;">${expired}</p>
|
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #856404;">${expired}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-box" style="background-color: #e2d3f5; border: 1px solid #c3b2d6;">
|
<div class="stat-box" style="background-color: #e2d3f5; border: 1px solid #c3b2d6;" title="Lezioni da programmare entro la data di scadenza del tuo ordine (${expireOnFormatted})">
|
||||||
<h5 style="margin: 0; color: #4c2c92; font-size: 14px;">Da Programmare</h5>
|
<h5 style="margin: 0; color: #4c2c92; font-size: 14px;">Da Programmare</h5>
|
||||||
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #4c2c92;">${toSchedule}</p>
|
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #4c2c92;">${toSchedule}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="background-color: #f8f9fa; padding: 15px; border-radius: 8px;">
|
<div style="background-color: #f8f9fa; padding: 15px; border-radius: 8px;">
|
||||||
<table class="lesson-table">
|
<p style="margin: 0 0 15px 0; color: #333; font-size: 14px; font-weight: 500;">
|
||||||
<thead>
|
Il tuo ordine scadrà il ${expireOnFormatted}
|
||||||
<tr>
|
</p>
|
||||||
<th>Data e Ora</th>
|
<table class="lesson-table">
|
||||||
<th>Lezione</th>
|
<thead>
|
||||||
<th>Stato</th>
|
<tr>
|
||||||
</tr>
|
<th>Data e Ora</th>
|
||||||
</thead>
|
<th>Lezione</th>
|
||||||
<tbody>
|
<th>Stato</th>
|
||||||
`;
|
<th>Riprogrammata</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
`;
|
||||||
|
|
||||||
if (lessons.length === 0) {
|
if (lessons.length === 0) {
|
||||||
htmlContent += `
|
htmlContent += `
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3" style="text-align: center; padding: 10px; color: #666; font-size: 13px;">
|
<td colspan="4" style="text-align: center; padding: 10px; color: #666; font-size: 13px;">
|
||||||
Nessuna lezione trovata per questo ordine.
|
Nessuna lezione trovata per questo ordine.
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -196,6 +236,7 @@ while ($row = $result->fetch_assoc()) {
|
|||||||
statusText = 'Programmata';
|
statusText = 'Programmata';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var isReprogrammedText = lesson.is_reprogrammed === 'Y' ? 'Sì' : 'No';
|
||||||
|
|
||||||
htmlContent += `
|
htmlContent += `
|
||||||
<tr class="${index % 2 === 0 ? 'even-row' : 'odd-row'}">
|
<tr class="${index % 2 === 0 ? 'even-row' : 'odd-row'}">
|
||||||
@@ -210,6 +251,7 @@ while ($row = $result->fetch_assoc()) {
|
|||||||
<td style="padding: 8px;">
|
<td style="padding: 8px;">
|
||||||
<span class="badge ${badgeClass}" style="color: ${badgeTextColor}; padding: 6px 10px; font-size: 12px; font-weight: 500;">${statusText}</span>
|
<span class="badge ${badgeClass}" style="color: ${badgeTextColor}; padding: 6px 10px; font-size: 12px; font-weight: 500;">${statusText}</span>
|
||||||
</td>
|
</td>
|
||||||
|
<td style="padding: 8px; font-size: 13px;">${isReprogrammedText}</td>
|
||||||
</tr>
|
</tr>
|
||||||
`;
|
`;
|
||||||
});
|
});
|
||||||
@@ -234,17 +276,16 @@ while ($row = $result->fetch_assoc()) {
|
|||||||
|
|
||||||
// Handle details button click
|
// Handle details button click
|
||||||
$('.details-btn').click(function(e) {
|
$('.details-btn').click(function(e) {
|
||||||
e.stopPropagation(); // Prevent row click event
|
e.stopPropagation();
|
||||||
var row = $(this).closest('tr');
|
var row = $(this).closest('tr');
|
||||||
var lessons = row.data('lessons');
|
var lessons = row.data('lessons');
|
||||||
var total = row.data('total');
|
var total = row.data('total');
|
||||||
var orderId = row.data('order-id');
|
var orderId = row.data('order-id');
|
||||||
var isExpired = row.data('is-expired');
|
var isExpired = row.data('is-expired') === true;
|
||||||
|
var expireOn = row.data('expireon');
|
||||||
|
|
||||||
// Calcolo delle date
|
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
|
|
||||||
// Calcolo dei conteggi
|
|
||||||
var completed = lessons.filter(l => {
|
var completed = lessons.filter(l => {
|
||||||
var lessonDate = new Date(l.bookingstart);
|
var lessonDate = new Date(l.bookingstart);
|
||||||
return (l.status === 'completed') ||
|
return (l.status === 'completed') ||
|
||||||
@@ -258,6 +299,18 @@ while ($row = $result->fetch_assoc()) {
|
|||||||
}).length;
|
}).length;
|
||||||
var toSchedule = total - (booked + completed + lost + expired);
|
var toSchedule = total - (booked + completed + lost + expired);
|
||||||
|
|
||||||
|
// Se l'ordine è scaduto, sposta le lezioni "Da Programmare" in "Scadute"
|
||||||
|
if (isExpired) {
|
||||||
|
expired += toSchedule;
|
||||||
|
toSchedule = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
var expireOnFormatted = expireOn ? new Date(expireOn).toLocaleDateString('it-IT', {
|
||||||
|
day: '2-digit',
|
||||||
|
month: '2-digit',
|
||||||
|
year: 'numeric'
|
||||||
|
}) : 'Non specificata';
|
||||||
|
|
||||||
var htmlContent = `
|
var htmlContent = `
|
||||||
<h4 style="margin-bottom: 20px; color: #333; font-weight: 600;">
|
<h4 style="margin-bottom: 20px; color: #333; font-weight: 600;">
|
||||||
Dettagli Ordine #${orderId}
|
Dettagli Ordine #${orderId}
|
||||||
@@ -266,23 +319,23 @@ while ($row = $result->fetch_assoc()) {
|
|||||||
</span>
|
</span>
|
||||||
</h4>
|
</h4>
|
||||||
<div style="display: flex; justify-content: space-around; margin-bottom: 30px; gap: 10px;">
|
<div style="display: flex; justify-content: space-around; margin-bottom: 30px; gap: 10px;">
|
||||||
<div class="stat-box" style="background-color: #d1e7dd; border: 1px solid #a3cfbb;">
|
<div class="stat-box" style="background-color: #d1e7dd; border: 1px solid #a3cfbb;" title="Numero di lezioni acquistate per questo ordine">
|
||||||
<h5 style="margin: 0; color: #0f5132; font-size: 14px;">Totale</h5>
|
<h5 style="margin: 0; color: #0f5132; font-size: 14px;">Totale</h5>
|
||||||
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #0f5132;">${total}</p>
|
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #0f5132;">${total}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-box" style="background-color: #d4edda; border: 1px solid #b1d4b6;">
|
<div class="stat-box" style="background-color: #d4edda; border: 1px solid #b1d4b6;" title="Lezioni già praticate">
|
||||||
<h5 style="margin: 0; color: #155724; font-size: 14px;">Fatte</h5>
|
<h5 style="margin: 0; color: #155724; font-size: 14px;">Praticate</h5>
|
||||||
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #155724;">${completed}</p>
|
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #155724;">${completed}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-box" style="background-color: #f8d7da; border: 1px solid #f1aeb5;">
|
<div class="stat-box" style="background-color: #f8d7da; border: 1px solid #f1aeb5;" title="Lezioni non praticate e non riprogrammate in tempo">
|
||||||
<h5 style="margin: 0; color: #721c24; font-size: 14px;">Perse</h5>
|
<h5 style="margin: 0; color: #721c24; font-size: 14px;">Perse</h5>
|
||||||
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #721c24;">${lost}</p>
|
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #721c24;">${lost}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-box" style="background-color: #fff3cd; border: 1px solid #ffecb5;">
|
<div class="stat-box" style="background-color: #fff3cd; border: 1px solid #ffecb5;" title="Lezioni non riprogrammate entro la data di scadenza dell'ordine">
|
||||||
<h5 style="margin: 0; color: #856404; font-size: 14px;">Scadute</h5>
|
<h5 style="margin: 0; color: #856404; font-size: 14px;">Scadute</h5>
|
||||||
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #856404;">${expired}</p>
|
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #856404;">${expired}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-box" style="background-color: #e2d3f5; border: 1px solid #c3b2d6;">
|
<div class="stat-box" style="background-color: #e2d3f5; border: 1px solid #c3b2d6;" title="Lezioni da programmare entro la data di scadenza del tuo ordine (${expireOnFormatted})">
|
||||||
<h5 style="margin: 0; color: #4c2c92; font-size: 14px;">Da Programmare</h5>
|
<h5 style="margin: 0; color: #4c2c92; font-size: 14px;">Da Programmare</h5>
|
||||||
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #4c2c92;">${toSchedule}</p>
|
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #4c2c92;">${toSchedule}</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -294,6 +347,7 @@ while ($row = $result->fetch_assoc()) {
|
|||||||
<th>Data e Ora</th>
|
<th>Data e Ora</th>
|
||||||
<th>Lezione</th>
|
<th>Lezione</th>
|
||||||
<th>Stato</th>
|
<th>Stato</th>
|
||||||
|
<th>Riprogrammata</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -302,7 +356,7 @@ while ($row = $result->fetch_assoc()) {
|
|||||||
if (lessons.length === 0) {
|
if (lessons.length === 0) {
|
||||||
htmlContent += `
|
htmlContent += `
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3" style="text-align: center; padding: 10px; color: #666; font-size: 13px;">
|
<td colspan="4" style="text-align: center; padding: 10px; color: #666; font-size: 13px;">
|
||||||
Nessuna lezione trovata per questo ordine.
|
Nessuna lezione trovata per questo ordine.
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -334,6 +388,7 @@ while ($row = $result->fetch_assoc()) {
|
|||||||
statusText = 'Programmata';
|
statusText = 'Programmata';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var isReprogrammedText = lesson.is_reprogrammed === 'Y' ? 'Sì' : 'No';
|
||||||
|
|
||||||
htmlContent += `
|
htmlContent += `
|
||||||
<tr class="${index % 2 === 0 ? 'even-row' : 'odd-row'}">
|
<tr class="${index % 2 === 0 ? 'even-row' : 'odd-row'}">
|
||||||
@@ -348,6 +403,7 @@ while ($row = $result->fetch_assoc()) {
|
|||||||
<td style="padding: 8px;">
|
<td style="padding: 8px;">
|
||||||
<span class="badge ${badgeClass}" style="color: ${badgeTextColor}; padding: 6px 10px; font-size: 12px; font-weight: 500;">${statusText}</span>
|
<span class="badge ${badgeClass}" style="color: ${badgeTextColor}; padding: 6px 10px; font-size: 12px; font-weight: 500;">${statusText}</span>
|
||||||
</td>
|
</td>
|
||||||
|
<td style="padding: 8px; font-size: 13px;">${isReprogrammedText}</td>
|
||||||
</tr>
|
</tr>
|
||||||
`;
|
`;
|
||||||
});
|
});
|
||||||
@@ -369,24 +425,24 @@ while ($row = $result->fetch_assoc()) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
function confirmDelete(id, deletePageUrl) {
|
function confirmDelete(id, deletePageUrl) {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Sei sicuro?",
|
title: "Sei sicuro?",
|
||||||
text: "Questa prenotazione verrà cancellata definitivamente! Ricordati poi di riprogrammare la tua lezione!",
|
text: "Questa prenotazione verrà cancellata definitivamente! Ricordati poi di riprogrammare la tua lezione!",
|
||||||
icon: "warning",
|
icon: "warning",
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: "#d33",
|
confirmButtonColor: "#d33",
|
||||||
cancelButtonColor: "#3085d6",
|
cancelButtonColor: "#3085d6",
|
||||||
confirmButtonText: "Sì, cancella!",
|
confirmButtonText: "Sì, cancella!",
|
||||||
cancelButtonText: "Annulla"
|
cancelButtonText: "Annulla"
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
window.location.href = `deleteclass.php?id=${id}`;
|
window.location.href = `deleteclass.php?id=${id}`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.custom-card {
|
.custom-card {
|
||||||
@@ -624,33 +680,48 @@ while ($row = $result->fetch_assoc()) {
|
|||||||
<th>N. Ticket</th>
|
<th>N. Ticket</th>
|
||||||
<th>Prima Lezione</th>
|
<th>Prima Lezione</th>
|
||||||
<th>Scadenza</th>
|
<th>Scadenza</th>
|
||||||
|
<th>Riprogr. Massime</th>
|
||||||
|
<th>Riprogrammate</th>
|
||||||
<th>Stato</th>
|
<th>Stato</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($documents as $document) {
|
<?php foreach ($documents as $document) {
|
||||||
$is_expired = strtotime($document['expireon']) < time();
|
$is_expired = strtotime($document['expireon']) < time();
|
||||||
|
$logMessage .= "Order ID: {$document['idorderbook']}, Lessons count: " . count($document['lessons']) . "\n";
|
||||||
?>
|
?>
|
||||||
<tr class="order-row"
|
<tr class="order-row"
|
||||||
data-lessons='<?php echo json_encode($document['lessons']); ?>'
|
data-lessons='<?php echo json_encode($document['lessons']); ?>'
|
||||||
data-total='<?php echo $document['quantityclass']; ?>'
|
data-total='<?php echo $document['quantityclass']; ?>'
|
||||||
data-order-id='<?php echo $document['order_id']; ?>'
|
data-order-id='<?php echo $document['idorderbook']; ?>'
|
||||||
data-is-expired='<?php echo $is_expired ? 'true' : 'false'; ?>'>
|
data-is-expired='<?php echo $is_expired ? 'true' : 'false'; ?>'
|
||||||
<td><?php echo $document['order_id']; ?></td>
|
data-expireon='<?php echo $document['expireon']; ?>'>
|
||||||
|
<td><?php echo $document['idorderbook']; ?></td>
|
||||||
<td><?php echo date('d-m-Y', strtotime($document['order_date_created'])); ?></td>
|
<td><?php echo date('d-m-Y', strtotime($document['order_date_created'])); ?></td>
|
||||||
<td><?php echo $document['servicename']; ?></td>
|
<td><?php echo $document['servicename']; ?></td>
|
||||||
<td><?php echo $document['day'] . ' ' . $document['time']; ?></td>
|
<td><?php echo $document['day'] . ' ' . $document['time']; ?></td>
|
||||||
<td><?php echo $document['quantityclass']; ?></td>
|
<td><?php echo $document['quantityclass']; ?></td>
|
||||||
<td><?php echo $document['first_lesson_date'] ? date('d-m-Y', strtotime($document['first_lesson_date'])) : '-'; ?></td>
|
<td><?php echo $document['first_lesson_date'] ? date('d-m-Y', strtotime($document['first_lesson_date'])) : '-'; ?></td>
|
||||||
<td><?php echo date('d-m-Y', strtotime($document['expireon'])); ?></td>
|
<td style="<?php echo $is_expired ? 'color: #dc3545;' : ''; ?>">
|
||||||
|
<?php echo date('d-m-Y', strtotime($document['expireon'])); ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span style="display: inline-block; padding: 4px 8px; font-size: 11px; font-weight: 500; color: #fff; background-color: #17a2b8; border-radius: 4px;">
|
||||||
|
<?php echo $document['maxreschedule']; ?>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span style="display: inline-block; padding: 4px 8px; font-size: 11px; font-weight: 500; color: #fff; background-color: <?php echo ($document['reprogrammed'] >= $document['maxreschedule']) ? '#dc3545' : '#28a745'; ?>; border-radius: 4px;">
|
||||||
|
<?php echo $document['reprogrammed']; ?>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="badge <?php echo $is_expired ? 'bg-danger' : 'bg-primary'; ?>">
|
<span class="badge <?php echo $is_expired ? 'bg-danger' : 'bg-primary'; ?>">
|
||||||
<?php echo $is_expired ? 'Scaduto' : 'Attivo'; ?>
|
<?php echo $is_expired ? 'Scaduto' : 'Attivo'; ?>
|
||||||
</span>
|
</span>
|
||||||
<button class="details-btn" data-order-id="<?php echo $document['order_id']; ?>" data-lessons='<?php echo json_encode($document['lessons']); ?>' data-total='<?php echo $document['quantityclass']; ?>' data-is-expired='<?php echo $is_expired ? 'true' : 'false'; ?>'>Dettagli</button>
|
<button class="details-btn">Dettagli</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php echo "<!-- Total per order_id " . $document['order_id'] . ": " . $document['quantityclass'] . " -->"; ?>
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -671,4 +742,7 @@ while ($row = $result->fetch_assoc()) {
|
|||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
<?php $conn->close(); ?>
|
<?php
|
||||||
|
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||||
|
$conn->close();
|
||||||
|
?>
|
||||||
+47
-45
@@ -8,6 +8,8 @@ $conn = new mysqli($servername, $username, $password, $dbname);
|
|||||||
if ($conn->connect_error) {
|
if ($conn->connect_error) {
|
||||||
die("Connessione fallita: " . $conn->connect_error);
|
die("Connessione fallita: " . $conn->connect_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gestione del messaggio GET
|
||||||
if (isset($_GET['message'])) {
|
if (isset($_GET['message'])) {
|
||||||
$message = $_GET['message'];
|
$message = $_GET['message'];
|
||||||
} else {
|
} else {
|
||||||
@@ -31,20 +33,6 @@ if (isset($_POST['submit'])) {
|
|||||||
$stmt->close();
|
$stmt->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gestione dell'aggiornamento della data di scadenza
|
|
||||||
if (isset($_POST['update_expiry'])) {
|
|
||||||
$order_id = $_POST['order_id'];
|
|
||||||
$new_expiry = $_POST['new_expiry'];
|
|
||||||
$stmt = $conn->prepare("UPDATE orderbook SET expireon = ? WHERE order_id = ?");
|
|
||||||
$stmt->bind_param("si", $new_expiry, $order_id);
|
|
||||||
if ($stmt->execute()) {
|
|
||||||
$message = 'success';
|
|
||||||
} else {
|
|
||||||
$message = 'error';
|
|
||||||
}
|
|
||||||
$stmt->close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Gestione del filtro per gli ordini
|
// Gestione del filtro per gli ordini
|
||||||
$filter = isset($_GET['filter']) ? $_GET['filter'] : 'all';
|
$filter = isset($_GET['filter']) ? $_GET['filter'] : 'all';
|
||||||
$today = date("Y-m-d");
|
$today = date("Y-m-d");
|
||||||
@@ -56,11 +44,11 @@ if ($filter == 'active') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Query SQL per recuperare tutti gli ordini con join su service
|
// Query SQL per recuperare tutti gli ordini con join su service
|
||||||
$query = "SELECT o.order_id, o.first_name, o.last_name, s.servicename, o.expireon, o.status, o.nticket
|
$query = "SELECT o.idorderbook, o.first_name, o.last_name, s.servicename, o.expireon, o.status, o.nticket
|
||||||
FROM orderbook o
|
FROM orderbook o
|
||||||
LEFT JOIN service s ON o.idservice = s.idservice
|
LEFT JOIN service s ON o.idservice = s.idservice
|
||||||
$whereClause
|
$whereClause
|
||||||
ORDER BY o.order_id DESC";
|
ORDER BY o.idorderbook DESC";
|
||||||
$result = $conn->query($query);
|
$result = $conn->query($query);
|
||||||
$orders = [];
|
$orders = [];
|
||||||
if ($result->num_rows > 0) {
|
if ($result->num_rows > 0) {
|
||||||
@@ -113,6 +101,7 @@ if ($result_dayoff->num_rows > 0) {
|
|||||||
minDate: 0,
|
minDate: 0,
|
||||||
onSelect: function(dateText) {
|
onSelect: function(dateText) {
|
||||||
let orderId = $(this).data('order-id');
|
let orderId = $(this).data('order-id');
|
||||||
|
console.log("Datepicker selezionato - idorderbook: " + orderId + ", newExpiry: " + dateText);
|
||||||
confirmUpdate(orderId, dateText);
|
confirmUpdate(orderId, dateText);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -122,12 +111,21 @@ if ($result_dayoff->num_rows > 0) {
|
|||||||
$(document).on('click', '.expiry-date', function() {
|
$(document).on('click', '.expiry-date', function() {
|
||||||
let orderId = $(this).data('order-id');
|
let orderId = $(this).data('order-id');
|
||||||
let currentDate = $(this).text().trim();
|
let currentDate = $(this).text().trim();
|
||||||
|
console.log("Clic su expiry-date - idorderbook: " + orderId + ", currentDate: " + currentDate);
|
||||||
|
if (!orderId) {
|
||||||
|
Swal.fire('Errore!', 'ID ordine non valido.', 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
$(this).html(`<input type="text" class="form-control expiryDateInput" data-order-id="${orderId}" value="${currentDate}" />`);
|
$(this).html(`<input type="text" class="form-control expiryDateInput" data-order-id="${orderId}" value="${currentDate}" />`);
|
||||||
$(this).find('.expiryDateInput').focus();
|
$(this).find('.expiryDateInput').focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Funzione per confermare l'aggiornamento della scadenza
|
// Funzione per confermare l'aggiornamento della scadenza
|
||||||
function confirmUpdate(orderId, newExpiry) {
|
function confirmUpdate(orderId, newExpiry) {
|
||||||
|
let originalCell = $(`td.expiry-date[data-order-id="${orderId}"]`);
|
||||||
|
let originalDate = originalCell.text().trim();
|
||||||
|
console.log("Invio AJAX - idorderbook: " + orderId + ", new_expiry: " + newExpiry);
|
||||||
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Sei sicuro?",
|
title: "Sei sicuro?",
|
||||||
text: "La data di scadenza verrà modificata!",
|
text: "La data di scadenza verrà modificata!",
|
||||||
@@ -139,35 +137,42 @@ if ($result_dayoff->num_rows > 0) {
|
|||||||
cancelButtonText: "Annulla"
|
cancelButtonText: "Annulla"
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
let form = $('<form>', {
|
$.ajax({
|
||||||
'method': 'POST',
|
url: 'update_expiry.php',
|
||||||
'action': ''
|
type: 'POST',
|
||||||
}).append(
|
data: {
|
||||||
$('<input>', {
|
order_id: orderId,
|
||||||
'type': 'hidden',
|
new_expiry: newExpiry,
|
||||||
'name': 'order_id',
|
update_expiry: 1
|
||||||
'value': orderId
|
},
|
||||||
}),
|
dataType: 'json',
|
||||||
$('<input>', {
|
success: function(response) {
|
||||||
'type': 'hidden',
|
console.log("Risposta AJAX:", response);
|
||||||
'name': 'new_expiry',
|
if (response.status === 'success') {
|
||||||
'value': newExpiry
|
Swal.fire('Successo!', response.message, 'success');
|
||||||
}),
|
originalCell.text(newExpiry);
|
||||||
$('<input>', {
|
} else {
|
||||||
'type': 'hidden',
|
Swal.fire('Errore!', response.message, 'error');
|
||||||
'name': 'update_expiry',
|
originalCell.text(originalDate);
|
||||||
'value': '1'
|
}
|
||||||
})
|
},
|
||||||
);
|
error: function(xhr, status, error) {
|
||||||
$('body').append(form);
|
console.error('Errore AJAX:', {
|
||||||
form.submit();
|
status: status,
|
||||||
|
error: error,
|
||||||
|
responseText: xhr.responseText
|
||||||
|
});
|
||||||
|
Swal.fire('Errore!', 'Errore durante la richiesta al server: ' + error, 'error');
|
||||||
|
originalCell.text(originalDate);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
location.reload();
|
originalCell.text(originalDate);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Funzione per confermare la cancellazione (mantenuta dal template originale)
|
// Funzione per confermare la cancellazione
|
||||||
function confirmDelete(id, deletePageUrl) {
|
function confirmDelete(id, deletePageUrl) {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Sei sicuro?",
|
title: "Sei sicuro?",
|
||||||
@@ -343,9 +348,6 @@ if ($result_dayoff->num_rows > 0) {
|
|||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<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">
|
||||||
@@ -379,12 +381,12 @@ if ($result_dayoff->num_rows > 0) {
|
|||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class="<?php echo $badgeClass; ?>"><?php echo $badgeText; ?></span></td>
|
<td><span class="<?php echo $badgeClass; ?>"><?php echo $badgeText; ?></span></td>
|
||||||
<td><?php echo $order["order_id"]; ?></td>
|
<td><?php echo $order["idorderbook"]; ?></td>
|
||||||
<td><?php echo $order["first_name"]; ?></td>
|
<td><?php echo $order["first_name"]; ?></td>
|
||||||
<td><?php echo $order["last_name"]; ?></td>
|
<td><?php echo $order["last_name"]; ?></td>
|
||||||
<td><?php echo $order["servicename"]; ?></td>
|
<td><?php echo $order["servicename"]; ?></td>
|
||||||
<td><?php echo $order["nticket"]; ?></td>
|
<td><?php echo $order["nticket"]; ?></td>
|
||||||
<td class="expiry-date" data-order-id="<?php echo $order['order_id']; ?>"><?php echo $order["expireon"]; ?></td>
|
<td class="expiry-date" data-order-id="<?php echo $order['idorderbook']; ?>"><?php echo $order["expireon"]; ?></td>
|
||||||
<td><?php echo $order["status"]; ?></td>
|
<td><?php echo $order["status"]; ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[15-Oct-2025 15:13:11 UTC] Tentativo di aggiornamento AJAX - idorderbook: 1, new_expiry: 2025-10-16
|
||||||
|
[15-Oct-2025 15:13:19 UTC] Tentativo di aggiornamento AJAX - idorderbook: 1, new_expiry: 2025-10-15
|
||||||
|
[15-Oct-2025 15:13:58 UTC] Tentativo di aggiornamento AJAX - idorderbook: 1, new_expiry: 2025-10-30
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<?php phpinfo();
|
||||||
@@ -2,3 +2,18 @@ Esecuzione cron: 2025-10-08 13:39:42
|
|||||||
Esecuzione cron: 2025-10-08 13:40:48
|
Esecuzione cron: 2025-10-08 13:40:48
|
||||||
Esecuzione cron: 2025-10-08 13:54:46
|
Esecuzione cron: 2025-10-08 13:54:46
|
||||||
Email inviata a info@claudiosironi.com per lezione ID 8 (09-10-2025 18:15)
|
Email inviata a info@claudiosironi.com per lezione ID 8 (09-10-2025 18:15)
|
||||||
|
Esecuzione cron: 2025-10-13 14:29:12
|
||||||
|
Generati 0 token UUID per prenotazioni senza token.
|
||||||
|
Email inviata a info@claudiosironi.com per lezione ID 4 (14-10-2025 18:15)
|
||||||
|
Esecuzione cron: 2025-11-26 16:39:15
|
||||||
|
Generati 7 token UUID per prenotazioni senza token.
|
||||||
|
Nessuna prenotazione trovata per domani (dalle 17:00) o dopodomani (fino alle 16:59).
|
||||||
|
Esecuzione cron: 2025-11-26 16:44:22
|
||||||
|
Generati 0 token UUID per prenotazioni senza token.
|
||||||
|
Nessuna prenotazione trovata per domani (dalle 17:00) o dopodomani (fino alle 16:59).
|
||||||
|
Esecuzione cron: 2025-11-26 16:44:25
|
||||||
|
Generati 0 token UUID per prenotazioni senza token.
|
||||||
|
Nessuna prenotazione trovata per domani (dalle 17:00) o dopodomani (fino alle 16:59).
|
||||||
|
Esecuzione cron: 2025-11-26 16:44:28
|
||||||
|
Generati 0 token UUID per prenotazioni senza token.
|
||||||
|
Nessuna prenotazione trovata per domani (dalle 17:00) o dopodomani (fino alle 16:59).
|
||||||
|
|||||||
@@ -153,12 +153,78 @@ if ($service_schedule_result->num_rows > 0) {
|
|||||||
$stmt_status->close();
|
$stmt_status->close();
|
||||||
echo "Aggiornato lo status a 'booked' per l'ordine ID: $order_id\n";
|
echo "Aggiornato lo status a 'booked' per l'ordine ID: $order_id\n";
|
||||||
|
|
||||||
|
// Gestione della scadenza: usa il parametro GET se fornito, altrimenti calcola come prima (ma qui assumo sia già calcolato via AJAX, per fallback calcola)
|
||||||
|
$expireon = null;
|
||||||
|
if (isset($_GET['expiry_date']) && !empty($_GET['expiry_date'])) {
|
||||||
|
$expireon = $_GET['expiry_date'];
|
||||||
|
} else {
|
||||||
|
// Fallback: calcola se non fornito (copia la logica da calculate_expiry.php se vuoi mantenerla)
|
||||||
|
$expiry_lessons_query = "SELECT expirylessons FROM expiryparameter WHERE quantityclass = ?";
|
||||||
|
$stmt_expiry_lessons = $conn->prepare($expiry_lessons_query);
|
||||||
|
$stmt_expiry_lessons->bind_param("i", $quantity_class);
|
||||||
|
$stmt_expiry_lessons->execute();
|
||||||
|
$expiry_lessons_result = $stmt_expiry_lessons->get_result();
|
||||||
|
if ($expiry_lessons_result->num_rows > 0) {
|
||||||
|
$expiry_row = $expiry_lessons_result->fetch_assoc();
|
||||||
|
$expirylessons = $expiry_row['expirylessons'];
|
||||||
|
$expiry_date_query = "SELECT dateschedule FROM serviceschedule WHERE idservice = ? AND dateschedule >= ? ORDER BY dateschedule LIMIT ?, 1";
|
||||||
|
$stmt_expiry_date = $conn->prepare($expiry_date_query);
|
||||||
|
$offset = $expirylessons - 1;
|
||||||
|
$stmt_expiry_date->bind_param("isi", $service_id, $first_lesson_date, $offset);
|
||||||
|
$stmt_expiry_date->execute();
|
||||||
|
$expiry_date_result = $stmt_expiry_date->get_result();
|
||||||
|
if ($expiry_date_result->num_rows > 0) {
|
||||||
|
$date_row = $expiry_date_result->fetch_assoc();
|
||||||
|
$expireon = $date_row['dateschedule'];
|
||||||
|
}
|
||||||
|
$stmt_expiry_date->close();
|
||||||
|
}
|
||||||
|
$stmt_expiry_lessons->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($expireon) {
|
||||||
|
// Aggiorna expireon
|
||||||
|
$update_expiry_query = "UPDATE orderbook SET expireon = ? WHERE idorderbook = ?";
|
||||||
|
$stmt_update_expiry = $conn->prepare($update_expiry_query);
|
||||||
|
$stmt_update_expiry->bind_param("si", $expireon, $order_id);
|
||||||
|
$stmt_update_expiry->execute();
|
||||||
|
$stmt_update_expiry->close();
|
||||||
|
echo "Aggiornata la colonna expireon per l'ordine ID: $order_id ($expireon)\n";
|
||||||
|
} else {
|
||||||
|
echo "Nessuna scadenza impostata per l'ordine ID: $order_id\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recupera e aggiorna maxreschedule (invariato)
|
||||||
|
$reschedule_number_query = "SELECT reschedulenumber FROM expiryparameter WHERE quantityclass = ?";
|
||||||
|
$stmt_reschedule = $conn->prepare($reschedule_number_query);
|
||||||
|
$stmt_reschedule->bind_param("i", $quantity_class);
|
||||||
|
$stmt_reschedule->execute();
|
||||||
|
$reschedule_number_result = $stmt_reschedule->get_result();
|
||||||
|
|
||||||
|
if ($reschedule_number_result && $reschedule_number_result->num_rows > 0) {
|
||||||
|
$reschedule_row = $reschedule_number_result->fetch_assoc();
|
||||||
|
$reschedule_number = $reschedule_row['reschedulenumber'];
|
||||||
|
|
||||||
|
$update_max_reschedule_query = "UPDATE orderbook SET maxreschedule = ? WHERE idorderbook = ?";
|
||||||
|
$stmt_max_reschedule = $conn->prepare($update_max_reschedule_query);
|
||||||
|
$stmt_max_reschedule->bind_param("ii", $reschedule_number, $order_id);
|
||||||
|
$stmt_max_reschedule->execute();
|
||||||
|
$stmt_max_reschedule->close();
|
||||||
|
|
||||||
|
echo "Aggiornata la colonna maxreschedule per l'ordine ID: $order_id\n";
|
||||||
|
} else {
|
||||||
|
echo "Nessun record trovato in expiryparameter per quantityclass: $quantity_class\n";
|
||||||
|
}
|
||||||
|
$stmt_reschedule->close();
|
||||||
|
|
||||||
|
// Invia la mail (modificata per includere la scadenza)
|
||||||
require 'phpmailer/src/Exception.php';
|
require 'phpmailer/src/Exception.php';
|
||||||
require 'phpmailer/src/PHPMailer.php';
|
require 'phpmailer/src/PHPMailer.php';
|
||||||
require 'phpmailer/src/SMTP.php';
|
require 'phpmailer/src/SMTP.php';
|
||||||
$name = $first_name;
|
$name = $first_name;
|
||||||
$messageedit = "<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 18px; line-height: 34.2px;'><strong><span style='line-height: 34.2px; font-size: 18px;'> Ciao $name , </span></strong></span></p>
|
$messageedit = "<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 18px; line-height: 34.2px;'><strong><span style='line-height: 34.2px; font-size: 18px;'> Ciao $name , </span></strong></span></p>
|
||||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Le prenotazioni relative al tuo ultimo ordine n. $ordern sono state inserite con successo!</span></p>
|
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Le prenotazioni relative al tuo ultimo ordine n. $ordern sono state inserite con successo!</span></p>
|
||||||
|
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Il tuo abbonamento scade il: <strong>$expireon</strong></span></p>
|
||||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Puoi vederle e riprogrammarle dall'indirizzo https://yogibook.yogasoul.it </span></p>
|
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Puoi vederle e riprogrammarle dall'indirizzo https://yogibook.yogasoul.it </span></p>
|
||||||
<br>
|
<br>
|
||||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Per il primo accesso devi per prima cosa resettare la password cliccando di seguito</span></p>
|
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Per il primo accesso devi per prima cosa resettare la password cliccando di seguito</span></p>
|
||||||
@@ -182,89 +248,20 @@ if ($service_schedule_result->num_rows > 0) {
|
|||||||
$mail->SMTPSecure = 'tls';
|
$mail->SMTPSecure = 'tls';
|
||||||
$mail->Port = '587';
|
$mail->Port = '587';
|
||||||
include('mail/emailtemplate2.php');
|
include('mail/emailtemplate2.php');
|
||||||
$htmlContent = $mailmessage1;
|
$htmlContent = $mailmessage1; // Assumo che $mailmessage1 sia il template; se devi integrare $messageedit qui, dimmelo
|
||||||
$mail->From = 'info@yogasoul.it';
|
$mail->From = 'info@yogasoul.it';
|
||||||
$mail->FromName = 'YogiBook [YogaSoul]';
|
$mail->FromName = 'YogiBook [YogaSoul]';
|
||||||
$mail->addAddress($billing_email);
|
$mail->addAddress($billing_email);
|
||||||
$mail->Subject = "YogiBook - Prenotazioni effettuate per il tuo ordine $ordern";
|
$mail->Subject = "YogiBook - Prenotazioni effettuate per il tuo ordine $ordern";
|
||||||
$mail->Body = $htmlContent;
|
$mail->Body = str_replace(['{messageedit}', '{buttonedit}'], [$messageedit, $buttonedit], $htmlContent); // Se il template ha placeholders, altrimenti usa direttamente $messageedit come Body
|
||||||
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
||||||
$mail->send();
|
$mail->send();
|
||||||
|
|
||||||
|
header("Location: orderbooklist.php");
|
||||||
|
exit();
|
||||||
} else {
|
} else {
|
||||||
echo "Nessun record di schedule futuro trovato per l'ordine ID: $order_id a partire dalla data della prima lezione: $first_lesson_date\n";
|
echo "Nessun record di schedule futuro trovato per l'ordine ID: $order_id a partire dalla data della prima lezione: $first_lesson_date\n";
|
||||||
}
|
}
|
||||||
$stmt_schedule->close();
|
$stmt_schedule->close();
|
||||||
|
|
||||||
// Recupera il numero di lezioni da expiryparameter (ora expirylessons)
|
|
||||||
$expiry_lessons_query = "SELECT expirylessons FROM expiryparameter WHERE quantityclass = ?";
|
|
||||||
$stmt_expiry_lessons = $conn->prepare($expiry_lessons_query);
|
|
||||||
$stmt_expiry_lessons->bind_param("i", $quantity_class);
|
|
||||||
$stmt_expiry_lessons->execute();
|
|
||||||
$expiry_lessons_result = $stmt_expiry_lessons->get_result();
|
|
||||||
|
|
||||||
if ($expiry_lessons_result && $expiry_lessons_result->num_rows > 0) {
|
|
||||||
$expiry_row = $expiry_lessons_result->fetch_assoc();
|
|
||||||
$expirylessons = $expiry_row['expirylessons'];
|
|
||||||
|
|
||||||
// Calcola la data della expirylessons-esima lezione disponibile
|
|
||||||
$expiry_date_query = "SELECT dateschedule FROM serviceschedule WHERE idservice = ? AND dateschedule >= ? ORDER BY dateschedule LIMIT ?, 1";
|
|
||||||
$stmt_expiry_date = $conn->prepare($expiry_date_query);
|
|
||||||
$offset = $expirylessons - 1; // Per prendere la n-esima riga (0-based offset)
|
|
||||||
$stmt_expiry_date->bind_param("isi", $service_id, $first_lesson_date, $offset);
|
|
||||||
$stmt_expiry_date->execute();
|
|
||||||
$expiry_date_result = $stmt_expiry_date->get_result();
|
|
||||||
|
|
||||||
if ($expiry_date_result->num_rows > 0) {
|
|
||||||
$date_row = $expiry_date_result->fetch_assoc();
|
|
||||||
$expireon = $date_row['dateschedule'];
|
|
||||||
|
|
||||||
// Aggiorna expireon in orderbook
|
|
||||||
$update_expiry_query = "UPDATE orderbook SET expireon = ? WHERE idorderbook = ?";
|
|
||||||
$stmt_update_expiry = $conn->prepare($update_expiry_query);
|
|
||||||
$stmt_update_expiry->bind_param("si", $expireon, $order_id);
|
|
||||||
$stmt_update_expiry->execute();
|
|
||||||
$stmt_update_expiry->close();
|
|
||||||
|
|
||||||
echo "Aggiornata la colonna expireon per l'ordine ID: $order_id (scadenza alla lezione n. $expirylessons: $expireon)\n";
|
|
||||||
} else {
|
|
||||||
// Non abbastanza lezioni: imposta a NULL o gestisci come preferisci
|
|
||||||
$update_expiry_query = "UPDATE orderbook SET expireon = NULL WHERE idorderbook = ?";
|
|
||||||
$stmt_update_expiry = $conn->prepare($update_expiry_query);
|
|
||||||
$stmt_update_expiry->bind_param("i", $order_id);
|
|
||||||
$stmt_update_expiry->execute();
|
|
||||||
$stmt_update_expiry->close();
|
|
||||||
|
|
||||||
echo "Non abbastanza lezioni disponibili per calcolare la scadenza per l'ordine ID: $order_id\n";
|
|
||||||
}
|
|
||||||
$stmt_expiry_date->close();
|
|
||||||
} else {
|
|
||||||
echo "Nessun record trovato in expiryparameter per quantityclass: $quantity_class\n";
|
|
||||||
}
|
|
||||||
$stmt_expiry_lessons->close();
|
|
||||||
|
|
||||||
// Recupera il numero da expiryparameter per maxreschedule
|
|
||||||
$reschedule_number_query = "SELECT reschedulenumber FROM expiryparameter WHERE quantityclass = ?";
|
|
||||||
$stmt_reschedule = $conn->prepare($reschedule_number_query);
|
|
||||||
$stmt_reschedule->bind_param("i", $quantity_class);
|
|
||||||
$stmt_reschedule->execute();
|
|
||||||
$reschedule_number_result = $stmt_reschedule->get_result();
|
|
||||||
|
|
||||||
if ($reschedule_number_result && $reschedule_number_result->num_rows > 0) {
|
|
||||||
$reschedule_row = $reschedule_number_result->fetch_assoc();
|
|
||||||
$reschedule_number = $reschedule_row['reschedulenumber'];
|
|
||||||
|
|
||||||
$update_max_reschedule_query = "UPDATE orderbook SET maxreschedule = ? WHERE idorderbook = ?";
|
|
||||||
$stmt_max_reschedule = $conn->prepare($update_max_reschedule_query);
|
|
||||||
$stmt_max_reschedule->bind_param("ii", $reschedule_number, $order_id);
|
|
||||||
$stmt_max_reschedule->execute();
|
|
||||||
$stmt_max_reschedule->close();
|
|
||||||
|
|
||||||
echo "Aggiornata la colonna maxreschedule per l'ordine ID: $order_id\n";
|
|
||||||
header("Location: orderbooklist.php");
|
|
||||||
exit();
|
|
||||||
} else {
|
|
||||||
echo "Nessun record trovato in expiryparameter per quantityclass: $quantity_class\n";
|
|
||||||
}
|
|
||||||
$stmt_reschedule->close();
|
|
||||||
|
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
|||||||
+60
-137
@@ -17,6 +17,9 @@ if ($conn->connect_error) {
|
|||||||
$logFile = 'rebook_from_cancel_log.txt';
|
$logFile = 'rebook_from_cancel_log.txt';
|
||||||
$logMessage = "Esecuzione riprogrammazione: " . date('Y-m-d H:i:s') . "\n";
|
$logMessage = "Esecuzione riprogrammazione: " . date('Y-m-d H:i:s') . "\n";
|
||||||
|
|
||||||
|
// Log del database utilizzato
|
||||||
|
$logMessage .= "Database connesso: $dbname\n";
|
||||||
|
|
||||||
// Recupera parametri GET
|
// Recupera parametri GET
|
||||||
if (!isset($_GET['idbookingclass']) || !isset($_GET['token'])) {
|
if (!isset($_GET['idbookingclass']) || !isset($_GET['token'])) {
|
||||||
$logMessage .= "Parametri mancanti: idbookingclass o token\n";
|
$logMessage .= "Parametri mancanti: idbookingclass o token\n";
|
||||||
@@ -147,7 +150,7 @@ $currentMonthEnd = date("Y-m-t", strtotime($currentMonthStart));
|
|||||||
// Aggiungi filtro per la data di scadenza
|
// Aggiungi filtro per la data di scadenza
|
||||||
$expiryCondition = '';
|
$expiryCondition = '';
|
||||||
if ($expiryDate) {
|
if ($expiryDate) {
|
||||||
$expiryCondition = "AND serviceschedule.dateschedule <= '{$expiryDate->format('Y-m-d 23:59:59')}'";
|
$expiryCondition = "AND ss.dateschedule <= '{$expiryDate->format('Y-m-d 23:59:59')}'";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Query per le lezioni disponibili
|
// Query per le lezioni disponibili
|
||||||
@@ -159,13 +162,35 @@ $query = "SELECT ss.*, s.servicename, s.colorclass, s.maxcapacity
|
|||||||
$expiryCondition
|
$expiryCondition
|
||||||
AND ss.idservice IN ($placeholders)
|
AND ss.idservice IN ($placeholders)
|
||||||
ORDER BY ss.dateschedule";
|
ORDER BY ss.dateschedule";
|
||||||
|
$logMessage .= "Query lezioni disponibili: $query\n";
|
||||||
|
$logMessage .= "Parametri: " . json_encode(array_merge([$currentMonthStart, $currentMonthEnd], $idassociateservices)) . "\n";
|
||||||
|
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||||
|
|
||||||
$stmt = $conn->prepare($query);
|
$stmt = $conn->prepare($query);
|
||||||
|
if (!$stmt) {
|
||||||
|
$logMessage .= "Errore preparazione query per lezioni disponibili: " . $conn->error . "\n";
|
||||||
|
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||||
|
echo "<h1>Errore</h1>";
|
||||||
|
echo "<p>Errore nella preparazione della query per le lezioni disponibili.</p>";
|
||||||
|
echo "<a href='https://yogibook.yogasoul.it'>Torna al portale</a>";
|
||||||
|
$conn->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$types = 'ss' . str_repeat('i', count($idassociateservices));
|
$types = 'ss' . str_repeat('i', count($idassociateservices));
|
||||||
$params = array_merge([$currentMonthStart, $currentMonthEnd], $idassociateservices);
|
$params = array_merge([$currentMonthStart, $currentMonthEnd], $idassociateservices);
|
||||||
$stmt->bind_param($types, ...$params);
|
$stmt->bind_param($types, ...$params);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$bookedclass = $stmt->get_result();
|
$bookedclass = $stmt->get_result();
|
||||||
|
if ($conn->error) {
|
||||||
|
$logMessage .= "Errore esecuzione query per lezioni disponibili: " . $conn->error . "\n";
|
||||||
|
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||||
|
echo "<h1>Errore</h1>";
|
||||||
|
echo "<p>Errore nell'esecuzione della query: " . $conn->error . "</p>";
|
||||||
|
echo "<a href='https://yogibook.yogasoul.it'>Torna al portale</a>";
|
||||||
|
$conn->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Mappa dei mesi in italiano
|
// Mappa dei mesi in italiano
|
||||||
$italianMonths = [
|
$italianMonths = [
|
||||||
@@ -200,7 +225,7 @@ file_put_contents($logFile, $logMessage, FILE_APPEND);
|
|||||||
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
||||||
<link href="assets/css/app.min.css" rel="stylesheet" type="text/css" />
|
<link href="assets/css/app.min.css" rel="stylesheet" type="text/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://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
<style>
|
<style>
|
||||||
.custom-card {
|
.custom-card {
|
||||||
margin: 10px auto;
|
margin: 10px auto;
|
||||||
@@ -325,156 +350,54 @@ file_put_contents($logFile, $logMessage, FILE_APPEND);
|
|||||||
}
|
}
|
||||||
|
|
||||||
.booking-button {
|
.booking-button {
|
||||||
background-color: #1ebf73;
|
background-color: #1ebf99;
|
||||||
color: #fff;
|
color: white;
|
||||||
border: none;
|
border: none;
|
||||||
padding: 8px 12px;
|
padding: 8px 12px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
transition: background-color 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.booking-button:hover {
|
.booking-button:hover {
|
||||||
background-color: #17a663;
|
background-color: #17a081;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="layout-wrapper">
|
<div class="container">
|
||||||
<header id="page-topbar" class="isvertical-topbar">
|
<h1>Riprogramma Lezione</h1>
|
||||||
<div class="navbar-header">
|
<p>Lezione attuale: <?php echo htmlspecialchars($servicename); ?> del <?php echo htmlspecialchars($newtimeformat); ?></p>
|
||||||
<div class="d-flex">
|
<p>Scadenza abbonamento: <?php echo htmlspecialchars($expireon); ?></p>
|
||||||
<?php include('include/logoarea.php'); ?>
|
<div class="month-navigation">
|
||||||
<button type="button" class="btn btn-sm px-3 font-size-24 header-item waves-effect vertical-menu-btn">
|
<button class="month-nav-button" onclick="window.location.href='?idbookingclass=<?php echo $idbookingclass; ?>&token=<?php echo urlencode($token); ?>&prev_month=<?php echo date('Y-m', strtotime($currentMonthStart . ' -1 month')); ?>'"><i class="fas fa-chevron-left"></i></button>
|
||||||
<i class="bx bx-menu align-middle"></i>
|
<span class="current-month"><?php echo $italianMonths[date('F', strtotime($currentMonthStart))]; ?> <?php echo date('Y', strtotime($currentMonthStart)); ?></span>
|
||||||
</button>
|
<button class="month-nav-button" onclick="window.location.href='?idbookingclass=<?php echo $idbookingclass; ?>&token=<?php echo urlencode($token); ?>&next_month=<?php echo date('Y-m', strtotime($currentMonthStart . ' +1 month')); ?>'"><i class="fas fa-chevron-right"></i></button>
|
||||||
<div class="page-title-box align-self-center d-none d-md-block">
|
</div>
|
||||||
<h4 class="page-title mb-0">Riprogramma la tua lezione</h4>
|
<?php while ($row = $bookedclass->fetch_assoc()) { ?>
|
||||||
</div>
|
<div class="custom-card" onclick="this.classList.toggle('expanded')">
|
||||||
|
<div class="custom-date-box" style="background-color: <?php echo htmlspecialchars($row['colorclass']); ?>;">
|
||||||
|
<div class="custom-day"><?php echo date('d', strtotime($row['dateschedule'])); ?></div>
|
||||||
|
<div class="custom-month"><?php echo $italianMonths[date('F', strtotime($row['dateschedule']))]; ?></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex">
|
<div class="custom-event-details">
|
||||||
<?php include('include/languageselection.php'); ?>
|
<h3 class="custom-heading"><?php echo htmlspecialchars($row['servicename']); ?></h3>
|
||||||
<?php include('include/profiletopbar.php'); ?>
|
<p class="custom-paragraph"><strong>Giorno:</strong> <?php echo htmlspecialchars($row['scheduleday']); ?></p>
|
||||||
|
<p class="custom-paragraph"><strong>Orario:</strong> <?php echo htmlspecialchars($row['startingtime']); ?></p>
|
||||||
|
<p class="custom-paragraph"><strong>Durata:</strong> <?php echo htmlspecialchars($row['durationtime']); ?> ore</p>
|
||||||
|
<div class="custom-actions">
|
||||||
|
<button class="custom-action-button booking-button" onclick="window.location.href='book_lesson.php?idserviceschedule=<?php echo $row['idserviceschedule']; ?>&idbookingclass=<?php echo $idbookingclass; ?>&token=<?php echo urlencode($token); ?>'">Prenota</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
<?php } ?>
|
||||||
<?php include('include/sidebar.php'); ?>
|
</div>
|
||||||
<div class="main-content">
|
<script>
|
||||||
<div class="page-content">
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
<div class="container-fluid">
|
console.log("Caricata pagina di riprogrammazione per ID <?php echo $idbookingclass; ?>, mese: <?php echo $currentMonthStart; ?>");
|
||||||
<div class="row">
|
});
|
||||||
<div class="col-xl-12">
|
</script>
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
<h3>Riprogrammazione Lezione</h3>
|
|
||||||
<p>Lezione attuale: <?php echo htmlspecialchars($servicename); ?> del <?php echo htmlspecialchars($newtimeformat); ?></p>
|
|
||||||
<p>Scadenza abbonamento: <?php echo htmlspecialchars($expireon); ?></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="month-navigation">
|
|
||||||
<a href="?idbookingclass=<?php echo $idbookingclass; ?>&token=<?php echo urlencode($token); ?>&prev_month=<?php echo date('Y-m', strtotime('-1 month', strtotime($currentMonthStart))); ?>" class="arrow-link">
|
|
||||||
<i class="fas fa-chevron-left fa-2x"></i>
|
|
||||||
</a>
|
|
||||||
<h2><?php echo $italianMonths[date("F", strtotime($currentMonthStart))] . ' ' . date("Y", strtotime($currentMonthStart)); ?></h2>
|
|
||||||
<a href="?idbookingclass=<?php echo $idbookingclass; ?>&token=<?php echo urlencode($token); ?>&next_month=<?php echo date('Y-m', strtotime('+1 month', strtotime($currentMonthStart))); ?>" class="arrow-link">
|
|
||||||
<i class="fas fa-chevron-right fa-2x"></i>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<?php if ($bookedclass->num_rows == 0): ?>
|
|
||||||
<p>Classi non presenti per questo mese o oltre la data di scadenza.</p>
|
|
||||||
<a href="https://yogibook.yogasoul.it" class="btn btn-primary">Torna al portale</a>
|
|
||||||
<?php else: ?>
|
|
||||||
<?php while ($row = $bookedclass->fetch_assoc()): ?>
|
|
||||||
<?php
|
|
||||||
$dateschedule = $row['dateschedule'];
|
|
||||||
$dateObj = new DateTime($dateschedule);
|
|
||||||
$dayInItalian = $dateObj->format("d");
|
|
||||||
$monthInItalian = $italianMonths[$dateObj->format("F")];
|
|
||||||
$newDateFormat = $dateObj->format("d-m-Y H:i");
|
|
||||||
|
|
||||||
$eventId = $row['idserviceschedule'];
|
|
||||||
$bookingQuery = "SELECT iduser FROM bookingclass WHERE idserviceschedule = ? AND status='booked'";
|
|
||||||
$stmtBooking = $conn->prepare($bookingQuery);
|
|
||||||
$stmtBooking->bind_param("i", $eventId);
|
|
||||||
$stmtBooking->execute();
|
|
||||||
$bookingResult = $stmtBooking->get_result();
|
|
||||||
$countPersons = $bookingResult->num_rows;
|
|
||||||
$stmtBooking->close();
|
|
||||||
|
|
||||||
$maxcapacity = $row['maxcapacity'];
|
|
||||||
$freeplace = $maxcapacity - $countPersons;
|
|
||||||
|
|
||||||
$idcheckservice = $row['idserviceschedule'];
|
|
||||||
$query = "SELECT * FROM bookingclass WHERE idserviceschedule = ? AND iduser = ?";
|
|
||||||
$stmtCheck = $conn->prepare($query);
|
|
||||||
$stmtCheck->bind_param("ii", $idcheckservice, $iduser);
|
|
||||||
$stmtCheck->execute();
|
|
||||||
$resultcheck = $stmtCheck->get_result();
|
|
||||||
$alreadybooked = $resultcheck->num_rows > 0 ? 'Y' : 'N';
|
|
||||||
$stmtCheck->close();
|
|
||||||
?>
|
|
||||||
<div class="custom-card" onclick="toggleCard(this)">
|
|
||||||
<?php if ($alreadybooked == 'Y'): ?>
|
|
||||||
<div class="custom-date-box" style="background-color:#FF6609">
|
|
||||||
<?php elseif ($freeplace > 0): ?>
|
|
||||||
<div class="custom-date-box" style="background-color:#1ebf73">
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="custom-date-box" style="background-color:#9C9C9C">
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="custom-day"><?php echo $dayInItalian; ?></div>
|
|
||||||
<div class="custom-month"><?php echo $monthInItalian; ?></div>
|
|
||||||
</div>
|
|
||||||
<?php if ($alreadybooked == 'Y'): ?>
|
|
||||||
<div class="custom-event-details" style="background-color:#FFAC7A">
|
|
||||||
<?php elseif ($freeplace > 0): ?>
|
|
||||||
<div class="custom-event-details" style="background-color:<?php echo htmlspecialchars($row['colorclass']); ?>">
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="custom-event-details" style="background-color:#CDCDCD">
|
|
||||||
<?php endif; ?>
|
|
||||||
<h2 class="custom-heading"><?php echo htmlspecialchars($row['servicename']); ?> - <?php echo $countPersons; ?>/<?php echo $maxcapacity; ?></h2>
|
|
||||||
<p class="custom-paragraph">Quando: <?php echo $newDateFormat; ?></p>
|
|
||||||
<p class="custom-paragraph">Luogo: via Valassina 62/B Seregno - Sala Contesto Yoga</p>
|
|
||||||
<div class="booking-details">
|
|
||||||
<?php if ($alreadybooked == 'Y'): ?>
|
|
||||||
<button class="booking-button"><i class="fa fa-check"></i> Sei già prenotata/o</button>
|
|
||||||
<?php elseif ($freeplace > 0): ?>
|
|
||||||
<a href="rebookandgo.php?idpreviousbooking=<?php echo $idbookingclass; ?>&idservicenew=<?php echo $row['idservice']; ?>&idnewbooking=<?php echo $row['idserviceschedule']; ?>&iduser=<?php echo $iduser; ?>">
|
|
||||||
<button class="booking-button"><i class="fas fa-arrow-circle-right"></i> Riprogramma Classe</button>
|
|
||||||
</a>
|
|
||||||
<?php else: ?>
|
|
||||||
<button class="booking-button"><i class="fa fa-stop"></i> Classe Piena</button>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endwhile; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="month-navigation">
|
|
||||||
<a href="?idbookingclass=<?php echo $idbookingclass; ?>&token=<?php echo urlencode($token); ?>&prev_month=<?php echo date('Y-m', strtotime('-1 month', strtotime($currentMonthStart))); ?>" class="arrow-link">
|
|
||||||
<i class="fas fa-chevron-left fa-2x"></i>
|
|
||||||
</a>
|
|
||||||
<h2><?php echo $italianMonths[date("F", strtotime($currentMonthStart))] . ' ' . date("Y", strtotime($currentMonthStart)); ?></h2>
|
|
||||||
<a href="?idbookingclass=<?php echo $idbookingclass; ?>&token=<?php echo urlencode($token); ?>&next_month=<?php echo date('Y-m', strtotime('+1 month', strtotime($currentMonthStart))); ?>" class="arrow-link">
|
|
||||||
<i class="fas fa-chevron-right fa-2x"></i>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php include('include/footer.php'); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
function toggleCard(card) {
|
|
||||||
card.classList.toggle("expanded");
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<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>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
Esecuzione riprogrammazione: 2025-10-13 15:06:31
|
||||||
|
Database connesso: yogibookaury
|
||||||
|
Query lezioni disponibili: SELECT ss.*, s.servicename, s.colorclass, s.maxcapacity
|
||||||
|
FROM serviceschedule ss
|
||||||
|
LEFT JOIN service s ON ss.idservice = s.idservice
|
||||||
|
WHERE ss.dateschedule BETWEEN ? AND DATE_ADD(?, INTERVAL 1 DAY)
|
||||||
|
AND ss.dateschedule <= '2025-10-30 23:59:59'
|
||||||
|
AND ss.idservice IN (?,?,?,?,?,?,?,?)
|
||||||
|
ORDER BY ss.dateschedule
|
||||||
|
Parametri: ["2025-10-01","2025-10-31",42,41,42,43,45,47,44,48]
|
||||||
|
Esecuzione riprogrammazione: 2025-10-13 15:06:31
|
||||||
|
Database connesso: yogibookaury
|
||||||
|
Query lezioni disponibili: SELECT ss.*, s.servicename, s.colorclass, s.maxcapacity
|
||||||
|
FROM serviceschedule ss
|
||||||
|
LEFT JOIN service s ON ss.idservice = s.idservice
|
||||||
|
WHERE ss.dateschedule BETWEEN ? AND DATE_ADD(?, INTERVAL 1 DAY)
|
||||||
|
AND ss.dateschedule <= '2025-10-30 23:59:59'
|
||||||
|
AND ss.idservice IN (?,?,?,?,?,?,?,?)
|
||||||
|
ORDER BY ss.dateschedule
|
||||||
|
Parametri: ["2025-10-01","2025-10-31",42,41,42,43,45,47,44,48]
|
||||||
|
Caricata pagina di riprogrammazione per ID 4, mese: 2025-10-01
|
||||||
|
Esecuzione riprogrammazione: 2025-10-13 15:06:38
|
||||||
|
Database connesso: yogibookaury
|
||||||
|
Query lezioni disponibili: SELECT ss.*, s.servicename, s.colorclass, s.maxcapacity
|
||||||
|
FROM serviceschedule ss
|
||||||
|
LEFT JOIN service s ON ss.idservice = s.idservice
|
||||||
|
WHERE ss.dateschedule BETWEEN ? AND DATE_ADD(?, INTERVAL 1 DAY)
|
||||||
|
AND ss.dateschedule <= '2025-10-30 23:59:59'
|
||||||
|
AND ss.idservice IN (?,?,?,?,?,?,?,?)
|
||||||
|
ORDER BY ss.dateschedule
|
||||||
|
Parametri: ["2025-11-01","2025-11-30",42,41,42,43,45,47,44,48]
|
||||||
|
Esecuzione riprogrammazione: 2025-10-13 15:06:38
|
||||||
|
Database connesso: yogibookaury
|
||||||
|
Query lezioni disponibili: SELECT ss.*, s.servicename, s.colorclass, s.maxcapacity
|
||||||
|
FROM serviceschedule ss
|
||||||
|
LEFT JOIN service s ON ss.idservice = s.idservice
|
||||||
|
WHERE ss.dateschedule BETWEEN ? AND DATE_ADD(?, INTERVAL 1 DAY)
|
||||||
|
AND ss.dateschedule <= '2025-10-30 23:59:59'
|
||||||
|
AND ss.idservice IN (?,?,?,?,?,?,?,?)
|
||||||
|
ORDER BY ss.dateschedule
|
||||||
|
Parametri: ["2025-11-01","2025-11-30",42,41,42,43,45,47,44,48]
|
||||||
|
Caricata pagina di riprogrammazione per ID 4, mese: 2025-11-01
|
||||||
|
Esecuzione riprogrammazione: 2025-10-13 15:06:41
|
||||||
|
Database connesso: yogibookaury
|
||||||
|
Query lezioni disponibili: SELECT ss.*, s.servicename, s.colorclass, s.maxcapacity
|
||||||
|
FROM serviceschedule ss
|
||||||
|
LEFT JOIN service s ON ss.idservice = s.idservice
|
||||||
|
WHERE ss.dateschedule BETWEEN ? AND DATE_ADD(?, INTERVAL 1 DAY)
|
||||||
|
AND ss.dateschedule <= '2025-10-30 23:59:59'
|
||||||
|
AND ss.idservice IN (?,?,?,?,?,?,?,?)
|
||||||
|
ORDER BY ss.dateschedule
|
||||||
|
Parametri: ["2025-10-01","2025-10-31",42,41,42,43,45,47,44,48]
|
||||||
|
Esecuzione riprogrammazione: 2025-10-13 15:06:41
|
||||||
|
Database connesso: yogibookaury
|
||||||
|
Query lezioni disponibili: SELECT ss.*, s.servicename, s.colorclass, s.maxcapacity
|
||||||
|
FROM serviceschedule ss
|
||||||
|
LEFT JOIN service s ON ss.idservice = s.idservice
|
||||||
|
WHERE ss.dateschedule BETWEEN ? AND DATE_ADD(?, INTERVAL 1 DAY)
|
||||||
|
AND ss.dateschedule <= '2025-10-30 23:59:59'
|
||||||
|
AND ss.idservice IN (?,?,?,?,?,?,?,?)
|
||||||
|
ORDER BY ss.dateschedule
|
||||||
|
Parametri: ["2025-10-01","2025-10-31",42,41,42,43,45,47,44,48]
|
||||||
|
Caricata pagina di riprogrammazione per ID 4, mese: 2025-10-01
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
require_once('Connections/bkngstm.php');
|
||||||
|
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
die("Connessione fallita: " . $conn->connect_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['idbookingclass'])) {
|
||||||
|
$idbookingclass = $_POST['idbookingclass'];
|
||||||
|
|
||||||
|
$query = "UPDATE bookingclass SET lostlesson = 'N' WHERE idbookingclass = ?";
|
||||||
|
$stmt = $conn->prepare($query);
|
||||||
|
$stmt->bind_param("i", $idbookingclass);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
echo json_encode(['success' => true]);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['success' => false, 'error' => $conn->error]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn->close();
|
||||||
+313
-369
@@ -1,6 +1,6 @@
|
|||||||
<?php require_once('include/headscript.php'); ?>
|
<?php require_once('include/headscript.php'); ?>
|
||||||
<?php // optionquery
|
<?php // optionquery
|
||||||
$optionquery = new WA_MySQLi_RS("optionquery",$bkngstm,0);
|
$optionquery = new WA_MySQLi_RS("optionquery", $bkngstm, 0);
|
||||||
$optionquery->setQuery("SELECT * FROM option");
|
$optionquery->setQuery("SELECT * FROM option");
|
||||||
$optionquery->execute();
|
$optionquery->execute();
|
||||||
?>
|
?>
|
||||||
@@ -8,410 +8,354 @@ $optionquery->execute();
|
|||||||
<?php
|
<?php
|
||||||
// Verifica se è stato inviato un modulo
|
// Verifica se è stato inviato un modulo
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
// Verifica se è stato caricato un file correttamente
|
// Verifica se è stato caricato un file correttamente
|
||||||
if (isset($_FILES["fileToUpload"]) && $_FILES["fileToUpload"]["error"] === UPLOAD_ERR_OK) {
|
if (isset($_FILES["fileToUpload"]) && $_FILES["fileToUpload"]["error"] === UPLOAD_ERR_OK) {
|
||||||
|
|
||||||
|
|
||||||
// Crea la connessione al database
|
|
||||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
|
||||||
|
|
||||||
// Verifica la connessione
|
|
||||||
if ($conn->connect_error) {
|
|
||||||
die("Connessione al database fallita: " . $conn->connect_error);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ottieni l'ID dell'utente (da dove viene?)
|
|
||||||
$iduserlogin = $_POST["iduserlogin"];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Chiudi la connessione al database
|
|
||||||
$conn->close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
|
||||||
// Crea la connessione al database
|
// Crea la connessione al database
|
||||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
// Verifica la connessione
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
die("Connessione al database fallita: " . $conn->connect_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ottieni l'ID dell'utente (da dove viene?)
|
||||||
|
$iduserlogin = $_POST["iduserlogin"];
|
||||||
|
|
||||||
|
// Chiudi la connessione al database
|
||||||
|
$conn->close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// Crea la connessione al database
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
// Verifica la connessione
|
// Verifica la connessione
|
||||||
if ($conn->connect_error) {
|
if ($conn->connect_error) {
|
||||||
die("Connessione al database fallita: " . $conn->connect_error);
|
die("Connessione al database fallita: " . $conn->connect_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Query per selezionare i dati filtrati per iduser, includendo servicename
|
||||||
|
$query = "SELECT orderbook.idorderbook, orderbook.nticket, orderbook.expireon, orderbook.idservice, service.servicename
|
||||||
// Query per selezionare i dati filtrati per iduser
|
FROM orderbook LEFT JOIN service ON orderbook.idservice=service.idservice
|
||||||
$query = "SELECT * FROM orderbook LEFT JOIN service ON orderbook.idservice=service.idservice WHERE iduser = '$iduserlogin'";
|
WHERE orderbook.iduser = ?";
|
||||||
$result = $conn->query($query);
|
$stmt = $conn->prepare($query);
|
||||||
|
$stmt->bind_param("i", $iduserlogin);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
// Array per memorizzare i risultati
|
// Array per memorizzare i risultati
|
||||||
$documents = array();
|
$documents = array();
|
||||||
|
|
||||||
while ($row = $result->fetch_assoc()) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
$documents[] = $row;
|
$documents[] = $row;
|
||||||
}
|
}
|
||||||
|
$stmt->close();
|
||||||
|
$conn->close();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<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">
|
||||||
|
|
||||||
<meta charset="utf-8" />
|
<!-- Bootstrap Css -->
|
||||||
<title>YogiBook - Prenotazioni YogaSoul</title>
|
<link href="assets/css/bootstrap.min.css" id="bootstrap-style" rel="stylesheet" type="text/css" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<!-- Icons Css -->
|
||||||
<meta content="YogiBook - Prenotazione facile YogaSOul" name="description" />
|
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
||||||
<meta content="Advanced Creative Solutions" name="author" />
|
<!-- App Css-->
|
||||||
<!-- App favicon -->
|
<link href="assets/css/app.min.css" id="app-style" rel="stylesheet" type="text/css" />
|
||||||
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
||||||
|
|
||||||
<!-- Bootstrap Css -->
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
|
||||||
<link href="assets/css/bootstrap.min.css" id="bootstrap-style" rel="stylesheet" type="text/css" />
|
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
|
||||||
<!-- Icons Css -->
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
||||||
<!-- App Css-->
|
<script>
|
||||||
<link href="assets/css/app.min.css" id="app-style" rel="stylesheet" type="text/css" />
|
$(function() {
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
$("#expiryDate").datepicker({
|
||||||
|
dateFormat: "yy-mm-dd"
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
|
});
|
||||||
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
|
});
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
</script>
|
||||||
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
<style>
|
||||||
<script>
|
|
||||||
$(function() {
|
|
||||||
$("#expiryDate").datepicker({ dateFormat: "yy-mm-dd" });
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
.custom-card {
|
|
||||||
margin: 10px auto;
|
|
||||||
display: flex;
|
|
||||||
width: 90%;
|
|
||||||
max-width: 700px;
|
|
||||||
background-color: white;
|
|
||||||
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
|
|
||||||
border-radius: 8px;
|
|
||||||
overflow: hidden;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: transform 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-card:hover {
|
|
||||||
transform: translateY(-5px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-date-box {
|
|
||||||
flex: 1;
|
|
||||||
background-color: red;
|
|
||||||
color: white;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
padding: 0;
|
|
||||||
font-size: 60px;
|
|
||||||
font-weight: bold;
|
|
||||||
border-top-left-radius: 8px;
|
|
||||||
border-bottom-left-radius: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-day {
|
|
||||||
line-height: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-month {
|
|
||||||
font-size: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-event-details {
|
|
||||||
flex: 2;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
padding: 10px 20px;
|
|
||||||
background-color: lightblue;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-heading {
|
|
||||||
margin-top: 0;
|
|
||||||
font-size: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-paragraph {
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-actions {
|
|
||||||
display: none;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-card.expanded .custom-actions {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-action-button {
|
|
||||||
background-color: #f0f0f0;
|
|
||||||
border: none;
|
|
||||||
padding: 8px 12px;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background-color 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-action-button:hover {
|
|
||||||
background-color: #e0e0e0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.custom-card {
|
.custom-card {
|
||||||
|
margin: 10px auto;
|
||||||
|
display: flex;
|
||||||
|
width: 90%;
|
||||||
|
max-width: 700px;
|
||||||
|
background-color: white;
|
||||||
|
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: transform 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-card:hover {
|
||||||
|
transform: translateY(-5px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-date-box {
|
||||||
|
flex: 1;
|
||||||
|
background-color: red;
|
||||||
|
color: white;
|
||||||
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0;
|
||||||
|
font-size: 60px;
|
||||||
|
font-weight: bold;
|
||||||
|
border-top-left-radius: 8px;
|
||||||
|
border-bottom-left-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-date-box, .custom-event-details {
|
.custom-day {
|
||||||
width: 100%;
|
line-height: 1;
|
||||||
border-radius: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-event-time {
|
.custom-month {
|
||||||
|
font-size: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-event-details {
|
||||||
|
flex: 2;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 10px 20px;
|
||||||
|
background-color: lightblue;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-heading {
|
||||||
|
margin-top: 0;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</style>
|
.custom-paragraph {
|
||||||
<script>
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-actions {
|
||||||
|
display: none;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-card.expanded .custom-actions {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-action-button {
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
border: none;
|
||||||
|
padding: 8px 12px;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-action-button:hover {
|
||||||
|
background-color: #e0e0e0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.custom-card {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-date-box,
|
||||||
|
.custom-event-details {
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-event-time {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-disabled {
|
||||||
|
background-color: #dc3545 !important;
|
||||||
|
color: white !important;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-expired {
|
||||||
|
background-color: #ff8c00 !important;
|
||||||
|
color: white !important;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
function confirmDelete(id, deletePageUrl) {
|
function confirmDelete(id, deletePageUrl) {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Sei sicuro?",
|
title: "Sei sicuro?",
|
||||||
text: "Questa prenotazione verrà cancellata definitivamente! Ricordati poi di riprogrammare la tua lezione!",
|
text: "Questa prenotazione verrà cancellata definitivamente! Ricordati poi di riprogrammare la tua lezione!",
|
||||||
icon: "warning",
|
icon: "warning",
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: "#d33",
|
confirmButtonColor: "#d33",
|
||||||
cancelButtonColor: "#3085d6",
|
cancelButtonColor: "#3085d6",
|
||||||
confirmButtonText: "Sì, cancella!",
|
confirmButtonText: "Sì, cancella!",
|
||||||
cancelButtonText: "Annulla"
|
cancelButtonText: "Annulla"
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
// Reindirizza direttamente alla pagina di cancellazione con l'ID come parametro.
|
// Reindirizza direttamente alla pagina di cancellazione con l'ID come parametro.
|
||||||
window.location.href = `deleteclass.php?id=${id}`;
|
window.location.href = `deleteclass.php?id=${id}`;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
</script>
|
||||||
}
|
</head>
|
||||||
</script>
|
|
||||||
|
|
||||||
<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">Prenotazione Classi</h4>
|
|
||||||
</div>
|
|
||||||
<!-- end page title -->
|
|
||||||
|
|
||||||
</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>
|
|
||||||
|
|
||||||
<!-- ============================================================== -->
|
|
||||||
<!-- 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 <?php echo $firstname; ?> </h5>
|
|
||||||
<p>Di seguito puoi visualizzare i tuoi ordini</p>
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-striped mb-0">
|
|
||||||
<thead>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
|
||||||
|
|
||||||
if ($conn->connect_error) {
|
|
||||||
die("Connessione fallita: " . $conn->connect_error);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ID dell'utente per il quale vuoi filtrare gli ordini
|
|
||||||
$userid = $iduserlogin;
|
|
||||||
|
|
||||||
// Query per ottenere la somma dei ticket per ogni ordine dell'utente
|
|
||||||
$query = "SELECT iduser, idorderbook, SUM(nticket) as total_tickets
|
|
||||||
FROM orderbook
|
|
||||||
WHERE iduser = $userid
|
|
||||||
GROUP BY iduser";
|
|
||||||
|
|
||||||
$result = $conn->query($query);
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
die("Query fallita: " . $conn->error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($result->num_rows > 0) {
|
|
||||||
while ($row = $result->fetch_assoc()) {
|
|
||||||
$idOrdine = $row["idorderbook"];
|
|
||||||
$totalTickets = $row["total_tickets"];
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$totalTickets = 0; // Imposta a zero se non ci sono righe nella query
|
|
||||||
}
|
|
||||||
|
|
||||||
$conn->close();
|
|
||||||
?><?php //check tickets
|
|
||||||
// Connessione al database
|
|
||||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
|
||||||
if ($conn->connect_error) {
|
|
||||||
die("Connessione al database fallita: " . $conn->connect_error);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ID dell'utente per il quale si desidera eseguire la query
|
|
||||||
$iduser = $iduserlogin; // Sostituisci con l'ID utente desiderato
|
|
||||||
|
|
||||||
// Data e ora attuali
|
|
||||||
$currentDateTime = date("Y-m-d H:i:s");
|
|
||||||
|
|
||||||
// Query per contare i record con data e ora passate e future
|
|
||||||
$query = "SELECT COUNT(*) AS total,
|
|
||||||
SUM(CASE WHEN serviceschedule.dateschedule <= '$currentDateTime' THEN 1 ELSE 0 END) AS passed,
|
|
||||||
SUM(CASE WHEN serviceschedule.dateschedule > '$currentDateTime' THEN 1 ELSE 0 END) AS future
|
|
||||||
FROM bookingclass
|
|
||||||
LEFT JOIN serviceschedule ON bookingclass.idserviceschedule = serviceschedule.idserviceschedule
|
|
||||||
WHERE bookingclass.iduser = $iduser";
|
|
||||||
|
|
||||||
$result = $conn->query($query);
|
|
||||||
if ($result) {
|
|
||||||
$row = $result->fetch_assoc();
|
|
||||||
$totalRecords = $row['total'];
|
|
||||||
$passedRecords = $row['passed'];
|
|
||||||
$futureRecords = $row['future'];
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
// Chiusura della connessione
|
|
||||||
$conn->close();
|
|
||||||
?>
|
|
||||||
<?php
|
|
||||||
$toprogram = $totalTickets - $passedRecords - $futureRecords;
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<th>Ordine</th>
|
|
||||||
<th>Da prenotare </th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php foreach ($documents as $document) { ?>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo $document['order_id']; ?></td>
|
|
||||||
<td>
|
|
||||||
<form action="bookingpanelorder.php" method="post">
|
|
||||||
<input type="hidden" name="idorder" value="<?php echo $document['idorderbook']; ?>">
|
|
||||||
<input type="hidden" name="idserviceordered" value="<?php echo $document['idservice']; ?>">
|
|
||||||
<button type="submit" class="btn btn-success waves-effect waves-light">Da prenotare: <?php echo $toprogram; ?></button>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php } ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!-- container-fluid -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php include('include/footer.php'); ?>
|
|
||||||
</div>
|
|
||||||
<!-- end main content-->
|
|
||||||
|
|
||||||
|
<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">Prenotazione Classi</h4>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- END layout-wrapper -->
|
<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 class="topnav">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<nav class="navbar navbar-light navbar-expand-lg topnav-menu"></nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<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 <?php echo $firstname; ?></h5>
|
||||||
|
<p>Di seguito puoi visualizzare i tuoi ordini</p>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped mb-0">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Ordine</th>
|
||||||
|
<th>Servizio</th>
|
||||||
|
<th>Numero di Ticket</th>
|
||||||
|
<th>Scadenza</th>
|
||||||
|
<th>Da prenotare</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($documents as $document) : ?>
|
||||||
|
<?php
|
||||||
|
// Connessione al database per calcolo per ordine
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
die("Connessione al database fallita: " . $conn->connect_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
$idorderbook = $document['idorderbook'];
|
||||||
|
$totalTickets = $document['nticket'];
|
||||||
|
$expireon = $document['expireon'];
|
||||||
|
$idservice = $document['idservice'];
|
||||||
|
$servicename = $document['servicename'];
|
||||||
|
|
||||||
|
// Verifica se l'ordine è scaduto
|
||||||
|
$currentDate = date("Y-m-d");
|
||||||
|
$isExpired = $expireon && $expireon < $currentDate;
|
||||||
|
|
||||||
<!-- JAVASCRIPT -->
|
// Data e ora attuali
|
||||||
<script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
|
$currentDateTime = date("Y-m-d H:i:s");
|
||||||
<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>
|
// Query per contare i record per questo ordine, escludendo status = 'cancelled'
|
||||||
|
$query = "SELECT COUNT(*) AS total,
|
||||||
|
SUM(CASE WHEN serviceschedule.dateschedule <= ? AND bookingclass.status = 'booked' AND bookingclass.lostlesson = 'N' THEN 1 ELSE 0 END) AS passed,
|
||||||
|
SUM(CASE WHEN serviceschedule.dateschedule > ? AND bookingclass.status = 'booked' AND bookingclass.lostlesson = 'N' THEN 1 ELSE 0 END) AS future,
|
||||||
|
SUM(CASE WHEN bookingclass.lostlesson = 'Y' AND bookingclass.status != 'cancelled' THEN 1 ELSE 0 END) AS lost,
|
||||||
|
SUM(CASE WHEN bookingclass.status = 'pending' THEN 1 ELSE 0 END) AS pending
|
||||||
|
FROM bookingclass
|
||||||
|
LEFT JOIN serviceschedule ON bookingclass.idserviceschedule = serviceschedule.idserviceschedule
|
||||||
|
WHERE bookingclass.iduser = ? AND bookingclass.idorder = ? AND bookingclass.status != 'cancelled'";
|
||||||
|
$stmt = $conn->prepare($query);
|
||||||
|
$stmt->bind_param("ssii", $currentDateTime, $currentDateTime, $iduserlogin, $idorderbook);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
</body>
|
if ($result) {
|
||||||
|
$row = $result->fetch_assoc();
|
||||||
|
$passedRecords = $row['passed'];
|
||||||
|
$futureRecords = $row['future'];
|
||||||
|
$lost = $row['lost'];
|
||||||
|
$pending = $row['pending'];
|
||||||
|
} else {
|
||||||
|
$passedRecords = 0;
|
||||||
|
$futureRecords = 0;
|
||||||
|
$lost = 0;
|
||||||
|
$pending = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$toprogram = $totalTickets - $passedRecords - $futureRecords - $pending - $lost;
|
||||||
|
|
||||||
|
$stmt->close();
|
||||||
|
$conn->close();
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $idorderbook; ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($servicename); ?></td>
|
||||||
|
<td><?php echo $totalTickets; ?></td>
|
||||||
|
<td><?php echo $expireon ? date('d-m-Y', strtotime($expireon)) : 'N/D'; ?></td>
|
||||||
|
<td>
|
||||||
|
<form action="bookingpanelorder.php" method="post">
|
||||||
|
<input type="hidden" name="idorder" value="<?php echo $idorderbook; ?>">
|
||||||
|
<input type="hidden" name="idserviceordered" value="<?php echo $idservice; ?>">
|
||||||
|
<button type="submit" class="btn <?php echo $isExpired ? 'btn-expired' : ($toprogram > 0 ? 'btn-success' : 'btn-disabled'); ?> waves-effect waves-light" <?php echo ($isExpired || $toprogram <= 0) ? 'disabled' : ''; ?>>
|
||||||
|
<?php echo $isExpired ? 'Abbonamento scaduto' : 'Da prenotare: ' . $toprogram; ?>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php include('include/footer.php'); ?>
|
||||||
|
</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>
|
||||||
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
// Abilita visualizzazione errori PHP (solo per debug, disabilita in produzione)
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
// Includi configurazione database
|
||||||
|
require_once('include/headscript.php');
|
||||||
|
|
||||||
|
// Inizializza log
|
||||||
|
$logFile = 'update_expired_lessons_log.txt';
|
||||||
|
$logMessage = "Esecuzione script aggiornamento lezioni scadute: " . date('Y-m-d H:i:s') . "\n";
|
||||||
|
|
||||||
|
// Connessione al database
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
$logMessage .= "Connessione al database fallita: " . $conn->connect_error . "\n";
|
||||||
|
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||||
|
die("Connessione al database fallita: " . $conn->connect_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
$logMessage .= "Database connesso: $dbname\n";
|
||||||
|
|
||||||
|
// Query per trovare ordini scaduti
|
||||||
|
$query_orders = "SELECT idorderbook, order_id, expireon
|
||||||
|
FROM orderbook
|
||||||
|
WHERE expireon < NOW()";
|
||||||
|
$result_orders = $conn->query($query_orders);
|
||||||
|
|
||||||
|
if (!$result_orders) {
|
||||||
|
$logMessage .= "Errore nella query degli ordini scaduti: " . $conn->error . "\n";
|
||||||
|
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||||
|
$conn->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$logMessage .= "Ordini scaduti trovati: " . $result_orders->num_rows . "\n";
|
||||||
|
|
||||||
|
$updated_lessons = 0;
|
||||||
|
$processed_orders = array();
|
||||||
|
|
||||||
|
// Aggiorna le lezioni per ogni ordine scaduto
|
||||||
|
while ($order = $result_orders->fetch_assoc()) {
|
||||||
|
$idorderbook = $order['idorderbook'];
|
||||||
|
$processed_orders[] = $idorderbook;
|
||||||
|
$logMessage .= "Elaborazione ordine: idorderbook = $idorderbook, expireon = {$order['expireon']}\n";
|
||||||
|
|
||||||
|
// Query per aggiornare le lezioni non completate e non perse
|
||||||
|
$update_query = "UPDATE bookingclass
|
||||||
|
SET expirylesson = 'Y'
|
||||||
|
WHERE idorder = ?
|
||||||
|
AND status != 'completed'
|
||||||
|
AND lostlesson != 'Y'
|
||||||
|
AND expirylesson != 'Y'";
|
||||||
|
$stmt = $conn->prepare($update_query);
|
||||||
|
if (!$stmt) {
|
||||||
|
$logMessage .= "Errore preparazione query per idorderbook $idorderbook: " . $conn->error . "\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->bind_param("i", $idorderbook);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
$affected_rows = $stmt->affected_rows;
|
||||||
|
$updated_lessons += $affected_rows;
|
||||||
|
$logMessage .= "Lezioni aggiornate per idorderbook $idorderbook: $affected_rows\n";
|
||||||
|
|
||||||
|
$stmt->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
$logMessage .= "Totale lezioni aggiornate: $updated_lessons\n";
|
||||||
|
$logMessage .= "Ordini elaborati: " . implode(", ", $processed_orders) . "\n";
|
||||||
|
|
||||||
|
// Scrivi il log
|
||||||
|
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||||
|
|
||||||
|
// Chiudi la connessione
|
||||||
|
$conn->close();
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
<?php
|
||||||
|
// Assicurati che non ci siano spazi o righe vuote prima di questo punto
|
||||||
|
ob_start(); // Avvia il buffer di output
|
||||||
|
|
||||||
|
// Abilita debug per registrare errori
|
||||||
|
ini_set('display_errors', 0); // Non mostrare errori sullo schermo
|
||||||
|
ini_set('log_errors', 1);
|
||||||
|
ini_set('error_log', 'php_errors.log'); // Specifica il file di log
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
require_once('include/headscript.php');
|
||||||
|
|
||||||
|
// Creazione della connessione
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
// Verifica della connessione
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
ob_end_clean();
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
error_log("Connessione al database fallita: " . $conn->connect_error);
|
||||||
|
echo json_encode(['status' => 'error', 'message' => 'Connessione al database fallita: ' . $conn->connect_error]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gestione della risposta AJAX
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] !== 'POST' || !isset($_POST['update_expiry'])) {
|
||||||
|
ob_end_clean();
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
error_log("Richiesta non valida a update_expiry.php: metodo=" . $_SERVER['REQUEST_METHOD'] . ", update_expiry=" . (isset($_POST['update_expiry']) ? 'set' : 'not set'));
|
||||||
|
echo json_encode(['status' => 'error', 'message' => 'Richiesta non valida']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verifica i parametri ricevuti
|
||||||
|
$order_id = isset($_POST['order_id']) ? intval($_POST['order_id']) : 0;
|
||||||
|
$new_expiry = isset($_POST['new_expiry']) ? $_POST['new_expiry'] : '';
|
||||||
|
|
||||||
|
// Log per debug
|
||||||
|
error_log("Tentativo di aggiornamento AJAX - idorderbook: $order_id, new_expiry: $new_expiry");
|
||||||
|
|
||||||
|
// Controlla se idorderbook è valido
|
||||||
|
if ($order_id <= 0) {
|
||||||
|
ob_end_clean();
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
error_log("idorderbook non valido o mancante: $order_id");
|
||||||
|
echo json_encode(['status' => 'error', 'message' => 'idorderbook non valido o mancante.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verifica se l'idorderbook esiste
|
||||||
|
$checkStmt = $conn->prepare("SELECT idorderbook FROM orderbook WHERE idorderbook = ?");
|
||||||
|
if (!$checkStmt) {
|
||||||
|
ob_end_clean();
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
error_log("Errore preparazione query SELECT: " . $conn->error);
|
||||||
|
echo json_encode(['status' => 'error', 'message' => 'Errore preparazione query: ' . $conn->error]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$checkStmt->bind_param("i", $order_id);
|
||||||
|
$checkStmt->execute();
|
||||||
|
$checkResult = $checkStmt->get_result();
|
||||||
|
if ($checkResult->num_rows === 0) {
|
||||||
|
ob_end_clean();
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
error_log("idorderbook $order_id non trovato nel database.");
|
||||||
|
echo json_encode(['status' => 'error', 'message' => 'idorderbook non trovato nel database.']);
|
||||||
|
$checkStmt->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$checkStmt->close();
|
||||||
|
|
||||||
|
// Esegui l'aggiornamento
|
||||||
|
$stmt = $conn->prepare("UPDATE orderbook SET expireon = ? WHERE idorderbook = ?");
|
||||||
|
if (!$stmt) {
|
||||||
|
ob_end_clean();
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
error_log("Errore preparazione query UPDATE: " . $conn->error);
|
||||||
|
echo json_encode(['status' => 'error', 'message' => 'Errore preparazione query UPDATE: ' . $conn->error]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$stmt->bind_param("si", $new_expiry, $order_id);
|
||||||
|
|
||||||
|
$response = [];
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
if ($stmt->affected_rows > 0) {
|
||||||
|
$response['status'] = 'success';
|
||||||
|
$response['message'] = 'Data di scadenza aggiornata con successo!';
|
||||||
|
} else {
|
||||||
|
$response['status'] = 'error';
|
||||||
|
$response['message'] = 'Nessuna riga aggiornata. Verifica l\'idorderbook.';
|
||||||
|
error_log("Nessuna riga aggiornata per idorderbook: $order_id");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$response['status'] = 'error';
|
||||||
|
$response['message'] = 'Errore SQL: ' . $stmt->error;
|
||||||
|
error_log("Errore SQL: " . $stmt->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->close();
|
||||||
|
ob_end_clean();
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode($response);
|
||||||
|
exit;
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
require_once('Connections/bkngstm.php');
|
||||||
|
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
die(json_encode(['success' => false, 'error' => 'Connessione fallita: ' . $conn->connect_error]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['userid']) && isset($_POST['lessonnotification'])) {
|
||||||
|
$userid = $_POST['userid'];
|
||||||
|
$lessonnotification = $_POST['lessonnotification'];
|
||||||
|
|
||||||
|
// Validate lessonnotification value
|
||||||
|
if (!in_array($lessonnotification, ['Y', 'N'])) {
|
||||||
|
echo json_encode(['success' => false, 'error' => 'Valore lessonnotification non valido']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = "UPDATE auth_users SET lessonnotification = ? WHERE id = ?";
|
||||||
|
$stmt = $conn->prepare($query);
|
||||||
|
$stmt->bind_param("si", $lessonnotification, $userid);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
echo json_encode(['success' => true]);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['success' => false, 'error' => $conn->error]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->close();
|
||||||
|
} else {
|
||||||
|
echo json_encode(['success' => false, 'error' => 'Parametri mancanti']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn->close();
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.7 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.7 MiB |
+64
-7
@@ -30,12 +30,15 @@ if ($currentDate > $currentMonthStart) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$currentMonthEnd = date("Y-m-t", strtotime($currentMonthStart));
|
$currentMonthEnd = date("Y-m-t", strtotime($currentMonthStart));
|
||||||
echo $currentMonthEnd;
|
$bookedclass->setQuery("SELECT bookingclass.*, service.*, serviceschedule.*, orderbook.expireon
|
||||||
$bookedclass->setQuery("SELECT * FROM bookingclass
|
FROM bookingclass
|
||||||
LEFT JOIN service ON bookingclass.idservice = service.idservice
|
LEFT JOIN service ON bookingclass.idservice = service.idservice
|
||||||
LEFT JOIN serviceschedule ON bookingclass.idserviceschedule = serviceschedule.idserviceschedule
|
LEFT JOIN serviceschedule ON bookingclass.idserviceschedule = serviceschedule.idserviceschedule
|
||||||
|
LEFT JOIN orderbook ON bookingclass.idorder = orderbook.idorderbook
|
||||||
WHERE bookingclass.iduser = '$iduserlogin' AND bookingclass.status = 'booked'
|
WHERE bookingclass.iduser = '$iduserlogin' AND bookingclass.status = 'booked'
|
||||||
AND serviceschedule.dateschedule BETWEEN '$currentMonthStart' AND DATE_ADD('$currentMonthEnd', INTERVAL 1 DAY) ORDER BY serviceschedule.dateschedule");
|
AND serviceschedule.dateschedule BETWEEN '$currentMonthStart' AND DATE_ADD('$currentMonthEnd', INTERVAL 1 DAY)
|
||||||
|
ORDER BY serviceschedule.dateschedule");
|
||||||
|
|
||||||
$bookedclass->execute();
|
$bookedclass->execute();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -85,15 +88,15 @@ $iduser = $iduserlogin; // Sostituisci con l'ID utente desiderato
|
|||||||
// Data e ora attuali
|
// Data e ora attuali
|
||||||
$currentDateTime = date("Y-m-d H:i:s");
|
$currentDateTime = date("Y-m-d H:i:s");
|
||||||
|
|
||||||
// Query per contare i record con data e ora passate e future
|
// Query per contare i record con data e ora passate e future, escludendo status = 'cancelled'
|
||||||
$query = "SELECT COUNT(*) AS total,
|
$query = "SELECT COUNT(*) AS total,
|
||||||
SUM(CASE WHEN serviceschedule.dateschedule <= '$currentDateTime' AND bookingclass.status = 'booked' AND bookingclass.lostlesson = 'N' THEN 1 ELSE 0 END) AS passed,
|
SUM(CASE WHEN serviceschedule.dateschedule <= '$currentDateTime' AND bookingclass.status = 'booked' AND bookingclass.lostlesson = 'N' THEN 1 ELSE 0 END) AS passed,
|
||||||
SUM(CASE WHEN serviceschedule.dateschedule > '$currentDateTime' AND bookingclass.status = 'booked' AND bookingclass.lostlesson = 'N' THEN 1 ELSE 0 END) AS future,
|
SUM(CASE WHEN serviceschedule.dateschedule > '$currentDateTime' AND bookingclass.status = 'booked' AND bookingclass.lostlesson = 'N' THEN 1 ELSE 0 END) AS future,
|
||||||
SUM(CASE WHEN bookingclass.lostlesson = 'Y' THEN 1 ELSE 0 END) AS lost,
|
SUM(CASE WHEN bookingclass.lostlesson = 'Y' AND bookingclass.status != 'cancelled' THEN 1 ELSE 0 END) AS lost,
|
||||||
SUM(CASE WHEN bookingclass.status = 'pending' THEN 1 ELSE 0 END) AS pending
|
SUM(CASE WHEN bookingclass.status = 'pending' THEN 1 ELSE 0 END) AS pending
|
||||||
FROM bookingclass
|
FROM bookingclass
|
||||||
LEFT JOIN serviceschedule ON bookingclass.idserviceschedule = serviceschedule.idserviceschedule
|
LEFT JOIN serviceschedule ON bookingclass.idserviceschedule = serviceschedule.idserviceschedule
|
||||||
WHERE bookingclass.iduser = $iduser";
|
WHERE bookingclass.iduser = $iduser AND bookingclass.status != 'cancelled'";
|
||||||
|
|
||||||
$result = $conn->query($query);
|
$result = $conn->query($query);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
@@ -311,6 +314,29 @@ $conn->close();
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function confirmDeleteOnly(idbookingclass, expirydate) {
|
||||||
|
Swal.fire({
|
||||||
|
title: "Attenzione",
|
||||||
|
html: `
|
||||||
|
<strong>Confermi di voler cancellare questa lezione?</strong><br><br>
|
||||||
|
<strong>RICORDA:</strong> dovrai riprogrammarla entro la scadenza del tuo abbonamento per non perderla!<br><br>
|
||||||
|
<span style="font-size:20px;color:#d33;font-weight:bold;">
|
||||||
|
Scadenza: ${expirydate}
|
||||||
|
</span>
|
||||||
|
`,
|
||||||
|
icon: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: "Procedi",
|
||||||
|
cancelButtonText: "Annulla",
|
||||||
|
confirmButtonColor: "#d33",
|
||||||
|
cancelButtonColor: "#3085d6"
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
window.location.href = "delete_lesson.php?id=" + idbookingclass;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -423,6 +449,14 @@ $conn->close();
|
|||||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
<?php if (isset($_GET['deleted'])) { ?>
|
||||||
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||||
|
<i class="mdi mdi-check-all me-2"></i>
|
||||||
|
Lezione cancellata con successo! Grazie per aver liberato il posto!
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -499,6 +533,10 @@ $conn->close();
|
|||||||
if ($bookedclass->TotalRows == 0) {
|
if ($bookedclass->TotalRows == 0) {
|
||||||
echo "<p>Prenotazioni non presenti per questo mese</p>";
|
echo "<p>Prenotazioni non presenti per questo mese</p>";
|
||||||
} else {
|
} else {
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
die("Connessione fallita: " . $conn->connect_error);
|
||||||
|
}
|
||||||
while (!$bookedclass->atEnd()) {
|
while (!$bookedclass->atEnd()) {
|
||||||
$wa_startindex = $bookedclass->Index;
|
$wa_startindex = $bookedclass->Index;
|
||||||
$dateschedule = $bookedclass->getColumnVal("dateschedule");
|
$dateschedule = $bookedclass->getColumnVal("dateschedule");
|
||||||
@@ -530,6 +568,18 @@ $conn->close();
|
|||||||
// Per lezioni in giorni futuri, la riprogrammazione è sempre consentita
|
// Per lezioni in giorni futuri, la riprogrammazione è sempre consentita
|
||||||
$canBeDeleted = true;
|
$canBeDeleted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Verifica il limite di riprogrammazioni per l'ordine
|
||||||
|
$idorder = $bookedclass->getColumnVal("idorder");
|
||||||
|
$query = "SELECT maxreschedule, reprogrammed FROM orderbook WHERE idorderbook = '$idorder'";
|
||||||
|
$result = $conn->query($query);
|
||||||
|
$canReprogram = true;
|
||||||
|
if ($result && $result->num_rows > 0) {
|
||||||
|
$row = $result->fetch_assoc();
|
||||||
|
$maxreschedule = $row['maxreschedule'] ?? 0;
|
||||||
|
$reprogrammed = $row['reprogrammed'] ?? 0;
|
||||||
|
$canReprogram = $reprogrammed < $maxreschedule;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<div class="custom-card" onclick="toggleCard(this)">
|
<div class="custom-card" onclick="toggleCard(this)">
|
||||||
<div class="custom-date-box" style="background-color:#1ebf73">
|
<div class="custom-date-box" style="background-color:#1ebf73">
|
||||||
@@ -546,11 +596,17 @@ $conn->close();
|
|||||||
</button>
|
</button>
|
||||||
<?php $idbookingclass = $bookedclass->getColumnVal("idbookingclass"); ?>
|
<?php $idbookingclass = $bookedclass->getColumnVal("idbookingclass"); ?>
|
||||||
<?php $idservice = $bookedclass->getColumnVal("idservice"); ?>
|
<?php $idservice = $bookedclass->getColumnVal("idservice"); ?>
|
||||||
<?php if ($canBeDeleted) : ?>
|
<?php $expirydate = date("d/m/Y", strtotime($bookedclass->getColumnVal("expireon"))); ?>
|
||||||
|
<?php if ($canBeDeleted && $canReprogram) : ?>
|
||||||
<button class="custom-action-button" onclick="confirmDelete(<?php echo $idbookingclass; ?>, <?php echo $idservice; ?>, 'bookingpanel.php')">
|
<button class="custom-action-button" onclick="confirmDelete(<?php echo $idbookingclass; ?>, <?php echo $idservice; ?>, 'bookingpanel.php')">
|
||||||
<i class="fas fa-calendar-alt"></i> Riprogramma
|
<i class="fas fa-calendar-alt"></i> Riprogramma
|
||||||
</button>
|
</button>
|
||||||
|
<button class="custom-action-button"
|
||||||
|
onclick="confirmDeleteOnly(<?php echo $idbookingclass; ?>, '<?php echo $expirydate; ?>')">
|
||||||
|
<i class="fas fa-trash"></i> Cancella
|
||||||
|
</button>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
|
|
||||||
<button class="custom-action-button"> <i class="fas fa-exclamation-circle"></i> Non puoi riprogrammare</button>
|
<button class="custom-action-button"> <i class="fas fa-exclamation-circle"></i> Non puoi riprogrammare</button>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
@@ -559,6 +615,7 @@ $conn->close();
|
|||||||
<?php
|
<?php
|
||||||
$bookedclass->moveNext();
|
$bookedclass->moveNext();
|
||||||
}
|
}
|
||||||
|
$conn->close();
|
||||||
}
|
}
|
||||||
$bookedclass->moveFirst();
|
$bookedclass->moveFirst();
|
||||||
unset($wa_startindex);
|
unset($wa_startindex);
|
||||||
|
|||||||
@@ -438,7 +438,7 @@ $conn->close();
|
|||||||
<input type="text" class="form-control" name="documentDescription" value="Certificato Medico" required><br>
|
<input type="text" class="form-control" name="documentDescription" value="Certificato Medico" required><br>
|
||||||
<label for="expiryDate">Data di Scadenza:</label>
|
<label for="expiryDate">Data di Scadenza:</label>
|
||||||
<input type="text" id="expiryDate" class="form-control" name="expiryDate" required><br>
|
<input type="text" id="expiryDate" class="form-control" name="expiryDate" required><br>
|
||||||
<label for="fileToUpload">Seleziona un File:</label>
|
<label for="fileToUpload">Seleziona un File: (peso massimo 16 MB)</label>
|
||||||
<input type="file" class="form-control" name="fileToUpload" required><br>
|
<input type="file" class="form-control" name="fileToUpload" required><br>
|
||||||
I documenti caricati sono solo a fini di sicurezza e cliccando su carica documento accetti il nostro regolamento privacy <br><br>
|
I documenti caricati sono solo a fini di sicurezza e cliccando su carica documento accetti il nostro regolamento privacy <br><br>
|
||||||
<input type="submit" class="btn btn-primary w-md" value="Carica Documento" name="submit">
|
<input type="submit" class="btn btn-primary w-md" value="Carica Documento" name="submit">
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
## Vanguard - Advanced PHP Login and User Management
|
## YogiBook Aury
|
||||||
|
|
||||||
- Website: https://vanguardapp.io
|
- Website: https://vanguardapp.io
|
||||||
- Documentation: https://milos.support-hub.io
|
- Documentation: https://milos.support-hub.io
|
||||||
- Developed by [Milos Stojanovic](https://mstojanovic.net)
|
- Developed by [Milos Stojanovic](https://mstojanovic.net)
|
||||||
|
|
||||||
|
Attenzione creati dei cron da mettere operativi
|
||||||
|
|
||||||
|
update_expired_lessons.php --> identifica le lezioni scadute e le mette in bookinglcass come scadute
|
||||||
|
non serve il cron perchè le sacadute partono da essre da programmare
|
||||||
Reference in New Issue
Block a user