Dashboard @php $tallerId = auth()->user()->taller_id; $opsAbiertas = \App\Models\OrdenTrabajo::whereIn('estado', ['pendiente','en_proceso'])->count(); $opsCerradasHoy = \App\Models\OrdenTrabajo::where('estado', 'cerrado') ->whereDate('updated_at', today()) ->count(); $stockCritico = \App\Models\Repuesto::whereColumn('stock_actual', '<=', 'stock_minimo') ->where('activo', true) ->count(); $opsDemoradas = \App\Models\OrdenTrabajo::whereIn('estado', ['pendiente','en_proceso']) ->where('fecha_ingreso', '<=', now()->subHours(72)) ->count(); @endphp {{-- Cards de resumen --}}

OPs Abiertas

{{ $opsAbiertas }}

Pendientes + En proceso

OPs Cerradas Hoy

{{ $opsCerradasHoy }}

{{ today()->format('d/m/Y') }}

@can('inventario.ver')

Stock Crítico

{{ $stockCritico }}

Repuestos bajo mínimo

@endcan

OPs Demoradas

{{ $opsDemoradas }}

Más de 72 horas en taller

{{-- OPs recientes --}}

Órdenes recientes

Ver todas →
@php $opsRecientes = \App\Models\OrdenTrabajo::with(['vehiculo.cliente','tecnico']) ->orderBy('created_at','desc') ->limit(5) ->get(); @endphp @if($opsRecientes->count() > 0) @foreach($opsRecientes as $op) @endforeach
{{ $op->numero_op }} {{ $op->vehiculo?->placa }} — {{ $op->vehiculo?->marca }} {{ $op->vehiculo?->modelo }} {{ $op->vehiculo?->cliente?->nombre }} @php $colores = [ 'pendiente' => 'bg-yellow-900/50 text-yellow-400', 'en_proceso' => 'bg-blue-900/50 text-blue-400', 'listo' => 'bg-green-900/50 text-green-400', 'entregado' => 'bg-teal-900/50 text-teal-400', 'cerrado' => 'bg-gray-800 text-gray-500', ]; @endphp {{ ucfirst(str_replace('_',' ',$op->estado)) }} {{ $op->fecha_ingreso->format('d/m/Y H:i') }}
@else

🔧

No hay órdenes de trabajo aún.

@endif