464 lines
18 KiB
PHP
464 lines
18 KiB
PHP
<?php require_once('include/headscript.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);
|
|
$bookedclass->setQuery("SELECT * FROM bookingclass LEFT JOIN service on bookingclass.idservice=service.idservice LEFT JOIN serviceschedule ON bookingclass.idserviceschedule=serviceschedule.idserviceschedule WHERE bookingclass.iduser='1'");
|
|
$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) {
|
|
// Crea la connessione al database
|
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
|
|
|
// Verifica la connessione
|
|
if ($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
|
|
$iduserlogin = $_POST["iduserlogin"];
|
|
|
|
// Altre informazioni sul documento
|
|
$documentDescription = $_POST["documentDescription"];
|
|
$expiryDate = $_POST["expiryDate"];
|
|
$originalFileName = $_FILES["fileToUpload"]["name"];
|
|
$fileExtension = pathinfo($originalFileName, PATHINFO_EXTENSION);
|
|
$timestamp = time(); // Timestamp corrente
|
|
$newFileName = "{$timestamp}_{$originalFileName}"; // Aggiungi timestamp al nome del file
|
|
$fileTmpName = $_FILES["fileToUpload"]["tmp_name"];
|
|
$fileDestination = "user/document/" . $newFileName;
|
|
|
|
// 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')";
|
|
|
|
if ($conn->query($sql) === TRUE) {
|
|
echo "<script>var uploadStatus = 'success';</script>";
|
|
} else {
|
|
$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>";
|
|
}
|
|
} 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 = "Nessun file caricato o errore durante il caricamento.";
|
|
echo "<script>var errorMessage = '" . addslashes($error_message) . "';</script>";
|
|
echo "<script>var uploadStatus = 'no_file_error';</script>";
|
|
}
|
|
}
|
|
?>
|
|
|
|
<?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
|
|
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"];
|
|
}
|
|
}
|
|
|
|
$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
|
|
$query = "SELECT COUNT(*) AS total,
|
|
SUM(CASE WHEN serviceschedule.dateschedule <= '$currentDateTime' THEN 1 ELSE 0 END) AS passed,
|
|
SUM(CASE WHEN serviceschedule.dateschedule > '$currentDateTime' THEN 1 ELSE 0 END) AS future
|
|
FROM bookingclass
|
|
LEFT JOIN serviceschedule ON bookingclass.idserviceschedule = serviceschedule.idserviceschedule
|
|
WHERE bookingclass.iduser = $iduser";
|
|
|
|
$result = $conn->query($query);
|
|
if ($result) {
|
|
$row = $result->fetch_assoc();
|
|
$totalRecords = $row['total'];
|
|
$passedRecords = $row['passed'];
|
|
$futureRecords = $row['future'];
|
|
}
|
|
// Chiusura della connessione
|
|
$conn->close();
|
|
?>
|
|
<?php
|
|
// 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);
|
|
}
|
|
|
|
// Query per selezionare i dati filtrati per iduser
|
|
$query = "SELECT * FROM certificateuserprofile WHERE iduser = $iduserlogin";
|
|
$result = $conn->query($query);
|
|
|
|
// Array per memorizzare i risultati
|
|
$documents = array();
|
|
|
|
while ($row = $result->fetch_assoc()) {
|
|
$documents[] = $row;
|
|
}
|
|
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title>Starter Page | webadmin - Admin & Dashboard Template</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta content="Premium Multipurpose Admin & Dashboard Template" name="description" />
|
|
<meta content="Themesdesign" name="author" />
|
|
<!-- App favicon -->
|
|
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
|
|
|
<!-- Bootstrap Css -->
|
|
<link href="assets/css/bootstrap.min.css" id="bootstrap-style" rel="stylesheet" type="text/css" />
|
|
<!-- Icons Css -->
|
|
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
|
<!-- App Css-->
|
|
<link href="assets/css/app.min.css" id="app-style" rel="stylesheet" type="text/css" />
|
|
<link rel="stylesheet" href="https://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"
|
|
});
|
|
});
|
|
|
|
// 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 === 'no_file_error') {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Errore',
|
|
text: errorMessage || 'Si è verificato un errore sconosciuto.',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
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;
|
|
}
|
|
|
|
@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>
|
|
<!-- Begin page -->
|
|
<div id="layout-wrapper">
|
|
|
|
<!-- Top Bar -->
|
|
<header id="page-topbar" class="isvertical-topbar">
|
|
<div class="navbar-header">
|
|
<div class="d-flex">
|
|
<!-- LOGO -->
|
|
<?php include('include/logoarea.php'); ?>
|
|
|
|
<button type="button" class="btn btn-sm px-3 font-size-24 header-item waves-effect vertical-menu-btn">
|
|
<i class="bx bx-menu align-middle"></i>
|
|
</button>
|
|
|
|
<!-- start page title -->
|
|
<div class="page-title-box align-self-center d-none d-md-block">
|
|
<h4 class="page-title mb-0">Prenotazione Classi</h4>
|
|
</div>
|
|
<!-- end page title -->
|
|
</div>
|
|
|
|
<div class="d-flex">
|
|
<?php include('include/languageselection.php'); ?>
|
|
<?php include('include/profiletopbar.php'); ?>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<?php include('include/sidebar.php'); ?>
|
|
|
|
<header class="ishorizontal-topbar">
|
|
<div class="navbar-header">
|
|
<div class="d-flex"></div>
|
|
</div>
|
|
|
|
<div class="topnav">
|
|
<div class="container-fluid">
|
|
<nav class="navbar navbar-light navbar-expand-lg topnav-menu"></nav>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- ============================================================== -->
|
|
<!-- Start right Content here -->
|
|
<!-- ============================================================== -->
|
|
<div class="main-content">
|
|
<div class="page-content">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-xl-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h5>Benvenuta/o <?php echo $firstname; ?> </h5>
|
|
<p>Di seguito puoi visualizzare o caricare i certificati medici di liberatoria alla pratica Yoga</p>
|
|
<div class="table-responsive">
|
|
<table class="table table-striped mb-0">
|
|
<thead>
|
|
<tr>
|
|
<th>Descrizione del Documento</th>
|
|
<th>Data di Scadenza</th>
|
|
<th>Documento</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($documents as $document) { ?>
|
|
<tr>
|
|
<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>
|
|
</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>
|
|
<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>
|
|
<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>
|
|
</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>
|