386 lines
20 KiB
PHP
386 lines
20 KiB
PHP
<?php require_once('include/headscript.php'); ?>
|
|
<?php
|
|
$conn = mysqli_connect($servername, $username, $password, $dbname);
|
|
// Verifica la connessione
|
|
if (!$conn) {
|
|
die("Connessione al database fallita: " . mysqli_connect_error());
|
|
}
|
|
// Query SQL per ottenere le informazioni desiderate
|
|
$sql = "SELECT * from orderbook WHERE orderbook.status ='pending'";
|
|
$result = mysqli_query($conn, $sql);
|
|
// Verifica se la query ha restituito risultati
|
|
if (!$result) {
|
|
die("Errore nella query: " . mysqli_error($conn));
|
|
}
|
|
?>
|
|
<!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" />
|
|
<!-- 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() {
|
|
$("#example-date-input, #first-lesson-date").datepicker({
|
|
dateFormat: "yy-mm-dd",
|
|
minDate: 0
|
|
});
|
|
});
|
|
</script>
|
|
<script>
|
|
$(document).ready(function() {
|
|
console.log("Script loaded and running!");
|
|
$(".surname").on("input", function() {
|
|
var searchTerm = $(this).val();
|
|
var currentForm = $(this).closest('form');
|
|
if (searchTerm.length >= 2) {
|
|
$.ajax({
|
|
url: "search_users.php",
|
|
method: "POST",
|
|
data: {
|
|
searchTerm: searchTerm
|
|
},
|
|
dataType: "json",
|
|
success: function(data) {
|
|
var results = data.results;
|
|
currentForm.next('.search-results').empty();
|
|
if (results.length > 0) {
|
|
currentForm.next('.search-results').append("<p>Seleziona un utente:</p>");
|
|
for (var i = 0; i < results.length; i++) {
|
|
var user = results[i];
|
|
currentForm.next('.search-results').append(
|
|
'<div class="user-result" data-email="' + user.email + '" data-userid="' + user.userid + '" data-firstname="' + user.first_name + '" data-lastname="' + user.last_name + '">' +
|
|
'Email: ' + user.email + ' | Nome: ' + user.first_name + ' | Cognome: ' + user.last_name +
|
|
'</div>'
|
|
);
|
|
}
|
|
currentForm.next('.search-results').on('click', '.user-result', function() {
|
|
var selectedEmail = $(this).data("email");
|
|
var selectedUserId = $(this).data("userid");
|
|
var selectedFirstName = $(this).data("firstname");
|
|
var selectedLastName = $(this).data("lastname");
|
|
console.log("Email:", selectedEmail);
|
|
console.log("User ID:", selectedUserId);
|
|
console.log("First Name:", selectedFirstName);
|
|
console.log("Last Name:", selectedLastName);
|
|
currentForm.find(".email").val(selectedEmail);
|
|
currentForm.find(".userid").val(selectedUserId);
|
|
currentForm.find(".name").val(selectedFirstName);
|
|
currentForm.find(".surname").val(selectedLastName);
|
|
$("#userid").val(selectedUserId);
|
|
});
|
|
}
|
|
}
|
|
});
|
|
} else {
|
|
currentForm.next('.search-results').empty();
|
|
}
|
|
});
|
|
});
|
|
</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>
|
|
<div id="layout-wrapper">
|
|
<header id="page-topbar" class="isvertical-topbar">
|
|
<div class="navbar-header">
|
|
<div class="d-flex">
|
|
<?php include('include/logoarea.php'); ?>
|
|
<button type="button" class="btn btn-sm px-3 font-size-24 header-item waves-effect vertical-menu-btn">
|
|
<i class="bx bx-menu align-middle"></i>
|
|
</button>
|
|
<div class="page-title-box align-self-center d-none d-md-block">
|
|
<h4 class="page-title mb-0">Prenotazione Classi</h4>
|
|
</div>
|
|
</div>
|
|
<div 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="card">
|
|
<div class="card-body">
|
|
<h5>Benvenuta/o <?php echo $firstname; ?> </h5>
|
|
<p>Ordini Pending</p>
|
|
<div class="table-responsive">
|
|
<table class="table table-striped mb-0">
|
|
<thead>
|
|
<tr>
|
|
<th>ID Ordine</th>
|
|
<th>Data</th>
|
|
<th>Utente</th>
|
|
<th>Iduser</th>
|
|
<th>Class</th>
|
|
<th>Quantità</th>
|
|
<th>Propaga</th>
|
|
<th>Cancella</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
echo "<tr>";
|
|
echo "<td>" . $row['order_id'] . "</td>";
|
|
echo "<td>" . $row['order_date_created'] . "</td>";
|
|
echo "<td>" . $row['first_name'] . " " . $row['last_name'] . "</td>";
|
|
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>" . "<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>";
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-xl-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h5>Inserisci nuovo Ordine</h5>
|
|
<form action="inserisci_ordine.php" method="post">
|
|
<div class="row">
|
|
<div class="col-md-6 mb-3">
|
|
<label for="formrow-firstname-input" class="form-label">Enter First Name</label>
|
|
<input type="text" class="form-control name" placeholder="First Name" id="formrow-firstname-input" name="formrow-firstname-input">
|
|
</div>
|
|
<div class="col-md-6 mb-3">
|
|
<label for="surname-input" class="form-label">Cognome</label>
|
|
<input list="users-suggestions" type="text" class="form-control surname" placeholder="Last Name" id="surname-input" name="surname-input">
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label for="formrow-email-input" class="form-label">Enter Email</label>
|
|
<input type="email" class="form-control email" placeholder="Email" id="formrow-email-input" name="formrow-email-input">
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label for="example-date-input" class="form-label">Data Ordine</label>
|
|
<input class="form-control" type="date" value="" id="example-date-input" name="example-date-input">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label for="first-lesson-date" class="form-label">Data Prima Lezione</label>
|
|
<input class="form-control" type="date" value="" id="first-lesson-date" name="first-lesson-date">
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-4">
|
|
<div class="mb-3">
|
|
<label for="ticket" class="form-label">N. Ticket</label>
|
|
<input type="text" class="form-control" placeholder="Ticket" id="ticket" name="ticket">
|
|
<input type="text" name="userid" id="userid" value="" />
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-4">
|
|
<div class="mb-3">
|
|
<label for="formrow-inputState" class="form-label">Classe</label>
|
|
<select id="formrow-inputState" name="formrow-inputState" class="form-select">
|
|
<?php
|
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
|
if ($conn->connect_error) {
|
|
die("Connection failed: " . $conn->connect_error);
|
|
}
|
|
$sql = "SELECT idservice, servicename, day, time FROM service ORDER BY servicename";
|
|
$result = $conn->query($sql);
|
|
echo '<option selected="">Choose...</option>';
|
|
if ($result->num_rows > 0) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$label = $row['servicename'] . ' - ' . $row['day'] . ' - ' . $row['time'];
|
|
$value = $row['idservice'];
|
|
echo "<option value='$value'>$label</option>";
|
|
}
|
|
} else {
|
|
echo '<option>No services available</option>';
|
|
}
|
|
$conn->close();
|
|
?>
|
|
</select>
|
|
<input type="hidden" name="cod" id="hiddenCod">
|
|
</div>
|
|
<script>
|
|
const selectElem = document.getElementById('formrow-inputState');
|
|
const hiddenElem = document.getElementById('hiddenCod');
|
|
selectElem.addEventListener('change', function() {
|
|
hiddenElem.value = selectElem.options[selectElem.selectedIndex].text;
|
|
});
|
|
</script>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<button type="submit" class="btn btn-primary w-md">Submit</button>
|
|
</div>
|
|
</form>
|
|
<div class="search-results"></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>
|