@extends('layouts.app') @section('title', 'Permissions - Détail') @section('header', 'Permissions des dossiers') @push('styles') @endpush @section('content') @php $statutLabels = ['pending' => ['En attente…', 'text-yellow-600'], 'running' => ['Scan en cours…', 'text-blue-600'], 'stopped' => ['Arrêté (partiel)', 'text-orange-600'], 'failed' => ['Échec', 'text-red-600'], 'completed' => ['Terminé', 'text-green-600']]; $enCours = false; $sections = [ 'sharepoint' => ['scan' => $spScan, 'enCours' => $spEnCours, 'folders' => $spFolders, 'arbreScan' => $spArbreScan, 'name' => 'SharePoint SRVPG', 'empty' => 'Aucune donnée dans la table des ACL.', 'totaux' => $spTotaux], 'partage' => ['scan' => $partageScan, 'enCours' => $partageEnCours, 'folders' => $partageFolders, 'arbreScan' => $partageArbreScan, 'name' => 'Serveur de fichiers', 'empty' => 'Aucune donnée dans la table des ACL.', 'totaux' => $partageTotaux], ]; if (!empty($type)) { $sections = array_filter($sections, fn($key) => $key === $type, ARRAY_FILTER_USE_KEY); } @endphp @foreach($sections as $type => $section) @php $s = $section['scan']; $ec = $section['enCours']; $folders = $section['folders']; $arbreScan = $section['arbreScan']; $running = $ec && in_array($ec->statut, ['pending', 'running']); $frozen = $ec && $ec->statut === 'running' && $ec->updated_at->diffInMinutes(now()) > 3; $stuck = $ec && $ec->statut === 'pending' && $ec->updated_at->diffInSeconds(now()) > 30; if ($running) $enCours = true; $totaux = $section['totaux']; @endphp

{{ $section['name'] }}

@if($running) {{ $statutLabels[$ec->statut][0] }} @if(!$frozen){{ $totaux['dossiers'] }} dossiers — {{ $totaux['fichiers'] }} fichiers@endif @if($ec->declenche_par) par {{ $ec->declenche_par }} @endif @elseif($s) {{ $statutLabels[$s->statut][0] }} {{ $totaux['dossiers'] }} dossiers — {{ $totaux['fichiers'] }} fichiers @if($s->scanne_le) {{ $s->scanne_le->format('d/m/Y H:i') }} @endif @else Contenu de la table ACL {{ $totaux['dossiers'] }} dossiers — {{ $totaux['fichiers'] }} fichiers @endif
@if($running) Actualiser
@csrf
@endif @if($s && $s->total_entrees_acl > 0 && $s->statut !== 'pending' && $s->statut !== 'running') Historique @endif
@if($running && !$frozen)

Scan en cours — les nouvelles données remplaceront l'ancien scan à la fin. @if($s && $s->id !== $ec->id) Résultats précédents conservés jusqu'à la fin du scan. @endif

@endif @if($frozen)
⏳ Scan gelé — plus d'activité depuis {{ $ec->updated_at->diffForHumans() }}.
@endif @if($stuck)
⚠ Scan bloqué — le processus n'a pas démarré.
@endif @if($s && $s->statut === 'failed' && $s->erreurs)
Erreur : {{ is_array($s->erreurs) ? implode('; ', $s->erreurs) : $s->erreurs }}
@endif @php $filtreSection = $filtreActif && $filtreActif['type'] === $type ? $filtreActif : null; @endphp
Filtrer :
@php $afficherArbre = $folders['total'] > 0; @endphp @if($afficherArbre)

Cliquez sur un dossier pour explorer ses permissions.

Chargement…

@elseif($running)
En attente des résultats…
@elseif($s)

Aucun dossier scanné.

@else

{{ $section['empty'] }}

@endif
@endforeach @if(!empty($sections) && collect($sections)->contains(fn($sec) => $sec['enCours'] && in_array($sec['enCours']->statut, ['pending','running'])) && request()->has('autorefresh')) @endif @endsection