branch waiting list with update
This commit is contained in:
+41
-3
@@ -73,9 +73,9 @@ if (!empty($scheduleIds)) {
|
||||
auth_users.first_name, auth_users.last_name, auth_users.id AS iduser
|
||||
FROM bookingclass
|
||||
LEFT JOIN auth_users ON bookingclass.iduser = auth_users.id
|
||||
WHERE bookingclass.idserviceschedule IN ($ph)
|
||||
AND bookingclass.status IN ('booked', 'pending')
|
||||
ORDER BY auth_users.last_name, auth_users.first_name";
|
||||
WHERE bookingclass.idserviceschedule IN ($ph)
|
||||
AND bookingclass.status IN ('booked', 'pending', 'waiting')
|
||||
ORDER BY bookingclass.created_at, auth_users.last_name, auth_users.first_name";
|
||||
$stmtBookings = $pdo->prepare($sqlBookings);
|
||||
$stmtBookings->execute(array_values($scheduleIds));
|
||||
foreach ($stmtBookings->fetchAll() as $b) {
|
||||
@@ -575,8 +575,10 @@ $italianMonths = [
|
||||
// separa confermati (booked) da in attesa (pending)
|
||||
$bookings = array_filter($allRows, fn($b) => $b['status'] === 'booked');
|
||||
$pendings = array_filter($allRows, fn($b) => $b['status'] === 'pending');
|
||||
$waitings = array_filter($allRows, fn($b) => $b['status'] === 'waiting');
|
||||
$countPersons = count($bookings); // contatore = solo confermati
|
||||
$countPending = count($pendings);
|
||||
$countWaiting = count($waitings);
|
||||
$maxcap = (int) $sch['maxcapacity'];
|
||||
$isFull = $maxcap > 0 && $countPersons >= $maxcap;
|
||||
$colorclass = $sch['colorclass'] ?: '#e6f3ff';
|
||||
@@ -599,6 +601,12 @@ $italianMonths = [
|
||||
<?php echo $countPending; ?> in attesa
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?php if ($countWaiting > 0) : ?>
|
||||
<span class="capacity-pill" style="background:#fbeef3;color:#d1698a;">
|
||||
<i class="fas fa-list-ol" style="font-size:11px;"></i>
|
||||
<?php echo $countWaiting; ?> in coda
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</h3>
|
||||
<p class="class-meta"><i class="far fa-clock me-1"></i><?php echo e($whenFmt); ?></p>
|
||||
<p class="class-meta"><i class="fas fa-location-dot me-1"></i>via Valassina 62/B Seregno - Sala Contesto Yoga</p>
|
||||
@@ -676,6 +684,36 @@ $italianMonths = [
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($countWaiting > 0) : ?>
|
||||
<div class="bookings-header" style="margin-top:18px;">
|
||||
<span class="title" style="color:#d1698a;"><i class="fas fa-list-ol me-1"></i> Lista d'attesa (<?php echo $countWaiting; ?>)</span>
|
||||
</div>
|
||||
<div class="booking-list">
|
||||
<?php $qpos = 1;
|
||||
foreach ($waitings as $b) :
|
||||
$idbc = (int) $b['idbookingclass'];
|
||||
$fullName = trim($b['first_name'] . ' ' . $b['last_name']);
|
||||
$ini = initials($b['first_name'] ?? '', $b['last_name'] ?? '');
|
||||
$avColor = avatarColor($fullName);
|
||||
?>
|
||||
<div class="booking-item" style="background:#fdf4f8;border-color:#f0d6e2;" data-iduser="<?php echo (int) $b['iduser']; ?>">
|
||||
<div class="avatar" style="background: <?php echo $avColor; ?>;"><?php echo e($ini); ?></div>
|
||||
<div class="booking-info">
|
||||
<span class="booking-name">
|
||||
<span style="display:inline-block;min-width:22px;font-weight:800;color:#d1698a;"><?php echo $qpos; ?>°</span>
|
||||
<?php echo e($fullName); ?>
|
||||
</span>
|
||||
<span class="status-chip" style="background:#fbeef3;color:#d1698a;">In coda</span>
|
||||
</div>
|
||||
<div class="booking-actions">
|
||||
<button class="mini-btn remove" onclick="handleRemoveClick(<?php echo $idbc; ?>)"><i class="fas fa-trash"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<?php $qpos++;
|
||||
endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="add-box">
|
||||
<strong class="d-block mb-2" style="font-size:14px;"><i class="fas fa-user-plus me-1" style="color:#1ebf73;"></i> Aggiungi partecipante</strong>
|
||||
<form class="add-booking-form" action="inserisci_record.php" method="post">
|
||||
|
||||
Reference in New Issue
Block a user