Review — {{ $procurement->reference }} — ProcureFlow Procurement Review Engine @php $stages = \App\Models\Procurement::stages(); $stageLabel = $stages[$procurement->current_stage] ?? 'Unknown Stage'; $statusColors = [ 'draft' => ['badge' => 'badge-gray', 'dot' => '#9ca3af'], 'active' => ['badge' => 'badge-blue', 'dot' => '#3b82f6'], 'completed' => ['badge' => 'badge-green', 'dot' => '#10b981'], 'cancelled' => ['badge' => 'badge-red', 'dot' => '#ef4444'], ]; $sc = $statusColors[$procurement->status] ?? $statusColors['draft']; $riskColors = [ 'Low' => ['badge' => 'badge-teal', 'bg' => '#f0fdfa', 'text' => '#0d9488'], 'Medium' => ['badge' => 'badge-amber', 'bg' => '#fffbeb', 'text' => '#d97706'], 'High' => ['badge' => 'badge-orange', 'bg' => '#fff7ed', 'text' => '#ea580c'], 'Critical' => ['badge' => 'badge-red', 'bg' => '#fef2f2', 'text' => '#dc2626'], ]; $rc = $riskColors[$procurement->risk_level ?? 'Low'] ?? $riskColors['Low']; @endphp
Procurements {{ $procurement->reference }} Review Engine
{{ $procurement->title }} {{ ucfirst($procurement->status) }} Stage {{ $procurement->current_stage }}: {{ $stageLabel }}
Ref: {{ $procurement->reference }} Type: {{ $procurement->type }} Method: {{ $procurement->method ?? '—' }} Unit: {{ $procurement->unit ?? '—' }} Owner: {{ $procurement->creator->name ?? 'Unassigned' }} Org: {{ $procurement->tenant->name ?? '—' }}
Est. Value
{{ $procurement->currency ?? 'USD' }} {{ number_format($procurement->estimated_value, 0) }}
Risk Level
{{ $procurement->risk_level ?? 'Low' }}
Close Date
@if($procurement->planned_close_date) {{ $procurement->planned_close_date->format('M d, Y') }} @if($procurement->planned_close_date->isPast() && $procurement->status === 'active') ▲ OVERDUE @endif @else Not set @endif
Started
{{ $procurement->created_at->format('M d, Y') }}
@php $pct = $validation['percent']; $ready = $validation['ready']; @endphp
@if($ready)
Ready for Approval ✅
All {{ $validation['total'] }} validation checks passed. This procurement may proceed.
@else
Not Ready — Blockers Detected ❌
{{ $validation['passing'] }} of {{ $validation['total'] }} checks passed. Resolve all issues before approving.
@endif
{{ $pct }}%
Readiness
@if(count($riskFlags) > 0)
@foreach($riskFlags as $flag) @php $flagColors = [ 'critical' => ['bg' => '#fef2f2', 'border' => '#fca5a5', 'text' => '#991b1b', 'icon' => '#dc2626'], 'high' => ['bg' => '#fff7ed', 'border' => '#fdba74', 'text' => '#9a3412', 'icon' => '#ea580c'], 'medium' => ['bg' => '#fffbeb', 'border' => '#fcd34d', 'text' => '#92400e', 'icon' => '#d97706'], 'low' => ['bg' => '#f0fdf4', 'border' => '#86efac', 'text' => '#14532d', 'icon' => '#16a34a'], ]; $fc = $flagColors[$flag['severity']] ?? $flagColors['medium']; @endphp
{{ strtoupper($flag['severity']) }} RISK — {{ $flag['title'] }}
{{ $flag['detail'] }}
@endforeach
@endif
Review Sections
 Stage Checklist {{ $checklistPct }}%
 Validation Gate {{ $validation['percent'] }}%
 Documents {{ $procurement->documents->count() }}
 Compliance
 Approvals @php $pendingApprCount = $procurement->approvals->where('status','pending')->count(); @endphp @if($pendingApprCount > 0) {{ $pendingApprCount }} @endif
 Risk & Issues @if(count($riskFlags) > 0) {{ count($riskFlags) }} @endif
 Data Snapshot
 Roadmap
 Audit Trail {{ $auditTrail->count() }}
 Actions
 Custom Review @if($customReview?->isSubmitted()) @elseif($customReview) Draft @endif
