<?php
    Theme::asset()->usePath()->add('jquery-bar-rating-css', 'libraries/jquery-bar-rating/css-stars.css');
    Theme::asset()->container('footer')->usePath()->add('jquery-bar-rating-js', 'libraries/jquery-bar-rating/jquery.barrating.min.js');
    Theme::asset()->container('footer')->usePath()->add('review-js', 'js/review.js');
?>

<?php if(RealEstateHelper::isEnabledReview()): ?>
    <?php ($canReview = auth('account')->check() && auth('account')->user()->canReview($model)); ?>
    <div>
        <h4><?php echo e(__('Write a review')); ?></h4>
        <form action="<?php echo e(route('public.ajax.review.store', $model->slug)); ?>" method="post" class="space-y-3 review-form">
            <?php echo csrf_field(); ?>
            <input type="hidden" name="reviewable_type" value="<?php echo e(get_class($model)); ?>">
            <div class="form-group">
                <select name="star" id="select-star">
                    <?php $__currentLoopData = range(1, 5); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($i); ?>" <?php if(old('score', 5) === $i): echo 'selected'; endif; ?>><?php echo e($i); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </div>
            <div class="form-group">
                <textarea name="content" id="content" class="form-control" placeholder="<?php echo e(__('Enter your message')); ?>" <?php if(! $canReview): echo 'disabled'; endif; ?>><?php echo e(old('content')); ?></textarea>
            </div>
            <?php if(auth()->guard('account')->guest()): ?>
                <p class="text-danger"><?php echo e(__('Please log in to write review!')); ?></p>
            <?php endif; ?>
            <button class="<?php echo \Illuminate\Support\Arr::toCssClasses(['btn btn-primary']); ?>" <?php if(! $canReview): echo 'disabled'; endif; ?>>
                <?php echo e(__('Submit review')); ?>

            </button>
        </form>
    </div>
    <br>
    <hr>
    <br>
    <div class="reviews-container">
        <?php if($model->reviews_count): ?>
            <div class="row">
                <div class="col-md-6">
                    <h5><span class="reviews-count"><?php echo e(__(':count Review(s)', ['count' => $model->reviews_count])); ?></span></h5>
                </div>
                <div class="col-md-6 text-right">
                    <?php echo $__env->make(Theme::getThemeNamespace('views.real-estate.partials.review-star'), ['avgStar' => $model->reviews_avg_star, 'count' => $model->reviews_count, 'style' => 2], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                </div>
            </div>
        <?php endif; ?>
        <div class="loading-spinner"></div>
        <div class="<?php echo \Illuminate\Support\Arr::toCssClasses(['reviews-list space-y-7 reviews-list', 'mt-10' => $model->reviews_count]); ?>" data-url="<?php echo e(route('public.ajax.review.index', $model->slug)); ?>?reviewable_type=<?php echo e(get_class($model)); ?>" data-type="<?php echo e(get_class($model)); ?>"></div>
    </div>
<?php endif; ?>
<?php /**PATH /home/gyannewsoftware/public_html/realestate13_FlexHome/platform/themes/flex-home/views/real-estate/partials/reviews.blade.php ENDPATH**/ ?>