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

    <style>
        @media print {
            .img img {
                width: 50px;
                height: 50px;
                object-fit: contain;
                border: 1px solid #9993;
                border-radius: 10px;
                padding: 5px;
            }
            #printButn{
                display: none !important;
            }
            .qr_box img {
                width: 100px;
                display: block;
                margin: auto;
                object-fit: contain;
            }
            .order-head .li {
                font-size: 10px;
            }
        }
    </style>
    <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 ">
        <div class="container">
            <div id="printable">
                <div class="order-details" >
                    <div class="row justify-content-center">
                        <div class="col-lg-10">
                            <div class="order-head">
                                <div class="row">
                                    <div class="col-lg-6">
                                        <p> <?php echo e(__('web.order_id')); ?>   : <b><?php echo e($order->id); ?></b></p>
                                    </div>
                                    <div class="col-lg-6">
                                        <p> <?php echo e(__('web.order_date')); ?>  : <b><?php echo e($order->date); ?></b></p>
                                    </div>
                                    <div class="col-lg-6">
                                        <p> <?php echo e(__('web.order_status')); ?> :  <b><?php echo e(__('orders.statuses.'.$order->status)); ?></b></p>
                                    </div>
                                    <div class="col-lg-6">
                                        <p><?php echo e(__('web.way_pay')); ?> :  <b><?php echo e($order->way->currentDescription->title); ?></b></p>
                                    </div>
                                    <div class="col-lg-6">
                                        <p> <?php echo e(__('web.address_name')); ?>   :  <b> <?php echo e($order->address->name); ?>  </b></p>
                                    </div>
                                    <div class="col-lg-6">
                                        <p> <?php echo e(__('web.address_details')); ?>   :  <b><?php echo e($order->address->address); ?> </b></p>
                                    </div>


                                </div>

                            </div>
                        </div>
                    </div>
                    <div class="order-body">
                        <div class="table_box mb-5 py-0">
                            <div class="table-responsive">
                                <table class="table table-bordered mb-0">
                                    <thead>
                                    <tr>
                                        <th scope="col">  <?php echo e(__('web.product_image')); ?>  </th>
                                        <th scope="col">  <?php echo e(__('web.product_name')); ?>  </th>
                                        <th scope="col"><?php echo e(__('web.quantity')); ?></th>
                                        <th scope="col"> <?php echo e(__('web.cost')); ?> </th>
                                        <th scope="col"> <?php echo e(__('web.rate')); ?>  </th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php $__currentLoopData = $order->products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <td>
                                                <div class="img">
                                                    <img src="<?php echo e(asset($row->product->image)); ?>" alt="">
                                                </div>
                                            </td>
                                            <td>  <?php echo e($row->product->currentDescription->title); ?> <?php if($row->sub_attribute_id): ?> - <?php echo e($row->mainAttr->currentDescription->title); ?> - <?php echo e($row->subAttr->currentDescription->title); ?> <?php endif; ?>  </td>
                                            <td><?php echo e($row->count); ?></td>
                                            <td><?php echo e($row->total); ?> <?php echo e(__('web.sar')); ?> </td>
                                            <?php if($row->product->canRate): ?>
                                                <td>
                                                    <button type="button" onclick="rateProduct(this)" data-id="<?php echo e($row->product_id); ?>" class="small color-primary"  data-bs-toggle="modal" data-bs-target="#rateModal">
                                                        <?php echo e(__('web.rate')); ?>

                                                    </button>
                                                </td>
                                            <?php else: ?>
                                                <td>
                                                    <?php echo e(__('web.rated')); ?>

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

                                    </tbody>
                                </table>
                            </div>
                        </div>

                    </div>

                </div>
                <div class="order_foot col-lg-10 mx-auto">
                    <div class="row justify-content-between">
                        <div class="col-lg-7">
                            <div class="pay_box">
                                <ul>
                                    <li>
                                        <span class="label"> <?php echo e(__('web.total_products')); ?> </span>
                                        <span> <b class="color-primary"><?php echo e($row->total_products); ?></b> <smal><?php echo e(__('web.sar')); ?> </smal></span>
                                    </li>
                                    <?php if($order->coupon_id): ?>
                                        <li>
                                            <span class="label"><?php echo e(__('web.discount')); ?>    </span>
                                            <span> <b class="color-primary"><?php echo e($order->discount); ?></b> <smal><?php echo e(__('web.sar')); ?> </smal></span>
                                        </li>
                                    <?php endif; ?>
                                    <li>
                                        <span class="label"> <?php echo e(__('web.total_tax')); ?>     </span>
                                        <span> <b class="color-primary"><?php echo e($row->total_tax); ?></b> <smal><?php echo e(__('web.sar')); ?> </smal></span>
                                    </li>
                                    <li>
                                        <span class="label"> <?php echo e(__('web.total_products_tax')); ?> </span>
                                        <span> <b class="color-primary"><?php echo e($row->total_products + $row->total_tax); ?></b> <smal><?php echo e(__('web.sar')); ?> </smal></span>
                                    </li>

                                    <?php if($order->on_hand_cost): ?>
                                    <li>
                                            <span class="label"> <?php echo e(__('web.on_hand_cost')); ?></span>
                                            <span> <b class="color-primary"><?php echo e($row->on_hand_cost); ?></b> <smal><?php echo e(__('web.sar')); ?> </smal></span>
                                        </li>
                                    <?php endif; ?>
                                    <li>
                                        <span class="label"> <?php echo e(__('web.shipping_cost')); ?> </span>
                                        <span> <b class="color-primary"><?php echo e($row->shipping_cost); ?></b> <smal><?php echo e(__('web.sar')); ?> </smal></span>
                                    </li>
                                    <li>
                                        <span class="label"><?php echo e(__('web.full_total')); ?>   </span>
                                        <span> <b class="color-primary"><?php echo e($order->total); ?></b> <smal><?php echo e(__('web.sar')); ?> </smal></span>
                                    </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="text-center mt-5">
                    <a href="<?php echo e(route('web.bill',$order->id)); ?>" class="butn primary_butn"> <?php echo e(__('web.bill')); ?> </a>
                </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/flower/resources/views/web/pages/orders/details.blade.php ENDPATH**/ ?>