@extends('layouts.app')
@section('title', 'Cashier Shift / RCD')
@section('content')
@php
// -------- Static Mock Data (MVP) --------
$user = 'cashier1@lgu.local';
// Assigned OR series for this cashier
$series = ['code' => '2025-A', 'start' => 1000, 'end' => 1999, 'next' => 1124];
// Current shift (toggle status to 'CLOSED' to see state changes)
$shift = [
'status' => 'OPEN', // 'OPEN' | 'CLOSED'
'opened_at' => '2025-10-18 08:00',
'closed_at' => null,
'begin_or' => '001120',
'end_or' => null,
];
// Issued ORs (this shift). Note: 'Voided' rows will be excluded from totals.
$ors = [
[
'or' => '001120',
'time' => '09:00',
'payor' => 'Dev Coffee Roasters',
'status' => 'Issued',
'gross' => 12750.0,
'cash' => 12750.0,
'check' => 0.0,
'in_deposit' => false,
],
[
'or' => '001121',
'time' => '09:14',
'payor' => 'Byte Bakery',
'status' => 'Voided',
'gross' => 8200.0,
'cash' => 0.0,
'check' => 0.0,
'in_deposit' => false,
],
[
'or' => '001122',
'time' => '09:30',
'payor' => 'Pixel Print Shop',
'status' => 'Adjusted',
'gross' => 9500.0,
'cash' => 9500.0,
'check' => 0.0,
'in_deposit' => false,
],
[
'or' => '001123',
'time' => '10:05',
'payor' => 'OrangeShake',
'status' => 'Issued',
'gross' => 6400.0,
'cash' => 1400.0,
'check' => 5000.0,
'in_deposit' => true,
],
// add more rows if you want to test totals/scroll
];
// Compute simple totals & range (exclude Voids)
$totals = ['gross' => 0.0, 'cash' => 0.0, 'check' => 0.0, 'count' => 0];
$firstIssued = null;
$lastIssued = null;
foreach ($ors as $row) {
if ($row['status'] !== 'Voided') {
$totals['gross'] += $row['gross'];
$totals['cash'] += $row['cash'];
$totals['check'] += $row['check'];
$totals['count']++;
// range derived from non-voided only (you can change to include all)
if ($firstIssued === null || strcmp($row['or'], $firstIssued) < 0) {
$firstIssued = $row['or'];
}
if ($lastIssued === null || strcmp($row['or'], $lastIssued) > 0) {
$lastIssued = $row['or'];
}
}
}
// RCD draft (static). Online is Phase 2.
$rcd = [
'date' => '2025-10-18',
'cashier' => $user,
'cash' => $totals['cash'],
'check' => $totals['check'],
'online' => 0.0,
'count' => $totals['count'],
'first_or' => $firstIssued ?? '—',
'last_or' => $lastIssued ?? '—',
'deposit_ref' => null,
];
@endphp
{{-- LEFT: Shift Status + RCD Summary --}}
{{-- State banner --}}
@if ($shift['status'] === 'OPEN')
Shift is OPEN: OR issuance allowed. RCD
is accumulating totals.
@else
Shift is CLOSED: Issuance locked. Review
and finalize RCD.
@endif
Assigned Series
{{ $series['code'] }}
({{ str_pad($series['start'], 4, '0', STR_PAD_LEFT) }}–{{ str_pad($series['end'], 4, '0', STR_PAD_LEFT) }})
Next OR
{{ str_pad($series['next'], 4, '0', STR_PAD_LEFT) }}
Posting receipts is allowed only while the shift is OPEN.
RCD Date
{{ $rcd['date'] }}
OR Range
{{ $rcd['first_or'] }} – {{ $rcd['last_or'] }}
| Count (Issued/Adjusted) |
{{ $rcd['count'] }} |
| Cash |
{{ number_format($rcd['cash'], 2) }} |
| Check |
{{ number_format($rcd['check'], 2) }} |
| Online |
{{ number_format($rcd['online'], 2) }} |
| Total |
{{ number_format($rcd['cash'] + $rcd['check'] + $rcd['online'], 2) }}
|
| Deposit Ref |
{{ $rcd['deposit_ref'] ?? '—' }} |
Finalizing locks new postings until a new shift is opened.
{{-- RIGHT: Issued ORs --}}
| OR No |
Time |
Payor |
Status |
Gross |
Cash |
Check |
|
@foreach ($ors as $r)
|
{{ $r['or'] }}
@if (!empty($r['in_deposit']))
Deposited
@endif
|
{{ $r['time'] }} |
{{ $r['payor'] }} |
@if ($r['status'] === 'Issued')
Issued
@elseif($r['status'] === 'Voided')
Voided
@else
Adjusted
@endif
|
{{ number_format($r['gross'], 2) }} |
{{ number_format($r['cash'], 2) }} |
{{ number_format($r['check'], 2) }} |
|
@endforeach
| Totals (excl. Voids) |
{{ number_format($totals['gross'], 2) }} |
{{ number_format($totals['cash'], 2) }} |
{{ number_format($totals['check'], 2) }} |
|
Totals include all non-voided ORs belonging to this shift. Voids remain visible
for audit but are excluded from RCD totals.
- Shift opened by {{ $user }} at 08:00
- OR 001120 issued at 09:00
- OR 001121 voided at 09:16 (Supervisor: treasurer@lgu.local)
- Draft RCD updated at 10:15
{{-- Open Shift (static confirm) --}}
Confirm opening a new shift for {{ $user }} with series
{{ $series['code'] }}?
{{-- Close Shift (static confirm) --}}
Closing the shift will stop OR issuance. Proceed?
{{-- Finalize RCD (static confirm) --}}
{{-- Toasts --}}
@endsection
@push('scripts')
@endpush