acces_formulaire.html 19 lignes · 1357 octets
{% import "components/bouton.html" as b %}
<form id="form-acces" class="flex flex-col gap-md" hx-post="/acces" hx-target="this" hx-swap="outerHTML"
      hx-disabled-elt="find button[type=submit]" novalidate x-data="decompte" data-attente="{{ attente.unwrap_or(0) }}">
  {% if let Some(erreur) = erreur %}
  <div id="erreur-acces" class="border-l-4 border-l-error bg-error-bg p-md text-sm text-foreground" role="alert">{{ erreur }}</div>
  {% endif %}
  {% if attente.is_some() %}
  <p class="text-sm text-error-ink" aria-live="polite">Nouvel essai possible dans <span x-text="restant">{{ attente.unwrap_or(0) }}</span> s.</p>
  {% endif %}
  <div class="flex flex-col gap-xs">
    <label for="jeton" class="text-sm text-foreground">Jeton d'accès <span class="text-error-ink" aria-hidden="true">*</span></label>
    <input id="jeton" name="jeton" required aria-required="true" autocomplete="off" spellcheck="false" autocapitalize="characters"
           class="h-10 w-full rounded-xs border border-input bg-background px-sm font-mono text-sm text-foreground"
           {% if erreur.is_some() %}aria-invalid="true" aria-describedby="erreur-acces"{% endif %}>
  </div>
  <div>
    <button type="submit" class="{% call b::classes("default") %}{% endcall %}" :disabled="bloque" {% if attente.is_some() %}disabled{% endif %}>Accéder</button>
  </div>
</form>