maintained filteration in stay type in cost calculator

This commit is contained in:
2025-08-25 16:20:07 +05:45
parent dc32ac8f91
commit 658d3600a2
4 changed files with 184 additions and 166 deletions

View File

@@ -14,10 +14,9 @@ class CostCalculatorService
$query->where('country_id', $request->country_id);
}
if ($request->filled('stay_type_id')) {
$query->where("stay_type_id", $request->stay_type_id);
}
// if ($request->filled('stay_type_id')) {
// $query->where("stay_type_id", $request->stay_type_id);
// }
})->latest()->paginate(10)->withQueryString();
}

View File

@@ -18,6 +18,7 @@ use Modules\CourseFinder\Models\Coop;
use Modules\CourseFinder\Models\Program;
use Modules\CourseFinder\Models\ProgramLevel;
use Modules\CourseFinder\Services\ProgramService;
use Illuminate\Support\Str;
class WebsiteController extends Controller
{
@@ -328,14 +329,16 @@ class WebsiteController extends Controller
};
$data = [
'serviceStatus' => $request->services,
'costs' => $costs,
'fee' => $program,
'title' => 'View Cost Calculation',
'cost' => $cost,
'type' => Str::slug($request->status_type_id),
'breakdowns' => [
'alone' => $getBreakdown('Alone'),
'with_spouse' => $getBreakdown('With Spouse'),
'with_spouse_and_child' => $getBreakdown('With Spouse and Child'),
'with-spouse' => $getBreakdown('With Spouse'),
'with-spouse-and-child' => $getBreakdown('With Spouse and Child'),
],
];

View File

@@ -147,11 +147,13 @@
@foreach ($countries as $country)
<div class="col col-sm-4">
<div>
<label class="text-20 text-ter p-0 m-0 flex items-center gap-10 px-10 py-12 bg-white rounded-30 tabs"
for="{{ $country->id }}"> <input type="radio" name="country_id" value="{{ $country->id }}"
id="{{ $country->id }}"> {{ $country->title }} </label>
<label
class="text-20 text-ter p-0 m-0 flex items-center gap-10 px-10 py-12 bg-white rounded-30 tabs"
for="{{ $country->id }}"> <input type="radio" name="country_id"
value="{{ $country->id }}" id="{{ $country->id }}">
{{ $country->title }} </label>
</div>
</div>
@endforeach
@@ -166,10 +168,12 @@
@foreach ($livingStatusOptions as $key => $status)
<div class="col col-sm-6">
<div class="">
<label class="text-20 text-ter p-0 m-0 flex items-center gap-10 px-10 py-12 bg-white rounded-30 tabs"
for="{{ $status }}"> <input type="radio" name="status_type_id" value="{{ $key }}"
id="{{ $status }}"> {{ $status }}</label>
<label
class="text-20 text-ter p-0 m-0 flex items-center gap-10 px-10 py-12 bg-white rounded-30 tabs"
for="{{ $status }}"> <input type="radio"
name="status_type_id" value="{{ $status }}"
id="{{ $status }}"> {{ $status }}</label>
</div>
</div>
@endforeach
@@ -183,18 +187,24 @@
<div class="row flex flex-wrap py-20">
<div class="col col-sm-4">
<div>
<label class="text-20 text-ter p-0 m-0 flex items-center gap-10 px-10 py-12 bg-white rounded-30 tabs" for="serviceYes"> <input name="services" type="radio" id="serviceYes"> Yes</label>
<label
class="text-20 text-ter p-0 m-0 flex items-center gap-10 px-10 py-12 bg-white rounded-30 tabs"
for="yes"> <input name="services" type="radio" id="yes"
value="yes"> Yes</label>
</div>
</div>
<div class="col col-sm-4">
<div >
<div>
<label class="text-20 text-ter p-0 m-0 flex items-center gap-10 px-10 py-12 bg-white rounded-30 tabs" for="serviceNo"> <input name="services" type="radio" id="serviceNo">No</label>
<label
class="text-20 text-ter p-0 m-0 flex items-center gap-10 px-10 py-12 bg-white rounded-30 tabs"
for="no"> <input name="services" type="radio" id="no"
value="no">No</label>
</div>
@@ -209,12 +219,14 @@
<div class="row flex flex-wrap py-20">
@foreach ($programLevelOptions as $level)
<div class="col col-sm-4">
<div >
<label class="text-20 text-ter p-0 m-0 flex items-center gap-10 px-10 py-12 bg-white rounded-30 tabs"
for="{{ $level }}"> <input type="radio" name="" id="{{ $level }}"
value=""> {{ $level }}</label>
<div>
<label
class="text-20 text-ter p-0 m-0 flex items-center gap-10 px-10 py-12 bg-white rounded-30 tabs"
for="{{ $level }}"> <input type="radio" name=""
id="{{ $level }}" value="">
{{ $level }}</label>
</div>
</div>
@endforeach

View File

