80 lines
4.3 KiB
PHP
80 lines
4.3 KiB
PHP
@extends('layouts.app')
|
|
@section('title', 'Affectations — Signatures CABM')
|
|
@section('content')
|
|
<h1>Affectations</h1>
|
|
<p class="muted" style="margin-top:-8px">
|
|
Un agent membre de plusieurs groupes reçoit le template de l'affectation dont la <strong>priorité est la plus haute</strong>
|
|
(à égalité : la plus ancienne). Sans groupe affecté, il reçoit le template par défaut.
|
|
Tous les groupes AD synchronisés sont proposés, sauf les groupes de rôles du back-office.
|
|
</p>
|
|
|
|
<div class="card">
|
|
<h2>Ajouter une affectation</h2>
|
|
<form method="post" action="{{ route('admin.assignments.store') }}" class="row" style="align-items:flex-end">
|
|
@csrf
|
|
<div style="flex:2;min-width:220px">
|
|
<label for="directory_group_id">Groupe AD</label>
|
|
<select id="directory_group_id" name="directory_group_id" required>
|
|
<option value="">— choisir —</option>
|
|
@if ($groups->isEmpty())
|
|
<option value="" disabled>Aucun groupe synchronisé : lancez php artisan signature:sync --full</option>
|
|
@endif
|
|
@foreach ($groups as $g)
|
|
<option value="{{ $g->id }}" @selected(old('directory_group_id') == $g->id)>{{ $g->display_name }} ({{ $g->members_count }})</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div style="flex:2;min-width:220px">
|
|
<label for="template_id">Template</label>
|
|
<select id="template_id" name="template_id" required>
|
|
<option value="">— choisir —</option>
|
|
@foreach ($templates as $t)
|
|
<option value="{{ $t->id }}" @selected(old('template_id') == $t->id)>{{ $t->name }}{{ $t->html_full ? '' : ' (non publié)' }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="priority">Priorité</label>
|
|
<input class="small" type="number" id="priority" name="priority" min="0" max="1000" value="{{ old('priority', 10) }}" required>
|
|
</div>
|
|
<button class="btn" type="submit">Ajouter</button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<h2>Affectations actives, par ordre de priorité</h2>
|
|
<table class="list">
|
|
<thead><tr><th>Priorité</th><th>Groupe AD</th><th>Membres</th><th>Template</th><th></th></tr></thead>
|
|
<tbody>
|
|
@forelse ($assignments as $a)
|
|
<tr>
|
|
<td>
|
|
<form class="row" method="post" action="{{ route('admin.assignments.update', $a) }}">
|
|
@csrf @method('PUT')
|
|
<input class="small" type="number" name="priority" min="0" max="1000" value="{{ $a->priority }}" aria-label="Priorité">
|
|
<button class="btn secondary small" type="submit">OK</button>
|
|
</form>
|
|
</td>
|
|
<td>{{ $a->group?->display_name }}</td>
|
|
<td>{{ $a->group?->members_count }}</td>
|
|
<td>
|
|
<a href="{{ route('admin.templates.edit', $a->template_id) }}">{{ $a->template?->name }}</a>
|
|
@unless ($a->template?->html_full) <span class="badge warn">non publié : ignoré</span> @endunless
|
|
</td>
|
|
<td style="text-align:right">
|
|
<form class="inline" method="post" action="{{ route('admin.assignments.destroy', $a) }}"
|
|
onsubmit="return confirm('Supprimer cette affectation ?')">
|
|
@csrf @method('DELETE')
|
|
<button class="btn danger small" type="submit">Supprimer</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="5" class="muted">Aucune affectation : tous les agents reçoivent le template par défaut.</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
<p class="muted">Vérifiez le résultat agent par agent dans l'onglet <a href="{{ route('admin.agents.index') }}">Agents</a>.</p>
|
|
</div>
|
|
@endsection
|