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

    <main>
        <!-- Start pg_header -->
    <?php echo $__env->make('web.pages.components.header.header', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

    <!-- Start section -->
    <section class="order_det_pg section py-5">
        <div class="container">
            <div class="order-details" id="printable">
                <div class="row justify-content-center">
                    <div class="col-lg-10">
                        <div class="order-head mb-4">
                            <div class="row">
                                <div class="col-md-6">
                                    <p><?php echo e(__('web.order_id')); ?>  : <span><?php echo e($order->id); ?></span></p>
                                </div>
                                <div class="col-md-6">
                                    <p> <?php echo e(__('web.order_date')); ?>    : <span><?php echo e($order->date); ?></span></p>
                                </div>
                                <div class="col-md-6">
                                    <p> <?php echo e(__('web.order_status')); ?>   : <span><?php echo e(__('orders.statuses.'.$order->status)); ?></span></p>
                                </div>
                                <div class="col-md-6">
                                    <p>
                                        <?php echo e(__('web.payment_status')); ?>   : <span><?php echo e(__('orders.payment_statuses.'.$order->payment_status)); ?></span>
                                    </p>

                                </div>
                                <div class="col-md-6">
                                    <p>
                                        <?php echo e(__('web.way_pay')); ?>   : <span> <?php echo e($order->way->currentDescription->title); ?></span>
                                    </p>

                                </div>
                                <div class="col-md-6">
                                    <p>
                                        <?php echo e(__('web.way_shipping')); ?>   : <span> <?php echo e($order->shipping->currentDescription->title); ?></span>
                                    </p>

                                </div>
                            </div>

                        </div>
                    </div>
                </div>
                <div class="order-body">
                    <div class="checkout_pg">
                        <div class="box">
                            <div class="table-responsive">
                                <table class="table mt-5">
                                    <thead>
                                    <tr>
                                        <th><?php echo e(__('web.product_image')); ?></th>
                                        <th><?php echo e(__('web.product_name')); ?></th>
                                        <th><?php echo e(__('web.product_code')); ?></th>
                                        <th><?php echo e(__('web.quantity')); ?></th>
                                        <th><?php echo e(__('web.total')); ?></th>
                                        <th></th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php $__currentLoopData = $order->products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <td>
                                                <img src="<?php echo e($row->product->image); ?>" class="prodImg" alt=""/>
                                            </td>
                                            <td><?php echo e($row->product->currentDescription->title); ?> </td>
                                            <td>#<?php echo e($row->product->code); ?></td>
                                            <td><?php echo e($row->count); ?></td>
                                            <td><b> <?php echo e($row->total); ?> <?php echo e(__('web.sar')); ?></b></td>
                                            <?php if($row->product->canRate): ?>
                                                <td>
                                                    <a href="#" class="small color-primary" onclick="rateProduct(this)" data-id="<?php echo e($row->product_id); ?>" data-bs-toggle="modal" data-bs-target="#rateModal">
                                                        <?php echo e(__('web.rate')); ?>

                                                    </a>
                                                </td>
                                            <?php endif; ?>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                    </div>

                    <div class="row justify-content-between">
                        <div class="col-lg-7">
                            <div class="pay_box">
                                <ul>
                                    <li>
                                        <span> <?php echo e(__('web.total_products')); ?>  </span>
                                        <strong> <?php echo e($order->total_products); ?> <?php echo e(__('web.sar')); ?> </strong>
                                    </li>
                                    <li>
                                        <span> <?php echo e(__('web.total_tax')); ?>  </span>
                                        <strong> <?php echo e($order->total_tax); ?> <?php echo e(__('web.sar')); ?> </strong>
                                    </li>
                                    <li>
                                        <span> <?php echo e(__('web.shipping_cost')); ?>  </span>
                                        <strong> <?php echo e($order->shipping_cost); ?> <?php echo e(__('web.sar')); ?> </strong>
                                    </li>
                                    <?php if($order->on_hand_cost): ?>
                                        <li>
                                            <span>  <?php echo e(__('web.on_hand_cost')); ?>  </span>
                                            <strong> <?php echo e($order->on_hand_cost); ?> <?php echo e(__('web.sar')); ?> </strong>
                                        </li>
                                    <?php endif; ?>
                                    <?php if($order->discount): ?>
                                        <li>
                                            <span> <?php echo e(__('web.discount')); ?>  </span>
                                            <strong> <?php echo e($order->discount); ?> <?php echo e(__('web.sar')); ?> </strong>
                                        </li>
                                    <?php endif; ?>
                                    <li>
                                        <span> <?php echo e(__('web.full_total')); ?> </span>
                                        <strong> <?php echo e($order->total); ?> <?php echo e(__('web.sar')); ?> </strong>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class="col-lg-5">
                            <div class="qr_box">
                                <img src="<?php echo e(asset($order->qr_image)); ?>" alt="" class="qr_img sec-img"/>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-3 col-md-5 mt-5 m-auto">

                </div>
                <div class="text-center mt-5">
                    <button type="button" class="butn primary_butn d-inline-block" id="printButn"> <?php echo e(__('web.print_bill')); ?>  </button>
                </div>
            </div>
        </div>
    </section>

</main>

    <div class="modal  rateModal fade" id="rateModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered modal-lg">
            <div class="modal-content">
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                <div class="modal-body">
                    <div class="content text-center mt-4">
                        <h4 class="title text-dark mb-4"><b>  <?php echo e(__('web.product_rate')); ?>  </b></h4>
                        <form method="post" action="<?php echo e(route('web.rate')); ?>" onsubmit="formAction(this)">
                            <?php echo csrf_field(); ?>
                            <input type="hidden" name="product_id" id="product_id">
                            <div class="stars-content mb-5">
                                <div class="star-rating">
                                    <input type="radio" id="5-stars" name="rate" value="5" />
                                    <label for="5-stars" class="star"><i class="fas fa-star"></i></label>
                                    <input type="radio" id="4-stars" name="rate" value="4" />
                                    <label for="4-stars" class="star"><i class="fas fa-star"></i></label>
                                    <input type="radio" id="3-stars" name="rate" value="3" />
                                    <label for="3-stars" class="star"><i class="fas fa-star"></i></label>
                                    <input type="radio" id="2-stars" name="rate" value="2" />
                                    <label for="2-stars" class="star"><i class="fas fa-star"></i></label>
                                    <input type="radio" id="1-star" name="rate" value="1" />
                                    <label for="1-star" class="star"><i class="fas fa-star"></i></label>
                                </div>
                            </div>
                            <div class="form-group col-md-10 m-auto">
                                <h6 class="title mb-3"> <?php echo e(__('web.write_your_comment')); ?>  </h6>
                                <textarea name="comment" class="form-control" placeholder="  <?php echo e(__('web.write_here')); ?>  " rows="7"></textarea>
                            </div>
                            <div class="d-flex justify-content-center align-items-center justify-content-center mt-5 ">
                                <button type="button" class="butn btn-secondary  mx-1" data-bs-dismiss="modal"><?php echo e(__('web.close')); ?></button>
                                <button type="submit" class="butn primary_butn mx-1"><?php echo e(__('web.send')); ?></button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

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

<?php $__env->startSection('inject_js'); ?>
    <script>
        $(function() {
            $("#printable").find('#printButn').on('click', function() {
                $.print("#printable");
            });
        });
        function rateProduct(elem)
        {
            let id = $(elem).attr('data-id')
            $('#product_id').val(id)
        }
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('web.layouts.layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Applications/MAMP/htdocs/electric/resources/views/web/pages/orders/details.blade.php ENDPATH**/ ?>