@@ -53,128 +53,133 @@
<div class="container-fluid">
<div class="row justify-content-center">
<div class="col-lg-12">
@foreach ($breakdowns as $type => $breakdown)
<div class="a4-page">
{{-- <div class="card shadow-lg border-0 rounded-4"> --}}
<div class="bg-warning-subtle position-relative">
<div class="card-body text-center py-10">
<a class="navbar-brand p-0" href="{{ url('/') }}" rel="home">
<span class="navbar-brand-inner">
<img src="{{ asset(setting('logo')) }}" alt="raffle logo" width="150px"
height="150px" />
</span>
</a>
</div>
@php
$breakdown = $breakdowns[$type];
@endphp
<div class="a4-page">
{{-- <div class="card shadow-lg border-0 rounded-4"> --}}
<div class="bg-warning-subtle position-relative">
<div class="card-body text-center py-10">
<a class="navbar-brand p-0" href="{{ url('/') }}" rel="home">
<span class="navbar-brand-inner">
<img src="{{ asset(setting('logo')) }}" alt="raffle logo" width="150px"
height="150px" />
</span>
</a>
</div>
<div class="text-center">
<p class="mb-0 fs-5 test-muted"><i>Estimated Cost Calculation For
{{ $cost->country?->title ?? 'N/A' }}</i> (<strong
class="text-capitalize">{{ strtoupper(str_replace('_', ' ', $type)) }}</strong>)
</p>
</div>
<div class="text-center">
<p class="mb-0 fs-5 test-muted"><i>Estimated Cost Calculation For
{{ $cost->country?->title ?? 'N/A' }}</i> (<strong
class="text-capitalize">{{ strtoupper(str_replace('_', ' ', $type)) }}</strong>)
</p>
</div>
<!-- Body -->
<div class="card-body p-4">
<!-- Tution Fee -->
<h6 class="fw-bold mt-4 text-primary">Tution Fee</h6>
<div class="table-responsive">
<table
class="table table-sm table-bordered table-striped shadow-sm rounded align-middle text-center small">
<thead>
<tr class="fw-bold text-uppercase text-end small">
<th></th>
<th>Yearly</th>
</tr>
</thead>
<tbody>
<tr>
<td class="fw-semibold text-muted">{{ $fee['title'] }}</td>
<td class="text-end">
{{ $fee['fee'] }}
</td>
</tr>
</tbody>
</table>
</div>
<!-- Tution Fee -->
<!-- Living & Accommodation -->
<h6 class="fw-bold mt-30 text-primary">Recurring Costs</h6>
<div class="table-responsive">
<table
class="table table-sm table-bordered table-striped shadow-sm rounded align-middle text-center small">
<thead>
<tr class="fw-bold text-uppercase text-end small">
<th></th>
<th>Monthly</th>
<th>Yearly</th>
</tr>
</thead>
<tbody>
<tr>
<td class="fw-semibold text-muted">Living Cost</td>
<td class="text-end">{{ $breakdown['living']['monthly'] }}</td>
<td class="text-end">{{ $breakdown['living']['yearly'] }}</td>
</tr>
<tr>
<td class="fw-semibold text-muted">Accommodation Cost</td>
<td class="text-end">{{ $breakdown['accomodation']['monthly'] }}</td>
<td class="text-end">{{ $breakdown['accomodation']['yearly'] }}</td>
</tr>
<tr class="table-success">
<td class="fw-bold text-uppercase">Total Recurring</td>
<td class="fw-bold text-end">
<span class="badge bg-success fs-6 px-2 py-1">
{{ $breakdown['living']['monthly'] + $breakdown['accomodation']['monthly'] }}
</span>
</td>
<td class="fw-bold text-end">
<span class="badge bg-success fs-6 px-2 py-1">
{{ $breakdown['living']['yearly'] + $breakdown['accomodation']['yearly'] }}
</span>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Living & Accommodation -->
<!-- One-time Costs -->
<h6 class="fw-bold mt-30 text-primary">One-time Costs</h6>
<div class="table-responsive">
<table
class="table table-sm table-hover table-striped border rounded shadow-sm align-middle small">
<tbody>
<tr>
<td class="fw-semibold text-muted">Visa</td>
<td class="text-end">{{ $breakdown['onetime']['visa'] }}</td>
</tr>
<tr>
<td class="fw-semibold text-muted">Biometrics</td>
<td class="text-end">{{ $breakdown['onetime']['biometrics'] }}</td>
</tr>
<tr>
<td class="fw-semibold text-muted">SEVIS</td>
<td class="text-end">{{ $breakdown['onetime']['sevis'] }}</td>
</tr>
<tr>
<td class="fw-semibold text-muted">Application</td>
<td class="text-end">{{ $breakdown['onetime']['application'] }}</td>
</tr>
<tr class="table-success">
<td class="fw-bold text-uppercase">Total One-time</td>
<td class="fw-bold text-end">
<span class="badge bg-success fs-6 px-2 py-1">
{{ $breakdown['onetime']['total'] }}
</span>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Body -->
<div class="card-body p-4">
<!-- Tution Fee -->
<h6 class="fw-bold mt-4 text-primary">Tution Fee</h6>
<div class="table-responsive">
<table
class="table table-sm table-bordered table-striped shadow-sm rounded align-middle text-center small">
<thead>
<tr class="fw-bold text-uppercase text-end small">
<th></th>
<th>Yearly</th>
</tr>
</thead>
<tbody>
<tr>
<td class="fw-semibold text-muted">{{ $fee['title'] }}</td>
<td class="text-end">
{{ $fee['fee'] }}
</td>
</tr>
</tbody>
</table>
</div>
<!-- Tution Fee -->
<!-- Living & Accommodation -->
<h6 class="fw-bold mt-30 text-primary">Recurring Costs</h6>
<div class="table-responsive">
<table
class="table table-sm table-bordered table-striped shadow-sm rounded align-middle text-center small">
<thead>
<tr class="fw-bold text-uppercase text-end small">
<th></th>
<th>Monthly</th>
<th>Yearly</th>
</tr>
</thead>
<tbody>
<tr>
<td class="fw-semibold text-muted">Living Cost</td>
<td class="text-end">{{ $breakdown['living']['monthly'] }}</td>
<td class="text-end">{{ $breakdown['living']['yearly'] }}</td>
</tr>
<tr>
<td class="fw-semibold text-muted">Accommodation Cost</td>
<td class="text-end">{{ $breakdown['accomodation']['monthly'] }}</td>
<td class="text-end">{{ $breakdown['accomodation']['yearly'] }}</td>
</tr>
<tr class="table-success">
<td class="fw-bold text-uppercase">Total Recurring</td>
<td class="fw-bold text-end">
<span class="badge bg-success fs-6 px-2 py-1">
{{ $breakdown['living']['monthly'] + $breakdown['accomodation']['monthly'] }}
</span>
</td>
<td class="fw-bold text-end">
<span class="badge bg-success fs-6 px-2 py-1">
{{ $breakdown['living']['yearly'] + $breakdown['accomodation']['yearly'] }}
</span>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Living & Accommodation -->
<!-- One-time Costs -->
<h6 class="fw-bold mt-30 text-primary">One-time Costs</h6>
<div class="table-responsive">
<table
class="table table-sm table-hover table-striped border rounded shadow-sm align-middle small">
<tbody>
<tr>
<td class="fw-semibold text-muted">Visa</td>
<td class="text-end">{{ $breakdown['onetime']['visa'] }}</td>
</tr>
<tr>
<td class="fw-semibold text-muted">Biometrics</td>
<td class="text-end">{{ $breakdown['onetime']['biometrics'] }}</td>
</tr>
<tr>
<td class="fw-semibold text-muted">SEVIS</td>
<td class="text-end">{{ $breakdown['onetime']['sevis'] }}</td>
</tr>
<tr>
<td class="fw-semibold text-muted">Application</td>
<td class="text-end">{{ $breakdown['onetime']['application'] }}</td>
</tr>
<tr class="table-success">
<td class="fw-bold text-uppercase">Total One-time</td>
<td class="fw-bold text-end">
<span class="badge bg-success fs-6 px-2 py-1">
{{ $breakdown['onetime']['total'] }}
</span>
</td>
</tr>
</tbody>
</table>
</div>
@if ($serviceStatus === 'yes')
<!-- Service Costs -->
<h6 class="fw-bold mt-30 text-primary">Service Costs</h6>
<div class="table-responsive">
@@ -204,32 +209,31 @@
</tbody>
</table>
</div>
@endif
<!-- Overall -->
<div class="table-responsive mt-4">
<table
class="table table-sm table-bordered shadow-sm rounded-4 text-center align-middle small">
<tbody>
<tr class="table-warning align-middle">
<td class="fw-bold text-uppercase">
<strong>Overall Estimated Cost</strong>
<div class="small fst-italic text-muted">
(Excluding Recurring Costs)
</div>
</td>
<td class="text-end">
<strong>{{ $breakdown['service']['total'] + $breakdown['onetime']['total'] + $fee['fee'] }}</strong>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Overall -->
<div class="table-responsive mt-4">
<table
class="table table-sm table-bordered shadow-sm rounded-4 text-center align-middle small">
<tbody>
<tr class="table-warning align-middle">
<td class="fw-bold text-uppercase">
<strong>Overall Estimated Cost</strong>
<div class="small fst-italic text-muted">
(Excluding Recurring Costs)
</div>
</td>
<td class="text-end">
<strong>{{ $breakdown['service']['total'] + $breakdown['onetime']['total'] + $fee['fee'] }}</strong>
</td>
</tr>
</tbody>
</table>
</div>
</div>
{{-- </div> --}}
@endforeach
</div>
</div>
</div>
</div>