Files
bot_ticket_r6_elite/internal/panel/templates/convocations.html
T
2026-05-11 15:47:08 +02:00

199 lines
9.3 KiB
HTML

{{define "title"}}Convocations{{end}}
{{define "header"}}Convocations{{end}}
{{define "content"}}
<!-- Config form -->
<div class="bg-discord-card rounded-lg border border-discord-border p-5 mb-6">
<h3 class="font-semibold text-white mb-4">Configuration des convocations</h3>
<form method="POST" action="/convocations" class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
<div>
<label class="block text-xs text-gray-400 mb-1">ID de catégorie Discord (pour les salons)</label>
<input type="text" name="category_id" value="{{if .Config}}{{.Config.CategoryID}}{{end}}"
placeholder="ex: 123456789012345678"
class="w-full bg-discord-hover border border-discord-border rounded-lg px-3 py-2 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-discord-accent">
</div>
<div>
<label class="block text-xs text-gray-400 mb-1">ID du salon de logs</label>
<input type="text" name="log_channel_id" value="{{if .Config}}{{.Config.LogChannelID}}{{end}}"
placeholder="ex: 123456789012345678"
class="w-full bg-discord-hover border border-discord-border rounded-lg px-3 py-2 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-discord-accent">
</div>
<div class="sm:col-span-2 flex items-center gap-3">
<label class="flex items-center gap-2 cursor-pointer select-none">
<input type="hidden" name="modal_enabled" value="0">
<input type="checkbox" name="modal_enabled" value="1"
{{if and .Config .Config.ModalEnabled}}checked{{end}}
class="w-4 h-4 rounded accent-indigo-500">
<span class="text-sm text-gray-300">Activer le modal (titre + description)</span>
</label>
</div>
<div class="sm:col-span-2 flex justify-end">
<button type="submit"
class="px-4 py-2 bg-gray-700 hover:bg-gray-600 text-white text-sm font-medium rounded-lg transition-colors">
Sauvegarder
</button>
</div>
</form>
</div>
<!-- Convocation panels -->
<div class="bg-discord-card rounded-lg border border-discord-border p-5 mb-6">
<h3 class="font-semibold text-white mb-4">Panels de convocation</h3>
{{if .ConvocPanels}}
<div class="space-y-3 mb-5">
{{range .ConvocPanels}}
<div class="flex items-center gap-3 bg-discord-hover rounded-lg px-4 py-3 border border-discord-border">
<div class="w-3 h-3 rounded-full flex-shrink-0" style="background:{{.EmbedColor}}"></div>
<div class="flex-1 min-w-0">
<p class="text-sm text-white font-medium truncate">{{.EmbedTitle}}</p>
<p class="text-xs text-gray-400 truncate">Salon : {{if .ChannelID}}{{.ChannelID}}{{else}}<span class="text-red-400">Non configuré</span>{{end}}
{{if .MessageID}}<span class="ml-2 text-green-400">● Envoyé</span>{{end}}
</p>
</div>
<div class="flex items-center gap-2 flex-shrink-0">
{{if .ChannelID}}
<form method="POST" action="/convocations/panels/{{.ID}}/send">
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
<button type="submit"
class="px-3 py-1.5 bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-medium rounded-lg transition-colors">
Envoyer
</button>
</form>
{{end}}
<form method="POST" action="/convocations/panels/{{.ID}}/delete"
onsubmit="return confirm('Supprimer ce panel ?')">
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
<button type="submit"
class="px-3 py-1.5 bg-red-700 hover:bg-red-600 text-white text-xs font-medium rounded-lg transition-colors">
Supprimer
</button>
</form>
</div>
</div>
{{end}}
</div>
{{end}}
<!-- Create new panel -->
<details class="group">
<summary class="cursor-pointer text-sm text-indigo-400 hover:text-indigo-300 select-none list-none flex items-center gap-1">
<svg class="w-4 h-4 transition-transform group-open:rotate-90" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
</svg>
Ajouter un nouveau panel
</summary>
<form method="POST" action="/convocations/panels/new"
class="mt-4 grid grid-cols-1 sm:grid-cols-2 gap-4">
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
<div>
<label class="block text-xs text-gray-400 mb-1">Titre de l'embed</label>
<input type="text" name="embed_title" placeholder="Créer une convocation"
class="w-full bg-discord-bg border border-discord-border rounded-lg px-3 py-2 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-discord-accent">
</div>
<div>
<label class="block text-xs text-gray-400 mb-1">Couleur de l'embed</label>
<input type="color" name="embed_color" value="#5865f2"
class="h-10 w-full rounded cursor-pointer bg-discord-hover border border-discord-border">
</div>
<div class="sm:col-span-2">
<label class="block text-xs text-gray-400 mb-1">Description de l'embed</label>
<textarea name="embed_description" rows="2" placeholder="Cliquez sur le bouton pour ouvrir une convocation..."
class="w-full bg-discord-bg border border-discord-border rounded-lg px-3 py-2 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-discord-accent resize-none"></textarea>
</div>
<div class="sm:col-span-2">
<label class="block text-xs text-gray-400 mb-1">ID du salon d'envoi</label>
<input type="text" name="channel_id" placeholder="ex: 123456789012345678"
class="w-full bg-discord-bg border border-discord-border rounded-lg px-3 py-2 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-discord-accent">
</div>
<div class="sm:col-span-2 flex justify-end">
<button type="submit"
class="px-4 py-2 bg-indigo-600 hover:bg-indigo-500 text-white text-sm font-medium rounded-lg transition-colors">
Créer le panel
</button>
</div>
</form>
</details>
</div>
<!-- Convocation list -->
<div class="bg-discord-card rounded-lg border border-discord-border overflow-hidden">
<div class="px-5 py-4 border-b border-discord-border flex items-center justify-between">
<h3 class="font-semibold text-white">Convocations passées</h3>
<span class="text-xs text-gray-400">{{.Total}} au total</span>
</div>
{{if .Tickets}}
<div class="overflow-x-auto">
<table class="w-full text-sm">
<thead>
<tr class="text-xs text-gray-400 uppercase border-b border-discord-border">
<th class="px-4 py-2 text-left">#</th>
<th class="px-4 py-2 text-left">Utilisateur</th>
<th class="px-4 py-2 text-left">Titre</th>
<th class="px-4 py-2 text-left">Staff</th>
<th class="px-4 py-2 text-left">Statut</th>
<th class="px-4 py-2 text-left">Ouvert le</th>
<th class="px-4 py-2 text-left">Fermé le</th>
</tr>
</thead>
<tbody class="divide-y divide-discord-border">
{{range .Tickets}}
<tr class="hover:bg-white/5 transition-colors">
<td class="px-4 py-2 text-indigo-400 font-mono">{{.TicketNumber}}</td>
<td class="px-4 py-2 text-gray-300 font-mono text-xs">{{.UserID}}</td>
<td class="px-4 py-2 text-white">
{{if .TicketTitle.Valid}}{{.TicketTitle.String}}{{else}}<span class="text-gray-500"></span>{{end}}
</td>
<td class="px-4 py-2 text-gray-400 font-mono text-xs">
{{if .ClaimedBy.Valid}}{{.ClaimedBy.String}}{{else}}—{{end}}
</td>
<td class="px-4 py-2">
{{if eq .Status "open"}}
<span class="px-2 py-0.5 rounded text-xs bg-green-900/40 text-green-400 border border-green-800">Ouvert</span>
{{else if eq .Status "claimed"}}
<span class="px-2 py-0.5 rounded text-xs bg-yellow-900/40 text-yellow-400 border border-yellow-800">Claimé</span>
{{else}}
<span class="px-2 py-0.5 rounded text-xs bg-gray-700 text-gray-400">Fermé</span>
{{end}}
</td>
<td class="px-4 py-2 text-gray-400 text-xs">{{.OpenedAt.Format "02/01/2006 15:04"}}</td>
<td class="px-4 py-2 text-gray-400 text-xs">
{{if .ClosedAt.Valid}}{{.ClosedAt.Time.Format "02/01/2006 15:04"}}{{else}}—{{end}}
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{if gt .Pages 1}}
<div class="px-5 py-3 border-t border-discord-border flex items-center gap-2 text-sm">
{{if gt .Page 1}}
<a href="?page={{add .Page -1}}" class="px-3 py-1 rounded border border-discord-border text-gray-300 hover:text-white hover:border-gray-500 transition-colors">← Précédent</a>
{{end}}
<span class="text-gray-400">Page {{.Page}} / {{.Pages}}</span>
{{if lt .Page .Pages}}
<a href="?page={{add .Page 1}}" class="px-3 py-1 rounded border border-discord-border text-gray-300 hover:text-white hover:border-gray-500 transition-colors">Suivant →</a>
{{end}}
</div>
{{end}}
{{else}}
<div class="px-5 py-12 text-center text-gray-500 text-sm">
Aucune convocation enregistrée.
</div>
{{end}}
</div>
{{end}}