🕒 Gestion des Heures SupplĂ©mentaires @if($isDelegation) | {{ $displayUser->firstname }} {{ $displayUser->name }} @endif

@if($isDelegation)

⚠ Mode DĂ©lĂ©gation Actif

@endif
@include('partials.unprinted_alert') {{-- SECTION 1 : CHOIX DU MOIS ET SAISIE --}}

📝 Nouvelle Saisie d'Heures SupplĂ©mentaires

{{-- Sélecteur de mois global --}}
@if($isLocked)

Déclaration Verrouillée

Cette période est désormais close car le document a été imprimé aprÚs le 10 du mois.
Veuillez contacter un administrateur pour toute modification.

@else
@csrf
{{-- LIGNE 1 --}}
isCurrentMonth() ? now() : $activeMois->copy()->startOfMonth(); @endphp value="{{ old('date_realisation', $defaultDate->format('Y-m-d')) }}">
{{-- LIGNE 2 --}}
Durée Totale
00:00
{{-- Espace vide --}}
{{-- LIGNE 3 --}}
@endif
{{-- ALERTES --}} @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif {{-- SECTION 2 : RÉCAPITULATIF DU MOIS --}}
{{-- HISTORIQUE RAPIDE (Horizontal) --}}

Mes Déclarations

@foreach($autresDeclarations as $decl) @php $hs = $decl->heuresSupplementaires; // Total Paye (Brut) $p = abs( $hs->sum('paye_n_premieres') + $hs->sum('paye_suivantes') + $hs->sum('paye_nuit') + $hs->sum('paye_dimanche_ferie') + $hs->sum('paye_dim_suiv') + $hs->sum('paye_1er_mai') ); // Total Récup (Acquises/Majorées) $r = abs( $hs->sum('maj_n_premieres') + $hs->sum('maj_suivantes') + $hs->sum('maj_nuit') + $hs->sum('maj_dimanche_ferie') + $hs->sum('maj_dim_suiv') + $hs->sum('maj_1er_mai') ); @endphp
{{ ucfirst($decl->mois->translatedFormat('F Y')) }}
{{-- RÉCUP en premier --}}
{{ \App\Helpers\TimeHelper::decimalToHours($r) }} Récup
{{-- PAYE en second --}}
{{ \App\Helpers\TimeHelper::decimalToHours($p) }} Paye
@endforeach
{{-- TABLEAU DES LIGNES --}} {{-- TABLEAUX DES LIGNES PAR FILIÈRE --}} @if(empty($linesByFiliere))

📅 Lignes de {{ $activeMois->translatedFormat('F Y') }}

☁
Aucune heure saisie pour ce mois.
@else @foreach($linesByFiliere as $fId => $group) @php $filiere = $group['filiere']; $lines = $group['lines']; $groupFerieDates = $group['ferieDates']; $sumTotal = $lines->sum('total_raw'); @endphp

🏱 Filiùre : {{ $filiere->nom_filiere }}

