import { Button } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; import { Separator } from '@/components/ui/separator'; import { systemCurrency } from '@/lib/utils'; import { ExamPreviewProps } from '@/types/page'; import { Link, router, usePage } from '@inertiajs/react'; import { Award, BookOpen, Calendar, Clock, Target } from 'lucide-react'; const CoursePreview = () => { const { auth, exam, system, wishlist, enrollment, translate } = usePage().props; const { frontend } = translate; const currency = systemCurrency(system.fields['selling_currency']); const handleWishlist = () => { if (wishlist) { router.delete(route('exam-wishlists.destroy', exam.id)); } else { router.post(route('exam-wishlists.store', exam.id)); } }; const enrollmentHandler = (exam: Exam) => { router.post(route('exam-enrollments.store'), { user_id: auth.user?.id, exam_id: exam.id, enrollment_type: 'free', }); }; return ( {enrollment ? (

You're enrolled!

) : (

{exam.pricing_type === 'free' ? ( exam.pricing_type ) : exam.discount ? ( <> {currency?.symbol} {exam.discount_price} {currency?.symbol} {exam.price} ) : ( <> {currency?.symbol} {exam.price} )}

{exam.pricing_type === 'free' ? ( ) : ( )}
)}
{exam.duration_hours > 0 && `${exam.duration_hours} hours `} {exam.duration_minutes > 0 && `${exam.duration_minutes} minutes`}
{exam.total_questions} questions
{exam.max_attempts} attempts allowed
{exam.pass_mark} marks to pass
{exam.expiry_type === 'lifetime' ? 'Lifetime' : exam.expiry_duration}
); }; export default CoursePreview;