File: /var/www/html/obaasimaghana/app/views/courses/_review_modal.php
<?php if(isLoggedIn() && !$data['has_reviewed'] && $data['enrollmentStatus'] === 'completed'): ?>
<div id="reviewModal" class="hidden fixed inset-0 bg-black bg-opacity-50 overflow-y-auto h-full w-full z-50">
<div class="relative top-20 mx-auto p-6 border w-full max-w-md shadow-xl rounded-lg bg-white">
<div class="absolute top-0 right-0 pt-4 pr-4">
<button type="button"
onclick="document.getElementById('reviewModal').classList.add('hidden')"
class="text-gray-400 hover:text-gray-500">
<svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
</svg>
</button>
</div>
<div class="mt-3">
<h3 class="text-lg font-semibold text-gray-900 mb-4">How would you rate this course?</h3>
<?php flash('review_message'); ?>
<form action="<?php echo APP_URL; ?>/courses/addReview" method="post" class="space-y-6">
<input type="hidden" name="course_id" value="<?php echo $course['id']; ?>">
<div>
<div class="flex items-center justify-center space-x-1">
<?php for($i = 5; $i >= 1; $i--): ?>
<input type="radio" name="rating" value="<?php echo $i; ?>" id="rating<?php echo $i; ?>" class="hidden peer">
<label for="rating<?php echo $i; ?>"
class="cursor-pointer transition-colors">
<svg class="w-12 h-12 text-gray-300 hover:text-yellow-400 peer-checked:text-yellow-400"
fill="currentColor"
viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"/>
</svg>
</label>
<?php endfor; ?>
</div>
<?php flash('rating_err'); ?>
</div>
<div>
<label for="review" class="block text-sm font-medium text-gray-700">
Write a Review
<span class="text-gray-400 font-normal">(optional)</span>
</label>
<div class="mt-1">
<textarea id="review"
name="review"
rows="4"
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-purple-500 focus:ring-purple-500 sm:text-sm"
placeholder="Tell us about your experience with this course..."
maxlength="1000"></textarea>
<?php flash('review_err'); ?>
</div>
</div>
<div class="flex items-center justify-end space-x-3">
<button type="button"
onclick="document.getElementById('reviewModal').classList.add('hidden')"
class="px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500">
Cancel
</button>
<button type="submit"
class="px-4 py-2 text-sm font-medium text-white bg-purple-600 border border-transparent rounded-md shadow-sm hover:bg-purple-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500">
Submit Review
</button>
</div>
</form>
</div>
</div>
</div>
<?php endif; ?>