Commit 674b6d78a57588a6c0deb5fd1045154d9143f6fa

Authored by Hayk Nazaryan
1 parent ebedc59367
Exists in master

not active employer redirect fix

Showing 2 changed files with 3 additions and 2 deletions Inline Diff

app/Http/Controllers/EmployerController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers; 3 namespace App\Http\Controllers;
4 4
5 use App\Classes\RusDate; 5 use App\Classes\RusDate;
6 use App\Classes\Tools; 6 use App\Classes\Tools;
7 use App\Http\Requests\BaseUser_min_Request; 7 use App\Http\Requests\BaseUser_min_Request;
8 use App\Http\Requests\FlotRequest; 8 use App\Http\Requests\FlotRequest;
9 use App\Http\Requests\MessagesRequiest; 9 use App\Http\Requests\MessagesRequiest;
10 use App\Http\Requests\VacancyRequestEdit; 10 use App\Http\Requests\VacancyRequestEdit;
11 use App\Mail\MailCreateEmployer; 11 use App\Mail\MailCreateEmployer;
12 use App\Mail\MailSotrudnichestvo; 12 use App\Mail\MailSotrudnichestvo;
13 use App\Mail\MassSendingMessages; 13 use App\Mail\MassSendingMessages;
14 use App\Mail\SendAllMessages; 14 use App\Mail\SendAllMessages;
15 use App\Models\Ad_employer; 15 use App\Models\Ad_employer;
16 use App\Models\ad_response; 16 use App\Models\ad_response;
17 use App\Models\Category; 17 use App\Models\Category;
18 use App\Models\Chat; 18 use App\Models\Chat;
19 use App\Models\Employer; 19 use App\Models\Employer;
20 use App\Models\EmployerAutoliftOption; 20 use App\Models\EmployerAutoliftOption;
21 use App\Models\Flot; 21 use App\Models\Flot;
22 use App\Models\Job_title; 22 use App\Models\Job_title;
23 use App\Models\Like_worker; 23 use App\Models\Like_worker;
24 use App\Models\Message; 24 use App\Models\Message;
25 use App\Models\Worker; 25 use App\Models\Worker;
26 use App\Models\MessagesRequests; 26 use App\Models\MessagesRequests;
27 use Carbon\Carbon; 27 use Carbon\Carbon;
28 use Illuminate\Auth\Events\Registered; 28 use Illuminate\Auth\Events\Registered;
29 use Illuminate\Database\Eloquent\Builder; 29 use Illuminate\Database\Eloquent\Builder;
30 use Illuminate\Http\RedirectResponse; 30 use Illuminate\Http\RedirectResponse;
31 use Illuminate\Http\Request; 31 use Illuminate\Http\Request;
32 use Illuminate\Support\Facades\Auth; 32 use Illuminate\Support\Facades\Auth;
33 use Illuminate\Support\Facades\Cache; 33 use Illuminate\Support\Facades\Cache;
34 use Illuminate\Support\Facades\Hash; 34 use Illuminate\Support\Facades\Hash;
35 use Illuminate\Support\Facades\Log; 35 use Illuminate\Support\Facades\Log;
36 use Illuminate\Support\Facades\Mail; 36 use Illuminate\Support\Facades\Mail;
37 use Illuminate\Support\Facades\Storage; 37 use Illuminate\Support\Facades\Storage;
38 use App\Models\User as User_Model; 38 use App\Models\User as User_Model;
39 use Illuminate\Support\Facades\Validator; 39 use Illuminate\Support\Facades\Validator;
40 use App\Enums\DbExportColumns; 40 use App\Enums\DbExportColumns;
41 use Illuminate\View\View; 41 use Illuminate\View\View;
42 use JsonException; 42 use JsonException;
43 use Throwable; 43 use Throwable;
44 44
45 class EmployerController extends Controller 45 class EmployerController extends Controller
46 { 46 {
47 public function vacancie($vacancy, Request $request) { 47 public function vacancie($vacancy, Request $request) {
48 $title = 'Заголовок вакансии'; 48 $title = 'Заголовок вакансии';
49 $Query = Ad_employer::with('jobs')-> 49 $Query = Ad_employer::with('jobs')->
50 with('cat')-> 50 with('cat')->
51 with('employer')-> 51 with('employer')->
52 with('jobs_code')-> 52 with('jobs_code')->
53 select('ad_employers.*')-> 53 select('ad_employers.*')->
54 where('id', '=', $vacancy)->get(); 54 where('id', '=', $vacancy)->get();
55 55
56 if ($Query[0]->active_is===0 || $Query[0]->is_remove!=0){ 56 if ($Query[0]->active_is===0 || $Query[0]->is_remove!=0){
57 57
58 abort(404); 58 abort(404);
59 59
60 } 60 }
61 61
62 if (isset(Auth()->user()->id)) 62 if (isset(Auth()->user()->id))
63 $uid = Auth()->user()->id; 63 $uid = Auth()->user()->id;
64 else 64 else
65 $uid = 0; 65 $uid = 0;
66 $title = $Query[0]->name; 66 $title = $Query[0]->name;
67 if ($request->ajax()) { 67 if ($request->ajax()) {
68 return view('ajax.vacance-item', compact('Query','uid')); 68 return view('ajax.vacance-item', compact('Query','uid'));
69 } else { 69 } else {
70 return view('vacance-item', compact('title', 'Query', 'uid')); 70 return view('vacance-item', compact('title', 'Query', 'uid'));
71 } 71 }
72 } 72 }
73 73
74 public function logout() { 74 public function logout() {
75 Auth::logout(); 75 Auth::logout();
76 return redirect()->route('index') 76 return redirect()->route('index')
77 ->with('success', 'Вы вышли из личного кабинета'); 77 ->with('success', 'Вы вышли из личного кабинета');
78 } 78 }
79 79
80 public function employer_info() { 80 public function employer_info() {
81 // код юзера 81 // код юзера
82 $user_info = Auth()->user(); 82 $user_info = Auth()->user();
83 // вьюшка для вывода данных 83 // вьюшка для вывода данных
84 return view('employers.info', compact('user_info')); 84 return view('employers.info', compact('user_info'));
85 } 85 }
86 86
87 public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { 87 public function employer_info_save(User_Model $user, BaseUser_min_Request $request) {
88 // Все данные через реквест 88 // Все данные через реквест
89 $all = $request->all(); 89 $all = $request->all();
90 unset($all['_token']); 90 unset($all['_token']);
91 // обновление 91 // обновление
92 $user->update($all); 92 $user->update($all);
93 return redirect()->route('employer.employer_info'); 93 return redirect()->route('employer.employer_info');
94 } 94 }
95 95
96 public function cabinet() { 96 public function cabinet() {
97 $id = Auth()->user()->id; 97 $id = Auth()->user()->id;
98 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 98 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
99 WhereHas('users', 99 WhereHas('users',
100 function (Builder $query) use ($id) {$query->Where('id', $id); 100 function (Builder $query) use ($id) {$query->Where('id', $id);
101 })->get(); 101 })->get();
102 return view('employers.cabinet45', compact('Employer')); 102 return view('employers.cabinet45', compact('Employer'));
103 } 103 }
104 104
105 public function slider_flot() { 105 public function slider_flot() {
106 $id = Auth()->user()->id; 106 $id = Auth()->user()->id;
107 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 107 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
108 WhereHas('users', 108 WhereHas('users',
109 function (Builder $query) use ($id) {$query->Where('id', $id); 109 function (Builder $query) use ($id) {$query->Where('id', $id);
110 })->get(); 110 })->get();
111 return view('employers.fly-flot', compact('Employer')); 111 return view('employers.fly-flot', compact('Employer'));
112 } 112 }
113 113
114 public function cabinet_save(Employer $Employer, Request $request) { 114 public function cabinet_save(Employer $Employer, Request $request) {
115 $params = $request->all(); 115 $params = $request->all();
116 $params['user_id'] = Auth()->user()->id; 116 $params['user_id'] = Auth()->user()->id;
117 $id = $Employer->id; 117 $id = $Employer->id;
118 118
119 if ($request->has('logo')) { 119 if ($request->has('logo')) {
120 if (!empty($Employer->logo)) { 120 if (!empty($Employer->logo)) {
121 Storage::delete($Employer->logo); 121 Storage::delete($Employer->logo);
122 } 122 }
123 $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); 123 $params['logo'] = $request->file('logo')->store("employer/$id", 'public');
124 } 124 }
125 125
126 $Employer->update($params); 126 $Employer->update($params);
127 127
128 return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); 128 return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены');
129 } 129 }
130 130
131 public function save_add_flot(FlotRequest $request) { 131 public function save_add_flot(FlotRequest $request) {
132 // отмена 132 // отмена
133 $params = $request->all(); 133 $params = $request->all();
134 134
135 if ($request->has('image')) { 135 if ($request->has('image')) {
136 $params['image'] = $request->file('image')->store("flot", 'public'); 136 $params['image'] = $request->file('image')->store("flot", 'public');
137 } 137 }
138 Flot::create($params); 138 Flot::create($params);
139 $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); 139 $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get();
140 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); 140 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен');
141 } 141 }
142 142
143 public function edit_flot(Flot $Flot, Employer $Employer) { 143 public function edit_flot(Flot $Flot, Employer $Employer) {
144 return view('employers.edit-flot', compact('Flot', 'Employer')); 144 return view('employers.edit-flot', compact('Flot', 'Employer'));
145 } 145 }
146 146
147 public function update_flot(FlotRequest $request, Flot $Flot) { 147 public function update_flot(FlotRequest $request, Flot $Flot) {
148 $params = $request->all(); 148 $params = $request->all();
149 149
150 if ($request->has('image')) { 150 if ($request->has('image')) {
151 if (!empty($flot->image)) { 151 if (!empty($flot->image)) {
152 Storage::delete($flot->image); 152 Storage::delete($flot->image);
153 } 153 }
154 $params['image'] = $request->file('image')->store("flot", 'public'); 154 $params['image'] = $request->file('image')->store("flot", 'public');
155 } else { 155 } else {
156 if (!empty($flot->image)) $params['image'] = $flot->image; 156 if (!empty($flot->image)) $params['image'] = $flot->image;
157 } 157 }
158 158
159 $Flot->update($params); 159 $Flot->update($params);
160 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); 160 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен');
161 } 161 }
162 162
163 public function delete_flot(Flot $Flot) { 163 public function delete_flot(Flot $Flot) {
164 $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); 164 $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get();
165 165
166 if (isset($Flot->id)) $Flot->delete(); 166 if (isset($Flot->id)) $Flot->delete();
167 return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); 167 return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален');
168 } 168 }
169 169
170 // Форма добавления вакансий 170 // Форма добавления вакансий
171 public function cabinet_vacancie() { 171 public function cabinet_vacancie() {
172 /** @var User_Model $user */ 172 /** @var User_Model $user */
173 $user = Auth()->user(); 173 $user = Auth()->user();
174 174
175 if ($user->is_public) { 175 if ($user->is_public) {
176 $categories = Category::query()->active()->get(); 176 $categories = Category::query()->active()->get();
177 177
178 $jobs = Job_title::query() 178 $jobs = Job_title::query()
179 ->orderByDesc('sort') 179 ->orderByDesc('sort')
180 ->OrderBy('name') 180 ->OrderBy('name')
181 ->where('is_remove', '=', '0') 181 ->where('is_remove', '=', '0')
182 ->where('is_bd', '=', '0') 182 ->where('is_bd', '=', '0')
183 ->get(); 183 ->get();
184 184
185 $Employer = Employer::query() 185 $Employer = Employer::query()
186 ->with(['users', 'ads', 'flots']) 186 ->with(['users', 'ads', 'flots'])
187 ->whereHas('users', fn (Builder $query) => $query->where('id', $user->id)) 187 ->whereHas('users', fn (Builder $query) => $query->where('id', $user->id))
188 ->get(); 188 ->get();
189 189
190 return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); 190 return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories'));
191 } 191 }
192 192
193 return redirect()->route('employer.cabinet_vacancie_danger'); 193 return redirect()->route('page', ['pages' => "Usloviya-razmescheniya"]);
194 // return redirect()->route('employer.cabinet_vacancie_danger');
194 } 195 }
195 196
196 // Форма предупреждения об оплате 197 // Форма предупреждения об оплате
197 public function cabinet_vacancie_danger() { 198 public function cabinet_vacancie_danger() {
198 return view('employers.add_vacancy_danger'); 199 return view('employers.add_vacancy_danger');
199 } 200 }
200 201
201 // Сохранение вакансии 202 // Сохранение вакансии
202 public function cabinet_vacancy_save1(VacancyRequestEdit $request) { 203 public function cabinet_vacancy_save1(VacancyRequestEdit $request) {
203 $params_emp = $request->all(); 204 $params_emp = $request->all();
204 205
205 $params_job["job_title_id"] = $params_emp['job_title_id']; 206 $params_job["job_title_id"] = $params_emp['job_title_id'];
206 207
207 $ad_jobs = Ad_employer::create($params_emp); 208 $ad_jobs = Ad_employer::create($params_emp);
208 $ad_jobs->jobs()->sync($request->get('job_title_id')); 209 $ad_jobs->jobs()->sync($request->get('job_title_id'));
209 210
210 return redirect()->route('employer.vacancy_list')->with('success', 'Вакансия успешно опубликована'); 211 return redirect()->route('employer.vacancy_list')->with('success', 'Вакансия успешно опубликована');
211 } 212 }
212 213
213 // Список вакансий 214 // Список вакансий
214 public function vacancy_list(Request $request) { 215 public function vacancy_list(Request $request) {
215 $id = Auth()->user()->id; 216 $id = Auth()->user()->id;
216 217
217 $Employer = Employer::query()->where('user_id', $id)->first(); 218 $Employer = Employer::query()->where('user_id', $id)->first();
218 $vacancy_list = Ad_employer::query() 219 $vacancy_list = Ad_employer::query()
219 ->with('jobs') 220 ->with('jobs')
220 ->with('jobs_code') 221 ->with('jobs_code')
221 ->where('employer_id', $Employer->id) 222 ->where('employer_id', $Employer->id)
222 ->where('is_remove', 0) 223 ->where('is_remove', 0)
223 ->orderbyDesc('updated_at') 224 ->orderbyDesc('updated_at')
224 ; 225 ;
225 226
226 if (($request->has('search')) && (!empty($request->get('search')))) { 227 if (($request->has('search')) && (!empty($request->get('search')))) {
227 $search = $request->get('search'); 228 $search = $request->get('search');
228 $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); 229 $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%");
229 } 230 }
230 231
231 if ($request->get('sort')) { 232 if ($request->get('sort')) {
232 $sort = $request->get('sort'); 233 $sort = $request->get('sort');
233 switch ($sort) { 234 switch ($sort) {
234 case 'nopublic': $vacancy_list->orderByDesc('updated_at') 235 case 'nopublic': $vacancy_list->orderByDesc('updated_at')
235 ->where('active_is', 0); 236 ->where('active_is', 0);
236 break; 237 break;
237 case 'public': $vacancy_list->orderByDesc('updated_at') 238 case 'public': $vacancy_list->orderByDesc('updated_at')
238 ->where('active_is',1); 239 ->where('active_is',1);
239 break; 240 break;
240 default: $vacancy_list->orderByDesc('updated_at'); 241 default: $vacancy_list->orderByDesc('updated_at');
241 break; 242 break;
242 } 243 }
243 } else { 244 } else {
244 $vacancy_list = $vacancy_list->orderByDesc('updated_at')->orderBy('id'); 245 $vacancy_list = $vacancy_list->orderByDesc('updated_at')->orderBy('id');
245 } 246 }
246 247
247 $vacancy_list = $vacancy_list->paginate(10); 248 $vacancy_list = $vacancy_list->paginate(10);
248 249
249 if ($request->ajax()) { 250 if ($request->ajax()) {
250 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); 251 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer'));
251 } else { 252 } else {
252 return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); 253 return view('employers.list_vacancy', compact('vacancy_list', 'Employer'));
253 } 254 }
254 } 255 }
255 256
256 // Карточка вакансии 257 // Карточка вакансии
257 public function vacancy_edit(Ad_employer $ad_employer) { 258 public function vacancy_edit(Ad_employer $ad_employer) {
258 $id = Auth()->user()->id; 259 $id = Auth()->user()->id;
259 $Positions = Category::query()->where('is_remove', '=', '0')->get(); 260 $Positions = Category::query()->where('is_remove', '=', '0')->get();
260 261
261 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> 262 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')->
262 where('is_remove', '=', '0')-> 263 where('is_remove', '=', '0')->
263 where('is_bd', '=', '0')->get(); 264 where('is_bd', '=', '0')->get();
264 265
265 $Employer = Employer::query()->with('users')->with('ads')-> 266 $Employer = Employer::query()->with('users')->with('ads')->
266 with('flots')->where('user_id', $id)->first(); 267 with('flots')->where('user_id', $id)->first();
267 268
268 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); 269 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs'));
269 } 270 }
270 271
271 // Сохранение-редактирование записи 272 // Сохранение-редактирование записи
272 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { 273 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) {
273 $params = $request->all(); 274 $params = $request->all();
274 275
275 $ad_employer->update($params); 276 $ad_employer->update($params);
276 $ad_employer->active_is = 1; 277 $ad_employer->active_is = 1;
277 $ad_employer->save(); 278 $ad_employer->save();
278 $ad_employer->jobs()->sync($request->get('job_title_id')); 279 $ad_employer->jobs()->sync($request->get('job_title_id'));
279 280
280 $id = Auth()->user()->id; 281 $id = Auth()->user()->id;
281 $Positions = Category::query()->where('is_remove', '=', '0')->get(); 282 $Positions = Category::query()->where('is_remove', '=', '0')->get();
282 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name') 283 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')
283 ->where('is_remove', '=', '0') 284 ->where('is_remove', '=', '0')
284 ->where('is_bd', '=', '0') 285 ->where('is_bd', '=', '0')
285 ->get(); 286 ->get();
286 287
287 $Employer = Employer::query() 288 $Employer = Employer::query()
288 ->with('users')->with('ads')->with('flots')->where('user_id', $id)->first(); 289 ->with('users')->with('ads')->with('flots')->where('user_id', $id)->first();
289 290
290 return redirect()->route('employer.vacancy_list')->with('success', 'Вакансия успешно отредактирована'); 291 return redirect()->route('employer.vacancy_list')->with('success', 'Вакансия успешно отредактирована');
291 } 292 }
292 293
293 // Сохранение карточки вакансии 294 // Сохранение карточки вакансии
294 public function vacancy_save(Request $request, Ad_employer $ad_employer) { 295 public function vacancy_save(Request $request, Ad_employer $ad_employer) {
295 $all = $request->all(); 296 $all = $request->all();
296 $ad_employer->update($all); 297 $ad_employer->update($all);
297 return redirect()->route('employer.cabinet_vacancie'); 298 return redirect()->route('employer.cabinet_vacancie');
298 } 299 }
299 300
300 // Удаление карточки вакансии 301 // Удаление карточки вакансии
301 public function vacancy_delete(Ad_employer $ad_employer) { 302 public function vacancy_delete(Ad_employer $ad_employer) {
302 $ad_employer->delete(); 303 $ad_employer->delete();
303 304
304 return redirect()->route('employer.vacancy_list') 305 return redirect()->route('employer.vacancy_list')
305 ->with('success', 'Вакансия удалена'); 306 ->with('success', 'Вакансия удалена');
306 } 307 }
307 308
308 // Обновление даты 309 // Обновление даты
309 public function vacancy_up(Ad_employer $ad_employer) { 310 public function vacancy_up(Ad_employer $ad_employer) {
310 $up = date('m/d/Y h:i:s', time()); 311 $up = date('m/d/Y h:i:s', time());
311 $ad_employer->updated_at = $up; 312 $ad_employer->updated_at = $up;
312 $ad_employer->save(); 313 $ad_employer->save();
313 314
314 return redirect()->route('employer.vacancy_list') 315 return redirect()->route('employer.vacancy_list')
315 ->with('success', 'Вакансия поднята'); 316 ->with('success', 'Вакансия поднята');
316 } 317 }
317 318
318 //Видимость вакансии 319 //Видимость вакансии
319 public function vacancy_eye(Ad_employer $ad_employer, $status) { 320 public function vacancy_eye(Ad_employer $ad_employer, $status) {
320 $statusMessages = [ 321 $statusMessages = [
321 'Вакансия скрыта', 322 'Вакансия скрыта',
322 'Вакансия видна работникам' 323 'Вакансия видна работникам'
323 ]; 324 ];
324 325
325 $vac_emp = Ad_employer::findOrFail($ad_employer->id); 326 $vac_emp = Ad_employer::findOrFail($ad_employer->id);
326 $vac_emp->active_is = $status; 327 $vac_emp->active_is = $status;
327 $vac_emp->save(); 328 $vac_emp->save();
328 329
329 return redirect()->route('employer.vacancy_list') 330 return redirect()->route('employer.vacancy_list')
330 ->with('success', $statusMessages[$status]); 331 ->with('success', $statusMessages[$status]);
331 } 332 }
332 333
333 //Вакансия редактирования (шаблон) 334 //Вакансия редактирования (шаблон)
334 public function vacancy_update(Ad_employer $id) { 335 public function vacancy_update(Ad_employer $id) {
335 336
336 } 337 }
337 338
338 //Отклики на вакансию - лист 339 //Отклики на вакансию - лист
339 public function answers(Employer $employer, Request $request) { 340 public function answers(Employer $employer, Request $request) {
340 $user_id = Auth()->user()->id; 341 $user_id = Auth()->user()->id;
341 $answer = Ad_employer::query()->where('employer_id', $employer->id); 342 $answer = Ad_employer::query()->where('employer_id', $employer->id);
342 if ($request->has('search')) { 343 if ($request->has('search')) {
343 $search = trim($request->get('search')); 344 $search = trim($request->get('search'));
344 if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); 345 if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%");
345 } 346 }
346 347
347 $answer = $answer->with('response')->OrderByDESC('id')->get(); 348 $answer = $answer->with('response')->OrderByDESC('id')->get();
348 349
349 return view('employers.list_answer', compact('answer', 'user_id', 'employer')); 350 return view('employers.list_answer', compact('answer', 'user_id', 'employer'));
350 } 351 }
351 352
352 //Обновление статуса 353 //Обновление статуса
353 public function supple_status(employer $employer, ad_response $ad_response, $flag) { 354 public function supple_status(employer $employer, ad_response $ad_response, $flag) {
354 $ad_response->update(Array('flag' => $flag)); 355 $ad_response->update(Array('flag' => $flag));
355 return redirect()->route('employer.answers', ['employer' => $employer->id]); 356 return redirect()->route('employer.answers', ['employer' => $employer->id]);
356 } 357 }
357 358
358 //Страницы сообщений список 359 //Страницы сообщений список
359 public function messages($type_message) { 360 public function messages($type_message) {
360 $user_id = Auth()->user()->id; 361 $user_id = Auth()->user()->id;
361 $superAdmin =User_Model::superAdmin(); 362 $superAdmin =User_Model::superAdmin();
362 $chats = Chat::get_user_chats($user_id); 363 $chats = Chat::get_user_chats($user_id);
363 $admin_chat = Chat::get_user_admin_chat($user_id); 364 $admin_chat = Chat::get_user_admin_chat($user_id);
364 $user_type = 'employer'; 365 $user_type = 'employer';
365 366
366 return view('employers.messages', compact('chats', 'admin_chat', 'user_id', 'user_type','superAdmin')); 367 return view('employers.messages', compact('chats', 'admin_chat', 'user_id', 'user_type','superAdmin'));
367 } 368 }
368 369
369 // Диалог между пользователями 370 // Диалог между пользователями
370 public function dialog(Chat $chat, Request $request) { 371 public function dialog(Chat $chat, Request $request) {
371 // Получение параметров. 372 // Получение параметров.
372 if ($request->has('ad_employer')){ 373 if ($request->has('ad_employer')){
373 $ad_employer = $request->get('ad_employer'); 374 $ad_employer = $request->get('ad_employer');
374 } else { 375 } else {
375 $ad_employer = 0; 376 $ad_employer = 0;
376 } 377 }
377 $superAdmin =User_Model::superAdmin(); 378 $superAdmin =User_Model::superAdmin();
378 379
379 $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first(); 380 $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first();
380 $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first(); 381 $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first();
381 382
382 $Messages = Chat::get_chat_messages($chat); 383 $Messages = Chat::get_chat_messages($chat);
383 384
384 Message::where('user_id', '=', $chat->to_user_id)->where('to_user_id', '=', $chat->user_id)->update(['flag_new' => 0]); 385 Message::where('user_id', '=', $chat->to_user_id)->where('to_user_id', '=', $chat->user_id)->update(['flag_new' => 0]);
385 386
386 return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages','chat','superAdmin')); 387 return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages','chat','superAdmin'));
387 } 388 }
388 389
389 public function pin_chat(Request $request){ 390 public function pin_chat(Request $request){
390 $chat_id = $request->get('id'); 391 $chat_id = $request->get('id');
391 $is_fixed = $request->get('is_fixed'); 392 $is_fixed = $request->get('is_fixed');
392 393
393 $chat = Chat::pin_chat($chat_id, $is_fixed); 394 $chat = Chat::pin_chat($chat_id, $is_fixed);
394 $message = $chat->is_fixed ? 'Сообщение закреплено' : 'Сообщение откреплено'; 395 $message = $chat->is_fixed ? 'Сообщение закреплено' : 'Сообщение откреплено';
395 return redirect()->back()->with('success', $message); 396 return redirect()->back()->with('success', $message);
396 } 397 }
397 398
398 public function remove_chat(Request $request){ 399 public function remove_chat(Request $request){
399 $chat_id = $request->get('id'); 400 $chat_id = $request->get('id');
400 Chat::remove_chat($chat_id); 401 Chat::remove_chat($chat_id);
401 } 402 }
402 403
403 // Регистрация работодателя 404 // Регистрация работодателя
404 public function register_employer(Request $request) 405 public function register_employer(Request $request)
405 { 406 {
406 $rules = [ 407 $rules = [
407 'surname' => ['nullable', 'string', 'max:255'], 408 'surname' => ['nullable', 'string', 'max:255'],
408 'name_man' => ['nullable', 'string', 'max:255'], 409 'name_man' => ['nullable', 'string', 'max:255'],
409 'email' => ['required', 'email', 'max:255', 'unique:users'], 410 'email' => ['required', 'email', 'max:255', 'unique:users'],
410 'name_company' => ['required', 'string', 'max:255'], 411 'name_company' => ['required', 'string', 'max:255'],
411 'password' => ['required', 'string', 'min:6'], 412 'password' => ['required', 'string', 'min:6'],
412 'password_confirmation' => ['required', 'same:password'], 413 'password_confirmation' => ['required', 'same:password'],
413 'politik' => ['required', 'accepted'], 414 'politik' => ['required', 'accepted'],
414 ]; 415 ];
415 416
416 $messages = [ 417 $messages = [
417 'required' => 'Укажите обязательное поле', 418 'required' => 'Укажите обязательное поле',
418 'email' => 'Введите корректный email', 419 'email' => 'Введите корректный email',
419 'unique' => 'Email уже зарегистрирован', 420 'unique' => 'Email уже зарегистрирован',
420 'same' => 'Пароль и подтверждение пароля не совпадают', 421 'same' => 'Пароль и подтверждение пароля не совпадают',
421 'min' => [ 422 'min' => [
422 'string' => 'Поле должно быть не менее :min символов', 423 'string' => 'Поле должно быть не менее :min символов',
423 ], 424 ],
424 'max' => [ 425 'max' => [
425 'string' => 'Поле должно быть не более :max символов', 426 'string' => 'Поле должно быть не более :max символов',
426 ], 427 ],
427 'accepted' => 'Необходимо согласиться с политикой конфиденциальности', 428 'accepted' => 'Необходимо согласиться с политикой конфиденциальности',
428 ]; 429 ];
429 430
430 $validator = Validator::make($request->all(), $rules, $messages); 431 $validator = Validator::make($request->all(), $rules, $messages);
431 432
432 if ($validator->fails()) { 433 if ($validator->fails()) {
433 return response()->json(['ERRORS' => $validator->errors()], 422); 434 return response()->json(['ERRORS' => $validator->errors()], 422);
434 } 435 }
435 436
436 $params = $request->all(); 437 $params = $request->all();
437 438
438 if (empty($params['surname'])) { 439 if (empty($params['surname'])) {
439 $params['surname'] = 'Неизвестно'; 440 $params['surname'] = 'Неизвестно';
440 } 441 }
441 if (empty($params['name_man'])) { 442 if (empty($params['name_man'])) {
442 $params['name_man'] = 'Неизвестно'; 443 $params['name_man'] = 'Неизвестно';
443 } 444 }
444 445
445 if ($user = $this->create($params)) { 446 if ($user = $this->create($params)) {
446 event(new Registered($user)); 447 event(new Registered($user));
447 448
448 try { 449 try {
449 Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params)); 450 Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params));
450 } catch (Throwable $e) { 451 } catch (Throwable $e) {
451 Log::error('Ошибка при отправке письма: ' . $e->getMessage()); 452 Log::error('Ошибка при отправке письма: ' . $e->getMessage());
452 } 453 }
453 454
454 Auth::guard()->login($user); 455 Auth::guard()->login($user);
455 456
456 return response()->json([ 457 return response()->json([
457 'REDIRECT' => route('employer.cabinet'), 458 'REDIRECT' => route('employer.cabinet'),
458 ]); 459 ]);
459 } 460 }
460 461
461 return response()->json([ 462 return response()->json([
462 'ERROR' => 'Произошла ошибка при регистрации. Попробуйте снова.', 463 'ERROR' => 'Произошла ошибка при регистрации. Попробуйте снова.',
463 ]); 464 ]);
464 } 465 }
465 466
466 // Создание пользователя 467 // Создание пользователя
467 protected function create(array $data) 468 protected function create(array $data)
468 { 469 {
469 $Use = new User_Model(); 470 $Use = new User_Model();
470 $Code_user = $Use->create([ 471 $Code_user = $Use->create([
471 'name' => $data['surname']." ".$data['name_man'], 472 'name' => $data['surname']." ".$data['name_man'],
472 'name_man' => $data['name_man'], 473 'name_man' => $data['name_man'],
473 'surname' => $data['surname'], 474 'surname' => $data['surname'],
474 'surname2' => $data['surname2'], 475 'surname2' => $data['surname2'],
475 'subscribe_email' => $data['email'], 476 'subscribe_email' => $data['email'],
476 'email' => $data['email'], 477 'email' => $data['email'],
477 'telephone' => $data['telephone'], 478 'telephone' => $data['telephone'],
478 'is_worker' => 0, 479 'is_worker' => 0,
479 'password' => Hash::make($data['password']), 480 'password' => Hash::make($data['password']),
480 'pubpassword' => base64_encode($data['password']), 481 'pubpassword' => base64_encode($data['password']),
481 'email_verified_at' => Carbon::now() 482 'email_verified_at' => Carbon::now()
482 ]); 483 ]);
483 484
484 if ($Code_user->id > 0) { 485 if ($Code_user->id > 0) {
485 $Employer = new Employer(); 486 $Employer = new Employer();
486 $Employer->user_id = $Code_user->id; 487 $Employer->user_id = $Code_user->id;
487 $Employer->name_company = $data['name_company']; 488 $Employer->name_company = $data['name_company'];
488 $Employer->email = $data['email']; 489 $Employer->email = $data['email'];
489 $Employer->telephone = $data['telephone']; 490 $Employer->telephone = $data['telephone'];
490 $Employer->code = Tools::generator_id(10); 491 $Employer->code = Tools::generator_id(10);
491 $Employer->save(); 492 $Employer->save();
492 493
493 return $Code_user; 494 return $Code_user;
494 } 495 }
495 } 496 }
496 497
497 // Отправка сообщения от работодателя 498 // Отправка сообщения от работодателя
498 public function send_message(MessagesRequiest $request) { 499 public function send_message(MessagesRequiest $request) {
499 $params = $request->all(); 500 $params = $request->all();
500 501
501 $user1 = $params['user_id']; 502 $user1 = $params['user_id'];
502 $user2 = $params['to_user_id']; 503 $user2 = $params['to_user_id'];
503 504
504 if ($request->has('file')) { 505 if ($request->has('file')) {
505 $params['file'] = $request->file('file')->store("messages", 'public'); 506 $params['file'] = $request->file('file')->store("messages", 'public');
506 } 507 }
507 Message::create($params); 508 Message::create($params);
508 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); 509 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
509 } 510 }
510 511
511 public function test123(Request $request) { 512 public function test123(Request $request) {
512 $params = $request->all(); 513 $params = $request->all();
513 $user1 = $params['user_id']; 514 $user1 = $params['user_id'];
514 $user2 = $params['to_user_id']; 515 $user2 = $params['to_user_id'];
515 516
516 $rules = [ 517 $rules = [
517 'text' => 'nullable|required_without:file|min:1|max:150000', 518 'text' => 'nullable|required_without:file|min:1|max:150000',
518 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' 519 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000'
519 ]; 520 ];
520 $messages = [ 521 $messages = [
521 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', 522 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен',
522 'min' => [ 523 'min' => [
523 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 524 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
524 'integer' => 'Поле «:attribute» должно быть :min или больше', 525 'integer' => 'Поле «:attribute» должно быть :min или больше',
525 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 526 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
526 ], 527 ],
527 'max' => [ 528 'max' => [
528 'string' => 'Поле «:attribute» должно быть не больше :max символов', 529 'string' => 'Поле «:attribute» должно быть не больше :max символов',
529 'integer' => 'Поле «:attribute» должно быть :max или меньше', 530 'integer' => 'Поле «:attribute» должно быть :max или меньше',
530 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 531 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
531 ] 532 ]
532 ]; 533 ];
533 534
534 $validator = Validator::make($request->all(), $rules, $messages); 535 $validator = Validator::make($request->all(), $rules, $messages);
535 536
536 if ($validator->fails()) { 537 if ($validator->fails()) {
537 return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); 538 return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator);
538 } 539 }
539 540
540 $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); 541 $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages');
541 return redirect()->route('employer.dialog', ['chat' => $new_message->chat_id_from]); 542 return redirect()->route('employer.dialog', ['chat' => $new_message->chat_id_from]);
542 543
543 } 544 }
544 545
545 //Избранные люди 546 //Избранные люди
546 public function favorites(Request $request) 547 public function favorites(Request $request)
547 { 548 {
548 $likedWorkersIds = Like_worker::query() 549 $likedWorkersIds = Like_worker::query()
549 ->where('user_id', Auth::user()->id) 550 ->where('user_id', Auth::user()->id)
550 ->get() 551 ->get()
551 ->pluck('code_record') 552 ->pluck('code_record')
552 ->toArray(); 553 ->toArray();
553 554
554 $workerBuilder = Worker::query() 555 $workerBuilder = Worker::query()
555 ->whereIn('id', $likedWorkersIds); 556 ->whereIn('id', $likedWorkersIds);
556 557
557 if (($request->has('search')) && (!empty($request->get('search')))) { 558 if (($request->has('search')) && (!empty($request->get('search')))) {
558 $search = $request->get('search'); 559 $search = $request->get('search');
559 560
560 $workerBuilder->whereHas('users', function (Builder $query) use ($search) { 561 $workerBuilder->whereHas('users', function (Builder $query) use ($search) {
561 $query->where('surname', 'LIKE', "%$search%") 562 $query->where('surname', 'LIKE', "%$search%")
562 ->orWhere('name_man', 'LIKE', "%$search%") 563 ->orWhere('name_man', 'LIKE', "%$search%")
563 ->orWhere('surname2', 'LIKE', "%$search%"); 564 ->orWhere('surname2', 'LIKE', "%$search%");
564 }); 565 });
565 } 566 }
566 567
567 $Workers = $workerBuilder->get(); 568 $Workers = $workerBuilder->get();
568 569
569 return view('employers.favorite', compact('Workers')); 570 return view('employers.favorite', compact('Workers'));
570 } 571 }
571 572
572 // База данных 573 // База данных
573 public function bd(Request $request) { 574 public function bd(Request $request) {
574 if (!Auth::user()->show_database) { 575 if (!Auth::user()->show_database) {
575 return redirect()->route('employer.employer_info'); 576 return redirect()->route('employer.employer_info');
576 } 577 }
577 578
578 $users = User_Model::query()->with('workers')->with('jobtitles'); 579 $users = User_Model::query()->with('workers')->with('jobtitles');
579 580
580 if ($request->has('search')) { 581 if ($request->has('search')) {
581 $find_key = $request->get('search'); 582 $find_key = $request->get('search');
582 $users = $users->where('name', 'LIKE', "%$find_key%") 583 $users = $users->where('name', 'LIKE', "%$find_key%")
583 ->orWhere('surname', 'LIKE', "%$find_key%") 584 ->orWhere('surname', 'LIKE', "%$find_key%")
584 ->orWhere('name_man', 'LIKE', "%$find_key%") 585 ->orWhere('name_man', 'LIKE', "%$find_key%")
585 ->orWhere('email', 'LIKE', "%$find_key%") 586 ->orWhere('email', 'LIKE', "%$find_key%")
586 ->orWhere('telephone', 'LIKE', "%$find_key%"); 587 ->orWhere('telephone', 'LIKE', "%$find_key%");
587 } 588 }
588 $count_users = $users->count(); 589 $count_users = $users->count();
589 590
590 // Данные 591 // Данные
591 $users = $users 592 $users = $users
592 ->Baseuser() 593 ->Baseuser()
593 ->orderByDesc('created_at') 594 ->orderByDesc('created_at')
594 ->paginate(10); 595 ->paginate(10);
595 596
596 $export_options = DbExportColumns::toArray(); 597 $export_options = DbExportColumns::toArray();
597 598
598 $jobs_titles = Job_title::select('id', 'name') 599 $jobs_titles = Job_title::select('id', 'name')
599 ->where('is_remove', '=', 0) 600 ->where('is_remove', '=', 0)
600 ->where('is_bd', '=', 2) 601 ->where('is_bd', '=', 2)
601 ->orderByDesc('sort') 602 ->orderByDesc('sort')
602 ->orderBy('name', 'asc') 603 ->orderBy('name', 'asc')
603 ->get() 604 ->get()
604 ->toArray() 605 ->toArray()
605 ; 606 ;
606 607
607 return view('employers.bd', compact('users', 'count_users', 'export_options', 'jobs_titles')); 608 return view('employers.bd', compact('users', 'count_users', 'export_options', 'jobs_titles'));
608 } 609 }
609 610
610 //Настройка уведомлений 611 //Настройка уведомлений
611 public function subscribe() { 612 public function subscribe() {
612 613
613 $user=Auth::user(); 614 $user=Auth::user();
614 615
615 return view('employers.subcribe',compact('user')); 616 return view('employers.subcribe',compact('user'));
616 } 617 }
617 618
618 //Установка уведомлений сохранение 619 //Установка уведомлений сохранение
619 public function save_subscribe(Request $request) { 620 public function save_subscribe(Request $request) {
620 621
621 $msg = $request->validate([ 622 $msg = $request->validate([
622 'email' => 'required|email|min:5|max:255', 623 'email' => 'required|email|min:5|max:255',
623 ]); 624 ]);
624 $user= Auth::user(); 625 $user= Auth::user();
625 626
626 User_Model::updateOrCreate( 627 User_Model::updateOrCreate(
627 ['id' => $user->id], 628 ['id' => $user->id],
628 ['subscribe_email' => $request->email, 629 ['subscribe_email' => $request->email,
629 'subscribe' => request()->has('email_msg') && request('email_msg') === 'on' ? 1 : 0 630 'subscribe' => request()->has('email_msg') && request('email_msg') === 'on' ? 1 : 0
630 ] 631 ]
631 ); 632 );
632 return redirect()->route('employer.subscribe')->with('success', 'Ваши изменения успешно сохранены'); 633 return redirect()->route('employer.subscribe')->with('success', 'Ваши изменения успешно сохранены');
633 } 634 }
634 //Сбросить форму с паролем 635 //Сбросить форму с паролем
635 public function password_reset() { 636 public function password_reset() {
636 $email = Auth()->user()->email; 637 $email = Auth()->user()->email;
637 return view('employers.password-reset', compact('email')); 638 return view('employers.password-reset', compact('email'));
638 } 639 }
639 640
640 //Обновление пароля 641 //Обновление пароля
641 public function new_password(Request $request) { 642 public function new_password(Request $request) {
642 $use = Auth()->user(); 643 $use = Auth()->user();
643 $request->validate([ 644 $request->validate([
644 'password' => 'required|string', 645 'password' => 'required|string',
645 'new_password' => 'required|string', 646 'new_password' => 'required|string',
646 'new_password2' => 'required|string' 647 'new_password2' => 'required|string'
647 ]); 648 ]);
648 649
649 if ($request->get('new_password') == $request->get('new_password2')) 650 if ($request->get('new_password') == $request->get('new_password2'))
650 if ($request->get('password') !== $request->get('new_password')) { 651 if ($request->get('password') !== $request->get('new_password')) {
651 $credentials = $request->only('email', 'password'); 652 $credentials = $request->only('email', 'password');
652 if (Auth::attempt($credentials)) { 653 if (Auth::attempt($credentials)) {
653 654
654 if (!is_null($use->email_verified_at)){ 655 if (!is_null($use->email_verified_at)){
655 656
656 $user_data = User_Model::find($use->id); 657 $user_data = User_Model::find($use->id);
657 $user_data->update([ 658 $user_data->update([
658 'password' => Hash::make($request->get('new_password')), 659 'password' => Hash::make($request->get('new_password')),
659 'pubpassword' => base64_encode($request->get('new_password')), 660 'pubpassword' => base64_encode($request->get('new_password')),
660 ]); 661 ]);
661 return redirect() 662 return redirect()
662 ->route('employer.password_reset') 663 ->route('employer.password_reset')
663 ->with('success', 'Поздравляю! Вы обновили свой пароль!'); 664 ->with('success', 'Поздравляю! Вы обновили свой пароль!');
664 } 665 }
665 666
666 return redirect() 667 return redirect()
667 ->route('employer.password_reset') 668 ->route('employer.password_reset')
668 ->withError('Данная учетная запись не было верифицированна!'); 669 ->withError('Данная учетная запись не было верифицированна!');
669 } 670 }
670 } 671 }
671 672
672 return redirect() 673 return redirect()
673 ->route('employer.password_reset') 674 ->route('employer.password_reset')
674 ->withErrors('Не совпадение данных, обновите пароли!'); 675 ->withErrors('Не совпадение данных, обновите пароли!');
675 } 676 }
676 677
677 678
678 679
679 // Форма Удаление пипла 680 // Форма Удаление пипла
680 public function delete_people() { 681 public function delete_people() {
681 $login = Auth()->user()->email; 682 $login = Auth()->user()->email;
682 return view('employers.delete_people', compact('login')); 683 return view('employers.delete_people', compact('login'));
683 } 684 }
684 685
685 // Удаление аккаунта 686 // Удаление аккаунта
686 public function action_delete_user(Request $request) { 687 public function action_delete_user(Request $request) {
687 $Answer = $request->all(); 688 $Answer = $request->all();
688 $user_id = Auth()->user()->id; 689 $user_id = Auth()->user()->id;
689 $request->validate([ 690 $request->validate([
690 'password' => 'required|string', 691 'password' => 'required|string',
691 ]); 692 ]);
692 693
693 $credentials = $request->only('email', 'password'); 694 $credentials = $request->only('email', 'password');
694 if (Auth::attempt($credentials)) { 695 if (Auth::attempt($credentials)) {
695 Auth::logout(); 696 Auth::logout();
696 $it = User_Model::find($user_id); 697 $it = User_Model::find($user_id);
697 $it->delete(); 698 $it->delete();
698 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); 699 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт');
699 } else { 700 } else {
700 return redirect()->route('employer.delete_people') 701 return redirect()->route('employer.delete_people')
701 ->withErrors( 'Неверный пароль! Нужен корректный пароль'); 702 ->withErrors( 'Неверный пароль! Нужен корректный пароль');
702 } 703 }
703 } 704 }
704 705
705 public function ajax_delete_user(Request $request) { 706 public function ajax_delete_user(Request $request) {
706 $Answer = $request->all(); 707 $Answer = $request->all();
707 $user_id = Auth()->user()->id; 708 $user_id = Auth()->user()->id;
708 $request->validate([ 709 $request->validate([
709 'password' => 'required|string', 710 'password' => 'required|string',
710 ]); 711 ]);
711 $credentials = $request->only('email', 'password'); 712 $credentials = $request->only('email', 'password');
712 if (Auth::attempt($credentials)) { 713 if (Auth::attempt($credentials)) {
713 714
714 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', 715 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт',
715 'email' => $request->get('email'), 716 'email' => $request->get('email'),
716 'password' => $request->get('password'))); 717 'password' => $request->get('password')));
717 } else { 718 } else {
718 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); 719 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль'));
719 } 720 }
720 } 721 }
721 722
722 // Рассылка сообщений 723 // Рассылка сообщений
723 public function send_all_messages() { 724 public function send_all_messages() {
724 $id = Auth()->user()->id; 725 $id = Auth()->user()->id;
725 $sending = Employer::query()->where('user_id', '=', "$id")->first(); 726 $sending = Employer::query()->where('user_id', '=', "$id")->first();
726 727
727 $job_titles = Job_title::query() 728 $job_titles = Job_title::query()
728 ->where('is_remove', '=', 0) 729 ->where('is_remove', '=', 0)
729 ->where('is_bd', '=', 1) 730 ->where('is_bd', '=', 1)
730 ->orderByDesc('sort') 731 ->orderByDesc('sort')
731 ->get(); 732 ->get();
732 733
733 if ($sending->sending_is) 734 if ($sending->sending_is)
734 return view('employers.send_all', compact('job_titles')); 735 return view('employers.send_all', compact('job_titles'));
735 else 736 else
736 return view('employers.send_all_danger'); 737 return view('employers.send_all_danger');
737 } 738 }
738 739
739 // Отправка сообщений для информации 740 // Отправка сообщений для информации
740 public function send_all_post(Request $request) { 741 public function send_all_post(Request $request) {
741 $data = $request->all(); 742 $data = $request->all();
742 $data['user'] = Auth()->user(); 743 $data['user'] = Auth()->user();
743 744
744 $id = MessagesRequests::create([ 745 $id = MessagesRequests::create([
745 'user_id' => $data['user']->id, 746 'user_id' => $data['user']->id,
746 'job_titles' => isset($data['job_title_ids']) ? json_encode($data['job_title_ids']) : null, 747 'job_titles' => isset($data['job_title_ids']) ? json_encode($data['job_title_ids']) : null,
747 'text' => $data['message_text'], 748 'text' => $data['message_text'],
748 ]); 749 ]);
749 750
750 try { 751 try {
751 if (!empty($id)) { 752 if (!empty($id)) {
752 Mail::to(env('EMAIL_ADMIN'))->send(new MassSendingMessages($data)); 753 Mail::to(env('EMAIL_ADMIN'))->send(new MassSendingMessages($data));
753 } 754 }
754 } catch (Throwable $e) { 755 } catch (Throwable $e) {
755 Log::error($e); 756 Log::error($e);
756 return redirect()->route('employer.send_all_messages')->with('error', 'Ошибка почтового сервера, пожалуйста, повторите рассылку позднее'); 757 return redirect()->route('employer.send_all_messages')->with('error', 'Ошибка почтового сервера, пожалуйста, повторите рассылку позднее');
757 } 758 }
758 759
759 return redirect()->route('employer.send_all_messages')->with('success', 'Запрос на рассылку был успешно отправлен.'); 760 return redirect()->route('employer.send_all_messages')->with('success', 'Запрос на рассылку был успешно отправлен.');
760 } 761 }
761 762
762 // База резюме 763 // База резюме
763 public function bd_tupe(Request $request) { 764 public function bd_tupe(Request $request) {
764 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); 765 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get();
765 766
766 return view('employers.bd_tupe', compact('Resume')); 767 return view('employers.bd_tupe', compact('Resume'));
767 } 768 }
768 769
769 ////////////////////////////////////////////////////////////////// 770 //////////////////////////////////////////////////////////////////
770 // Отправил сообщение 771 // Отправил сообщение
771 ////////////////////////////////////////////////////////////////// 772 //////////////////////////////////////////////////////////////////
772 public function new_message(Request $request) 773 public function new_message(Request $request)
773 { 774 {
774 $params = $request->all(); 775 $params = $request->all();
775 776
776 $id = $params['_user_id']; 777 $id = $params['_user_id'];
777 $message_params = [ 778 $message_params = [
778 'title' => $params['title'], 779 'title' => $params['title'],
779 'text' => $params['text'], 780 'text' => $params['text'],
780 'ad_employer_id' => $params['_vacancy'], 781 'ad_employer_id' => $params['_vacancy'],
781 'flag_new' => 1 782 'flag_new' => 1
782 ]; 783 ];
783 784
784 $message = Message::add_message( 785 $message = Message::add_message(
785 $request, 786 $request,
786 $params['_user_id'], 787 $params['_user_id'],
787 $params['_to_user_id'], 788 $params['_to_user_id'],
788 $message_params, 789 $message_params,
789 file_store_path: "worker/$id" 790 file_store_path: "worker/$id"
790 ); 791 );
791 792
792 return redirect()->route('employer.dialog', ['chat' => $message->chat_id_to]); 793 return redirect()->route('employer.dialog', ['chat' => $message->chat_id_to]);
793 } 794 }
794 795
795 // Восстановление пароля 796 // Восстановление пароля
796 public function repair_password(Request $request) { 797 public function repair_password(Request $request) {
797 $params = $request->get('email'); 798 $params = $request->get('email');
798 } 799 }
799 800
800 // Избранные люди на корабль 801 // Избранные люди на корабль
801 public function selected_people(Request $request) { 802 public function selected_people(Request $request) {
802 $id = $request->get('id'); 803 $id = $request->get('id');
803 $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> 804 $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')->
804 where('is_remove', '=', '0')-> 805 where('is_remove', '=', '0')->
805 where('is_bd', '=', '0')-> 806 where('is_bd', '=', '0')->
806 where('position_id', $id)-> 807 where('position_id', $id)->
807 get(); 808 get();
808 return view('favorite_people', compact('favorite_people')); 809 return view('favorite_people', compact('favorite_people'));
809 } 810 }
810 811
811 /** 812 /**
812 * @throws JsonException 813 * @throws JsonException
813 */ 814 */
814 public function vacancyAutoLiftForm(): View|RedirectResponse 815 public function vacancyAutoLiftForm(): View|RedirectResponse
815 { 816 {
816 if (!Auth::user()->can_autolift) { 817 if (!Auth::user()->can_autolift) {
817 return redirect()->route('employer.employer_info'); 818 return redirect()->route('employer.employer_info');
818 } 819 }
819 820
820 $employer = Auth::user()->employers[0]; 821 $employer = Auth::user()->employers[0];
821 $vacancies = $employer 822 $vacancies = $employer
822 ->ads() 823 ->ads()
823 ->where('is_remove', 0) 824 ->where('is_remove', 0)
824 ->where('active_is', 1) 825 ->where('active_is', 1)
825 ->get(); 826 ->get();
826 827
827 $options = $employer->autoliftOptions ?? new EmployerAutoliftOption(); 828 $options = $employer->autoliftOptions ?? new EmployerAutoliftOption();
828 829
829 $leftDays = 0; 830 $leftDays = 0;
830 831
831 if ($options->days_repeat) { 832 if ($options->days_repeat) {
832 $leftDays = $options->days_repeat - now()->diffInDays(Carbon::parse($options->created_at)); 833 $leftDays = $options->days_repeat - now()->diffInDays(Carbon::parse($options->created_at));
833 } 834 }
834 835
835 836
836 return view('employers.vacancy_autolift', compact('vacancies', 'options', 'leftDays')); 837 return view('employers.vacancy_autolift', compact('vacancies', 'options', 'leftDays'));
837 } 838 }
838 839
839 /** 840 /**
840 * @throws JsonException 841 * @throws JsonException
841 */ 842 */
842 public function vacancyAutoLiftSave(Request $request) 843 public function vacancyAutoLiftSave(Request $request)
843 { 844 {
844 $employer = Auth::user()->employers[0]; 845 $employer = Auth::user()->employers[0];
845 846
846 $employer->autoliftOptions()->updateOrCreate( 847 $employer->autoliftOptions()->updateOrCreate(
847 [ 848 [
848 'employer_id' => $employer->id, 849 'employer_id' => $employer->id,
849 ], 850 ],
850 [ 851 [
851 'is_enabled' => $request->get('is_enabled') === 'true', 852 'is_enabled' => $request->get('is_enabled') === 'true',
852 'times_per_day' => $request->get('times_per_day'), 853 'times_per_day' => $request->get('times_per_day'),
853 'days_repeat' => $request->get('days_repeat'), 854 'days_repeat' => $request->get('days_repeat'),
854 'time_send_first' => $request->get('time_send_first'), 855 'time_send_first' => $request->get('time_send_first'),
855 'time_send_second' => $request->get('time_send_second'), 856 'time_send_second' => $request->get('time_send_second'),
856 'time_send_third' => $request->get('time_send_third'), 857 'time_send_third' => $request->get('time_send_third'),
857 'time_send_tg' => $request->get('time_send_tg'), 858 'time_send_tg' => $request->get('time_send_tg'),
858 ] 859 ]
859 ); 860 );
860 861
861 foreach ($request->get('vacancies') as $vacancy) { 862 foreach ($request->get('vacancies') as $vacancy) {
862 if ($vacancy['autolift_site']) { 863 if ($vacancy['autolift_site']) {
863 Ad_employer::query() 864 Ad_employer::query()
864 ->where('id', $vacancy['id']) 865 ->where('id', $vacancy['id'])
865 ->update([ 866 ->update([
866 'autolift_site' => $vacancy['autolift_site'] === 'true', //they're arriving as strings 867 'autolift_site' => $vacancy['autolift_site'] === 'true', //they're arriving as strings
867 'autosend_tg' => $vacancy['autosend_tg'] === 'true', 868 'autosend_tg' => $vacancy['autosend_tg'] === 'true',
868 ]); 869 ]);
869 } 870 }
870 } 871 }
871 872
872 return response(['success' => true]); 873 return response(['success' => true]);
873 } 874 }
874 875
875 public function autoresponder() 876 public function autoresponder()
876 { 877 {
877 $user = Auth::user(); 878 $user = Auth::user();
878 return view('employers.autoresponder', compact('user')); 879 return view('employers.autoresponder', compact('user'));
879 } 880 }
880 881
881 public function autoresponderSave(Request $request): RedirectResponse 882 public function autoresponderSave(Request $request): RedirectResponse
882 { 883 {
883 $user = Auth::user(); 884 $user = Auth::user();
884 $user->autoresponder = $request->get('autoresponder', false) === 'on'; 885 $user->autoresponder = $request->get('autoresponder', false) === 'on';
885 $user->autoresponder_message = $request->get('autoresponder_message'); 886 $user->autoresponder_message = $request->get('autoresponder_message');
886 $user->save(); 887 $user->save();
887 888
888 return redirect(route('employer.autoresponder')); 889 return redirect(route('employer.autoresponder'));
889 } 890 }
890 } 891 }
891 892
resources/views/employers/menu.blade.php
1 <div class="cabinet__side-item"> 1 <div class="cabinet__side-item">
2 <div class="cabinet__menu"> 2 <div class="cabinet__menu">
3 <button type="button" class="cabinet__menu-toper js-toggle"> 3 <button type="button" class="cabinet__menu-toper js-toggle">
4 <span class="cabinet__menu-toper-text"></span> 4 <span class="cabinet__menu-toper-text"></span>
5 <i class="cabinet__menu-toper-arrow"> 5 <i class="cabinet__menu-toper-arrow">
6 <svg> 6 <svg>
7 <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> 7 <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use>
8 </svg> 8 </svg>
9 </i> 9 </i>
10 </button> 10 </button>
11 <div class="cabinet__menu-body"> 11 <div class="cabinet__menu-body">
12 <div class="cabinet__menu-items"> 12 <div class="cabinet__menu-items">
13 <a href="{{ route('employer.employer_info') }}" class="cabinet__menu-item @if ($item==0) active @endif"> 13 <a href="{{ route('employer.employer_info') }}" class="cabinet__menu-item @if ($item==0) active @endif">
14 <i> 14 <i>
15 <svg> 15 <svg>
16 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> 16 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
17 </svg> 17 </svg>
18 </i> 18 </i>
19 <span>Личные данные</span> 19 <span>Личные данные</span>
20 </a> 20 </a>
21 <a href="{{ route('employer.cabinet') }}" class="cabinet__menu-item @if ($item==1) active @endif"> 21 <a href="{{ route('employer.cabinet') }}" class="cabinet__menu-item @if ($item==1) active @endif">
22 <i> 22 <i>
23 <svg> 23 <svg>
24 <use xlink:href="{{ asset('images/sprite.svg#user_alt') }}"></use> 24 <use xlink:href="{{ asset('images/sprite.svg#user_alt') }}"></use>
25 </svg> 25 </svg>
26 </i> 26 </i>
27 <span>Профиль</span> 27 <span>Профиль</span>
28 </a> 28 </a>
29 @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_public)) 29 @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_public))
30 <a href="{{ route('employer.cabinet_vacancie') }}" class="cabinet__menu-item @if ($item==2) active @endif"> 30 <a href="{{ route('employer.cabinet_vacancie') }}" class="cabinet__menu-item @if ($item==2) active @endif">
31 <i> 31 <i>
32 <svg> 32 <svg>
33 <use xlink:href="{{ asset('images/sprite.svg#cabinet-2') }}"></use> 33 <use xlink:href="{{ asset('images/sprite.svg#cabinet-2') }}"></use>
34 </svg> 34 </svg>
35 </i> 35 </i>
36 <span>Разместить вакансию</span> 36 <span>Разместить вакансию</span>
37 </a> 37 </a>
38 @else 38 @else
39 <a href="{{ route('employer.cabinet_vacancie_danger') }}" class="cabinet__menu-item @if ($item==2) active @endif"> 39 <a href="{{ route('page', ['pages' => "Usloviya-razmescheniya"]) }}" class="cabinet__menu-item @if ($item==2) active @endif">
40 <i> 40 <i>
41 <svg> 41 <svg>
42 <use xlink:href="{{ asset('images/sprite.svg#cabinet-2') }}"></use> 42 <use xlink:href="{{ asset('images/sprite.svg#cabinet-2') }}"></use>
43 </svg> 43 </svg>
44 </i> 44 </i>
45 <span>Разместить вакансию</span> 45 <span>Разместить вакансию</span>
46 </a> 46 </a>
47 @endif 47 @endif
48 <a href="{{ route('employer.vacancy_list') }}" class="cabinet__menu-item @if ($item==3) active @endif"> 48 <a href="{{ route('employer.vacancy_list') }}" class="cabinet__menu-item @if ($item==3) active @endif">
49 <i> 49 <i>
50 <svg> 50 <svg>
51 <use xlink:href="{{ asset('images/sprite.svg#cabinet-3') }}"></use> 51 <use xlink:href="{{ asset('images/sprite.svg#cabinet-3') }}"></use>
52 </svg> 52 </svg>
53 </i> 53 </i>
54 <span>Мои вакансии</span> 54 <span>Мои вакансии</span>
55 </a> 55 </a>
56 <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="cabinet__menu-item @if ($item==5) active @endif"> 56 <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="cabinet__menu-item @if ($item==5) active @endif">
57 <i> 57 <i>
58 <svg> 58 <svg>
59 <use xlink:href="{{ asset('images/sprite.svg#cabinet-5') }}"></use> 59 <use xlink:href="{{ asset('images/sprite.svg#cabinet-5') }}"></use>
60 </svg> 60 </svg>
61 </i> 61 </i>
62 <span>Сообщения</span> 62 <span>Сообщения</span>
63 </a> 63 </a>
64 <a href="{{ route('employer.favorites') }}" class="cabinet__menu-item @if ($item==6) active @endif"> 64 <a href="{{ route('employer.favorites') }}" class="cabinet__menu-item @if ($item==6) active @endif">
65 <i> 65 <i>
66 <svg> 66 <svg>
67 <use xlink:href="{{ asset('images/sprite.svg#cabinet-6') }}"></use> 67 <use xlink:href="{{ asset('images/sprite.svg#cabinet-6') }}"></use>
68 </svg> 68 </svg>
69 </i> 69 </i>
70 <span>Избранные кандидаты</span> 70 <span>Избранные кандидаты</span>
71 </a> 71 </a>
72 @if ((!Auth()->user()->is_worker)) 72 @if ((!Auth()->user()->is_worker))
73 @if(Auth()->user()->can_autolift) 73 @if(Auth()->user()->can_autolift)
74 <a href="{{ route('employer.autolift') }}" class="cabinet__menu-item @if ($item==15) active @endif"> 74 <a href="{{ route('employer.autolift') }}" class="cabinet__menu-item @if ($item==15) active @endif">
75 <i> 75 <i>
76 <svg> 76 <svg>
77 <use xlink:href="{{ asset('images/sprite.svg#refresh') }}"></use> 77 <use xlink:href="{{ asset('images/sprite.svg#refresh') }}"></use>
78 </svg> 78 </svg>
79 </i> 79 </i>
80 <span>Автоподнятие вакансий</span> 80 <span>Автоподнятие вакансий</span>
81 </a> 81 </a>
82 @endif 82 @endif
83 83
84 @if(Auth()->user()->show_database) 84 @if(Auth()->user()->show_database)
85 <a href="{{ route('employer.bd') }}" class="cabinet__menu-item @if ($item==7) active @endif"> 85 <a href="{{ route('employer.bd') }}" class="cabinet__menu-item @if ($item==7) active @endif">
86 <i> 86 <i>
87 <svg> 87 <svg>
88 <use xlink:href="{{ asset('images/sprite.svg#cabinet-7')}}"></use> 88 <use xlink:href="{{ asset('images/sprite.svg#cabinet-7')}}"></use>
89 </svg> 89 </svg>
90 </i> 90 </i>
91 <span>База данных</span> 91 <span>База данных</span>
92 </a> 92 </a>
93 @endif 93 @endif
94 94
95 @if(Auth()->user()->is_lookin) 95 @if(Auth()->user()->is_lookin)
96 <a href="{{ route('bd_resume') }}" target="_blank" class="cabinet__menu-item @if ($item==8) active @endif"> 96 <a href="{{ route('bd_resume') }}" target="_blank" class="cabinet__menu-item @if ($item==8) active @endif">
97 <i> 97 <i>
98 <svg> 98 <svg>
99 <use xlink:href="{{ asset('images/sprite.svg#cabinet-8') }}"></use> 99 <use xlink:href="{{ asset('images/sprite.svg#cabinet-8') }}"></use>
100 </svg> 100 </svg>
101 </i> 101 </i>
102 <span>База резюме</span> 102 <span>База резюме</span>
103 </a> 103 </a>
104 @endif 104 @endif
105 @endif 105 @endif
106 106
107 107
108 <a href="{{ route('employer.send_all_messages') }}" class="cabinet__menu-item @if ($item==9) active @endif"> 108 <a href="{{ route('employer.send_all_messages') }}" class="cabinet__menu-item @if ($item==9) active @endif">
109 <i> 109 <i>
110 <svg> 110 <svg>
111 <use xlink:href="{{ asset('images/sprite.svg#cabinet-9') }}"></use> 111 <use xlink:href="{{ asset('images/sprite.svg#cabinet-9') }}"></use>
112 </svg> 112 </svg>
113 </i> 113 </i>
114 <span>Рассылка сообщений</span> 114 <span>Рассылка сообщений</span>
115 </a> 115 </a>
116 <a href="{{ route('employer.autoresponder') }}" class="cabinet__menu-item @if ($item==16) active @endif"> 116 <a href="{{ route('employer.autoresponder') }}" class="cabinet__menu-item @if ($item==16) active @endif">
117 <i> 117 <i>
118 <svg> 118 <svg>
119 <use xlink:href="{{ asset('images/sprite.svg#answering') }}"></use> 119 <use xlink:href="{{ asset('images/sprite.svg#answering') }}"></use>
120 </svg> 120 </svg>
121 </i> 121 </i>
122 <span>Автоответчик</span> 122 <span>Автоответчик</span>
123 </a> 123 </a>
124 <a href="{{ route('employer.faq') }}" class="cabinet__menu-item @if ($item==10) active @endif"> 124 <a href="{{ route('employer.faq') }}" class="cabinet__menu-item @if ($item==10) active @endif">
125 <i> 125 <i>
126 <svg> 126 <svg>
127 <use xlink:href="{{ asset('images/sprite.svg#cabinet-10') }}"></use> 127 <use xlink:href="{{ asset('images/sprite.svg#cabinet-10') }}"></use>
128 </svg> 128 </svg>
129 </i> 129 </i>
130 <span>FAQ</span> 130 <span>FAQ</span>
131 </a> 131 </a>
132 <a href="{{ route('employer.slider_flot') }}" class="cabinet__menu-item @if ($item==12) active @endif"> 132 <a href="{{ route('employer.slider_flot') }}" class="cabinet__menu-item @if ($item==12) active @endif">
133 <i> 133 <i>
134 <svg> 134 <svg>
135 <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use> 135 <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use>
136 </svg> 136 </svg>
137 </i> 137 </i>
138 <span>Мой флот</span> 138 <span>Мой флот</span>
139 </a> 139 </a>
140 140
141 <nav> 141 <nav>
142 <ul class="drop-down closed"> 142 <ul class="drop-down closed">
143 <li> 143 <li>
144 <a style="background-color: white" class="nav-button cabinet__menu-item"> 144 <a style="background-color: white" class="nav-button cabinet__menu-item">
145 <i> 145 <i>
146 <svg> 146 <svg>
147 <use xlink:href="{{ asset('images/sprite.svg#settings') }}"></use> 147 <use xlink:href="{{ asset('images/sprite.svg#settings') }}"></use>
148 </svg> 148 </svg>
149 </i> 149 </i>
150 <span>Настройки</span> 150 <span>Настройки</span>
151 </a> 151 </a>
152 </li> 152 </li>
153 <li> 153 <li>
154 <a href="{{ route('employer.subscribe') }}" class="cabinet__menu-item @if ($item==11) active @endif"> 154 <a href="{{ route('employer.subscribe') }}" class="cabinet__menu-item @if ($item==11) active @endif">
155 <i><svg> 155 <i><svg>
156 <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use> 156 <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use>
157 </svg></i> 157 </svg></i>
158 <span>Настройки уведомлений</span> 158 <span>Настройки уведомлений</span>
159 </a> 159 </a>
160 </li> 160 </li>
161 <li> 161 <li>
162 <a href="{{ route('employer.password_reset') }}" class="cabinet__menu-item green @if ($item==13) active @endif"> 162 <a href="{{ route('employer.password_reset') }}" class="cabinet__menu-item green @if ($item==13) active @endif">
163 <i></i> 163 <i></i>
164 <span>Сменить пароль</span> 164 <span>Сменить пароль</span>
165 </a> 165 </a>
166 </li> 166 </li>
167 <li> 167 <li>
168 <a href="{{ route('employer.delete_people') }}" class="cabinet__menu-item red @if ($item==14) active @endif"> 168 <a href="{{ route('employer.delete_people') }}" class="cabinet__menu-item red @if ($item==14) active @endif">
169 <i></i> 169 <i></i>
170 <span>Удалить профиль</span> 170 <span>Удалить профиль</span>
171 </a> 171 </a>
172 </li> 172 </li>
173 </ul> 173 </ul>
174 </nav> 174 </nav>
175 </div> 175 </div>
176 <div class="cabinet__menu-bottom"> 176 <div class="cabinet__menu-bottom">
177 <a href="{{ route('logout') }}" class="button cabinet__menu-leave"> 177 <a href="{{ route('logout') }}" class="button cabinet__menu-leave">
178 <svg> 178 <svg>
179 <use xlink:href="{{ asset('images/sprite.svg#leave') }}"></use> 179 <use xlink:href="{{ asset('images/sprite.svg#leave') }}"></use>
180 </svg> 180 </svg>
181 Выход 181 Выход
182 </a> 182 </a>
183 <span class="cabinet__menu-copy"> 183 <span class="cabinet__menu-copy">
184 &copy; 2020 &ndash; Rekamore.su 184 &copy; 2020 &ndash; Rekamore.su
185 </span> 185 </span>
186 </div> 186 </div>
187 </div> 187 </div>
188 </div> 188 </div>
189 </div> 189 </div>
190 190
191 <script> 191 <script>
192 $(function(){ 192 $(function(){
193 var active_menu = $('.cabinet__menu-item.active'); 193 var active_menu = $('.cabinet__menu-item.active');
194 if (active_menu.length === 1){ 194 if (active_menu.length === 1){
195 $('.cabinet__menu-toper-text').html(active_menu.html()); 195 $('.cabinet__menu-toper-text').html(active_menu.html());
196 } 196 }
197 }); 197 });
198 198
199 $(function() { 199 $(function() {
200 // Bind Click event to the drop down navigation button 200 // Bind Click event to the drop down navigation button
201 $(".nav-button").click(function() { 201 $(".nav-button").click(function() {
202 /* Toggle the CSS closed class which reduces the height of the UL thus 202 /* Toggle the CSS closed class which reduces the height of the UL thus
203 hiding all LI apart from the first */ 203 hiding all LI apart from the first */
204 $(this).parent().parent().toggleClass("closed"); 204 $(this).parent().parent().toggleClass("closed");
205 }); 205 });
206 206
207 }); 207 });
208 </script> 208 </script>
209 209