{{-- Client. Sans lui (planning sans client_id, ou contact introuvable dans Gestan), route('clients.show') planterait sur un id nul. --}} @if (!empty($client['id']))
Client

@endif @include('admin.plannings._nature_chantier') @include('admin.plannings._adresse_chantier') {{-- Devis (masqué si vide, ex. chantiers intervention) --}} @if (!empty($devisList) && is_array($devisList))
Devis
@foreach ($devisList as $devis)
  • N° : {{ $devis['id'] ?? '—' }}
  • Nature : {{ $devis['nature'] ?? '—' }}
  • Adresse du devis : {{ $devis['adresse_1'] ?? '—' }} {{ $devis['adresse_2'] ?? '—' }}
  • Code Postal : {{ $devis['code_postal'] ?? '—' }}
  • Ville : {{ $devis['ville'] ?? '—' }}
  • Responsable : {{ $devis['responsable'] ?? '—' }}
@endforeach @endif {{-- Interventions (masqué si vide, ex. chantiers pose/maçonnerie) --}} @if (!empty($interventionsList) && is_array($interventionsList))
Interventions
@foreach ($interventionsList as $inter) @php $clientInter = $inter['CLIENT'] ?? null; $nomClientInter = $clientInter['RAISON_SOCIALE'] ?? trim(($clientInter['NOMFAMILLE'] ?? '') . ' ' . ($clientInter['PRENOM'] ?? '')) ?: '—'; // Le LIEU saisi dans Gestan, sinon le client (gestan_inter_adresse) $lieuInter = gestan_inter_adresse($inter); $adresseInter = $lieuInter['complete']; @endphp
  • N° : {{ $inter['IDINTERVENTION'] ?? '—' }}
  • Libellé : {{ $inter['LIBINTER'] ?? '—' }}
  • Secteur : {{ $inter['SECTEUR'] ?? '—' }}
  • Client : {{ $nomClientInter }}
  • @if ($adresseInter)
  • {{ $lieuInter['lieu'] ? __("Lieu d'intervention") : __('Adresse') }} : {{ $adresseInter }}
  • @endif
{{-- Le compte rendu du technicien, relu ici pour ne pas avoir a ouvrir la fiche de chaque intervention du planning. --}} @include('admin.plannings._rapports_intervention', [ 'intervention' => $inter, 'rapports' => ($rapportsInterventions ?? collect()) ->get((int) ($inter['IDINTERVENTION'] ?? 0)) ?? collect(), ])
@endforeach @endif
{{-- Infos planning --}}
{{ ($equipeType ?? null) === \App\Models\Equipe::TYPE_VEHICULE ? 'Réparation véhicule' : 'Chantier' }}
@php // dates API = string -> Carbon $debut = !empty($planning['date_debut']) ? \Illuminate\Support\Carbon::parse($planning['date_debut']) : null; $fin = !empty($planning['date_fin']) ? \Illuminate\Support\Carbon::parse($planning['date_fin']) : null; $equipeNom = $planning['equipe']['nom'] ?? '—'; @endphp
{{-- Techniciens --}}
Techniciens
@php // selon ton API : "employes" OU "employes" / "users" -> toi c'est "employes" $employes = $planning['employes'] ?? []; @endphp @if (!empty($employes) && is_array($employes)) @else

Aucun technicien affecté.

@endif {{-- Observations : ton API ne renvoie pas ça actuellement --}} {{-- Si tu ajoutes observations dans l'API, tu pourras réactiver --}} @if (!empty($planning['observations']) && is_array($planning['observations']))
Observations

@endif {{-- Photos du chantier, puis ses retours : les deux partiels se taisent tout seuls quand l'equipe n'en attend pas. --}} @include('admin.plannings.photos._bloc', [ 'planning' => $localPlanning ?? null, 'photos' => $photosChantier ?? collect(), 'typeRapport' => $typeRapport ?? null, ]) {{-- Retours de chantier. Le partiel se tait tout seul quand l'equipe n'en attend pas : interventions et absences ont la meme modale. --}} @include('admin.plannings.rapports._liste', [ 'planning' => $localPlanning ?? null, 'rapports' => $rapports ?? collect(), 'typeRapport' => $typeRapport ?? null, ]) {{-- HISTORIQUE du planning local associe : replie pour ne pas allonger la modale --}} @can('logs.view')
@include('admin.logs._list', [ 'logs' => $logs, 'titre' => 'Historique du planning', 'vide' => 'Aucun log pour ce planning.', ])
@endcan
{{-- Bouton EDIT --}} @php $isIntervention = in_array($equipeType ?? '', ['intervention']); $isReparation = ($equipeType ?? null) === \App\Models\Equipe::TYPE_VEHICULE; $editUrl = match (true) { $isIntervention => route('plannings.interventions.edit', $planning['id']), $isReparation => route('plannings.reparations.edit', $planning['id']), default => route('plannings.chantiers.edit', $planning['id']), }; $editPerm = $isIntervention ? 'plannings.editIntervention' : 'plannings.editChantier'; @endphp @can($editPerm) @endcan @can('plannings.delete') @include('admin.plannings._supprimer', ['classe' => 'px-2']) @endcan