@extends('layouts.app') @section('title', 'Dashboard') @section('content') @php function cascadeRound($value): int { $parts = explode('.', number_format((float) $value, 6, '.', '')); if (count($parts) !== 2) return (int) round($value); $carry = false; for ($i = strlen($parts[1]) - 1; $i >= 0; $i--) { $carry = ((int) $parts[1][$i] + ($carry ? 1 : 0)) >= 5; } return (int) $parts[0] + ($carry ? 1 : 0); } $showSummaryCards = auth()->user()->roles->pluck('name')->intersect(['Super Admin', 'Co Admin', 'Auditor', 'Ticket Admin', 'Visa Admin', 'Branch Manager', 'Fingerprint Admin'])->isNotEmpty(); $showPackages = true; $showRequests = auth()->user()->roles->pluck('name')->intersect(['Super Admin', 'Co Admin', 'Ticket Admin', 'Ticket Staff'])->isNotEmpty(); $stats = [ 'visaSubmitted' => $visaSubmitted, 'visaIssued' => $visaIssued, 'visaPending' => $visaPending, 'inboundTicket' => $inboundTicket, 'outboundTicket' => $outboundTicket, 'pendingTicket' => $pendingTicket, 'totalDue' => $totalDue, 'totalInvoice' => $invoiceCount, // 'totalProfit' => '89,750 SAR', 'totalPassengers' => $totalPassengers, 'totalReceived' => 86, 'departureDone' => 50, 'departureStay' => 30, ]; $reissueRequests = [ ['id' => 1, 'invoiceId' => 1001, 'invoiceNo' => 'INV-2024-001', 'branch' => 'Riyadh', 'passengers' => ['count' => 2]], ]; $addTicketRequests = []; $refundRequests = []; @endphp

Dashboard

@if($showSummaryCards)

Bookings

{{ $invoiceCount }}
Total Invoice (This Month)

Total Sales

@currency(cascadeRound($invoiceTotalAmount), 0, null, cascadeRound($invoiceTotalAmountBdt))
This Month

Total Received (Booking)

@currency(cascadeRound($totalInitialPayment), 0, null, cascadeRound($totalInitialPaymentBdt))
Total
@currency(cascadeRound($initialPaymentCash), 0, null, cascadeRound($initialPaymentCashBdt))
Cash
@currency(cascadeRound($initialPaymentBank), 0, null, cascadeRound($initialPaymentBankBdt))
Bank
This Month

Total Due

@currency(cascadeRound($totalDue), 0, null, cascadeRound($totalDueBdt))
Receivable (This Month)

Total Due Collection

@currency(cascadeRound($totalDueCollection), 0, null, cascadeRound($totalDueCollectionBdt))
Total
@currency(cascadeRound($dueCollectionCash), 0, null, cascadeRound($dueCollectionCashBdt))
Cash
@currency(cascadeRound($dueCollectionBank), 0, null, cascadeRound($dueCollectionBankBdt))
Bank
Collection (This Month)

Fingerprint

{{ $fingerprintApproved }}
Approved
{{ $fingerprintDone }}
Done
{{ $fingerprintProcessing }}
Processing
This Month

Visa

{{ $stats['visaSubmitted'] }}
Submitted
{{ $stats['visaIssued'] }}
Issued
{{ $stats['visaPending'] }}
Pending
This Month

Ticket

{{ $inboundTicket ?? 0 }}
Inbound Ticket
{{ $outboundTicket ?? 0 }}
Outbound Ticket
{{ $pendingTicket ?? 0 }}
Pending Ticket
This Month
{{--
{{ $totalProfit ?? '89,750 SAR' }}
Total Profit
This Month
--}}
{{ $totalPassengers ?? 'N/A' }}
Total Passengers
This Month
{{--
{{ $totalReceived ?? 86 }}
Total Received
New Booking (This Month)
--}} {{--

Departure

{{ $departureDone ?? 50 }}
Done
{{ $departureStay ?? 30 }}
Stay
This Month
--}}
Last Updated: Just now
@endif
@if($showPackages) @php $packageChunks = $packages->chunk(6); @endphp

Packages

@if($packageChunks->count() > 1)
@endif
@forelse($packageChunks as $index => $chunk) @empty
No packages available
@endforelse
@if($packageChunks->count() > 1)
@foreach($packageChunks as $index => $chunk) @endforeach
@endif
@endif @if($showRequests)
@endif
@endsection