
        <table class="table">
            <thead>

<?php if(Config::get('app.locale') == "ar"): ?>
                <tr>
                    <th>#</th>
                    <th>اسم العميل</th>
                    <th style="display: none;">اسم البائع</th>
                    <th>اجمالي الفاتورة</th>
                    <th>الخصم </th>
                    <th>المدفوع </th>
                    <th>الارباح </th>
                    <th>الحالة</th>
                    <th>التاريخ</th>
                    <th> الغاء الفاتورة </th>
                    <th><i class="fa fa-trash"></i></th>
                </tr>
<?php else: ?>
                <tr>
                    <th>ID</th>
                    <th>Customer Name</th>
                    <th>User</th>
                    <th>Total</th>
                    <th>Discount </th>
                    <th>Paid </th>
                    <th>Profit </th>
                    <th>Status</th>
                    <th>Created At</th>
                    <th><i class="fa fa-trash"></i></th>
                </tr>
<?php endif; ?>


            </thead>
            <tbody >
                <?php
                $the_total = 0;
                $all_paid_total = 0;
                $the_discount = 0;
                $total_profit = 0;

                ?>
                <?php $__currentLoopData = $orders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $order): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

<?php 
$bankak_paid = \App\Models\Payment::where('order_id',$order->id)->first()->bankak;
$cash_paid = \App\Models\Payment::where('order_id',$order->id)->first()->cash;
$shake_paid = \App\Models\Payment::where('order_id',$order->id)->first()->shake;
$invoice_amount = \App\Models\Payment::where('order_id',$order->id)->first()->amount;


$all_paid = $bankak_paid + $cash_paid + $shake_paid;
?>


                <tr>
                    <td><a href="#" onclick="window.open('<?php echo url('admin/ticket/'); ?>/<?php echo $order->id; ?>','','width=400,height=500');"><?php echo e($order->id); ?></a></td>
                    <td><?php echo e($order->getCustomerName()); ?></td>
                    <td style="display: none;"><?php echo e($order->user->first_name); ?> <?php echo e($order->user->last_name); ?> </td>
                    <td><?php echo e(config('settings.currency_symbol')); ?> <?php echo e($order->formattedTotal()); ?></td>
                    <td><?php echo e(config('settings.currency_symbol')); ?> <?php echo e($order->discount); ?></td>
                  

                    <td><?php echo e(config('settings.currency_symbol')); ?> 

<?php echo e($all_paid); ?> 

                    </td>


                    <td style=""><?php echo e(config('settings.currency_symbol')); ?> 

<?php echo e($order->net_profit); ?> 

                    </td>


                    <td>

                        <?php if($all_paid == 0): ?>
                            <span class="badge badge-danger">غير مدفوع</span>
                        <?php elseif($all_paid < $order->total()): ?>
                            <span class="badge badge-warning">مدفوع جزئي</span>
                        <?php elseif($all_paid == $order->total()): ?>
                            <span class="badge badge-success">مدفوعة </span>
                        <?php elseif($all_paid > $order->total()): ?>
                            <span class="badge badge-info">لديه متبقي</span>
                        <?php endif; ?>
                    </td>
                    

                    <td><?php echo e($order->created_at); ?></td>

                    
                    

                    <td>
                        
                        <a onclick="return confirm('<?php echo __('هل انت متأكد ؟') ?>');" href="<?php echo e(url('refund')); ?>/<?php echo e($order->id); ?>">
                          <span class="badge badge-danger"><i class="fas fa-close"></i> الغاء الفاتورة </span>
                        </a>

                    </td>
                    <td> 


		
      <?php if(auth()->user()->id  == '4'): ?> 
                            <span class="btn btn-danger btn-sm" >
                                <form action="<?php echo e(url('/admin/orders/')); ?>/<?php echo e($order->id); ?>" method="post">
                                    <?php echo method_field('DELETE'); ?>
                                    <button onclick="return confirm('Are you sure you want to delete this ?');" style="border: 0px; background:none; color: white">
                                        <i class="fas fa-trash"></i>
                                        Delete</button>
                                    <?php echo csrf_field(); ?>
                                </form>


                            </span>
                       <?php endif; ?> 

                    </td>
                </tr>

                <?php 
                $all_paid_total = $all_paid_total + $all_paid;
                $the_total = $the_total + $order->total();
                $the_discount = $the_discount + $order->discount;
                $total_profit = $total_profit + $order->net_profit;
                ?>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
            <tfoot>
                <tr>
                    <th></th>
                    <th></th>
                    <th><?php echo e(config('settings.currency_symbol')); ?> <?php echo e(number_format($the_total, 2)); ?></th>
                    <th><?php echo e(config('settings.currency_symbol')); ?> <?php echo e(number_format($the_discount, 2)); ?></th>
                    
                    <th><?php echo e(config('settings.currency_symbol')); ?> <?php echo e(number_format($all_paid_total - $the_discount, 2)); ?></th>

 <th><?php echo e(config('settings.currency_symbol')); ?> <?php echo e(number_format($total_profit, 2)); ?></th>

                    <th></th>
                    <th></th>
                    <th></th>
                </tr>
            </tfoot>
        </table>
        <?php echo e($orders->render()); ?>


<?php /**PATH C:\xampp\php\pear\~\resources\views//orders/search_results.blade.php ENDPATH**/ ?>