@extends('layouts.app')
@section('titulo','Historial horómetro')
@section('contenido')
Horómetro actual
{{ number_format((float)$equipo->horometro_actual, 2) }} h
@foreach(['ultimo_pm_360'=>'PM 01 (360h)','ultimo_pm_720'=>'PM 02 (720h)','ultimo_pm_4320'=>'PM 03 (4320h)','ultimo_pm_8640'=>'PM 04 (8640h)'] as $col => $lbl)
@php $base = (float)($equipo->$col ?? 0); $umbral = (int) explode('_', $col)[2]; $pendiente = $base > 0 ? (((float)$equipo->horometro_actual) - $base) : 0; $rest = $umbral - $pendiente; $color = $rest <= 0 ? 'danger' : ($rest < $umbral * 0.1 ? 'warning' : 'success'); @endphp
@if($base > 0)
{{ $lbl }}
Última: {{ number_format($base,0) }} h
{{ $rest > 0 ? 'Faltan '.number_format($rest,0).' h' : 'Excedido '.number_format(-$rest,0).' h' }}
@endif
@endforeach