{% import "macros/buttons.html" as buttons %} {% import "macros/forms.html" as forms %} {% import "macros/modal.html" as modal %} {% import "macros/icons.html" as icons %} {% extends "admin/user_fields/list.html" %} {% block head_title_content %}Create User field ยท {{ super() }}{% endblock %} {% set open_modal = true %} {% block modal %}
{% call modal.header() %} {% call modal.title() %}Create User field{% endcall %} {% endcall %} {% call modal.body() %}
{{ forms.form_field( form.name, **{ "script": " on keyup if #" ~ form.slug.id ~ "@pristine call slugify(event.target.value, { replacement: '_', lower: true }) set #" ~ form.slug.id ~ "@value to it end " }, ) }} {{ forms.form_field( form.slug, **{ "script": " on load set @pristine to true on change set @pristine to false " }, ) }} {{ forms.form_field(form.type, **{"hx-post": url_for('dashboard.user_fields:create'), "hx-trigger": "change", "hx-target": "#modal"}) }} {% if form.configuration %} {% if form.configuration.choices %}
{{ forms.form_field(form.configuration.choices, **{"hx-post": url_for('dashboard.user_fields:create'), "hx-trigger": "change", "hx-target": "#modal"}) }}
{% endif %} {% if form.configuration["default"] %} {% if form.type.data == "BOOLEAN" %} {% else %} {{ forms.form_field(form.configuration["default"]) }} {% endif %} {% endif %} {{ forms.form_field(form.configuration.at_registration) }} {{ forms.form_field(form.configuration.at_update) }} {{ forms.form_field(form.configuration.required) }} {% endif %} {{ forms.form_csrf_token(form) }}
{% endcall %} {% call modal.footer() %} {% call buttons.submit('btn-sm') %} Create {% endcall %} {% endcall %}
{% endblock %}