

<?php $__env->startSection('content'); ?>
    <?php Fun::lang()?>
    <div class="container-fluid">
        <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.payment')); ?></h3>
                    </div>
                </div>
                <div class="container-fluid" style="background: white; padding:10px">
                    <div class="row">
                        <?php echo Form::open(['class'=>'form-data']); ?>

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

                            </div>
                            <div class="form-group col-sm-9 col-md-9">
                                <?php echo Form::select('tailor_id', getTailor('ert')->pluck('name','id') , null , ['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 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="">
                            </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="button"
                                        class="button_info pull-right submit_search"><?php echo e(__('administrator.search')); ?></button>
                            </div>
                        </div>
                        <?php echo Form::close(); ?>

                    </div>
                    <div class="table-responsive">
                        <table id="table" class="table table-hover" style="white-space: nowrap">
                            <thead>
                            <tr>
                                <th width="5%">#</th>
                                <th><?php echo e(__('administrator.date')); ?></th>
                                <th><?php echo e(__('administrator.invoice')); ?></th>
                                <th><?php echo e(__('administrator.user')); ?></th>
                                <th><?php echo e(__('administrator.tailor')); ?></th>
                                <th><?php echo e(__('administrator.sewing_price')); ?></th>
                                <th><?php echo e(__('administrator.total_qty')); ?></th>
                                <th><?php echo e(__('administrator.return_qty')); ?></th>
                                <th><?php echo e(__('administrator.total_amount')); ?></th>
                                <th><?php echo e(__('administrator.tailor_due')); ?></th>
                                <th><?php echo e(__('administrator.material_due')); ?></th>
                                <th><?php echo e(__('administrator.lost_amount')); ?></th>
                                <th><?php echo e(__('administrator.paid_amount')); ?></th>
                                <th><?php echo e(__('administrator.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">
        let $table = $('#table');
        $(document).ready(function () {
            getTable();
            $table.on('click','.show_', function () {
                getHtmlFormShow($(this).data('href'),'900px');
            });
            $('.submit_search').on('click', function () {
                getTable();
            });
            $(document).on('keyup', '.amount', function () {
                let remain = ($('.remain').data('pp'));
                remain = remain?parseFloat(remain):0;
                if (parseFloat($(this).val()) > remain) {
                    $(this).val(remain);
                }
            });
            $table.on('click', '.btn_ar', function () {
                let $url = $(this).data('href');
                let add_ar_href = $(this).data('ar_href');
                let clear = $(this).data('clear');
                let $width = clear?'1000px':'700px';
                clear = clear?'<?php echo e(__('administrator.clear')); ?>':'<?php echo e(__('administrator.add')); ?>';
                getHtmlFormShow($url ,'800px',add_ar_href,clear+' <?php echo e(__('administrator.account_receivable')); ?>',$width);
            });
            $(document).on('click', '.btn_get_clear_ar', function () {
                let $url = $(this).data('href');
                getHtmlFormShow($url ,'800px');
            });
            $(document).on('click','.button_show_transfer',function () {
                $.get($(this).data('href'),function (data) {
                    jalert('',data.view,'900px');
                });
            });
            $table.on('click', '.btn_add_payment', function () {
                getHtmlForm($(this).data('href'),'<?php echo e(__('administrator.add_payment')); ?>','900px');
            });
        });

        function getTable() {
            $table.DataTable().destroy();
            $table.DataTable({

                searching: false,
                ordering: false,
                processing: false,
                serverSide: true,
                lengthMenu: [20, 30, 50, 100, 200, 500, 1000],
                ajax: {
                    url: "<?php echo e(route('payment-production')); ?>?"+$('.form-data').serialize(),
                },
                columns:
                    [
                        {data: 'DT_RowIndex', 'searchable': false},
                        {data: 'payment_date'},
                        {data: 'invoice_number'},
                        {data: 'user_id'},
                        {data: 'tailor_id'},
                        {data: 'sewing_price'},
                        {data: 'total_qty'},
                        {data: 'return_qty'},
                        {data: 'payment_amount'},
                        {data: 'tailor_due'},
                        {data: 'material_due'},
                        {data: 'lost_amount'},
                        {data: 'paid_amount'},
                        {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/administrator/payment/production/production-payment.blade.php ENDPATH**/ ?>