@extends('layouts.app') @section('title', 'Machine Details') @section('content')

Machine Asset: {{ $machine->name }}

Edit Settings
{{ str_replace('_', ' ', $machine->status) }}
Operational Status
{{ $machine->code }}
{{ $machine->model ?? 'Standard Industrial Series' }}
{{ $machine->serial_number ?? 'N/A' }}
Placement
@if($machine->productionLine)
{{ $machine->productionLine->name }}
{{ $machine->productionLine?->zone?->factory?->name ?? 'N/A' }} - {{ $machine->productionLine?->zone?->name ?? 'N/A' }}
@else
Unassigned
@endif
Total Logs

{{ $machine->maintenanceLogs->count() }}

Last service: {{ $machine->last_maintenance_at ? $machine->last_maintenance_at->format('M d, Y') : 'Never' }}
Scheduled Service

{{ $machine->maintenanceSchedules->where('status', 'pending')->count() }}

Next due: {{ $machine->next_maintenance_at ? $machine->next_maintenance_at->format('M d, Y') : 'Not Scheduled' }}
Historical Maintenance Logs
@forelse($machine->maintenanceLogs->sortByDesc('start_time')->take(5) as $log) @empty @endforelse
Date Technician Duration Cost
{{ $log->start_time->format('M d, Y') }}
{{ $log->start_time->format('H:i') }}
{{ $log->technician->name }} {{ $log->downtime_minutes }} mins ${{ number_format($log->cost, 2) }}
No maintenance history recorded for this asset.
@if($machine->maintenanceLogs->count() > 5) @endif
@endsection