@extends('layouts.app') @section('htmlheader_title') {{ __('adminlte::message.progvehictitle') }} @endsection @section('contentheader_title') {{'Programación'}}
@endsection @section('main-content')

{{ __('adminlte::message.progvehiclist') }}

@if(in_array(Auth::user()->UsRol, Permisos::TODOPROSARC) || in_array(Auth::user()->UsRol2, Permisos::TODOPROSARC)) {{ __('adminlte::message.progvehiccreatetext') }} @endif @if(in_array(Auth::user()->UsRol, Permisos::CONDUCTOR) || in_array(Auth::user()->UsRol2, Permisos::CONDUCTOR)) @php $hoy = \Illuminate\Support\Carbon::today()->toDateString(); $preopPendiente = collect($programacions)->first(function($p) use ($hoy) { try { $fechaProg = \Illuminate\Support\Carbon::parse($p->ProgVehFecha)->toDateString(); } catch (\Exception $e) { return false; } $completado = !empty($p->ProgVehPreoperacionalCompletado); return $fechaProg === $hoy && !$completado; }); // Botón "Crear" como respaldo: primer preoperacional pendiente desde hoy en adelante $preopCrear = collect($programacions) ->filter(function($p) { try { $fechaProg = \Illuminate\Support\Carbon::parse($p->ProgVehFecha)->startOfDay(); } catch (\Exception $e) { return false; } $completado = !empty($p->ProgVehPreoperacionalCompletado); return $fechaProg->greaterThanOrEqualTo(\Illuminate\Support\Carbon::today()) && !$completado; }) ->sortBy(function($p) { try { return \Illuminate\Support\Carbon::parse(($p->ProgVehFecha ?? '') . ' ' . ($p->ProgVehSalida ?? '00:00:00')); } catch (\Exception $e) { return \Illuminate\Support\Carbon::now()->addYears(50); } }) ->first(); @endphp Crear preoperacional @if($preopPendiente) Llenar preoperacional (directo) @endif @endif
@if(session('warning'))
{{ session('warning') }}
@endif @if((in_array(Auth::user()->UsRol, Permisos::CONDUCTOR) || in_array(Auth::user()->UsRol2, Permisos::CONDUCTOR)) && collect($programacions)->isEmpty())
No tienes programaciones asignadas para mostrar.
Posibles causas:
  • La programación no tiene conductor asignado (FK_ProgConductor).
  • La solicitud aún no está en estado Programado o Notificado.
  • La fecha de programación está fuera del rango configurado (2024-07-01 a 2026-12-31).
