Admin licenses : bouton BÊTA visible directement, plus dans un menu replié

Avant : pour basculer l'accès BÊTA d'un client, il fallait deviner qu'il
fallait cliquer sur le code <channel> dans la cellule pour ouvrir un
<details> caché — pas de chevron, pas de label « modifier ». L'admin
trouvait pas l'option et pensait qu'elle n'existait pas.

Après : sur la page Licenses, chaque ligne affiche directement deux
boutons cliquables :
- « Activer BÊTA » / « ✓ BÊTA actif » (bouton secondary / warning selon
  l'état) — toggle en un clic sans menu
- « ✎ Channel » qui déplie le dropdown pour changer le channel

L'état actuel reste visible au-dessus (code du channel + badge β BÊTA
si actif). Beaucoup plus discoverable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-05 09:55:22 +02:00
parent d9c3f09e9a
commit aab2e41152

View File

@@ -293,38 +293,49 @@ Layout::header('Licenses', 'licenses');
<?php endif; ?> <?php endif; ?>
</td> </td>
<td> <td>
<!-- Affichage de l'état actuel : channel + badge BÊTA si actif -->
<div style="margin-bottom: 6px;">
<code style="background: rgba(0,0,0,0.3); padding: 2px 6px; border-radius: 4px; font-size: 11px;"
title="Channel actuellement attribué à cette license">
<?= htmlspecialchars($l['channel'] ?? 'default') ?>
</code>
<?php if ((int)($l['can_see_betas'] ?? 0) === 1): ?>
<span class="badge badge-warning" style="margin-left: 4px;" title="Voit les versions taggées beta">β BÊTA</span>
<?php endif; ?>
</div>
<!-- Toggle BÊTA en bouton DIRECTEMENT visible (pas dans un details).
L'admin n'a plus à deviner qu'il faut cliquer sur le code du channel
pour trouver l'option. -->
<form method="post" style="display: inline-block; margin-right: 4px;">
<?= Layout::csrfField() ?>
<input type="hidden" name="action" value="toggle_betas">
<input type="hidden" name="id" value="<?= $l['id'] ?>">
<button class="btn <?= (int)($l['can_see_betas'] ?? 0) === 1 ? 'btn-warning' : 'btn-secondary' ?>"
type="submit" style="font-size: 11px; padding: 4px 10px;"
title="Bascule l'accès aux versions taggées BÊTA pour cette license">
<?= (int)($l['can_see_betas'] ?? 0) === 1 ? '✓ BÊTA actif' : 'Activer BÊTA' ?>
</button>
</form>
<!-- Channel : modifier via un menu compact -->
<details style="display: inline-block;"> <details style="display: inline-block;">
<summary style="cursor: pointer; list-style: none;"> <summary class="btn btn-secondary" style="font-size: 11px; padding: 4px 10px; list-style: none;">
<code style="background: rgba(0,0,0,0.3); padding: 2px 6px; border-radius: 4px; font-size: 11px;"> ✎ Channel
<?= htmlspecialchars($l['channel'] ?? 'default') ?>
</code>
<?php if ((int)($l['can_see_betas'] ?? 0) === 1): ?>
<span class="badge badge-warning" style="margin-left: 4px;" title="Voit les versions taggées beta">β</span>
<?php endif; ?>
</summary> </summary>
<div style="margin-top: 8px; min-width: 220px;"> <form method="post" style="margin-top: 8px; display: flex; gap: 4px; align-items: center;">
<form method="post" style="display: flex; gap: 4px; align-items: center; margin-bottom: 6px;"> <?= Layout::csrfField() ?>
<?= Layout::csrfField() ?> <input type="hidden" name="action" value="set_channel">
<input type="hidden" name="action" value="set_channel"> <input type="hidden" name="id" value="<?= $l['id'] ?>">
<input type="hidden" name="id" value="<?= $l['id'] ?>"> <select name="channel" style="min-width: 160px;">
<select name="channel" style="flex: 1;"> <?php foreach ($availableChannels as $value => $label):
<?php foreach ($availableChannels as $value => $label): $selected = ($l['channel'] ?? '') === $value ? 'selected' : '';
$selected = ($l['channel'] ?? '') === $value ? 'selected' : ''; ?>
?> <option value="<?= htmlspecialchars($value) ?>" <?= $selected ?>><?= htmlspecialchars($label) ?></option>
<option value="<?= htmlspecialchars($value) ?>" <?= $selected ?>><?= htmlspecialchars($label) ?></option> <?php endforeach; ?>
<?php endforeach; ?> </select>
</select> <button class="btn btn-primary" type="submit">OK</button>
<button class="btn btn-primary" type="submit">OK</button> </form>
</form>
<form method="post">
<?= Layout::csrfField() ?>
<input type="hidden" name="action" value="toggle_betas">
<input type="hidden" name="id" value="<?= $l['id'] ?>">
<button class="btn btn-secondary" type="submit" style="width: 100%;">
<?= (int)($l['can_see_betas'] ?? 0) === 1 ? 'Retirer accès BÊTA' : 'Activer accès BÊTA' ?>
</button>
</form>
</div>
</details> </details>
</td> </td>
<td><span class="badge <?= $cls ?>"><?= $status ?></span></td> <td><span class="badge <?= $cls ?>"><?= $status ?></span></td>