Compare commits
24 Commits
1bcb7eb180
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 2392a267d1 | |||
| 9fdb56c7ed | |||
| aff67bc496 | |||
| 754c5f93f0 | |||
| 26fb165c98 | |||
| 8c3c3982ac | |||
| f1d9b8d31e | |||
| 318191cc31 | |||
| a061db1e87 | |||
| 8a86787501 | |||
| 10ef6db5c5 | |||
| 9447d62c27 | |||
| 77c938e8de | |||
| edc6bda47f | |||
| 3c8d8b9fab | |||
| eb7c0ff531 | |||
| 4b41240fea | |||
| 3b4718b6d2 | |||
| 26d5788278 | |||
| 653cc3e2c4 | |||
| e54668b960 | |||
| ef9ba730fc | |||
| 2d83c9da13 | |||
| 9254d420d2 |
@@ -1,5 +1,5 @@
|
||||
APP_ENV=production
|
||||
APP_DEBUG=false
|
||||
APP_DEBUG=true
|
||||
APP_KEY=base64:aj3bR0zA9I8nZ1Rm5alncE4QFTPNoHVkd8YSRJEImwY=
|
||||
APP_URL=https://yogibook.yogasoul.it
|
||||
|
||||
@@ -31,7 +31,6 @@ MAIL_USERNAME=info@yogasoul.it
|
||||
MAIL_PASSWORD=!Testolina88
|
||||
MAIL_ENCRYPTION=ssl
|
||||
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
|
||||
+22
-1
@@ -1,2 +1,23 @@
|
||||
.DS_Store
|
||||
|
||||
/node_modules
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
/.idea
|
||||
/.fleet
|
||||
/.vscode
|
||||
/.vagrant
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
.env
|
||||
.phpunit.result.cache
|
||||
.php_cs.cache
|
||||
/documentation
|
||||
/.phpunit.cache
|
||||
/public/build
|
||||
.env.backup
|
||||
.env.production
|
||||
auth.json
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<?php phpinfo();
|
||||
@@ -9,10 +9,10 @@ $dotenv = Dotenv::createImmutable(__DIR__ . '/../../');
|
||||
$dotenv->load();
|
||||
|
||||
// Prende i valori dal .env
|
||||
$hostname_bkngstm = $_ENV['DB_HOST'] ?? 'localhost';
|
||||
$database_bkngstm = $_ENV['DB_DATABASE'] ?? 'yogibookaury';
|
||||
$username_bkngstm = $_ENV['DB_USERNAME'] ?? 'root';
|
||||
$password_bkngstm = $_ENV['DB_PASSWORD'] ?? '';
|
||||
$hostname_bkngstm = $_ENV['DB_HOST'];
|
||||
$database_bkngstm = $_ENV['DB_DATABASE'];
|
||||
$username_bkngstm = $_ENV['DB_USERNAME'];
|
||||
$password_bkngstm = $_ENV['DB_PASSWORD'];
|
||||
|
||||
$servername = $hostname_bkngstm;
|
||||
$username = $username_bkngstm;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
?>
|
||||
@@ -8,20 +9,18 @@ include('include/headscript.php');
|
||||
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
|
||||
// Recupera il parametro "idbookingclass" dalla richiesta GET
|
||||
if (isset($_GET['idbookingclass'])) {
|
||||
$idbookingclass = $_GET['idbookingclass'];
|
||||
|
||||
// Aggiorna lo status a "booked" nella tabella "bookingclass"
|
||||
$query = "UPDATE bookingclass SET status = 'booked' WHERE idbookingclass = ?";
|
||||
// Aggiorna lo status a "booked" e is_reprogrammed a "Y" nella tabella "bookingclass"
|
||||
$query = "UPDATE bookingclass SET status = 'booked', is_reprogrammed = 'Y' WHERE idbookingclass = ?";
|
||||
$stmt = $conn->prepare($query);
|
||||
|
||||
if ($stmt) {
|
||||
$stmt->bind_param("i", $idbookingclass);
|
||||
if ($stmt->execute())
|
||||
|
||||
//query
|
||||
if ($stmt->execute()) {
|
||||
// Query per recuperare i dettagli della prenotazione
|
||||
$query = "SELECT bookingclass.*, auth_users.*, service.*
|
||||
FROM bookingclass
|
||||
LEFT JOIN auth_users ON bookingclass.iduser = auth_users.id
|
||||
@@ -38,13 +37,13 @@ if ($result) {
|
||||
$emailuser = $row['email'];
|
||||
$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>
|
||||
// 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>
|
||||
@@ -64,7 +63,6 @@ $buttonedit="<a href='https://yogibook.yogasoul.it/' target='_blank' class='v-bu
|
||||
<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->isSMTP(); // Set mailer to use SMTP
|
||||
@@ -75,39 +73,31 @@ $mail->Password = '!Testolina88'; // SMTP password
|
||||
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
|
||||
$mail->Port = '587';
|
||||
|
||||
|
||||
include('mail/emailtemplate2.php');
|
||||
// Email body content
|
||||
|
||||
//$trfnmbmail=$appformn.'r'.$revnumb;
|
||||
$htmlContent = $mailmessage1;
|
||||
|
||||
|
||||
$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->send();
|
||||
|
||||
//mail sent
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 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 {
|
||||
echo "Errore durante l'esecuzione della query: " . $stmt->error;
|
||||
echo "Errore durante l'esecuzione della query: " . $conn->error;
|
||||
}
|
||||
$stmt->close();
|
||||
} else {
|
||||
echo "Errore durante l'esecuzione della query: " . $stmt->error;
|
||||
}
|
||||
} else {
|
||||
echo "Errore nella preparazione della query: " . $conn->error;
|
||||
}
|
||||
@@ -118,9 +108,3 @@ $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
||||
// Chiudi la connessione al database
|
||||
$conn->close();
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+244
-281
@@ -1,17 +1,21 @@
|
||||
<?php require_once('include/headscript.php'); ?>
|
||||
<?php // require_once('Connections/bkngstm.php');
|
||||
?>
|
||||
<?php // require_once('webassist/mysqli/rsobj.php');
|
||||
?>
|
||||
<?php // require_once('webassist/mysqli/queryobj.php');
|
||||
?>
|
||||
<?php // optionquery
|
||||
$optionquery = new WA_MySQLi_RS("optionquery", $bkngstm, 0);
|
||||
$optionquery->setQuery("SELECT * FROM option");
|
||||
$optionquery->execute();
|
||||
?>
|
||||
|
||||
<?php
|
||||
$bookedclass = new WA_MySQLi_RS("bookedclass", $bkngstm, 0);
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
if ($conn->connect_error) {
|
||||
die("Connessione fallita: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// Recupera maxbeforetimecancell dalla tabella option
|
||||
$option_query = "SELECT maxbeforetimecancell FROM option LIMIT 1";
|
||||
$option_result = $conn->query($option_query);
|
||||
if ($option_result && $option_result->num_rows > 0) {
|
||||
$option_row = $option_result->fetch_assoc();
|
||||
$timetocancel = $option_row['maxbeforetimecancell'];
|
||||
} else {
|
||||
$timetocancel = 24; // Valore predefinito se non trovato (es. 24 ore)
|
||||
}
|
||||
|
||||
// Verifica se è stata specificata una richiesta per cambiare il mese
|
||||
if (isset($_GET['prev_month'])) {
|
||||
@@ -22,34 +26,17 @@ if (isset($_GET['prev_month'])) {
|
||||
$currentMonthStart = date("Y-m-01");
|
||||
}
|
||||
|
||||
$currentDate = date("Y-m-d");
|
||||
|
||||
// Modifica: Se la data odierna è dopo l'inizio del mese corrente, imposta la data odierna come inizio
|
||||
//if ($currentDate > $currentMonthStart) {
|
||||
// $currentMonthStart = $currentDate;
|
||||
//}
|
||||
|
||||
$currentMonthEnd = date("Y-m-t", strtotime($currentMonthStart));
|
||||
|
||||
$bookedclass = new WA_MySQLi_RS("bookedclass", $conn, 0);
|
||||
$bookedclass->setQuery("SELECT * FROM serviceschedule
|
||||
LEFT JOIN service ON serviceschedule.idservice = service.idservice
|
||||
WHERE serviceschedule.dateschedule BETWEEN '$currentMonthStart' AND DATE_ADD('$currentMonthEnd', INTERVAL 1 DAY) ORDER BY serviceschedule.dateschedule");
|
||||
$bookedclass->execute();
|
||||
|
||||
?>
|
||||
|
||||
<?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 = 1;
|
||||
|
||||
// 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
|
||||
@@ -67,31 +54,17 @@ if ($result->num_rows > 0) {
|
||||
$totalTickets = $row["total_tickets"];
|
||||
}
|
||||
} else {
|
||||
$totalTickets = 0; // Imposta a zero se non ci sono righe nella query
|
||||
$totalTickets = 0;
|
||||
}
|
||||
|
||||
$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 = 1; // 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
|
||||
$currentDateTime = date("Y-m-d H:i:s");
|
||||
$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";
|
||||
WHERE bookingclass.iduser = $userid";
|
||||
|
||||
$result = $conn->query($query);
|
||||
if ($result) {
|
||||
@@ -100,7 +73,7 @@ if ($result) {
|
||||
$passedRecords = $row['passed'];
|
||||
$futureRecords = $row['future'];
|
||||
}
|
||||
// Chiusura della connessione
|
||||
|
||||
$conn->close();
|
||||
?>
|
||||
|
||||
@@ -108,31 +81,20 @@ $conn->close();
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<title>YogiBook - Prenotazioni YogaSoul</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="YogiBook - Prenotazione facile YogaSOul" name="description" />
|
||||
<meta content="Advanced Creative Solutions" name="author" />
|
||||
<!-- App favicon -->
|
||||
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
||||
|
||||
<!-- Bootstrap Css -->
|
||||
<link href="assets/css/bootstrap.min.css" id="bootstrap-style" rel="stylesheet" type="text/css" />
|
||||
<!-- Icons Css -->
|
||||
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
||||
<!-- App Css-->
|
||||
<link href="assets/css/app.min.css" id="app-style" rel="stylesheet" type="text/css" />
|
||||
|
||||
<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>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script>
|
||||
// Function to handle the click event on the "Rimuovi" button
|
||||
function handleRemoveClick(idbookingclass) {
|
||||
// Display SweetAlert confirmation
|
||||
Swal.fire({
|
||||
title: 'Sei sicuro?',
|
||||
text: 'Questa azione rimuoverà la persona dalla classe. Vuoi procedere?',
|
||||
@@ -142,18 +104,15 @@ $conn->close();
|
||||
cancelButtonText: 'Annulla',
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// If user confirms, redirect to the removebooking.php page
|
||||
window.location.href = `removebooking.php?idbookingclass=${idbookingclass}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
// Handle "Persa" button click
|
||||
$(".lost-button").click(function() {
|
||||
var idbookingclass = $(this).data("idbookingclass");
|
||||
|
||||
// Mostra un SweetAlert di conferma
|
||||
Swal.fire({
|
||||
title: 'Sei sicuro?',
|
||||
text: 'Vuoi davvero contrassegnare questa lezione come persa?',
|
||||
@@ -163,7 +122,6 @@ $conn->close();
|
||||
cancelButtonText: 'Annulla'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Se l'utente conferma, esegui l'aggiornamento
|
||||
$.ajax({
|
||||
url: "aggiorna_campo_lost.php",
|
||||
method: "POST",
|
||||
@@ -171,7 +129,6 @@ $conn->close();
|
||||
idbookingclass: idbookingclass
|
||||
},
|
||||
success: function(response) {
|
||||
// Dopo aver contrassegnato con successo la lezione come persa, reindirizza all'adminpanel
|
||||
window.location.href = 'adminpanel.php?success=1';
|
||||
},
|
||||
error: function() {
|
||||
@@ -181,46 +138,220 @@ $conn->close();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
// Handle "Ripristina" button click
|
||||
$(".restore-button").click(function() {
|
||||
var idbookingclass = $(this).data("idbookingclass");
|
||||
Swal.fire({
|
||||
title: 'Sei sicuro?',
|
||||
text: 'Vuoi davvero ripristinare questa lezione?',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Sì, ripristina',
|
||||
cancelButtonText: 'Annulla'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: "ripristina_campo_lost.php",
|
||||
method: "POST",
|
||||
data: {
|
||||
idbookingclass: idbookingclass
|
||||
},
|
||||
success: function(response) {
|
||||
window.location.href = 'adminpanel.php?success=2';
|
||||
},
|
||||
error: function() {
|
||||
Swal.fire('Errore durante il ripristino', '', 'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Handle "Riprogramma" button click
|
||||
$(".reprogram-button").click(function() {
|
||||
var idbookingclass = $(this).data("idbookingclass");
|
||||
$.ajax({
|
||||
url: "get_available_classes.php?t=" + new Date().getTime(),
|
||||
method: "GET",
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data.error) {
|
||||
Swal.fire('Errore', data.error, 'error');
|
||||
console.error('Errore nella risposta JSON:', data.error);
|
||||
return;
|
||||
}
|
||||
|
||||
// Crea la tendina con le lezioni disponibili
|
||||
let selectOptions = '';
|
||||
let selectedSet = false;
|
||||
const now = new Date();
|
||||
const 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'
|
||||
};
|
||||
|
||||
data.classes.forEach(function(cls) {
|
||||
// Gestione della data
|
||||
let displayDate;
|
||||
if (cls.display_dateschedule) {
|
||||
displayDate = cls.display_dateschedule;
|
||||
} else if (cls.dateschedule) {
|
||||
// Converte dateschedule (es. "2024-10-28 19:30") in formato italiano
|
||||
const dateObj = new Date(cls.dateschedule);
|
||||
const day = dateObj.getDate().toString().padStart(2, '0');
|
||||
const month = italianMonths[dateObj.toLocaleString('en-US', {
|
||||
month: 'long'
|
||||
})];
|
||||
const year = dateObj.getFullYear();
|
||||
const hours = dateObj.getHours().toString().padStart(2, '0');
|
||||
const minutes = dateObj.getMinutes().toString().padStart(2, '0');
|
||||
displayDate = `${day} ${month} ${year} ${hours}:${minutes}`;
|
||||
} else {
|
||||
displayDate = 'Data non disponibile';
|
||||
}
|
||||
|
||||
// Gestione dell'occupazione
|
||||
const occupancy = (typeof cls.occupied_seats !== 'undefined' && typeof cls.maxcapacity !== 'undefined') ?
|
||||
`(${cls.occupied_seats}/${cls.maxcapacity})` :
|
||||
'(0/0)';
|
||||
|
||||
// Selezione della data per il confronto
|
||||
const classDate = cls.iso_dateschedule ? new Date(cls.iso_dateschedule) : (cls.dateschedule ? new Date(cls.dateschedule) : new Date());
|
||||
const isSelected = !selectedSet && classDate >= now ? 'selected' : '';
|
||||
if (!selectedSet && classDate >= now) selectedSet = true;
|
||||
|
||||
selectOptions += `<option value="${cls.idserviceschedule}" ${isSelected}>${cls.servicename} - ${displayDate} ${occupancy}</option>`;
|
||||
});
|
||||
|
||||
Swal.fire({
|
||||
title: 'Riprogramma Lezione',
|
||||
html: `
|
||||
<label for="class-select">Seleziona una lezione:</label>
|
||||
<select id="class-select" class="form-control" style="width: 100%;">
|
||||
${selectOptions}
|
||||
</select>
|
||||
<br>
|
||||
<label for="is-reprogrammed">Segna come riprogrammata:</label>
|
||||
<input type="checkbox" id="is-reprogrammed" name="is_reprogrammed" checked>
|
||||
`,
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Riprogramma',
|
||||
cancelButtonText: 'Annulla',
|
||||
preConfirm: () => {
|
||||
const selectedClass = document.getElementById('class-select').value;
|
||||
const isReprogrammed = document.getElementById('is-reprogrammed').checked ? 'Y' : 'N';
|
||||
if (!selectedClass) {
|
||||
Swal.showValidationMessage('Seleziona una lezione');
|
||||
return false;
|
||||
}
|
||||
return {
|
||||
idbookingclass: idbookingclass,
|
||||
idserviceschedule: selectedClass,
|
||||
is_reprogrammed: isReprogrammed
|
||||
};
|
||||
}
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: "reprogramclass.php",
|
||||
method: "POST",
|
||||
data: {
|
||||
idbookingclass: result.value.idbookingclass,
|
||||
idserviceschedule: result.value.idserviceschedule,
|
||||
is_reprogrammed: result.value.is_reprogrammed
|
||||
},
|
||||
success: function(response) {
|
||||
window.location.href = 'adminpanel.php?success=3';
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Errore AJAX riprogrammazione:', status, error, xhr.responseText);
|
||||
Swal.fire('Errore durante la riprogrammazione', 'Dettagli: ' + status + ' - ' + error, 'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Errore AJAX:', status, error, xhr.responseText);
|
||||
Swal.fire('Errore durante il recupero delle lezioni', 'Dettagli: ' + status + ' - ' + error, 'error');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function confirmDelete(id, deletePageUrl) {
|
||||
Swal.fire({
|
||||
title: "Sei sicuro?",
|
||||
text: "Questa prenotazione verrà cancellata definitivamente! Ricordati poi di riprogrammare la tua lezione!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#d33",
|
||||
cancelButtonColor: "#3085d6",
|
||||
confirmButtonText: "Sì, cancella!",
|
||||
cancelButtonText: "Annulla"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = `deleteclass.php?id=${id}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.lost-button {
|
||||
.lost-button,
|
||||
.restore-button,
|
||||
.reprogram-button {
|
||||
background-color: orange;
|
||||
/* Imposta il colore arancione */
|
||||
color: white;
|
||||
/* Imposta il testo in bianco o altro colore a tua scelta */
|
||||
border: none;
|
||||
padding: 6px 12px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.restore-button {
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
.reprogram-button {
|
||||
background-color: #007bff;
|
||||
}
|
||||
|
||||
.lost-button:hover {
|
||||
background-color: darkorange;
|
||||
/* Cambia il colore al passaggio del mouse se lo desideri */
|
||||
}
|
||||
|
||||
.restore-button:hover {
|
||||
background-color: darkgreen;
|
||||
}
|
||||
|
||||
.reprogram-button:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
.email-search-results {
|
||||
position: absolute;
|
||||
/* O posizionamento relativo a seconda delle esigenze */
|
||||
top: 100%;
|
||||
/* Posizionamento rispetto all'elemento padre */
|
||||
left: 0;
|
||||
right: 0;
|
||||
background-color: white;
|
||||
/* Colore di sfondo */
|
||||
border: 1px solid #ccc;
|
||||
/* Bordo */
|
||||
max-height: 200px;
|
||||
/* Altezza massima */
|
||||
overflow-y: auto;
|
||||
/* Scorrimento verticale se i risultati superano l'altezza massima */
|
||||
z-index: 1000;
|
||||
/* Per sovrapporre altri elementi */
|
||||
display: none;
|
||||
/* Inizialmente nascosto */
|
||||
}
|
||||
|
||||
.custom-card {
|
||||
@@ -298,7 +429,6 @@ $conn->close();
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
|
||||
.custom-action-button {
|
||||
background-color: #f0f0f0;
|
||||
border: none;
|
||||
@@ -327,8 +457,7 @@ $conn->close();
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
|
||||
.month-navigation {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
@@ -347,69 +476,39 @@ $conn->close();
|
||||
font-size: 24px;
|
||||
margin: 0 20px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function confirmDelete(id, deletePageUrl) {
|
||||
Swal.fire({
|
||||
title: "Sei sicuro?",
|
||||
text: "Questa prenotazione verrà cancellata definitivamente! Ricordati poi di riprogrammare la tua lezione!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#d33",
|
||||
cancelButtonColor: "#3085d6",
|
||||
confirmButtonText: "Sì, cancella!",
|
||||
cancelButtonText: "Annulla"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Reindirizza direttamente alla pagina di cancellazione con l'ID come parametro.
|
||||
window.location.href = `deleteclass.php?id=${id}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.pastel-color {
|
||||
border: 1px solid #D1C4CC;
|
||||
padding: 0px;
|
||||
text-align: center;
|
||||
border-radius: 10px;
|
||||
margin-right: 20px;
|
||||
/* Spazio tra i box */
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.pastel-color.blue {
|
||||
background-color: #D4E1F1;
|
||||
/* Azzurro pastello */
|
||||
}
|
||||
|
||||
.pastel-color.green {
|
||||
background-color: #FFD8B5;
|
||||
/* Verde pastello */
|
||||
}
|
||||
|
||||
.pastel-color.pink {
|
||||
background-color: #C3E6CB;
|
||||
/* Rosa pastello */
|
||||
}
|
||||
|
||||
.pastel-color.purple {
|
||||
background-color: #F4CCCC;
|
||||
/* Viola pastello */
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.pastel-color {
|
||||
margin-right: 0;
|
||||
/* Rimuovi lo spazio tra i box */
|
||||
margin-bottom: 20px;
|
||||
/* Spazio tra i box */
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
|
||||
.booking-details {
|
||||
margin-top: 10px;
|
||||
border-top: 1px solid #ccc;
|
||||
@@ -422,7 +521,6 @@ $conn->close();
|
||||
margin-top: 5px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
border: 1px solid #333;
|
||||
/* Aggiunto il bordo grigio scuro */
|
||||
}
|
||||
|
||||
.booking-row td {
|
||||
@@ -432,14 +530,11 @@ $conn->close();
|
||||
|
||||
.delete-cell {
|
||||
text-align: left;
|
||||
/* Allinea il contenuto a sinistra */
|
||||
vertical-align: top;
|
||||
/* Allinea il contenuto in alto */
|
||||
}
|
||||
|
||||
.delete-button {
|
||||
display: block;
|
||||
/* Per occupare l'intera larghezza del cell */
|
||||
padding: 6px 12px;
|
||||
border: none;
|
||||
background-color: #e74c3c;
|
||||
@@ -453,40 +548,25 @@ $conn->close();
|
||||
background-color: #d64937;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- <body data-layout="horizontal"> -->
|
||||
|
||||
<!-- Begin page -->
|
||||
<div id="layout-wrapper">
|
||||
|
||||
<!-- Top Bar -->
|
||||
<header id="page-topbar" class="isvertical-topbar">
|
||||
<div class="navbar-header">
|
||||
<div class="d-flex">
|
||||
<!-- LOGO -->
|
||||
<?php include('include/logoarea.php'); ?>
|
||||
|
||||
<button type="button" class="btn btn-sm px-3 font-size-24 header-item waves-effect vertical-menu-btn">
|
||||
<i class="bx bx-menu align-middle"></i>
|
||||
</button>
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="page-title-box align-self-center d-none d-md-block">
|
||||
<h4 class="page-title mb-0">Prenotazione Classi</h4>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="d-flex">
|
||||
|
||||
<?php include('include/languageselection.php'); ?>
|
||||
|
||||
<div class="dropdown d-inline-block">
|
||||
<button type="button" class="btn header-item noti-icon"
|
||||
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<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">
|
||||
@@ -500,64 +580,33 @@ $conn->close();
|
||||
</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 class="d-flex"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="topnav">
|
||||
<div class="container-fluid">
|
||||
<nav class="navbar navbar-light navbar-expand-lg topnav-menu">
|
||||
|
||||
|
||||
</nav>
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$toprogram = $totalTickets - $passedRecords - $futureRecords;
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="">
|
||||
<div class="row mb-2">
|
||||
<div class="col-xl-3 col-md-12">
|
||||
@@ -565,51 +614,43 @@ $conn->close();
|
||||
<form class="email-search">
|
||||
<div class="position-relative">
|
||||
<h3>Classi</h3>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xl-9 col-md-12">
|
||||
<div class="text-sm-end">
|
||||
<?php if ($toprogram > 0) {
|
||||
echo '<button type="button" class="btn btn-info btn-rounded waves-effect waves-light mb-2 me-2" data-bs-toggle="modal" data-bs-target=".create-task"><i class="mdi mdi-plus me-1"></i> Programma Lezioni</button>';
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if (isset($_GET['success']) && $_GET['success'] == 1) { ?>
|
||||
|
||||
if (isset($_GET['success'])) {
|
||||
if ($_GET['success'] == 1) { ?>
|
||||
<div class="alert alert-danger success-message" role="alert">
|
||||
Lezione segnata come persa con successo
|
||||
</div>
|
||||
<?php
|
||||
<?php } elseif ($_GET['success'] == 2) { ?>
|
||||
<div class="alert alert-success success-message" role="alert">
|
||||
Lezione ripristinata con successo
|
||||
</div>
|
||||
<?php } elseif ($_GET['success'] == 3) { ?>
|
||||
<div class="alert alert-success success-message" role="alert">
|
||||
Lezione riprogrammata con successo
|
||||
</div>
|
||||
<?php }
|
||||
}
|
||||
?>
|
||||
<div class="container-fluid">
|
||||
<!-- starts cards -->
|
||||
|
||||
|
||||
|
||||
<!-- Aggiungi le frecce per la navigazione tra i mesi -->
|
||||
<?php
|
||||
$italianMonths = [
|
||||
"January" => "Gennaio",
|
||||
@@ -625,7 +666,6 @@ $conn->close();
|
||||
"November" => "Novembre",
|
||||
"December" => "Dicembre"
|
||||
];
|
||||
|
||||
?>
|
||||
<div class="month-navigation">
|
||||
<a href="?prev_month=<?php echo date('Y-m', strtotime('-1 month', strtotime($currentMonthStart))); ?>" class="arrow-link">
|
||||
@@ -637,10 +677,6 @@ $conn->close();
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$wa_startindex = 0;
|
||||
|
||||
@@ -651,60 +687,20 @@ $conn->close();
|
||||
$wa_startindex = $bookedclass->Index;
|
||||
?>
|
||||
<?php
|
||||
// Data dalla variabile $bookedclass->getColumnVal("dateschedule")
|
||||
$dateschedule = $bookedclass->getColumnVal("dateschedule");
|
||||
|
||||
// Converti la data in un oggetto DateTime
|
||||
$dateObj = new DateTime($dateschedule);
|
||||
|
||||
// Estrai il giorno e il mese in italiano
|
||||
$dayInItalian = $dateObj->format("d");
|
||||
$monthInItalian = $dateObj->format("F");
|
||||
|
||||
// Mappa dei nomi dei mesi in italiano
|
||||
$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"
|
||||
];
|
||||
|
||||
// Sostituisci il nome del mese con la versione italiana
|
||||
$monthInItalian = $italianMonths[$monthInItalian];
|
||||
?>
|
||||
<?php
|
||||
// Data dalla variabile $bookedclass->getColumnVal("dateschedule")
|
||||
$dateschedule = $bookedclass->getColumnVal("dateschedule");
|
||||
|
||||
// Converti la data in un oggetto DateTime
|
||||
$dateObj = new DateTime($dateschedule);
|
||||
|
||||
// Formatta la data nel nuovo formato desiderato
|
||||
$newDateFormat = $dateObj->format("d-m-Y H:i");
|
||||
|
||||
// Calculate the time difference in hours
|
||||
$currentTime = new DateTime();
|
||||
$classTime = new DateTime($dateschedule);
|
||||
$timeDifference = $classTime->diff($currentTime);
|
||||
$hoursDifference = $timeDifference->h + $timeDifference->days * 24;
|
||||
|
||||
// Check if the time difference is less than 6 hours
|
||||
$timetocancel = $optionquery->getColumnVal("maxbeforetimecancell");
|
||||
$canBeDeleted = ($hoursDifference >= $timetocancel);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<?php $mysqli = new mysqli($servername, $username, $password, $dbname);
|
||||
// Esegui una nuova query per ottenere le persone prenotate per l'evento corrente
|
||||
$mysqli = new mysqli($servername, $username, $password, $dbname);
|
||||
$eventId = $bookedclass->getColumnVal("idserviceschedule");
|
||||
$bookingQuery = "SELECT bookingclass.*, auth_users.first_name, auth_users.last_name, auth_users.id
|
||||
FROM bookingclass
|
||||
@@ -714,8 +710,6 @@ $conn->close();
|
||||
$stmt->bind_param("i", $eventId);
|
||||
$stmt->execute();
|
||||
$bookingResult = $stmt->get_result();
|
||||
|
||||
// Calcola il numero di persone prenotate
|
||||
$countPersons = $bookingResult->num_rows;
|
||||
$stmt->close();
|
||||
$mysqli->close();
|
||||
@@ -750,9 +744,18 @@ $conn->close();
|
||||
</button>
|
||||
</td>
|
||||
<td class="lost-cell">
|
||||
<?php if ($booking['lostlesson'] === 'Y'): ?>
|
||||
<button class="restore-button" data-idbookingclass="<?php echo $idbookedclass; ?>">
|
||||
<i class="fas fa-undo"></i> Ripristina
|
||||
</button>
|
||||
<?php else: ?>
|
||||
<button class="lost-button" data-idbookingclass="<?php echo $idbookedclass; ?>">
|
||||
<i class="fas fa-wind"></i> Persa
|
||||
</button>
|
||||
<button class="reprogram-button" data-idbookingclass="<?php echo $idbookedclass; ?>">
|
||||
<i class="fas fa-calendar-alt"></i> Riprogramma
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endwhile; ?>
|
||||
@@ -761,11 +764,8 @@ $conn->close();
|
||||
<form action="inserisci_record.php" method="post">
|
||||
<label for="name">Nome:</label>
|
||||
<input type="text" class="name" name="name"><br><br>
|
||||
|
||||
<label for="surname">Cognome:</label>
|
||||
<input type="text" class="surname" name="surname"><br><br>
|
||||
|
||||
|
||||
<label for="email">Email:</label>
|
||||
<input type="text" class="email" name="email"><br><br>
|
||||
<input type="hidden" class="userid" name="userid">
|
||||
@@ -774,17 +774,11 @@ $conn->close();
|
||||
<input type="hidden" id="idorder" name="idorder" value="0">
|
||||
<input type="hidden" id="idservice" name="idservice" value="<?php echo $bookedclass->getColumnVal("idservice"); ?>">
|
||||
<input type="hidden" id="bookingstart" name="bookingstart" value="<?php echo $dateschedule; ?>">
|
||||
|
||||
|
||||
<button type="submit">Inserisci</button>
|
||||
</form>
|
||||
|
||||
<div class="search-results"></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
let searchTimeout;
|
||||
@@ -855,11 +849,9 @@ $conn->close();
|
||||
bookings.style.display = bookings.style.display === 'block' ? 'none' : 'block';
|
||||
}
|
||||
</script>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
function toggleCard(card) {
|
||||
card.classList.toggle("expanded");
|
||||
@@ -879,55 +871,26 @@ $conn->close();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$bookedclass->moveNext();
|
||||
}
|
||||
}
|
||||
|
||||
$bookedclass->moveFirst(); // Ritorna all'inizio del recordset
|
||||
$bookedclass->moveFirst();
|
||||
unset($wa_startindex);
|
||||
unset($wa_repeatcount);
|
||||
?>
|
||||
<!-- Aggiungi altre card qui con le stesse classi -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Page-content -->
|
||||
|
||||
<?php include('include/footer.php'); ?>
|
||||
</div>
|
||||
<!-- end main content-->
|
||||
|
||||
</div>
|
||||
<!-- END layout-wrapper -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- JAVASCRIPT -->
|
||||
<script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="assets/libs/metismenujs/metismenujs.min.js"></script>
|
||||
<script src="assets/libs/simplebar/simplebar.min.js"></script>
|
||||
<script src="assets/libs/eva-icons/eva.min.js"></script>
|
||||
|
||||
<script src="assets/js/app.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+137
-79
@@ -1,107 +1,165 @@
|
||||
<?php
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
?>
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
|
||||
|
||||
require_once('include/headscript.php');
|
||||
if (isset($_GET['idorder'])) { $idorder = $_GET['idorder']; }
|
||||
if (isset($_GET['idnewbooking'])) { $idnewbooking = $_GET['idnewbooking']; }
|
||||
if (isset($_GET['iduser'])) { $iduser = $_GET['iduser']; }
|
||||
if (isset($_GET['idservicenew'])) { $idservicenew = $_GET['idservicenew']; }
|
||||
|
||||
// Effettua la cancellazione del record nella tabella bookingclass
|
||||
// Sostituisci questi passaggi con il codice reale per connettersi al database e eseguire la query di cancellazione
|
||||
|
||||
// Recupera i valori di bookingstart e idserviceschedule dalla tabella bookingclass
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
|
||||
$sqlnewbook = "SELECT dateschedule FROM serviceschedule WHERE idserviceschedule = $idnewbooking";
|
||||
$resultnew = $conn->query($sqlnewbook);
|
||||
|
||||
// Estrai il risultato e memorizzalo in $newtime
|
||||
$rownew = $resultnew->fetch_assoc();
|
||||
$newtime = $rownew["dateschedule"];
|
||||
|
||||
|
||||
|
||||
// Effettua l'inserimento del nuovo record nella tabella bookingclass
|
||||
$insertQuery = "INSERT INTO bookingclass (idserviceschedule, iduser, prevbookingstart, idprevserviceschedule, idservice, idorder, bookingstart, status)
|
||||
VALUES ($idnewbooking, $iduser, '0', '0', $idservicenew, $idorder, '$newtime', 'pending')";
|
||||
$conn->query($insertQuery);
|
||||
|
||||
// Chiudi la connessione al database
|
||||
$conn->close();
|
||||
$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;'>Hai inviato una richiesta di riprogrammazione della tua lezione </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>
|
||||
<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>
|
||||
|
||||
// Abilita il reporting degli errori per il debug
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
// Recupera i parametri GET
|
||||
$idorder = isset($_GET['idorder']) ? (int)$_GET['idorder'] : 0;
|
||||
$idnewbooking = isset($_GET['idnewbooking']) ? (int)$_GET['idnewbooking'] : 0;
|
||||
$iduser = isset($_GET['iduser']) ? (int)$_GET['iduser'] : 0;
|
||||
$idservicenew = isset($_GET['idservicenew']) ? (int)$_GET['idservicenew'] : 0;
|
||||
|
||||
// Valida i parametri richiesti
|
||||
if ($idorder === 0 || $idnewbooking === 0 || $iduser === 0 || $idservicenew === 0) {
|
||||
die("Errore: Parametri mancanti.");
|
||||
}
|
||||
|
||||
// Crea la connessione al database
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
if ($conn->connect_error) {
|
||||
die("Connessione al database fallita: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// Recupera dateschedule e servicename
|
||||
$query = "SELECT serviceschedule.dateschedule, service.servicename
|
||||
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();
|
||||
|
||||
if ($resultnew->num_rows > 0) {
|
||||
$rownew = $resultnew->fetch_assoc();
|
||||
$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();
|
||||
|
||||
// Aggiorna una prenotazione cancellata a pending (se esiste)
|
||||
$updateQuery = "UPDATE bookingclass
|
||||
SET status = 'pending'
|
||||
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
|
||||
$conn->close();
|
||||
|
||||
// Configura il contenuto dell'email
|
||||
$messageedit = "
|
||||
<p style='font-size: 14px; line-height: 190%;'>
|
||||
<span style='font-size: 18px; line-height: 34.2px;'>
|
||||
<strong>Ciao $firstname,</strong>
|
||||
</span>
|
||||
</p>
|
||||
<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 per il servizio <strong>$servicename</strong>.
|
||||
</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>
|
||||
<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: https://yogibook.yogasoul.it </span></p>
|
||||
<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 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 prima resettare la password cliccando qui:
|
||||
</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 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>
|
||||
<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>";
|
||||
<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>
|
||||
$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%;'>YogiBook - YogaSoul</span>
|
||||
</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');
|
||||
// Email body content
|
||||
|
||||
//$trfnmbmail=$appformn.'r'.$revnumb;
|
||||
$htmlContent = $mailmessage1;
|
||||
|
||||
|
||||
$mail->From = 'info@yogasoul.it';
|
||||
$mail->FromName = 'YogiBook [YogaSoul]';
|
||||
$mail->addAddress($emailuser); // Add a recipient
|
||||
|
||||
|
||||
// Configura l'email
|
||||
$mail = new PHPMailer(true);
|
||||
try {
|
||||
$mail->isSMTP();
|
||||
$mail->Host = 'mail.yogasoul.it';
|
||||
$mail->SMTPAuth = true;
|
||||
$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->Body = $htmlContent;
|
||||
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
||||
$mail->Body = $mailmessage1;
|
||||
$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 sent
|
||||
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
die("Errore durante l'invio dell'email: " . $mail->ErrorInfo);
|
||||
}
|
||||
|
||||
// Esegui il reindirizzamento
|
||||
header("Location: userpanel.php?reprogram=Y");
|
||||
exit();
|
||||
|
||||
?>
|
||||
+104
-305
@@ -1,45 +1,13 @@
|
||||
<?php require_once('include/headscript.php'); ?>
|
||||
<?php // require_once('Connections/bkngstm.php'); ?>
|
||||
<?php // require_once('webassist/mysqli/rsobj.php'); ?>
|
||||
<?php // require_once('webassist/mysqli/queryobj.php'); ?>
|
||||
<?php // optionquery
|
||||
<?php
|
||||
// optionquery
|
||||
$optionquery = new WA_MySQLi_RS("optionquery", $bkngstm, 0);
|
||||
$optionquery->setQuery("SELECT * FROM option");
|
||||
$optionquery->execute();
|
||||
?>
|
||||
<?php // array servicesordered
|
||||
/* $conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
// Verifica della connessione
|
||||
if ($conn->connect_error) {
|
||||
die("Connessione al database fallita: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// ID dell'utente per cui eseguire la query
|
||||
$iduser = 1;
|
||||
|
||||
// Query per selezionare i valori della colonna idservice per lo specifico iduser
|
||||
$sql = "SELECT idservice FROM orderbook WHERE iduser = $iduser";
|
||||
$result = $conn->query($sql);
|
||||
|
||||
$idserviceordered = array();
|
||||
|
||||
if ($result->num_rows > 0) {
|
||||
// Memorizza i valori della colonna idservice nell'array $idserviceordered
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$idserviceordered[] = $row['idservice'];
|
||||
}
|
||||
} else {
|
||||
echo "Nessun risultato trovato.";
|
||||
}
|
||||
|
||||
// Chiudi la connessione al database
|
||||
$conn->close();
|
||||
|
||||
// Esempio di stampa dei valori memorizzati nell'array $idserviceordered
|
||||
print_r($idserviceordered); */
|
||||
?>
|
||||
<?php // array service possible
|
||||
<?php
|
||||
// array service possible
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
// Verifica della connessione
|
||||
@@ -47,7 +15,7 @@ if ($conn->connect_error) {
|
||||
die("Connessione al database fallita: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// Prendi il valore di idservieordered dalla variabile GET
|
||||
// Prendi il valore di idservieordered dalla variabile GET o POST
|
||||
if (isset($_GET['id'])) {
|
||||
$idpreviousbooking = $_GET['id'];
|
||||
}
|
||||
@@ -61,25 +29,37 @@ if (isset($_POST['idserviceordered'])) {
|
||||
$idserviceordered = $_POST['idserviceordered'];
|
||||
}
|
||||
|
||||
// Recupera la data di scadenza dell'ordine
|
||||
$expiryQuery = "SELECT expireon FROM orderbook WHERE order_id = ?";
|
||||
$stmt = $conn->prepare($expiryQuery);
|
||||
$stmt->bind_param("i", $idpreviousbooking);
|
||||
$stmt->execute();
|
||||
$expiryResult = $stmt->get_result();
|
||||
$expiryDate = null;
|
||||
if ($expiryResult->num_rows > 0) {
|
||||
$row = $expiryResult->fetch_assoc();
|
||||
$expiryDate = new DateTime($row['expireon']);
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
|
||||
// Query sulla tabella associateclass
|
||||
$sql = "SELECT idassociateservice FROM associateclass WHERE idmainservice = $idserviceordered";
|
||||
$result = $conn->query($sql);
|
||||
$sql = "SELECT idassociateservice FROM associateclass WHERE idmainservice = ?";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bind_param("i", $idserviceordered);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
$idassociateservices = array();
|
||||
array_push($idassociateservices, $idserviceordered);
|
||||
if ($result->num_rows > 0) {
|
||||
// Memorizza i valori della colonna idassociateservice nell'array $idassociateservices
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$idassociateservices[] = $row['idassociateservice'];
|
||||
}
|
||||
}
|
||||
|
||||
// Chiudi la connessione al database
|
||||
$stmt->close();
|
||||
$conn->close();
|
||||
|
||||
// Esempio di stampa dei valori memorizzati nell'array $idassociateservices
|
||||
//print_r($idassociateservices);
|
||||
?>
|
||||
|
||||
<?php
|
||||
@@ -96,13 +76,21 @@ if (isset($_GET['prev_month'])) {
|
||||
|
||||
$currentMonthEnd = date("Y-m-t", strtotime($currentMonthStart));
|
||||
|
||||
// Aggiungi filtro per la data di scadenza se definita, includendo la data di scadenza
|
||||
$expiryCondition = '';
|
||||
if ($expiryDate) {
|
||||
$expiryCondition = "AND (serviceschedule.dateschedule <= '{$expiryDate->format('Y-m-d 23:59:59')}' OR serviceschedule.dateschedule = '{$expiryDate->format('Y-m-d')}')";
|
||||
}
|
||||
|
||||
$bookedclass->setQuery("SELECT * FROM serviceschedule
|
||||
LEFT JOIN service ON serviceschedule.idservice = service.idservice
|
||||
WHERE serviceschedule.dateschedule BETWEEN '$currentMonthStart' AND DATE_ADD('$currentMonthEnd', INTERVAL 1 DAY) ORDER BY serviceschedule.dateschedule");
|
||||
WHERE serviceschedule.dateschedule BETWEEN '$currentMonthStart' AND DATE_ADD('$currentMonthEnd', INTERVAL 1 DAY)
|
||||
$expiryCondition
|
||||
ORDER BY serviceschedule.dateschedule");
|
||||
$bookedclass->execute();
|
||||
?>
|
||||
<?php
|
||||
|
||||
<?php
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
if ($conn->connect_error) {
|
||||
@@ -128,7 +116,6 @@ 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
|
||||
@@ -136,20 +123,17 @@ if ($result->num_rows > 0) {
|
||||
|
||||
$conn->close();
|
||||
?>
|
||||
<?php //check tickets
|
||||
// Connessione al database
|
||||
|
||||
<?php
|
||||
//check tickets
|
||||
$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 = 1; // 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
|
||||
@@ -163,10 +147,8 @@ if ($result) {
|
||||
$totalRecords = $row['total'];
|
||||
$passedRecords = $row['passed'];
|
||||
$futureRecords = $row['future'];
|
||||
|
||||
|
||||
}
|
||||
// Chiusura della connessione
|
||||
|
||||
$conn->close();
|
||||
?>
|
||||
|
||||
@@ -174,23 +156,16 @@ $conn->close();
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<title>YogiBook - Prenotazioni YogaSoul</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="YogiBook - Prenotazione facile YogaSOul" name="description" />
|
||||
<meta content="Advanced Creative Solutions" name="author" />
|
||||
<!-- App favicon -->
|
||||
<meta content="Advanced Creative Solutions" author />
|
||||
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
||||
|
||||
<!-- Bootstrap Css -->
|
||||
<link href="assets/css/bootstrap.min.css" id="bootstrap-style" rel="stylesheet" type="text/css" />
|
||||
<!-- Icons Css -->
|
||||
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
||||
<!-- App Css-->
|
||||
<link href="assets/css/app.min.css" id="app-style" rel="stylesheet" type="text/css" />
|
||||
<link rel="stylesheet" href="https://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>
|
||||
@@ -280,7 +255,8 @@ $conn->close();
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.custom-date-box, .custom-event-details {
|
||||
.custom-date-box,
|
||||
.custom-event-details {
|
||||
width: 100%;
|
||||
border-radius: 0;
|
||||
}
|
||||
@@ -289,8 +265,7 @@ $conn->close();
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
|
||||
.month-navigation {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
@@ -310,62 +285,38 @@ $conn->close();
|
||||
margin: 0 20px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script>
|
||||
function confirmDelete(id, deletePageUrl) {
|
||||
Swal.fire({
|
||||
title: "Sei sicuro?",
|
||||
text: "Questa prenotazione verrà cancellata definitivamente! Ricordati poi di riprogrammare la tua lezione!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#d33",
|
||||
cancelButtonColor: "#3085d6",
|
||||
confirmButtonText: "Sì, cancella!",
|
||||
cancelButtonText: "Annulla"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Reindirizza direttamente alla pagina di cancellazione con l'ID come parametro.
|
||||
window.location.href = `deleteclass.php?id=${id}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.pastel-color {
|
||||
border: 1px solid #D1C4CC;
|
||||
padding: 0px;
|
||||
text-align: center;
|
||||
border-radius: 10px;
|
||||
margin-right: 20px; /* Spazio tra i box */
|
||||
margin-right: 20px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.pastel-color.blue {
|
||||
background-color: #D4E1F1; /* Azzurro pastello */
|
||||
background-color: #D4E1F1;
|
||||
}
|
||||
|
||||
.pastel-color.green {
|
||||
background-color: #FFD8B5; /* Verde pastello */
|
||||
background-color: #FFD8B5;
|
||||
}
|
||||
|
||||
.pastel-color.pink {
|
||||
background-color: #C3E6CB; /* Rosa pastello */
|
||||
background-color: #C3E6CB;
|
||||
}
|
||||
|
||||
.pastel-color.purple {
|
||||
background-color: #F4CCCC; /* Viola pastello */
|
||||
}
|
||||
background-color: #F4CCCC;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.pastel-color {
|
||||
margin-right: 0; /* Rimuovi lo spazio tra i box */
|
||||
margin-bottom: 20px; /* Spazio tra i box */
|
||||
margin-right: 0;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
|
||||
.booking-details {
|
||||
margin-top: 10px;
|
||||
border-top: 1px solid #ccc;
|
||||
@@ -396,107 +347,69 @@ $conn->close();
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
function confirmDelete(id, deletePageUrl) {
|
||||
Swal.fire({
|
||||
title: "Sei sicuro?",
|
||||
text: "Questa prenotazione verrà cancellata definitivamente! Ricordati poi di riprogrammare la tua lezione!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#d33",
|
||||
cancelButtonColor: "#3085d6",
|
||||
confirmButtonText: "Sì, cancella!",
|
||||
cancelButtonText: "Annulla"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = `deleteclass.php?id=${id}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
</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">Riprogramma la tua lezione</h4>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="d-flex">
|
||||
|
||||
<?php include('include/languageselection.php'); ?>
|
||||
|
||||
<div class="dropdown d-inline-block">
|
||||
<button type="button" class="btn header-item noti-icon"
|
||||
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="bx bx-search icon-sm align-middle"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-end p-0">
|
||||
<form class="p-2">
|
||||
<div class="search-box">
|
||||
<div class="position-relative">
|
||||
<input type="text" class="form-control rounded bg-light border-0" placeholder="Search...">
|
||||
<i class="bx bx-search search-icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php include('include/profiletopbar.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<?php include('include/sidebar.php'); ?>
|
||||
|
||||
<header class="ishorizontal-topbar">
|
||||
<div class="navbar-header">
|
||||
<div class="d-flex">
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="d-flex"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="topnav">
|
||||
<div class="container-fluid">
|
||||
<nav class="navbar navbar-light navbar-expand-lg topnav-menu">
|
||||
|
||||
|
||||
</nav>
|
||||
<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">
|
||||
|
||||
|
||||
<?php
|
||||
$toprogram = $totalTickets - $passedRecords - $futureRecords;
|
||||
|
||||
?>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="">
|
||||
<div class="row mb-2">
|
||||
<div class="col-xl-3 col-md-12">
|
||||
@@ -504,12 +417,10 @@ $conn->close();
|
||||
<form class="email-search">
|
||||
<div class="position-relative">
|
||||
<h3>Riprogrammazione Lezione</h3>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xl-9 col-md-12">
|
||||
<div class="text-sm-end">
|
||||
<?php if ($toprogram > 0) {
|
||||
@@ -517,31 +428,16 @@ $conn->close();
|
||||
}
|
||||
?>
|
||||
<button type="button" class="btn btn-success btn-rounded waves-effect waves-light mb-2 me-2" data-bs-toggle="modal" data-bs-target=".create-task"><i class="mdi mdi-plus me-1"></i> Acquista Pacchetto Lezioni</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<!-- starts cards -->
|
||||
|
||||
|
||||
|
||||
<!-- Aggiungi le frecce per la navigazione tra i mesi -->
|
||||
<?php
|
||||
$italianMonths = [
|
||||
"January" => "Gennaio",
|
||||
@@ -557,143 +453,73 @@ $conn->close();
|
||||
"November" => "Novembre",
|
||||
"December" => "Dicembre"
|
||||
];
|
||||
|
||||
?>
|
||||
<div class="month-navigation">
|
||||
|
||||
<a href="?prev_month=<?php echo date('Y-m', strtotime('-1 month', strtotime($currentMonthStart))); ?>&idserviceordered=<?php echo $idserviceordered; ?>&id=<?php echo $idpreviousbooking; ?>" 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="?next_month=<?php echo date('Y-m', strtotime('+1 month', strtotime($currentMonthStart))); ?>&idserviceordered=<?php echo $idserviceordered; ?>&id=<?php echo $idpreviousbooking; ?>" class="arrow-link">
|
||||
<i class="fas fa-chevron-right fa-2x"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$wa_startindex = 0;
|
||||
|
||||
if ($bookedclass->TotalRows == 0) {
|
||||
echo "<p>Classi non presenti per questo mese</p>";
|
||||
echo "<p>Classi non presenti per questo mese o oltre la data di scadenza</p>";
|
||||
} else {
|
||||
while (!$bookedclass->atEnd()) {
|
||||
$wa_startindex = $bookedclass->Index;
|
||||
?>
|
||||
<?php
|
||||
// Data dalla variabile $bookedclass->getColumnVal("dateschedule")
|
||||
$dateschedule = $bookedclass->getColumnVal("dateschedule");
|
||||
|
||||
// Converti la data in un oggetto DateTime
|
||||
$dateObj = new DateTime($dateschedule);
|
||||
|
||||
// Estrai il giorno e il mese in italiano
|
||||
$dayInItalian = $dateObj->format("d");
|
||||
$monthInItalian = $dateObj->format("F");
|
||||
|
||||
// Mappa dei nomi dei mesi in italiano
|
||||
$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"
|
||||
];
|
||||
|
||||
// Sostituisci il nome del mese con la versione italiana
|
||||
$monthInItalian = $italianMonths[$monthInItalian];
|
||||
?>
|
||||
<?php
|
||||
// Data dalla variabile $bookedclass->getColumnVal("dateschedule")
|
||||
$dateschedule = $bookedclass->getColumnVal("dateschedule");
|
||||
|
||||
// Converti la data in un oggetto DateTime
|
||||
$dateObj = new DateTime($dateschedule);
|
||||
|
||||
// Formatta la data nel nuovo formato desiderato
|
||||
$monthInItalian = $italianMonths[$dateObj->format("F")];
|
||||
$newDateFormat = $dateObj->format("d-m-Y H:i");
|
||||
|
||||
// Calculate the time difference in hours
|
||||
$currentTime = new DateTime();
|
||||
$classTime = new DateTime($dateschedule);
|
||||
$timeDifference = $classTime->diff($currentTime);
|
||||
$hoursDifference = $timeDifference->h + $timeDifference->days * 24;
|
||||
|
||||
// Check if the time difference is less than 6 hours
|
||||
$timetocancel = $optionquery->getColumnVal("maxbeforetimecancell");
|
||||
$canBeDeleted = ($hoursDifference >= $timetocancel);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<?php $mysqli = new mysqli($servername, $username, $password, $dbname);
|
||||
// Esegui una nuova query per ottenere le persone prenotate per l'evento corrente
|
||||
$mysqli = new mysqli($servername, $username, $password, $dbname);
|
||||
$eventId = $bookedclass->getColumnVal("idserviceschedule");
|
||||
$bookingQuery = "SELECT iduser FROM bookingclass
|
||||
WHERE bookingclass.idserviceschedule = $eventId AND bookingclass.status='booked'";
|
||||
$bookingResult = $mysqli->query($bookingQuery);
|
||||
|
||||
// Calcola il numero di persone prenotate
|
||||
$bookingQuery = "SELECT iduser FROM bookingclass WHERE bookingclass.idserviceschedule = ? AND bookingclass.status='booked'";
|
||||
$stmt = $mysqli->prepare($bookingQuery);
|
||||
$stmt->bind_param("i", $eventId);
|
||||
$stmt->execute();
|
||||
$bookingResult = $stmt->get_result();
|
||||
$countPersons = $bookingResult->num_rows;
|
||||
$stmt->close();
|
||||
|
||||
?>
|
||||
<?php // check if service possible to bookedclass
|
||||
|
||||
// Esempio: Simula il valore di $bookedclass->getColumnVal("servicename")
|
||||
$cardservice = $bookedclass->getColumnVal("idservice");
|
||||
|
||||
// Verifica se il valore di $cardservice è presente nell'array $idassociateservices
|
||||
if (in_array($cardservice, $idassociateservices)) {
|
||||
// Il valore è presente, esegui il codice successivo
|
||||
|
||||
?>
|
||||
<?php
|
||||
$maxcapacity = $bookedclass->getColumnVal("maxcapacity");
|
||||
$freeplace = $maxcapacity - $countPersons;
|
||||
?>
|
||||
|
||||
<?php //query check active bookingclass
|
||||
// Crea la connessione al database
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
// Variabili dei dati da verificare
|
||||
$idcheckservice = $bookedclass->getColumnVal("idserviceschedule"); // Sostituisci con il tuo valore
|
||||
$iduser = $iduserlog; // Sostituisci con il tuo valore
|
||||
|
||||
// Query per verificare l'esistenza del record
|
||||
$query = "SELECT * FROM bookingclass WHERE idserviceschedule = $idcheckservice AND iduser = $iduser";
|
||||
$resultcheck = $conn->query($query);
|
||||
|
||||
if ($resultcheck->num_rows > 0) {
|
||||
$alreadybooked='Y'; // record found
|
||||
} else {
|
||||
$alreadybooked='N';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$idcheckservice = $bookedclass->getColumnVal("idserviceschedule");
|
||||
$iduser = $iduserlog;
|
||||
$query = "SELECT * FROM bookingclass WHERE idserviceschedule = ? AND iduser = ?";
|
||||
$stmt = $conn->prepare($query);
|
||||
$stmt->bind_param("ii", $idcheckservice, $iduser);
|
||||
$stmt->execute();
|
||||
$resultcheck = $stmt->get_result();
|
||||
$alreadybooked = $resultcheck->num_rows > 0 ? 'Y' : 'N';
|
||||
$stmt->close();
|
||||
$conn->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 } ?>
|
||||
<?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 } ?>
|
||||
<div class="custom-day"><?php echo $dayInItalian; ?></div>
|
||||
<div class="custom-month"><?php echo $monthInItalian; ?></div>
|
||||
</div>
|
||||
@@ -701,57 +527,46 @@ if ($resultcheck->num_rows > 0) {
|
||||
<div class="custom-event-details" style="background-color:#FFAC7A">
|
||||
<?php } elseif ($freeplace > 0) { ?>
|
||||
<div class="custom-event-details" style="background-color:<?php echo ($bookedclass->getColumnVal("colorclass")); ?>">
|
||||
<?php } else { ?><div class="custom-event-details" style="background-color:#CDCDCD"><?php } ?>
|
||||
<?php } else { ?>
|
||||
<div class="custom-event-details" style="background-color:#CDCDCD">
|
||||
<?php } ?>
|
||||
<h2 class="custom-heading"><?php echo ($bookedclass->getColumnVal("servicename")); ?> -<?php echo $countPersons; ?>/<?php echo ($bookedclass->getColumnVal("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>
|
||||
<?php $idnewbooking = $bookedclass->getColumnVal("idserviceschedule"); ?>
|
||||
<?php $idservicenew = $bookedclass->getColumnVal("idservice"); ?>
|
||||
<!-- Mostra l'elenco delle persone prenotate solo se ce ne sono -->
|
||||
|
||||
<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 $idpreviousbooking; ?>&idservicenew=<?php echo $idservicenew; ?>&idnewbooking=<?php echo $idnewbooking; ?>&iduser=<?php echo $iduserlogin; ?>"?><button class="booking-button"><i class="fas fa-arrow-circle-right"></i> Riprogramma Classe</button></a>
|
||||
<a href="rebookandgo.php?idpreviousbooking=<?php echo $idpreviousbooking; ?>&idservicenew=<?php echo $idservicenew; ?>&idnewbooking=<?php echo $idnewbooking; ?>&iduser=<?php echo $iduserlogin; ?>"><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 } ?>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
}
|
||||
$bookedclass->moveNext();
|
||||
}
|
||||
}
|
||||
|
||||
$bookedclass->moveFirst(); // Ritorna all'inizio del recordset
|
||||
$bookedclass->moveFirst();
|
||||
unset($wa_startindex);
|
||||
unset($wa_repeatcount);
|
||||
?>
|
||||
<!-- Aggiungi altre card qui con le stesse classi -->
|
||||
|
||||
<div class="month-navigation">
|
||||
|
||||
<a href="?prev_month=<?php echo date('Y-m', strtotime('-1 month', strtotime($currentMonthStart))); ?>&idserviceordered=<?php echo $idserviceordered; ?>&id=<?php echo $idpreviousbooking; ?>" 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="?next_month=<?php echo date('Y-m', strtotime('+1 month', strtotime($currentMonthStart))); ?>&idserviceordered=<?php echo $idserviceordered; ?>&id=<?php echo $idpreviousbooking; ?>" class="arrow-link">
|
||||
<i class="fas fa-chevron-right fa-2x"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function toggleCard(card) {
|
||||
@@ -759,32 +574,16 @@ unset($wa_repeatcount);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Page-content -->
|
||||
|
||||
<?php include('include/footer.php'); ?>
|
||||
</div>
|
||||
<!-- end main content-->
|
||||
|
||||
</div>
|
||||
<!-- END layout-wrapper -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- JAVASCRIPT -->
|
||||
<script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="assets/libs/metismenujs/metismenujs.min.js"></script>
|
||||
<script src="assets/libs/simplebar/simplebar.min.js"></script>
|
||||
<script src="assets/libs/eva-icons/eva.min.js"></script>
|
||||
|
||||
<script src="assets/js/app.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -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();
|
||||
@@ -0,0 +1,318 @@
|
||||
<?php
|
||||
// Abilita visualizzazione errori PHP (solo per debug)
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
// Connessione al database
|
||||
include('include/headscript.php');
|
||||
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
if ($conn->connect_error) {
|
||||
die("Connessione al database fallita: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// Inizializza log
|
||||
$logFile = 'cancella_prenotazione_log.txt';
|
||||
$logMessage = "Esecuzione cancellazione: " . date('Y-m-d H:i:s') . "\n";
|
||||
|
||||
// Recupera parametri GET: idbookingclass e token
|
||||
if (!isset($_GET['idbookingclass']) || !isset($_GET['token'])) {
|
||||
$logMessage .= "Parametri mancanti: idbookingclass o token\n";
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
echo "<h1>Cancellazione non possibile</h1>";
|
||||
echo "<p>Parametri mancanti.</p>";
|
||||
echo "<a href='https://yogibook.yogasoul.it'>Torna al portale</a>";
|
||||
$conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
// Sanitizza idbookingclass
|
||||
$idbookingclass = filter_var($_GET['idbookingclass'], FILTER_VALIDATE_INT);
|
||||
$token = $_GET['token'];
|
||||
|
||||
if (!$idbookingclass) {
|
||||
$logMessage .= "Errore: idbookingclass non valido: " . $_GET['idbookingclass'] . "\n";
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
echo "<h1>Cancellazione non possibile</h1>";
|
||||
echo "<p>Parametro idbookingclass non valido.</p>";
|
||||
echo "<a href='https://yogibook.yogasoul.it'>Torna al portale</a>";
|
||||
$conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
// Verifica validità: token corrisponde, lezione futura
|
||||
$query = "SELECT bc.*, ob.expireon, au.email, au.first_name, s.servicename
|
||||
FROM bookingclass bc
|
||||
LEFT JOIN orderbook ob ON bc.idorder = ob.order_id
|
||||
LEFT JOIN auth_users au ON bc.iduser = au.id
|
||||
LEFT JOIN service s ON bc.idservice = s.idservice
|
||||
WHERE bc.idbookingclass = ?
|
||||
AND bc.cancellation_token = ?
|
||||
AND bc.status = 'booked'
|
||||
AND bc.bookingstart > NOW()";
|
||||
$stmt = $conn->prepare($query);
|
||||
|
||||
if (!$stmt) {
|
||||
$logMessage .= "Errore preparazione query per ID $idbookingclass: " . $conn->error . "\n";
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
echo "<h1>Cancellazione non possibile</h1>";
|
||||
echo "<p>Errore nella preparazione della query.</p>";
|
||||
echo "<a href='https://yogibook.yogasoul.it'>Torna al portale</a>";
|
||||
$conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt->bind_param("is", $idbookingclass, $token);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
if ($result->num_rows === 0) {
|
||||
$checkQuery = "SELECT * FROM bookingclass
|
||||
WHERE idbookingclass = ?
|
||||
AND cancellation_token = ?
|
||||
AND status = 'booked'
|
||||
AND bookingstart > NOW()";
|
||||
$checkStmt = $conn->prepare($checkQuery);
|
||||
$checkStmt->bind_param("is", $idbookingclass, $token);
|
||||
$checkStmt->execute();
|
||||
$checkResult = $checkStmt->get_result();
|
||||
|
||||
if ($checkResult->num_rows > 0) {
|
||||
$row = $checkResult->fetch_assoc();
|
||||
$bookingstart = $row['bookingstart'];
|
||||
$lessonTime = new DateTime($bookingstart);
|
||||
$hour = (int)$lessonTime->format('H');
|
||||
$minute = (int)$lessonTime->format('i');
|
||||
$isBefore1700 = ($hour < 17) || ($hour === 17 && $minute === 0);
|
||||
$logMessage .= "Tentativo di cancellazione fallito per ID $idbookingclass: orario oltre il limite (" . ($isBefore1700 ? "00:01" : "12:00") . ")\n";
|
||||
echo "<h1>Cancellazione non possibile</h1>";
|
||||
echo "<p>Non è possibile cancellare la lezione dopo le " . ($isBefore1700 ? "00:01" : "12:00") . " del giorno della lezione.</p>";
|
||||
echo "<a href='https://yogibook.yogasoul.it'>Torna al portale</a>";
|
||||
} else {
|
||||
$logMessage .= "Tentativo di cancellazione fallito per ID $idbookingclass: link non valido o lezione non prenotata\n";
|
||||
echo "<h1>Cancellazione non possibile</h1>";
|
||||
echo "<p>Il link non è valido o la lezione non è prenotata.</p>";
|
||||
echo "<a href='https://yogibook.yogasoul.it'>Torna al portale</a>";
|
||||
}
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
$checkStmt->close();
|
||||
$stmt->close();
|
||||
$conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
$row = $result->fetch_assoc();
|
||||
$bookingstart = $row['bookingstart'];
|
||||
$newtimeformat = date("d-m-Y H:i", strtotime($bookingstart));
|
||||
$expireon = $row['expireon'] ? date("d-m-Y", strtotime($row['expireon'])) : "sconosciuta";
|
||||
$emailuser = $row['email'];
|
||||
$firstname = $row['first_name'] ?? 'Utente';
|
||||
$servicename = $row['servicename'] ?? 'Sconosciuta';
|
||||
$iduser = $row['iduser'];
|
||||
$idservice = $row['idservice'];
|
||||
$idorderbook = $row['idorder'];
|
||||
|
||||
// Verifica il limite di cancellazione
|
||||
$lessonTime = new DateTime($bookingstart);
|
||||
$hour = (int)$lessonTime->format('H');
|
||||
$minute = (int)$lessonTime->format('i');
|
||||
$isBefore1700 = ($hour < 17) || ($hour === 17 && $minute === 0);
|
||||
$currentTime = new DateTime();
|
||||
$lessonDate = $lessonTime->format('Y-m-d');
|
||||
|
||||
if ($isBefore1700) {
|
||||
$deadline = new DateTime("$lessonDate 00:01:00");
|
||||
} else {
|
||||
$deadline = new DateTime("$lessonDate 12:00:00");
|
||||
}
|
||||
|
||||
if ($currentTime > $deadline) {
|
||||
$logMessage .= "Tentativo di cancellazione fallito per ID $idbookingclass: orario oltre il limite (" . $deadline->format('Y-m-d H:i:s') . ")\n";
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
echo "<h1>Cancellazione non possibile</h1>";
|
||||
echo "<p>Non è possibile cancellare la lezione dopo le " . ($isBefore1700 ? "00:01" : "12:00") . " del giorno della lezione.</p>";
|
||||
echo "<a href='https://yogibook.yogasoul.it'>Torna al portale</a>";
|
||||
$stmt->close();
|
||||
$conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
// Gestisci azione di cancellazione
|
||||
if (isset($_GET['action']) && $_GET['action'] === 'cancel') {
|
||||
$updateQuery = "UPDATE bookingclass
|
||||
SET status = 'cancelled'
|
||||
WHERE idbookingclass = ? AND cancellation_token = ?";
|
||||
$updateStmt = $conn->prepare($updateQuery);
|
||||
$updateStmt->bind_param("is", $idbookingclass, $token);
|
||||
$updateStmt->execute();
|
||||
|
||||
if (!filter_var($emailuser, FILTER_VALIDATE_EMAIL)) {
|
||||
$logMessage .= "Email non valida per ID $idbookingclass: $emailuser\n";
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
echo "<h1>Cancellazione confermata</h1>";
|
||||
echo "<p>La lezione del $newtimeformat è stata cancellata con successo, ma non è stato possibile inviare l'email di conferma.</p>";
|
||||
echo "<p>Ricordati di riprenotare entro la scadenza del tuo abbonamento ($expireon).</p>";
|
||||
echo "<a href='https://yogibook.yogasoul.it'>Torna al portale</a>";
|
||||
$stmt->close();
|
||||
$conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
$cancellationDeadline = $isBefore1700 ? "00:01" : "12:00";
|
||||
$messagecancel = "<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 18px; line-height: 34.2px;'><strong>Ciao $firstname,</strong></span></p>
|
||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>La tua lezione ($servicename) del $newtimeformat è stata cancellata con successo!</span></p>
|
||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Hai cancellato la lezione entro il limite delle $cancellationDeadline del giorno della lezione.</span></p>
|
||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Ricordati di riprenotare entro la scadenza del tuo abbonamento ($expireon).</span></p>
|
||||
<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>
|
||||
<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>";
|
||||
|
||||
$messageedit = $messagecancel;
|
||||
$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>";
|
||||
|
||||
require_once 'phpmailer/src/Exception.php';
|
||||
require_once 'phpmailer/src/PHPMailer.php';
|
||||
require_once 'phpmailer/src/SMTP.php';
|
||||
|
||||
$mail = new PHPMailer(true);
|
||||
try {
|
||||
$mail->isSMTP();
|
||||
$mail->Host = 'mail.yogasoul.it';
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->Username = 'info@yogasoul.it';
|
||||
$mail->Password = '!Testolina88';
|
||||
$mail->SMTPSecure = 'tls';
|
||||
$mail->Port = 587;
|
||||
|
||||
if (!file_exists('mail/emailtemplate2.php')) {
|
||||
throw new Exception("File emailtemplate2.php non trovato.");
|
||||
}
|
||||
include('mail/emailtemplate2.php');
|
||||
|
||||
if (!isset($mailmessage1)) {
|
||||
throw new Exception("Variabile \$mailmessage1 non definita in emailtemplate2.php.");
|
||||
}
|
||||
|
||||
$htmlContent = str_replace('{message}', $messagecancel, $mailmessage1);
|
||||
|
||||
$mail->From = 'info@yogasoul.it';
|
||||
$mail->FromName = 'YogiBook [YogaSoul]';
|
||||
$mail->addAddress($emailuser);
|
||||
$mail->Subject = "YogiBook - Lezione cancellata con successo!";
|
||||
$mail->Body = $htmlContent;
|
||||
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
||||
|
||||
$mail->send();
|
||||
$logMessage .= "Cancellazione confermata per ID $idbookingclass ($newtimeformat), email inviata a $emailuser\n";
|
||||
|
||||
echo "<h1>Cancellazione confermata</h1>";
|
||||
echo "<p>La lezione del $newtimeformat è stata cancellata con successo.</p>";
|
||||
echo "<p>Ricordati di riprenotare entro la scadenza del tuo abbonamento ($expireon).</p>";
|
||||
echo "<a href='https://yogibook.yogasoul.it'>Torna al portale</a>";
|
||||
} catch (Exception $e) {
|
||||
$logMessage .= "Cancellazione confermata per ID $idbookingclass ($newtimeformat), ma errore invio email a $emailuser: " . $mail->ErrorInfo . "\n";
|
||||
echo "<h1>Cancellazione confermata</h1>";
|
||||
echo "<p>La lezione del $newtimeformat è stata cancellata con successo, ma non è stato possibile inviare l'email di conferma.</p>";
|
||||
echo "<p>Ricordati di riprenotare entro la scadenza del tuo abbonamento ($expireon).</p>";
|
||||
echo "<a href='https://yogibook.yogasoul.it'>Torna al portale</a>";
|
||||
}
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
$updateStmt->close();
|
||||
$stmt->close();
|
||||
$conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
$logMessage .= "Accesso a modale per ID $idbookingclass, token: $token, opzione riprogrammazione: rebook-from-cancel.php?idbookingclass=$idbookingclass&token=" . urlencode($token) . "\n";
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="it">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>YogiBook - Cancellazione Lezione</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<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>
|
||||
<link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Gestione Lezione</h1>
|
||||
<p>Lezione: <?php echo htmlspecialchars($servicename); ?> del <?php echo htmlspecialchars($newtimeformat); ?></p>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
console.log("Modale SweetAlert2 avviato per ID <?php echo $idbookingclass; ?>, token: <?php echo urlencode($token); ?>");
|
||||
Swal.fire({
|
||||
title: "Cosa vuoi fare?",
|
||||
html: "Puoi cancellare la lezione del <?php echo htmlspecialchars($newtimeformat); ?> o riprogrammarla.<br>Scadenza abbonamento: <?php echo htmlspecialchars($expireon); ?><br><br><strong>Debug:</strong> Reindirizzamento previsto: rebook-from-cancel.php?idbookingclass=<?php echo $idbookingclass; ?>&token=<?php echo urlencode($token); ?>",
|
||||
icon: "question",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#d33",
|
||||
cancelButtonColor: "#3085d6",
|
||||
confirmButtonText: "Cancella Lezione",
|
||||
cancelButtonText: "Riprogramma Lezione",
|
||||
showDenyButton: true,
|
||||
denyButtonText: "Riprogramma Lezione",
|
||||
denyButtonColor: "#e47c06ff"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
console.log("Cliccato 'Cancella Lezione' per ID <?php echo $idbookingclass; ?>");
|
||||
Swal.fire({
|
||||
title: "Attenzione!",
|
||||
text: "La lezione sarà cancellata. Ricordati di riprenotare entro la scadenza del tuo abbonamento (<?php echo htmlspecialchars($expireon); ?>)!",
|
||||
icon: "warning",
|
||||
confirmButtonText: "Conferma Cancellazione",
|
||||
showCancelButton: true,
|
||||
cancelButtonText: "Annulla"
|
||||
}).then((confirmResult) => {
|
||||
if (confirmResult.isConfirmed) {
|
||||
console.log("Conferma cancellazione, reindirizzamento a: ?idbookingclass=<?php echo $idbookingclass; ?>&token=<?php echo urlencode($token); ?>&action=cancel");
|
||||
window.location.replace("?idbookingclass=<?php echo $idbookingclass; ?>&token=<?php echo urlencode($token); ?>&action=cancel");
|
||||
} else {
|
||||
console.log("Cancellazione annullata");
|
||||
}
|
||||
});
|
||||
} else if (result.isCancel) {
|
||||
console.log("Cliccato 'Riprogramma Lezione' per ID <?php echo $idbookingclass; ?>, reindirizzamento a: rebook-from-cancel.php?idbookingclass=<?php echo $idbookingclass; ?>&token=<?php echo urlencode($token); ?>");
|
||||
try {
|
||||
window.location.replace("rebook-from-cancel.php?idbookingclass=<?php echo $idbookingclass; ?>&token=<?php echo urlencode($token); ?>");
|
||||
} catch (e) {
|
||||
console.error("Errore durante il reindirizzamento: ", e);
|
||||
alert("Errore: impossibile reindirizzare a rebook-from-cancel.php. Controlla la console del browser.");
|
||||
}
|
||||
} else if (result.isDenied) {
|
||||
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); ?>");
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<?php
|
||||
$stmt->close();
|
||||
$conn->close();
|
||||
?>
|
||||
@@ -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
|
||||
+60
-100
@@ -1,7 +1,5 @@
|
||||
<?php require_once('include/headscript.php'); ?>
|
||||
|
||||
<?php
|
||||
|
||||
// Creazione della connessione
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
@@ -10,18 +8,18 @@ if ($conn->connect_error) {
|
||||
die("Connessione fallita: " . $conn->connect_error);
|
||||
}
|
||||
if (isset($_GET['message'])) {
|
||||
$message = $_GET['message']; } else { $message='n'; }
|
||||
$message = $_GET['message'];
|
||||
} else {
|
||||
$message = 'n';
|
||||
}
|
||||
// ID dell'insegnante
|
||||
$idTeacher = 1;
|
||||
|
||||
|
||||
// Controlla se il form è stato inviato
|
||||
if (isset($_POST['submit'])) {
|
||||
// Recupera la data dal form
|
||||
$dayoffdate = $_POST['dayoff'];
|
||||
|
||||
|
||||
|
||||
// Query SQL per l'inserimento del day off
|
||||
$insertQuery = "INSERT INTO dayoff (idteacher, dayoffdate) VALUES ($idTeacher, '$dayoffdate')";
|
||||
|
||||
@@ -33,8 +31,6 @@ if (isset($_POST['submit'])) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Query SQL
|
||||
$query = "SELECT * FROM certificateuserprofile LEFT JOIN auth_users ON certificateuserprofile.iduser=auth_users.id ORDER BY auth_users.last_name";
|
||||
|
||||
@@ -50,13 +46,10 @@ if ($result->num_rows > 0) {
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<title>YogiBook - Prenotazioni YogaSoul</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
@@ -73,23 +66,53 @@ if ($result->num_rows > 0) {
|
||||
<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">
|
||||
|
||||
<!-- DataTables CSS -->
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/dataTables.bootstrap5.min.css">
|
||||
|
||||
<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 src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
||||
<!-- DataTables JS -->
|
||||
<script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.11.5/js/dataTables.bootstrap5.min.js"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
$("#expiryDate").datepicker({
|
||||
dateFormat: "yy-mm-dd", // Formato della data
|
||||
minDate: 0, // Impedisce la selezione di date passate
|
||||
// Altre opzioni del datepicker se necessario
|
||||
dateFormat: "yy-mm-dd",
|
||||
minDate: 0,
|
||||
});
|
||||
$("#dayoff").datepicker({
|
||||
dateFormat: "yy-mm-dd"
|
||||
});
|
||||
// Initialize DataTables
|
||||
$('#certificateTable').DataTable({
|
||||
"language": {
|
||||
"url": "//cdn.datatables.net/plug-ins/1.11.5/i18n/it-IT.json"
|
||||
},
|
||||
"pageLength": 100,
|
||||
"order": [
|
||||
[0, "asc"]
|
||||
]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(function() {
|
||||
$("#dayoff").datepicker({ dateFormat: "yy-mm-dd" });
|
||||
|
||||
function confirmDelete(id) {
|
||||
Swal.fire({
|
||||
title: "Sei sicuro?",
|
||||
text: "Questo certificato verrà cancellato definitivamente!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#d33",
|
||||
cancelButtonColor: "#3085d6",
|
||||
confirmButtonText: "Sì, cancella!",
|
||||
cancelButtonText: "Annulla"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = `deletecertificate.php?id=${id}&source=admin`;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.custom-card {
|
||||
@@ -178,7 +201,8 @@ if ($result->num_rows > 0) {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.custom-date-box, .custom-event-details {
|
||||
.custom-date-box,
|
||||
.custom-event-details {
|
||||
width: 100%;
|
||||
border-radius: 0;
|
||||
}
|
||||
@@ -188,59 +212,30 @@ if ($result->num_rows > 0) {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function confirmDelete(id, deletePageUrl) {
|
||||
Swal.fire({
|
||||
title: "Sei sicuro?",
|
||||
text: "Questa prenotazione verrà cancellata definitivamente! Ricordati poi di riprogrammare la tua lezione!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#d33",
|
||||
cancelButtonColor: "#3085d6",
|
||||
confirmButtonText: "Sì, cancella!",
|
||||
cancelButtonText: "Annulla"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Reindirizza direttamente alla pagina di cancellazione con l'ID come parametro.
|
||||
window.location.href = `deleteclass.php?id=${id}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- <body data-layout="horizontal"> -->
|
||||
|
||||
<!-- Begin page -->
|
||||
<div id="layout-wrapper">
|
||||
|
||||
<!-- Top Bar -->
|
||||
<header id="page-topbar" class="isvertical-topbar">
|
||||
<div class="navbar-header">
|
||||
<div class="d-flex">
|
||||
<!-- LOGO -->
|
||||
<?php include('include/logoarea.php'); ?>
|
||||
|
||||
<button type="button" class="btn btn-sm px-3 font-size-24 header-item waves-effect vertical-menu-btn">
|
||||
<i class="bx bx-menu align-middle"></i>
|
||||
</button>
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="page-title-box align-self-center d-none d-md-block">
|
||||
<h4 class="page-title mb-0">Prenotazione Classi</h4>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="d-flex">
|
||||
|
||||
<?php include('include/languageselection.php'); ?>
|
||||
|
||||
<div class="dropdown d-inline-block">
|
||||
<button type="button" class="btn header-item noti-icon"
|
||||
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<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">
|
||||
@@ -250,69 +245,49 @@ if ($result->num_rows > 0) {
|
||||
<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>
|
||||
|
||||
|
||||
|
||||
</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="d-flex"></div>
|
||||
<div class="topnav">
|
||||
<div class="container-fluid">
|
||||
<nav class="navbar navbar-light navbar-expand-lg topnav-menu">
|
||||
|
||||
|
||||
</nav>
|
||||
<nav class="navbar navbar-light navbar-expand-lg topnav-menu"></nav>
|
||||
</div>
|
||||
</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">
|
||||
<?php if ($message == 'success') { ?>
|
||||
<div class="alert alert-success" role="alert">
|
||||
DayOff rimosso con successo
|
||||
Certificato rimosso con successo
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<h5>Benvenuta/o <?php echo $firstname; ?> </h5>
|
||||
<p>Certificati</p>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped mb-0">
|
||||
<table id="certificateTable" class="table table-striped mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nome</th>
|
||||
<th>Scadenza</th>
|
||||
<th>Data Caricamento</th>
|
||||
<th>Documento</th>
|
||||
<th>Azione</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -320,51 +295,36 @@ if ($result->num_rows > 0) {
|
||||
<tr>
|
||||
<td><?php echo $document["first_name"]; ?> <?php echo $document["last_name"]; ?></td>
|
||||
<td><?php echo $document["expirydatedocument"]; ?></td>
|
||||
<td><?php echo $document["uploaded_at"] ?? 'N/D'; ?></td>
|
||||
<td><a href="user/document/<?php echo $document["filenamedocument"]; ?>" target="_blank">DOC</a></td>
|
||||
<td>
|
||||
<button class="btn btn-danger btn-sm" onclick="confirmDelete(<?php echo $document['idcertificateuserprofile']; ?>)">
|
||||
<i class="fas fa-trash"></i> Cancella
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
|
||||
|
||||
<!-- End Page-content -->
|
||||
|
||||
<?php include('include/footer.php'); ?>
|
||||
</div>
|
||||
<!-- end main content-->
|
||||
|
||||
</div>
|
||||
<!-- END layout-wrapper -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- JAVASCRIPT -->
|
||||
<script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="assets/libs/metismenujs/metismenujs.min.js"></script>
|
||||
<script src="assets/libs/simplebar/simplebar.min.js"></script>
|
||||
<script src="assets/libs/eva-icons/eva.min.js"></script>
|
||||
|
||||
<script src="assets/js/app.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
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,41 @@
|
||||
<?php
|
||||
require_once('include/headscript.php');
|
||||
|
||||
// Creazione della connessione
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
// Verifica della connessione
|
||||
if ($conn->connect_error) {
|
||||
die("Connessione fallita: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
if (isset($_GET['id'])) {
|
||||
$id = intval($_GET['id']); // Sanitize input
|
||||
// Optional: Verify user ownership for security (uncomment if needed)
|
||||
/*
|
||||
$iduserlogin = $_SESSION['iduserlogin']; // Assumes user ID is stored in session
|
||||
$deleteQuery = "DELETE FROM certificateuserprofile WHERE idcertificateuserprofile = ? AND iduser = ?";
|
||||
$stmt = $conn->prepare($deleteQuery);
|
||||
$stmt->bind_param("ii", $id, $iduserlogin);
|
||||
*/
|
||||
$deleteQuery = "DELETE FROM certificateuserprofile WHERE idcertificateuserprofile = ?";
|
||||
$stmt = $conn->prepare($deleteQuery);
|
||||
$stmt->bind_param("i", $id);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
// Determine redirect based on source
|
||||
$source = isset($_GET['source']) ? $_GET['source'] : 'user';
|
||||
if ($source === 'admin') {
|
||||
header("Location: certificati.php?message=success");
|
||||
} else {
|
||||
header("Location: userprofiledoc.php?message=success");
|
||||
}
|
||||
} else {
|
||||
echo "Errore nella cancellazione: " . $conn->error;
|
||||
}
|
||||
$stmt->close();
|
||||
} else {
|
||||
echo "ID non fornito.";
|
||||
}
|
||||
|
||||
$conn->close();
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
require_once('include/headscript.php');
|
||||
|
||||
$conn = mysqli_connect($servername, $username, $password, $dbname);
|
||||
|
||||
if (!$conn) {
|
||||
die(json_encode(['error' => 'Connessione al database fallita']));
|
||||
}
|
||||
|
||||
// Query per ottenere tutte le classi disponibili
|
||||
$sql = "SELECT id, servicename, day, time FROM classes ORDER BY servicename, day, time";
|
||||
$result = mysqli_query($conn, $sql);
|
||||
|
||||
$classes = [];
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
$classes[] = [
|
||||
'id' => $row['id'],
|
||||
'servicename' => $row['servicename'],
|
||||
'day' => $row['day'],
|
||||
'time' => $row['time']
|
||||
];
|
||||
}
|
||||
|
||||
mysqli_close($conn);
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($classes);
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
require_once('include/headscript.php');
|
||||
|
||||
$conn = mysqli_connect($servername, $username, $password, $dbname);
|
||||
|
||||
if (!$conn) {
|
||||
die(json_encode(['error' => 'Connessione al database fallita']));
|
||||
}
|
||||
|
||||
$class_id = isset($_POST['class_id']) ? intval($_POST['class_id']) : 0;
|
||||
|
||||
if ($class_id <= 0) {
|
||||
die(json_encode(['error' => 'ID classe non valido']));
|
||||
}
|
||||
|
||||
// Query per ottenere le date disponibili per la classe specificata
|
||||
// Supponiamo che ci sia una tabella 'class_schedule' con le date disponibili
|
||||
$sql = "SELECT DISTINCT DATE(bookingstart) as available_date
|
||||
FROM class_schedule
|
||||
WHERE class_id = ?
|
||||
ORDER BY available_date";
|
||||
$stmt = mysqli_prepare($conn, $sql);
|
||||
mysqli_stmt_bind_param($stmt, 'i', $class_id);
|
||||
mysqli_stmt_execute($stmt);
|
||||
$result = mysqli_stmt_get_result($stmt);
|
||||
|
||||
$availableDates = [];
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
$availableDates[] = $row['available_date'];
|
||||
}
|
||||
|
||||
mysqli_stmt_close($stmt);
|
||||
mysqli_close($conn);
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(['availableDates' => $availableDates]);
|
||||
@@ -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>
|
||||
</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>
|
||||
<a href="userprofiledoc.php" class="">
|
||||
@@ -128,7 +135,15 @@
|
||||
<li>
|
||||
<a href="situationusers.php" class="">
|
||||
<i class="bx bx-power-off icon nav-icon"></i>
|
||||
<span class="menu-item" data-key="t-email">Siutazione</span>
|
||||
<span class="menu-item" data-key="t-email">Situazione</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="ordersummary.php" class="">
|
||||
<i class="bx bx-power-off icon nav-icon"></i>
|
||||
<span class="menu-item" data-key="t-email">Sommario Ordini</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
@@ -168,4 +183,3 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- Left Sidebar End -->
|
||||
|
||||
@@ -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,379 @@
|
||||
<?php require_once('include/headscript.php'); ?>
|
||||
|
||||
<?php
|
||||
|
||||
// Creazione della connessione
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
// Verifica della connessione
|
||||
if ($conn->connect_error) {
|
||||
die("Connessione fallita: " . $conn->connect_error);
|
||||
}
|
||||
if (isset($_GET['message'])) {
|
||||
$message = $_GET['message'];
|
||||
} else {
|
||||
$message = 'n';
|
||||
}
|
||||
|
||||
// Gestione del filtro
|
||||
$filter = isset($_GET['filter']) ? $_GET['filter'] : 'all';
|
||||
$today = date("Y-m-d");
|
||||
$whereClause = "";
|
||||
if ($filter == 'active') {
|
||||
$whereClause = "WHERE expireon > '$today'";
|
||||
} elseif ($filter == 'expired') {
|
||||
$whereClause = "WHERE expireon <= '$today'";
|
||||
}
|
||||
|
||||
// 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
|
||||
FROM orderbook o
|
||||
LEFT JOIN service s ON o.idservice = s.idservice
|
||||
$whereClause
|
||||
ORDER BY o.order_id DESC";
|
||||
|
||||
// Esecuzione della query
|
||||
$result = $conn->query($query);
|
||||
|
||||
// Recupero dei records
|
||||
$orders = [];
|
||||
if ($result->num_rows > 0) {
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$orders[] = $row;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<title>YogiBook - Riepilogo Ordini</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="YogiBook - Prenotazione facile YogaSOul" name="description" />
|
||||
<meta content="Advanced Creative Solutions" name="author" />
|
||||
<!-- App favicon -->
|
||||
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
||||
|
||||
<!-- Bootstrap Css -->
|
||||
<link href="assets/css/bootstrap.min.css" id="bootstrap-style" rel="stylesheet" type="text/css" />
|
||||
<!-- Icons Css -->
|
||||
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
||||
<!-- App Css-->
|
||||
<link href="assets/css/app.min.css" id="app-style" rel="stylesheet" type="text/css" />
|
||||
<link rel="stylesheet" href="https://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>
|
||||
<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/ui/1.12.1/jquery-ui.js"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
$("#expiryDate").datepicker({
|
||||
dateFormat: "yy-mm-dd", // Formato della data
|
||||
minDate: 0, // Impedisce la selezione di date passate
|
||||
// Altre opzioni del datepicker se necessario
|
||||
});
|
||||
});
|
||||
</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 {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.custom-date-box,
|
||||
.custom-event-details {
|
||||
width: 100%;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.custom-event-time {
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function confirmDelete(id, deletePageUrl) {
|
||||
Swal.fire({
|
||||
title: "Sei sicuro?",
|
||||
text: "Questa prenotazione verrà cancellata definitivamente! Ricordati poi di riprogrammare la tua lezione!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#d33",
|
||||
cancelButtonColor: "#3085d6",
|
||||
confirmButtonText: "Sì, cancella!",
|
||||
cancelButtonText: "Annulla"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Reindirizza direttamente alla pagina di cancellazione con l'ID come parametro.
|
||||
window.location.href = `deleteclass.php?id=${id}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
</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">Riepilogo Ordini</h4>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="d-flex">
|
||||
|
||||
<?php include('include/languageselection.php'); ?>
|
||||
|
||||
<div class="dropdown d-inline-block">
|
||||
<button type="button" class="btn header-item noti-icon"
|
||||
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="bx bx-search icon-sm align-middle"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-end p-0">
|
||||
<form class="p-2">
|
||||
<div class="search-box">
|
||||
<div class="position-relative">
|
||||
<input type="text" class="form-control rounded bg-light border-0" placeholder="Search...">
|
||||
<i class="bx bx-search search-icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php include('include/profiletopbar.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<?php include('include/sidebar.php'); ?>
|
||||
|
||||
<header class="ishorizontal-topbar">
|
||||
<div class="navbar-header">
|
||||
<div class="d-flex">
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="topnav">
|
||||
<div class="container-fluid">
|
||||
<nav class="navbar navbar-light navbar-expand-lg topnav-menu">
|
||||
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- Start right Content here -->
|
||||
<!-- ============================================================== -->
|
||||
<div class="main-content">
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<?php if ($message == 'success') { ?>
|
||||
<div class="alert alert-success" role="alert">
|
||||
Operazione completata con successo
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<h5>Riepilogo Ordini (Amministratore)</h5>
|
||||
<p>Tutti gli ordini registrati</p>
|
||||
|
||||
<!-- Filtri -->
|
||||
<div class="mb-3">
|
||||
<a href="?filter=all" class="btn btn-secondary <?php echo $filter == 'all' ? 'active' : ''; ?>">Tutti</a>
|
||||
<a href="?filter=active" class="btn btn-success <?php echo $filter == 'active' ? 'active' : ''; ?>">Attivi</a>
|
||||
<a href="?filter=expired" class="btn btn-danger <?php echo $filter == 'expired' ? 'active' : ''; ?>">Scaduti</a>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Stato</th>
|
||||
<th>Numero Ordine</th>
|
||||
<th>Nome</th>
|
||||
<th>Cognome</th>
|
||||
<th>Nome Classe</th>
|
||||
<th>Scadenza</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($orders as $order) {
|
||||
$isActive = ($order["expireon"] > $today);
|
||||
$badgeClass = $isActive ? 'badge bg-success' : 'badge bg-danger';
|
||||
$badgeText = $isActive ? 'Attivo' : 'Scaduto';
|
||||
?>
|
||||
<tr>
|
||||
<td><span class="<?php echo $badgeClass; ?>"><?php echo $badgeText; ?></span></td>
|
||||
<td><?php echo $order["order_id"]; ?></td>
|
||||
<td><?php echo $order["first_name"]; ?></td>
|
||||
<td><?php echo $order["last_name"]; ?></td>
|
||||
<td><?php echo $order["servicename"]; ?></td>
|
||||
<td><?php echo $order["expireon"]; ?></td>
|
||||
<td><?php echo $order["status"]; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- End Page-content -->
|
||||
|
||||
<?php include('include/footer.php'); ?>
|
||||
</div>
|
||||
<!-- end main content-->
|
||||
|
||||
</div>
|
||||
<!-- END layout-wrapper -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- JAVASCRIPT -->
|
||||
<script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="assets/libs/metismenujs/metismenujs.min.js"></script>
|
||||
<script src="assets/libs/simplebar/simplebar.min.js"></script>
|
||||
<script src="assets/libs/eva-icons/eva.min.js"></script>
|
||||
|
||||
<script src="assets/js/app.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,379 @@
|
||||
<?php require_once('include/headscript.php'); ?>
|
||||
|
||||
<?php
|
||||
|
||||
// Creazione della connessione
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
// Verifica della connessione
|
||||
if ($conn->connect_error) {
|
||||
die("Connessione fallita: " . $conn->connect_error);
|
||||
}
|
||||
if (isset($_GET['message'])) {
|
||||
$message = $_GET['message'];
|
||||
} else {
|
||||
$message = 'n';
|
||||
}
|
||||
|
||||
// Gestione del filtro
|
||||
$filter = isset($_GET['filter']) ? $_GET['filter'] : 'all';
|
||||
$today = date("Y-m-d");
|
||||
$whereClause = "";
|
||||
if ($filter == 'active') {
|
||||
$whereClause = "WHERE expireon > '$today'";
|
||||
} elseif ($filter == 'expired') {
|
||||
$whereClause = "WHERE expireon <= '$today'";
|
||||
}
|
||||
|
||||
// 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
|
||||
FROM orderbook o
|
||||
LEFT JOIN service s ON o.idservice = s.idservice
|
||||
$whereClause
|
||||
ORDER BY o.order_id DESC";
|
||||
|
||||
// Esecuzione della query
|
||||
$result = $conn->query($query);
|
||||
|
||||
// Recupero dei records
|
||||
$orders = [];
|
||||
if ($result->num_rows > 0) {
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$orders[] = $row;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<title>YogiBook - Riepilogo Ordini</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="YogiBook - Prenotazione facile YogaSOul" name="description" />
|
||||
<meta content="Advanced Creative Solutions" name="author" />
|
||||
<!-- App favicon -->
|
||||
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
||||
|
||||
<!-- Bootstrap Css -->
|
||||
<link href="assets/css/bootstrap.min.css" id="bootstrap-style" rel="stylesheet" type="text/css" />
|
||||
<!-- Icons Css -->
|
||||
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
||||
<!-- App Css-->
|
||||
<link href="assets/css/app.min.css" id="app-style" rel="stylesheet" type="text/css" />
|
||||
<link rel="stylesheet" href="https://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>
|
||||
<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/ui/1.12.1/jquery-ui.js"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
$("#expiryDate").datepicker({
|
||||
dateFormat: "yy-mm-dd", // Formato della data
|
||||
minDate: 0, // Impedisce la selezione di date passate
|
||||
// Altre opzioni del datepicker se necessario
|
||||
});
|
||||
});
|
||||
</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 {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.custom-date-box,
|
||||
.custom-event-details {
|
||||
width: 100%;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.custom-event-time {
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function confirmDelete(id, deletePageUrl) {
|
||||
Swal.fire({
|
||||
title: "Sei sicuro?",
|
||||
text: "Questa prenotazione verrà cancellata definitivamente! Ricordati poi di riprogrammare la tua lezione!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#d33",
|
||||
cancelButtonColor: "#3085d6",
|
||||
confirmButtonText: "Sì, cancella!",
|
||||
cancelButtonText: "Annulla"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Reindirizza direttamente alla pagina di cancellazione con l'ID come parametro.
|
||||
window.location.href = `deleteclass.php?id=${id}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
</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">Riepilogo Ordini</h4>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="d-flex">
|
||||
|
||||
<?php include('include/languageselection.php'); ?>
|
||||
|
||||
<div class="dropdown d-inline-block">
|
||||
<button type="button" class="btn header-item noti-icon"
|
||||
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="bx bx-search icon-sm align-middle"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-end p-0">
|
||||
<form class="p-2">
|
||||
<div class="search-box">
|
||||
<div class="position-relative">
|
||||
<input type="text" class="form-control rounded bg-light border-0" placeholder="Search...">
|
||||
<i class="bx bx-search search-icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php include('include/profiletopbar.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<?php include('include/sidebar.php'); ?>
|
||||
|
||||
<header class="ishorizontal-topbar">
|
||||
<div class="navbar-header">
|
||||
<div class="d-flex">
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="topnav">
|
||||
<div class="container-fluid">
|
||||
<nav class="navbar navbar-light navbar-expand-lg topnav-menu">
|
||||
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- Start right Content here -->
|
||||
<!-- ============================================================== -->
|
||||
<div class="main-content">
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<?php if ($message == 'success') { ?>
|
||||
<div class="alert alert-success" role="alert">
|
||||
Operazione completata con successo
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<h5>Riepilogo Ordini (Amministratore)</h5>
|
||||
<p>Tutti gli ordini registrati</p>
|
||||
|
||||
<!-- Filtri -->
|
||||
<div class="mb-3">
|
||||
<a href="?filter=all" class="btn btn-secondary <?php echo $filter == 'all' ? 'active' : ''; ?>">Tutti</a>
|
||||
<a href="?filter=active" class="btn btn-success <?php echo $filter == 'active' ? 'active' : ''; ?>">Attivi</a>
|
||||
<a href="?filter=expired" class="btn btn-danger <?php echo $filter == 'expired' ? 'active' : ''; ?>">Scaduti</a>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Stato</th>
|
||||
<th>Numero Ordine</th>
|
||||
<th>Nome</th>
|
||||
<th>Cognome</th>
|
||||
<th>Nome Classe</th>
|
||||
<th>Scadenza</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($orders as $order) {
|
||||
$isActive = ($order["expireon"] > $today);
|
||||
$badgeClass = $isActive ? 'badge bg-success' : 'badge bg-danger';
|
||||
$badgeText = $isActive ? 'Attivo' : 'Scaduto';
|
||||
?>
|
||||
<tr>
|
||||
<td><span class="<?php echo $badgeClass; ?>"><?php echo $badgeText; ?></span></td>
|
||||
<td><?php echo $order["order_id"]; ?></td>
|
||||
<td><?php echo $order["first_name"]; ?></td>
|
||||
<td><?php echo $order["last_name"]; ?></td>
|
||||
<td><?php echo $order["servicename"]; ?></td>
|
||||
<td><?php echo $order["expireon"]; ?></td>
|
||||
<td><?php echo $order["status"]; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- End Page-content -->
|
||||
|
||||
<?php include('include/footer.php'); ?>
|
||||
</div>
|
||||
<!-- end main content-->
|
||||
|
||||
</div>
|
||||
<!-- END layout-wrapper -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- JAVASCRIPT -->
|
||||
<script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="assets/libs/metismenujs/metismenujs.min.js"></script>
|
||||
<script src="assets/libs/simplebar/simplebar.min.js"></script>
|
||||
<script src="assets/libs/eva-icons/eva.min.js"></script>
|
||||
|
||||
<script src="assets/js/app.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -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['cod'] . "</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 "</tr>";
|
||||
}
|
||||
@@ -381,6 +381,55 @@ if (!$result) {
|
||||
<script src="assets/libs/simplebar/simplebar.min.js"></script>
|
||||
<script src="assets/libs/eva-icons/eva.min.js"></script>
|
||||
<script src="assets/js/app.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.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>
|
||||
|
||||
</html>
|
||||
+537
-135
@@ -1,89 +1,447 @@
|
||||
<?php require_once('include/headscript.php'); ?>
|
||||
<?php // optionquery
|
||||
$optionquery = new WA_MySQLi_RS("optionquery",$bkngstm,0);
|
||||
$optionquery->setQuery("SELECT * FROM option");
|
||||
$optionquery->execute();
|
||||
?>
|
||||
|
||||
<?php
|
||||
// Abilita visualizzazione errori PHP (solo per debug)
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
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";
|
||||
|
||||
// Verifica se è stato inviato un modulo
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
// Verifica se è stato caricato un file correttamente
|
||||
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) {
|
||||
$logMessage .= "Connessione al database fallita: " . $conn->connect_error . "\n";
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
die("Connessione al database fallita: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// Ottieni l'ID dell'utente (da dove viene?)
|
||||
$iduserlogin = $_POST["iduserlogin"];
|
||||
|
||||
|
||||
|
||||
// Chiudi la connessione al database
|
||||
$iduserlogin = filter_var($_POST["iduserlogin"], FILTER_VALIDATE_INT);
|
||||
$logMessage .= "ID utente ricevuto dal form: $iduserlogin\n";
|
||||
$conn->close();
|
||||
} else {
|
||||
$logMessage .= "Errore caricamento file o iduserlogin non valido\n";
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
// Crea la connessione al database
|
||||
// Connessione al database
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
// Verifica la connessione
|
||||
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 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
|
||||
LEFT JOIN service s ON o.idservice = s.idservice
|
||||
WHERE o.iduser = ?";
|
||||
$stmt = $conn->prepare($query);
|
||||
$stmt->bind_param("i", $iduserlogin);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
// Query per selezionare i dati filtrati per iduser
|
||||
$query = "SELECT * FROM orderbook LEFT JOIN service ON orderbook.idservice=service.idservice WHERE iduser = '$iduserlogin'";
|
||||
$result = $conn->query($query);
|
||||
|
||||
// Array per memorizzare i risultati
|
||||
$documents = array();
|
||||
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$documents[] = $row;
|
||||
}
|
||||
// Get lesson details for each order
|
||||
$idorderbook = $row['idorderbook'];
|
||||
$logMessage .= "Elaborazione ordine: idorderbook = $idorderbook, order_id = {$row['order_id']}\n";
|
||||
|
||||
$lesson_query = "SELECT bc.idbookingclass, bc.bookingstart, bc.status, bc.lostlesson, bc.expirylesson, bc.idservice, bc.is_reprogrammed, s.servicename
|
||||
FROM bookingclass bc
|
||||
LEFT JOIN service s ON bc.idservice = s.idservice
|
||||
WHERE bc.idorder = ?";
|
||||
$lesson_stmt = $conn->prepare($lesson_query);
|
||||
$lesson_stmt->bind_param("i", $idorderbook);
|
||||
$lesson_stmt->execute();
|
||||
$lesson_result = $lesson_stmt->get_result();
|
||||
|
||||
$lessons = array();
|
||||
$logMessage .= "Query lezioni per idorderbook $idorderbook: $lesson_query\n";
|
||||
if ($lesson_result) {
|
||||
$logMessage .= "Numero di lezioni trovate per idorderbook $idorderbook: " . $lesson_result->num_rows . "\n";
|
||||
while ($lesson_row = $lesson_result->fetch_assoc()) {
|
||||
$lesson_row['bookingstart'] = date('c', strtotime($lesson_row['bookingstart']));
|
||||
$lessons[] = $lesson_row;
|
||||
$logMessage .= "Lezione aggiunta: " . json_encode($lesson_row) . "\n";
|
||||
}
|
||||
} else {
|
||||
$logMessage .= "Errore nella query per idorderbook $idorderbook: " . $conn->error . "\n";
|
||||
}
|
||||
$row['lessons'] = $lessons;
|
||||
$documents[] = $row;
|
||||
$logMessage .= "Lezioni per idorderbook $idorderbook: " . count($lessons) . "\n";
|
||||
$lesson_stmt->close();
|
||||
}
|
||||
$stmt->close();
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
?>
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="it">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<title>YogiBook - Prenotazioni YogaSoul</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="YogiBook - Prenotazione facile YogaSOul" name="description" />
|
||||
<meta content="Advanced Creative Solutions" name="author" />
|
||||
<!-- App favicon -->
|
||||
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
||||
|
||||
<!-- Bootstrap Css -->
|
||||
<link href="assets/css/bootstrap.min.css" id="bootstrap-style" rel="stylesheet" type="text/css" />
|
||||
<!-- Icons Css -->
|
||||
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
||||
<!-- App Css-->
|
||||
<link href="assets/css/app.min.css" id="app-style" rel="stylesheet" type="text/css" />
|
||||
<link rel="stylesheet" href="https://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">
|
||||
<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>
|
||||
$(function() {
|
||||
$("#expiryDate").datepicker({ dateFormat: "yy-mm-dd" });
|
||||
$("#expiryDate").datepicker({
|
||||
dateFormat: "yy-mm-dd"
|
||||
});
|
||||
|
||||
// Handle order click for popup
|
||||
$('.order-row').click(function() {
|
||||
var lessons = $(this).data('lessons');
|
||||
console.log('Lezioni ricevute:', lessons);
|
||||
var total = $(this).data('total');
|
||||
var orderId = $(this).data('order-id');
|
||||
var isExpired = $(this).data('is-expired') === true; // Converti in booleano
|
||||
var expireOn = $(this).data('expireon');
|
||||
|
||||
// Calcolo delle date
|
||||
var now = new Date();
|
||||
|
||||
// Calcolo dei conteggi
|
||||
var completed = lessons.filter(l => {
|
||||
var lessonDate = new Date(l.bookingstart);
|
||||
return (l.status === 'completed') ||
|
||||
(l.status === 'booked' && lessonDate < now && l.lostlesson !== 'Y' && l.expirylesson !== 'Y');
|
||||
}).length;
|
||||
var lost = lessons.filter(l => l.lostlesson === 'Y').length;
|
||||
var expired = lessons.filter(l => l.expirylesson === 'Y').length;
|
||||
var booked = lessons.filter(l => {
|
||||
var lessonDate = new Date(l.bookingstart);
|
||||
return (l.status === 'booked' && lessonDate >= now && l.lostlesson !== 'Y' && l.expirylesson !== 'Y');
|
||||
}).length;
|
||||
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({
|
||||
booked: booked,
|
||||
completed: completed,
|
||||
lost: lost,
|
||||
expired: expired,
|
||||
toSchedule: toSchedule,
|
||||
total: total
|
||||
});
|
||||
|
||||
var expireOnFormatted = expireOn ? new Date(expireOn).toLocaleDateString('it-IT', {
|
||||
day: '2-digit',
|
||||
month: '2-digit',
|
||||
year: 'numeric'
|
||||
}) : 'Non specificata';
|
||||
|
||||
var htmlContent = `
|
||||
<h4 style="margin-bottom: 20px; color: #333; font-weight: 600;">
|
||||
Dettagli Ordine #${orderId}
|
||||
<span class="badge ${isExpired ? 'bg-danger' : 'bg-primary'}" style="margin-left: 10px; color: white;">
|
||||
${isExpired ? 'Scaduto' : 'Attivo'}
|
||||
</span>
|
||||
</h4>
|
||||
<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;" title="Numero di lezioni acquistate per questo ordine">
|
||||
<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>
|
||||
</div>
|
||||
<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;">Praticate</h5>
|
||||
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #155724;">${completed}</p>
|
||||
</div>
|
||||
<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>
|
||||
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #721c24;">${lost}</p>
|
||||
</div>
|
||||
<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>
|
||||
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #856404;">${expired}</p>
|
||||
</div>
|
||||
<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>
|
||||
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #4c2c92;">${toSchedule}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div style="background-color: #f8f9fa; padding: 15px; border-radius: 8px;">
|
||||
<p style="margin: 0 0 15px 0; color: #333; font-size: 14px; font-weight: 500;">
|
||||
Il tuo ordine scadrà il ${expireOnFormatted}
|
||||
</p>
|
||||
<table class="lesson-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Data e Ora</th>
|
||||
<th>Lezione</th>
|
||||
<th>Stato</th>
|
||||
<th>Riprogrammata</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
`;
|
||||
|
||||
if (lessons.length === 0) {
|
||||
htmlContent += `
|
||||
<tr>
|
||||
<td colspan="4" style="text-align: center; padding: 10px; color: #666; font-size: 13px;">
|
||||
Nessuna lezione trovata per questo ordine.
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
} else {
|
||||
lessons.forEach(function(lesson, index) {
|
||||
var lessonDate = new Date(lesson.bookingstart);
|
||||
var statusText = lesson.status;
|
||||
var badgeClass = 'bg-primary';
|
||||
var badgeTextColor = '#fff';
|
||||
if (lesson.status === 'completed') {
|
||||
badgeClass = 'bg-success';
|
||||
badgeTextColor = '#fff';
|
||||
statusText = 'Completata';
|
||||
} else if (lesson.lostlesson === 'Y') {
|
||||
badgeClass = 'bg-danger';
|
||||
badgeTextColor = '#fff';
|
||||
statusText = 'Persa';
|
||||
} else if (lesson.expirylesson === 'Y') {
|
||||
badgeClass = 'bg-warning';
|
||||
badgeTextColor = '#000';
|
||||
statusText = 'Scaduta';
|
||||
} else if (lesson.status === 'booked') {
|
||||
if (lessonDate < now && lesson.lostlesson !== 'Y' && lesson.expirylesson !== 'Y') {
|
||||
statusText = 'Completata';
|
||||
badgeClass = 'bg-success';
|
||||
badgeTextColor = '#fff';
|
||||
} else {
|
||||
statusText = 'Programmata';
|
||||
}
|
||||
}
|
||||
var isReprogrammedText = lesson.is_reprogrammed === 'Y' ? 'Sì' : 'No';
|
||||
|
||||
htmlContent += `
|
||||
<tr class="${index % 2 === 0 ? 'even-row' : 'odd-row'}">
|
||||
<td style="padding: 8px; font-size: 13px;">${lessonDate.toLocaleString('it-IT', {
|
||||
day: '2-digit',
|
||||
month: '2-digit',
|
||||
year: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
})}</td>
|
||||
<td style="padding: 8px; font-size: 13px;">${lesson.servicename}</td>
|
||||
<td style="padding: 8px;">
|
||||
<span class="badge ${badgeClass}" style="color: ${badgeTextColor}; padding: 6px 10px; font-size: 12px; font-weight: 500;">${statusText}</span>
|
||||
</td>
|
||||
<td style="padding: 8px; font-size: 13px;">${isReprogrammedText}</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
}
|
||||
|
||||
htmlContent += `
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
`;
|
||||
|
||||
Swal.fire({
|
||||
title: '',
|
||||
html: htmlContent,
|
||||
confirmButtonText: 'Chiudi',
|
||||
width: '1000px',
|
||||
customClass: {
|
||||
popup: 'custom-modal'
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Handle details button click
|
||||
$('.details-btn').click(function(e) {
|
||||
e.stopPropagation();
|
||||
var row = $(this).closest('tr');
|
||||
var lessons = row.data('lessons');
|
||||
var total = row.data('total');
|
||||
var orderId = row.data('order-id');
|
||||
var isExpired = row.data('is-expired') === true;
|
||||
var expireOn = row.data('expireon');
|
||||
|
||||
var now = new Date();
|
||||
|
||||
var completed = lessons.filter(l => {
|
||||
var lessonDate = new Date(l.bookingstart);
|
||||
return (l.status === 'completed') ||
|
||||
(l.status === 'booked' && lessonDate < now && l.lostlesson !== 'Y' && l.expirylesson !== 'Y');
|
||||
}).length;
|
||||
var lost = lessons.filter(l => l.lostlesson === 'Y').length;
|
||||
var expired = lessons.filter(l => l.expirylesson === 'Y').length;
|
||||
var booked = lessons.filter(l => {
|
||||
var lessonDate = new Date(l.bookingstart);
|
||||
return (l.status === 'booked' && lessonDate >= now && l.lostlesson !== 'Y' && l.expirylesson !== 'Y');
|
||||
}).length;
|
||||
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 = `
|
||||
<h4 style="margin-bottom: 20px; color: #333; font-weight: 600;">
|
||||
Dettagli Ordine #${orderId}
|
||||
<span class="badge ${isExpired ? 'bg-danger' : 'bg-primary'}" style="margin-left: 10px; color: white;">
|
||||
${isExpired ? 'Scaduto' : 'Attivo'}
|
||||
</span>
|
||||
</h4>
|
||||
<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;" title="Numero di lezioni acquistate per questo ordine">
|
||||
<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>
|
||||
</div>
|
||||
<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;">Praticate</h5>
|
||||
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #155724;">${completed}</p>
|
||||
</div>
|
||||
<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>
|
||||
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #721c24;">${lost}</p>
|
||||
</div>
|
||||
<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>
|
||||
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #856404;">${expired}</p>
|
||||
</div>
|
||||
<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>
|
||||
<p style="font-size: 24px; font-weight: bold; margin: 5px 0; color: #4c2c92;">${toSchedule}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div style="background-color: #f8f9fa; padding: 15px; border-radius: 8px;">
|
||||
<table class="lesson-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Data e Ora</th>
|
||||
<th>Lezione</th>
|
||||
<th>Stato</th>
|
||||
<th>Riprogrammata</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
`;
|
||||
|
||||
if (lessons.length === 0) {
|
||||
htmlContent += `
|
||||
<tr>
|
||||
<td colspan="4" style="text-align: center; padding: 10px; color: #666; font-size: 13px;">
|
||||
Nessuna lezione trovata per questo ordine.
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
} else {
|
||||
lessons.forEach(function(lesson, index) {
|
||||
var lessonDate = new Date(lesson.bookingstart);
|
||||
var statusText = lesson.status;
|
||||
var badgeClass = 'bg-primary';
|
||||
var badgeTextColor = '#fff';
|
||||
if (lesson.status === 'completed') {
|
||||
badgeClass = 'bg-success';
|
||||
badgeTextColor = '#fff';
|
||||
statusText = 'Completata';
|
||||
} else if (lesson.lostlesson === 'Y') {
|
||||
badgeClass = 'bg-danger';
|
||||
badgeTextColor = '#fff';
|
||||
statusText = 'Persa';
|
||||
} else if (lesson.expirylesson === 'Y') {
|
||||
badgeClass = 'bg-warning';
|
||||
badgeTextColor = '#000';
|
||||
statusText = 'Scaduta';
|
||||
} else if (lesson.status === 'booked') {
|
||||
if (lessonDate < now && lesson.lostlesson !== 'Y' && lesson.expirylesson !== 'Y') {
|
||||
statusText = 'Completata';
|
||||
badgeClass = 'bg-success';
|
||||
badgeTextColor = '#fff';
|
||||
} else {
|
||||
statusText = 'Programmata';
|
||||
}
|
||||
}
|
||||
var isReprogrammedText = lesson.is_reprogrammed === 'Y' ? 'Sì' : 'No';
|
||||
|
||||
htmlContent += `
|
||||
<tr class="${index % 2 === 0 ? 'even-row' : 'odd-row'}">
|
||||
<td style="padding: 8px; font-size: 13px;">${lessonDate.toLocaleString('it-IT', {
|
||||
day: '2-digit',
|
||||
month: '2-digit',
|
||||
year: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
})}</td>
|
||||
<td style="padding: 8px; font-size: 13px;">${lesson.servicename}</td>
|
||||
<td style="padding: 8px;">
|
||||
<span class="badge ${badgeClass}" style="color: ${badgeTextColor}; padding: 6px 10px; font-size: 12px; font-weight: 500;">${statusText}</span>
|
||||
</td>
|
||||
<td style="padding: 8px; font-size: 13px;">${isReprogrammedText}</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
}
|
||||
|
||||
htmlContent += `
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
`;
|
||||
|
||||
Swal.fire({
|
||||
title: '',
|
||||
html: htmlContent,
|
||||
confirmButtonText: 'Chiudi',
|
||||
width: '1000px',
|
||||
customClass: {
|
||||
popup: 'custom-modal'
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function confirmDelete(id, deletePageUrl) {
|
||||
Swal.fire({
|
||||
title: "Sei sicuro?",
|
||||
text: "Questa prenotazione verrà cancellata definitivamente! Ricordati poi di riprogrammare la tua lezione!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#d33",
|
||||
cancelButtonColor: "#3085d6",
|
||||
confirmButtonText: "Sì, cancella!",
|
||||
cancelButtonText: "Annulla"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = `deleteclass.php?id=${id}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
@@ -106,7 +464,7 @@ while ($row = $result->fetch_assoc()) {
|
||||
|
||||
.custom-date-box {
|
||||
flex: 1;
|
||||
background-color: red;
|
||||
background-color: #ff4d4f;
|
||||
color: white;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -132,7 +490,7 @@ while ($row = $result->fetch_assoc()) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 10px 20px;
|
||||
background-color: lightblue;
|
||||
background-color: #e6f3ff;
|
||||
}
|
||||
|
||||
.custom-heading {
|
||||
@@ -173,7 +531,8 @@ while ($row = $result->fetch_assoc()) {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.custom-date-box, .custom-event-details {
|
||||
.custom-date-box,
|
||||
.custom-event-details {
|
||||
width: 100%;
|
||||
border-radius: 0;
|
||||
}
|
||||
@@ -182,97 +541,128 @@ while ($row = $result->fetch_assoc()) {
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.order-row {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.order-row:hover {
|
||||
background-color: #f8f9fa !important;
|
||||
}
|
||||
|
||||
.stat-box {
|
||||
padding: 12px;
|
||||
border-radius: 8px;
|
||||
text-align: center;
|
||||
width: 18%;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.stat-box:hover {
|
||||
transform: translateY(-3px);
|
||||
}
|
||||
|
||||
.custom-modal .swal2-content {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.custom-modal .lesson-table {
|
||||
width: 100% !important;
|
||||
border-collapse: collapse !important;
|
||||
font-size: 13px !important;
|
||||
color: #333 !important;
|
||||
}
|
||||
|
||||
.custom-modal .lesson-table th {
|
||||
background-color: #e9ecef !important;
|
||||
padding: 10px !important;
|
||||
text-align: left !important;
|
||||
font-weight: 600 !important;
|
||||
border-bottom: 2px solid #dee2e6 !important;
|
||||
border-right: 1px solid #dee2e6 !important;
|
||||
}
|
||||
|
||||
.custom-modal .lesson-table th:last-child {
|
||||
border-right: none !important;
|
||||
}
|
||||
|
||||
.custom-modal .lesson-table td {
|
||||
padding: 8px !important;
|
||||
line-height: 1.2 !important;
|
||||
vertical-align: middle !important;
|
||||
border-bottom: 1px solid #dee2e6 !important;
|
||||
border-right: 1px solid #dee2e6 !important;
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
.custom-modal .lesson-table td:last-child {
|
||||
border-right: none !important;
|
||||
}
|
||||
|
||||
.custom-modal .lesson-table .even-row {
|
||||
background-color: #fff !important;
|
||||
}
|
||||
|
||||
.custom-modal .lesson-table .odd-row {
|
||||
background-color: #f8f9fa !important;
|
||||
}
|
||||
|
||||
.custom-modal .lesson-table tr:hover {
|
||||
background-color: #e9ecef !important;
|
||||
}
|
||||
|
||||
.details-btn {
|
||||
margin-left: 10px;
|
||||
padding: 5px 10px;
|
||||
font-size: 12px;
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.details-btn:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function confirmDelete(id, deletePageUrl) {
|
||||
Swal.fire({
|
||||
title: "Sei sicuro?",
|
||||
text: "Questa prenotazione verrà cancellata definitivamente! Ricordati poi di riprogrammare la tua lezione!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#d33",
|
||||
cancelButtonColor: "#3085d6",
|
||||
confirmButtonText: "Sì, cancella!",
|
||||
cancelButtonText: "Annulla"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Reindirizza direttamente alla pagina di cancellazione con l'ID come parametro.
|
||||
window.location.href = `deleteclass.php?id=${id}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- <body data-layout="horizontal"> -->
|
||||
|
||||
<!-- Begin page -->
|
||||
<div id="layout-wrapper">
|
||||
|
||||
<!-- Top Bar -->
|
||||
<header id="page-topbar" class="isvertical-topbar">
|
||||
<div class="navbar-header">
|
||||
<div class="d-flex">
|
||||
<!-- LOGO -->
|
||||
<?php include('include/logoarea.php'); ?>
|
||||
|
||||
<button type="button" class="btn btn-sm px-3 font-size-24 header-item waves-effect vertical-menu-btn">
|
||||
<i class="bx bx-menu align-middle"></i>
|
||||
</button>
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="page-title-box align-self-center d-none d-md-block">
|
||||
<h4 class="page-title mb-0">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 class="d-flex"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="topnav">
|
||||
<div class="container-fluid">
|
||||
<nav class="navbar navbar-light navbar-expand-lg topnav-menu">
|
||||
|
||||
|
||||
</nav>
|
||||
<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">
|
||||
@@ -286,61 +676,73 @@ while ($row = $result->fetch_assoc()) {
|
||||
<th>N. Ordine</th>
|
||||
<th>Data Ordine</th>
|
||||
<th>Classe</th>
|
||||
<th>Giorno/Ora</th>
|
||||
<th>N. Ticket</th>
|
||||
<th>Prima Lezione</th>
|
||||
<th>Scadenza</th>
|
||||
<th>Riprogr. Massime</th>
|
||||
<th>Riprogrammate</th>
|
||||
<th>Stato</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($documents as $document) { ?>
|
||||
<tr>
|
||||
<td><?php echo $document['order_id']; ?></td>
|
||||
<?php foreach ($documents as $document) {
|
||||
$is_expired = strtotime($document['expireon']) < time();
|
||||
$logMessage .= "Order ID: {$document['idorderbook']}, Lessons count: " . count($document['lessons']) . "\n";
|
||||
?>
|
||||
<tr class="order-row"
|
||||
data-lessons='<?php echo json_encode($document['lessons']); ?>'
|
||||
data-total='<?php echo $document['quantityclass']; ?>'
|
||||
data-order-id='<?php echo $document['idorderbook']; ?>'
|
||||
data-is-expired='<?php echo $is_expired ? 'true' : 'false'; ?>'
|
||||
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 $document['servicename']; ?></td>
|
||||
<td><?php echo $document['day'] . ' ' . $document['time']; ?></td>
|
||||
<td><?php echo $document['quantityclass']; ?></td>
|
||||
<td><?php echo date('d-m-Y', strtotime($document['expireon'])); ?></td>
|
||||
<td><?php echo $document['first_lesson_date'] ? date('d-m-Y', strtotime($document['first_lesson_date'])) : '-'; ?></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>
|
||||
<span class="badge <?php echo $is_expired ? 'bg-danger' : 'bg-primary'; ?>">
|
||||
<?php echo $is_expired ? 'Scaduto' : 'Attivo'; ?>
|
||||
</span>
|
||||
<button class="details-btn">Dettagli</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php include('include/footer.php'); ?>
|
||||
</div>
|
||||
<!-- end main content-->
|
||||
|
||||
</div>
|
||||
<!-- END layout-wrapper -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- JAVASCRIPT -->
|
||||
<script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="assets/libs/metismenujs/metismenujs.min.js"></script>
|
||||
<script src="assets/libs/simplebar/simplebar.min.js"></script>
|
||||
<script src="assets/libs/eva-icons/eva.min.js"></script>
|
||||
|
||||
<script src="assets/js/app.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<?php
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
$conn->close();
|
||||
?>
|
||||
@@ -0,0 +1,412 @@
|
||||
<?php require_once('include/headscript.php'); ?>
|
||||
|
||||
<?php
|
||||
// Creazione della connessione
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
// Verifica della connessione
|
||||
if ($conn->connect_error) {
|
||||
die("Connessione fallita: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// Gestione del messaggio GET
|
||||
if (isset($_GET['message'])) {
|
||||
$message = $_GET['message'];
|
||||
} else {
|
||||
$message = 'n';
|
||||
}
|
||||
|
||||
// ID dell'insegnante (per il form DayOff)
|
||||
$idTeacher = 1;
|
||||
|
||||
// Gestione dell'inserimento del DayOff
|
||||
if (isset($_POST['submit'])) {
|
||||
$dayoffdate = $_POST['dayoff'];
|
||||
$insertQuery = "INSERT INTO dayoff (idteacher, dayoffdate) VALUES (?, ?)";
|
||||
$stmt = $conn->prepare($insertQuery);
|
||||
$stmt->bind_param("is", $idTeacher, $dayoffdate);
|
||||
if ($stmt->execute()) {
|
||||
$message = 'success_dayoff';
|
||||
} else {
|
||||
$message = 'error_dayoff';
|
||||
}
|
||||
$stmt->close();
|
||||
}
|
||||
|
||||
// Gestione del filtro per gli ordini
|
||||
$filter = isset($_GET['filter']) ? $_GET['filter'] : 'all';
|
||||
$today = date("Y-m-d");
|
||||
$whereClause = "";
|
||||
if ($filter == 'active') {
|
||||
$whereClause = "WHERE expireon > '$today'";
|
||||
} elseif ($filter == 'expired') {
|
||||
$whereClause = "WHERE expireon <= '$today'";
|
||||
}
|
||||
|
||||
// Query SQL per recuperare tutti gli ordini con join su service
|
||||
$query = "SELECT o.idorderbook, o.first_name, o.last_name, s.servicename, o.expireon, o.status, o.nticket
|
||||
FROM orderbook o
|
||||
LEFT JOIN service s ON o.idservice = s.idservice
|
||||
$whereClause
|
||||
ORDER BY o.idorderbook DESC";
|
||||
$result = $conn->query($query);
|
||||
$orders = [];
|
||||
if ($result->num_rows > 0) {
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$orders[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
// Query SQL per i DayOff
|
||||
$query_dayoff = "SELECT iddayoff, dayoffdate FROM dayoff WHERE idteacher = '1'";
|
||||
$result_dayoff = $conn->query($query_dayoff);
|
||||
$documents = [];
|
||||
if ($result_dayoff->num_rows > 0) {
|
||||
while ($row = $result_dayoff->fetch_assoc()) {
|
||||
$documents[] = $row;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>YogiBook - Prenotazioni YogaSoul</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="YogiBook - Prenotazione facile YogaSOul" name="description" />
|
||||
<meta content="Advanced Creative Solutions" name="author" />
|
||||
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
||||
<link href="assets/css/bootstrap.min.css" id="bootstrap-style" 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 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>
|
||||
<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/ui/1.12.1/jquery-ui.js"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
// Inizializzazione del Datepicker per i campi DayOff
|
||||
$("#dayoff").datepicker({
|
||||
dateFormat: "yy-mm-dd",
|
||||
minDate: 0
|
||||
});
|
||||
|
||||
// Inizializzazione del Datepicker per i campi di scadenza editabili
|
||||
$(document).on('focus', '.expiryDateInput', function() {
|
||||
$(this).datepicker({
|
||||
dateFormat: "yy-mm-dd",
|
||||
minDate: 0,
|
||||
onSelect: function(dateText) {
|
||||
let orderId = $(this).data('order-id');
|
||||
console.log("Datepicker selezionato - idorderbook: " + orderId + ", newExpiry: " + dateText);
|
||||
confirmUpdate(orderId, dateText);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Rendere il campo scadenza editabile al click
|
||||
$(document).on('click', '.expiry-date', function() {
|
||||
let orderId = $(this).data('order-id');
|
||||
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).find('.expiryDateInput').focus();
|
||||
});
|
||||
|
||||
// Funzione per confermare l'aggiornamento della scadenza
|
||||
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({
|
||||
title: "Sei sicuro?",
|
||||
text: "La data di scadenza verrà modificata!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#d33",
|
||||
confirmButtonText: "Sì, modifica!",
|
||||
cancelButtonText: "Annulla"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: 'update_expiry.php',
|
||||
type: 'POST',
|
||||
data: {
|
||||
order_id: orderId,
|
||||
new_expiry: newExpiry,
|
||||
update_expiry: 1
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log("Risposta AJAX:", response);
|
||||
if (response.status === 'success') {
|
||||
Swal.fire('Successo!', response.message, 'success');
|
||||
originalCell.text(newExpiry);
|
||||
} else {
|
||||
Swal.fire('Errore!', response.message, 'error');
|
||||
originalCell.text(originalDate);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Errore AJAX:', {
|
||||
status: status,
|
||||
error: error,
|
||||
responseText: xhr.responseText
|
||||
});
|
||||
Swal.fire('Errore!', 'Errore durante la richiesta al server: ' + error, 'error');
|
||||
originalCell.text(originalDate);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
originalCell.text(originalDate);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Funzione per confermare la cancellazione
|
||||
function confirmDelete(id, deletePageUrl) {
|
||||
Swal.fire({
|
||||
title: "Sei sicuro?",
|
||||
text: "Questa prenotazione verrà cancellata definitivamente! Ricordati poi di riprogrammare la tua lezione!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#d33",
|
||||
cancelButtonColor: "#3085d6",
|
||||
confirmButtonText: "Sì, cancella!",
|
||||
cancelButtonText: "Annulla"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = `deleteclass.php?id=${id}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</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;
|
||||
}
|
||||
|
||||
.expiry-date {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.expiry-date:hover {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</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">Riepilogo Ordini</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>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include('include/profiletopbar.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<?php include('include/sidebar.php'); ?>
|
||||
<header class="ishorizontal-topbar">
|
||||
<div class="navbar-header">
|
||||
<div class="d-flex"></div>
|
||||
</div>
|
||||
<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="card">
|
||||
<div class="card-body">
|
||||
<h5>Riepilogo Ordini (Amministratore)</h5>
|
||||
<p>Tutti gli ordini registrati</p>
|
||||
<div class="mb-3">
|
||||
<a href="?filter=all" class="btn btn-secondary <?php echo $filter == 'all' ? 'active' : ''; ?>">Tutti</a>
|
||||
<a href="?filter=active" class="btn btn-success <?php echo $filter == 'active' ? 'active' : ''; ?>">Attivi</a>
|
||||
<a href="?filter=expired" class="btn btn-danger <?php echo $filter == 'expired' ? 'active' : ''; ?>">Scaduti</a>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Stato</th>
|
||||
<th>Numero Ordine</th>
|
||||
<th>Nome</th>
|
||||
<th>Cognome</th>
|
||||
<th>Nome Classe</th>
|
||||
<th>Numero Ticket</th>
|
||||
<th>Scadenza</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($orders as $order) {
|
||||
$isActive = ($order["expireon"] > $today);
|
||||
$badgeClass = $isActive ? 'badge bg-success' : 'badge bg-danger';
|
||||
$badgeText = $isActive ? 'Attivo' : 'Scaduto';
|
||||
?>
|
||||
<tr>
|
||||
<td><span class="<?php echo $badgeClass; ?>"><?php echo $badgeText; ?></span></td>
|
||||
<td><?php echo $order["idorderbook"]; ?></td>
|
||||
<td><?php echo $order["first_name"]; ?></td>
|
||||
<td><?php echo $order["last_name"]; ?></td>
|
||||
<td><?php echo $order["servicename"]; ?></td>
|
||||
<td><?php echo $order["nticket"]; ?></td>
|
||||
<td class="expiry-date" data-order-id="<?php echo $order['idorderbook']; ?>"><?php echo $order["expireon"]; ?></td>
|
||||
<td><?php echo $order["status"]; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</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>
|
||||
@@ -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();
|
||||
@@ -0,0 +1,181 @@
|
||||
<?php
|
||||
// Abilita visualizzazione errori PHP (solo per debug)
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
include('include/headscript.php');
|
||||
|
||||
// Includi PHPMailer una sola volta, all'inizio dello script
|
||||
require 'phpmailer/src/Exception.php';
|
||||
require 'phpmailer/src/PHPMailer.php';
|
||||
require 'phpmailer/src/SMTP.php';
|
||||
|
||||
// Verifica connessione al database
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
if ($conn->connect_error) {
|
||||
die("Connessione al database fallita: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// Inizializza contatore e log
|
||||
$emailCount = 0;
|
||||
$errors = [];
|
||||
$logFile = 'promemoria_cron_log.txt';
|
||||
$logMessage = "Esecuzione cron: " . date('Y-m-d H:i:s') . "\n";
|
||||
|
||||
// Genera UUID per tutti i record senza token
|
||||
$updateQuery = "UPDATE bookingclass
|
||||
SET cancellation_token = UUID()
|
||||
WHERE status = 'booked'
|
||||
AND cancellation_token IS NULL";
|
||||
$updateStmt = $conn->prepare($updateQuery);
|
||||
if ($updateStmt) {
|
||||
$updateStmt->execute();
|
||||
$affectedRows = $updateStmt->affected_rows;
|
||||
$logMessage .= "Generati $affectedRows token UUID per prenotazioni senza token.\n";
|
||||
} else {
|
||||
$errors[] = "Errore preparazione query per generazione token: " . $conn->error;
|
||||
$logMessage .= "Errore generazione token: " . $conn->error . "\n";
|
||||
}
|
||||
|
||||
// Seleziona prenotazioni per domani (dalle 17:00 in poi) e dopodomani (fino alle 16:59)
|
||||
$tomorrow = date('Y-m-d', strtotime('+1 day'));
|
||||
$dayAfterTomorrow = date('Y-m-d', strtotime('+2 days'));
|
||||
$query = "SELECT bc.*, au.email, au.first_name, s.servicename
|
||||
FROM bookingclass bc
|
||||
LEFT JOIN auth_users au ON bc.iduser = au.id
|
||||
LEFT JOIN service s ON bc.idservice = s.idservice
|
||||
WHERE bc.status = 'booked' AND (
|
||||
(DATE(bc.bookingstart) = ? AND TIME(bc.bookingstart) >= '17:00:00') OR
|
||||
(DATE(bc.bookingstart) = ? AND TIME(bc.bookingstart) <= '16:59:59')
|
||||
)";
|
||||
|
||||
$stmt = $conn->prepare($query);
|
||||
if (!$stmt) {
|
||||
$errors[] = "Errore preparazione query: " . $conn->error;
|
||||
file_put_contents($logFile, $logMessage . "Errore query: " . $conn->error . "\n", FILE_APPEND);
|
||||
echo "Errore preparazione query: " . $conn->error;
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt->bind_param("ss", $tomorrow, $dayAfterTomorrow);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
if ($result->num_rows === 0) {
|
||||
$logMessage .= "Nessuna prenotazione trovata per domani (dalle 17:00) o dopodomani (fino alle 16:59).\n";
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
echo "Nessuna prenotazione trovata.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$idbookingclass = $row['idbookingclass'];
|
||||
$token = $row['cancellation_token'];
|
||||
|
||||
// Verifica che il token esista
|
||||
if (empty($token)) {
|
||||
$errors[] = "Token mancante per ID $idbookingclass dopo aggiornamento UUID.";
|
||||
$logMessage .= "Token mancante per ID $idbookingclass dopo aggiornamento UUID.\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
$firstname = $row['first_name'] ?? 'Utente';
|
||||
$emailuser = $row['email'];
|
||||
$servicename = $row['servicename'] ?? 'Sconosciuta';
|
||||
$bookingstart = $row['bookingstart'];
|
||||
$dataformat = date("d-m-Y H:i", strtotime($bookingstart));
|
||||
|
||||
// Determina il limite di cancellazione in base all'orario della lezione
|
||||
$lessonTime = new DateTime($bookingstart);
|
||||
$isTomorrow = $lessonTime->format('Y-m-d') === $tomorrow;
|
||||
$hour = (int)$lessonTime->format('H');
|
||||
$minute = (int)$lessonTime->format('i');
|
||||
$isBefore1700 = ($hour < 17) || ($hour === 17 && $minute === 0);
|
||||
$cancellationDeadline = $isBefore1700 ? "00:01" : "12:00";
|
||||
|
||||
// Verifica email valida
|
||||
if (!filter_var($emailuser, FILTER_VALIDATE_EMAIL)) {
|
||||
$errors[] = "Email non valida per ID $idbookingclass: $emailuser";
|
||||
$logMessage .= "Email non valida per ID $idbookingclass: $emailuser\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
// Link cancellazione
|
||||
$link = "https://yogibook.yogasoul.it/cancella-prenotazione.php?idbookingclass=$idbookingclass&token=$token";
|
||||
|
||||
// Messaggio email
|
||||
$message = "<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 18px; line-height: 34.2px;'><strong>Ciao $firstname,</strong></span></p>
|
||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Promemoria: hai la lezione $servicename del $dataformat.</span></p>
|
||||
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 16px; line-height: 30.4px;'>Puoi cancellarla fino alle $cancellationDeadline del giorno della lezione cliccando qui:</span></p>
|
||||
<a href='$link' target='_blank'>Cancella prenotazione</a>
|
||||
<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>";
|
||||
|
||||
// Definisci $messageedit per il template
|
||||
$messageedit = $message;
|
||||
|
||||
// Definisci $buttonedit
|
||||
$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);
|
||||
try {
|
||||
$mail->isSMTP();
|
||||
$mail->Host = 'mail.yogasoul.it';
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->Username = 'info@yogasoul.it';
|
||||
$mail->Password = '!Testolina88';
|
||||
$mail->SMTPSecure = 'tls';
|
||||
$mail->Port = 587;
|
||||
|
||||
if (!file_exists('mail/emailtemplate2.php')) {
|
||||
throw new Exception("File emailtemplate2.php non trovato.");
|
||||
}
|
||||
include('mail/emailtemplate2.php');
|
||||
|
||||
if (!isset($mailmessage1)) {
|
||||
throw new Exception("Variabile \$mailmessage1 non definita in emailtemplate2.php.");
|
||||
}
|
||||
|
||||
$htmlContent = str_replace('{message}', $message, $mailmessage1);
|
||||
|
||||
$mail->From = 'info@yogasoul.it';
|
||||
$mail->FromName = 'YogiBook [YogaSoul]';
|
||||
$mail->addAddress($emailuser);
|
||||
$mail->Subject = "YogiBook - Promemoria lezione!";
|
||||
$mail->Body = $htmlContent;
|
||||
$mail->AltBody = 'Promemoria lezione.';
|
||||
|
||||
$mail->send();
|
||||
$emailCount++;
|
||||
$logMessage .= "Email inviata a $emailuser per lezione ID $idbookingclass ($dataformat)\n";
|
||||
} catch (Exception $e) {
|
||||
$errors[] = "Errore invio email a $emailuser (ID $idbookingclass): " . $mail->ErrorInfo;
|
||||
$logMessage .= "Errore invio a $emailuser (ID $idbookingclass): " . $mail->ErrorInfo . "\n";
|
||||
}
|
||||
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
// Scrivi log
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
|
||||
// Output debug
|
||||
echo "Esecuzione completata: $emailCount email inviate.\n";
|
||||
if (!empty($errors)) {
|
||||
echo "Errori rilevati:\n";
|
||||
foreach ($errors as $error) {
|
||||
echo "- $error\n";
|
||||
}
|
||||
} else {
|
||||
echo "Nessun errore.\n";
|
||||
}
|
||||
echo "Dettagli nel file di log: $logFile\n";
|
||||
|
||||
$conn->close();
|
||||
@@ -0,0 +1,19 @@
|
||||
Esecuzione cron: 2025-10-08 13:39:42
|
||||
Esecuzione cron: 2025-10-08 13:40:48
|
||||
Esecuzione cron: 2025-10-08 13:54:46
|
||||
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();
|
||||
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/PHPMailer.php';
|
||||
require 'phpmailer/src/SMTP.php';
|
||||
$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>
|
||||
<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>
|
||||
<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>
|
||||
@@ -182,81 +248,20 @@ if ($service_schedule_result->num_rows > 0) {
|
||||
$mail->SMTPSecure = 'tls';
|
||||
$mail->Port = '587';
|
||||
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->FromName = 'YogiBook [YogaSoul]';
|
||||
$mail->addAddress($billing_email);
|
||||
$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->send();
|
||||
|
||||
header("Location: orderbooklist.php");
|
||||
exit();
|
||||
} 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";
|
||||
}
|
||||
$stmt_schedule->close();
|
||||
|
||||
// Recupera il numero di settimane da expiryparameter
|
||||
$expiry_class_query = "SELECT quantityclass, first_lesson_date FROM orderbook WHERE idorderbook = ?";
|
||||
$stmt_expiry = $conn->prepare($expiry_class_query);
|
||||
$stmt_expiry->bind_param("i", $order_id);
|
||||
$stmt_expiry->execute();
|
||||
$expiry_class_result = $stmt_expiry->get_result();
|
||||
|
||||
if ($expiry_class_result && $expiry_class_result->num_rows > 0) {
|
||||
$row = $expiry_class_result->fetch_assoc();
|
||||
$quantity_class = $row['quantityclass'];
|
||||
$first_lesson_date = $row['first_lesson_date'];
|
||||
|
||||
$expiry_weeks_query = "SELECT expiryweeks FROM expiryparameter WHERE quantityclass = ?";
|
||||
$stmt_expiry_weeks = $conn->prepare($expiry_weeks_query);
|
||||
$stmt_expiry_weeks->bind_param("i", $quantity_class);
|
||||
$stmt_expiry_weeks->execute();
|
||||
$expiry_weeks_result = $stmt_expiry_weeks->get_result();
|
||||
|
||||
if ($expiry_weeks_result && $expiry_weeks_result->num_rows > 0) {
|
||||
$expiry_row = $expiry_weeks_result->fetch_assoc();
|
||||
$expiry_weeks = $expiry_row['expiryweeks'];
|
||||
|
||||
// Aggiorna la colonna expireon in orderbook basandosi su first_lesson_date
|
||||
$update_expiry_query = "UPDATE orderbook SET expireon = DATE_ADD(first_lesson_date, INTERVAL ? WEEK) WHERE idorderbook = ?";
|
||||
$stmt_update_expiry = $conn->prepare($update_expiry_query);
|
||||
$stmt_update_expiry->bind_param("ii", $expiry_weeks, $order_id);
|
||||
$stmt_update_expiry->execute();
|
||||
$stmt_update_expiry->close();
|
||||
|
||||
echo "Aggiornata la colonna expireon per l'ordine ID: $order_id\n";
|
||||
} else {
|
||||
echo "Nessun record trovato in expiryparameter per quantityclass: $quantity_class\n";
|
||||
}
|
||||
$stmt_expiry_weeks->close();
|
||||
} else {
|
||||
echo "Nessun record trovato in orderbook per l'ordine ID: $order_id\n";
|
||||
}
|
||||
$stmt_expiry->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();
|
||||
|
||||
@@ -0,0 +1,407 @@
|
||||
<?php
|
||||
// Abilita visualizzazione errori PHP (solo per debug)
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
// Includi headscript.php
|
||||
require_once('include/headscript.php');
|
||||
|
||||
// Connessione al database
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
if ($conn->connect_error) {
|
||||
die("Connessione al database fallita: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// Inizializza log
|
||||
$logFile = 'rebook_from_cancel_log.txt';
|
||||
$logMessage = "Esecuzione riprogrammazione: " . date('Y-m-d H:i:s') . "\n";
|
||||
|
||||
// Log del database utilizzato
|
||||
$logMessage .= "Database connesso: $dbname\n";
|
||||
|
||||
// Recupera parametri GET
|
||||
if (!isset($_GET['idbookingclass']) || !isset($_GET['token'])) {
|
||||
$logMessage .= "Parametri mancanti: idbookingclass o token\n";
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
echo "<h1>Riprogrammazione non possibile</h1>";
|
||||
echo "<p>Parametri mancanti.</p>";
|
||||
echo "<a href='https://yogibook.yogasoul.it'>Torna al portale</a>";
|
||||
$conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
$idbookingclass = filter_var($_GET['idbookingclass'], FILTER_VALIDATE_INT);
|
||||
$token = $_GET['token'];
|
||||
|
||||
if (!$idbookingclass) {
|
||||
$logMessage .= "Errore: idbookingclass non valido: " . $_GET['idbookingclass'] . "\n";
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
echo "<h1>Riprogrammazione non possibile</h1>";
|
||||
echo "<p>Parametro idbookingclass non valido.</p>";
|
||||
echo "<a href='https://yogibook.yogasoul.it'>Torna al portale</a>";
|
||||
$conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
// Verifica validità della prenotazione
|
||||
$query = "SELECT bc.*, ob.expireon, au.email, au.first_name, s.servicename
|
||||
FROM bookingclass bc
|
||||
LEFT JOIN orderbook ob ON bc.idorder = ob.order_id
|
||||
LEFT JOIN auth_users au ON bc.iduser = au.id
|
||||
LEFT JOIN service s ON bc.idservice = s.idservice
|
||||
WHERE bc.idbookingclass = ?
|
||||
AND bc.cancellation_token = ?
|
||||
AND bc.status = 'booked'
|
||||
AND bc.bookingstart > NOW()";
|
||||
$stmt = $conn->prepare($query);
|
||||
|
||||
if (!$stmt) {
|
||||
$logMessage .= "Errore preparazione query per ID $idbookingclass: " . $conn->error . "\n";
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
echo "<h1>Riprogrammazione non possibile</h1>";
|
||||
echo "<p>Errore nella preparazione della query.</p>";
|
||||
echo "<a href='https://yogibook.yogasoul.it'>Torna al portale</a>";
|
||||
$conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt->bind_param("is", $idbookingclass, $token);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
if ($result->num_rows === 0) {
|
||||
$logMessage .= "Tentativo di riprogrammazione fallito per ID $idbookingclass: link non valido o lezione non prenotata\n";
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
echo "<h1>Riprogrammazione non possibile</h1>";
|
||||
echo "<p>Il link non è valido o la lezione non è prenotata.</p>";
|
||||
echo "<a href='https://yogibook.yogasoul.it'>Torna al portale</a>";
|
||||
$stmt->close();
|
||||
$conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
$row = $result->fetch_assoc();
|
||||
$bookingstart = $row['bookingstart'];
|
||||
$newtimeformat = date("d-m-Y H:i", strtotime($bookingstart));
|
||||
$expireon = $row['expireon'] ? date("d-m-Y", strtotime($row['expireon'])) : "sconosciuta";
|
||||
$emailuser = $row['email'];
|
||||
$firstname = $row['first_name'] ?? 'Utente';
|
||||
$servicename = $row['servicename'] ?? 'Sconosciuta';
|
||||
$iduser = $row['iduser'];
|
||||
$idserviceordered = $row['idservice'];
|
||||
$idorder = $row['idorder'];
|
||||
|
||||
// Verifica il limite di cancellazione/riprogrammazione
|
||||
$lessonTime = new DateTime($bookingstart);
|
||||
$hour = (int)$lessonTime->format('H');
|
||||
$minute = (int)$lessonTime->format('i');
|
||||
$isBefore1700 = ($hour < 17) || ($hour === 17 && $minute === 0);
|
||||
$currentTime = new DateTime();
|
||||
$lessonDate = $lessonTime->format('Y-m-d');
|
||||
|
||||
if ($isBefore1700) {
|
||||
$deadline = new DateTime("$lessonDate 00:01:00");
|
||||
} else {
|
||||
$deadline = new DateTime("$lessonDate 12:00:00");
|
||||
}
|
||||
|
||||
if ($currentTime > $deadline) {
|
||||
$logMessage .= "Tentativo di riprogrammazione fallito per ID $idbookingclass: orario oltre il limite (" . $deadline->format('Y-m-d H:i:s') . ")\n";
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
echo "<h1>Riprogrammazione non possibile</h1>";
|
||||
echo "<p>Non è possibile riprogrammare la lezione dopo le " . ($isBefore1700 ? "00:01" : "12:00") . " del giorno della lezione.</p>";
|
||||
echo "<a href='https://yogibook.yogasoul.it'>Torna al portale</a>";
|
||||
$stmt->close();
|
||||
$conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
// Recupera la data di scadenza dell'ordine
|
||||
$expiryDate = new DateTime($row['expireon']);
|
||||
|
||||
// Query sulla tabella associateclass
|
||||
$sql = "SELECT idassociateservice FROM associateclass WHERE idmainservice = ?";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bind_param("i", $idserviceordered);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
$idassociateservices = array();
|
||||
array_push($idassociateservices, $idserviceordered);
|
||||
if ($result->num_rows > 0) {
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$idassociateservices[] = $row['idassociateservice'];
|
||||
}
|
||||
}
|
||||
$stmt->close();
|
||||
|
||||
// Verifica se è stata specificata una richiesta per cambiare il mese
|
||||
if (isset($_GET['prev_month'])) {
|
||||
$currentMonthStart = $_GET['prev_month'] . '-01';
|
||||
} elseif (isset($_GET['next_month'])) {
|
||||
$currentMonthStart = $_GET['next_month'] . '-01';
|
||||
} else {
|
||||
$currentMonthStart = date("Y-m-01");
|
||||
}
|
||||
|
||||
$currentMonthEnd = date("Y-m-t", strtotime($currentMonthStart));
|
||||
|
||||
// Aggiungi filtro per la data di scadenza
|
||||
$expiryCondition = '';
|
||||
if ($expiryDate) {
|
||||
$expiryCondition = "AND ss.dateschedule <= '{$expiryDate->format('Y-m-d 23:59:59')}'";
|
||||
}
|
||||
|
||||
// Query per le lezioni disponibili
|
||||
$placeholders = implode(',', array_fill(0, count($idassociateservices), '?'));
|
||||
$query = "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)
|
||||
$expiryCondition
|
||||
AND ss.idservice IN ($placeholders)
|
||||
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);
|
||||
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));
|
||||
$params = array_merge([$currentMonthStart, $currentMonthEnd], $idassociateservices);
|
||||
$stmt->bind_param($types, ...$params);
|
||||
$stmt->execute();
|
||||
$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
|
||||
$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"
|
||||
];
|
||||
|
||||
$logMessage .= "Caricata pagina di riprogrammazione per ID $idbookingclass, mese: $currentMonthStart\n";
|
||||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="it">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>YogiBook - Riprogramma Lezione</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" author />
|
||||
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
||||
<link href="assets/css/bootstrap.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 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@11"></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 {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.custom-date-box,
|
||||
.custom-event-details {
|
||||
width: 100%;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.custom-event-time {
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.month-navigation {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.month-nav-button {
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.current-month {
|
||||
font-size: 24px;
|
||||
margin: 0 20px;
|
||||
}
|
||||
|
||||
.booking-details {
|
||||
margin-top: 10px;
|
||||
border-top: 1px solid #ccc;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
.booking-button {
|
||||
background-color: #1ebf99;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 8px 12px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.booking-button:hover {
|
||||
background-color: #17a081;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Riprogramma Lezione</h1>
|
||||
<p>Lezione attuale: <?php echo htmlspecialchars($servicename); ?> del <?php echo htmlspecialchars($newtimeformat); ?></p>
|
||||
<p>Scadenza abbonamento: <?php echo htmlspecialchars($expireon); ?></p>
|
||||
<div class="month-navigation">
|
||||
<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>
|
||||
<span class="current-month"><?php echo $italianMonths[date('F', strtotime($currentMonthStart))]; ?> <?php echo date('Y', strtotime($currentMonthStart)); ?></span>
|
||||
<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>
|
||||
<?php while ($row = $bookedclass->fetch_assoc()) { ?>
|
||||
<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 class="custom-event-details">
|
||||
<h3 class="custom-heading"><?php echo htmlspecialchars($row['servicename']); ?></h3>
|
||||
<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>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
console.log("Caricata pagina di riprogrammazione per ID <?php echo $idbookingclass; ?>, mese: <?php echo $currentMonthStart; ?>");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<?php
|
||||
$stmt->close();
|
||||
$conn->close();
|
||||
?>
|
||||
@@ -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,57 @@
|
||||
<?php
|
||||
require_once('include/headscript.php');
|
||||
|
||||
$conn = mysqli_connect($servername, $username, $password, $dbname);
|
||||
|
||||
if (!$conn) {
|
||||
die(json_encode(['success' => false, 'message' => 'Connessione al database fallita']));
|
||||
}
|
||||
|
||||
$id_booking_class = isset($_POST['id']) ? intval($_POST['id']) : 0;
|
||||
$class_id = isset($_POST['class_id']) ? intval($_POST['class_id']) : 0;
|
||||
$new_date = isset($_POST['new_date']) ? $_POST['new_date'] : '';
|
||||
|
||||
if ($id_booking_class <= 0 || $class_id <= 0 || empty($new_date)) {
|
||||
die(json_encode(['success' => false, 'message' => 'Dati non validi']));
|
||||
}
|
||||
|
||||
// Ottieni i dettagli della classe attuale
|
||||
$sql = "SELECT bookingstart, servicename, day, time FROM bookingclass WHERE idbookingclass = ?";
|
||||
$stmt = mysqli_prepare($conn, $sql);
|
||||
mysqli_stmt_bind_param($stmt, 'i', $id_booking_class);
|
||||
mysqli_stmt_execute($stmt);
|
||||
$result = mysqli_stmt_get_result($stmt);
|
||||
$current_class = mysqli_fetch_assoc($result);
|
||||
|
||||
if (!$current_class) {
|
||||
die(json_encode(['success' => false, 'message' => 'Lezione non trovata']));
|
||||
}
|
||||
|
||||
// Ottieni i dettagli della nuova classe
|
||||
$sql = "SELECT servicename, day, time FROM classes WHERE id = ?";
|
||||
$stmt = mysqli_prepare($conn, $sql);
|
||||
mysqli_stmt_bind_param($stmt, 'i', $class_id);
|
||||
mysqli_stmt_execute($stmt);
|
||||
$result = mysqli_stmt_get_result($stmt);
|
||||
$new_class = mysqli_fetch_assoc($result);
|
||||
|
||||
if (!$new_class) {
|
||||
die(json_encode(['success' => false, 'message' => 'Classe non trovata']));
|
||||
}
|
||||
|
||||
// Aggiorna la lezione
|
||||
$sql = "UPDATE bookingclass
|
||||
SET bookingstart = ?, prevbookingstart = ?, servicename = ?, day = ?, time = ?
|
||||
WHERE idbookingclass = ?";
|
||||
$stmt = mysqli_prepare($conn, $sql);
|
||||
$new_bookingstart = $new_date . ' ' . $new_class['time'] . ':00';
|
||||
mysqli_stmt_bind_param($stmt, 'sssssi', $new_bookingstart, $current_class['bookingstart'], $new_class['servicename'], $new_class['day'], $new_class['time'], $id_booking_class);
|
||||
|
||||
if (mysqli_stmt_execute($stmt)) {
|
||||
echo json_encode(['success' => true]);
|
||||
} else {
|
||||
echo json_encode(['success' => false, 'message' => 'Errore durante l\'aggiornamento della lezione']);
|
||||
}
|
||||
|
||||
mysqli_stmt_close($stmt);
|
||||
mysqli_close($conn);
|
||||
@@ -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();
|
||||
+83
-139
@@ -10,8 +10,6 @@ $optionquery->execute();
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
// Verifica se è stato caricato un file correttamente
|
||||
if (isset($_FILES["fileToUpload"]) && $_FILES["fileToUpload"]["error"] === UPLOAD_ERR_OK) {
|
||||
|
||||
|
||||
// Crea la connessione al database
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
@@ -23,16 +21,12 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
// 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);
|
||||
@@ -42,11 +36,14 @@ if ($conn->connect_error) {
|
||||
die("Connessione al database fallita: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Query per selezionare i dati filtrati per iduser
|
||||
$query = "SELECT * FROM orderbook LEFT JOIN service ON orderbook.idservice=service.idservice WHERE iduser = '$iduserlogin'";
|
||||
$result = $conn->query($query);
|
||||
// Query per selezionare i dati filtrati per iduser, includendo servicename
|
||||
$query = "SELECT orderbook.idorderbook, orderbook.nticket, orderbook.expireon, orderbook.idservice, service.servicename
|
||||
FROM orderbook LEFT JOIN service ON orderbook.idservice=service.idservice
|
||||
WHERE orderbook.iduser = ?";
|
||||
$stmt = $conn->prepare($query);
|
||||
$stmt->bind_param("i", $iduserlogin);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
// Array per memorizzare i risultati
|
||||
$documents = array();
|
||||
@@ -54,13 +51,14 @@ $documents = array();
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$documents[] = $row;
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
$conn->close();
|
||||
?>
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<title>YogiBook - Prenotazioni YogaSoul</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
@@ -83,7 +81,9 @@ while ($row = $result->fetch_assoc()) {
|
||||
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
$("#expiryDate").datepicker({ dateFormat: "yy-mm-dd" });
|
||||
$("#expiryDate").datepicker({
|
||||
dateFormat: "yy-mm-dd"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
@@ -173,7 +173,8 @@ while ($row = $result->fetch_assoc()) {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.custom-date-box, .custom-event-details {
|
||||
.custom-date-box,
|
||||
.custom-event-details {
|
||||
width: 100%;
|
||||
border-radius: 0;
|
||||
}
|
||||
@@ -182,6 +183,18 @@ while ($row = $result->fetch_assoc()) {
|
||||
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) {
|
||||
@@ -202,77 +215,42 @@ while ($row = $result->fetch_assoc()) {
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- <body data-layout="horizontal"> -->
|
||||
|
||||
<!-- Begin page -->
|
||||
<div id="layout-wrapper">
|
||||
|
||||
<!-- Top Bar -->
|
||||
<header id="page-topbar" class="isvertical-topbar">
|
||||
<div class="navbar-header">
|
||||
<div class="d-flex">
|
||||
<!-- LOGO -->
|
||||
<?php include('include/logoarea.php'); ?>
|
||||
|
||||
<button type="button" class="btn btn-sm px-3 font-size-24 header-item waves-effect vertical-menu-btn">
|
||||
<i class="bx bx-menu align-middle"></i>
|
||||
</button>
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="page-title-box align-self-center d-none d-md-block">
|
||||
<h4 class="page-title mb-0">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="d-flex"></div>
|
||||
<div class="topnav">
|
||||
<div class="container-fluid">
|
||||
<nav class="navbar navbar-light navbar-expand-lg topnav-menu">
|
||||
|
||||
|
||||
</nav>
|
||||
<nav class="navbar navbar-light navbar-expand-lg topnav-menu"></nav>
|
||||
</div>
|
||||
</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">
|
||||
@@ -282,136 +260,102 @@ while ($row = $result->fetch_assoc()) {
|
||||
<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
|
||||
|
||||
$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
|
||||
// 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);
|
||||
}
|
||||
|
||||
// ID dell'utente per il quale si desidera eseguire la query
|
||||
$iduser = $iduserlogin; // Sostituisci con l'ID utente desiderato
|
||||
$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;
|
||||
|
||||
// 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 per contare i record per questo ordine, escludendo status = 'cancelled'
|
||||
$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
|
||||
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 = $iduser";
|
||||
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();
|
||||
|
||||
$result = $conn->query($query);
|
||||
if ($result) {
|
||||
$row = $result->fetch_assoc();
|
||||
$totalRecords = $row['total'];
|
||||
$passedRecords = $row['passed'];
|
||||
$futureRecords = $row['future'];
|
||||
|
||||
|
||||
$lost = $row['lost'];
|
||||
$pending = $row['pending'];
|
||||
} else {
|
||||
$passedRecords = 0;
|
||||
$futureRecords = 0;
|
||||
$lost = 0;
|
||||
$pending = 0;
|
||||
}
|
||||
// Chiusura della connessione
|
||||
|
||||
$toprogram = $totalTickets - $passedRecords - $futureRecords - $pending - $lost;
|
||||
|
||||
$stmt->close();
|
||||
$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><?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 $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>
|
||||
<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 } ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php include('include/footer.php'); ?>
|
||||
</div>
|
||||
<!-- end main content-->
|
||||
|
||||
</div>
|
||||
<!-- END layout-wrapper -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- JAVASCRIPT -->
|
||||
<script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="assets/libs/metismenujs/metismenujs.min.js"></script>
|
||||
<script src="assets/libs/simplebar/simplebar.min.js"></script>
|
||||
<script src="assets/libs/eva-icons/eva.min.js"></script>
|
||||
|
||||
<script src="assets/js/app.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+448
-151
@@ -17,7 +17,7 @@ SELECT
|
||||
auth_users.id AS id_utente,
|
||||
auth_users.first_name AS nome_utente,
|
||||
auth_users.last_name AS cognome_utente,
|
||||
auth_users.email AS email_utente, -- Aggiungiamo l'email dell'utente
|
||||
auth_users.email AS email_utente,
|
||||
COALESCE(lezioni_acquistate, 0) AS lezioni_acquistate,
|
||||
COUNT(CASE WHEN bookingclass.bookingstart <= CURDATE() AND bookingclass.lostlesson = 'N' THEN 1 END) AS lezioni_praticate,
|
||||
COUNT(CASE WHEN bookingclass.bookingstart > CURDATE() THEN 1 END) AS lezioni_programmate,
|
||||
@@ -70,7 +70,7 @@ if (!$result) {
|
||||
<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">
|
||||
|
||||
<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">
|
||||
<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>
|
||||
@@ -84,7 +84,9 @@ if (!$result) {
|
||||
</script>
|
||||
<script>
|
||||
$(function() {
|
||||
$("#dayoff").datepicker({ dateFormat: "yy-mm-dd" });
|
||||
$("#dayoff").datepicker({
|
||||
dateFormat: "yy-mm-dd"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!-- DataTables CSS -->
|
||||
@@ -192,27 +194,33 @@ if (!$result) {
|
||||
|
||||
/* Styling for the modal table */
|
||||
.lost-lesson {
|
||||
background-color: #ffcc80 !important; /* Orange for lost lessons */
|
||||
background-color: #ffcc80 !important;
|
||||
/* Orange for lost lessons */
|
||||
}
|
||||
|
||||
.past-lesson {
|
||||
background-color: #c6d9f0 !important; /* Lighter grayish-blue for past lessons */
|
||||
background-color: #c6d9f0 !important;
|
||||
/* Lighter grayish-blue for past lessons */
|
||||
}
|
||||
|
||||
.past-lesson-reprogrammed {
|
||||
background-color: #a9bcd8 !important; /* Slightly different gray for past reprogrammed lessons */
|
||||
background-color: #a9bcd8 !important;
|
||||
/* Slightly different gray for past reprogrammed lessons */
|
||||
}
|
||||
|
||||
.future-lesson {
|
||||
background-color: #b3ffb3 !important; /* Softer pastel green for future lessons */
|
||||
background-color: #b3ffb3 !important;
|
||||
/* Softer pastel green for future lessons */
|
||||
}
|
||||
|
||||
.future-lesson-reprogrammed {
|
||||
background-color: #a3e6a3 !important; /* Slightly different green for future reprogrammed lessons */
|
||||
background-color: #a3e6a3 !important;
|
||||
/* Slightly different green for future reprogrammed lessons */
|
||||
}
|
||||
|
||||
.status-reprogrammed {
|
||||
background-color: #fffacd !important; /* Light yellow for "Riprogrammata" status cell */
|
||||
background-color: #fffacd !important;
|
||||
/* Light yellow for "Riprogrammata" status cell */
|
||||
}
|
||||
|
||||
.btn-warning {
|
||||
@@ -226,9 +234,21 @@ if (!$result) {
|
||||
border-color: #e07b00 !important;
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background-color: #dc3545 !important;
|
||||
border-color: #dc3545 !important;
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
.btn-danger:hover {
|
||||
background-color: #c82333 !important;
|
||||
border-color: #c82333 !important;
|
||||
}
|
||||
|
||||
/* Custom modal width */
|
||||
.modal-xl-custom {
|
||||
max-width: 1200px; /* Wider modal */
|
||||
max-width: 1200px;
|
||||
/* Wider modal */
|
||||
}
|
||||
|
||||
/* Stile per il pulsante email */
|
||||
@@ -262,6 +282,18 @@ if (!$result) {
|
||||
height: 200px;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
/* Stile per il pulsante Riprogramma */
|
||||
.btn-reprogram {
|
||||
background-color: #28a745 !important;
|
||||
border-color: #28a745 !important;
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
.btn-reprogram:hover {
|
||||
background-color: #218838 !important;
|
||||
border-color: #218838 !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function confirmDelete(id, deletePageUrl) {
|
||||
@@ -342,7 +374,6 @@ if (!$result) {
|
||||
<button class="btn btn-email-all" id="sendEmailToAll">Invia Email a Tutti</button>
|
||||
<div class="table-responsive">
|
||||
<table id="userStatsTable" class="table table-striped mb-0">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID Utente</th>
|
||||
@@ -353,7 +384,7 @@ if (!$result) {
|
||||
<th>Lezioni Programmate</th>
|
||||
<th>Lezioni Perse</th>
|
||||
<th>Lezioni da Programmare</th>
|
||||
<th>Azione Email</th> <!-- Nuova colonna -->
|
||||
<th>Azione Email</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -368,7 +399,6 @@ if (!$result) {
|
||||
echo "<td>" . $row['lezioni_programmate'] . "</td>";
|
||||
echo "<td>" . $row['lezioni_perse'] . "</td>";
|
||||
echo "<td>" . $row['lezioni_da_programmare'] . "</td>";
|
||||
// Nuova colonna "Azione Email" con il pulsante
|
||||
echo "<td>";
|
||||
echo "<button class='btn btn-sm btn-email send-email' data-id='" . $row['id_utente'] . "' data-nome='" . $row['nome_utente'] . "' data-email='" . $row['email_utente'] . "'><i class='fas fa-envelope'></i></button>";
|
||||
echo "</td>";
|
||||
@@ -449,6 +479,35 @@ if (!$result) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal per Riprogrammare Lezione -->
|
||||
<div class="modal fade" id="reprogramModal" tabindex="-1" aria-labelledby="reprogramModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="reprogramModalLabel">Riprogramma Lezione</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="reprogramForm">
|
||||
<div class="mb-3">
|
||||
<label for="classSelect" class="form-label">Seleziona Classe</label>
|
||||
<select class="form-control" id="classSelect" required></select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="reprogramDate" class="form-label">Seleziona Data</label>
|
||||
<input type="text" class="form-control" id="reprogramDate" readonly required>
|
||||
</div>
|
||||
<input type="hidden" id="reprogramIdBookingClass" name="id_booking_class">
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Chiudi</button>
|
||||
<button type="button" class="btn btn-primary" id="reprogramBtn">Riprogramma</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- JAVASCRIPT -->
|
||||
<script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="assets/libs/metismenujs/metismenujs.min.js"></script>
|
||||
@@ -456,13 +515,9 @@ if (!$result) {
|
||||
<script src="assets/libs/eva-icons/eva.min.js"></script>
|
||||
<script src="assets/js/app.js"></script>
|
||||
|
||||
<!-- Aggiorna il link a SweetAlert2 -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
|
||||
<!-- JavaScript -->
|
||||
<script>
|
||||
$('#userStatsTable').DataTable({
|
||||
paging: false, // ❌ disattiva paginazione
|
||||
paging: false,
|
||||
searching: true,
|
||||
ordering: true,
|
||||
language: {
|
||||
@@ -470,8 +525,6 @@ $('#userStatsTable').DataTable({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
// Function to format date as "DD - Month - YYYY HH:mm:ss"
|
||||
function formatDate(dateStr) {
|
||||
@@ -500,14 +553,15 @@ $('#userStatsTable').DataTable({
|
||||
$.ajax({
|
||||
url: 'fetch_class_details.php',
|
||||
method: 'POST',
|
||||
data: { id_utente: id_utente },
|
||||
data: {
|
||||
id_utente: id_utente
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
console.log('Refresh Success Response:', data);
|
||||
var tbody = $('#classDetailsBody');
|
||||
tbody.empty();
|
||||
|
||||
// Ensure data is an array
|
||||
if (!Array.isArray(data)) {
|
||||
data = [data];
|
||||
}
|
||||
@@ -570,7 +624,18 @@ $('#userStatsTable').DataTable({
|
||||
.addClass('btn btn-sm btn-warning mark-lost')
|
||||
.text('P')
|
||||
.data('id', row.idbookingclass);
|
||||
actionTd.append(pButton);
|
||||
var rButton = $('<button>')
|
||||
.addClass('btn btn-sm btn-danger remove-class')
|
||||
.text('Rimuovi')
|
||||
.data('id', row.idbookingclass);
|
||||
var reprogramButton = $('<button>')
|
||||
.addClass('btn btn-sm btn-reprogram reprogram-class')
|
||||
.text('Riprogramma')
|
||||
.data('id', row.idbookingclass)
|
||||
.data('servicename', row.servicename)
|
||||
.data('day', row.day)
|
||||
.data('time', row.time);
|
||||
actionTd.append(pButton).append(' ').append(rButton).append(' ').append(reprogramButton);
|
||||
} else {
|
||||
actionTd.text('-');
|
||||
}
|
||||
@@ -597,6 +662,362 @@ $('#userStatsTable').DataTable({
|
||||
refreshTable(id_utente, nome_utente);
|
||||
});
|
||||
|
||||
// Gestione pulsante Rimuovi
|
||||
$(document).on('click', '.remove-class', function() {
|
||||
var id = $(this).data('id');
|
||||
var id_utente = $('#classModal').data('current-id');
|
||||
var nome_utente = $('#userName').text();
|
||||
|
||||
Swal.fire({
|
||||
title: "Sei sicuro?",
|
||||
text: "Questa lezione verrà rimossa definitivamente!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#d33",
|
||||
cancelButtonColor: "#3085d6",
|
||||
confirmButtonText: "Sì, rimuovi!",
|
||||
cancelButtonText: "Annulla",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: 'deleteclass.php',
|
||||
method: 'POST',
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
Swal.fire({
|
||||
title: "Successo",
|
||||
text: "Lezione rimossa con successo.",
|
||||
icon: "success",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
refreshTable(id_utente, nome_utente);
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: "Errore",
|
||||
text: response.message || "Errore durante la rimozione della lezione.",
|
||||
icon: "error",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log('Remove Class AJAX Error:', xhr, status, error);
|
||||
Swal.fire({
|
||||
title: "Errore",
|
||||
text: "Errore durante la rimozione della lezione: " + error,
|
||||
icon: "error",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Gestione pulsante Riprogramma
|
||||
$(document).on('click', '.reprogram-class', function() {
|
||||
var id = $(this).data('id');
|
||||
var servicename = $(this).data('servicename');
|
||||
var day = $(this).data('day');
|
||||
var time = $(this).data('time');
|
||||
|
||||
$('#reprogramIdBookingClass').val(id);
|
||||
$('#reprogramModalLabel').text('Riprogramma Lezione: ' + servicename);
|
||||
|
||||
// Carica le classi disponibili
|
||||
$.ajax({
|
||||
url: 'fetch_available_classes.php',
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
var classSelect = $('#classSelect');
|
||||
classSelect.empty();
|
||||
$.each(data, function(index, classe) {
|
||||
var optionText = classe.servicename + ' (' + classe.day + ' ' + classe.time + ')';
|
||||
var option = $('<option>')
|
||||
.val(classe.id)
|
||||
.text(optionText)
|
||||
.data('servicename', classe.servicename)
|
||||
.data('day', classe.day)
|
||||
.data('time', classe.time);
|
||||
if (classe.servicename === servicename && classe.day === day && classe.time === time) {
|
||||
option.prop('selected', true);
|
||||
}
|
||||
classSelect.append(option);
|
||||
});
|
||||
|
||||
// Inizializza il datepicker
|
||||
$('#reprogramDate').datepicker({
|
||||
dateFormat: 'yy-mm-dd',
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
onSelect: function(dateText) {
|
||||
// Puoi aggiungere logica qui se necessario
|
||||
}
|
||||
});
|
||||
|
||||
// Carica le date disponibili per la classe selezionata
|
||||
loadAvailableDates(classSelect.val());
|
||||
|
||||
$('#reprogramModal').modal('show');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log('Fetch Classes AJAX Error:', xhr, status, error);
|
||||
Swal.fire({
|
||||
title: "Errore",
|
||||
text: "Errore nel caricamento delle classi disponibili.",
|
||||
icon: "error",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Gestione cambio classe nel menu a tendina
|
||||
$('#classSelect').on('change', function() {
|
||||
var classId = $(this).val();
|
||||
loadAvailableDates(classId);
|
||||
});
|
||||
|
||||
// Funzione per caricare le date disponibili
|
||||
function loadAvailableDates(classId) {
|
||||
$.ajax({
|
||||
url: 'fetch_available_dates.php',
|
||||
method: 'POST',
|
||||
data: {
|
||||
class_id: classId
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
$('#reprogramDate').datepicker('option', 'beforeShowDay', function(date) {
|
||||
var dateStr = $.datepicker.formatDate('yy-mm-dd', date);
|
||||
return [data.availableDates.includes(dateStr), ''];
|
||||
});
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log('Fetch Available Dates AJAX Error:', xhr, status, error);
|
||||
Swal.fire({
|
||||
title: "Errore",
|
||||
text: "Errore nel caricamento delle date disponibili.",
|
||||
icon: "error",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Gestione pulsante Riprogramma
|
||||
$('#reprogramBtn').on('click', function() {
|
||||
var id = $('#reprogramIdBookingClass').val();
|
||||
var classId = $('#classSelect').val();
|
||||
var newDate = $('#reprogramDate').val();
|
||||
var id_utente = $('#classModal').data('current-id');
|
||||
var nome_utente = $('#userName').text();
|
||||
|
||||
if (!newDate || !classId) {
|
||||
Swal.fire({
|
||||
title: "Errore",
|
||||
text: "Per favore, seleziona una classe e una data.",
|
||||
icon: "error",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: 'reprogram_class.php',
|
||||
method: 'POST',
|
||||
data: {
|
||||
id: id,
|
||||
class_id: classId,
|
||||
new_date: newDate
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
Swal.fire({
|
||||
title: "Successo",
|
||||
text: "Lezione riprogrammata con successo.",
|
||||
icon: "success",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
$('#reprogramModal').modal('hide');
|
||||
refreshTable(id_utente, nome_utente);
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: "Errore",
|
||||
text: response.message || "Errore durante la riprogrammazione della lezione.",
|
||||
icon: "error",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log('Reprogram AJAX Error:', xhr, status, error);
|
||||
Swal.fire({
|
||||
title: "Errore",
|
||||
text: "Errore durante la riprogrammazione della lezione: " + error,
|
||||
icon: "error",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Gestione invio email individuale
|
||||
$('.send-email').on('click', function() {
|
||||
var id_utente = $(this).data('id');
|
||||
var nome_utente = $(this).data('nome');
|
||||
var email_utente = $(this).data('email');
|
||||
|
||||
$('#emailModalLabel').text('Invia Email a ' + nome_utente);
|
||||
$('#emailBody').val('Ciao ' + nome_utente.split(' ')[0] + ',\n\n');
|
||||
$('#emailRecipients').val(JSON.stringify([{
|
||||
id: id_utente,
|
||||
email: email_utente,
|
||||
nome: nome_utente
|
||||
}]));
|
||||
$('#emailModal').modal('show');
|
||||
});
|
||||
|
||||
// Gestione invio email a tutti
|
||||
$('#sendEmailToAll').on('click', function() {
|
||||
var recipients = [];
|
||||
$('.send-email').each(function() {
|
||||
var id_utente = $(this).data('id');
|
||||
var email_utente = $(this).data('email');
|
||||
var nome_utente = $(this).data('nome');
|
||||
if ([4, 10, 3].includes(id_utente)) {
|
||||
recipients.push({
|
||||
id: id_utente,
|
||||
email: email_utente,
|
||||
nome: nome_utente
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (recipients.length === 0) {
|
||||
Swal.fire({
|
||||
title: "Attenzione",
|
||||
text: "Nessun utente idoneo trovato per l'invio dell'email.",
|
||||
icon: "warning",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
$('#emailModalLabel').text('Invia Email a Tutti');
|
||||
$('#emailBody').val('Ciao a tutti,\n\n');
|
||||
$('#emailRecipients').val(JSON.stringify(recipients));
|
||||
$('#emailModal').modal('show');
|
||||
});
|
||||
|
||||
// Gestione invio email
|
||||
$('#sendEmailBtn').on('click', function() {
|
||||
var subject = $('#emailSubject').val();
|
||||
var body = $('#emailBody').val();
|
||||
var recipients = JSON.parse($('#emailRecipients').val());
|
||||
|
||||
if (!subject || !body) {
|
||||
Swal.fire({
|
||||
title: "Errore",
|
||||
text: "Per favore, compila sia l'oggetto che il messaggio.",
|
||||
icon: "error",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: '/public/send_email.php',
|
||||
method: 'POST',
|
||||
data: {
|
||||
subject: subject,
|
||||
body: body,
|
||||
recipients: JSON.stringify(recipients)
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
Swal.fire({
|
||||
title: "Successo",
|
||||
text: response.message,
|
||||
icon: "success",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
$('#emailModal').modal('hide');
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: "Errore",
|
||||
text: response.message,
|
||||
icon: "error",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log('Send Email AJAX Error:', xhr, status, error);
|
||||
Swal.fire({
|
||||
title: "Errore",
|
||||
text: "Errore durante l'invio dell'email: " + error,
|
||||
icon: "error",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Gestione mark-lost (già presente, ma incluso per completezza)
|
||||
$(document).on('click', '.mark-lost', function() {
|
||||
var id = $(this).data('id');
|
||||
var id_utente = $('#classModal').data('current-id');
|
||||
@@ -620,7 +1041,9 @@ $('#userStatsTable').DataTable({
|
||||
$.ajax({
|
||||
url: 'mark_lost.php',
|
||||
method: 'POST',
|
||||
data: { id: id },
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
dataType: 'json',
|
||||
timeout: 10000,
|
||||
success: function(response) {
|
||||
@@ -671,134 +1094,8 @@ $('#userStatsTable').DataTable({
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Gestione invio email individuale
|
||||
$('.send-email').on('click', function() {
|
||||
var id_utente = $(this).data('id');
|
||||
var nome_utente = $(this).data('nome');
|
||||
var email_utente = $(this).data('email');
|
||||
|
||||
// Imposta il titolo del modal
|
||||
$('#emailModalLabel').text('Invia Email a ' + nome_utente);
|
||||
|
||||
// Precompila il corpo dell'email con "Ciao [Nome]"
|
||||
$('#emailBody').val('Ciao ' + nome_utente.split(' ')[0] + ',\n\n');
|
||||
|
||||
// Imposta il destinatario (solo questo utente), includendo il nome
|
||||
$('#emailRecipients').val(JSON.stringify([{id: id_utente, email: email_utente, nome: nome_utente}]));
|
||||
|
||||
// Mostra il modal
|
||||
$('#emailModal').modal('show');
|
||||
});
|
||||
|
||||
// Gestione invio email a tutti
|
||||
$('#sendEmailToAll').on('click', function() {
|
||||
// Raccogli tutti gli utenti idonei (ID 4, 10, 3)
|
||||
var recipients = [];
|
||||
$('.send-email').each(function() {
|
||||
var id_utente = $(this).data('id');
|
||||
var email_utente = $(this).data('email');
|
||||
var nome_utente = $(this).data('nome');
|
||||
// Limita agli utenti con ID 4, 10, 3
|
||||
if ([4, 10, 3].includes(id_utente)) {
|
||||
recipients.push({id: id_utente, email: email_utente, nome: nome_utente});
|
||||
}
|
||||
});
|
||||
|
||||
if (recipients.length === 0) {
|
||||
Swal.fire({
|
||||
title: "Attenzione",
|
||||
text: "Nessun utente idoneo trovato per l'invio dell'email.",
|
||||
icon: "warning",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Imposta il titolo del modal
|
||||
$('#emailModalLabel').text('Invia Email a Tutti');
|
||||
|
||||
// Precompila il corpo dell'email con "Ciao a tutti"
|
||||
$('#emailBody').val('Ciao a tutti,\n\n');
|
||||
|
||||
// Imposta i destinatari
|
||||
$('#emailRecipients').val(JSON.stringify(recipients));
|
||||
|
||||
// Mostra il modal
|
||||
$('#emailModal').modal('show');
|
||||
});
|
||||
|
||||
// Gestione invio email
|
||||
$('#sendEmailBtn').on('click', function() {
|
||||
var subject = $('#emailSubject').val();
|
||||
var body = $('#emailBody').val();
|
||||
var recipients = JSON.parse($('#emailRecipients').val());
|
||||
|
||||
if (!subject || !body) {
|
||||
Swal.fire({
|
||||
title: "Errore",
|
||||
text: "Per favore, compila sia l'oggetto che il messaggio.",
|
||||
icon: "error",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Invia l'email tramite AJAX
|
||||
$.ajax({
|
||||
url: '/public/send_email.php', // Usa il percorso relativo corretto
|
||||
method: 'POST',
|
||||
data: {
|
||||
subject: subject,
|
||||
body: body,
|
||||
recipients: JSON.stringify(recipients)
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
Swal.fire({
|
||||
title: "Successo",
|
||||
text: response.message,
|
||||
icon: "success",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
$('#emailModal').modal('hide');
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: "Errore",
|
||||
text: response.message,
|
||||
icon: "error",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log('Send Email AJAX Error:', xhr, status, error);
|
||||
Swal.fire({
|
||||
title: "Errore",
|
||||
text: "Errore durante l'invio dell'email: " + error,
|
||||
icon: "error",
|
||||
focusConfirm: true,
|
||||
didOpen: () => {
|
||||
document.body.removeAttribute('aria-hidden');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 569 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.7 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.7 MiB |
+154
-264
@@ -1,20 +1,21 @@
|
||||
<?php require_once('include/headscript.php'); ?>
|
||||
<?php // require_once('Connections/bkngstm.php'); ?>
|
||||
<?php // require_once('webassist/mysqli/rsobj.php'); ?>
|
||||
<?php // require_once('webassist/mysqli/queryobj.php'); ?>
|
||||
<?php // require_once('Connections/bkngstm.php');
|
||||
?>
|
||||
<?php // require_once('webassist/mysqli/rsobj.php');
|
||||
?>
|
||||
<?php // require_once('webassist/mysqli/queryobj.php');
|
||||
?>
|
||||
<?php // optionquery
|
||||
$optionquery = new WA_MySQLi_RS("optionquery", $bkngstm, 0);
|
||||
$optionquery->setQuery("SELECT * FROM option");
|
||||
$optionquery->execute();
|
||||
?>
|
||||
<?php
|
||||
|
||||
$bookedclass = new WA_MySQLi_RS("bookedclass", $bkngstm, 0);
|
||||
|
||||
// Verifica se è stata specificata una richiesta per cambiare il mese
|
||||
if (isset($_GET['prev_month'])) {
|
||||
$currentMonthStart = $_GET['prev_month'] . '-01';
|
||||
|
||||
} elseif (isset($_GET['next_month'])) {
|
||||
$currentMonthStart = $_GET['next_month'] . '-01';
|
||||
} else {
|
||||
@@ -29,18 +30,19 @@ if ($currentDate > $currentMonthStart) {
|
||||
}
|
||||
|
||||
$currentMonthEnd = date("Y-m-t", strtotime($currentMonthStart));
|
||||
echo $currentMonthEnd;
|
||||
$bookedclass->setQuery("SELECT * FROM bookingclass
|
||||
$bookedclass->setQuery("SELECT bookingclass.*, service.*, serviceschedule.*, orderbook.expireon
|
||||
FROM bookingclass
|
||||
LEFT JOIN service ON bookingclass.idservice = service.idservice
|
||||
LEFT JOIN serviceschedule ON bookingclass.idserviceschedule = serviceschedule.idserviceschedule
|
||||
LEFT JOIN orderbook ON bookingclass.idorder = orderbook.idorderbook
|
||||
WHERE bookingclass.iduser = '$iduserlogin' AND bookingclass.status = 'booked'
|
||||
AND serviceschedule.dateschedule BETWEEN '$currentMonthStart' AND DATE_ADD('$currentMonthEnd', INTERVAL 1 DAY) ORDER BY serviceschedule.dateschedule");
|
||||
$bookedclass->execute();
|
||||
AND serviceschedule.dateschedule BETWEEN '$currentMonthStart' AND DATE_ADD('$currentMonthEnd', INTERVAL 1 DAY)
|
||||
ORDER BY serviceschedule.dateschedule");
|
||||
|
||||
$bookedclass->execute();
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
if ($conn->connect_error) {
|
||||
@@ -66,7 +68,6 @@ 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
|
||||
@@ -87,19 +88,15 @@ $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 per contare i record con data e ora passate e future, escludendo status = 'cancelled'
|
||||
$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 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
|
||||
FROM bookingclass
|
||||
LEFT JOIN serviceschedule ON bookingclass.idserviceschedule = serviceschedule.idserviceschedule
|
||||
WHERE bookingclass.iduser = $iduser";
|
||||
|
||||
|
||||
|
||||
|
||||
WHERE bookingclass.iduser = $iduser AND bookingclass.status != 'cancelled'";
|
||||
|
||||
$result = $conn->query($query);
|
||||
if ($result) {
|
||||
@@ -109,9 +106,6 @@ if ($result) {
|
||||
$futureRecords = $row['future'];
|
||||
$lost = $row['lost'];
|
||||
$pending = $row['pending'];
|
||||
|
||||
|
||||
|
||||
}
|
||||
// Chiusura della connessione
|
||||
$conn->close();
|
||||
@@ -121,7 +115,6 @@ $conn->close();
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<title>YogiBook - Prenotazioni YogaSoul</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
@@ -216,7 +209,6 @@ $conn->close();
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
|
||||
}
|
||||
|
||||
.custom-action-button:hover {
|
||||
@@ -228,7 +220,8 @@ $conn->close();
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.custom-date-box, .custom-event-details {
|
||||
.custom-date-box,
|
||||
.custom-event-details {
|
||||
width: 100%;
|
||||
border-radius: 0;
|
||||
}
|
||||
@@ -257,13 +250,53 @@ $conn->close();
|
||||
font-size: 24px;
|
||||
margin: 0 20px;
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
<style>
|
||||
.pastel-color {
|
||||
border: 1px solid #D1C4CC;
|
||||
padding: 0px;
|
||||
text-align: center;
|
||||
border-radius: 10px;
|
||||
margin-right: 20px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.pastel-color.acquistate {
|
||||
background-color: #E2C4FB;
|
||||
}
|
||||
|
||||
.pastel-color.praticate {
|
||||
background-color: #C4E1FB;
|
||||
}
|
||||
|
||||
.pastel-color.prenotate {
|
||||
background-color: #CDFBC4;
|
||||
}
|
||||
|
||||
.pastel-color.conferma {
|
||||
background-color: #FBFAC4;
|
||||
}
|
||||
|
||||
.pastel-color.programmare {
|
||||
background-color: #FBE4C4;
|
||||
}
|
||||
|
||||
.pastel-color.perse {
|
||||
background-color: #FBC7C4;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.pastel-color {
|
||||
margin-right: 0;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
function confirmDelete(id, idservice, deletePageUrl) {
|
||||
Swal.fire({
|
||||
@@ -277,154 +310,75 @@ $conn->close();
|
||||
cancelButtonText: "Annulla"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Reindirizza direttamente alla pagina di cancellazione con l'ID e l'ID del servizio come parametri.
|
||||
window.location.href = `${deletePageUrl}?id=${id}&idserviceordered=${idservice}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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>
|
||||
|
||||
|
||||
<style>
|
||||
.pastel-color {
|
||||
border: 1px solid #D1C4CC;
|
||||
padding: 0px;
|
||||
text-align: center;
|
||||
border-radius: 10px;
|
||||
margin-right: 20px; /* Spazio tra i box */
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.pastel-color.acquistate {
|
||||
background-color: #E2C4FB; /* Azzurro pastello */
|
||||
}
|
||||
|
||||
.pastel-color.praticate {
|
||||
background-color: #C4E1FB; /* Verde pastello */
|
||||
}
|
||||
|
||||
.pastel-color.prenotate {
|
||||
background-color: #CDFBC4; /* Rosa pastello */
|
||||
}
|
||||
|
||||
.pastel-color.conferma {
|
||||
background-color: #FBFAC4; /* Arancio pastello */
|
||||
}
|
||||
|
||||
.pastel-color.programmare {
|
||||
background-color: #FBE4C4; /* Arancio pastello */
|
||||
}
|
||||
|
||||
.pastel-color.perse {
|
||||
background-color: #FBC7C4; /* Arancio pastello */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.pastel-color {
|
||||
margin-right: 0; /* Rimuovi lo spazio tra i box */
|
||||
margin-bottom: 20px; /* Spazio tra i box */
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<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'); ?>
|
||||
|
||||
<!-- /searh on topbar
|
||||
|
||||
<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="d-flex"></div>
|
||||
<div class="topnav">
|
||||
<div class="container-fluid">
|
||||
<nav class="navbar navbar-light navbar-expand-lg topnav-menu">
|
||||
|
||||
|
||||
</nav>
|
||||
<nav class="navbar navbar-light navbar-expand-lg topnav-menu"></nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- Start right Content here -->
|
||||
<!-- ============================================================== -->
|
||||
<div class="main-content">
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5>Benvenuta/o </h5>
|
||||
<p>Di seguito puoi vedere lo stato delle tue prenotazioni</p>
|
||||
|
||||
<?php
|
||||
$toprogram = $totalTickets - $passedRecords - $futureRecords - $pending - $lost;
|
||||
?>
|
||||
@@ -480,24 +434,14 @@ $conn->close();
|
||||
</div>
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert" style="text-align: center;">
|
||||
<i class="mdi mdi-alert-outline me-2"></i>
|
||||
Car* Yogi, ti ricordiamo che il pacchetto 4 lezioni ha validità entro le 5 settimane dall'acquisto e il pacchetto da 12 lezioni entro il <strong>24 aprile 2025</strong> 🙏
|
||||
Car* Yogi, ti ricordiamo che il pacchetto 4 lezioni ha validità entro le 5 settimane dall'acquisto e il pacchetto da 12 lezioni entro il <strong>20 dicembre 2025</strong> 🙏
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
<?php if (isset($_GET['reprogram'])) { ?>
|
||||
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||
<i class="mdi mdi-check-all me-2"></i>
|
||||
@@ -505,14 +449,20 @@ $conn->close();
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
<?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="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="">
|
||||
<div class="row mb-2">
|
||||
<div class="col-xl-3 col-md-12">
|
||||
@@ -520,15 +470,12 @@ $conn->close();
|
||||
<form class="email-search">
|
||||
<div class="position-relative">
|
||||
<h3>Lezioni Programmate</h3>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xl-9 col-md-12">
|
||||
<div class="text-sm-end">
|
||||
|
||||
<?php if ($toprogram > 0) { ?>
|
||||
<a href="selectorder.php">
|
||||
<button type="button" class="btn btn-primary btn-rounded waves-effect waves-light mb-2 me-2" data-bs-toggle="modal" data-bs-target=".create-task">
|
||||
@@ -541,31 +488,17 @@ $conn->close();
|
||||
<i class="mdi mdi-plus me-1"></i> Acquista Pacchetto Lezioni
|
||||
</button>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<!-- starts cards -->
|
||||
|
||||
|
||||
|
||||
<!-- Aggiungi le frecce per la navigazione tra i mesi -->
|
||||
<div class="month-navigation">
|
||||
<?php
|
||||
$italianMonths = [
|
||||
"January" => "Gennaio",
|
||||
@@ -581,9 +514,7 @@ $conn->close();
|
||||
"November" => "Novembre",
|
||||
"December" => "Dicembre"
|
||||
];
|
||||
|
||||
?>
|
||||
<div class="month-navigation">
|
||||
<a href="?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>
|
||||
@@ -593,76 +524,63 @@ $conn->close();
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<?php
|
||||
$wa_startindex = 0;
|
||||
|
||||
if ($bookedclass->TotalRows == 0) {
|
||||
echo "<p>Prenotazioni non presenti per questo mese</p>";
|
||||
} else {
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
if ($conn->connect_error) {
|
||||
die("Connessione fallita: " . $conn->connect_error);
|
||||
}
|
||||
while (!$bookedclass->atEnd()) {
|
||||
$wa_startindex = $bookedclass->Index;
|
||||
?>
|
||||
<?php
|
||||
// Data dalla variabile $bookedclass->getColumnVal("dateschedule")
|
||||
$dateschedule = $bookedclass->getColumnVal("dateschedule");
|
||||
|
||||
// Converti la data in un oggetto DateTime
|
||||
$dateObj = new DateTime($dateschedule);
|
||||
|
||||
// Estrai il giorno e il mese in italiano
|
||||
$dayInItalian = $dateObj->format("d");
|
||||
$monthInItalian = $dateObj->format("F");
|
||||
|
||||
// Mappa dei nomi dei mesi in italiano
|
||||
$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"
|
||||
];
|
||||
|
||||
// Sostituisci il nome del mese con la versione italiana
|
||||
$monthInItalian = $italianMonths[$monthInItalian];
|
||||
?>
|
||||
<?php
|
||||
// Data dalla variabile $bookedclass->getColumnVal("dateschedule")
|
||||
$dateschedule = $bookedclass->getColumnVal("dateschedule");
|
||||
|
||||
// Converti la data in un oggetto DateTime
|
||||
$dateObj = new DateTime($dateschedule);
|
||||
|
||||
// Formatta la data nel nuovo formato desiderato
|
||||
$newDateFormat = $dateObj->format("d-m-Y H:i");
|
||||
|
||||
// Calculate the time difference in hours
|
||||
// Calcola se la lezione può essere riprogrammata
|
||||
$currentTime = new DateTime();
|
||||
$classTime = new DateTime($dateschedule);
|
||||
$timeDifference = $classTime->diff($currentTime);
|
||||
$hoursDifference = $timeDifference->h + $timeDifference->days * 24;
|
||||
$isSameDay = $classTime->format('Y-m-d') === $currentTime->format('Y-m-d');
|
||||
$classHour = (int)$classTime->format('H');
|
||||
$classMinute = (int)$classTime->format('i');
|
||||
$isBefore1700 = ($classHour < 17) || ($classHour === 17 && $classMinute === 0);
|
||||
|
||||
// Check if the time difference is less than 6 hours
|
||||
$timetocancel=$optionquery->getColumnVal("maxbeforetimecancell");
|
||||
$canBeDeleted = ($hoursDifference > $timetocancel);
|
||||
// Definisci il limite per la riprogrammazione
|
||||
if ($isSameDay) {
|
||||
if ($isBefore1700) {
|
||||
// Lezioni prima delle 17:00: cancellazione valida fino alle 00:01 dello stesso giorno
|
||||
$deadline = new DateTime($classTime->format('Y-m-d 00:01:00'));
|
||||
} else {
|
||||
// Lezioni alle 17:00 o dopo: cancellazione valida fino alle 12:00 dello stesso giorno
|
||||
$deadline = new DateTime($classTime->format('Y-m-d 12:00:00'));
|
||||
}
|
||||
$canBeDeleted = $currentTime <= $deadline;
|
||||
} else {
|
||||
// Per lezioni in giorni futuri, la riprogrammazione è sempre consentita
|
||||
$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-date-box" style="background-color:#1ebf73">
|
||||
<div class="custom-day"><?php echo $dayInItalian; ?></div>
|
||||
@@ -676,92 +594,64 @@ $newDateFormat = $dateObj->format("d-m-Y H:i");
|
||||
<button class="custom-action-button" onclick="addToCalendar(this)" data-eventname="<?php echo ($bookedclass->getColumnVal("servicename")); ?>" data-eventdate="<?php echo $newDateFormat; ?>">
|
||||
<i class="far fa-calendar-plus"></i> Cal
|
||||
</button>
|
||||
|
||||
<!-- <button class="custom-action-button"><i class="fas fa-edit"></i> Riprogramma</button> -->
|
||||
<?php $idbookingclass=$bookedclass->getColumnVal("idbookingclass");
|
||||
$idservice=$bookedclass->getColumnVal("idservice");
|
||||
?>
|
||||
|
||||
<?php if ($canBeDeleted) : ?>
|
||||
<?php $idbookingclass = $bookedclass->getColumnVal("idbookingclass"); ?>
|
||||
<?php $idservice = $bookedclass->getColumnVal("idservice"); ?>
|
||||
<?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')">
|
||||
<i class="fas fa-calendar-alt"></i> Riprogramma
|
||||
</button>
|
||||
|
||||
|
||||
<button class="custom-action-button"
|
||||
onclick="confirmDeleteOnly(<?php echo $idbookingclass; ?>, '<?php echo $expirydate; ?>')">
|
||||
<i class="fas fa-trash"></i> Cancella
|
||||
</button>
|
||||
<?php else : ?>
|
||||
|
||||
<button class="custom-action-button"> <i class="fas fa-exclamation-circle"></i> Non puoi riprogrammare</button>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$bookedclass->moveNext();
|
||||
}
|
||||
$conn->close();
|
||||
}
|
||||
|
||||
$bookedclass->moveFirst(); // Ritorna all'inizio del recordset
|
||||
$bookedclass->moveFirst();
|
||||
unset($wa_startindex);
|
||||
unset($wa_repeatcount);
|
||||
?></div></div></div></div><br><br>
|
||||
<!-- Aggiungi altre card qui con le stesse classi -->
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><br><br>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include('include/footer.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function toggleCard(card) {
|
||||
card.classList.toggle("expanded");
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Page-content -->
|
||||
|
||||
<?php include('include/footer.php'); ?>
|
||||
</div>
|
||||
<!-- end main content-->
|
||||
|
||||
</div>
|
||||
<!-- END layout-wrapper -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- JAVASCRIPT -->
|
||||
<script>
|
||||
function addToCalendar(button) {
|
||||
const eventName = button.getAttribute('data-eventname');
|
||||
const eventDate = button.getAttribute('data-eventdate');
|
||||
|
||||
// Qui dovresti implementare la logica per aggiungere l'evento al calendario.
|
||||
// Puoi gestire l'aggiunta sia a Google Calendar che a Outlook.
|
||||
|
||||
// Esempio: Aggiunta a Google Calendar (il link potrebbe variare)
|
||||
const googleCalendarLink = `https://www.google.com/calendar/render?action=TEMPLATE&text=${encodeURIComponent(eventName)}&dates=${encodeURIComponent(eventDate)}`;
|
||||
window.open(googleCalendarLink, '_blank');
|
||||
|
||||
// Esempio: Aggiunta a Outlook (il link potrebbe variare)
|
||||
const outlookCalendarLink = `webcal://outlook.live.com/calendar/0/deeplink/compose?path=/calendar/action/compose&subject=${encodeURIComponent(eventName)}&startdt=${encodeURIComponent(eventDate)}`;
|
||||
window.open(outlookCalendarLink, '_blank');
|
||||
}
|
||||
</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>
|
||||
|
||||
</html>
|
||||
+109
-121
@@ -1,5 +1,6 @@
|
||||
<?php require_once('include/headscript.php'); ?>
|
||||
<?php // optionquery
|
||||
<?php
|
||||
// optionquery
|
||||
$optionquery = new WA_MySQLi_RS("optionquery", $bkngstm, 0);
|
||||
$optionquery->setQuery("SELECT * FROM option");
|
||||
$optionquery->execute();
|
||||
@@ -12,24 +13,24 @@ $bookedclass->execute();
|
||||
<?php
|
||||
// Verifica se è stato inviato un modulo
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
// Verifica se è stato caricato un file correttamente
|
||||
if (isset($_FILES["fileToUpload"]) && $_FILES["fileToUpload"]["error"] === UPLOAD_ERR_OK) {
|
||||
|
||||
|
||||
// Verifica se tutti i campi obbligatori sono presenti
|
||||
if (isset($_FILES["fileToUpload"]) && $_FILES["fileToUpload"]["error"] === UPLOAD_ERR_OK && !empty($_POST["documentDescription"]) && !empty($_POST["expiryDate"])) {
|
||||
// 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);
|
||||
$error_message = "Connessione al database fallita: " . $conn->connect_error;
|
||||
echo "<script>var errorMessage = '" . addslashes($error_message) . "';</script>";
|
||||
echo "<script>var uploadStatus = 'db_connection_error';</script>";
|
||||
die();
|
||||
}
|
||||
|
||||
// Ottieni l'ID dell'utente (da dove viene?)
|
||||
// Ottieni l'ID dell'utente
|
||||
$iduserlogin = $_POST["iduserlogin"];
|
||||
|
||||
// Altre informazioni sul documento
|
||||
$documentDescription = $_POST["documentDescription"];
|
||||
$expiryDate = $_POST["expiryDate"];
|
||||
$documentDescription = $conn->real_escape_string($_POST["documentDescription"]);
|
||||
$expiryDate = $conn->real_escape_string($_POST["expiryDate"]);
|
||||
$uploadedAt = date("Y-m-d"); // Data corrente per uploaded_at
|
||||
$originalFileName = $_FILES["fileToUpload"]["name"];
|
||||
$fileExtension = pathinfo($originalFileName, PATHINFO_EXTENSION);
|
||||
$timestamp = time(); // Timestamp corrente
|
||||
@@ -39,26 +40,37 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
|
||||
// Sposta il file nella cartella di destinazione
|
||||
if (move_uploaded_file($fileTmpName, $fileDestination)) {
|
||||
// Inserisci i dati nel database
|
||||
$sql = "INSERT INTO certificateuserprofile (iduser, documentdescription, filenamedocument, expirydatedocument)
|
||||
VALUES ('$iduserlogin', '$documentDescription', '$newFileName', '$expiryDate')";
|
||||
// Inserisci i dati nel database usando prepared statement
|
||||
$sql = "INSERT INTO certificateuserprofile (iduser, documentdescription, filenamedocument, expirydatedocument, uploaded_at)
|
||||
VALUES (?, ?, ?, ?, ?)";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bind_param("issss", $iduserlogin, $documentDescription, $newFileName, $expiryDate, $uploadedAt);
|
||||
|
||||
|
||||
|
||||
$conn->query($sql) ;
|
||||
if ($stmt->execute()) {
|
||||
echo "<script>var uploadStatus = 'success';</script>";
|
||||
} else {
|
||||
echo "Errore nel caricamento del file.";
|
||||
$error_message = "Errore durante l'inserimento nel database: " . $conn->error;
|
||||
echo "<script>var errorMessage = '" . addslashes($error_message) . "';</script>";
|
||||
echo "<script>var uploadStatus = 'db_insert_error';</script>";
|
||||
}
|
||||
$stmt->close();
|
||||
} else {
|
||||
$error_message = "Errore nel caricamento del file.";
|
||||
echo "<script>var errorMessage = '" . addslashes($error_message) . "';</script>";
|
||||
echo "<script>var uploadStatus = 'file_upload_error';</script>";
|
||||
}
|
||||
|
||||
// Chiudi la connessione al database
|
||||
$conn->close();
|
||||
} else {
|
||||
$error_message = "Tutti i campi sono obbligatori: descrizione, data di scadenza e file.";
|
||||
echo "<script>var errorMessage = '" . addslashes($error_message) . "';</script>";
|
||||
echo "<script>var uploadStatus = 'validation_error';</script>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
if ($conn->connect_error) {
|
||||
@@ -84,13 +96,12 @@ if ($result->num_rows > 0) {
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$idOrdine = $row["idorderbook"];
|
||||
$totalTickets = $row["total_tickets"];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$conn->close();
|
||||
?>
|
||||
<?php //check tickets
|
||||
<?php
|
||||
// Connessione al database
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
if ($conn->connect_error) {
|
||||
@@ -117,8 +128,6 @@ if ($result) {
|
||||
$totalRecords = $row['total'];
|
||||
$passedRecords = $row['passed'];
|
||||
$futureRecords = $row['future'];
|
||||
|
||||
|
||||
}
|
||||
// Chiusura della connessione
|
||||
$conn->close();
|
||||
@@ -132,8 +141,6 @@ if ($conn->connect_error) {
|
||||
die("Connessione al database fallita: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Query per selezionare i dati filtrati per iduser
|
||||
$query = "SELECT * FROM certificateuserprofile WHERE iduser = $iduserlogin";
|
||||
$result = $conn->query($query);
|
||||
@@ -145,17 +152,17 @@ while ($row = $result->fetch_assoc()) {
|
||||
$documents[] = $row;
|
||||
}
|
||||
|
||||
$conn->close();
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<title>Starter Page | webadmin - Admin & Dashboard Template</title>
|
||||
<title>YogiBook - Carica Certificati</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="Premium Multipurpose Admin & Dashboard Template" name="description" />
|
||||
<meta content="Themesdesign" name="author" />
|
||||
<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">
|
||||
|
||||
@@ -167,14 +174,65 @@ while ($row = $result->fetch_assoc()) {
|
||||
<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">
|
||||
|
||||
<!-- SweetAlert2 CDN -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
|
||||
<!-- jQuery and jQuery UI -->
|
||||
<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/ui/1.12.1/jquery-ui.js"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
$("#expiryDate").datepicker({ dateFormat: "yy-mm-dd" });
|
||||
$("#expiryDate").datepicker({
|
||||
dateFormat: "yy-mm-dd",
|
||||
minDate: 0 // Impedisce la selezione di date passate
|
||||
});
|
||||
});
|
||||
|
||||
// Handle upload status and display modals
|
||||
$(document).ready(function() {
|
||||
if (typeof Swal === 'undefined') {
|
||||
console.error('SweetAlert2 non è caricato correttamente.');
|
||||
alert('Errore: SweetAlert2 non è disponibile. Controlla la connessione al CDN.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof uploadStatus !== 'undefined') {
|
||||
if (uploadStatus === 'success') {
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: 'Successo',
|
||||
text: 'Documento caricato con successo!',
|
||||
confirmButtonText: 'OK'
|
||||
}).then(() => {
|
||||
window.location.href = window.location.href; // Ricarica la pagina
|
||||
});
|
||||
} else if (uploadStatus === 'db_connection_error' || uploadStatus === 'db_insert_error' || uploadStatus === 'file_upload_error' || uploadStatus === 'validation_error') {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Errore',
|
||||
text: errorMessage || 'Si è verificato un errore sconosciuto.',
|
||||
confirmButtonText: 'OK'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function confirmDeleteCertificate(id) {
|
||||
Swal.fire({
|
||||
title: "Sei sicuro?",
|
||||
text: "Questo certificato verrà cancellato definitivamente!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#d33",
|
||||
cancelButtonColor: "#3085d6",
|
||||
confirmButtonText: "Sì, cancella!",
|
||||
cancelButtonText: "Annulla"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = `deletecertificate.php?id=${id}&source=user`;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.custom-card {
|
||||
@@ -263,7 +321,8 @@ while ($row = $result->fetch_assoc()) {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.custom-date-box, .custom-event-details {
|
||||
.custom-date-box,
|
||||
.custom-event-details {
|
||||
width: 100%;
|
||||
border-radius: 0;
|
||||
}
|
||||
@@ -273,30 +332,9 @@ while ($row = $result->fetch_assoc()) {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function confirmDelete(id, deletePageUrl) {
|
||||
Swal.fire({
|
||||
title: "Sei sicuro?",
|
||||
text: "Questa prenotazione verrà cancellata definitivamente! Ricordati poi di riprogrammare la tua lezione!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#d33",
|
||||
cancelButtonColor: "#3085d6",
|
||||
confirmButtonText: "Sì, cancella!",
|
||||
cancelButtonText: "Annulla"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Reindirizza direttamente alla pagina di cancellazione con l'ID come parametro.
|
||||
window.location.href = `deleteclass.php?id=${id}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- <body data-layout="horizontal"> -->
|
||||
|
||||
<!-- Begin page -->
|
||||
<div id="layout-wrapper">
|
||||
|
||||
@@ -306,27 +344,17 @@ while ($row = $result->fetch_assoc()) {
|
||||
<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>
|
||||
@@ -335,40 +363,30 @@ while ($row = $result->fetch_assoc()) {
|
||||
|
||||
<header class="ishorizontal-topbar">
|
||||
<div class="navbar-header">
|
||||
<div class="d-flex">
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="d-flex"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="topnav">
|
||||
<div class="container-fluid">
|
||||
<nav class="navbar navbar-light navbar-expand-lg topnav-menu">
|
||||
|
||||
|
||||
</nav>
|
||||
<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">
|
||||
<?php if (isset($_GET['message']) && $_GET['message'] == 'success') { ?>
|
||||
<div class="alert alert-success" role="alert">
|
||||
Certificato rimosso con successo
|
||||
</div>
|
||||
<?php } ?>
|
||||
<h5>Benvenuta/o <?php echo $firstname; ?> </h5>
|
||||
<p>Di seguito puoi visualizzare o caricare i certificati medici di libratoria alla pratica Yoga</p>
|
||||
<p>Di seguito puoi visualizzare o caricare i certificati medici di liberatoria alla pratica Yoga</p>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped mb-0">
|
||||
<thead>
|
||||
@@ -376,6 +394,7 @@ while ($row = $result->fetch_assoc()) {
|
||||
<th>Descrizione del Documento</th>
|
||||
<th>Data di Scadenza</th>
|
||||
<th>Documento</th>
|
||||
<th>Azione</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -384,102 +403,71 @@ while ($row = $result->fetch_assoc()) {
|
||||
<td><?php echo $document['documentdescription']; ?></td>
|
||||
<td><?php echo $document['expirydatedocument']; ?></td>
|
||||
<td><a href="user/document/<?php echo $document['filenamedocument']; ?>" target="_blank">Documento</a></td>
|
||||
<td>
|
||||
<button class="btn btn-danger btn-sm" onclick="confirmDeleteCertificate(<?php echo $document['idcertificateuserprofile']; ?>)">
|
||||
<i class="fas fa-trash"></i> Cancella
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="">
|
||||
<div class="row mb-12">
|
||||
<div class="col-xl-12 col-md-12">
|
||||
<div class="pb-3 pb-xl-0">
|
||||
|
||||
<div class="position-relative">
|
||||
<h3>Carica documenti</h3>
|
||||
|
||||
|
||||
</div>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="iduserlogin" class="form-control" value="<?php echo $iduserlogin; ?>">
|
||||
<label for="documentDescription">Descrizione del Documento:</label>
|
||||
<input type="text" class="form-control" name="documentDescription" required><br>
|
||||
<input type="text" class="form-control" name="documentDescription" value="Certificato Medico" required><br>
|
||||
<label for="expiryDate">Data di Scadenza:</label>
|
||||
<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>
|
||||
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">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xl-9 col-md-12">
|
||||
|
||||
|
||||
<div class="col-xl-9 col-md-12"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
|
||||
|
||||
</div>
|
||||
<!-- End Page-content -->
|
||||
|
||||
<?php include('include/footer.php'); ?>
|
||||
</div>
|
||||
<!-- end main content-->
|
||||
|
||||
</div>
|
||||
<!-- END layout-wrapper -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- JAVASCRIPT -->
|
||||
<script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="assets/libs/metismenujs/metismenujs.min.js"></script>
|
||||
<script src="assets/libs/simplebar/simplebar.min.js"></script>
|
||||
<script src="assets/libs/eva-icons/eva.min.js"></script>
|
||||
|
||||
<script src="assets/js/app.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,36 @@
|
||||
YogaSoul Autoresponder — Istruzioni rapide
|
||||
|
||||
COS'È
|
||||
- Crea BOZZE di risposta (non invia) per le ultime X email NON LETTE in INBOX.
|
||||
- Le bozze vengono salvate nella cartella Drafts/Bozze dell’account IMAP, in thread (In-Reply-To/References) con citazione del messaggio originale.
|
||||
|
||||
FILE NELLA CARTELLA
|
||||
- yogasoul_autoresponder.exe (oppure: email_autoresponder_yogasoul.py se lo usi con Python)
|
||||
- config.json (credenziali e impostazioni)
|
||||
- prompt_template.txt (testo/tono della risposta: modificabile liberamente)
|
||||
- yogasoul_knowledge_base.json (dati corsi, link, ecc.)
|
||||
|
||||
COME SI USA (Windows, senza Python)
|
||||
1) Apri la cartella “YogaSoul Autoresponder”.
|
||||
2) Modifica `config.json` con:
|
||||
- imap_server, email_address, email_password
|
||||
- openai_api_key
|
||||
- max_to_process (es. 5), throttle_seconds (es. 1.5)
|
||||
3) (Opz.) Modifica `prompt_template.txt` e/o `yogasoul_knowledge_base.json`.
|
||||
4) Doppio click su `yogasoul_autoresponder.exe` (oppure su `run_autoresponder.bat` se fornito).
|
||||
5) Controlla in Posta le BOZZE: dovresti vedere una bozza per ogni email non letta (fino a max_to_process).
|
||||
|
||||
IMPOSTAZIONI UTILI (config.json)
|
||||
- "max_to_process": quante email non lette processare (consigliato 5).
|
||||
- "throttle_seconds": pausa tra le richieste (consigliato 1–2s).
|
||||
- "mark_as_seen": true per segnare come lette dopo la bozza (false per lasciarle non lette).
|
||||
- "preferred_draft_folder": cartella locale alternativa se il server non ha Drafts.
|
||||
|
||||
TROUBLESHOOTING
|
||||
- Nessuna bozza: verifica credenziali IMAP/API in config.json; verifica che ci siano email UNSEEN.
|
||||
- Bozze “schiacciate”: il programma converte in HTML con <p>/<br>; se serve, modifica il prompt.
|
||||
- Rate limit/blocchi: alza "throttle_seconds" (es. 1.5–2.0) e tieni "max_to_process" basso (5).
|
||||
- Cartella bozze: il programma cerca \Drafts; in fallback crea INBOX.BozzaRisposte.
|
||||
|
||||
SICUREZZA
|
||||
- `config.json` contiene password in chiaro: conserva la cartella su un PC/utente fidato.
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"imap_server": "mail.yogasoul.it",
|
||||
"email_address": "info@yogasoul.it",
|
||||
"email_password": "!Testolina88",
|
||||
"openai_api_key": "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",
|
||||
"openai_model": "gpt-3.5-turbo",
|
||||
"preferred_draft_folder": "BozzaRisposte",
|
||||
"mark_as_seen": true,
|
||||
"throttle_seconds": 2,
|
||||
"max_to_process": 5
|
||||
}
|
||||
@@ -0,0 +1,511 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
import json
|
||||
import imaplib
|
||||
import email
|
||||
import traceback
|
||||
import html as html_lib
|
||||
from email.utils import parseaddr
|
||||
from email.mime.text import MIMEText
|
||||
from email.header import decode_header, make_header
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
# ==========================
|
||||
# CONFIG da config.json (accanto allo script/EXE)
|
||||
# ==========================
|
||||
def app_dir() -> Path:
|
||||
# se "frozen" (PyInstaller), usa la cartella dell'eseguibile
|
||||
return Path(sys.executable).parent if getattr(sys, "frozen", False) else Path(__file__).resolve().parent
|
||||
|
||||
CONFIG_PATH = app_dir() / "config.json"
|
||||
|
||||
def load_config():
|
||||
try:
|
||||
with open(CONFIG_PATH, "r", encoding="utf-8") as f:
|
||||
cfg = json.load(f)
|
||||
print(f"[CONFIG] Caricato: {CONFIG_PATH}")
|
||||
return cfg
|
||||
except Exception as e:
|
||||
print(f"[ERRORE] Impossibile leggere {CONFIG_PATH}: {e}")
|
||||
return {}
|
||||
|
||||
CFG = load_config()
|
||||
|
||||
# valori letti dal config (con default sensati)
|
||||
IMAP_SERVER = CFG.get("imap_server", "mail.yogasoul.it")
|
||||
EMAIL_ADDRESS = CFG.get("email_address", "")
|
||||
EMAIL_PASSWORD = CFG.get("email_password", "")
|
||||
OPENAI_API_KEY = CFG.get("openai_api_key", "")
|
||||
OPENAI_MODEL = CFG.get("openai_model", "gpt-3.5-turbo")
|
||||
PREFERRED_DRAFT_FOLDER = CFG.get("preferred_draft_folder", "BozzaRisposte")
|
||||
MARK_AS_SEEN = bool(CFG.get("mark_as_seen", True))
|
||||
THROTTLE_SECONDS = float(CFG.get("throttle_seconds", 0) or 0)
|
||||
MAX_TO_PROCESS = int(CFG.get("max_to_process", 5) or 5)
|
||||
# Percorsi esterni (accanto all'eseguibile)
|
||||
KB_PATH = str(app_dir() / CFG.get("kb_path", "yogasoul_knowledge_base.json"))
|
||||
PROMPT_PATH = str(app_dir() / CFG.get("prompt_path", "prompt_template.txt"))
|
||||
|
||||
# ==========================
|
||||
# UTILS
|
||||
# ==========================
|
||||
def _decode_mime_words(s):
|
||||
if not s:
|
||||
return ""
|
||||
try:
|
||||
return str(make_header(decode_header(s)))
|
||||
except Exception:
|
||||
parts = decode_header(s)
|
||||
out = []
|
||||
for text, enc in parts:
|
||||
if isinstance(text, bytes):
|
||||
out.append(text.decode(enc or "utf-8", errors="ignore"))
|
||||
else:
|
||||
out.append(text or "")
|
||||
return "".join(out)
|
||||
|
||||
def _html_to_text(html):
|
||||
try:
|
||||
text = re.sub(r"(?is)<(script|style).*?>.*?</\1>", "", html or "")
|
||||
text = re.sub(r"(?s)<br\s*/?>", "\n", text)
|
||||
text = re.sub(r"(?s)</p\s*>", "\n\n", text)
|
||||
text = re.sub(r"(?s)<.*?>", "", text)
|
||||
return text.strip()
|
||||
except Exception:
|
||||
return html or ""
|
||||
|
||||
def _ensure_html_blocks(s):
|
||||
"""Se il modello restituisce testo piatto, convertilo in HTML semplice e leggibile."""
|
||||
s = (s or "").strip()
|
||||
if "<html" in s.lower() or "<p" in s.lower() or "<br" in s.lower():
|
||||
body = s
|
||||
else:
|
||||
parts = [p.strip() for p in s.split("\n\n") if p.strip()]
|
||||
if len(parts) > 1:
|
||||
body = "".join(
|
||||
"<p>{}</p>".format(html_lib.escape(p).replace("\n", "<br>"))
|
||||
for p in parts
|
||||
)
|
||||
else:
|
||||
body = "<p>{}</p>".format(html_lib.escape(s).replace("\n", "<br>"))
|
||||
return "<!doctype html><html><body>{}</body></html>".format(body)
|
||||
|
||||
def _make_quoted_original(body_text):
|
||||
"""Crea il blocco citato del messaggio originale, safe-escaped."""
|
||||
if not body_text:
|
||||
return ""
|
||||
escaped = html_lib.escape(body_text).replace("\n", "<br>")
|
||||
return (
|
||||
"<hr>"
|
||||
"<p style='color:#666; font-size:90%'>— Messaggio originale —</p>"
|
||||
f"<blockquote style='margin:0 0 0 1em; padding-left:1em; border-left:3px solid #ddd'>{escaped}</blockquote>"
|
||||
)
|
||||
|
||||
def _inject_before_body_end(html_src: str, addition: str) -> str:
|
||||
"""Inserisce 'addition' prima di </body> in modo case-insensitive; se manca </body>, appende."""
|
||||
m = re.search(r'</\s*body\s*>', html_src, flags=re.I)
|
||||
if not m:
|
||||
return html_src + addition
|
||||
start = m.start()
|
||||
return html_src[:start] + addition + html_src[start:]
|
||||
|
||||
def load_knowledge_base(path=KB_PATH):
|
||||
if not os.path.isfile(path):
|
||||
print(f"[ATTENZIONE] KB non trovata: {path}. Proseguo senza.")
|
||||
return {}
|
||||
try:
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
except Exception as e:
|
||||
print(f"[ERRORE] Lettura KB: {e}. Proseguo senza.")
|
||||
return {}
|
||||
|
||||
def assert_config():
|
||||
problems = []
|
||||
if not isinstance(IMAP_SERVER, str) or not IMAP_SERVER.strip():
|
||||
problems.append("imap_server mancante in config.json")
|
||||
if not isinstance(EMAIL_ADDRESS, str) or not EMAIL_ADDRESS.strip():
|
||||
problems.append("email_address mancante in config.json")
|
||||
if not isinstance(EMAIL_PASSWORD, str) or not EMAIL_PASSWORD.strip():
|
||||
problems.append("email_password mancante in config.json")
|
||||
if not isinstance(OPENAI_API_KEY, str) or not OPENAI_API_KEY.strip():
|
||||
problems.append("openai_api_key mancante in config.json")
|
||||
if problems:
|
||||
print("[CONFIG] Correggi config.json:")
|
||||
for p in problems:
|
||||
print(" -", p)
|
||||
return False
|
||||
return True
|
||||
|
||||
# ==========================
|
||||
# Prompt esterno
|
||||
# ==========================
|
||||
def load_prompt(path: str) -> str:
|
||||
try:
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
print(f"[PROMPT] Caricato: {path}")
|
||||
return f.read()
|
||||
except Exception as e:
|
||||
print(f"[ATTENZIONE] Prompt non trovato o illeggibile: {path} ({e})")
|
||||
return ""
|
||||
|
||||
def render_prompt(template: str, **vars_) -> str:
|
||||
# Sostituzione semplice stile {{nome}}
|
||||
out = template
|
||||
for k, v in vars_.items():
|
||||
out = out.replace(f"{{{{{k}}}}}", str(v))
|
||||
return out
|
||||
|
||||
# ==========================
|
||||
# IMAP helpers robusti
|
||||
# ==========================
|
||||
LIST_RE = re.compile(r'^\s*\((?P<flags>[^)]*)\)\s+"(?P<delim>[^"]+)"\s+(?P<name>.+?)\s*$')
|
||||
|
||||
def _parse_list_line(raw: bytes):
|
||||
s = raw.decode(errors="ignore")
|
||||
m = LIST_RE.match(s)
|
||||
if not m:
|
||||
parts = s.strip().split()
|
||||
name = parts[-1] if parts else ""
|
||||
name = name.strip('"')
|
||||
return ([], ".", name)
|
||||
flags_str = m.group("flags") or ""
|
||||
delim = m.group("delim") or "."
|
||||
name = m.group("name").strip()
|
||||
if name.startswith('"') and name.endswith('"'):
|
||||
name = name[1:-1]
|
||||
flags = [f.strip() for f in flags_str.split() if f.strip()]
|
||||
return (flags, delim, name)
|
||||
|
||||
def _list_mailboxes(mail):
|
||||
try:
|
||||
typ, boxes = mail.list()
|
||||
if typ != "OK":
|
||||
return []
|
||||
return [_parse_list_line(raw) for raw in (boxes or [])]
|
||||
except Exception:
|
||||
return []
|
||||
|
||||
def _find_drafts_mailbox(mail):
|
||||
boxes = _list_mailboxes(mail)
|
||||
if not boxes:
|
||||
return (None, ".")
|
||||
delim_guess = boxes[0][1] if boxes[0][1] else "."
|
||||
# special-use \Drafts
|
||||
for flags, delim, name in boxes:
|
||||
if any("\\Drafts" in f or "\\drafts" in f for f in flags):
|
||||
return (name, delim or delim_guess)
|
||||
# nomi comuni
|
||||
wanted = ("drafts", "bozze", "bozza", "draft")
|
||||
for flags, delim, name in boxes:
|
||||
low = name.lower()
|
||||
if any(w in low.split(delim or ".")[-1] for w in wanted):
|
||||
return (name, delim or delim_guess)
|
||||
return (None, delim_guess)
|
||||
|
||||
def _select_or_create(mail, name, delim):
|
||||
typ, _ = mail.select(name, readonly=False)
|
||||
if typ == "OK":
|
||||
return name
|
||||
candidate = f"INBOX{delim}{name}"
|
||||
typ, _ = mail.select(candidate, readonly=False)
|
||||
if typ == "OK":
|
||||
return candidate
|
||||
mail.create(candidate)
|
||||
typ, _ = mail.select(candidate, readonly=False)
|
||||
if typ == "OK":
|
||||
return candidate
|
||||
raise RuntimeError(f"Impossibile selezionare o creare la casella '{name}' (delim='{delim}')")
|
||||
|
||||
# ==========================
|
||||
# INTENT DETECTION (semplice)
|
||||
# ==========================
|
||||
SCHEDULE_WORDS = [
|
||||
"orario", "orari", "quando", "che ore", "a che ora", "giorni", "mercoledì", "martedì",
|
||||
"lezione di", "inizia", "finisce", "durata"
|
||||
]
|
||||
BOOKING_WORDS = [
|
||||
"prenota", "prenotazione", "prenotare", "iscriversi", "iscrizione", "link", "come fare", "dove prenoto"
|
||||
]
|
||||
INFO_WORDS = [
|
||||
"informazioni", "info", "cos'è", "che cos", "benefici", "a chi è adatto", "livello", "programma",
|
||||
"insegnante", "maestro", "costi", "prezzo", "quanto costa", "materiale", "cosa portare"
|
||||
]
|
||||
|
||||
def classify_intent(subject, body):
|
||||
s = f"{subject or ''} {body or ''}".lower()
|
||||
has_info = any(w in s for w in INFO_WORDS)
|
||||
has_sched = any(w in s for w in SCHEDULE_WORDS)
|
||||
has_book = any(w in s for w in BOOKING_WORDS)
|
||||
if has_info:
|
||||
return "extended"
|
||||
if (has_sched or has_book) and not has_info:
|
||||
return "brief"
|
||||
return "brief"
|
||||
|
||||
# ==========================
|
||||
# OPENAI: GENERAZIONE BOZZA
|
||||
# ==========================
|
||||
def generate_response(email_info, kb):
|
||||
try:
|
||||
from openai import OpenAI
|
||||
client = OpenAI(api_key=OPENAI_API_KEY)
|
||||
|
||||
nickname = "amico"
|
||||
if email_info.get("sender_name"):
|
||||
nickname = email_info["sender_name"].split()[0]
|
||||
elif email_info.get("sender_email"):
|
||||
nickname = email_info["sender_email"].split("@")[0].split(".")[0] or "amico"
|
||||
|
||||
kb_json = json.dumps(kb, ensure_ascii=False, indent=2)
|
||||
intent = classify_intent(email_info.get("subject",""), email_info.get("body_text",""))
|
||||
|
||||
if intent == "brief":
|
||||
policy = ("Se il messaggio chiede solo orari e/o come prenotare, rispondi BREVE: "
|
||||
"indica orari precisi e inserisci SOLO il link prenotazione. Non aggiungere benefici o descrizioni.")
|
||||
else:
|
||||
policy = ("Se il messaggio chiede informazioni sul corso, rispondi ESTESO: "
|
||||
"includi orari, benefici principali, a chi è adatto, eventuale insegnante, e il link prenotazione.")
|
||||
|
||||
email_text = (
|
||||
f"Soggetto: {email_info.get('subject','')}\n"
|
||||
f"Mittente: {email_info.get('sender_email','')}\n"
|
||||
f"Corpo: {email_info.get('body_text','')}"
|
||||
)
|
||||
|
||||
# Prompt da file esterno (con fallback interno)
|
||||
template = load_prompt(PROMPT_PATH)
|
||||
if not template:
|
||||
template = (
|
||||
"Sei Aurora, fondatrice di YogaSoul (www.yogasoul.it), stile zen e informale, diretto.\n"
|
||||
"Rispondi in italiano, amichevole e rilassato, con emoticon yoga (🌿, 🧘♀️, 😊) senza esagerare.\n"
|
||||
"Saluta con \"Ciao {{nickname}}, bello sentirti!\" e firma con \"Namaste, Aurora - YogaSoul\".\n"
|
||||
"Usa la knowledge base per corsi, orari, prezzi, benefici, insegnanti.\n"
|
||||
"Includi sempre il link_prenotazione specifico come <a href='link'>Iscriviti qui</a> per prenotazioni,\n"
|
||||
"e il calendario <a href='https://yogasoul.it/wp-content/uploads/2025/08/Calendario-settembre-2025-2.jpg'>qui</a>.\n"
|
||||
"Se non sai, scrivi: \"Contattami per dettagli! 🧘♀️\".\n\n"
|
||||
"{{policy}}\n\n"
|
||||
"Knowledge Base:\n"
|
||||
"{{kb_json}}\n\n"
|
||||
"Email ricevuta:\n"
|
||||
"{{email_text}}\n\n"
|
||||
"Scrivi la risposta in HTML pulito (usa <p>, <ul>/<li> se utile; niente CSS superfluo).\n"
|
||||
)
|
||||
|
||||
prompt = render_prompt(
|
||||
template,
|
||||
nickname=nickname,
|
||||
policy=policy,
|
||||
kb_json=kb_json,
|
||||
email_text=email_text,
|
||||
)
|
||||
|
||||
resp = client.chat.completions.create(
|
||||
model=OPENAI_MODEL,
|
||||
messages=[{"role": "user", "content": prompt}],
|
||||
max_tokens=700,
|
||||
temperature=0.7,
|
||||
)
|
||||
draft_raw = (resp.choices[0].message.content or "").strip()
|
||||
return _ensure_html_blocks(draft_raw)
|
||||
except Exception as e:
|
||||
print(f"[ERRORE] OpenAI: {e}")
|
||||
traceback.print_exc()
|
||||
return _ensure_html_blocks(
|
||||
"<p>Errore con l'AI, contattami per dettagli! 🧘♀️<br>"
|
||||
"Namaste, Aurora - YogaSoul</p>"
|
||||
)
|
||||
|
||||
# ==========================
|
||||
# PIPELINE: processa TUTTE le UNSEEN (max N)
|
||||
# ==========================
|
||||
def fetch_all_unseen(mail, limit=None):
|
||||
"""Ritorna lista di dict (uno per messaggio) + seq id, senza chiudere la connessione IMAP."""
|
||||
results = []
|
||||
typ, _ = mail.select("INBOX")
|
||||
if typ != "OK":
|
||||
raise RuntimeError("Impossibile selezionare INBOX")
|
||||
typ, data = mail.search(None, "UNSEEN")
|
||||
if typ != "OK":
|
||||
raise RuntimeError("Search UNSEEN fallita")
|
||||
ids = data[0].split() # solitamente in ordine crescente (più vecchie -> più nuove)
|
||||
|
||||
if not ids:
|
||||
print("Nessuna email non letta.")
|
||||
return results
|
||||
|
||||
if limit and limit > 0:
|
||||
ids = ids[-limit:] # prendi SOLO le ultime N non lette
|
||||
|
||||
for seq_id in ids:
|
||||
typ, msg_data = mail.fetch(seq_id, "(RFC822)")
|
||||
if typ != "OK" or not msg_data or not msg_data[0]:
|
||||
print(f"[WARN] Fetch fallito per id {seq_id}")
|
||||
continue
|
||||
|
||||
msg = email.message_from_bytes(msg_data[0][1])
|
||||
name, sender_addr = parseaddr(msg.get("From", "") or "")
|
||||
subject = _decode_mime_words(msg.get("Subject", "") or "")
|
||||
message_id = msg.get("Message-ID", "") or ""
|
||||
references = msg.get("References", "") or ""
|
||||
|
||||
body_text = ""
|
||||
if msg.is_multipart():
|
||||
for part in msg.walk():
|
||||
ctype = part.get_content_type()
|
||||
disp = (part.get("Content-Disposition") or "").lower()
|
||||
if ctype == "text/plain" and "attachment" not in disp:
|
||||
payload = part.get_payload(decode=True)
|
||||
if payload is not None:
|
||||
body_text = payload.decode(errors="ignore")
|
||||
break
|
||||
if not body_text:
|
||||
for part in msg.walk():
|
||||
if part.get_content_type() == "text/html":
|
||||
payload = part.get_payload(decode=True)
|
||||
if payload is not None:
|
||||
body_text = _html_to_text(payload.decode(errors="ignore"))
|
||||
break
|
||||
else:
|
||||
payload = msg.get_payload(decode=True)
|
||||
if payload is not None:
|
||||
try:
|
||||
body_text = payload.decode(errors="ignore")
|
||||
except Exception:
|
||||
body_text = _html_to_text(payload.decode(errors="ignore"))
|
||||
|
||||
results.append({
|
||||
"seq_id": seq_id,
|
||||
"sender_email": sender_addr,
|
||||
"sender_name": name,
|
||||
"subject": subject,
|
||||
"message_id": message_id,
|
||||
"references": references,
|
||||
"body_text": body_text or "",
|
||||
})
|
||||
return results
|
||||
|
||||
def prepare_reply_mime(email_info, response_html):
|
||||
"""Costruisce il MIME HTML della risposta con quote e thread headers."""
|
||||
reply_body = _inject_before_body_end(
|
||||
response_html,
|
||||
_make_quoted_original(email_info.get("body_text",""))
|
||||
)
|
||||
|
||||
msg = MIMEText(reply_body, "html", "utf-8")
|
||||
subj = email_info.get("subject") or "[Risposta automatica] - YogaSoul"
|
||||
if not subj.lower().startswith("re:"):
|
||||
subj = f"Re: {subj}"
|
||||
msg["Subject"] = subj
|
||||
msg["From"] = EMAIL_ADDRESS
|
||||
if email_info.get("sender_email"):
|
||||
msg["To"] = email_info["sender_email"]
|
||||
if email_info.get("message_id"):
|
||||
msg["In-Reply-To"] = email_info["message_id"]
|
||||
prev_refs = email_info.get("references", "")
|
||||
if prev_refs and email_info.get("message_id"):
|
||||
msg["References"] = (prev_refs + " " + email_info["message_id"]).strip()
|
||||
elif email_info.get("message_id"):
|
||||
msg["References"] = email_info["message_id"]
|
||||
return msg
|
||||
|
||||
def ensure_drafts_folder(mail):
|
||||
"""Trova o crea la cartella bozze; ritorna (folder_name, delim)."""
|
||||
drafts_name, delim = _find_drafts_mailbox(mail)
|
||||
if drafts_name:
|
||||
return drafts_name, delim
|
||||
folder = f"INBOX{delim}{PREFERRED_DRAFT_FOLDER}"
|
||||
typ, _ = mail.select(folder, readonly=False)
|
||||
if typ == "OK":
|
||||
return folder, delim
|
||||
mail.create(folder)
|
||||
typ, _ = mail.select(folder, readonly=False)
|
||||
if typ == "OK":
|
||||
return folder, delim
|
||||
candidate = f"INBOX{delim}Drafts"
|
||||
mail.create(candidate)
|
||||
typ, _ = mail.select(candidate, readonly=False)
|
||||
if typ == "OK":
|
||||
return candidate, delim
|
||||
raise RuntimeError("Impossibile trovare/creare una cartella bozze.")
|
||||
|
||||
def append_draft(mail, folder, msg):
|
||||
"""Esegue APPEND con flag \Draft nella folder indicata."""
|
||||
flags = r"(\Draft)"
|
||||
when = imaplib.Time2Internaldate(time.time())
|
||||
typ, resp = mail.append(folder, flags, when, msg.as_bytes())
|
||||
print("[APPEND]", folder, "=>", typ, resp)
|
||||
return typ == "OK"
|
||||
|
||||
# ==========================
|
||||
# MAIN
|
||||
# ==========================
|
||||
def main():
|
||||
# Controllo config di base
|
||||
problems = []
|
||||
if not isinstance(IMAP_SERVER, str) or not IMAP_SERVER.strip():
|
||||
problems.append("imap_server mancante in config.json")
|
||||
if not isinstance(EMAIL_ADDRESS, str) or not EMAIL_ADDRESS.strip():
|
||||
problems.append("email_address mancante in config.json")
|
||||
if not isinstance(EMAIL_PASSWORD, str) or not EMAIL_PASSWORD.strip():
|
||||
problems.append("email_password mancante in config.json")
|
||||
if not isinstance(OPENAI_API_KEY, str) or not OPENAI_API_KEY.strip():
|
||||
problems.append("openai_api_key mancante in config.json")
|
||||
if problems:
|
||||
print("[CONFIG] Correggi config.json:")
|
||||
for p in problems:
|
||||
print(" -", p)
|
||||
return
|
||||
|
||||
# Login IMAP
|
||||
try:
|
||||
mail = imaplib.IMAP4_SSL(IMAP_SERVER)
|
||||
mail.login(EMAIL_ADDRESS, EMAIL_PASSWORD)
|
||||
except Exception as e:
|
||||
print(f"[ERRORE] Login IMAP fallito: {e}")
|
||||
traceback.print_exc()
|
||||
return
|
||||
|
||||
try:
|
||||
drafts_folder, delim = ensure_drafts_folder(mail)
|
||||
print(f"[DEBUG] drafts_folder='{drafts_folder}' delim='{delim}'")
|
||||
|
||||
emails = fetch_all_unseen(mail, limit=MAX_TO_PROCESS)
|
||||
if not emails:
|
||||
print("Nessuna nuova email da processare.")
|
||||
mail.logout()
|
||||
return
|
||||
|
||||
kb = load_knowledge_base(KB_PATH)
|
||||
processed = 0
|
||||
|
||||
for info in emails:
|
||||
draft_html = generate_response(info, kb)
|
||||
mime_msg = prepare_reply_mime(info, draft_html)
|
||||
ok = append_draft(mail, drafts_folder, mime_msg)
|
||||
if ok and MARK_AS_SEEN:
|
||||
try:
|
||||
mail.store(info["seq_id"], "+FLAGS", "\\Seen")
|
||||
except Exception as e:
|
||||
print(f"[WARN] Non sono riuscito a marcare come letta id {info['seq_id']}: {e}")
|
||||
processed += 1
|
||||
if THROTTLE_SECONDS:
|
||||
time.sleep(THROTTLE_SECONDS)
|
||||
|
||||
print(f"✅ Elaborate {processed} email (max {MAX_TO_PROCESS}). Bozze salvate in '{drafts_folder}'.")
|
||||
mail.logout()
|
||||
except Exception as e:
|
||||
print(f"[ERRORE] Pipeline: {e}")
|
||||
traceback.print_exc()
|
||||
try:
|
||||
mail.logout()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,17 @@
|
||||
Sei Aurora, fondatrice di YogaSoul (www.yogasoul.it), stile zen e informale, diretto.
|
||||
Rispondi in italiano, amichevole e rilassato, con emoticon yoga (🌿, 🧘♀️, 😊) senza esagerare.
|
||||
Saluta con "Ciao {{nickname}}, bello sentirti!" e firma con "Namaste, Aurora - YogaSoul".
|
||||
Usa la knowledge base per corsi, orari, prezzi, benefici, insegnanti.
|
||||
Includi sempre il link_prenotazione specifico come <a href='link'>Iscriviti qui</a> per prenotazioni,
|
||||
e il calendario <a href='https://yogasoul.it/wp-content/uploads/2025/08/Calendario-settembre-2025-2.jpg'>qui</a>.
|
||||
Se non sai, scrivi: "Contattami per dettagli! 🧘♀️".
|
||||
|
||||
{{policy}}
|
||||
|
||||
Knowledge Base:
|
||||
{{kb_json}}
|
||||
|
||||
Email ricevuta:
|
||||
{{email_text}}
|
||||
|
||||
Scrivi la risposta in HTML pulito (usa <p>, <ul>/<li> se utile; niente CSS superfluo).
|
||||
@@ -0,0 +1,138 @@
|
||||
{
|
||||
"corsi": [
|
||||
{
|
||||
"nome": "Yoga e Meditazione",
|
||||
"descrizione": "Pratica che unisce yoga e meditazione per promuovere equilibrio interiore e consapevolezza. Eseguita online.",
|
||||
"benefici": ["Riduce stress e ansia", "Migliora concentrazione", "Favorisce rilassamento", "Supporta benessere emotivo"],
|
||||
"adatto_a": "Tutti i livelli, ideale per chi cerca una pratica mattutina o online.",
|
||||
"orari": "Lunedì 6:00-7:00",
|
||||
"luogo": "Online",
|
||||
"prezzo": {"singola_lezione": "Da definire", "pacchetto_4_lezioni": "Da definire", "pacchetto_12_lezioni": "Da definire", "prova": "€5"},
|
||||
"insegnante": "Aurora Masiero",
|
||||
"calendario_link": "https://yogasoul.it/wp-content/uploads/2025/08/Calendario-settembre-2025-2.jpg",
|
||||
"link_prenotazione": "https://yogasoul.it/product/yoga-e-meditazione/",
|
||||
"fonte": "https://yogasoul.it/aerial-yoga-classi-di-prova-a-seregno-registrazione/, immagine calendario"
|
||||
},
|
||||
{
|
||||
"nome": "Pilates Matwork",
|
||||
"descrizione": "Pratica a corpo libero che rafforza il core e migliora postura e flessibilità.",
|
||||
"benefici": ["Rafforza il core", "Migliora postura", "Aumenta flessibilità", "Riduce tensioni"],
|
||||
"adatto_a": "Tutti i livelli, ideale per forza e postura. Adatto a principianti.",
|
||||
"orari": "Lunedì 18:15-19:15",
|
||||
"luogo": "Via Valassina 62b, Seregno (MB)",
|
||||
"prezzo": {"singola_lezione": "Da definire", "pacchetto_4_lezioni": "Da definire", "pacchetto_12_lezioni": "Da definire", "prova": "€5"},
|
||||
"insegnante": "Barbara",
|
||||
"calendario_link": "https://yogasoul.it/wp-content/uploads/2025/08/Calendario-settembre-2025-2.jpg",
|
||||
"link_prenotazione": "https://yogasoul.it/product/pilates-matwork/",
|
||||
"fonte": "https://yogasoul.it/product/pilates-matwork/, immagine calendario"
|
||||
},
|
||||
{
|
||||
"nome": "Aerial Yoga",
|
||||
"descrizione": "Pratica con tessuto sospeso, unisce yoga e acrobatica. Livelli: Intermedio, Base/Mix.",
|
||||
"benefici": ["Aumenta forza e flessibilità", "Riduce pressione articolare", "Promuove rilassamento", "Stimola creatività"],
|
||||
"adatto_a": "Principianti (Base), intermedi (Intermedio, Mix). Sconsigliato per pressione alta o gravidanza senza medico.",
|
||||
"orari": "Martedì 18:15-19:15 (Intermedio), Mercoledì 18:30-19:30 (Base/Mix), Giovedì 19:15-20:15 (Base/Mix), Venerdì 20:30-21:30 (Mix)",
|
||||
"luogo": "Via Valassina 62b, Seregno (MB)",
|
||||
"prezzo": {"singola_lezione": "Da definire", "pacchetto_4_lezioni": "Da definire", "pacchetto_12_lezioni": "Da definire", "prova": "€5"},
|
||||
"insegnante": "Aurora Masiero",
|
||||
"calendario_link": "https://yogasoul.it/wp-content/uploads/2025/08/Calendario-settembre-2025-2.jpg",
|
||||
"link_prenotazione": "https://yogasoul.it/product/aerial-yoga/",
|
||||
"fonte": "https://yogasoul.it/product/aerial-yoga/, immagine calendario"
|
||||
},
|
||||
{
|
||||
"nome": "Hatha Yoga",
|
||||
"descrizione": "Pratica tradizionale con asana, pranayama e meditazione per equilibrare corpo e mente.",
|
||||
"benefici": ["Migliora flessibilità", "Riduce stress", "Promuove consapevolezza", "Supporta rilassamento"],
|
||||
"adatto_a": "Principianti e tutti i livelli, ideale per un’introduzione dolce.",
|
||||
"orari": "Martedì 19:30-20:30, Giovedì 18:00-19:00 (come Hatha Vinyasa)",
|
||||
"luogo": "Via Valassina 62b, Seregno (MB)",
|
||||
"prezzo": {"singola_lezione": "Da definire", "pacchetto_4_lezioni": "Da definire", "pacchetto_12_lezioni": "Da definire", "prova": "€5"},
|
||||
"insegnante": "Giorgia",
|
||||
"calendario_link": "https://yogasoul.it/wp-content/uploads/2025/08/Calendario-settembre-2025-2.jpg",
|
||||
"link_prenotazione": "https://yogasoul.it/product/hatha-yoga/",
|
||||
"fonte": "https://yogasoul.it/product/hatha-yoga/, immagine calendario"
|
||||
},
|
||||
{
|
||||
"nome": "Anukalana Yoga",
|
||||
"descrizione": "Stile fluido che integra yoga, Tai Chi e danza per un approccio olistico.",
|
||||
"benefici": ["Migliora fluidità", "Aumenta flessibilità", "Favorisce rilassamento", "Supporta equilibrio energetico"],
|
||||
"adatto_a": "Tutti i livelli, ideale per chi ama movimenti creativi.",
|
||||
"orari": "Mercoledì 19:45-20:45",
|
||||
"luogo": "Via Valassina 62b, Seregno (MB)",
|
||||
"prezzo": {"singola_lezione": "Da definire", "pacchetto_4_lezioni": "Da definire", "pacchetto_12_lezioni": "Da definire", "prova": "€5"},
|
||||
"insegnante": "Aurora Masiero",
|
||||
"calendario_link": "https://yogasoul.it/wp-content/uploads/2025/08/Calendario-settembre-2025-2.jpg",
|
||||
"link_prenotazione": "https://yogasoul.it/product/anukalana-yoga/",
|
||||
"fonte": "https://yogasoul.it/product/anukalana-yoga/, immagine calendario"
|
||||
},
|
||||
{
|
||||
"nome": "Yoga in Gravidanza",
|
||||
"descrizione": "Pratica dolce per donne incinte, con respirazione e rilassamento. Include amaca su richiesta.",
|
||||
"benefici": ["Allevia mal di schiena", "Migliora flessibilità", "Promuove connessione col bambino", "Supporta benessere"],
|
||||
"adatto_a": "Donne incinte con approvazione medica, adatto a principianti.",
|
||||
"orari": "Sabato 9:30-10:30 (attivato su richiesta)",
|
||||
"luogo": "Via Valassina 62b, Seregno (MB)",
|
||||
"prezzo": {"singola_lezione": "Da definire", "pacchetto_4_lezioni": "Da definire", "pacchetto_12_lezioni": "Da definire", "prova": "€5"},
|
||||
"insegnante": "Aurora Masiero",
|
||||
"calendario_link": "https://yogasoul.it/wp-content/uploads/2025/08/Calendario-settembre-2025-2.jpg",
|
||||
"link_prenotazione": "https://yogasoul.it/product/yoga-in-gravidanza/",
|
||||
"fonte": "https://yogasoul.it/product/yoga-in-gravidanza-in-presenza-seregno/, immagine calendario"
|
||||
},
|
||||
{
|
||||
"nome": "Videocorso Yoga in Gravidanza",
|
||||
"descrizione": "Corso on-demand per donne incinte, con esercizi per prepararsi al parto.",
|
||||
"benefici": ["Allevia fastidi", "Migliora flessibilità", "Promuove rilassamento", "Accessibile 24/7"],
|
||||
"adatto_a": "Donne incinte con approvazione medica, adatto a principianti.",
|
||||
"orari": "On-demand, accessibile 24/7",
|
||||
"luogo": "Online",
|
||||
"prezzo": {"videocorso": "€30"},
|
||||
"insegnante": "Aurora Masiero",
|
||||
"calendario_link": "https://yogasoul.it/wp-content/uploads/2025/08/Calendario-settembre-2025-2.jpg",
|
||||
"link_prenotazione": "https://yogasoul.it/lp-courses/videocorso-yoga-in-gravidanza/",
|
||||
"fonte": "https://yogasoul.it/lp-courses/videocorso-yoga-in-gravidanza/"
|
||||
}
|
||||
],
|
||||
"prenotazioni": {
|
||||
"metodo": "Prenota sui link specifici dei corsi su www.yogasoul.it/product/... tramite YOGIBook.",
|
||||
"pagamento": "Carta di credito (Stripe) o bonifico. Fatturazione automatica.",
|
||||
"cambio_lezione": "Cambio lezione entro 24h tramite YOGIBook. Pacchetti: 4 lezioni (1 recuperabile entro 5 settimane), 12 lezioni (3 recuperabili entro scadenza).",
|
||||
"cancellazione": "Cancellazioni entro 24h, no rimborsi parziali."
|
||||
},
|
||||
"contatti": {
|
||||
"email": "info@yogasoul.it",
|
||||
"telefono": "+39 353 4636941",
|
||||
"whatsapp": "+39 353 4636941",
|
||||
"indirizzo": "Via Valassina 62b, Seregno (MB), Italia",
|
||||
"social": {
|
||||
"facebook": "https://www.facebook.com/yogasoul.it/",
|
||||
"youtube": "https://www.youtube.com/@yogasoul6746",
|
||||
"instagram": "https://www.instagram.com/aura_yogasoul/"
|
||||
}
|
||||
},
|
||||
"faq": [
|
||||
{
|
||||
"domanda": "Quali sono gli orari di Aerial Yoga?",
|
||||
"risposta": "Aerial Yoga: martedì 18:15-19:15 (Intermedio), mercoledì 18:30-19:30 (Base/Mix), giovedì 19:15-20:15 (Base/Mix), venerdì 20:30-21:30 (Mix). Prova €5, costi da definire. Calendario: https://yogasoul.it/wp-content/uploads/2025/08/Calendario-settembre-2025-2.jpg"
|
||||
},
|
||||
{
|
||||
"domanda": "Quanto costa Hatha Yoga e quali sono i benefici?",
|
||||
"risposta": "Hatha Yoga: prova €5, costi da definire. Benefici: flessibilità, forza, riduzione stress. Orari: martedì 19:30-20:30, giovedì 18:00-19:00. Calendario: https://yogasoul.it/wp-content/uploads/2025/08/Calendario-settembre-2025-2.jpg"
|
||||
},
|
||||
{
|
||||
"domanda": "Yoga in Gravidanza è attivo? Quanto costa?",
|
||||
"risposta": "Sì, attivo su richiesta il sabato 9:30-10:30. Prova €5, costi da definire, videocorso €30. Calendario: https://yogasoul.it/wp-content/uploads/2025/08/Calendario-settembre-2025-2.jpg"
|
||||
},
|
||||
{
|
||||
"domanda": "Posso provare una lezione?",
|
||||
"risposta": "Sì, tutte le prove costano €5. Prenota qui: https://yogasoul.it/aerial-yoga-classi-di-prova-a-seregno-registrazione/"
|
||||
},
|
||||
{
|
||||
"domanda": "Come prenoto o cambio una lezione?",
|
||||
"risposta": "Prenota sui link dei corsi (es. https://yogasoul.it/product/hatha-yoga/) con YOGIBook. Pagamento Stripe o bonifico, cambi entro 24h."
|
||||
},
|
||||
{
|
||||
"domanda": "Chi sono gli insegnanti?",
|
||||
"risposta": "Hatha Yoga: Giorgia, Pilates Matwork: Barbara, altri corsi: Aurora Masiero."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
## Vanguard - Advanced PHP Login and User Management
|
||||
## YogiBook Aury
|
||||
|
||||
- Website: https://vanguardapp.io
|
||||
- Documentation: https://milos.support-hub.io
|
||||
- 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