<?php
    $start_date = date('Y/m/d',strtotime($Flash_Deal->start_date));
    $end_date = date('Y/m/d',strtotime($Flash_Deal->end_date));
    $current_date = date('Y/m/d');
    $deal_date = '1990/01/01';
    if($start_date<= $current_date && $end_date >= $current_date){
        $deal_date = $end_date;
    }
    elseif ($start_date >= $current_date && $end_date >= $current_date) {
        $deal_date = $start_date;
    }

?>

<div class="row">
    <?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

    <div class="col-lg-4 col-xl-3 col-sm-6 col-md-6 single_product_item">
        <div class="single_product_list product_tricker">
          <div class="product_img">
            <a href="<?php echo e(route('frontend.item.show',$product->product->slug)); ?>" class="product_img_iner">
              <img src="<?php echo e(asset(asset_path(@$product->product->product->thumbnail_image_source))); ?>" alt="#" class="img-fluid">
            </a>
            <div class="socal_icon">
              <a href="" class="add_to_wishlist <?php echo e($product->product->is_wishlist() == 1?'is_wishlist':''); ?>" id="wishlistbtn_<?php echo e($product->id); ?>" data-product_id="<?php echo e($product->product->id); ?>" data-seller_id="<?php echo e($product->product->user_id); ?>"> <i class="ti-heart"></i> </a>
              <a href="" class="addToCompareFromThumnail" data-producttype="<?php echo e($product->product->product->product_type); ?>" data-seller=<?php echo e($product->product->user_id); ?> data-product-sku=<?php echo e($product->product->skus->first()->id); ?> data-product-id=<?php echo e($product->product->id); ?>> <i class="ti-exchange-vertical"></i> </a>
              <a href="" class="addToCartFromThumnail" data-producttype="<?php echo e($product->product->product->product_type); ?>" data-seller=<?php echo e($product->product->user_id); ?> data-product-sku=<?php echo e($product->product->skus->first()->id); ?>


                <?php if(@$product->product->hasDeal): ?>
                data-base-price=<?php echo e(selling_price($product->product->skus->first()->selling_price,$product->product->hasDeal->discount_type,$product->product->hasDeal->discount)); ?>

                <?php else: ?>
                data-base-price=<?php echo e(selling_price($product->product->skus->first()->selling_price,$product->product->discount_type,$product->product->discount)); ?>

                <?php endif; ?>
                data-shipping-method=<?php echo e(@$product->product->product->shippingMethods->first()->shipping_method_id); ?>

                data-product-id=<?php echo e($product->product->id); ?>

                data-stock_manage="<?php echo e($product->product->stock_manage); ?>"
                data-stock="<?php echo e(@$product->product->skus->first()->product_stock); ?>"
                data-min_qty="<?php echo e($product->product->product->minimum_order_qty); ?>"> <i class="ti-bag"></i> </a>
            </div>
          </div>
          <div class="product_text">
            <h5>
              <a href="<?php echo e(route('frontend.item.show',$product->product->slug)); ?>"><?php if(@$product->product->product_name): ?> <?php echo e(substr(@$product->product->product_name,0,28)); ?> <?php if(strlen(@$product->product->product_name) > 28): ?>... <?php endif; ?> <?php else: ?> <?php echo e(substr(@$product->product->product->product_name,0,28)); ?> <?php if(strlen(@$product->product->product->product_name) > 28): ?>... <?php endif; ?> <?php endif; ?></a>
            </h5>
            <div class="product_review_star d-flex justify-content-between align-items-center">
              <p>
                  <?php if($product->product->hasDeal): ?>

                    <?php if($product->product->product->product_type == 1): ?>
                        <?php echo e(single_price(selling_price($product->product->skus->first()->selling_price,$product->discount_type,$product->discount))); ?>

                    <?php else: ?>
                        <?php if(selling_price($product->product->skus->min('selling_price'),$product->discount_type,$product->discount) === selling_price($product->product->skus->max('selling_price'),$product->discount_type,$product->discount)): ?>
                            <?php echo e(single_price(selling_price($product->product->skus->min('selling_price'),$product->discount_type,$product->discount))); ?>

                        <?php else: ?>
                            <?php echo e(single_price(selling_price($product->product->skus->min('selling_price'),$product->discount_type,$product->discount))); ?> - <?php echo e(single_price(selling_price($product->product->skus->max('selling_price'),$product->discount_type,$product->discount))); ?>

                        <?php endif; ?>
                    <?php endif; ?>

                  <?php else: ?>
                    <?php if(@$product->product->product->product_type == 1): ?>
                        <?php if(@$product->product->hasDiscount == 'yes'): ?>
                            <?php echo e(single_price(selling_price(@$product->product->skus->first()->selling_price,@$product->product->discount_type,@$product->product->discount))); ?>

                        <?php else: ?>
                            <?php echo e(single_price(@$product->product->skus->first()->selling_price)); ?>

                        <?php endif; ?>
                    <?php else: ?>
                        <?php if(@$product->product->hasDiscount == 'yes'): ?>
                            <?php if(selling_price($product->product->skus->min('selling_price'),$product->product->discount_type,$product->product->discount) === selling_price($product->product->skus->max('selling_price'),$product->product->discount_type,$product->product->discount)): ?>
                                <?php echo e(single_price(selling_price($product->product->skus->min('selling_price'),$product->product->discount_type,$product->product->discount))); ?>

                            <?php else: ?>
                                <?php echo e(single_price(selling_price($product->product->skus->min('selling_price'),$product->product->discount_type,$product->product->discount))); ?> - <?php echo e(single_price(selling_price($product->product->skus->max('selling_price'),$product->product->discount_type,$product->product->discount))); ?>

                            <?php endif; ?>
                        <?php else: ?>
                            <?php if($product->product->skus->min('selling_price') === $product->product->skus->max('selling_price')): ?>
                                <?php echo e(single_price($product->product->skus->min('selling_price'))); ?>

                            <?php else: ?>
                                <?php echo e(single_price($product->product->skus->min('selling_price'))); ?> - <?php echo e(single_price($product->product->skus->max('selling_price'))); ?>

                            <?php endif; ?>
                        <?php endif; ?>
                    <?php endif; ?>
                  <?php endif; ?>
              </p>
              <div class="review_star_icon">
                  <?php
                  $reviews = $product->product->reviews->where('status',1)->pluck('rating');
                    if(count($reviews)>0){
                        $value = 0;
                        $rating = 0;
                        foreach($reviews as $review){
                            $value += $review;
                        }
                        $rating = $value/count($reviews);
                        $total_review = count($reviews);
                    }else{
                        $rating = 0;
                        $total_review = 0;
                    }
                ?>
                <?php if($rating == 0): ?>
                <i class="fas fa-star non_rated "></i>
                <i class="fas fa-star non_rated "></i>
                <i class="fas fa-star non_rated "></i>
                <i class="fas fa-star non_rated "></i>
                <i class="fas fa-star non_rated "></i>
                <?php elseif($rating < 1 && $rating > 0): ?>
                <i class="fas fa-star-half-alt"></i>
                <i class="fas fa-star non_rated "></i>
                <i class="fas fa-star non_rated "></i>
                <i class="fas fa-star non_rated "></i>
                <i class="fas fa-star non_rated "></i>
                <?php elseif($rating <= 1 && $rating > 0): ?>
                <i class="fas fa-star"></i>
                <i class="fas fa-star non_rated "></i>
                <i class="fas fa-star non_rated "></i>
                <i class="fas fa-star non_rated "></i>
                <i class="fas fa-star non_rated "></i>
                <?php elseif($rating < 2 && $rating > 1): ?>
                <i class="fas fa-star"></i>
                <i class="fas fa-star-half-alt"></i>
                <i class="fas fa-star non_rated "></i>
                <i class="fas fa-star non_rated "></i>
                <i class="fas fa-star non_rated "></i>
                <?php elseif($rating <= 2 && $rating > 1): ?>
                <i class="fas fa-star"></i>
                <i class="fas fa-star"></i>
                <i class="fas fa-star non_rated "></i>
                <i class="fas fa-star non_rated "></i>
                <i class="fas fa-star non_rated "></i>
                <?php elseif($rating < 3 && $rating > 2): ?>
                <i class="fas fa-star"></i>
                <i class="fas fa-star"></i>
                <i class="fas fa-star-half-alt"></i>
                <i class="fas fa-star non_rated "></i>
                <i class="fas fa-star non_rated "></i>
                <?php elseif($rating <= 3 && $rating > 2): ?>
                <i class="fas fa-star"></i>
                <i class="fas fa-star"></i>
                <i class="fas fa-star "></i>
                <i class="fas fa-star non_rated "></i>
                <i class="fas fa-star non_rated "></i>
                <?php elseif($rating < 4 && $rating > 3): ?>
                <i class="fas fa-star"></i>
                <i class="fas fa-star"></i>
                <i class="fas fa-star "></i>
                <i class="fas fa-star-half-alt"></i>
                <i class="fas fa-star non_rated "></i>
                <?php elseif($rating <= 4 && $rating > 3): ?>
                <i class="fas fa-star"></i>
                <i class="fas fa-star"></i>
                <i class="fas fa-star "></i>
                <i class="fas fa-star "></i>
                <i class="fas fa-star non_rated "></i>
                <?php elseif($rating < 5 && $rating > 4): ?>
                <i class="fas fa-star"></i>
                <i class="fas fa-star"></i>
                <i class="fas fa-star "></i>
                <i class="fas fa-star "></i>
                <i class="fas fa-star-half-alt"></i>
                <?php else: ?>
                <i class="fas fa-star"></i>
                <i class="fas fa-star"></i>
                <i class="fas fa-star "></i>
                <i class="fas fa-star "></i>
                <i class="fas fa-star "></i>
                <?php endif; ?>
              </div>
            </div>
            <div class="product_review_count d-flex justify-content-between align-items-center">
              <span>
                <?php if($product->product->hasDeal): ?>
                    <?php if($product->discount > 0): ?>

                        <?php if($product->product->product->product_type == 1): ?>
                            <?php echo e(single_price($product->product->skus->first()->selling_price)); ?>

                        <?php else: ?>
                            <?php if($product->product->skus->min('selling_price') === $product->product->skus->max('selling_price')): ?>
                                <?php echo e(single_price($product->product->skus->min('selling_price'))); ?>

                            <?php else: ?>
                                <?php echo e(single_price($product->product->skus->min('selling_price'))); ?> - <?php echo e(single_price($product->product->skus->max('selling_price'))); ?>

                            <?php endif; ?>
                        <?php endif; ?>
                    <?php endif; ?>
                <?php else: ?>
                    <?php if($product->product->hasDiscount == 'yes'): ?>
                        <?php if($product->product->discount > 0): ?>

                            <?php if($product->product->product->product_type == 1): ?>
                                <?php echo e(single_price($product->product->skus->first()->selling_price)); ?>

                            <?php else: ?>
                                <?php if($product->product->skus->min('selling_price') === $product->product->skus->max('selling_price')): ?>
                                    <?php echo e(single_price($product->product->skus->min('selling_price'))); ?>

                                <?php else: ?>
                                    <?php echo e(single_price($product->product->skus->min('selling_price'))); ?> - <?php echo e(single_price($product->product->skus->max('selling_price'))); ?>

                                <?php endif; ?>
                            <?php endif; ?>
                        <?php endif; ?>
                    <?php endif; ?>

                <?php endif; ?>
              </span>

              <p><?php echo e(sprintf("%.2f",$rating)); ?>/5 (<?php echo e($total_review<10?'0':''); ?><?php echo e($total_review); ?> <?php echo e(__('defaultTheme.review')); ?>)</p>
            </div>
          </div>


          <?php if($product->product->hasDeal): ?>
            <?php if($product->discount > 0): ?>
            <span class="new_price">
                <?php if($product->discount_type ==0): ?>
                <?php echo e($product->discount); ?> % <?php echo e(__('common.off')); ?>

                <?php else: ?>
                <?php echo e(single_price($product->discount)); ?> <?php echo e(__('common.off')); ?>

                <?php endif; ?>

                </span>
            <?php endif; ?>
          <?php else: ?>
            <?php if($product->product->hasDiscount == 'yes'): ?>
                <?php if($product->product->discount > 0): ?>
                    <span class="new_price">
                        <?php if($product->product->discount_type ==0): ?>
                        <?php echo e($product->product->discount); ?> % <?php echo e(__('common.off')); ?>

                        <?php else: ?>
                        <?php echo e(single_price($product->product->discount)); ?> <?php echo e(__('common.off')); ?>

                        <?php endif; ?>

                    </span>
                <?php endif; ?>

            <?php endif; ?>

          <?php endif; ?>

        </div>
    </div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
