<div class="modal fade crud-modal" id="crudFormModal" tabindex="-1" aria-hidden="true" data-bs-backdrop="static">
    <div class="modal-dialog modal-lg modal-dialog-scrollable">
        <div class="modal-content">
            <form id="crudModalForm" method="POST" enctype="multipart/form-data" action="{{ route('administracion.crud.store', ['entity' => $entity]) }}" autocomplete="off">
                @csrf
                <input id="crudModalMethod" type="hidden" name="_method" value="POST">
                <input id="crudModalFormMode" type="hidden" name="__form_mode" value="create">
                <input id="crudModalUpdateUrl" type="hidden" name="__update_url" value="">
                <input id="crudModalReturnEntity" type="hidden" name="__return_entity" value="{{ old('__return_entity', request()->query('return_entity', '')) }}">
                <input id="crudModalReturnUrl" type="hidden" name="__return_url" value="{{ old('__return_url', request()->query('return_url', '')) }}">
                <input id="crudModalRestoreDraftKey" type="hidden" name="__restore_draft_key" value="{{ old('__restore_draft_key', request()->query('restore_draft_key', '')) }}">

                <div class="modal-header">
                    <h5 class="modal-title" id="crudFormModalTitle">{{ $entityCreateLabel }}</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Cerrar"></button>
                </div>

                <div class="modal-body">
                    @if ($errors->any())
                        <div class="alert alert-danger" role="alert">
                            <div class="fw-semibold mb-1">Hay errores de validacion:</div>
                            <ul class="mb-0 ps-3">
                                @foreach ($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                @endforeach
                            </ul>
                        </div>
                    @endif

                    <div class="form-text mb-3">Los campos marcados con <span class="text-danger">*</span> son obligatorios.</div>

                    <div class="modal-form-grid">
                        @includeFirst([
                            'administracion.crud.partials.form-fields-' . $entity,
                            'administracion.crud.partials.form-fields',
                        ])
                    </div>
                </div>

                <div class="modal-footer">
                    <button class="btn btn-outline-secondary" type="button" data-bs-dismiss="modal">Cancelar</button>
                    <button class="btn btn-brand" id="crudModalSubmit" type="submit">Guardar</button>
                </div>
            </form>
        </div>
    </div>
</div>
