@php use Illuminate\Support\Carbon; @endphp @extends('layouts.app') @section('title', 'Kit Service | Employee List (CDD & CDI)') @section('content')
@include('employees.partial.header')
@foreach($employees as $employee) @php $daysLeft = null; $rowClass = ''; if ($employee->contract_type === 'CDD' && $employee->end_contract_date) { $endDate = Carbon::parse($employee->end_contract_date); $now = Carbon::now(); $daysLeft = intval($now->diffInDays($endDate, false)); // Highlight si <=20 jours ou déjà passé if ($daysLeft <= 20) { $rowClass = 'bg-red-50'; } } $gender = strtolower($employee->gender); $photoPath = $gender === 'female' ? 'assets/profil/female.png' : ($gender === 'male' ? 'assets/profil/male.png' : 'assets/profil/other.png'); @endphp @endforeach
Photo Matricule Nom complet Département Fonction Contrat Date de fin Jours restants Action
photo {{ $employee->employee_id }} {{ $employee->first_name }} {{ $employee->last_name }} {{ $employee->department }} {{ $employee->function }} {{ $employee->contract_type }} {{ $employee->end_contract_date ? Carbon::parse($employee->end_contract_date)->format('d/m/Y') : '—' }} @if($daysLeft !== null) @if($daysLeft <= 20) {{ $daysLeft }} jours @else - @endif @else - @endif {{-- CDD Review --}} @if($employee->contract_type === 'CDD' && $daysLeft !== null && $daysLeft <= 20) @endif {{-- CDI Termination Letter --}} @if($employee->contract_type === 'CDI' && $employee->end_contract_date && $employee->end_contract_reason) @endif
@endsection