642 lines
38 KiB
PHP
642 lines
38 KiB
PHP
<?php include('include/headscriptnologin.php'); ?>
|
||
<?php include('include/generalsettings.php'); ?>
|
||
<?php
|
||
if (session_status() === PHP_SESSION_NONE) {
|
||
session_start();
|
||
}
|
||
|
||
|
||
// Definisci il tempo di scadenza in secondi (20 minuti)
|
||
$expire_time = 20 * 60; // 20 minuti in secondi
|
||
$now = time();
|
||
|
||
if (isset($_SESSION['cart_start_time'])) {
|
||
$time_elapsed = $now - $_SESSION['cart_start_time'];
|
||
$time_remaining = max(0, $expire_time - $time_elapsed);
|
||
|
||
// Debug: Stampa i valori di sessione e tempo
|
||
echo "<script>console.log('Session start time: {$_SESSION['cart_start_time']}');</script>";
|
||
echo "<script>console.log('Current time (now): {$now}');</script>";
|
||
echo "<script>console.log('Time elapsed: {$time_elapsed}');</script>";
|
||
echo "<script>console.log('Time remaining: {$time_remaining}');</script>";
|
||
|
||
// Se il tempo è scaduto, svuota il carrello
|
||
if ($time_remaining <= 0) {
|
||
unset($_SESSION['cart']);
|
||
unset($_SESSION['cart_start_time']);
|
||
echo "<p>Il carrello è scaduto. Ricarica la pagina o aggiungi nuovamente gli articoli.</p>";
|
||
exit;
|
||
}
|
||
} else {
|
||
$time_remaining = 0;
|
||
// Debug: Segnala che il tempo non è stato inizializzato
|
||
echo "<script>console.log('Cart start time non settato.');</script>";
|
||
}
|
||
?>
|
||
|
||
<!doctype html>
|
||
<html lang="en">
|
||
|
||
<head>
|
||
<!-- Required meta tags -->
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<link rel="shortcut icon" href="assets/images/favicon.png">
|
||
<?php include('include/seo.php'); ?>
|
||
<?php include('stylesheet.php'); ?>
|
||
<!-- Fancybox CSS -->
|
||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css">
|
||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||
<!-- Fancybox JS -->
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js"></script>
|
||
|
||
</head>
|
||
|
||
<body>
|
||
<style>
|
||
.popover {
|
||
background-color: #000 !important;
|
||
color: #fff !important;
|
||
border: none !important;
|
||
}
|
||
|
||
.popover-body {
|
||
color: #fff !important;
|
||
}
|
||
|
||
.popover-arrow::before {
|
||
border-top-color: #000 !important;
|
||
}
|
||
</style>
|
||
<!-- start navbar -->
|
||
<?php include('include/navbar.php'); ?>
|
||
<!-- end /. navbar -->
|
||
<!-- start details header -->
|
||
<div class="py-4">
|
||
<div class="container">
|
||
<div class="justify-content-between row align-items-center g-4">
|
||
<div class="col-lg col-xxl-8">
|
||
<h1 class="h2 page-header-title fw-semibold"><?php echo $carttitle; ?></h1>
|
||
<ul class="list-inline list-separator d-flex align-items-center mb-2">
|
||
<?php
|
||
if (isset($_GET['expired']) && $_GET['expired'] == 'true') {
|
||
unset($_SESSION['cart']);
|
||
echo '<div class="alert alert-warning" role="alert">Tempo scaduto, il carrello è stato svuotato.</div>';
|
||
}
|
||
?>
|
||
|
||
</ul>
|
||
|
||
</div>
|
||
<div class="col-lg-auto">
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- end /. details header -->
|
||
<div class="body-content">
|
||
<div class="decoration blur-2"></div>
|
||
<div class="decoration blur-3"></div>
|
||
<div class="container-xxl">
|
||
<div class="card">
|
||
<div class="card-header position-relative">
|
||
<div class="d-flex justify-content-between align-items-center flex-wrap">
|
||
<div>
|
||
<h6 class="fs-17 fw-semi-bold my-1"><?php echo $carttitle; ?></h6>
|
||
<p class="mb-0"><?php echo $cartinstructions; ?></p>
|
||
</div>
|
||
<script>
|
||
var timeRemaining = <?php echo $time_remaining; ?>;
|
||
|
||
function startCountdown() {
|
||
var countdownElement = document.getElementById('countdown');
|
||
var timer = setInterval(function() {
|
||
if (timeRemaining <= 0) {
|
||
clearInterval(timer);
|
||
window.location.href = window.location.pathname + "?expired=true"; // Ricarica la pagina con il parametro expired
|
||
} else {
|
||
var minutes = Math.floor(timeRemaining / 60);
|
||
var seconds = timeRemaining % 60;
|
||
countdownElement.innerHTML = minutes + "m " + seconds + "s";
|
||
timeRemaining--;
|
||
}
|
||
}, 1000);
|
||
}
|
||
|
||
window.onload = startCountdown;
|
||
</script>
|
||
|
||
<p>Tempo rimanente per completare l'acquisto: <span id="countdown"></span></p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="card-body">
|
||
<div class="table-responsive">
|
||
<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer">
|
||
|
||
<div class="row">
|
||
<div class="col-sm-12">
|
||
<?php
|
||
if (session_status() == PHP_SESSION_NONE) {
|
||
session_start();
|
||
}
|
||
|
||
// Check if the cart is empty
|
||
if (!isset($_SESSION['cart']) || empty($_SESSION['cart'])) {
|
||
echo "<p>Your cart is empty.</p>";
|
||
exit;
|
||
}
|
||
|
||
$cart_items = $_SESSION['cart'];
|
||
$conn = new mysqli($servername, $username, $password, $database);
|
||
|
||
if ($conn->connect_error) {
|
||
die("Connection failed: " . $conn->connect_error);
|
||
}
|
||
|
||
echo '<table class="table table-striped table-borderless category-list dataTable no-footer" id="DataTables_Table_0">';
|
||
echo '<thead>
|
||
<tr>
|
||
<th>' . $code . '</th>
|
||
<th>' . $imageprod . '</th>
|
||
<th>' . $product . '</th>
|
||
<th>' . $schoolname . '</th>
|
||
<th>' . $date . '</th>
|
||
<th>' . $time . '</th>
|
||
<th>' . $quantity . '</th>
|
||
<th>' . $price . '</th>
|
||
<th>Action</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>';
|
||
|
||
$totalCost = 0;
|
||
|
||
foreach ($cart_items as $idschedule => $cart_item) {
|
||
$quantity = $cart_item['quantity'];
|
||
|
||
$query = "
|
||
SELECT
|
||
yogaclass.productcode,
|
||
yogaclass.imgyogaclass,
|
||
yogaclass.nameyogaclass,
|
||
yogaschool.nameschool,
|
||
yogaschool.address,
|
||
yogaschool.zip,
|
||
yogaschool.city,
|
||
yogaschool.country,
|
||
schedule.dateschedule,
|
||
schedule.timeschedule,
|
||
schedule.cost
|
||
FROM schedule
|
||
LEFT JOIN yogaclass ON schedule.idyogaclass = yogaclass.idyogaclass
|
||
LEFT JOIN yogaschool ON yogaclass.idyogaschool = yogaschool.idyogaschool
|
||
WHERE schedule.idschedule = ?
|
||
";
|
||
|
||
$stmt = $conn->prepare($query);
|
||
$stmt->bind_param("i", $idschedule);
|
||
$stmt->execute();
|
||
$result = $stmt->get_result();
|
||
|
||
if ($row = $result->fetch_assoc()) {
|
||
$date = new DateTime($row['dateschedule']);
|
||
$formattedDate = $date->format('d F Y');
|
||
$time = new DateTime($row['timeschedule']);
|
||
$formattedTime = $time->format('H:i');
|
||
$price = floatval($row['cost']);
|
||
$totalItemCost = $price * $quantity;
|
||
$totalCost += $totalItemCost;
|
||
|
||
echo '<tr>';
|
||
echo '<td>' . htmlspecialchars($row['productcode']) . '</td>';
|
||
echo '<td><img src="uploadclass/' . htmlspecialchars($row['imgyogaclass']) . '" alt="Image" style="width: 100px;"></td>';
|
||
echo '<td>' . htmlspecialchars($row['nameyogaclass']) . '</td>';
|
||
echo '<td>
|
||
<a href="#" tabindex="0" class="school-popover" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="top" data-bs-html="true"
|
||
data-bs-content="' . htmlspecialchars($row['address']) . ', ' . htmlspecialchars($row['zip']) . ' ' . htmlspecialchars($row['city']) . ', ' . htmlspecialchars($row['country']) . '">
|
||
' . htmlspecialchars($row['nameschool']) . '
|
||
</a>
|
||
</td>';
|
||
|
||
|
||
echo '<td>' . htmlspecialchars($formattedDate) . '</td>';
|
||
echo '<td>' . htmlspecialchars($formattedTime) . '</td>';
|
||
echo '<td>
|
||
<input type="number" class="form-control" value="' . htmlspecialchars($quantity) . '" min="1" max="3" data-idschedule="' . $idschedule . '" onchange="updateQuantity(this)">
|
||
</td>';
|
||
echo '<td>€' . number_format($totalItemCost, 2) . '</td>';
|
||
echo '<td>
|
||
<button class="btn btn-danger" onclick="removeFromCart(' . $idschedule . ')">
|
||
<i class="fa-solid fa-trash"></i>
|
||
</button>
|
||
</td>';
|
||
echo '</tr>';
|
||
}
|
||
|
||
$stmt->close();
|
||
}
|
||
|
||
echo '<tr>';
|
||
echo '<td colspan="7" class="text-end"><strong>Total</strong></td>';
|
||
echo '<td><strong>€' . number_format($totalCost, 2) . '</strong></td>';
|
||
echo '<td></td>';
|
||
echo '</tr>';
|
||
echo '</tbody></table>';
|
||
|
||
$conn->close();
|
||
?>
|
||
|
||
<script>
|
||
function updateQuantity(input) {
|
||
var quantity = input.value;
|
||
var idschedule = input.getAttribute('data-idschedule');
|
||
|
||
$.ajax({
|
||
url: 'update_cart.php',
|
||
type: 'POST',
|
||
data: {
|
||
id_schedule: idschedule,
|
||
quantity: quantity
|
||
},
|
||
dataType: 'json',
|
||
success: function(response) {
|
||
if (response.status === 'success') {
|
||
Swal.fire({
|
||
title: 'Success!',
|
||
text: response.message,
|
||
icon: 'success',
|
||
confirmButtonText: 'OK'
|
||
}).then(() => {
|
||
location.reload(); // Refresh the page to update the cart view
|
||
});
|
||
} else {
|
||
Swal.fire({
|
||
title: 'Error!',
|
||
text: response.message,
|
||
icon: 'error',
|
||
confirmButtonText: 'OK'
|
||
});
|
||
}
|
||
},
|
||
error: function(xhr, status, error) {
|
||
Swal.fire({
|
||
title: 'Error!',
|
||
text: 'An error occurred while updating the cart.',
|
||
icon: 'error',
|
||
confirmButtonText: 'OK'
|
||
});
|
||
}
|
||
});
|
||
}
|
||
|
||
|
||
function removeFromCart(idschedule) {
|
||
Swal.fire({
|
||
title: 'Are you sure?',
|
||
text: "Do you want to remove this item from your cart?",
|
||
icon: 'warning',
|
||
showCancelButton: true,
|
||
confirmButtonText: 'Yes, remove it!',
|
||
cancelButtonText: 'Cancel'
|
||
}).then((result) => {
|
||
if (result.isConfirmed) {
|
||
$.ajax({
|
||
url: 'remove_from_cart.php',
|
||
type: 'POST',
|
||
data: {
|
||
id_schedule: idschedule
|
||
},
|
||
dataType: 'json',
|
||
success: function(response) {
|
||
if (response.status === 'success') {
|
||
Swal.fire({
|
||
title: 'Removed!',
|
||
text: response.message,
|
||
icon: 'success',
|
||
confirmButtonText: 'OK'
|
||
}).then(() => {
|
||
location.reload(); // Refresh the page to update the cart view
|
||
});
|
||
} else {
|
||
Swal.fire({
|
||
title: 'Error!',
|
||
text: response.message,
|
||
icon: 'error',
|
||
confirmButtonText: 'OK'
|
||
});
|
||
}
|
||
},
|
||
error: function(xhr, status, error) {
|
||
Swal.fire({
|
||
title: 'Error!',
|
||
text: 'An error occurred while removing the item.',
|
||
icon: 'error',
|
||
confirmButtonText: 'OK'
|
||
});
|
||
}
|
||
});
|
||
}
|
||
});
|
||
}
|
||
|
||
|
||
$(document).ready(function() {
|
||
$('.school-info').hover(function() {
|
||
var address = $(this).data('address');
|
||
$(this).attr('title', address);
|
||
});
|
||
});
|
||
$(document).ready(function() {
|
||
$('.school-popover').popover({
|
||
trigger: 'hover',
|
||
container: 'body',
|
||
placement: 'top',
|
||
html: true
|
||
});
|
||
});
|
||
</script>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="row">
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- start listings carousel -->
|
||
<div class="py-5 position-relative overflow-hidden">
|
||
<div class="container py-4">
|
||
<div class="row justify-content-center">
|
||
<div class="col-sm-10 col-md-10 col-lg-8 col-xl-7">
|
||
<!-- start section header -->
|
||
<div class="section-header text-center mb-5" data-aos="fade-down">
|
||
<!-- start subtitle -->
|
||
<div class="d-inline-block font-caveat fs-1 fw-medium section-header__subtitle text-capitalize text-primary">Similar Listings</div>
|
||
<!-- end /. subtitle -->
|
||
<!-- start title -->
|
||
<h2 class="display-5 fw-semibold mb-3 section-header__title text-capitalize">Similar Listings you may like</h2>
|
||
<!-- end /. title -->
|
||
<!-- start description -->
|
||
<div class="sub-title fs-16">Discover exciting categories. <span class="text-primary fw-semibold">Find what you’re looking for.</span></div>
|
||
<!-- end /. description -->
|
||
</div>
|
||
<!-- end /. section header -->
|
||
</div>
|
||
</div>
|
||
<div class="listings-carousel owl-carousel owl-theme owl-nav-bottom">
|
||
<!-- start listing card -->
|
||
<div class="card rounded-3 w-100 flex-fill overflow-hidden">
|
||
<!-- start card link -->
|
||
<a href="listing-details.html" class="stretched-link"></a>
|
||
<!-- end /. card link -->
|
||
<!-- start card image wrap -->
|
||
<div class="card-img-wrap card-image-hover overflow-hidden">
|
||
<img src="assets/images/place/01.jpg" alt="" class="img-fluid">
|
||
<div class="bg-primary card-badge d-inline-block text-white position-absolute">10% OFF</div>
|
||
<div class="bg-primary card-badge d-inline-block text-white position-absolute">$100 off $399: eblwc</div>
|
||
<div class="d-flex end-0 gap-2 me-3 mt-3 position-absolute top-0 z-1">
|
||
<a href="" class="btn-icon shadow-sm d-flex align-items-center justify-content-center text-primary bg-light rounded-circle" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Bookmark">
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-heart" viewBox="0 0 16 16">
|
||
<path d="m8 2.748-.717-.737C5.6.281 2.514.878 1.4 3.053c-.523 1.023-.641 2.5.314 4.385.92 1.815 2.834 3.989 6.286 6.357 3.452-2.368 5.365-4.542 6.286-6.357.955-1.886.838-3.362.314-4.385C13.486.878 10.4.28 8.717 2.01L8 2.748zM8 15C-7.333 4.868 3.279-3.04 7.824 1.143c.06.055.119.112.176.171a3.12 3.12 0 0 1 .176-.17C12.72-3.042 23.333 4.867 8 15z"></path>
|
||
</svg>
|
||
</a>
|
||
<a href="" class="btn-icon shadow-sm d-flex align-items-center justify-content-center text-primary bg-light rounded-circle" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Quick View">
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16">
|
||
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"></path>
|
||
</svg>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
<!-- end /. card image wrap -->
|
||
<div class="d-flex flex-column h-100 position-relative p-4">
|
||
<div class="align-items-center bg-primary cat-icon d-flex justify-content-center position-absolute rounded-circle text-white"><i class="fa-solid fa-shop"></i></div>
|
||
<div class="align-items-center d-flex flex-wrap gap-1 text-primary card-start">
|
||
<!-- start ratings -->
|
||
<i class="fa-solid fa-star"></i>
|
||
<!-- end /. ratings -->
|
||
<!-- start ratings counter text -->
|
||
<span class="fw-medium text-primary"><span class="fs-5 fw-semibold me-1">(4.5)</span>2,391 reviews</span>
|
||
<!-- end /. ratings counter text -->
|
||
</div>
|
||
<!-- start card title -->
|
||
<h4 class="fs-5 fw-semibold mb-0">Green Mart Apartment</h4>
|
||
<!-- end /. card title -->
|
||
</div>
|
||
</div>
|
||
<!-- end /. listing card -->
|
||
<!-- start listing card -->
|
||
<div class="card rounded-3 w-100 flex-fill overflow-hidden">
|
||
<!-- start card link -->
|
||
<a href="listing-details.html" class="stretched-link"></a>
|
||
<!-- end /. card link -->
|
||
<!-- start card image wrap -->
|
||
<div class="card-img-wrap card-image-hover overflow-hidden">
|
||
<img src="assets/images/place/02.jpg" alt="" class="img-fluid">
|
||
<div class="bg-primary card-badge d-inline-block text-white position-absolute">10% OFF</div>
|
||
<div class="bg-primary card-badge d-inline-block text-white position-absolute">$100 off $399: eblwc</div>
|
||
<div class="d-flex end-0 gap-2 me-3 mt-3 position-absolute top-0 z-1">
|
||
<a href="" class="btn-icon shadow-sm d-flex align-items-center justify-content-center text-primary bg-light rounded-circle" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Bookmark">
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-heart" viewBox="0 0 16 16">
|
||
<path d="m8 2.748-.717-.737C5.6.281 2.514.878 1.4 3.053c-.523 1.023-.641 2.5.314 4.385.92 1.815 2.834 3.989 6.286 6.357 3.452-2.368 5.365-4.542 6.286-6.357.955-1.886.838-3.362.314-4.385C13.486.878 10.4.28 8.717 2.01L8 2.748zM8 15C-7.333 4.868 3.279-3.04 7.824 1.143c.06.055.119.112.176.171a3.12 3.12 0 0 1 .176-.17C12.72-3.042 23.333 4.867 8 15z"></path>
|
||
</svg>
|
||
</a>
|
||
<a href="" class="btn-icon shadow-sm d-flex align-items-center justify-content-center text-primary bg-light rounded-circle" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Quick View">
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16">
|
||
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"></path>
|
||
</svg>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
<!-- end /. card image wrap -->
|
||
<div class="d-flex flex-column h-100 position-relative p-4">
|
||
<div class="align-items-center bg-primary cat-icon d-flex justify-content-center position-absolute rounded-circle text-white"><i class="fa-solid fa-utensils"></i></div>
|
||
<div class="align-items-center d-flex flex-wrap gap-1 text-primary card-start">
|
||
<!-- start ratings -->
|
||
<i class="fa-solid fa-star"></i>
|
||
<!-- end /. ratings -->
|
||
<!-- start ratings counter text -->
|
||
<span class="fw-medium text-primary"><span class="fs-5 fw-semibold me-1">(4.5)</span>2,391 reviews</span>
|
||
<!-- end /. ratings counter text -->
|
||
</div>
|
||
<!-- start card title -->
|
||
<h4 class="fs-5 fw-semibold mb-0">Chuijhal Hotel And Restaurant</h4>
|
||
<!-- end /. card title -->
|
||
</div>
|
||
</div>
|
||
<!-- end /. listing card -->
|
||
<!-- start listing card -->
|
||
<div class="card rounded-3 w-100 flex-fill overflow-hidden">
|
||
<!-- start card link -->
|
||
<a href="listing-details.html" class="stretched-link"></a>
|
||
<!-- end /. card link -->
|
||
<!-- start card image wrap -->
|
||
<div class="card-img-wrap card-image-hover overflow-hidden">
|
||
<img src="assets/images/place/03.jpg" alt="" class="img-fluid">
|
||
<div class="bg-primary card-badge d-inline-block text-white position-absolute">10% OFF</div>
|
||
<div class="bg-primary card-badge d-inline-block text-white position-absolute">$100 off $399: eblwc</div>
|
||
<div class="d-flex end-0 gap-2 me-3 mt-3 position-absolute top-0 z-1">
|
||
<a href="" class="btn-icon shadow-sm d-flex align-items-center justify-content-center text-primary bg-light rounded-circle" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Bookmark">
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-heart" viewBox="0 0 16 16">
|
||
<path d="m8 2.748-.717-.737C5.6.281 2.514.878 1.4 3.053c-.523 1.023-.641 2.5.314 4.385.92 1.815 2.834 3.989 6.286 6.357 3.452-2.368 5.365-4.542 6.286-6.357.955-1.886.838-3.362.314-4.385C13.486.878 10.4.28 8.717 2.01L8 2.748zM8 15C-7.333 4.868 3.279-3.04 7.824 1.143c.06.055.119.112.176.171a3.12 3.12 0 0 1 .176-.17C12.72-3.042 23.333 4.867 8 15z"></path>
|
||
</svg>
|
||
</a>
|
||
<a href="" class="btn-icon shadow-sm d-flex align-items-center justify-content-center text-primary bg-light rounded-circle" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Quick View">
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16">
|
||
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"></path>
|
||
</svg>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
<!-- end /. card image wrap -->
|
||
<div class="d-flex flex-column h-100 position-relative p-4">
|
||
<div class="align-items-center bg-primary cat-icon d-flex justify-content-center position-absolute rounded-circle text-white"><i class="fa-solid fa-ethernet"></i></div>
|
||
<div class="align-items-center d-flex flex-wrap gap-1 text-primary card-start">
|
||
<!-- start ratings -->
|
||
<i class="fa-solid fa-star"></i>
|
||
<!-- end /. ratings -->
|
||
<!-- start ratings counter text -->
|
||
<span class="fw-medium text-primary"><span class="fs-5 fw-semibold me-1">(4.5)</span>2,391 reviews</span>
|
||
<!-- end /. ratings counter text -->
|
||
</div>
|
||
<!-- start card title -->
|
||
<h4 class="fs-5 fw-semibold mb-0">The Barber's Lounge</h4>
|
||
<!-- end /. card title -->
|
||
</div>
|
||
</div>
|
||
<!-- end /. listing card -->
|
||
<!-- start listing card -->
|
||
<div class="card rounded-3 w-100 flex-fill overflow-hidden">
|
||
<!-- start card link -->
|
||
<a href="listing-details.html" class="stretched-link"></a>
|
||
<!-- end /. card link -->
|
||
<!-- start card image wrap -->
|
||
<div class="card-img-wrap card-image-hover overflow-hidden">
|
||
<img src="assets/images/place/04.jpg" alt="" class="img-fluid">
|
||
<div class="bg-primary card-badge d-inline-block text-white position-absolute">10% OFF</div>
|
||
<div class="bg-primary card-badge d-inline-block text-white position-absolute">$100 off $399: eblwc</div>
|
||
<div class="d-flex end-0 gap-2 me-3 mt-3 position-absolute top-0 z-1">
|
||
<a href="" class="btn-icon shadow-sm d-flex align-items-center justify-content-center text-primary bg-light rounded-circle" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Bookmark">
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-heart" viewBox="0 0 16 16">
|
||
<path d="m8 2.748-.717-.737C5.6.281 2.514.878 1.4 3.053c-.523 1.023-.641 2.5.314 4.385.92 1.815 2.834 3.989 6.286 6.357 3.452-2.368 5.365-4.542 6.286-6.357.955-1.886.838-3.362.314-4.385C13.486.878 10.4.28 8.717 2.01L8 2.748zM8 15C-7.333 4.868 3.279-3.04 7.824 1.143c.06.055.119.112.176.171a3.12 3.12 0 0 1 .176-.17C12.72-3.042 23.333 4.867 8 15z"></path>
|
||
</svg>
|
||
</a>
|
||
<a href="" class="btn-icon shadow-sm d-flex align-items-center justify-content-center text-primary bg-light rounded-circle" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Quick View">
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16">
|
||
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"></path>
|
||
</svg>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
<!-- end /. card image wrap -->
|
||
<div class="d-flex flex-column h-100 position-relative p-4">
|
||
<div class="align-items-center bg-primary cat-icon d-flex justify-content-center position-absolute rounded-circle text-white"><i class="fa-solid fa-gamepad"></i></div>
|
||
<div class="align-items-center d-flex flex-wrap gap-1 text-primary card-start">
|
||
<!-- start ratings -->
|
||
<i class="fa-solid fa-star"></i>
|
||
<!-- end /. ratings -->
|
||
<!-- start ratings counter text -->
|
||
<span class="fw-medium text-primary"><span class="fs-5 fw-semibold me-1">(4.5)</span>2,391 reviews</span>
|
||
<!-- end /. ratings counter text -->
|
||
</div>
|
||
<!-- start card title -->
|
||
<h4 class="fs-5 fw-semibold mb-0">Gaming Expo Spectacle</h4>
|
||
<!-- end /. card title -->
|
||
</div>
|
||
</div>
|
||
<!-- end /. listing card -->
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- end /. listings carousel -->
|
||
<!-- start footer -->
|
||
<?php include('include/footer.php'); ?>
|
||
<!-- end /. footer -->
|
||
<!-- Optional JavaScript -->
|
||
<script src="assets/plugins/jQuery/jquery.min.js"></script>
|
||
<script src="assets/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||
<script src="assets/plugins/aos/aos.min.js"></script>
|
||
<script src="assets/plugins/macy/macy.js"></script>
|
||
<script src="assets/plugins/simple-parallax/simpleParallax.min.js"></script>
|
||
<script src="assets/plugins/OwlCarousel2/owl.carousel.min.js"></script>
|
||
<script src="assets/plugins/theia-sticky-sidebar/ResizeSensor.min.js"></script>
|
||
<script src="assets/plugins/theia-sticky-sidebar/theia-sticky-sidebar.min.js"></script>
|
||
<script src="assets/plugins/waypoints/jquery.waypoints.min.js"></script>
|
||
<script src="assets/plugins/counter-up/jquery.counterup.min.js"></script>
|
||
<script src="assets/plugins/jquery-fancyfileuploader/fancy-file-uploader/jquery.ui.widget.js"></script>
|
||
<script src="assets/plugins/jquery-fancyfileuploader/fancy-file-uploader/jquery.fileupload.js"></script>
|
||
<script src="assets/plugins/jquery-fancyfileuploader/fancy-file-uploader/jquery.iframe-transport.js"></script>
|
||
<script src="assets/plugins/jquery-fancyfileuploader/fancy-file-uploader/jquery.fancy-fileupload.js"></script>
|
||
<script src="assets/plugins/ion.rangeSlider/ion.rangeSlider.min.js"></script>
|
||
<script src="assets/plugins/magnific-popup/jquery.magnific-popup.min.js"></script>
|
||
<script src="assets/plugins/select2/select2.min.js"></script>
|
||
<!-- Custom script for this template -->
|
||
<script src="assets/js/script.js"></script>
|
||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||
|
||
<script>
|
||
$(document).ready(function() {
|
||
// Quando il pulsante "Add to Cart" viene cliccato
|
||
$('.add-to-cart-btn').on('click', function() {
|
||
var idschedule = $(this).data('id'); // Ottieni l'ID della classe
|
||
addToCart(idschedule); // Esegui la funzione per aggiungere al carrello
|
||
});
|
||
});
|
||
|
||
// Funzione per aggiungere l'articolo al carrello
|
||
function addToCart(idschedule) {
|
||
$.ajax({
|
||
url: 'add_to_cart.php',
|
||
type: 'POST',
|
||
data: {
|
||
id_schedule: idschedule
|
||
}, // Invia l'ID della classe
|
||
dataType: 'json',
|
||
success: function(response) {
|
||
// Se l'articolo viene aggiunto con successo
|
||
if (response.status === 'success') {
|
||
Swal.fire({
|
||
title: 'Successo!',
|
||
text: response.message,
|
||
icon: 'success',
|
||
showCancelButton: true,
|
||
confirmButtonText: 'Vai al carrello',
|
||
cancelButtonText: 'Continua con gli acquisti'
|
||
}).then((result) => {
|
||
// Se l'utente clicca su "Vai al carrello", redireziona
|
||
if (result.isConfirmed) {
|
||
window.location.href = 'cart.php';
|
||
}
|
||
});
|
||
} else {
|
||
// Se c'è un errore nella risposta
|
||
Swal.fire('Errore!', response.message, 'error');
|
||
}
|
||
},
|
||
// Gestione dell'errore AJAX
|
||
error: function(xhr, status, error) {
|
||
Swal.fire({
|
||
title: 'Errore!',
|
||
text: 'Errore nella richiesta: ' + xhr.responseText,
|
||
icon: 'error',
|
||
confirmButtonText: 'OK'
|
||
});
|
||
}
|
||
});
|
||
}
|
||
</script>
|
||
|
||
|
||
|
||
</body>
|
||
|
||
</html>
|