@extends('layouts.app-hr')

@section('content')
    @include('hr.salary-tax.confirm-delete')
    <?php Fun::lang()?>
    <div class="top-header">
        <ol class="breadcrumb">
            <li><a href="#">{{__('administrator.Dashboard')}}</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.salary_tax')}} </h3>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6 col-xs-12">
                    <div class="title-add">
                        <div class="pull-right">
                            @can('Salary tax Create')
                                <a href="{{route('salary-tax.create')}}"
                                   class="button_primary">{{__('administrator.add_new')}}</a>
                            @endcan
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="box-body">
            <table id="datatable_salary_tax" width="100%" class="table table-striped">
                <thead>
                <tr>
                    <th>#</th>
                    <th>{{__('administrator.name')}}</th>
                    <th>{{__('administrator.rate')}}</th>
                    <th>{{__('administrator.from_salary')}}</th>
                    <th>{{__('administrator.to_salary')}}</th>
                    <th>{{__('administrator.add')}}</th>
                    <th>{{__('administrator.minus')}}</th>
                    <th style="width: 200px;">{{ __('administrator.action') }}</th>
                </tr>
                </thead>

            </table>
        </div>
    </div>
@endsection
@section('script')
    <script type="text/javascript">
        $(document).ready(function () {

            $(document).on('click', '.btn_delete', function () {
                var id = $(this).data('id');
                $('#delete-id').val(id);
                $('#form-delete').modal('show');
            });

            $('#datatable_salary_tax').DataTable({
                ordering: false,
                serverSide: true,
                lengthMenu: [[20, 30, 50, 100, 1000], [20, 30, 50, 100, 1000]],
                ajax: "{{ route('salary-tax.index') }}",
                columns:
                    [
                        {data: 'DT_RowIndex'},
                        {data: 'name'},
                        {data: 'rate'},
                        {data: 'from_salary'},
                        {data: 'to_salary'},
                        {data: 'add'},
                        {data: 'minus'},
                        {data: 'action'},
                    ],
                "scrollX": true,
                "initComplete": function (settings, json) {

                }
            });

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