@extends('layouts.app') @php use App\Models\Permission; use App\Support\Format; use App\Support\ProcedureChecklist; use App\Support\ProcedureProgress; $canRecord = auth()->user()->hasAnyPermission(Permission::PROPOSAL_CREATE, Permission::PROPOSAL_UPDATE); $isInsurance = $procedure === ProcedureChecklist::NRSIC; $short = $isInsurance ? 'NRSIC' : 'TA procedure'; $clauses = $isInsurance ? 'clauses 8.1 to 8.10' : 'clauses 2.0 to 7.2'; @endphp @section('title', $short.' — '.$proposal->outlet) @section('heading', $short.' — '.$proposal->outlet) @section('subheading', ProcedureChecklist::procedureLabel($procedure).', '.$clauses) @section('actions') {{-- The two procedures run off the same records, so they sit side by side. --}}
TA NRSIC
Back to the proposal @endsection @section('content') {{-- ---------------------------------------------------------------- --}} {{-- Where the procedure stands --}} {{-- ---------------------------------------------------------------- --}}
Showroom
{{ $proposal->outlet }}
Landlord
{{ $proposal->landlord?->name ?: '—' }}
Steps done
{{ $summary['done'] }} of {{ $summary['total'] }}
Overdue
{{ $summary['overdue'] }}
@if ($summary['late'] > 0)
Done late
{{ $summary['late'] }}
@endif
@if ($summary['next'])
@if ($summary['next']['status'] === ProcedureProgress::OVERDUE) Overdue: @else Next: @endif {{ $summary['next']['title'] }} (clause {{ $summary['next']['clause'] }}, {{ $summary['next']['owner_label'] }})
@elseif ($summary['complete'])
Every step of the procedure has been completed.
@endif
@unless ($canRecord)
You can see where the procedure stands, but recording a step needs permission to update proposals.
@endunless {{-- ---------------------------------------------------------------- --}} {{-- The stages --}} {{-- ---------------------------------------------------------------- --}} @foreach ($stages as $stage)
@if ($stage['complete']) @elseif ($stage['overdue'] > 0) @else @endif {{ $stage['clause'] }} — {{ $stage['title'] }} {{ $stage['done'] }} of {{ count($stage['steps']) }} done @if ($stage['overdue'] > 0) · {{ $stage['overdue'] }} overdue @endif
@foreach ($stage['steps'] as $step) @php $colour = ProcedureProgress::statusColour($step['status']); $isDone = in_array($step['status'], [ProcedureProgress::DONE, ProcedureProgress::LATE], true); @endphp
{{ ProcedureProgress::statusLabel($step['status']) }} {{ $step['title'] }} Clause {{ $step['clause'] }} · {{ $step['owner_label'] }} · {{ $step['allowance'] }} @if ($step['optional']) · only if it applies @endif @if ($step['remarks'] || $step['reference']) @if ($step['reference']) {{ $step['reference'] }} @endif @if ($step['remarks']) {{ $step['remarks'] }} @endif @endif @if ($step['completed_on']) {{ Format::date($step['completed_on']) }} @if ($step['signed_by']) {{ $step['signed_by'] }} @endif @if ($step['status'] === ProcedureProgress::LATE) {{ $step['days_late'] }} working {{ \Illuminate\Support\Str::plural('day', $step['days_late']) }} late @endif @elseif ($step['status'] === ProcedureProgress::SET_ASIDE) Not applicable @elseif ($step['due_on']) Due {{ Format::date($step['due_on']) }} @if ($step['due_overridden']) @endif @if ($step['status'] === ProcedureProgress::OVERDUE) {{ $step['days_late'] }} working {{ \Illuminate\Support\Str::plural('day', $step['days_late']) }} over @endif @elseif ($step['status'] === ProcedureProgress::WAITING) Waiting on the step before @elseif ($step['after'] === null) Ready to start @else {{-- Reachable, but the procedure sets no deadline for it. --}} No deadline set @endif @if ($canRecord)
@csrf @method('PUT')
@if ($step['optional'])
@endif
Untick everything and clear the notes to put the step back to outstanding.
@endif
@endforeach
@endforeach

Deadlines count working days, Monday to Friday, from the step before — public holidays are not allowed for, so a due date is the earliest the deadline can fall.

@endsection