Refactor course finder and resources templates for improved readability and functionality

- Updated course finder form to use HTML helper methods for cleaner syntax.
- Enhanced form structure with better class management and attributes.
- Implemented AJAX pagination for course listings to improve user experience.
- Cleaned up resource template code for consistency and readability.
- Ensured proper indentation and spacing for better maintainability.
- Added missing target="_blank" attribute for external links in resource documents.
This commit is contained in:
2025-08-03 18:01:22 +05:45
parent 5e4cb2767c
commit afc7c61f86
5 changed files with 582 additions and 450 deletions

View File

@@ -12,311 +12,301 @@
deciding where and what to study abroad can be a daunting task. Don't worry, we are here to guide you during
the entire process.</p>
</div>
<form id="filterForm" method="GET">
{{ html()->form('GET')->route('program.index')->class(['filter-form', 'filterForm'])->attributes(['id' => 'filter-form'])->open() }}
<div class="row">
<div class=" col col-md-9 ">
<div class=" course-finder-top">
<h2 class="text-black text-center text-24 py-10">Browse Subjects</h2>
{{ html()->text('search')->value(request('search'))->placeholder('Search Program')->class('form-control px-10 py-10')->style('width: 95%;') }}
<button type="submit" class="bg-transparent border-0"><i
class="lqd-icn-ess icon-ld-search-2 text-24 font-bold"></i></button>
</div>
</div>
</div>
<div class="py-20 ">
<div class="row">
<div class=" col col-md-9 ">
<div class=" course-finder-top">
<h2 class="text-black text-center text-24 py-10">Browse Subjects</h2>
<input class="w-full px-10 py-10" type="text" name="" id=""
value="{{ request('search') }}" placeholder="Search Your Favourite Subjects" autocomplete="off">
<button type="submit" class="bg-transparent border-0"><i
class="lqd-icn-ess icon-ld-search-2 text-24 font-bold"></i></button>
<div class="col col-md-9">
<div class="course-finder-form">
<h2 class="text-22 text-center text-sec font-bold">Browse Through Category</h2>
<div class="row">
<div class="col col-sm-6 col-md-4">
{{ html()->select('country_id', $countryOptions)->value(request('country_id'))->placeholder('Select Country')->class('form-select choices-select countryDropdown w-full py-10 px-5 text-14') }}
</div>
<div class="col col-sm-6 col-md-4">
{{ html()->select('institution_id', $institutionOptions)->value(request('institution_id'))->placeholder('Select Institution')->class('form-select institutionDropdown w-full py-10 px-5 text-14') }}
</div>
<div class="col col-sm-6 col-md-4">
{{ html()->select('programlevel_id', $programLevelOptions)->value(request('programlevel_id'))->placeholder('Select Program Level')->class('form-select choices-select w-full py-10 px-5 text-14') }}
</div>
<div class="col col-sm-6 col-md-4">
{{ html()->select('intake_id', $intakeOptions)->value(request('intake_id'))->placeholder('Select Intake')->class('form-select choices-select w-full py-10 px-5 text-14') }}
</div>
@php
$statusList = config('constants.page_status_options');
$hasClass = false;
$hasStatus = false;
if (request()->has('class_id')) {
$hasClass = true;
}
if (request()->has('status')) {
$hasStatus = true;
}
@endphp
<div class="col col-sm-6 col-md-4">
{{ html()->select('test_id', $testOptions)->value(request('test_id'))->placeholder('Test Proficiency')->class('form-select choices-select w-full py-10 px-5 text-14') }}
</div>
<div class="col col-sm-6 col-md-4">
<div class="flex gap-10 items-center flex-wrp">
<input class="text-14 px-5 py-10 w-50percent" type="text" name="min_score"
placeholder="Min score" value="{{ request('min_score') }}">
<input class="text-14 px-5 py-10 w-50percent" type="text" placeholder="Max Score"
value="{{ request('max_score') }}">
</div>
</div>
<div class="col col-sm-12">
<div class="flex gap-20 justify-center items-center">
<button type="submit"
class="text-14 px-20 py-10 rounded-10 bg-sec text-white border-0">Submit</button>
<a href="javascript:void(0)" onclick="resetForm()"><button
class="text-14 px-20 py-10 rounded-10 bg-brand text-white border-0">Reset</button></a>
</div>
</div>
</div>
</div>
</div>
</div>
{{ html()->form()->close() }}
<div class="py-20 ">
<div class="row">
<div class="col col-md-9">
<div class="course-finder-form">
<h2 class="text-22 text-center text-sec font-bold">Browse Through Category</h2>
<div class="row">
<div class="col col-sm-6 col-md-4">
<select class="w-full py-10 px-5 text-14" name="country_id"
value="{{ request('country_id') }}">
<option value="" selected hidden>Choose Country</option>
@foreach ($countryOptions as $key => $value)
<option value="{{ $key }}" @selected(request('country_id') == $key)>
{{ $value }}</option>
@endforeach
</select>
</div>
<div class="data-wrapper py-20">
<h2 class="text-22 text-center text-sec font-bold">Available Courses</h2>
@forelse ($programs as $item)
<div class="course-finder-box">
<div class="row">
<div class="col col-md-2">
<div class="sm:w-50percent w-full h-70">
<img class="w-full h-full" src="{{ $item->institution?->image }}"
alt="">
</div>
</div>
<div class="col col-sm-6 col-md-4">
<select class=" w-full py-10 px-5 text-14" name="" id="institutionDropdown"
name="institution_id">
<option value="" selected>Choose Institution</option>
@foreach ($institutionOptions as $key => $Institution)
<option value="{{ $key }}" @selected(request('institution_id') == $key)>
{{ $Institution }}</option>
@endforeach
</select>
</div>
<div class="col col-md-7">
<div class="flex flex-col gap-5">
<h3 class="text-20 font-medium">{{ $item->title }}</h3>
<h5 class="text-16 font-lighter">{{ $item->institution?->title }} <span
class="text-brand">{{ $item->institution?->country?->title }}</span>
</h5>
<div class="flex gap-10 items-center">
<h6 class="text-grey font-medium text-14"><span
class="font-bold">Code:</span>
{{ !empty($item->code) ? $item->code : 'N/A' }}</h6>
<h6 class="text-grey font-medium text-14"><span
class="font-bold">Fee:</span>
{{ !empty($item->fee) ? $item->fee : 'N/A' }}</h6>
<h6 class="text-grey font-medium text-14"><span
class="font-bold">Schlorship:</span>
{{ !empty($item->scholarship) ? $item->scholarship : 'N/A' }}</h6>
</div>
<div class="col col-sm-6 col-md-4">
<select class=" w-full py-10 px-5 text-14" name="programlevel_id"
value="{{ request('institution_id') }}">
<option value="" selected hidden>Choose Level</option>
@foreach ($programLevelOptions as $key => $Level)
<option value="{{ $key }}" @selected(request('programlevel_id') == $key)>
{{ $Level }}</option>
@endforeach
</select>
</div>
<div class="flex gap-10 items-center">
<h6 class="text-grey font-medium text-14"><span
class="font-bold">Level:</span>
{{ !empty($item->programlevel?->title) ? $item->programlevel?->title : 'N/A' }}
</h6>
<h6 class="text-grey font-medium text-14"><span
class="font-bold">Duration:</span>
{{ !empty($item->year) ? $item->year : 'N/A' }}</h6>
</h6>
<h6 class="text-grey font-medium text-14"><span
class="font-bold">PSW:</span>
{{ !empty($item->psw) ? $item->psw : 'N/A' }}</h6>
</h6>
</div>
<div class="col col-sm-6 col-md-4">
<select class=" w-full py-10 px-5 text-14" name="intake_id"
value="{{ request('intake_id') }}">
<option value="" selected hidden>Choose Intake</option>
@foreach ($intakeOptions as $key => $Intake)
<option value="{{ $key }}" @selected(request('intake_id') == $key)>
{{ $Intake }}</option>
@endforeach
</select>
</div>
</div>
<div class="col col-sm-6 col-md-4">
<select class=" w-full py-10 px-5 text-14" name="test_id"
value="{{ request('test_id') }}">
<option value="" selected hidden>Choose Class</option>
@foreach ($testOptions as $key => $Test)
<option value="{{ $key }}" @selected(request('test_id') == $key)>
{{ $Test }}</option>
@endforeach
</select>
</div>
</div>
<div class="col col-md-3">
<div class="flex flex-col gap-10 ">
@foreach ($item->tests as $index => $test)
<h6 class="text-black text-16 font-medium"><span
class="font-bold">{{ $test->title }}:</span>
{{ $test->pivot?->min_score }}
({{ $test->pivot?->band_score }})
</h6>
@endforeach
</div>
<div class="col col-sm-6 col-md-4">
<div class="flex gap-10 items-center flex-wrp">
<input class="text-14 px-5 py-10 w-50percent" type="text" name="min_score"
placeholder="Min score" value="{{ request('min_score') }}">
<input class="text-14 px-5 py-10 w-50percent" type="text" placeholder="Max Score"
value="{{ request('max_score') }}">
</div>
</div>
<div class="col col-sm-12">
<div class="flex gap-20 justify-center items-center">
<button type="submit"
class="text-14 px-20 py-10 rounded-10 bg-sec text-white border-0">Submit</button>
<a href="javascript:void(0)" onclick="resetForm()"><button
class="text-14 px-20 py-10 rounded-10 bg-brand text-white border-0">Reset</button></a>
<div class="row">
<div class="col col-12">
<div class="flex items-center gap-10">
@if (!empty($item->intakes))
<h6 class="text-16">Intake:</h6>
@forelse ($item->intakes as $value)
<h6 class="bg-sec text-14 text-white px-5 py-5 rounded-10 font-bold">
{{ $intakeOptions[$value] }}</h6>
</h6>
@empty
<span class="fs-13 text-muted mb-0 text-center"><span
class="badge bg-danger p-2">N/A</span></span>
@endforelse
@endif
</div>
</div>
</div>
</div>
</div>
</form>
<div class="py-20">
{{-- <div class="course-finder-box">
<div class="row">
<div class="col col-md-2">
<div class="sm:w-50percent w-full h-70">
<img class="w-full h-full" src="assets/images/general/university.jpg" alt="">
</div>
</div>
<div class="col col-md-7">
<div class="flex flex-col gap-5">
<h3 class="text-20 font-medium">(STEM) Bachelor of Architecture (BArch)</h3>
<h5 class="text-16 font-lighter">Marywood University <span class="text-brand">(USA)</span></h5>
<div class="flex gap-10 items-center">
<h6 class="text-grey font-medium text-14"><span class="font-bold">Code:</span>
BArch</h6>
<h6 class="text-grey font-medium text-14"><span class="font-bold">Fee:</span>
$41,3700 per year</h6>
<h6 class="text-grey font-medium text-14"><span class="font-bold">Schlorship:</span> Upto
$23,000</h6>
</div>
<div class="flex gap-10 items-center">
<h6 class="text-grey font-medium text-14"><span class="font-bold">Level:</span>
Bachelor</h6>
<h6 class="text-grey font-medium text-14"><span class="font-bold">Duration:</span> N/A
</h6>
</div>
</div>
</div>
<div class="col col-md-3">
<div class="flex flex-col gap-10 ">
<h6 class="text-black text-16 font-medium"><span class="font-bold">IELTS:</span>
5.5(5.5)</h6>
<h6 class="text-gray text-16 font-medium"><span class="font-bold">PTE:</span>
48(48)</h6>
<h6 class="text-gray text-16 font-medium"><span class="font-bold">Duolingo:</span>
90 Overall</h6>
</div>
@empty
<div class="text-center">
<p class="text-danger">No Course Found !!!</p>
</div>
@endforelse
{{ $programs->links() }}
</div>
</div>
<div class="col col-md-3">
<div class=" sticky top-60 " data-custom-animations="true"
data-ca-options='{"animationTarget": ".btn, h2", "ease": "power4.out", "initValues":{"x": "-10px", "y": "10px", "opacity":0} , "animations":{"x": "0px", "y": "0px", "opacity":1}}'>
<div
class="module-title flex flex-col h-full relative bg-size bg-no-repeat bg-center-right transition-all pt-30 pb-30 px-20 sm:mr-0 rounded-10">
<div class="row">
<div class="col col-12">
<div class="flex items-center gap-10">
<h6 class="text-16">Intake:</h6>
<h6 class="bg-sec text-14 text-white px-5 py-5 rounded-10 font-bold">January
</h6>
<h6 class="bg-sec text-14 text-white px-5 py-5 rounded-10 font-bold">January
</h6>
<div class="d-flex justify-center pb-10">
<h2
class="ld-fh-element mb-0/2em inline-block relative leading-45 -mt-0/2em text-sec text-20">
Get Your Free Counselling!
</h2>
</div>
<form action="{{ route('enquiry.store') }}" method="post" id="contact-form">
@csrf
<input class="w-full mb-30 rounded-6 py-15 text-14 px-10 bg-light-blue border-light-grey"
type="text" name="name" id="" placeholder="Full Name">
<input class="w-full mb-30 rounded-6 py-15 text-14 px-10 bg-light-blue border-light-grey"
type="text" name="phone" id="" placeholder="Phone">
<input class="w-full mb-30 rounded-6 py-15 text-14 px-10 bg-light-blue border-light-grey"
type="email" name="email" id="" placeholder="Email">
<textarea class="w-full mb-20 rounded-6 py-15 text-14 px-10 bg-light-blue border-light-grey" name="subject"
id="" placeholder="Message"></textarea>
<button type="submit" id="submit-btn"
class="px-20 py-10 bg-sec text-white rounded-30 text-14 border-0 button-hover">Submit</button>
</form>
</div>
</div>
</div>
</div>
<div class="course-finder-box">
<div class="row">
<div class="col col-md-2">
<div class="sm:w-50percent w-full h-70">
<img class="w-full h-full" src="assets/images/general/university.jpg" alt="">
</div>
</div>
<div class="col col-md-7">
<div class="flex flex-col gap-5">
<h3 class="text-20 font-medium">(STEM) Bachelor of Architecture (BArch)</h3>
<h5 class="text-16 font-lighter">Marywood University <span class="text-brand">(USA)</span>
</h5>
<div class="flex gap-10 items-center">
<h6 class="text-grey font-medium text-14"><span class="font-bold">Code:</span>
BArch</h6>
<h6 class="text-grey font-medium text-14"><span class="font-bold">Fee:</span>
$41,3700 per year</h6>
<h6 class="text-grey font-medium text-14"><span class="font-bold">Schlorship:</span> Upto
$23,000</h6>
</div>
<div class="flex gap-10 items-center">
<h6 class="text-grey font-medium text-14"><span class="font-bold">Level:</span> Bachelor
</h6>
<h6 class="text-grey font-medium text-14"><span class="font-bold">Duration:</span> N/A
</h6>
</div>
</div>
</div>
<div class="col col-md-3">
<div class="flex flex-col gap-10 ">
<h6 class="text-black text-16 font-medium"><span class="font-bold">IELTS:</span>
5.5(5.5)</h6>
<h6 class="text-gray text-16 font-medium"><span class="font-bold">PTE:</span>
48(48)</h6>
<h6 class="text-gray text-16 font-medium"><span class="font-bold">Duolingo:</span>
90 Overall</h6>
</div>
</div>
</div>
<div class="row">
<div class="col col-12">
<div class="flex items-center gap-10">
<h6 class="text-16">Intake:</h6>
<h6 class="bg-sec text-14 text-white px-5 py-5 rounded-10 font-bold">January
</h6>
<h6 class="bg-sec text-14 text-white px-5 py-5 rounded-10 font-bold">January
</h6>
</div>
</div>
</div>
</div>
<div class="course-finder-box">
<div class="row">
<div class="col col-md-2">
<div class="sm:w-50percent w-full h-70">
<img class="w-full h-full" src="assets/images/general/university.jpg" alt="">
</div>
</div>
<div class="col col-md-7">
<div class="flex flex-col gap-5">
<h3 class="text-20 font-medium">(STEM) Bachelor of Architecture (BArch)</h3>
<h5 class="text-16 font-lighter">Marywood University <span class="text-brand">(USA)</span>
</h5>
<div class="flex gap-10 items-center">
<h6 class="text-grey font-medium text-14"><span class="font-bold">Code:</span>
BArch</h6>
<h6 class="text-grey font-medium text-14"><span class="font-bold">Fee:</span>
$41,3700 per year</h6>
<h6 class="text-grey font-medium text-14"><span class="font-bold">Schlorship:</span> Upto
$23,000</h6>
</div>
<div class="flex gap-10 items-center">
<h6 class="text-grey font-medium text-14"><span class="font-bold">Level:</span> Bachelor
</h6>
<h6 class="text-grey font-medium text-14"><span class="font-bold">Duration:</span> N/A
</h6>
</div>
</div>
</div>
<div class="col col-md-3">
<div class="flex flex-col gap-10 ">
<h6 class="text-black text-16 font-medium"><span class="font-bold">IELTS:</span>
5.5(5.5)</h6>
<h6 class="text-gray text-16 font-medium"><span class="font-bold">PTE:</span>
48(48)</h6>
<h6 class="text-gray text-16 font-medium"><span class="font-bold">Duolingo:</span>
90 Overall</h6>
</div>
</div>
</div>
<div class="row">
<div class="col col-12">
<div class="flex items-center gap-10">
<h6 class="text-16">Intake:</h6>
<h6 class="bg-sec text-14 text-white px-5 py-5 rounded-10 font-bold">January
</h6>
<h6 class="bg-sec text-14 text-white px-5 py-5 rounded-10 font-bold">January
</h6>
</div>
</div>
</div>
</div> --}}
<div class="text-center">
<p class="text-danger">No Course Found !!!</p>
</div>
</div>
</div>
<div class="col col-md-3">
<div class=" sticky top-60 " data-custom-animations="true"
data-ca-options='{"animationTarget": ".btn, h2", "ease": "power4.out", "initValues":{"x": "-10px", "y": "10px", "opacity":0} , "animations":{"x": "0px", "y": "0px", "opacity":1}}'>
<div
class="module-title flex flex-col h-full relative bg-size bg-no-repeat bg-center-right transition-all pt-30 pb-30 px-20 sm:mr-0 rounded-10">
<div class="d-flex justify-center pb-10">
<h2 class="ld-fh-element mb-0/2em inline-block relative leading-45 -mt-0/2em text-sec text-20">
Get Your Free Counselling!
</h2>
</div>
<form action="{{ route('enquiry.store') }}" method="post" id="contact-form">
@csrf
<input class="w-full mb-30 rounded-6 py-15 text-14 px-10 bg-light-blue border-light-grey" type="text"
name="name" id="" placeholder="Full Name">
<input class="w-full mb-30 rounded-6 py-15 text-14 px-10 bg-light-blue border-light-grey" type="text"
name="phone" id="" placeholder="Phone">
<input class="w-full mb-30 rounded-6 py-15 text-14 px-10 bg-light-blue border-light-grey"
type="email" name="email" id="" placeholder="Email">
<textarea class="w-full mb-20 rounded-6 py-15 text-14 px-10 bg-light-blue border-light-grey" name="subject"
id="" placeholder="Message"></textarea>
<button type="submit" id="submit-btn"
class="px-20 py-10 bg-sec text-white rounded-30 text-14 border-0 button-hover">Submit</button>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- next row for b -->
<!-- form starts -->
<!-- next row for b -->
<!-- form starts -->
</div>
@endsection
@push('js')
<script>
const url = "{{ route('program.getCoursesList') }}";
let isLoading = false;
$(document).ready(function() {
setTimeout(() => {
infiniteLoadMore(1)
}, 2000);
})
// var institutionSelect = $('.institution-select').select2();
$(document).on('submit', '#filter-course-form', function(event) {
event.preventDefault();
const page = 1;
if (!isLoading) {
isLoading = true;
infiniteLoadMore(page);
}
})
// $(document).on('click', '.reset-course-filter', function(event) {
// event.preventDefault();
// const page = 1;
// $('.institution-select').val(null).trigger('change.select2');
// institutionSelect.select2('destroy').select2();
// $('#filter-course-form')
// .find('input:not([type="hidden"]), select, textarea')
// .val('')
// .prop('checked', false)
// .prop('selected', false);
// if (!isLoading) {
// isLoading = true;
// infiniteLoadMore(page);
// }
// })
$(document).on('click', '.pagination .page-link', function(event) {
event.preventDefault();
const page = $(this).attr('href').split('page=')[1];
if (!isLoading) {
isLoading = true;
infiniteLoadMore(page);
}
});
function infiniteLoadMore(page) {
$.ajax({
url: `${url}?page=${page}`,
datatype: "html",
type: "GET",
data: $('#filter-course-form').serializeArray(),
beforeSend: function() {
$("#data-wrapper").empty();
$('.auto-load').show();
}
})
.done(function(response) {
if (response.html == '') {
$('#total-result').text(`Total Results: ${response.queryCount}`);
$('.pagination').closest().parent().find('nav').hide();
$("#data-wrapper").empty().append(`
<div class="card">
<div class="card-body">
<p class="d-flex align-items-center justify-content-center">
No data to display :(
</p>
</div>
</div>
`);
$('.auto-load').hide();
return;
}
$('.auto-load').hide();
$('#total-result').text(`Total Results: ${response.queryCount}`);
$("#data-wrapper").empty().append(response.html);
})
.fail(function(jqXHR, ajaxOptions, thrownError) {
console.log('Server error occurred');
})
.always(function() {
isLoading = false;
});
}
</script>
@endpush