@extends('layouts.app') @section('title', __('app.titles.dashboard')) @section('breadcrumbs') @include('components.breadcrumbs', ['items' => []]) @endsection @section('content')

{{ __('clients.title') }}

@if(!auth()->user()->isViewer())
{{ __('clients.limits.title') }}: {{ $currentClientCount }} / {{ $clientLimit }} {{ __('clients.limits.used') }}
@if(!$canAddNewClient)
{{ __('clients.limits.reached') }}! {{ __('clients.limits.cannot_add') }}
@endif
@endif
{{ __('clients.list_description') }} @if(!auth()->user()->isViewer()) @if($canAddNewClient) {{ __('clients.add_new') }} @else @endif @endif
{{ __('clients.found') }} {{ $clients->count() }} {{ __('clients.clients') }}
@if(!auth()->user()->isViewer()) @endif @foreach($clients as $client) @if(!auth()->user()->isViewer()) @endif @endforeach
ID @if($sortBy === 'id') @endif {{ __('clients.table.name') }} @if($sortBy === 'name') @endif {{ __('clients.table.last_scan') }} @if($sortBy === 'last_scan_date') @endif {{ __('clients.table.current_score') }} @if($sortBy === 'current_score') @endif {{ __('clients.table.total_errors') }} @if($sortBy === 'current_total_errors') @endif {{ __('clients.table.actions') }}
{{ $client['id'] }} {{ $client['name'] }} @if($client['last_scan_date'])
{{ $client['last_scan_date']->format('d/m/Y H:i') }}
@if($client['next_scan_date'])
Prossima: {{ $client['next_scan_date']->format('d/m/Y') }}
@endif @else
{{ __('clients.table.no_scan') }}
@if($client['next_scan_date'])
Prossima: {{ $client['next_scan_date']->format('d/m/Y') }}
@endif @endif
@if($client['current_score'] !== null) @php $scoreClass = 'text-success'; $scoreDescription = __('clients.score.excellent'); if($client['current_score'] < 50) { $scoreClass = 'text-danger'; $scoreDescription = __('clients.score.critical'); } elseif($client['current_score'] < 75) { $scoreClass = 'text-warning'; $scoreDescription = __('clients.score.needs_improvement'); } // Icona delta $deltaIcon = ''; $deltaClass = ''; $deltaTitle = ''; if($client['score_delta'] !== null) { if($client['score_delta'] == 0) { $deltaIcon = 'bi-dash-circle-fill'; $deltaClass = 'text-muted'; $deltaTitle = 'Score invariato'; } elseif($client['score_delta'] > 0) { $deltaIcon = 'bi-arrow-up-circle-fill'; $deltaClass = 'text-success'; $deltaTitle = 'Score migliorato (+' . $client['score_delta'] . ')'; } elseif($client['score_delta'] == -1) { $deltaIcon = 'bi-arrow-down-circle'; $deltaClass = 'text-warning'; $deltaTitle = 'Score diminuito (-1)'; } else { // < -1 $deltaIcon = 'bi-arrow-down-circle-fill'; $deltaClass = 'text-danger'; $deltaTitle = 'Score peggiorato (' . $client['score_delta'] . ')'; } } @endphp
{{ $client['current_score'] }}% @if($deltaIcon) @endif
@else N/A @endif
@if($client['current_total_errors'] !== null) @php $errorClass = 'text-success'; $errorDescription = __('clients.errors.few'); if($client['current_total_errors'] > 50) { $errorClass = 'text-danger'; $errorDescription = __('clients.errors.many_critical'); } elseif($client['current_total_errors'] > 20) { $errorClass = 'text-warning'; $errorDescription = __('clients.errors.to_fix'); } @endphp {{ $client['current_total_errors'] }} @else N/A @endif
@csrf @method('DELETE')
@if($clients->isEmpty())

{{ __('clients.no_clients') }}

@if($canAddNewClient) {{ __('clients.add_first') }} @endif
@endif @endsection