Refonte design V1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
@extends('layouts.app')
|
||||
@section('title', ($template->exists ? $template->name : 'Nouveau template').' — Signatures CABM')
|
||||
@section('title', ($template->exists ? $template->name : 'Nouveau template').' — Signatures')
|
||||
@section('content')
|
||||
@php
|
||||
$isAdmin = auth()->user()->hasRole('admin');
|
||||
@@ -15,28 +15,33 @@
|
||||
];
|
||||
@endphp
|
||||
|
||||
<div class="row" style="margin-bottom:16px">
|
||||
<a href="{{ route('admin.templates.index') }}">← Templates</a>
|
||||
<h1 style="margin:0 0 0 12px">{{ $template->exists ? $template->name : 'Nouveau template' }}</h1>
|
||||
@if ($template->is_default) <span class="badge">par défaut</span> @endif
|
||||
@if ($template->exists)
|
||||
@if (! $template->published_version)
|
||||
<span class="badge warn">jamais publié</span>
|
||||
@elseif ($dirty)
|
||||
<span class="badge warn">brouillon modifié depuis v{{ $template->published_version }}</span>
|
||||
@else
|
||||
<span class="badge ok">publié · v{{ $template->published_version }}</span>
|
||||
@endif
|
||||
@endif
|
||||
<span class="spacer"></span>
|
||||
<header class="page-head">
|
||||
<div>
|
||||
<a class="back" href="{{ route('admin.templates.index') }}"><x-icon name="chevron-left" :size="16" />Templates</a>
|
||||
<div class="page-title">
|
||||
<h1>{{ $template->exists ? $template->name : 'Nouveau template' }}</h1>
|
||||
@if ($template->is_default) <span class="badge plain">par défaut</span> @endif
|
||||
@if ($template->exists)
|
||||
@if (! $template->published_version)
|
||||
<span class="badge warn">jamais publié</span>
|
||||
@elseif ($dirty)
|
||||
<span class="badge warn">brouillon modifié depuis v{{ $template->published_version }}</span>
|
||||
@else
|
||||
<span class="badge ok">publié, v{{ $template->published_version }}</span>
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@if ($template->exists && $isAdmin)
|
||||
<form class="inline" method="post" action="{{ route('admin.templates.publish', $template) }}"
|
||||
onsubmit="return confirm('Publier le brouillon enregistré ? Il sera servi immédiatement aux agents concernés.')">
|
||||
@csrf
|
||||
<button class="btn" type="submit" @disabled(! $dirty && $template->published_version)>Publier</button>
|
||||
</form>
|
||||
<div class="page-actions">
|
||||
<form class="inline" method="post" action="{{ route('admin.templates.publish', $template) }}"
|
||||
data-confirm="Publier le brouillon enregistré ? Il sera servi immédiatement aux agents concernés." data-confirm-label="Publier">
|
||||
@csrf
|
||||
<button class="btn" type="submit" @disabled(! $dirty && $template->published_version)><x-icon name="send" />Publier</button>
|
||||
</form>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<form method="post" id="template-form"
|
||||
action="{{ $template->exists ? route('admin.templates.update', $template) : route('admin.templates.store') }}">
|
||||
@@ -57,16 +62,16 @@
|
||||
<label for="draft_html_short">Signature courte (réponses et transferts)</label>
|
||||
<textarea class="code" id="draft_html_short" name="draft_html_short" data-variant="short" spellcheck="false" style="min-height:120px">{{ old('draft_html_short', $template->draft_html_short) }}</textarea>
|
||||
|
||||
<div class="row" style="margin-top:12px">
|
||||
<button class="btn" type="submit">Enregistrer le brouillon</button>
|
||||
<span class="muted">L'enregistrement ne change rien pour les agents tant que le template n'est pas publié.</span>
|
||||
<div class="row" style="margin-top:14px">
|
||||
<button class="btn" type="submit"><x-icon name="save" />Enregistrer le brouillon</button>
|
||||
<span class="muted">Rien ne change pour les agents tant que le template n'est pas publié.</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="card">
|
||||
<div class="row">
|
||||
<h2 style="margin:0">Aperçu</h2>
|
||||
<div class="card-head">
|
||||
<h2>Aperçu</h2>
|
||||
<span class="spacer"></span>
|
||||
<select id="preview-variant" aria-label="Variante affichée" style="width:auto">
|
||||
<option value="full">Complète</option>
|
||||
@@ -95,7 +100,7 @@
|
||||
<button type="button" data-insert="{{ $snippets['site_url'] }}" title="URL publique (images)">site_url</button>
|
||||
<button type="button" data-insert="{{ $snippets['if'] }}" title="Ligne conditionnelle">#if …</button>
|
||||
</div>
|
||||
<p class="muted">Images : déposez-les dans <code>public/img</code> et référencez
|
||||
<p class="muted">Images : envoyez-les depuis l'écran <a href="{{ route('admin.images.index') }}">Images</a> et référencez
|
||||
<code>{{ $snippets['img'] }}</code>. Pas de script ni de formulaire : ils sont retirés à l'enregistrement.</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -103,21 +108,22 @@
|
||||
</form>
|
||||
|
||||
@if ($template->exists)
|
||||
<div class="card">
|
||||
<h2>Historique des publications</h2>
|
||||
<div class="card card--flush">
|
||||
<div class="card-head"><h2>Historique des publications</h2></div>
|
||||
<div class="table-wrap">
|
||||
<table class="list">
|
||||
<thead><tr><th>Version</th><th>Publiée le</th><th>Par</th><th></th></tr></thead>
|
||||
<tbody>
|
||||
@forelse ($versions as $v)
|
||||
<tr>
|
||||
<td>v{{ $v->version }} @if ($v->version === $template->published_version) <span class="badge ok">en ligne</span> @endif</td>
|
||||
<td>{{ $v->created_at->timezone('Europe/Paris')->format('d/m/Y H:i') }}</td>
|
||||
<td class="num">v{{ $v->version }} @if ($v->version === $template->published_version) <span class="badge ok">en ligne</span> @endif</td>
|
||||
<td class="nowrap">{{ $v->created_at->timezone('Europe/Paris')->format('d/m/Y H:i') }}</td>
|
||||
<td>{{ $v->publisher?->name ?? '—' }}</td>
|
||||
<td style="text-align:right">
|
||||
<td class="cell-actions">
|
||||
<form class="inline" method="post" action="{{ route('admin.templates.restore', [$template, $v]) }}"
|
||||
onsubmit="return confirm('Remplacer le brouillon actuel par la version {{ $v->version }} ?')">
|
||||
data-confirm="Remplacer le brouillon actuel par la version {{ $v->version }} ?" data-confirm-label="Recharger">
|
||||
@csrf
|
||||
<button class="btn secondary small" type="submit">Recharger dans le brouillon</button>
|
||||
<button class="btn secondary small" type="submit"><x-icon name="rotate-ccw" :size="15" />Recharger dans le brouillon</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -126,6 +132,7 @@
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if ($isAdmin)
|
||||
@@ -133,13 +140,13 @@
|
||||
@unless ($template->is_default)
|
||||
<form class="inline" method="post" action="{{ route('admin.templates.default', $template) }}">
|
||||
@csrf
|
||||
<button class="btn secondary" type="submit" @disabled(! $template->html_full)>Définir comme template par défaut</button>
|
||||
<button class="btn secondary" type="submit" @disabled(! $template->html_full)><x-icon name="star" />Définir comme template par défaut</button>
|
||||
</form>
|
||||
<span class="spacer"></span>
|
||||
<form class="inline" method="post" action="{{ route('admin.templates.destroy', $template) }}"
|
||||
onsubmit="return confirm('Supprimer ce template et ses affectations ?')">
|
||||
data-confirm="Supprimer ce template et ses affectations ?" data-confirm-label="Supprimer" data-confirm-danger>
|
||||
@csrf @method('DELETE')
|
||||
<button class="btn danger" type="submit">Supprimer</button>
|
||||
<button class="btn danger" type="submit"><x-icon name="trash-2" />Supprimer</button>
|
||||
</form>
|
||||
@else
|
||||
<span class="muted">Le template par défaut s'applique aux agents qui ne sont dans aucun groupe affecté. Il ne peut pas être supprimé.</span>
|
||||
|
||||
@@ -1,39 +1,52 @@
|
||||
@extends('layouts.app')
|
||||
@section('title', 'Templates — Signatures CABM')
|
||||
@section('title', 'Templates — Signatures')
|
||||
@section('content')
|
||||
<div class="row" style="margin-bottom:16px">
|
||||
<h1 style="margin:0">Templates</h1>
|
||||
<span class="spacer"></span>
|
||||
<a class="btn" href="{{ route('admin.templates.create') }}">Nouveau template</a>
|
||||
</div>
|
||||
<div class="card">
|
||||
<table class="list">
|
||||
<thead><tr><th>Nom</th><th>État</th><th>Version publiée</th><th>Groupes affectés</th><th>Mis à jour</th></tr></thead>
|
||||
<tbody>
|
||||
@forelse ($templates as $t)
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ route('admin.templates.edit', $t) }}">{{ $t->name }}</a>
|
||||
@if ($t->is_default) <span class="badge">par défaut</span> @endif
|
||||
@if ($t->description)<div class="muted">{{ $t->description }}</div>@endif
|
||||
</td>
|
||||
<td>
|
||||
@if (! $t->published_version)
|
||||
<span class="badge warn">jamais publié</span>
|
||||
@elseif ($t->draft_html_full !== $t->html_full || $t->draft_html_short !== $t->html_short)
|
||||
<span class="badge warn">brouillon modifié</span>
|
||||
@else
|
||||
<span class="badge ok">publié</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $t->published_version ? 'v'.$t->published_version : '—' }}</td>
|
||||
<td>{{ $t->assignments_count }}</td>
|
||||
<td class="muted">{{ $t->updated_at?->timezone('Europe/Paris')->format('d/m/Y H:i') }}</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr><td colspan="5" class="muted">Aucun template.</td></tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
<header class="page-head">
|
||||
<div>
|
||||
<h1>Templates</h1>
|
||||
<p class="lead">Un template est le modèle HTML d'une signature. Il est servi aux agents une fois publié, selon les affectations par groupe AD.</p>
|
||||
</div>
|
||||
<div class="page-actions">
|
||||
<a class="btn" href="{{ route('admin.templates.create') }}"><x-icon name="plus" />Nouveau template</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="card card--flush">
|
||||
<div class="table-wrap">
|
||||
<table class="list">
|
||||
<thead><tr><th>Nom</th><th>État</th><th>Version publiée</th><th>Groupes affectés</th><th>Mis à jour</th></tr></thead>
|
||||
<tbody>
|
||||
@forelse ($templates as $t)
|
||||
<tr>
|
||||
<td>
|
||||
<a class="cell-title" href="{{ route('admin.templates.edit', $t) }}">{{ $t->name }}</a>
|
||||
@if ($t->is_default) <span class="badge plain">par défaut</span> @endif
|
||||
@if ($t->description)<div class="muted">{{ $t->description }}</div>@endif
|
||||
</td>
|
||||
<td>
|
||||
@if (! $t->published_version)
|
||||
<span class="badge warn">jamais publié</span>
|
||||
@elseif ($t->draft_html_full !== $t->html_full || $t->draft_html_short !== $t->html_short)
|
||||
<span class="badge warn">brouillon modifié</span>
|
||||
@else
|
||||
<span class="badge ok">publié</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="num">{{ $t->published_version ? 'v'.$t->published_version : '—' }}</td>
|
||||
<td class="num">{{ $t->assignments_count }}</td>
|
||||
<td class="muted nowrap">{{ $t->updated_at?->timezone('Europe/Paris')->format('d/m/Y H:i') }}</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr><td colspan="5">
|
||||
<div class="empty">
|
||||
<x-icon name="file-code" :size="32" />
|
||||
<p><strong>Aucun template</strong>Créez le premier modèle de signature, puis publiez-le pour qu'il soit servi aux agents.</p>
|
||||
<p><a class="btn" href="{{ route('admin.templates.create') }}"><x-icon name="plus" />Nouveau template</a></p>
|
||||
</div>
|
||||
</td></tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user