@extends('layouts.app') @section('title', 'Availability Audit Detail') @section('content')
Availability Audit Details
Audit Information

{{ $report->submitted_at ? $report->submitted_at->format('d M, Y h:i A') : 'N/A' }}

{{ $report->submittedBy->name ?? 'System' }}

{{ $report->submittedBy->email ?? '' }}

{{ $report->outlet->name ?? 'Unknown Outlet' }}

{{ $report->outlet->address ?? '' }}
@if($report->geo_tag_match) Compliant @else Non-Compliant @endif

{{ $report->geo_tag_distance ? number_format($report->geo_tag_distance, 2) . ' meters' : 'N/A' }}

POSM Items Availability ({{ $report->items->count() }})
@if($report->items->count() > 0)
@foreach($report->items as $item) @endforeach
Product Name SKU Availability Quantity Condition
{{ $item->product->name ?? 'Unknown Product' }}
{{ $item->product->category ?? '' }}
{{ $item->product->code ?? 'N/A' }} @if($item->status == 'green') Available @elseif($item->status == 'red') Missing @else {{ ucfirst($item->status) }} @endif {{ $item->quantity ?? 0 }} @if($item->condition == 'good') @elseif($item->condition == 'damaged') @else - @endif
@else

No items recorded for this audit.

@endif
Audit Summary
Total Items Audited {{ $report->items->count() }}

Available {{ $report->items->where('status', 'green')->count() }}
Missing {{ $report->items->where('status', 'red')->count() }}
Compliance Rate {{ $report->items->count() > 0 ? round(($report->items->where('status', 'green')->count() / $report->items->count()) * 100) : 0 }}%

Location Info
Coordinates

Lat: {{ $report->visit_latitude ?? 'N/A' }}

Lng: {{ $report->visit_longitude ?? 'N/A' }}

@endsection