@extends('layouts.app') @section('content') @php function truncate_string($string, $limit = 80) { return mb_strlen($string, 'UTF-8') > $limit ? mb_substr($string, 0, $limit) . '...' : $string; } function compareDateWithToday($receivedDate) { $today = new DateTime(); $date = new DateTime($receivedDate); // Normalizar fechas (solo fecha, sin hora) $normalizedToday = new DateTime($today->format('Y-m-d')); $normalizedDate = new DateTime($date->format('Y-m-d')); if ($normalizedToday < $normalizedDate) { return ['text-success', 'Vigente/Dentro de fecha']; } elseif ($normalizedToday == $normalizedDate) { return ['text-warning', 'Previo a expirar/terminar']; } else { return ['text-danger', 'Expirado/Extemporaneo']; } } @endphp
@can('write_order') {{ __('contract.title.create') }} @endcan
@include('layouts.alert')
@foreach ($contracts as $index => $contract) @endforeach
@csrf
Limpiar
# {{ __('contract.data.customer') }} Duración del contrato {{ __('contract.title.technicians') }} Estado de uso Estado por tiempo
{{ ++$index }} {{ $contract->customer->name ?? '-' }} {{ \Carbon\Carbon::parse($contract->startdate)->format('d/m/Y') }} - {{ \Carbon\Carbon::parse($contract->enddate)->format('d/m/Y') }}
    @foreach ($contract->technicianNames() as $tech)
  • {{ $tech }}
  • @endforeach
{{ $contract->status == 1 ? __('contract.status.active') : ($contract->status == 0 ? __('contract.status.finalized') : __('contract.status.to_finalize')) }} @php $results = compareDateWithToday($contract->enddate); @endphp {{ $results[1] }} @can('write_order') {{-- --}} @endcan
{{ $contracts->links('pagination::bootstrap-5') }}
@endsection