@php $formatContractType = fn ($contract): string => mb_strtoupper($contract->contract_type ?: 'cdi'); $contractTypeModifier = fn ($contract): string => $contract->contract_type === 'cdd' ? ' contract-type-badge--cdd' : ' contract-type-badge--cdi'; $statusBadgeModifier = fn ($contract): string => match ($contract->status) { 'draft' => ' contract-status-badge--draft', 'to_sign' => ' contract-status-badge--to-sign', 'cancelled' => ' contract-status-badge--cancelled', 'ended', 'superseded' => ' contract-status-badge--ended', default => '', }; $formatDates = function ($contract): string { $start = $contract->started_on?->format('d/m/y') ?? '—'; $end = $contract->ended_at ?? $contract->ends_on; if ($end) { return "{$start} → {$end->format('d/m/y')}"; } if (! $contract->started_on) { return $start; } $days = max(0, (int) $contract->started_on->diffInDays(now()) + 1); return $start.' ('.$days.' jour'.($days > 1 ? 's' : '').')'; }; $formatAmplitude = function ($contract): string { $schedule = is_array($contract->weekly_schedule) ? $contract->weekly_schedule : []; $days = collect($schedule)->where('enabled', true)->count(); $minutes = (int) ($contract->weekly_minutes ?? 0); if ($days === 0 && $minutes === 0) { return '—'; } $hours = $minutes / 60; $hoursLabel = fmod($hours, 1.0) === 0.0 ? (string) (int) $hours : str_replace('.', ',', rtrim(rtrim(number_format($hours, 2, '.', ''), '0'), '.')); return $days.'jrs | '.$hoursLabel.' hrs'; }; $contractUrl = fn ($contract): ?string => $activeTab === 'terminating' ? route($isParentView ? 'parent.contracts.end' : 'contracts.end', $contract) : route($isParentView ? 'parent.contracts.show' : 'contracts.show', $contract); $pdfUrl = fn ($contract): string => route($isParentView ? 'parent.contracts.pdf' : 'contracts.pdf', $contract); $canDelete = fn ($contract): bool => $contract->canBeDeletedBy(auth()->user()); $deleteUrl = fn ($contract): string => route($isParentView ? 'parent.contracts.destroy' : 'contracts.destroy', $contract); $canAmend = fn ($contract): bool => $contract->status === 'active' && ! $contract->hasPendingAmendment(); $amendmentStoreUrl = fn ($contract): string => route($isParentView ? 'parent.contracts.amendments.store' : 'contracts.amendments.store', $contract); $canReopen = fn ($contract): bool => $contract->canBeReopenedBy(auth()->user()); $reopenUrl = fn ($contract): string => route($isParentView ? 'parent.contracts.reopen' : 'contracts.reopen', $contract); $canDuplicate = fn ($contract): bool => $contract->canBeDuplicatedBy(auth()->user()); $duplicateUrl = fn ($contract): string => route($isParentView ? 'parent.contracts.duplicate' : 'contracts.duplicate', $contract); // Dossier de fin de contrat non annulé le plus récent : sert à savoir si on propose de la consulter // (déjà en cours) ou d'en ouvrir une (aucune en cours), et si elle est actée (bonne réception confirmée). $activeTermination = fn ($contract) => $contract->terminations->whereNull('cancelled_at')->sortByDesc('created_at')->first(); $terminationActed = fn ($contract): bool => (bool) $activeTermination($contract)?->isAcknowledged(); $hasTerminationInProgress = fn ($contract): bool => $activeTermination($contract) !== null && ! $terminationActed($contract); $canEnd = fn ($contract): bool => $contract->canBeEndedBy(auth()->user()) && ! $terminationActed($contract); $endUrl = fn ($contract): string => route($isParentView ? 'parent.contracts.end' : 'contracts.end', $contract); $sortUrl = function (string $column) use ($sort, $direction): string { $query = request()->except(['sort', 'direction', 'page']); if ($sort !== $column) { $query['sort'] = $column; $query['direction'] = 'asc'; } elseif ($direction === 'asc') { $query['sort'] = $column; $query['direction'] = 'desc'; } return request()->url().($query ? '?'.http_build_query($query) : ''); }; $sortIndicator = fn (string $column): string => $sort === $column ? ($direction === 'asc' ? '↑' : '↓') : ''; $tabUrl = fn (string $tab): string => $isParentView ? route('parent.contracts', ['tab' => $tab]) : route('contracts.index', ['tab' => $tab]); $careTypeShortLabel = fn ($contract): ?string => match ($contract->care_type) { 'incomplete_year' => 'année incomplète', 'occasional' => 'garde occasionnelle', default => null, }; $formatWeeklyDuration = function ($contract): string { $minutes = (int) ($contract->weekly_minutes ?? 0); if ($minutes <= 0) { return '—'; } return sprintf('%dh%02d / sem.', intdiv($minutes, 60), $minutes % 60); }; $formatHourlyRate = fn ($contract): string => $contract->hourly_rate_net ? number_format((float) $contract->hourly_rate_net, 2, ',', ' ').' €/h' : '—'; $formatMonthlySalary = fn ($contract): string => $contract->monthly_salary_estimate ? number_format((float) $contract->monthly_salary_estimate, 2, ',', ' ').' € net' : '—'; $formatSinceDate = function ($contract): string { $end = $contract->ended_at ?? $contract->ends_on; if (! $contract->started_on) { return 'Date de début à préciser'; } if ($end) { return $contract->started_on->format('d/m/Y').' → '.$end->format('d/m/Y'); } return 'Depuis le '.$contract->started_on->format('d/m/Y'); }; @endphp

