<div>
    @component('common.breadcrumb', ['addBtn' => true, 'permission_create' => 'Annex_others_create', 'breadcrumb_show' => $breadcrumb_show])
        @slot('breadcrumb_title')
            <h3>{{ $componentName }} | {{ $pageTitle }}</h3>
        @endslot
        <li class="breadcrumb-item">Administración</li>
        <li class="breadcrumb-item active">{{ $componentName }}</li>

    @endcomponent

    @include('common.searchbox')
    <div class="container-fluid">
        <div class="row layout-top-spacing">
            <div class="col-sm-12">
                <div class="card">
                    <div class="table-responsive">
                        <table class="table">
                            <thead class="bg-primary">
                                <tr>
                                    <th scope="col">NOMBRE @include('common.orderby', ['column' => 'name'])</th>
                                    <th scope="col" class="text-center">DESCRIPCIÓN @include('common.orderby', ['column' => 'description'])</th>
                                    <th scope="col" class="text-center">ESTADO</th>
                                    <th scope="col" class="text-center">ACCIONES</th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach ($annex_others as $item)
                                    <tr>
                                        <td>{{ $item->name }}</td>
                                        <td class="text-left">{{ $item->description }}</td>
                                        <td class="text-center">
                                            @if ($item->status == 'Activo')
                                                <span class="badge badge-success">Activo</span>
                                            @else
                                                <span class="badge badge-danger">Inactivo</span>
                                            @endif
                                        </td>

                                        <td class="text-center">
                                            @can('Annex_others_update')
                                            <a href="javascript:void(0)" wire:click="Edit({{ $item->id }})"
                                                class="btn btn-outline-primary" title="Editar">
                                                <i class="fas fa-edit"></i>
                                            </a>
                                            @endcan
                                            @can('Annex_others_delete')
                                            <a href="javascript:void(0)" onclick="Confirm('{{ $item->id }}')"
                                                class="btn btn-outline-primary " title="Eliminar">
                                                <i class="fas fa-trash"></i>
                                            </a>
                                            @endcan
                                        </td>
                                    </tr>
                                @endforeach
                            </tbody>
                        </table>
                        {{ $annex_others->links() }}
                    </div>

                </div>
            </div>
        </div>
        @include('livewire.annex-others.form')
    </div>
</div>
@include('common.scriptsCompStandar')
@push('cheditor')
<script src="{{asset('assets/js/ckeditor/ckeditor.js')}}"></script>
<script>
    const config = {
        language: 'es',
        height: 150,
        extraPlugins: 'shortcodes',
        removeButtons: 'Cut,Copy,Paste,PasteText,PasteFromWord,ExportPdf,Link,Table,Anchor,Underline,Strike,Subscript,Superscript,Image,SpecialChar,Maximize,ShowBlocks,About,Save,NewPage,Preview,Print,Templates,Scayt,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,Strike,Blockquote,CreateDiv,BidiLtr,BidiRtl,Language,Unlink,Anchor,Flash,HorizontalRule,Smiley,SpecialChar,PageBreak,Iframe,Styles,Format,Font,FontSize,TextColor,BGColor,Maximize,About,ShowBlocks,Save,NewPage,Preview,Print,Templates,Scayt,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,Strike,Blockquote,CreateDiv,BidiLtr,BidiRtl,Language,Unlink,Anchor,Flash,HorizontalRule,Smiley,Source'
        };
    const editor1 = CKEDITOR.replace('content', config);

    document.addEventListener('DOMContentLoaded', function() {
        window.livewire.on('show-modal', () => {
            editor1.setData({!! $content !!});
        });

    });

    document.querySelector('#save_annex_others').addEventListener( 'click', () => {
        let main_functions = $('#content').data('content');
        eval (main_functions).set('content', editor1.getData());

    } );
</script>
@endpush

