@php use App\Models\AssetVerification; $statusMeta = [ AssetVerification::OPEN => ['label' => __('Being counted'), 'color' => 'sky'], AssetVerification::SUBMITTED => ['label' => __('Awaiting approval'), 'color' => 'amber'], AssetVerification::APPROVED => ['label' => __('Approved'), 'color' => 'emerald'], AssetVerification::RETURNED => ['label' => __('Sent back'), 'color' => 'rose'], ]; // `on` is written out in full rather than composed from the colour: Tailwind // only ships classes it can see as literal strings in the source. $resultMeta = [ AssetVerification::PRESENT => [ 'label' => __('Present'), 'color' => 'emerald', 'icon' => 'check-circle', 'on' => 'border-emerald-300 bg-emerald-50 text-emerald-700 ring-2 ring-emerald-100', ], AssetVerification::DAMAGED => [ 'label' => __('Damaged'), 'color' => 'amber', 'icon' => 'wrench-screwdriver', 'on' => 'border-amber-300 bg-amber-50 text-amber-700 ring-2 ring-amber-100', ], AssetVerification::MISSING => [ 'label' => __('Missing'), 'color' => 'rose', 'icon' => 'exclamation-triangle', 'on' => 'border-rose-300 bg-rose-50 text-rose-700 ring-2 ring-rose-100', ], ]; $tonePill = [ 'up' => 'bg-emerald-50 text-emerald-700', 'down' => 'bg-rose-50 text-rose-700', 'muted' => 'bg-slate-100 text-slate-500', ]; $countable = $sheet?->isCountable() ?? false; $daysLeft = $due->daysRemaining(); @endphp
@if ($sheet && $countable && $canCount) {{-- :disabled rather than @disabled: a Blade directive inside a component's opening tag confuses the attribute parser. --}} {{ __('Send for approval') }} @endif @if ($sheet?->isAwaitingApproval() && $canApprove) {{ __('Review count') }} @endif {{-- The one thing the page has to say before anything else: where this month's count stands, and whose move it is. --}} @if ($sheet)

{{ $sheet->periodLabel() }}

{{ $statusMeta[$sheet->status]['label'] ?? $sheet->status }}

@if ($sheet->isApproved()) {{ __('Approved by :who on :when.', ['who' => $sheet->reviewer?->name ?? __('a director'), 'when' => $sheet->reviewed_at?->timezone(config('app.display_timezone'))->format('j M Y')]) }} @elseif ($sheet->isAwaitingApproval()) {{ __('Sent up by :who on :when. Nothing is written to the register until a director approves it.', ['who' => $sheet->submitter?->name ?? __('production'), 'when' => $sheet->submitted_at?->timezone(config('app.display_timezone'))->format('j M Y')]) }} @elseif ($daysLeft >= 0) {{ trans_choice('{0} Due today.|{1} :count day left to finish and get it signed off.|[2,*] :count days left to finish and get it signed off.', $daysLeft, ['count' => $daysLeft]) }} @else {{ __('Overdue by :days day(s). :month has not been closed off against what is actually in the building.', ['days' => abs($daysLeft), 'month' => $sheet->periodLabel()]) }} @endif

{{ __('Progress') }} {{ $sheet->checkedCount() }} / {{ $sheet->lineCount() }}
@if ($sheet->status === AssetVerification::RETURNED && $sheet->review_note)

{{ __('Sent back by :who', ['who' => $sheet->reviewer?->name ?? __('a director')]) }}

{{ $sheet->review_note }}

@endif @if ($sheet->notes)

{{ __('Note from the count') }}

{{ $sheet->notes }}

@endif
@endif {{-- Counters. No money here on purpose: this screen is for the floor. --}}
@foreach ($kpis as $m)

{{ $m['label'] }}

{{ $m['value'] }}

{{ $m['sub'] }}
@endforeach
{{-- The sheet --}}
@foreach ($filters as $key => $label) @endforeach
@if ($countable && $canCount) {{ __('All present on this page') }} @endif
@forelse ($lines as $line) @empty @endforelse
{{ __('Asset') }} {{ __('Register says') }} {{ __('Found') }} {{ __('Answer') }}

{{ $line->asset?->name ?? __('(removed)') }}

{{ collect([$line->asset?->asset_tag, $line->asset?->serial_number, $line->asset?->category])->filter()->join(' · ') ?: '—' }}

{{ $line->expected_location ?: __('No location recorded') }} @if ($line->expected_condition) · {{ $line->expected_condition }} @endif @if ($line->isChecked())
@if ($line->hasMoved())

{{ $line->location_found }}

@elseif ($line->location_found)

{{ $line->location_found }}

@endif @if ($line->condition_found && $line->condition_found !== $line->expected_condition)

{{ __('Condition: :c', ['c' => $line->condition_found]) }}

@endif @if ($line->note)

{{ $line->note }}

@endif

{{ __('by :who', ['who' => $line->checker?->name ?? '—']) }}

@else {{ __('Not checked yet') }} @endif
@if ($countable && $canCount)
@foreach ($resultMeta as $key => $meta) @endforeach
@elseif ($line->isChecked()) {{ $resultMeta[$line->result]['label'] ?? $line->result }} @else — @endif
{{ $lines->links() }}
{{-- Past counts. The gaps are the point: a month with no row is a month nobody checked, and that is a fact the register should not hide. --}} @if ($history->isNotEmpty())

{{ __('Past counts') }}

{{ __('Every month the register was checked against the building.') }}

@foreach ($history as $past) @endforeach
{{ __('Month') }} {{ __('Status') }} {{ __('Present') }} {{ __('Damaged') }} {{ __('Missing') }} {{ __('Counted by') }} {{ __('Approved by') }}
{{ $statusMeta[$past->status]['label'] ?? $past->status }} {{ $past->present_count }} {{ $past->damaged_count }} {{ $past->missing_count }} {{ $past->submitter?->name ?? '—' }} {{ $past->reviewer?->name ?? '—' }}
@endif
{{-- Detail for one line: where it actually is, what state it is in. --}} {{ __('What did you find?') }}

{{ __('Only fill in what is different from the register. Saving this counts the item as present unless you have already flagged it.') }}

{{ __('Cancel') }} {{ __('Save') }} {{ __('Saving…') }}
{{-- Send the finished sheet up. --}} {{ __('Send the count for approval') }} @if ($sheet)

{{ __('All :total item(s) have been answered: :present present, :damaged damaged, :missing missing. A director will check it over and sign it off.', [ 'total' => $sheet->lineCount(), 'present' => $sheet->resultCount(AssetVerification::PRESENT), 'damaged' => $sheet->resultCount(AssetVerification::DAMAGED), 'missing' => $sheet->resultCount(AssetVerification::MISSING), ]) }}

@endif
{{ __('Not yet') }} {{ __('Send for approval') }} {{ __('Sending…') }}
{{-- A director's ruling. --}} {{ __('Review the count') }} @if ($sheet)

{{ __(':who checked all :total item(s) — :present present, :damaged damaged, :missing missing.', [ 'who' => $sheet->submitter?->name ?? __('Production'), 'total' => $sheet->lineCount(), 'present' => $sheet->resultCount(AssetVerification::PRESENT), 'damaged' => $sheet->resultCount(AssetVerification::DAMAGED), 'missing' => $sheet->resultCount(AssetVerification::MISSING), ]) }}

{{ __('Approving stamps every item as verified today and applies the locations and conditions they corrected. Sending it back changes nothing and reopens the sheet.') }}

@endif
{{ __('Cancel') }} {{ __('Approve') }} {{ __('Approving…') }}