<?php $__env->startSection('panel'); ?>
    <div class="container">
        <div class="order-details">
            <div class="order-details-top">
                <h6><?php echo app('translator')->get('Order Items'); ?></h6>
                <div>
                    <h5 class="order-details-id mb-1 d-flex align-items-center flex-wrap gap-3">
                        <span class="order-details-id"><?php echo app('translator')->get('Order ID'); ?>:</span> <?php echo e($order->order_number); ?>

                        <span>
                            <?php echo $order->paymentBadge() ?>
                            <?php echo $order->statusBadge() ?>
                        </span>
                    </h5>

                    <span> <?php echo e(showDateTime($order->created_at, 'F d, Y')); ?> <?php echo app('translator')->get('at'); ?> <?php echo e(showDateTime($order->created_at, 'h:i A')); ?> </span>
                </div>
            </div>

            <div class="order-details-products mb-3">
                <div class="table-responsive">
                    <table class="table table-bordered table--responsive--md">
                        <thead>
                            <tr>
                                <th><?php echo app('translator')->get('Product'); ?></th>
                                <th><?php echo app('translator')->get('Price'); ?></th>
                                <th><?php echo app('translator')->get('Quantity'); ?></th>
                                <th><?php echo app('translator')->get('Total Price'); ?></th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                                $subtotal = $order->orderDetail->sum(function ($detail) {
                                    return $detail->price * $detail->quantity;
                                });
                            ?>

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

                                <?php
                                    $mainImage = $data->productVariant && @$data->productVariant->main_image_id ? $data->productVariant->mainImage(true) : @$data->product->mainImage(true);
                                ?>

                                <tr>
                                    <td>
                                        <div class="single-product-item  align-items-center">
                                            <div class="thumb">
                                                <img class="lazyload" src="<?php echo e(getImage(null)); ?>" data-src="<?php echo e($mainImage); ?>" alt="product-image">
                                            </div>

                                            <div class="content d-flex flex-column">
                                                <?php echo e(@$data->product->name); ?>


                                                <?php if($data->productVariant): ?>
                                                    - <?php echo e(@$data->productVariant->name); ?>

                                                <?php endif; ?>

                                                <?php if($data->product->is_downloadable && $order->status == Status::ORDER_DELIVERED && $order->payment_status == Status::PAYMENT_SUCCESS): ?>
                                                    <a href="<?php echo e(route('user.order.item.download', encrypt($data->id))); ?>" class="fw-light text-decoration-underline"> <i class="la la-download"></i> <?php echo app('translator')->get('Download'); ?></a>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    </td>
                                    <td> <?php echo e(showAmount($data->price)); ?></td>
                                    <td><?php echo e($data->quantity); ?></td>
                                    <td class="text-end"><?php echo e(showAmount($data->price * $data->quantity)); ?></td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
            </div>

            <div class="row g-3 flex-md-row-reverse">
                <div class="col-md-6">
                    <div class="details-info-list">
                        <h6 class="mb-3"><?php echo app('translator')->get('Order Summary'); ?></h6>
                        <ul>
                            <li>
                                <span><?php echo app('translator')->get('Subtotal'); ?></span>
                                <span class="fw-semibold"><?php echo e(showAmount($subtotal, 2)); ?></span>
                            </li>
                            <?php if($order->appliedCoupon): ?>
                                <li>
                                    <span>(<i class="la la-minus"></i>) <?php echo app('translator')->get('Coupon'); ?> (<?php echo e($order->appliedCoupon->coupon->coupon_code); ?>)</span>
                                    <span> <?php echo e(showAmount($order->appliedCoupon->amount, 2)); ?></span>
                                </li>
                            <?php endif; ?>

                            <li>
                                <span>(<i class="la la-plus"></i>) <?php echo app('translator')->get('Shipping'); ?></span>
                                <span><?php echo e(@gs('cur_sym') . getAmount($order->shipping_charge, 2)); ?></span>
                            </li>

                            <li class="total">
                                <span><?php echo app('translator')->get('Total'); ?></span>
                                <span><?php echo e(showAmount($order->total_amount)); ?></span>
                            </li>
                        </ul>
                    </div>

                    <?php if(isset($order->deposit) && $order->deposit->status != 0): ?>
                        <div class="details-info-list">
                            <h6 class="mb-3"><?php echo app('translator')->get('Payment Details'); ?></h6>
                            <ul>
                                <li>
                                    <span><?php echo app('translator')->get('Payment Method'); ?></span>
                                    <span>
                                        <?php if($order->deposit->method_code == 0): ?>
                                            <?php echo app('translator')->get('Cash On Delivery'); ?>
                                        <?php else: ?>
                                            <?php echo e(__($order->deposit->gateway->name)); ?>

                                        <?php endif; ?>
                                    </span>
                                </li>

                                <li>
                                    <span><?php echo app('translator')->get('Total Bill'); ?></span>
                                    <span><?php echo e(showAmount($order->total_amount)); ?></span>
                                </li>

                                <?php if(@$order->deposit->charge > 0): ?>
                                    <li>
                                        <span><?php echo app('translator')->get('Gateway Charge'); ?></span>
                                        <span><?php echo e(gs('cur_sym') . getAmount(@$order->deposit->charge)); ?></span>
                                    </li>
                                <?php endif; ?>

                                <li class="total">
                                    <span><?php echo app('translator')->get('Total Payable Amount'); ?> </span>
                                    <span><?php echo e(gs('cur_sym') . getAmount($order->deposit->amount + @$order->deposit->charge)); ?></span>
                                </li>

                            </ul>
                        </div>
                    <?php endif; ?>
                </div>
                <?php
                    $shippingAddress = $order->shipping_address ? json_decode($order->shipping_address) : null;
                ?>
                <div class="col-md-6">
                    <?php if($shippingAddress): ?>
                        <div class="details-info-address">

                            <h6 class="mb-3"><?php echo app('translator')->get('Shipping Details'); ?></h6>
                            <ul class="info-address-list">
                                <li>
                                    <span class="title"><?php echo app('translator')->get('Name'); ?> </span>
                                    <span>
                                        <span class="devide-colon">:</span>
                                        <?php echo e($order->user->firstname); ?> <?php echo e($order->user->lastname); ?>

                                    </span>
                                </li>
                                <li>
                                    <span class="title"><?php echo app('translator')->get('Address'); ?></span>
                                    <span>
                                        <span class="devide-colon">:</span>
                                        <?php echo e($shippingAddress->address); ?>

                                    </span>
                                </li>
                                <li>
                                    <span class="title"><?php echo app('translator')->get('State'); ?></span>
                                    <span>
                                        <span class="devide-colon">:</span>
                                        <?php echo e($shippingAddress->state); ?>

                                    </span>
                                </li>
                                <li>
                                    <span class="title"><?php echo app('translator')->get('City'); ?></span>
                                    <span>
                                        <span class="devide-colon">:</span>
                                        <?php echo e($shippingAddress->city); ?>

                                    </span>
                                </li>
                                <li>
                                    <span class="title"><?php echo app('translator')->get('Zip'); ?></span>
                                    <span>
                                        <span class="devide-colon">:</span>
                                        <?php echo e($shippingAddress->zip); ?>

                                    </span>
                                </li>
                                <li>
                                    <span class="title"><?php echo app('translator')->get('Country'); ?></span>
                                    <span>
                                        <span class="devide-colon">:</span>
                                        <?php echo e($shippingAddress->country); ?>

                                    </span>
                                </li>
                            </ul>
                        </div>
                    <?php endif; ?>
                </div>
            </div>

            <div class="mt-3 text-end">
                <a href="<?php echo e(route('user.print.invoice', $order->id)); ?>" target=blank class="btn btn-lg btn-outline--light"><i class="la la-print"></i> <?php echo app('translator')->get('Print'); ?></a>
            </div>
        </div>
    </div>

<?php $__env->stopSection(); ?>

<?php echo $__env->make($activeTemplate . 'layouts.user', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/creativedesignbd/ecommerce7.creativedesign.com.bd/core/resources/views/templates/basic/user/orders/details.blade.php ENDPATH**/ ?>