Commit d0ef9ed6 authored by Mahmoud Aglan's avatar Mahmoud Aglan

sgjdfh

parent d01e77d7
......@@ -28,17 +28,17 @@ class FacilityDashboardController extends Controller
);
$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]
);
$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]
);
$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]
);
......
......@@ -36,7 +36,7 @@ final class MirrorDisplayService
$facilityId = (int) $f['id'];
$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
WHERE facility_id = ? AND reservation_date = ? AND status IN ('confirmed', 'checked_in')
AND start_time <= ? AND end_time > ?
......@@ -45,7 +45,7 @@ final class MirrorDisplayService
);
$nextBooking = $db->selectOne(
"SELECT id, purpose, start_time, end_time
"SELECT id, notes, start_time, end_time
FROM reservations
WHERE facility_id = ? AND reservation_date = ? AND status = 'confirmed'
AND start_time > ?
......@@ -89,12 +89,12 @@ final class MirrorDisplayService
'capacity' => (int) ($f['capacity'] ?? 0),
'current_status' => $status,
'current_booking' => $currentBooking ? [
'purpose' => $currentBooking['purpose'] ?? '',
'purpose' => $currentBooking['notes'] ?? '',
'start_time' => $currentBooking['start_time'],
'end_time' => $currentBooking['end_time'],
] : null,
'next_booking' => $nextBooking ? [
'purpose' => $nextBooking['purpose'] ?? '',
'purpose' => $nextBooking['notes'] ?? '',
'start_time' => $nextBooking['start_time'],
'end_time' => $nextBooking['end_time'],
] : null,
......
......@@ -50,15 +50,15 @@
<?= e(substr($b['start_time'], 0, 5)) ?><?= e(substr($b['end_time'], 0, 5)) ?>
</div>
<div style="flex:1;font-size:13px;color:#1A1A2E;">
<?= e($b['purpose'] ?? 'حجز') ?>
<?= e($b['notes'] ?? 'حجز') ?>
</div>
<div>
<span style="font-size:11px;padding:2px 8px;border-radius:8px;background:<?= $color ?>15;color:<?= $color ?>;">
<?= ['confirmed'=>'مؤكد','checked_in'=>'جاري','completed'=>'مكتمل'][$b['status']] ?? $b['status'] ?>
</span>
</div>
<?php if ($b['final_amount'] > 0): ?>
<div style="font-size:12px;color:#059669;font-weight:600;"><?= number_format((float) $b['final_amount'], 0) ?> ج.م</div>
<?php if ($b['total_amount'] > 0): ?>
<div style="font-size:12px;color:#059669;font-weight:600;"><?= number_format((float) $b['total_amount'], 0) ?> ج.م</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
......@@ -91,8 +91,8 @@
<tr>
<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;"><?= e($b['purpose'] ?? '—') ?></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;"><?= e($b['notes'] ?? '—') ?></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>
<?php endforeach; ?>
</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