{%- extends "_layout.html" %}

{%- block content %}
            <div>
                {%- if item_action == 'update' %}
                                {{ macros_page.render_breadcrumbs(item) }}
                {%- elif item_action == 'createfor' %}
                                {{ macros_page.render_breadcrumbs(parent) }}
                {%- else %}
                                {{ macros_page.render_breadcrumbs() }}
                {%- endif %}
                <hr>
                <div class="row justify-content-center">
                    <div class="col-md-6">
                        <div class="card bg-light">
                            <div class="card-body">
                                <form method="POST" action="{{ form_url }}" id="form-{{ item_type }}-{{ item_action }}">
                                    <fieldset>
                                        <legend class="card-title">{{ hawat_current_view.get_view_title() }}</legend>

                                        <div class="d-grid row-gap-2">

                                            {%- block itemform_fields %}{% endblock itemform_fields %}

                                            <hr>

                                            {{ macros_form.render_form_errors(form.next.errors) }}
                                            {{ form.next }}
                                            {%- if 'csrf_token' in form %}
                                            {{ macros_form.render_form_errors(form.csrf_token.errors) }}
                                            {{ form.csrf_token }}
                                            {%- endif %}

                                            <div class="btn-toolbar" role="toolbar" aria-label="{{ _('Form submission buttons') }}">
                                                <div class="btn-group" role="group">
                                                    {%- block itemform_buttons %}
                                                    {% if referrer %}
                                                    <a href="{{ referrer }}" class="btn btn-secondary">{{ _('Cancel') }}</a>
                                                    {% endif %}
                                                    {{ form.submit(class_='btn btn-primary') }}
                                                    {% endblock itemform_buttons %}
                                                </div>
                                            </div>
                                        </div>
                                    </fieldset>
                                </form>
                            </div> <!-- /.card -->
                        </div>
                    </div>
                </div> <!-- /.row -->
            </div>

    {%- block itemform_after %}{%- endblock itemform_after %}

    {%- if permission_can('developer') %}
        {%- if form.errors %}
            <hr>
            {{ macros_site.render_raw_var('form-errors', form.errors) }}
        {%- endif %}

        {%- if item %}
            <hr>
            {{ macros_site.render_raw_item_view(item) }}
        {%- endif %}

        {%- block itemform_devel %}{%- endblock itemform_devel %}
    {%- endif %}

{%- endblock content %}