Stage {{ $procurement->current_stage }} Checklist — {{ $stageLabel }}
{{ $checklist->where('is_checked', true)->count() }}/{{ $checklist->count() }} complete
{{ $checklistPct }}%
@if($checklist->count() > 0) @foreach($checklist->sortByDesc('is_required') as $item) @endforeach
Checklist Item Required Status Checked By Checked At
@csrf
{{ $item->item }} @if($item->is_required) Required @else Optional @endif @if($item->is_checked) Complete @else {{ $item->is_required ? 'Missing' : 'Pending' }} @endif {{ $item->checker->name ?? '—' }} {{ $item->checked_at ? $item->checked_at->format('M d, Y') : '—' }}
@else
No checklist items for Stage {{ $procurement->current_stage }}
Add checklist templates in Settings → Compliance Checklists.
@endif
Validation Gate — Readiness Engine
@php $grouped = collect($validation['checks'])->groupBy('section'); $sectionLabels = [ 'fields' => 'Core Fields', 'documents' => 'Documents', 'bids' => 'Bid Management', 'evaluation' => 'Evaluation', 'approvals' => 'Approvals', 'checklist' => 'Stage Checklist', ]; @endphp @foreach($grouped as $section => $items)
{{ $sectionLabels[$section] ?? ucfirst($section) }}
@foreach($items as $check)
@if($check['pass'])
@else
@endif
{{ $check['label'] }}
@if(!empty($check['note']))
⚠ {{ $check['note'] }}
@endif
{{ $check['pass'] ? 'PASS' : 'FAIL' }}
@endforeach
@endforeach
{{ $validation['ready'] ? '✅ All checks passed — Ready for approval' : '❌ ' . ($validation['total'] - $validation['passing']) . ' check(s) failing — Not ready' }}
{{ $validation['passing'] }}/{{ $validation['total'] }} passing
Document Verification Panel
{{ $procurement->documents->count() }} document(s)
@if($procurement->documents->count() > 0) @foreach($procurement->documents as $doc) @endforeach
Document Name Type Version Stage Status Uploaded By Date Actions
{{ $doc->name }}
@if($doc->checksum)
{{ substr($doc->checksum, 0, 20) }}…
@endif
{{ $doc->type }} v{{ $doc->version ?? 1 }} Stage {{ $doc->stage_at_upload ?? '—' }} @if($doc->is_locked) 🔒 Locked @else ✓ Available @endif {{ $doc->uploader->name ?? '—' }} {{ $doc->created_at->format('M d, Y') }}
@else
No documents uploaded
Upload documents from the procurement detail page.
Go to Procurement
@endif
Compliance & Policy Checks
@foreach($complianceChecks as $check) @php $checkColors = [ 'pass' => ['bg' => '#f0fdf4', 'border' => '#86efac', 'badge' => '#10b981', 'icon_bg' => '#10b981', 'icon_stroke' => 'white'], 'warning' => ['bg' => '#fffbeb', 'border' => '#fcd34d', 'badge' => '#d97706', 'icon_bg' => '#f59e0b', 'icon_stroke' => 'white'], 'fail' => ['bg' => '#fef2f2', 'border' => '#fca5a5', 'badge' => '#dc2626', 'icon_bg' => '#ef4444', 'icon_stroke' => 'white'], ]; $cc = $checkColors[$check['status']] ?? $checkColors['warning']; @endphp
@if($check['status'] === 'pass') @elseif($check['status'] === 'warning') @else @endif
{{ $check['label'] }}
{{ $check['detail'] }}
{{ strtoupper($check['status']) }}
@endforeach
@if(empty($complianceChecks))
No compliance checks run for current stage.
@endif
Stakeholder & Approval Status
@php $totalAppr = $procurement->approvals->count(); $approved = $procurement->approvals->where('status','approved')->count(); $pendingAppr = $procurement->approvals->where('status','pending')->count(); $rejectedAppr= $procurement->approvals->where('status','rejected')->count(); @endphp
{{ $approved }} Approved {{ $pendingAppr }} Pending @if($rejectedAppr > 0){{ $rejectedAppr }} Rejected@endif
@if($procurement->approvals->count() > 0)
@foreach($procurement->approvals->sortBy('order') as $appr) @php $apprStatus = $appr->status; $dotBg = match($apprStatus) { 'approved' => '#10b981', 'rejected' => '#ef4444', 'returned' => '#f59e0b', default => '#d1d5db', }; $isOverdue = $appr->status === 'pending' && $appr->due_by && $appr->due_by->isPast(); @endphp @if(!$loop->last)
@endif
@if($apprStatus === 'approved') @elseif($apprStatus === 'rejected') @else @endif
{{ $appr->role_label }}
{{ $appr->approver->name ?? 'Unassigned' }}
{{ ucfirst($apprStatus) }} @if($isOverdue)
⚠ SLA Breach — overdue since {{ $appr->due_by->format('M d') }}
@elseif($appr->due_by)
Due: {{ $appr->due_by->format('M d, Y') }}
@endif
@if($appr->comment)
"{{ $appr->comment }}"
@endif @if($appr->decided_at)
Decided: {{ $appr->decided_at->format('M d, Y H:i') }}
@endif @if($appr->approver_id === auth()->id() && $apprStatus === 'pending') @endif
@endforeach
@else
No approval chain configured
Approvals are triggered when the procurement advances to Stage 5.
@endif
Risk & Issue Panel
Risk: {{ $procurement->risk_level ?? 'Low' }}
@if(count($riskFlags) > 0)
System-Detected Risk Flags
@foreach($riskFlags as $flag) @php $flagColors = [ 'critical' => ['bg' => '#fef2f2', 'border' => '#fca5a5', 'text' => '#991b1b', 'badge' => 'badge-red'], 'high' => ['bg' => '#fff7ed', 'border' => '#fdba74', 'text' => '#9a3412', 'badge' => 'badge-orange'], 'medium' => ['bg' => '#fffbeb', 'border' => '#fcd34d', 'text' => '#92400e', 'badge' => 'badge-amber'], 'low' => ['bg' => '#f0fdf4', 'border' => '#86efac', 'text' => '#14532d', 'badge' => 'badge-teal'], ]; $fc = $flagColors[$flag['severity']] ?? $flagColors['medium']; @endphp
{{ strtoupper($flag['severity']) }} {{ $flag['title'] }}
{{ $flag['detail'] }}
@endforeach
@else
No system-detected risk flags at this stage.
@endif
Manual Risk Assessment
Risk Level
{{ $procurement->risk_level ?? 'Not set' }}
Mitigation Plan
{{ $procurement->mitigation_plan ? str($procurement->mitigation_plan)->limit(120) : 'No mitigation plan documented.' }}
Update Risk Assessment →
Data Snapshot — Stage {{ $procurement->current_stage }}: {{ $stageLabel }}
Bids
{{ $procurement->bids->count() }}
On-Time Bids
{{ $procurement->bids->where('status','on_time')->count() }}
Documents
{{ $procurement->documents->count() }}
Contract(s)
{{ $procurement->contracts->count() }}
@if($procurement->bids->count() > 0)
Bidder List & Scores (Read-only)
@foreach($procurement->bids->sortBy('rank') as $bid) @endforeach
Bidder Bid Amount Tech Score Fin Score Combined Rank Status
{{ $bid->bidder_name }} {{ number_format($bid->bid_amount, 0) }} {{ $bid->technical_score ? number_format($bid->technical_score, 1) : '—' }} {{ $bid->financial_score ? number_format($bid->financial_score, 1) : '—' }} {{ $bid->combined_score ? number_format($bid->combined_score, 1) : '—' }} @if($bid->rank === 1) 1st @elseif($bid->rank) #{{ $bid->rank }} @else @endif {{ $bid->status === 'on_time' ? 'On-time' : 'Late / Rejected' }}
@endif @if($procurement->contracts->count() > 0)
Contract Summary
@foreach($procurement->contracts as $contract)
{{ $contract->contract_number ?? 'Contract #' . $contract->id }}
Supplier: {{ $contract->supplier_name ?? '—' }}
{{ $contract->currency ?? '' }} {{ number_format($contract->contract_value ?? 0, 0) }}
View Contract →
@endforeach
@endif @if($procurement->bids->count() === 0 && $procurement->contracts->count() === 0)
No stage-specific data available yet
Data will appear here as the procurement progresses through stages.
@endif
Roadmap & Stage Timeline
Full Roadmap →
@foreach(\App\Models\Procurement::stages() as $num => $lbl) @php $isDone = $procurement->current_stage > $num; $isActive = $procurement->current_stage == $num; $roadmapForStage = $procurement->roadmapItems->where('stage', $num); $hasDelay = $roadmapForStage->filter(fn($r) => $r->variance_days && $r->variance_days > 0)->count() > 0; @endphp
@if($num > 1)
@endif @if($num < 8)
@endif
@if($isDone) @else {{ $num }} @endif
{{ $lbl }}
@if($hasDelay)
▲ delay
@endif
@endforeach
@if($procurement->roadmapItems->count() > 0) @foreach($procurement->roadmapItems->sortBy(['stage','order']) as $ri) @endforeach
Stage Activity Planned Revised Actual Variance Comment
Stage {{ $ri->stage }} {{ $ri->activity }} {{ $ri->original_date?->format('M d, Y') ?? '—' }} {{ $ri->revised_date?->format('M d, Y') ?? '—' }} {{ $ri->actual_date?->format('M d, Y') ?? '—' }} @if($ri->variance_days && $ri->variance_days > 0) +{{ $ri->variance_days }}d @elseif($ri->variance_days && $ri->variance_days < 0) {{ $ri->variance_days }}d @else @endif {{ $ri->comment ?: '—' }}
@else
No roadmap items yet
Initialize the roadmap from the Roadmap module.
@endif
Audit Trail — Who Did What, When
{{ $auditTrail->count() }} entries Full Audit Pack →
@if($auditTrail->count() > 0)
@foreach($auditTrail as $entry) @if(!$loop->last)
@endif
{{ $entry->action }} @if($entry->description) — {{ str($entry->description)->limit(100) }} @endif
{{ $entry->user->name ?? 'System' }}
{{ $entry->created_at->format('M d, Y H:i') }}
@endforeach
@else
No audit trail entries
Actions on this procurement will appear here automatically.
@endif
Version Control Snapshot
@php $vcCheckpoints = [ 'VC-1' => ['label' => 'Plan Approved', 'stage' => 1, 'done' => $procurement->current_stage > 1], 'VC-2' => ['label' => 'Solicitation Issued', 'stage' => 2, 'done' => $procurement->current_stage > 2], 'VC-3' => ['label' => 'Bids Received & Opened', 'stage' => 3, 'done' => $procurement->current_stage > 3], 'VC-4' => ['label' => 'Evaluation Complete', 'stage' => 4, 'done' => $procurement->current_stage > 4], 'VC-5' => ['label' => 'Award Approved', 'stage' => 5, 'done' => $procurement->current_stage > 5], 'VC-6' => ['label' => 'Contract Archived', 'stage' => 8, 'done' => $procurement->audit_locked], ]; @endphp @foreach($vcCheckpoints as $vc => $info)
@if($info['done']) @else {{ substr($vc, 3) }} @endif
{{ $vc }}
{{ $info['label'] }}
@endforeach
Document versions on file
{{ $procurement->documents->count() }} file(s)
Audit locked
{{ $procurement->audit_locked ? 'Yes' : 'No' }}
@if($userPendingApproval)
Action Required — Your Approval is Pending

