<div>
    @component('common.breadcrumb', ['addBtn' => true, 'permission_create' => 'Company_job_positions_create', 'breadcrumb_show' => $breadcrumb_show])
        @slot('breadcrumb_title')
            <h3>{{ $componentName }} | {{ $pageTitle }}</h3>
        @endslot
        <li class="breadcrumb-item">Empresa</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="card-body">
                        <div class="card-header">
                            <h4>{{ $company_name }} | Plan: <b>{{ $company_plan_name }}</b></h4>
                        </div>
                    </div>
                </div>
            </div>
            <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">SALARIO BASE @include('common.orderby', ['column' => 'base_salary'])</th>
                                    <th scope="col" class="text-center">ACCIONES</th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach ($job_positions as $item)
                                    <tr>
                                        <td>{{ $item->name }}</td>
                                        <td class="text-left">{{ number_format($item->base_salary, 2) }}</td>


                                        <td class="text-center">
                                            @can('Company_job_positions_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('Company_job_positions_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>
                        {{ $job_positions->links() }}
                    </div>

                </div>
            </div>
        </div>
        @include('livewire.company.job_positions.form')
    </div>
</div>
@include('common.scriptsCompStandar')
@push('cheditor')
<script src="{{asset('assets/js/ckeditor/ckeditor.js')}}"></script>
<script>
    const config = {
        language: 'es',
        height: 150,
        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('main_functions', config);
    const editor2 = CKEDITOR.replace('special_functions', config);
    const editor3 = CKEDITOR.replace('qualities', config);

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

    });

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

        let special_functions = $('#special_functions').data('special_functions');
        eval (special_functions).set('special_functions', editor2.getData());

        let qualities = $('#qualities').data('qualities');
        eval (qualities).set('qualities', editor3.getData());
    } );
</script>
@endpush

