<?php $__env->startSection('content'); ?>
    <?php Fun::lang()?>
    <style>
        .jconfirm .jconfirm-box {
            overflow-x: scroll;
            overflow-y: hidden;
        }

        .table {
            white-space: nowrap;
        }

    </style>
    <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><?php echo e(__('administrator.packing')); ?></h3>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <br>&nbsp;
            <br>
            <div class="wrapper-table">
                <table id="print_table" class="table table-striped table-hover">
                    <thead>
                    <tr>
                        <th>#</th>
                        <th><?php echo e(__('administrator.date')); ?></th>
                        <th><?php echo e(__('administrator.production')); ?></th>
                        <th><?php echo e(__('administrator.user')); ?></th>
                        <th><?php echo e(__('administrator.total_item')); ?></th>
                        <th><?php echo e(__('administrator.import_qty')); ?></th>
                        <th><?php echo e(__('administrator.return_qty')); ?></th>
                        <th><?php echo e(__('administrator.remain')); ?></th>
                        <th><?php echo e(__('administrator.action')); ?></th>
                    </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
    <script type="text/javascript">
        let table_ = $('#print_table');
        $(document).ready(function () {
            getTable();
            $('.select2').on('change', function () {
                getTable();
            });
            $('#print_table').on('click', ' .btn_show', function () {
                let add = $(this).data('add');
                let title = add?$(this).attr('title'):'';
                getHtmlFormShow($(this).data('href'),'700px',add,title,'900px');
            });
            $('#print_table').on('click', ' .btn_done', function () {
                let this_ = $(this).closest('tr');
                let date = this_.find('td:nth-child(2)').text();
                let inv = this_.find('td:nth-child(3)').text();
                let qty = this_.find('td:nth-child(6)').text();
                let text = '<?php echo e(__('administrator.date')); ?> : '+date+'<br>';
                text += '<?php echo e(__('administrator.invoice_number')); ?> : '+inv+'<br>';
                text += '<?php echo e(__('administrator.total_qty')); ?> : '+qty+'<br>';
                confirmForm($(this).data('href'),'<?php echo e(__('administrator.are_you_sure')); ?>',text,'success');
            });

        });

        function getTable() {
            table_.DataTable().destroy();
            let DTtable = table_.DataTable({
                searching: false,
                ordering: false,
                serverSide: true,
                lengthMenu: [20, 30, 50, 100, 200, 500, 1000],
                ajax: {
                    url: "<?php echo e(route('production-packing.index')); ?>",
                },
                columns:
                    [
                        {
                            className: 'dt-control',
                            orderable: false,
                            data: 'DT_RowIndex',
                            defaultContent: '',
                        },
                        {data: 'date'},
                        {data: 'invoice_number'},
                        {data: 'user_id'},
                        {data: 'total_item'},
                        {data: 'import_qty'},
                        {data: 'return_qty'},
                        {data: 'remain_qty'},
                        {data: 'action'},
                    ],
            });
            table_.on('click', 'td.dt-control', function () {
                var tr = $(this).closest('tr');
                var row = DTtable.row(tr);
                if (row.child.isShown()) {
                    // This row is already open - close it
                    row.child.hide();
                    tr.removeClass('shown dt-hasChild');
                } else {
                    // Open this row
                    $.get('',{getPacking:1,production_id:row.data().id},function (res) {
                        row.child(res).show();
                        tr.addClass('shown dt-hasChild');
                    })
                }
            });
        }

    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make(branchMenu(), \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/nsowos/public_html/shr-brand/resources/views/administrator/production-packing/index.blade.php ENDPATH**/ ?>