@php // Severity → how the checklist row is painted. `ok` always wins. $checkTone = [ 'blocker' => ['icon' => 'x-circle', 'chip' => 'bg-rose-50 text-rose-600', 'badge' => 'rose', 'word' => __('Blocks the close')], 'warning' => ['icon' => 'exclamation-triangle', 'chip' => 'bg-brand-yellow-50 text-brand-yellow-700', 'badge' => 'amber', 'word' => __('Worth a look')], ]; $okTone = ['icon' => 'check-circle', 'chip' => 'bg-emerald-50 text-emerald-600', 'badge' => 'emerald', 'word' => __('Clear')]; @endphp
{{ __('Adjustments') }} {{-- Month picker + the close action. Everything below reads off this. --}}

{{ __('Accounting month') }}

{{ $monthLabel }}

@if ($canManage) @if ($snapshot?->isClosed()) {{ __('Reopen') }} @else {{ __('Close Month') }} {{ __('Closing…') }} @endif @endif
{{-- Where this month stands against the seven-day sign-off rule. The reminders say "three days left"; without this the page they land on said nothing, which is how a deadline becomes an email people stop opening. --}} @if ($deadline)

@if ($deadline['late']) {{ __('Past the sign-off deadline. Close it and the reports stop moving.') }} @elseif ($deadline['remaining'] === 0) {{ __('Today is the last day to close and sign off :month.', ['month' => $monthLabel]) }} @else {{ trans_choice( '{1} One day left to close and sign off :month, the deadline is the :day:suffix.|[2,*] :count days left to close and sign off :month, the deadline is the :day:suffix.', $deadline['remaining'], ['count' => $deadline['remaining'], 'month' => $monthLabel, 'day' => $deadline['deadlineDay'], 'suffix' => 'th'], ) }} @endif

@endif @if ($canManage && ! $snapshot?->isClosed() && count($blockers) > 0)

{{ $blockers[0]['message'] }}

@endif
{{-- Locked banner: what was frozen, by whom, when. --}} @if ($snapshot)

{{ $snapshot->isClosed() ? __(':month is closed', ['month' => $monthLabel]) : __(':month was reopened', ['month' => $monthLabel]) }}

@if ($snapshot->isClosed()) {{ __('Closed by :who on :when.', [ 'who' => $snapshot->closer?->name ?? $snapshot->locker?->name ?? __('the system'), 'when' => $snapshot->locked_at?->timezone(config('app.display_timezone'))->format('j M Y, H:i') ?? '—', ]) }} @else {{ __('Reopened by :who on :when. Reason: :reason', [ 'who' => $snapshot->reopener?->name ?? __('an administrator'), 'when' => $snapshot->reopened_at?->timezone(config('app.display_timezone'))->format('j M Y, H:i') ?? '—', 'reason' => $snapshot->reopen_reason ?: __('not recorded'), ]) }} @endif

{{ $snapshot->isClosed() ? __('Locked') : __('Open for correction') }}
@php $frozen = [ ['label' => __('Cash collected'), 'value' => $snapshot->cash_collected_base], ['label' => __('Gross profit'), 'value' => $snapshot->gross_profit_base], ['label' => __('Net profit'), 'value' => $snapshot->net_profit_base], ['label' => __('Retained'), 'value' => $snapshot->retained_profit_base], ]; $frozenCash = [ ['label' => __('Opening cash'), 'value' => $snapshot->opening_cash_base], ['label' => __('Cash in'), 'value' => $snapshot->cash_in_base], ['label' => __('Cash out'), 'value' => $snapshot->cash_out_base], ['label' => __('Closing cash'), 'value' => $snapshot->closing_cash_base], ['label' => __('of which walk-in change held'), 'value' => $snapshot->held_change_base, 'muted' => true], ]; @endphp

{{ __('Frozen profit & loss') }}

@foreach ($frozen as $f)
{{ $f['label'] }}
{{ $baseCode }} {{ number_format((float) $f['value'], 2) }}
@endforeach

{{ __('Frozen cash block') }}

@foreach ($frozenCash as $f)
{{ $f['label'] }}
{{ $baseCode }} {{ number_format((float) $f['value'], 2) }}
@endforeach

{{ __('Next month must open on this closing figure. Change held for walk-in customers is inside it and carries forward as theirs.') }}

