@extends('layouts.admin') @section('content')
@if (session('status'))
{{ session('status') }}
@endif @php $filtro_pertenencia = $filtro_pertenencia ?? ''; $filtroPertenencias = $filtroPertenencias ?? []; $bHabilitadoCampoSujetoPasivo = $bHabilitadoCampoSujetoPasivo ?? false; $bOcultarCamposSujetoPasivo = $bOcultarCamposSujetoPasivo ?? false; $instituciones = $instituciones ?? null; $nIdHtmlSelectInstitucion = $nIdHtmlSelectInstitucion ?? ''; $sUrlFuenteDatos = $sUrlFuenteDatos ?? ''; $opcionesSelectSujetoPasivoNuevoFormato = $opcionesSelectSujetoPasivoNuevoFormato ?? []; $opcionesSelectSujetoPasivo = $opcionesSelectSujetoPasivo ?? []; $nIdInstitucionUsuarioActual = $nIdInstitucionUsuarioActual ?? ''; $sujetoPasivoRutReq = $sujetoPasivoRutReq ?? ''; $viajes = $viajes ?? null; $total = $total ?? 0; $texto_libre = $textoLibreReq ?? ''; $estado = $estado ?? ''; $estados = $estados ?? []; $fechaInicioReq = $fechaInicioReq ?? ''; $fechaTerminoReq = $fechaTerminoReq ?? ''; $pertenenciaSeleccionada = Auth::user()->selectedPertenencia(); $esAdminInstitucional = $pertenenciaSeleccionada && (Helpers::getHumanRol($pertenenciaSeleccionada->cargo_pasivo, $pertenenciaSeleccionada->jefe, ucwords($pertenenciaSeleccionada->rol)) == 'Administrador Institucional'); @endphp

Registro de viajes realizados @if(Auth::user()->hasPermiso('Viaje','c') && !Auth::user()->root ) @endif

{!! html()->form('GET', '/admin/viajes') ->class('form-horizontal') ->name('form-admin-viajes') ->open() !!} @php $nIdHtmlSelectInstitucion = 'filtroInstitucionReq'; $sUrlFuenteDatos = 'cargos-pasivos/lista-sujetos'; @endphp @if(count($filtroPertenencias) > 0) @php $nIdHtmlSelectInstitucion = 'filtro_pertenencia'; $sUrlFuenteDatos = 'cargos-pasivos/lista-sujetos-sin-dependencia'; $bHabilitadoCampoSujetoPasivo = false; if (!empty($filtroPertenencias)) { $bHabilitadoCampoSujetoPasivo = true; } @endphp
@endif @if (($bHabilitadoCampoSujetoPasivo ?? null) === null || $bHabilitadoCampoSujetoPasivo) { $bHabilitadoCampoSujetoPasivo = true; } $bOcultarCamposSujetoPasivo = false; if( Auth::user()->selectedPertenencia()->cargo_pasivo ?? false && Auth::user()->selectedPertenencia()->cargo_pasivo == 1 ) { $bHabilitadoCampoSujetoPasivo = false; $bOcultarCamposSujetoPasivo = true; } @endif @if(\Auth::user()->root && $instituciones !== null) @php $nIdHtmlSelectInstitucion = 'filtroInstitucionReq'; $sUrlFuenteDatos = 'cargos-pasivos/lista-sujetos'; @endphp
{!! html()->select($nIdHtmlSelectInstitucion) ->options([null => 'Seleccione el nombre de la institución'] + $instituciones->all()) ->value($filtroInstitucionReq ?? '') ->class('form-control') ->id('institucion') ->attribute('onchange', 'filtroInstitucionChange(this, "sujeto_pasivo", "sujeto_pasivo_rut")') !!}
@php $bHabilitadoCampoSujetoPasivo = !empty($filtroInstitucionReq ?? ''); @endphp @endif @if(!$bOcultarCamposSujetoPasivo)
@if($nIdHtmlSelectInstitucion == 'filtro_pertenencia') @else @endif
@endif
{!! html()->select('estado') ->options([null => 'Seleccione una estado'] + $estados) ->value($estado ?? '') ->class('form-select') ->id('estado') !!}
@if(\Auth::user()->hasRol('admin', 'root', 'cargo_pasivo', 'auditor'))
@if (\Auth::user()->hasRol('admin', 'root')) @else @endif
@if (\Auth::user()->hasRol('admin', 'root')) @else @endif
@endif
{!! html()->submit('Buscar') ->class('btn btn-primary me-2') !!} Limpiar
{!! html()->form()->close() !!}
@if(!is_null($viajes))
@if ($total !== null>0 ) @foreach($viajes as $item) @endforeach @endif
{!! Helpers::headColumn('fecha_inicio', 'Inicio') !!} {!! Helpers::headColumn('fecha_termino', 'Término') !!} Sujeto pasivo {!! Helpers::headColumn('destino', 'Destino') !!} Objeto {!! Helpers::headColumn('estado', 'Estado') !!} Acciones
{{ $item->fecha_inicio }} {{ $item->fecha_termino }} {{ !is_null($item->nombres)? $item->nombres.' '. $item->apellidos : ' '}} {{ $item->destino }} {{ $item->objeto }} {{ ucwords($item->estado) }}
@if(Auth::user()->hasPermiso('Viaje','u')) Editar @endif @if(Auth::user()->hasPermiso('Viaje','d') && !$esAdminInstitucional) Eliminar @endif
@endif @if(!is_null($viajes))
{{ $viajes->appends( \Request::query() )->links() }}
@endif
@endsection