yogiwhere/public/frontend2/listing-details.php

907 lines
66 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php include('include/headscriptnologin.php'); ?>
<?php include('include/generalsettings.php'); ?>
<?php
$conn = new mysqli($servername, $username, $password, $database);
$idschool = isset($_GET['idschool']) ? intval($_GET['idschool']) : 0;
if ($idschool > 0) {
// Prepara la query per selezionare la scuola specifica
$query = "SELECT idyogaschool, nameschool, phoneschool, address, emailschool, city, zip, country, latitude, longitude, publishdate, schooldescription, addedfee FROM yogaschool WHERE idyogaschool = ?";
// Prepara la query utilizzando prepared statements per evitare SQL injection
if ($stmt = $conn->prepare($query)) {
// Associa il parametro alla query
$stmt->bind_param("i", $idschool); // 'i' indica un intero
// Esegui la query
$stmt->execute();
// Associa i risultati a variabili
$stmt->bind_result($idyogaschool, $nameschool, $phoneschool, $address, $emailschool, $city, $zip, $country, $latitude, $longitude, $publishdate, $schooldescription, $addedfee);
$date = new DateTime($publishdate);
// Formatta la data come desiderato
$formattedDate = $date->format('d F Y');
// Fetch del risultato
if ($stmt->fetch()) {
// Ora tutte le colonne sono nelle variabili corrispondenti
// Ad esempio, $nameschool contiene il nome della scuola, $phoneschool il telefono, ecc.
} else {
echo "Nessuna scuola trovata con l'ID fornito.";
}
// Chiudi lo statement
$stmt->close();
} else {
echo "Errore nella preparazione della query.";
}
// Chiudi la connessione al database
$conn->close();
} else {
echo "ID scuola non valido.";
}
?>
<!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>
.tooltip {
background-color: #f8f9fa;
/* Colore di sfondo del tooltip */
color: #212529;
/* Colore del testo del tooltip */
border-radius: 4px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
}
.tooltip .arrow::before {
border-top-color: #f8f9fa;
/* Colore della freccia del tooltip */
}
</style>
<?php include('include/navbar.php'); ?>
<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 $nameschool; ?></h1>
<ul class="list-inline list-separator d-flex align-items-center mb-2">
<li class="list-inline-item"><a class="fw-medium" href="#"><?php echo $address; ?>,
<?php echo $zip; ?><?php echo $city; ?>- <?php echo $country; ?><i class="fa-solid fa-arrow-up-right-from-square fs-14 ms-2"></i></a></li>
<li class="list-inline-item">
<div class="d-flex align-items-center gap-2 ms-auto">
<div class="d-flex align-items-center text-primary rating-stars"><i class="fa-star-icon"></i><i class="fa-star-icon"></i><i class="fa-star-icon"></i><i class="fa-star-icon half"></i><i class="fa-star-icon none"></i></div>
<!-- start counter text --><span class="fw-medium text-primary"><span class="fs-6 fw-semibold me-1">(4.5)</span><small>2,
391 reviews</small></span>
<!-- end /. counter text -->
</div>
</li>
</ul>
<ul class="fs-14 fw-medium list-inline list-separator mb-0 text-muted">
<li class="list-inline-item"><?php echo $phonetitle; ?><?php echo $phoneschool; ?></li>
<li class="list-inline-item"><?php echo $emailtitle; ?><a href="mailto:<?php echo $emailschool; ?>?subject=<?php echo rawurlencode($subjectmail); ?>"><?php echo $emailschool; ?></a></li>
</ul>
</div>
<div class="col-lg-auto">
<?php
// Verifica se l'utente è loggato
if (Auth::check()) {
$iduserlogin = Auth::id(); // Ottieni l'ID dell'utente loggato
} else {
$iduserlogin = null; // L'utente non è loggato
}
?><?php
$is_bookmarked = false;
if (Auth::check()) {
$conn = new mysqli($servername, $username, $password, $database);
$query = "SELECT * FROM bookmarks WHERE iduser = ? AND idyogaschool = ? AND product_id =0";
$stmt = $conn->prepare($query);
$stmt->bind_param('ii', $iduserlogin, $idyogaschool);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {
$is_bookmarked = true;
}
$stmt->close();
$conn->close();
}
?>
<div class="form-check form-check-bookmark mb-2 mb-sm-0">
<input
class="form-check-input"
type="checkbox"
value=""
id="jobBookmarkCheck"
<?php if (isset($iduserlogin) && !is_null($iduserlogin)): ?>
data-iduser="<?php echo $iduserlogin; ?>"
<?php endif; ?>
data-idyogaschool="<?php echo $idyogaschool; ?>"
data-productid="0"
<?php if (!Auth::check()): ?>
data-bs-toggle="tooltip" data-bs-placement="top" title="Devi essere loggato per salvare tra i preferiti"
onclick="return false;"
<?php else: ?>
onclick="toggleBookmark(this);"
<?php endif; ?>
<?php if ($is_bookmarked): ?>
checked
<?php endif; ?>>
<label class="form-check-label" for="jobBookmarkCheck">
<span class="form-check-bookmark-default">
<i class="fa-regular fa-heart me-1"></i> <?php echo $saveschool; ?>
</span>
<span class="form-check-bookmark-active">
<i class="fa-solid fa-heart me-1"></i> Saved
</span>
</label>
</div>
</div>
</div>
</div>
</div>
<div class="container"><?php
$conn = new mysqli($servername, $username, $password, $database);
// Query per recuperare le foto dalla tabella photoyogaschool
$query_photos = "SELECT photofilename FROM photoyogaschool WHERE idyogaschool = ?";
$stmt = $conn->prepare($query_photos);
$stmt->bind_param("i", $idyogaschool);
$stmt->execute();
$result = $stmt->get_result();
// Verifica se ci sono foto
if ($result->num_rows > 0) {
echo '<div class="rounded-4 overflow-hidden">';
echo '<div class="row gx-2 zoom-gallery">';
// Contatore per gestire le prime tre immagini
$counter = 0;
while ($row = $result->fetch_assoc()) {
$photofilename = $row['photofilename'];
$photo_url = 'uploadschool/' . $photofilename; // Percorso completo della foto
// Visualizza la prima foto più grande (col-md-8)
if ($counter == 0) {
echo '
<div class="col-md-8">
<a class="d-block position-relative" data-fancybox="gallery" href="' . $photo_url . '">
<img class="img-fluid w-100" src="' . $photo_url . '" alt="Image Description">
<div class="position-absolute bottom-0 end-0 mb-3 me-3">
<span class="align-items-center btn btn-light btn-sm d-flex d-md-none fw-semibold gap-2">
<i class="fa-solid fa-expand"></i>
<span>' . $viewphotos . '</span>
</span>
</div>
</a>
</div>';
}
// Visualizza la seconda e terza foto più piccole (col-md-4)
if ($counter == 1) {
echo '
<div class="col-md-4 d-none d-md-inline-block">
<a class="d-block mb-2" data-fancybox="gallery" href="' . $photo_url . '">
<img class="img-fluid w-100" src="' . $photo_url . '" alt="Image Description">
</a>
';
}
if ($counter == 2) {
echo '
<a class="d-block position-relative" data-fancybox="gallery" href="' . $photo_url . '">
<img class="img-fluid w-100" src="' . $photo_url . '" alt="Image Description">
<div class="position-absolute bottom-0 end-0 mb-3 me-3">
<span class="align-items-center btn btn-light btn-sm d-md-inline-flex d-none fw-semibold gap-2">
<i class="fa-solid fa-expand"></i>
<span>' . $viewphotos . '</span>
</span>
</div>
</a>
</div>';
}
// Crea il resto delle immagini nascoste per il Fancybox
if ($counter > 2) {
echo '<a href="' . $photo_url . '" data-fancybox="gallery" style="display:none;"></a>';
}
$counter++;
}
echo '</div></div>';
}
$stmt->close();
?><div class="d-flex justify-content-end mt-2"><span class="small text-dark fw-semibold"><?php echo $published; ?></span><span class="small ms-1 text-muted"><?php echo $formattedDate; ?></span></div>
</div>
<!-- end /. gallery -->
<!-- start listing details -->
<div class="py-5">
<div class="container">
<div class="row">
<div class="col-lg-8 content">
<div class="mb-4">
<h4 class="fw-semibold fs-3 mb-4"><?php echo $schooldescriptiontitle; ?><span class="font-caveat text-primary"><?php echo $school; ?></span></h4>
<p><?php echo $schooldescription; ?></p>
</div>
<div class="mb-4">
<h4 class="fw-semibold fs-3 mb-4"><?php echo $categorieslesson; ?><span class="font-caveat text-primary"><?php echo $availabletitle; ?></span></h4><?php
$idyogaschool = intval($idyogaschool);
$conn = new mysqli($servername, $username, $password, $database);
$query_checkcategories = "
SELECT classcategory.namecategory
FROM schoolcategories
LEFT JOIN classcategory
ON schoolcategories.idclasscategory = classcategory.idclasscategory
WHERE schoolcategories.idschool = ?
";
$stmt = $conn->prepare($query_checkcategories);
$stmt->bind_param("i", $idyogaschool);
$stmt->execute();
$result = $stmt->get_result();
// Verifica se ci sono categorie trovate
if ($result->num_rows > 0) {
echo '<div class="row g-4">';
$counter = 0; // Contatore per gestire il layout a 4 per riga
while ($row = $result->fetch_assoc()) {
$namecategory = $row['namecategory'];
// Stampa dinamica delle categorie con più spazio tra le righe
echo '
<div class="col-auto col-lg-3 mb-4">
<div class="d-flex align-items-center text-dark">
<div class="flex-shrink-0">
<i class="fa-solid fa-star fs-18"></i>
</div>
<div class="flex-grow-1 fs-16 fw-medium ms-3">' . htmlspecialchars($namecategory) . '</div>
</div>
</div>';
$counter++;
// Aggiungi una riga vuota dopo ogni 4 elementi
if ($counter % 4 == 0) {
echo '</div><div class="row g-4">';
}
}
echo '</div>'; // Chiudi la riga finale
} else {
echo 'Nessuna categoria trovata.';
}
$stmt->close();
?>
</div>
<hr class="my-5">
<!-- start classes available section -->
<div class="mb-4">
<h4 class="fw-semibold fs-3 mb-4"><?php echo $classestitle; ?><span class="font-caveat text-primary"><?php echo $availabletitle; ?></span></h4><?php
$idyogaschool = intval($idyogaschool);
$conn = new mysqli($servername, $username, $password, $database);
$query_schedule = "
SELECT schedule.idschedule, schedule.dateschedule, schedule.timeschedule, schedule.durationschedule, schedule.availableseat, schedule.cost,
yogaclass.idyogaclass, yogaclass.nameyogaclass, yogaclass.descriptionyogaclass, classcategory.namecategory, classcategory.picturecategory
FROM schedule
LEFT JOIN yogaclass ON schedule.idyogaclass = yogaclass.idyogaclass
LEFT JOIN classcategory ON yogaclass.idclasscategory = classcategory.idclasscategory
WHERE schedule.idyogaschool = ?
ORDER BY schedule.dateschedule, schedule.timeschedule
";
$stmt = $conn->prepare($query_schedule);
$stmt->bind_param("i", $idyogaschool);
$stmt->execute();
$result = $stmt->get_result();
// Loop attraverso i risultati della query e genera le card dinamiche
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
// Recupera i dati della lezione, inclusi idyogaclass
$idyogaclass = $row['idyogaclass']; // Assicurati di avere l'ID della lezione
$date = date('d M Y', strtotime($row['dateschedule']));
$time = date('H:i', strtotime($row['timeschedule']));
$duration = $row['durationschedule'];
$seats = $row['availableseat'];
$cost = $row['cost'];
$class_name = $row['nameyogaclass'];
$description = $row['descriptionyogaclass'];
$category = $row['namecategory'];
$photoclass = $row['picturecategory'];
$idschedule = $row['idschedule'];
// Controlla se la classe è già salvata nei preferiti
$is_class_bookmarked = false;
$bookmark_query = "SELECT * FROM bookmarks WHERE iduser = ? AND idyogaschool = ? AND product_id = ?";
$bookmark_stmt = $conn->prepare($bookmark_query);
$bookmark_stmt->bind_param('iii', $iduserlogin, $idyogaschool, $idyogaclass);
$bookmark_stmt->execute();
$bookmark_result = $bookmark_stmt->get_result();
if ($bookmark_result->num_rows > 0) {
$is_class_bookmarked = true;
}
// fee calculation
$conn = new mysqli($servername, $username, $password, $database);
if ($addedfee == 'Y') {
// Prepara la query per recuperare la fee in base al costo
$query = "SELECT fee FROM fees WHERE ? BETWEEN min_prezzo AND max_prezzo LIMIT 1";
if ($stmt = $conn->prepare($query)) {
// Associa il valore del costo alla query
$stmt->bind_param("d", $cost); // 'd' indica un valore decimale (double)
$stmt->execute();
$stmt->bind_result($fee);
// Se troviamo una fee, la sommiamo al costo
if ($stmt->fetch()) {
$cost += $fee; // Aggiungi la fee al costo
}
// Chiudi lo statement
$stmt->close();
}
}
// Stampa la card dinamica con il cuoricino
echo '
<div class="card border-0 shadow-sm overflow-hidden rounded-4 mb-4 card-hover card-hover-bg position-relative">
<div class="card-body p-0">
<div class="g-0 row">
<div class="col-lg-4 col-md-4 col-xl-12 col-xxl-4 position-relative">
<div class="card-image-hover dark-overlay h-100 overflow-hidden position-relative">
<img src="uploadclass/' . $photoclass . '" alt="" class="h-100 w-100 object-fit-cover">
<div class="bg-success card-badge d-inline-block position-absolute start-0 text-white z-2">
' . $seats . ' seats available
</div>
</div>
</div>
<div class="col-lg-8 col-md-8 col-xl-12 col-xxl-8 p-3 p-lg-4 p-md-3 p-sm-4">
<div class="d-flex flex-column h-100">
<div class="d-flex justify-content-end gap-2 me-3 mt-3 position-absolute top-0 end-0 z-1">
<span class="badge bg-light text-danger fs-6 fw-semibold p-2">
€' . $cost . '
</span>
<div class="form-check form-check-bookmark">
<input
class="form-check-input"
type="checkbox"
id="bookmarkClass' . $idyogaclass . '"
data-iduser="' . $iduserlogin . '"
data-idyogaschool="' . $idyogaschool . '"
data-productid="' . $idyogaclass . '"
onclick="toggleBookmarkClass(this);"';
// Se la classe è nei preferiti, il checkbox sarà selezionato
if ($is_class_bookmarked) {
echo ' checked ';
}
echo '>
<label class="form-check-label" for="bookmarkClass' . $idyogaclass . '">
<span class="form-check-bookmark-default">
<i class="fa-regular fa-heart"></i>
</span>
<span class="form-check-bookmark-active">
<i class="fa-solid fa-heart"></i> Saved
</span>
</label>
</div>
</div>
<h4 class="fs-18 fw-semibold mb-0">' . $class_name . '</h4>
<div class="mt-2 text-muted fs-14">
' . $description . '
</div>
<div class="d-flex flex-wrap gap-3 mt-auto z-1">
<div class="d-flex gap-2 align-items-center fs-13 fw-semibold">
<i class="fa-solid fa-calendar-day"></i>
<span>' . $date . '</span>
</div>
<div class="d-flex gap-2 align-items-center fs-13 fw-semibold">
<i class="fa-solid fa-clock"></i>
<span>' . $time . ' - ' . $duration . ' min</span>
</div>
<div class="d-flex gap-2 align-items-center fs-13 fw-semibold">
<i class="fa-solid fa-yoga"></i>
<span>' . $category . '</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>';
// Chiudi lo statement della query bookmark
$bookmark_stmt->close();
}
}
?>
</div>
<!-- end /. classes available section -->
<hr class="my-5">
<!-- start reviews section --><?php // include('include/reviews.php');
?><!-- end /. reviews section -->
<hr class="my-5">
<!-- start comment form section --><?php //include('include/leaveacomment.php');
?><!-- end /. comment form section -->
</div>
<div class="col-lg-4 ps-xxl-5 sidebar">
<div class="border mb-4 p-4 rounded-4">
<h4 class="fw-semibold mb-4"><?php echo $whereweare; ?></h4>
<!-- Start Map -->
<div id="map" style="width: 100%; height: 400px;"></div>
<!-- End Map -->
</div>
<!-- Include Google Maps API -->
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB4iuUg1YDRIBRZ5e-jdssfqDuT9VLiOnY"></script>
<script>
function initMap() {
// Variabili PHP per le coordinate
var latitude = <?php echo $latitude; ?>;
var longitude = <?php echo $longitude; ?>;
// Crea una nuova mappa centrata sulle coordinate
var map = new google.maps.Map(document.getElementById('map'), {
center: {
lat: latitude,
lng: longitude
}
,
zoom: 15
});
// Aggiungi un marker sulla mappa
var marker = new google.maps.Marker({
position: {
lat: latitude,
lng: longitude
}
,
map: map,
title: 'Our Location'
});
}
// Inizializza la mappa quando la pagina è caricata
window.onload = initMap;
</script>
<!-- start opening hours --><?php
// Esempio di $idyogaschool e $lang (imposta dinamicamente)
$idyogaschool = intval($idyogaschool);
$lang = 'it'; // Lingua corrente
$conn = new mysqli($servername, $username, $password, $database);
// Query per recuperare gli orari e i giorni
$query_schoolopening = "
SELECT days.namedays, schoolopening.openhours, schoolopening.closehours
FROM schoolopening
LEFT JOIN days ON schoolopening.iddays = days.iddays
WHERE schoolopening.idyogaschool = ?
";
$stmt = $conn->prepare($query_schoolopening);
$stmt->bind_param("i", $idyogaschool);
$stmt->execute();
$result = $stmt->get_result();
// Controllo se ci sono risultati
if ($result->num_rows > 0) {
echo '<div class="border p-4 rounded-4">';
echo '<div class="align-items-center d-flex justify-content-between mb-4">';
echo '<h4 class="w-semibold mb-0">' . $timetitle . ' <span class="font-caveat text-primary">' . $openingtitle . '</span></h4>';
echo '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-clock" viewBox="0 0 16 16">';
echo '<path d="M8 3.5a.5.5 0 0 0-1 0V9a.5.5 0 0 0 .252.434l3.5 2a.5.5 0 0 0 .496-.868L8 8.71V3.5z"></path>';
echo '<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm7-8A7 7 0 1 1 1 8a7 7 0 0 1 14 0z"></path>';
echo '</svg>';
echo '</div>';
// Stampa dinamica degli orari
while ($row = $result->fetch_assoc()) {
// Recupera il nome del giorno dalla colonna JSON
$days_json = json_decode($row['namedays'], true);
$day_name = $days_json[$lang]; // Ottieni il giorno nella lingua selezionata
// Recupera gli orari
$openhours = $row['openhours'];
$closehours = $row['closehours'];
// Gestisci i giorni in cui la scuola è chiusa
if ($openhours === '00:00:00' && $closehours === '00:00:00') {
$hours_text = '<span class="fw-medium text-danger">Close</span>';
} else {
$hours_text = '<span class="fs-14">' . date('g:i a', strtotime($openhours)) . ' - ' . date('g:i a', strtotime($closehours)) . '</span>';
}
// Stampa il rigo dinamico per il giorno
echo '<div class="align-items-center d-flex justify-content-between mb-3">';
echo '<span class="fw-semibold">' . $day_name . '</span>';
echo $hours_text;
echo '</div>';
}
echo '</div>'; // Chiudi il contenitore
} else {
echo 'Nessun orario di apertura trovato.';
}
$stmt->close();
?><!-- end /. opening hours -->
</div>
</div>
</div>
</div>
<!-- end /. listing details -->
<!-- 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 youre 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>
<script>
// Inizializza tutti i tooltip presenti nella pagina
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
var tooltipList = tooltipTriggerList.map(function(tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl);
});
function toggleBookmark(checkbox) {
var idUser = checkbox.getAttribute('data-iduser');
var idYogaSchool = checkbox.getAttribute('data-idyogaschool');
var productId = checkbox.getAttribute('data-productid'); // Dovrebbe essere 0 per le scuole
// Verifica lo stato del checkbox subito dopo il click
var isChecked = checkbox.checked;
if (isChecked) {
// Aggiungi ai preferiti
$.ajax({
url: 'add_to_bookmarks.php',
method: 'POST',
data: {
iduser: idUser,
idyogaschool: idYogaSchool,
product_id: productId // product_id = 0 per le scuole
},
success: function(response) {
console.log("Aggiunto ai preferiti:", response);
},
error: function() {
alert('Errore durante il salvataggio nei preferiti.');
// Se fallisce, ritorna lo stato precedente del checkbox
checkbox.checked = !isChecked;
}
});
} else {
// Rimuovi dai preferiti
$.ajax({
url: 'remove_from_bookmarks.php',
method: 'POST',
data: {
iduser: idUser,
idyogaschool: idYogaSchool,
product_id: productId // product_id = 0 per le scuole
},
success: function(response) {
console.log("Rimosso dai preferiti:", response);
},
error: function() {
alert('Errore durante la rimozione dai preferiti.');
// Se fallisce, ritorna lo stato precedente del checkbox
checkbox.checked = !isChecked;
}
});
}
}
</script>
<script>
function toggleBookmarkClass(checkbox) {
var idUser = checkbox.getAttribute('data-iduser');
var idYogaSchool = checkbox.getAttribute('data-idyogaschool');
var productId = checkbox.getAttribute('data-productid'); // product_id = idyogaclass
if (checkbox.checked) {
// Aggiungi ai preferiti
$.ajax({
url: 'add_to_bookmarks.php',
method: 'POST',
data: {
iduser: idUser,
idyogaschool: idYogaSchool,
product_id: productId // Usa idyogaclass come product_id
},
success: function(response) {
console.log(response);
},
error: function() {
alert('Errore durante il salvataggio nei preferiti.');
}
});
} else {
// Rimuovi dai preferiti
$.ajax({
url: 'remove_from_bookmarks.php',
method: 'POST',
data: {
iduser: idUser,
idyogaschool: idYogaSchool,
product_id: productId // Usa idyogaclass come product_id
},
success: function(response) {
console.log(response);
},
error: function() {
alert('Errore durante la rimozione dai preferiti.');
}
});
}
}
</script>
</body>
</html>