
<?php $__env->startSection('content'); ?>
    <?php
        $date = @$_GET['date'];
        $customer = @$_GET['customer'] ;
        $status = @$_GET['status'] ;
    ?>
    <?php Fun::lang()?>
    <div class="container-fluid">
        <div class="row">
            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                <?php echo Form::open(['route' => 'pos-branch.index', 'method' => 'get']); ?>

                <div class="col-sm-3 col-md-3">
                    <div class="col-sm-3 col-md-3" style="margin-top: 5px">
                        <?php echo e(__('administrator.customer')); ?>

                    </div>
                    <div class="form-group col-sm-9 col-md-9">
                        <?php echo Form::select('customer', getCustomerByAgent(Auth::user()->id) , $customer , ['placeholder'=>__('administrator.please_select'),'class' => 'form-control select2']); ?>

                    </div>
                </div>
                <div class="col-sm-3 col-md-3">
                    <div class="col-sm-3 col-md-3" style="margin-top: 5px">
                        <?php echo e(__('administrator.status')); ?>

                    </div>
                    <div class="form-group col-sm-9 col-md-9">
                        <?php echo Form::select('status', getPaymentStatus(), null, ['placeholder'=>__('administrator.please_select'),'class' => 'form-control status select2']); ?>

                    </div>
                </div>
                <div class="col-sm-3 col-md-3">
                    <div class="col-sm-3 col-md-3" style="margin-top: 5px">
                        <?php echo e(__('administrator.date')); ?>

                    </div>
                    <div class="form-group col-sm-9 col-md-9">
                        <input type="text" class="form-control date_picker" name="date" value="<?php echo e($date?$date:''); ?>">
                    </div>
                </div>
                <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 form-group">
                    <div class="col-sm-12">
                        <button type="submit" class="button_info"><?php echo e(__('administrator.search')); ?></button>
                    </div>
                </div>
                <?php echo Form::close(); ?>

            </div>
        </div>
        <div class="row">
            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                <div class="row">
                    <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
                        <h3><?php echo e(__('administrator.pos')); ?></h3>
                    </div>
                    <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 text-right">
                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('POS Retail Create')): ?>
                        <a href="<?php echo e(route('pos-branch.create')); ?>">
                            <button type="button" class="button_info"><i class="fa fa-pencil"></i> <?php echo e(__('administrator.create')); ?></button>
                        </a>
                    <?php endif; ?>
                    </div>
                </div>
                <div class="container-fluid" style="background: white; padding:10px">
                    <div class="table-responsive">
                        <table id="customer" class="table">
                            <thead>
                                <tr>
                                    <th width="5%">#</th>
                                    <th><?php echo e(__('administrator.date')); ?></th>
                                    <th><?php echo e(__('administrator.invoice_number')); ?></th>
                                    <th><?php echo e(__('administrator.customer')); ?></th>
                                    <th><?php echo e(__('administrator.phone')); ?></th>
                                    <th><?php echo e(__('administrator.discount')); ?> (%)</th>
                                    <th><?php echo e(__('administrator.paid')); ?> ($)</th>
                                    <th><?php echo e(__('administrator.total')); ?> ($)</th>
                                    <th><?php echo e(__('administrator.payment_status')); ?></th>
                                    <th><?php echo e(__('administrator.action')); ?></th>
                                </tr>
                            </thead>
                            <tbody>

                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
    <script type="text/javascript">
        $(document).ready(function () {
            $(document).on('click','.show_invoice',function () {
                var id = $(this).data('id');
                if(id){
                    $.ajax({
                        url: '<?php echo url("get-invoice/'+id+'"); ?>',
                        success: function (data) {
                            var content_ = (data);
                            $.confirm({
                                title: '',
                                content: content_,
                                boxWidth: '20%',
                                useBootstrap: false,
                                buttons: {
                                    close: {
                                        text: '<?php echo e(__('administrator.close')); ?>',
                                        btnClass: 'button_warning',
                                        keys: ['esc'],
                                        action: function () {

                                        }
                                    },
                                    print: {
                                        text: '<?php echo e(__('administrator.print')); ?>',
                                        btnClass: 'button_info',
                                        keys: ['enter'],
                                        action: function () {
                                            $('.invoice-box').printThis({
                                                loadCSS: "<?php echo e(asset('assets/css/pos-invoice.css')); ?>",
                                                afterPrint: function () {
                                                    window.location.reload();
                                                }
                                            });
                                        }
                                    },
                                }
                            });
                            $('.loading_btn').hide();
                            $('input[type=submit]').show();
                            $('button[type=submit]').show();
                        }
                    });
                }
            });
        });
        $('#customer').DataTable({
            ordering: false,
            processing: false,
            serverSide: true,
            lengthMenu: [[20, 30, 50, 100, 200, 500, 1000], [20, 30, 50, 100, 200, 500, 1000]],
            ajax: {
                url: "<?php echo e(route('pos-branch.index')); ?>?customer=<?php echo e($customer); ?>&date=<?php echo e($date); ?>&status=<?php echo e($status); ?>",
            },
            columns:
                [
                    {data: 'DT_RowIndex', 'searchable': false},
                    {data: 'sale_date'},
                    {data: 'invoice_number'},
                    {data: 'customer_id'},
                    {data: 'customer_phone'},
                    {data: 'discount'},
                    {data: 'paid_amount_kh'},
                    {data: 'total'},
                    {data: 'payment_status'},
                    {data: 'action'},
                ],


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

        });
    </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/pos/clothes-pos/index.blade.php ENDPATH**/ ?>