<?php Fun::lang() ?>
<?php $total = 0 ?>
<?php $total_discount = 0 ?>

<div class="print_this_form">
    <div class="col-sm-12">
        <table class="text-left">
            <tr>
                <td><?php echo e(__('administrator.name')); ?></td>
                <td width="10px"> :</td>
                <td><strong><?php echo e($customer->name); ?></strong></td>
            </tr>
            <tr>
                <td><?php echo e(__('administrator.phone')); ?></td>
                <td> :</td>
                <td><?php echo e($customer->phone); ?></td>
            </tr>
            <tr>
                <td><?php echo e(__('administrator.address')); ?></td>
                <td> :</td>
                <td><?php echo e($customer->address); ?></td>
            </tr>
            <tr>
                <td><?php echo e(__('administrator.created_at')); ?></td>
                <td> :</td>
                <td><?php echo e(date('d-m-Y', strtotime($customer->created_at))); ?></td>
            </tr>
        </table>
    </div>
    <h4 style="margin-top: 10px;margin-bottom: 10px"><?php echo e(__('administrator.sale_history')); ?></h4>
    <div class="col-sm-12">
        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <th>#</th>
                <th><?php echo e(__('administrator.sale_date')); ?></th>
                <th><?php echo e(__('administrator.invoice_number')); ?></th>
                <th><?php echo e(__('administrator.paid')); ?></th>
                <th><?php echo e(__('administrator.total')); ?></th>
                <th><?php echo e(__('administrator.remain')); ?></th>
                <th><?php echo e(__('administrator.payment_status')); ?></th>
            </tr>
            </thead>
            <tbody>
            <?php $__currentLoopData = $history; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key =>$row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php
                $total_paid = $row->paid_amount;
                $total = generateGrandTotal($row);
                $remain = $total - $total_paid;
                $total_paid =  findCurrency($row->currency_id)->symbol . number_format($total_paid, 2);
                $total =  findCurrency($row->currency_id)->symbol . number_format($total, 2);
                $remain = findCurrency($row->currency_id)->symbol  . number_format(($remain > 0 ? $remain : 0), 2);
                ?>
                <tr>
                    <td><?php echo e($key+1); ?></td>
                    <td><?php echo e(date('d-m-Y',strtotime($row->sale_date))); ?></td>
                    <td><a class="under-line cursor text-primary btn_purchase_invoice_public" data-href="<?php echo e(route("get-wholesale-invoice", $row->id)); ?>"><?php echo e($row->invoice_number); ?></a></td>
                    <td><?php echo e($total_paid); ?></td>
                    <td><?php echo e($total); ?></td>
                    <td><?php echo e($remain); ?></td>
                    <td><?php echo checkPaymentStatus($row->payment_status); ?></td>
                </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
        </table>
        <div class="col-sm-12 col-xs-12">
            <div class="pagin">
                <?php echo Form::hidden('id_hide', @$customer?$customer->id:''); ?>

                <?php if(@$history): ?>
                    <?php echo $history->render(); ?>

                <?php endif; ?>
            </div>
        </div>
    </div>
</div>





<?php /**PATH /home/nsowos/public_html/shr-brand/resources/views/administrator/people/customers/show.blade.php ENDPATH**/ ?>