<?php $__env->startSection('title'); ?>
    <?php echo app('translator')->getFromJson('Track Orders'); ?> - <?php echo e(config('app.name')); ?>

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

<?php $__env->startSection('meta-tags'); ?>
    <meta name="description" content="<?php echo app('translator')->getFromJson('Track Orders'); ?>">
<?php $__env->stopSection(); ?>

<?php $__env->startSection('meta-tags-og'); ?>
    <meta property="og:url" content="<?php echo e(url()->current()); ?>" />
    <meta property="og:type" content="website" />
    <meta property="og:title" content="<?php echo app('translator')->getFromJson('Track Orders'); ?> - <?php echo e(config('app.name')); ?>" />
    <meta property="og:description" content="<?php echo app('translator')->getFromJson('Track Orders'); ?>" />
    <meta property="og:image" content="<?php echo e(url('/img/'.config('settings.site_logo'))); ?>" />
<?php $__env->stopSection(); ?>

<?php $__env->startSection('styles'); ?>
    <?php echo $__env->make('includes.order_tracker_style', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
    <style>
        .orders-details-inner > h3 {
            padding: 6px !important;
            margin: 0px !important;
            font-size: 18px;
            border-bottom: 1px solid #eee;
        }

        .orders-details-inner > ul > li {
            float: left;
            list-style: none;
            margin-bottom: 20px;
            padding: 10px !important;
            border-right: 1px solid #eee;
        }

        .orders-details-inner ul li a {
            color: #333;
            font-size: 16px;
        }

        .orders-details {
            background-color: #f9f9f9;
            padding: 15px;
            margin-top: 15px;
        }

        .bar1, .bar2, .bar3 {
            width: 22px;
            height: 3px;
            background-color: #333;
            margin: 4px 0;
            transition: 0.4s;
        }

        .change .bar1 {
            -webkit-transform: rotate(-45deg) translate(-7px, 3px);
            transform: rotate(-45deg) translate(-7px, 3px);
        }

        .change .bar2 {
            opacity: 0;
        }

        .change .bar3 {
            -webkit-transform: rotate(45deg) translate(-7px, -3px);
            transform: rotate(45deg) translate(-7px, -3px);
        }

        .btn-toggle-close a {
            margin-top: 20px !important;
            display: block;
        }

        .orders-details-inner-sub-2 {
            margin-top: 15px;
        }

        .orders-details-inner-sub-2 img {
            width: 60px;
            float: left;
            margin-right: 15px;
        }

        .orders-details-inner-sub-2 h4 a {
            color: #888;
        }

        .orders-details-inner-sub-2 p {
            padding-top: 0px;
            font-size: 14px;
            color: #333;
        }

        @media (max-width: 767px) {
            .orders-details-inner-sub-2 {
                height: 100%;
                display: block;
                margin: 40px auto;
            }
        }

        .panel-body-row {
            text-align: left;
        }

        .img-box {
            text-align: center;
        }

        .img-box .product-img {
            height: 80px;
            width: auto !important;
        }

        .product-img {
            width: 100% !important;
        }

        .grand-total p {
            text-align: left;
            padding: 0px;
        }

        .panel-heading, .panel-body {
            border: 1px solid #e5e5e5;
        }

        .panel-heading {
            border-bottom: none;
        }

        .orders-details {
            border: 1px solid #158cba;
            border-radius: 5px;
        }

        .media-body {
            text-align: center;
        }

        .order_detail_item_name {
            color: #444;
        }
    </style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('sidebar'); ?>
    <?php echo $__env->make('includes.user-account-sidebar', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('above_content'); ?>
    <div class="breadcrumb">
        <div class="container">
            <div class="breadcrumb-inner">
                <ul class="list-inline list-unstyled">
                    <li><a href="<?php echo e(url('/')); ?>"><?php echo app('translator')->getFromJson('Home'); ?></a></li>
                    <li class="active"><?php echo app('translator')->getFromJson('Track Orders'); ?></li>
                </ul>
            </div>
            <!-- /.breadcrumb-inner -->
        </div>
        <!-- /.container -->
    </div>
    <!-- /.breadcrumb -->
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <div class="col-md-9 user_account">
        <div class="shopping-cart">
            <div class="page-title">
                <h2><?php echo app('translator')->getFromJson('Your Orders'); ?></h2>
            </div>
            <div class="content-panel">
                <div class="col-md-12 panel-heading">
                    <div class="col-md-1 device-none">
                        <h4></h4>
                    </div>
                    <div class="col-md-2 col-xs-4">
                        <h4> <?php echo app('translator')->getFromJson('Order No.'); ?> </h4>
                    </div>
                    <div class="col-md-2 col-xs-6">
                        <h4> <?php echo app('translator')->getFromJson('Products'); ?> </h4>
                    </div>
                    <div class="col-md-2 col-xs-6 device-none">
                        <h4> <?php echo app('translator')->getFromJson('Payment Status'); ?> </h4>
                    </div>
                    <div class="col-md-2 device-none">
                        <h4><?php echo app('translator')->getFromJson('Total'); ?> </h4>
                    </div>
                    <div class="col-md-2 device-none">
                        <h4> <?php echo app('translator')->getFromJson('Order Date'); ?> </h4>
                    </div>
                    <div class="col-md-1 col-xs-2 ">
                    </div>
                </div>
                <?php if(count($orders) > 0): ?>
                    <?php $__currentLoopData = $orders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $order): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="col-md-12 panel-body">
                        <div class="panel-body-row">
                            <div class="col-md-1 device-none">
                                <h4> <?php echo e($key+1); ?> </h4>
                            </div>
                            <div class="col-md-2 col-xs-4">
                                <h4>
                                    <a class="" onclick="myFunction(this)" class="btn-toggle-close"
                                       data-toggle="collapse" href="#multiCollapseExample<?php echo e($key+1); ?>"
                                       aria-expanded="false" aria-controls="multiCollapseExample<?php echo e($key+1); ?>">
                                        #<?php echo e($order->getOrderId()); ?>

                                    </a>
                                </h4>
                            </div>
                            <?php if($order->products->first()): ?>
                                <div class="col-md-2 col-xs-6">
                                    <a target="_blank"
                                       href="<?php echo e(route('front.product.show', [$order->products->first()->slug])); ?>">
                                        <?php if($order->products->first()->photo): ?>
                                            <?php
                                                $image_url = \App\Helpers\Helper::check_image_avatar($order->products->first()->photo->name, 150);
                                            ?>
                                            <div class="img-box">
                                                <img class="product-img" src="<?php echo e($image_url); ?>" alt="<?php echo e($order->products->first()->name); ?>"  />
                                            </div>
                                        <?php else: ?>
                                            <div class="img-box">
                                                <img src="https://via.placeholder.com/150x150?text=No+Image" class="product-img" alt="<?php echo e($order->products->first()->name); ?>" />
                                            </div>
                                        <?php endif; ?>
                                        <p class="text-center order_detail_item_name"> <?php echo e($order->products->first()->name); ?> </p>
                                    </a>
                                </div>
                            <?php else: ?>
                                <div class="col-md-2 col-xs-6">
                                    <p><?php echo app('translator')->getFromJson('Not Available'); ?></p>
                                </div>
                            <?php endif; ?>
                            <div class="col-md-2 col-xs-6 device-none text-center">
                                <h4>
                                    <?php if($order->is_not_online_payment() && $order->paid == 0): ?>
                                        <span class="text-warning"><?php echo app('translator')->getFromJson('Failed'); ?></span>
                                    <?php else: ?>
                                        <?php if($order->paid): ?>
                                            <span class="text-success"><?php echo app('translator')->getFromJson('Paid'); ?></span>
                                        <?php else: ?>
                                            <span class="text-danger"><?php echo app('translator')->getFromJson('Unpaid'); ?></span>
                                        <?php endif; ?>
                                    <?php endif; ?>
                                </h4>
                            </div>
                            <div class="col-md-2 device-none">
                                <h4> <?php echo e(currency_format($order->shipping_cost + $order->total - $order->wallet_amount - $order->coupon_amount + ($order->total * $order->tax) / 100, $order->currency)); ?> </h4>
                            </div>
                            <div class="col-md-2 device-none">
                                <h4> <?php echo e($order->created_at->toFormattedDateString()); ?> </h4>
                            </div>

                            <div class="col-md-1 col-xs-2 btn-toggle-close">

                                <a class="" onclick="myFunction(this)" class="btn-toggle-close" data-toggle="collapse"
                                   href="#multiCollapseExample<?php echo e($key+1); ?>" aria-expanded="false"
                                   aria-controls="multiCollapseExample<?php echo e($key+1); ?>">
                                    <div class="bar1"></div>
                                    <div class="bar2"></div>
                                    <div class="bar3"></div>
                                </a>
                                <?php if($order->is_not_online_payment() && $order->paid == 0): ?>
                                    <?php echo Form::model($order, ['method'=>'patch', 'action'=>['FrontOrdersController@hide', $order->id], 'id'=> 'hide-form-'.$order->id, 'style'=>'display: none;']); ?>

                                    <?php echo Form::close(); ?>

                                    <a href="" class='btn btn-xs btn-danger pull-left'
                                       onclick="
                                               if(confirm('<?php echo app('translator')->getFromJson('Are you sure you want to delete this?'); ?>')) {
                                               event.preventDefault();
                                               $('#hide-form-<?php echo e($order->id); ?>').submit();
                                               } else {
                                               event.preventDefault();
                                               }
                                               "
                                    ><i class="fa fa-trash"> </i></a>
                                <?php endif; ?>
                            </div>
                        </div>

                        <div class="clearfix"></div>

                        <div class="col-md-12 multi-collapse collapse" id="multiCollapseExample<?php echo e($key+1); ?>"
                             aria-expanded="false" style="height: 0px;">
                            <div class="orders-details">
                                <div class="orders-details-inner">
                                    <?php
                                        $tracking_data = '';
                                        if(!empty( $order->tracking_id ) ){
                                            $tracking_data = '<span class="pull-right">'.__("Track Your Order Using this Tracking ID :").' <strong>'. $order->tracking_id.'</strong></span>';
                                        }
                                    ?>
                                    <h3><strong> <?php echo app('translator')->getFromJson('Order'); ?> #<?php echo e($order->getOrderId()); ?> </strong> <?php echo $tracking_data; ?></h3>
                                    <?php if(count($order->shipments) > 0): ?>
                                        <div class="row bs-wizard" style="border-bottom:0;">
                                            <?php $__currentLoopData = $order->shipments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $shipment): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <?php if($order->shipments->contains($shipment->id)): ?>
                                                    <div class="col-xs-3 bs-wizard-step complete">
                                                        <div class="text-center bs-wizard-stepnum"><?php echo e($shipment->name); ?></div>
                                                        <div class="progress">
                                                            <div class="progress-bar"></div>
                                                        </div>
                                                        <a href="#" class="bs-wizard-dot"></a>
                                                        <div class="bs-wizard-info text-center"><?php echo e($shipment->address. ', ' .$shipment->city. ', ' .$shipment->state. ' - ' .$shipment->zip. ' ' .$shipment->country); ?>

                                                            <br>
                                                            <?php echo e($shipment->created_at->toCookieString()); ?>

                                                        </div>
                                                    </div>
                                                <?php endif; ?>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php if($order->is_processed == 1): ?>
                                                <div class="col-xs-3 bs-wizard-step complete">
                                                    <div class="text-center bs-wizard-stepnum"><?php echo app('translator')->getFromJson('Delivered'); ?></div>
                                                    <div class="progress">
                                                        <div class="progress-bar"></div>
                                                    </div>
                                                    <a href="#" class="bs-wizard-dot"></a>
                                                    <div class="bs-wizard-info text-center">
                                                        <?php echo e(Carbon\Carbon::parse($order->processed_date)->toCookieString()); ?>

                                                    </div>
                                                </div>
                                            <?php endif; ?>
                                        </div>
                                        <hr>
                                    <?php endif; ?>
                                    <?php $__currentLoopData = $order->products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <div class="orders-details-inner-sub-2">
                                            <div class="media text-right">
                                                <a href="<?php echo e(route('front.product.show', [$product->slug])); ?>">
                                                <?php if($product->photo): ?>
                                                    <?php
                                                        $image_url = \App\Helpers\Helper::check_image_avatar($product->photo->name, 80);
                                                    ?>

                                                    <div class="img-box">
                                                        <img class="product-img" src="<?php echo e($image_url); ?>" alt="<?php echo e($product->name); ?>" width="80"  />
                                                    </div>
                                                <?php else: ?>
                                                    <div class="img-box">
                                                        <img src="https://via.placeholder.com/150x150?text=No+Image" width="80" class="img-responsive product-img" alt="<?php echo e($product->name); ?>" />
                                                    </div>
                                                <?php endif; ?>
                                                </a>
                                                <div class="media-body">
                                                    <div class="col-md-8">
                                                        <h4>
                                                            <a target="_blank"
                                                               href="<?php echo e(route('front.product.show', [$product->slug])); ?>"><?php echo e($product->name); ?>

                                                    <?php if($product->pivot->spec && ($specs = unserialize($product->pivot->spec))): ?>
                                                        <br>
                                                        <?php $__currentLoopData = $specs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $spec): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                            <em><?php echo e($spec['name']); ?>:</em> <?php echo e($spec['value']); ?><?php if(!$loop->last): ?>, <?php endif; ?>
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                    <?php endif; ?>
                                                           </a>
                                                        </h4>
                                                        <p><strong><?php echo app('translator')->getFromJson('Qty:'); ?> </strong><?php echo e($product->pivot->quantity); ?></p>
                                                    </div>
                                                    <div class="col-md-4 text-right">
                                                        <h4> <?php echo e(currency_format($product->pivot->total, $order->currency)); ?> </h4>
                                                        <?php if($product->file): ?>
                                                            <div>
                                                                <?php echo Form::open(['method'=>'post', 'action'=>'FrontOrdersController@download']); ?>

                                                                <?php echo e(Form::hidden('filename', $product->file->filename)); ?>

                                                                <?php echo e(Form::hidden('order_id', $order->id)); ?>

                                                                <?php echo Form::submit($product->file->original_filename, ['class'=>'btn btn-link', 'role'=>'link']); ?>

                                                                <?php echo Form::close(); ?>

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

                                </div>
                                <div class="clearfix"></div>

                                <div class="col-md-4 grand-total">
                                    <p><strong><?php echo app('translator')->getFromJson('Payment Status:'); ?></strong>
                                        <?php if($order->is_not_online_payment() && $order->paid == 0): ?>
                                            <strong class="text-warning"><?php echo app('translator')->getFromJson('Failed'); ?></strong>
                                        <?php else: ?>
                                            <?php if($order->paid): ?>
                                                <strong class="text-success"><?php echo app('translator')->getFromJson('Paid'); ?></strong>
                                            <?php else: ?>
                                                <strong class="text-danger"><?php echo app('translator')->getFromJson('Unpaid'); ?></strong>
                                            <?php endif; ?>
                                        <?php endif; ?>
                                    </p>
                                    <hr>
                                    <?php if($order->payment_date): ?>
                                    <p><strong><?php echo app('translator')->getFromJson('Payment Date:'); ?></strong> <?php echo e($order->payment_date); ?> </p>
                                    <?php endif; ?>
                                    <p><strong><?php echo app('translator')->getFromJson('Payment Method:'); ?></strong> <?php echo e($order->payment_method); ?> </p>
                                    <p><strong><?php echo app('translator')->getFromJson('Order Status:'); ?></strong> 
                                        <strong>
                                        <?php if($order->is_processed): ?>
                                            <span class="text-success"><?php echo app('translator')->getFromJson('Delivered'); ?></span>
                                        <?php else: ?>
                                            <?php if($order->stock_regained): ?>
                                                <span class="text-primary"><?php echo app('translator')->getFromJson('Cancelled'); ?></span>
                                            <?php elseif($order->is_not_online_payment() && $order->paid == 0): ?>
                                                <strong class="text-warning"><?php echo app('translator')->getFromJson('Failed'); ?></strong>
                                            <?php else: ?>
                                                <strong class="text-danger"><?php echo app('translator')->getFromJson('Pending'); ?></strong>
                                            <?php endif; ?>
                                        <?php endif; ?>
                                        </strong>
                                    </p>
                                    <?php if(!($order->is_processed || $order->stock_regained || ($order->is_not_online_payment() && $order->paid == 0))): ?>
                                       <p> <strong><?php echo app('translator')->getFromJson('Current Status:'); ?></strong> <?php echo e($order->status); ?> </p>
                                    <?php endif; ?>
                                    <?php if($order->is_processed == 1): ?>
                                        <p> <strong><?php echo app('translator')->getFromJson('Delivered on:'); ?></strong> <?php echo e($order->processed_date); ?> </p>
                                       <strong><a target="_blank" href="<?php echo e(route('front.orders.show', ['id'=>$order->id])); ?>"><?php echo app('translator')->getFromJson('View Invoice'); ?></a></strong>
                                    <?php endif; ?>
                                    <hr>
                                </div>

                                <div class="grand-total shipping-address col-md-4 text-center">
                                    <p><strong><?php echo app('translator')->getFromJson('Shipping Address'); ?></strong></p>
                                    <hr>
                                    <div class="text-center">
                                        <p>
                                            <strong><?php echo e($order->address->first_name); ?> <?php echo e($order->address->last_name); ?></strong>
                                        </p>
                                        <p> <?php echo e($order->address->address); ?><br>
                                            <?php echo e($order->address->city); ?>, <?php echo e($order->address->state); ?>

                                            - <?php echo e($order->address->zip); ?><br>
                                            <?php echo e($order->address->country); ?>.<br>
                                        </p>
                                        <hr>
                                    </div>
                                </div>

                                <div class="col-md-4 grand-total">
                                    <div class="pull-right">
                                        <p><strong><?php echo app('translator')->getFromJson('Order Total'); ?></strong></p>
                                        <hr>
                                        <p><strong><?php echo app('translator')->getFromJson('Sub Total:'); ?></strong> <?php echo e(currency_format($order->total, $order->currency)); ?>

                                        </p>
                                        <p><strong><?php echo app('translator')->getFromJson('Tax:'); ?></strong> <?php echo e($order->tax); ?> % </p>
                                        <p><strong><?php echo app('translator')->getFromJson('Shipping Cost:'); ?></strong> <?php echo e(isset($order->shipping_cost) ? currency_format($order->shipping_cost, $order->currency) : currency_format(0, $order->currency)); ?>

                                        </p>
                                        <?php if($order->wallet_amount && $order->wallet_amount > 0): ?>
                                            <p><strong><?php echo app('translator')->getFromJson('Wallet Used:'); ?></strong> - <?php echo e(currency_format($order->wallet_amount, $order->currency)); ?>

                                            </p>
                                        <?php endif; ?>

                                        <?php if($order->coupon_amount && $order->coupon_amount > 0): ?>
                                            <p><strong><?php echo app('translator')->getFromJson('Coupon Discount:'); ?></strong> - <?php echo e(currency_format($order->coupon_amount, $order->currency)); ?>

                                            </p>
                                        <?php endif; ?>
                                        <p><strong><?php echo app('translator')->getFromJson('Order Total:'); ?></strong> <?php echo e(currency_format($order->shipping_cost + $order->total - $order->wallet_amount - $order->coupon_amount + ($order->total * $order->tax) / 100, $order->currency)); ?>

                                        </p>
                                        <hr>
                                    </div>
                                </div>
                                <div class="clearfix"></div>
                            </div>
                        </div>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                <?php else: ?>
                    <div class="row text-center">
                        <div class="empty-bag">
                            <div class="empty-bag-icon">
                                <img src="<?php echo e(asset('/img/icons/purchase-order.png')); ?>" class="img-responsive m-a" alt="<?php echo app('translator')->getFromJson('No Order History'); ?>" width="100">
                            </div>
                            <h3 class="text-center text-muted"><?php echo app('translator')->getFromJson('NO ORDERS HISTORY FOUND'); ?></h3>
                        </div>
                    </div>
                <?php endif; ?>

                <?php if(count($orders)): ?>
                <div class="text-right">
                    <?php echo e($orders->links()); ?>

                </div>
                <?php endif; ?>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
    <script>
        function myFunction(x) {
            x.classList.toggle("change");
        }
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.front', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>