@endif {{-- @if(Auth::user()->UsRol <> __('adminlte::message.Conductor') || Auth::user()->UsRol2 <> __('adminlte::message.Conductor')) --}} {{-- @endif --}} @if(in_array(Auth::user()->UsRol, Permisos::CONDUCTOR) || in_array(Auth::user()->UsRol2, Permisos::CONDUCTOR)) @endif @if(in_array(Auth::user()->UsRol, Permisos::ProgVehic2) || in_array(Auth::user()->UsRol2, Permisos::ProgVehic2)) @endif @if(in_array(Auth::user()->UsRol, Permisos::ProgVehic2) || in_array(Auth::user()->UsRol2, Permisos::SolSerCertifi)) @endif @foreach($programacions as $programacion) @php $vehiculoPlaca = 'No definido'; if($programacion->ProgVehtipo == 1){ foreach($personals as $personal){ if($programacion->FK_ProgAyudante == $personal->ID_Pers){ $ayudante = $personal->PersFirstName.' '.$personal->PersLastName; } } foreach($personals as $personal){ if($programacion->FK_ProgConductor == $personal->ID_Pers){ $conductor = $personal->PersFirstName.' '.$personal->PersLastName; } } foreach ($vehiculos as $vehiculo) { if($programacion->FK_ProgVehiculo == $vehiculo->ID_Vehic){ $vehiculoPlaca = $vehiculo->VehicPlaca; } } } elseif($programacion->ProgVehtipo == 2){ foreach($personals as $personal){ if($programacion->FK_ProgAyudante == $personal->ID_Pers){ $ayudante = $personal->PersFirstName.' '.$personal->PersLastName; } } $conductor = 'No aplica'; foreach ($vehiculos as $vehiculo) { if($programacion->FK_ProgVehiculo == $vehiculo->ID_Vehic){ $vehiculoPlaca = $vehiculo->VehicPlaca; } } } else{ $ayudante = 'No aplica'; $conductor = $programacion->SolSerConductor; $vehiculoPlaca = $programacion->SolSerVehiculo; } if (!isset($ayudante)) { $ayudante = 'No definido'; } if (!isset($conductor)) { $conductor = 'No definido'; } @endphp {{-- @if(Auth::user()->UsRol <> __('adminlte::message.Conductor')) --}} {{-- @endif --}} @if(in_array(Auth::user()->UsRol, Permisos::CONDUCTOR) || in_array(Auth::user()->UsRol2, Permisos::CONDUCTOR)) @endif @if(in_array(Auth::user()->UsRol, Permisos::ProgVehic2) || in_array(Auth::user()->UsRol2, Permisos::ProgVehic2)) @endif @if(in_array(Auth::user()->UsRol, Permisos::ProgVehic2) || in_array(Auth::user()->UsRol2, Permisos::SolSerCertifi)) @php $Status = ['Aprobado', 'Programado', 'Notificado']; @endphp @endif @endforeach
{{ __('adminlte::message.progvehicclient') }} {{ __('adminlte::message.progvehicfech') }} {{ __('adminlte::message.progvehicvehic') }} {{ __('adminlte::message.progvehicsalida') }} {{ __('adminlte::message.progvehicayudan') }}{{ __('adminlte::message.progvehicconduc') }} Puntos de recolección {{ __('adminlte::message.progvehicllegada') }} {{ __('adminlte::message.progvehictype') }} AutorizaciónAcciones{{ __('adminlte::message.progvehicservi2') }}{{ __('adminlte::message.edit') }}{{ __('adminlte::message.progvehicserauth') }}
{{$programacion->CliName}} {{$programacion->ProgVehFecha}} {{$vehiculoPlaca}} {{date('h:i A', strtotime($programacion->ProgVehSalida))}} {{$ayudante}}{{$conductor}}
    @foreach($programacion->puntosderecoleccion as $Punto)
  • {{$Punto->GSedeName}}
  • @endforeach
{{$programacion->ProgVehEntrada <> null ? date('h:i A', strtotime($programacion->ProgVehEntrada)) : ''}} @if ($programacion->ProgVehtipo == 1) Interno
@if ($programacion->ProgVehExclusive == 1) (Exclusivo) @else (Recorrido) @endif @elseif($programacion->ProgVehtipo == 2) Alquilado @else Externo @endif
{{$programacion->ProgVehStatus}} Datos @php $puedeLlenarPreoperacional = false; try { $fechaHoy = \Illuminate\Support\Carbon::today(); $fechaProg = \Illuminate\Support\Carbon::parse($programacion->ProgVehFecha)->startOfDay(); $puedeLlenarPreoperacional = $fechaProg->greaterThanOrEqualTo($fechaHoy); } catch (\Exception $e) { $puedeLlenarPreoperacional = false; } @endphp @if($puedeLlenarPreoperacional) {{ isset($programacion->ProgVehPreoperacionalCompletado) && $programacion->ProgVehPreoperacionalCompletado ? "Ver" : "Llenar" }} Preoperacional @else {{-- Botón de respaldo para abrir sin depender de modales/condiciones --}} Preoperacional (directo) @endif #{{$programacion->ID_SolSer}} {{__('adminlte::message.edit')}} {{ __('adminlte::message.progvehicserauth')}}
@endsection @section('NewScript') @endsection