
@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.tailor')}}</h3>
                            </div>
                            <div class="pull-right">
                                @can('Tailor Create')
                                    <a onclick="getHtmlForm('{{route('tailor.create')}}','{{__('administrator.create').' '.__('administrator.tailor')}}','30%')" class=" button_info"><span class="fa fa-plus"></span> {{__('administrator.create')}}</a>
                                @endcan
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="wrapper-table">
                <table id="print_table" width="100%" class="table table-striped table-hover ​​ customize">
                    <thead>
                    <tr>
                        <th>#</th>
                        <th>{{__('administrator.type')}}</th>
                        <th>{{__('administrator.name')}}</th>
                        <th>{{__('administrator.contact')}}</th>
                        <th>{{__('administrator.account_receivable')}}</th>
                        <th>{{__('administrator.action')}}</th>
                    </tr>
                    </thead>
                    <tbody>

                    </tbody>
                </table>
            </div>
        </div>
    </div>

@endsection
@section('script')
    <script>
        $table = $('#print_table');
        $(document).ready(function () {
            getTable();
            $table.on('click','.btn-edit',function () {
                console.log(1);
                let href = $(this).data('href');
                getHtmlForm(href,'{{__('administrator.edit').' '.__('administrator.tailor')}}','30%')
            });
        });
        function getTable() {
            $table.DataTable().destroy();
            $table.DataTable({

                ordering: false,
                serverSide: true,
                lengthMenu: [[20, 30, 50, 100, 200, 500, 1000], [20, 30, 50, 100, 200, 500, 1000]],
                ajax: {
                    url: '{{route('tailor.index')}}',
                },
                columns:
                    [
                        {data: 'DT_RowIndex', 'searchable': false},
                        {data: 'type',  'searchable': false},
                        {data: 'name', 'name': 'nso007_tailor.name'},
                        {data: 'phone', 'name': 'nso007_tailor.phone'},
                        {data: 'account_receivable_riel', 'searchable': false},
                        {data: 'action', 'searchable': false},
                    ],
            });
        }
    </script>
@endsection






