Skip to content

Commit 4dc5eb8

Browse files
committed
fix: reverse filtering when thana is selected
1 parent 34a33eb commit 4dc5eb8

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

app/Http/Controllers/Frontend/Page/PageController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function appointmentPage(Request $request, ?ExpertProfile $expertProfile
6565
if ($defaultDistrict) {
6666
$q->where('district', $defaultDistrict);
6767
}
68-
if ($request->query('branch-thana')) {
68+
if ($request->query('dist_only', false) && $request->query('branch-thana')) {
6969
$q->where('thana', $request->query('branch-thana'));
7070
}
7171
if ($expertProfile != null) {
@@ -135,7 +135,7 @@ public function officePage(Request $request)
135135
{
136136
$admin = User::role('super admin')->first();
137137
$maps = Map::where(function (Builder $q) use ($request, $admin) {
138-
if ($request->query('thana')) {
138+
if ($request->query('dist_only', false) && $request->query('thana')) {
139139
$q->where('thana', $request->query('thana'));
140140
}
141141
if ($request->query('district', 'Chattogram')) {

resources/views/frontend/layouts/app.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
2+
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" x-data>
33

44
<x-frontend.layouts.head description="Fill tax with ease and comfort" :favicon="$settings->basic->favicon" />
55

resources/views/frontend/pages/appointment/makeAppointment.blade.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,14 @@ class="text-muted fs-6">(selected)</span></h5>
151151
class="text-danger">*</span></label>
152152
<select class="hx-include !w-full"
153153
hx-get="{{ $expertProfile ?? false ? route('consultation.make', ['expertProfile' => $expertProfile]) : route('appointment.make') }}"
154+
hx-vals="{'dist_only': 'true'}"
154155
hx-select="#hx-filter-target" hx-include=".hx-include"
155156
hx-target="#hx-filter-target" hx-swap="outerHTML"
156157
label="Select District" id="branch-district"
157158
name="branch-district" required
158159
placeholder="Select District...">
159-
<option selected disabled value="">Select a district</option>
160+
<option selected disabled value="">Select a district
161+
</option>
160162
@foreach ($branchDistricts as $district)
161163
<option value="{{ $district }}"
162164
@selected(trim($district) == 'Chattogram')>{{ trim($district) }}
@@ -175,7 +177,8 @@ class="text-danger">*</span></label>
175177
hx-target="#hx-filter-target" hx-swap="outerHTML"
176178
id="branch-thana" name="branch-thana" required
177179
placeholder="Select Thana...">
178-
<option selected disabled value="">Select a thana</option>
180+
<option selected disabled value="">Select a thana
181+
</option>
179182
@foreach ($branchThanas as $thana)
180183
<option value="{{ trim($thana) }}"
181184
@selected(trim($thana) == request()->query('branch-thana'))>{{ $thana }}
@@ -209,8 +212,9 @@ class="location-input"
209212
id="location-input-{{ $map->id }}"
210213
value="{{ $map->id }}" hidden>
211214
</label>
212-
@empty
213-
<div class="p-5 rounded bg-gray-200">No branches found for selected location</div>
215+
@empty
216+
<div class="p-5 rounded bg-gray-200">No branches found for
217+
selected location</div>
214218
@endforelse
215219
</div>
216220

resources/views/frontend/pages/office.blade.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
<div class="flex items-center gap-2 mt-3">
2525
<label for="branch-thana">District: </label>
2626
<select class="grow hx-include" hx-include=".hx-include"
27-
hx-get="{{ route('office') }}" hx-select="#hx-filter-target"
27+
hx-get="{{ route('office') }}"
28+
hx-vals="{'dist_only': 'true'}"
29+
hx-select="#hx-filter-target"
2830
hx-target="#hx-filter-target" hx-swap="outerHTML" label="Select District"
2931
id="branch-district" name="district" placeholder="Select District...">
3032
<option selected disabled value="">Select a district</option>

0 commit comments

Comments
 (0)