You are requested to review and approve this procurement as {{ $userPendingApproval->role_label }} (Stage {{ $userPendingApproval->stage }}).

@endif @if(auth()->user()->hasRole(['admin','procurement_officer']))
Stage Management
@if($validation['ready']) Validation gate passed. This procurement is ready to advance to the next stage. @else Validation gate not cleared. Resolve {{ $validation['total'] - $validation['passing'] }} failing check(s) before advancing. @endif
@if($procurement->current_stage < 8 && $procurement->status !== 'completed')
@csrf
@endif
@endif
@php $cr = $customReview; $isLocked = $cr?->isSubmitted(); $formRoute = $cr ? route('procurements.custom-review.update', $procurement) : route('procurements.custom-review.store', $procurement); $method = $cr ? 'PUT' : 'POST'; $sections = [ ['key' => 'stage_progress', 'label' => 'Stage Progress', 'icon' => 'M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2'], ['key' => 'compliance', 'label' => 'Regulatory Compliance','icon' => 'M3 6l3 1m0 0l-3 9a5.002 5.002 0 006.001 0M6 7l3 9M6 7l6-2m6 2l3-1m-3 1l-3 9a5.002 5.002 0 006.001 0M18 7l3 9m-3-9l-6-2m0-2v2m0 16V5m0 16H9m3 0h3'], ['key' => 'documents', 'label' => 'Document Quality', 'icon' => 'M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z'], ['key' => 'bids', 'label' => 'Bid Competitiveness', 'icon' => 'M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z'], ['key' => 'approvals', 'label' => 'Approval Process', 'icon' => 'M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z'], ['key' => 'risk', 'label' => 'Risk Management', 'icon' => 'M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z'], ]; $ratingLabels = [1 => 'Very Poor', 2 => 'Poor', 3 => 'Satisfactory', 4 => 'Good', 5 => 'Excellent']; @endphp @session('success')
{{ session('success') }}
@endsession
Custom Reviewer Observations
@if($isLocked) Submitted {{ $cr->submitted_at->format('M d, Y H:i') }} by {{ $cr->reviewer->name }} @elseif($cr) Draft — not yet submitted @else No review yet @endif

