Commit d0ef9ed6 authored by Mahmoud Aglan's avatar Mahmoud Aglan

sgjdfh

parent d01e77d7
...@@ -28,17 +28,17 @@ class FacilityDashboardController extends Controller ...@@ -28,17 +28,17 @@ class FacilityDashboardController extends Controller
); );
$todayRevenue = $db->selectOne( $todayRevenue = $db->selectOne(
"SELECT COALESCE(SUM(final_amount), 0) AS total FROM reservations WHERE facility_id = ? AND reservation_date = ? AND payment_status = 'paid'", "SELECT COALESCE(SUM(total_amount), 0) AS total FROM reservations WHERE facility_id = ? AND reservation_date = ? AND payment_id IS NOT NULL AND status NOT IN ('cancelled')",
[(int) $id, $today] [(int) $id, $today]
); );
$weekRevenue = $db->selectOne( $weekRevenue = $db->selectOne(
"SELECT COALESCE(SUM(final_amount), 0) AS total FROM reservations WHERE facility_id = ? AND reservation_date >= ? AND payment_status = 'paid'", "SELECT COALESCE(SUM(total_amount), 0) AS total FROM reservations WHERE facility_id = ? AND reservation_date >= ? AND payment_id IS NOT NULL AND status NOT IN ('cancelled')",
[(int) $id, $weekStart] [(int) $id, $weekStart]
); );
$monthRevenue = $db->selectOne( $monthRevenue = $db->selectOne(
"SELECT COALESCE(SUM(final_amount), 0) AS total FROM reservations WHERE facility_id = ? AND reservation_date >= ? AND payment_status = 'paid'", "SELECT COALESCE(SUM(total_amount), 0) AS total FROM reservations WHERE facility_id = ? AND reservation_date >= ? AND payment_id IS NOT NULL AND status NOT IN ('cancelled')",
[(int) $id, $monthStart] [(int) $id, $monthStart]
); );
......
...@@ -36,7 +36,7 @@ final class MirrorDisplayService ...@@ -36,7 +36,7 @@ final class MirrorDisplayService
$facilityId = (int) $f['id']; $facilityId = (int) $f['id'];
$currentBooking = $db->selectOne( $currentBooking = $db->selectOne(
"SELECT id, member_id, purpose, start_time, end_time, status "SELECT id, member_id, notes, start_time, end_time, status
FROM reservations FROM reservations
WHERE facility_id = ? AND reservation_date = ? AND status IN ('confirmed', 'checked_in') WHERE facility_id = ? AND reservation_date = ? AND status IN ('confirmed', 'checked_in')
AND start_time <= ? AND end_time > ? AND start_time <= ? AND end_time > ?
...@@ -45,7 +45,7 @@ final class MirrorDisplayService ...@@ -45,7 +45,7 @@ final class MirrorDisplayService
); );
$nextBooking = $db->selectOne( $nextBooking = $db->selectOne(
"SELECT id, purpose, start_time, end_time "SELECT id, notes, start_time, end_time
FROM reservations FROM reservations
WHERE facility_id = ? AND reservation_date = ? AND status = 'confirmed' WHERE facility_id = ? AND reservation_date = ? AND status = 'confirmed'
AND start_time > ? AND start_time > ?
...@@ -89,12 +89,12 @@ final class MirrorDisplayService ...@@ -89,12 +89,12 @@ final class MirrorDisplayService
'capacity' => (int) ($f['capacity'] ?? 0), 'capacity' => (int) ($f['capacity'] ?? 0),
'current_status' => $status, 'current_status' => $status,
'current_booking' => $currentBooking ? [ 'current_booking' => $currentBooking ? [
'purpose' => $currentBooking['purpose'] ?? '', 'purpose' => $currentBooking['notes'] ?? '',
'start_time' => $currentBooking['start_time'], 'start_time' => $currentBooking['start_time'],
'end_time' => $currentBooking['end_time'], 'end_time' => $currentBooking['end_time'],
] : null, ] : null,
'next_booking' => $nextBooking ? [ 'next_booking' => $nextBooking ? [
'purpose' => $nextBooking['purpose'] ?? '', 'purpose' => $nextBooking['notes'] ?? '',
'start_time' => $nextBooking['start_time'], 'start_time' => $nextBooking['start_time'],
'end_time' => $nextBooking['end_time'], 'end_time' => $nextBooking['end_time'],
] : null, ] : null,
......
...@@ -50,15 +50,15 @@ ...@@ -50,15 +50,15 @@
<?= e(substr($b['start_time'], 0, 5)) ?><?= e(substr($b['end_time'], 0, 5)) ?> <?= e(substr($b['start_time'], 0, 5)) ?><?= e(substr($b['end_time'], 0, 5)) ?>
</div> </div>
<div style="flex:1;font-size:13px;color:#1A1A2E;"> <div style="flex:1;font-size:13px;color:#1A1A2E;">
<?= e($b['purpose'] ?? 'حجز') ?> <?= e($b['notes'] ?? 'حجز') ?>
</div> </div>
<div> <div>
<span style="font-size:11px;padding:2px 8px;border-radius:8px;background:<?= $color ?>15;color:<?= $color ?>;"> <span style="font-size:11px;padding:2px 8px;border-radius:8px;background:<?= $color ?>15;color:<?= $color ?>;">
<?= ['confirmed'=>'مؤكد','checked_in'=>'جاري','completed'=>'مكتمل'][$b['status']] ?? $b['status'] ?> <?= ['confirmed'=>'مؤكد','checked_in'=>'جاري','completed'=>'مكتمل'][$b['status']] ?? $b['status'] ?>
</span> </span>
</div> </div>
<?php if ($b['final_amount'] > 0): ?> <?php if ($b['total_amount'] > 0): ?>
<div style="font-size:12px;color:#059669;font-weight:600;"><?= number_format((float) $b['final_amount'], 0) ?> ج.م</div> <div style="font-size:12px;color:#059669;font-weight:600;"><?= number_format((float) $b['total_amount'], 0) ?> ج.م</div>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
...@@ -91,8 +91,8 @@ ...@@ -91,8 +91,8 @@
<tr> <tr>
<td style="padding:8px;border-bottom:1px solid #F3F4F6;"><?= e($b['reservation_date']) ?></td> <td style="padding:8px;border-bottom:1px solid #F3F4F6;"><?= e($b['reservation_date']) ?></td>
<td style="padding:8px;border-bottom:1px solid #F3F4F6;direction:ltr;text-align:right;"><?= e(substr($b['start_time'],0,5)) ?><?= e(substr($b['end_time'],0,5)) ?></td> <td style="padding:8px;border-bottom:1px solid #F3F4F6;direction:ltr;text-align:right;"><?= e(substr($b['start_time'],0,5)) ?><?= e(substr($b['end_time'],0,5)) ?></td>
<td style="padding:8px;border-bottom:1px solid #F3F4F6;"><?= e($b['purpose'] ?? '—') ?></td> <td style="padding:8px;border-bottom:1px solid #F3F4F6;"><?= e($b['notes'] ?? '—') ?></td>
<td style="padding:8px;border-bottom:1px solid #F3F4F6;text-align:left;"><?= $b['final_amount'] > 0 ? number_format((float)$b['final_amount'], 0) . ' ج.م' : '—' ?></td> <td style="padding:8px;border-bottom:1px solid #F3F4F6;text-align:left;"><?= $b['total_amount'] > 0 ? number_format((float)$b['total_amount'], 0) . ' ج.م' : '—' ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment