
<?php $__env->startSection('title'); ?>
    <title><?php echo e($websiteLang->where('lang_key','wishlist')->first()->custom_text); ?></title>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('user-dashboard'); ?>
<div class="row">
    <div class="col-xl-9 ms-auto">
        <div class="wsus__dashboard_main_content">
          <div class="wsus__my_property">
            <h4 class="heading"><?php echo e($websiteLang->where('lang_key','wishlist')->first()->custom_text); ?></h4>
            <div class="row">
              <div class="col-12">
                <div class="table-responsive">
                    <table class="table">
                      <tr>
                          <th class="image">
                            <?php echo e($websiteLang->where('lang_key','img')->first()->custom_text); ?>

                        </th>

                        <th class="title">
                            <?php echo e($websiteLang->where('lang_key','property')->first()->custom_text); ?>

                        </th>

                        <th class="purpose">
                            <?php echo e($websiteLang->where('lang_key','date_added')->first()->custom_text); ?>

                        </th>

                        <th class="status">
                            <?php echo e($websiteLang->where('lang_key','views')->first()->custom_text); ?>

                        </th>

                        <th class="actions">
                            <?php echo e($websiteLang->where('lang_key','action')->first()->custom_text); ?>

                        </th>

                      </tr>

                      <?php $__currentLoopData = $wishlists; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td class="image">
                                    <a href="<?php echo e(route('property.details',$item->property->slug)); ?>">
                                        <img   class="wishlist-image" src="<?php echo e(url($item->property->thumbnail_image)); ?>" alt="img" class="img-fluid">
                                    </a>
                                </td>

                                <td class="title">
                                    <h5> <a href="<?php echo e(route('property.details',$item->property->slug)); ?>"><?php echo e($item->property->title); ?></a> </h5>
                                    <p class="address"><?php echo e($item->property->address.', '.$item->property->city->name); ?></p>

                                    <?php
                                        $total_review=$item->property->reviews->where('status',1)->count();
                                        if($total_review > 0){
                                            $avg_sum=$item->property->reviews->where('status',1)->sum('avarage_rating');


                                            $avg=$avg_sum/$total_review;
                                            $intAvg=intval($avg);
                                            $nextVal=$intAvg+1;
                                            $reviewPoint=$intAvg;
                                            $halfReview=false;
                                            if($intAvg < $avg && $avg < $nextVal){
                                                $reviewPoint= $intAvg + 0.5;
                                                $halfReview=true;
                                            }

                                        }
                                    ?>

                                    <?php if($total_review > 0): ?>
                                    <p class="rating">
                                        <span><?php echo e(sprintf("%.1f", $reviewPoint)); ?></span>
                                        <?php for($i = 1; $i <=5; $i++): ?>
                                            <?php if($i <= $reviewPoint): ?>
                                                <i class="fas fa-star"></i>
                                            <?php elseif($i> $reviewPoint ): ?>
                                                <?php if($halfReview==true): ?>
                                                <i class="fas fa-star-half-alt"></i>
                                                    <?php
                                                        $halfReview=false
                                                    ?>
                                                <?php else: ?>
                                                <i class="fal fa-star"></i>
                                                <?php endif; ?>
                                            <?php endif; ?>
                                        <?php endfor; ?>
                                        <span>(<?php echo e($total_review); ?> <?php echo e($websiteLang->where('lang_key','review')->first()->custom_text); ?>)</span>
                                    </p>

                                    <?php else: ?>
                                        <p>
                                            <span>0.0</span>
                                            <?php for($i = 1; $i <=5; $i++): ?>
                                            <i class="fal fa-star"></i>
                                            <?php endfor; ?>
                                            <span>(<?php echo e(0); ?> <?php echo e($websiteLang->where('lang_key','review')->first()->custom_text); ?>)</span>
                                        </p>

                                    <?php endif; ?>
                                </td>

                                <td class="purpose">
                                    <p><?php echo e($item->created_at->format('Y-m-d')); ?></p>
                                </td>

                                <td class="status">
                                    <p><?php echo e($item->property->views); ?></p>
                                </td>

                                <td class="actions">

                                    <ul class="d-flex">

                                        <li><a onclick="return confirm('<?php echo e($websiteLang->where('lang_key','are_you_sure')->first()->custom_text); ?>')" href="<?php echo e(route('user.delete.wishlist',$item->id)); ?>"><i class="far fa-trash-alt"></i></a></li>

                                    </ul>
                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  </table>
                </div>
              </div>
              <div class="col-12 mt_25">
                <?php echo e($wishlists->links('user.paginator')); ?>

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

<?php echo $__env->make('layouts.user.profile.layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/cloudelite/imobi.eliteteclda.com/resources/views/user/profile/wishlist.blade.php ENDPATH**/ ?>