@forelse($clientsData as $clientData) @php $serviceTypeRow = strtolower((string)($clientData['contract_service_type'] ?? '')); $rowHasCleaning = (!empty($clientData['cleaning_contracts'])) || str_contains($serviceTypeRow,'clean') || str_contains($serviceTypeRow,'menage') || str_contains($serviceTypeRow,'ménage'); $rowHasBin = (!empty($clientData['bin_contracts'] ?? [])) || str_contains($serviceTypeRow,'bin') || str_contains($serviceTypeRow,'poubelle'); $rowHasIroning = (!empty($clientData['ironing_contracts'] ?? [])) || str_contains($serviceTypeRow,'iron') || str_contains($serviceTypeRow,'repass'); $rowHasDish = (!empty($clientData['dishwashing_contracts'])) || str_contains($serviceTypeRow,'dish') || str_contains($serviceTypeRow,'vaisselle'); // Déterminer l'ID du contrat principal (ménage prioritaire) $primaryContractId = null; $cleaningContracts = $clientData['cleaning_contracts'] ?? []; if (!empty($cleaningContracts)) { $primaryContractId = collect($cleaningContracts)->first()['id'] ?? null; } if (!$primaryContractId && !empty($clientData['primary_contract_id'] ?? null)) { $primaryContractId = $clientData['primary_contract_id']; } // Récupérer les dates du contrat principal pour les filtres $contractStartDate = null; $contractEndDate = null; // Chercher d'abord dans cleaning_contracts if (!empty($clientData['cleaning_contracts'])) { $primaryContract = collect($clientData['cleaning_contracts']) ->where('id', $primaryContractId) ->first(); if ($primaryContract) { $contractStartDate = $primaryContract['start_date'] ?? null; $contractEndDate = $primaryContract['end_date'] ?? null; } else { // Prendre le premier contrat si pas de contrat principal trouvé $firstContract = collect($clientData['cleaning_contracts'])->first(); if ($firstContract) { $contractStartDate = $firstContract['start_date'] ?? null; $contractEndDate = $firstContract['end_date'] ?? null; } } } // Si pas trouvé dans cleaning_contracts, chercher dans tous les autres types de contrats if (!$contractStartDate) { $allContracts = array_merge( $clientData['cleaning_contracts'] ?? [], $clientData['dishwashing_contracts'] ?? [], $clientData['bin_contracts'] ?? [], $clientData['ironing_contracts'] ?? [] ); if (!empty($allContracts)) { // Chercher le contrat avec l'ID principal $primaryContract = collect($allContracts)->where('id', $primaryContractId)->first(); if ($primaryContract) { $contractStartDate = $primaryContract['start_date'] ?? null; $contractEndDate = $primaryContract['end_date'] ?? null; } else { // Prendre le premier contrat disponible $firstContract = collect($allContracts)->first(); if ($firstContract) { $contractStartDate = $firstContract['start_date'] ?? null; $contractEndDate = $firstContract['end_date'] ?? null; } } } } @endphp @empty @endforelse
ID Client Dates de contrat Adresse Personnel Contrat ménage Actions Statut
{{ $clientData['row_contract_id'] ?? ($primaryContractId ?? '—') }} @php $clientId = $clientData['client']->client_id ?? ($clientData['client']->id ?? null); @endphp @if($clientId)
@if($clientData['client']->logo_url ?? false) @else
@endif
{{ $clientData['client']->client_display_name ?? 'Client' }}
{{ $clientData['client']->client_code ?? '' }}
@else
@if($clientData['client']->logo_url ?? false) @else
@endif
{{ $clientData['client']->client_display_name ?? 'Client' }}
{{ $clientData['client']->client_code ?? '' }}
@endif
@php // Utiliser les mêmes dates que celles définies plus haut pour les attributs data-* $startDate = $contractStartDate; $endDate = $contractEndDate; // Debug pour les particuliers if (($clientData['client']->client_type ?? '') === 'particulier') { \Log::info('Debug dates particulier', [ 'client_name' => $clientData['client']->client_display_name ?? '', 'primary_contract_id' => $primaryContractId, 'cleaning_contracts_count' => count($clientData['cleaning_contracts'] ?? []), 'dishwashing_contracts_count' => count($clientData['dishwashing_contracts'] ?? []), 'bin_contracts_count' => count($clientData['bin_contracts'] ?? []), 'ironing_contracts_count' => count($clientData['ironing_contracts'] ?? []), 'start_date' => $startDate, 'end_date' => $endDate, 'all_contracts' => [ 'cleaning' => $clientData['cleaning_contracts'] ?? [], 'dishwashing' => $clientData['dishwashing_contracts'] ?? [], 'bin' => $clientData['bin_contracts'] ?? [], 'ironing' => $clientData['ironing_contracts'] ?? [] ] ]); } @endphp @if($startDate)
Début : {{ \Carbon\Carbon::parse($startDate)->format('d/m/Y') }}
@else @if(($clientData['client']->client_type ?? '') === 'particulier')
DEBUG: Pas de start_date - C:{{ count($clientData['cleaning_contracts'] ?? []) }} D:{{ count($clientData['dishwashing_contracts'] ?? []) }} B:{{ count($clientData['bin_contracts'] ?? []) }} I:{{ count($clientData['ironing_contracts'] ?? []) }}
@endif @endif @if($endDate)
Fin : {{ \Carbon\Carbon::parse($endDate)->format('d/m/Y') }}
@else
Durée : Indéterminée
@endif
@php $addr = $clientData['address'] ?? null; $street = trim($addr->street ?? ''); $postal = trim($addr->postal_code ?? ''); $city = trim($addr->city ?? ''); $floor = trim($addr->floor ?? ''); $side = trim($addr->side ?? ''); $mainParts = []; if ($street !== '') { $mainParts[] = $street; } $cityLine = trim(($postal !== '' ? $postal . ' ' : '') . $city); if ($cityLine !== '') { $mainParts[] = $cityLine; } $computedAddress = count($mainParts) > 0 ? implode(', ', $mainParts) : ($addr->formatted_address ?? 'Adresse non définie'); $mainAddress = trim($addr->short_address ?? '') !== '' ? $addr->short_address : $computedAddress; @endphp
{{ $mainAddress }}
@if($floor !== '' || $side !== '')
@if($floor !== '') {{ $floor }} @endif @if($side !== '') {{ $side }} @endif
@endif
@forelse($clientData['workers'] as $worker) @php $workerId = $worker->id ?? null; @endphp @if($workerId)
{{ $worker->prenom ?? 'Prénom' }}
@else
{{ $worker->prenom ?? 'Prénom' }}
@endif @empty
Non assigné
@endforelse
@php // Déterminer si ce contrat est en facturation horaire (pour masquer le planning) $cleaningContracts = $clientData['cleaning_contracts'] ?? []; $dishwashingContracts = $clientData['dishwashing_contracts'] ?? []; $binContracts = $clientData['bin_contracts'] ?? []; $ironingContracts = $clientData['ironing_contracts'] ?? []; $rowIsHourly = strtolower($clientData['billing_type'] ?? '') === 'hourly'; if (!$rowIsHourly && is_array($cleaningContracts)) { foreach ($cleaningContracts as $c) { if (strtolower($c['billing_type'] ?? '') === 'hourly') { $rowIsHourly = true; break; } } } if (!$rowIsHourly && is_array($dishwashingContracts)) { foreach ($dishwashingContracts as $c) { if (strtolower($c['billing_type'] ?? '') === 'hourly') { $rowIsHourly = true; break; } } } if (!$rowIsHourly && is_array($binContracts)) { foreach ($binContracts as $c) { if (strtolower($c['billing_type'] ?? '') === 'hourly') { $rowIsHourly = true; break; } } } if (!$rowIsHourly && is_array($ironingContracts)) { foreach ($ironingContracts as $c) { if (strtolower($c['billing_type'] ?? '') === 'hourly') { $rowIsHourly = true; break; } } } @endphp @if($rowIsHourly) {{-- Mode horaire: une seule prestation par contrat -> rendre UN seul bloc contrat mini --}} @php $hourlyBlock = null; $label = ''; $amount = null; $iconClass = 'fa-clock'; $legendIconClass = ''; // Priorité: Ménage > Poubelle > Repassage > Vaisselle if (is_array($cleaningContracts)) { foreach ($cleaningContracts as $c) { if (strtolower($c['billing_type'] ?? '')==='hourly') { $label = "À l'heure — Ménage"; $iconClass='fa-broom'; $legendIconClass='cleaning-icon'; $hourlyBlock = $c; break; } } } if (!$hourlyBlock && is_array($binContracts)) { foreach ($binContracts as $c) { if (strtolower($c['billing_type'] ?? '')==='hourly') { $label = "À l'heure — Poubelle"; $iconClass='fa-trash'; $legendIconClass='trash-icon'; $hourlyBlock = $c; break; } } } if (!$hourlyBlock && is_array($ironingContracts)) { foreach ($ironingContracts as $c) { if (strtolower($c['billing_type'] ?? '')==='hourly') { $label = "À l'heure — Repassage"; $iconClass='fa-shirt'; $legendIconClass='ironing-icon'; $hourlyBlock = $c; break; } } } if (!$hourlyBlock && is_array($dishwashingContracts)) { foreach ($dishwashingContracts as $c) { if (strtolower($c['billing_type'] ?? '')==='hourly') { $label = "À l'heure — Vaisselle"; $iconClass='fa-utensils'; $legendIconClass='dishwashing-icon'; $hourlyBlock = $c; break; } } } if ($hourlyBlock) { $hasTotal = isset($hourlyBlock['total_amount']) && $hourlyBlock['total_amount'] !== null && $hourlyBlock['total_amount'] !== ''; if ($hasTotal) { $amount = number_format((float) $hourlyBlock['total_amount'], 2, ',', ' '); } else { // Try compute from block values; else fallback to top-level clientData $rate = isset($hourlyBlock['hourly_rate']) ? (float)$hourlyBlock['hourly_rate'] : (isset($clientData['hourly_rate']) ? (float)$clientData['hourly_rate'] : null); $marg = isset($hourlyBlock['margin_percent']) ? (float)$hourlyBlock['margin_percent'] : (isset($clientData['margin_percent']) ? (float)$clientData['margin_percent'] : null); if ($rate !== null && $marg !== null && $marg < 100) { $den = 1 - ($marg / 100.0); $tot = $den > 0 ? ($rate / $den) : null; $amount = $tot !== null ? number_format((float)$tot, 2, ',', ' ') : ($rate !== null ? number_format($rate, 2, ',', ' ') : null); } else { $amount = $rate !== null ? number_format($rate, 2, ',', ' ') : null; } } } @endphp @if($hourlyBlock)
{{ $label }}
@if($amount !== null) {{ $amount }}€/h @else Non défini @endif
@else @php // Fallback si pas de bloc trouvé mais ligne marquée horaire (compat legacy) $legacyHasTotal = isset($clientData['total_amount']) && $clientData['total_amount'] !== '' && $clientData['total_amount'] !== null; if ($legacyHasTotal) { $legacyAmount = number_format((float) $clientData['total_amount'], 2, ',', ' '); } else { $legacyRate = isset($clientData['hourly_rate']) ? (float) $clientData['hourly_rate'] : null; $legacyMargin = isset($clientData['margin_percent']) ? (float) $clientData['margin_percent'] : null; if ($legacyRate !== null && $legacyMargin !== null && $legacyMargin < 100) { $den = 1 - ($legacyMargin / 100.0); $tot = $den > 0 ? ($legacyRate / $den) : null; $legacyAmount = $tot !== null ? number_format((float)$tot, 2, ',', ' ') : ($legacyRate !== null ? number_format($legacyRate, 2, ',', ' ') : null); } else { $legacyAmount = $legacyRate !== null ? number_format($legacyRate, 2, ',', ' ') : null; } } $legacyLabel = "À l'heure"; $legacyIconClass = 'fa-clock'; $legacyLegendIconClass = ''; if (!empty($clientData['contract_service_type'])) { $stype = strtolower((string)$clientData['contract_service_type']); if (str_contains($stype, 'clean') || str_contains($stype, 'menage') || str_contains($stype, 'ménage')) { $legacyLabel = "À l'heure — Ménage"; $legacyIconClass='fa-broom'; $legacyLegendIconClass='cleaning-icon'; } elseif (str_contains($stype, 'bin') || str_contains($stype, 'poubelle')) { $legacyLabel = "À l'heure — Poubelle"; $legacyIconClass='fa-trash'; $legacyLegendIconClass='trash-icon'; } elseif (str_contains($stype, 'iron') || str_contains($stype, 'repass')) { $legacyLabel = "À l'heure — Repassage"; $legacyIconClass='fa-shirt'; $legacyLegendIconClass='ironing-icon'; } elseif (str_contains($stype, 'dish') || str_contains($stype, 'vaisselle')) { $legacyLabel = "À l'heure — Vaisselle"; $legacyIconClass='fa-utensils'; $legacyLegendIconClass='dishwashing-icon'; } } else { // Inférence du type si pas de contract_service_type fourni if (!empty($cleaningContracts)) { $legacyLabel = "À l'heure — Ménage"; $legacyIconClass='fa-broom'; $legacyLegendIconClass='cleaning-icon'; } elseif (!empty($binContracts)) { $legacyLabel = "À l'heure — Poubelle"; $legacyIconClass='fa-trash'; $legacyLegendIconClass='trash-icon'; } elseif (!empty($ironingContracts)) { $legacyLabel = "À l'heure — Repassage"; $legacyIconClass='fa-shirt'; $legacyLegendIconClass='ironing-icon'; } elseif (!empty($dishwashingContracts)) { $legacyLabel = "À l'heure — Vaisselle"; $legacyIconClass='fa-utensils'; $legacyLegendIconClass='dishwashing-icon'; } } @endphp
{{ $legacyLabel }}
@if($legacyAmount !== null) {{ $legacyAmount }}€/h @else Non défini @endif
@endif @else
@php // Utiliser les vraies données du contrat depuis la base de données $daysConfig = $clientData['days_config'] ?? []; // Les clés viennent des schedules: monday..sunday $dayShortNames = [ 'monday' => 'Lu', 'tuesday' => 'Ma', 'wednesday' => 'Me', 'thursday' => 'Je', 'friday' => 'Ve', 'saturday' => 'Sa', 'sunday' => 'Di' ]; $dayNames = ['monday','tuesday','wednesday','thursday','friday','saturday','sunday']; @endphp
@foreach($dayNames as $dayKey) @php $dayData = $daysConfig[$dayKey] ?? null; $hasTasks = $dayData && isset($dayData['tasks']) && count($dayData['tasks']) > 0; @endphp
{{ $dayShortNames[$dayKey] }}
@if($hasTasks) @php $tasks = $dayData['tasks'] ?? []; $hasCleaning = false; $hasDish = false; $hasBin = false; $hasIron = false; foreach ($tasks as $t) { $s = strtolower((string)$t); if (!$hasCleaning && (str_contains($s,'nettoyage')||str_contains($s,'ménage')||str_contains($s,'cleaning')||str_contains($s,'menage'))) { $hasCleaning = true; } if (!$hasDish && (str_contains($s,'vaisselle')||str_contains($s,'dish')||str_contains($s,'couvert'))) { $hasDish = true; } if (!$hasBin && (str_contains($s,'poubelle')||str_contains($s,'trash')||str_contains($s,'garbage')||str_contains($s,'bin'))) { $hasBin = true; } if (!$hasIron && (str_contains($s,'repassage')||str_contains($s,'ironing'))) { $hasIron = true; } } @endphp
{{-- Groupe ménage (balai) --}} @if($hasCleaning)
@if(($dayData['morning'] ?? false) || ($dayData['evening'] ?? false))
@if($dayData['morning'] ?? false)
@endif @if($dayData['evening'] ?? false)
@endif
@endif
@endif {{-- Icônes de tâches séparées --}} @if($hasDish)
@endif @if($hasBin)
@if(($dayData['morning'] ?? false) || ($dayData['evening'] ?? false))
@if($dayData['morning'] ?? false)
@endif @if($dayData['evening'] ?? false)
@endif
@endif
@endif @if($hasIron)
@endif
@else
@endif
@endforeach
{{-- Compteur des tâches --}} @php // Calculer les totaux directement à partir du planning affiché (par jour avec tâche) $totalCleaning = 0; $totalDishwashing = 0; $totalBin = 0; $totalIron = 0; $daysConfig = $clientData['days_config'] ?? []; $dayNames = ['monday','tuesday','wednesday','thursday','friday','saturday','sunday']; foreach ($dayNames as $dayKey) { $dayData = $daysConfig[$dayKey] ?? null; if ($dayData && isset($dayData['tasks']) && count($dayData['tasks']) > 0) { $tasks = $dayData['tasks']; $hasCleaning = false; $hasDish = false; $hasBin = false; $hasIron = false; foreach ($tasks as $t) { $s = strtolower((string)$t); if (!$hasCleaning && (str_contains($s,'nettoyage')||str_contains($s,'ménage')||str_contains($s,'cleaning')||str_contains($s,'menage'))) { $hasCleaning = true; } if (!$hasDish && (str_contains($s,'vaisselle')||str_contains($s,'dish')||str_contains($s,'couvert'))) { $hasDish = true; } if (!$hasBin && (str_contains($s,'poubelle')||str_contains($s,'trash')||str_contains($s,'garbage')||str_contains($s,'bin'))) { $hasBin = true; } if (!$hasIron && (str_contains($s,'repassage')||str_contains($s,'ironing'))) { $hasIron = true; } } if ($hasCleaning) { $totalCleaning++; } if ($hasDish) { $totalDishwashing++; } if ($hasBin) { $totalBin++; } if ($hasIron) { $totalIron++; } } } @endphp @php // Récupérer les contrats par type (séparés) $cleaningContracts = $clientData['cleaning_contracts'] ?? []; $dishwashingContracts = $clientData['dishwashing_contracts'] ?? []; $binContracts = $clientData['bin_contracts'] ?? []; $ironingContracts = $clientData['ironing_contracts'] ?? []; // Pour compatibilité avec l'ancien système $billingType = $clientData['billing_type'] ?? null; $monthlyAmount = $clientData['monthly_package_amount'] ?? null; $hourlyRate = $clientData['hourly_rate'] ?? null; $contractServiceType = $clientData['contract_service_type'] ?? null; @endphp
@if($totalCleaning > 0)
{{ $totalCleaning }} fois/semaine
{{-- Informations du contrat sous ménage --}} @if(!empty($cleaningContracts)) @foreach($cleaningContracts as $contract)
@if($contract['billing_type'] === 'package') @else @endif
{{ $contract['billing_type'] === 'package' ? 'Forfait' : 'À l\'heure' }} — Ménage
@php $hasTotal = isset($contract['total_amount']) && $contract['total_amount'] !== null && $contract['total_amount'] !== ''; @endphp @if($hasTotal) {{ number_format((float) $contract['total_amount'], 2, ',', ' ') }}{{ $contract['billing_type'] === 'package' ? '€/mois' : '€/h' }} @elseif($contract['billing_type'] === 'package' && !empty($contract['monthly_package_amount'])) {{ number_format((float) $contract['monthly_package_amount'], 2, ',', ' ') }}€/mois @elseif($contract['billing_type'] === 'hourly' && !empty($contract['hourly_rate'])) {{ number_format((float) $contract['hourly_rate'], 2, ',', ' ') }}€/h @else Non défini @endif
@endforeach @endif
@endif @if($totalBin > 0)
{{ $totalBin }} fois/semaine
{{-- Informations du contrat sous poubelle (contrat séparé) --}} @if(!empty($binContracts)) @foreach($binContracts as $contract)
@if(($contract['billing_type'] ?? '') === 'package') @else @endif
{{ ($contract['billing_type'] ?? '') === 'package' ? 'Forfait' : 'À l\'heure' }} — Poubelle
@php $hasTotal = isset($contract['total_amount']) && $contract['total_amount'] !== null && $contract['total_amount'] !== ''; @endphp @if($hasTotal) {{ number_format((float) $contract['total_amount'], 2, ',', ' ') }}{{ ($contract['billing_type'] ?? '') === 'package' ? '€/mois' : '€/h' }} @elseif(($contract['billing_type'] ?? '') === 'package' && !empty($contract['monthly_package_amount'])) {{ number_format((float) $contract['monthly_package_amount'], 2, ',', ' ') }}€/mois @elseif(($contract['billing_type'] ?? '') === 'hourly' && !empty($contract['hourly_rate'])) {{ number_format((float) $contract['hourly_rate'], 2, ',', ' ') }}€/h @else Non défini @endif
@endforeach @endif
@endif @if($totalIron > 0)
{{ $totalIron }} fois/semaine
{{-- Informations du contrat sous repassage (contrat séparé) --}} @if(!empty($ironingContracts)) @foreach($ironingContracts as $contract)
@if(($contract['billing_type'] ?? '') === 'package') @else @endif
{{ ($contract['billing_type'] ?? '') === 'package' ? 'Forfait' : 'À l\'heure' }} — Repassage
@php $hasTotal = isset($contract['total_amount']) && $contract['total_amount'] !== null && $contract['total_amount'] !== ''; @endphp @if($hasTotal) {{ number_format((float) $contract['total_amount'], 2, ',', ' ') }}{{ ($contract['billing_type'] ?? '') === 'package' ? '€/mois' : '€/h' }} @elseif(($contract['billing_type'] ?? '') === 'package' && !empty($contract['monthly_package_amount'])) {{ number_format((float) $contract['monthly_package_amount'], 2, ',', ' ') }}€/mois @elseif(($contract['billing_type'] ?? '') === 'hourly' && !empty($contract['hourly_rate'])) {{ number_format((float) $contract['hourly_rate'], 2, ',', ' ') }}€/h @else Non défini @endif
@endforeach @endif
@endif @if($totalDishwashing > 0)
{{ $totalDishwashing }} fois/semaine
{{-- Informations du contrat sous vaisselle --}} @if(!empty($dishwashingContracts)) @foreach($dishwashingContracts as $contract)
@if($contract['billing_type'] === 'package') @else @endif
{{ $contract['billing_type'] === 'package' ? 'Forfait' : 'À l\'heure' }} — Vaisselle
@php $hasTotal = isset($contract['total_amount']) && $contract['total_amount'] !== null && $contract['total_amount'] !== ''; @endphp @if($hasTotal) {{ number_format((float) $contract['total_amount'], 2, ',', ' ') }}{{ $contract['billing_type'] === 'package' ? '€/mois' : '€/h' }} @elseif($contract['billing_type'] === 'package' && !empty($contract['monthly_package_amount'])) {{ number_format((float) $contract['monthly_package_amount'], 2, ',', ' ') }}€/mois @elseif($contract['billing_type'] === 'hourly' && !empty($contract['hourly_rate'])) {{ number_format((float) $contract['hourly_rate'], 2, ',', ' ') }}€/h @else Non défini @endif
@endforeach @endif
@endif @if($totalCleaning == 0 && $totalDishwashing == 0) @php $hasCleaningContracts = !empty($cleaningContracts); $hasDishwashingContracts = !empty($dishwashingContracts); $hasLegacyContract = !empty($billingType) || !empty($monthlyAmount) || !empty($hourlyRate); $hasAnyContract = $hasCleaningContracts || $hasDishwashingContracts || $hasLegacyContract; @endphp
@if($hasCleaningContracts)
0 fois/semaine
@foreach($cleaningContracts as $contract)
@if(($contract['billing_type'] ?? '') === 'package') @else @endif
{{ ($contract['billing_type'] ?? '') === 'package' ? 'Forfait' : 'À l\'heure' }} — Ménage
@php $hasTotal = isset($contract['total_amount']) && $contract['total_amount'] !== null && $contract['total_amount'] !== ''; @endphp @if($hasTotal) {{ number_format((float) $contract['total_amount'], 2, ',', ' ') }}{{ ($contract['billing_type'] ?? '') === 'package' ? '€/mois' : '€/h' }} @elseif(($contract['billing_type'] ?? '') === 'package' && !empty($contract['monthly_package_amount'])) {{ number_format((float) $contract['monthly_package_amount'], 2, ',', ' ') }}€/mois @elseif(($contract['billing_type'] ?? '') === 'hourly' && !empty($contract['hourly_rate'])) {{ number_format((float) $contract['hourly_rate'], 2, ',', ' ') }}€/h @else Non défini @endif
@endforeach @endif @if($hasDishwashingContracts)
0 fois/semaine
@foreach($dishwashingContracts as $contract)
@if(($contract['billing_type'] ?? '') === 'package') @else @endif
{{ ($contract['billing_type'] ?? '') === 'package' ? 'Forfait' : 'À l\'heure' }}
@php $hasTotal = isset($contract['total_amount']) && $contract['total_amount'] !== null && $contract['total_amount'] !== ''; @endphp @if($hasTotal) {{ number_format((float) $contract['total_amount'], 2, ',', ' ') }}{{ ($contract['billing_type'] ?? '') === 'package' ? '€/mois' : '€/h' }} @elseif(($contract['billing_type'] ?? '') === 'package' && !empty($contract['monthly_package_amount'])) {{ number_format((float) $contract['monthly_package_amount'], 2, ',', ' ') }}€/mois @elseif(($contract['billing_type'] ?? '') === 'hourly' && !empty($contract['hourly_rate'])) {{ number_format((float) $contract['hourly_rate'], 2, ',', ' ') }}€/h @else Non défini @endif
@endforeach @endif @if(!$hasAnyContract) Aucun contrat @endif
@endif
@endif
@php // Determine a primary contract id for edit/delete actions (with server fallback) $primaryContractId = $clientData['row_contract_id'] ?? null; if (!empty($cleaningContracts)) { $primaryContractId = $primaryContractId ?: ($cleaningContracts[0]['id'] ?? null); } if (!$primaryContractId && !empty($dishwashingContracts)) { $primaryContractId = $dishwashingContracts[0]['id'] ?? null; } if (!$primaryContractId && !empty($clientData['primary_contract_id'] ?? null)) { $primaryContractId = $clientData['primary_contract_id']; } @endphp
@php $today = \Carbon\Carbon::now(); $startDate = $contractStartDate ? \Carbon\Carbon::parse($contractStartDate) : null; $endDate = $contractEndDate ? \Carbon\Carbon::parse($contractEndDate) : null; $status = 'unknown'; $statusLabel = 'Inconnu'; $statusClass = 'secondary'; $statusIcon = 'fas fa-question-circle'; if ($startDate) { if ($startDate > $today) { // Contrat futur $status = 'future'; $statusLabel = 'Futur'; $statusClass = 'info'; $statusIcon = 'fas fa-clock'; } elseif ($endDate && $endDate < $today) { // Contrat terminé $status = 'terminated'; $statusLabel = 'Terminé'; $statusClass = 'danger'; $statusIcon = 'fas fa-stop-circle'; } else { // Contrat en cours $status = 'active'; $statusLabel = 'En cours'; $statusClass = 'success'; $statusIcon = 'fas fa-play-circle'; } } @endphp
{{ $statusLabel }}

Aucun client assigné

Aucun client n'a encore été assigné pour le ménage.