@extends('admin.layouts.master') @section('title', __('admin.delivery_inspections.show_title')) @section('content')

{{ __('admin.delivery_inspections.show_title') }}

{{ $deliveryInspection->project->project_name }}
@if($deliveryInspection->status === 'under_review')
@csrf
@endif {{ __('admin.actions.back_to_list') }}
@if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif
{{-- Info Card --}}
{{ app()->getLocale() === 'ar' ? 'معلومات الفحص' : 'Inspection Info' }}
@php $statusColors = ['pending'=>'secondary','under_review'=>'info','revision_required'=>'warning','approved'=>'success','rejected'=>'danger']; $color = $statusColors[$deliveryInspection->status] ?? 'secondary'; @endphp

{{ __('admin.delivery_inspections.fields.status') }}: {{ __('admin.delivery_inspections.statuses.'.$deliveryInspection->status) }}

{{ __('admin.delivery_inspections.fields.project_id') }}:
{{ $deliveryInspection->project->project_name }}

{{ app()->getLocale() === 'ar' ? 'العميل' : 'Client' }}:
{{ $deliveryInspection->project->client->name ?? '—' }}

{{ __('admin.delivery_inspections.fields.inspector_id') }}:
{{ $deliveryInspection->inspector->name ?? '—' }}

{{ __('admin.delivery_inspections.fields.created_at') }}:
{{ $deliveryInspection->created_at->format('Y-m-d') }}

@if($deliveryInspection->approved_at)

{{ __('admin.delivery_inspections.fields.approved_at') }}:
{{ $deliveryInspection->approved_at->format('Y-m-d') }}

{{ __('admin.delivery_inspections.fields.approved_by') }}:
{{ $deliveryInspection->approver->name ?? '—' }}

@endif {{-- Progress Summary --}} @php $total = $deliveryInspection->itemResponses->count(); $passed = $deliveryInspection->itemResponses->where('status','passed')->count(); $failed = $deliveryInspection->itemResponses->where('status','failed')->count(); $pending = $deliveryInspection->itemResponses->where('status','pending')->count(); $revision = $deliveryInspection->itemResponses->where('status','revision_required')->count(); $pct = $total > 0 ? round(($passed/$total)*100) : 0; @endphp
{{ app()->getLocale() === 'ar' ? 'ملخص التقدم' : 'Progress Summary' }}
{{ $pct }}%
✓ {{ $passed }} {{ app()->getLocale() === 'ar' ? 'ناجح' : 'Passed' }} ✗ {{ $failed }} {{ app()->getLocale() === 'ar' ? 'فاشل' : 'Failed' }} ⚠ {{ $revision }} {{ app()->getLocale() === 'ar' ? 'مراجعة' : 'Revision' }} ○ {{ $pending }} {{ app()->getLocale() === 'ar' ? 'معلق' : 'Pending' }}
{{-- Checklist Items --}}
{{ app()->getLocale() === 'ar' ? 'قائمة التحقق' : 'Checklist Items' }}
@if($deliveryInspection->itemResponses->isEmpty())

{{ app()->getLocale() === 'ar' ? 'لا توجد عناصر فحص.' : 'No checklist items.' }}

{{ app()->getLocale() === 'ar' ? 'إضافة عناصر' : 'Add Items' }}
@else @foreach($deliveryInspection->itemResponses as $response) @php $itemStatusColors = ['pending'=>'light','passed'=>'success','failed'=>'danger','revision_required'=>'warning']; $ic = $itemStatusColors[$response->status] ?? 'light'; @endphp
{{ app()->getLocale() === 'ar' ? $response->item->title_ar : $response->item->title_en }} @if($response->item->is_critical) {{ app()->getLocale() === 'ar' ? 'حرج' : 'Critical' }} @endif {{ $response->status === 'passed' ? (app()->getLocale() === 'ar' ? 'ناجح' : 'Passed') : ($response->status === 'failed' ? (app()->getLocale() === 'ar' ? 'فاشل' : 'Failed') : ($response->status === 'revision_required' ? (app()->getLocale() === 'ar' ? 'يحتاج مراجعة' : 'Revision Required') : (app()->getLocale() === 'ar' ? 'معلق' : 'Pending'))) }}
@if($response->item->description_ar || $response->item->description_en) {{ app()->getLocale() === 'ar' ? $response->item->description_ar : $response->item->description_en }} @endif @if($response->comments_ar || $response->comments_en)
{{ app()->getLocale() === 'ar' ? $response->comments_ar : $response->comments_en }}
@endif @if($response->revision_notes_ar || $response->revision_notes_en)
{{ app()->getLocale() === 'ar' ? $response->revision_notes_ar : $response->revision_notes_en }}
@endif
{{-- Review Form --}}
@csrf @method('PATCH')
status === 'passed')>
status === 'failed')>
status === 'revision_required')>
@endforeach @endif
{{-- Reject Modal --}} @endsection