organisation.html 68 lignes · 5807 octets
{% import "components/actions.html" as a %}
{# E-002 Organisation #}
<form id="form-organisation" class="grid gap-xl lg:grid-cols-3" hx-post="{{ action }}" hx-target="this" hx-swap="outerHTML"
      hx-disabled-elt="find button[type=submit]" hx-disinherit="hx-disabled-elt hx-target hx-swap" novalidate x-data="organisation">
  <div class="flex flex-col gap-md lg:col-span-2">
    {% call a::resume(erreurs.nombre()) %}{% endcall %}
    {% if fige %}<p class="border-l-4 border-l-info bg-info-bg p-md text-sm text-foreground">Fixé à l'installation : une évolution ne change ni l'organisation, ni le domaine, ni la base de l'annuaire.</p>{% endif %}
    {% if let Some(e) = erreurs.get("langue") %}<p class="text-sm text-error-ink" role="alert">{{ e }}</p>{% endif %}
    <div class="field flex flex-col gap-xs">
      <label for="nom" class="text-sm text-foreground">Nom de l'organisation <span class="text-error-ink" aria-hidden="true">*</span></label>
      <input id="nom" name="nom" value="{{ nom }}"{% if fige %} disabled{% endif %} required aria-required="true" maxlength="100"
             class="h-10 rounded-xs border bg-background px-sm text-sm text-foreground {% if erreurs.get("nom").is_some() %}border-error{% else %}border-input{% endif %}"
             {% if let Some(e) = erreurs.get("nom") %}aria-invalid="true" aria-describedby="erreur-nom"{% endif %}>
      {% if let Some(e) = erreurs.get("nom") %}<p id="erreur-nom" class="text-sm text-error-ink">{{ e }}</p>{% endif %}
    </div>
    {% include "assistant/champ_domaine_contenu.html" %}
    <div class="field flex flex-col gap-xs">
      <div class="flex items-center justify-between gap-sm">
        <label for="base_dn" class="text-sm text-foreground">Base de l'annuaire <span class="text-error-ink" aria-hidden="true">*</span></label>
        <label class="flex items-center gap-xs text-sm text-muted-foreground">
          <input type="checkbox" name="personnaliser" value="1" x-model="personnaliser" {% if personnaliser %}checked{% endif %}{% if fige %} disabled{% endif %} class="size-4 accent-primary">
          Personnaliser
        </label>
      </div>
      <input id="base_dn" name="base_dn" value="{{ base_dn }}"{% if fige %} disabled{% endif %} spellcheck="false" x-ref="base" :readonly="baseFigee" {% if !personnaliser %}readonly{% endif %}
             class="h-10 rounded-xs border bg-background px-sm font-mono text-sm text-foreground read-only:border-transparent read-only:bg-muted read-only:text-muted-foreground {% if erreurs.get("base_dn").is_some() %}border-error{% else %}border-input{% endif %}"
             aria-describedby="{% if erreurs.get("base_dn").is_some() %}erreur-base_dn {% endif %}aide-base_dn">
      {% if let Some(e) = erreurs.get("base_dn") %}<p id="erreur-base_dn" class="text-sm text-error-ink">{{ e }}</p>{% endif %}
      <p id="aide-base_dn" class="text-sm text-muted-foreground">Déduite du domaine. Ne la personnalisez que pour reprendre un annuaire existant.</p>
    </div>
    <div class="grid gap-md md:grid-cols-2">
      <div class="field flex flex-col gap-xs">
        <label for="langue" class="text-sm text-foreground">Langue des portails <span class="text-error-ink" aria-hidden="true">*</span></label>
        <select id="langue" name="langue"{% if fige %} disabled{% endif %} class="h-10 rounded-xs border border-input bg-background px-sm text-sm text-foreground">
          <option value="fr" {% if langue == "fr" %}selected{% endif %}>Français</option>
          <option value="en" {% if langue == "en" %}selected{% endif %}>English</option>
        </select>
      </div>
      <div class="field flex flex-col gap-xs">
        <label for="fuseau" class="text-sm text-foreground">Fuseau horaire <span class="text-error-ink" aria-hidden="true">*</span></label>
        <input id="fuseau" name="fuseau" value="{{ fuseau }}"{% if fige %} disabled{% endif %} list="fuseaux" spellcheck="false"
               class="h-10 rounded-xs border bg-background px-sm text-sm text-foreground {% if erreurs.get("fuseau").is_some() %}border-error{% else %}border-input{% endif %}"
               {% if let Some(e) = erreurs.get("fuseau") %}aria-invalid="true" aria-describedby="erreur-fuseau"{% endif %}>
        <datalist id="fuseaux">
          <option value="Europe/Paris"></option><option value="Europe/Brussels"></option><option value="Europe/Zurich"></option>
          <option value="Europe/Luxembourg"></option><option value="America/Montreal"></option><option value="Indian/Reunion"></option>
          <option value="America/Guadeloupe"></option><option value="America/Martinique"></option><option value="Pacific/Noumea"></option><option value="UTC"></option>
        </datalist>
        {% if let Some(e) = erreurs.get("fuseau") %}<p id="erreur-fuseau" class="text-sm text-error-ink">{{ e }}</p>{% endif %}
      </div>
    </div>
  </div>
  <aside class="flex flex-col gap-md">
    <div class="rounded-sm bg-muted p-md">
      <h2 class="text-sm text-graphite">Aperçu de l'annuaire</h2>
      <pre class="mt-xs overflow-x-auto font-mono text-xs text-foreground" tabindex="0" x-text="apercu">{{ base_dn }}
├── ou=users          utilisateurs
├── ou=groups         groupes
├── ou=applications   comptes de service
└── ou=ppolicies      politiques de mots de passe</pre>
    </div>
    <details class="rounded-sm bg-muted p-md text-sm text-graphite">
      <summary class="cursor-pointer text-foreground">Pourquoi un domaine ?</summary>
      <p class="mt-xs">Il sert de base à l'annuaire (dc=exemple,dc=fr) et aux noms des services. Utilisez de préférence un domaine que votre organisation possède ; évitez le suffixe .local.</p>
    </details>
  </aside>
  <div class="lg:col-span-3">{% call a::actions(precedent) %}{% endcall %}</div>
</form>