@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.cut_piece')}} </h3>
                            </div>
                            <div class="pull-right">
                                {{--<a href="{{route('cut-piece.create')}}" class=" button_info">--}}
                                     {{--<span class="fa fa-plus"></span> {{__('administrator.new_cut_piece')}}--}}
                                {{--</a>--}}
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="wrapper-table">
                <table id="datatable_cut_piece" width="100%" class="table  table-striped table-hover">
                    <thead>
                    <tr>
                        <th>#</th>
                        <th>{{__('administrator.item_name')}}</th>
                        <th>{{__('administrator.cost')}}</th>
                        <th>{{__('administrator.created_at')}}</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','.print_barcode',function () {
                $(this).printThis({
                    loadCSS: "{{asset('assets/css/pos-invoice.css')}}",
                    afterPrint: function () {
                        // window.location.reload();
                    }
                });
            });
            $(document).on('click', '.show_productsinfo', function () {
                let url = $(this).data('url');
                $.ajax({
                    url: url,
                    async: false,
                    success:function (data) {
                        $.alert({
                            title:'',
                            theme:'modern',
                            content:data,
                            useBootstrap:false,
                            boxWidth:'60%'
                        });
                    }
                });
            });
            $(document).on('click', '.edit', function () {
                window.location.href = $(this).data('url');
            });
            $(document).on('click', '.duplicate', function () {
                window.location.href = $(this).data('url');
            });
            $('#datatable_cut_piece').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('cut-piece.index') }}",
                columns:
                    [
                        {data: 'DT_RowIndex', searchable:false, "orderable": "false"},
                        {data: 'product_name', 'name': 'nso007_products.product_name'},
                        {data: 'cost', 'searchable': false},
                        {data: 'created_at', 'searchable': false},
                        {data: 'action'},

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

            });
        });
    </script>
@endsection


