Commit 59d4ce857ef6179c02f3075858d49bb4028a2f87

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

Рефакторинг кода, исправление ошибки фильтра с ценами, исправление ошибки с избранными

Showing 6 changed files with 61 additions and 334 deletions Inline Diff

app/Classes/FilterData.php
1 <?php 1 <?php
2 2
3 3
4 namespace App\Classes; 4 namespace App\Classes;
5 5
6 6
7 class FilterData 7 class FilterData
8 { 8 {
9 protected $builder; 9 protected $builder;
10 protected $request; 10 protected $request;
11 11
12 public function __construct($builder, $request) { 12 public function __construct($builder, $request) {
13 $this->builder = $builder; 13 $this->builder = $builder;
14 $this->request = $request; 14 $this->request = $request;
15 } 15 }
16 16
17 public function apply() { 17 public function apply() {
18 foreach ($this->filters() as $filter => $value) { 18 foreach ($this->filters() as $filter => $value) {
19 if (method_exists($this, $filter)) { 19 if (method_exists($this, $filter)) {
20 $this->filter($value); 20 if (!empty($value)) $this->$filter($value);
21 } 21 }
22 } 22 }
23 return $this->builder; 23 return $this->builder;
24 } 24 }
25 25
26 public function area($value) { 26 public function area($value) {
27 return $this->builder->where('area_id', '=', $value); 27 return $this->builder->where('area_id', '=', $value);
28 } 28 }
29 29
30 public function type_area($value) { 30 public function type_area($value) {
31 return $this->builder->where('type_area_id', '=', $value); 31 return $this->builder->where('type_area_id', '=', $value);
32 } 32 }
33 33
34 public function format_area($value) { 34 public function format_area($value) {
35 return $this->builder->where('format_area_id', '=', $value); 35 return $this->builder->where('format_area_id', '=', $value);
36 } 36 }
37 37
38 public function area_m2_min($value) { 38 public function area_m2_min($value) {
39 return $this->builder->where('area', '>', $value); 39 $value = str_replace("+", "", $value);
40 $value = str_replace(' ', '', $value);
41 if ($value) return $this->builder->where('area', '>', $value);
40 } 42 }
41 43
42 public function area_m2_max($value) { 44 public function area_m2_max($value) {
43 return $this->builder->where('area', '<', $value); 45 $value = str_replace("+", "", $value);
46 $value = str_replace(' ', '', $value);
47 if ($value) return $this->builder->where('area', '<', $value);
44 } 48 }
45 49
46 public function price_min($value) { 50 public function price_min($value) {
47 return $this->builder->where('price', '>', $value); 51 $value = str_replace("+", "", $value);
52 $value = str_replace(' ', '', $value);
53
54 if ($value) return $this->builder->where('price', '>', $value);
48 } 55 }
49 56
50 public function price_max($value) { 57 public function price_max($value) {
51 return $this->builder->where('price', '<', $value); 58 $value = str_replace("+", "", $value);
59 $value = str_replace(' ', '', $value);
60 if ($value) return $this->builder->where('price', '<', $value);
52 } 61 }
53 62
54 public function address($value) { 63 public function address($value) {
55 return $this->builder->where('address', 'LIKE', "%".$value."%"); 64 if ($value) return $this->builder->where('address', 'LIKE', "%".$value."%");
56 } 65 }
57 66
58 public function filters() { 67 public function filters() {
59 return $this->request->all(); 68 return $this->request->all();
60 } 69 }
61 } 70 }
62 71
app/Classes/SortData.php
1 <?php 1 <?php
2 2
3 3
4 namespace App\Classes; 4 namespace App\Classes;
5 5
6 6
7 class SortData 7 class SortData
8 { 8 {
9 protected $builder; 9 protected $builder;
10 protected $request; 10 protected $request;
11 11
12 public function __construct($builder, $request) { 12 public function __construct($builder, $request) {
13 $this->builder = $builder; 13 $this->builder = $builder;
14 $this->request = $request; 14 $this->request = $request;
15 } 15 }
16 16
17 public function apply() { 17 public function apply() {
18 foreach ($this->sorter() as $filter => $value) { 18 foreach ($this->sorter() as $filter => $value) {
19 if (method_exists($this, $filter)) { 19 if (method_exists($this, $filter)) {
20 $this->filter($value); 20 $this->$filter($value);
21 } 21 }
22 } 22 }
23 return $this->builder; 23 return $this->builder;
24 } 24 }
25 25
26 public function sort_price($value) { 26 public function sort_price($value) {
27 switch ($value) { 27 switch ($value) {
28 case 1: $this->builder = $this->builder->orderBy('price');break; 28 case 1: $this->builder = $this->builder->orderBy('price');break;
29 case 2: $this->builder = $this->builder->orderByDesc('price');break; 29 case 2: $this->builder = $this->builder->orderByDesc('price');break;
30 default: $this->builder = $this->builder->orderBy('price');break; 30 default: $this->builder = $this->builder->orderBy('price');break;
31 } 31 }
32 } 32 }
33 33
34 public function sort_new($value) { 34 public function sort_new($value) {
35 switch ($value) { 35 switch ($value) {
36 case 1: $this->builder = $this->builder->orderByDesc('created_at');break; 36 case 1: $this->builder = $this->builder->orderByDesc('created_at');break;
37 case 2: $this->builder = $this->builder->orderBy('created_at');break; 37 case 2: $this->builder = $this->builder->orderBy('created_at');break;
38 default: $this->builder = $this->builder->orderByDesc('created_at');break; 38 default: $this->builder = $this->builder->orderByDesc('created_at');break;
39 } 39 }
40 } 40 }
41 41
42 public function sort_area($value) { 42 public function sort_area($value) {
43 switch ($value) { 43 switch ($value) {
44 case 1: $this->builder = $this->builder->orderByDesc('area');break; 44 case 1: $this->builder = $this->builder->orderByDesc('area');break;
45 case 2: $this->builder = $this->builder->orderBy('area');break; 45 case 2: $this->builder = $this->builder->orderBy('area');break;
46 default: $this->builder = $this->builder->orderByDesc('area');break; 46 default: $this->builder = $this->builder->orderByDesc('area');break;
47 } 47 }
48 } 48 }
49 49
50 public function sorter() { 50 public function sorter() {
51 return $this->request->all(); 51 return $this->request->all();
52 } 52 }
53 53
54 } 54 }
55 55
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\Classes\SortData;
5 use App\Http\Requests\EmailRequest; 6 use App\Http\Requests\EmailRequest;
6 use App\Http\Requests\FooterFeedbackRequest; 7 use App\Http\Requests\FooterFeedbackRequest;
7 use App\Models\Area; 8 use App\Models\Area;
8 use App\Models\Contact; 9 use App\Models\Contact;
9 use App\Models\format_area; 10 use App\Models\format_area;
10 use App\Models\House; 11 use App\Models\House;
11 use App\Models\ModelMailFeedback; 12 use App\Models\ModelMailFeedback;
12 use App\Models\News; 13 use App\Models\News;
13 use App\Models\Page; 14 use App\Models\Page;
14 use App\Models\Partners; 15 use App\Models\Partners;
15 use App\Models\type_area; 16 use App\Models\type_area;
16 use Illuminate\Database\Eloquent\Model; 17 use Illuminate\Database\Eloquent\Model;
17 use Illuminate\Http\Request; 18 use Illuminate\Http\Request;
18 use App\Classes\RusDate; 19 use App\Classes\RusDate;
19 use Illuminate\Support\Facades\DB; 20 use Illuminate\Support\Facades\DB;
20 use Illuminate\Support\Facades\Mail; 21 use Illuminate\Support\Facades\Mail;
21 use PhpParser\Node\Stmt\Switch_; 22 use PhpParser\Node\Stmt\Switch_;
22 use Illuminate\Support\Facades\Response; 23 use Illuminate\Support\Facades\Response;
23 use App\Classes\FilterData; 24 use App\Classes\FilterData;
24 25
25 class MainController extends Controller 26 class MainController extends Controller
26 { 27 {
27 /* 28 /*
28 * Главная страница проекта 29 * Главная страница проекта
29 */ 30 */
30 public function index() { 31 public function index() {
31 $houses = House::with('areas')->orderByDesc('created_at')->limit(8)->get(); 32 $houses = House::with('areas')->orderByDesc('created_at')->limit(8)->get();
32 $news = News::query()->orderByDesc('created_at')->limit(8)->get(); 33 $news = News::query()->orderByDesc('created_at')->limit(8)->get();
33 $partners = Partners::query()->limit(18)->get(); 34 $partners = Partners::query()->limit(18)->get();
34 return view('index', compact('houses', 'news', 'partners')); 35 return view('index', compact('houses', 'news', 'partners'));
35 } 36 }
36 37
37 /* 38 /*
38 * Фильтр ajax в каталоге 39 * Фильтр ajax в каталоге
39 */ 40 */
40 public function catalog_ajax_filter(Request $request) { 41 public function catalog_ajax_filter(Request $request) {
41 $Res = Array(); 42 $Res = Array();
42 if (!empty($request->area)) { 43 if (!empty($request->area)) {
43 $area_table = Area::where('id', '=', $request->area)->get(); 44 $area_table = Area::where('id', '=', $request->area)->get();
44 $Res[] = $area_table[0]->name_area; 45 $Res[] = $area_table[0]->name_area;
45 } else { 46 } else {
46 $Res[] = "Все объекты"; 47 $Res[] = "Все объекты";
47 } 48 }
48 49
49 if (!empty($request->type_area)) { 50 if (!empty($request->type_area)) {
50 $type_area_table = type_area::where('id', '=', $request->type_area)->get(); 51 $type_area_table = type_area::where('id', '=', $request->type_area)->get();
51 $Res[] = $type_area_table[0]->name_type; 52 $Res[] = $type_area_table[0]->name_type;
52 } else { 53 } else {
53 $Res[] = "Тип недвижимости"; 54 $Res[] = "Тип недвижимости";
54 } 55 }
55 56
56 if (!empty($request->format_area)) { 57 if (!empty($request->format_area)) {
57 $format_area_table = format_area::where('id', '=', $request->format_area)->get(); 58 $format_area_table = format_area::where('id', '=', $request->format_area)->get();
58 $Res[] = $format_area_table[0]->name_format; 59 $Res[] = $format_area_table[0]->name_format;
59 } else { 60 } else {
60 $Res[] = "Формат недвижимости"; 61 $Res[] = "Формат недвижимости";
61 } 62 }
62 63
63 return json_encode($Res); 64 return json_encode($Res);
64 } 65 }
65 66
66 /* 67 /*
67 * Страница ЖК 68 * Страница ЖК
68 */ 69 */
69 public function Complex(Area $area, Request $request) { 70 public function Complex(Area $area, Request $request) {
70 //////////раздел аренда 71 //////////раздел аренда
71 $house_arenda = House::with('areas')-> 72 $house_arenda = House::with('areas')->
72 where('area_id', '=', $area->id)-> 73 where('area_id', '=', $area->id)->
73 where('format_house', '=', 'Аренда'); 74 where('format_house', '=', 'Аренда');
74 75
75 if ($request->view == 'arenda') { 76 if ($request->view == 'arenda') {
76 switch ($request->sort_price) { 77 $house_arenda = (new SortData($house_arenda, $request))->apply()->get();
77 case 1: $house_arenda = $house_arenda->orderBy('price');break; 78
78 case 2: $house_arenda = $house_arenda->orderByDesc('price');break;
79 }
80 switch ($request->sort_new) {
81 case 1: $house_arenda = $house_arenda->orderByDesc('created_at');break;
82 case 2: $house_arenda = $house_arenda->orderBy('created_at');break;
83 }
84 switch ($request->sort_area) {
85 case 1: $house_arenda = $house_arenda->orderByDesc('area')->get();break;
86 case 2: $house_arenda = $house_arenda->orderBy('area')->get();break;
87 }
88 } else { 79 } else {
89 $house_arenda = $house_arenda->orderBy('price')-> 80 $house_arenda = $house_arenda->orderBy('price')->
90 orderByDesc('created_at')-> 81 orderByDesc('created_at')->
91 orderByDesc('area')->get(); 82 orderByDesc('area')->get();
92 } 83 }
93 84
94 ////////раздел продажа 85 ////////раздел продажа
95 $house_prodaja = House::with('areas')-> 86 $house_prodaja = House::with('areas')->
96 where('area_id', '=', $area->id)-> 87 where('area_id', '=', $area->id)->
97 where('format_house', '=', 'Продажа'); 88 where('format_house', '=', 'Продажа');
98 89
99 if ($request->view == 'prodaja') { 90 if ($request->view == 'prodaja') {
100 switch ($request->sort_price) { 91 $house_prodaja = (new SortData($house_prodaja, $request))->apply()->get();
101 case 1: $house_prodaja = $house_prodaja->orderBy('price');break; 92
102 case 2: $house_prodaja = $house_prodaja->orderByDesc('price');break;
103 }
104 switch ($request->sort_new) {
105 case 1: $house_prodaja = $house_prodaja->orderByDesc('created_at');break;
106 case 2: $house_prodaja = $house_prodaja->orderBy('created_at');break;
107 }
108 switch ($request->sort_area) {
109 case 1: $house_prodaja = $house_prodaja->orderByDesc('area')->get();break;
110 case 2: $house_prodaja = $house_prodaja->orderBy('area')->get();break;
111 }
112 } else { 93 } else {
113 $house_prodaja = $house_prodaja->orderBy('price')-> 94 $house_prodaja = $house_prodaja->orderBy('price')->
114 orderByDesc('created_at')-> 95 orderByDesc('created_at')->
115 orderByDesc('area')->get(); 96 orderByDesc('area')->get();
116 } 97 }
117 98
118 //////////////// Раздел бизнеса 99 //////////////// Раздел бизнеса
119 $house_bissnes = House::with('areas')-> 100 $house_bissnes = House::with('areas')->
120 where('area_id', '=', $area->id)-> 101 where('area_id', '=', $area->id)->
121 where('format_house', '=', 'Бизнес'); 102 where('format_house', '=', 'Бизнес');
122 //orderByDesc('created_at')->get(); 103 //orderByDesc('created_at')->get();
123 104
124 if ($request->view == 'bissnes') { 105 if ($request->view == 'bissnes') {
125 switch ($request->sort_price) { 106 $house_bissnes = (new SortData($house_bissnes, $request))->apply()->get();
126 case 1: $house_bissnes = $house_bissnes->orderBy('price');break; 107
127 case 2: $house_bissnes = $house_bissnes->orderByDesc('price');break;
128 }
129 switch ($request->sort_new) {
130 case 1: $house_bissnes = $house_bissnes->orderByDesc('created_at');break;
131 case 2: $house_bissnes = $house_bissnes->orderBy('created_at');break;
132 }
133 switch ($request->sort_area) {
134 case 1: $house_bissnes = $house_bissnes->orderByDesc('area')->get();break;
135 case 2: $house_bissnes = $house_bissnes->orderBy('area')->get();break;
136 }
137 } else { 108 } else {
138 $house_bissnes = $house_bissnes->orderBy('price')-> 109 $house_bissnes = $house_bissnes->orderBy('price')->
139 orderByDesc('created_at')-> 110 orderByDesc('created_at')->
140 orderByDesc('area')->get(); 111 orderByDesc('area')->get();
141 } 112 }
142 113
143 //////////раздел арендованные 114 //////////раздел арендованные
144 $house_arendovannie = House::with('areas')-> 115 $house_arendovannie = House::with('areas')->
145 where('area_id', '=', $area->id)-> 116 where('area_id', '=', $area->id)->
146 where('format_house', '=', 'Арендованные'); 117 where('format_house', '=', 'Арендованные');
147 //orderByDesc('created_at')->get(); 118 //orderByDesc('created_at')->get();
148 119
149 if ($request->view == 'arendovannie') { 120 if ($request->view == 'arendovannie') {
150 switch ($request->sort_price) { 121 $house_arendovannie = (new SortData($house_arendovannie, $request))->apply()->get();
151 case 1: $house_arendovannie = $house_arendovannie->orderBy('price');break; 122
152 case 2: $house_arendovannie = $house_arendovannie->orderByDesc('price');break;
153 }
154 switch ($request->sort_new) {
155 case 1: $house_arendovannie = $house_arendovannie->orderByDesc('created_at');break;
156 case 2: $house_arendovannie = $house_arendovannie->orderBy('created_at');break;
157 }
158 switch ($request->sort_area) {
159 case 1: $house_arendovannie = $house_arendovannie->orderByDesc('area')->get();break;
160 case 2: $house_arendovannie = $house_arendovannie->orderBy('area')->get();break;
161 }
162 } else { 123 } else {
163 $house_arendovannie = $house_arendovannie->orderBy('price')-> 124 $house_arendovannie = $house_arendovannie->orderBy('price')->
164 orderByDesc('created_at')-> 125 orderByDesc('created_at')->
165 orderByDesc('area')->get(); 126 orderByDesc('area')->get();
166 } 127 }
167 128
168 if ($request->ajax()) { 129 if ($request->ajax()) {
169 switch($request->view) { 130 switch($request->view) {
170 case 'arenda': return view('ajax.complex.arenda', compact('house_arenda')); break; 131 case 'arenda': return view('ajax.complex.arenda', compact('house_arenda')); break;
171 case 'prodaja': return view('ajax.complex.prodaja', compact('house_prodaja'));break; 132 case 'prodaja': return view('ajax.complex.prodaja', compact('house_prodaja'));break;
172 case 'bissnes': return view('ajax.complex.bissnes', compact('house_bissnes')); break; 133 case 'bissnes': return view('ajax.complex.bissnes', compact('house_bissnes')); break;
173 case 'arendovannie': return view('ajax.complex.arendovannie', compact('house_arendovannie')); break; 134 case 'arendovannie': return view('ajax.complex.arendovannie', compact('house_arendovannie')); break;
174 } 135 }
175 } 136 }
176 137
177 return view('complex', compact('area', 138 return view('complex', compact('area',
178 'house_arenda', 139 'house_arenda',
179 'house_prodaja', 140 'house_prodaja',
180 'house_bissnes', 141 'house_bissnes',
181 'house_arendovannie')); 142 'house_arendovannie'));
182 143
183 } 144 }
184 145
185 /* 146 /*
186 * О компании 147 * О компании
187 */ 148 */
188 public function About(): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Contracts\Foundation\Application 149 public function About(): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Contracts\Foundation\Application
189 { 150 {
190 $news = News::query()->orderByDesc('created_at')->limit(8)->get(); 151 $news = News::query()->orderByDesc('created_at')->limit(8)->get();
191 $partners = Partners::query()->limit(18)->get(); 152 $partners = Partners::query()->limit(18)->get();
192 return view('about', compact('news', 'partners')); 153 return view('about', compact('news', 'partners'));
193 } 154 }
194 155
195 /* 156 /*
196 * Форма обратной связи внизу сайта 157 * Форма обратной связи внизу сайта
197 */ 158 */
198 public function main_form(FooterFeedbackRequest $request) { 159 public function main_form(FooterFeedbackRequest $request) {
199 $RentTorg = Contact::query()->limit(1)->get(); 160 $RentTorg = Contact::query()->limit(1)->get();
200 $MailBD = new ModelMailFeedback(); 161 $MailBD = new ModelMailFeedback();
201 $MailBD->to = 'Администрации сайта'; 162 $MailBD->to = 'Администрации сайта';
202 $MailBD->from = $request->TelephoneUser; 163 $MailBD->from = $request->TelephoneUser;
203 $MailBD->subject = "Пользователь <".$request->NameUser.">"; 164 $MailBD->subject = "Пользователь <".$request->NameUser.">";
204 $MailBD->form = 'Форма в футере'; 165 $MailBD->form = 'Форма в футере';
205 $MailBD->text = "От пользователя: ".$request->NameUser.". Заявка на лучшие предложения. Сообщение: ".$request->TextUser; 166 $MailBD->text = "От пользователя: ".$request->NameUser.". Заявка на лучшие предложения. Сообщение: ".$request->TextUser;
206 $MailBD->save(); 167 $MailBD->save();
207 168
208 //return true; 169 //return true;
209 /* 170 /*
210 Mail::send('emails.feedback', ['user' => $user], 171 Mail::send('emails.feedback', ['user' => $user],
211 function ($message) use ($user) { 172 function ($message) use ($user) {
212 $message->from('sender@gmail.com', 'Sender'); 173 $message->from('sender@gmail.com', 'Sender');
213 $message->to($user->email, $user->name)->subject('Test message'); 174 $message->to($user->email, $user->name)->subject('Test message');
214 }); 175 });
215 */ 176 */
216 } 177 }
217 178
218 /* 179 /*
219 * Форма обратной связе в хедере 180 * Форма обратной связе в хедере
220 */ 181 */
221 public function header_form(FooterFeedbackRequest $request) { 182 public function header_form(FooterFeedbackRequest $request) {
222 $RentTorg = Contact::query()->limit(1)->get(); 183 $RentTorg = Contact::query()->limit(1)->get();
223 $MailBD = new ModelMailFeedback(); 184 $MailBD = new ModelMailFeedback();
224 $MailBD->to = 'Администрации сайта'; 185 $MailBD->to = 'Администрации сайта';
225 $MailBD->from = $request->TelephoneUser; 186 $MailBD->from = $request->TelephoneUser;
226 $MailBD->subject = "Пользователь <".$request->NameUser.">"; 187 $MailBD->subject = "Пользователь <".$request->NameUser.">";
227 $MailBD->form = 'Форма в заголовке сайта'; 188 $MailBD->form = 'Форма в заголовке сайта';
228 $MailBD->text = "От пользователя: ".$request->NameUser." Сообщение: Заказываю обратный звонок"; 189 $MailBD->text = "От пользователя: ".$request->NameUser." Сообщение: Заказываю обратный звонок";
229 $MailBD->save(); 190 $MailBD->save();
230 } 191 }
231 192
232 /* 193 /*
233 * Форма записаться на просмотр 194 * Форма записаться на просмотр
234 */ 195 */
235 public function rec_view_form(FooterFeedbackRequest $request) { 196 public function rec_view_form(FooterFeedbackRequest $request) {
236 $RentTorg = Contact::query()->limit(1)->get(); 197 $RentTorg = Contact::query()->limit(1)->get();
237 $MailBD = new ModelMailFeedback(); 198 $MailBD = new ModelMailFeedback();
238 $MailBD->to = 'Администрации сайта'; 199 $MailBD->to = 'Администрации сайта';
239 $MailBD->from = $request->TelephoneUser; 200 $MailBD->from = $request->TelephoneUser;
240 $MailBD->subject = "Пользователь <".$request->NameUser.">"; 201 $MailBD->subject = "Пользователь <".$request->NameUser.">";
241 $MailBD->form = 'Форма записи на просмотр'; 202 $MailBD->form = 'Форма записи на просмотр';
242 $MailBD->text = "От пользователя: ".$request->NameUser." Сообщение: Заказываю просмотр офиса"; 203 $MailBD->text = "От пользователя: ".$request->NameUser." Сообщение: Заказываю просмотр офиса";
243 $MailBD->text .= "Адрес офиса-объекта: ".url()->previous()." "; 204 $MailBD->text .= "Адрес офиса-объекта: ".url()->previous()." ";
244 $MailBD->save(); 205 $MailBD->save();
245 } 206 }
246 207
247 /* 208 /*
248 * Форма обратной связи на странице "Контакты" 209 * Форма обратной связи на странице "Контакты"
249 */ 210 */
250 public function page_contact_form(FooterFeedbackRequest $request) { 211 public function page_contact_form(FooterFeedbackRequest $request) {
251 $RentTorg = Contact::query()->limit(1)->get(); 212 $RentTorg = Contact::query()->limit(1)->get();
252 $MailBD = new ModelMailFeedback(); 213 $MailBD = new ModelMailFeedback();
253 $MailBD->to = 'Администрации сайта'; 214 $MailBD->to = 'Администрации сайта';
254 $MailBD->from = $request->TelephoneUser; 215 $MailBD->from = $request->TelephoneUser;
255 $MailBD->subject = "Пользователь <".$request->NameUser."> Компания <".$request->NameCompany.">"; 216 $MailBD->subject = "Пользователь <".$request->NameUser."> Компания <".$request->NameCompany.">";
256 $MailBD->form = 'Форма на странице "Контакты"'; 217 $MailBD->form = 'Форма на странице "Контакты"';
257 $MailBD->text = "От пользователя: ".$request->NameUser."Телефон: ".$request->TelephoneUser." Почта: <".$request->EmailUser."> Сообщение:".$request->TextUser; 218 $MailBD->text = "От пользователя: ".$request->NameUser."Телефон: ".$request->TelephoneUser." Почта: <".$request->EmailUser."> Сообщение:".$request->TextUser;
258 $MailBD->save(); 219 $MailBD->save();
259 } 220 }
260 /* 221 /*
261 * Форма обратной связи по емайлу 222 * Форма обратной связи по емайлу
262 */ 223 */
263 public function email_form(EmailRequest $request) { 224 public function email_form(EmailRequest $request) {
264 $RentTorg = Contact::query()->limit(1)->get(); 225 $RentTorg = Contact::query()->limit(1)->get();
265 $MailBD = new ModelMailFeedback(); 226 $MailBD = new ModelMailFeedback();
266 $MailBD->to = 'Администрации сайта'; 227 $MailBD->to = 'Администрации сайта';
267 $MailBD->from = $request->EmailUser; 228 $MailBD->from = $request->EmailUser;
268 $MailBD->subject = "Пользователь <".$request->EmailUser.">"; 229 $MailBD->subject = "Пользователь <".$request->EmailUser.">";
269 $MailBD->form = 'Форма обратной связи по Email'; 230 $MailBD->form = 'Форма обратной связи по Email';
270 $MailBD->text = "От почты: ".$request->EmailUser." Сообщение: Отправить на данную почту предложения RentTorg"; 231 $MailBD->text = "От почты: ".$request->EmailUser." Сообщение: Отправить на данную почту предложения RentTorg";
271 $MailBD->save(); 232 $MailBD->save();
272 //dd('Email form'); 233 //dd('Email form');
273 return redirect()->route('index'); 234 return redirect()->route('index');
274 } 235 }
275 236
276 /* 237 /*
277 * Избранное 238 * Избранное
278 */ 239 */
279 public function Favorite(Request $request) { 240 public function Favorite(Request $request) {
280 if (empty($_COOKIE['favorite_house'])) { 241 if (empty($_COOKIE['favorite_house'])) {
281 $Arr = Array(); 242 $Arr = Array();
282 } else { 243 } else {
283 $Arr = json_decode($_COOKIE['favorite_house'], true); 244 $Arr = json_decode($_COOKIE['favorite_house'], true);
284 } 245 }
285 if (!empty($Arr) && is_array($Arr)) { 246 if (!empty($Arr) && is_array($Arr)) {
286 $houses = House::with('areas')->whereIn('id', $Arr); 247 $houses = House::with('areas')->whereIn('id', $Arr);
287 248
288 if (isset($request->sort_price)) { 249 if (isset($request->sort_price)) {
289 switch ($request->sort_price) { 250 $houses = (new SortData($houses, $request))->apply();
290 case 1: $houses = $houses->orderBy('price');break; 251
291 case 2: $houses = $houses->orderByDesc('price');break;
292 }
293 switch ($request->sort_new) {
294 case 1: $houses = $houses->orderByDesc('created_at');break;
295 case 2: $houses = $houses->orderBy('created_at');break;
296 }
297 switch ($request->sort_area) {
298 case 1: $houses = $houses->orderByDesc('area');break;
299 case 2: $houses = $houses->orderBy('area');break;
300 }
301 252
302 } else { 253 } else {
303 $houses = $houses->orderBy('price')-> 254 $houses = $houses->orderBy('price')->
304 orderByDesc('created_at')-> 255 orderByDesc('created_at')->
305 orderByDesc('area'); 256 orderByDesc('area');
306 } 257 }
307 258
308 $houses = $houses->paginate(4); 259 $houses = $houses->paginate(4);
309 260
310 if ($request->ajax()) { 261 if ($request->ajax()) {
311 return view('ajax.complex.favorite', compact('houses')); 262 return view('ajax.complex.favorite', compact('houses'));
312 } 263 }
313 264
314 return view('favorite_data', compact('houses')); 265 return view('favorite_data', compact('houses'));
315 } else { 266 } else {
316 return view('favorite', compact('Arr')); 267 return view('favorite', compact('Arr'));
317 } 268 }
318 269
319 270
320 } 271 }
321 272
322 /* 273 /*
323 * Категории каталога Аренда/Продажа/Бизнес 274 * Категории каталога Аренда/Продажа/Бизнес/Арендованные
324 */ 275 */
325 public function Category($cat, Request $request) { 276 public function Category($cat, Request $request) {
326 switch ($cat) { 277 switch ($cat) {
327 case 'arenda': 278 case 'arenda':
328 $title = "Аренда торговых помещениий"; 279 $title = "Аренда торговых помещениий";
329 $format_house = 'Аренда'; 280 $format_house = 'Аренда';
330 break; 281 break;
331 case 'sale': 282 case 'sale':
332 $title = "Продажа торговых помещений"; 283 $title = "Продажа торговых помещений";
333 $format_house = 'Продажа'; 284 $format_house = 'Продажа';
334 break; 285 break;
335 case 'bussiness': 286 case 'bussiness':
336 $title = "Арендый бизнес"; 287 $title = "Арендый бизнес";
337 $format_house = 'Бизнес'; 288 $format_house = 'Бизнес';
338 break; 289 break;
290 case 'arendovannie':
291 $title = "Арендованные";
292 $format_house = 'Арендованные';
293 break;
339 default: 294 default:
340 $title = "Аренда торговых помещениий"; 295 $title = "Аренда торговых помещениий";
341 $format_house = 'Аренда'; 296 $format_house = 'Аренда';
342 break; 297 break;
343 } 298 }
344 299
345 $houses = House::with('areas')-> 300 $houses = House::with('areas')->
346 where('format_house', '=', $format_house); 301 where('format_house', '=', $format_house);
347 //->appends(request()->query()); 302 //->appends(request()->query());
348 303
349 if (!empty($request->area)) { 304 $houses = (new FilterData($houses, $request))->apply();
350 $houses = $houses->where('area_id', '=', $request->area);
351 }
352 // условия поиска по типу недвижимости
353 if (!empty($request->type_area)) {
354 $houses = $houses->where('type_area_id', '=', $request->type_area);
355 }
356 // условия поиска по формату недвижимости
357 if (!empty($request->format_area)) {
358 $houses = $houses->where('format_area_id', '=', $request->format_area);
359 }
360 // условия поиска по площади - минимальная площадь
361 if (!empty($request->area_m2_min)) {
362 $houses = $houses->where('area', '>', $request->area_m2_min);
363 }
364 // условия поиска по площади - максимальная площадь
365 if (!empty($request->area_m2_max)) {
366 $houses = $houses->where('area', '<', $request->area_m2_max);
367 }
368 // условия поиска по цене - минимальная цена
369 if (!empty($request->price_min)) {
370 $houses = $houses->where('price', '>', $request->price_min);
371 }
372 // условия поиска по цене - максимальная цена
373 if (!empty($request->price_max)) {
374 $houses = $houses->where('price', '<', $request->price_max);
375 }
376 // условия поиска по адресу
377 if (!empty($request->address)) {
378 $houses = $houses->where('address', 'LIKE', "%".$request->address."%");
379 }
380 305
381 if (isset($request->sort_price)) { 306 if (isset($request->sort_price)) {
382 switch ($request->sort_price) { 307 $houses = (new SortData($houses, $request))->apply();
383 case 1: $houses = $houses->orderBy('price');break; 308
384 case 2: $houses = $houses->orderByDesc('price');break;
385 }
386 switch ($request->sort_new) {
387 case 1: $houses = $houses->orderByDesc('created_at');break;
388 case 2: $houses = $houses->orderBy('created_at');break;
389 }
390 switch ($request->sort_area) {
391 case 1: $houses = $houses->orderByDesc('area');break;
392 case 2: $houses = $houses->orderBy('area');break;
393 }
394 309
395 } else { 310 } else {
396 $houses = $houses->orderBy('price')-> 311 $houses = $houses->orderBy('price')->
397 orderByDesc('created_at')-> 312 orderByDesc('created_at')->
398 orderByDesc('area'); 313 orderByDesc('area');
399 } 314 }
400 315
401 $houses = $houses->paginate(4); 316 $houses = $houses->paginate(4);
402 317
403 if ($request->ajax()) { 318 if ($request->ajax()) {
404 return view('ajax.complex.category', compact('houses')); 319 return view('ajax.complex.category', compact('houses'));
405 } 320 }
406 321
407 return view('category_catalog', compact('title', 'cat', 'houses')); 322 return view('category_catalog', compact('title', 'cat', 'houses'));
408 } 323 }
409 324
410 public function Test(Request $request) { 325 public function Test(Request $request) {
411 $house_arenda = House::with('areas')-> 326 $house_arenda = House::with('areas')->
412 where('format_house', '=', 'Аренда'); 327 where('format_house', '=', 'Аренда');
413 328
414 $house_arenda = $house_arenda->orderByDesc('price')-> 329 $house_arenda = $house_arenda->orderByDesc('price')->
415 orderByDesc('created_at')-> 330 orderByDesc('created_at')->
416 orderByDesc('area')->get(); 331 orderByDesc('area')->get();
417 332
418 333
419 return view('ajax.complex.arenda', compact('house_arenda')); 334 return view('ajax.complex.arenda', compact('house_arenda'));
420 335
421 } 336 }
422 337
423 338
424 /* 339 /*
425 * Каталог 340 * Каталог
426 */ 341 */
427 public function Catalog(Request $request) { 342 public function Catalog(Request $request) {
428 343
429 //////////раздел аренда///////////////////////////////////////////////////////////////// 344 //////////раздел аренда/////////////////////////////////////////////////////////////////
430 $house_arenda = House::with('areas')-> 345 $house_arenda = House::with('areas')->
431 where('format_house', '=', 'Аренда'); 346 where('format_house', '=', 'Аренда');
432 // условия поиска по объектам комплексов 347 // условия поиска по объектам комплексов
433 348
434 //$house_arenda = (new FilterData($house_arenda, $request))->apply(); 349 $house_arenda = (new FilterData($house_arenda, $request))->apply();
435
436
437 if (!empty($request->area)) {
438 $house_arenda = $house_arenda->where('area_id', '=', $request->area);
439 }
440 // условия поиска по типу недвижимости
441 if (!empty($request->type_area)) {
442 $house_arenda = $house_arenda->where('type_area_id', '=', $request->type_area);
443 }
444 // условия поиска по формату недвижимости
445 if (!empty($request->format_area)) {
446 $house_arenda = $house_arenda->where('format_area_id', '=', $request->format_area);
447 }
448 // условия поиска по площади - минимальная площадь
449 if (!empty($request->area_m2_min)) {
450 $house_arenda = $house_arenda->where('area', '>', $request->area_m2_min);
451 }
452 // условия поиска по площади - максимальная площадь
453 if (!empty($request->area_m2_max)) {
454 $house_arenda = $house_arenda->where('area', '<', $request->area_m2_max);
455 }
456 // условия поиска по цене - минимальная цена
457 if (!empty($request->price_min)) {
458 $house_arenda = $house_arenda->where('price', '>', $request->price_min);
459 }
460 // условия поиска по цене - максимальная цена
461 if (!empty($request->price_max)) {
462 $house_arenda = $house_arenda->where('price', '<', $request->price_max);
463 }
464 // условия поиска по адресу
465 if (!empty($request->address)) {
466 $house_arenda = $house_arenda->where('address', 'LIKE', "%".$request->address."%");
467 }
468
469 350
470 if ($request->view == 'arenda') { 351 if ($request->view == 'arenda') {
471 switch ($request->sort_price) { 352 $house_arenda = (new SortData($house_arenda, $request))->apply()->get();
472 case 1: $house_arenda = $house_arenda->orderBy('price');break;
473 case 2: $house_arenda = $house_arenda->orderByDesc('price');break;
474 }
475 switch ($request->sort_new) {
476 case 1: $house_arenda = $house_arenda->orderByDesc('created_at');break;
477 case 2: $house_arenda = $house_arenda->orderBy('created_at');break;
478 }
479 switch ($request->sort_area) {
480 case 1: $house_arenda = $house_arenda->orderByDesc('area')->get();break;
481 case 2: $house_arenda = $house_arenda->orderBy('area')->get();break;
482 }
483 } else { 353 } else {
484 $house_arenda = $house_arenda->orderBy('price')-> 354 $house_arenda = $house_arenda->orderBy('price')->
485 orderByDesc('created_at')-> 355 orderByDesc('created_at')->
486 orderByDesc('area')->get(); 356 orderByDesc('area')->get();
487 } 357 }
488 358
489 ////////раздел продажа////////////////////////////////////////////////////////////////// 359 ////////раздел продажа//////////////////////////////////////////////////////////////////
490 $house_prodaja = House::with('areas')-> 360 $house_prodaja = House::with('areas')->
491 where('format_house', '=', 'Продажа'); 361 where('format_house', '=', 'Продажа');
492 362
493 // условия поиска по объектам комплексов 363 $house_prodaja = (new FilterData($house_prodaja, $request))->apply();
494 if (!empty($request->area)) {
495 $house_prodaja = $house_prodaja->where('area_id', '=', $request->area);
496 }
497 // условия поиска по типу недвижимости
498 if (!empty($request->type_area)) {
499 $house_prodaja = $house_prodaja->where('type_area_id', '=', $request->type_area);
500 }
501 // условия поиска по формату недвижимости
502 if (!empty($request->format_area)) {
503 $house_prodaja = $house_prodaja->where('format_area_id', '=', $request->format_area);
504 }
505 // условия поиска по площади - минимальная площадь
506 if (!empty($request->area_m2_min)) {
507 $house_prodaja = $house_prodaja->where('area', '>', $request->area_m2_min);
508 }
509 // условия поиска по площади - максимальная площадь
510 if (!empty($request->area_m2_max)) {
511 $house_prodaja = $house_prodaja->where('area', '<', $request->area_m2_max);
512 }
513 // условия поиска по цене - минимальная цена
514 if (!empty($request->price_min)) {
515 $house_prodaja = $house_prodaja->where('price', '>', $request->price_min);
516 }
517 // условия поиска по цене - максимальная цена
518 if (!empty($request->price_max)) {
519 $house_prodaja = $house_prodaja->where('price', '<', $request->price_max);
520 }
521 // условия поиска по адресу
522 if (!empty($request->address)) {
523 $house_prodaja = $house_prodaja->where('address', 'LIKE', "%".$request->address."%");
524 }
525 364
526 if ($request->view == 'prodaja') { 365 if ($request->view == 'prodaja') {
527 switch ($request->sort_price) { 366 $house_prodaja = (new SortData($house_prodaja, $request))->apply()->get();
528 case 1: $house_prodaja = $house_prodaja->orderBy('price');break; 367
529 case 2: $house_prodaja = $house_prodaja->orderByDesc('price');break;
530 }
531 switch ($request->sort_new) {
532 case 1: $house_prodaja = $house_prodaja->orderByDesc('created_at');break;
533 case 2: $house_prodaja = $house_prodaja->orderBy('created_at');break;
534 }
535 switch ($request->sort_area) {
536 case 1: $house_prodaja = $house_prodaja->orderByDesc('area')->get();break;
537 case 2: $house_prodaja = $house_prodaja->orderBy('area')->get();break;
538 }
539 } else { 368 } else {
540 $house_prodaja = $house_prodaja->orderBy('price')-> 369 $house_prodaja = $house_prodaja->orderBy('price')->
541 orderByDesc('created_at')-> 370 orderByDesc('created_at')->
542 orderByDesc('area')->get(); 371 orderByDesc('area')->get();
543 } 372 }
544 373
545 //////////////// Раздел бизнеса///////////////////////////////////////////////////////// 374 //////////////// Раздел бизнеса/////////////////////////////////////////////////////////
546 $house_bissnes = House::with('areas')-> 375 $house_bissnes = House::with('areas')->
547 where('format_house', '=', 'Бизнес'); 376 where('format_house', '=', 'Бизнес');
548 //orderByDesc('created_at')->get(); 377 //orderByDesc('created_at')->get();
549 378
550 // условия поиска по объектам комплексов 379 $house_bissnes = (new FilterData($house_bissnes, $request))->apply();
551 if (!empty($request->area)) {
552 $house_bissnes = $house_bissnes->where('area_id', '=', $request->area);
553 }
554 // условия поиска по типу недвижимости
555 if (!empty($request->type_area)) {
556 $house_bissnes = $house_bissnes->where('type_area_id', '=', $request->type_area);
557 }
558 // условия поиска по формату недвижимости
559 if (!empty($request->format_area)) {
560 $house_bissnes = $house_bissnes->where('format_area_id', '=', $request->format_area);
561 }
562 // условия поиска по площади - минимальная площадь
563 if (!empty($request->area_m2_min)) {
564 $house_bissnes = $house_bissnes->where('area', '>', $request->area_m2_min);
565 }
566 // условия поиска по площади - максимальная площадь
567 if (!empty($request->area_m2_max)) {
568 $house_bissnes = $house_bissnes->where('area', '<', $request->area_m2_max);
569 }
570 // условия поиска по цене - минимальная цена
571 if (!empty($request->price_min)) {
572 $house_bissnes = $house_bissnes->where('price', '>', $request->price_min);
573 }
574 // условия поиска по цене - максимальная цена
575 if (!empty($request->price_max)) {
576 $house_bissnes = $house_bissnes->where('price', '<', $request->price_max);
577 }
578 // условия поиска по адресу
579 if (!empty($request->address)) {
580 $house_bissnes = $house_bissnes->where('address', 'LIKE', "%".$request->address."%");
581 }
582 380
583 if ($request->view == 'bissnes') { 381 if ($request->view == 'bissnes') {
584 switch ($request->sort_price) { 382 $house_bissnes = (new SortData($house_bissnes, $request))->apply()->get();
585 case 1: $house_bissnes = $house_bissnes->orderBy('price');break; 383
586 case 2: $house_bissnes = $house_bissnes->orderByDesc('price');break;
587 }
588 switch ($request->sort_new) {
589 case 1: $house_bissnes = $house_bissnes->orderByDesc('created_at');break;
590 case 2: $house_bissnes = $house_bissnes->orderBy('created_at');break;
591 }
592 switch ($request->sort_area) {
593 case 1: $house_bissnes = $house_bissnes->orderByDesc('area')->get();break;
594 case 2: $house_bissnes = $house_bissnes->orderBy('area')->get();break;
595 }
596 } else { 384 } else {
597 $house_bissnes = $house_bissnes->orderBy('price')-> 385 $house_bissnes = $house_bissnes->orderBy('price')->
598 orderByDesc('created_at')-> 386 orderByDesc('created_at')->
599 orderByDesc('area')->get(); 387 orderByDesc('area')->get();
600 } 388 }
601 389
602 //////////раздел арендованные////////////////////////////////////////////////////////// 390 //////////раздел арендованные//////////////////////////////////////////////////////////
603 $house_arendovannie = House::with('areas')-> 391 $house_arendovannie = House::with('areas')->
604 where('format_house', '=', 'Арендованные'); 392 where('format_house', '=', 'Арендованные');
605 //orderByDesc('created_at')->get(); 393 //orderByDesc('created_at')->get();
606 394
607 // условия поиска по объектам комплексов 395 $house_arendovannie = (new FilterData($house_arendovannie, $request))->apply();
608 if (!empty($request->area)) {
609 $house_arendovannie = $house_arendovannie->where('area_id', '=', $request->area);
610 }
611 // условия поиска по типу недвижимости
612 if (!empty($request->type_area)) {
613 $house_arendovannie = $house_arendovannie->where('type_area_id', '=', $request->type_area);
614 }
615 // условия поиска по формату недвижимости
616 if (!empty($request->format_area)) {
617 $house_arendovannie = $house_arendovannie->where('format_area_id', '=', $request->format_area);
618 }
619 // условия поиска по площади - минимальная площадь
620 if (!empty($request->area_m2_min)) {
621 $house_arendovannie = $house_arendovannie->where('area', '>', $request->area_m2_min);
622 }
623 // условия поиска по площади - максимальная площадь
624 if (!empty($request->area_m2_max)) {
625 $house_arendovannie = $house_arendovannie->where('area', '<', $request->area_m2_max);
626 }
627 // условия поиска по цене - минимальная цена
628 if (!empty($request->price_min)) {
629 $house_arendovannie = $house_arendovannie->where('price', '>', $request->price_min);
630 }
631 // условия поиска по цене - максимальная цена
632 if (!empty($request->price_max)) {
633 $house_arendovannie = $house_arendovannie->where('price', '<', $request->price_max);
634 }
635 // условия поиска по адресу
636 if (!empty($request->address)) {
637 $house_arendovannie = $house_arendovannie->where('address', 'LIKE', "%".$request->address."%");
638 }
639 396
640 if ($request->view == 'arendovannie') { 397 if ($request->view == 'arendovannie') {
641 switch ($request->sort_price) { 398 $house_arendovannie = (new SortData($house_arendovannie, $request))->apply()->get();
642 case 1: $house_arendovannie = $house_arendovannie->orderBy('price');break; 399
643 case 2: $house_arendovannie = $house_arendovannie->orderByDesc('price');break;
644 }
645 switch ($request->sort_new) {
646 case 1: $house_arendovannie = $house_arendovannie->orderByDesc('created_at');break;
647 case 2: $house_arendovannie = $house_arendovannie->orderBy('created_at');break;
648 }
649 switch ($request->sort_area) {
650 case 1: $house_arendovannie = $house_arendovannie->orderByDesc('area')->get();break;
651 case 2: $house_arendovannie = $house_arendovannie->orderBy('area')->get();break;
652 }
653 } else { 400 } else {
654 $house_arendovannie = $house_arendovannie->orderBy('price')-> 401 $house_arendovannie = $house_arendovannie->orderBy('price')->
655 orderByDesc('created_at')-> 402 orderByDesc('created_at')->
656 orderByDesc('area')->get(); 403 orderByDesc('area')->get();
657 } 404 }
658 405
659 if ($request->ajax()) { 406 if ($request->ajax()) {
660 switch($request->view) { 407 switch($request->view) {
661 case 'arenda': return view('ajax.complex.arenda', compact('house_arenda')); break; 408 case 'arenda': return view('ajax.complex.arenda', compact('house_arenda')); break;
662 case 'prodaja': return view('ajax.complex.prodaja', compact('house_prodaja'));break; 409 case 'prodaja': return view('ajax.complex.prodaja', compact('house_prodaja'));break;
663 case 'bissnes': return view('ajax.complex.bissnes', compact('house_bissnes')); break; 410 case 'bissnes': return view('ajax.complex.bissnes', compact('house_bissnes')); break;
664 case 'arendovannie': return view('ajax.complex.arendovannie', compact('house_arendovannie')); break; 411 case 'arendovannie': return view('ajax.complex.arendovannie', compact('house_arendovannie')); break;
665 } 412 }
666 } 413 }
667 if (session('message') == 'Искать') { 414 if (session('message') == 'Искать') {
668 session()->flash('message', 'Сброс'); 415 session()->flash('message', 'Сброс');
669 } else { 416 } else {
670 session()->flash('message', 'Искать'); 417 session()->flash('message', 'Искать');
671 } 418 }
672 419
673 if (empty($request)) { 420 if (empty($request)) {
674 session()->flash('message', 'Искать'); 421 session()->flash('message', 'Искать');
675 } 422 }
676 423
677 return view('catalog', compact( 424 return view('catalog', compact(
678 'house_arenda', 425 'house_arenda',
679 'house_prodaja', 426 'house_prodaja',
680 'house_bissnes', 427 'house_bissnes',
681 'house_arendovannie' 428 'house_arendovannie'
682 )); 429 ));
683 430
684 431
685 } 432 }
686 433
687 /* 434 /*
688 * Новости 435 * Новости
689 */ 436 */
690 public function News() { 437 public function News() {
691 //$news = News::orderByDesc('created_at')->limit(1)->paginate(); 438 //$news = News::orderByDesc('created_at')->limit(1)->paginate();
692 $news_ = News::query()->orderByDesc('created_at')->paginate(4); 439 $news_ = News::query()->orderByDesc('created_at')->paginate(4);
693 return view('news', compact('news_')); 440 return view('news', compact('news_'));
694 } 441 }
695 442
696 /* 443 /*
697 * Контакты 444 * Контакты
698 */ 445 */
699 public function Contact() { 446 public function Contact() {
700 return view('contact'); 447 return view('contact');
701 } 448 }
702 449
703 /* 450 /*
704 * Карта объектов 451 * Карта объектов
705 */ 452 */
706 public function MapsObj(Request $request) { 453 public function MapsObj(Request $request) {
707 //$houses = House::with('areas'); 454 //$houses = House::with('areas');
708 //$houses = $houses->orderBy('id')->get(); 455 //$houses = $houses->orderBy('id')->get();
709 $input = $request->all(); 456 $input = $request->all();
710 457
711 $houses = House::with('areas'); 458 $houses = House::with('areas');
712 if (empty($input)) { 459 if (empty($input)) {
713 460
714 } else { 461 } else {
715 462 $houses = (new FilterData($houses, $request))->apply();
716 // условия поиска по объектам комплексов
717 if (!empty($request->area)) {
718 $houses = $houses->where('area_id', '=', $request->area);
719 }
720 // условия поиска по типу недвижимости
721 if (!empty($request->type_area)) {
722 $houses = $houses->where('type_area_id', '=', $request->type_area);
723 }
724 // условия поиска по формату недвижимости
725 if (!empty($request->format_area)) {
726 $houses = $houses->where('format_area_id', '=', $request->format_area);
727 }
728 // условия поиска по площади - минимальная площадь
729 if (!empty($request->area_m2_min)) {
730 $houses = $houses->where('area', '>', $request->area_m2_min);
731 }
732 // условия поиска по площади - максимальная площадь
733 if (!empty($request->area_m2_max)) {
734 $houses = $houses->where('area', '<', $request->area_m2_max);
735 }
736 // условия поиска по цене - минимальная цена
737 if (!empty($request->price_min)) {
738 $houses = $houses->where('price', '>', $request->price_min);
739 }
740 // условия поиска по цене - максимальная цена
741 if (!empty($request->price_max)) {
742 $houses = $houses->where('price', '<', $request->price_max);
743 }
744 // условия поиска по адресу
745 if (!empty($request->address)) {
746 $houses = $houses->where('address', 'LIKE', "%".$request->address."%");
747 }
748 } 463 }
749 464
750 $houses = $houses->orderByDesc('id')->get(); 465 $houses = $houses->orderByDesc('id')->get();
751 466
752 $areas = Area::query()->orderBy('id')->get(); 467 $areas = Area::query()->orderBy('id')->get();
753 468
754 return view('mapsobj', compact('areas', 'input', 'houses')); 469 return view('mapsobj', compact('areas', 'input', 'houses'));
755 } 470 }
756 471
757 /* 472 /*
758 * Посмотр конктретного предложение офиса 473 * Посмотр конктретного предложение офиса
759 */ 474 */
760 public function Offer(House $house, Request $request) { 475 public function Offer(House $house, Request $request) {
761 $houses = House::with('areas'); 476 $houses = House::with('areas');
762 $houses = $houses->where('type_area_id', '=', $house->typearea->id); 477 $houses = $houses->where('type_area_id', '=', $house->typearea->id);
763 $houses = $houses->where('format_house', '=', $house->format_house); 478 $houses = $houses->where('format_house', '=', $house->format_house);
764 $houses = $houses->orderByDesc('created_at')->limit(8)->get(); 479 $houses = $houses->orderByDesc('created_at')->limit(8)->get();
765 480
766 //получение адреса страницы 481 //получение адреса страницы
767 $url = $request->url(); 482 $url = $request->url();
768 // получение ip-адреса клиента 483 // получение ip-адреса клиента
769 $ip = RusDate::ip_addr_client(); 484 $ip = RusDate::ip_addr_client();
770 485
771 //получение выборки данных из базы данных по данной странице 486 //получение выборки данных из базы данных по данной странице
772 $page_ = Page::query()->where('url', '=', "$url")-> 487 $page_ = Page::query()->where('url', '=', "$url")->
773 orderBy('created_at')->limit(1)->get(); 488 orderBy('created_at')->limit(1)->get();
774 489
775 //если интервал времени больше суток, то обнуляем счетчик 490 //если интервал времени больше суток, то обнуляем счетчик
776 if ($page_->count()) { 491 if ($page_->count()) {
777 $result = RusDate::interval_day($page_[0]->created_at); 492 $result = RusDate::interval_day($page_[0]->created_at);
778 if ($result) { 493 if ($result) {
779 DB::table('pages')->where('url', '=', "$url")->delete(); 494 DB::table('pages')->where('url', '=', "$url")->delete();
780 } 495 }
781 } 496 }
782 // проверяем если в базе данных данный ip-адрес 497 // проверяем если в базе данных данный ip-адрес
783 $count_user = DB::table('pages')->where('ipaddress', '=', "$ip")-> 498 $count_user = DB::table('pages')->where('ipaddress', '=', "$ip")->
784 where('url', '=', "$url")->get(); 499 where('url', '=', "$url")->get();
785 // если есть, то обновляем дату просмотра 500 // если есть, то обновляем дату просмотра
786 if ($count_user->count() > 0) { 501 if ($count_user->count() > 0) {
787 DB::table('pages')->where('ipaddress', '=', "$ip")-> 502 DB::table('pages')->where('ipaddress', '=', "$ip")->
788 where('url', '=', "$url")->update(['created_at' => date('Y-m-d H:i')]); 503 where('url', '=', "$url")->update(['created_at' => date('Y-m-d H:i')]);
789 } else { 504 } else {
790 // в противном случае добавляем новый ip В бд 505 // в противном случае добавляем новый ip В бд
791 $page = new Page(); 506 $page = new Page();
792 $page->ipaddress = $ip; 507 $page->ipaddress = $ip;
793 $page->url = $url; 508 $page->url = $url;
794 $page->save(); 509 $page->save();
795 } 510 }
796 511
797 // выводим количество пользователей гостей данной страницы 512 // выводим количество пользователей гостей данной страницы
798 $count_user = DB::table('pages')->where('url', '=', "$url")->get(); 513 $count_user = DB::table('pages')->where('url', '=', "$url")->get();
799 return view('house.post', compact('house', 'houses', 'count_user')); 514 return view('house.post', compact('house', 'houses', 'count_user'));
800 } 515 }
801 516
802 /* 517 /*
803 * Просмотр детально конкретной новости 518 * Просмотр детально конкретной новости
804 */ 519 */
805 public function DetailNew(News $news) { 520 public function DetailNew(News $news) {
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 @include('js.filter_value')
9 <script> 9 <script>
10 $(document).on('click', '.js_sort_group_item', function() { 10 $(document).on('click', '.js_sort_group_item', function() {
11 var val = $(this).data('val'); 11 var val = $(this).data('val');
12 var sort_price_val = ''; 12 var sort_price_val = '';
13 var sort_area_val = ''; 13 var sort_area_val = '';
14 var sort_new_val = ''; 14 var sort_new_val = '';
15 15
16 $('.sort-price').each(function() { 16 $('.sort-price').each(function() {
17 var this_ = $(this); 17 var this_ = $(this);
18 var v = $(this).data('val'); 18 var v = $(this).data('val');
19 if (this_.hasClass('active')) 19 if (this_.hasClass('active'))
20 sort_price_val = v; 20 sort_price_val = v;
21 }); 21 });
22 22
23 $('.sort-new').each(function() { 23 $('.sort-new').each(function() {
24 var v = $(this).data('val'); 24 var v = $(this).data('val');
25 var this_ = $(this); 25 var this_ = $(this);
26 if (this_.hasClass('active')) 26 if (this_.hasClass('active'))
27 sort_new_val = v; 27 sort_new_val = v;
28 }); 28 });
29 29
30 $('.sort-area').each(function() { 30 $('.sort-area').each(function() {
31 var v = $(this).data('val'); 31 var v = $(this).data('val');
32 var this_ = $(this); 32 var this_ = $(this);
33 if (this_.hasClass('active')) 33 if (this_.hasClass('active'))
34 sort_area_val = v; 34 sort_area_val = v;
35 35
36 }); 36 });
37 37
38 console.log('-----Загрузка ajax аренда---------'); 38 console.log('-----Загрузка ajax аренда---------');
39 $.ajax({ 39 $.ajax({
40 type: "GET", 40 type: "GET",
41 url: "{{ route('catalog') }}", 41 url: "{{ route('catalog') }}",
42 data: "view=arenda&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+ 42 data: "view=arenda&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+
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'];?>"+ 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'];?>"+
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'];?>"+ 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'];?>"+
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'];?>", 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'];?>",
46 success: function(data) { 46 success: function(data) {
47 console.log('Успешно обновлены данные АРЕНДА таблиц '); 47 console.log('Успешно обновлены данные АРЕНДА таблиц ');
48 $('#arenda_block').html(data); 48 $('#arenda_block').html(data);
49 }, 49 },
50 headers: { 50 headers: {
51 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 51 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
52 }, 52 },
53 error: function(data) { 53 error: function(data) {
54 console.log('Error: '+ data); 54 console.log('Error: '+ data);
55 } 55 }
56 }); 56 });
57 57
58 console.log('---ajax продажи---'); 58 console.log('---ajax продажи---');
59 $.ajax({ 59 $.ajax({
60 type: "GET", 60 type: "GET",
61 url: "{{ route('catalog') }}", 61 url: "{{ route('catalog') }}",
62 data: "view=prodaja&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+ 62 data: "view=prodaja&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+
63 "&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'];?>"+ 63 "&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'];?>"+
64 "&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'];?>"+ 64 "&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'];?>"+
65 "&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'];?>", 65 "&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'];?>",
66 success: function(data) { 66 success: function(data) {
67 console.log('Успешно обновлены данные ПРОДАЖА таблиц '); 67 console.log('Успешно обновлены данные ПРОДАЖА таблиц ');
68 $('#prodaja_block').html(data); 68 $('#prodaja_block').html(data);
69 }, 69 },
70 headers: { 70 headers: {
71 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 71 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
72 }, 72 },
73 error: function(data) { 73 error: function(data) {
74 console.log('Error: '+ data); 74 console.log('Error: '+ data);
75 } 75 }
76 }); 76 });
77 77
78 console.log('---ajax бизнес---'); 78 console.log('---ajax бизнес---');
79 $.ajax({ 79 $.ajax({
80 type: "GET", 80 type: "GET",
81 url: "{{ route('catalog') }}", 81 url: "{{ route('catalog') }}",
82 data: "view=bissnes&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+ 82 data: "view=bissnes&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+
83 "&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'];?>"+ 83 "&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'];?>"+
84 "&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'];?>"+ 84 "&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'];?>"+
85 "&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'];?>", 85 "&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'];?>",
86 success: function(data) { 86 success: function(data) {
87 console.log('Успешно обновлены данные БИЗНЕС таблиц '); 87 console.log('Успешно обновлены данные БИЗНЕС таблиц ');
88 $('#bissnes_block').html(data); 88 $('#bissnes_block').html(data);
89 }, 89 },
90 headers: { 90 headers: {
91 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 91 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
92 }, 92 },
93 error: function(data) { 93 error: function(data) {
94 console.log('Error: '+ data); 94 console.log('Error: '+ data);
95 } 95 }
96 }); 96 });
97 97
98 console.log('---ajax арендованные---'); 98 console.log('---ajax арендованные---');
99 $.ajax({ 99 $.ajax({
100 type: "GET", 100 type: "GET",
101 url: "{{ route('catalog') }}", 101 url: "{{ route('catalog') }}",
102 data: "view=arendovannie&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+ 102 data: "view=arendovannie&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+
103 "&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'];?>"+ 103 "&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'];?>"+
104 "&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'];?>"+ 104 "&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'];?>"+
105 "&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'];?>", 105 "&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'];?>",
106 success: function(data) { 106 success: function(data) {
107 console.log('Успешно обновлены данные таблиц АРЕНДОВАННЫЕ '); 107 console.log('Успешно обновлены данные таблиц АРЕНДОВАННЫЕ ');
108 $('#arendovannie_block').html(data); 108 $('#arendovannie_block').html(data);
109 //.append(data); 109 //.append(data);
110 }, 110 },
111 headers: { 111 headers: {
112 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 112 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
113 }, 113 },
114 error: function(data) { 114 error: function(data) {
115 console.log('Error: '+ data); 115 console.log('Error: '+ data);
116 } 116 }
117 }); 117 });
118 118
119 } 119 }
120 ); 120 );
121 </script> 121 </script>
122 @endsection 122 @endsection
123 123
124 @section('content') 124 @section('content')
125 <section class="catalog"> 125 <section class="catalog">
126 <div class="container"> 126 <div class="container">
127 <div class="catalog__top top-catalog"> 127 <div class="catalog__top top-catalog">
128 <div class="top-catalog__inner"> 128 <div class="top-catalog__inner">
129 <h2 class="top-catalog__title title">Каталог коммерческой недвижимости</h2> 129 <h2 class="top-catalog__title title">Каталог коммерческой недвижимости</h2>
130 <div class="top-catalog__result">Найдено объектов по Вашему запросу: <span><?=$house_arenda->count()+$house_prodaja->count()+$house_bissnes->count()+$house_arendovannie->count(); ?></span></div> 130 <div class="top-catalog__result">Найдено объектов по Вашему запросу: <span><?=$house_arenda->count()+$house_prodaja->count()+$house_bissnes->count()+$house_arendovannie->count(); ?></span></div>
131 </div> 131 </div>
132 <form class="top-catalog__sorts"> 132 <form class="top-catalog__sorts">
133 <div class="top-catalog__sort-group sort-group js_sort_group"> 133 <div class="top-catalog__sort-group sort-group js_sort_group">
134 <input class="js_sort_group_input" type="hidden"> 134 <input class="js_sort_group_input" type="hidden">
135 <div class="sort-group__current js_sort_group_current">Сначала дешевле</div> 135 <div class="sort-group__current js_sort_group_current">Сначала дешевле</div>
136 <ul class="sort-group__list js_sort_group_list"> 136 <ul class="sort-group__list js_sort_group_list">
137 <li class="sort-price sort-group__item js_sort_group_item active" data-val="1">Сначала дешевле</li> 137 <li class="sort-price sort-group__item js_sort_group_item active" data-val="1">Сначала дешевле</li>
138 <li class="sort-price sort-group__item js_sort_group_item" data-val="2">Сначала дороже</li> 138 <li class="sort-price sort-group__item js_sort_group_item" data-val="2">Сначала дороже</li>
139 </ul> 139 </ul>
140 </div> 140 </div>
141 <div class="top-catalog__sort-group sort-group js_sort_group"> 141 <div class="top-catalog__sort-group sort-group js_sort_group">
142 <input class="js_sort_group_input" type="hidden"> 142 <input class="js_sort_group_input" type="hidden">
143 <div class="sort-group__current js_sort_group_current">Сначала новые</div> 143 <div class="sort-group__current js_sort_group_current">Сначала новые</div>
144 <ul class="sort-group__list js_sort_group_list"> 144 <ul class="sort-group__list js_sort_group_list">
145 <li class="sort-new sort-group__item js_sort_group_item active" data-val="1">Сначала новые</li> 145 <li class="sort-new sort-group__item js_sort_group_item active" data-val="1">Сначала новые</li>
146 <li class="sort-new sort-group__item js_sort_group_item" data-val="2">Сначала старые</li> 146 <li class="sort-new sort-group__item js_sort_group_item" data-val="2">Сначала старые</li>
147 </ul> 147 </ul>
148 </div> 148 </div>
149 <div class="top-catalog__sort-group sort-group sort-group--wide js_sort_group"> 149 <div class="top-catalog__sort-group sort-group sort-group--wide js_sort_group">
150 <input class="js_sort_group_input" type="hidden"> 150 <input class="js_sort_group_input" type="hidden">
151 <div class="sort-group__current js_sort_group_current">Сначала с большей площадью</div> 151 <div class="sort-group__current js_sort_group_current">Сначала с большей площадью</div>
152 <ul class="sort-group__list js_sort_group_list"> 152 <ul class="sort-group__list js_sort_group_list">
153 <li class="sort-area sort-group__item js_sort_group_item active" data-val="1">Сначала с большей площадью</li> 153 <li class="sort-area sort-group__item js_sort_group_item active" data-val="1">Сначала с большей площадью</li>
154 <li class="sort-area sort-group__item js_sort_group_item" data-val="2">Сначала с меньшей площадью</li> 154 <li class="sort-area sort-group__item js_sort_group_item" data-val="2">Сначала с меньшей площадью</li>
155 </ul> 155 </ul>
156 </div> 156 </div>
157 </form> 157 </form>
158 </div> 158 </div>
159 </div> 159 </div>
160 <div class="complex__sliders"> 160 <div class="complex__sliders">
161 <section class="slider"> 161 <section class="slider">
162 <div class="container"> 162 <div class="container">
163 <div class="slider__wrap"> 163 <div class="slider__wrap">
164 <div class="slider__top"> 164 <div class="slider__top">
165 <h2 class="slider__title title">Аренда торговых помещений</h2><a class="slider__more" href="#">Показать все объекты</a> 165 <h2 class="slider__title title">Аренда торговых помещений</h2><a class="slider__more" href="{{ route('category', ['cat'=>'arenda']) }}">Показать все объекты</a>
166 <div class="slider__control"> 166 <div class="slider__control">
167 <div class="swiper-button-prev"> 167 <div class="swiper-button-prev">
168 <svg width="10" height="17"> 168 <svg width="10" height="17">
169 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use> 169 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
170 </svg> 170 </svg>
171 </div> 171 </div>
172 <div class="swiper-button-next"> 172 <div class="swiper-button-next">
173 <svg width="10" height="17"> 173 <svg width="10" height="17">
174 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use> 174 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
175 </svg> 175 </svg>
176 </div> 176 </div>
177 </div> 177 </div>
178 </div> 178 </div>
179 <div class="slider__swiper swiper"> 179 <div class="slider__swiper swiper">
180 <div class="swiper-wrapper" id="arenda_block"> 180 <div class="swiper-wrapper" id="arenda_block">
181 @if ($house_arenda->count()) 181 @if ($house_arenda->count())
182 @foreach ($house_arenda as $house1) 182 @foreach ($house_arenda as $house1)
183 @include('catalogs.elemhouse', ['house' => $house1]) 183 @include('catalogs.elemhouse', ['house' => $house1])
184 @endforeach 184 @endforeach
185 @else 185 @else
186 <h3>Здесь пока что нет предложений</h3> 186 <h3>Здесь пока что нет предложений</h3>
187 @endif 187 @endif
188 188
189 </div> 189 </div>
190 </div> 190 </div>
191 <div class="swiper-pagination"></div> 191 <div class="swiper-pagination"></div>
192 </div> 192 </div>
193 </div> 193 </div>
194 </section> 194 </section>
195 <section class="slider"> 195 <section class="slider">
196 <div class="container"> 196 <div class="container">
197 <div class="slider__wrap"> 197 <div class="slider__wrap">
198 <div class="slider__top"> 198 <div class="slider__top">
199 <h2 class="slider__title title">Продажа торговых помещений</h2><a class="slider__more" href="#">Показать все объекты</a> 199 <h2 class="slider__title title">Продажа торговых помещений</h2><a class="slider__more" href="{{ route('category', ['cat'=>'sale']) }}">Показать все объекты</a>
200 <div class="slider__control"> 200 <div class="slider__control">
201 <div class="swiper-button-prev"> 201 <div class="swiper-button-prev">
202 <svg width="10" height="17"> 202 <svg width="10" height="17">
203 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use> 203 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
204 </svg> 204 </svg>
205 </div> 205 </div>
206 <div class="swiper-button-next"> 206 <div class="swiper-button-next">
207 <svg width="10" height="17"> 207 <svg width="10" height="17">
208 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use> 208 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
209 </svg> 209 </svg>
210 </div> 210 </div>
211 </div> 211 </div>
212 </div> 212 </div>
213 <div class="slider__swiper swiper"> 213 <div class="slider__swiper swiper">
214 <div class="swiper-wrapper" id="prodaja_block"> 214 <div class="swiper-wrapper" id="prodaja_block">
215 @if ($house_prodaja->count()) 215 @if ($house_prodaja->count())
216 @foreach ($house_prodaja as $house2) 216 @foreach ($house_prodaja as $house2)
217 @include('catalogs.elemhouse', ['house' => $house2]) 217 @include('catalogs.elemhouse', ['house' => $house2])
218 @endforeach 218 @endforeach
219 @else 219 @else
220 <h3>Здесь пока что нет предложений</h3> 220 <h3>Здесь пока что нет предложений</h3>
221 @endif 221 @endif
222 </div> 222 </div>
223 </div> 223 </div>
224 <div class="swiper-pagination"></div> 224 <div class="swiper-pagination"></div>
225 </div> 225 </div>
226 </div> 226 </div>
227 </section> 227 </section>
228 <section class="slider"> 228 <section class="slider">
229 <div class="container"> 229 <div class="container">
230 <div class="slider__wrap"> 230 <div class="slider__wrap">
231 <div class="slider__top"> 231 <div class="slider__top">
232 <h2 class="slider__title title">Арендный бизнес</h2><a class="slider__more" href="#">Показать все объекты</a> 232 <h2 class="slider__title title">Арендный бизнес</h2><a class="slider__more" href="{{ route('category', ['cat'=>'bussiness']) }}">Показать все объекты</a>
233 <div class="slider__control"> 233 <div class="slider__control">
234 <div class="swiper-button-prev"> 234 <div class="swiper-button-prev">
235 <svg width="10" height="17"> 235 <svg width="10" height="17">
236 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use> 236 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
237 </svg> 237 </svg>
238 </div> 238 </div>
239 <div class="swiper-button-next"> 239 <div class="swiper-button-next">
240 <svg width="10" height="17"> 240 <svg width="10" height="17">
241 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use> 241 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
242 </svg> 242 </svg>
243 </div> 243 </div>
244 </div> 244 </div>
245 </div> 245 </div>
246 <div class="slider__swiper swiper"> 246 <div class="slider__swiper swiper">
247 <div class="swiper-wrapper" id="bissnes_block"> 247 <div class="swiper-wrapper" id="bissnes_block">
248 @if ($house_bissnes->count()) 248 @if ($house_bissnes->count())
249 @foreach ($house_bissnes as $house3) 249 @foreach ($house_bissnes as $house3)
250 @include('catalogs.elemhouse', ['house' => $house3]) 250 @include('catalogs.elemhouse', ['house' => $house3])
251 @endforeach 251 @endforeach
252 @else 252 @else
253 <h3>Здесь пока что нет предложений</h3> 253 <h3>Здесь пока что нет предложений</h3>
254 @endif 254 @endif
255 </div> 255 </div>
256 </div> 256 </div>
257 <div class="swiper-pagination"></div> 257 <div class="swiper-pagination"></div>
258 </div> 258 </div>
259 </div> 259 </div>
260 </section> 260 </section>
261 <section class="slider"> 261 <section class="slider">
262 <div class="container"> 262 <div class="container">
263 <div class="slider__wrap"> 263 <div class="slider__wrap">
264 <div class="slider__top"> 264 <div class="slider__top">
265 <h2 class="slider__title title">Арендованные</h2><a class="slider__more" href="#">Показать все объекты</a> 265 <h2 class="slider__title title">Арендованные</h2><a class="slider__more" href="{{ route('category', ['cat'=>'arendovannie']) }}">Показать все объекты</a>
266 <div class="slider__control"> 266 <div class="slider__control">
267 <div class="swiper-button-prev"> 267 <div class="swiper-button-prev">
268 <svg width="10" height="17"> 268 <svg width="10" height="17">
269 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use> 269 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
270 </svg> 270 </svg>
271 </div> 271 </div>
272 <div class="swiper-button-next"> 272 <div class="swiper-button-next">
273 <svg width="10" height="17"> 273 <svg width="10" height="17">
274 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use> 274 <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
275 </svg> 275 </svg>
276 </div> 276 </div>
277 </div> 277 </div>
278 </div> 278 </div>
279 <div class="slider__swiper swiper"> 279 <div class="slider__swiper swiper">
280 <div class="swiper-wrapper" id="arendovannie_block"> 280 <div class="swiper-wrapper" id="arendovannie_block">
281 @if ($house_arendovannie->count()) 281 @if ($house_arendovannie->count())
282 @foreach ($house_arendovannie as $house1) 282 @foreach ($house_arendovannie as $house1)
283 @include('catalogs.elemhouse', ['house' => $house1]) 283 @include('catalogs.elemhouse', ['house' => $house1])
284 @endforeach 284 @endforeach
285 @else 285 @else
286 <h3>Здесь пока что нет предложений</h3> 286 <h3>Здесь пока что нет предложений</h3>
287 @endif 287 @endif
288 288
289 </div> 289 </div>
290 </div> 290 </div>
291 <div class="swiper-pagination"></div> 291 <div class="swiper-pagination"></div>
292 </div> 292 </div>
293 </div> 293 </div>
294 </section> 294 </section>
295 </div> 295 </div>
296 </section> 296 </section>
297 @endsection 297 @endsection
298 298
299 @section('form_feedback') 299 @section('form_feedback')
300 <!-- Форма обратной связи --> 300 <!-- Форма обратной связи -->
301 @include('form.form_feedback') 301 @include('form.form_feedback')
302 @endsection 302 @endsection
303 303
304 304
resources/views/js/cookies_favorite.blade.php
1 <script> 1 <script>
2 $(document).ready(function() { 2 $(document).ready(function() {
3 $(document).on('click', '.js_card_favorites', function () { 3 $(document).on('click', '.js_card_favorites', function () {
4 var _this = $(this); 4 var _this = $(this);
5 var id_house = _this.attr('data-val'); 5 var id_house = _this.attr('data-val');
6 6
7 if (_this.hasClass('active')) { 7 if (_this.hasClass('active')) {
8 add_in_array(id_house); 8 add_in_array(id_house);
9 console.log('Добавлено в избранное id=' + id_house); 9 console.log('Добавлено в избранное id=' + id_house);
10 } else { 10 } else {
11 delete_in_array(id_house); 11 delete_in_array(id_house);
12 console.log('Удалено из избранных id='+id_house) 12 console.log('Удалено из избранных id='+id_house)
13 } 13 }
14 14
15 var str = $.cookie('favorite_house'); 15 var str = $.cookie('favorite_house');
16 console.log("Вывод куков "+str); 16 console.log("Вывод куков "+str);
17 17
18 }); 18 });
19 }); 19 });
20 20
21 //помеченный элемент 21 //помеченный элемент
22 function selected_item(obj) { 22 function selected_item(obj) {
23 var arr = read_array(); 23 var arr = read_array();
24 var index = arr.indexOf(obj); 24 var index = arr.indexOf(obj);
25 25
26 if (index > 0) 26 if (index > 0)
27 return "active"; 27 return "active";
28 else 28 else
29 return ""; 29 return "";
30 } 30 }
31 31
32 // запись элемента массива в cookie 32 // запись элемента массива в cookie
33 function add_in_array(obj){ 33 function add_in_array(obj){
34 var arr = read_array();//получаем текущее состояние массива 34 var arr = read_array();//получаем текущее состояние массива
35 arr[arr.length]=obj; //добавляем элемент в конец 35 arr[arr.length]=obj; //добавляем элемент в конец
36 //var str = JSON.stringify(arr);//конвертируем в строку 36 //var str = JSON.stringify(arr);//конвертируем в строку
37 //$.cookie('arr',str);//записываем массив в куки 37 //$.cookie('arr',str);//записываем массив в куки
38 $.cookie('favorite_house', JSON.stringify(arr)); 38 $.cookie('favorite_house', JSON.stringify(arr));
39 } 39 }
40 40
41 // удаление элемента из массива в cookie 41 // удаление элемента из массива в cookie
42 function delete_in_array(obj) { 42 function delete_in_array(obj) {
43 var arr = read_array(); 43 var arr = read_array();
44 var index = arr.indexOf(obj); 44 var unique = [...new Set(arr)]
45 arr.splice(index, 1); 45 var index = unique.indexOf(obj);
46
47 unique.splice(index, 1);
48
46 //var str = JSON.stringify(arr);//конвертируем в строку 49 //var str = JSON.stringify(arr);//конвертируем в строку
47 //$.cookie('arr',str);//записываем массив в куки 50 //$.cookie('arr',str);//записываем массив в куки
48 $.cookie('favorite_house', JSON.stringify(arr)); 51 $.cookie('favorite_house', JSON.stringify(unique));
49 } 52 }
50 53
51 function read_array(){ 54 function read_array(){
52 var dataArr=$.cookie('favorite_house');//считываем данные из куков 55 var dataArr=$.cookie('favorite_house');//считываем данные из куков
53 //если массив не был обнаружен, иницилизируем его 56 //если массив не был обнаружен, иницилизируем его
54 if(dataArr===null){ 57 if(dataArr===null){
55 dataArr = init_array(); //возвращаем инициализированный пустой маасив 58 dataArr = init_array(); //возвращаем инициализированный пустой маасив
56 } 59 }
57 //возвращаем полученный массив 60 //возвращаем полученный массив
58 //return JSON.parse(dataArr); 61 //return JSON.parse(dataArr);
59 return JSON.parse(dataArr); 62 return JSON.parse(dataArr);
60 } 63 }
61 64
62 //другими словами создаем пустой массив 65 //другими словами создаем пустой массив
63 function init_array(){ 66 function init_array(){
64 //var str = JSON.stringify(new Array());//конвертируем в строку 67 //var str = JSON.stringify(new Array());//конвертируем в строку
65 var str = JSON.stringify(new Array()); 68 var str = JSON.stringify(new Array());
66 $.cookie('favorite_house',str);//записываем массив в куки 69 $.cookie('favorite_house',str);//записываем массив в куки
67 return str; 70 return str;
68 } 71 }
69 </script> 72 </script>
70 73
resources/views/part/filter/category.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({{ asset('images/category-bg.jpg') }})"></div> 3 <div class="hero__bg" style="background-image:url({{ asset('images/category-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"><a class="breadcrumbs__link" href="{{ route('catalog') }}">Каталог</a></li> 9 <li class="breadcrumbs__item"><a class="breadcrumbs__link" href="{{ route('catalog') }}">Каталог</a></li>
10 <li class="breadcrumbs__item"><span class="breadcrumbs__link">{{ $title }}</span></li> 10 <li class="breadcrumbs__item"><span class="breadcrumbs__link">{{ $title }}</span></li>
11 </ul> 11 </ul>
12 </div> 12 </div>
13 <div class="hero__cnt"> 13 <div class="hero__cnt">
14 <h1 class="hero__title title-main">{{ $title }}</h1> 14 <h1 class="hero__title title-main">{{ $title }}</h1>
15 <p class="hero__descr">В Москве, Новой Москве и Подмосковье</p> 15 <p class="hero__descr">В Москве, Новой Москве и Подмосковье</p>
16 </div> 16 </div>
17 <div class="hero__bottom"> 17 <div class="hero__bottom">
18 <div class="hero__links"> 18 <div class="hero__links">
19 <a class="hero__link {{ (url()->current() == route('category', ['cat'=>'arenda']))? 'active' : null }}" href="{{ route('category', ['cat'=>'arenda']) }}">Аренда торговых помещениий</a> 19 <a class="hero__link {{ (url()->current() == route('category', ['cat'=>'arenda']))? 'active' : null }}" href="{{ route('category', ['cat'=>'arenda']) }}">Аренда торговых помещениий</a>
20 <a class="hero__link {{ (url()->current() == route('category', ['cat'=>'sale']))? 'active' : null }}" href="{{ route('category', ['cat'=>'sale']) }}">Продажа торговых помещений</a> 20 <a class="hero__link {{ (url()->current() == route('category', ['cat'=>'sale']))? 'active' : null }}" href="{{ route('category', ['cat'=>'sale']) }}">Продажа торговых помещений</a>
21 <a class="hero__link {{ (url()->current() == route('category', ['cat'=>'bussiness']))? 'active' : null }}" href="{{ route('category', ['cat'=>'bussiness']) }}">Арендый бизнес</a></div> 21 <a class="hero__link {{ (url()->current() == route('category', ['cat'=>'bussiness']))? 'active' : null }}" href="{{ route('category', ['cat'=>'bussiness']) }}">Арендый бизнес</a></div>
22 </div> 22 </div>
23 <form class="hero-search" action="<?//=url()->current()?>" method="GET"> 23 <form class="hero-search" action="<?//=url()->current()?>" method="GET">
24 <div class="hero-search__control"> 24 <div class="hero-search__control">
25 <div class="hero-filter hero-filter--modified1 js_hero_filter"> 25 <div class="hero-filter hero-filter--modified1 js_hero_filter">
26 <input class="js_hero_filter_input" id="area" name="area" type="hidden"> 26 <input class="js_hero_filter_input" id="area" name="area" type="hidden">
27 <div class="hero-filter__current js_hero_filter_current" id="area_name" name="area_name">Все объекты</div> 27 <div class="hero-filter__current js_hero_filter_current" id="area_name" name="area_name">Все объекты</div>
28 <div class="hero-filter__dropdown js_hero_filter_dropdown"> 28 <div class="hero-filter__dropdown js_hero_filter_dropdown">
29 <ul class="hero-filter__list"> 29 <ul class="hero-filter__list">
30 <li class="hero-filter__item" data-val="0">Все объекты</li> 30 <li class="hero-filter__item" data-val="0">Все объекты</li>
31 @if ($items_area->count()) 31 @if ($items_area->count())
32 @foreach($items_area as $item_area) 32 @foreach($items_area as $item_area)
33 <li class="hero-filter__item" data-val="{{ $item_area->id }}">{{ $item_area->name_area }}</li> 33 <li class="hero-filter__item" data-val="{{ $item_area->id }}">{{ $item_area->name_area }}</li>
34 @endforeach 34 @endforeach
35 @endif 35 @endif
36 </ul> 36 </ul>
37 </div> 37 </div>
38 </div> 38 </div>
39 <div class="hero-filter hero-filter--modified2 js_hero_filter"> 39 <div class="hero-filter hero-filter--modified2 js_hero_filter">
40 <input class="js_hero_filter_input" id="type_area" name="type_area" type="hidden"> 40 <input class="js_hero_filter_input" id="type_area" name="type_area" type="hidden">
41 <div class="hero-filter__current js_hero_filter_current" id="type_area_name" name="type_area_name">Тип недвижимости</div> 41 <div class="hero-filter__current js_hero_filter_current" id="type_area_name" name="type_area_name">Тип недвижимости</div>
42 <div class="hero-filter__dropdown js_hero_filter_dropdown"> 42 <div class="hero-filter__dropdown js_hero_filter_dropdown">
43 <ul class="hero-filter__list"> 43 <ul class="hero-filter__list">
44 <li class="hero-filter__item" data-val="0">Выбрать все</li> 44 <li class="hero-filter__item" data-val="0">Выбрать все</li>
45 @if ($items_type_area->count()) 45 @if ($items_type_area->count())
46 @foreach($items_type_area as $item_type_area) 46 @foreach($items_type_area as $item_type_area)
47 <li class="hero-filter__item" data-val="{{ $item_type_area->id }}">{{ $item_type_area->name_type }}</li> 47 <li class="hero-filter__item" data-val="{{ $item_type_area->id }}">{{ $item_type_area->name_type }}</li>
48 @endforeach 48 @endforeach
49 @endif 49 @endif
50 </ul> 50 </ul>
51 </div> 51 </div>
52 </div> 52 </div>
53 <div class="hero-filter hero-filter--modified3 js_hero_filter"> 53 <div class="hero-filter hero-filter--modified3 js_hero_filter">
54 <input class="js_hero_filter_input" id="format_area" name="format_area" type="hidden"> 54 <input class="js_hero_filter_input" id="format_area" name="format_area" type="hidden">
55 <div class="hero-filter__current js_hero_filter_current" id="format_area_name" name="format_area_name">Формат недвижимости</div> 55 <div class="hero-filter__current js_hero_filter_current" id="format_area_name" name="format_area_name">Формат недвижимости</div>
56 <div class="hero-filter__dropdown js_hero_filter_dropdown"> 56 <div class="hero-filter__dropdown js_hero_filter_dropdown">
57 <ul class="hero-filter__list"> 57 <ul class="hero-filter__list">
58 <li class="hero-filter__item" data-val="0">Выбрать все</li> 58 <li class="hero-filter__item" data-val="0">Выбрать все</li>
59 @if ($items_format_area->count()) 59 @if ($items_format_area->count())
60 @foreach($items_format_area as $item_format_area) 60 @foreach($items_format_area as $item_format_area)
61 <li class="hero-filter__item" data-val="{{ $item_format_area->id }}">{{ $item_format_area->name_format }}</li> 61 <li class="hero-filter__item" data-val="{{ $item_format_area->id }}">{{ $item_format_area->name_format }}</li>
62 @endforeach 62 @endforeach
63 @endif 63 @endif
64 </ul> 64 </ul>
65 </div> 65 </div>
66 </div> 66 </div>
67 <div class="hero-filter hero-filter--modified4 js_hero_filter"> 67 <div class="hero-filter hero-filter--modified4 js_hero_filter">
68 <div class="hero-filter__current js_hero_filter_current">Площадь, м<sup>2</sup></div> 68 <div class="hero-filter__current js_hero_filter_current">Площадь, м<sup>2</sup></div>
69 <div class="hero-filter__dropdown js_hero_filter_dropdown"> 69 <div class="hero-filter__dropdown js_hero_filter_dropdown">
70 <div class="hero-filter__fields"> 70 <div class="hero-filter__fields">
71 <label class="hero-filter__field"><span>От</span> 71 <label class="hero-filter__field"><span>От</span>
72 <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']); }?>"> 72 <input class="js_hero_filter_field js_hero_filter_from" id="area_m2_min" name="area_m2_min" type="text" placeholder="3" value="<?if (isset($_GET['area_m2_min'])) { echo($_GET['area_m2_min']); }?>">
73 </label> 73 </label>
74 <label class="hero-filter__field"><span>До</span> 74 <label class="hero-filter__field"><span>До</span>
75 <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']);}?>"> 75 <input class="js_hero_filter_field js_hero_filter_to" id="area_m2_max" name="area_m2_max" type="text" placeholder="125 000" value="<?if (isset($_GET['area_m2_max'])) { echo($_GET['area_m2_max']);}?>">
76 </label> 76 </label>
77 </div> 77 </div>
78 <button class="hero-filter__reset js_hero_filter_reset" type="button">Очистить</button> 78 <button class="hero-filter__reset js_hero_filter_reset" type="button">Очистить</button>
79 </div> 79 </div>
80 </div> 80 </div>
81 <div class="hero-filter hero-filter--modified5 js_hero_filter"> 81 <div class="hero-filter hero-filter--modified5 js_hero_filter">
82 <div class="hero-filter__current js_hero_filter_current">Стоимость, ₽</div> 82 <div class="hero-filter__current js_hero_filter_current">Стоимость, ₽</div>
83 <div class="hero-filter__dropdown js_hero_filter_dropdown"> 83 <div class="hero-filter__dropdown js_hero_filter_dropdown">
84 <div class="hero-filter__fields"> 84 <div class="hero-filter__fields">
85 <label class="hero-filter__field"><span>От</span> 85 <label class="hero-filter__field"><span>От</span>
86 <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']); } ?>"> 86 <input class="js_hero_filter_field js_hero_filter_from" id="price_min" name="price_min" type="text" placeholder="50" value="<?if (isset($_GET['price_min'])) { echo ($_GET['price_min']); } ?>">
87 </label> 87 </label>
88 <label class="hero-filter__field"><span>До</span> 88 <label class="hero-filter__field"><span>До</span>
89 <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']); }?>"> 89 <input class="js_hero_filter_field js_hero_filter_to" id="price_max" name="price_max" type="text" placeholder="125000" value="<?if (isset($_GET['price_max'])) { echo ($_GET['price_max']); }?>">
90 </label> 90 </label>
91 </div> 91 </div>
92 <button class="hero-filter__reset js_hero_filter_reset" type="button">Очистить</button> 92 <button class="hero-filter__reset js_hero_filter_reset" type="button">Очистить</button>
93 </div> 93 </div>
94 </div> 94 </div>
95 </div> 95 </div>
96 <div class="hero-search__bottom"> 96 <div class="hero-search__bottom">
97 <div class="hero-search__field"> 97 <div class="hero-search__field">
98 <input type="text" id="address" name="address" placeholder="Укажите метро, округ, район, улицу" value="<?if (isset($_GET['address'])) { echo ($_GET['address']); }?>"> 98 <input type="text" id="address" name="address" placeholder="Укажите метро, округ, район, улицу" value="<?if (isset($_GET['address'])) { echo ($_GET['address']); }?>">
99 <button> 99 <button>
100 <svg width="20" height="20"> 100 <svg width="20" height="20">
101 <use xlink:href="{{ asset('images/sprite.svg#hero-search') }}"> </use> 101 <use xlink:href="{{ asset('images/sprite.svg#hero-search') }}"> </use>
102 </svg> 102 </svg>
103 </button> 103 </button>
104 </div> 104 </div>
105 <div class="hero-search__buttons"> 105 <div class="hero-search__buttons">
106 <a class="hero-search__btn btn btn--white js_hero_search_btn" href="{{ route('maps') }}">Показать на карте</a> 106 <a class="hero-search__btn btn btn--white js_hero_search_btn" href="{{ route('maps') }}">Показать на карте</a>
107 <button type="submit" class="hero-search__btn btn btn--main js_hero_search_btn"> 107 <button type="submit" class="hero-search__btn btn btn--main js_hero_search_btn">
108 Искать 108 Искать
109 </button> 109 </button>
110 </div> 110 </div>
111 </div> 111 </div>
112 </form> 112 </form>
113 </div> 113 </div>
114 </div> 114 </div>
115 </div> 115 </div>
116 </div> 116 </div>
117 </section> 117 </section>
118 118