77 lines
3.8 KiB
PHP
77 lines
3.8 KiB
PHP
@extends('layouts.app')
|
|
@section('title', 'Agents — Signatures')
|
|
@section('content')
|
|
@php
|
|
$initials = fn (?string $name) => mb_strtoupper(collect(preg_split('/[\s\-]+/u', trim((string) $name)))->filter()->take(2)->map(fn ($w) => mb_substr($w, 0, 1))->join(''));
|
|
@endphp
|
|
<header class="page-head">
|
|
<div>
|
|
<h1>Agents</h1>
|
|
<p class="lead">Qui reçoit quoi : le template appliqué à chaque agent selon ses groupes. Ouvrez un agent pour voir sa signature.</p>
|
|
</div>
|
|
</header>
|
|
|
|
<form method="get" class="row" style="margin-bottom:16px">
|
|
<div class="search">
|
|
<x-icon name="search" :size="16" />
|
|
<input type="search" name="q" value="{{ $q }}" placeholder="Nom, adresse ou service" aria-label="Rechercher un agent">
|
|
</div>
|
|
<button class="btn secondary" type="submit">Rechercher</button>
|
|
<span class="muted">{{ $agents->total() }} agent{{ $agents->total() > 1 ? 's' : '' }}</span>
|
|
</form>
|
|
|
|
<div class="card card--flush">
|
|
<div class="table-wrap">
|
|
<table class="list">
|
|
<thead><tr><th>Agent</th><th>Service</th><th>Groupes signature_*</th><th>Template appliqué</th></tr></thead>
|
|
<tbody>
|
|
@forelse ($agents as $a)
|
|
<tr>
|
|
<td>
|
|
<div class="person">
|
|
<span class="avatar" aria-hidden="true">{{ $initials($a->display_name) }}</span>
|
|
<div>
|
|
<a class="cell-title" href="{{ route('admin.agents.show', $a) }}">{{ $a->display_name }}</a>
|
|
<div class="muted">{{ $a->mail }}</div>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td>{{ $a->department }}</td>
|
|
<td class="muted">{{ $a->groups->pluck('display_name')->join(', ') ?: '—' }}</td>
|
|
<td>
|
|
@if ($resolved[$a->id] ?? null)
|
|
{{ $resolved[$a->id] }}
|
|
@else
|
|
<span class="badge warn">aucun</span>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="4">
|
|
<div class="empty">
|
|
<x-icon name="search" :size="32" />
|
|
<p><strong>Aucun agent trouvé</strong>{{ $q !== '' ? 'Essayez un autre nom, une adresse ou un service.' : 'Lancez une synchronisation de l\'annuaire depuis le tableau de bord.' }}</p>
|
|
</div>
|
|
</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@if ($agents->hasPages())
|
|
<nav class="card-foot pager" aria-label="Pagination">
|
|
@if ($agents->onFirstPage())
|
|
<span class="btn secondary small" aria-disabled="true"><x-icon name="chevron-left" :size="15" />Précédent</span>
|
|
@else
|
|
<a class="btn secondary small" href="{{ $agents->previousPageUrl() }}" rel="prev"><x-icon name="chevron-left" :size="15" />Précédent</a>
|
|
@endif
|
|
<span class="muted">Page {{ $agents->currentPage() }} sur {{ $agents->lastPage() }}</span>
|
|
@if ($agents->hasMorePages())
|
|
<a class="btn secondary small" href="{{ $agents->nextPageUrl() }}" rel="next">Suivant<x-icon name="chevron-right" :size="15" /></a>
|
|
@else
|
|
<span class="btn secondary small" aria-disabled="true">Suivant<x-icon name="chevron-right" :size="15" /></span>
|
|
@endif
|
|
</nav>
|
|
@endif
|
|
</div>
|
|
@endsection
|