<%- include('../partials/header') %>
<%- include('../partials/adm-nav') %>

<section class="panel">
  <div class="panel-head">
    <h2><%= role ? 'Modifier' : 'Créer' %> un rôle</h2>
    <a href="/adm/roles" class="btn btn-ghost">Retour</a>
  </div>

  <% if (error) { %>
    <div class="alert"><%= error %></div>
  <% } %>

  <form method="POST" action="<%= role ? '/adm/roles/' + role.id + '?_method=PUT' : '/adm/roles' %>" class="form">
    <label>
      <span>Nom du rôle *</span>
      <input type="text" name="nom" required value="<%= role && role.nom ? role.nom : '' %>" placeholder="ex. Responsable d'opération">
    </label>
    <label>
      <span>Description</span>
      <textarea name="description" rows="3" placeholder="Mission et périmètre"><%= role && role.description ? role.description : '' %></textarea>
    </label>
    <div class="form-actions">
      <button type="submit" class="btn btn-primary"><%= role ? 'Enregistrer' : 'Créer' %></button>
    </div>
  </form>
</section>

<%- include('../partials/footer') %>
