@extends('adminlte::page')

@section('content')
    <?php Fun::lang()?>
    <div class="top-header">
        <ol class="breadcrumb">
            <li><a href="#">{{__('administrator.dashboard')}}</a></li>
            <li><a href="{{route('hr-exp-level.index')}}">{{__('administrator.exp_level')}}</a></li>
        </ol>
    </div>
    <div class="page">
        <div class="top-content">
            <div class="row">
                <div class="col-sm-6 col-xs-12">
                    <div class="title-add">
                        <div class="pull-left">
                            <h3>{{__('administrator.exp_level')}} </h3>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6 col-xs-12">
                    <div class="title-add">
                        <div class="pull-right">
                            @can('Experience-Level-Create')<a href="{{route('hr-exp-level.create')}}" class="button_primary">{{__('administrator.add_new')}}</a>@endcan
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="box-body">
            <table id="datatable_products" width="100%" class="table table-striped">
                <thead>
                <tr>
                    <th>#</th>
                    <th>{{__('administrator.name')}}</th>
                    <th>{{ __('administrator.note') }}</th>
                    <th>{{ __('administrator.action') }}</th>
                </tr>
                </thead>
                <tbody>

                </tbody>
            </table>
        </div>
    </div>
@endsection
@section('js')
    <script type="text/javascript">
        $(document).ready(function () {
            $('#datatable_products').DataTable({
                ordering: false,
                serverSide: true,
                ajax: "{{ route('datatable.hr-get-exp-level') }}",
                columns:
                    [
                        {data: 'DT_RowIndex'},
                        {data: 'name'},
                        {data: 'note'},
                        {data: 'action'},
                    ],
                "initComplete": function (settings, json) {
                    $('#datatable_products tbody :not(script)').contents().filter(function () {
                        return this.nodeType === 3;
                    }).replaceWith(function () {
                        return this.nodeValue.replace(/full_day/g, '{{__('administrator.full_day')}}').replace(/half_day/g, '{{__('administrator.half_day')}}').replace(/day_off/g, '{{__('administrator.day_off')}}');
                    });
                }
            });

            $.fn.dataTable.ext.errMode = 'throw';
        });
    </script>
@endsection