<div class="row justify-content-center">

    <div class="col-lg-12">
        <?php
            $total_number_of_item_per_page = $products->perPage();
            $total_number_of_items = ($products->total() > 0) ? $products->total() : 1;
            $total_number_of_pages = $total_number_of_items / $total_number_of_item_per_page;
            $reminder = $total_number_of_items % $total_number_of_item_per_page;
            if ($reminder > 0) {
                $total_number_of_pages += 1;
            }
        ?>
        <div class="pagination_part">
            <nav aria-label="Page navigation example">
                <ul class="pagination">
                    <li class="page-item"><a class="page-link" href="<?php echo e($products->previousPageUrl()); ?>"> <i class="ti-arrow-left"></i> </a></li>
                    <?php for($i=1; $i <= $total_number_of_pages; $i++): ?>
                        <?php if(($products->currentPage() + 2) == $i): ?>
                            <li class="page-item"><a class="page-link" href="<?php echo e($products->url($i)); ?>"><?php echo e($i); ?></a></li>
                        <?php endif; ?>
                        <?php if(($products->currentPage() + 1) == $i): ?>
                            <li class="page-item"><a class="page-link" href="<?php echo e($products->url($i)); ?>"><?php echo e($i); ?></a></li>
                        <?php endif; ?>
                        <?php if($products->currentPage() == $i): ?>
                            <li class="page-item <?php if(request()->toRecievedList == $i || request()->toRecievedList == null): ?> active <?php endif; ?>"><a class="page-link" href="<?php echo e($products->url($i)); ?>"><?php echo e($i); ?></a></li>
                        <?php endif; ?>
                        <?php if(($products->currentPage() - 1) == $i): ?>
                            <li class="page-item"><a class="page-link" href="<?php echo e($products->url($i)); ?>"><?php echo e($i); ?></a></li>
                        <?php endif; ?>
                        <?php if(($products->currentPage() - 2) == $i): ?>
                            <li class="page-item"><a class="page-link" href="<?php echo e($products->url($i)); ?>"><?php echo e($i); ?></a></li>
                        <?php endif; ?>
                    <?php endfor; ?>
                    <li class="page-item"><a class="page-link" href="<?php echo e($products->nextPageUrl()); ?>"> <i class="ti-arrow-right"></i> </a></li>
                </ul>
            </nav>
        </div>
    </div>
</div>
<?php /**PATH /home/penastud/public_html/mart/resources/views/frontend/default/partials/flash_deal_paginate_data.blade.php ENDPATH**/ ?>