{% import "backend/macros.html" as macros %}
{% extends "backend/custom/surround.html" %}

{% block content %}
    {% if not origin %}
        {% set origin = False %}
    {% endif %}
    {% set record = record %}

                {{ macros.getRecordButtons(classname,classid,current_user,record,editable,backlink)}}
                
            {% if editable %}
            <form method="post" enctype="multipart/form-data" id="form-record" class="main-object-form">
            <!-- Inputs ocultos -->
            <input type="hidden" id="csrf_token" name="csrf_token" value="{{ csrf_token() }}">
            {% if record %}
                <input type="hidden" id="modifiedby_id" name="modifiedby_id" value="{{ current_user.id }}" >
            {%else%}
                <input type="hidden" id="createdby_id" name="createdby_id" value="{{ current_user.id }}" >
            {% endif %}
            {% endif %}
            <div class="bg-white shadow-sm rounded-3 p-4">
                <!-- Tabs superiores -->
                <ul class="nav nav-tabs mb-3" id="mainTab" role="tablist">
                    <li class="nav-item" role="presentation">
                        <button class="nav-link active" id="identificacion-tab" data-bs-toggle="tab"
                            data-bs-target="#identificacion" type="button" role="tab">{{classname}}</button>
                    </li>
                </ul>
                <div class="tab-content" id="mainTabContent">
                    <!-- Tab IDENTIFICACIÓN -->
                    <div class="tab-pane fade show active" id="identificacion" role="tabpanel">
                        {% for id, field in fields.items() %}
                            {{ macros.fieldForm(field, record, editable, origin) }}
                        {% endfor %}
                    </div>
                </div>
            </div>
            {%if editable %}
            </form>
            {% endif %}
{% endblock %}