@extends(branchMenu())
@section('content')
    <?php Fun::lang()?>
    <div class="container-fluid">
        <div class="">
            <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.production_template')}} </h3>
                            </div>
                            <div class="pull-right">
                            @can('Item Template Create')
                                <a href="{{route('production-template.create')}}" class=" button_info"><span
                                            class="fa fa-plus"></span> {{__('administrator.add_new')}}</a>
                            @endcan
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="wrapper-table">
                <table id="datatable_production" width="100%" class="table  table-striped table-hover">
                    <thead>
                    <tr>
                        <th>#</th>
                        <th>{{__('administrator.barcode')}}</th>
                        <th>{{__('administrator.product')}}</th>
                        <th>{{__('administrator.total_cost')}}</th>
                        <th>{{__('administrator.action')}}</th>
                    </tr>
                    </thead>
                    <tbody>

                    </tbody>
                </table>
            </div>
        </div>
    </div>
@endsection
@section('script')
    <script type="text/javascript">
        $(document).ready(function () {
            $(document).on('click', '.edit', function () {
                window.location.href = $(this).data('url');
            });
            $('#datatable_production').DataTable({
                "oLanguage": {
                "sSearch":"{{__('administrator.search')}}:",
                "sLengthMenu": "{{__('administrator.display')}} _MENU_ {{__('administrator.record_per_page')}}",
                "sZeroRecords": "{{__('administrator.Nothing_foundsorry')}}",
                "sInfo": "{{__('administrator.showing')}} _START_ {{__('administrator.to')}} _END_ {{__('administrator.of')}} _TOTAL_ {{__('administrator.record')}}",
                "sInfoEmpty": "{{__('administrator.showing')}} 0 {{__('administrator.to')}} 0 {{__('administrator.of')}} 0 {{__('administrator.record')}}",
                "sInfoFiltered": "({{__('administrator.filter_form')}} _MAX_ {{__('administrator.total_records')}})",
                "oPaginate": {
                "sFirst":    "{{__('administrator.first')}}",
                "sLast":    "{{__('administrator.last')}}",
                "sNext":    "{{__('administrator.next')}}",
                "sPrevious": "{{__('administrator.previous')}}"
                },
            },
                ordering: true,
                serverSide: true,
                lengthMenu: [[20, 30, 50, 100, 200, 500, 1000], [20, 30, 50, 100, 200, 500, 1000]],
                ajax: "{{ route('production-template.index') }}",
                columns:
                    [
                        {data: 'DT_RowIndex', searchable:false, "orderable": "false"},
                        {data: 'barcode', 'name': 'barcode'},
                        {data: 'product_name', 'name': 'nso007_products.product_name'},
                        {data: 'total_cost',  'searchable':false,},
                        {data: 'action'},

                    ],
                "initComplete": function (settings, json) {
                }

            });
        });

    </script>
@endsection


