<?php $__env->startSection('title', 'Programs'); ?>

<?php $__env->startSection('content'); ?>
    <?php echo $__env->make('layouts.partials.page_header', [
        'title' => 'Programs',
        'breadcrumbs' => [
            ['label' => 'Home', 'url' => route('home')],
            ['label' => 'Programs', 'url' => ''],
        ]
    ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

    <section class="course-grid">
        <div class="container">
            <div class="row">
                <div class="col-xl-4 col-lg-5">
                    <form action="<?php echo e(route('programs.index')); ?>" method="GET">
                        <div class="course-grid__left">
                            <div class="course-grid__sidebar">
                                <div class="course-grid__search course-grid__single">
                                    <div class="course-grid__title-box">
                                        <h3 class="course-grid__title">Search Programs</h3>
                                        <div class="course-grid__title-shape-1">
                                            <img src="<?php echo e(asset('images/shapes/course-grid-title-shape-1.png')); ?>" alt="">
                                        </div>
                                    </div>
                                    <div class="course-grid__search-form">
                                        <input type="search" name="search" class="form-control" placeholder="Search by title or university" value="<?php echo e(request('search')); ?>">
                                        <button type="submit" class="thm-btn"><i class="icon-search"></i> Search</button>
                                    </div>
                                </div>

                                <div class="course-grid__categories course-grid__single">
                                    <div class="course-grid__title-box">
                                        <h3 class="course-grid__title">Country</h3>
                                        <div class="course-grid__title-shape-1">
                                            <img src="<?php echo e(asset('images/shapes/course-grid-title-shape-1.png')); ?>" alt="">
                                        </div>
                                    </div>
                                    <div class="course-grid__list-item">
                                        <div class="select-box">
                                            <select name="country" class="wide" onchange="this.form.submit()">
                                                <option value="">All Countries</option>
                                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $countries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $country): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                                                    <option value="<?php echo e($country->id); ?>" <?php echo e(request('country') == $country->id ? 'selected' : ''); ?>>
                                                        <?php echo e($country->name); ?>

                                                    </option>
                                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <div class="course-grid__discount course-grid__single">
                                    <div class="course-grid__discount-shape-bg" style="background-image: url(<?php echo e(asset('images/shapes/course-grid-discount-shape-bg.png')); ?>);"></div>
                                    <h4 class="course-grid__discount-title">Need Help Choosing?</h4>
                                    <p class="course-grid__discount-text">We can help you match a program to your budget and goals.</p>
                                    <div class="course-grid__discount-img">
                                        <img src="<?php echo e(asset('images/resources/course-grid-discount-img-1.png')); ?>" alt="">
                                    </div>
                                    <div class="course-grid__discount-coupon">
                                        <a href="<?php echo e(route('contact')); ?>" class="thm-btn">Book Consultation</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>

                <div class="col-xl-8 col-lg-7">
                    <div class="course-grid__right">
                        <div class="course-list__right-top">
                            <p class="course-list__right-top-text">
                                Showing <?php echo e($programs->firstItem() ?? 0); ?> - <?php echo e($programs->lastItem() ?? 0); ?> of <?php echo e($programs->total()); ?> programs
                            </p>
                            <div class="course-list__showing-sort">
                                <p>Sort by:</p>
                                <div class="select-box">
                                    <select class="wide" id="sortSelect" onchange="updateSort(this.value)">
                                        <option value="name-asc" <?php echo e(request('sort') == 'name' && request('direction') == 'asc' ? 'selected' : ''); ?>>Name A-Z</option>
                                        <option value="name-desc" <?php echo e(request('sort') == 'name' && request('direction') == 'desc' ? 'selected' : ''); ?>>Name Z-A</option>
                                        <option value="fee-asc" <?php echo e(request('sort') == 'fee' && request('direction') == 'asc' ? 'selected' : ''); ?>>Fee Low to High</option>
                                        <option value="fee-desc" <?php echo e(request('sort') == 'fee' && request('direction') == 'desc' ? 'selected' : ''); ?>>Fee High to Low</option>
                                        <option value="deadline-asc" <?php echo e(request('sort') == 'deadline' && request('direction') == 'asc' ? 'selected' : ''); ?>>Deadline Soonest</option>
                                    </select>
                                </div>
                            </div>
                        </div>

                        <div class="course-grid__right-content-box">
                            <div class="row">
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $programs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $program): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                                    <div class="col-xl-6">
                                        <div class="courses-two__single">
                                            <div class="courses-two__content">
                                                <div class="courses-two__doller-and-review">
                                                    <div class="courses-two__doller">
                                                        <p>$<?php echo e(number_format((float) $program->fee)); ?></p>
                                                    </div>
                                                    <div class="courses-two__review">
                                                        <p><?php echo e(ucfirst($program->degree_level)); ?></p>
                                                    </div>
                                                </div>

                                                <h3 class="courses-two__title">
                                                    <a href="<?php echo e(route('programs.show', $program->id)); ?>"><?php echo e($program->title); ?></a>
                                                </h3>
                                                <p class="courses-two__text">
                                                    <?php echo e(\Illuminate\Support\Str::limit($program->description ?? 'Study pathway at '.$program->university->name, 120)); ?>

                                                </p>
                                                <ul class="courses-two__meta list-unstyled">
                                                    <li>
                                                        <div class="icon"><span class="icon-book"></span></div>
                                                        <p><?php echo e($program->university->name); ?></p>
                                                    </li>
                                                    <li>
                                                        <div class="icon"><span class="icon-location"></span></div>
                                                        <p><?php echo e($program->university->country->name ?? 'Country'); ?></p>
                                                    </li>
                                                    <li>
                                                        <div class="icon"><span class="icon-clock"></span></div>
                                                        <p><?php echo e($program->application_deadline?->format('M d, Y') ?? 'Open'); ?></p>
                                                    </li>
                                                </ul>
                                                <div class="courses-two__btn-box mt-3">
                                                    <a href="<?php echo e(route('programs.show', $program->id)); ?>" class="thm-btn-two">
                                                        <span>View Program</span>
                                                        <i class="icon-angles-right"></i>
                                                    </a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>
                                    <div class="col-12 text-center py-5">
                                        <h4>No programs found.</h4>
                                    </div>
                                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            </div>
                        </div>

                        <div class="blog-list__pagination">
                            <?php echo e($programs->appends(request()->except('page'))->links('vendor.pagination.custom')); ?>

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

<?php $__env->startPush('scripts'); ?>
    <script>
        function updateSort(value) {
            const [sort, direction] = value.split('-');
            const url = new URL(window.location.href);
            url.searchParams.set('sort', sort);
            url.searchParams.set('direction', direction);
            window.location.href = url.toString();
        }
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/insightg/public_html/resources/views/programs/index.blade.php ENDPATH**/ ?>