@endif {{-- Headline cards for the selected month --}}
@foreach ($metrics as $m) @php $tone = $m['delta'] === null ? 'muted' : ($m['delta'] >= 0 ? 'up' : 'down'); $pill = ['up' => 'bg-emerald-50 text-emerald-700', 'down' => 'bg-rose-50 text-rose-700', 'muted' => 'bg-slate-100 text-slate-500'][$tone]; @endphp

{{ $m['label'] }}

{{ $m['value'] }}

@if ($m['delta'] !== null) {{ number_format(abs($m['delta']), 0) }}% {{ $m['deltaLabel'] }} @else {{ $m['sub'] }} @endif
@endforeach
{{-- Pre-close review --}}

{{ __('Pre-close review') }}

{{ __('This month beside last month. Anything moving :pct% or more is flagged, in either direction.', ['pct' => 25]) }}

@php $lastGroup = null; @endphp @foreach ($review as $r) @if ($lastGroup !== null && $r['group'] !== $lastGroup) @endif @php $lastGroup = $r['group']; @endphp @endforeach
{{ __('Figure') }} {{ $monthLabel }} {{ $previousLabel }} {{ __('Change') }}
{{ __('Cash position') }}
{{ $r['label'] }} @if ($r['flagged']) @endif {{ number_format((float) $r['now'], 2) }} {{ number_format((float) $r['was'], 2) }} {{ $r['delta'] >= 0 ? '+' : '−' }}{{ number_format(abs((float) $r['delta']), 2) }} @if ($r['pct'] !== null) ({{ number_format(abs((float) $r['pct']), 1) }}%) @endif
{{-- Readiness checklist --}}

{{ __('Readiness checklist') }}

{{ __('Everything that should have landed in :month before it is frozen.', ['month' => $monthLabel]) }}

{{ count($blockers) > 0 ? __('Not ready') : (count($warnings) > 0 ? trans_choice('{1} :count loose end|[2,*] :count loose ends', count($warnings), ['count' => count($warnings)]) : __('Ready to close')) }}
    @foreach ($checklist as $item) @php $tone = $item['ok'] ? $okTone : $checkTone[$item['severity']]; @endphp
  • {{ $item['label'] }}

    @unless ($item['ok']) {{ $tone['word'] }} @endunless

    {{ $item['message'] }}

    @if (! $item['ok'] && $item['route']) {{ __('Fix in :page', ['page' => $item['cta']]) }} @endif
  • @endforeach
{{-- Closed months --}}

{{ __('Closed months') }}

{{ __('The frozen figure is never edited. Where a correction was authorised, it is shown as a separate reconciling line.') }}

@forelse ($history as $row) @php $key = sprintf('%04d-%02d', $row->period_year, $row->period_month); $adj = (float) ($adjustmentTotals[$key] ?? 0); @endphp @empty @endforelse
{{ __('Month') }} {{ __('Status') }} {{ __('Closed by') }} {{ __('Net profit (frozen)') }} {{ __('Adjustments') }} {{ __('Closing cash') }} {{ __('Actions') }}
{{ \Illuminate\Support\Carbon::create($row->period_year, $row->period_month, 1)->format('F Y') }} {{ $row->isClosed() ? __('Locked') : __('Reopened') }} {{ $row->closer?->name ?? $row->locker?->name ?? '—' }} {{ $row->locked_at?->timezone(config('app.display_timezone'))->format('j M Y, H:i') ?? '—' }} {{ number_format((float) $row->net_profit_base, 2) }} @if (abs($adj) > 0.004) {{ $adj >= 0 ? '+' : '−' }}{{ number_format(abs($adj), 2) }} {{ __('adjusted :amount', ['amount' => number_format((float) $row->net_profit_base + $adj, 2)]) }} @else — @endif {{ number_format((float) $row->closing_cash_base, 2) }}
@if ($canManage && $row->isClosed()) @endif
{{-- Reopen: reason is mandatory and it is recorded against the month. --}} {{ __('Reopen a closed month') }}

{{ __('Reopening un-freezes the month: its figures start moving again and back-dated writes are accepted. Most corrections belong in an authorised adjustment instead, which leaves the closed figure intact.') }}

{{ __('Recorded against the month with your name and the time, and visible to every director.') }}

{{ __('Cancel') }} {{ __('Reopen Month') }} {{ __('Reopening…') }}