<div wire:ignore.self class="modal modal-account-request fade modalVqBrandsModal" id="modalVqBrandsModal" data-backdrop="static"
        tabindex="-1" role="dialog" aria-labelledby="staticBackdrop" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered modal-xl" role="document" style="max-width: 600px;">
            <div class="modal-content h-100" style="min-height: 500px;">

                @include('parts.overlay', ['target' => 'edit, use, store'])

                <div class="modal-header">
                    <h3 class="modal-title" id="calendarModalLabel" wire:ignore>Marcas</h3>
                    <button type="button" class="close" aria-label="Close" id="closeBrands">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <!--begin: Datatable-->
                    <div class="row mb-5 mt-2">
                        <div class="col-12 mb-3">
                            <div class="row">
                                @if ($message = Session::get('message'))
                                    <div class="col-12">
                                        <div class="alert alert-success alert-block">
                                            <button type="button" class="close" data-dismiss="alert" style="padding:4px;">×</button>
                                            <strong>{{ $message }}</strong>
                                        </div>
                                    </div>
                                @endif
                                <div class="col-12">
                                    <div class="form-group">
                                        <label for="brand-name">{{ $data['title'] }}</label>
                                        <form wire:submit.prevent="store">
                                            <div class="d-flex align-items-center justify-content-between">
                                                <div class="w-75">
                                                    <input type="text" class="form-control w-100 @error('data.brand-name') is-invalid @enderror" wire:model="data.brand-name" placeholder="{{ $data['placeholder'] }}" id="brand-name">
                                                </div>
                                                <div>
                                                    <button id="btn-submit" type="submit" class="btn btn-primary" wire:loading.attr="disabled">
                                                        <i class="far fa-save"></i>
                                                       Guardar
                                                    </button>
                                                </div>
                                            </div>
                                        </form>
                                        @error('data.brand-name') <span class="text-danger">{{ $message }}</span>@enderror
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-12 mb-3">
                            <h5 class="modal-title w-100 mb-2">Listado de marcas</h5>
                            <div class="wrapper-search">
                                <input type="text" id="search" class="form-control" wire:model.debounce.1000ms="params.search" placeholder="Buscar...">
                                @if (!empty($params['search']))
                                <button type="button" class="btn" id="btn-search" wire:click="clearText">
                                    <i class="fa fa-times"></i>
                                </button>
                                @endif
                            </div>
                        </div>
                        <div class="col-12">
                            <div class="table-responsive" style="max-height: 400px;min-wdth: 600px;">
                                <table class="table" id="table_id">
                                    <thead>
                                        <tr>
                                            <th style="width: 40px;">#</th>
                                            <th>Nombre</th>
                                            <th class="text-center" style="width: 100px;"></th>
                                            <th class="text-center" style="width: 100px;">
                                                Acciones
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        @forelse ($items as $key => $item)
                                            <tr>
                                                <th>{{ $key+1 }}</th>
                                                <td>{{ $item->name ?? '--' }}</td>
                                                <td>
                                                    <button wire:click="use({{ $item->id }})" type="button"
                                                        class="dropdown-item btn-link text-primary text-center">
                                                        Usar
                                                    </button>
                                                </td>
                                                <td>
                                                    <button wire:click="edit({{ $item->id }})" type="button"
                                                        class="dropdown-item btn-link">
                                                        <i class="fas fa-pencil-alt mr-1"></i> Editar
                                                    </button>
                                                </td>
                                            </tr>
                                        @empty
                                            <tr>
                                                <th colspan="5">
                                                    <div class="alert alert-light">
                                                        No tiene marcas registradas
                                                    </div>
                                                </th>
                                            </tr>
                                        @endforelse
                                    </tbody>
                                </table>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
</div>
{{-- Script para user_main --}}
@push('styles')
    <style>
        #modalVqBrandsModal {
            background-color: rgb(0 0 0 / 41%);
        }
    </style>
@endpush
@push('scripts')
    <script type="text/javascript">
        document.addEventListener("DOMContentLoaded", () => {
            window.addEventListener('show-modal-vq-brands', event => {
                $('#modalVqBrandsModal').modal('show');
            });

            window.addEventListener('close-modal-vq-brands', event => {
                $('#modalVqBrandsModal').modal('hide');
            });

            $('#closeBrands').on('click', function() {
                $('#modalVqBrandsModal').modal('hide');
            });
        });
    </script>
@endpush
