657 lines
30 KiB
PHP
657 lines
30 KiB
PHP
<?php require_once('include/headscript.php'); ?>
|
|
<?php
|
|
/**
|
|
* Connessione unica PDO riusata per tutta la pagina.
|
|
* DBHandlerSelect è un singleton: una sola connessione per richiesta.
|
|
* $iduserlogin arriva dalla sessione autenticata (headscript.php).
|
|
*/
|
|
$pdo = DBHandlerSelect::getInstance()->getConnection();
|
|
|
|
// Forziamo l'id utente a intero: viene dalla sessione, ma è comunque
|
|
// buona norma non fidarsi mai e trattarlo come integer.
|
|
$iduserlogin = (int) $iduserlogin;
|
|
|
|
/* -------------------------------------------------------------------------
|
|
* 1) Calcolo del mese da visualizzare
|
|
* ---------------------------------------------------------------------- */
|
|
if (isset($_GET['prev_month'])) {
|
|
$currentMonthStart = preg_replace('/[^0-9\-]/', '', $_GET['prev_month']) . '-01';
|
|
} elseif (isset($_GET['next_month'])) {
|
|
$currentMonthStart = preg_replace('/[^0-9\-]/', '', $_GET['next_month']) . '-01';
|
|
} else {
|
|
$currentMonthStart = date("Y-m-01");
|
|
}
|
|
|
|
// Validazione: se la stringa non è una data valida, torna al mese corrente
|
|
$ts = strtotime($currentMonthStart);
|
|
if ($ts === false) {
|
|
$currentMonthStart = date("Y-m-01");
|
|
}
|
|
|
|
$currentDate = date("Y-m-d");
|
|
|
|
// Se oggi è dopo l'inizio del mese scelto, parti da oggi
|
|
if ($currentDate > $currentMonthStart) {
|
|
$currentMonthStart = $currentDate;
|
|
}
|
|
|
|
$currentMonthEnd = date("Y-m-t", strtotime($currentMonthStart));
|
|
|
|
/* -------------------------------------------------------------------------
|
|
* 2) Lezioni prenotate nel range del mese
|
|
* ---------------------------------------------------------------------- */
|
|
$sqlBooked = "SELECT bookingclass.*, service.*, serviceschedule.*, orderbook.expireon
|
|
FROM bookingclass
|
|
LEFT JOIN service ON bookingclass.idservice = service.idservice
|
|
LEFT JOIN serviceschedule ON bookingclass.idserviceschedule = serviceschedule.idserviceschedule
|
|
LEFT JOIN orderbook ON bookingclass.idorder = orderbook.idorderbook
|
|
WHERE bookingclass.iduser = :iduser
|
|
AND bookingclass.status = 'booked'
|
|
AND serviceschedule.dateschedule BETWEEN :monthStart AND DATE_ADD(:monthEnd, INTERVAL 1 DAY)
|
|
ORDER BY serviceschedule.dateschedule";
|
|
|
|
$stmtBooked = $pdo->prepare($sqlBooked);
|
|
$stmtBooked->execute([
|
|
':iduser' => $iduserlogin,
|
|
':monthStart' => $currentMonthStart,
|
|
':monthEnd' => $currentMonthEnd,
|
|
]);
|
|
$bookedRows = $stmtBooked->fetchAll();
|
|
|
|
/* -------------------------------------------------------------------------
|
|
* 3) Somma dei ticket acquistati dall'utente
|
|
* ---------------------------------------------------------------------- */
|
|
$sqlTickets = "SELECT SUM(nticket) AS total_tickets
|
|
FROM orderbook
|
|
WHERE iduser = :iduser";
|
|
$stmtTickets = $pdo->prepare($sqlTickets);
|
|
$stmtTickets->execute([':iduser' => $iduserlogin]);
|
|
$rowTickets = $stmtTickets->fetch();
|
|
$totalTickets = (int) ($rowTickets['total_tickets'] ?? 0);
|
|
|
|
/* -------------------------------------------------------------------------
|
|
* 4) Conteggio stati lezioni (praticate / future / perse / da confermare)
|
|
* ---------------------------------------------------------------------- */
|
|
$currentDateTime = date("Y-m-d H:i:s");
|
|
|
|
$sqlCounts = "SELECT
|
|
COUNT(*) AS total,
|
|
SUM(CASE WHEN serviceschedule.dateschedule <= :now1
|
|
AND bookingclass.status = 'booked'
|
|
AND bookingclass.lostlesson = 'N' THEN 1 ELSE 0 END) AS passed,
|
|
SUM(CASE WHEN serviceschedule.dateschedule > :now2
|
|
AND bookingclass.status = 'booked'
|
|
AND bookingclass.lostlesson = 'N' THEN 1 ELSE 0 END) AS future,
|
|
SUM(CASE WHEN bookingclass.lostlesson = 'Y'
|
|
AND bookingclass.status != 'cancelled' THEN 1 ELSE 0 END) AS lost,
|
|
SUM(CASE WHEN bookingclass.status = 'pending' THEN 1 ELSE 0 END) AS pending
|
|
FROM bookingclass
|
|
LEFT JOIN serviceschedule ON bookingclass.idserviceschedule = serviceschedule.idserviceschedule
|
|
WHERE bookingclass.iduser = :iduser
|
|
AND bookingclass.status != 'cancelled'";
|
|
|
|
$stmtCounts = $pdo->prepare($sqlCounts);
|
|
$stmtCounts->execute([
|
|
':now1' => $currentDateTime,
|
|
':now2' => $currentDateTime,
|
|
':iduser' => $iduserlogin,
|
|
]);
|
|
$rowCounts = $stmtCounts->fetch();
|
|
|
|
$totalRecords = (int) ($rowCounts['total'] ?? 0);
|
|
$passedRecords = (int) ($rowCounts['passed'] ?? 0);
|
|
$futureRecords = (int) ($rowCounts['future'] ?? 0);
|
|
$lost = (int) ($rowCounts['lost'] ?? 0);
|
|
$pending = (int) ($rowCounts['pending'] ?? 0);
|
|
|
|
$toprogram = $totalTickets - $passedRecords - $futureRecords - $pending - $lost;
|
|
|
|
/* -------------------------------------------------------------------------
|
|
* 5) Pre-caricamento limiti di riprogrammazione per gli ordini coinvolti
|
|
* (una sola query invece di una per ogni card, dentro il loop)
|
|
* ---------------------------------------------------------------------- */
|
|
$reprogramInfo = [];
|
|
$orderIds = array_filter(array_unique(array_map(
|
|
fn($r) => (int) ($r['idorder'] ?? 0),
|
|
$bookedRows
|
|
)));
|
|
|
|
if (!empty($orderIds)) {
|
|
// Costruiamo i placeholder ?,?,? in numero pari agli id
|
|
$placeholders = implode(',', array_fill(0, count($orderIds), '?'));
|
|
$sqlReprog = "SELECT idorderbook, maxreschedule, reprogrammed
|
|
FROM orderbook
|
|
WHERE idorderbook IN ($placeholders)";
|
|
$stmtReprog = $pdo->prepare($sqlReprog);
|
|
$stmtReprog->execute(array_values($orderIds));
|
|
foreach ($stmtReprog->fetchAll() as $r) {
|
|
$reprogramInfo[(int) $r['idorderbook']] = [
|
|
'max' => (int) ($r['maxreschedule'] ?? 0),
|
|
'done' => (int) ($r['reprogrammed'] ?? 0),
|
|
];
|
|
}
|
|
}
|
|
|
|
/* -------------------------------------------------------------------------
|
|
* Helper output sicuro (evita XSS quando stampiamo dati DB nell'HTML)
|
|
* ---------------------------------------------------------------------- */
|
|
function e($value): string
|
|
{
|
|
return htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8');
|
|
}
|
|
|
|
$italianMonths = [
|
|
"January" => "Gennaio",
|
|
"February" => "Febbraio",
|
|
"March" => "Marzo",
|
|
"April" => "Aprile",
|
|
"May" => "Maggio",
|
|
"June" => "Giugno",
|
|
"July" => "Luglio",
|
|
"August" => "Agosto",
|
|
"September" => "Settembre",
|
|
"October" => "Ottobre",
|
|
"November" => "Novembre",
|
|
"December" => "Dicembre"
|
|
];
|
|
?>
|
|
<!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" />
|
|
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
|
|
|
<link href="assets/css/bootstrap.min.css" id="bootstrap-style" rel="stylesheet" type="text/css" />
|
|
<link href="assets/css/icons.min.css" 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">
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></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;
|
|
}
|
|
}
|
|
|
|
.month-navigation {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.month-nav-button {
|
|
background: none;
|
|
border: none;
|
|
font-size: 24px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.current-month {
|
|
font-size: 24px;
|
|
margin: 0 20px;
|
|
}
|
|
|
|
.card {
|
|
width: 100%;
|
|
}
|
|
|
|
.pastel-color {
|
|
border: 1px solid #D1C4CC;
|
|
padding: 0px;
|
|
text-align: center;
|
|
border-radius: 10px;
|
|
margin-right: 20px;
|
|
font-size: 18px;
|
|
}
|
|
|
|
.pastel-color.acquistate {
|
|
background-color: #E2C4FB;
|
|
}
|
|
|
|
.pastel-color.praticate {
|
|
background-color: #C4E1FB;
|
|
}
|
|
|
|
.pastel-color.prenotate {
|
|
background-color: #CDFBC4;
|
|
}
|
|
|
|
.pastel-color.conferma {
|
|
background-color: #FBFAC4;
|
|
}
|
|
|
|
.pastel-color.programmare {
|
|
background-color: #FBE4C4;
|
|
}
|
|
|
|
.pastel-color.perse {
|
|
background-color: #FBC7C4;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.pastel-color {
|
|
margin-right: 0;
|
|
margin-bottom: 20px;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
function confirmDelete(id, idservice, deletePageUrl) {
|
|
Swal.fire({
|
|
title: "Sei sicuro?",
|
|
text: "Questa prenotazione verrà cancellata e ti verrà richiesto di programmare la lezione!",
|
|
icon: "warning",
|
|
showCancelButton: true,
|
|
confirmButtonColor: "#d33",
|
|
cancelButtonColor: "#3085d6",
|
|
confirmButtonText: "Sì, riprogramma!",
|
|
cancelButtonText: "Annulla"
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
window.location.href = `${deletePageUrl}?id=${id}&idserviceordered=${idservice}`;
|
|
}
|
|
});
|
|
}
|
|
|
|
function confirmDeleteOnly(idbookingclass, expirydate) {
|
|
Swal.fire({
|
|
title: "Attenzione",
|
|
html: `
|
|
<strong>Confermi di voler cancellare questa lezione?</strong><br><br>
|
|
<strong>RICORDA:</strong> dovrai riprogrammarla entro la scadenza del tuo abbonamento per non perderla!<br><br>
|
|
<span style="font-size:20px;color:#d33;font-weight:bold;">
|
|
Scadenza: ${expirydate}
|
|
</span>
|
|
`,
|
|
icon: "warning",
|
|
showCancelButton: true,
|
|
confirmButtonText: "Procedi",
|
|
cancelButtonText: "Annulla",
|
|
confirmButtonColor: "#d33",
|
|
cancelButtonColor: "#3085d6"
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
window.location.href = "delete_lesson.php?id=" + idbookingclass;
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
</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'); ?>
|
|
<?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 class="topnav">
|
|
<div class="container-fluid">
|
|
<nav class="navbar navbar-light navbar-expand-lg topnav-menu"></nav>
|
|
</div>
|
|
</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 </h5>
|
|
<p>Di seguito puoi vedere lo stato delle tue prenotazioni</p>
|
|
<div class="row">
|
|
<div class="col-md-2">
|
|
<div class="card pastel-color acquistate">
|
|
<div class="card-body">
|
|
<h5 style="font-size: 0.9em;">Lezioni acquistate</h5>
|
|
<p><?php echo e($totalTickets); ?></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="card pastel-color praticate">
|
|
<div class="card-body">
|
|
<h5 style="font-size: 0.9em;">Praticate</h5>
|
|
<p><?php echo e($passedRecords); ?></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="card pastel-color prenotate">
|
|
<div class="card-body">
|
|
<h5 style="font-size: 0.9em;">Prenotate</h5>
|
|
<p><?php echo e($futureRecords); ?></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="card pastel-color conferma">
|
|
<div class="card-body">
|
|
<h5 style="font-size: 0.9em;">Da confermare</h5>
|
|
<p><?php echo e($pending); ?></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="card pastel-color programmare">
|
|
<div class="card-body">
|
|
<h5 style="font-size: 0.9em;">Da programmare</h5>
|
|
<p><?php echo e($toprogram); ?></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="card pastel-color perse">
|
|
<div class="card-body">
|
|
<h5 style="font-size: 0.9em;">Perse</h5>
|
|
<p><?php echo e($lost); ?></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="alert alert-warning alert-dismissible fade show" role="alert" style="text-align: center;">
|
|
<i class="mdi mdi-alert-outline me-2"></i>
|
|
Car* Yogi, ti ricordiamo che il pacchetto 4 lezioni ha validità entro le 5 settimane dall'acquisto e il pacchetto da 12 lezioni entro il <strong>20 dicembre 2025</strong> 🙏
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if (isset($_GET['reprogram'])) { ?>
|
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
|
<i class="mdi mdi-check-all me-2"></i>
|
|
Richiesta di riprogrammazione inviata con successo!
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
</div>
|
|
<?php } ?>
|
|
<?php if (isset($_GET['deleted'])) { ?>
|
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
|
<i class="mdi mdi-check-all me-2"></i>
|
|
Lezione cancellata con successo! Grazie per aver liberato il posto!
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
</div>
|
|
<?php } ?>
|
|
|
|
<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">
|
|
<form class="email-search">
|
|
<div class="position-relative">
|
|
<h3>Lezioni Programmate</h3>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div class="col-xl-9 col-md-12">
|
|
<div class="text-sm-end">
|
|
<?php if ($toprogram > 0) { ?>
|
|
<a href="selectorder.php">
|
|
<button type="button" class="btn btn-primary btn-rounded waves-effect waves-light mb-2 me-2" data-bs-toggle="modal" data-bs-target=".create-task">
|
|
<i class="mdi mdi-plus me-1"></i> Programma lezioni rimanenti
|
|
</button>
|
|
</a>
|
|
<?php } ?>
|
|
<a href="https://yogasoul.it/shop-completo/">
|
|
<button type="button" class="btn btn-success btn-rounded waves-effect waves-light mb-2 me-2" data-bs-toggle="modal" data-bs-target=".create-task">
|
|
<i class="mdi mdi-plus me-1"></i> Acquista Pacchetto Lezioni
|
|
</button>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container-fluid">
|
|
<div class="month-navigation">
|
|
<a href="?prev_month=<?php echo e(date('Y-m', strtotime('-1 month', strtotime($currentMonthStart)))); ?>" class="arrow-link">
|
|
<i class="fas fa-chevron-left fa-2x"></i>
|
|
</a>
|
|
<h2><?php echo e($italianMonths[date("F", strtotime($currentMonthStart))] . ' ' . date("Y", strtotime($currentMonthStart))); ?></h2>
|
|
<a href="?next_month=<?php echo e(date('Y-m', strtotime('+1 month', strtotime($currentMonthStart)))); ?>" class="arrow-link">
|
|
<i class="fas fa-chevron-right fa-2x"></i>
|
|
</a>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-xl-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<?php if (empty($bookedRows)) { ?>
|
|
<p>Prenotazioni non presenti per questo mese</p>
|
|
<?php
|
|
} else {
|
|
foreach ($bookedRows as $row) {
|
|
$dateschedule = $row['dateschedule'];
|
|
$dateObj = new DateTime($dateschedule);
|
|
$dayInItalian = $dateObj->format("d");
|
|
$monthInItalian = $italianMonths[$dateObj->format("F")];
|
|
$newDateFormat = $dateObj->format("d-m-Y H:i");
|
|
|
|
// Calcolo finestra di cancellazione
|
|
$currentTime = new DateTime();
|
|
$classTime = new DateTime($dateschedule);
|
|
$isSameDay = $classTime->format('Y-m-d') === $currentTime->format('Y-m-d');
|
|
$classHour = (int) $classTime->format('H');
|
|
$classMinute = (int) $classTime->format('i');
|
|
$isBefore1700 = ($classHour < 17) || ($classHour === 17 && $classMinute === 0);
|
|
|
|
if ($isSameDay) {
|
|
if ($isBefore1700) {
|
|
$deadline = new DateTime($classTime->format('Y-m-d 00:01:00'));
|
|
} else {
|
|
$deadline = new DateTime($classTime->format('Y-m-d 12:00:00'));
|
|
}
|
|
$canBeDeleted = $currentTime <= $deadline;
|
|
} else {
|
|
$canBeDeleted = true;
|
|
}
|
|
|
|
// Limite riprogrammazioni (dai dati pre-caricati, niente query nel loop)
|
|
$idorder = (int) ($row['idorder'] ?? 0);
|
|
$canReprogram = true;
|
|
if (isset($reprogramInfo[$idorder])) {
|
|
$canReprogram = $reprogramInfo[$idorder]['done'] < $reprogramInfo[$idorder]['max'];
|
|
}
|
|
|
|
$idbookingclass = (int) $row['idbookingclass'];
|
|
$idservice = (int) $row['idservice'];
|
|
$expirydate = date("d/m/Y", strtotime($row['expireon']));
|
|
$colorclass = $row['colorclass'] ?? '#1ebf73';
|
|
$servicename = $row['servicename'] ?? '';
|
|
?>
|
|
<div class="custom-card" onclick="toggleCard(this)">
|
|
<div class="custom-date-box" style="background-color:#1ebf73">
|
|
<div class="custom-day"><?php echo e($dayInItalian); ?></div>
|
|
<div class="custom-month"><?php echo e($monthInItalian); ?></div>
|
|
</div>
|
|
<div class="custom-event-details" style="background-color:<?php echo e($colorclass); ?>">
|
|
<h2 class="custom-heading"><?php echo e($servicename); ?></h2>
|
|
<p class="custom-paragraph">Quando: <?php echo e($newDateFormat); ?></p>
|
|
<p class="custom-paragraph">Luogo: via Valassina 62/B Seregno - Sala Contesto Yoga</p>
|
|
<div class="custom-actions">
|
|
<button class="custom-action-button" onclick="addToCalendar(this)" data-eventname="<?php echo e($servicename); ?>" data-eventdate="<?php echo e($newDateFormat); ?>">
|
|
<i class="far fa-calendar-plus"></i> Cal
|
|
</button>
|
|
<?php if ($canBeDeleted && $canReprogram) : ?>
|
|
<button class="custom-action-button" onclick="confirmDelete(<?php echo $idbookingclass; ?>, <?php echo $idservice; ?>, 'bookingpanel.php')">
|
|
<i class="fas fa-calendar-alt"></i> Riprogramma
|
|
</button>
|
|
<button class="custom-action-button"
|
|
onclick="confirmDeleteOnly(<?php echo $idbookingclass; ?>, '<?php echo e($expirydate); ?>')">
|
|
<i class="fas fa-trash"></i> Cancella
|
|
</button>
|
|
<?php else : ?>
|
|
<button class="custom-action-button"><i class="fas fa-exclamation-circle"></i> Non puoi riprogrammare</button>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div><br><br>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include('include/footer.php'); ?>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function toggleCard(card) {
|
|
card.classList.toggle("expanded");
|
|
}
|
|
|
|
function addToCalendar(button) {
|
|
const eventName = button.getAttribute('data-eventname');
|
|
const eventDate = button.getAttribute('data-eventdate');
|
|
const googleCalendarLink = `https://www.google.com/calendar/render?action=TEMPLATE&text=${encodeURIComponent(eventName)}&dates=${encodeURIComponent(eventDate)}`;
|
|
window.open(googleCalendarLink, '_blank');
|
|
const outlookCalendarLink = `webcal://outlook.live.com/calendar/0/deeplink/compose?path=/calendar/action/compose&subject=${encodeURIComponent(eventName)}&startdt=${encodeURIComponent(eventDate)}`;
|
|
window.open(outlookCalendarLink, '_blank');
|
|
}
|
|
</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/simplebar/simplebar.min.js"></script>
|
|
<script src="assets/libs/eva-icons/eva.min.js"></script>
|
|
<script src="assets/js/app.js"></script>
|
|
</body>
|
|
|
|
</html>
|