@php $t = \App\Helpers\TranslationHelper::getUserTranslations(); $date = isset($declaration->work_date) ? \Carbon\Carbon::parse($declaration->work_date) : null; $year = $date ? (int)$date->format('Y') : null; $month = $date ? (int)$date->format('n') : null; $day = $date ? $date->format('d') : ''; $monthKey = $date ? strtolower($date->format('F')) : null; $fullMonth = $date ? ($t['translations']['months'][$monthKey] ?? $date->translatedFormat('F')) : ''; if (function_exists('mb_substr')) { $monthAbbr = ucfirst(mb_substr($fullMonth, 0, 3, 'UTF-8')).'.'; } else { $monthAbbr = ucfirst(substr($fullMonth,0,3)).'.'; } $clientName = $declaration->client_name ?? ($t['translations']['interventions']['client'] ?? 'Client'); // Utiliser ServiceIconHelper pour uniformiser les icônes et classes $serviceType = $declaration->service_type ?? 'cleaning'; $config = \App\Helpers\ServiceIconHelper::getConfig($serviceType); $serviceIcon = $config['icon']; $serviceClass = $config['class']; $serviceLabel = $t['translations']['cleaning'][$config['label_key']] ?? $config['fallback']; $start = isset($declaration->start_time) ? substr($declaration->start_time,0,5) : null; $end = isset($declaration->end_time) ? substr($declaration->end_time,0,5) : null; $minutes = isset($declaration->minutes_worked) ? (int)$declaration->minutes_worked : null; $sep = $t['translations']['schedules']['hour_separator'] ?? 'h'; $hoursText = $minutes !== null ? (floor($minutes/60).$sep.str_pad((string)($minutes%60), 2, '0', STR_PAD_LEFT)) : ''; $isValidated = (int)($declaration->status ?? 0) === 1; $statusClass = $isValidated ? 'validated' : 'pending'; @endphp
@php $clientType = strtolower($declaration->client_type ?? ''); $isParticulier = $clientType === 'particulier'; @endphp @if($isParticulier)
@php $nameParts = explode(' ', trim($clientName)); $initials = ''; if (count($nameParts) >= 2) { $initials = strtoupper(substr($nameParts[0], 0, 1) . substr($nameParts[1], 0, 1)); } else { $initials = strtoupper(substr($clientName, 0, 2)); } @endphp {{ $initials }}
@else @endif @if($date)
{{ $day }}
{{ $monthAbbr }}
{{ $year }}
@endif
{{ $clientName }}
@if(!empty($declaration->client_type)) @php $typeClass = strtolower($declaration->client_type); $typeKey = 'client_type_'.$typeClass; $typeLabel = $t['translations']['declaration'][$typeKey] ?? $declaration->client_type; @endphp
{{ $typeLabel }}
@endif
@if(!empty($declaration->short_address))
{{ $declaration->short_address }}
@endif @php $breakMin = isset($declaration->break_minutes) ? (int)$declaration->break_minutes : 0; $pauseText = ''; if ($breakMin > 0) { $bh = floor($breakMin / 60); $bm = $breakMin % 60; $pauseText = ' (' . ($bh > 0 ? ($bh . 'h' . str_pad((string)$bm, 2, '0', STR_PAD_LEFT)) : ($bm . ' min')) . ')'; } @endphp @if($start && $end)
{{ $start }} – {{ $end }}{!! $pauseText !!}
@endif @if(!empty($hoursText))
{{ $t['translations']['cleaning']['total_sum'] ?? "Total d'heures:" }} {{ $hoursText }}
@endif
{{ $serviceLabel }} @if(($userEmploymentStatus ?? 'micro') !== 'salarie')
{{ $t['translations']['declaration']['hourly_total_label'] ?? 'Total' }}
{{ number_format((float)($declaration->total_amount ?? 0), 2, ',', ' ') }} €
@endif