JFIF  x x C         C     "        } !1AQa "q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz        w !1AQ aq"2B #3Rbr{ gilour

File "2053e5f4795a6feb9c85d63b4bc32ae1.php"

Full Path: /home/ambitio2/public_html/storage/framework/views/2053e5f4795a6feb9c85d63b4bc32ae1.php
File size: 8.94 KB
MIME-type: text/x-php
Charset: utf-8

<?php
    $averageRating = $reviews->avg('rating');
    $fullStars = floor($averageRating); // Number of full stars
    $halfStar = $averageRating - $fullStars >= 0.5 ? 1 : 0; // Check if there's a half star
    $emptyStars = 5 - $fullStars - $halfStar; // Remaining stars are empty

    // Count the number of reviews for each rating
    $starCounts = [
        5 => $reviews->where('rating', 5)->count(),
        4 => $reviews->where('rating', 4)->count(),
        3 => $reviews->where('rating', 3)->count(),
        2 => $reviews->where('rating', 2)->count(),
        1 => $reviews->where('rating', 1)->count(),
    ];

    // Calculate the total number of reviews
    $totalReviews = $reviews->count();
?>
<div>
    <div class="d-flex align-items-center gap-30px mb-30px flex-column flex-md-row">
        <div class="tutor-review-rating">
            <div class="d-flex align-items-center gap-2 mb-3">
                <h4 class="in-title-30px"><?php echo e(number_format($averageRating, 1)); ?></h4>
                <ul class="tutor-rating-stars">
                    <!-- Display full stars -->
                    <?php for($i = 0; $i < $fullStars; $i++): ?>
                        <li>
                            <img src="<?php echo e(asset('assets/frontend/default/image/star-yellow-22.svg')); ?>" alt="Full Star">
                        </li>
                    <?php endfor; ?>
                    
                    <!-- Display half star if applicable -->
                    <?php if($halfStar): ?>
                        <li>
                            <img src="<?php echo e(asset('assets/frontend/default/image/star-half-yellow-22.svg')); ?>" alt="Half Star">
                        </li>
                    <?php endif; ?>
                    
                    <!-- Display empty stars for the remaining -->
                    <?php for($i = 0; $i < $emptyStars; $i++): ?>
                        <li>
                            <img src="<?php echo e(asset('assets/frontend/default/image/star-gray-22.svg')); ?>" alt="Empty Star">
                        </li>
                    <?php endfor; ?>
                </ul>
            </div>
            <p class="in-subtitle-16px lh-1"><?php echo e($totalReviews.' '.get_phrase('Global Ratings')); ?></p>
        </div>
        <div class="tutor-review-stars">
            <ul>
                <?php $__currentLoopData = $starCounts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $star => $count): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php
                        // Calculate the percentage for each star rating
                        $percentage = $totalReviews > 0 ? ($count / $totalReviews) * 100 : 0;
                    ?>
                    <li class="tutor-rating-progress-wrap">
                        <h5 class="in-title-16px tutor-rating-progress-star"><?php echo e(get_phrase($star . ' Stars')); ?></h5>
                        <div class="progress lms-progress tutor-rating-progress" role="progressbar" aria-label="Basic example" aria-valuenow="<?php echo e($percentage); ?>" aria-valuemin="0" aria-valuemax="100">
                            <div class="progress-bar" style="width: <?php echo e($percentage); ?>%"></div>
                        </div>
                        <h5 class="in-title-16px"><?php echo e($count); ?></h5>
                    </li>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </ul>
        </div>
    </div>
    <!-- Comment Reply -->
    <div class="mb-30px">
        <div class="mb-30px">
            <div class="single-comment-wrap">
                <?php $__currentLoopData = $reviews; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $review): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php
                    $rating = round($review->rating); // Round the rating to the nearest integer
                    $fullStars = $rating; // Number of full stars
                    $emptyStars = 5 - $fullStars; // Remaining stars will be empty
                ?>
                <div class="single-comment">
                     <div class="d-flex align-items-center gap-12px mb-3">
                         <div class="commentator-profile">
                             <img src="<?php echo e(get_image($review->review_to_user->photo)); ?>" alt="">
                         </div>
                         <div>
                             <h5 class="in-title-16px mb-6px fw-semibold"><?php echo e($review->review_to_user->name); ?></h5>
                             <div class="comment-date-stars">
                                 <p class="in-subtitle-14px"><?php echo e($review->created_at->format('d F Y')); ?></p>
                                 <ul class="comment-stars-group">
                                    <!-- Display full stars -->
                                    <?php for($i = 0; $i < $fullStars; $i++): ?>
                                        <li>
                                            <img src="<?php echo e(asset('assets/frontend/default/image/star-yellow2-16.svg')); ?>" alt="Full Star">
                                        </li>
                                    <?php endfor; ?>

                                    <!-- Display empty stars for the remaining -->
                                    <?php for($i = 0; $i < $emptyStars; $i++): ?>
                                        <li>
                                            <img src="<?php echo e(asset('assets/frontend/default/image/star-gray-16.svg')); ?>" alt="Empty Star">
                                        </li>
                                    <?php endfor; ?>
                                 </ul>
                             </div>
                         </div>
                     </div>
                     <p class="in-subtitle-16px"><?php echo $review->review; ?></p>
                </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
             </div>
        </div>
    </div>
    <?php if(Auth::check() && auth()->user()->role != 'admin'): ?>
        <?php
            // Check if the booking exists
            $bookingExists = App\Models\TutorBooking::where('tutor_id', $tutor_details->id)
                ->where('student_id', auth()->user()->id)
                ->exists();
            
            // Check if a review exists for this booking
            $existingReview = App\Models\TutorReview::where('tutor_id', $tutor_details->id)
                ->where('student_id', auth()->user()->id)
                ->first();
        ?>
        <?php if($bookingExists): ?>
        <div>
            <form action="<?php echo e(route('tutor_review')); ?>" method="POST">
                <?php echo csrf_field(); ?>
                <h3 class="in-title-20px mb-20px"><?php echo e(get_phrase('Student Review')); ?></h3>
                <input type="hidden" name="tutor_id" value="<?php echo e($tutor_details->id); ?>">
                <div class="mb-20px">
                    <label class="form-label lms-form-label mb-3"><?php echo e(get_phrase('Rating')); ?></label>
                    <select class="lms-select lms-md-select lms-form-control max-w-469px" name="rating">
                        <option value="1" <?php echo e((optional($existingReview)->rating == 1) ? 'selected' : ''); ?>><?php echo e(get_phrase('One')); ?></option>
                        <option value="2" <?php echo e((optional($existingReview)->rating == 2) ? 'selected' : ''); ?>><?php echo e(get_phrase('Two')); ?></option>
                        <option value="3" <?php echo e((optional($existingReview)->rating == 3) ? 'selected' : ''); ?>><?php echo e(get_phrase('Three')); ?></option>
                        <option value="4" <?php echo e((optional($existingReview)->rating == 4) ? 'selected' : ''); ?>><?php echo e(get_phrase('Four')); ?></option>
                        <option value="5" <?php echo e((optional($existingReview)->rating == 5) ? 'selected' : ''); ?>><?php echo e(get_phrase('Five')); ?></option>
                    </select>
                </div>
                <div class="mb-20px">
                    <label class="form-label lms-form-label mb-3" for="textarea"><?php echo e(get_phrase('Review')); ?></label>
                    <textarea id="textarea" class="form-control lms-form-control" name="review"><?php echo e(old('review', optional($existingReview)->review)); ?></textarea>
                </div>
                <button type="submit" class="btn btn-purple-md">
                    <?php echo e($existingReview ? get_phrase('Update') : get_phrase('Submit')); ?>

                </button>
            </form>
        </div>
        <?php endif; ?>
    <?php endif; ?>
</div><?php /**PATH G:\Projects\academylmslaravel_running\resources\views/frontend/default/tutor_booking/reviews.blade.php ENDPATH**/ ?>