Commit 5e41e3567e835d3b38b1869ef037c22616db147f

Authored by Андрей Ларионов
1 parent 9a5d84dc0d
Exists in master

Фильтрация и сортировка на странице категории

Showing 8 changed files with 79 additions and 66 deletions Inline Diff

app/Http/Controllers/MainController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers; 3 namespace App\Http\Controllers;
4 4
5 use App\Models\Area; 5 use App\Models\Area;
6 use App\Models\format_area; 6 use App\Models\format_area;
7 use App\Models\House; 7 use App\Models\House;
8 use App\Models\News; 8 use App\Models\News;
9 use App\Models\Partners; 9 use App\Models\Partners;
10 use App\Models\type_area; 10 use App\Models\type_area;
11 use Illuminate\Http\Request; 11 use Illuminate\Http\Request;
12 use App\Classes\RusDate; 12 use App\Classes\RusDate;
13 use PhpParser\Node\Stmt\Switch_; 13 use PhpParser\Node\Stmt\Switch_;
14 use Illuminate\Support\Facades\Response; 14 use Illuminate\Support\Facades\Response;
15 15
16 class MainController extends Controller 16 class MainController extends Controller
17 { 17 {
18 /* 18 /*
19 * Главная страница проекта 19 * Главная страница проекта
20 */ 20 */
21 public function index() { 21 public function index() {
22 $houses = House::with('areas')->orderByDesc('created_at')->limit(8)->get(); 22 $houses = House::with('areas')->orderByDesc('created_at')->limit(8)->get();
23 $news = News::query()->orderByDesc('created_at')->limit(8)->get(); 23 $news = News::query()->orderByDesc('created_at')->limit(8)->get();
24 $partners = Partners::query()->limit(18)->get(); 24 $partners = Partners::query()->limit(18)->get();
25 return view('index', compact('houses', 'news', 'partners')); 25 return view('index', compact('houses', 'news', 'partners'));
26 } 26 }
27 27
28 /* 28 /*
29 * Фильтр ajax в каталоге 29 * Фильтр ajax в каталоге
30 */ 30 */
31 public function catalog_ajax_filter(Request $request) { 31 public function catalog_ajax_filter(Request $request) {
32 $Res = Array(); 32 $Res = Array();
33 if (!empty($request->area)) { 33 if (!empty($request->area)) {
34 $area_table = Area::where('id', '=', $request->area)->get(); 34 $area_table = Area::where('id', '=', $request->area)->get();
35 $Res[] = $area_table[0]->name_area; 35 $Res[] = $area_table[0]->name_area;
36 } else { 36 } else {
37 $Res[] = "Все объекты"; 37 $Res[] = "Все объекты";
38 } 38 }
39 39
40 if (!empty($request->type_area)) { 40 if (!empty($request->type_area)) {
41 $type_area_table = type_area::where('id', '=', $request->type_area)->get(); 41 $type_area_table = type_area::where('id', '=', $request->type_area)->get();
42 $Res[] = $type_area_table[0]->name_type; 42 $Res[] = $type_area_table[0]->name_type;
43 } else { 43 } else {
44 $Res[] = "Тип недвижимости"; 44 $Res[] = "Тип недвижимости";
45 } 45 }
46 46
47 if (!empty($request->format_area)) { 47 if (!empty($request->format_area)) {
48 $format_area_table = format_area::where('id', '=', $request->format_area)->get(); 48 $format_area_table = format_area::where('id', '=', $request->format_area)->get();
49 $Res[] = $format_area_table[0]->name_format; 49 $Res[] = $format_area_table[0]->name_format;
50 } else { 50 } else {
51 $Res[] = "Формат недвижимости"; 51 $Res[] = "Формат недвижимости";
52 } 52 }
53 53
54 return json_encode($Res); 54 return json_encode($Res);
55 } 55 }
56 56
57 /* 57 /*
58 * Страница ЖК 58 * Страница ЖК
59 */ 59 */
60 public function Complex(Area $area, Request $request) { 60 public function Complex(Area $area, Request $request) {
61 //////////раздел аренда 61 //////////раздел аренда
62 $house_arenda = House::with('areas')-> 62 $house_arenda = House::with('areas')->
63 where('area_id', '=', $area->id)-> 63 where('area_id', '=', $area->id)->
64 where('format_house', '=', 'Аренда'); 64 where('format_house', '=', 'Аренда');
65 65
66 if ($request->view == 'arenda') { 66 if ($request->view == 'arenda') {
67 switch ($request->sort_price) { 67 switch ($request->sort_price) {
68 case 1: $house_arenda = $house_arenda->orderBy('price');break; 68 case 1: $house_arenda = $house_arenda->orderBy('price');break;
69 case 2: $house_arenda = $house_arenda->orderByDesc('price');break; 69 case 2: $house_arenda = $house_arenda->orderByDesc('price');break;
70 } 70 }
71 switch ($request->sort_new) { 71 switch ($request->sort_new) {
72 case 1: $house_arenda = $house_arenda->orderByDesc('created_at');break; 72 case 1: $house_arenda = $house_arenda->orderByDesc('created_at');break;
73 case 2: $house_arenda = $house_arenda->orderBy('created_at');break; 73 case 2: $house_arenda = $house_arenda->orderBy('created_at');break;
74 } 74 }
75 switch ($request->sort_area) { 75 switch ($request->sort_area) {
76 case 1: $house_arenda = $house_arenda->orderByDesc('area')->get();break; 76 case 1: $house_arenda = $house_arenda->orderByDesc('area')->get();break;
77 case 2: $house_arenda = $house_arenda->orderBy('area')->get();break; 77 case 2: $house_arenda = $house_arenda->orderBy('area')->get();break;
78 } 78 }
79 } else { 79 } else {
80 $house_arenda = $house_arenda->orderBy('price')-> 80 $house_arenda = $house_arenda->orderBy('price')->
81 orderByDesc('created_at')-> 81 orderByDesc('created_at')->
82 orderByDesc('area')->get(); 82 orderByDesc('area')->get();
83 } 83 }
84 84
85 ////////раздел продажа 85 ////////раздел продажа
86 $house_prodaja = House::with('areas')-> 86 $house_prodaja = House::with('areas')->
87 where('area_id', '=', $area->id)-> 87 where('area_id', '=', $area->id)->
88 where('format_house', '=', 'Продажа'); 88 where('format_house', '=', 'Продажа');
89 89
90 if ($request->view == 'prodaja') { 90 if ($request->view == 'prodaja') {
91 switch ($request->sort_price) { 91 switch ($request->sort_price) {
92 case 1: $house_prodaja = $house_prodaja->orderBy('price');break; 92 case 1: $house_prodaja = $house_prodaja->orderBy('price');break;
93 case 2: $house_prodaja = $house_prodaja->orderByDesc('price');break; 93 case 2: $house_prodaja = $house_prodaja->orderByDesc('price');break;
94 } 94 }
95 switch ($request->sort_new) { 95 switch ($request->sort_new) {
96 case 1: $house_prodaja = $house_prodaja->orderByDesc('created_at');break; 96 case 1: $house_prodaja = $house_prodaja->orderByDesc('created_at');break;
97 case 2: $house_prodaja = $house_prodaja->orderBy('created_at');break; 97 case 2: $house_prodaja = $house_prodaja->orderBy('created_at');break;
98 } 98 }
99 switch ($request->sort_area) { 99 switch ($request->sort_area) {
100 case 1: $house_prodaja = $house_prodaja->orderByDesc('area')->get();break; 100 case 1: $house_prodaja = $house_prodaja->orderByDesc('area')->get();break;
101 case 2: $house_prodaja = $house_prodaja->orderBy('area')->get();break; 101 case 2: $house_prodaja = $house_prodaja->orderBy('area')->get();break;
102 } 102 }
103 } else { 103 } else {
104 $house_prodaja = $house_prodaja->orderBy('price')-> 104 $house_prodaja = $house_prodaja->orderBy('price')->
105 orderByDesc('created_at')-> 105 orderByDesc('created_at')->
106 orderByDesc('area')->get(); 106 orderByDesc('area')->get();
107 } 107 }
108 108
109 //////////////// Раздел бизнеса 109 //////////////// Раздел бизнеса
110 $house_bissnes = House::with('areas')-> 110 $house_bissnes = House::with('areas')->
111 where('area_id', '=', $area->id)-> 111 where('area_id', '=', $area->id)->
112 where('format_house', '=', 'Бизнес'); 112 where('format_house', '=', 'Бизнес');
113 //orderByDesc('created_at')->get(); 113 //orderByDesc('created_at')->get();
114 114
115 if ($request->view == 'bissnes') { 115 if ($request->view == 'bissnes') {
116 switch ($request->sort_price) { 116 switch ($request->sort_price) {
117 case 1: $house_bissnes = $house_bissnes->orderBy('price');break; 117 case 1: $house_bissnes = $house_bissnes->orderBy('price');break;
118 case 2: $house_bissnes = $house_bissnes->orderByDesc('price');break; 118 case 2: $house_bissnes = $house_bissnes->orderByDesc('price');break;
119 } 119 }
120 switch ($request->sort_new) { 120 switch ($request->sort_new) {
121 case 1: $house_bissnes = $house_bissnes->orderByDesc('created_at');break; 121 case 1: $house_bissnes = $house_bissnes->orderByDesc('created_at');break;
122 case 2: $house_bissnes = $house_bissnes->orderBy('created_at');break; 122 case 2: $house_bissnes = $house_bissnes->orderBy('created_at');break;
123 } 123 }
124 switch ($request->sort_area) { 124 switch ($request->sort_area) {
125 case 1: $house_bissnes = $house_bissnes->orderByDesc('area')->get();break; 125 case 1: $house_bissnes = $house_bissnes->orderByDesc('area')->get();break;
126 case 2: $house_bissnes = $house_bissnes->orderBy('area')->get();break; 126 case 2: $house_bissnes = $house_bissnes->orderBy('area')->get();break;
127 } 127 }
128 } else { 128 } else {
129 $house_bissnes = $house_bissnes->orderBy('price')-> 129 $house_bissnes = $house_bissnes->orderBy('price')->
130 orderByDesc('created_at')-> 130 orderByDesc('created_at')->
131 orderByDesc('area')->get(); 131 orderByDesc('area')->get();
132 } 132 }
133 133
134 //////////раздел арендованные 134 //////////раздел арендованные
135 $house_arendovannie = House::with('areas')-> 135 $house_arendovannie = House::with('areas')->
136 where('area_id', '=', $area->id)-> 136 where('area_id', '=', $area->id)->
137 where('format_house', '=', 'Арендованные'); 137 where('format_house', '=', 'Арендованные');
138 //orderByDesc('created_at')->get(); 138 //orderByDesc('created_at')->get();
139 139
140 if ($request->view == 'arendovannie') { 140 if ($request->view == 'arendovannie') {
141 switch ($request->sort_price) { 141 switch ($request->sort_price) {
142 case 1: $house_arendovannie = $house_arendovannie->orderBy('price');break; 142 case 1: $house_arendovannie = $house_arendovannie->orderBy('price');break;
143 case 2: $house_arendovannie = $house_arendovannie->orderByDesc('price');break; 143 case 2: $house_arendovannie = $house_arendovannie->orderByDesc('price');break;
144 } 144 }
145 switch ($request->sort_new) { 145 switch ($request->sort_new) {
146 case 1: $house_arendovannie = $house_arendovannie->orderByDesc('created_at');break; 146 case 1: $house_arendovannie = $house_arendovannie->orderByDesc('created_at');break;
147 case 2: $house_arendovannie = $house_arendovannie->orderBy('created_at');break; 147 case 2: $house_arendovannie = $house_arendovannie->orderBy('created_at');break;
148 } 148 }
149 switch ($request->sort_area) { 149 switch ($request->sort_area) {
150 case 1: $house_arendovannie = $house_arendovannie->orderByDesc('area')->get();break; 150 case 1: $house_arendovannie = $house_arendovannie->orderByDesc('area')->get();break;
151 case 2: $house_arendovannie = $house_arendovannie->orderBy('area')->get();break; 151 case 2: $house_arendovannie = $house_arendovannie->orderBy('area')->get();break;
152 } 152 }
153 } else { 153 } else {
154 $house_arendovannie = $house_arendovannie->orderBy('price')-> 154 $house_arendovannie = $house_arendovannie->orderBy('price')->
155 orderByDesc('created_at')-> 155 orderByDesc('created_at')->
156 orderByDesc('area')->get(); 156 orderByDesc('area')->get();
157 } 157 }
158 158
159 if ($request->ajax()) { 159 if ($request->ajax()) {
160 switch($request->view) { 160 switch($request->view) {
161 case 'arenda': return view('ajax.complex.arenda', compact('house_arenda')); break; 161 case 'arenda': return view('ajax.complex.arenda', compact('house_arenda')); break;
162 case 'prodaja': return view('ajax.complex.prodaja', compact('house_prodaja'));break; 162 case 'prodaja': return view('ajax.complex.prodaja', compact('house_prodaja'));break;
163 case 'bissnes': return view('ajax.complex.bissnes', compact('house_bissnes')); break; 163 case 'bissnes': return view('ajax.complex.bissnes', compact('house_bissnes')); break;
164 case 'arendovannie': return view('ajax.complex.arendovannie', compact('house_arendovannie')); break; 164 case 'arendovannie': return view('ajax.complex.arendovannie', compact('house_arendovannie')); break;
165 } 165 }
166 } 166 }
167 167
168 return view('complex', compact('area', 168 return view('complex', compact('area',
169 'house_arenda', 169 'house_arenda',
170 'house_prodaja', 170 'house_prodaja',
171 'house_bissnes', 171 'house_bissnes',
172 'house_arendovannie')); 172 'house_arendovannie'));
173 173
174 } 174 }
175 175
176 /* 176 /*
177 * О компании 177 * О компании
178 */ 178 */
179 public function About() { 179 public function About() {
180 return view('about'); 180 return view('about');
181 } 181 }
182 182
183 /* 183 /*
184 * Избранное 184 * Избранное
185 */ 185 */
186 public function Favorite() { 186 public function Favorite() {
187 return view('favorite'); 187 return view('favorite');
188 } 188 }
189 189
190 public function Category_ajax($cat, Request $request) {
191 return $cat;
192 }
193
194 /* 190 /*
195 * Категории каталога Аренда/Продажа/Бизнес 191 * Категории каталога Аренда/Продажа/Бизнес
196 */ 192 */
197 public function Category($cat, Request $request) { 193 public function Category($cat, Request $request) {
198 switch ($cat) { 194 switch ($cat) {
199 case 'arenda': 195 case 'arenda':
200 $title = "Аренда торговых помещениий"; 196 $title = "Аренда торговых помещениий";
201 $format_house = 'Аренда'; 197 $format_house = 'Аренда';
202 break; 198 break;
203 case 'sale': 199 case 'sale':
204 $title = "Продажа торговых помещений"; 200 $title = "Продажа торговых помещений";
205 $format_house = 'Продажа'; 201 $format_house = 'Продажа';
206 break; 202 break;
207 case 'bussiness': 203 case 'bussiness':
208 $title = "Арендый бизнес"; 204 $title = "Арендый бизнес";
209 $format_house = 'Бизнес'; 205 $format_house = 'Бизнес';
210 break; 206 break;
211 default: 207 default:
212 $title = "Аренда торговых помещениий"; 208 $title = "Аренда торговых помещениий";
213 $format_house = 'Аренда'; 209 $format_house = 'Аренда';
214 break; 210 break;
215 } 211 }
216 212
217 $houses = House::with('areas')-> 213 $houses = House::with('areas')->
218 where('format_house', '=', $format_house); 214 where('format_house', '=', $format_house);
219 //->appends(request()->query()); 215 //->appends(request()->query());
220 /* 216
221 if (!empty($request->area)) { 217 if (!empty($request->area)) {
222 $houses = $houses->where('area_id', '=', $request->area); 218 $houses = $houses->where('area_id', '=', $request->area);
223 } 219 }
224 // условия поиска по типу недвижимости 220 // условия поиска по типу недвижимости
225 if (!empty($request->type_area)) { 221 if (!empty($request->type_area)) {
226 $houses = $houses->where('type_area_id', '=', $request->type_area); 222 $houses = $houses->where('type_area_id', '=', $request->type_area);
227 } 223 }
228 // условия поиска по формату недвижимости 224 // условия поиска по формату недвижимости
229 if (!empty($request->format_area)) { 225 if (!empty($request->format_area)) {
230 $houses = $houses->where('format_area_id', '=', $request->format_area); 226 $houses = $houses->where('format_area_id', '=', $request->format_area);
231 } 227 }
232 // условия поиска по площади - минимальная площадь 228 // условия поиска по площади - минимальная площадь
233 if (!empty($request->area_m2_min)) { 229 if (!empty($request->area_m2_min)) {
234 $houses = $houses->where('area', '>', $request->area_m2_min); 230 $houses = $houses->where('area', '>', $request->area_m2_min);
235 } 231 }
236 // условия поиска по площади - максимальная площадь 232 // условия поиска по площади - максимальная площадь
237 if (!empty($request->area_m2_max)) { 233 if (!empty($request->area_m2_max)) {
238 $houses = $houses->where('area', '<', $request->area_m2_max); 234 $houses = $houses->where('area', '<', $request->area_m2_max);
239 } 235 }
240 // условия поиска по цене - минимальная цена 236 // условия поиска по цене - минимальная цена
241 if (!empty($request->price_min)) { 237 if (!empty($request->price_min)) {
242 $houses = $houses->where('price', '>', $request->price_min); 238 $houses = $houses->where('price', '>', $request->price_min);
243 } 239 }
244 // условия поиска по цене - максимальная цена 240 // условия поиска по цене - максимальная цена
245 if (!empty($request->price_max)) { 241 if (!empty($request->price_max)) {
246 $houses = $houses->where('price', '<', $request->price_max); 242 $houses = $houses->where('price', '<', $request->price_max);
247 } 243 }
248 // условия поиска по адресу 244 // условия поиска по адресу
249 if (!empty($request->address)) { 245 if (!empty($request->address)) {
250 $houses = $houses->where('address', 'LIKE', "%".$request->address."%"); 246 $houses = $houses->where('address', 'LIKE', "%".$request->address."%");
251 } 247 }
252 248
253 if (!empty($request->sort_price)) { 249 if (isset($request->sort_price)) {
254 switch ($request->sort_price) { 250 switch ($request->sort_price) {
255 case 1: $houses = $houses->orderBy('price');break; 251 case 1: $houses = $houses->orderBy('price');break;
256 case 2: $houses = $houses->orderByDesc('price');break; 252 case 2: $houses = $houses->orderByDesc('price');break;
257 } 253 }
258 switch ($request->sort_new) { 254 switch ($request->sort_new) {
259 case 1: $houses = $houses->orderByDesc('created_at');break; 255 case 1: $houses = $houses->orderByDesc('created_at');break;
260 case 2: $houses = $houses->orderBy('created_at');break; 256 case 2: $houses = $houses->orderBy('created_at');break;
261 } 257 }
262 switch ($request->sort_area) { 258 switch ($request->sort_area) {
263 case 1: $houses = $houses->orderByDesc('area')->get();break; 259 case 1: $houses = $houses->orderByDesc('area');break;
264 case 2: $houses = $houses->orderBy('area')->get();break; 260 case 2: $houses = $houses->orderBy('area');break;
265 } 261 }
262
266 } else { 263 } else {
267 $houses = $houses->orderBy('price')-> 264 $houses = $houses->orderBy('price')->
268 orderByDesc('created_at')-> 265 orderByDesc('created_at')->
269 orderByDesc('area'); 266 orderByDesc('area');
270 } 267 }
271 */ 268
272 $houses = $houses->paginate(4); 269 $houses = $houses->paginate(4);
273 270
274 if ($request->ajax()) { 271 if ($request->ajax()) {
275 return view('ajax.complex.category', compact('houses')); 272 return view('ajax.complex.category', compact('houses'));
276 } 273 }
277 274
278 return view('category_catalog', compact('title', 'cat', 'houses')); 275 return view('category_catalog', compact('title', 'cat', 'houses'));
279 } 276 }
280 277
281 278
282 /* 279 /*
283 * Каталог 280 * Каталог
284 */ 281 */
285 public function Catalog(Request $request) { 282 public function Catalog(Request $request) {
286 283
287 //////////раздел аренда///////////////////////////////////////////////////////////////// 284 //////////раздел аренда/////////////////////////////////////////////////////////////////
288 $house_arenda = House::with('areas')-> 285 $house_arenda = House::with('areas')->
289 where('format_house', '=', 'Аренда'); 286 where('format_house', '=', 'Аренда');
290 // условия поиска по объектам комплексов 287 // условия поиска по объектам комплексов
291 if (!empty($request->area)) { 288 if (!empty($request->area)) {
292 $house_arenda = $house_arenda->where('area_id', '=', $request->area); 289 $house_arenda = $house_arenda->where('area_id', '=', $request->area);
293 } 290 }
294 // условия поиска по типу недвижимости 291 // условия поиска по типу недвижимости
295 if (!empty($request->type_area)) { 292 if (!empty($request->type_area)) {
296 $house_arenda = $house_arenda->where('type_area_id', '=', $request->type_area); 293 $house_arenda = $house_arenda->where('type_area_id', '=', $request->type_area);
297 } 294 }
298 // условия поиска по формату недвижимости 295 // условия поиска по формату недвижимости
299 if (!empty($request->format_area)) { 296 if (!empty($request->format_area)) {
300 $house_arenda = $house_arenda->where('format_area_id', '=', $request->format_area); 297 $house_arenda = $house_arenda->where('format_area_id', '=', $request->format_area);
301 } 298 }
302 // условия поиска по площади - минимальная площадь 299 // условия поиска по площади - минимальная площадь
303 if (!empty($request->area_m2_min)) { 300 if (!empty($request->area_m2_min)) {
304 $house_arenda = $house_arenda->where('area', '>', $request->area_m2_min); 301 $house_arenda = $house_arenda->where('area', '>', $request->area_m2_min);
305 } 302 }
306 // условия поиска по площади - максимальная площадь 303 // условия поиска по площади - максимальная площадь
307 if (!empty($request->area_m2_max)) { 304 if (!empty($request->area_m2_max)) {
308 $house_arenda = $house_arenda->where('area', '<', $request->area_m2_max); 305 $house_arenda = $house_arenda->where('area', '<', $request->area_m2_max);
309 } 306 }
310 // условия поиска по цене - минимальная цена 307 // условия поиска по цене - минимальная цена
311 if (!empty($request->price_min)) { 308 if (!empty($request->price_min)) {
312 $house_arenda = $house_arenda->where('price', '>', $request->price_min); 309 $house_arenda = $house_arenda->where('price', '>', $request->price_min);
313 } 310 }
314 // условия поиска по цене - максимальная цена 311 // условия поиска по цене - максимальная цена
315 if (!empty($request->price_max)) { 312 if (!empty($request->price_max)) {
316 $house_arenda = $house_arenda->where('price', '<', $request->price_max); 313 $house_arenda = $house_arenda->where('price', '<', $request->price_max);
317 } 314 }
318 // условия поиска по адресу 315 // условия поиска по адресу
319 if (!empty($request->address)) { 316 if (!empty($request->address)) {
320 $house_arenda = $house_arenda->where('address', 'LIKE', "%".$request->address."%"); 317 $house_arenda = $house_arenda->where('address', 'LIKE', "%".$request->address."%");
321 } 318 }
322 319
323 if ($request->view == 'arenda') { 320 if ($request->view == 'arenda') {
324 switch ($request->sort_price) { 321 switch ($request->sort_price) {
325 case 1: $house_arenda = $house_arenda->orderBy('price');break; 322 case 1: $house_arenda = $house_arenda->orderBy('price');break;
326 case 2: $house_arenda = $house_arenda->orderByDesc('price');break; 323 case 2: $house_arenda = $house_arenda->orderByDesc('price');break;
327 } 324 }
328 switch ($request->sort_new) { 325 switch ($request->sort_new) {
329 case 1: $house_arenda = $house_arenda->orderByDesc('created_at');break; 326 case 1: $house_arenda = $house_arenda->orderByDesc('created_at');break;
330 case 2: $house_arenda = $house_arenda->orderBy('created_at');break; 327 case 2: $house_arenda = $house_arenda->orderBy('created_at');break;
331 } 328 }
332 switch ($request->sort_area) { 329 switch ($request->sort_area) {
333 case 1: $house_arenda = $house_arenda->orderByDesc('area')->get();break; 330 case 1: $house_arenda = $house_arenda->orderByDesc('area')->get();break;
334 case 2: $house_arenda = $house_arenda->orderBy('area')->get();break; 331 case 2: $house_arenda = $house_arenda->orderBy('area')->get();break;
335 } 332 }
336 } else { 333 } else {
337 $house_arenda = $house_arenda->orderBy('price')-> 334 $house_arenda = $house_arenda->orderBy('price')->
338 orderByDesc('created_at')-> 335 orderByDesc('created_at')->
339 orderByDesc('area')->get(); 336 orderByDesc('area')->get();
340 } 337 }
341 338
342 ////////раздел продажа////////////////////////////////////////////////////////////////// 339 ////////раздел продажа//////////////////////////////////////////////////////////////////
343 $house_prodaja = House::with('areas')-> 340 $house_prodaja = House::with('areas')->
344 where('format_house', '=', 'Продажа'); 341 where('format_house', '=', 'Продажа');
345 342
346 // условия поиска по объектам комплексов 343 // условия поиска по объектам комплексов
347 if (!empty($request->area)) { 344 if (!empty($request->area)) {
348 $house_prodaja = $house_prodaja->where('area_id', '=', $request->area); 345 $house_prodaja = $house_prodaja->where('area_id', '=', $request->area);
349 } 346 }
350 // условия поиска по типу недвижимости 347 // условия поиска по типу недвижимости
351 if (!empty($request->type_area)) { 348 if (!empty($request->type_area)) {
352 $house_prodaja = $house_prodaja->where('type_area_id', '=', $request->type_area); 349 $house_prodaja = $house_prodaja->where('type_area_id', '=', $request->type_area);
353 } 350 }
354 // условия поиска по формату недвижимости 351 // условия поиска по формату недвижимости
355 if (!empty($request->format_area)) { 352 if (!empty($request->format_area)) {
356 $house_prodaja = $house_prodaja->where('format_area_id', '=', $request->format_area); 353 $house_prodaja = $house_prodaja->where('format_area_id', '=', $request->format_area);
357 } 354 }
358 // условия поиска по площади - минимальная площадь 355 // условия поиска по площади - минимальная площадь
359 if (!empty($request->area_m2_min)) { 356 if (!empty($request->area_m2_min)) {
360 $house_prodaja = $house_prodaja->where('area', '>', $request->area_m2_min); 357 $house_prodaja = $house_prodaja->where('area', '>', $request->area_m2_min);
361 } 358 }
362 // условия поиска по площади - максимальная площадь 359 // условия поиска по площади - максимальная площадь
363 if (!empty($request->area_m2_max)) { 360 if (!empty($request->area_m2_max)) {
364 $house_prodaja = $house_prodaja->where('area', '<', $request->area_m2_max); 361 $house_prodaja = $house_prodaja->where('area', '<', $request->area_m2_max);
365 } 362 }
366 // условия поиска по цене - минимальная цена 363 // условия поиска по цене - минимальная цена
367 if (!empty($request->price_min)) { 364 if (!empty($request->price_min)) {
368 $house_prodaja = $house_prodaja->where('price', '>', $request->price_min); 365 $house_prodaja = $house_prodaja->where('price', '>', $request->price_min);
369 } 366 }
370 // условия поиска по цене - максимальная цена 367 // условия поиска по цене - максимальная цена
371 if (!empty($request->price_max)) { 368 if (!empty($request->price_max)) {
372 $house_prodaja = $house_prodaja->where('price', '<', $request->price_max); 369 $house_prodaja = $house_prodaja->where('price', '<', $request->price_max);
373 } 370 }
374 // условия поиска по адресу 371 // условия поиска по адресу
375 if (!empty($request->address)) { 372 if (!empty($request->address)) {
376 $house_prodaja = $house_prodaja->where('address', 'LIKE', "%".$request->address."%"); 373 $house_prodaja = $house_prodaja->where('address', 'LIKE', "%".$request->address."%");
377 } 374 }
378 375
379 if ($request->view == 'prodaja') { 376 if ($request->view == 'prodaja') {
380 switch ($request->sort_price) { 377 switch ($request->sort_price) {
381 case 1: $house_prodaja = $house_prodaja->orderBy('price');break; 378 case 1: $house_prodaja = $house_prodaja->orderBy('price');break;
382 case 2: $house_prodaja = $house_prodaja->orderByDesc('price');break; 379 case 2: $house_prodaja = $house_prodaja->orderByDesc('price');break;
383 } 380 }
384 switch ($request->sort_new) { 381 switch ($request->sort_new) {
385 case 1: $house_prodaja = $house_prodaja->orderByDesc('created_at');break; 382 case 1: $house_prodaja = $house_prodaja->orderByDesc('created_at');break;
386 case 2: $house_prodaja = $house_prodaja->orderBy('created_at');break; 383 case 2: $house_prodaja = $house_prodaja->orderBy('created_at');break;
387 } 384 }
388 switch ($request->sort_area) { 385 switch ($request->sort_area) {
389 case 1: $house_prodaja = $house_prodaja->orderByDesc('area')->get();break; 386 case 1: $house_prodaja = $house_prodaja->orderByDesc('area')->get();break;
390 case 2: $house_prodaja = $house_prodaja->orderBy('area')->get();break; 387 case 2: $house_prodaja = $house_prodaja->orderBy('area')->get();break;
391 } 388 }
392 } else { 389 } else {
393 $house_prodaja = $house_prodaja->orderBy('price')-> 390 $house_prodaja = $house_prodaja->orderBy('price')->
394 orderByDesc('created_at')-> 391 orderByDesc('created_at')->
395 orderByDesc('area')->get(); 392 orderByDesc('area')->get();
396 } 393 }
397 394
398 //////////////// Раздел бизнеса///////////////////////////////////////////////////////// 395 //////////////// Раздел бизнеса/////////////////////////////////////////////////////////
399 $house_bissnes = House::with('areas')-> 396 $house_bissnes = House::with('areas')->
400 where('format_house', '=', 'Бизнес'); 397 where('format_house', '=', 'Бизнес');
401 //orderByDesc('created_at')->get(); 398 //orderByDesc('created_at')->get();
402 399
403 // условия поиска по объектам комплексов 400 // условия поиска по объектам комплексов
404 if (!empty($request->area)) { 401 if (!empty($request->area)) {
405 $house_bissnes = $house_bissnes->where('area_id', '=', $request->area); 402 $house_bissnes = $house_bissnes->where('area_id', '=', $request->area);
406 } 403 }
407 // условия поиска по типу недвижимости 404 // условия поиска по типу недвижимости
408 if (!empty($request->type_area)) { 405 if (!empty($request->type_area)) {
409 $house_bissnes = $house_bissnes->where('type_area_id', '=', $request->type_area); 406 $house_bissnes = $house_bissnes->where('type_area_id', '=', $request->type_area);
410 } 407 }
411 // условия поиска по формату недвижимости 408 // условия поиска по формату недвижимости
412 if (!empty($request->format_area)) { 409 if (!empty($request->format_area)) {
413 $house_bissnes = $house_bissnes->where('format_area_id', '=', $request->format_area); 410 $house_bissnes = $house_bissnes->where('format_area_id', '=', $request->format_area);
414 } 411 }
415 // условия поиска по площади - минимальная площадь 412 // условия поиска по площади - минимальная площадь
416 if (!empty($request->area_m2_min)) { 413 if (!empty($request->area_m2_min)) {
417 $house_bissnes = $house_bissnes->where('area', '>', $request->area_m2_min); 414 $house_bissnes = $house_bissnes->where('area', '>', $request->area_m2_min);
418 } 415 }
419 // условия поиска по площади - максимальная площадь 416 // условия поиска по площади - максимальная площадь
420 if (!empty($request->area_m2_max)) { 417 if (!empty($request->area_m2_max)) {
421 $house_bissnes = $house_bissnes->where('area', '<', $request->area_m2_max); 418 $house_bissnes = $house_bissnes->where('area', '<', $request->area_m2_max);
422 } 419 }
423 // условия поиска по цене - минимальная цена 420 // условия поиска по цене - минимальная цена
424 if (!empty($request->price_min)) { 421 if (!empty($request->price_min)) {
425 $house_bissnes = $house_bissnes->where('price', '>', $request->price_min); 422 $house_bissnes = $house_bissnes->where('price', '>', $request->price_min);
426 } 423 }
427 // условия поиска по цене - максимальная цена 424 // условия поиска по цене - максимальная цена
428 if (!empty($request->price_max)) { 425 if (!empty($request->price_max)) {
429 $house_bissnes = $house_bissnes->where('price', '<', $request->price_max); 426 $house_bissnes = $house_bissnes->where('price', '<', $request->price_max);
430 } 427 }
431 // условия поиска по адресу 428 // условия поиска по адресу
432 if (!empty($request->address)) { 429 if (!empty($request->address)) {
433 $house_bissnes = $house_bissnes->where('address', 'LIKE', "%".$request->address."%"); 430 $house_bissnes = $house_bissnes->where('address', 'LIKE', "%".$request->address."%");
434 } 431 }
435 432
436 if ($request->view == 'bissnes') { 433 if ($request->view == 'bissnes') {
437 switch ($request->sort_price) { 434 switch ($request->sort_price) {
438 case 1: $house_bissnes = $house_bissnes->orderBy('price');break; 435 case 1: $house_bissnes = $house_bissnes->orderBy('price');break;
439 case 2: $house_bissnes = $house_bissnes->orderByDesc('price');break; 436 case 2: $house_bissnes = $house_bissnes->orderByDesc('price');break;
440 } 437 }
441 switch ($request->sort_new) { 438 switch ($request->sort_new) {
442 case 1: $house_bissnes = $house_bissnes->orderByDesc('created_at');break; 439 case 1: $house_bissnes = $house_bissnes->orderByDesc('created_at');break;
443 case 2: $house_bissnes = $house_bissnes->orderBy('created_at');break; 440 case 2: $house_bissnes = $house_bissnes->orderBy('created_at');break;
444 } 441 }
445 switch ($request->sort_area) { 442 switch ($request->sort_area) {
446 case 1: $house_bissnes = $house_bissnes->orderByDesc('area')->get();break; 443 case 1: $house_bissnes = $house_bissnes->orderByDesc('area')->get();break;
447 case 2: $house_bissnes = $house_bissnes->orderBy('area')->get();break; 444 case 2: $house_bissnes = $house_bissnes->orderBy('area')->get();break;
448 } 445 }
449 } else { 446 } else {
450 $house_bissnes = $house_bissnes->orderBy('price')-> 447 $house_bissnes = $house_bissnes->orderBy('price')->
451 orderByDesc('created_at')-> 448 orderByDesc('created_at')->
452 orderByDesc('area')->get(); 449 orderByDesc('area')->get();
453 } 450 }
454 451
455 //////////раздел арендованные////////////////////////////////////////////////////////// 452 //////////раздел арендованные//////////////////////////////////////////////////////////
456 $house_arendovannie = House::with('areas')-> 453 $house_arendovannie = House::with('areas')->
457 where('format_house', '=', 'Арендованные'); 454 where('format_house', '=', 'Арендованные');
458 //orderByDesc('created_at')->get(); 455 //orderByDesc('created_at')->get();
459 456
460 // условия поиска по объектам комплексов 457 // условия поиска по объектам комплексов
461 if (!empty($request->area)) { 458 if (!empty($request->area)) {
462 $house_arendovannie = $house_arendovannie->where('area_id', '=', $request->area); 459 $house_arendovannie = $house_arendovannie->where('area_id', '=', $request->area);
463 } 460 }
464 // условия поиска по типу недвижимости 461 // условия поиска по типу недвижимости
465 if (!empty($request->type_area)) { 462 if (!empty($request->type_area)) {
466 $house_arendovannie = $house_arendovannie->where('type_area_id', '=', $request->type_area); 463 $house_arendovannie = $house_arendovannie->where('type_area_id', '=', $request->type_area);
467 } 464 }
468 // условия поиска по формату недвижимости 465 // условия поиска по формату недвижимости
469 if (!empty($request->format_area)) { 466 if (!empty($request->format_area)) {
470 $house_arendovannie = $house_arendovannie->where('format_area_id', '=', $request->format_area); 467 $house_arendovannie = $house_arendovannie->where('format_area_id', '=', $request->format_area);
471 } 468 }
472 // условия поиска по площади - минимальная площадь 469 // условия поиска по площади - минимальная площадь
473 if (!empty($request->area_m2_min)) { 470 if (!empty($request->area_m2_min)) {
474 $house_arendovannie = $house_arendovannie->where('area', '>', $request->area_m2_min); 471 $house_arendovannie = $house_arendovannie->where('area', '>', $request->area_m2_min);
475 } 472 }
476 // условия поиска по площади - максимальная площадь 473 // условия поиска по площади - максимальная площадь
477 if (!empty($request->area_m2_max)) { 474 if (!empty($request->area_m2_max)) {
478 $house_arendovannie = $house_arendovannie->where('area', '<', $request->area_m2_max); 475 $house_arendovannie = $house_arendovannie->where('area', '<', $request->area_m2_max);
479 } 476 }
480 // условия поиска по цене - минимальная цена 477 // условия поиска по цене - минимальная цена
481 if (!empty($request->price_min)) { 478 if (!empty($request->price_min)) {
482 $house_arendovannie = $house_arendovannie->where('price', '>', $request->price_min); 479 $house_arendovannie = $house_arendovannie->where('price', '>', $request->price_min);
483 } 480 }
484 // условия поиска по цене - максимальная цена 481 // условия поиска по цене - максимальная цена
485 if (!empty($request->price_max)) { 482 if (!empty($request->price_max)) {
486 $house_arendovannie = $house_arendovannie->where('price', '<', $request->price_max); 483 $house_arendovannie = $house_arendovannie->where('price', '<', $request->price_max);
487 } 484 }
488 // условия поиска по адресу 485 // условия поиска по адресу
489 if (!empty($request->address)) { 486 if (!empty($request->address)) {
490 $house_arendovannie = $house_arendovannie->where('address', 'LIKE', "%".$request->address."%"); 487 $house_arendovannie = $house_arendovannie->where('address', 'LIKE', "%".$request->address."%");
491 } 488 }
492 489
493 if ($request->view == 'arendovannie') { 490 if ($request->view == 'arendovannie') {
494 switch ($request->sort_price) { 491 switch ($request->sort_price) {
495 case 1: $house_arendovannie = $house_arendovannie->orderBy('price');break; 492 case 1: $house_arendovannie = $house_arendovannie->orderBy('price');break;
496 case 2: $house_arendovannie = $house_arendovannie->orderByDesc('price');break; 493 case 2: $house_arendovannie = $house_arendovannie->orderByDesc('price');break;
497 } 494 }
498 switch ($request->sort_new) { 495 switch ($request->sort_new) {
499 case 1: $house_arendovannie = $house_arendovannie->orderByDesc('created_at');break; 496 case 1: $house_arendovannie = $house_arendovannie->orderByDesc('created_at');break;
500 case 2: $house_arendovannie = $house_arendovannie->orderBy('created_at');break; 497 case 2: $house_arendovannie = $house_arendovannie->orderBy('created_at');break;
501 } 498 }
502 switch ($request->sort_area) { 499 switch ($request->sort_area) {
503 case 1: $house_arendovannie = $house_arendovannie->orderByDesc('area')->get();break; 500 case 1: $house_arendovannie = $house_arendovannie->orderByDesc('area')->get();break;
504 case 2: $house_arendovannie = $house_arendovannie->orderBy('area')->get();break; 501 case 2: $house_arendovannie = $house_arendovannie->orderBy('area')->get();break;
505 } 502 }
506 } else { 503 } else {
507 $house_arendovannie = $house_arendovannie->orderBy('price')-> 504 $house_arendovannie = $house_arendovannie->orderBy('price')->
508 orderByDesc('created_at')-> 505 orderByDesc('created_at')->
509 orderByDesc('area')->get(); 506 orderByDesc('area')->get();
510 } 507 }
511 508
512 if ($request->ajax()) { 509 if ($request->ajax()) {
513 switch($request->view) { 510 switch($request->view) {
514 case 'arenda': return view('ajax.complex.arenda', compact('house_arenda')); break; 511 case 'arenda': return view('ajax.complex.arenda', compact('house_arenda')); break;
515 case 'prodaja': return view('ajax.complex.prodaja', compact('house_prodaja'));break; 512 case 'prodaja': return view('ajax.complex.prodaja', compact('house_prodaja'));break;
516 case 'bissnes': return view('ajax.complex.bissnes', compact('house_bissnes')); break; 513 case 'bissnes': return view('ajax.complex.bissnes', compact('house_bissnes')); break;
517 case 'arendovannie': return view('ajax.complex.arendovannie', compact('house_arendovannie')); break; 514 case 'arendovannie': return view('ajax.complex.arendovannie', compact('house_arendovannie')); break;
518 } 515 }
519 } 516 }
520 if (session('message') == 'Искать') { 517 if (session('message') == 'Искать') {
521 session()->flash('message', 'Сброс'); 518 session()->flash('message', 'Сброс');
522 } else { 519 } else {
523 session()->flash('message', 'Искать'); 520 session()->flash('message', 'Искать');
524 } 521 }
525 522
526 if (empty($request)) { 523 if (empty($request)) {
527 session()->flash('message', 'Искать'); 524 session()->flash('message', 'Искать');
528 } 525 }
529 526
530 return view('catalog', compact( 527 return view('catalog', compact(
531 'house_arenda', 528 'house_arenda',
532 'house_prodaja', 529 'house_prodaja',
533 'house_bissnes', 530 'house_bissnes',
534 'house_arendovannie' 531 'house_arendovannie'
535 )); 532 ));
536 533
537 534
538 } 535 }
539 536
540 /* 537 /*
541 * Новости 538 * Новости
542 */ 539 */
543 public function News() { 540 public function News() {
544 //$news = News::orderByDesc('created_at')->limit(1)->paginate(); 541 //$news = News::orderByDesc('created_at')->limit(1)->paginate();
545 $news_ = News::query()->orderByDesc('created_at')->paginate(4); 542 $news_ = News::query()->orderByDesc('created_at')->paginate(4);
546 return view('news', compact('news_')); 543 return view('news', compact('news_'));
547 } 544 }
548 545
549 /* 546 /*
550 * Контакты 547 * Контакты
551 */ 548 */
552 public function Contact() { 549 public function Contact() {
553 return view('contact'); 550 return view('contact');
554 } 551 }
555 552
556 /* 553 /*
557 * Карта объектов 554 * Карта объектов
558 */ 555 */
559 public function MapsObj() { 556 public function MapsObj() {
560 return view('mapsobj'); 557 return view('mapsobj');
561 } 558 }
562 559
563 /* 560 /*
564 * Посмотр конктретного предложение офиса 561 * Посмотр конктретного предложение офиса
565 */ 562 */
566 public function Offer(House $house) { 563 public function Offer(House $house) {
567 $houses = House::with('areas'); 564 $houses = House::with('areas');
568 $houses = $houses->where('type_area_id', '=', $house->typearea->id); 565 $houses = $houses->where('type_area_id', '=', $house->typearea->id);
569 $houses = $houses->where('format_house', '=', $house->format_house); 566 $houses = $houses->where('format_house', '=', $house->format_house);
570 $houses = $houses->orderByDesc('created_at')->limit(8)->get(); 567 $houses = $houses->orderByDesc('created_at')->limit(8)->get();
571 568
572 return view('house.post', compact('house', 'houses')); 569 return view('house.post', compact('house', 'houses'));
573 } 570 }
574 571
575 /* 572 /*
576 * Просмотр детально конкретной новости 573 * Просмотр детально конкретной новости
577 */ 574 */
578 public function DetailNew(News $news) { 575 public function DetailNew(News $news) {
579 $news_list = News::query()->orderByDesc('created_at')->limit(8)->get(); 576 $news_list = News::query()->orderByDesc('created_at')->limit(8)->get();
580 return view('new.post', compact('news', 'news_list')); 577 return view('new.post', compact('news', 'news_list'));
581 } 578 }
582 } 579 }
resources/views/ajax/complex/category.blade.php
1 <div class="category__grid"> 1 <div class="category__grid">
2 @if ($houses->count()) 2 @if ($houses->count())
3 @foreach ($houses as $house1) 3 @foreach ($houses as $house1)
4 @include('catalogs.house_mini', ['house' => $house1]) 4 @include('catalogs.house_mini', ['house' => $house1])
5 @endforeach 5 @endforeach
6 6
7 @else 7 @else
8 <h3>Здесь пока что нет предложений</h3> 8 <h3>Здесь пока что нет предложений</h3>
9 @endif 9 @endif
10 </div> 10 </div>
11 <div class="pagination"> 11 <div class="pagination">
12 <?//=$houses->appends($_GET)->links('catalogs.paginate');?> 12 <?=$houses->appends($_GET)->links('catalogs.paginate');?>
13 </div> 13 </div>
14 14
15 15
resources/views/ajax/complex/test.blade.php
File was created 1 Тест данных, выходные данные:
2 <pre>
3 <?php print_r($houses);?>
4 </pre>
5 --------------------
6
resources/views/catalog.blade.php
1 @extends('layout.site', ['title' => 'Каталог RentTorg']) 1 @extends('layout.site', ['title' => 'Каталог RentTorg'])
2 2
3 @section('filter') 3 @section('filter')
4 @include('part.filter.catalog') 4 @include('part.filter.catalog')
5 @endsection 5 @endsection
6 6
7 @section('custom_js') 7 @section('custom_js')
8 @include('js.filter_value');
8 <script> 9 <script>
9 $(window).load(function() { 10 /*
11 $(window).load(function() {
10 var url_str = "<?=url()->full();?>"; 12 var url_str = "<?=url()->full();?>";
11 var url = new URL(url_str); 13 var url = new URL(url_str);
12 var searchParams = new URLSearchParams(url.search.substring(1)); 14 var searchParams = new URLSearchParams(url.search.substring(1));
13 15
14 var area = searchParams.get("area"), 16 var area = searchParams.get("area"),
15 type_area = searchParams.get("type_area"), 17 type_area = searchParams.get("type_area"),
16 format_area= searchParams.get("format_area"), 18 format_area= searchParams.get("format_area"),
17 address= searchParams.get("address"); 19 address= searchParams.get("address");
18 20
19 var area_name = $('#area_name'); 21 var area_name = $('#area_name');
20 var type_area_name = $('#type_area_name'); 22 var type_area_name = $('#type_area_name');
21 var format_area_name = $('#format_area_name'); 23 var format_area_name = $('#format_area_name');
22 var address_name = $('#address'); 24 var address_name = $('#address');
23 25
24 if ((area !== "") || (type_area !== "") || (format_area !== "") || (address !== "")) 26 if ((area !== "") || (type_area !== "") || (format_area !== "") || (address !== ""))
25 { 27 {
26 $.ajax({ 28 $.ajax({
27 type: "GET", 29 type: "GET",
28 url: "{{ route('catalog_ajax_filter') }}", 30 url: "{{ route('catalog_ajax_filter') }}",
29 data: "area=" + area + "&type_area=" + type_area + "&format_area=" + format_area + "&address=" + address + "", 31 data: "area=" + area + "&type_area=" + type_area + "&format_area=" + format_area + "&address=" + address + "",
30 success: function (data) { 32 success: function (data) {
31 console.log('Фильтры данных были переданы '); 33 console.log('Фильтры данных были переданы ');
32 data = JSON.parse(data); 34 data = JSON.parse(data);
33 console.log(data); 35 console.log(data);
34 36
35 if (area !== "") { 37 if (area !== "") {
36 area_name.html(data[0]); 38 area_name.html(data[0]);
37 } 39 }
38 if (type_area !== "") { 40 if (type_area !== "") {
39 type_area_name.html(data[1]); 41 type_area_name.html(data[1]);
40 } 42 }
41 if (format_area !== "") { 43 if (format_area !== "") {
42 format_area_name.html(data[2]); 44 format_area_name.html(data[2]);
43 } 45 }
44 if (address !== "") { 46 if (address !== "") {
45 address_name.html(data[3]); 47 address_name.html(data[3]);
46 } 48 }
47 49
48 }, 50 },
49 headers: { 51 headers: {
50 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 52 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
51 }, 53 },
52 error: function (data) { 54 error: function (data) {
53 console.log('Error: ' + data); 55 console.log('Error: ' + data);
54 } 56 }
55 }); 57 });
56 } 58 }
57 }); 59 });
58 60 */
59 $(document).on('click', '.js_sort_group_item', function() { 61 $(document).on('click', '.js_sort_group_item', function() {
60 var val = $(this).data('val'); 62 var val = $(this).data('val');
61 var sort_price_val = ''; 63 var sort_price_val = '';
62 var sort_area_val = ''; 64 var sort_area_val = '';
63 var sort_new_val = ''; 65 var sort_new_val = '';
64 66
65 $('.sort-price').each(function() { 67 $('.sort-price').each(function() {
66 var this_ = $(this); 68 var this_ = $(this);
67 var v = $(this).data('val'); 69 var v = $(this).data('val');
68 if (this_.hasClass('active')) 70 if (this_.hasClass('active'))
69 sort_price_val = v; 71 sort_price_val = v;
70 }); 72 });
71 73
72 $('.sort-new').each(function() { 74 $('.sort-new').each(function() {
73 var v = $(this).data('val'); 75 var v = $(this).data('val');
74 var this_ = $(this); 76 var this_ = $(this);
75 if (this_.hasClass('active')) 77 if (this_.hasClass('active'))
76 sort_new_val = v; 78 sort_new_val = v;
77 }); 79 });
78 80
79 $('.sort-area').each(function() { 81 $('.sort-area').each(function() {
80 var v = $(this).data('val'); 82 var v = $(this).data('val');
81 var this_ = $(this); 83 var this_ = $(this);
82 if (this_.hasClass('active')) 84 if (this_.hasClass('active'))
83 sort_area_val = v; 85 sort_area_val = v;
84 86
85 }); 87 });
86 88
87 console.log('-------------------'); 89 console.log('-------------------');
88 $.ajax({ 90 $.ajax({
89 type: "GET", 91 type: "GET",
90 url: "{{ route('catalog') }}", 92 url: "{{ route('catalog') }}",
91 data: "view=arenda&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+ 93 data: "view=arenda&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+
92 "&area=<?if (isset($_GET['area'])) echo $_GET['area'];?>&type_area=<?if (isset($_GET['type_area'])) echo $_GET['type_area'];?>&format_area=<? if (isset($_GET['format_area'])) echo $_GET['format_area'];?>"+ 94 "&area=<?if (isset($_GET['area'])) echo $_GET['area'];?>&type_area=<?if (isset($_GET['type_area'])) echo $_GET['type_area'];?>&format_area=<? if (isset($_GET['format_area'])) echo $_GET['format_area'];?>"+
93 "&area_m2_min=<? if (isset($_GET['area_m2_min'])) echo $_GET['area_m2_min'];?>&area_m2_max=<? if (isset($_GET['area_m2_max'])) echo $_GET['area_m2_max'];?>"+ 95 "&area_m2_min=<? if (isset($_GET['area_m2_min'])) echo $_GET['area_m2_min'];?>&area_m2_max=<? if (isset($_GET['area_m2_max'])) echo $_GET['area_m2_max'];?>"+
94 "&price_min=<? if (isset($_GET['price_min'])) echo $_GET['price_min'];?>&price_max=<? if (isset($_GET['price_max'])) echo $_GET['price_max'];?>&address=<? if (isset($_GET['address'])) echo $_GET['address'];?>", 96 "&price_min=<? if (isset($_GET['price_min'])) echo $_GET['price_min'];?>&price_max=<? if (isset($_GET['price_max'])) echo $_GET['price_max'];?>&address=<? if (isset($_GET['address'])) echo $_GET['address'];?>",
95 success: function(data) { 97 success: function(data) {
96 console.log('Успешно обновлены данные АРЕНДА таблиц '); 98 console.log('Успешно обновлены данные АРЕНДА таблиц ');
97 $('#arenda_block').html(data); 99 $('#arenda_block').html(data);
98 }, 100 },
99 headers: { 101 headers: {
100 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 102 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
101 }, 103 },
102 error: function(data) { 104 error: function(data) {
103 console.log('Error: '+ data); 105 console.log('Error: '+ data);
104 } 106 }
105 }); 107 });
106 108
107 $.ajax({ 109 $.ajax({
108 type: "GET", 110 type: "GET",
109 url: "{{ route('catalog') }}", 111 url: "{{ route('catalog') }}",
110 data: "view=prodaja&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+ 112 data: "view=prodaja&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+
111 "&area=<?if (isset($_GET['area'])) echo $_GET['area'];?>&type_area=<?if (isset($_GET['type_area'])) echo $_GET['type_area'];?>&format_area=<? if (isset($_GET['format_area'])) echo $_GET['format_area'];?>"+ 113 "&area=<?if (isset($_GET['area'])) echo $_GET['area'];?>&type_area=<?if (isset($_GET['type_area'])) echo $_GET['type_area'];?>&format_area=<? if (isset($_GET['format_area'])) echo $_GET['format_area'];?>"+
112 "&area_m2_min=<? if (isset($_GET['area_m2_min'])) echo $_GET['area_m2_min'];?>&area_m2_max=<? if (isset($_GET['area_m2_max'])) echo $_GET['area_m2_max'];?>"+ 114 "&area_m2_min=<? if (isset($_GET['area_m2_min'])) echo $_GET['area_m2_min'];?>&area_m2_max=<? if (isset($_GET['area_m2_max'])) echo $_GET['area_m2_max'];?>"+
113 "&price_min=<? if (isset($_GET['price_min'])) echo $_GET['price_min'];?>&price_max=<? if (isset($_GET['price_max'])) echo $_GET['price_max'];?>&address=<? if (isset($_GET['address'])) echo $_GET['address'];?>", 115 "&price_min=<? if (isset($_GET['price_min'])) echo $_GET['price_min'];?>&price_max=<? if (isset($_GET['price_max'])) echo $_GET['price_max'];?>&address=<? if (isset($_GET['address'])) echo $_GET['address'];?>",
114 success: function(data) { 116 success: function(data) {
115 console.log('Успешно обновлены данные ПРОДАЖА таблиц '); 117 console.log('Успешно обновлены данные ПРОДАЖА таблиц ');
116 $('#prodaja_block').html(data); 118 $('#prodaja_block').html(data);
117 }, 119 },
118 headers: { 120 headers: {
119 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 121 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
120 }, 122 },
121 error: function(data) { 123 error: function(data) {
122 console.log('Error: '+ data); 124 console.log('Error: '+ data);
123 } 125 }
124 }); 126 });
125 127
126 $.ajax({ 128 $.ajax({
127 type: "GET", 129 type: "GET",
128 url: "{{ route('catalog') }}", 130 url: "{{ route('catalog') }}",
129 data: "view=bissnes&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+ 131 data: "view=bissnes&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+
130 "&area=<?if (isset($_GET['area'])) echo $_GET['area'];?>&type_area=<?if (isset($_GET['type_area'])) echo $_GET['type_area'];?>&format_area=<? if (isset($_GET['format_area'])) echo $_GET['format_area'];?>"+ 132 "&area=<?if (isset($_GET['area'])) echo $_GET['area'];?>&type_area=<?if (isset($_GET['type_area'])) echo $_GET['type_area'];?>&format_area=<? if (isset($_GET['format_area'])) echo $_GET['format_area'];?>"+
131 "&area_m2_min=<? if (isset($_GET['area_m2_min'])) echo $_GET['area_m2_min'];?>&area_m2_max=<? if (isset($_GET['area_m2_max'])) echo $_GET['area_m2_max'];?>"+ 133 "&area_m2_min=<? if (isset($_GET['area_m2_min'])) echo $_GET['area_m2_min'];?>&area_m2_max=<? if (isset($_GET['area_m2_max'])) echo $_GET['area_m2_max'];?>"+
132 "&price_min=<? if (isset($_GET['price_min'])) echo $_GET['price_min'];?>&price_max=<? if (isset($_GET['price_max'])) echo $_GET['price_max'];?>&address=<? if (isset($_GET['address'])) echo $_GET['address'];?>", 134 "&price_min=<? if (isset($_GET['price_min'])) echo $_GET['price_min'];?>&price_max=<? if (isset($_GET['price_max'])) echo $_GET['price_max'];?>&address=<? if (isset($_GET['address'])) echo $_GET['address'];?>",
133 success: function(data) { 135 success: function(data) {
134 console.log('Успешно обновлены данные БИЗНЕС таблиц '); 136 console.log('Успешно обновлены данные БИЗНЕС таблиц ');
135 $('#bissnes_block').html(data); 137 $('#bissnes_block').html(data);
136 }, 138 },
137 headers: { 139 headers: {
138 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 140 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
139 }, 141 },
140 error: function(data) { 142 error: function(data) {
141 console.log('Error: '+ data); 143 console.log('Error: '+ data);
142 } 144 }
143 }); 145 });
144 146
145 $.ajax({ 147 $.ajax({
146 type: "GET", 148 type: "GET",
147 url: "{{ route('catalog') }}", 149 url: "{{ route('catalog') }}",
148 data: "view=arendovannie&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+ 150 data: "view=arendovannie&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+
149 "&area=<?if (isset($_GET['area'])) echo $_GET['area'];?>&type_area=<?if (isset($_GET['type_area'])) echo $_GET['type_area'];?>&format_area=<? if (isset($_GET['format_area'])) echo $_GET['format_area'];?>"+ 151 "&area=<?if (isset($_GET['area'])) echo $_GET['area'];?>&type_area=<?if (isset($_GET['type_area'])) echo $_GET['type_area'];?>&format_area=<? if (isset($_GET['format_area'])) echo $_GET['format_area'];?>"+
150 "&area_m2_min=<? if (isset($_GET['area_m2_min'])) echo $_GET['area_m2_min'];?>&area_m2_max=<? if (isset($_GET['area_m2_max'])) echo $_GET['area_m2_max'];?>"+ 152 "&area_m2_min=<? if (isset($_GET['area_m2_min'])) echo $_GET['area_m2_min'];?>&area_m2_max=<? if (isset($_GET['area_m2_max'])) echo $_GET['area_m2_max'];?>"+
151 "&price_min=<? if (isset($_GET['price_min'])) echo $_GET['price_min'];?>&price_max=<? if (isset($_GET['price_max'])) echo $_GET['price_max'];?>&address=<? if (isset($_GET['address'])) echo $_GET['address'];?>", 153 "&price_min=<? if (isset($_GET['price_min'])) echo $_GET['price_min'];?>&price_max=<? if (isset($_GET['price_max'])) echo $_GET['price_max'];?>&address=<? if (isset($_GET['address'])) echo $_GET['address'];?>",
152 success: function(data) { 154 success: function(data) {
153 console.log('Успешно обновлены данные таблиц '); 155 console.log('Успешно обновлены данные таблиц ');
154 $('#arendovannie_block').html(data); 156 $('#arendovannie_block').html(data);
155 //.append(data); 157 //.append(data);
156 }, 158 },
157 headers: { 159 headers: {
158 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 160 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
159 }, 161 },
160 error: function(data) { 162 error: function(data) {
161 console.log('Error: '+ data); 163 console.log('Error: '+ data);
162 } 164 }
163 }); 165 });
164 166
165 } 167 }
166 ); 168 );
167 </script> 169 </script>
168 @endsection 170 @endsection
169 171
170 @section('content') 172 @section('content')
171 <section class="catalog"> 173 <section class="catalog">
172 <div class="container"> 174 <div class="container">
173 <div class="catalog__top top-catalog"> 175 <div class="catalog__top top-catalog">
174 <div class="top-catalog__inner"> 176 <div class="top-catalog__inner">
175 <h2 class="top-catalog__title title">Каталог коммерческой недвижимости</h2> 177 <h2 class="top-catalog__title title">Каталог коммерческой недвижимости</h2>
176 <div class="top-catalog__result">Найдено объектов по Вашему запросу: <span><?=$house_arenda->count()+$house_prodaja->count()+$house_bissnes->count()+$house_arendovannie->count(); ?></span></div> 178 <div class="top-catalog__result">Найдено объектов по Вашему запросу: <span><?=$house_arenda->count()+$house_prodaja->count()+$house_bissnes->count()+$house_arendovannie->count(); ?></span></div>
177 </div> 179 </div>
178 <form class="top-catalog__sorts"> 180 <form class="top-catalog__sorts">
179 <div class="top-catalog__sort-group sort-group js_sort_group"> 181 <div class="top-catalog__sort-group sort-group js_sort_group">
180 <input class="js_sort_group_input" type="hidden"> 182 <input class="js_sort_group_input" type="hidden">
181 <div class="sort-group__current js_sort_group_current">Сначала дешевле</div> 183 <div class="sort-group__current js_sort_group_current">Сначала дешевле</div>
182 <ul class="sort-group__list js_sort_group_list"> 184 <ul class="sort-group__list js_sort_group_list">
183 <li class="sort-price sort-group__item js_sort_group_item active" data-val="1">Сначала дешевле</li> 185 <li class="sort-price sort-group__item js_sort_group_item active" data-val="1">Сначала дешевле</li>
184 <li class="sort-price sort-group__item js_sort_group_item" data-val="2">Сначала дороже</li> 186 <li class="sort-price sort-group__item js_sort_group_item" data-val="2">Сначала дороже</li>
185 </ul> 187 </ul>
186 </div> 188 </div>
187 <div class="top-catalog__sort-group sort-group js_sort_group"> 189 <div class="top-catalog__sort-group sort-group js_sort_group">
188 <input class="js_sort_group_input" type="hidden"> 190 <input class="js_sort_group_input" type="hidden">
189 <div class="sort-group__current js_sort_group_current">Сначала новые</div> 191 <div class="sort-group__current js_sort_group_current">Сначала новые</div>
190 <ul class="sort-group__list js_sort_group_list"> 192 <ul class="sort-group__list js_sort_group_list">
191 <li class="sort-new sort-group__item js_sort_group_item active" data-val="1">Сначала новые</li> 193 <li class="sort-new sort-group__item js_sort_group_item active" data-val="1">Сначала новые</li>
192 <li class="sort-new sort-group__item js_sort_group_item" data-val="2">Сначала старые</li> 194 <li class="sort-new sort-group__item js_sort_group_item" data-val="2">Сначала старые</li>
193 </ul> 195 </ul>
194 </div> 196 </div>
195 <div class="top-catalog__sort-group sort-group sort-group--wide js_sort_group"> 197 <div class="top-catalog__sort-group sort-group sort-group--wide js_sort_group">
196 <input class="js_sort_group_input" type="hidden"> 198 <input class="js_sort_group_input" type="hidden">
197 <div class="sort-group__current js_sort_group_current">Сначала с большей площадью</div> 199 <div class="sort-group__current js_sort_group_current">Сначала с большей площадью</div>
198 <ul class="sort-group__list js_sort_group_list"> 200 <ul class="sort-group__list js_sort_group_list">
199 <li class="sort-area sort-group__item js_sort_group_item active" data-val="1">Сначала с большей площадью</li> 201 <li class="sort-area sort-group__item js_sort_group_item active" data-val="1">Сначала с большей площадью</li>
200 <li class="sort-area sort-group__item js_sort_group_item" data-val="2">Сначала с меньшей площадью</li> 202 <li class="sort-area sort-group__item js_sort_group_item" data-val="2">Сначала с меньшей площадью</li>
201 </ul> 203 </ul>
202 </div> 204 </div>
203 </form> 205 </form>
204 </div> 206 </div>
205 </div> 207 </div>
206 <div class="complex__sliders"> 208 <div class="complex__sliders">
207 <section class="slider"> 209 <section class="slider">
208 <div class="container"> 210 <div class="container">
209 <div class="slider__wrap"> 211 <div class="slider__wrap">
210 <div class="slider__top"> 212 <div class="slider__top">
211 <h2 class="slider__title title">Аренда торговых помещений</h2><a class="slider__more" href="#">Показать все объекты</a> 213 <h2 class="slider__title title">Аренда торговых помещений</h2><a class="slider__more" href="#">Показать все объекты</a>
212 <div class="slider__control"> 214 <div class="slider__control">
213 <div class="swiper-button-prev"> 215 <div class="swiper-button-prev">
214 <svg width="10" height="17"> 216 <svg width="10" height="17">
215 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use> 217 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
216 </svg> 218 </svg>
217 </div> 219 </div>
218 <div class="swiper-button-next"> 220 <div class="swiper-button-next">
219 <svg width="10" height="17"> 221 <svg width="10" height="17">
220 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use> 222 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
221 </svg> 223 </svg>
222 </div> 224 </div>
223 </div> 225 </div>
224 </div> 226 </div>
225 <div class="slider__swiper swiper"> 227 <div class="slider__swiper swiper">
226 <div class="swiper-wrapper" id="arenda_block"> 228 <div class="swiper-wrapper" id="arenda_block">
227 @if ($house_arenda->count()) 229 @if ($house_arenda->count())
228 @foreach ($house_arenda as $house1) 230 @foreach ($house_arenda as $house1)
229 @include('catalogs.elemhouse', ['house' => $house1]) 231 @include('catalogs.elemhouse', ['house' => $house1])
230 @endforeach 232 @endforeach
231 @else 233 @else
232 <h3>Здесь пока что нет предложений</h3> 234 <h3>Здесь пока что нет предложений</h3>
233 @endif 235 @endif
234 236
235 </div> 237 </div>
236 </div> 238 </div>
237 <div class="swiper-pagination"></div> 239 <div class="swiper-pagination"></div>
238 </div> 240 </div>
239 </div> 241 </div>
240 </section> 242 </section>
241 <section class="slider"> 243 <section class="slider">
242 <div class="container"> 244 <div class="container">
243 <div class="slider__wrap"> 245 <div class="slider__wrap">
244 <div class="slider__top"> 246 <div class="slider__top">
245 <h2 class="slider__title title">Продажа торговых помещений</h2><a class="slider__more" href="#">Показать все объекты</a> 247 <h2 class="slider__title title">Продажа торговых помещений</h2><a class="slider__more" href="#">Показать все объекты</a>
246 <div class="slider__control"> 248 <div class="slider__control">
247 <div class="swiper-button-prev"> 249 <div class="swiper-button-prev">
248 <svg width="10" height="17"> 250 <svg width="10" height="17">
249 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use> 251 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
250 </svg> 252 </svg>
251 </div> 253 </div>
252 <div class="swiper-button-next"> 254 <div class="swiper-button-next">
253 <svg width="10" height="17"> 255 <svg width="10" height="17">
254 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use> 256 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
255 </svg> 257 </svg>
256 </div> 258 </div>
257 </div> 259 </div>
258 </div> 260 </div>
259 <div class="slider__swiper swiper"> 261 <div class="slider__swiper swiper">
260 <div class="swiper-wrapper" id="prodaja_block"> 262 <div class="swiper-wrapper" id="prodaja_block">
261 @if ($house_prodaja->count()) 263 @if ($house_prodaja->count())
262 @foreach ($house_prodaja as $house2) 264 @foreach ($house_prodaja as $house2)
263 @include('catalogs.elemhouse', ['house' => $house2]) 265 @include('catalogs.elemhouse', ['house' => $house2])
264 @endforeach 266 @endforeach
265 @else 267 @else
266 <h3>Здесь пока что нет предложений</h3> 268 <h3>Здесь пока что нет предложений</h3>
267 @endif 269 @endif
268 </div> 270 </div>
269 </div> 271 </div>
270 <div class="swiper-pagination"></div> 272 <div class="swiper-pagination"></div>
271 </div> 273 </div>
272 </div> 274 </div>
273 </section> 275 </section>
274 <section class="slider"> 276 <section class="slider">
275 <div class="container"> 277 <div class="container">
276 <div class="slider__wrap"> 278 <div class="slider__wrap">
277 <div class="slider__top"> 279 <div class="slider__top">
278 <h2 class="slider__title title">Арендный бизнес</h2><a class="slider__more" href="#">Показать все объекты</a> 280 <h2 class="slider__title title">Арендный бизнес</h2><a class="slider__more" href="#">Показать все объекты</a>
279 <div class="slider__control"> 281 <div class="slider__control">
280 <div class="swiper-button-prev"> 282 <div class="swiper-button-prev">
281 <svg width="10" height="17"> 283 <svg width="10" height="17">
282 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use> 284 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
283 </svg> 285 </svg>
284 </div> 286 </div>
285 <div class="swiper-button-next"> 287 <div class="swiper-button-next">
286 <svg width="10" height="17"> 288 <svg width="10" height="17">
287 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use> 289 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
288 </svg> 290 </svg>
289 </div> 291 </div>
290 </div> 292 </div>
291 </div> 293 </div>
292 <div class="slider__swiper swiper"> 294 <div class="slider__swiper swiper">
293 <div class="swiper-wrapper" id="bissnes_block"> 295 <div class="swiper-wrapper" id="bissnes_block">
294 @if ($house_bissnes->count()) 296 @if ($house_bissnes->count())
295 @foreach ($house_bissnes as $house3) 297 @foreach ($house_bissnes as $house3)
296 @include('catalogs.elemhouse', ['house' => $house3]) 298 @include('catalogs.elemhouse', ['house' => $house3])
297 @endforeach 299 @endforeach
298 @else 300 @else
299 <h3>Здесь пока что нет предложений</h3> 301 <h3>Здесь пока что нет предложений</h3>
300 @endif 302 @endif
301 </div> 303 </div>
302 </div> 304 </div>
303 <div class="swiper-pagination"></div> 305 <div class="swiper-pagination"></div>
304 </div> 306 </div>
305 </div> 307 </div>
306 </section> 308 </section>
307 <section class="slider"> 309 <section class="slider">
308 <div class="container"> 310 <div class="container">
309 <div class="slider__wrap"> 311 <div class="slider__wrap">
310 <div class="slider__top"> 312 <div class="slider__top">
311 <h2 class="slider__title title">Арендованные</h2><a class="slider__more" href="#">Показать все объекты</a> 313 <h2 class="slider__title title">Арендованные</h2><a class="slider__more" href="#">Показать все объекты</a>
312 <div class="slider__control"> 314 <div class="slider__control">
313 <div class="swiper-button-prev"> 315 <div class="swiper-button-prev">
314 <svg width="10" height="17"> 316 <svg width="10" height="17">
315 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use> 317 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
316 </svg> 318 </svg>
317 </div> 319 </div>
318 <div class="swiper-button-next"> 320 <div class="swiper-button-next">
319 <svg width="10" height="17"> 321 <svg width="10" height="17">
320 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use> 322 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
321 </svg> 323 </svg>
322 </div> 324 </div>
323 </div> 325 </div>
324 </div> 326 </div>
325 <div class="slider__swiper swiper"> 327 <div class="slider__swiper swiper">
326 <div class="swiper-wrapper" id="arendovannie_block"> 328 <div class="swiper-wrapper" id="arendovannie_block">
327 @if ($house_arendovannie->count()) 329 @if ($house_arendovannie->count())
328 @foreach ($house_arendovannie as $house1) 330 @foreach ($house_arendovannie as $house1)
329 @include('catalogs.elemhouse', ['house' => $house1]) 331 @include('catalogs.elemhouse', ['house' => $house1])
330 @endforeach 332 @endforeach
331 @else 333 @else
332 <h3>Здесь пока что нет предложений</h3> 334 <h3>Здесь пока что нет предложений</h3>
333 @endif 335 @endif
334 336
335 </div> 337 </div>
336 </div> 338 </div>
337 <div class="swiper-pagination"></div> 339 <div class="swiper-pagination"></div>
338 </div> 340 </div>
339 </div> 341 </div>
340 </section> 342 </section>
341 </div> 343 </div>
342 </section> 344 </section>
343 @endsection 345 @endsection
344 346
345 @section('form_feedback') 347 @section('form_feedback')
346 <!-- Форма обратной связи --> 348 <!-- Форма обратной связи -->
347 @include('form.form_feedback') 349 @include('form.form_feedback')
348 @endsection 350 @endsection
349 351
350 352
resources/views/category_catalog.blade.php
1 @extends('layout.site', ['title' => $title]) 1 @extends('layout.site', ['title' => $title])
2 2
3 @section('filter') 3 @section('filter')
4 @include('part.filter.category', ['title' => $title]) 4 @include('part.filter.category', ['title' => $title])
5 @endsection 5 @endsection
6 6
7 @section('custom_js') 7 @section('custom_js')
8 <script> 8 @include('js.filter_value');
9 $(window).load(function() { 9 <script>
10 var url_str = "<?=url()->full();?>";
11 var url = new URL(url_str);
12 var searchParams = new URLSearchParams(url.search.substring(1));
13
14 var area = searchParams.get("area"),
15 type_area = searchParams.get("type_area"),
16 format_area= searchParams.get("format_area"),
17 address= searchParams.get("address");
18
19 var area_name = $('#area_name');
20 var type_area_name = $('#type_area_name');
21 var format_area_name = $('#format_area_name');
22 var address_name = $('#address');
23
24 if ((area !== "") || (type_area !== "") || (format_area !== "") || (address !== ""))
25 {
26 $.ajax({
27 type: "GET",
28 url: "{{ route('catalog_ajax_filter') }}",
29 data: "area=" + area + "&type_area=" + type_area + "&format_area=" + format_area + "&address=" + address + "",
30 success: function (data) {
31 console.log('Фильтры данных были переданы ');
32 data = JSON.parse(data);
33 console.log(data);
34
35 if (area !== "") {
36 area_name.html(data[0]);
37 }
38 if (type_area !== "") {
39 type_area_name.html(data[1]);
40 }
41 if (format_area !== "") {
42 format_area_name.html(data[2]);
43 }
44 if (address !== "") {
45 address_name.html(data[3]);
46 }
47
48 },
49 headers: {
50 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
51 },
52 error: function (data) {
53 console.log('Error: ' + data);
54 }
55 });
56 }
57 });
58
59 $(document).on('click', '.js_sort_group_item', function() { 10 $(document).on('click', '.js_sort_group_item', function() {
60 var val = $(this).data('val'); 11 var val = $(this).data('val');
61 var sort_price_val = ''; 12 var sort_price_val = '';
62 var sort_area_val = ''; 13 var sort_area_val = '';
63 var sort_new_val = ''; 14 var sort_new_val = '';
64 15
65 $('.sort-price').each(function() { 16 $('.sort-price').each(function() {
66 var this_ = $(this); 17 var this_ = $(this);
67 var v = $(this).data('val'); 18 var v = $(this).data('val');
68 if (this_.hasClass('active')) 19 if (this_.hasClass('active'))
69 sort_price_val = v; 20 sort_price_val = v;
70 }); 21 });
71 22
72 $('.sort-new').each(function() { 23 $('.sort-new').each(function() {
73 var v = $(this).data('val'); 24 var v = $(this).data('val');
74 var this_ = $(this); 25 var this_ = $(this);
75 if (this_.hasClass('active')) 26 if (this_.hasClass('active'))
76 sort_new_val = v; 27 sort_new_val = v;
77 }); 28 });
78 29
79 $('.sort-area').each(function() { 30 $('.sort-area').each(function() {
80 var v = $(this).data('val'); 31 var v = $(this).data('val');
81 var this_ = $(this); 32 var this_ = $(this);
82 if (this_.hasClass('active')) 33 if (this_.hasClass('active'))
83 sort_area_val = v; 34 sort_area_val = v;
84 35
85 }); 36 });
86 37
87 console.log('-------------------'); 38 console.log('-------------------');
88 $.ajax({ 39 $.ajax({
89 type: "GET", 40 type: "GET",
90 url: "{{ route('category', ['cat'=>$cat]) }}", 41 url: "{{ route('category', ['cat'=>$cat]) }}",
91 data: "sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+ 42 data: "sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+
92 "&area=<?if (isset($_GET['area'])) echo $_GET['area'];?>&type_area=<?if (isset($_GET['type_area'])) echo $_GET['type_area'];?>&format_area=<? if (isset($_GET['format_area'])) echo $_GET['format_area'];?>"+ 43 "&area=<?if (isset($_GET['area'])) echo $_GET['area'];?>&type_area=<?if (isset($_GET['type_area'])) echo $_GET['type_area'];?>&format_area=<? if (isset($_GET['format_area'])) echo $_GET['format_area'];?>"+
93 "&area_m2_min=<? if (isset($_GET['area_m2_min'])) echo $_GET['area_m2_min'];?>&area_m2_max=<? if (isset($_GET['area_m2_max'])) echo $_GET['area_m2_max'];?>"+ 44 "&area_m2_min=<? if (isset($_GET['area_m2_min'])) echo $_GET['area_m2_min'];?>&area_m2_max=<? if (isset($_GET['area_m2_max'])) echo $_GET['area_m2_max'];?>"+
94 "&price_min=<? if (isset($_GET['price_min'])) echo $_GET['price_min'];?>&price_max=<? if (isset($_GET['price_max'])) echo $_GET['price_max'];?>&address=<? if (isset($_GET['address'])) echo $_GET['address'];?>", 45 "&price_min=<? if (isset($_GET['price_min'])) echo $_GET['price_min'];?>&price_max=<? if (isset($_GET['price_max'])) echo $_GET['price_max'];?>&address=<? if (isset($_GET['address'])) echo $_GET['address'];?>",
95 success: function(data) { 46 success: function(data) {
96 console.log('Успешно обновлены данные таблиц '+data); 47 console.log('Успешно обновлены данные таблиц!!!!!!!!!! ');
97 $('#block_ajax').html(data); 48 $('#block_ajax').html(data);
98 }, 49 },
99 headers: { 50 headers: {
100 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 51 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
101 }, 52 },
102 error: function(data) { 53 error: function(data) {
103 console.log('Error: '+ data); 54 console.log('Error: '+ data);
104 } 55 }
105 }); 56 });
106 } 57 }
107 ); 58 );
108 </script> 59 </script>
109 @endsection 60 @endsection
110 61
111 @section('content') 62 @section('content')
112 <section class="category"> 63 <section class="category">
113 <div class="container"> 64 <div class="container">
114 <div class="category__top top-catalog"> 65 <div class="category__top top-catalog">
115 <div class="top-catalog__inner"> 66 <div class="top-catalog__inner">
116 <h2 class="top-catalog__title title">{{ $title }}</h2> 67 <h2 class="top-catalog__title title">{{ $title }}</h2>
117 <div class="top-catalog__result">Найдено объектов по Вашему запросу: <span>{{ $houses->count() }}</span></div> 68 <div class="top-catalog__result">Найдено объектов по Вашему запросу: <span>{{ $houses->count() }}</span></div>
118 </div> 69 </div>
119 <form class="top-catalog__sorts"> 70 <form class="top-catalog__sorts">
120 <div class="top-catalog__sort-group sort-group js_sort_group"> 71 <div class="top-catalog__sort-group sort-group js_sort_group">
121 <input class="js_sort_group_input" type="hidden"> 72 <input class="js_sort_group_input" type="hidden">
122 <div class="sort-group__current js_sort_group_current">Сначала дешевле</div> 73 <div class="sort-group__current js_sort_group_current">Сначала дешевле</div>
123 <ul class="sort-group__list js_sort_group_list"> 74 <ul class="sort-group__list js_sort_group_list">
124 <li class="sort-price sort-group__item js_sort_group_item active" data-val="1">Сначала дешевле</li> 75 <li class="sort-price sort-group__item js_sort_group_item active" data-val="1">Сначала дешевле</li>
125 <li class="sort-price sort-group__item js_sort_group_item" data-val="2">Сначала дороже</li> 76 <li class="sort-price sort-group__item js_sort_group_item" data-val="2">Сначала дороже</li>
126 </ul> 77 </ul>
127 </div> 78 </div>
128 <div class="top-catalog__sort-group sort-group js_sort_group"> 79 <div class="top-catalog__sort-group sort-group js_sort_group">
129 <input class="js_sort_group_input" type="hidden"> 80 <input class="js_sort_group_input" type="hidden">
130 <div class="sort-group__current js_sort_group_current">Сначала новые</div> 81 <div class="sort-group__current js_sort_group_current">Сначала новые</div>
131 <ul class="sort-group__list js_sort_group_list"> 82 <ul class="sort-group__list js_sort_group_list">
132 <li class="sort-new sort-group__item js_sort_group_item active" data-val="1">Сначала новые</li> 83 <li class="sort-new sort-group__item js_sort_group_item active" data-val="1">Сначала новые</li>
133 <li class="sort-new sort-group__item js_sort_group_item" data-val="2">Сначала старые</li> 84 <li class="sort-new sort-group__item js_sort_group_item" data-val="2">Сначала старые</li>
134 </ul> 85 </ul>
135 </div> 86 </div>
136 <div class="top-catalog__sort-group sort-group sort-group--wide js_sort_group"> 87 <div class="top-catalog__sort-group sort-group sort-group--wide js_sort_group">
137 <input class="js_sort_group_input" type="hidden"> 88 <input class="js_sort_group_input" type="hidden">
138 <div class="sort-group__current js_sort_group_current">Сначала с большей площадью</div> 89 <div class="sort-group__current js_sort_group_current">Сначала с большей площадью</div>
139 <ul class="sort-group__list js_sort_group_list"> 90 <ul class="sort-group__list js_sort_group_list">
140 <li class="sort-area sort-group__item js_sort_group_item active" data-val="1">Сначала с большей площадью</li> 91 <li class="sort-area sort-group__item js_sort_group_item active" data-val="1">Сначала с большей площадью</li>
141 <li class="sort-area sort-group__item js_sort_group_item" data-val="2">Сначала с меньшей площадью</li> 92 <li class="sort-area sort-group__item js_sort_group_item" data-val="2">Сначала с меньшей площадью</li>
142 </ul> 93 </ul>
143 </div> 94 </div>
144 </form> 95 </form>
145 </div> 96 </div>
146 <div id="block_ajax"> 97 <div id="block_ajax">
147 <div class="category__grid"> 98 <div class="category__grid">
148 @if ($houses->count()) 99 @if ($houses->count())
149 @foreach ($houses as $house1) 100 @foreach ($houses as $house1)
150 @include('catalogs.house_mini', ['house' => $house1]) 101 @include('catalogs.house_mini', ['house' => $house1])
151 @endforeach 102 @endforeach
152 @else 103 @else
153 <h3>Здесь пока что нет предложений</h3> 104 <h3>Здесь пока что нет предложений</h3>
154 @endif 105 @endif
155 </div> 106 </div>
156 <div class="pagination"> 107 <div class="pagination">
157 <?=$houses->appends($_GET)->links('catalogs.paginate'); 108 <?=$houses->appends($_GET)->links('catalogs.paginate');
158 ///=$houses->withQueryString()->links('catalogs.paginate'); ?> 109 ///=$houses->withQueryString()->links('catalogs.paginate'); ?>
159 </div> 110 </div>
160 </div> 111 </div>
161 </div> 112 </div>
162 </section> 113 </section>
163 @endsection 114 @endsection
164 115
165 @section('form_feedback') 116 @section('form_feedback')
166 <!-- Форма обратной связи --> 117 <!-- Форма обратной связи -->
167 @include('form.form_feedback') 118 @include('form.form_feedback')
168 @endsection 119 @endsection
169 120
resources/views/js/filter_value.blade.php
File was created 1 <script>
2 $(window).load(function() {
3 var url_str = "<?=url()->full();?>";
4 var url = new URL(url_str);
5 var searchParams = new URLSearchParams(url.search.substring(1));
6
7 var area = searchParams.get("area"),
8 type_area = searchParams.get("type_area"),
9 format_area= searchParams.get("format_area"),
10 address= searchParams.get("address");
11
12 var area_name = $('#area_name');
13 var type_area_name = $('#type_area_name');
14 var format_area_name = $('#format_area_name');
15 var address_name = $('#address');
16
17 var area_input = $('#area');
18 var type_area_input = $('#type_area');
19 var format_area_input = $('#format_area');
20
21 if ((area !== "") || (type_area !== "") || (format_area !== "") || (address !== ""))
22 {
23 $.ajax({
24 type: "GET",
25 url: "{{ route('catalog_ajax_filter') }}",
26 data: "area=" + area + "&type_area=" + type_area + "&format_area=" + format_area + "&address=" + address + "",
27 success: function (data) {
28 console.log('Фильтры данных были переданы ');
29 data = JSON.parse(data);
30 console.log(data);
31
32 if (area !== "") {
33 area_name.html(data[0]);
34 area_input.val(area);
35 }
36 if (type_area !== "") {
37 type_area_name.html(data[1]);
38 type_area_input.val(type_area);
39 }
40 if (format_area !== "") {
41 format_area_name.html(data[2]);
42 format_area_input.val(format_area);
43 }
44 if (address !== "") {
45 address_name.html(data[3]);
46 }
47
48 },
49 headers: {
50 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
51 },
52 error: function (data) {
53 console.log('Error: ' + data);
54 }
55 });
56 }
57 });
58 </script>
59
resources/views/part/filter/catalog.blade.php
1 <section class="hero hero--modified1"> 1 <section class="hero hero--modified1">
2 <div class="container"> 2 <div class="container">
3 <div class="hero__bg" style="background-image:url('images/catalog-bg.jpg')"></div> 3 <div class="hero__bg" style="background-image:url('images/catalog-bg.jpg')"></div>
4 <div class="hero__wrap"> 4 <div class="hero__wrap">
5 <div class="hero__inner"> 5 <div class="hero__inner">
6 <div class="breadcrumbs"> 6 <div class="breadcrumbs">
7 <ul class="breadcrumbs__list"> 7 <ul class="breadcrumbs__list">
8 <li class="breadcrumbs__item"><a class="breadcrumbs__link" href="{{ route('index') }}">Главная</a></li> 8 <li class="breadcrumbs__item"><a class="breadcrumbs__link" href="{{ route('index') }}">Главная</a></li>
9 <li class="breadcrumbs__item"><span class="breadcrumbs__link">Каталог</span></li> 9 <li class="breadcrumbs__item"><span class="breadcrumbs__link">Каталог</span></li>
10 </ul> 10 </ul>
11 </div> 11 </div>
12 <div class="hero__cnt"> 12 <div class="hero__cnt">
13 <h1 class="hero__title title-main">Каталог продажи и аренды торговой недвижимости в Москве</h1> 13 <h1 class="hero__title title-main">Каталог продажи и аренды торговой недвижимости в Москве</h1>
14 <p class="hero__descr">В Москве, Новой Москве и Подмосковье</p> 14 <p class="hero__descr">В Москве, Новой Москве и Подмосковье</p>
15 </div> 15 </div>
16 <div class="hero__bottom"> 16 <div class="hero__bottom">
17 <div class="hero__links"> 17 <div class="hero__links">
18 <a class="hero__link" href="{{ route('category', ['cat'=>'arenda']) }}">Аренда торговых помещениий</a> 18 <a class="hero__link" href="{{ route('category', ['cat'=>'arenda']) }}">Аренда торговых помещениий</a>
19 <a class="hero__link" href="{{ route('category', ['cat'=>'sale']) }}">Продажа торговых помещений</a> 19 <a class="hero__link" href="{{ route('category', ['cat'=>'sale']) }}">Продажа торговых помещений</a>
20 <a class="hero__link" href="{{ route('category', ['cat'=>'bussiness']) }}">Арендый бизнес</a></div> 20 <a class="hero__link" href="{{ route('category', ['cat'=>'bussiness']) }}">Арендый бизнес</a></div>
21 <form class="hero-search" action="{{ route('catalog') }}" method="GET"> 21 <form class="hero-search" action="{{ route('catalog') }}" method="GET">
22 <div class="hero-search__control"> 22 <div class="hero-search__control">
23 <div class="hero-filter hero-filter--modified1 js_hero_filter"> 23 <div class="hero-filter hero-filter--modified1 js_hero_filter">
24 <input class="js_hero_filter_input" id="area" name="area" type="hidden"> 24 <input class="js_hero_filter_input" id="area" name="area" type="hidden">
25 <div class="hero-filter__current js_hero_filter_current" id="area_name" name="area_name">Все объекты</div> 25 <div class="hero-filter__current js_hero_filter_current" id="area_name" name="area_name">Все объекты</div>
26 <div class="hero-filter__dropdown js_hero_filter_dropdown"> 26 <div class="hero-filter__dropdown js_hero_filter_dropdown">
27 <ul class="hero-filter__list"> 27 <ul class="hero-filter__list">
28 <li class="hero-filter__item" data-val="0">Все объекты</li> 28 <li class="hero-filter__item" data-val="0">Все объекты</li>
29 @if ($items_area->count()) 29 @if ($items_area->count())
30 @foreach($items_area as $item_area) 30 @foreach($items_area as $item_area)
31 <li class="hero-filter__item" data-val="{{ $item_area->id }}">{{ $item_area->name_area }}</li> 31 <li class="hero-filter__item" data-val="{{ $item_area->id }}">{{ $item_area->name_area }}</li>
32 @endforeach 32 @endforeach
33 @endif 33 @endif
34 </ul> 34 </ul>
35 </div> 35 </div>
36 </div> 36 </div>
37 <div class="hero-filter hero-filter--modified2 js_hero_filter"> 37 <div class="hero-filter hero-filter--modified2 js_hero_filter">
38 <input class="js_hero_filter_input" id="type_area" name="type_area" type="hidden"> 38 <input class="js_hero_filter_input" id="type_area" name="type_area" type="hidden">
39 <div class="hero-filter__current js_hero_filter_current" id="type_area_name" name="type_area_name">Тип недвижимости</div> 39 <div class="hero-filter__current js_hero_filter_current" id="type_area_name" name="type_area_name">Тип недвижимости</div>
40 <div class="hero-filter__dropdown js_hero_filter_dropdown"> 40 <div class="hero-filter__dropdown js_hero_filter_dropdown">
41 <ul class="hero-filter__list"> 41 <ul class="hero-filter__list">
42 <li class="hero-filter__item" data-val="0">Выбрать все</li> 42 <li class="hero-filter__item" data-val="0">Выбрать все</li>
43 @if ($items_type_area->count()) 43 @if ($items_type_area->count())
44 @foreach($items_type_area as $item_type_area) 44 @foreach($items_type_area as $item_type_area)
45 <li class="hero-filter__item" data-val="{{ $item_type_area->id }}">{{ $item_type_area->name_type }}</li> 45 <li class="hero-filter__item" data-val="{{ $item_type_area->id }}">{{ $item_type_area->name_type }}</li>
46 @endforeach 46 @endforeach
47 @endif 47 @endif
48 </ul> 48 </ul>
49 </div> 49 </div>
50 </div> 50 </div>
51 <div class="hero-filter hero-filter--modified3 js_hero_filter"> 51 <div class="hero-filter hero-filter--modified3 js_hero_filter">
52 <input class="js_hero_filter_input" id="format_area" name="format_area" type="hidden"> 52 <input class="js_hero_filter_input" id="format_area" name="format_area" type="hidden">
53 <div class="hero-filter__current js_hero_filter_current" id="format_area_name" name="format_area_name">Формат недвижимости</div> 53 <div class="hero-filter__current js_hero_filter_current" id="format_area_name" name="format_area_name">Формат недвижимости</div>
54 <div class="hero-filter__dropdown js_hero_filter_dropdown"> 54 <div class="hero-filter__dropdown js_hero_filter_dropdown">
55 <ul class="hero-filter__list"> 55 <ul class="hero-filter__list">
56 <li class="hero-filter__item" data-val="0">Выбрать все</li> 56 <li class="hero-filter__item" data-val="0">Выбрать все</li>
57 @if ($items_format_area->count()) 57 @if ($items_format_area->count())
58 @foreach($items_format_area as $item_format_area) 58 @foreach($items_format_area as $item_format_area)
59 <li class="hero-filter__item" data-val="{{ $item_format_area->id }}">{{ $item_format_area->name_format }}</li> 59 <li class="hero-filter__item" data-val="{{ $item_format_area->id }}">{{ $item_format_area->name_format }}</li>
60 @endforeach 60 @endforeach
61 @endif 61 @endif
62 </ul> 62 </ul>
63 </div> 63 </div>
64 </div> 64 </div>
65 <div class="hero-filter hero-filter--modified4 js_hero_filter"> 65 <div class="hero-filter hero-filter--modified4 js_hero_filter">
66 <div class="hero-filter__current js_hero_filter_current">Площадь, м<sup>2</sup></div> 66 <div class="hero-filter__current js_hero_filter_current">Площадь, м<sup>2</sup></div>
67 <div class="hero-filter__dropdown js_hero_filter_dropdown"> 67 <div class="hero-filter__dropdown js_hero_filter_dropdown">
68 <div class="hero-filter__fields"> 68 <div class="hero-filter__fields">
69 <label class="hero-filter__field"><span>От</span> 69 <label class="hero-filter__field"><span>От</span>
70 <input class="js_hero_filter_field js_hero_filter_from" id="area_m2_min" name="area_m2_min" type="text" data-min="3" placeholder="3" value="<?if (isset($_GET['area_m2_min'])) { echo($_GET['area_m2_min']); }?>"> 70 <input class="js_hero_filter_field js_hero_filter_from" id="area_m2_min" name="area_m2_min" type="text" data-min="3" placeholder="3" value="<?if (isset($_GET['area_m2_min'])) { echo($_GET['area_m2_min']); }?>">
71 </label> 71 </label>
72 <label class="hero-filter__field"><span>До</span> 72 <label class="hero-filter__field"><span>До</span>
73 <input class="js_hero_filter_field js_hero_filter_to" id="area_m2_max" name="area_m2_max" type="text" data-max="125000" placeholder="125 000" value="<?if (isset($_GET['area_m2_max'])) { echo($_GET['area_m2_max']);}?>"> 73 <input class="js_hero_filter_field js_hero_filter_to" id="area_m2_max" name="area_m2_max" type="text" data-max="125000" placeholder="125 000" value="<?if (isset($_GET['area_m2_max'])) { echo($_GET['area_m2_max']);}?>">
74 </label> 74 </label>
75 </div> 75 </div>
76 <button class="hero-filter__reset js_hero_filter_reset" type="button">Очистить</button> 76 <button class="hero-filter__reset js_hero_filter_reset" type="button">Очистить</button>
77 </div> 77 </div>
78 </div> 78 </div>
79 <div class="hero-filter hero-filter--modified5 js_hero_filter"> 79 <div class="hero-filter hero-filter--modified5 js_hero_filter">
80 <div class="hero-filter__current js_hero_filter_current">Стоимость, ₽</div> 80 <div class="hero-filter__current js_hero_filter_current">Стоимость, ₽</div>
81 <div class="hero-filter__dropdown js_hero_filter_dropdown"> 81 <div class="hero-filter__dropdown js_hero_filter_dropdown">
82 <div class="hero-filter__fields"> 82 <div class="hero-filter__fields">
83 <label class="hero-filter__field"><span>От</span> 83 <label class="hero-filter__field"><span>От</span>
84 <input class="js_hero_filter_field js_hero_filter_from" id="price_min" name="price_min" type="text" data-min="50" placeholder="50" value="<?if (isset($_GET['price_min'])) { echo ($_GET['price_min']); } ?>"> 84 <input class="js_hero_filter_field js_hero_filter_from" id="price_min" name="price_min" type="text" data-min="50" placeholder="50" value="<?if (isset($_GET['price_min'])) { echo ($_GET['price_min']); } ?>">
85 </label> 85 </label>
86 <label class="hero-filter__field"><span>До</span> 86 <label class="hero-filter__field"><span>До</span>
87 <input class="js_hero_filter_field js_hero_filter_to" id="price_max" name="price_max" type="text" data-max="125000" placeholder="125 000" value="<?if (isset($_GET['price_max'])) { echo ($_GET['price_max']); }?>"> 87 <input class="js_hero_filter_field js_hero_filter_to" id="price_max" name="price_max" type="text" data-max="125000" placeholder="125 000" value="<?if (isset($_GET['price_max'])) { echo ($_GET['price_max']); }?>">
88 </label> 88 </label>
89 </div> 89 </div>
90 <button class="hero-filter__reset js_hero_filter_reset" type="button">Очистить</button> 90 <button class="hero-filter__reset js_hero_filter_reset" type="button">Очистить</button>
91 </div> 91 </div>
92 </div> 92 </div>
93 </div> 93 </div>
94 <div class="hero-search__bottom"> 94 <div class="hero-search__bottom">
95 <div class="hero-search__field"> 95 <div class="hero-search__field">
96 <input type="text" id="address" name="address" placeholder="Укажите метро, округ, район, улицу" value="<?if (isset($_GET['address'])) { echo ($_GET['address']); }?>"> 96 <input type="text" id="address" name="address" placeholder="Укажите метро, округ, район, улицу" value="<?if (isset($_GET['address'])) { echo ($_GET['address']); }?>">
97 <button> 97 <button>
98 <svg width="20" height="20"> 98 <svg width="20" height="20">
99 <use xlink:href="{{ asset('images/sprite.svg#hero-search') }}"> </use> 99 <use xlink:href="{{ asset('images/sprite.svg#hero-search') }}"> </use>
100 </svg> 100 </svg>
101 </button> 101 </button>
102 </div> 102 </div>
103 <div class="hero-search__buttons"> 103 <div class="hero-search__buttons">
104 <a class="hero-search__btn btn btn--white js_hero_search_btn" href="{{ route('maps') }}">Показать на карте</a> 104 <a class="hero-search__btn btn btn--white js_hero_search_btn" href="{{ route('maps') }}">Показать на карте</a>
105 <button type="submit" class="hero-search__btn btn btn--main js_hero_search_btn"> 105 <button type="submit" class="hero-search__btn btn btn--main js_hero_search_btn">
106 {{ session()->get('message') }} 106 Искать
107 </button> 107 </button>
108 </div> 108 </div>
109 </div> 109 </div>
110 </form> 110 </form>
111 </div> 111 </div>
112 </div> 112 </div>
113 </div> 113 </div>
114 </div> 114 </div>
115 </section> 115 </section>
116 116
resources/views/part/filter/main.blade.php
1 <section class="hero"> 1 <section class="hero">
2 <div class="container"> 2 <div class="container">
3 <div class="hero__bg" style="background-image:url('images/hero-bg.jpg')"></div> 3 <div class="hero__bg" style="background-image:url('images/hero-bg.jpg')"></div>
4 <div class="hero__wrap"> 4 <div class="hero__wrap">
5 <div class="hero__inner"> 5 <div class="hero__inner">
6 <div class="hero__cnt"> 6 <div class="hero__cnt">
7 <h1 class="hero__title title-main">Аренда и продажа торговой недвижимости</h1> 7 <h1 class="hero__title title-main">Аренда и продажа торговой недвижимости</h1>
8 <p class="hero__descr">В Москве, Новой Москве и Подмосковье</p> 8 <p class="hero__descr">В Москве, Новой Москве и Подмосковье</p>
9 </div> 9 </div>
10 <div class="hero__bottom"> 10 <div class="hero__bottom">
11 <div class="hero__links"> 11 <div class="hero__links">
12 <a class="hero__link" href="{{ route('category', ['cat'=>'arenda']) }}">Аренда торговых помещениий</a> 12 <a class="hero__link" href="{{ route('category', ['cat'=>'arenda']) }}">Аренда торговых помещениий</a>
13 <a class="hero__link" href="{{ route('category', ['cat'=>'sale']) }}">Продажа торговых помещений</a> 13 <a class="hero__link" href="{{ route('category', ['cat'=>'sale']) }}">Продажа торговых помещений</a>
14 <a class="hero__link" href="{{ route('category', ['cat'=>'bussiness']) }}">Арендый бизнес</a></div> 14 <a class="hero__link" href="{{ route('category', ['cat'=>'bussiness']) }}">Арендый бизнес</a></div>
15 <form class="hero-search" action="{{ route('catalog') }}" method="GET"> 15 <form class="hero-search" action="{{ route('catalog') }}" method="GET">
16 <div class="hero-search__control"> 16 <div class="hero-search__control">
17 <div class="hero-filter hero-filter--modified1 js_hero_filter"> 17 <div class="hero-filter hero-filter--modified1 js_hero_filter">
18 <input class="js_hero_filter_input" id="area" name="area" type="hidden"> 18 <input class="js_hero_filter_input" id="area" name="area" type="hidden">
19 <div class="hero-filter__current js_hero_filter_current" id="area_name" name="area_name">Все объекты</div> 19 <div class="hero-filter__current js_hero_filter_current" id="area_name" name="area_name">Все объекты</div>
20 <div class="hero-filter__dropdown js_hero_filter_dropdown"> 20 <div class="hero-filter__dropdown js_hero_filter_dropdown">
21 <ul class="hero-filter__list"> 21 <ul class="hero-filter__list">
22 <li class="hero-filter__item" data-val="0">Все объекты</li> 22 <li class="hero-filter__item" data-val="0">Все объекты</li>
23 @if ($items_area->count()) 23 @if ($items_area->count())
24 @foreach($items_area as $item_area) 24 @foreach($items_area as $item_area)
25 <li class="hero-filter__item" data-val="{{ $item_area->id }}">{{ $item_area->name_area }}</li> 25 <li class="hero-filter__item" data-val="{{ $item_area->id }}">{{ $item_area->name_area }}</li>
26 @endforeach 26 @endforeach
27 @endif 27 @endif
28 </ul> 28 </ul>
29 </div> 29 </div>
30 </div> 30 </div>
31 <div class="hero-filter hero-filter--modified2 js_hero_filter"> 31 <div class="hero-filter hero-filter--modified2 js_hero_filter">
32 <input class="js_hero_filter_input" id="type_area" name="type_area" type="hidden"> 32 <input class="js_hero_filter_input" id="type_area" name="type_area" type="hidden">
33 <div class="hero-filter__current js_hero_filter_current" id="type_area_name" name="type_area_name">Тип недвижимости</div> 33 <div class="hero-filter__current js_hero_filter_current" id="type_area_name" name="type_area_name">Тип недвижимости</div>
34 <div class="hero-filter__dropdown js_hero_filter_dropdown"> 34 <div class="hero-filter__dropdown js_hero_filter_dropdown">
35 <ul class="hero-filter__list"> 35 <ul class="hero-filter__list">
36 <li class="hero-filter__item" data-val="0">Выбрать все</li> 36 <li class="hero-filter__item" data-val="0">Выбрать все</li>
37 @if ($items_type_area->count()) 37 @if ($items_type_area->count())
38 @foreach($items_type_area as $item_type_area) 38 @foreach($items_type_area as $item_type_area)
39 <li class="hero-filter__item" data-val="{{ $item_type_area->id }}">{{ $item_type_area->name_type }}</li> 39 <li class="hero-filter__item" data-val="{{ $item_type_area->id }}">{{ $item_type_area->name_type }}</li>
40 @endforeach 40 @endforeach
41 @endif 41 @endif
42 </ul> 42 </ul>
43 </div> 43 </div>
44 </div> 44 </div>
45 <div class="hero-filter hero-filter--modified3 js_hero_filter"> 45 <div class="hero-filter hero-filter--modified3 js_hero_filter">
46 <input class="js_hero_filter_input" id="format_area" name="format_area" type="hidden"> 46 <input class="js_hero_filter_input" id="format_area" name="format_area" type="hidden">
47 <div class="hero-filter__current js_hero_filter_current" id="format_area_name" name="format_area_name">Формат недвижимости</div> 47 <div class="hero-filter__current js_hero_filter_current" id="format_area_name" name="format_area_name">Формат недвижимости</div>
48 <div class="hero-filter__dropdown js_hero_filter_dropdown"> 48 <div class="hero-filter__dropdown js_hero_filter_dropdown">
49 <ul class="hero-filter__list"> 49 <ul class="hero-filter__list">
50 <li class="hero-filter__item" data-val="0">Выбрать все</li> 50 <li class="hero-filter__item" data-val="0">Выбрать все</li>
51 @if ($items_format_area->count()) 51 @if ($items_format_area->count())
52 @foreach($items_format_area as $item_format_area) 52 @foreach($items_format_area as $item_format_area)
53 <li class="hero-filter__item" data-val="{{ $item_format_area->id }}">{{ $item_format_area->name_format }}</li> 53 <li class="hero-filter__item" data-val="{{ $item_format_area->id }}">{{ $item_format_area->name_format }}</li>
54 @endforeach 54 @endforeach
55 @endif 55 @endif
56 </ul> 56 </ul>
57 </div> 57 </div>
58 </div> 58 </div>
59 <div class="hero-filter hero-filter--modified4 js_hero_filter"> 59 <div class="hero-filter hero-filter--modified4 js_hero_filter">
60 <div class="hero-filter__current js_hero_filter_current">Площадь, м<sup>2</sup></div> 60 <div class="hero-filter__current js_hero_filter_current">Площадь, м<sup>2</sup></div>
61 <div class="hero-filter__dropdown js_hero_filter_dropdown"> 61 <div class="hero-filter__dropdown js_hero_filter_dropdown">
62 <div class="hero-filter__fields"> 62 <div class="hero-filter__fields">
63 <label class="hero-filter__field"><span>От</span> 63 <label class="hero-filter__field"><span>От</span>
64 <input class="js_hero_filter_field js_hero_filter_from" id="area_m2_min" name="area_m2_min" type="text" data-min="3" placeholder="3" value="<?if (isset($_GET['area_m2_min'])) { echo($_GET['area_m2_min']); }?>"> 64 <input class="js_hero_filter_field js_hero_filter_from" id="area_m2_min" name="area_m2_min" type="text" data-min="3" placeholder="3" value="<?if (isset($_GET['area_m2_min'])) { echo($_GET['area_m2_min']); }?>">
65 </label> 65 </label>
66 <label class="hero-filter__field"><span>До</span> 66 <label class="hero-filter__field"><span>До</span>
67 <input class="js_hero_filter_field js_hero_filter_to" id="area_m2_max" name="area_m2_max" type="text" data-max="125000" placeholder="125 000" value="<?if (isset($_GET['area_m2_max'])) { echo($_GET['area_m2_max']);}?>"> 67 <input class="js_hero_filter_field js_hero_filter_to" id="area_m2_max" name="area_m2_max" type="text" data-max="125000" placeholder="125 000" value="<?if (isset($_GET['area_m2_max'])) { echo($_GET['area_m2_max']);}?>">
68 </label> 68 </label>
69 </div> 69 </div>
70 <button class="hero-filter__reset js_hero_filter_reset" type="button">Очистить</button> 70 <button class="hero-filter__reset js_hero_filter_reset" type="button">Очистить</button>
71 </div> 71 </div>
72 </div> 72 </div>
73 <div class="hero-filter hero-filter--modified5 js_hero_filter"> 73 <div class="hero-filter hero-filter--modified5 js_hero_filter">
74 <div class="hero-filter__current js_hero_filter_current">Стоимость, ₽</div> 74 <div class="hero-filter__current js_hero_filter_current">Стоимость, ₽</div>
75 <div class="hero-filter__dropdown js_hero_filter_dropdown"> 75 <div class="hero-filter__dropdown js_hero_filter_dropdown">
76 <div class="hero-filter__fields"> 76 <div class="hero-filter__fields">
77 <label class="hero-filter__field"><span>От</span> 77 <label class="hero-filter__field"><span>От</span>
78 <input class="js_hero_filter_field js_hero_filter_from" id="price_min" name="price_min" type="text" data-min="50" placeholder="50" value="<?if (isset($_GET['price_min'])) { echo ($_GET['price_min']); } ?>"> 78 <input class="js_hero_filter_field js_hero_filter_from" id="price_min" name="price_min" type="text" data-min="50" placeholder="50" value="<?if (isset($_GET['price_min'])) { echo ($_GET['price_min']); } ?>">
79 </label> 79 </label>
80 <label class="hero-filter__field"><span>До</span> 80 <label class="hero-filter__field"><span>До</span>
81 <input class="js_hero_filter_field js_hero_filter_to" id="price_max" name="price_max" type="text" data-max="125000" placeholder="125 000" value="<?if (isset($_GET['price_max'])) { echo ($_GET['price_max']); }?>"> 81 <input class="js_hero_filter_field js_hero_filter_to" id="price_max" name="price_max" type="text" data-max="125000" placeholder="125 000" value="<?if (isset($_GET['price_max'])) { echo ($_GET['price_max']); }?>">
82 </label> 82 </label>
83 </div> 83 </div>
84 <button class="hero-filter__reset js_hero_filter_reset" type="button">Очистить</button> 84 <button class="hero-filter__reset js_hero_filter_reset" type="button">Очистить</button>
85 </div> 85 </div>
86 </div> 86 </div>
87 </div> 87 </div>
88 <div class="hero-search__bottom"> 88 <div class="hero-search__bottom">
89 <div class="hero-search__field"> 89 <div class="hero-search__field">
90 <input type="text" id="address" name="address" placeholder="Укажите метро, округ, район, улицу" value="<?if (isset($_GET['address'])) { echo ($_GET['address']); }?>"> 90 <input type="text" id="address" name="address" placeholder="Укажите метро, округ, район, улицу" value="<?if (isset($_GET['address'])) { echo ($_GET['address']); }?>">
91 <button> 91 <button>
92 <svg width="20" height="20"> 92 <svg width="20" height="20">
93 <use xlink:href="{{ asset('images/sprite.svg#hero-search') }}"> </use> 93 <use xlink:href="{{ asset('images/sprite.svg#hero-search') }}"> </use>
94 </svg> 94 </svg>
95 </button> 95 </button>
96 </div> 96 </div>
97 <div class="hero-search__buttons"> 97 <div class="hero-search__buttons">
98 <a class="hero-search__btn btn btn--white js_hero_search_btn" href="{{ route('maps') }}">Показать на карте</a> 98 <a class="hero-search__btn btn btn--white js_hero_search_btn" href="{{ route('maps') }}">Показать на карте</a>
99 <button type="submit" class="hero-search__btn btn btn--main js_hero_search_btn"> 99 <button type="submit" class="hero-search__btn btn btn--main js_hero_search_btn">
100 Искать<? //session()->get('message')?> 100 Искать
101 </button> 101 </button>
102 </div> 102 </div>
103 </div> 103 </div>
104 </form> 104 </form>
105 </div> 105 </div>
106 </div> 106 </div>
107 </div><a class="hero__btn js_smooth_link" href="#slider"></a> 107 </div><a class="hero__btn js_smooth_link" href="#slider"></a>
108 </div> 108 </div>
109 </section> 109 </section>
110 110