@extends('layouts.atelier')
@section('title', 'Infos ESL ' . $eslId)
@section('page-title', 'Infos ESL ' . $eslId)
@section('topbar-actions')
← Inventaire
Réinitialiser
@endsection
@section('content')
@php
$brand = $brand ?? 'hanshow';
$raw = $liveInfo?->raw ?? [];
$lastHbMs = isset($raw['last_hb_time']) ? (int) $raw['last_hb_time'] : null;
$lastHbIso = $lastHbMs ? \Carbon\Carbon::createFromTimestampMs($lastHbMs)->toIso8601String() : null;
$resX = $raw['resolution_x'] ?? null;
$resY = $raw['resolution_y'] ?? null;
$desc = $raw['description'] ?? null;
$apMac = $raw['ap_mac'] ?? null;
$template = $raw['template'] ?? null;
$isReset = str_starts_with($template ?? '', 'RESET_');
$batPct = $liveInfo?->batteryPercent;
$feedUrl = route('inventaire.esl-info.feed', ['eslId' => $eslId, 'brand' => $brand, 'connector_id' => $connector?->id]);
@endphp
{{-- ══ 1. FICHE LIVE AP ══════════════════════════════════════════════════════ --}}
{{-- En-tête : statut + batterie + bouton Localiser --}}
{{-- Badge statut --}}
@if($liveInfo && $liveInfo->online)
online
@elseif($liveInfo)
offline
@else
AP non dispo
@endif
{{-- Taille écran --}}
@if(!empty($raw['screen_size']))
{{ $raw['screen_size'] }} mm
@endif
{{-- Firmware --}}
@if($liveInfo && !empty($liveInfo->firmware))
FW {{ $liveInfo->firmware }}
@endif
{{-- Batterie --}}
@if($batPct !== null)
@include('partials.battery-icon', ['pct' => $batPct])
@endif
{{-- Bouton Localiser --}}
@if($connector)
@endif
@if($liveInfo && !empty($raw))
{{-- Chips d'informations techniques --}}
@if($resX && $resY)
{{ $resX }}×{{ $resY }} px
@endif
@if($desc)
{{ $desc }}
@endif
@if(isset($raw['temperature']) && $raw['temperature'] > 0)
{{ $raw['temperature'] }}°C
@endif
@if($apMac)
AP {{ $apMac }}
@endif
{{-- Template actuel --}}
@if($template)
Template actuel sur l'AP
{{ $template }}
@if($isReset)
RESET
@else
Autre
@endif
@endif
{{-- Statistiques AP + Dernier contact --}}
@if(!empty($raw['success_rate']))
Succès AP
{{ $raw['success_rate'] }}
@endif
@if(isset($raw['failed_times']))
Échecs AP
{{ $raw['failed_times'] ?? 0 }}
@endif
@if($lastHbIso)
Dernier contact
{{ \Carbon\Carbon::createFromTimestampMs($lastHbMs)->diffForHumans() }}
@endif
@endif
{{-- Avertissement si AP indisponible --}}
@if($liveError)
⚠ {{ $liveError }}
@endif
{{-- ══ 2. STATS NOTRE BASE ════════════════════════════════════════════════════ --}}
Historique dans notre base
{{ $stats['total'] }}
Opérations
{{ $stats['succes'] }}
Succès
{{ $stats['erreurs'] }}
Erreurs
@if($stats['last_at'])
Dernier reset : {{ $stats['last_at']->diffForHumans() }}
@else
Aucun reset effectué via cette application.
@endif
{{-- ══ 3. DERNIER TEMPLATE ENVOYÉ ════════════════════════════════════════════ --}}
@if($lastReset)
Dernier template envoyé
@if($lastReset->confirmed_at && $lastReset->ack_status === 'success')
✓ Confirmé par l'ESL
@elseif($lastReset->confirmed_at)
✗ ACK échoué
@else
Pas d'ACK
@endif
@if($lastReset->mock)
Démo
@endif
{{-- Métadonnées --}}
{{-- Réponse API (response_data) --}}
@if($lastReset->response_data)
Réponse {{ ucfirst($brand) }} — données agent
{{ json_encode($lastReset->response_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) }}
@endif
{{-- ACK callback ESL (ack_raw) --}}
@if($lastReset->ack_raw)
Confirmation ESL — ACK callback
@if($lastReset->confirmed_at)
· {{ $lastReset->confirmed_at->format('H:i:s') }}
@endif
{{ json_encode($lastReset->ack_raw, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) }}
@else
Aucun ACK reçu pour ce reset (timeout ou mock).
@endif
@elseif($stats['total'] > 0)
Dernier template envoyé
Aucun reset réussi enregistré pour cette ESL.
@endif
{{-- /max-width:900px --}}
{{-- ══ 4. HISTORIQUE DES OPÉRATIONS (pleine largeur) ═══════════════════════ --}}
Historique des opérations
@if($stats['total'] > 0)
({{ $stats['total'] }})
@endif
@if($operations->isEmpty())
Aucune opération dans la base pour cette étiquette.
@else
@php
$statutMap = [
'pending' => ['badge-muted', '—'],
'checking' => ['badge-info', '⏳'],
'ping_ok' => ['badge-info', 'Ping OK'],
'ping_fail' => ['badge-danger', '✗ Ping'],
'reset_ok' => ['badge-success', '✓ Reset'],
'erreur' => ['badge-danger', '✗ Erreur'],
];
@endphp
| Date |
Session |
Statut |
Ping |
Reset |
Batterie |
FW |
Durée |
ACK |
Mode |
@foreach($operations as $op)
@php
[$badgeCls, $badgeLbl] = $statutMap[$op->statut] ?? ['badge-muted', $op->statut];
$opHbIso = $op->created_at?->toIso8601String();
@endphp
|
{{ $op->created_at?->format('d/m/Y H:i') }}
|
{{ $op->session?->nom ?? ('Session #' . $op->session_id) }}
@if($op->session?->type === 'batch')
lot
@endif
|
{{ $badgeLbl }}
@if(in_array($op->statut, ['ping_fail','erreur']))
@endif
|
@if($op->ping_ok === true) OK
@elseif($op->ping_ok === false) KO
@else —
@endif
|
@if($op->reset_ok === true) OK
@elseif($op->reset_ok === false) KO
@else —
@endif
|
@include('partials.battery-icon', ['pct' => $op->battery_pct])
|
{{ $op->firmware ?? '—' }} |
{{ $op->duration_ms ? $op->duration_ms . ' ms' : '—' }} |
@if($op->confirmed_at)
@if($op->ack_status === 'success')
✓ {{ $op->confirmed_at->format('H:i:s') }}
@else
✗ Échec
@endif
@elseif($op->reset_ok)
En attente…
@else
—
@endif
|
@if($op->mock)
Démo
@endif
|
@endforeach
@endif
@endsection