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

<section class="headerbg headerbg-inner">
    <div class="header header-padding">
        <?php echo $__env->make('partials.site.header-menu', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    </div>
    <div class="inner-heading"><?php echo e(__('lang.my_order_title')); ?></div>
</section>
<section class="youracc-bg">
    <div class="container">
        <div class="row">
            <div class="col-md-3">
                <?php echo $__env->make('partials.site.user-links', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
            </div>
            <div class="col-md-6">
                <?php if(Session::has('message')): ?>
                <div class="row">
                    <div class="col-lg-12">
                        <div class="alert alert-success" role="alert">
                          <?php echo e(Session::get('message')); ?>

                        </div>
                    </div>
                </div>
                <?php endif; ?>
                <?php if(Session::has('error')): ?>
                <div class="row">
                    <div class="col-lg-12">
                        <div class="alert alert-danger" role="alert">
                          <?php echo e(Session::get('error')); ?>

                        </div>
                    </div>
                </div>
                <?php endif; ?>
                <div class="order-tracking-bg">
                    <div class="order-tracking order-tracking-bg">
                        <ul>
                            <li class="active mt-10">
                                <span><img src="<?php echo e(asset('site-assets/images/icon-store.png')); ?>"  /></span>
                                <h4><?php echo e(__('lang.your_order_received')); ?></h4>
                                <p>
                                    <?php echo e(\Helpers::commonDateFormate($data->updated_at)); ?> <br />
                                    <?php echo e(\Helpers::commonTimeFormate($data->updated_at)); ?>

                                </p>
                            </li>
                            <li class="middle-li-margin middle-option">
                                <span class="pt-23"><img src="<?php echo e(asset('site-assets/images/icon-delivery.png')); ?>"  /></span>
                                <h4><?php echo e(__('lang.your_order_on_the_way')); ?></h4>
                            </li>
                            <li>
                                <span class="pt-23"><img src="<?php echo e(asset('site-assets/images/path.png')); ?>"  /></span>
                                <h4><?php echo e(__('lang.your_order_delivered')); ?></h4>
                            </li>
                        </ul>
                    </div>
                    <!-- <div class="order-tracking-table">
                        <table>
                            <tr>
                                <th width="33.3%"><?php echo e(__('lang.cart_total')); ?></th>
                                <th width="33.3%"><?php echo e(__('lang.your_order_expected')); ?></th>
                                <th width="33.3%"><?php echo e(__('lang.navigation_payment')); ?></th>
                            </tr>
                            <tr>
                                <td><?php echo e(\Helpers::currency($data->final_amount)); ?></td>
                                <td><?php echo e(isset($data->product_orders[0])?(isset($data->product_orders[0]->product_deliverys[0]))?\Helpers::commonDateFormate($data->product_orders[0]->product_deliverys[0]->delivery_date):'--':'--'); ?></td>
                                <td><?php if($data->payment): ?> <?php echo e($data->payment->status); ?> <?php else: ?> -- <?php endif; ?></td>
                            </tr>
                        </table>
                    </div> -->
                </div>
                <div class="delvery-details">
                    <ul>
                        <li>
                            <h4><?php echo e(__('lang.your_order_delivery_address')); ?></h4>
                            <?php if($data->delivery_address): ?>
                            <?php echo e($data->delivery_address->google_address); ?>

                            <br>
                            <?php echo e(__('lang.note')); ?> <?php echo e($data->delivery_address->note); ?>

                            <?php else: ?>
                            --
                            <?php endif; ?>
                        </li>
                        <li>
                            <h4><?php echo e(__('lang.phone')); ?></h4>
                            <?php echo e($data->user->phone); ?>

                        </li>
                        <li>
                            <h4><?php echo e(__('lang.your_order_delivery_time')); ?></h4>
                            <?php if(isset($data->time_slots)): ?> <b><?php echo e($data->time_slots->name); ?></b> <?php echo e(date('h:i A',strtotime($data->time_slots->from_time))); ?> - <?php echo e(date('h:i A',strtotime($data->time_slots->to_time))); ?> <?php endif; ?>
                        </li>
                        <li>
                            <h4><?php echo e(__('lang.Payment_method')); ?></h4>
                            <?php echo e($data->payment_method); ?>

                        </li>
                        <li>
                            <h4><?php echo e(__('lang.your_order_time')); ?></h4>
                            <?php echo e(\Helpers::commonDateTimeFormate($data->created_at)); ?>

                        </li>
                    </ul>
                </div>
                <!-- <div class="order-tracking-table">
                    <table>
                        <tr>
                            <th width="33.3%"><?php echo e(__('lang.cart_total')); ?></th>
                            <th width="33.3%"><?php echo e(__('lang.your_order_expected')); ?></th>
                            <th width="33.3%"><?php echo e(__('lang.navigation_payment')); ?></th>
                        </tr>
                        <tr>
                            <td><?php echo e(\Helpers::currency($data->final_amount)); ?></td>
                            <td><?php echo e(isset($data->product_orders[0])?(isset($data->product_orders[0]->product_deliverys[0]))?\Helpers::commonDateFormate($data->product_orders[0]->product_deliverys[0]->delivery_date):'--':'--'); ?></td>
                            <td><?php if($data->payment): ?> <?php echo e($data->payment->status); ?> <?php else: ?> -- <?php endif; ?></td>
                        </tr>
                    </table>
                </div> -->
                <div class="order-tracking-table" style="border-bottom: solid 1px #e1e6eb;">
                    <div class="col-md-12" style="display: flex;padding-left: 0px;padding-right: 0px;line-height: 1;">
                        <div class="col-md-6 text-align-left" style="padding-left: 0px;padding-right: 0px;">
                            <p style="color: #748a9d;font-size: 20px;"><?php echo e(__('lang.sub_total')); ?></p>
                        </div>
                        <div class="col-md-6 text-align-right" style="padding-left: 0px;padding-right: 0px;">
                            <p style="color: #748a9d;font-size: 20px;"><?php echo e(\Helpers::currency($data->subtotal)); ?></p>
                        </div>
                    </div>
                    <div class="col-md-12" style="display: flex;padding-left: 0px;padding-right: 0px;line-height: 1;">
                        <div class="col-md-6 text-align-left" style="padding-left: 0px;padding-right: 0px;">
                            <p style="color: #748a9d;font-size: 20px;"><?php echo e(__('lang.vat')); ?></p>
                        </div>
                        <div class="col-md-6 text-align-right" style="padding-left: 0px;padding-right: 0px;">
                            <p style="color: #748a9d;font-size: 20px;"><?php echo e(\Helpers::currency($data->tax)); ?></p>
                        </div>
                    </div>
                    <div class="col-md-12" style="display: flex;padding-left: 0px;padding-right: 0px;line-height: 1;">
                        <div class="col-md-6 text-align-left" style="padding-left: 0px;padding-right: 0px;">
                            <p style="margin-bottom: 10px;color: #748a9d;font-size: 20px;"><?php echo e(__('lang.delivery')); ?></p>
                        </div>
                        <div class="col-md-6 text-align-right" style="padding-left: 0px;padding-right: 0px;">
                            <p style="margin-bottom: 10px;color: #748a9d;font-size: 20px;"><?php echo e(__('lang.standard_free_delivery')); ?></p>
                        </div>
                    </div>
                </div>
                <div class="order-tracking-table" style="border-bottom: solid 1px #e1e6eb;">
                    <div class="col-md-12" style="display: flex;padding-left: 0px;padding-right: 0px;line-height: 1;padding-top: 15px;">
                        <div class="col-md-6 text-align-left" style="padding-left: 0px;padding-right: 0px;">
                            <p style="color: #748a9d;font-size: 20px;"><?php echo e(__('lang.coupon_discount')); ?></p>
                        </div>
                        <div class="col-md-6 text-align-right" style="padding-left: 0px;padding-right: 0px;">
                            <p style="font-weight: bold;color: #06283d;font-size: 20px;">-<?php echo e(\Helpers::currency($data->promotional_disount)); ?></p>
                        </div>
                    </div>
                </div>
                <div class="order-tracking-table">
                    <div class="col-md-12" style="display: flex;padding-left: 0px;padding-right: 0px;line-height: 1;padding-top: 15px;">
                        <div class="col-md-6 text-align-left" style="padding-left: 0px;padding-right: 0px;">
                            <h1 style="font-weight: bold;color:#06283d;"><?php echo e(__('lang.total')); ?></h1>
                        </div>
                        <div class="col-md-6 text-align-right" style="padding-left: 0px;padding-right: 0px;">
                            <h1 style="font-weight: bold;color:#06283d;"><?php echo e(\Helpers::currency($data->final_amount)); ?></h1>
                        </div>
                    </div>
                </div>
                <!-- <?php 
                $allow = 0;
                ?>
                <?php if(count($data->delivered_products)>0): ?>
                <?php $__currentLoopData = $data->delivered_products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $delivery): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php
                if((strtotime($delivery['date'])>strtotime(date("Y-m-d H:i:s")))){
                    $allow = 1;  
                }
                ?>
                <div class="item-status">
                    <div class="item-status-left">
                        <h6><?php echo e(__('lang.items')); ?></h6>
                    </div>
                    <div class="item-status-right">
                        <h6><?php echo e(__('lang.status')); ?></h6>
                    </div>
                    <?php $__currentLoopData = $delivery['data']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="item-status-left">
                            <p><?php echo e(($product->product_orders)?($product->product_orders->product)?$product->product_orders->product->name:'--':'--'); ?>: x <?php echo e(($product->product_orders)?$product->product_orders->quantity:'--'); ?></p>
                        </div>
                        <div class="item-status-right">
                            <p><?php echo e(($product->delivery_status)?$product->delivery_status->status:'--'); ?></p>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    <div class="item-status-left" style="margin-top:10px;">
                        <p><b><?php echo e(__('lang.date')); ?></b> <?php echo e(\Helpers::commonDateFormate($delivery['date'])); ?></p>
                    </div>
                    <div class="item-status-right">
                    </div>
                </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                <?php endif; ?>-->
                <?php if($data->cancel_request): ?>
                    <div class="savebtn pl-0">
                        <?php if($data->cancel_request->status==0): ?>
                            <p class="btn btn-secondary"><?php echo e(__('lang.cancel_request_already_submited')); ?></p>
                        <?php elseif($data->cancel_request->status==2): ?>
                            <p class="btn btn-danger"><?php echo e(__('lang.cancel_request_declined_by_admin')); ?></p>
                        <?php elseif($data->cancel_request->status==1 && $data->cancel_request->refund_status==1): ?>
                            <?php if($data->payment_method!='cash'): ?>
                                <p class="btn btn-success"><?php echo e(__('lang.cancel_request_approved_and_refunded')); ?></p>
                            <?php else: ?>
                                <p class="btn btn-success"><?php echo e(__('lang.cancel_request_approved')); ?></p>
                            <?php endif; ?>
                        <?php elseif($data->cancel_request->status==1 && $data->cancel_request->refund_status==0): ?>
                            <?php if($data->payment_method!='cash'): ?>
                                <p class="btn btn-info"><?php echo e(__('lang.cancel_request_approved')); ?></p>
                            <?php else: ?>
                                <p class="btn btn-success"><?php echo e(__('lang.cancel_request_approved')); ?></p>
                            <?php endif; ?>
                        <?php endif; ?>
                    </div>
                <?php elseif(!$allow): ?>
                <div class="savebtn pl-0">
                    <p class="btn btn-danger"><?php echo e(__('lang.cancel_request_not_allowed')); ?></p>
                </div>
                <?php else: ?>
                <div class="savebtn pl-0">
                    <a href="<?php echo e(url('/cancel-order-request/'.$data->id)); ?>" onclick="return confirm('<?php echo e(__('lang.are_you_sure_you_want_to_cancel_order')); ?>');"><?php echo e(__('lang.cancel_order')); ?>&nbsp;&nbsp;<img src="<?php echo e(asset('site-assets/images/arrowright.png')); ?>" class="mt-n-1" /></a>
                </div>
                <?php endif; ?> 
            </div>
            <div class="col-md-3">
                <div class="itemno">
                    <h5><?php echo e(__('lang.no_of_items')); ?> <?php echo e(count($data->product_orders)); ?> <?php echo e(__('lang.items')); ?></h5>
                    <?php $__currentLoopData = $data->product_orders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $productInfo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="itemno-details">
                        <div class="itemno-details-left">
                            <img src="<?php echo e(asset('app-assets/images/products/'.$productInfo->product->image)); ?>"  />
                            <p><?php echo e($productInfo->product->name); ?></p>
                            <p><?php echo e(__('lang.order_qty')); ?> <?php echo e($productInfo->quantity); ?></p>
                        </div>
                        <div class="itemno-details-right">
                            <h6 style="text-transform:capitalize;">(<?php echo e($productInfo->order_frequency); ?>)</h6>
                            <?php if($productInfo->order_frequency!='once'): ?>
                            <p>
                                <?php echo e(__('lang.start_date')); ?> 
                                <?php if(isset($productInfo->start_date)): ?>
                                    <?php echo e(\Helpers::commonDateFormate($productInfo->start_date)); ?>

                                <?php else: ?>
                                    <?php if(isset($productInfo->product_deliverys[0])): ?>
                                        <?php echo e(\Helpers::commonDateFormate($productInfo->product_deliverys[0]->delivery_date)); ?>

                                    <?php else: ?>
                                        --
                                    <?php endif; ?>
                                <?php endif; ?>
                            </p>
                            <p>
                                <?php echo e(__('lang.end_date')); ?> 
                                <?php if(isset($productInfo->end_date)): ?>
                                    <?php echo e(\Helpers::commonDateFormate($productInfo->end_date)); ?>

                                <?php else: ?>
                                    <?php if($productInfo->product_deliverys): ?>
                                        <?php if(isset($productInfo->product_deliverys[count($productInfo->product_deliverys)-1])): ?>
                                            <?php echo e(\Helpers::commonDateFormate($productInfo->product_deliverys[count($productInfo->product_deliverys)-1]->delivery_date)); ?>

                                        <?php else: ?>
                                            --
                                        <?php endif; ?>
                                    <?php else: ?>
                                        --
                                    <?php endif; ?>
                                <?php endif; ?>
                            </p>
                            <?php endif; ?>
                        </div>
                    </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </div>
        </div>
    </div>
</section>
<style type="text/css">
    .item-status-right p {
        margin: 0;
    }
</style>
<footer class="footer">
    <?php echo $__env->make('partials.site.footer', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
</footer>
<!-- END: Content-->
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.site-app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/waterfl/public_html/resources/views/order-details.blade.php ENDPATH**/ ?>