πŸ‘₯ Import d'agents @if($preview) Γ‰tape 2 β€” PrΓ©visualisation @else Γ‰tape 1 β€” Chargement du fichier @endif

← Retour Γ  la liste
{{-- ═══════════════════════════════════════════════════════════════ --}} {{-- MESSAGES SESSION --}} {{-- ═══════════════════════════════════════════════════════════════ --}} @if(session('success'))
βœ… {{ session('success') }}
@endif @if(session('error'))
❌ {{ session('error') }}
@endif @if(session('info'))
ℹ️ {{ session('info') }}
@endif @if($errors->any())

❌ Erreur de validation :

    @foreach($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif {{-- ═══════════════════════════════════════════════════════════════ --}} {{-- Γ‰TAPE 1 : FORMULAIRE D'UPLOAD (quand pas de prΓ©visualisation) --}} {{-- ═══════════════════════════════════════════════════════════════ --}} @if(!$preview)
{{-- Importer un fichier --}}

πŸ“₯ Analyser un fichier d'agents

πŸ“‹ Format attendu des colonnes :

email nom prΓ©nom service est_chef

Fichiers acceptΓ©s : .csv (sΓ©parateur , ou ;), .xlsx et .sql
La colonne service peut contenir le code ou le libellΓ© du service.
La colonne est_chef accepte : oui / non / 1 / 0 / vrai / faux.

@csrf
{{-- Export --}}

πŸ“€ Exporter la liste des agents

GΓ©nΓ©rez un fichier Excel rΓ©capitulatif contenant tous les agents enregistrΓ©s, leurs rΓ΄les, services et soldes de rΓ©cupΓ©ration actuels.

πŸ“Š GΓ©nΓ©rer l'export Excel (.xlsx)
{{-- ═══════════════════════════════════════════════════════════════ --}} {{-- Γ‰TAPE 2 : PRΓ‰VISUALISATION + SΓ‰LECTION + IMPORT --}} {{-- ═══════════════════════════════════════════════════════════════ --}} @else @php $validRows = $preview['valid'] ?? []; $invalidRows = $preview['invalid'] ?? []; $filename = $preview['filename'] ?? 'fichier'; $createdAt = $preview['created_at'] ?? ''; @endphp {{-- En-tΓͺte de prΓ©visualisation --}}

πŸ—‚οΈ PrΓ©visualisation β€” {{ $filename }}

AnalysΓ© le {{ $createdAt }}

βœ… {{ count($validRows) }} importable(s) ❌ {{ count($invalidRows) }} rejetΓ©(s) {{-- Annuler --}}
@csrf
{{-- ─────────────────────────────────────────────────────────── --}} {{-- ONGLETS DE NAVIGATION --}} {{-- ─────────────────────────────────────────────────────────── --}}
{{-- CONTENU ONGLET 1 : IMPORTABLES --}}
@if(count($validRows) > 0)
@csrf
{{-- Header section --}}

βœ… Agents prΓͺts Γ  Γͺtre importΓ©s (sΓ©lectionnez ceux Γ  importer)

{{-- ── BARRE D'ACTIONS PAR LOTS ─────────────────────── --}}
⚑ Actions par lots 0 sélectionné(s)
{{-- Service --}}
{{-- Chef --}}
{{-- Appliquer --}}
{{-- Feedback batch --}}
{{-- ── FILTRE PAR DOMAINE ──────────────────────────── --}} @php $domains = collect($validRows) ->map(fn($r) => substr(strrchr($r['email'], '@'), 1)) ->filter() ->unique() ->sort() ->values(); @endphp @if($domains->count() > 1)
@endif {{-- ── TABLE ────────────────────────────────────────── --}}
@foreach($validRows as $row) @endforeach
Nom / PrΓ©nom ↕ Email ↕ Service ↕ Chef
{{ strtoupper($row['nom']) }}
{{ $row['prenom'] }}
{{ $row['email'] }} {{-- Hidden inputs conservΓ©s pour la soumission --}} {{ $row['id_service'] ? ($row['service_name'] ?? 'Service dΓ©tectΓ©') : 'β€” Aucun service β€”' }} @if($row['service_not_found'] && !empty($row['service_raw']))

⚠️ "{{ $row['service_raw'] }}" non trouvé

@endif
{{ $row['est_chef'] ? 'Chef' : 'Non' }}
{{-- Erreur JS --}} {{-- Bouton d'import --}}

{{ count($validRows) }} agent(s) sΓ©lectionnΓ©(s) sur {{ count($validRows) }} importable(s).

@else

πŸ˜• Aucun agent importable dans ce fichier.

Tous les agents sont dΓ©jΓ  en base ou les lignes sont invalides.

@endif
{{-- CONTENU ONGLET 2 : REJETÉS --}} @endif
{{-- ═══════════════════════════════════════════════════════════════════════ --}} {{-- JAVASCRIPT --}} {{-- ═══════════════════════════════════════════════════════════════════════ --}}