@extends(branchMenu())
@section('content')
    <?php Fun::lang()?>
    <div class="page">
        <div class=container-fluid>
            <div class="top-content">
                <div class="row">
                    <div class="col-sm-12 col-xs-12">
                        <div class="title-add">
                            <div class="pull-left">
                                <h3>{{__('administrator.packer')}}</h3>
                            </div>
                            <div class="pull-right">
                                <a onclick="getHtmlForm('{{route('packers.create')}}','{{__('administrator.create')}} {{__('administrator.packer')}}','30%')" class=" button_info"><span class="fa fa-plus"></span> {{__('administrator.create')}}</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="wrapper-table">
                <table id="datatable" class="table table-striped table-hover ">
                    <thead>
                    <tr>
                        <th>#</th>
                        <th>{{__('administrator.name')}}</th>
                        <th>{{__('administrator.contact')}}</th>
                        <th>{{__('administrator.fee')}}</th>
                        <th>{{__('administrator.action')}}</th>
                    </tr>
                    </thead>
                    <tbody></tbody>
                </table>
            </div>
        </div>
    </div>
 @endsection
@section('script')
    <script type="text/javascript">
        let $table = $('#datatable');
        $(document).ready(function () {
            getTable();
            $table.on('click','.btn-edit',function () {
                let href = $(this).data('href');
                getHtmlForm(href,'{{__('administrator.edit').' '.__('administrator.packer')}}','30%')
            })
        });
        function getTable() {
            $table.DataTable().destroy();
            $table.DataTable({
                ordering: false,
                serverSide: true,
                lengthMenu: tbLeng,
                ajax: "",
                columns:
                    [
                        {data: 'DT_RowIndex', searchable:false,'orderable':false},
                        {data: 'name','name': 'nso007_packer.name'},
                        {data: 'contact', 'name': 'nso007_packer.contact'},
                        {data: 'fee', searchable:false},
                        {data: 'action',searchable:false},
                    ],
                "initComplete": function (settings, json) {
                }

            });

        }
    </script>
@stop



