

<?php $__env->startSection('title','Order Details'); ?>
<?php $__env->startSection('page-title','Order Details'); ?>

<?php $__env->startSection('content'); ?>

<div class="container-fluid">

    <div class="card shadow">

        <div class="card-header bg-primary text-white d-flex justify-content-between">

            <h4 class="mb-0">
                <i class="fas fa-file-invoice"></i>
                Order #<?php echo e($order->id); ?>

            </h4>

            <a href="<?php echo e(route('admin.new-sale')); ?>"
               class="btn btn-light btn-sm">

                <i class="fas fa-arrow-left"></i>

                Back

            </a>

        </div>

        <div class="card-body">

            <div class="row">

                <!-- Customer -->

                <div class="col-md-6">

                    <h5 class="border-bottom pb-2">

                        Customer Information

                    </h5>

                    <table class="table table-borderless">

                        <tr>
                            <th width="35%">Name</th>
                            <td>
                                <strong><?php echo e($order->customer->name); ?></strong><br>
                                <small class="text-muted"> <?php echo e($order->customer->urdu_name ?? ''); ?>

                           </td>
                            
                        </tr>

                        <tr>
                            <th>Phone</th>
                            <td><?php echo e($order->customer->phone); ?></td>
                        </tr>

                        <tr>
                            <th>Address</th>
                            <td>
                                <strong><?php echo e($order->customer->address); ?></strong><br>
                                <small class="text-muted"> <?php echo e($order->customer->urdu_address ?? ''); ?>

                            </td>
                        </tr>

                    </table>

                </div>

                <!-- Order -->

                <div class="col-md-6">

                    <h5 class="border-bottom pb-2">

                        Order Information

                    </h5>

                    <table class="table table-borderless">

                        <tr>
                            <th width="40%">Order Date</th>
                            <td><?php echo e($order->order_date->format('d M Y h:i A')); ?></td>
                        </tr>

                        <tr>
                            <th>Payment Status</th>
                            <td>

                                <span class="badge bg-success">

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


                                </span>

                            </td>
                        </tr>

                        

                        <tr>
                            <th>Paid Amount</th>
                            <td>Rs. <?php echo e(number_format($order->paid_amount,2)); ?></td>
                        </tr>

                    </table>

                </div>

            </div>

            <hr>

            <h5>

                Products

            </h5>

            <div class="table-responsive">

                <table class="table table-bordered">

                    <thead class="table-dark">

                    <tr>

                        <th>#</th>

                        <th>Product</th>

                        <th>Description</th>

                        <th>Price</th>

                        <th>Qty</th>

                        <th>Discount</th>

                        <th>Total</th>

                    </tr>

                    </thead>

                    <tbody>

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

                        <tr>

                            <td><?php echo e($loop->iteration); ?></td>

                            <td>
                                <strong><?php echo e($item->product->name); ?></strong>
                                 <?php if($item->product->category==2): ?>
                                     <strong>
                                         (<?php echo e($item->days); ?>days)
                                     </strong>
                                  <?php endif; ?>
                                <br>
                               <small class="text-muted"> <?php echo e($item->product->name_urdu ?? ''); ?></small>
                            </td>

                            <td><?php echo e($item->description); ?></td>

                            <td>Rs. <?php echo e(number_format($item->price,2)); ?></td>

                            <td><?php echo e($item->qty); ?></td>

                            <td>Rs. <?php echo e(number_format($item->discount,2)); ?></td>

                            <td>

                                <strong>

                                    Rs. <?php echo e(number_format($item->total,2)); ?>


                                </strong>

                            </td>

                        </tr>

                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                    </tbody>

                </table>

            </div>

            <div class="row mt-4">

                <div class="col-md-4 ms-auto">

                    <table class="table">

                        <tr>

                            <th>Subtotal</th>

                            <td class="text-end">

                                Rs. <?php echo e(number_format($order->subtotal,2)); ?>


                            </td>

                        </tr>

                        <tr>

                            <th>Cariage</th>

                            <td class="text-end">

                                Rs. <?php echo e(number_format($order->carriage,2)); ?>


                            </td>

                        </tr>

                        

                        <tr class="table-success">

                            <th>Grand Total</th>

                            <td class="text-end">

                                <strong>

                                    Rs. <?php echo e(number_format($order->grand_total,2)); ?>


                                </strong>

                            </td>

                        </tr>

                        <tr>

                            <th>Paid</th>

                            <td class="text-end">

                                Rs. <?php echo e(number_format($order->paid_amount,2)); ?>


                            </td>

                        </tr>

                        <tr class="table-warning">

                            <th>Remaining</th>

                            <td class="text-end">

                                <strong>

                                    Rs. <?php echo e(number_format($order->grand_total-$order->paid_amount,2)); ?>


                                </strong>

                            </td>

                        </tr>

                    </table>

                </div>

            </div>

            <a href="<?php echo e(route('admin.order.invoice', $order->id)); ?>"
                 class="btn btn-sm btn-outline-success"
                 target="_blank">
                  <i class="las la-print"></i> Print Bill
              </a>

        </div>

    </div>

</div>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layout.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\wamp64\www\alifoods\resources\views/admin/partials/customer_order_detail.blade.php ENDPATH**/ ?>