Total : {{ \App\Helpers\TimeHelper::decimalToHours(abs($sumTotal)) }}
@php $nbColRecup = ($filiere->activer_dimanche_ferie ? 4 : 5); if (!$filiere->dimanche_ferie_recuperable) { $nbColRecup -= ($filiere->activer_dimanche_ferie ? 1 : 2); } @endphp {{-- RĂ©cup --}} @if($filiere->dimanche_ferie_recuperable) @if($filiere->activer_dimanche_ferie) @else @endif @endif {{-- Paye --}} @if($filiere->appliquer_seuil_paie) @else @endif @if($filiere->activer_dimanche_ferie) @else @endif @foreach($lines as $line) @php $isFerie = in_array($line->date_realisation->format('Y-m-d'), $groupFerieDates); $isPortGrimaud = ($line->id_motif == 6); $isWeekend = $line->date_realisation->isWeekend(); $isDimanche = $line->date_realisation->isSunday(); $textColor = 'text-gray-800'; $dateColor = 'text-gray-700'; $motifColor = 'text-gray-400'; $rowClass = 'hover:bg-gray-100 transition group border-b border-gray-50'; if ($isPortGrimaud) { $textColor = 'text-green-700'; $dateColor = 'text-green-600'; $motifColor = 'text-green-500'; } elseif ($isFerie) { $textColor = 'text-red-700'; $dateColor = 'text-red-600'; $motifColor = 'text-red-500'; } elseif ($isDimanche) { $textColor = 'text-red-300'; $dateColor = 'text-red-300'; $motifColor = 'text-red-200'; } elseif ($isWeekend) { $textColor = 'text-amber-700'; $dateColor = 'text-amber-600'; $motifColor = 'text-amber-500'; } @endphp {{-- RĂ©cup --}} @if($filiere->dimanche_ferie_recuperable) @if($filiere->activer_dimanche_ferie) @else @endif @endif {{-- Paye --}} @if($filiere->appliquer_seuil_paie) @else @endif @if($filiere->activer_dimanche_ferie) @else @endif @endforeach {{-- Ligne des TOTAUX BRUTS --}} {{-- RĂ©cup Bruts --}} @if($filiere->dimanche_ferie_recuperable) @if($filiere->activer_dimanche_ferie) @else @endif @endif {{-- Paye Bruts (dĂ©jĂ  bruts) --}} @if($filiere->appliquer_seuil_paie) @else @endif @if($filiere->activer_dimanche_ferie) @else @endif {{-- Ligne de TEST : TAUX DE MAJORATION --}} {{-- RĂ©cup --}} @if($filiere->dimanche_ferie_recuperable) @if($filiere->activer_dimanche_ferie) @else @endif @endif {{-- Paye --}} {{-- Ligne des TOTAUX MAJORÉS --}} {{-- RĂ©cup MajorĂ©s --}} @if($filiere->dimanche_ferie_recuperable) @if($filiere->activer_dimanche_ferie) @else @endif @endif {{-- Paye MajorĂ©s (N/A) --}}
Date / Motif / Travail TotalÀ RÉCUPÉRER (Brut en lignes) À PAYER Actions
{{ $filiere->n_premieres_heures }} prem Suiv NuitDim/FerAu-delĂ  18ers dim 1er Mai{{ $filiere->n_premieres_heures }} prem SuivHeuresNuitDim/FerAu-delĂ  18ers dim 1er Mai
{{ ucfirst(str_replace('.', '', $line->date_realisation->translatedFormat('D d M'))) }} {{ \Carbon\Carbon::parse($line->heure_debut)->format('H:i') }}-{{ \Carbon\Carbon::parse($line->heure_fin)->format('H:i') }} {{ $line->travail_effectue }} ({{ $line->motif->libelle_motif }}) @if($line->is_oubliee) ⚠ @endif @if($line->id_createur && $line->id_createur != $displayUser->id) (Saisi par {{ $line->createur->firstname }}) @endif @if(!$filiere->activer_dimanche_ferie && $line->is_au_dela_18_dim) > 18 Dim @endif
{{ $line->total_raw_fmt }} {{ $line->raw_n_premieres > 0 ? \App\Helpers\TimeHelper::decimalToHours($line->raw_n_premieres) : '-' }} {{ $line->raw_suivantes > 0 ? \App\Helpers\TimeHelper::decimalToHours($line->raw_suivantes) : '-' }} {{ $line->raw_nuit > 0 ? \App\Helpers\TimeHelper::decimalToHours($line->raw_nuit) : '-' }} {{ $line->raw_dimanche_ferie > 0 ? \App\Helpers\TimeHelper::decimalToHours($line->raw_dimanche_ferie) : '-' }} {{ $line->raw_dim_suiv > 0 ? \App\Helpers\TimeHelper::decimalToHours($line->raw_dim_suiv) : '-' }} {{ $line->raw_1er_mai > 0 ? \App\Helpers\TimeHelper::decimalToHours($line->raw_1er_mai) : '-' }} {{ $line->paye_n_premieres > 0 ? \App\Helpers\TimeHelper::decimalToHours($line->paye_n_premieres) : '-' }} {{ $line->paye_suivantes > 0 ? \App\Helpers\TimeHelper::decimalToHours($line->paye_suivantes) : '-' }} {{ ($line->paye_n_premieres + $line->paye_suivantes) > 0 ? \App\Helpers\TimeHelper::decimalToHours($line->paye_n_premieres + $line->paye_suivantes) : '-' }} {{ $line->paye_nuit > 0 ? \App\Helpers\TimeHelper::decimalToHours($line->paye_nuit) : '-' }} {{ $line->paye_dimanche_ferie > 0 ? \App\Helpers\TimeHelper::decimalToHours($line->paye_dimanche_ferie) : '-' }} {{ $line->paye_dim_suiv > 0 ? \App\Helpers\TimeHelper::decimalToHours($line->paye_dim_suiv) : '-' }} {{ $line->paye_1er_mai > 0 ? \App\Helpers\TimeHelper::decimalToHours($line->paye_1er_mai) : '-' }}
@php $isStaySubsequentDay = false; $stayData = []; if (isset($line->motif) && $line->motif->est_sejour) { if (preg_match('/\(J([2-9]|[1-9][0-9]+)\/[0-9]+\)$/', $line->travail_effectue)) { $isStaySubsequentDay = true; } elseif ($line->groupe_id) { $groupLines = $lines->where('groupe_id', $line->groupe_id)->sortBy('date_realisation'); $lastLine = $groupLines->last(); $stayData = [ 'date_realisation_fin' => $lastLine->date_realisation->format('Y-m-d'), 'heure_fin' => \Carbon\Carbon::parse($lastLine->heure_fin)->format('H:i'), 'total_paye' => \App\Helpers\TimeHelper::decimalToHours($groupLines->sum('choix_paye')), 'total_recup' => \App\Helpers\TimeHelper::decimalToHours($groupLines->sum('choix_recup')), 'travail_effectue' => trim(preg_replace('/\(J[0-9]+\/[0-9]+\)$/', '', $line->travail_effectue)), ]; } } $stayJson = json_encode($stayData); @endphp @if(!$group['isLocked']) @if(!$isStaySubsequentDay) @else @endif @else 🔒 @endif
Totaux Majorés @php $sumMaj = $lines->sum('maj_n_premieres') + $lines->sum('maj_suivantes'); $sumMaj += $lines->sum('maj_nuit'); if ($filiere->activer_dimanche_ferie) { $sumMaj += $lines->sum('maj_dimanche_ferie'); } else { $sumMaj += $lines->sum('maj_dim_suiv') + $lines->sum('maj_1er_mai'); } @endphp {{ $sumMaj > 0 ? \App\Helpers\TimeHelper::decimalToHours($sumMaj) : '-' }} @php $sum = $lines->sum('maj_n_premieres'); @endphp {{ $sum > 0 ? \App\Helpers\TimeHelper::decimalToHours($sum) : '-' }} @php $sum = $lines->sum('maj_suivantes'); @endphp {{ $sum > 0 ? \App\Helpers\TimeHelper::decimalToHours($sum) : '-' }} @php $sum = $lines->sum('maj_nuit'); @endphp {{ $sum > 0 ? \App\Helpers\TimeHelper::decimalToHours($sum) : '-' }} @php $sum = $lines->sum('maj_dimanche_ferie'); @endphp {{ $sum > 0 ? \App\Helpers\TimeHelper::decimalToHours($sum) : '-' }} @php $sum = $lines->sum('maj_dim_suiv'); @endphp {{ $sum > 0 ? \App\Helpers\TimeHelper::decimalToHours($sum) : '-' }} @php $sum = $lines->sum('maj_1er_mai'); @endphp {{ $sum > 0 ? \App\Helpers\TimeHelper::decimalToHours($sum) : '-' }} -
@endforeach @endif
@push('scripts') @endpush