Rate each procurement dimension and add qualitative observations. Save as a draft at any time, then submit your final verdict when ready. Submitted reviews cannot be edited.

@csrf @if($method === 'PUT') @method('PUT') @endif @foreach($sections as $s) @php $rKey = $s['key'] . '_rating'; $nKey = $s['key'] . '_notes'; $rVal = old($rKey, $cr?->{$rKey}); $nVal = old($nKey, $cr?->{$nKey}); @endphp
{{ $s['label'] }}
@if($rVal) {{ $ratingLabels[$rVal] ?? '' }} @endif
Rating
@foreach([1,2,3,4,5] as $star) @endforeach
Observations
@if($isLocked)
{{ $nVal ?: '—' }}
@else @endif
@endforeach
Overall Verdict
Overall Rating
@foreach([1,2,3,4,5] as $star) @endforeach
Recommendation
@foreach(['approve' => ['Approve', '#10b981'], 'conditional' => ['Conditional Approval', '#f59e0b'], 'reject' => ['Reject', '#ef4444']] as $val => [$lbl, $col]) @endforeach
Final Observations & Recommendations
@if($isLocked)
{{ old('final_observations', $cr?->final_observations) ?: '—' }}
@else @endif
@if(!$isLocked)
@if($cr) Last saved: {{ $cr->updated_at->diffForHumans() }} @endif
@endif
@if($userPendingApproval) @foreach(['approve' => ['label' => 'Approve', 'status' => 'approved', 'color' => '#10b981', 'icon' => 'M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z'], 'reject' => ['label' => 'Reject', 'status' => 'rejected', 'color' => '#ef4444', 'icon' => 'M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z'], 'return' => ['label' => 'Return', 'status' => 'returned', 'color' => '#d97706', 'icon' => 'M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6']] as $key => $opts)
@endforeach @endif