Commit cb29aec7 by Arpit Jain

Completed project review point and also add 404 and 405 page

parent b9b8d94a
...@@ -99,7 +99,9 @@ class SearchController extends Controller ...@@ -99,7 +99,9 @@ class SearchController extends Controller
} }
$html = view('frontend.searchs.location_element', compact('finalData', 'links', 'meta'))->render(); $locality = $request->locality;
$html = view('frontend.searchs.location_element', compact('finalData', 'links', 'meta', 'locality'))->render();
return ['status' => 'success', 'data' => $html]; return ['status' => 'success', 'data' => $html];
} }
...@@ -113,22 +115,14 @@ class SearchController extends Controller ...@@ -113,22 +115,14 @@ class SearchController extends Controller
})) }))
->first(); ->first();
if(!empty($pageData)){ /*Fetch Locater ID*/
$locatorID = $pageData->locaterlists->locater_identity;
/*Fetch Locater ID*/
$locatorID = $pageData->locaterlists->locater_identity;
$api_url = config('app.api_location');
$locationDetailAPIdata = $this->call_api($api_url,$locatorID);
$homepage = Homepage::where('homepages.status', '=', '1')->first();
return view('frontend.searchs.detail', compact('homepage','locatorID','locationDetailAPIdata','pageData'));
}else{
return view('errors.404');
} $api_url = config('app.api_location');
$locationDetailAPIdata = $this->call_api($api_url,$locatorID);
$homepage = Homepage::where('homepages.status', '=', '1')->first();
return view('frontend.searchs.detail', compact('homepage','locatorID','locationDetailAPIdata','pageData'));
} }
...@@ -138,19 +132,36 @@ class SearchController extends Controller ...@@ -138,19 +132,36 @@ class SearchController extends Controller
$api_url = config('app.api_search'); $api_url = config('app.api_search');
$locationDetailAPIdata = $this->call_api_page($api_url,$request['query']); $locationDetailAPIdata = $this->call_api_page($api_url,$request['query']);
$html = view('frontend.searchs.autocomplete', compact('locationDetailAPIdata'))->render(); if(empty($locationDetailAPIdata['data'])){
return [
'status' => 'success', $html = view('frontend.searchs.autocomplete', compact('locationDetailAPIdata'))->render();
'data' => $html return response()->json([
]; 'status' => 'error',
'data' => $html
]);
}else{
$html = view('frontend.searchs.autocomplete', compact('locationDetailAPIdata'))->render();
return response()->json([
'status' => 'success',
'data' => $html
]);
}
} }
public function reviewPaginate(Request $request) /**
* For render Review ajax
* */
public function reviewpaginate(Request $request)
{ {
$api_url = config('app.api'); $api_url = config('app.api');
$reviewData = $this->review_api_detail($api_url,$request->locatorID,$request->page); $reviewData = $this->review_api_detail($api_url,$request->locatorID,$request->page);
if ( count($reviewData['data']) < 1 ) return '';
return view('frontend.searchs.review_element', compact('reviewData')); return view('frontend.searchs.review_element', compact('reviewData'));
} }
...@@ -158,17 +169,22 @@ class SearchController extends Controller ...@@ -158,17 +169,22 @@ class SearchController extends Controller
public function getCityValue(Request $request) public function getCityValue(Request $request)
{ {
$getCityData = City::where('cities.name', '!=', '') $getCityData = City::where('cities.name', '!=', '')->where('cities.parent_id', '=', $request->state)->pluck('name','id')->toarray();
->where('cities.parent_id', '=', $request->state)
->where('cities.is_deleted', '=', '0')
->where('cities.status', '=', '1')
->pluck('name','id')->toarray();
$html = view('frontend.searchs.city_dropdown', compact('getCityData'))->render(); if(!empty($getCityData)){
return [
'status' => 'success', $html = view('frontend.searchs.city_dropdown', compact('getCityData'))->render();
'data' => $html return response()->json([
]; 'status' => 'success',
'data' => $html
]);
}else{
$html = view('frontend.searchs.city_dropdown', compact('getCityData'))->render();
return response()->json(['status' => 'error', 'data' => $html]);
}
} }
} }
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<div class="searchbar_form"> <div class="searchbar_form">
<div class="searchfield"> <div class="searchfield">
<div class="os"><i class="mdi mdi-magnify"></i> <div class="os"><i class="mdi mdi-magnify"></i>
<input type="text" class="form-control locality" autocomplete="off" name="locality" value="@if(@$locality) {{ $locality }} @endif" placeholder="--Search Nearby--"> <input type="text" class="form-control locality" autocomplete="off" name="locality" placeholder="--Search Nearby--">
<div id="localitylist"></div> <div id="localitylist"></div>
</div> </div>
</div> </div>
...@@ -99,12 +99,12 @@ ...@@ -99,12 +99,12 @@
var location = $('.location').val(); var location = $('.location').val();
var state = $('.getStateValue option:selected').attr('state'); var state = $('.getStateValue option:selected').attr('state');
var city = $('.getCityValue').val(); var city = $('.getCityValue').val();
var ratingOrder = $(this).data('rating');
e.preventDefault(); e.preventDefault();
$.ajax({ $.ajax({
type: 'post', type: 'post',
url: "{{route('searchlocater')}}", url: "{{route('searchlocater')}}",
data: {"_token": "{{ csrf_token() }}", locality:locality, location:location, state:state,city:city}, data: {"_token": "{{ csrf_token() }}", locality:locality, location:location, state:state,city:city,ratingOrder:ratingOrder},
success: function (datanew) { success: function (datanew) {
if(datanew.status == 'success') { if(datanew.status == 'success') {
//PRELOADER //PRELOADER
...@@ -147,9 +147,9 @@ ...@@ -147,9 +147,9 @@
url: "{{route('searchlocater')}}", url: "{{route('searchlocater')}}",
data: {"_token": "{{ csrf_token() }}",page:page,locality:locality,state:state,city:city,location:location,ratingOrder:ratingOrder}, data: {"_token": "{{ csrf_token() }}",page:page,locality:locality,state:state,city:city,location:location,ratingOrder:ratingOrder},
success: function (datanew) { success: function (datanew) {
loader(); loader();
$('#searchlocaterid').html(datanew.data); $('#searchlocaterid').html(datanew.data);
$(".locality").val(locality);
} }
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment