gestion addin

This commit is contained in:
mrKamoo
2026-10-01 13:38:01 +02:00
parent 28eba5e1e4
commit 1b91590cca
13 changed files with 769 additions and 48 deletions
@@ -0,0 +1,40 @@
@extends('layouts.app')
@section('title', 'Champs agents — Signatures CABM')
@section('content')
<h1>Champs modifiables par les agents</h1>
<p class="muted" style="margin-top:-8px">
Les agents modifient ces champs dans l'add-in (bouton « Ma signature ») ou sur le portail.
La valeur saisie remplace celle de l'annuaire <strong>dans la signature uniquement</strong> : l'AD reste la référence.
Publication immédiate, chaque modification est tracée. Fermer un champ fait revenir les signatures concernées à la valeur de l'annuaire.
</p>
<form method="post" action="{{ route('admin.fields.update') }}" class="card">
@csrf @method('PUT')
<table class="list">
<thead><tr><th>Ouvert</th><th>Variable</th><th>Libellé affiché à l'agent</th><th>Contrôle</th><th>Agents ayant une valeur perso</th></tr></thead>
<tbody>
@foreach ($fields as $f)
<tr>
<td>
<input type="hidden" name="fields[{{ $f->field }}][enabled]" value="0">
<input type="checkbox" name="fields[{{ $f->field }}][enabled]" value="1" @checked($f->enabled) aria-label="Ouvrir {{ $f->label }}">
</td>
<td><code>{{ $f->field }}</code></td>
<td><input type="text" name="fields[{{ $f->field }}][label]" value="{{ $f->label }}" maxlength="60" required></td>
<td>
<select name="fields[{{ $f->field }}][type]">
@foreach ($types as $key => $type)
<option value="{{ $key }}" @selected(($f->validation_rule ?: 'text') === $key)>{{ $type['label'] }}</option>
@endforeach
</select>
</td>
<td class="muted">{{ $usage[$f->field] ?? 0 }}</td>
</tr>
@endforeach
</tbody>
</table>
<div class="row" style="margin-top:12px">
<button class="btn" type="submit">Enregistrer</button>
<span class="muted">L'adresse e-mail n'est jamais modifiable.</span>
</div>
</form>
@endsection
@@ -58,6 +58,7 @@
<a href="{{ route('admin.images.index') }}" @class(['active' => request()->routeIs('admin.images.*')])>Images</a>
@if (auth()->user()->hasRole('admin'))
<a href="{{ route('admin.assignments.index') }}" @class(['active' => request()->routeIs('admin.assignments.*')])>Affectations</a>
<a href="{{ route('admin.fields.index') }}" @class(['active' => request()->routeIs('admin.fields.*')])>Champs agents</a>
@endif
<a href="{{ route('admin.agents.index') }}" @class(['active' => request()->routeIs('admin.agents.*')])>Agents</a>
<a href="{{ route('portal.home') }}" @class(['active' => request()->routeIs('portal.*')])>Ma signature</a>
+59 -8
View File
@@ -1,13 +1,64 @@
@extends('layouts.app')
@section('title', 'Ma signature — CABM')
@section('content')
<div class="card">
<h1>Ma signature</h1>
<p class="muted">Modèle : {{ $full['template'] ?? 'aucun' }}. Vos informations proviennent de l'annuaire de la collectivité ;
la modification de certains champs arrivera prochainement.</p>
<h2>Nouveau message</h2>
@include('partials.signature-frame', ['html' => $full['html'] ?? '<em>Aucune signature</em>'])
<h2 style="margin-top:16px">Réponse / transfert</h2>
@include('partials.signature-frame', ['html' => ($reply['html'] ?? '') !== '' ? $reply['html'] : '<em>Aucune signature</em>'])
<h1>Ma signature</h1>
<div class="split">
<div>
<div class="card">
<h2>Nouveau message</h2>
<p class="muted">Modèle : {{ $full['template'] ?? 'aucun' }}</p>
@include('partials.signature-frame', ['html' => $full['html'] ?? '<em>Aucune signature</em>'])
<h2 style="margin-top:16px">Réponse / transfert</h2>
@include('partials.signature-frame', ['html' => ($reply['html'] ?? '') !== '' ? $reply['html'] : '<em>Aucune signature</em>'])
</div>
</div>
<form method="post" action="{{ route('portal.update') }}" class="card">
@csrf @method('PUT')
<h2>Mes informations</h2>
@if (! $profile['fields'])
<p class="muted">Aucun champ n'est modifiable pour le moment. Vos informations viennent de l'annuaire de la collectivité :
pour les corriger, contactez le service des ressources humaines ou le support informatique.</p>
@else
<p class="muted">Ces valeurs ne modifient que votre signature, pas l'annuaire.</p>
@foreach ($profile['fields'] as $f)
@php
$mode = ! $f['overridden'] ? 'directory' : ($f['override'] === '' ? 'hidden' : 'custom');
$id = 'f-'.$f['key'];
@endphp
<fieldset style="border:1px solid var(--line);border-radius:6px;padding:10px 12px;margin:12px 0" data-field>
<legend style="font-weight:600;font-size:13px;padding:0 4px">{{ $f['label'] }}</legend>
<label style="font-weight:400;margin:4px 0"><input type="radio" name="fields[{{ $f['key'] }}][mode]" value="directory" @checked($mode === 'directory')>
Annuaire : <strong>{{ $f['directory_value'] ?: '(vide)' }}</strong></label>
<label style="font-weight:400;margin:4px 0"><input type="radio" name="fields[{{ $f['key'] }}][mode]" value="custom" @checked($mode === 'custom')>
Valeur personnalisée</label>
<input type="text" id="{{ $id }}" name="fields[{{ $f['key'] }}][value]" value="{{ $mode === 'custom' ? $f['override'] : '' }}"
maxlength="120" @if ($f['type'] === 'phone') inputmode="tel" placeholder="ex. 06 12 34 56 78" @endif aria-label="{{ $f['label'] }} personnalisé">
<label style="font-weight:400;margin:4px 0"><input type="radio" name="fields[{{ $f['key'] }}][mode]" value="hidden" @checked($mode === 'hidden')>
Ne pas afficher</label>
</fieldset>
@endforeach
@endif
<h2 style="margin-top:16px">En réponse et transfert</h2>
@php $rv = $profile['reply_variant'] ?? 'default'; $labels = ['short' => 'signature courte', 'full' => 'signature complète', 'none' => 'aucune signature']; @endphp
@foreach (['default' => 'Réglage par défaut ('.$labels[$profile['reply_variant_default']].')', 'short' => 'Signature courte', 'full' => 'Signature complète', 'none' => 'Aucune signature'] as $value => $label)
<label style="font-weight:400;margin:4px 0"><input type="radio" name="reply_variant" value="{{ $value }}" @checked($rv === $value)> {{ $label }}</label>
@endforeach
<div class="row" style="margin-top:16px"><button class="btn" type="submit">Enregistrer</button></div>
</form>
</div>
@endsection
@push('scripts')
<script>
// Saisir une valeur sélectionne automatiquement « Valeur personnalisée »
document.querySelectorAll('[data-field] input[type=text]').forEach((input) => {
input.addEventListener('input', () => {
const custom = input.closest('[data-field]').querySelector('input[value=custom]');
if (custom) custom.checked = true;
});
});
</script>
@endpush