final fixing order
This commit is contained in:
parent
3c8d8b9fab
commit
edc6bda47f
@ -1,20 +1,97 @@
|
|||||||
|
<?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';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 dell'aggiornamento della data di scadenza
|
||||||
|
if (isset($_POST['update_expiry'])) {
|
||||||
|
$order_id = $_POST['order_id'];
|
||||||
|
$new_expiry = $_POST['new_expiry'];
|
||||||
|
$stmt = $conn->prepare("UPDATE orderbook SET expireon = ? WHERE order_id = ?");
|
||||||
|
$stmt->bind_param("si", $new_expiry, $order_id);
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
$message = 'success';
|
||||||
|
} else {
|
||||||
|
$message = 'error';
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gestione del filtro per gli ordini
|
||||||
|
$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, o.nticket
|
||||||
|
FROM orderbook o
|
||||||
|
LEFT JOIN service s ON o.idservice = s.idservice
|
||||||
|
$whereClause
|
||||||
|
ORDER BY o.order_id 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>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>YogiBook - Riepilogo Ordini</title>
|
<title>YogiBook - Prenotazioni YogaSoul</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta content="YogiBook - Prenotazione facile YogaSOul" name="description" />
|
<meta content="YogiBook - Prenotazione facile YogaSOul" name="description" />
|
||||||
<meta content="Advanced Creative Solutions" name="author" />
|
<meta content="Advanced Creative Solutions" name="author" />
|
||||||
<!-- App favicon -->
|
|
||||||
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
<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" />
|
<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" />
|
<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 href="assets/css/app.min.css" id="app-style" rel="stylesheet" type="text/css" />
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
|
||||||
@ -23,7 +100,13 @@
|
|||||||
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
// Inizializzazione del Datepicker per i campi che verranno creati dinamicamente
|
// 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() {
|
$(document).on('focus', '.expiryDateInput', function() {
|
||||||
$(this).datepicker({
|
$(this).datepicker({
|
||||||
dateFormat: "yy-mm-dd",
|
dateFormat: "yy-mm-dd",
|
||||||
@ -35,15 +118,15 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Funzione per rendere il campo modificabile
|
// Rendere il campo scadenza editabile al click
|
||||||
$(document).on('click', '.expiry-date', function() {
|
$(document).on('click', '.expiry-date', function() {
|
||||||
let orderId = $(this).data('order-id');
|
let orderId = $(this).data('order-id');
|
||||||
let currentDate = $(this).text();
|
let currentDate = $(this).text().trim();
|
||||||
$(this).html(`<input type="text" class="form-control expiryDateInput" data-order-id="${orderId}" value="${currentDate}" />`);
|
$(this).html(`<input type="text" class="form-control expiryDateInput" data-order-id="${orderId}" value="${currentDate}" />`);
|
||||||
$(this).find('.expiryDateInput').focus();
|
$(this).find('.expiryDateInput').focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Funzione per confermare l'aggiornamento
|
// Funzione per confermare l'aggiornamento della scadenza
|
||||||
function confirmUpdate(orderId, newExpiry) {
|
function confirmUpdate(orderId, newExpiry) {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Sei sicuro?",
|
title: "Sei sicuro?",
|
||||||
@ -56,7 +139,6 @@
|
|||||||
cancelButtonText: "Annulla"
|
cancelButtonText: "Annulla"
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
// Crea un form nascosto per inviare i dati
|
|
||||||
let form = $('<form>', {
|
let form = $('<form>', {
|
||||||
'method': 'POST',
|
'method': 'POST',
|
||||||
'action': ''
|
'action': ''
|
||||||
@ -80,29 +162,29 @@
|
|||||||
$('body').append(form);
|
$('body').append(form);
|
||||||
form.submit();
|
form.submit();
|
||||||
} else {
|
} else {
|
||||||
// Ricarica la pagina per ripristinare il testo originale
|
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
function confirmDelete(id, deletePageUrl) {
|
// Funzione per confermare la cancellazione (mantenuta dal template originale)
|
||||||
Swal.fire({
|
function confirmDelete(id, deletePageUrl) {
|
||||||
title: "Sei sicuro?",
|
Swal.fire({
|
||||||
text: "Questa prenotazione verrà cancellata definitivamente! Ricordati poi di riprogrammare la tua lezione!",
|
title: "Sei sicuro?",
|
||||||
icon: "warning",
|
text: "Questa prenotazione verrà cancellata definitivamente! Ricordati poi di riprogrammare la tua lezione!",
|
||||||
showCancelButton: true,
|
icon: "warning",
|
||||||
confirmButtonColor: "#d33",
|
showCancelButton: true,
|
||||||
cancelButtonColor: "#3085d6",
|
confirmButtonColor: "#d33",
|
||||||
confirmButtonText: "Sì, cancella!",
|
cancelButtonColor: "#3085d6",
|
||||||
cancelButtonText: "Annulla"
|
confirmButtonText: "Sì, cancella!",
|
||||||
}).then((result) => {
|
cancelButtonText: "Annulla"
|
||||||
if (result.isConfirmed) {
|
}).then((result) => {
|
||||||
window.location.href = `deleteclass.php?id=${id}`;
|
if (result.isConfirmed) {
|
||||||
}
|
window.location.href = `deleteclass.php?id=${id}`;
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.custom-card {
|
.custom-card {
|
||||||
@ -213,30 +295,20 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<!-- Begin page -->
|
|
||||||
<div id="layout-wrapper">
|
<div id="layout-wrapper">
|
||||||
|
|
||||||
<!-- Top Bar -->
|
|
||||||
<header id="page-topbar" class="isvertical-topbar">
|
<header id="page-topbar" class="isvertical-topbar">
|
||||||
<div class="navbar-header">
|
<div class="navbar-header">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<!-- LOGO -->
|
|
||||||
<?php include('include/logoarea.php'); ?>
|
<?php include('include/logoarea.php'); ?>
|
||||||
|
|
||||||
<button type="button" class="btn btn-sm px-3 font-size-24 header-item waves-effect vertical-menu-btn">
|
<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>
|
<i class="bx bx-menu align-middle"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- start page title -->
|
|
||||||
<div class="page-title-box align-self-center d-none d-md-block">
|
<div class="page-title-box align-self-center d-none d-md-block">
|
||||||
<h4 class="page-title mb-0">Riepilogo Ordini</h4>
|
<h4 class="page-title mb-0">Riepilogo Ordini</h4>
|
||||||
</div>
|
</div>
|
||||||
<!-- end page title -->
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<?php include('include/languageselection.php'); ?>
|
<?php include('include/languageselection.php'); ?>
|
||||||
|
|
||||||
<div class="dropdown d-inline-block">
|
<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>
|
<i class="bx bx-search icon-sm align-middle"></i>
|
||||||
@ -252,13 +324,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php include('include/profiletopbar.php'); ?>
|
<?php include('include/profiletopbar.php'); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<?php include('include/sidebar.php'); ?>
|
<?php include('include/sidebar.php'); ?>
|
||||||
|
|
||||||
<header class="ishorizontal-topbar">
|
<header class="ishorizontal-topbar">
|
||||||
<div class="navbar-header">
|
<div class="navbar-header">
|
||||||
<div class="d-flex"></div>
|
<div class="d-flex"></div>
|
||||||
@ -270,7 +340,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<!-- Start right Content here -->
|
|
||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
@ -286,18 +355,85 @@
|
|||||||
<div class="alert alert-danger" role="alert">
|
<div class="alert alert-danger" role="alert">
|
||||||
Errore durante l'aggiornamento
|
Errore durante l'aggiornamento
|
||||||
</div>
|
</div>
|
||||||
|
<?php } elseif ($message == 'success_dayoff') { ?>
|
||||||
|
<div class="alert alert-success" role="alert">
|
||||||
|
DayOff inserito con successo
|
||||||
|
</div>
|
||||||
|
<?php } elseif ($message == 'error_dayoff') { ?>
|
||||||
|
<div class="alert alert-danger" role="alert">
|
||||||
|
Errore durante l'inserimento del DayOff
|
||||||
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
<h5>Benvenuta/o <?php echo $firstname; ?></h5>
|
||||||
|
<p>Giorni DayOff</p>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped mb-0">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Giorno Day Off</th>
|
||||||
|
<th>ACTION</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($documents as $document) { ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $document["dayoffdate"]; ?></td>
|
||||||
|
<td>
|
||||||
|
<form method="post" action="removedayoff.php?iddayoff=<?php echo $document["iddayoff"]; ?>">
|
||||||
|
<input type="hidden" name="date" value="<?php echo $document["dayoffdate"]; ?>">
|
||||||
|
<button type="submit" class="btn btn-danger">Rimuovi</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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">
|
||||||
|
<div class="pb-3 pb-xl-0">
|
||||||
|
<div class="position-relative">
|
||||||
|
<h3>Inserisci Dayoff</h3>
|
||||||
|
</div>
|
||||||
|
<form method="post" enctype="multipart/form-data">
|
||||||
|
<label for="dayoff">Data di Scadenza:</label>
|
||||||
|
<input type="text" id="dayoff" class="form-control datepicker" name="dayoff" required><br>
|
||||||
|
<input type="submit" class="btn btn-primary w-md" value="Inserisci" name="submit">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xl-9 col-md-12"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xl-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
<h5>Riepilogo Ordini (Amministratore)</h5>
|
<h5>Riepilogo Ordini (Amministratore)</h5>
|
||||||
<p>Tutti gli ordini registrati</p>
|
<p>Tutti gli ordini registrati</p>
|
||||||
|
|
||||||
<!-- Filtri -->
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<a href="?filter=all" class="btn btn-secondary <?php echo $filter == 'all' ? 'active' : ''; ?>">Tutti</a>
|
<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=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>
|
<a href="?filter=expired" class="btn btn-danger <?php echo $filter == 'expired' ? 'active' : ''; ?>">Scaduti</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped mb-0">
|
<table class="table table-striped mb-0">
|
||||||
<thead>
|
<thead>
|
||||||
@ -336,17 +472,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- container-fluid -->
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- End Page-content -->
|
|
||||||
<?php include('include/footer.php'); ?>
|
<?php include('include/footer.php'); ?>
|
||||||
</div>
|
</div>
|
||||||
<!-- end main content-->
|
|
||||||
</div>
|
</div>
|
||||||
<!-- END layout-wrapper -->
|
|
||||||
|
|
||||||
<!-- JAVASCRIPT -->
|
|
||||||
<script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></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/metismenujs/metismenujs.min.js"></script>
|
||||||
<script src="assets/libs/simplebar/simplebar.min.js"></script>
|
<script src="assets/libs/simplebar/simplebar.min.js"></script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user