{% import "macros/buttons.html" as buttons %}
{% import "macros/forms.html" as forms %}
{% import "macros/icons.html" as icons %}

{% extends layout %}

{% block head_title_content %}Permissions · {{ super() }}{% endblock %}

{% block main %}
<div class="sm:flex sm:justify-between sm:items-center mb-8">

  <div class="mb-4 sm:mb-0">
    <h1 class="text-2xl md:text-3xl text-slate-800 font-bold">Permissions</h1>
  </div>

</div>

<form
  hx-boost="true"
  hx-target="#main"
  method="POST"
  action="{{ url_for('dashboard.permissions:list') }}"
  _="on fief:closeModal go back"
  class="mb-8"
>
  <div class="flex gap-4">
    {{ forms.form_field(form.name, class="grow") }}
    {{ forms.form_field(form.codename, class="grow") }}
    <div class="flex items-end">
      {% call buttons.submit('btn') %}
      {{ icons.plus('w-4 h-4')}}
      <span class="hidden sm:block ml-2">Create Permission</span>
      {% endcall %}
    </div>
  </div>
  {{ forms.form_csrf_token(form) }}
</form>

{% include "admin/permissions/table.html" %}
{% endblock %}