Mes contrats

@if ($shareCode ?? null)
@endif
@if ($isParentView) @else
@if ($activeTab === 'models') Créer un modèle @else Projet de contrat @endif
@endif
@if ($activeTab === 'models')

Les modèles me permettent de préparer à l’avance les conditions habituelles d’un contrat (rémunération, horaires, congés…). Je les partage ensuite à un parent employeur : il crée son contrat en un clic avec ces conditions déjà remplies, il n’a plus qu’à le compléter, de quoi aller plus vite jusqu’à la signature.

@if (($templates ?? collect())->isNotEmpty())
@foreach ($templates as $template) @php $templateUrl = route('contract-templates.edit', $template); @endphp @endforeach
Modèle Type Amplitude Salaire net estimé Dernier partage Actions
{{ $template->title }} {{ mb_strtoupper($template->contract_type) }} {{ $formatAmplitude($template) }} {{ $template->monthly_salary_estimate ? number_format((float) $template->monthly_salary_estimate, 2, ',', ' ') . ' €' : '—' }} {{ $template->shared_at?->diffForHumans() ?? 'Jamais' }}
@else
Je n’ai pas encore de modèle.
@endif @elseif ($contracts->count() > 0)
@foreach ($contracts as $contract) @php $child = $contract->child; $employer = $child?->employer; $rowUrl = $contractUrl($contract); @endphp @endforeach
Enfant{{ $sortIndicator('child') }} {{ $isParentView ? 'Mon assistante maternelle' : 'Parent' }}{{ $sortIndicator($isParentView ? 'assistant' : 'parent') }} État{{ $sortIndicator('status') }} Type{{ $sortIndicator('type') }} Débuté le Amplitude Actions
@if ($rowUrl) {{ $child?->display_name ?? 'Mon enfant' }} @else {{ $child?->display_name ?? 'Mon enfant' }} @endif
{{ $isParentView ? ($contract->assistant()?->name ?: 'Mon assistante maternelle reste à renseigner') : ($employer?->display_name ?: 'Parent non renseigné') }} {{ $contract->statusLabel() }} {{ $formatContractType($contract) }} {{ $formatDates($contract) }} {{ $formatAmplitude($contract) }}
{{ $contracts->links() }}
@foreach ($contracts as $contract) @php $child = $contract->child; $employer = $child?->employer; $rowUrl = $contractUrl($contract); $metaName = $isParentView ? ($contract->assistant()?->name ?: 'Mon assistante maternelle reste à renseigner') : ($employer?->display_name ?: 'Parent non renseigné'); $metaCareType = $careTypeShortLabel($contract); @endphp
{{ $contract->statusLabel() }} {{ $formatSinceDate($contract) }}
Amplitude {{ $formatWeeklyDuration($contract) }}
Taux net {{ $formatHourlyRate($contract) }}
Salaire mensualisé {{ $formatMonthlySalary($contract) }}
@endforeach
@else
Je n’ai pas encore de contrat.
@endif