@extends('layouts.app') @section('title', 'CAPA Dashboard') @section('content')

CAPA Dashboard

New CAPA
{{-- Stat cards --}}
@php $cards = [ ['label' => 'Total CAPAs', 'value' => $stats['total'], 'icon' => 'fa-list', 'color' => 'primary'], ['label' => 'Open', 'value' => $stats['open'], 'icon' => 'fa-folder-open','color' => 'info'], ['label' => 'Overdue', 'value' => $stats['overdue'], 'icon' => 'fa-clock', 'color' => 'warning'], ['label' => 'Critical', 'value' => $stats['critical'], 'icon' => 'fa-bolt', 'color' => 'danger'], ['label' => 'Under Review', 'value' => $stats['under_review'], 'icon' => 'fa-search', 'color' => 'secondary'], ['label' => 'Implementation', 'value' => $stats['implementation'], 'icon' => 'fa-tasks', 'color' => 'primary'], ['label' => 'Effectiveness', 'value' => $stats['effectiveness'], 'icon' => 'fa-check-double','color' => 'warning'], ['label' => 'Closed', 'value' => $stats['closed'], 'icon' => 'fa-check-circle','color' => 'success'], ]; @endphp @foreach($cards as $c)
{{ $c['label'] }}
{{ number_format($c['value']) }}
@endforeach
{{-- Status breakdown --}}
By Status
@forelse($statusBreakdown as $status => $count)
{{ str_replace('_', ' ', $status) }} {{ $count }}
@empty

No data.

@endforelse
{{-- Priority breakdown --}}
By Priority
@foreach(['CRITICAL', 'HIGH', 'MEDIUM', 'LOW'] as $p)
{{ $p }} {{ $priorityBreakdown[$p] ?? 0 }}
@endforeach
{{-- Overdue actions --}}
Overdue Actions
@if($overdueActions->isEmpty())

No overdue actions.

@else
@foreach($overdueActions as $a) @endforeach
CAPA # Action Responsible Due Date Days Overdue
{{ $a->capa?->capa_number }} {{ Str::limit($a->action_description, 60) }} {{ $a->responsible?->name ?? '—' }} {{ $a->due_date?->format('M j, Y') }} {{ now()->diffInDays($a->due_date) }} days
@endif
{{-- Recent --}}
Recently Created
@foreach($recent as $c) @endforeach
CAPA # Title Priority Status Created
{{ $c->capa_number }} {{ Str::limit($c->title, 60) }} {{ $c->priority }} {{ $c->status }} {{ $c->created_at?->format('M j, Y') }}
@endsection