Commit 6f659072096c3a4e4e19461aea603c7a3528d24e

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

коммит вторника

Showing 17 changed files Inline Diff

app/Http/Controllers/Admin/AdminController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers\Admin; 3 namespace App\Http\Controllers\Admin;
4 4
5 use App\Classes\Tools; 5 use App\Classes\Tools;
6 use App\Http\Controllers\Controller; 6 use App\Http\Controllers\Controller;
7 use App\Http\Requests\CompanyRequest; 7 use App\Http\Requests\CompanyRequest;
8 use App\Http\Requests\RequestAdminNews; 8 use App\Http\Requests\RequestAdminNews;
9 use App\Http\Requests\RequestPosition; 9 use App\Http\Requests\RequestPosition;
10 use App\Models\Company; 10 use App\Models\Company;
11 use App\Models\Employer; 11 use App\Models\Employer;
12 use App\Models\News; 12 use App\Models\News;
13 use App\Models\Positions; 13 use App\Models\Positions;
14 use App\Models\User; 14 use App\Models\User;
15 use Carbon\Carbon; 15 use Carbon\Carbon;
16 use Illuminate\Http\Request; 16 use Illuminate\Http\Request;
17 use Illuminate\Support\Facades\Auth; 17 use Illuminate\Support\Facades\Auth;
18 use Illuminate\Support\Facades\Hash; 18 use Illuminate\Support\Facades\Hash;
19 use Illuminate\Support\Facades\Storage; 19 use Illuminate\Support\Facades\Storage;
20 use Illuminate\Support\Facades\Validator; 20 use Illuminate\Support\Facades\Validator;
21 21
22 class AdminController extends Controller 22 class AdminController extends Controller
23 { 23 {
24 /** 24 /**
25 * Handle the incoming request. 25 * Handle the incoming request.
26 * 26 *
27 * @param \Illuminate\Http\Request $request 27 * @param \Illuminate\Http\Request $request
28 * @return \Illuminate\Http\Response 28 * @return \Illuminate\Http\Response
29 */ 29 */
30 public function __invoke(Request $request) 30 public function __invoke(Request $request)
31 { 31 {
32 // 32 //
33 } 33 }
34 34
35 public function register() { 35 public function register() {
36 $code_emp = Tools::generator_id(10); 36 $code_emp = Tools::generator_id(10);
37 return view('admin.register', compact('code_emp')); 37 return view('admin.register', compact('code_emp'));
38 } 38 }
39 39
40 public function create(Request $request) { 40 public function create(Request $request) {
41 41
42 $params = $request->all(); 42 $params = $request->all();
43 unset($params['code_emp']); 43 unset($params['code_emp']);
44 $rules = [ 44 $rules = [
45 'name' => 'required|string|max:255', 45 'name' => 'required|string|max:255',
46 'email' => 'required|string|email|max:255|unique:users', 46 'email' => 'required|string|email|max:255|unique:users',
47 'password' => 'required|string|min:8|confirmed', 47 'password' => 'required|string|min:8|confirmed',
48 ]; 48 ];
49 49
50 $messages = [ 50 $messages = [
51 'required' => 'Укажите обязательное поле «:attribute»', 51 'required' => 'Укажите обязательное поле «:attribute»',
52 'confirmed' => 'Пароли не совпадают', 52 'confirmed' => 'Пароли не совпадают',
53 'email' => 'Введите корректный email', 53 'email' => 'Введите корректный email',
54 'unique' => 'Данный email занят уже', 54 'unique' => 'Данный email занят уже',
55 'min' => [ 55 'min' => [
56 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 56 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
57 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 57 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
58 ], 58 ],
59 'max' => [ 59 'max' => [
60 'string' => 'Поле «:attribute» должно быть не больше :max символов', 60 'string' => 'Поле «:attribute» должно быть не больше :max символов',
61 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 61 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
62 ], 62 ],
63 ]; 63 ];
64 64
65 $validator = Validator::make($params, $rules, $messages); 65 $validator = Validator::make($params, $rules, $messages);
66 66
67 if ($validator->fails()) { 67 if ($validator->fails()) {
68 return back()->withErrors($validator)->withInput(); 68 return back()->withErrors($validator)->withInput();
69 69
70 } else { 70 } else {
71 try { 71 try {
72 $user = User::create([ 72 $user = User::create([
73 'name' => $request->name, 73 'name' => $request->name,
74 'email' => $request->email, 74 'email' => $request->email,
75 'password' => Hash::make($request->password), 75 'password' => Hash::make($request->password),
76 'pubpassword' => base64_encode($request->password), 76 'pubpassword' => base64_encode($request->password),
77 'admin' => '1', 77 'admin' => '1',
78 'is_worker' => '0', 78 'is_worker' => '0',
79 'email_verified_at' => Carbon::now() 79 'email_verified_at' => Carbon::now()
80 ]); 80 ]);
81 } finally { 81 } finally {
82 $emp = Employer::create([ 82 $emp = Employer::create([
83 'name_company' => 'Администратор', 83 'name_company' => 'Администратор',
84 'user_id' => $user->id, 84 'user_id' => $user->id,
85 'code' => $request->code_emp 85 'code' => $request->code_emp
86 ]); 86 ]);
87 } 87 }
88 return redirect()->route('admin.login') 88 return redirect()->route('admin.login')
89 ->with('success', 'Вы успешно зарегистрировались'); 89 ->with('success', 'Вы успешно зарегистрировались');
90 } 90 }
91 } 91 }
92 92
93 public function login() { 93 public function login() {
94 return view('admin.login'); 94 return view('admin.login');
95 } 95 }
96 96
97 // Аутентификация 97 // Аутентификация
98 public function autenticate(Request $request) { 98 public function autenticate(Request $request) {
99 //$request->validate( 99 //$request->validate(
100 $rules = [ 100 $rules = [
101 'email' => 'required|string|email', 101 'email' => 'required|string|email',
102 'password' => 'required|string', 102 'password' => 'required|string',
103 ]; 103 ];
104 104
105 $messages = [ 105 $messages = [
106 'required' => 'Укажите обязательное поле «:attribute»', 106 'required' => 'Укажите обязательное поле «:attribute»',
107 'email' => 'Введите корректный email', 107 'email' => 'Введите корректный email',
108 'min' => [ 108 'min' => [
109 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 109 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
110 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 110 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
111 ], 111 ],
112 'max' => [ 112 'max' => [
113 'string' => 'Поле «:attribute» должно быть не больше :max символов', 113 'string' => 'Поле «:attribute» должно быть не больше :max символов',
114 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 114 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
115 ], 115 ],
116 ]; 116 ];
117 117
118 118
119 $validator = Validator::make($request->all(), $rules, $messages); 119 $validator = Validator::make($request->all(), $rules, $messages);
120 120
121 if ($validator->fails()) { 121 if ($validator->fails()) {
122 return back()->withErrors($validator)->withInput(); 122 return back()->withErrors($validator)->withInput();
123 123
124 } else { 124 } else {
125 125
126 $credentials = $request->only('email', 'password'); 126 $credentials = $request->only('email', 'password');
127 127
128 if (Auth::attempt($credentials, $request->has('remember'))) { 128 if (Auth::attempt($credentials, $request->has('remember'))) {
129 129
130 if (is_null(Auth::user()->email_verified_at)) { 130 if (is_null(Auth::user()->email_verified_at)) {
131 Auth::logout(); 131 Auth::logout();
132 return back()->withErrors('Адрес почты не подтвержден')->withInput(); 132 return back()->withErrors('Адрес почты не подтвержден')->withInput();
133 } 133 }
134 134
135 if (!Auth::user()->admin) { 135 if (!Auth::user()->admin) {
136 Auth::logout(); 136 Auth::logout();
137 return //redirect()->route('admin.login') 137 return //redirect()->route('admin.login')
138 back()->withErrors('Вы не являетесь админом!')->withInput();; 138 back()->withErrors('Вы не являетесь админом!')->withInput();;
139 139
140 } 140 }
141 141
142 return redirect() 142 return redirect()
143 ->route('admin.index') 143 ->route('admin.index')
144 ->with('success', 'Вы вошли в личный кабинет.'); 144 ->with('success', 'Вы вошли в личный кабинет.');
145 } 145 }
146 } 146 }
147 147
148 return redirect() 148 return redirect()
149 ->route('admin.login') 149 ->route('admin.login')
150 ->withErrors('Неверный логин или пароль!')->withInput(); 150 ->withErrors('Неверный логин или пароль!')->withInput();
151 151
152 } 152 }
153 153
154 public function logout() { 154 public function logout() {
155 Auth::logout(); 155 Auth::logout();
156 return redirect()->route('index') 156 return redirect()->route('index')
157 ->with('success', 'Вы вышли из личного кабинета'); 157 ->with('success', 'Вы вышли из личного кабинета');
158 } 158 }
159 159
160 public function index() { 160 public function index() {
161 $all_user = User::query()->count(); 161 $all_user = User::query()->count();
162 $all_employer = User::where('is_worker', '0')->count(); 162 $all_employer = User::where('is_worker', '0')->count();
163 $all_worker = User::where('is_worker', '1')->count(); 163 $all_worker = User::where('is_worker', '1')->count();
164 $all_admin = User::where('admin', '1')->count(); 164 $all_admin = User::where('admin', '1')->count();
165 return view('admin.index', compact('all_employer', 'all_user', 'all_worker', 'all_admin')); 165 return view('admin.index', compact('all_employer', 'all_user', 'all_worker', 'all_admin'));
166 } 166 }
167 167
168 public function index_admin(Request $request) { 168 public function index_admin(Request $request) {
169 $title = 'Админка - Администраторы системы'; 169 $title = 'Админка - Администраторы системы';
170 $id_admin = Auth::user()->id; 170 $id_admin = Auth::user()->id;
171 171
172 if ($request->ajax()) { 172 if ($request->ajax()) {
173 $user = User::find($request->id); 173 $user = User::find($request->id);
174 $request->offsetUnset('id'); 174 $request->offsetUnset('id');
175 $user->update($request->all()); 175 $user->update($request->all());
176 } 176 }
177 $find_key = ''; 177 $find_key = '';
178 $users = User::where('admin', '1'); 178 $users = User::where('admin', '1');
179 if (isset($request->find)) { 179 if (isset($request->find)) {
180 $find_key = $request->find; 180 $find_key = $request->find;
181 $users = $users->where(function($query) use($find_key) { 181 $users = $users->where(function($query) use($find_key) {
182 $query->Where('name', 'LIKE', "%$find_key%") 182 $query->Where('name', 'LIKE', "%$find_key%")
183 ->orWhere('email', 'LIKE', "%$find_key%"); 183 ->orWhere('email', 'LIKE', "%$find_key%");
184 }); 184 });
185 } 185 }
186 $users = $users->paginate(15); 186 $users = $users->paginate(15);
187 187
188 if ($request->ajax()) { 188 if ($request->ajax()) {
189 return view('admin.users.index_ajax', compact('users', 'id_admin')); 189 return view('admin.users.index_ajax', compact('users', 'id_admin'));
190 } else { 190 } else {
191 return view('admin.users.index', compact('users', 'title', 'id_admin', 'find_key')); 191 return view('admin.users.index', compact('users', 'title', 'id_admin', 'find_key'));
192 } 192 }
193 } 193 }
194 194
195 //Страница профиль пользователя - форма 195 //Страница профиль пользователя - форма
196 public function profile_user(User $user) { 196 public function profile_user(User $user) {
197 $visible = false; 197 $visible = false;
198 if($user->is_worker) { 198 if($user->is_worker) {
199 $caption = "Карточка работника"; 199 $caption = "Карточка работника";
200 if (isset($user->workers[0]->id)) { 200 if (isset($user->workers[0]->id)) {
201 $link = route('admin.worker-profile-edit', ['worker' => $user->workers[0]->id]); 201 $link = route('admin.worker-profile-edit', ['worker' => $user->workers[0]->id]);
202 $visible = true; 202 $visible = true;
203 } else { 203 } else {
204 $link = ""; 204 $link = "";
205 } 205 }
206 206
207 } else { 207 } else {
208 $caption = "Карточка работодателя"; 208 $caption = "Карточка работодателя";
209 if (isset($user->employers[0]->id)) { 209 if (isset($user->employers[0]->id)) {
210 210
211 $link = route('admin.employer-profile', ['employer' => $user->employers[0]->id]); 211 $link = route('admin.employer-profile', ['employer' => $user->employers[0]->id]);
212 $visible = true; 212 $visible = true;
213 } else { 213 } else {
214 $link = ""; 214 $link = "";
215 } 215 }
216 } 216 }
217 217
218 return view('admin.users.profile', compact('user', 'visible', 'link', 'caption')); 218 return view('admin.users.profile', compact('user', 'visible', 'link', 'caption'));
219 } 219 }
220 220
221 //Страница профиль пользователя - сохранение формы 221 //Страница профиль пользователя - сохранение формы
222 public function store_profile_user(User $user, Request $request) { 222 public function store_profile_user(User $user, Request $request) {
223 $rules = [ 223 $rules = [
224 'name' => 'required|min:3', 224 'name' => 'required|min:3',
225 ]; 225 ];
226 $messages = [ 226 $messages = [
227 'required' => 'Укажите обязательное поле', 227 'required' => 'Укажите обязательное поле',
228 'email' => 'Это поле должно быть определено, как Email' 228 'email' => 'Это поле должно быть определено, как Email'
229 ]; 229 ];
230 $validator = Validator::make($request->all(), $rules, $messages); 230 $validator = Validator::make($request->all(), $rules, $messages);
231 231
232 if ($validator->fails()) { 232 if ($validator->fails()) {
233 return redirect()->route('admin.user-profile', ['user' => $user->id]) 233 return redirect()->route('admin.user-profile', ['user' => $user->id])
234 ->withErrors($validator); 234 ->withErrors($validator);
235 } else { 235 } else {
236 $user->update($request->all()); 236 $user->update($request->all());
237 return redirect()->route('admin.user-profile', ['user' => $user->id]) 237 return redirect()->route('admin.user-profile', ['user' => $user->id])
238 ->with('success', 'Данные были успешно сохранены'); 238 ->with('success', 'Данные были успешно сохранены');
239 } 239 }
240 return redirect()->route('admin.user-profile', ['user' => $user->id]); 240 return redirect()->route('admin.user-profile', ['user' => $user->id]);
241 } 241 }
242 242
243 // Страница профиль админа - форма 243 // Страница профиль админа - форма
244 public function profile() { 244 public function profile() {
245 $id = Auth::user()->id; 245 $id = Auth::user()->id;
246 $user = User::find($id); 246 $user = User::find($id);
247 247
248 return view('admin.profile', compact('user')); 248 return view('admin.profile', compact('user'));
249 } 249 }
250 250
251 // Страница профиль админа - сохранение формы 251 // Страница профиль админа - сохранение формы
252 public function store_profile(Request $request) { 252 public function store_profile(Request $request) {
253 $id = Auth::user()->id; 253 $id = Auth::user()->id;
254 $user = User::find($id); 254 $user = User::find($id);
255 255
256 $rules = [ 256 $rules = [
257 'name' => 'required|min:3', 257 'name' => 'required|min:3',
258 'email' => 'required|email|min:3', 258 'email' => 'required|email|min:3',
259 ]; 259 ];
260 $messages = [ 260 $messages = [
261 'required' => 'Укажите обязательное поле', 261 'required' => 'Укажите обязательное поле',
262 'email' => 'Это поле должно быть определено, как Email' 262 'email' => 'Это поле должно быть определено, как Email'
263 ]; 263 ];
264 $validator = Validator::make($request->all(), $rules, $messages); 264 $validator = Validator::make($request->all(), $rules, $messages);
265 265
266 if ($validator->fails()) { 266 if ($validator->fails()) {
267 return redirect()->route('admin.profile') 267 return redirect()->route('admin.profile')
268 ->withErrors($validator); 268 ->withErrors($validator);
269 } else { 269 } else {
270 $user->update($request->all()); 270 $user->update($request->all());
271 return redirect()->route('admin.profile') 271 return redirect()->route('admin.profile')
272 ->with('success', 'Данные были успешно сохранены'); 272 ->with('success', 'Данные были успешно сохранены');
273 } 273 }
274 return redirect()->route('admin.profile'); 274 return redirect()->route('admin.profile');
275 } 275 }
276 276
277 // Форма смены пароля администоратора 277 // Форма смены пароля администоратора
278 public function profile_password() { 278 public function profile_password() {
279 $id = Auth::user()->id; 279 $id = Auth::user()->id;
280 $user = User::find($id); 280 $user = User::find($id);
281 $username = $user->name; 281 $username = $user->name;
282 282
283 return view('admin.password', compact('username')); 283 return view('admin.password', compact('username'));
284 } 284 }
285 285
286 // Сохранение формы смены пароля администоратора 286 // Сохранение формы смены пароля администоратора
287 public function profile_password_new(Request $request) { 287 public function profile_password_new(Request $request) {
288 288
289 $rules = [ 289 $rules = [
290 'old_password' => 'required|min:6', //|current_password:api', 290 'old_password' => 'required|min:6', //|current_password:api',
291 'password' => 'required|min:6|confirmed', 291 'password' => 'required|min:6|confirmed',
292 ]; 292 ];
293 $messages = [ 293 $messages = [
294 'required' => 'Укажите обязательное поле', 294 'required' => 'Укажите обязательное поле',
295 'confirmed' => 'Пароли не совпадают' 295 'confirmed' => 'Пароли не совпадают'
296 ]; 296 ];
297 297
298 $validator = Validator::make($request->all(), $rules, $messages); 298 $validator = Validator::make($request->all(), $rules, $messages);
299 299
300 if (! Hash::check($request->old_password, $request->user()->password)) { 300 if (! Hash::check($request->old_password, $request->user()->password)) {
301 return back()->withErrors([ 301 return back()->withErrors([
302 'old_password' => ['Неверный предыдущий пароль'] 302 'old_password' => ['Неверный предыдущий пароль']
303 ]); 303 ]);
304 } 304 }
305 305
306 if ($validator->fails()) { 306 if ($validator->fails()) {
307 return redirect()->route('admin.password') 307 return redirect()->route('admin.password')
308 ->withErrors($validator); 308 ->withErrors($validator);
309 } else { 309 } else {
310 $params = $request->all(); 310 $params = $request->all();
311 // устанавливаем новый пароль для пользователя 311 // устанавливаем новый пароль для пользователя
312 User::where('id', Auth::id()) 312 User::where('id', Auth::id())
313 ->update(['password' => Hash::make($request->password)]); 313 ->update(['password' => Hash::make($request->password)]);
314 session()->flash('success', 'Успешно изменен пароль!'); 314 session()->flash('success', 'Успешно изменен пароль!');
315 315
316 return redirect()->route('admin.password'); 316 return redirect()->route('admin.password');
317 } 317 }
318 } 318 }
319 319
320 // Страница конфигурация сайта - форма 320 // Страница конфигурация сайта - форма
321 public function config_form() { 321 public function config_form() {
322 $config = Company::find(1); 322 $config = Company::find(1);
323 return view('admin.config', compact('config')); 323 return view('admin.config', compact('config'));
324 } 324 }
325 325
326 // Страница конфигурация сайта - сохранение формы 326 // Страница конфигурация сайта - сохранение формы
327 public function store_config(CompanyRequest $request) { 327 public function store_config(CompanyRequest $request) {
328 $config = Company::find(1); 328 $config = Company::find(1);
329 329
330 $params = $request->all(); 330 $params = $request->all();
331 unset($params['logo']); 331 unset($params['logo']);
332 unset($params['image']); 332 unset($params['image']);
333 333
334 if ($request->has('logo')) { 334 if ($request->has('logo')) {
335 Storage::delete($config->logo); 335 Storage::delete($config->logo);
336 $params['logo'] = $request->file('logo')->store('config', 'public'); 336 $params['logo'] = $request->file('logo')->store('config', 'public');
337 } 337 }
338 338
339 if ($request->has('image')) { 339 if ($request->has('image')) {
340 Storage::delete($config->image); 340 Storage::delete($config->image);
341 $params['image'] = $request->file('image')->store('config', 'public'); 341 $params['image'] = $request->file('image')->store('config', 'public');
342 } 342 }
343 343
344 if (is_null($config)) { 344 if (is_null($config)) {
345 Company::create($params); 345 Company::create($params);
346 } else { 346 } else {
347 $config->update($params); 347 $config->update($params);
348 } 348 }
349 349
350 return redirect()->route('admin.config'); 350 return redirect()->route('admin.config');
351 } 351 }
352 352
353 public function position() { 353 public function position() {
354 $Positions = Positions::query()->get(); 354 $Positions = Positions::query()->get();
355 return view('admin.positions.position', compact('Positions')); 355 return view('admin.positions.position', compact('Positions'));
356 } 356 }
357 357
358 public function position_add() { 358 public function position_add() {
359 return view('admin.positions.add'); 359 return view('admin.positions.add');
360 } 360 }
361 361
362 public function position_add_save(RequestPosition $request) { 362 public function position_add_save(RequestPosition $request) {
363 $all = $request->all(); 363 $all = $request->all();
364 $position = Positions::create($all); 364 $position = Positions::create($all);
365 return redirect()->route('admin.position'); 365 return redirect()->route('admin.position');
366 } 366 }
367 367
368 public function position_edit(Positions $position) { 368 public function position_edit(Positions $position) {
369 return view('admin.positions.edit', compact('position')); 369 return view('admin.positions.edit', compact('position'));
370 } 370 }
371 371
372 public function position_update(Positions $position, RequestPosition $request) { 372 public function position_update(Positions $position, RequestPosition $request) {
373 $all = $request->all(); 373 $all = $request->all();
374 unset($all['_token']); 374 unset($all['_token']);
375 $status = $position->update($all); 375 $status = $position->update($all);
376 return redirect()->route('admin.position'); 376 return redirect()->route('admin.position');
377 } 377 }
378 378
379 public function position_delete(Positions $position) { 379 public function position_delete(Positions $position) {
380 $position->delete(); 380 $position->delete();
381 return redirect()->route('admin.position'); 381 return redirect()->route('admin.position');
382 } 382 }
383 383
384 public function news_admin() { 384 public function news_admin() {
385 $news = News::query()->paginate(10); 385 $news = News::query()->paginate(10);
386 return view('admin.news.list', compact('news')); 386 return view('admin.news.list', compact('news'));
387 } 387 }
388 388
389 public function new_admin_add() { 389 public function new_admin_add() {
390 return view('admin.news.add'); 390 return view('admin.news.add');
391 } 391 }
392 392
393 public function new_admin_add_save(RequestAdminNews $request) { 393 public function new_admin_add_save(RequestAdminNews $request) {
394 $params = $request->all(); 394 $params = $request->all();
395 if ($request->has('image')) { 395 if ($request->has('image')) {
396 $params['image'] = $request->file('image')->store('news', 'public'); 396 $params['image'] = $request->file('image')->store('news', 'public');
397 } 397 }
398 398
399 News::create($params); 399 News::create($params);
400 return redirect()->route('admin.news_admin'); 400 return redirect()->route('admin.news_admin');
401 } 401 }
402 402
403 public function new_admin_edit(News $new) { 403 public function new_admin_edit(News $new) {
404 // Вернуть все 404 // Вернуть все
405 return view('admin.news.edit', compact('new')); 405 return view('admin.news.edit', compact('new'));
406 } 406 }
407 407
408 public function new_admin_update_save(RequestAdminNews $request, News $new) { 408 public function new_admin_update_save(RequestAdminNews $request, News $new) {
409 $params = $request->all(); 409 $params = $request->all();
410
410 if ($request->has('image')) { 411 if ($request->has('image')) {
411 if (!empty($request->get('image'))) {
412 $params['image'] = $request->file('image')->store('news', 'public'); 412 $params['image'] = $request->file('image')->store('news', 'public');
413 } else { 413 } else {
414 if (!empty($new->image)) 414 if (!empty($new->image))
415 $params['image'] = $new->image; 415 $params['image'] = $new->image;
416 else
417 unset($params['image']);
418 }
419 } 416 }
417
420 $new->update($params); 418 $new->update($params);
421 return redirect()->route('admin.news_admin'); 419 return redirect()->route('admin.news_admin');
422 } 420 }
423 421
424 public function new_admin_delete(News $new) 422 public function new_admin_delete(News $new)
425 { 423 {
426 $new->delete(); 424 $new->delete();
427 return redirect()->route('admin.news_admin'); 425 return redirect()->route('admin.news_admin');
428 } 426 }
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\FlotRequest; 7 use App\Http\Requests\FlotRequest;
8 use App\Http\Requests\MessagesRequiest; 8 use App\Http\Requests\MessagesRequiest;
9 use App\Http\Requests\VacancyRequestEdit; 9 use App\Http\Requests\VacancyRequestEdit;
10 use App\Http\Requests\VacansiaRequiest; 10 use App\Http\Requests\VacansiaRequiest;
11 use App\Mail\MailSotrudnichestvo; 11 use App\Mail\MailSotrudnichestvo;
12 use App\Mail\SendAllMessages; 12 use App\Mail\SendAllMessages;
13 use App\Models\Ad_employer; 13 use App\Models\Ad_employer;
14 use App\Models\Ad_jobs; 14 use App\Models\Ad_jobs;
15 use App\Models\ad_response; 15 use App\Models\ad_response;
16 use App\Models\Category; 16 use App\Models\Category;
17 use App\Models\Education; 17 use App\Models\Education;
18 use App\Models\Employer; 18 use App\Models\Employer;
19 use App\Models\employers_main; 19 use App\Models\employers_main;
20 use App\Models\Flot; 20 use App\Models\Flot;
21 use App\Models\Job_title; 21 use App\Models\Job_title;
22 use App\Models\Like_vacancy; 22 use App\Models\Like_vacancy;
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\Positions; 25 use App\Models\Positions;
26 use App\Models\Worker; 26 use App\Models\Worker;
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\Database\Eloquent\Model; 30 use Illuminate\Database\Eloquent\Model;
31 use Illuminate\Foundation\Auth\User; 31 use Illuminate\Foundation\Auth\User;
32 use Illuminate\Http\Request; 32 use Illuminate\Http\Request;
33 use Illuminate\Support\Facades\Auth; 33 use Illuminate\Support\Facades\Auth;
34 use Illuminate\Support\Facades\Hash; 34 use Illuminate\Support\Facades\Hash;
35 use Illuminate\Support\Facades\Mail; 35 use Illuminate\Support\Facades\Mail;
36 use Illuminate\Support\Facades\Storage; 36 use Illuminate\Support\Facades\Storage;
37 use App\Models\User as User_Model; 37 use App\Models\User as User_Model;
38 use Illuminate\Support\Facades\Validator; 38 use Illuminate\Support\Facades\Validator;
39 39
40 class EmployerController extends Controller 40 class EmployerController extends Controller
41 { 41 {
42 public function vacancie($vacancy, Request $request) { 42 public function vacancie($vacancy, Request $request) {
43 $title = 'Заголовок вакансии'; 43 $title = 'Заголовок вакансии';
44 $Query = Ad_employer::with('jobs')-> 44 $Query = Ad_employer::with('jobs')->
45 with('cat')-> 45 with('cat')->
46 with('employer')-> 46 with('employer')->
47 with('jobs_code')-> 47 with('jobs_code')->
48 select('ad_employers.*')-> 48 select('ad_employers.*')->
49 where('id', '=', $vacancy)->get(); 49 where('id', '=', $vacancy)->get();
50 50
51 if (isset(Auth()->user()->id)) 51 if (isset(Auth()->user()->id))
52 $uid = Auth()->user()->id; 52 $uid = Auth()->user()->id;
53 else 53 else
54 $uid = 0; 54 $uid = 0;
55 $title = $Query[0]->name; 55 $title = $Query[0]->name;
56 if ($request->ajax()) { 56 if ($request->ajax()) {
57 return view('ajax.vacance-item', compact('Query','uid')); 57 return view('ajax.vacance-item', compact('Query','uid'));
58 } else { 58 } else {
59 return view('vacance-item', compact('title', 'Query', 'uid')); 59 return view('vacance-item', compact('title', 'Query', 'uid'));
60 } 60 }
61 } 61 }
62 62
63 public function logout() { 63 public function logout() {
64 Auth::logout(); 64 Auth::logout();
65 return redirect()->route('index') 65 return redirect()->route('index')
66 ->with('success', 'Вы вышли из личного кабинета'); 66 ->with('success', 'Вы вышли из личного кабинета');
67 } 67 }
68 68
69 public function cabinet() { 69 public function cabinet() {
70 $id = Auth()->user()->id; 70 $id = Auth()->user()->id;
71 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 71 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
72 WhereHas('users', 72 WhereHas('users',
73 function (Builder $query) use ($id) {$query->Where('id', $id); 73 function (Builder $query) use ($id) {$query->Where('id', $id);
74 })->get(); 74 })->get();
75 return view('employers.cabinet45', compact('Employer')); 75 return view('employers.cabinet45', compact('Employer'));
76 } 76 }
77 77
78 public function slider_flot() { 78 public function slider_flot() {
79 $id = Auth()->user()->id; 79 $id = Auth()->user()->id;
80 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 80 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
81 WhereHas('users', 81 WhereHas('users',
82 function (Builder $query) use ($id) {$query->Where('id', $id); 82 function (Builder $query) use ($id) {$query->Where('id', $id);
83 })->get(); 83 })->get();
84 return view('employers.fly-flot', compact('Employer')); 84 return view('employers.fly-flot', compact('Employer'));
85 } 85 }
86 86
87 public function cabinet_save(Employer $Employer, Request $request) { 87 public function cabinet_save(Employer $Employer, Request $request) {
88 $params = $request->all(); 88 $params = $request->all();
89 $params['user_id'] = Auth()->user()->id; 89 $params['user_id'] = Auth()->user()->id;
90 $id = $Employer->id; 90 $id = $Employer->id;
91 91
92 if ($request->has('logo')) { 92 if ($request->has('logo')) {
93 if (!empty($Employer->logo)) { 93 if (!empty($Employer->logo)) {
94 Storage::delete($Employer->logo); 94 Storage::delete($Employer->logo);
95 } 95 }
96 $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); 96 $params['logo'] = $request->file('logo')->store("employer/$id", 'public');
97 } 97 }
98 98
99 $Employer->update($params); 99 $Employer->update($params);
100 100
101 return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); 101 return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены');
102 } 102 }
103 103
104 public function save_add_flot(FlotRequest $request) { 104 public function save_add_flot(FlotRequest $request) {
105 // отмена 105 // отмена
106 $params = $request->all(); 106 $params = $request->all();
107 107
108 if ($request->has('image')) { 108 if ($request->has('image')) {
109 $params['image'] = $request->file('image')->store("flot", 'public'); 109 $params['image'] = $request->file('image')->store("flot", 'public');
110 } 110 }
111 Flot::create($params); 111 Flot::create($params);
112 $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); 112 $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get();
113 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); 113 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен');
114 } 114 }
115 115
116 public function delete_flot(Flot $Flot) { 116 public function delete_flot(Flot $Flot) {
117 $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); 117 $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get();
118 118
119 if (isset($Flot->id)) $Flot->delete(); 119 if (isset($Flot->id)) $Flot->delete();
120 return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); 120 return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален');
121 } 121 }
122 122
123 // Форма добавления вакансий 123 // Форма добавления вакансий
124 public function cabinet_vacancie() { 124 public function cabinet_vacancie() {
125 $id = Auth()->user()->id; 125 $id = Auth()->user()->id;
126 126
127 $categories = Category::query()->active()->get(); 127 $categories = Category::query()->active()->get();
128 128
129 $Positions = Category::query()->active()->get(); 129 $Positions = Category::query()->active()->get();
130 130
131 if ($Positions->count()) { 131 if ($Positions->count()) {
132 $jobs = Job_title::query()->OrderBy('name')->where('position_id', $Positions[0]->id)->get(); 132 $jobs = Job_title::query()->OrderBy('name')->Notbdif()->where('position_id', $Positions[0]->id)->get();
133 } else { 133 } else {
134 $jobs = Job_title::query()->OrderBy('name')->where('position_id', 0)->get(); 134 $jobs = Job_title::query()->OrderBy('name')->Notbdif()->where('position_id', 0)->get();
135 } 135 }
136 136
137 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 137 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
138 WhereHas('users', 138 WhereHas('users',
139 function (Builder $query) use ($id) {$query->Where('id', $id); 139 function (Builder $query) use ($id) {$query->Where('id', $id);
140 })->get(); 140 })->get();
141 141
142 return view('employers.add_vacancy', compact('Employer', 'jobs' , 'categories', 'Positions')); 142 return view('employers.add_vacancy', compact('Employer', 'jobs' , 'categories', 'Positions'));
143 } 143 }
144 144
145 // Сохранение вакансии 145 // Сохранение вакансии
146 public function cabinet_vacancy_save1(VacancyRequestEdit $request) { 146 public function cabinet_vacancy_save1(VacancyRequestEdit $request) {
147 $params = $request->all(); 147 $params_emp = $request->all();
148 $params_job["job_title_id"] = $params_emp['job_title_id'];
149 $params_job["min_salary"] = $params_emp['min_salary'];
150 $params_job["max_salary"] = $params_emp['max_salary'];
151 $params_job["region"] = $params_emp['region'];
152 $params_job["power"] = $params_emp['power'];
153 $params_job["sytki"] = $params_emp['sytki'];
154 $params_job["start"] = $params_emp['start'];
155 $params_job["flot"] = $params_emp['flot'];
156 $params_job["description"] = $params_emp['description'];
157
158 $ad_jobs = Ad_employer::create($params_emp);
148 $ad_jobs = Ad_employer::create($params); 159 $params_job['ad_employer_id'] = $ad_jobs->id;
149 return redirect()->route('employer.vacancy_list'); 160 Ad_jobs::create($params_job);
150 } 161 return redirect()->route('employer.vacancy_list');
151 162 }
152 // Список вакансий 163
153 public function vacancy_list(Request $request) { 164 // Список вакансий
154 $id = Auth()->user()->id; 165 public function vacancy_list(Request $request) {
155 $Employer = Employer::query()->where('user_id', $id)->first(); 166 $id = Auth()->user()->id;
156 $vacancy_list = Ad_employer::query()->with('jobs')->with('jobs_code')->where('employer_id', $Employer->id); 167 $Employer = Employer::query()->where('user_id', $id)->first();
168 $vacancy_list = Ad_employer::query()->with('jobs')->
157 169 with('jobs_code')->
158 170 where('employer_id', $Employer->id);
159 if ($request->get('sort')) { 171
160 $sort = $request->get('sort'); 172 if ($request->get('sort')) {
161 switch ($sort) { 173 $sort = $request->get('sort');
162 case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; 174 switch ($sort) {
163 case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; 175 case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break;
164 case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; 176 case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break;
165 case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; 177 case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break;
166 case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; 178 case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break;
167 default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; 179 case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break;
168 } 180 default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break;
169 } 181 }
170 $vacancy_list = $vacancy_list->paginate(4); 182 }
171 183 $vacancy_list = $vacancy_list->paginate(4);
172 //ajax 184
173 if ($request->ajax()) { 185 //ajax
174 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); 186 if ($request->ajax()) {
175 } else { 187 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer'));
176 return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); 188 } else {
177 } 189 return view('employers.list_vacancy', compact('vacancy_list', 'Employer'));
178 } 190 }
179 191 }
180 // Карточка вакансии 192
181 public function vacancy_edit(Ad_employer $ad_employer) { 193 // Карточка вакансии
182 $id = Auth()->user()->id; 194 public function vacancy_edit(Ad_employer $ad_employer) {
183 195 $id = Auth()->user()->id;
184 $Positions = Category::query()->active()->get(); 196
185 if ($Positions->count()) { 197 $Positions = Category::query()->active()->get();
186 $jobs = Job_title::query()->OrderBy('name')->where('position_id', $Positions[0]->id)->get(); 198 if ($Positions->count()) {
187 } else { 199 $jobs = Job_title::query()->OrderBy('name')->where('position_id', $Positions[0]->id)->get();
188 $jobs = Job_title::query()->OrderBy('name')->where('position_id', 0)->get(); 200 } else {
189 } 201 $jobs = Job_title::query()->OrderBy('name')->where('position_id', 0)->get();
190 202 }
191 $categories = Category::query()->get(); 203
192 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 204 $categories = Category::query()->get();
193 where('user_id', $id)->first(); 205 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
194 206 where('user_id', $id)->first();
195 return view('employers.edit_vacancy', compact('ad_employer', 'Positions', 'categories','Employer', 'jobs')); 207
196 } 208 return view('employers.edit_vacancy', compact('ad_employer', 'Positions', 'categories','Employer', 'jobs'));
197 209 }
198 // Сохранение-редактирование записи 210
199 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { 211 // Сохранение-редактирование записи
200 $params = $request->all(); 212 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) {
201 213 $params = $request->all();
202 //$jobs['flot'] = $params['flot']; 214
203 //$jobs['job_title_id'] = $params['job_title_id']; 215 //$jobs['flot'] = $params['flot'];
204 //$titles['position_id'] = $params['position_id']; 216 //$jobs['job_title_id'] = $params['job_title_id'];
205 //unset($params['job_title_id']); 217 //$titles['position_id'] = $params['position_id'];
206 218 //unset($params['job_title_id']);
207 $ad_employer->update($params); 219
208 220 $ad_employer->update($params);
209 //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> 221
210 // where('ad_employer_id', $ad_employer->id)->first(); 222 //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])->
211 //$data = Ad_jobs::find($job_->id); 223 // where('ad_employer_id', $ad_employer->id)->first();
212 //$ad_jobs = $data->update($jobs); 224 //$data = Ad_jobs::find($job_->id);
213 return redirect()->route('employer.vacancy_list'); 225 //$ad_jobs = $data->update($jobs);
214 } 226 return redirect()->route('employer.vacancy_list');
215 227 }
216 // Сохранение карточки вакансии 228
217 public function vacancy_save(Request $request, Ad_employer $ad_employer) { 229 // Сохранение карточки вакансии
218 $all = $request->all(); 230 public function vacancy_save(Request $request, Ad_employer $ad_employer) {
219 $ad_employer->update($all); 231 $all = $request->all();
220 return redirect()->route('employer.cabinet_vacancie'); 232 $ad_employer->update($all);
221 } 233 return redirect()->route('employer.cabinet_vacancie');
222 234 }
223 // Удаление карточки вакансии 235
224 public function vacancy_delete(Ad_employer $ad_employer) { 236 // Удаление карточки вакансии
225 $ad_employer->delete(); 237 public function vacancy_delete(Ad_employer $ad_employer) {
226 238 $ad_employer->delete();
227 return redirect()->route('employer.vacancy_list') 239
228 ->with('success', 'Данные были успешно сохранены'); 240 return redirect()->route('employer.vacancy_list')
229 } 241 ->with('success', 'Данные были успешно сохранены');
230 242 }
231 // Обновление даты 243
232 public function vacancy_up(Ad_employer $ad_employer) { 244 // Обновление даты
233 $up = date('m/d/Y h:i:s', time());; 245 public function vacancy_up(Ad_employer $ad_employer) {
234 $vac_emp = Ad_employer::findOrFail($ad_employer->id); 246 $up = date('m/d/Y h:i:s', time());;
235 $vac_emp->updated_at = $up; 247 $vac_emp = Ad_employer::findOrFail($ad_employer->id);
236 $vac_emp->save(); 248 $vac_emp->updated_at = $up;
237 249 $vac_emp->save();
238 return redirect()->route('employer.vacancy_list'); 250
239 // начало конца 251 return redirect()->route('employer.vacancy_list');
240 } 252 // начало конца
241 253 }
242 //Видимость вакансии 254
243 public function vacancy_eye(Ad_employer $ad_employer, $status) { 255 //Видимость вакансии
244 $vac_emp = Ad_employer::findOrFail($ad_employer->id); 256 public function vacancy_eye(Ad_employer $ad_employer, $status) {
245 $vac_emp->active_is = $status; 257 $vac_emp = Ad_employer::findOrFail($ad_employer->id);
246 $vac_emp->save(); 258 $vac_emp->active_is = $status;
247 259 $vac_emp->save();
248 return redirect()->route('employer.vacancy_list'); 260
249 } 261 return redirect()->route('employer.vacancy_list');
250 262 }
251 //Вакансия редактирования (шаблон) 263
252 public function vacancy_update(Ad_employer $id) { 264 //Вакансия редактирования (шаблон)
253 265 public function vacancy_update(Ad_employer $id) {
254 } 266
255 267 }
256 //Отклики на вакансию - лист 268
257 public function answers(Employer $employer, Request $request) { 269 //Отклики на вакансию - лист
258 $user_id = Auth()->user()->id; 270 public function answers(Employer $employer, Request $request) {
259 $answer = Ad_employer::query()->where('employer_id', $employer->id); 271 $user_id = Auth()->user()->id;
260 if ($request->has('search')) { 272 $answer = Ad_employer::query()->where('employer_id', $employer->id);
261 $search = trim($request->get('search')); 273 if ($request->has('search')) {
262 if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); 274 $search = trim($request->get('search'));
263 } 275 if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%");
264 276 }
265 $answer = $answer->with('response')->get(); 277
266 278 $answer = $answer->with('response')->get();
267 return view('employers.list_answer', compact('answer', 'user_id', 'employer')); 279
268 } 280 return view('employers.list_answer', compact('answer', 'user_id', 'employer'));
269 281 }
270 //Обновление статуса 282
271 public function supple_status(employer $employer, ad_response $ad_response, $flag) { 283 //Обновление статуса
272 $ad_response->update(Array('flag' => $flag)); 284 public function supple_status(employer $employer, ad_response $ad_response, $flag) {
273 return redirect()->route('employer.answers', ['employer' => $employer->id]); 285 $ad_response->update(Array('flag' => $flag));
274 } 286 return redirect()->route('employer.answers', ['employer' => $employer->id]);
275 287 }
276 //Страницы сообщений список 288
277 public function messages($type_message) { 289 //Страницы сообщений список
278 $user_id = Auth()->user()->id; 290 public function messages($type_message) {
279 291 $user_id = Auth()->user()->id;
280 $messages_input = Message::query()->with('vacancies')->with('user_from')-> 292
281 Where('to_user_id', $user_id)->OrderByDesc('created_at'); 293 $messages_input = Message::query()->with('vacancies')->with('user_from')->
282 294 Where('to_user_id', $user_id)->OrderByDesc('created_at');
283 $messages_output = Message::query()->with('vacancies')-> 295
284 with('user_to')->where('user_id', $user_id)-> 296 $messages_output = Message::query()->with('vacancies')->
285 OrderByDesc('created_at'); 297 with('user_to')->where('user_id', $user_id)->
286 298 OrderByDesc('created_at');
287 299
288 $count_input = $messages_input->count(); 300
289 $count_output = $messages_output->count(); 301 $count_input = $messages_input->count();
290 302 $count_output = $messages_output->count();
291 if ($type_message == 'input') { 303
292 $messages = $messages_input->paginate(15); 304 if ($type_message == 'input') {
293 } 305 $messages = $messages_input->paginate(15);
294 306 }
295 if ($type_message == 'output') { 307
296 $messages = $messages_output->paginate(15); 308 if ($type_message == 'output') {
297 } 309 $messages = $messages_output->paginate(15);
298 310 }
299 return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); 311
300 } 312 return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id'));
301 313 }
302 // Диалог между пользователями 314
303 public function dialog(User_Model $user1, User_Model $user2) { 315 // Диалог между пользователями
304 if (isset($user2->id)) { 316 public function dialog(User_Model $user1, User_Model $user2) {
305 $companion = User_Model::query()->with('workers')-> 317 if (isset($user2->id)) {
306 with('employers')-> 318 $companion = User_Model::query()->with('workers')->
307 where('id', $user2->id)->first(); 319 with('employers')->
308 } 320 where('id', $user2->id)->first();
309 321 }
310 $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) { 322
311 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); 323 $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) {
312 })->orWhere(function($query) use ($user1, $user2) { 324 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id);
313 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); 325 })->orWhere(function($query) use ($user1, $user2) {
314 })->OrderBy('created_at')->get(); 326 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id);
315 327 })->OrderBy('created_at')->get();
316 $id_vac = null; 328
317 foreach ($Messages as $it) { 329 $id_vac = null;
318 if (isset($it->response)) { 330 foreach ($Messages as $it) {
319 foreach ($it->response as $r) { 331 if (isset($it->response)) {
320 if (isset($r->ad_employer_id)) { 332 foreach ($it->response as $r) {
321 $id_vac = $r->ad_employer_id; 333 if (isset($r->ad_employer_id)) {
322 break; 334 $id_vac = $r->ad_employer_id;
323 } 335 break;
324 } 336 }
325 } 337 }
326 if (!is_null($id_vac)) break; 338 }
327 } 339 if (!is_null($id_vac)) break;
328 340 }
329 $ad_employer = null; 341
330 if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); 342 $ad_employer = null;
331 $sender = $user1; 343 if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first();
332 344 $sender = $user1;
333 return view('employers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); 345
334 } 346 return view('employers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer'));
335 347 }
336 // Регистрация работодателя 348
337 public function register_employer(Request $request) { 349 // Регистрация работодателя
338 $params = $request->all(); 350 public function register_employer(Request $request) {
339 351 $params = $request->all();
340 $rules = [ 352
341 //'surname' => ['required', 'string', 'max:255'], 353 $rules = [
342 //'name_man' => ['required', 'string', 'max:255'], 354 //'surname' => ['required', 'string', 'max:255'],
343 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 355 //'name_man' => ['required', 'string', 'max:255'],
344 'name_company' => ['required', 'string', 'max:255'], 356 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
345 'password' => ['required', 'string', 'min:8'], 357 'name_company' => ['required', 'string', 'max:255'],
346 ]; 358 'password' => ['required', 'string', 'min:8'],
347 359 ];
348 360
349 $messages = [ 361
350 'required' => 'Укажите обязательное поле', 362 $messages = [
351 'min' => [ 363 'required' => 'Укажите обязательное поле',
352 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 364 'min' => [
353 'integer' => 'Поле «:attribute» должно быть :min или больше', 365 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
354 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 366 'integer' => 'Поле «:attribute» должно быть :min или больше',
355 ], 367 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
356 'max' => [ 368 ],
357 'string' => 'Поле «:attribute» должно быть не больше :max символов', 369 'max' => [
358 'integer' => 'Поле «:attribute» должно быть :max или меньше', 370 'string' => 'Поле «:attribute» должно быть не больше :max символов',
359 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 371 'integer' => 'Поле «:attribute» должно быть :max или меньше',
360 ] 372 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
361 ]; 373 ]
374 ];
375
376 $email = $request->get('email');
377 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) {
378 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл"));
362 379 }
363 if ($request->get('password') !== $request->get('confirmed')){ 380
364 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); 381 if ($request->get('password') !== $request->get('confirmed')){
365 } 382 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля"));
383 }
384
385 if (strlen($request->get('password')) < 8) {
386 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!"));
387 }
388
389 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?');
390 $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z',
391 'X', 'C', 'V', 'B', 'N', 'M');
392 $spec_bool = false;
393 $alpha_bool = false;
394
395 $haystack = $request->get('password');
396
397 foreach ($specsumbol as $it) {
398 if (strpos($haystack, $it) !== false) {
399 $spec_bool = true;
400 }
401 }
402
403 foreach ($alpha as $it) {
404 if (strpos($haystack, $it) !== false) {
405 $alpha_bool = true;
406 }
407 }
408
409 if ((!$spec_bool) || (!$alpha_bool)) {
410 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?"));
366 411 }
367 if (empty($request->get('surname'))) { 412
368 $params['surname'] = 'Неизвестно'; 413 if (empty($request->get('surname'))) {
369 }
370 414 $params['surname'] = 'Неизвестно';
371 if (empty($request->get('name_man'))) { 415 }
372 $params['name_man'] = 'Неизвестно'; 416 if (empty($request->get('name_man'))) {
373 }
374 417 $params['name_man'] = 'Неизвестно';
375 $validator = Validator::make($params, $rules, $messages); 418 }
376 419 $validator = Validator::make($params, $rules, $messages);
377 if ($validator->fails()) { 420
378 return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); 421 if ($validator->fails()) {
379 } else { 422 return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе."));
380 $user = $this->create($params); 423 } else {
381 event(new Registered($user));
382 424 $user = $this->create($params);
383 Auth::guard()->login($user); 425 event(new Registered($user));
426 Auth::guard()->login($user);
384 } 427 }
385 if ($user) { 428
386 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; 429 if ($user) {
387 } else { 430 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));;
388 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); 431 } else {
389 } 432 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!"));
390 } 433 }
391 434 }
392 // Создание пользователя 435
393 protected function create(array $data) 436 // Создание пользователя
394 { 437 protected function create(array $data)
395 $Use = new User_Model(); 438 {
396 $Code_user = $Use->create([ 439 $Use = new User_Model();
397 'name' => $data['surname']." ".$data['name_man'], 440 $Code_user = $Use->create([
398 'name_man' => $data['name_man'], 441 'name' => $data['surname']." ".$data['name_man'],
399 'surname' => $data['surname'], 442 'name_man' => $data['name_man'],
400 'surname2' => $data['surname2'], 443 'surname' => $data['surname'],
401 'subscribe_email' => $data['email'], 444 'surname2' => $data['surname2'],
402 'email' => $data['email'], 445 'subscribe_email' => $data['email'],
403 'telephone' => $data['telephone'], 446 'email' => $data['email'],
404 'is_worker' => 0, 447 'telephone' => $data['telephone'],
405 'password' => Hash::make($data['password']), 448 'is_worker' => 0,
406 'pubpassword' => base64_encode($data['password']), 449 'password' => Hash::make($data['password']),
407 'email_verified_at' => Carbon::now() 450 'pubpassword' => base64_encode($data['password']),
408 ]); 451 'email_verified_at' => Carbon::now()
409 452 ]);
410 if ($Code_user->id > 0) { 453
411 $Employer = new Employer(); 454 if ($Code_user->id > 0) {
412 $Employer->user_id = $Code_user->id; 455 $Employer = new Employer();
413 $Employer->name_company = $data['name_company']; 456 $Employer->user_id = $Code_user->id;
414 $Employer->email = $data['email']; 457 $Employer->name_company = $data['name_company'];
415 $Employer->telephone = $data['telephone']; 458 $Employer->email = $data['email'];
416 $Employer->code = Tools::generator_id(10); 459 $Employer->telephone = $data['telephone'];
417 $Employer->save(); 460 $Employer->code = Tools::generator_id(10);
418 461 $Employer->save();
419 return $Code_user; 462
420 } 463 return $Code_user;
421 } 464 }
422 465 }
423 // Отправка сообщения от работодателя 466
424 public function send_message(MessagesRequiest $request) { 467 // Отправка сообщения от работодателя
425 $params = $request->all(); 468 public function send_message(MessagesRequiest $request) {
426 dd($params); 469 $params = $request->all();
427 $user1 = $params['user_id']; 470 dd($params);
428 $user2 = $params['to_user_id']; 471 $user1 = $params['user_id'];
429 472 $user2 = $params['to_user_id'];
430 if ($request->has('file')) { 473
431 $params['file'] = $request->file('file')->store("messages", 'public'); 474 if ($request->has('file')) {
432 } 475 $params['file'] = $request->file('file')->store("messages", 'public');
433 Message::create($params); 476 }
434 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); 477 Message::create($params);
435 } 478 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
436 479 }
437 public function test123(Request $request) { 480
438 $params = $request->all(); 481 public function test123(Request $request) {
439 $user1 = $params['user_id']; 482 $params = $request->all();
440 $user2 = $params['to_user_id']; 483 $user1 = $params['user_id'];
441 484 $user2 = $params['to_user_id'];
442 $rules = [ 485
443 'text' => 'required|min:1|max:150000', 486 $rules = [
444 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' 487 'text' => 'required|min:1|max:150000',
445 ]; 488 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000'
446 $messages = [ 489 ];
447 'required' => 'Укажите обязательное поле', 490 $messages = [
448 'min' => [ 491 'required' => 'Укажите обязательное поле',
449 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 492 'min' => [
450 'integer' => 'Поле «:attribute» должно быть :min или больше', 493 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
451 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 494 'integer' => 'Поле «:attribute» должно быть :min или больше',
452 ], 495 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
453 'max' => [ 496 ],
454 'string' => 'Поле «:attribute» должно быть не больше :max символов', 497 'max' => [
455 'integer' => 'Поле «:attribute» должно быть :max или меньше', 498 'string' => 'Поле «:attribute» должно быть не больше :max символов',
456 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 499 'integer' => 'Поле «:attribute» должно быть :max или меньше',
457 ] 500 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
458 ]; 501 ]
459 502 ];
460 $validator = Validator::make($request->all(), $rules, $messages); 503
461 504 $validator = Validator::make($request->all(), $rules, $messages);
462 if ($validator->fails()) { 505
463 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) 506 if ($validator->fails()) {
464 ->withErrors($validator); 507 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2])
465 } else { 508 ->withErrors($validator);
466 if ($request->has('file')) { 509 } else {
467 $params['file'] = $request->file('file')->store("messages", 'public'); 510 if ($request->has('file')) {
468 } 511 $params['file'] = $request->file('file')->store("messages", 'public');
469 Message::create($params); 512 }
470 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); 513 Message::create($params);
471 514 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
472 } 515
473 } 516 }
474 517 }
475 //Избранные люди 518
476 public function favorites(Request $request) { 519 //Избранные люди
477 $IP_address = RusDate::ip_addr_client(); 520 public function favorites(Request $request) {
478 $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); 521 $IP_address = RusDate::ip_addr_client();
479 522 $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get();
480 if ($Arr->count()) { 523
481 $A = Array(); 524 if ($Arr->count()) {
482 foreach ($Arr as $it) { 525 $A = Array();
483 $A[] = $it->code_record; 526 foreach ($Arr as $it) {
484 } 527 $A[] = $it->code_record;
485 528 }
486 $Workers = Worker::query()->whereIn('id', $A); 529
487 } else { 530 $Workers = Worker::query()->whereIn('id', $A);
488 $Workers = Worker::query()->where('id', '=', '0'); 531 } else {
489 } 532 $Workers = Worker::query()->where('id', '=', '0');
490 533 }
491 if (($request->has('search')) && (!empty($request->get('search')))) { 534
492 $search = $request->get('search'); 535 if (($request->has('search')) && (!empty($request->get('search')))) {
493 536 $search = $request->get('search');
494 $Workers = $Workers->WhereHas('users', 537
495 function (Builder $query) use ($search) { 538 $Workers = $Workers->WhereHas('users',
496 $query->Where('surname', 'LIKE', "%$search%") 539 function (Builder $query) use ($search) {
497 ->orWhere('name_man', 'LIKE', "%$search%") 540 $query->Where('surname', 'LIKE', "%$search%")
498 ->orWhere('surname2', 'LIKE', "%$search%"); 541 ->orWhere('name_man', 'LIKE', "%$search%")
499 }); 542 ->orWhere('surname2', 'LIKE', "%$search%");
500 } else { 543 });
501 $Workers = $Workers->with('users'); 544 } else {
502 } 545 $Workers = $Workers->with('users');
503 546 }
504 $Workers = $Workers->get(); 547
505 return view('employers.favorite', compact('Workers')); 548 $Workers = $Workers->get();
506 } 549 return view('employers.favorite', compact('Workers'));
507 550 }
508 // База данных 551
509 public function bd(Request $request) { 552 // База данных
510 // для типа BelongsTo 553 public function bd(Request $request) {
511 //$documents = Document::query()->orderBy(Location::select('name') 554 // для типа BelongsTo
512 // ->whereColumn('locations.id', 'documents.location_id') 555 //$documents = Document::query()->orderBy(Location::select('name')
513 //); 556 // ->whereColumn('locations.id', 'documents.location_id')
514 557 //);
515 // для типа HasOne/Many 558
516 // $documents = Document::::query()->orderBy(Location::select('name') 559 // для типа HasOne/Many
517 // ->whereColumn('locations.document_id', 'documents.id') 560 // $documents = Document::::query()->orderBy(Location::select('name')
518 //); 561 // ->whereColumn('locations.document_id', 'documents.id')
519 562 //);
520 563
521 $users = User_Model::query()->with('workers'); 564
522 565 $users = User_Model::query()->with('workers');
523 if ($request->has('search')) { 566
524 $find_key = $request->get('search'); 567 if ($request->has('search')) {
525 $users = $users->where('name', 'LIKE', "%$find_key%") 568 $find_key = $request->get('search');
526 ->orWhere('surname', 'LIKE', "%$find_key%") 569 $users = $users->where('name', 'LIKE', "%$find_key%")
527 ->orWhere('name_man', 'LIKE', "%$find_key%") 570 ->orWhere('surname', 'LIKE', "%$find_key%")
528 ->orWhere('email', 'LIKE', "%$find_key%") 571 ->orWhere('name_man', 'LIKE', "%$find_key%")
529 ->orWhere('telephone', 'LIKE', "%$find_key%"); 572 ->orWhere('email', 'LIKE', "%$find_key%")
530 } 573 ->orWhere('telephone', 'LIKE', "%$find_key%");
531 574 }
532 // Данные 575
533 $users = $users->Baseuser()-> 576 // Данные
534 orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id'))-> 577 $users = $users->Baseuser()->
535 paginate(5); 578 orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id'))->
536 579 paginate(5);
537 580
538 return view('employers.bd', compact('users')); 581
539 } 582 return view('employers.bd', compact('users'));
540 583 }
541 //Настройка уведомлений 584
542 public function subscribe() { 585 //Настройка уведомлений
543 return view('employers.subcribe'); 586 public function subscribe() {
544 } 587 return view('employers.subcribe');
545 588 }
546 //Установка уведомлений сохранение 589
547 public function save_subscribe(Request $request) { 590 //Установка уведомлений сохранение
548 dd($request->all()); 591 public function save_subscribe(Request $request) {
549 $msg = $request->validate([ 592 dd($request->all());
550 'subscribe_email' => 'required|email|min:5|max:255', 593 $msg = $request->validate([
551 ]); 594 'subscribe_email' => 'required|email|min:5|max:255',
552 return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); 595 ]);
553 } 596 return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку');
554 597 }
555 //Сбросить форму с паролем 598
556 public function password_reset() { 599 //Сбросить форму с паролем
557 $email = Auth()->user()->email; 600 public function password_reset() {
558 return view('employers.password-reset', compact('email')); 601 $email = Auth()->user()->email;
559 } 602 return view('employers.password-reset', compact('email'));
560 603 }
561 //Обновление пароля 604
562 public function new_password(Request $request) { 605 //Обновление пароля
563 $use = Auth()->user(); 606 public function new_password(Request $request) {
564 $request->validate([ 607 $use = Auth()->user();
565 'password' => 'required|string', 608 $request->validate([
566 'new_password' => 'required|string', 609 'password' => 'required|string',
567 'new_password2' => 'required|string' 610 'new_password' => 'required|string',
568 ]); 611 'new_password2' => 'required|string'
569 612 ]);
570 if ($request->get('new_password') == $request->get('new_password2')) 613
571 if ($request->get('password') !== $request->get('new_password')) { 614 if ($request->get('new_password') == $request->get('new_password2'))
572 $credentials = $request->only('email', 'password'); 615 if ($request->get('password') !== $request->get('new_password')) {
573 if (Auth::attempt($credentials)) { 616 $credentials = $request->only('email', 'password');
574 617 if (Auth::attempt($credentials)) {
575 if (!is_null($use->email_verified_at)){ 618
576 619 if (!is_null($use->email_verified_at)){
577 $user_data = User_Model::find($use->id); 620
578 $user_data->update([ 621 $user_data = User_Model::find($use->id);
579 'password' => Hash::make($request->get('new_password')), 622 $user_data->update([
580 'pubpassword' => base64_encode($request->get('new_password')), 623 'password' => Hash::make($request->get('new_password')),
581 ]); 624 'pubpassword' => base64_encode($request->get('new_password')),
582 return redirect() 625 ]);
583 ->route('employer.password_reset') 626 return redirect()
584 ->with('success', 'Поздравляю! Вы обновили свой пароль!'); 627 ->route('employer.password_reset')
585 } 628 ->with('success', 'Поздравляю! Вы обновили свой пароль!');
586 629 }
587 return redirect() 630
588 ->route('employer.password_reset') 631 return redirect()
589 ->withError('Данная учетная запись не было верифицированна!'); 632 ->route('employer.password_reset')
590 } 633 ->withError('Данная учетная запись не было верифицированна!');
591 } 634 }
592 635 }
593 return redirect() 636
594 ->route('employer.password_reset') 637 return redirect()
595 ->withErrors('Не совпадение данных, обновите пароли!'); 638 ->route('employer.password_reset')
596 } 639 ->withErrors('Не совпадение данных, обновите пароли!');
597 640 }
598 641
599 642
600 // Форма Удаление пипла 643
601 public function delete_people() { 644 // Форма Удаление пипла
602 $login = Auth()->user()->email; 645 public function delete_people() {
603 return view('employers.delete_people', compact('login')); 646 $login = Auth()->user()->email;
604 } 647 return view('employers.delete_people', compact('login'));
605 648 }
606 // Удаление аккаунта 649
607 public function action_delete_user(Request $request) { 650 // Удаление аккаунта
608 $Answer = $request->all(); 651 public function action_delete_user(Request $request) {
609 $user_id = Auth()->user()->id; 652 $Answer = $request->all();
610 $request->validate([ 653 $user_id = Auth()->user()->id;
611 'password' => 'required|string', 654 $request->validate([
612 ]); 655 'password' => 'required|string',
613 656 ]);
614 $credentials = $request->only('email', 'password'); 657
615 if (Auth::attempt($credentials)) { 658 $credentials = $request->only('email', 'password');
616 Auth::logout(); 659 if (Auth::attempt($credentials)) {
617 $it = User_Model::find($user_id); 660 Auth::logout();
618 $it->delete(); 661 $it = User_Model::find($user_id);
619 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); 662 $it->delete();
620 } else { 663 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт');
621 return redirect()->route('employer.delete_people') 664 } else {
622 ->withErrors( 'Неверный пароль! Нужен корректный пароль'); 665 return redirect()->route('employer.delete_people')
623 } 666 ->withErrors( 'Неверный пароль! Нужен корректный пароль');
624 } 667 }
625 668 }
626 public function ajax_delete_user(Request $request) { 669
627 $Answer = $request->all(); 670 public function ajax_delete_user(Request $request) {
628 $user_id = Auth()->user()->id; 671 $Answer = $request->all();
629 $request->validate([ 672 $user_id = Auth()->user()->id;
630 'password' => 'required|string', 673 $request->validate([
631 ]); 674 'password' => 'required|string',
632 $credentials = $request->only('email', 'password'); 675 ]);
633 if (Auth::attempt($credentials)) { 676 $credentials = $request->only('email', 'password');
634 677 if (Auth::attempt($credentials)) {
635 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', 678
636 'email' => $request->get('email'), 679 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт',
637 'password' => $request->get('password'))); 680 'email' => $request->get('email'),
638 } else { 681 'password' => $request->get('password')));
639 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); 682 } else {
640 } 683 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль'));
641 } 684 }
642 685 }
643 // FAQ - Вопросы/ответы для работодателей и соискателей 686
644 public function faq() { 687 // FAQ - Вопросы/ответы для работодателей и соискателей
645 return view('employers.faq'); 688 public function faq() {
646 } 689 return view('employers.faq');
647 690 }
648 // Рассылка сообщений 691
649 public function send_all_messages() { 692 // Рассылка сообщений
650 return view('employers.send_all'); 693 public function send_all_messages() {
651 } 694 return view('employers.send_all');
652 695 }
653 // Отправка сообщений для информации 696
654 public function send_all_post(Request $request) { 697 // Отправка сообщений для информации
655 $data = $request->all(); 698 public function send_all_post(Request $request) {
656 699 $data = $request->all();
657 $emails = User_Model::query()->where('is_worker', '1')->get(); 700
658 701 $emails = User_Model::query()->where('is_worker', '1')->get();
659 foreach ($emails as $e) { 702
660 Mail::to($e->email)->send(new SendAllMessages($data)); 703 foreach ($emails as $e) {
661 } 704 Mail::to($e->email)->send(new SendAllMessages($data));
662 705 }
663 return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); 706
664 } 707 return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены');
665 708 }
666 // База резюме 709
667 public function bd_tupe(Request $request) { 710 // База резюме
668 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); 711 public function bd_tupe(Request $request) {
669 712 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get();
670 return view('employers.bd_tupe', compact('Resume')); 713
671 } 714 return view('employers.bd_tupe', compact('Resume'));
672 715 }
673 ////////////////////////////////////////////////////////////////// 716
674 // Отправил сообщение 717 //////////////////////////////////////////////////////////////////
675 ////////////////////////////////////////////////////////////////// 718 // Отправил сообщение
676 public function new_message(Request $request) { 719 //////////////////////////////////////////////////////////////////
677 $params = $request->all(); 720 public function new_message(Request $request) {
678 $id = $params['_user_id']; 721 $params = $request->all();
679 $message = new Message(); 722 $id = $params['_user_id'];
680 $message->user_id = $params['_user_id']; 723 $message = new Message();
681 $message->to_user_id = $params['_to_user_id']; 724 $message->user_id = $params['_user_id'];
682 $message->title = $params['title']; 725 $message->to_user_id = $params['_to_user_id'];
683 $message->text = $params['text']; 726 $message->title = $params['title'];
684 if ($request->has('_file')) { 727 $message->text = $params['text'];
685 $message->file = $request->file('_file')->store("worker/$id", 'public'); 728 if ($request->has('_file')) {
686 } 729 $message->file = $request->file('_file')->store("worker/$id", 'public');
687 $message->flag_new = 1; 730 }
688 $id_message = $message->save(); 731 $message->flag_new = 1;
689 732 $id_message = $message->save();
690 $data['message_id'] = $id_message; 733
691 $data['ad_employer_id'] = $params['_vacancy']; 734 $data['message_id'] = $id_message;
692 $data['job_title_id'] = 0; 735 $data['ad_employer_id'] = $params['_vacancy'];
693 736 $data['job_title_id'] = 0;
694 $data['flag'] = 1; 737
695 $ad_responce = ad_response::create($data); 738 $data['flag'] = 1;
696 return redirect()->route('employer.messages', ['type_message' => 'output']); 739 $ad_responce = ad_response::create($data);
697 } 740 return redirect()->route('employer.messages', ['type_message' => 'output']);
698 741 }
699 // Восстановление пароля 742
700 public function repair_password(Request $request) { 743 // Восстановление пароля
701 $params = $request->get('email'); 744 public function repair_password(Request $request) {
702 } 745 $params = $request->get('email');
703 746 }
704 // Избранные люди на корабль 747
705 public function selected_people(Request $request) { 748 // Избранные люди на корабль
706 $id = $request->get('id'); 749 public function selected_people(Request $request) {
707 $favorite_people = Job_title::query()->Notbdif()->where('position_id', $id)->get(); 750 $id = $request->get('id');
708 return view('favorite_people', compact('favorite_people')); 751 $favorite_people = Job_title::query()->Notbdif()->where('position_id', $id)->get();
709 } 752 return view('favorite_people', compact('favorite_people'));
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\RusDate; 5 use App\Classes\RusDate;
6 use App\Classes\Tools; 6 use App\Classes\Tools;
7 use App\Mail\MailRegistration; 7 use App\Mail\MailRegistration;
8 use App\Mail\MailRepair; 8 use App\Mail\MailRepair;
9 use App\Models\Ad_employer; 9 use App\Models\Ad_employer;
10 use App\Models\Ad_jobs; 10 use App\Models\Ad_jobs;
11 use App\Models\Category; 11 use App\Models\Category;
12 use App\Models\Education; 12 use App\Models\Education;
13 use App\Models\Employer; 13 use App\Models\Employer;
14 use App\Models\employers_main; 14 use App\Models\employers_main;
15 use App\Models\Job_title; 15 use App\Models\Job_title;
16 use App\Models\Like_vacancy; 16 use App\Models\Like_vacancy;
17 use App\Models\Like_worker; 17 use App\Models\Like_worker;
18 use App\Models\News; 18 use App\Models\News;
19 use App\Models\Positions; 19 use App\Models\Positions;
20 use App\Models\reclame; 20 use App\Models\reclame;
21 use App\Models\User; 21 use App\Models\User;
22 use Illuminate\Http\Request; 22 use Illuminate\Http\Request;
23 use Illuminate\Support\Facades\Auth; 23 use Illuminate\Support\Facades\Auth;
24 use Illuminate\Support\Facades\DB; 24 use Illuminate\Support\Facades\DB;
25 use Illuminate\Support\Facades\Hash; 25 use Illuminate\Support\Facades\Hash;
26 use Illuminate\Support\Facades\Mail; 26 use Illuminate\Support\Facades\Mail;
27 use Illuminate\Support\Facades\Validator; 27 use Illuminate\Support\Facades\Validator;
28 use App\Classes\StatusUser; 28 use App\Classes\StatusUser;
29 29
30 class MainController extends Controller 30 class MainController extends Controller
31 { 31 {
32 // Главная страница публичной части 32 // Главная страница публичной части
33 public function index() { 33 public function index() {
34 $news = News::query()->orderByDesc('id')->limit(6)->get(); 34 $news = News::query()->orderByDesc('id')->limit(6)->get();
35 35
36 $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') 36 $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*')
37 ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') 37 ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id')
38 ->OrderByDesc('created_at') 38 ->OrderByDesc('created_at')
39 ->GroupBy('categories.id') 39 ->GroupBy('categories.id')
40 ->get(); 40 ->get();
41 41
42 $Position = Category::query()->where('is_remove', '=', '0')->get(); 42 $Position = Category::query()->where('is_remove', '=', '0')->get();
43 43 $job_titles = Job_title::query()->where('is_remove', '=', 0)->get();
44 /*$BigFlot = Array(); 44 /*$BigFlot = Array();
45 foreach ($Position as $position) { 45 foreach ($Position as $position) {
46 $BigFlot[] = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> 46 $BigFlot[] = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')->
47 orderBy('job_titles.sort')-> 47 orderBy('job_titles.sort')->
48 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> 48 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')->
49 where('position_ship', "$position->name")-> 49 where('position_ship', "$position->name")->
50 groupby('job_title_id','position_ship')-> 50 groupby('job_title_id','position_ship')->
51 get(); 51 get();
52 } 52 }
53
54 $BigFlot = Array(); 53 $BigFlot = Array();
55
56 foreach ($Position as $position) { 54 foreach ($Position as $position) {
57
58 $BigFlot[] = Ad_jobs::query()->with(['job_title' => function($query) { 55 $BigFlot[] = Ad_jobs::query()->with(['job_title' => function($query) {
59 $query->OrderBy('sort'); 56 $query->OrderBy('sort');
60 }])->whereHas('job_title', function ($query) use ($position) { 57 }])->whereHas('job_title', function ($query) use ($position) {
61 $query->where('position_id', $position->id); 58 $query->where('position_id', $position->id);
62 })-> 59 })->
63 distinct('job_title_id')-> 60 distinct('job_title_id')->
64 get(); 61 get();
65 }*/ 62 }*/
66 63 /*$BigFlot = Array();
67 $BigFlot = Array();
68 foreach ($Position as $position) { 64 foreach ($Position as $position) {
69 $BigFlot[] = DB::table('ad_jobs')-> 65 $BigFlot[$position->id] = DB::table('ad_jobs')->
70 selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> 66 selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name, job_titles.position_id')->
71 orderByDesc('job_titles.sort')-> 67 orderByDesc('job_titles.sort')->
72 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> 68 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')->
73 where('job_titles.position_id', $position->id)-> 69 where('job_titles.position_id', $position->id)->
74 groupby('job_title_id')-> 70 groupby('job_title_id')->
75 get(); 71 get();
72 }*/
73 $Data = DB::table('job_titles')->
74 selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')->
75 leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')->
76 join('categories', 'categories.id', '=', 'job_titles.position_id')->
77 groupBy('job_titles.id')->orderByDesc('job_titles.position_id')->
78 orderByDesc('job_titles.sort')->get()->toArray();
79
80 $Main_Job = array();
81 $name_cat = '';
82 foreach ($Data as $it) {
83 $it_arr = (array)$it;
84 if ($name_cat != $it_arr['catname'])
85 $name_cat = $it_arr['catname'];
86 $Main_Job[$name_cat][] = $it_arr;
76 } 87 }
77 88
78 $employers = employers_main::query()->with('employer')->orderBy('id')->limit(8)->get(); 89 $employers = employers_main::query()->with('employer')->orderBy('id')->limit(8)->get();
79 $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get(); 90 $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get();
80 return view('index', compact('news', 'categories', 'employers', 'vacancy', 'BigFlot', 'Position')); 91 return view('index', compact('news', 'job_titles', 'categories', 'employers', 'vacancy', 'Main_Job'));
81 } 92 }
82 93
83 public function search_vacancies(Request $request) { 94 public function search_vacancies(Request $request) {
84 if ($request->has('search')) { 95 if ($request->has('search')) {
85 $search = $request->get('search'); 96 $search = $request->get('search');
86 $job_titles = Job_title::query()->where('name', 'LIKE', "%$search%")->first(); 97 $job_titles = Job_title::query()->where('name', 'LIKE', "%$search%")->first();
87 if (isset($job_titles->id)) 98 if (isset($job_titles->id))
88 if ($job_titles->id > 0) 99 if ($job_titles->id > 0)
89 return redirect()->route('vacancies', ['job' => $job_titles->id]); 100 return redirect()->route('vacancies', ['job' => $job_titles->id]);
90 } 101 }
91 } 102 }
92 103
93 // Лайк вакансии 104 // Лайк вакансии
94 public function like_vacancy(Request $request) { 105 public function like_vacancy(Request $request) {
95 $IP_address = RusDate::ip_addr_client(); 106 $IP_address = RusDate::ip_addr_client();
96 107
97 if ($request->has('code_record')) { 108 if ($request->has('code_record')) {
98 if ($request->has('delete')) { 109 if ($request->has('delete')) {
99 $atomic_era = Like_vacancy::select('id')-> 110 $atomic_era = Like_vacancy::select('id')->
100 where('code_record', '=', $request-> 111 where('code_record', '=', $request->
101 get('code_record'))->first(); 112 get('code_record'))->first();
102 113
103 DB::table('like_vacancy')->where('code_record', $request->get('code_record'))->delete(); 114 DB::table('like_vacancy')->where('code_record', $request->get('code_record'))->delete();
104 115
105 } else { 116 } else {
106 $params = $request->all(); 117 $params = $request->all();
107 $params['ip_address'] = $IP_address; 118 $params['ip_address'] = $IP_address;
108 Like_vacancy::create($params); 119 Like_vacancy::create($params);
109 } 120 }
110 } 121 }
111 } 122 }
112 123
113 // Лайк соискателю. 124 // Лайк соискателю.
114 public function like_worker(Request $request) { 125 public function like_worker(Request $request) {
115 $IP_address = RusDate::ip_addr_client(); 126 $IP_address = RusDate::ip_addr_client();
116 127
117 if ($request->has('code_record')) { 128 if ($request->has('code_record')) {
118 if ($request->has('delete')) { 129 if ($request->has('delete')) {
119 $atomic_era = Like_worker::select('id')-> 130 $atomic_era = Like_worker::select('id')->
120 where('code_record', '=', $request-> 131 where('code_record', '=', $request->
121 get('code_record'))->first(); 132 get('code_record'))->first();
122 133
123 DB::table('like_worker')->where('code_record', $request->get('code_record'))->delete(); 134 DB::table('like_worker')->where('code_record', $request->get('code_record'))->delete();
124 135
125 return "Вот и результат удаления!"; 136 return "Вот и результат удаления!";
126 137
127 } else { 138 } else {
128 $params = $request->all(); 139 $params = $request->all();
129 $params['ip_address'] = $IP_address; 140 $params['ip_address'] = $IP_address;
130 Like_worker::create($params); 141 Like_worker::create($params);
131 } 142 }
132 } 143 }
133 } 144 }
134 145
135
136 public function vacancies(Request $request) { 146 public function vacancies(Request $request) {
137 //должности 147 //должности
138 $Job_title = Job_title::query()->orderBy('name')->get(); 148 $Job_title = Job_title::query()->orderBy('name')->get();
139 149
140 $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') 150 $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*')
141 ->selectRaw('min(ad_employers.salary) as min_salary, max(ad_employers.salary) as max_salary') 151 ->selectRaw('min(ad_employers.salary) as min_salary, max(ad_employers.salary) as max_salary')
142 ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') 152 ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id')
143 ->join('ad_jobs', 'ad_jobs.ad_employer_id', '=', 'ad_employers.id'); 153 ->join('ad_jobs', 'ad_jobs.ad_employer_id', '=', 'ad_employers.id');
144 154
145 //категории и вакансии 155 //категории и вакансии
146 if (($request->has('job')) && ($request->get('job') > 0)) { 156 if (($request->has('job')) && ($request->get('job') > 0)) {
147 $categories = $categories->Where('job_title_id', '=', $request->get('job')); 157 $categories = $categories->Where('job_title_id', '=', $request->get('job'));
148 } 158 }
149 159
150 $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get(); 160 $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get();
151 161
152 $Position = Category::query()->where('is_remove', '=', '0')->get(); 162 //$Position = Category::query()->where('is_remove', '=', '0')->get();
153 163
154 164
155 /*$BigFlot = Array(); 165 /*$BigFlot = Array();
156 foreach ($Position as $position) { 166 foreach ($Position as $position) {
157 $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> 167 $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')->
158 orderBy('job_titles.sort')-> 168 orderBy('job_titles.sort')->
159 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> 169 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')->
160 where('position_ship', "$position->name"); 170 where('position_ship', "$position->name");
161 if (($request->has('job')) && ($request->get('job') > 0)) { 171 if (($request->has('job')) && ($request->get('job') > 0)) {
162 $War_flot = $War_flot->where('job_title_id', $request->get('job')); 172 $War_flot = $War_flot->where('job_title_id', $request->get('job'));
163 } 173 }
164 $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); 174 $War_flot = $War_flot->groupby('job_title_id','position_ship')->get();
165 $BigFlot[] = $War_flot; 175 $BigFlot[] = $War_flot;
166 }*/ 176 }*/
167 177 /*
168 $BigFlot = Array(); 178 $BigFlot = Array();
169 foreach ($Position as $position) { 179 foreach ($Position as $position) {
170 $WarFlot = DB::table('ad_jobs')-> 180 $WarFlot = DB::table('ad_jobs')->
171 selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> 181 selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')->
172 orderByDesc('job_titles.sort')-> 182 orderByDesc('job_titles.sort')->
173 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> 183 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')->
174 where('job_titles.position_id', $position->id); 184 where('job_titles.position_id', $position->id);
175 if (($request->has('job')) && ($request->get('job') > 0)) { 185 if (($request->has('job')) && ($request->get('job') > 0)) {
176 $WarFlot = $WarFlot->where('job_title_id', $request->get('job')); 186 $WarFlot = $WarFlot->where('job_title_id', $request->get('job'));
177 } 187 }
178 $WarFlot = $WarFlot->groupby('job_title_id')->get(); 188 $WarFlot = $WarFlot->groupby('job_title_id')->get();
179 $BigFlot[] = $WarFlot; 189 $BigFlot[] = $WarFlot;
190 }
191 */
192
193 $Data = DB::table('job_titles')->
194 selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat');
195 if (($request->has('job')) && ($request->get('job') > 0)) {
196 $Data = $Data->where('job_title_id', $request->get('job'));
197 }
198 $Data = $Data->leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')->
199 join('categories', 'categories.id', '=', 'job_titles.position_id')->
200 groupBy('job_titles.id')->orderByDesc('job_titles.position_id')->
201 orderByDesc('job_titles.sort')->get()->toArray();
202
203 $Main_Job = array();
204 $name_cat = '';
205 foreach ($Data as $it) {
206 $it_arr = (array)$it;
207 if ($name_cat != $it_arr['catname'])
208 $name_cat = $it_arr['catname'];
209 $Main_Job[$name_cat][] = $it_arr;
180 } 210 }
181 211
182 if ($request->ajax()) { 212 if ($request->ajax()) {
183 return view('ajax.new_sky', compact('categories', 'BigFlot', 'Position')); 213 return view('ajax.new_sky', compact('categories', 'Main_Job'));
184 } else { 214 } else {
185 return view('new_sky', compact('Job_title', 'categories', 'BigFlot', 'Position')); 215 return view('new_sky', compact('Job_title', 'categories', 'Main_Job'));
186 } 216 }
187 } 217 }
188 218
189 //Вакансии категория детальная 219 //Вакансии категория детальная
190 public function list_vacancies(Category $categories, Request $request) { 220 public function list_vacancies(Category $categories, Request $request) {
191 if (isset(Auth()->user()->id)) 221 if (isset(Auth()->user()->id))
192 $uid = Auth()->user()->id; 222 $uid = Auth()->user()->id;
193 else 223 else
194 $uid = 0; 224 $uid = 0;
195 225
196 if ($request->get('job') == 0) 226 if ($request->get('job') == 0)
197 $job_search = ''; 227 $job_search = '';
198 else 228 else
199 $job_search = $request->get('job'); 229 $job_search = $request->get('job');
200 230
201 $Query = Ad_employer::with('jobs')-> 231 $Query = Ad_employer::with('jobs')->
202 with('cat')-> 232 with('cat')->
203 with('employer')-> 233 with('employer')->
204 234
205 whereHas('jobs_code', function ($query) use ($job_search) { 235 whereHas('jobs_code', function ($query) use ($job_search) {
206 if (!empty($job_search)) { 236 if (!empty($job_search)) {
207 $query->where('job_title_id', $job_search); 237 $query->where('job_title_id', $job_search);
208 } 238 }
209 })->select('ad_employers.*'); 239 })->select('ad_employers.*');
210 240
211 if (isset($categories->id) && ($categories->id > 0)) { 241 if (isset($categories->id) && ($categories->id > 0)) {
212 $Query = $Query->where('category_id', '=', $categories->id); 242 $Query = $Query->where('category_id', '=', $categories->id);
213 $Name_categori = Category::query()->where('id', '=', $categories->id)->get(); 243 $Name_categori = Category::query()->where('id', '=', $categories->id)->get();
214 } else { 244 } else {
215 $Name_categori = ''; 245 $Name_categori = '';
216 } 246 }
217 247
218 if ($request->get('sort')) { 248 if ($request->get('sort')) {
219 $sort = $request->get('sort'); 249 $sort = $request->get('sort');
220 switch ($sort) { 250 switch ($sort) {
221 case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break; 251 case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break;
222 case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break; 252 case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break;
223 case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; 253 case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break;
224 case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; 254 case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break;
225 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; 255 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break;
226 default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; 256 default: $Query = $Query->orderBy('id')->orderby('updated_at'); break;
227 } 257 }
228 } 258 }
229 259
230 $Job_title = Job_title::query()->OrderBy('name')->get(); 260 $Job_title = Job_title::query()->OrderBy('name')->get();
231 261
232 $Query_count = $Query->count(); 262 $Query_count = $Query->count();
233 263
234 $Query = $Query->OrderBy('updated_at')->paginate(3); 264 $Query = $Query->OrderBy('updated_at')->paginate(3);
235 265
236 $Reclama = reclame::query()->get(); 266 $Reclama = reclame::query()->get();
237 267
238 if ($request->ajax()) { 268 if ($request->ajax()) {
239 if ($request->has('title')) { 269 if ($request->has('title')) {
240 return view('ajax.list_category', compact( 270 return view('ajax.list_category', compact(
241 'Name_categori' 271 'Name_categori'
242 )); 272 ));
243 } else { 273 } else {
244 return view('ajax.list_vacancies', compact('Query', 274 return view('ajax.list_vacancies', compact('Query',
245 'Query_count', 275 'Query_count',
246 'Name_categori', 276 'Name_categori',
247 'Reclama', 277 'Reclama',
248 'categories', 278 'categories',
249 'Job_title', 279 'Job_title',
250 'uid')); 280 'uid'));
251 } 281 }
252 } else { 282 } else {
253 //Вернуть все 283 //Вернуть все
254 return view('list_vacancies', compact('Query', 284 return view('list_vacancies', compact('Query',
255 'Query_count', 285 'Query_count',
256 'Reclama', 286 'Reclama',
257 'Name_categori', 287 'Name_categori',
258 'categories', 288 'categories',
259 'Job_title', 289 'Job_title',
260 'uid')); 290 'uid'));
261 } 291 }
262 } 292 }
263 293
264 // Образование 294 // Образование
265 public function education(Request $request) { 295 public function education(Request $request) {
266 $educations = Education::query(); 296 $educations = Education::query();
267 if (($request->has('search')) && (!empty($request->get('search')))) { 297 if (($request->has('search')) && (!empty($request->get('search')))) {
268 $search = trim($request->get('search')); 298 $search = trim($request->get('search'));
269 $educations = $educations->where('name', 'LIKE', "%$search%"); 299 $educations = $educations->where('name', 'LIKE', "%$search%");
270 } 300 }
271 301
272 if ($request->get('sort')) { 302 if ($request->get('sort')) {
273 $sort = $request->get('sort'); 303 $sort = $request->get('sort');
274 switch ($sort) { 304 switch ($sort) {
275 case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break; 305 case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break;
276 case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break; 306 case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break;
277 case 'created_at_up': $educations = $educations->OrderBy('created_at')->orderBy('id'); break; 307 case 'created_at_up': $educations = $educations->OrderBy('created_at')->orderBy('id'); break;
278 case 'created_at_down': $educations = $educations->orderByDesc('created_at')->orderBy('id'); break; 308 case 'created_at_down': $educations = $educations->orderByDesc('created_at')->orderBy('id'); break;
279 case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break; 309 case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break;
280 default: $educations = $educations->orderBy('id')->orderby('updated_at'); break; 310 default: $educations = $educations->orderBy('id')->orderby('updated_at'); break;
281 } 311 }
282 } 312 }
283 313
284 $count_edu = $educations->count(); 314 $count_edu = $educations->count();
285 $educations = $educations->paginate(6); 315 $educations = $educations->paginate(6);
286 if ($request->ajax()) { 316 if ($request->ajax()) {
287 return view('ajax.education', compact('educations')); 317 return view('ajax.education', compact('educations'));
288 } else { 318 } else {
289 return view('education', compact('educations', 'count_edu')); 319 return view('education', compact('educations', 'count_edu'));
290 } 320 }
291 } 321 }
292 322
293 // Контакты 323 // Контакты
294 public function contacts() { 324 public function contacts() {
295 return view('contacts'); 325 return view('contacts');
296 } 326 }
297 327
298 // Вход в личный кабинет 328 // Вход в личный кабинет
299 public function input_login(Request $request) 329 public function input_login(Request $request)
300 { 330 {
301 $params = $request->all(); 331 $params = $request->all();
302 332
303 333
304 $rules = [ 334 $rules = [
305 'email' => 'required|string|email', 335 'email' => 'required|string|email',
306 'password' => 'required|string|min:3|max:25', 336 'password' => 'required|string|min:3|max:25',
307 ]; 337 ];
308 338
309 $messages = [ 339 $messages = [
310 'required' => 'Укажите обязательное поле «:attribute»', 340 'required' => 'Укажите обязательное поле «:attribute»',
311 'email' => 'Введите корректный email', 341 'email' => 'Введите корректный email',
312 'min' => [ 342 'min' => [
313 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 343 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
314 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 344 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
315 ], 345 ],
316 'max' => [ 346 'max' => [
317 'string' => 'Поле «:attribute» должно быть не больше :max символов', 347 'string' => 'Поле «:attribute» должно быть не больше :max символов',
318 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 348 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
319 ], 349 ],
320 ]; 350 ];
321 351
322 $validator = Validator::make($request->all(), $rules, $messages); 352 $validator = Validator::make($request->all(), $rules, $messages);
323 353
324 354
325 if ($validator->fails()) { 355 if ($validator->fails()) {
326 return json_encode(Array("ERROR" => "Email или пароль невалидный!")); 356 return json_encode(Array("ERROR" => "Email или пароль невалидный!"));
327 //redirect()->route('index')->with('Error', "Email или пароль невалидный"); 357 //redirect()->route('index')->with('Error', "Email или пароль невалидный");
328 } else { 358 } else {
329 $credentials = $request->only('email', 'password'); 359 $credentials = $request->only('email', 'password');
330 360
331 if (Auth::attempt($credentials, $request->has('remember'))) { 361 if (Auth::attempt($credentials, $request->has('remember'))) {
332 362
333 if (is_null(Auth::user()->email_verified_at)) { 363 if (is_null(Auth::user()->email_verified_at)) {
334 Auth::logout(); 364 Auth::logout();
335 return json_encode(Array("ERROR" => "Адрес почты не подтвержден")); 365 return json_encode(Array("ERROR" => "Адрес почты не подтвержден"));
336 } 366 }
337 367
338 if (Auth::user()->is_worker) { 368 if (Auth::user()->is_worker) {
339 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl())); 369 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));
340 } else { 370 } else {
341 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl())); 371 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));
342 } 372 }
343 373
344 return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет")); 374 return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет"));
345 //->route('index') 375 //->route('index')
346 //->with('success', 'Вы вошли в личный кабинет.'); 376 //->with('success', 'Вы вошли в личный кабинет.');
347 } else { 377 } else {
348 return json_encode(Array("ERROR" => "Неверный логин или пароль!")); 378 return json_encode(Array("ERROR" => "Неверный логин или пароль!"));
349 } 379 }
350 } 380 }
351 } 381 }
352 382
353 // Восстановление пароля 383 // Восстановление пароля
354 public function repair_password(Request $request) { 384 public function repair_password(Request $request) {
355 $rules = [ 385 $rules = [
356 'email' => 'required|string|email', 386 'email' => 'required|string|email',
357 ]; 387 ];
358 388
359 $messages = [ 389 $messages = [
360 'required' => 'Укажите обязательное поле «:attribute»', 390 'required' => 'Укажите обязательное поле «:attribute»',
361 'email' => 'Введите корректный email', 391 'email' => 'Введите корректный email',
362 'min' => [ 392 'min' => [
363 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 393 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
364 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 394 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
365 ], 395 ],
366 'max' => [ 396 'max' => [
367 'string' => 'Поле «:attribute» должно быть не больше :max символов', 397 'string' => 'Поле «:attribute» должно быть не больше :max символов',
368 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 398 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
369 ], 399 ],
370 ]; 400 ];
371 401
372 $validator = Validator::make($request->all(), $rules, $messages); 402 $validator = Validator::make($request->all(), $rules, $messages);
373 403
374 if ($validator->fails()) { 404 if ($validator->fails()) {
375 return redirect()->back()->with('Error', "Email невалидный"); 405 return redirect()->back()->with('Error', "Email невалидный");
376 } else { 406 } else {
377 $new_password = Tools::generator_id(10); 407 $new_password = Tools::generator_id(10);
378 $hash_password = Hash::make($new_password); 408 $hash_password = Hash::make($new_password);
379 $user = User::query()->where('email', $request->get('email'))->first(); 409 $user = User::query()->where('email', $request->get('email'))->first();
380 $EditRec = User::find($user->id); 410 $EditRec = User::find($user->id);
381 $EditRec->password = $hash_password; 411 $EditRec->password = $hash_password;
382 $EditRec->save(); 412 $EditRec->save();
383 413
384 foreach ([$request->get('email')] as $recipient) { 414 foreach ([$request->get('email')] as $recipient) {
385 Mail::to($recipient)->send(new MailRepair($new_password)); 415 Mail::to($recipient)->send(new MailRepair($new_password));
386 } 416 }
387 return redirect()->route('index'); 417 return redirect()->route('index');
388 418
389 } 419 }
390 420
391 } 421 }
392 422
393 // Вывод новостей 423 // Вывод новостей
394 public function news(Request $request) { 424 public function news(Request $request) {
395 $Query = News::query(); 425 $Query = News::query();
396 if ($request->has('search')) { 426 if ($request->has('search')) {
397 $search = $request->get('search'); 427 $search = $request->get('search');
398 $Query = $Query->where('title', 'LIKE', "%$search%")-> 428 $Query = $Query->where('title', 'LIKE', "%$search%")->
399 orWhere('text', 'LIKE', "%$search%"); 429 orWhere('text', 'LIKE', "%$search%");
400 } 430 }
401 431
402 if ($request->ajax()) { 432 if ($request->ajax()) {
403 if ($request->get('sort')) { 433 if ($request->get('sort')) {
404 $sort = $request->get('sort'); 434 $sort = $request->get('sort');
405 switch ($sort) { 435 switch ($sort) {
406 case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break; 436 case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break;
407 case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break; 437 case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break;
408 case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; 438 case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break;
409 case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; 439 case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break;
410 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; 440 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break;
411 default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; 441 default: $Query = $Query->orderBy('id')->orderby('updated_at'); break;
412 } 442 }
413 } 443 }
414 } 444 }
415 $Query_count = $Query->count(); 445 $Query_count = $Query->count();
416 $Query = $Query->paginate(6); 446 $Query = $Query->paginate(6);
417 447
418 if ($request->ajax()) { 448 if ($request->ajax()) {
419 return view('ajax.news-list', compact('Query', 'Query_count')); 449 return view('ajax.news-list', compact('Query', 'Query_count'));
420 } else { 450 } else {
421 return view('news-list', compact('Query', 'Query_count')); 451 return view('news-list', compact('Query', 'Query_count'));
422 } 452 }
423 } 453 }
424 454
425 //Детальная новость 455 //Детальная новость
426 public function detail_new(News $new) { 456 public function detail_new(News $new) {
427 // Наборка 457 // Наборка
428 $Query = News::query()->where('id', $new->id)->get(); 458 $Query = News::query()->where('id', $new->id)->get();
429 $title = $Query[0]->title; 459 $title = $Query[0]->title;
app/Http/Controllers/WorkerController.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\Http\Requests\DocumentsRequest; 6 use App\Http\Requests\DocumentsRequest;
7 use App\Http\Requests\PrevCompanyRequest; 7 use App\Http\Requests\PrevCompanyRequest;
8 use App\Http\Requests\SertificationRequest; 8 use App\Http\Requests\SertificationRequest;
9 use App\Models\Ad_employer; 9 use App\Models\Ad_employer;
10 use App\Models\ad_response; 10 use App\Models\ad_response;
11 use App\Models\Category; 11 use App\Models\Category;
12 use App\Models\Dop_info; 12 use App\Models\Dop_info;
13 use App\Models\Employer; 13 use App\Models\Employer;
14 use App\Models\infobloks; 14 use App\Models\infobloks;
15 use App\Models\Job_title; 15 use App\Models\Job_title;
16 use App\Models\Like_vacancy; 16 use App\Models\Like_vacancy;
17 use App\Models\Like_worker; 17 use App\Models\Like_worker;
18 use App\Models\Message; 18 use App\Models\Message;
19 use App\Models\place_works; 19 use App\Models\place_works;
20 use App\Models\PrevCompany; 20 use App\Models\PrevCompany;
21 use App\Models\reclame; 21 use App\Models\reclame;
22 use App\Models\ResponseWork; 22 use App\Models\ResponseWork;
23 use App\Models\sertification; 23 use App\Models\sertification;
24 use App\Models\Static_worker; 24 use App\Models\Static_worker;
25 use App\Models\Title_worker;
25 use App\Models\User; 26 use App\Models\User;
26 use App\Models\User as User_Model; 27 use App\Models\User as User_Model;
27 use App\Models\Worker; 28 use App\Models\Worker;
28 use Barryvdh\DomPDF\Facade\Pdf; 29 use Barryvdh\DomPDF\Facade\Pdf;
29 use Carbon\Carbon; 30 use Carbon\Carbon;
30 use Illuminate\Auth\Events\Registered; 31 use Illuminate\Auth\Events\Registered;
31 use Illuminate\Database\Eloquent\Builder; 32 use Illuminate\Database\Eloquent\Builder;
32 use Illuminate\Database\Eloquent\Model; 33 use Illuminate\Database\Eloquent\Model;
33 use Illuminate\Http\JsonResponse; 34 use Illuminate\Http\JsonResponse;
34 use Illuminate\Http\Request; 35 use Illuminate\Http\Request;
35 use Illuminate\Support\Facades\Auth; 36 use Illuminate\Support\Facades\Auth;
36 use Illuminate\Support\Facades\Hash; 37 use Illuminate\Support\Facades\Hash;
37 use Illuminate\Support\Facades\Storage; 38 use Illuminate\Support\Facades\Storage;
38 use Illuminate\Support\Facades\Validator; 39 use Illuminate\Support\Facades\Validator;
39 40
40 class WorkerController extends Controller 41 class WorkerController extends Controller
41 { 42 {
42 public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу'); 43 public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу');
43 44
44 //профиль 45 //профиль
45 public function profile(Worker $worker) 46 public function profile(Worker $worker)
46 { 47 {
47 $get_date = date('Y.m'); 48 $get_date = date('Y.m');
48 49
49 $c = Static_worker::query()->where('year_month', '=', $get_date) 50 $c = Static_worker::query()->where('year_month', '=', $get_date)
50 ->where('user_id', '=', $worker->users->id) 51 ->where('user_id', '=', $worker->users->id)
51 ->get(); 52 ->get();
52 53
53 if ($c->count() > 0) { 54 if ($c->count() > 0) {
54 $upd = Static_worker::find($c[0]->id); 55 $upd = Static_worker::find($c[0]->id);
55 $upd->lookin = $upd->lookin + 1; 56 $upd->lookin = $upd->lookin + 1;
56 $upd->save(); 57 $upd->save();
57 } else { 58 } else {
58 $crt = new Static_worker(); 59 $crt = new Static_worker();
59 $crt->lookin = 1; 60 $crt->lookin = 1;
60 $crt->year_month = $get_date; 61 $crt->year_month = $get_date;
61 $crt->user_id = $worker->user_id; 62 $crt->user_id = $worker->user_id;
62 $crt->save(); 63 $crt->save();
63 } 64 }
64 65
65 $stat = Static_worker::query()->where('year_month', '=', $get_date) 66 $stat = Static_worker::query()->where('year_month', '=', $get_date)
66 ->where('user_id', '=', $worker->users->id) 67 ->where('user_id', '=', $worker->users->id)
67 ->get(); 68 ->get();
68 69
69 return view('public.workers.profile', compact('worker', 'stat')); 70 return view('public.workers.profile', compact('worker', 'stat'));
70 } 71 }
71 72
72 // лист база резюме 73 // лист база резюме
73 public function bd_resume(Request $request) 74 public function bd_resume(Request $request)
74 { 75 {
75 if (isset(Auth()->user()->id)) { 76 if (isset(Auth()->user()->id)) {
76 $idiot = Auth()->user()->id; 77 $idiot = Auth()->user()->id;
77 } else { 78 } else {
78 $idiot = 0; 79 $idiot = 0;
79 } 80 }
80 81
81 $status_work = $this->status_work; 82 $status_work = $this->status_work;
82 $resumes = Worker::query()->with('users')->with('job_titles'); 83 $resumes = Worker::query()->with('users')->with('job_titles');
83 $resumes = $resumes->whereHas('users', function (Builder $query) { 84 $resumes = $resumes->whereHas('users', function (Builder $query) {
84 $query->Where('is_worker', '=', '1') 85 $query->Where('is_worker', '=', '1')
85 ->Where('is_bd', '=', '0'); 86 ->Where('is_bd', '=', '0');
86 }); 87 });
87 88
88 //dd($request->get('job')); 89 //dd($request->get('job'));
89 if (($request->has('job')) && ($request->get('job') > 0)) { 90 if (($request->has('job')) && ($request->get('job') > 0)) {
90 $resumes = $resumes->whereHas('job_titles', function(Builder $query) use ($request) { 91 $resumes = $resumes->whereHas('job_titles', function(Builder $query) use ($request) {
91 $query->Where('job_titles.id', $request->get('job')); 92 $query->Where('job_titles.id', $request->get('job'));
92 }); 93 });
93 } 94 }
94 95
95 $Job_title = Job_title::query()->get(); 96 $Job_title = Job_title::query()->get();
96 97
97 if ($request->get('sort')) { 98 if ($request->get('sort')) {
98 $sort = $request->get('sort'); 99 $sort = $request->get('sort');
99 switch ($sort) { 100 switch ($sort) {
100 case 'name_up': 101 case 'name_up':
101 $resumes = $resumes->orderBy(User::select('surname') 102 $resumes = $resumes->orderBy(User::select('surname')
102 ->whereColumn('Workers.user_id', 'users.id') 103 ->whereColumn('Workers.user_id', 'users.id')
103 ); 104 );
104 break; 105 break;
105 case 'name_down': 106 case 'name_down':
106 $resumes = $resumes->orderByDesc(User::select('surname') 107 $resumes = $resumes->orderByDesc(User::select('surname')
107 ->whereColumn('Workers.user_id', 'users.id') 108 ->whereColumn('Workers.user_id', 'users.id')
108 ); 109 );
109 break; 110 break;
110 case 'created_at_up': $resumes = $resumes->OrderBy('created_at')->orderBy('id'); break; 111 case 'created_at_up': $resumes = $resumes->OrderBy('created_at')->orderBy('id'); break;
111 case 'created_at_down': $resumes = $resumes->orderByDesc('created_at')->orderBy('id'); break; 112 case 'created_at_down': $resumes = $resumes->orderByDesc('created_at')->orderBy('id'); break;
112 case 'default': $resumes = $resumes->orderBy('id')->orderby('updated_at'); break; 113 case 'default': $resumes = $resumes->orderBy('id')->orderby('updated_at'); break;
113 default: $resumes = $resumes->orderBy('id')->orderby('updated_at'); break; 114 default: $resumes = $resumes->orderBy('id')->orderby('updated_at'); break;
114 } 115 }
115 } 116 }
116 117
117 $res_count = $resumes->count(); 118 $res_count = $resumes->count();
118 //$resumes = $resumes->get(); 119 //$resumes = $resumes->get();
119 120
120 $resumes = $resumes->paginate(4); 121 $resumes = $resumes->paginate(4);
121 if ($request->ajax()) { 122 if ($request->ajax()) {
122 // Условия обставлены 123 // Условия обставлены
123 if ($request->has('block') && ($request->get('block') == 1)) { 124 if ($request->has('block') && ($request->get('block') == 1)) {
124 return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); 125 return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot'));
125 } 126 }
126 127
127 if ($request->has('block') && ($request->get('block') == 2)) { 128 if ($request->has('block') && ($request->get('block') == 2)) {
128 return view('ajax.resume_2', compact('resumes', 'status_work', 'res_count', 'idiot')); 129 return view('ajax.resume_2', compact('resumes', 'status_work', 'res_count', 'idiot'));
129 } 130 }
130 } else { 131 } else {
131 return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title')); 132 return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title'));
132 } 133 }
133 } 134 }
134 135
135 //Лайк резюме 136 //Лайк резюме
136 public function like_controller() { 137 public function like_controller() {
137 138
138 } 139 }
139 140
140 // анкета соискателя 141 // анкета соискателя
141 public function resume_profile(Worker $worker) 142 public function resume_profile(Worker $worker)
142 { 143 {
143 if (isset(Auth()->user()->id)) { 144 if (isset(Auth()->user()->id)) {
144 $idiot = Auth()->user()->id; 145 $idiot = Auth()->user()->id;
145 } else { 146 } else {
146 $idiot = 0; 147 $idiot = 0;
147 } 148 }
148 149
149 $status_work = $this->status_work; 150 $status_work = $this->status_work;
150 $Query = Worker::query()->with('users')->with('job_titles') 151 $Query = Worker::query()->with('users')->with('job_titles')
151 ->with('place_worker')->with('sertificate')->with('prev_company') 152 ->with('place_worker')->with('sertificate')->with('prev_company')
152 ->with('infobloks'); 153 ->with('infobloks');
153 $Query = $Query->where('id', '=', $worker->id); 154 $Query = $Query->where('id', '=', $worker->id);
154 $Query = $Query->get(); 155 $Query = $Query->get();
155 156
156 $get_date = date('Y.m'); 157 $get_date = date('Y.m');
157 $c = Static_worker::query()->where('year_month', '=', $get_date) 158 $c = Static_worker::query()->where('year_month', '=', $get_date)
158 ->where('user_id', '=', $worker->id) 159 ->where('user_id', '=', $worker->id)
159 ->get(); 160 ->get();
160 161
161 if ($c->count() > 0) { 162 if ($c->count() > 0) {
162 $upd = Static_worker::find($c[0]->id); 163 $upd = Static_worker::find($c[0]->id);
163 $upd->lookin = $upd->lookin + 1; 164 $upd->lookin = $upd->lookin + 1;
164 $upd->save(); 165 $upd->save();
165 } else { 166 } else {
166 $crt = new Static_worker(); 167 $crt = new Static_worker();
167 $crt->lookin = 1; 168 $crt->lookin = 1;
168 $crt->year_month = $get_date; 169 $crt->year_month = $get_date;
169 $crt->user_id = $worker->user_id; 170 $crt->user_id = $worker->user_id;
170 $crt->save(); 171 $crt->save();
171 } 172 }
172 $stat = Static_worker::query()->where('year_month', '=', $get_date) 173 $stat = Static_worker::query()->where('year_month', '=', $get_date)
173 ->where('user_id', '=', $worker->id) 174 ->where('user_id', '=', $worker->id)
174 ->get(); 175 ->get();
175 return view('worker', compact('Query', 'status_work', 'idiot')); 176 return view('worker', compact('Query', 'status_work', 'idiot'));
176 } 177 }
177 178
178 // скачать анкету соискателя 179 // скачать анкету соискателя
179 public function resume_download(Worker $worker) 180 public function resume_download(Worker $worker)
180 { 181 {
181 $status_work = $this->status_work; 182 $status_work = $this->status_work;
182 $Query = Worker::query()->with('users')->with('job_titles') 183 $Query = Worker::query()->with('users')->with('job_titles')
183 ->with('place_worker')->with('sertificate')->with('prev_company') 184 ->with('place_worker')->with('sertificate')->with('prev_company')
184 ->with('infobloks'); 185 ->with('infobloks');
185 $Query = $Query->where('id', '=', $worker->id); 186 $Query = $Query->where('id', '=', $worker->id);
186 $Query = $Query->get()->toArray(); 187 $Query = $Query->get()->toArray();
187 188
188 view()->share('Query',$Query); 189 view()->share('Query',$Query);
189 190
190 $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape'); 191 $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape');
191 192
192 return $pdf->stream(); 193 return $pdf->stream();
193 } 194 }
194 195
195 public function resume_download_all() { 196 public function resume_download_all() {
196 $status_work = $this->status_work; 197 $status_work = $this->status_work;
197 $Query = Worker::query()->with('users')->with('job_titles') 198 $Query = Worker::query()->with('users')->with('job_titles')
198 ->with('place_worker')->with('sertificate')->with('prev_company') 199 ->with('place_worker')->with('sertificate')->with('prev_company')
199 ->with('infobloks'); 200 ->with('infobloks');
200 //$Query = $Query->where('id', '=', $worker->id); 201 //$Query = $Query->where('id', '=', $worker->id);
201 $Query = $Query->get()->toArray(); 202 $Query = $Query->get()->toArray();
202 203
203 view()->share('Query',$Query); 204 view()->share('Query',$Query);
204 205
205 $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape'); 206 $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape');
206 207
207 return $pdf->stream(); 208 return $pdf->stream();
208 } 209 }
209 210
210 // Кабинет работника 211 // Кабинет работника
211 public function cabinet(Request $request) 212 public function cabinet(Request $request)
212 { 213 {
213 // дата год и месяц 214 // дата год и месяц
214 $get_date = date('Y.m'); 215 $get_date = date('Y.m');
215 216
216 $id = Auth()->user()->id; 217 $id = Auth()->user()->id;
217 218
218 $Infobloks = infobloks::query()->get(); 219 $Infobloks = infobloks::query()->get();
219 220
220 $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')-> 221 $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')->
221 with('infobloks')->with('place_worker')-> 222 with('infobloks')->with('place_worker')->
222 WhereHas('users', 223 WhereHas('users',
223 function (Builder $query) use ($id) {$query->Where('id', $id); 224 function (Builder $query) use ($id) {$query->Where('id', $id);
224 })->get(); 225 })->get();
225 226
226 $Job_titles = Job_title::query()->OrderBy('name')->get(); 227 $Job_titles = Job_title::query()->OrderBy('name')->get();
227 $Infoblocks = infobloks::query()->OrderBy('name')->get(); 228 $Infoblocks = infobloks::query()->OrderBy('name')->get();
228 229
229 $stat = Static_worker::query()->where('year_month', '=', $get_date) 230 $stat = Static_worker::query()->where('year_month', '=', $get_date)
230 ->where('user_id', '=', $Worker[0]->id) 231 ->where('user_id', '=', $Worker[0]->id)
231 ->get(); 232 ->get();
232 233
233 // 10% 234 // 10%
234 235
235 $persent = 10; 236 $persent = 10;
236 $persent1 = 0; 237 $persent1 = 0;
237 $persent2 = 0; 238 $persent2 = 0;
238 $persent3 = 0; 239 $persent3 = 0;
239 $persent4 = 0; 240 $persent4 = 0;
240 $persent5 = 0; 241 $persent5 = 0;
241 242
242 if ((!empty($Worker[0]->telephone)) && 243 if ((!empty($Worker[0]->telephone)) &&
243 (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) && 244 (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) &&
244 (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) { 245 (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) {
245 // 40% 246 // 40%
246 $persent = $persent + 40; 247 $persent = $persent + 40;
247 $persent1 = 40; 248 $persent1 = 40;
248 } 249 }
249 250
250 //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year); 251 //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year);
251 252
252 if ($Worker[0]->sertificate->count() > 0) { 253 if ($Worker[0]->sertificate->count() > 0) {
253 // 15% 254 // 15%
254 $persent = $persent + 15; 255 $persent = $persent + 15;
255 $persent2 = 15; 256 $persent2 = 15;
256 } 257 }
257 258
258 if ($Worker[0]->infobloks->count() > 0) { 259 if ($Worker[0]->infobloks->count() > 0) {
259 // 20% 260 // 20%
260 $persent = $persent + 20; 261 $persent = $persent + 20;
261 $persent3 = 20; 262 $persent3 = 20;
262 } 263 }
263 264
264 if ($Worker[0]->prev_company->count() > 0) { 265 if ($Worker[0]->prev_company->count() > 0) {
265 // 10% 266 // 10%
266 $persent = $persent + 10; 267 $persent = $persent + 10;
267 $persent4 = 10; 268 $persent4 = 10;
268 } 269 }
269 270
270 if (!empty($Worker[0]->photo)) { 271 if (!empty($Worker[0]->photo)) {
271 // 5% 272 // 5%
272 $persent = $persent + 5; 273 $persent = $persent + 5;
273 $persent5 = 5; 274 $persent5 = 5;
274 } 275 }
275 276
276 //dd($persent1, $persent2, $persent3, $persent4, $persent5); 277 //dd($persent1, $persent2, $persent3, $persent4, $persent5);
277 278
278 if ($request->has('print')) { 279 if ($request->has('print')) {
279 dd($Worker); 280 dd($Worker);
280 } else { 281 } else {
281 return view('workers.cabinet', compact('Worker', 'Infobloks', 'persent', 'Job_titles', 'Infoblocks', 'stat')); 282 return view('workers.cabinet', compact('Worker', 'Infobloks', 'persent', 'Job_titles', 'Infoblocks', 'stat'));
282 } 283 }
283 } 284 }
284 285
285 // Сохранение данных 286 // Сохранение данных
286 public function cabinet_save(Worker $worker, Request $request) 287 public function cabinet_save(Worker $worker, Request $request)
287 { 288 {
288 $id = $worker->id; 289 $id = $worker->id;
289 $params = $request->all(); 290 $params = $request->all();
290 291
291 $job_title_id = $request->get('job_title_id'); 292 $job_title_id = $request->get('job_title_id');
292 293
293 unset($params['new_diplom']); 294 unset($params['new_diplom']);
294 unset($params['new_data_begin']); 295 unset($params['new_data_begin']);
295 unset($params['new_data_end']); 296 unset($params['new_data_end']);
296 unset($params['new_job_title']); 297 unset($params['new_job_title']);
297 unset($params['new_teplohod']); 298 unset($params['new_teplohod']);
298 unset($params['new_GWT']); 299 unset($params['new_GWT']);
299 unset($params['new_KBT']); 300 unset($params['new_KBT']);
300 unset($params['new_Begin_work']); 301 unset($params['new_Begin_work']);
301 unset($params['new_End_work']); 302 unset($params['new_End_work']);
302 unset($params['new_name_company']); 303 unset($params['new_name_company']);
303 304
304 $rules = [ 305 $rules = [
305 'surname' => ['required', 'string', 'max:255'], 306 'surname' => ['required', 'string', 'max:255'],
306 'name_man' => ['required', 'string', 'max:255'], 307 'name_man' => ['required', 'string', 'max:255'],
307 'email' => ['required', 'string', 'email', 'max:255'], 308 'email' => ['required', 'string', 'email', 'max:255'],
308 309
309 ]; 310 ];
310 311
311 $messages = [ 312 $messages = [
312 'required' => 'Укажите обязательное поле', 313 'required' => 'Укажите обязательное поле',
313 'min' => [ 314 'min' => [
314 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 315 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
315 'integer' => 'Поле «:attribute» должно быть :min или больше', 316 'integer' => 'Поле «:attribute» должно быть :min или больше',
316 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 317 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
317 ], 318 ],
318 'max' => [ 319 'max' => [
319 'string' => 'Поле «:attribute» должно быть не больше :max символов', 320 'string' => 'Поле «:attribute» должно быть не больше :max символов',
320 'integer' => 'Поле «:attribute» должно быть :max или меньше', 321 'integer' => 'Поле «:attribute» должно быть :max или меньше',
321 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 322 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
322 ] 323 ]
323 ]; 324 ];
324 325
325 $validator = Validator::make($params, $rules, $messages); 326 $validator = Validator::make($params, $rules, $messages);
326 327
327 if ($validator->fails()) { 328 if ($validator->fails()) {
328 return redirect()->route('worker.cabinet')->withErrors($validator); 329 return redirect()->route('worker.cabinet')->withErrors($validator);
329 } else { 330 } else {
330 331
331 if ($request->has('photo')) { 332 if ($request->has('photo')) {
332 if (!empty($Worker->photo)) { 333 if (!empty($Worker->photo)) {
333 Storage::delete($Worker->photo); 334 Storage::delete($Worker->photo);
334 } 335 }
335 $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); 336 $params['photo'] = $request->file('photo')->store("worker/$id", 'public');
336 } 337 }
337 338
338 if ($request->has('file')) { 339 if ($request->has('file')) {
339 if (!empty($Worker->file)) { 340 if (!empty($Worker->file)) {
340 Storage::delete($Worker->file); 341 Storage::delete($Worker->file);
341 } 342 }
342 $params['file'] = $request->file('file')->store("worker/$id", 'public'); 343 $params['file'] = $request->file('file')->store("worker/$id", 'public');
343 } 344 }
344 345
345 $id_wor = $worker->update($params); 346 $id_wor = $worker->update($params);
346 347 $use = User::find($worker->user_id);
347 $use = User_Model::find($id_wor);
348 $use->surname = $request->get('surname'); 348 $use->surname = $request->get('surname');
349 $use->name_man = $request->get('name_man'); 349 $use->name_man = $request->get('name_man');
350 $use->surname2 = $request->get('surname2'); 350 $use->surname2 = $request->get('surname2');
351 351
352 $use->save(); 352 $use->save();
353 $worker->job_titles()->sync($job_title_id); 353 $worker->job_titles()->sync($job_title_id);
354 354
355 return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); 355 return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены');
356 } 356 }
357 } 357 }
358 358
359 // Сообщения данные 359 // Сообщения данные
360 public function messages($type_message) 360 public function messages($type_message)
361 { 361 {
362 $user_id = Auth()->user()->id; 362 $user_id = Auth()->user()->id;
363 363
364 $messages_input = Message::query()->with('vacancies')->with('user_from')-> 364 $messages_input = Message::query()->with('vacancies')->with('user_from')->
365 Where('to_user_id', $user_id)->OrderByDesc('created_at'); 365 Where('to_user_id', $user_id)->OrderByDesc('created_at');
366 366
367 $messages_output = Message::query()->with('vacancies')-> 367 $messages_output = Message::query()->with('vacancies')->
368 with('user_to')->where('user_id', $user_id)-> 368 with('user_to')->where('user_id', $user_id)->
369 OrderByDesc('created_at'); 369 OrderByDesc('created_at');
370 370
371 371
372 $count_input = $messages_input->count(); 372 $count_input = $messages_input->count();
373 $count_output = $messages_output->count(); 373 $count_output = $messages_output->count();
374 374
375 if ($type_message == 'input') { 375 if ($type_message == 'input') {
376 $messages = $messages_input->paginate(15); 376 $messages = $messages_input->paginate(15);
377 } 377 }
378 378
379 if ($type_message == 'output') { 379 if ($type_message == 'output') {
380 $messages = $messages_output->paginate(15); 380 $messages = $messages_output->paginate(15);
381 } 381 }
382 // Вернуть все 100% 382 // Вернуть все 100%
383 return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); 383 return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id'));
384 } 384 }
385 385
386 // Избранный 386 // Избранный
387 public function favorite() 387 public function favorite()
388 { 388 {
389 return view('workers.favorite'); 389 return view('workers.favorite');
390 } 390 }
391 391
392 // Сменить пароль 392 // Сменить пароль
393 public function new_password() 393 public function new_password()
394 { 394 {
395 $email = Auth()->user()->email; 395 $email = Auth()->user()->email;
396 return view('workers.new_password', compact('email')); 396 return view('workers.new_password', compact('email'));
397 } 397 }
398 398
399 // Обновление пароля 399 // Обновление пароля
400 public function save_new_password(Request $request) { 400 public function save_new_password(Request $request) {
401 $use = Auth()->user(); 401 $use = Auth()->user();
402 $request->validate([ 402 $request->validate([
403 'password' => 'required|string', 403 'password' => 'required|string',
404 'new_password' => 'required|string', 404 'new_password' => 'required|string',
405 'new_password2' => 'required|string' 405 'new_password2' => 'required|string'
406 ]); 406 ]);
407 407
408 if ($request->get('new_password') == $request->get('new_password2')) 408 if ($request->get('new_password') == $request->get('new_password2'))
409 if ($request->get('password') !== $request->get('new_password')) { 409 if ($request->get('password') !== $request->get('new_password')) {
410 $credentials = $request->only('email', 'password'); 410 $credentials = $request->only('email', 'password');
411 if (Auth::attempt($credentials, $request->has('save_me'))) { 411 if (Auth::attempt($credentials, $request->has('save_me'))) {
412 412
413 if (!is_null($use->email_verified_at)){ 413 if (!is_null($use->email_verified_at)){
414 414
415 $user_data = User_Model::find($use->id); 415 $user_data = User_Model::find($use->id);
416 $user_data->update([ 416 $user_data->update([
417 'password' => Hash::make($request->get('new_password')), 417 'password' => Hash::make($request->get('new_password')),
418 'pubpassword' => base64_encode($request->get('new_password')), 418 'pubpassword' => base64_encode($request->get('new_password')),
419 ]); 419 ]);
420 return redirect() 420 return redirect()
421 ->route('worker.new_password') 421 ->route('worker.new_password')
422 ->with('success', 'Поздравляю! Вы обновили свой пароль!'); 422 ->with('success', 'Поздравляю! Вы обновили свой пароль!');
423 } 423 }
424 424
425 return redirect() 425 return redirect()
426 ->route('worker.new_password') 426 ->route('worker.new_password')
427 ->withError('Данная учетная запись не было верифицированна!'); 427 ->withError('Данная учетная запись не было верифицированна!');
428 } 428 }
429 } 429 }
430 430
431 return redirect() 431 return redirect()
432 ->route('worker.new_password') 432 ->route('worker.new_password')
433 ->withErrors('Не совпадение данных, обновите пароли!'); 433 ->withErrors('Не совпадение данных, обновите пароли!');
434 } 434 }
435 435
436 // Удаление профиля форма 436 // Удаление профиля форма
437 public function delete_profile() 437 public function delete_profile()
438 { 438 {
439 $login = Auth()->user()->email; 439 $login = Auth()->user()->email;
440 return view('workers.delete_profile', compact('login')); 440 return view('workers.delete_profile', compact('login'));
441 } 441 }
442 442
443 // Удаление профиля код 443 // Удаление профиля код
444 public function delete_profile_result(Request $request) { 444 public function delete_profile_result(Request $request) {
445 $Answer = $request->all(); 445 $Answer = $request->all();
446 $user_id = Auth()->user()->id; 446 $user_id = Auth()->user()->id;
447 $request->validate([ 447 $request->validate([
448 'password' => 'required|string', 448 'password' => 'required|string',
449 ]); 449 ]);
450 450
451 $credentials = $request->only('email', 'password'); 451 $credentials = $request->only('email', 'password');
452 if (Auth::attempt($credentials)) { 452 if (Auth::attempt($credentials)) {
453 Auth::logout(); 453 Auth::logout();
454 $it = User_Model::find($user_id); 454 $it = User_Model::find($user_id);
455 $it->delete(); 455 $it->delete();
456 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); 456 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт');
457 } else { 457 } else {
458 return redirect()->route('worker.delete_profile') 458 return redirect()->route('worker.delete_profile')
459 ->withErrors( 'Неверный пароль! Нужен корректный пароль'); 459 ->withErrors( 'Неверный пароль! Нужен корректный пароль');
460 } 460 }
461 } 461 }
462 462
463 // Регистрация соискателя 463 // Регистрация соискателя
464 public function register_worker(Request $request) 464 public function register_worker(Request $request)
465 { 465 {
466 $params = $request->all(); 466 $params = $request->all();
467 $params['is_worker'] = 1; 467 $params['is_worker'] = 1;
468 468
469 $rules = [ 469 $rules = [
470 'surname' => ['required', 'string', 'max:255'], 470 'surname' => ['required', 'string', 'max:255'],
471 'name_man' => ['required', 'string', 'max:255'], 471 'name_man' => ['required', 'string', 'max:255'],
472 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 472 'email' => ['required', 'email', 'max:255', 'unique:users'],
473 'password' => ['required', 'string', 'min:8'] 473 'password' => ['required', 'string', 'min:8']
474 ]; 474 ];
475 475
476 $messages = [ 476 $messages = [
477 'required' => 'Укажите обязательное поле', 477 'required' => 'Укажите обязательное поле',
478 'min' => [ 478 'min' => [
479 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 479 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
480 'integer' => 'Поле «:attribute» должно быть :min или больше', 480 'integer' => 'Поле «:attribute» должно быть :min или больше',
481 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 481 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
482 ], 482 ],
483 'max' => [ 483 'max' => [
484 'string' => 'Поле «:attribute» должно быть не больше :max символов', 484 'string' => 'Поле «:attribute» должно быть не больше :max символов',
485 'integer' => 'Поле «:attribute» должно быть :max или меньше', 485 'integer' => 'Поле «:attribute» должно быть :max или меньше',
486 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 486 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
487 ] 487 ]
488 ]; 488 ];
489 489
490 $email = $request->get('email');
491 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) {
492 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл"));
493 }
494
490 if ($request->get('password') !== $request->get('confirmed')){ 495 if ($request->get('password') !== $request->get('confirmed')){
491 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); 496 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля"));
492 } 497 }
493 498
494 $haystack = $request->get('password'); 499 $haystack = $request->get('password');
495 500
496 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); 501 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?');
497 $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 502 $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z',
498 'X', 'C', 'V', 'B', 'N', 'M'); 503 'X', 'C', 'V', 'B', 'N', 'M');
504 $lenpwd_bool = true;
499 $spec_bool = false; 505 $spec_bool = false;
500 $alpha_bool = false; 506 $alpha_bool = false;
501 507
508 if (strlen($haystack) < 8) $lenpwd_bool = false;
509
502 foreach ($specsumbol as $it) { 510 foreach ($specsumbol as $it) {
503 if (strpos($haystack, $it) !== false) { 511 if (strpos($haystack, $it) !== false) {
504 $spec_bool = true; 512 $spec_bool = true;
505 } 513 }
506 } 514 }
507 515
508 foreach ($alpha as $it) { 516 foreach ($alpha as $it) {
509 if (strpos($haystack, $it) !== false) { 517 if (strpos($haystack, $it) !== false) {
510 $alpha_bool = true; 518 $alpha_bool = true;
511 } 519 }
512 } 520 }
513 521
522 if (!$lenpwd_bool) {
523 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!"));
524 }
525
514 if ((!$spec_bool) || (!$alpha_bool)) { 526 if ((!$spec_bool) || (!$alpha_bool)) {
515 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); 527 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?"));
516 } 528 }
517 529
518 if (($request->has('politik')) && ($request->get('politik') == 1)) { 530 if (($request->has('politik')) && ($request->get('politik') == 1)) {
519 $validator = Validator::make($params, $rules, $messages); 531 $validator = Validator::make($params, $rules, $messages);
520 532
521 if ($validator->fails()) { 533 if ($validator->fails()) {
522 return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); 534 return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе."));
523 } else { 535 } else {
524 536 //dd($params);
525 $user = $this->create($params); 537 $user = $this->create($params);
526 event(new Registered($user)); 538 event(new Registered($user));
527 Auth::guard()->login($user); 539 Auth::guard()->login($user);
528 } 540 }
529 if ($user) { 541 if ($user) {
530 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; 542 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));;
531 } else { 543 } else {
532 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); 544 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!"));
533 } 545 }
534 546
535 } else { 547 } else {
536 return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); 548 return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!"));
537 } 549 }
538 } 550 }
539 551
540 // Звездная оценка и ответ 552 // Звездная оценка и ответ
541 public function stars_answer(Request $request) { 553 public function stars_answer(Request $request) {
542 $params = $request->all(); 554 $params = $request->all();
543 $rules = [ 555 $rules = [
544 'message' => ['required', 'string', 'max:255'], 556 'message' => ['required', 'string', 'max:255'],
545 ]; 557 ];
546 558
547 $messages = [ 559 $messages = [
548 'required' => 'Укажите обязательное поле', 560 'required' => 'Укажите обязательное поле',
549 'min' => [ 561 'min' => [
550 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 562 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
551 'integer' => 'Поле «:attribute» должно быть :min или больше', 563 'integer' => 'Поле «:attribute» должно быть :min или больше',
552 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 564 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
553 ], 565 ],
554 'max' => [ 566 'max' => [
555 'string' => 'Поле «:attribute» должно быть не больше :max символов', 567 'string' => 'Поле «:attribute» должно быть не больше :max символов',
556 'integer' => 'Поле «:attribute» должно быть :max или меньше', 568 'integer' => 'Поле «:attribute» должно быть :max или меньше',
557 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 569 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
558 ] 570 ]
559 ]; 571 ];
560 $response_worker = ResponseWork::create($params); 572 $response_worker = ResponseWork::create($params);
561 return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); 573 return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!');
562 } 574 }
563 575
576 public function TestWorker()
577 {
578 $Use = new User();
579
580 $Code_user = $Use->create([
581 'name' => 'surname name_man',
582 'name_man' => 'name_man',
583 'surname' => 'surname',
584 'surname2' => 'surname2',
585 'subscribe_email' => '1',
586 'email' => 'email@mail.com',
587 'telephone' => '1234567890',
588 'password' => Hash::make('password'),
589 'pubpassword' => base64_encode('password'),
590 'email_verified_at' => Carbon::now(),
591 'is_worker' => 1,
592 ]);
593
594 if ($Code_user->id > 0) {
595 $Worker = new Worker();
596 $Worker->user_id = $Code_user->id;
597 $Worker->position_work = 1; //'job_titles';
598 $Worker->email = 'email@email.com';
599 $Worker->telephone = '1234567890';
600 $status = $Worker->save();
601
602 $Title_Worker = new Title_worker();
603 $Title_Worker->worker_id = $Worker->id;
604 $Title_Worker->job_title_id = 1;
605 $Title_Worker->save();
606 }
607 }
608
564 // Создание пользователя 609 // Создание пользователя
565 protected function create(array $data) 610 protected function create(array $data)
566 { 611 {
567 $Use = new User(); 612 $Use = new User();
613
568 $Code_user = $Use->create([ 614 $Code_user = $Use->create([
569 'name' => $data['surname']." ".$data['name_man'], 615 'name' => $data['surname']." ".$data['name_man'],
570 'name_man' => $data['name_man'], 616 'name_man' => $data['name_man'],
571 'surname' => $data['surname'], 617 'surname' => $data['surname'],
572 'surname2' => $data['surname2'], 618 'surname2' => $data['surname2'],
573 'subscribe_email' => $data['email'], 619 'subscribe_email' => $data['email'],
574 'email' => $data['email'], 620 'email' => $data['email'],
575 'telephone' => $data['telephone'], 621 'telephone' => $data['telephone'],
576 'password' => Hash::make($data['password']), 622 'password' => Hash::make($data['password']),
577 'pubpassword' => base64_encode($data['password']), 623 'pubpassword' => base64_encode($data['password']),
578 'email_verified_at' => Carbon::now(), 624 'email_verified_at' => Carbon::now(),
579 'is_worker' => $data['is_worker'], 625 'is_worker' => $data['is_worker'],
580 ]); 626 ]);
627
581 if ($Code_user->id > 0) { 628 if ($Code_user->id > 0) {
582 $Worker = new Worker(); 629 $Worker = new Worker();
583 $Worker->user_id = $Code_user->id; 630 $Worker->user_id = $Code_user->id;
584 $Worker->position_work = $data['job_titles']; 631 $Worker->position_work = $data['job_titles'];
585 $Worker->email = $data['email']; 632 $Worker->email = $data['email'];
586 $Worker->telephone = $data['telephone']; 633 $Worker->telephone = $data['telephone'];
587 $Worker->save(); 634 $Worker->save();
588 635
636 if (isset($Worker->id)) {
637 $Title_Worker = new Title_worker();
638 $Title_Worker->worker_id = $Worker->id;
639 $Title_Worker->job_title_id = $data['job_titles'];
640 $Title_Worker->save();
641 }
642
589 return $Code_user; 643 return $Code_user;
590 } 644 }
591 } 645 }
592 646
593 // Вакансии избранные 647 // Вакансии избранные
594 public function colorado(Request $request) { 648 public function colorado(Request $request) {
595 $IP_address = RusDate::ip_addr_client(); 649 $IP_address = RusDate::ip_addr_client();
596 $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); 650 $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get();
597 651
598 if ($Arr->count()) { 652 if ($Arr->count()) {
599 $A = Array(); 653 $A = Array();
600 foreach ($Arr as $it) { 654 foreach ($Arr as $it) {
601 $A[] = $it->code_record; 655 $A[] = $it->code_record;
602 } 656 }
603 657
604 $Query = Ad_employer::query()->whereIn('id', $A); 658 $Query = Ad_employer::query()->whereIn('id', $A);
605 } else { 659 } else {
606 $Query = Ad_employer::query()->where('id', '=', '0'); 660 $Query = Ad_employer::query()->where('id', '=', '0');
607 } 661 }
608 662
609 $Query = $Query->with('jobs')-> 663 $Query = $Query->with('jobs')->
610 with('cat')-> 664 with('cat')->
611 with('employer')-> 665 with('employer')->
612 whereHas('jobs_code', function ($query) use ($request) { 666 whereHas('jobs_code', function ($query) use ($request) {
613 if ($request->ajax()) { 667 if ($request->ajax()) {
614 if (null !== ($request->get('job'))) { 668 if (null !== ($request->get('job'))) {
615 $query->where('job_title_id', $request->get('job')); 669 $query->where('job_title_id', $request->get('job'));
616 } 670 }
617 } 671 }
618 })->select('ad_employers.*'); 672 })->select('ad_employers.*');
619 673
620 $Job_title = Job_title::query()->OrderBy('name')->get(); 674 $Job_title = Job_title::query()->OrderBy('name')->get();
621 675
622 $Query_count = $Query->count(); 676 $Query_count = $Query->count();
623 677
624 $Query = $Query->OrderBy('updated_at')->paginate(3); 678 $Query = $Query->OrderBy('updated_at')->paginate(3);
625 679
626 680
627 return view('workers.favorite', compact('Query', 681 return view('workers.favorite', compact('Query',
628 'Query_count', 682 'Query_count',
629 'Job_title')); 683 'Job_title'));
630 684
631 } 685 }
632 686
633 //Переписка 687 //Переписка
634 public function dialog(User_Model $user1, User_Model $user2) { 688 public function dialog(User_Model $user1, User_Model $user2) {
635 if (isset($user2->id)) { 689 if (isset($user2->id)) {
636 $companion = User_Model::query()->with('workers')-> 690 $companion = User_Model::query()->with('workers')->
637 with('employers')-> 691 with('employers')->
638 where('id', $user2->id)->first(); 692 where('id', $user2->id)->first();
639 } 693 }
640 694
641 $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) { 695 $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) {
642 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); 696 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id);
643 })->orWhere(function($query) use ($user1, $user2) { 697 })->orWhere(function($query) use ($user1, $user2) {
644 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); 698 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id);
645 })->OrderBy('created_at')->get(); 699 })->OrderBy('created_at')->get();
646 700
647 $id_vac = null; 701 $id_vac = null;
648 foreach ($Messages as $it) { 702 foreach ($Messages as $it) {
649 if (isset($it->response)) { 703 if (isset($it->response)) {
650 foreach ($it->response as $r) { 704 foreach ($it->response as $r) {
651 if (isset($r->ad_employer_id)) { 705 if (isset($r->ad_employer_id)) {
652 $id_vac = $r->ad_employer_id; 706 $id_vac = $r->ad_employer_id;
653 break; 707 break;
654 } 708 }
655 } 709 }
656 } 710 }
657 if (!is_null($id_vac)) break; 711 if (!is_null($id_vac)) break;
658 } 712 }
659 713
660 $ad_employer = null; 714 $ad_employer = null;
661 if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); 715 if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first();
662 $sender = $user1; 716 $sender = $user1;
663 717
664 return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); 718 return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer'));
665 } 719 }
666 720
667 // Даунылоады 721 // Даунылоады
668 public function download(Worker $worker) { 722 public function download(Worker $worker) {
669 $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; 723 $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...'];
670 view()->share('house',$arr_house); 724 view()->share('house',$arr_house);
671 $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); 725 $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape');
672 return $pdf->stream(); 726 return $pdf->stream();
673 } 727 }
674 728
675 // Поднятие анкеты 729 // Поднятие анкеты
676 public function up(Worker $worker) { 730 public function up(Worker $worker) {
677 $worker->updated_at = Carbon::now(); 731 $worker->updated_at = Carbon::now();
678 $worker->save(); 732 $worker->save();
679 // 0 733 // 0
680 return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); 734 return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных');
681 } 735 }
682 736
683 // Форма сертификате 737 // Форма сертификате
684 public function new_sertificate(Worker $worker) { 738 public function new_sertificate(Worker $worker) {
685 return view('workers.sertificate_add', compact('worker')); 739 return view('workers.sertificate_add', compact('worker'));
686 } 740 }
687 741
688 // Добавление сертификата 742 // Добавление сертификата
689 public function add_serificate(SertificationRequest $request) { 743 public function add_serificate(SertificationRequest $request) {
690 $params = $request->all(); 744 $params = $request->all();
691 745
692 $Sertificate = new sertification(); 746 $Sertificate = new sertification();
693 $Sertificate->create($params); 747 $Sertificate->create($params);
694 $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get(); 748 $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get();
695 return redirect()->route('worker.cabinet'); 749 return redirect()->route('worker.cabinet');
696 //return view('ajax.documents', compact('Docs')); 750 //return view('ajax.documents', compact('Docs'));
697 } 751 }
698 752
699 // Удалить сертификат 753 // Удалить сертификат
700 public function delete_sertificate(sertification $doc) { 754 public function delete_sertificate(sertification $doc) {
701 $doc->delete(); 755 $doc->delete();
702 756
703 return redirect()->route('worker.cabinet'); 757 return redirect()->route('worker.cabinet');
704 } 758 }
705 759
706 // Редактирование сертификата 760 // Редактирование сертификата
707 public function edit_sertificate(Worker $worker, sertification $doc) { 761 public function edit_sertificate(Worker $worker, sertification $doc) {
708 return view('workers.sertificate_edit', compact('doc', 'worker')); 762 return view('workers.sertificate_edit', compact('doc', 'worker'));
709 } 763 }
710 764
711 // Редактирование обновление сертификата 765 // Редактирование обновление сертификата
712 public function update_serificate(SertificationRequest $request, sertification $doc) { 766 public function update_serificate(SertificationRequest $request, sertification $doc) {
713 $all = $request->all(); 767 $all = $request->all();
714 $doc->worker_id = $all['worker_id']; 768 $doc->worker_id = $all['worker_id'];
715 $doc->name = $all['name']; 769 $doc->name = $all['name'];
716 $doc->end_begin = $all['end_begin']; 770 $doc->end_begin = $all['end_begin'];
717 $doc->save(); 771 $doc->save();
718 772
719 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); 773 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!');
720 } 774 }
721 775
722 public function delete_add_diplom(Request $request, Worker $worker) { 776 public function delete_add_diplom(Request $request, Worker $worker) {
723 $infoblok_id = $request->get('infoblok_id'); 777 $infoblok_id = $request->get('infoblok_id');
724 778
725 if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) 779 if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0)
726 $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); 780 $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete();
727 else { 781 else {
728 $params['infoblok_id'] = $infoblok_id; 782 $params['infoblok_id'] = $infoblok_id;
729 $params['worker_id'] = $worker->id; 783 $params['worker_id'] = $worker->id;
730 $id = Dop_info::create($params); 784 $id = Dop_info::create($params);
731 //$id = $worker->infobloks()->sync([$infoblok_id]); 785 //$id = $worker->infobloks()->sync([$infoblok_id]);
732 } 786 }
733 787
734 //$Infoblocks = infobloks::query()->get(); 788 //$Infoblocks = infobloks::query()->get();
735 return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); 789 return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks'));
736 } 790 }
737 791
738 792
739 793
740 // Добавление диплома 794 // Добавление диплома
741 public function add_diplom_ajax(Request $request) { 795 public function add_diplom_ajax(Request $request) {
742 // конец 796 // конец
743 $params = $request->all(); 797 $params = $request->all();
744 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); 798 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count();
745 799
746 if ($count == 0) $dop_info = Dop_info::create($params); 800 if ($count == 0) $dop_info = Dop_info::create($params);
747 $Infoblocks = infobloks::query()->get(); 801 $Infoblocks = infobloks::query()->get();
748 $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); 802 $Worker = Worker::query()->where('id', $request->get('worker_id'))->get();
749 $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); 803 $data = Dop_info::query()->where('worker_id', $request->has('worker_id'));
750 return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); 804 return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker'));
751 } 805 }
752 806
753 // Добавление диплома без ajax 807 // Добавление диплома без ajax
754 public function add_diplom(Worker $worker) { 808 public function add_diplom(Worker $worker) {
755 $worker_id = $worker->id; 809 $worker_id = $worker->id;
756 $Infoblocks = infobloks::query()->get(); 810 $Infoblocks = infobloks::query()->get();
757 return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); 811 return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks'));
758 } 812 }
759 // Сохранить 813 // Сохранить
760 // Сохраняю диплом 814 // Сохраняю диплом
761 public function add_diplom_save(Request $request) { 815 public function add_diplom_save(Request $request) {
762 $params = $request->all(); 816 $params = $request->all();
763 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); 817 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count();
764 if ($count == 0) $dop_info = Dop_info::create($params); 818 if ($count == 0) $dop_info = Dop_info::create($params);
765 return redirect()->route('worker.cabinet'); 819 return redirect()->route('worker.cabinet');
766 } 820 }
767 821
768 // Добавление стандартного документа 822 // Добавление стандартного документа
769 public function add_document(Worker $worker) { 823 public function add_document(Worker $worker) {
770 return view('workers.docs', compact('worker')); 824 return view('workers.docs', compact('worker'));
771 } 825 }
772 826
773 //Сохранение стандартого документа 827 //Сохранение стандартого документа
774 public function add_document_save(DocumentsRequest $request) { 828 public function add_document_save(DocumentsRequest $request) {
775 $params = $request->all(); 829 $params = $request->all();
776 $place_work = place_works::create($params); 830 $place_work = place_works::create($params);
777 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!'); 831 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!');
778 } 832 }
779 833
780 // Редактирование документа 834 // Редактирование документа
781 public function edit_document(place_works $doc, Worker $worker) { 835 public function edit_document(place_works $doc, Worker $worker) {
782 return view('workers.docs-edit', compact('doc', 'worker')); 836 return view('workers.docs-edit', compact('doc', 'worker'));
783 } 837 }
784 838
785 //Сохранение отредактированного документа 839 //Сохранение отредактированного документа
786 public function edit_document_save(DocumentsRequest $request, place_works $doc) { 840 public function edit_document_save(DocumentsRequest $request, place_works $doc) {
787 $params = $request->all(); 841 $params = $request->all();
788 $doc->update($params); 842 $doc->update($params);
789 843
790 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); 844 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!');
791 } 845 }
792 846
793 // Удаление документа 847 // Удаление документа
794 public function delete_document(place_works $doc) { 848 public function delete_document(place_works $doc) {
795 $doc->delete(); 849 $doc->delete();
796 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); 850 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!');
797 } 851 }
798 852
799 //Отправка нового сообщения 853 //Отправка нового сообщения
800 public function new_message(Request $request) { 854 public function new_message(Request $request) {
801 $params = $request->all(); 855 $params = $request->all();
802 856
803 $id = $params['send_user_id']; 857 $id = $params['send_user_id'];
804 $message = new Message(); 858 $message = new Message();
805 $message->user_id = $params['send_user_id']; 859 $message->user_id = $params['send_user_id'];
806 $message->to_user_id = $params['send_to_user_id']; 860 $message->to_user_id = $params['send_to_user_id'];
807 $message->title = $params['send_title']; 861 $message->title = $params['send_title'];
808 $message->text = $params['send_text']; 862 $message->text = $params['send_text'];
809 if ($request->has('send_file')) { 863 if ($request->has('send_file')) {
810 $message->file = $request->file('send_file')->store("worker/$id", 'public'); 864 $message->file = $request->file('send_file')->store("worker/$id", 'public');
811 } 865 }
812 $message->flag_new = 1; 866 $message->flag_new = 1;
813 $id_message = $message->save(); 867 $id_message = $message->save();
814 868
815 $data['message_id'] = $id_message; 869 $data['message_id'] = $id_message;
816 $data['ad_employer_id'] = $params['send_vacancy']; 870 $data['ad_employer_id'] = $params['send_vacancy'];
817 $data['job_title_id'] = $params['send_job_title_id']; 871 $data['job_title_id'] = $params['send_job_title_id'];
818 $data['flag'] = 1; 872 $data['flag'] = 1;
819 $ad_responce = ad_response::create($data); 873 $ad_responce = ad_response::create($data);
820 return redirect()->route('worker.messages', ['type_message' => 'output']); 874 return redirect()->route('worker.messages', ['type_message' => 'output']);
821 } 875 }
822 876
823 // Информация о предыдущих компаниях 877 // Информация о предыдущих компаниях
824 public function new_prev_company(Worker $worker) { 878 public function new_prev_company(Worker $worker) {
825 return view('workers.prev_company_form', compact('worker')); 879 return view('workers.prev_company_form', compact('worker'));
826 } 880 }
827 881
828 // Добавление контакта компании 882 // Добавление контакта компании
829 public function add_prev_company(PrevCompanyRequest $request) { 883 public function add_prev_company(PrevCompanyRequest $request) {
830 // Возвращение параметров 884 // Возвращение параметров
831 $all = $request->all(); 885 $all = $request->all();
832 $PrevCompany = PrevCompany::create($all); 886 $PrevCompany = PrevCompany::create($all);
833 887
834 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); 888 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись');
835 } 889 }
836 890
837 // Удаление контакта предыдущей компании 891 // Удаление контакта предыдущей компании
838 public function delete_prev_company(PrevCompany $doc) { 892 public function delete_prev_company(PrevCompany $doc) {
839 $doc->delete(); 893 $doc->delete();
840 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); 894 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!');
841 } 895 }
842 } 896 }
843 897
app/Http/Requests/RequestAdminNews.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Requests; 3 namespace App\Http\Requests;
4 4
5 use Illuminate\Foundation\Http\FormRequest; 5 use Illuminate\Foundation\Http\FormRequest;
6 use Illuminate\Support\Arr; 6 use Illuminate\Support\Arr;
7 7
8 class RequestAdminNews extends FormRequest 8 class RequestAdminNews extends FormRequest
9 { 9 {
10 /** 10 /**
11 * Determine if the user is authorized to make this request. 11 * Determine if the user is authorized to make this request.
12 * 12 *
13 * @return bool 13 * @return bool
14 */ 14 */
15 public function authorize() 15 public function authorize()
16 { 16 {
17 return true; 17 return true;
18 } 18 }
19 19
20 /** 20 /**
21 * Get the validation rules that apply to the request. 21 * Get the validation rules that apply to the request.
22 * 22 *
23 * @return array<string, mixed> 23 * @return array<string, mixed>
24 */ 24 */
25 public function rules() 25 public function rules()
26 { 26 {
27 if (in_array($this->route()->getName(), ['admin.new_admin_update'])) { 27 if (in_array($this->route()->getName(), ['admin.new_admin_update'])) {
28 // получаем модель Pages через маршрут admin/editor-pages/edit/{page} 28 // получаем модель Pages через маршрут admin/editor-pages/edit/{page}
29 $model = $this->route('new_admin_edit'); 29 $model = $this->route('new_admin_edit');
30 } else { 30 } else {
31 $unique = 'unique:news,slug'; 31 $unique = 'unique:news,slug';
32 $Array1['slug'] = [ 32 $Array1['slug'] = [
33 'required', 33 'required',
34 'max:255', 34 'max:255',
35 $unique, 35 $unique,
36 'regex:~^[-_a-z0-9]+$~i', 36 'regex:~^[-_a-z0-9]+$~i',
37 ]; 37 ];
38 } 38 }
39 39
40 $Array1 = [ 40 $Array1 = [
41 'title' => [ 41 'title' => [
42 'required', 42 'required',
43 'string', 43 'string',
44 'min:3', 44 'min:3',
45 'max:255', 45 'max:255',
46 ], 46 ],
47 'text' => [ 47 'text' => [
48 'required', 48 'required',
49 'min:255', 49 'min:50',
50 'max:99999999'
50 ], 51 ],
51 ]; 52 ];
52 return $Array1; 53 return $Array1;
53 } 54 }
54 } 55 }
55 56
resources/views/admin/news/edit.blade.php
1 @extends('layout.admin', ['title' => 'Админка - Редактирование новости']) 1 @extends('layout.admin', ['title' => 'Админка - Редактирование новости'])
2 2
3 @section('content') 3 @section('content')
4 <script>
5 function translit(word){
6 var answer = '';
7 var converter = {
8 'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd',
9 'е': 'e', 'ё': 'e', 'ж': 'zh', 'з': 'z', 'и': 'i',
10 'й': 'y', 'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n',
11 'о': 'o', 'п': 'p', 'р': 'r', 'с': 's', 'т': 't',
12 'у': 'u', 'ф': 'f', 'х': 'h', 'ц': 'c', 'ч': 'ch',
13 'ш': 'sh', 'щ': 'sch', 'ь': '', 'ы': 'y', 'ъ': '',
14 'э': 'e', 'ю': 'yu', 'я': 'ya',
15
16 'А': 'A', 'Б': 'B', 'В': 'V', 'Г': 'G', 'Д': 'D',
17 'Е': 'E', 'Ё': 'E', 'Ж': 'Zh', 'З': 'Z', 'И': 'I',
18 'Й': 'Y', 'К': 'K', 'Л': 'L', 'М': 'M', 'Н': 'N',
19 'О': 'O', 'П': 'P', 'Р': 'R', 'С': 'S', 'Т': 'T',
20 'У': 'U', 'Ф': 'F', 'Х': 'H', 'Ц': 'C', 'Ч': 'Ch',
21 'Ш': 'Sh', 'Щ': 'Sch', 'Ь': '', 'Ы': 'Y', 'Ъ': '',
22 'Э': 'E', 'Ю': 'Yu', 'Я': 'Ya', ' ': '-'
23 };
24
25 for (var i = 0; i < word.length; ++i ) {
26 if (converter[word[i]] == undefined){
27 answer += word[i];
28 } else {
29 answer += converter[word[i]];
30 }
31 }
32
33 return answer;
34 }
35
36 window.addEventListener("DOMContentLoaded", (event) => {
37 let title = document.querySelector('#title');
38 let text = document.querySelector('#slug');
39
40 title.addEventListener('input', function() {
41 text.value = translit(this.value);
42 });
43 });
44
45 </script>
4 <form method="POST" action="{{ route('admin.new_admin_update', ['new' => $new->id]) }}" enctype="multipart/form-data"> 46 <form method="POST" action="{{ route('admin.new_admin_update', ['new' => $new->id]) }}" enctype="multipart/form-data">
5 @csrf 47 @csrf
6 @include('admin.news.form') 48
49
50 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
51 <label class="block text-sm">
52 <span class="text-gray-700 dark:text-gray-400">Заголовой новости</span>
53 <input name="title" id="title"
54 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
55 placeholder="Заголовой новости" value="{{ old('title') ?? ((isset($new->title)) ? $new->title : '') }}"
56 />
57 @error('title')
58 <span class="text-xs text-red-600 dark:text-red-400">
59 {{ $message }}
60 </span>
61 @enderror
62 </label><br>
63
64 <label class="block text-sm">
65 <span class="text-gray-700 dark:text-gray-400">Код в URL-строке</span>
66 <input name="slug" id="slug"
67 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
68 placeholder="Код в URL-строке" value="{{ old('slug') ?? (isset($new->slug)) ? $new->slug : '' ?? '' }}"
69 />
70 @error('slug')
71 <span class="text-xs text-red-600 dark:text-red-400">
72 {{ $message }}
73 </span>
74 @enderror
75 </label><br>
76
77 <label class="block text-sm">
78 <span class="text-gray-700 dark:text-gray-400">Текст</span>
79 <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor" name="text" id="text" placeholder="Текст (html)" required
80 rows="10">{{ old('text') ?? $new->text ?? '' }}</textarea>
81 @error('text')
82 <span class="text-xs text-red-600 dark:text-red-400">
83 {{ $message }}
84 </span>
85 @enderror
86 </label><br>
87
88 <label class="block text-sm">
89 <span class="text-gray-700 dark:text-gray-400">Картинка</span>
90 <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600
91 dark:bg-gray-700 focus:border-purple-400
92 focus:outline-none focus:shadow-outline-purple
93 dark:text-gray-300 dark:focus:shadow-outline-gray
94 form-input"
95 id="image" name="image" accept="image/png, image/jpeg">
96 @error('image')
97 <span class="text-xs text-red-600 dark:text-red-400">
98 {{ $message }}
99 </span>
100 @enderror
101 @isset($new->image)
102 <img src="{{asset(Storage::url($new->image))}}" width="100px"/>
103 @endisset
104
105 </label><br>
106
107 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
108 <div>
109 <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
110 Сохранить
111 </button>
112 <a href="{{ route('admin.news_admin') }}"
113 class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"
114 style="display: -webkit-inline-box; height: 30px!important;"
115 >Назад</a>
116 </div>
117 </div>
118 </div>
7 </form> 119 </form>
120 <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script>
121 <script>
122 CKEDITOR.replace( 'text', {
123 filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}",
124 filebrowserUploadMethod: 'form'
125 });
126 </script>
8 @endsection 127 @endsection
9 128
resources/views/admin/news/form.blade.php
1 <script> 1 <script>
2 function translit(word){ 2 function translit(word){
3 var answer = ''; 3 var answer = '';
4 var converter = { 4 var converter = {
5 'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd', 5 'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd',
6 'е': 'e', 'ё': 'e', 'ж': 'zh', 'з': 'z', 'и': 'i', 6 'е': 'e', 'ё': 'e', 'ж': 'zh', 'з': 'z', 'и': 'i',
7 'й': 'y', 'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n', 7 'й': 'y', 'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n',
8 'о': 'o', 'п': 'p', 'р': 'r', 'с': 's', 'т': 't', 8 'о': 'o', 'п': 'p', 'р': 'r', 'с': 's', 'т': 't',
9 'у': 'u', 'ф': 'f', 'х': 'h', 'ц': 'c', 'ч': 'ch', 9 'у': 'u', 'ф': 'f', 'х': 'h', 'ц': 'c', 'ч': 'ch',
10 'ш': 'sh', 'щ': 'sch', 'ь': '', 'ы': 'y', 'ъ': '', 10 'ш': 'sh', 'щ': 'sch', 'ь': '', 'ы': 'y', 'ъ': '',
11 'э': 'e', 'ю': 'yu', 'я': 'ya', 11 'э': 'e', 'ю': 'yu', 'я': 'ya',
12 12
13 'А': 'A', 'Б': 'B', 'В': 'V', 'Г': 'G', 'Д': 'D', 13 'А': 'A', 'Б': 'B', 'В': 'V', 'Г': 'G', 'Д': 'D',
14 'Е': 'E', 'Ё': 'E', 'Ж': 'Zh', 'З': 'Z', 'И': 'I', 14 'Е': 'E', 'Ё': 'E', 'Ж': 'Zh', 'З': 'Z', 'И': 'I',
15 'Й': 'Y', 'К': 'K', 'Л': 'L', 'М': 'M', 'Н': 'N', 15 'Й': 'Y', 'К': 'K', 'Л': 'L', 'М': 'M', 'Н': 'N',
16 'О': 'O', 'П': 'P', 'Р': 'R', 'С': 'S', 'Т': 'T', 16 'О': 'O', 'П': 'P', 'Р': 'R', 'С': 'S', 'Т': 'T',
17 'У': 'U', 'Ф': 'F', 'Х': 'H', 'Ц': 'C', 'Ч': 'Ch', 17 'У': 'U', 'Ф': 'F', 'Х': 'H', 'Ц': 'C', 'Ч': 'Ch',
18 'Ш': 'Sh', 'Щ': 'Sch', 'Ь': '', 'Ы': 'Y', 'Ъ': '', 18 'Ш': 'Sh', 'Щ': 'Sch', 'Ь': '', 'Ы': 'Y', 'Ъ': '',
19 'Э': 'E', 'Ю': 'Yu', 'Я': 'Ya', ' ': '-' 19 'Э': 'E', 'Ю': 'Yu', 'Я': 'Ya', ' ': '-'
20 }; 20 };
21 21
22 for (var i = 0; i < word.length; ++i ) { 22 for (var i = 0; i < word.length; ++i ) {
23 if (converter[word[i]] == undefined){ 23 if (converter[word[i]] == undefined){
24 answer += word[i]; 24 answer += word[i];
25 } else { 25 } else {
26 answer += converter[word[i]]; 26 answer += converter[word[i]];
27 } 27 }
28 } 28 }
29 29
30 return answer; 30 return answer;
31 } 31 }
32 32
33 window.addEventListener("DOMContentLoaded", (event) => { 33 window.addEventListener("DOMContentLoaded", (event) => {
34 let title = document.querySelector('#title'); 34 let title = document.querySelector('#title');
35 let text = document.querySelector('#slug'); 35 let text = document.querySelector('#slug');
36 36
37 title.addEventListener('input', function() { 37 title.addEventListener('input', function() {
38 text.value = translit(this.value); 38 text.value = translit(this.value);
39 }); 39 });
40 }); 40 });
41 41
42 </script> 42 </script>
43 43
44 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> 44 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
45 <label class="block text-sm"> 45 <label class="block text-sm">
46 <span class="text-gray-700 dark:text-gray-400">Заголовой новости</span> 46 <span class="text-gray-700 dark:text-gray-400">Заголовой новости</span>
47 <input name="title" id="title" 47 <input name="title" id="title"
48 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 48 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
49 placeholder="Заголовой новости" value="{{ old('title') ?? ((isset($new->title)) ? $new->title : '') }}" 49 placeholder="Заголовой новости" value="{{ old('title') ?? '' }}"
50 /> 50 />
51 @error('title') 51 @error('title')
52 <span class="text-xs text-red-600 dark:text-red-400"> 52 <span class="text-xs text-red-600 dark:text-red-400">
53 {{ $message }} 53 {{ $message }}
54 </span> 54 </span>
55 @enderror 55 @enderror
56 </label><br> 56 </label><br>
57 57
58 <label class="block text-sm"> 58 <label class="block text-sm">
59 <span class="text-gray-700 dark:text-gray-400">Код в URL-строке</span> 59 <span class="text-gray-700 dark:text-gray-400">Код в URL-строке</span>
60 <input name="slug" id="slug" 60 <input name="slug" id="slug"
61 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 61 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
62 placeholder="Код в URL-строке" value="{{ old('slug') ?? '' }}" 62 placeholder="Код в URL-строке" value="{{ old('slug') ?? '' }}"
63 /> 63 />
64 @error('slug') 64 @error('slug')
65 <span class="text-xs text-red-600 dark:text-red-400"> 65 <span class="text-xs text-red-600 dark:text-red-400">
66 {{ $message }} 66 {{ $message }}
67 </span> 67 </span>
68 @enderror 68 @enderror
69 </label><br> 69 </label><br>
70 70
71 <label class="block text-sm"> 71 <label class="block text-sm">
72 <span class="text-gray-700 dark:text-gray-400">Текст</span> 72 <span class="text-gray-700 dark:text-gray-400">Текст</span>
73 <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor" name="text" id="text" placeholder="Текст (html)" required 73 <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor" name="text" id="text" placeholder="Текст (html)" required
74 rows="10">{{ old('text') ?? $new->text ?? '' }}</textarea> 74 rows="10">{{ old('text') ?? '' }}</textarea>
75 @error('text') 75 @error('text')
76 <span class="text-xs text-red-600 dark:text-red-400"> 76 <span class="text-xs text-red-600 dark:text-red-400">
77 {{ $message }} 77 {{ $message }}
78 </span> 78 </span>
79 @enderror 79 @enderror
80 </label><br> 80 </label><br>
81 81
82 <label class="block text-sm"> 82 <label class="block text-sm">
83 <span class="text-gray-700 dark:text-gray-400">Картинка</span> 83 <span class="text-gray-700 dark:text-gray-400">Картинка</span>
84 <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600 84 <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600
85 dark:bg-gray-700 focus:border-purple-400 85 dark:bg-gray-700 focus:border-purple-400
86 focus:outline-none focus:shadow-outline-purple 86 focus:outline-none focus:shadow-outline-purple
87 dark:text-gray-300 dark:focus:shadow-outline-gray 87 dark:text-gray-300 dark:focus:shadow-outline-gray
88 form-input" 88 form-input"
89 id="image" name="image" accept="image/png, image/jpeg"> 89 id="image" name="image" accept="image/png, image/jpeg">
90 @error('image') 90 @error('image')
91 <span class="text-xs text-red-600 dark:text-red-400"> 91 <span class="text-xs text-red-600 dark:text-red-400">
92 {{ $message }} 92 {{ $message }}
93 </span> 93 </span>
94 @enderror 94 @enderror
95 @isset($new->image)
96 <img src="{{asset(Storage::url($new->image))}}" width="100px"/>
97 @endisset
98 95
99 </label><br> 96 </label><br>
100 97
101 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> 98 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
102 <div> 99 <div>
103 <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"> 100 <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
104 Сохранить 101 Сохранить
105 </button> 102 </button>
106 <a href="{{ route('admin.news_admin') }}" 103 <a href="{{ route('admin.news_admin') }}"
107 class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" 104 class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"
108 style="display: -webkit-inline-box; height: 30px!important;" 105 style="display: -webkit-inline-box; height: 30px!important;"
109 >Назад</a> 106 >Назад</a>
110 </div> 107 </div>
111 </div> 108 </div>
112 </div> 109 </div>
113 <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> 110 <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script>
114 <script> 111 <script>
115 CKEDITOR.replace( 'text', { 112 CKEDITOR.replace( 'text', {
116 filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", 113 filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}",
117 filebrowserUploadMethod: 'form' 114 filebrowserUploadMethod: 'form'
118 }); 115 });
119 </script> 116 </script>
120 117
resources/views/ajax/new_sky.blade.php
1 @foreach ($BigFlot as $key => $flot) 1 @foreach($Main_Job as $key => $it_main)
2 <div class="vacancies__list-col"> 2 <div class="vacancies__list-col">
3 @include('block_real', ['flot' => $flot, 'position' => $Position[$key]]) 3 @include('block_real_new', ['it_main' => $it_main, 'category' => $key])
4 </div> 4 </div>
5 @endforeach 5 @endforeach
6 6
resources/views/block_real_new.blade.php
File was created 1 @php $colors = Array('#F4C4C2', '#FBF1C8', '#ECFDEF', '#F3ECF6', '#ECFDEF');
2 $i = 0;
3 $k = 0;
4 @endphp
5 @if (count($it_main) > 0)
6 @foreach ($it_main as $cat)
7 @if ($k == 0)
8 <div class="vacancies__list-label">{{ $category }}</div>
9 @endif
10
11 <a href="{{ route('list-vacancies', ['job' => $cat['id_job']]) }}" class="vacancies__item">
12 <span style="border-color:{{$colors[$i]}}">
13 <b>{{ $cat['jn'] }}</b>
14 <i>Вакансий: <span>{{ $cat['cnt'] }}</span></i>
15 </span>
16 </a>
17
18 @php
19 $i++;
20 $k++;
21 if ($i > 4) {$i = 0;}
22 @endphp
23 @endforeach
24 @else
25 <div class="vacancies__list-label">{{ $category }}</div>
26 <a class="vacancies__item">
27 <span style="border-color:{{$colors[1]}}">
28 <b>Тут нет информации</b>
29 </span>
30 </a>
31 @endif
32
resources/views/employers/add_vacancy-first.blade.php
File was created 1 @extends('layout.frontend', ['title' => 'Добавление вакансии РекаМоре'])
2
3 @section('scripts')
4 <script>
5 console.log('Приближаемся к системе, нас рой тут...');
6 $(document).on('change', '#position_id', function() {
7 var this_ = $(this);
8 var val_ = this_.val();
9 var ajax_ = $('#job_title_id');
10
11 console.log('Создания списка людей, которые поднимутся на корабль...');
12
13 $.ajax({
14 type: "GET",
15 url: "{{ route('employer.selected_people') }}",
16 data: "id="+val_,
17 success: function (data) {
18 console.log('Ответка пришла');
19 console.log('Список избранных людей создан');
20 ajax_.html(data);
21 },
22 headers: {
23 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
24 },
25 error: function (data) {
26 console.log('Обрыв связи');
27 console.log('Error: ' + data);
28 }
29 });
30 });
31 </script>
32 @endsection
33 @section('content')
34 <section class="cabinet">
35 <div class="container">
36 <ul class="breadcrumbs cabinet__breadcrumbs">
37 <li><a href="{{ route('index') }}">Главная</a></li>
38 <li><b>Личный кабинет</b></li>
39 </ul>
40 <div class="cabinet__wrapper">
41 <div class="cabinet__side">
42 <div class="cabinet__side-toper">
43
44 @include('employers.emblema')
45
46 </div>
47
48 @include('employers.menu', ['item' => 2])
49
50 </div>
51
52 <form class="cabinet__body" action="{{ route('employer.vac_save') }}" method="POST">
53 @csrf
54 <input type="hidden" name="employer_id" value="{{ $Employer[0]->id }}"/>
55 <div class="cabinet__body-item">
56 <div class="cabinet__descr">
57 <h2 class="title cabinet__title">Разместить вакансию</h2>
58 <p class="cabinet__text"><b>Данные по вакансии</b></p>
59 <p class="cabinet__text">Все поля обязательны для заполнения *</p>
60 </div>
61 </div>
62
63 <div class="cabinet__body-item">
64 <h4>Поля для вакансии</h4>
65 <div class="cabinet__inputs">
66 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
67 <label class="form-group__label">Название вакансии</label>
68 <div class="form-group__item">
69 <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $Employer[0]->name ?? '' }}" required>
70 @error('name')
71 <span class="text-xs text-red-600 dark:text-red-400">
72 {{ $message }}
73 </span>
74 @enderror
75 </div>
76 </div>
77
78 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
79 <label class="form-group__label">Телефон</label>
80 <div class="form-group__item">
81 <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $Employer[0]->telephone ?? '' }}" placeholder="Свой телефон">
82 @error('telephone')
83 <span class="text-xs text-red-600 dark:text-red-400">
84 {{ $message }}
85 </span>
86 @enderror
87 </div>
88 </div>
89
90 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
91 <label class="form-group__label">Емайл</label>
92 <div class="form-group__item">
93 <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $Employer[0]->email ?? '' }}" placeholder="Своя почту">
94 @error('email')
95 <span class="text-xs text-red-600 dark:text-red-400">
96 {{ $message }}
97 </span>
98 @enderror
99 </div>
100 </div>
101
102 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
103 <label class="form-group__label">Зарплата среднестатистическая для вакансии</label>
104 <div class="form-group__item">
105 <input type="text" class="input" name="salary" id="salary" value="0" placeholder="Среднестатистическая зарплата">
106 @error('salary')
107 <span class="text-xs text-red-600 dark:text-red-400">
108 {{ $message }}
109 </span>
110 @enderror
111 </div>
112 </div>
113
114 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
115 <label class="form-group__label">Город посадки</label>
116 <div class="form-group__item">
117 <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $Employer[0]->city ?? '' }}" placeholder="Севастополь">
118 @error('city')
119 <span class="text-xs text-red-600">
120 {{ $message }}
121 </span>
122 @enderror
123 </div>
124 </div>
125
126 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
127 <label class="form-group__label">Категория (локация)</label>
128 <div class="form-group__item">
129 <div class="select">
130 <select class="js-select2" name="category_id" id="category_id">
131 @php $i = 1 @endphp
132 @if ($categories->count())
133 @foreach($categories as $j)
134 @if ($i == 1) <option selected> Выберите категорию из списка</option>
135 @else
136 <option value="{{ $j->id }}">{{ $j->name }}</option>
137 @endif
138 @php $i++ @endphp
139 @endforeach
140 @endif
141 </select>
142 @error('category_id')
143 <span class="text-xs text-red-600 dark:text-red-400">
144 {{ $message }}
145 </span>
146 @enderror
147 </div>
148 </div>
149 </div>
150
151 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
152 <label class="form-group__label">Описание вакансии</label>
153 <div class="form-group__item">
154 <textarea class="textarea" name="text" id="text">{{ $Employer[0]->text ?? '' }}</textarea>
155 @error('text')
156 <span class="text-xs text-red-600">
157 {{ $message }}
158 </span>
159 @enderror
160 </div>
161 </div>
162 </div>
163 <button type="submit" class="button cabinet__submit">Опубликовать</button>
164 </div>
165 </form>
166 </div>
167 </div>
168 </section>
169 </div>
170 @endsection
171
resources/views/employers/add_vacancy.blade.php
1 @extends('layout.frontend', ['title' => 'Добавление вакансии РекаМоре']) 1 @extends('layout.frontend', ['title' => 'Добавление вакансии РекаМоре'])
2 2
3 @section('scripts') 3 @section('scripts')
4 <script> 4 <script>
5 console.log('Приближаемся к системе, нас рой тут...'); 5 console.log('Приближаемся к системе, нас рой тут...');
6 $(document).on('change', '#position_id', function() { 6 $(document).on('change', '#category_id', function() {
7 var this_ = $(this); 7 var this_ = $(this);
8 var val_ = this_.val(); 8 var val_ = this_.val();
9 var ajax_ = $('#job_title_id'); 9 var ajax_ = $('#job_title_id');
10 10
11 console.log('Создания списка людей, которые поднимутся на корабль...'); 11 console.log('Создания списка людей, которые поднимутся на корабль...');
12 12
13 $.ajax({ 13 $.ajax({
14 type: "GET", 14 type: "GET",
15 url: "{{ route('employer.selected_people') }}", 15 url: "{{ route('employer.selected_people') }}",
16 data: "id="+val_, 16 data: "id="+val_,
17 success: function (data) { 17 success: function (data) {
18 console.log('Ответка пришла'); 18 console.log('Ответка пришла');
19 console.log('Список избранных людей создан'); 19 console.log('Список избранных людей создан');
20 ajax_.html(data); 20 ajax_.html(data);
21 }, 21 },
22 headers: { 22 headers: {
23 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 23 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
24 }, 24 },
25 error: function (data) { 25 error: function (data) {
26 console.log('Обрыв связи'); 26 console.log('Обрыв связи');
27 console.log('Error: ' + data); 27 console.log('Error: ' + data);
28 } 28 }
29 }); 29 });
30 }); 30 });
31 </script> 31 </script>
32 @endsection 32 @endsection
33 @section('content') 33 @section('content')
34 <section class="cabinet"> 34 <section class="cabinet">
35 <div class="container"> 35 <div class="container">
36 <ul class="breadcrumbs cabinet__breadcrumbs"> 36 <ul class="breadcrumbs cabinet__breadcrumbs">
37 <li><a href="{{ route('index') }}">Главная</a></li> 37 <li><a href="{{ route('index') }}">Главная</a></li>
38 <li><b>Личный кабинет</b></li> 38 <li><b>Личный кабинет</b></li>
39 </ul> 39 </ul>
40 <div class="cabinet__wrapper"> 40 <div class="cabinet__wrapper">
41 <div class="cabinet__side"> 41 <div class="cabinet__side">
42 <div class="cabinet__side-toper"> 42 <div class="cabinet__side-toper">
43 43
44 @include('employers.emblema') 44 @include('employers.emblema')
45 45
46 </div> 46 </div>
47 47
48 @include('employers.menu', ['item' => 2]) 48 @include('employers.menu', ['item' => 2])
49 49
50 </div> 50 </div>
51 51
52 <form class="cabinet__body" action="{{ route('employer.vac_save') }}" method="POST"> 52 <form class="cabinet__body" action="{{ route('employer.vac_save') }}" method="POST">
53 @csrf 53 @csrf
54 <input type="hidden" name="employer_id" value="{{ $Employer[0]->id }}"/> 54 <input type="hidden" name="employer_id" value="{{ $Employer[0]->id }}"/>
55 <div class="cabinet__body-item"> 55 <div class="cabinet__body-item">
56 <div class="cabinet__descr"> 56 <div class="cabinet__descr">
57 <h2 class="title cabinet__title">Разместить вакансию</h2> 57 <h2 class="title cabinet__title">Разместить вакансию</h2>
58 <p class="cabinet__text"><b>Данные по вакансии</b></p> 58 <p class="cabinet__text"><b>Данные по вакансии</b></p>
59 <p class="cabinet__text">Все поля обязательны для заполнения *</p> 59 <p class="cabinet__text">Все поля обязательны для заполнения *</p>
60 </div> 60 </div>
61 </div> 61 </div>
62 62
63 <div class="cabinet__body-item"> 63 <div class="cabinet__body-item">
64 <h4>Поля для вакансии</h4> 64 <h4>Поля для вакансии</h4>
65 <div class="cabinet__inputs"> 65 <div class="cabinet__inputs">
66 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 66 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
67 <label class="form-group__label">Название вакансии</label> 67 <label class="form-group__label">Название вакансии</label>
68 <div class="form-group__item"> 68 <div class="form-group__item">
69 <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $Employer[0]->name ?? '' }}" required> 69 <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $Employer[0]->name ?? '' }}" required>
70 @error('name') 70 @error('name')
71 <span class="text-xs text-red-600 dark:text-red-400"> 71 <span class="text-xs text-red-600 dark:text-red-400">
72 {{ $message }} 72 {{ $message }}
73 </span> 73 </span>
74 @enderror 74 @enderror
75 </div> 75 </div>
76 </div> 76 </div>
77 77
78 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 78 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
79 <label class="form-group__label">Телефон</label> 79 <label class="form-group__label">Телефон</label>
80 <div class="form-group__item"> 80 <div class="form-group__item">
81 <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $Employer[0]->telephone ?? '' }}" placeholder="Свой телефон"> 81 <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $Employer[0]->telephone ?? '' }}" placeholder="Свой телефон">
82 @error('telephone') 82 @error('telephone')
83 <span class="text-xs text-red-600 dark:text-red-400"> 83 <span class="text-xs text-red-600 dark:text-red-400">
84 {{ $message }} 84 {{ $message }}
85 </span> 85 </span>
86 @enderror 86 @enderror
87 </div> 87 </div>
88 </div> 88 </div>
89 89
90 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 90 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
91 <label class="form-group__label">Емайл</label> 91 <label class="form-group__label">Емайл</label>
92 <div class="form-group__item"> 92 <div class="form-group__item">
93 <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $Employer[0]->email ?? '' }}" placeholder="Своя почту"> 93 <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $Employer[0]->email ?? '' }}" placeholder="Своя почту">
94 @error('email') 94 @error('email')
95 <span class="text-xs text-red-600 dark:text-red-400"> 95 <span class="text-xs text-red-600 dark:text-red-400">
96 {{ $message }} 96 {{ $message }}
97 </span> 97 </span>
98 @enderror 98 @enderror
99 </div> 99 </div>
100 </div> 100 </div>
101 101
102 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> 102 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
103 <label class="form-group__label">Зарплата среднестатистическая для вакансии</label> 103 <label class="form-group__label">Зарплата среднестатистическая для вакансии</label>
104 <div class="form-group__item"> 104 <div class="form-group__item">
105 <input type="text" class="input" name="salary" id="salary" value="0" placeholder="Среднестатистическая зарплата"> 105 <input type="text" class="input" name="salary" id="salary" value="0" placeholder="Среднестатистическая зарплата">
106 @error('salary') 106 @error('salary')
107 <span class="text-xs text-red-600 dark:text-red-400"> 107 <span class="text-xs text-red-600 dark:text-red-400">
108 {{ $message }} 108 {{ $message }}
109 </span> 109 </span>
110 @enderror 110 @enderror
111 </div> 111 </div>
112 </div> 112 </div>
113 113
114 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> 114 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
115 <label class="form-group__label">Город посадки</label> 115 <label class="form-group__label">Город посадки</label>
116 <div class="form-group__item"> 116 <div class="form-group__item">
117 <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $Employer[0]->city ?? '' }}" placeholder="Севастополь"> 117 <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $Employer[0]->city ?? '' }}" placeholder="Севастополь">
118 @error('city') 118 @error('city')
119 <span class="text-xs text-red-600"> 119 <span class="text-xs text-red-600">
120 {{ $message }} 120 {{ $message }}
121 </span> 121 </span>
122 @enderror 122 @enderror
123 </div> 123 </div>
124 </div> 124 </div>
125 125
126 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 126 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
127 <label class="form-group__label">Категория (локация)</label> 127 <label class="form-group__label">Категория (локация)</label>
128 <div class="form-group__item"> 128 <div class="form-group__item">
129 <div class="select"> 129 <div class="select">
130 <select class="js-select2" name="category_id" id="category_id"> 130 <select class="js-select2" name="category_id" id="category_id">
131 @php $i = 1 @endphp 131 @php $i = 1 @endphp
132 @if ($categories->count()) 132 @if ($categories->count())
133 @foreach($categories as $j) 133 @foreach($categories as $j)
134 @if ($i == 1) <option selected> Выберите категорию из списка</option> 134 @if ($i == 1) <option selected> Выберите категорию из списка</option>
135 @else 135 @else
136 <option value="{{ $j->id }}">{{ $j->name }}</option> 136 <option value="{{ $j->id }}">{{ $j->name }}</option>
137 @endif 137 @endif
138 @php $i++ @endphp 138 @php $i++ @endphp
139 @endforeach 139 @endforeach
140 @endif 140 @endif
141 </select> 141 </select>
142 @error('category_id') 142 @error('category_id')
143 <span class="text-xs text-red-600 dark:text-red-400"> 143 <span class="text-xs text-red-600 dark:text-red-400">
144 {{ $message }} 144 {{ $message }}
145 </span> 145 </span>
146 @enderror 146 @enderror
147 </div> 147 </div>
148 </div> 148 </div>
149 </div> 149 </div>
150 150
151 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 151 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
152 <label class="form-group__label">Описание вакансии</label> 152 <label class="form-group__label">Описание вакансии</label>
153 <div class="form-group__item"> 153 <div class="form-group__item">
154 <textarea class="textarea" name="text" id="text">{{ $Employer[0]->text ?? '' }}</textarea> 154 <textarea class="textarea" name="text" id="text">{{ $Employer[0]->text ?? '' }}</textarea>
155 @error('text') 155 @error('text')
156 <span class="text-xs text-red-600"> 156 <span class="text-xs text-red-600">
157 {{ $message }} 157 {{ $message }}
158 </span> 158 </span>
159 @enderror 159 @enderror
160 </div> 160 </div>
161 </div> 161 </div>
162 </div> 162 </div>
163 </div>
164
165 <div class="cabinet__body-item">
166 <div class="cabinet__body-item">
167 <div class="cabinet__descr">
168 <p class="cabinet__text"><b>Добавление должности</b></p>
169 </div>
170 </div>
171
172 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
173 <label class="form-group__label">Должность соискателя</label>
174 <div class="form-group__item">
175 <div class="select">
176 <select class="js-select2" name="job_title_id" id="job_title_id">
177 @php $i = 1 @endphp
178 @if ($jobs->count())
179 @foreach($jobs as $j)
180 @if ($i == 1) <option selected> Выберите должность из списка</option>
181 @else
182 <option value="{{ $j->id }}">{{ $j->name }}</option>
183 @endif
184 @php $i++ @endphp
185 @endforeach
186 @endif
187 </select>
188 @error('job_title_id')
189 <span class="text-xs text-red-600 dark:text-red-400">
190 {{ $message }}
191 </span>
192 @enderror
193 </div>
194 </div>
195 </div>
196
197 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
198 <label class="form-group__label">Минимальная зарплата</label>
199 <div class="form-group__item">
200 <input type="text" class="input" name="min_salary" id="min_salary" value="{{ old('min_salary') ?? '' }}" placeholder="Минимальная зарплата">
201 @error('min_salary')
202 <span class="text-xs text-red-600">
203 {{ $message }}
204 </span>
205 @enderror
206 </div>
207 </div>
208
209 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
210 <label class="form-group__label">Максимальная зарплата</label>
211 <div class="form-group__item">
212 <input type="text" class="input" name="max_salary" id="max_salary" value="{{ old('max_salary') ?? '' }}" placeholder="Максимальная зарплата">
213 @error('salary')
214 <span class="text-xs text-red-600 dark:text-red-400">
215 {{ $message }}
216 </span>
217 @enderror
218 </div>
219 </div>
220
221 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
222 <label class="form-group__label">Регион отплытия</label>
223 <div class="form-group__item">
224 <input type="text" class="input" name="region" id="region" value="{{ old('region') ?? $Employer[0]->city ?? '' }}" placeholder="Севастополь">
225 @error('region')
226 <span class="text-xs text-red-600">
227 {{ $message }}
228 </span>
229 @enderror
230 </div>
231 </div>
232
233 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
234 <label class="form-group__label">Мощность</label>
235 <div class="form-group__item">
236 <input type="text" class="input" name="power" id="power" value="{{ old('power') ?? '' }}" placeholder="POWER-45">
237 @error('power')
238 <span class="text-xs text-red-600">
239 {{ $message }}
240 </span>
241 @enderror
242 </div>
243 </div>
244
245 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
246 <label class="form-group__label">Суточные выплаты</label>
247 <div class="form-group__item">
248 <input type="text" class="input" name="sytki" id="sytki" value="{{ old('sytki') ?? '' }}" placeholder="2000">
249 @error('power')
250 <span class="text-xs text-red-600">
251 {{ $message }}
252 </span>
253 @enderror
254 </div>
255 </div>
256
257 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
258 <label class="form-group__label">Начало отплытия</label>
259 <div class="form-group__item">
260 <input type="text" class="input" name="start" id="start" value="{{ old('start') ?? '' }}" placeholder="20 сентября 2024">
261 @error('power')
262 <span class="text-xs text-red-600">
263 {{ $message }}
264 </span>
265 @enderror
266 </div>
267 </div>
268
269 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
270 <label class="form-group__label">Корабль для посадки</label>
271 <div class="form-group__item">
272 <div class="select">
273 <select class="js-select2" name="flot" id="flot">
274 <option value="" selected> Не указан корабль</option>
275 @if ($Employer[0]->flots->count())
276 @foreach($Employer[0]->flots as $j)
277 <option value="{{ $j->name }}">{{ $j->name }} ({{ $j->id }})</option>
278 @endforeach
279 @endif
280 </select>
281 @error('flot')
282 <span class="text-xs text-red-600">
283 {{ $message }}
284 </span>
285 @enderror
286 </div>
287 </div>
288 </div>
289
290 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
291 <label class="form-group__label">Дополнительная информация</label>
292 <div class="form-group__item">
293 <textarea class="textarea" name="description" id="description">{{ old('description') ?? '' }}</textarea>
294 @error('description')
295 <span class="text-xs text-red-600">
296 {{ $message }}
297 </span>
298 @enderror
299 </div>
300 </div>
301
302 </div>
163 <button type="submit" class="button cabinet__submit">Опубликовать</button> 303 <button type="submit" class="button cabinet__submit">Опубликовать</button>
164 </div> 304 </div>
165 </form> 305 </form>
166 </div> 306 </div>
167 </div> 307 </div>
168 </section> 308 </section>
169 </div> 309 </div>
170 @endsection 310 @endsection
171 311
resources/views/employers/ajax/list_vacancy.blade.php
1 @if ($vacancy_list->count()) 1 @if ($vacancy_list->count())
2 <!--<button type="button" class="table__button js-toggle js-parent-toggle button button_light button_more">
3 <span>Показать ещё</span>
4 <span>Свернуть</span>
5 </button>-->
6 <div class="table__scroll"> 2 <div class="table__scroll">
7 <div class="table__body table__body_min-width"> 3 <div class="table__body table__body_min-width">
8 <table> 4 <table>
9 <thead> 5 <thead>
10 <tr> 6 <tr>
7 <th>№</th>
11 <th>Название</th> 8 <th>Название</th>
12 <th>Дата добавления<br>/&nbsp;обновления</th> 9 <th>Дата добавления<br>/&nbsp;обновления</th>
10 <th>Должности</th>
13 <th>Статус</th> 11 <th>Статус</th>
14 <th>Действия</th> 12 <th>Действия</th>
15 </tr> 13 </tr>
16 </thead> 14 </thead>
17 <tbody> 15 <tbody>
18 @foreach($vacancy_list as $it) 16 @foreach($vacancy_list as $it)
19 <tr> 17 <tr>
18 <td>{{ $it->id }}</td>
20 <td>{{ $it->name }}</td> 19 <td>{{ $it->name }}</td>
21 <td>{{ date('d.m.Y H:i:s', strtotime($it->created_at)) }} / {{ date('d.m.Y H:i:s', strtotime($it->updated_at)) }}</td> 20 <td>{{ date('d.m.Y H:i:s', strtotime($it->created_at)) }} <br>/ {{ date('d.m.Y H:i:s', strtotime($it->updated_at)) }}</td>
21 <td> <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $it->id]) }}" class="button">Добавить</a>
22
23 @if ($it->jobs->count())
24 @foreach ($it->jobs as $key => $it_um)
25 <p>@if (isset($it->jobs_code[$key]))
26 <a href="{{ route('employer.edit_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id, 'ad_employer' => $it->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">{{$it_um->name}}</a>
27 <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a>
28 @endif
29 </p>
30 @endforeach
31 @else
32 Нет связанных <br> с вакансией должностей
33 @endif
34 </td>
22 <td> 35 <td>
23 @if ($it->active_is) 36 @if ($it->active_is)
24 <span class="table__status green"><i></i>Опубликовано</span> 37 <span class="table__status green"><i></i>Опубликовано</span>
25 @else 38 @else
26 <span class="table__status"><i></i>Не опубликовано</span> 39 <span class="table__status"><i></i>Не опубликовано</span>
27 @endif 40 @endif
28 </td> 41 </td>
29 <td> 42 <td>
30 <span class="table__controls"> 43 <span class="table__controls">
31 <a class="table__controls-item up-it" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}"> 44 <a class="table__controls-item up-it" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}">
32 <svg> 45 <svg>
33 <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use> 46 <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use>
34 </svg> 47 </svg>
35 </a> 48 </a>
36 <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" class="table__controls-item"> 49 <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" class="table__controls-item">
37 <svg> 50 <svg>
38 <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> 51 <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use>
39 </svg> 52 </svg>
40 </a> 53 </a>
41 <a class="table__controls-item" href="{{ route('employer.vacancy_delete', ['ad_employer' => $it->id]) }}"> 54 <a class="table__controls-item" href="{{ route('employer.vacancy_delete', ['ad_employer' => $it->id]) }}">
42 <svg> 55 <svg>
43 <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> 56 <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use>
44 </svg> 57 </svg>
45 </a> 58 </a>
46 @if ($it->active_is) 59 @if ($it->active_is)
47 <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" class="table__controls-item"> 60 <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" class="table__controls-item">
48 <svg> 61 <svg>
49 <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> 62 <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use>
50 </svg> 63 </svg>
51 </a> 64 </a>
52 @else 65 @else
53 <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" class="table__controls-item"> 66 <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" class="table__controls-item">
54 <svg> 67 <svg>
55 <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> 68 <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use>
56 </svg> 69 </svg>
57 </a> 70 </a>
58 @endif 71 @endif
59 72
60 </span> 73 <!--<button type="button" class="table__controls-item">
74 <svg>
75 <use xlink:href=" asset('images/sprite.svg#tg') }}"></use>
76 </svg>
77 </button>
78 -->
79 </span>
61 </td> 80 </td>
62 </tr> 81 </tr>
63 @endforeach 82 @endforeach
64 </tbody> 83 </tbody>
65 </table> 84 </table>
66 </div><br> 85 </div><br>
67 {{ $vacancy_list->appends($_GET)->links('paginate') }} 86 {{ $vacancy_list->appends($_GET)->links('paginate') }}
68 </div> 87 </div>
69 @else 88 @else
70 89
71 <div class="notify"> 90 <div class="notify">
72 <svg> 91 <svg>
73 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> 92 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use>
74 </svg> 93 </svg>
resources/views/index.blade.php
1 @extends('layout.frontend', ['title' => 'Главная страница РекаМоре']) 1 @extends('layout.frontend', ['title' => 'Главная страница РекаМоре'])
2 2
3 @section('scripts') 3 @section('scripts')
4 4
5 @endsection 5 @endsection
6 6
7 @section('content') 7 @section('content')
8 <section class="work"> 8 <section class="work">
9 <div class="container"> 9 <div class="container">
10 <img src="{{ asset('images/1.png') }}" alt="" class="work__pic"> 10 <img src="{{ asset('images/1.png') }}" alt="" class="work__pic">
11 <div class="work__body"> 11 <div class="work__body">
12 <div class="work__title"> 12 <div class="work__title">
13 <h4>Работа в море / 13 <h4>Работа в море /
14 <span class="br">Работа на реке</span></h4> 14 <span class="br">Работа на реке</span></h4>
15 </div> 15 </div>
16 <div class="work__text">Профессиональная сеть морского сообщества «RekaMore.su» приветствует вас — 16 <div class="work__text">Профессиональная сеть морского сообщества «RekaMore.su» приветствует вас —
17 тех, кто не представляет себе жизнь без моря, тех, кто готов связать свою жизнь с работой в 17 тех, кто не представляет себе жизнь без моря, тех, кто готов связать свою жизнь с работой в
18 сложных, но очень интересных условиях. </div> 18 сложных, но очень интересных условиях. </div>
19 <div class="work__list"> 19 <div class="work__list">
20 <div>Тысячи соискателей увидят Ваше объявление</div> 20 <div>Тысячи соискателей увидят Ваше объявление</div>
21 <div>Десятки компаний выкладывают объявления каждый день</div> 21 <div>Десятки компаний выкладывают объявления каждый день</div>
22 </div> 22 </div>
23 <form class="search work__form" action="{{ route('search_vacancies') }}" method="GET"> 23 <form class="search work__form" action="{{ route('search_vacancies') }}" method="GET">
24 <input type="search" id="search" name="search" class="input" placeholder="Желаемая должность" required> 24 <input type="search" id="search" name="search" class="input" placeholder="Желаемая должность" required>
25 <button type="submit" class="button button_light">Посмотреть вакансии</button> 25 <button type="submit" class="button button_light">Посмотреть вакансии</button>
26 <span> 26 <span>
27 <svg> 27 <svg>
28 <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> 28 <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use>
29 </svg> 29 </svg>
30 </span> 30 </span>
31 </form> 31 </form>
32 @guest 32 @guest
33 <a data-fancybox data-src="#question2" data-options='{"touch":false,"autoFocus":false}' class="button work__search">Я ищу сотрудника</a> 33 <a data-fancybox data-src="#question2" data-options='{"touch":false,"autoFocus":false}' class="button work__search">Я ищу сотрудника</a>
34 @else 34 @else
35 <a href="{{ route('bd_resume') }}" class="button work__search">Я ищу сотрудника</a> 35 <a href="{{ route('bd_resume') }}" class="button work__search">Я ищу сотрудника</a>
36 @endguest 36 @endguest
37 <div class="work__get"> 37 <div class="work__get">
38 <b>Скачать приложение</b> 38 <b>Скачать приложение</b>
39 <a href=""> 39 <a href="">
40 <img src="{{ asset('images/google.svg') }}" alt=""> 40 <img src="{{ asset('images/google.svg') }}" alt="">
41 </a> 41 </a>
42 <a href=""> 42 <a href="">
43 <img src="{{ asset('images/apple.svg') }}" alt=""> 43 <img src="{{ asset('images/apple.svg') }}" alt="">
44 </a> 44 </a>
45 </div> 45 </div>
46 </div> 46 </div>
47 </div> 47 </div>
48 </section> 48 </section>
49 <section class="numbers"> 49 <section class="numbers">
50 <div class="container"> 50 <div class="container">
51 <div class="numbers__body"> 51 <div class="numbers__body">
52 <div class="numbers__item"> 52 <div class="numbers__item">
53 <b>500+</b> 53 <b>500+</b>
54 <span>Резюме</span> 54 <span>Резюме</span>
55 Банальные, но неопровержимые выводы, а также элементы политического процесса лишь добавляют 55 Банальные, но неопровержимые выводы, а также элементы политического процесса лишь добавляют
56 фракционных разногласий и призваны к ответу. 56 фракционных разногласий и призваны к ответу.
57 </div> 57 </div>
58 <div class="numbers__item"> 58 <div class="numbers__item">
59 <b>1 000+</b> 59 <b>1 000+</b>
60 <span>Вакансий</span> 60 <span>Вакансий</span>
61 В рамках спецификации современных стандартов, диаграммы связей заблокированы в рамках своих 61 В рамках спецификации современных стандартов, диаграммы связей заблокированы в рамках своих
62 собственных рациональных ограничений. 62 собственных рациональных ограничений.
63 </div> 63 </div>
64 <div class="numbers__item"> 64 <div class="numbers__item">
65 <b>265</b> 65 <b>265</b>
66 <span>Компаний</span> 66 <span>Компаний</span>
67 Но сторонники тоталитаризма в науке заблокированы в рамках своих собственных рациональных 67 Но сторонники тоталитаризма в науке заблокированы в рамках своих собственных рациональных
68 ограничений. 68 ограничений.
69 </div> 69 </div>
70 </div> 70 </div>
71 </div> 71 </div>
72 </section> 72 </section>
73 <!--<section class="vacancies"> 73 <!--<section class="vacancies">
74 <div class="container"> 74 <div class="container">
75 <div class="title"><h4>Новые вакансии</h4></div> 75 <div class="title"><h4>Новые вакансии</h4></div>
76 <div class="vacancies__body"> 76 <div class="vacancies__body">
77 <a class="vacancies__more button button_light js-parent-toggle" href="{{ route('vacancies') }}">Все должности</a> 77 <a class="vacancies__more button button_light js-parent-toggle" href="{{ route('vacancies') }}">Все должности</a>
78 <div class="vacancies__list"> 78 <div class="vacancies__list">
79 _if ($categories->count()) 79 _if ($categories->count())
80 _foreach ($categories as $cat) 80 _foreach ($categories as $cat)
81 <a href=" route('list-vacancies', ['categories' => $cat->id]) }}" class="vacancies__item"> 81 <a href=" route('list-vacancies', ['categories' => $cat->id]) }}" class="vacancies__item">
82 <span style="border-color:#F4C4C2"> 82 <span style="border-color:#F4C4C2">
83 <b> $cat->name }}</b> 83 <b> $cat->name }}</b>
84 <i>Вакансий: <span> $cat->cnt }}</span></i> 84 <i>Вакансий: <span> $cat->cnt }}</span></i>
85 </span> 85 </span>
86 </a> 86 </a>
87 _endforeach 87 _endforeach
88 _else 88 _else
89 Тут пока нет никаких вакансий 89 Тут пока нет никаких вакансий
90 _endif 90 _endif
91 </div> 91 </div>
92 </div> 92 </div>
93 </div> 93 </div>
94 </section>--> 94 </section>-->
95 95
96 <main class="main"> 96 <main class="main">
97 <div class="container"> 97 <div class="container">
98 <div class="main__vacancies"> 98 <div class="main__vacancies">
99 <h2 class="main__vacancies-title">Категории вакансий</h2> 99 <h2 class="main__vacancies-title">Категории вакансий</h2>
100 <div class="vacancies__body"> 100 <div class="vacancies__body">
101 <!--<button class="vacancies__more button button_more button_light js-toggle js-parent-toggle">
102 <span>Показать ещё</span>
103 <span>Скрыть</span>
104 </button>-->
105 <div class="vacancies__list" id="block_ajax" name="block_ajax"> 101 <div class="vacancies__list" id="block_ajax" name="block_ajax">
106 @foreach ($BigFlot as $key => $flot) 102 @foreach($Main_Job as $key => $it_main)
107 <div class="vacancies__list-col"> 103 <div class="vacancies__list-col">
108 @include('block_real', ['flot' => $flot, 'position' => $Position[$key]]) 104 @include('block_real_new', ['it_main' => $it_main, 'category' => $key])
109 </div> 105 </div>
110 @endforeach 106 @endforeach
107 <!--_include('block_real', ['flot' => $flot, 'position' => $Position[$flot->position_id]])-->
111 </div> 108 </div>
112 </div> 109 </div>
113 </div> 110 </div>
114 </div> 111 </div>
115 </main> 112 </main>
116 113
117 <section class="employer"> 114 <section class="employer">
118 <div class="container"> 115 <div class="container">
119 <div class="title"><h4>Работодатели</h4></div> 116 <div class="title"><h4>Работодатели</h4></div>
120 <div class="swiper js-employer-swiper"> 117 <div class="swiper js-employer-swiper">
121 <div class="swiper-wrapper"> 118 <div class="swiper-wrapper">
122 119
123 @if ($employers->count()) 120 @if ($employers->count())
124 @php 121 @php
125 $rec = 0; 122 $rec = 0;
126 $count = $employers->count(); 123 $count = $employers->count();
127 124
128 @endphp 125 @endphp
129 126
130 @foreach($employers as $emp) 127 @foreach($employers as $emp)
131 @php $rec++ @endphp 128 @php $rec++ @endphp
132 @if (($rec==1) || ($rec==5) || ($rec==9) || ($rec==13) || ($rec==17)) 129 @if (($rec==1) || ($rec==5) || ($rec==9) || ($rec==13) || ($rec==17))
133 <div class="swiper-slide"> 130 <div class="swiper-slide">
134 <div class="employer__item"> 131 <div class="employer__item">
135 @endif 132 @endif
136 @if (!empty($emp->employer->logo)) 133 @if (!empty($emp->employer->logo))
137 <a href="{{ route('ad-employer', ['ad_employer' => $emp->employer->id]) }}"> 134 <a href="{{ route('ad-employer', ['ad_employer' => $emp->employer->id]) }}">
138 <img src="{{ asset(Storage::url($emp->employer->logo)) }}" alt="{{ $emp->employer->name_company }}"> 135 <img src="{{ asset(Storage::url($emp->employer->logo)) }}" alt="{{ $emp->employer->name_company }}">
139 </a> 136 </a>
140 @else 137 @else
141 <a href="{{ route('ad-employer', ['ad_employer' => $emp->employer->id]) }}"> 138 <a href="{{ route('ad-employer', ['ad_employer' => $emp->employer->id]) }}">
142 <img src="{{ asset('images/logo_emp.png') }}" alt="{{ $emp->employer->name_company }}"> 139 <img src="{{ asset('images/logo_emp.png') }}" alt="{{ $emp->employer->name_company }}">
143 </a> 140 </a>
144 @endif 141 @endif
145 @if (($rec==4) || ($rec==8) || ($rec==12) || ($rec==16) || ($rec==20) || ($rec == $count)) 142 @if (($rec==4) || ($rec==8) || ($rec==12) || ($rec==16) || ($rec==20) || ($rec == $count))
146 </div> 143 </div>
147 </div> 144 </div>
148 @endif 145 @endif
149 @endforeach 146 @endforeach
150 @else 147 @else
151 <h5>Тут нет никаких записей</h5> 148 <h5>Тут нет никаких записей</h5>
152 @endif 149 @endif
153 </div> 150 </div>
154 <div class="swiper-pagination"></div> 151 <div class="swiper-pagination"></div>
155 </div> 152 </div>
156 <a href="{{ route('shipping_companies') }}" class="employer__more button button_light">Все работодатели</a> 153 <a href="{{ route('shipping_companies') }}" class="employer__more button button_light">Все работодатели</a>
157 </div> 154 </div>
158 </section> 155 </section>
159 <section class="about"> 156 <section class="about">
160 <div class="container"> 157 <div class="container">
161 <div class="about__wrapper"> 158 <div class="about__wrapper">
162 <div class="title about__title"><h4>О нас</h4></div> 159 <div class="title about__title"><h4>О нас</h4></div>
163 <div class="about__body"> 160 <div class="about__body">
164 <div class="about__line"></div> 161 <div class="about__line"></div>
165 <div class="about__item"> 162 <div class="about__item">
166 <b>Для работодателей</b> 163 <b>Для работодателей</b>
167 <span>Наш ресурс позволит Вам за демократичную цену найти нужных специалистов в кратчайшие 164 <span>Наш ресурс позволит Вам за демократичную цену найти нужных специалистов в кратчайшие
168 сроки, подробнее об условиях можно узнать <a href="{{ route('page', ['pages' => 'Stoimost-razmescheniya']) }}">здесь</a>.</span> 165 сроки, подробнее об условиях можно узнать <a href="{{ route('page', ['pages' => 'Stoimost-razmescheniya']) }}">здесь</a>.</span>
169 <a class="about__button button button_whited" style="text-decoration: none" href="{{ route('bd_resume') }}">Поиск сотрудников</a> 166 <a class="about__button button button_whited" style="text-decoration: none" href="{{ route('bd_resume') }}">Поиск сотрудников</a>
170 </div> 167 </div>
171 <div class="about__item"> 168 <div class="about__item">
172 <b>Для сотрудников</b> 169 <b>Для сотрудников</b>
173 <span>Наше преимущество — это большой объем вакансий, более 70 судоходных компаний России и 170 <span>Наше преимущество — это большой объем вакансий, более 70 судоходных компаний России и
174 СНГ ищут сотрудников через наши ресурсы</span> 171 СНГ ищут сотрудников через наши ресурсы</span>
175 <a class="about__button button button_whited" style="text-decoration: none" href="{{ route('vacancies') }}">Ищу работу</a> 172 <a class="about__button button button_whited" style="text-decoration: none" href="{{ route('vacancies') }}">Ищу работу</a>
176 </div> 173 </div>
177 </div> 174 </div>
178 </div> 175 </div>
179 </div> 176 </div>
180 </section> 177 </section>
181 178
182 @if ($news->count()) 179 @if ($news->count())
183 <section class="news"> 180 <section class="news">
184 <div class="container"> 181 <div class="container">
185 <div class="news__toper"> 182 <div class="news__toper">
186 <div class="title"><h4>Новости и статьи</h4></div> 183 <div class="title"><h4>Новости и статьи</h4></div>
187 <div class="navs"> 184 <div class="navs">
188 <button class="js-news-swiper-button-prev"> 185 <button class="js-news-swiper-button-prev">
189 <svg class="rotate180"> 186 <svg class="rotate180">
190 <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> 187 <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use>
191 </svg> 188 </svg>
192 </button> 189 </button>
193 <button class="js-news-swiper-button-next"> 190 <button class="js-news-swiper-button-next">
194 <svg> 191 <svg>
195 <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> 192 <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use>
196 </svg> 193 </svg>
197 </button> 194 </button>
198 </div> 195 </div>
199 </div> 196 </div>
200 197
201 <div class="swiper js-news-swiper"> 198 <div class="swiper js-news-swiper">
202 <div class="swiper-wrapper"> 199 <div class="swiper-wrapper">
203 200
204 @foreach ($news as $new) 201 @foreach ($news as $new)
205 <div class="swiper-slide"> 202 <div class="swiper-slide">
206 <div class="news__item"> 203 <div class="news__item">
207 @if (empty($new->image)) 204 @if (empty($new->image))
208 <img src="{{ asset('/images/default_ship.jpg') }}" alt="" class="news__item-pic"> 205 <img src="{{ asset('/images/default_ship.jpg') }}" alt="" class="news__item-pic">
209 @else 206 @else
210 <img src="{{ asset(Storage::url($new->image)) }}" alt="" class="news__item-pic"> 207 <img src="{{ asset(Storage::url($new->image)) }}" alt="" class="news__item-pic">
211 @endif 208 @endif
212 <div class="news__item-body"> 209 <div class="news__item-body">
213 <time datetime="{{ date('d.m.Y H:i:s', strtotime($new->created_at)) }}" class="news__item-date">{{ date('d.m.Y H:i:s', strtotime($new->created_at)) }}</time> 210 <time datetime="{{ date('d.m.Y H:i:s', strtotime($new->created_at)) }}" class="news__item-date">{{ date('d.m.Y H:i:s', strtotime($new->created_at)) }}</time>
214 <span class="news__item-title">{{ $new->title }}</span> 211 <span class="news__item-title">{{ $new->title }}</span>
215 <span class="news__item-text">{!! mb_strimwidth($new->text, 0, 100) !!}</span> 212 <span class="news__item-text">{!! mb_strimwidth($new->text, 0, 100) !!}</span>
216 <a href="{{ route('detail_new', ['new' => $new->id]) }}" class="news__item-more button button_light">Читать далее</a> 213 <a href="{{ route('detail_new', ['new' => $new->id]) }}" class="news__item-more button button_light">Читать далее</a>
217 </div> 214 </div>
218 </div> 215 </div>
219 </div> 216 </div>
220 @endforeach 217 @endforeach
221 218
222 </div> 219 </div>
223 <div class="swiper-pagination"></div> 220 <div class="swiper-pagination"></div>
224 </div> 221 </div>
225 <a href="{{ route('news') }}" class="news__all button button_light">Все новости</a> 222 <a href="{{ route('news') }}" class="news__all button button_light">Все новости</a>
226 223
227 </div> 224 </div>
228 </section> 225 </section>
229 @endif 226 @endif
230 227
231 <section class="info"> 228 <section class="info">
232 <div class="container"> 229 <div class="container">
233 <img src="images/5.png" alt="" class="info__pic"> 230 <img src="images/5.png" alt="" class="info__pic">
234 <div class="info__body"> 231 <div class="info__body">
235 <div class="title info__title"><h4>Мы в социальных сетях</h4></div> 232 <div class="title info__title"><h4>Мы в социальных сетях</h4></div>
236 <div class="info__item"> 233 <div class="info__item">
237 <div class="info__text">Телеграм — Подпишитесь на наш телеграм канал и получайте уведомления о 234 <div class="info__text">Телеграм — Подпишитесь на наш телеграм канал и получайте уведомления о
238 новых вакансиях прямо на свой смартфон</div> 235 новых вакансиях прямо на свой смартфон</div>
239 <a href="{{ $companies[0]->telegram }}" class="info__link" style="background:#20A0E1"> 236 <a href="{{ $companies[0]->telegram }}" class="info__link" style="background:#20A0E1">
240 <svg> 237 <svg>
241 <use xlink:href="{{ asset('images/sprite.svg#tg') }}"></use> 238 <use xlink:href="{{ asset('images/sprite.svg#tg') }}"></use>
242 </svg> 239 </svg>
243 Телеграм 240 Телеграм
244 </a> 241 </a>
245 </div> 242 </div>
246 <div class="info__item"> 243 <div class="info__item">
247 <div class="info__text">ВКонтакте — Лучшие вакансии за неделю выкладываем именно тут, информация 244 <div class="info__text">ВКонтакте — Лучшие вакансии за неделю выкладываем именно тут, информация
248 о судоходных компаниях, инструкции по работе с сайтом, конкурсы и многое другое</div> 245 о судоходных компаниях, инструкции по работе с сайтом, конкурсы и многое другое</div>
249 <a href="{{ $companies[0]->vkontact }}" class="info__link" style="background:#2787F5"> 246 <a href="{{ $companies[0]->vkontact }}" class="info__link" style="background:#2787F5">
250 <svg> 247 <svg>
251 <use xlink:href="{{ asset('images/sprite.svg#vk') }}"></use> 248 <use xlink:href="{{ asset('images/sprite.svg#vk') }}"></use>
252 </svg> 249 </svg>
253 ВКонтакте 250 ВКонтакте
254 </a> 251 </a>
255 </div> 252 </div>
256 </div> 253 </div>
257 </div> 254 </div>
258 </section> 255 </section>
259 @endsection 256 @endsection
resources/views/list_vacancies.blade.php
1 @php 1 @php
2 use App\Classes\StatusUser; 2 use App\Classes\StatusUser;
3 @endphp 3 @endphp
4 4
5 @extends('layout.frontend', ['title' => 'Вакансии РекаМоре']) 5 @extends('layout.frontend', ['title' => 'Вакансии РекаМоре'])
6 6
7 @section('scripts') 7 @section('scripts')
8 <script> 8 <script>
9 console.log('Test system'); 9 console.log('Test system');
10 $(document).on('change', '#jobs', function() { 10 $(document).on('change', '#jobs', function() {
11 var val = $(this).val(); 11 var val = $(this).val();
12 var main_oskar = $('#main_ockar'); 12 var main_oskar = $('#main_ockar');
13 var ti_head = $('#title_head'); 13 var ti_head = $('#title_head');
14 14
15 console.log('Code='+val); 15 console.log('Code='+val);
16 console.log('Click change...'); 16 console.log('Click change...');
17 $.ajax({ 17 $.ajax({
18 type: "GET", 18 type: "GET",
19 url: "{{ route('list-vacancies', ['categories' => $categories->id]) }}", 19 url: "{{ route('list-vacancies', ['categories' => $categories->id]) }}",
20 data: "job="+val, 20 data: "job="+val,
21 success: function (data) { 21 success: function (data) {
22 console.log('Выбор сделан!'); 22 console.log('Выбор сделан!');
23 23
24 main_oskar.html(data); 24 main_oskar.html(data);
25 history.pushState({}, '', "{{ route('list-vacancies', ['categories' => $categories->id]) }}?job="+val+"@if (isset($_GET['sort']))&sort={{ $_GET['sort'] }}@endif"+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); 25 history.pushState({}, '', "{{ route('list-vacancies', ['categories' => $categories->id]) }}?job="+val+"@if (isset($_GET['sort']))&sort={{ $_GET['sort'] }}@endif"+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif");
26 }, 26 },
27 headers: { 27 headers: {
28 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 28 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
29 }, 29 },
30 error: function (data) { 30 error: function (data) {
31 data = JSON.stringify(data); 31 data = JSON.stringify(data);
32 console.log('Error: ' + data); 32 console.log('Error: ' + data);
33 } 33 }
34 }); 34 });
35 35
36 if ((val == '') || (val == '0')) { 36 if ((val == '') || (val == '0')) {
37 title_head.html('Все категории'); 37 title_head.html('Все категории');
38 } else { 38 } else {
39 $.ajax({ 39 $.ajax({
40 type: "GET", 40 type: "GET",
41 url: "{{ route('list-vacancies', ['categories' => $categories->id]) }}?@if (isset($_GET['sort']))&sort={{ $_GET['sort'] }}@endif", 41 url: "{{ route('list-vacancies', ['categories' => $categories->id]) }}?@if (isset($_GET['sort']))&sort={{ $_GET['sort'] }}@endif",
42 data: "job=" + val +"&title=1", 42 data: "job=" + val +"&title=1",
43 success: function (data) { 43 success: function (data) {
44 44
45 console.log(data); 45 console.log(data);
46 }, 46 },
47 47
48 headers: { 48 headers: {
49 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 49 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
50 }, 50 },
51 51
52 error: function (data) { 52 error: function (data) {
53 data = JSON.stringify(data); 53 data = JSON.stringify(data);
54 console.log('Error: ' + data); 54 console.log('Error: ' + data);
55 } 55 }
56 }); 56 });
57 57
58 } 58 }
59 }); 59 });
60 60
61 $(document).on('click', '.js_send_it_button', function() { 61 $(document).on('click', '.js_send_it_button', function() {
62 var this_ = $(this); 62 var this_ = $(this);
63 var code_user_id = this_.attr('data-uid'); 63 var code_user_id = this_.attr('data-uid');
64 var code_to_user_id = this_.attr('data-tuid'); 64 var code_to_user_id = this_.attr('data-tuid');
65 var code_vacancy = this_.attr('data-vacancy'); 65 var code_vacancy = this_.attr('data-vacancy');
66 var user_id = $('#_user_id'); 66 var user_id = $('#_user_id');
67 var to_user_id = $('#_to_user_id'); 67 var to_user_id = $('#_to_user_id');
68 var vacancy = $('#_vacancy'); 68 var vacancy = $('#_vacancy');
69 69
70 console.log('Клик на кнопки...'); 70 console.log('Клик на кнопки...');
71 71
72 user_id.val(code_user_id); 72 user_id.val(code_user_id);
73 to_user_id.val(code_to_user_id); 73 to_user_id.val(code_to_user_id);
74 vacancy.val(code_vacancy); 74 vacancy.val(code_vacancy);
75 }); 75 });
76 76
77 $(document).on('change', '#sort_ajax', function() { 77 $(document).on('change', '#sort_ajax', function() {
78 var this_ = $(this); 78 var this_ = $(this);
79 var val_ = this_.val(); 79 var val_ = this_.val();
80 console.log('sort items '+val_); 80 console.log('sort items '+val_);
81 81
82 $.ajax({ 82 $.ajax({
83 type: "GET", 83 type: "GET",
84 url: "{{ route('list-vacancies', ['categories' => $categories->id]) }}", 84 url: "{{ route('list-vacancies', ['categories' => $categories->id]) }}",
85 data: "sort="+val_+"&block=1", 85 data: "sort="+val_+"&block=1",
86 success: function (data) { 86 success: function (data) {
87 console.log('Выбор сортировки'); 87 console.log('Выбор сортировки');
88 console.log(data); 88 console.log(data);
89 $('#main_ockar').html(data); 89 $('#main_ockar').html(data);
90 history.pushState({}, '', "{{ route('list-vacancies', ['categories' => $categories->id]) }}?sort="+val_+"@if (isset($_GET['job']))&job={{ $_GET['job'] }}@endif"+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); 90 history.pushState({}, '', "{{ route('list-vacancies', ['categories' => $categories->id]) }}?sort="+val_+"@if (isset($_GET['job']))&job={{ $_GET['job'] }}@endif"+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif");
91 }, 91 },
92 headers: { 92 headers: {
93 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 93 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
94 }, 94 },
95 error: function (data) { 95 error: function (data) {
96 data = JSON.stringify(data); 96 data = JSON.stringify(data);
97 console.log('Error: ' + data); 97 console.log('Error: ' + data);
98 } 98 }
99 }); 99 });
100 }); 100 });
101 101
102 102
103 103
104 $(document).ready(function(){ 104 $(document).ready(function(){
105 var sel = $('#select2-sort_ajax-container'); 105 var sel = $('#select2-sort_ajax-container');
106 var key = getUrlParameter('sort'); 106 var key = getUrlParameter('sort');
107 console.log(sel); 107 console.log(sel);
108 console.log(key); 108 console.log(key);
109 109
110 if (key !=='') { 110 if (key !=='') {
111 console.log(key); 111 console.log(key);
112 switch (key) { 112 switch (key) {
113 case "default": sel.html('Сортировка (по умолчанию)'); break; 113 case "default": sel.html('Сортировка (по умолчанию)'); break;
114 case "name_up": sel.html('По имени (возрастание)'); break; 114 case "name_up": sel.html('По имени (возрастание)'); break;
115 case "name_down": sel.html('По дате (убывание)'); break; 115 case "name_down": sel.html('По дате (убывание)'); break;
116 case "created_at_up": sel.html('По дате (возрастание)'); break; 116 case "created_at_up": sel.html('По дате (возрастание)'); break;
117 case "created_at_down": sel.html('По дате (убывание)'); break; 117 case "created_at_down": sel.html('По дате (убывание)'); break;
118 } 118 }
119 119
120 } 120 }
121 }); 121 });
122 </script> 122 </script>
123 @include('js.favorite-vacancy-45') 123 @include('js.favorite-vacancy-45')
124 @endsection 124 @endsection
125 @section('content') 125 @section('content')
126 <section class="thing"> 126 <section class="thing">
127 <div class="container"> 127 <div class="container">
128 <form class="thing__body" action="{{ route('list-vacancies', ['categories' => (!empty($Name_categori)) ? $Name_categori[0]->id : '0']) }}" method="POST"> 128 <form class="thing__body" action="{{ route('list-vacancies', ['categories' => (!empty($Name_categori)) ? $Name_categori[0]->id : '0']) }}" method="POST">
129 <ul class="breadcrumbs thing__breadcrumbs"> 129 <ul class="breadcrumbs thing__breadcrumbs">
130 <li><a href="{{ route('index') }}">Главная</a></li> 130 <li><a href="{{ route('index') }}">Главная</a></li>
131 <li><a href="{{ route('vacancies') }}">Вакансии</a></li> 131 <li><a href="{{ route('vacancies') }}">Вакансии</a></li>
132 <li><b>{{ isset($Name_categori[0]) ? $Name_categori[0]->name : 'Все категории' }}</b></li> 132 <li><b>{{ isset($Name_categori[0]) ? $Name_categori[0]->name : 'Все категории' }}</b></li>
133 </ul> 133 </ul>
134 <h1 class="thing__title">Вакансии</h1> 134 <h1 class="thing__title">Вакансии</h1>
135 <p class="thing__text">С другой стороны, социально-экономическое развитие не оставляет шанса для 135 <p class="thing__text">С другой стороны, социально-экономическое развитие не оставляет шанса для
136 существующих финансовых и административных условий.</p> 136 существующих финансовых и административных условий.</p>
137 <div class="select select_search thing__select"> 137 <div class="select select_search thing__select">
138 <div class="select__icon"> 138 <div class="select__icon">
139 <svg> 139 <svg>
140 <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> 140 <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use>
141 </svg> 141 </svg>
142 </div> 142 </div>
143 <select class="js-select2" id="jobs" name="jobs"> 143 <select class="js-select2" id="jobs" name="jobs">
144 <option value="0" selected>Выберите должность</option> 144 <option value="0" selected>Выберите должность</option>
145 @if ($Job_title->count()) 145 @if ($Job_title->count())
146 @foreach($Job_title as $JT) 146 @foreach($Job_title as $JT)
147 <option value="{{ $JT->id }}">{{ $JT->name }}</option> 147 <option value="{{ $JT->id }}" @if(isset($_GET['job']) && ($_GET['job'] == $JT->id)) selected @endif>{{ $JT->name }}</option>
148 @endforeach 148 @endforeach
149 @endif 149 @endif
150 </select> 150 </select>
151 </div> 151 </div>
152 </form> 152 </form>
153 </div> 153 </div>
154 </section> 154 </section>
155 <main class="main"> 155 <main class="main">
156 <div class="container"> 156 <div class="container">
157 <div class="main__vacancies" > 157 <div class="main__vacancies" >
158 @if (isset($Name_categori[0]->name)) 158 @if (isset($Name_categori[0]->name))
159 <h2 class="main__vacancies-title">Категория вакансий {{ $Name_categori[0]->name }}</h2> 159 <h2 class="main__vacancies-title">Категория вакансий {{ $Name_categori[0]->name }}</h2>
160 @else 160 @else
161 <h2 class="main__vacancies-title" id="title_head" name="title_head">Все категории</h2> 161 <h2 class="main__vacancies-title" id="title_head" name="title_head">Все категории</h2>
162 @endif 162 @endif
163 <div class="filters main__vacancies-filters"> 163 <div class="filters main__vacancies-filters">
164 <div class="filters__label" id="col-vo" name="col-vo">Показано {{ $Query->firstItem() }} – {{ $Query->lastItem() }} из @isset($Query_count) {{ $Query_count }} @else 0 @endisset результатов поиска</div> 164 <div class="filters__label" id="col-vo" name="col-vo">Показано {{ $Query->firstItem() }} – {{ $Query->lastItem() }} из @isset($Query_count) {{ $Query_count }} @else 0 @endisset результатов поиска</div>
165 <div class="filters__body"> 165 <div class="filters__body">
166 <div class="select filters__select"> 166 <div class="select filters__select">
167 <select class="js-select2" id="sort_ajax" name="sort_ajax"> 167 <select class="js-select2" id="sort_ajax" name="sort_ajax">
168 <option value="default">Сортировка (по умолчанию)</option> 168 <option value="default">Сортировка (по умолчанию)</option>
169 <option value="name_up">По имени (возрастание)</option> 169 <option value="name_up">По имени (возрастание)</option>
170 <option value="name_down">По имени (убывание)</option> 170 <option value="name_down">По имени (убывание)</option>
171 <option value="created_at_up">По дате (возрастание)</option> 171 <option value="created_at_up">По дате (возрастание)</option>
172 <option value="created_at_down">По дате (убывание)</option> 172 <option value="created_at_down">По дате (убывание)</option>
173 </select> 173 </select>
174 </div> 174 </div>
175 </div> 175 </div>
176 </div> 176 </div>
177 177
178 <div class="main__vacancies" style="width:100%;" id="main_ockar" name="main_oskar"> 178 <div class="main__vacancies" style="width:100%;" id="main_ockar" name="main_oskar">
179 @php $i = ($Query->currentPage() * $Query->perPage() - $Query->count() - 1) @endphp 179 @php $i = ($Query->currentPage() * $Query->perPage() - $Query->count() - 1) @endphp
180 180
181 @foreach ($Query as $Q) 181 @foreach ($Query as $Q)
182 @foreach ($Reclama as $Rec) 182 @foreach ($Reclama as $Rec)
183 @if ($Rec->position == $i) 183 @if ($Rec->position == $i)
184 <div class="main__vacancies-thing"> 184 <div class="main__vacancies-thing">
185 @if (!empty($Rec->image)) 185 @if (!empty($Rec->image))
186 <img src="{{ asset(Storage::url($Rec->image)) }}" alt="{{ $Rec->title }}" class="main__vacancies-thing-pic"> 186 <img src="{{ asset(Storage::url($Rec->image)) }}" alt="{{ $Rec->title }}" class="main__vacancies-thing-pic">
187 @else 187 @else
188 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $Rec->title }}" class="main__vacancies-thing-pic"> 188 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $Rec->title }}" class="main__vacancies-thing-pic">
189 @endif 189 @endif
190 <div class="main__vacancies-thing-body"> 190 <div class="main__vacancies-thing-body">
191 <h2>{{ $Rec->title }}</h2> 191 <h2>{{ $Rec->title }}</h2>
192 <div class="main__vacancies-thing-scroll"> 192 <div class="main__vacancies-thing-scroll">
193 {!! $Rec->text !!} 193 {!! $Rec->text !!}
194 </div> 194 </div>
195 <a href="{{ $Rec->link }}" class="button">Узнать больше</a> 195 <a href="{{ $Rec->link }}" class="button">Узнать больше</a>
196 </div> 196 </div>
197 </div> 197 </div>
198 @endif 198 @endif
199 @endforeach 199 @endforeach
200 <div class="main__vacancies-item main__employer-page-two-item" data-id="{{ $Q->id }}"> 200 <div class="main__vacancies-item main__employer-page-two-item" data-id="{{ $Q->id }}">
201 201
202 <a href="{{ route('list-vacancies', ['categories' => $categories->id]) }}" class="back main__employer-page-two-item-back"> 202 <a href="{{ route('list-vacancies', ['categories' => $categories->id]) }}" class="back main__employer-page-two-item-back">
203 <svg> 203 <svg>
204 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> 204 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use>
205 </svg> 205 </svg>
206 <span> 206 <span>
207 Вернуться к списку вакансий 123 207 Вернуться к списку вакансий 123
208 </span> 208 </span>
209 </a> 209 </a>
210 210
211 <div class="main__employer-page-two-item-toper"> 211 <div class="main__employer-page-two-item-toper">
212 @if (!empty($Q->employer->logo)) 212 @if (!empty($Q->employer->logo))
213 <img src="{{ asset(Storage::url($Q->employer->logo)) }}" alt="{{ $Q->employer->name }}"> 213 <img src="{{ asset(Storage::url($Q->employer->logo)) }}" alt="{{ $Q->employer->name }}">
214 @else 214 @else
215 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $Rec->title }}" class="main__vacancies-thing-pic"> 215 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $Rec->title }}" class="main__vacancies-thing-pic">
216 @endif 216 @endif
217 <span>@if (!empty($Q->name)) {{ $Q->name }} @endif</span> 217 <span>@if (!empty($Q->name)) {{ $Q->name }} @endif</span>
218 </div> 218 </div>
219 219
220 <div class="main__employer-page-two-item-text"> 220 <div class="main__employer-page-two-item-text">
221 <div class="main__employer-page-two-item-text-name">Судоходная компания ведет набор 221 <div class="main__employer-page-two-item-text-name">Судоходная компания ведет набор
222 специалистов на следующие должности:</div> 222 специалистов на следующие должности:</div>
223 <div class="main__employer-page-two-item-text-links"> 223 <div class="main__employer-page-two-item-text-links">
224 @if (isset($Q->jobs)) 224 @if (isset($Q->jobs))
225 @foreach ($Q->jobs as $key => $j) 225 @foreach ($Q->jobs as $key => $j)
226 <a>“{{ $j->name }}” – з/п от @if (isset($Q->jobs_code[$key]->min_salary)) {{ $Q->jobs_code[$key]->min_salary }} @endif - @if (isset($Q->jobs_code[$key]->max_salary)) {{ $Q->jobs_code[$key]->max_salary }} @endif рублей (на руки)</a> 226 <a>“{{ $j->name }}” – з/п от @if (isset($Q->jobs_code[$key]->min_salary)) {{ $Q->jobs_code[$key]->min_salary }} @endif - @if (isset($Q->jobs_code[$key]->max_salary)) {{ $Q->jobs_code[$key]->max_salary }} @endif рублей (на руки)</a>
227 @endforeach 227 @endforeach
228 @endif 228 @endif
229 </div> 229 </div>
230 </div> 230 </div>
231 231
232 <div class="main__employer-page-two-item-text"> 232 <div class="main__employer-page-two-item-text">
233 <div class="main__employer-page-two-item-text-name">Мы предлагаем:</div> 233 <div class="main__employer-page-two-item-text-name">Мы предлагаем:</div>
234 <div class="main__employer-page-two-item-text-body"> 234 <div class="main__employer-page-two-item-text-body">
235 {!! $Q->text !!} 235 {!! $Q->text !!}
236 </div> 236 </div>
237 </div> 237 </div>
238 <div class="main__employer-page-two-item-text"> 238 <div class="main__employer-page-two-item-text">
239 <div class="main__employer-page-two-item-text-name">Наши ожидания:</div> 239 <div class="main__employer-page-two-item-text-name">Наши ожидания:</div>
240 <div class="main__employer-page-two-item-text-body"> 240 <div class="main__employer-page-two-item-text-body">
241 {!! $Q->description !!} 241 {!! $Q->description !!}
242 </div> 242 </div>
243 </div> 243 </div>
244 <div class="main__employer-page-two-item-text"> 244 <div class="main__employer-page-two-item-text">
245 <div class="main__employer-page-two-item-text-name">Резюме направляйте на почту:</div> 245 <div class="main__employer-page-two-item-text-name">Резюме направляйте на почту:</div>
246 <div class="main__employer-page-two-item-text-body"> 246 <div class="main__employer-page-two-item-text-body">
247 {!! $Q->contacts_emails !!} 247 {!! $Q->contacts_emails !!}
248 </div> 248 </div>
249 </div> 249 </div>
250 <div class="main__employer-page-two-item-text"> 250 <div class="main__employer-page-two-item-text">
251 <div class="main__employer-page-two-item-text-name">Или звоните:</div> 251 <div class="main__employer-page-two-item-text-name">Или звоните:</div>
252 <div class="main__employer-page-two-item-text-body"> 252 <div class="main__employer-page-two-item-text-body">
253 {!! $Q->contacts_telephones !!} 253 {!! $Q->contacts_telephones !!}
254 </div> 254 </div>
255 </div> 255 </div>
256 256
257 <div class="main__employer-page-two-item-tags"> 257 <div class="main__employer-page-two-item-tags">
258 @if (!empty($Q->jobs_code[0]->position_ship)) 258 @if (!empty($Q->jobs_code[0]->position_ship))
259 <span class="main__employer-page-two-item-tag"> #{{ $Q->jobs_code[0]->position_ship }}</span> 259 <span class="main__employer-page-two-item-tag"> #{{ $Q->jobs_code[0]->position_ship }}</span>
260 @else 260 @else
261 @if (isset($Q->jobs)) 261 @if (isset($Q->jobs))
262 @foreach ($Q->jobs as $key => $j) 262 @foreach ($Q->jobs as $key => $j)
263 <span class="main__employer-page-two-item-tag"> #{{ $j->name }}</span> 263 <span class="main__employer-page-two-item-tag"> #{{ $j->name }}</span>
264 @endforeach 264 @endforeach
265 @endif 265 @endif
266 @endif 266 @endif
267 </div> 267 </div>
268 <div class="main__employer-page-two-item-buttons"> 268 <div class="main__employer-page-two-item-buttons">
269 @guest 269 @guest
270 <button type="button" data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' 270 <button type="button" data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}'
271 class="button main__employer-page-two-item-button">Откликнуться</button> 271 class="button main__employer-page-two-item-button">Откликнуться</button>
272 @else 272 @else
273 @if (App\Classes\StatusUser::Status()==1) 273 @if (App\Classes\StatusUser::Status()==1)
274 <button type="button" data-fancybox data-src="#send" data-vacancy="{{ $Q->id }}" data-uid="{{ $uid }}" data-tuid="{{ $Q->employer->user_id }}" data-options='{"touch":false,"autoFocus":false}' 274 <button type="button" data-fancybox data-src="#send" data-vacancy="{{ $Q->id }}" data-uid="{{ $uid }}" data-tuid="{{ $Q->employer->user_id }}" data-options='{"touch":false,"autoFocus":false}'
275 class="button main__employer-page-two-item-button js_send_it_button">Откликнуться</button> 275 class="button main__employer-page-two-item-button js_send_it_button">Откликнуться</button>
276 @else 276 @else
277 <button type="button" data-fancybox data-src="#send2" data-vacancy="{{ $Q->id }}" data-uid="{{ $uid }}" data-tuid="{{ $Q->employer->user_id }}" data-options='{"touch":false,"autoFocus":false}' 277 <button type="button" data-fancybox data-src="#send2" data-vacancy="{{ $Q->id }}" data-uid="{{ $uid }}" data-tuid="{{ $Q->employer->user_id }}" data-options='{"touch":false,"autoFocus":false}'
278 class="button main__employer-page-two-item-button js_send_it_button">Откликнуться</button> 278 class="button main__employer-page-two-item-button js_send_it_button">Откликнуться</button>
279 @endif 279 @endif
280 @endguest 280 @endguest
281 <a href="{{ route('vacancie', ['vacancy' => $Q->id]) }}" class="button button_light main__employer-page-two-item-button">Подробнее</a> 281 <a href="{{ route('vacancie', ['vacancy' => $Q->id]) }}" class="button button_light main__employer-page-two-item-button">Подробнее</a>
282 </div> 282 </div>
283 <div class="main__employer-page-two-item-bottom"> 283 <div class="main__employer-page-two-item-bottom">
284 <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($Q->created_at)) }}</div> 284 <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($Q->created_at)) }}</div>
285 <button type="button" id="like{{ $Q->id }}" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js-toggle js_vac_favorite {{ \App\Classes\LikesClass::get_status_vacancy($Q) }}"> 285 <button type="button" id="like{{ $Q->id }}" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js-toggle js_vac_favorite {{ \App\Classes\LikesClass::get_status_vacancy($Q) }}">
286 <svg> 286 <svg>
287 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> 287 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use>
288 </svg> 288 </svg>
289 </button> 289 </button>
290 </div> 290 </div>
291 </div> 291 </div>
292 @php $i++ @endphp 292 @php $i++ @endphp
293 @endforeach 293 @endforeach
294 <div style="margin-top: 20px"> 294 <div style="margin-top: 20px">
295 {{ $Query->onEachSide(0)->appends($_GET)->links('paginate') }} 295 {{ $Query->onEachSide(0)->appends($_GET)->links('paginate') }}
296 </div><!-- конец --> 296 </div><!-- конец -->
297 297
298 </div> 298 </div>
299 </div> 299 </div>
300 </div> 300 </div>
301 </main> 301 </main>
302 @endsection 302 @endsection
303 303
resources/views/new_sky.blade.php
1 @extends('layout.frontend', ['title' => 'Вакансии РекаМоре']) 1 @extends('layout.frontend', ['title' => 'Вакансии РекаМоре'])
2 2
3 @section('scripts') 3 @section('scripts')
4 <script> 4 <script>
5 console.log('Test system'); 5 console.log('Test system');
6 $(document).on('change', '.jobs', function() { 6 $(document).on('change', '.jobs', function() {
7 var val = $(this).val(); 7 var val = $(this).val();
8 8
9 console.log('Click change...'); 9 console.log('Click change...');
10 $.ajax({ 10 $.ajax({
11 type: "GET", 11 type: "GET",
12 url: "{{ route('vacancies') }}", 12 url: "{{ route('vacancies') }}",
13 data: "job="+val, 13 data: "job="+val,
14 success: function (data) { 14 success: function (data) {
15 console.log('Выбор должности'); 15 console.log('Выбор должности');
16 console.log(data); 16 console.log(data);
17 $('#block_ajax').html(data); 17 $('#block_ajax').html(data);
18 }, 18 },
19 headers: { 19 headers: {
20 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 20 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
21 }, 21 },
22 error: function (data) { 22 error: function (data) {
23 data = JSON.stringify(data); 23 data = JSON.stringify(data);
24 console.log('Error: ' + data); 24 console.log('Error: ' + data);
25 } 25 }
26 }); 26 });
27 }); 27 });
28 </script> 28 </script>
29 @endsection 29 @endsection
30 30
31 @section('content') 31 @section('content')
32 <section class="thing"> 32 <section class="thing">
33 <div class="container"> 33 <div class="container">
34 <form class="thing__body"> 34 <form class="thing__body">
35 <ul class="breadcrumbs thing__breadcrumbs"> 35 <ul class="breadcrumbs thing__breadcrumbs">
36 <li><a href="{{ route('index') }}">Главная</a></li> 36 <li><a href="{{ route('index') }}">Главная</a></li>
37 <li><b>Вакансии</b></li> 37 <li><b>Вакансии</b></li>
38 </ul> 38 </ul>
39 <h1 class="thing__title">Вакансии</h1> 39 <h1 class="thing__title">Вакансии</h1>
40 <p class="thing__text">С другой стороны, социально-экономическое развитие не оставляет шанса для 40 <p class="thing__text">С другой стороны, социально-экономическое развитие не оставляет шанса для
41 существующих финансовых и административных условий.</p> 41 существующих финансовых и административных условий.</p>
42 <div class="select select_search thing__select"> 42 <div class="select select_search thing__select">
43 <div class="select__icon"> 43 <div class="select__icon">
44 <svg> 44 <svg>
45 <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> 45 <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use>
46 </svg> 46 </svg>
47 </div> 47 </div>
48 <select class="js-select2 jobs" id="jobs" name="jobs"> 48 <select class="js-select2 jobs" id="jobs" name="jobs">
49 <option value="0">Выберите должность</option> 49 <option value="0">Выберите должность</option>
50 @if ($Job_title->count()) 50 @if ($Job_title->count())
51 @foreach($Job_title as $JT) 51 @foreach($Job_title as $JT)
52 <option value="{{ $JT->id }}" @if ((isset($_GET['job'])) && ($_GET['job'] == $JT->id)) selected @endif>{{ $JT->name }}</option> 52 <option value="{{ $JT->id }}" @if ((isset($_GET['job'])) && ($_GET['job'] == $JT->id)) selected @endif>{{ $JT->name }}</option>
53 @endforeach 53 @endforeach
54 @endif 54 @endif
55 </select> 55 </select>
56 </div> 56 </div>
57 </form> 57 </form>
58 </div> 58 </div>
59 </section> 59 </section>
60 60
61 61
62 <main class="main"> 62 <main class="main">
63 <div class="container"> 63 <div class="container">
64 <div class="main__vacancies"> 64 <div class="main__vacancies">
65 <h2 class="main__vacancies-title">Категории вакансий</h2> 65 <h2 class="main__vacancies-title">Категории вакансий</h2>
66 <div class="vacancies__body"> 66 <div class="vacancies__body">
67 <!--<button class="vacancies__more button button_more button_light js-toggle js-parent-toggle"> 67 <!--<button class="vacancies__more button button_more button_light js-toggle js-parent-toggle">
68 <span>Показать ещё</span> 68 <span>Показать ещё</span>
69 <span>Скрыть</span> 69 <span>Скрыть</span>
70 </button>--> 70 </button>-->
71 <div class="vacancies__list" id="block_ajax" name="block_ajax"> 71 <div class="vacancies__list" id="block_ajax" name="block_ajax">
72 @foreach ($BigFlot as $key => $flot) 72 @foreach($Main_Job as $key => $it_main)
73 <div class="vacancies__list-col"> 73 <div class="vacancies__list-col">
74 @include('block_real', ['flot' => $flot, 'position' => $Position[$key]]) 74 @include('block_real_new', ['it_main' => $it_main, 'category' => $key])
75 </div> 75 </div>
76 @endforeach 76 @endforeach
77 <!--_foreach (BigFlot as $key => $flot)
78 <div class="vacancies__list-col">
79 _include('block_real', ['flot' => $flot, 'position' => $Position[$key]])
80 </div>
81 _endforeach-->
77 </div> 82 </div>
78 </div> 83 </div>
79 </div> 84 </div>
80 </div> 85 </div>
81 </main> 86 </main>
82 87
83 </div> 88 </div>
84 @endsection 89 @endsection
85 90
resources/views/worker.blade.php
1 @extends('layout.frontend', ['title' => 'Карточка соискателя - РекаМоре']) 1 @extends('layout.frontend', ['title' => 'Карточка соискателя - РекаМоре'])
2 2
3 @section('scripts') 3 @section('scripts')
4 <script> 4 <script>
5 console.log('Test system'); 5 console.log('Test system');
6 $(document).on('change', '#jobs', function() { 6 $(document).on('change', '#jobs', function() {
7 var val = $(this).val(); 7 var val = $(this).val();
8 var main_oskar = $('#main_ockar'); 8 var main_oskar = $('#main_ockar');
9 9
10 console.log('Code='+val); 10 console.log('Code='+val);
11 console.log('Click change...'); 11 console.log('Click change...');
12 $.ajax({ 12 $.ajax({
13 type: "GET", 13 type: "GET",
14 url: "", 14 url: "",
15 data: "job="+val, 15 data: "job="+val,
16 success: function (data) { 16 success: function (data) {
17 console.log('Выбор сделан!'); 17 console.log('Выбор сделан!');
18 console.log(data); 18 console.log(data);
19 main_oskar.html(data); 19 main_oskar.html(data);
20 }, 20 },
21 headers: { 21 headers: {
22 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 22 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
23 }, 23 },
24 error: function (data) { 24 error: function (data) {
25 data = JSON.stringify(data); 25 data = JSON.stringify(data);
26 console.log('Error: ' + data); 26 console.log('Error: ' + data);
27 } 27 }
28 }); 28 });
29 }); 29 });
30 </script> 30 </script>
31 31
32 <script> 32 <script>
33 $(document).on('click', '.js_it_button', function() { 33 $(document).on('click', '.js_it_button', function() {
34 var this_ = $(this); 34 var this_ = $(this);
35 var code_user_id = this_.attr('data-uid'); 35 var code_user_id = this_.attr('data-uid');
36 var code_to_user_id = this_.attr('data-tuid'); 36 var code_to_user_id = this_.attr('data-tuid');
37 var code_vacancy = this_.attr('data-vacancy'); 37 var code_vacancy = this_.attr('data-vacancy');
38 var user_id = $('#_user_id'); 38 var user_id = $('#_user_id');
39 var to_user_id = $('#_to_user_id'); 39 var to_user_id = $('#_to_user_id');
40 var vacancy = $('#_vacancy'); 40 var vacancy = $('#_vacancy');
41 41
42 console.log('code_to_user_id='+code_to_user_id); 42 console.log('code_to_user_id='+code_to_user_id);
43 console.log('code_user_id='+code_user_id); 43 console.log('code_user_id='+code_user_id);
44 console.log('code_vacancy='+code_vacancy); 44 console.log('code_vacancy='+code_vacancy);
45 console.log('Клик на кнопке...'); 45 console.log('Клик на кнопке...');
46 46
47 user_id.val(code_user_id); 47 user_id.val(code_user_id);
48 to_user_id.val(code_to_user_id); 48 to_user_id.val(code_to_user_id);
49 vacancy.val(code_vacancy); 49 vacancy.val(code_vacancy);
50 }); 50 });
51 </script> 51 </script>
52 @include('js.favorite-worker') 52 @include('js.favorite-worker')
53 @endsection 53 @endsection
54 54
55 @section('content') 55 @section('content')
56 <section class="thing"> 56 <section class="thing">
57 <div class="container"> 57 <div class="container">
58 <ul class="breadcrumbs thing__breadcrumbs"> 58 <ul class="breadcrumbs thing__breadcrumbs">
59 <li><a href="{{ route('index') }}">Главная</a></li> 59 <li><a href="{{ route('index') }}">Главная</a></li>
60 <li><a href="{{ route('bd_resume') }}">База резюме</a></li> 60 <li><a href="{{ route('bd_resume') }}">База резюме</a></li>
61 <li><b>@if (isset($Query[0]->users)) {{ $Query[0]->users->surname." ".$Query[0]->users->name_man." ".$Query[0]->users->surname2 }} @else Неизвестно @endif</b></li> 61 <li><b>@if (isset($Query[0]->users)) {{ $Query[0]->users->surname." ".$Query[0]->users->name_man." ".$Query[0]->users->surname2 }} @else Неизвестно @endif</b></li>
62 </ul> 62 </ul>
63 <div class="thing__profile"> 63 <div class="thing__profile">
64 <img src="@isset($Query->photo) {{ asset(Storage::url($Query->photo)) }} @else {{ asset('images/default_man.jpg') }} @endif" alt="" class="thing__profile-photo"> 64 <img src="@if (isset($Query[0]->photo)) {{ asset(Storage::url($Query[0]->photo)) }} @elseif(!empty($Query[0]->users->file)) {{ asset(Storage::url($Query[0]->users->file)) }} @else {{ asset('images/default_man.jpg') }} @endif" alt="" class="main__resume-base-body-item-photo">
65 <div class="thing__profile-body"> 65 <div class="thing__profile-body">
66 <h1 class="thing__title">@if (isset($Query[0]->users)) {{ $Query[0]->users->surname." ".$Query[0]->users->name_man." ".$Query[0]->users->surname2 }} @else Неизвестно @endif</h1> 66 <h1 class="thing__title">@if (isset($Query[0]->users)) {{ $Query[0]->users->surname." ".$Query[0]->users->name_man." ".$Query[0]->users->surname2 }} @else Неизвестно @endif</h1>
67 <p class="thing__text">Сложно сказать, почему ключевые особенности структуры проекта рассмотрены 67 <p class="thing__text">Сложно сказать, почему ключевые особенности структуры проекта рассмотрены
68 исключительно в разрезе маркетинговых и финансовых предпосылок.</p> 68 исключительно в разрезе маркетинговых и финансовых предпосылок.</p>
69 <div class="thing__bottom"> 69 <div class="thing__bottom">
70 <a class="button" href="{{ route('resume_download', ['worker' => $Query[0]->id]) }}"> 70 <a class="button" href="{{ route('resume_download', ['worker' => $Query[0]->id]) }}">
71 Скачать резюме 71 Скачать резюме
72 <svg> 72 <svg>
73 <use xlink:href="{{ asset('images/sprite.svg#download') }}"></use> 73 <use xlink:href="{{ asset('images/sprite.svg#download') }}"></use>
74 </svg> 74 </svg>
75 </a> 75 </a>
76 <button type="button" class="like js-toggle"> 76 <button type="button" class="like js-toggle">
77 <svg> 77 <svg>
78 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> 78 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use>
79 </svg> 79 </svg>
80 </button> 80 </button>
81 </div> 81 </div>
82 </div> 82 </div>
83 </div> 83 </div>
84 </div> 84 </div>
85 </section> 85 </section>
86 <main class="main"> 86 <main class="main">
87 <div class="container"> 87 <div class="container">
88 <div class="main__resume-profile"> 88 <div class="main__resume-profile">
89 <div class="main__content"> 89 <div class="main__content">
90 <div class="main__spoiler"> 90 <div class="main__spoiler">
91 <button type="button" class="main__spoiler-toper js-toggle active"> 91 <button type="button" class="main__spoiler-toper js-toggle active">
92 Основная информация</button> 92 Основная информация</button>
93 93
94 <div class="main__spoiler-body"> 94 <div class="main__spoiler-body">
95 <table class="main__table"> 95 <table class="main__table">
96 <tbody> 96 <tbody>
97 <tr> 97 <tr>
98 <td>Имя:</td> 98 <td>Имя:</td>
99 <td><b>{{ $Query[0]->users->name_man }}</b></td> 99 <td><b>{{ $Query[0]->users->name_man }}</b></td>
100 </tr> 100 </tr>
101 <tr> 101 <tr>
102 <td>Должность:</td> 102 <td>Должность:</td>
103 <td> 103 <td>
104 @if ($Query[0]->job_titles->count()) 104 @if ($Query[0]->job_titles->count())
105 @foreach ($Query[0]->job_titles as $it) 105 @foreach ($Query[0]->job_titles as $it)
106 <b>{{ $it->name }}</b> 106 <b>{{ $it->name }}</b>
107 @endforeach 107 @endforeach
108 @endif 108 @endif
109 </td> 109 </td>
110 </tr> 110 </tr>
111 <tr> 111 <tr>
112 <td>Телефон:</td> 112 <td>Телефон:</td>
113 <td><b><a href="tel:{{ $Query[0]->telephone }}">{{ $Query[0]->telephone }}</a></b></td> 113 <td><b><a href="tel:{{ $Query[0]->telephone }}">{{ $Query[0]->telephone }}</a></b></td>
114 </tr> 114 </tr>
115 <tr> 115 <tr>
116 <td>E-mail:</td> 116 <td>E-mail:</td>
117 <td><b><a href="emailto:{{ $Query[0]->email }}">{{ $Query[0]->email }}</a></b></td> 117 <td><b><a href="emailto:{{ $Query[0]->email }}">{{ $Query[0]->email }}</a></b></td>
118 </tr> 118 </tr>
119 <tr> 119 <tr>
120 <td>Возраст:</td> 120 <td>Возраст:</td>
121 <td><b>{{ $Query[0]->old_year }}</b></td> 121 <td><b>{{ $Query[0]->old_year }}</b></td>
122 </tr> 122 </tr>
123 <tr> 123 <tr>
124 <td>Статус:</td> 124 <td>Статус:</td>
125 <td><b>{{ $status_work[$Query[0]->status_work] }}</b></td> 125 <td><b>{{ $status_work[$Query[0]->status_work] }}</b></td>
126 </tr> 126 </tr>
127 <tr> 127 <tr>
128 <td>Город проживания:</td> 128 <td>Город проживания:</td>
129 <td><b>{{ $Query[0]->city }}</b></td> 129 <td><b>{{ $Query[0]->city }}</b></td>
130 </tr> 130 </tr>
131 <tr> 131 <tr>
132 <td>Уровень английского:</td> 132 <td>Уровень английского:</td>
133 <td><b>{{ $Query[0]->en_is }}</b></td> 133 <td><b>{{ $Query[0]->en_is }}</b></td>
134 </tr> 134 </tr>
135 <tr> 135 <tr>
136 <td>Опыт работы:</td> 136 <td>Опыт работы:</td>
137 <td><b>{{ $Query[0]->experience }}</b></td> 137 <td><b>{{ $Query[0]->experience }}</b></td>
138 </tr> 138 </tr>
139 </tbody> 139 </tbody>
140 </table> 140 </table>
141 </div> 141 </div>
142 </div> 142 </div>
143 <div class="main__spoiler"> 143 <div class="main__spoiler">
144 <button type="button" class="main__spoiler-toper js-toggle">Сертификаты / документы</button> 144 <button type="button" class="main__spoiler-toper js-toggle">Сертификаты / документы</button>
145 <div class="main__spoiler-body"> 145 <div class="main__spoiler-body">
146 146
147 @if (isset($Query[0]->sertificate)) 147 @if (isset($Query[0]->sertificate))
148 @if ($Query[0]->sertificate->count()) 148 @if ($Query[0]->sertificate->count())
149 @foreach($Query[0]->sertificate as $it) 149 @foreach($Query[0]->sertificate as $it)
150 <table class="main__table"> 150 <table class="main__table">
151 <tbody> 151 <tbody>
152 <tr> 152 <tr>
153 <td>Название сертификата:</td> 153 <td>Название сертификата:</td>
154 <td><b>{{ $it->name }}</b></td> 154 <td><b>{{ $it->name }}</b></td>
155 </tr> 155 </tr>
156 <tr> 156 <tr>
157 <td>Организация выдавшая документ:</td> 157 <td>Организация выдавшая документ:</td>
158 <td><b>{{ $it->education }}</b></td> 158 <td><b>{{ $it->education }}</b></td>
159 </tr> 159 </tr>
160 <tr> 160 <tr>
161 <td>Дата начала обучения:</td> 161 <td>Дата начала обучения:</td>
162 <td><b>{{ $it->date_begin }}</b></td> 162 <td><b>{{ $it->date_begin }}</b></td>
163 </tr> 163 </tr>
164 <tr> 164 <tr>
165 <td>Дата конца обучения:</td> 165 <td>Дата конца обучения:</td>
166 <td><b>{{ $it->end_begin }}</b></td> 166 <td><b>{{ $it->end_begin }}</b></td>
167 </tr> 167 </tr>
168 </tbody> 168 </tbody>
169 </table> 169 </table>
170 <br> 170 <br>
171 @endforeach 171 @endforeach
172 @endif 172 @endif
173 @endif 173 @endif
174 </div> 174 </div>
175 </div> 175 </div>
176 176
177 <div class="main__spoiler"> 177 <div class="main__spoiler">
178 <button type="button" class="main__spoiler-toper js-toggle">Опыт работы</button> 178 <button type="button" class="main__spoiler-toper js-toggle">Опыт работы</button>
179 <div class="main__spoiler-body"> 179 <div class="main__spoiler-body">
180 180
181 @if (isset($Query[0]->place_worker)) 181 @if (isset($Query[0]->place_worker))
182 @if ($Query[0]->place_worker->count()) 182 @if ($Query[0]->place_worker->count())
183 @foreach($Query[0]->place_worker as $it) 183 @foreach($Query[0]->place_worker as $it)
184 184
185 <table class="main__table"> 185 <table class="main__table">
186 <tbody> 186 <tbody>
187 <tr> 187 <tr>
188 <td>Должность:</td> 188 <td>Должность:</td>
189 <td><b>{{ $it->job_title }}</b></td> 189 <td><b>{{ $it->job_title }}</b></td>
190 </tr> 190 </tr>
191 <tr> 191 <tr>
192 <td>Опыт работы в танкерном флоте:</td> 192 <td>Опыт работы в танкерном флоте:</td>
193 <td><b>@if($it->tanker==1) Есть @else Нет @endif</b></td> 193 <td><b>@if($it->tanker==1) Есть @else Нет @endif</b></td>
194 </tr> 194 </tr>
195 <tr> 195 <tr>
196 <td>Дата начала работы:</td> 196 <td>Дата начала работы:</td>
197 <td><b>{{ $it->begin_work }}</b></td> 197 <td><b>{{ $it->begin_work }}</b></td>
198 </tr> 198 </tr>
199 <tr> 199 <tr>
200 <td>Дата конца работы:</td> 200 <td>Дата конца работы:</td>
201 <td><b>{{ $it->end_work }}</b></td> 201 <td><b>{{ $it->end_work }}</b></td>
202 </tr> 202 </tr>
203 <tr> 203 <tr>
204 <td>Название компании:</td> 204 <td>Название компании:</td>
205 <td><b>{{ $it->name_company }}</b></td> 205 <td><b>{{ $it->name_company }}</b></td>
206 </tr> 206 </tr>
207 <tr> 207 <tr>
208 <td>GWT тип</td> 208 <td>GWT тип</td>
209 <td><b>{{ $it->GWT }}</b></td> 209 <td><b>{{ $it->GWT }}</b></td>
210 </tr> 210 </tr>
211 <tr> 211 <tr>
212 <td>ГД:</td> 212 <td>ГД:</td>
213 <td><b>{{ $it->KBT }}</b></td> 213 <td><b>{{ $it->KBT }}</b></td>
214 </tr> 214 </tr>
215 </tbody> 215 </tbody>
216 </table> 216 </table>
217 <br> 217 <br>
218 @endforeach 218 @endforeach
219 @endif 219 @endif
220 @endif 220 @endif
221 </div> 221 </div>
222 </div> 222 </div>
223 223
224 <div class="main__spoiler"> 224 <div class="main__spoiler">
225 <button type="button" class="main__spoiler-toper js-toggle">Дополнительные документы</button> 225 <button type="button" class="main__spoiler-toper js-toggle">Дополнительные документы</button>
226 <div class="main__spoiler-body"> 226 <div class="main__spoiler-body">
227 227
228 @if (isset($Query[0]->infobloks)) 228 @if (isset($Query[0]->infobloks))
229 @if ($Query[0]->infobloks->count()) 229 @if ($Query[0]->infobloks->count())
230 <table class="main__table"> 230 <table class="main__table">
231 <tbody> 231 <tbody>
232 @foreach($Query[0]->infobloks as $it) 232 @foreach($Query[0]->infobloks as $it)
233 <tr> 233 <tr>
234 <td>Документ:</td> 234 <td>Документ:</td>
235 <td><b>{{ $it->name }}</b></td> 235 <td><b>{{ $it->name }}</b></td>
236 </tr> 236 </tr>
237 @endforeach 237 @endforeach
238 </tbody> 238 </tbody>
239 </table> 239 </table>
240 @endif 240 @endif
241 @endif 241 @endif
242 </div> 242 </div>
243 </div> 243 </div>
244 </div> 244 </div>
245 245
246 <div class="main__resume-profile-about"> 246 <div class="main__resume-profile-about">
247 <h2 class="main__resume-profile-about-title">О себе</h2> 247 <h2 class="main__resume-profile-about-title">О себе</h2>
248 <p class="main__resume-profile-about-text">{{ $Query[0]->text }}</p> 248 <p class="main__resume-profile-about-text">{{ $Query[0]->text }}</p>
249 <div class="button main__resume-profile-about-button js_it_button" data-fancybox data-src="#send2" data-vacancy="0" data-uid="{{ $idiot }}" data-tuid="{{ $Query[0]->users->id }}" data-options='{"touch":false,"autoFocus":false}'>Написать сообщение</div> 249 <div class="button main__resume-profile-about-button js_it_button" data-fancybox data-src="#send2" data-vacancy="0" data-uid="{{ $idiot }}" data-tuid="{{ $Query[0]->users->id }}" data-options='{"touch":false,"autoFocus":false}'>Написать сообщение</div>
250 </div> 250 </div>
251 <div class="main__resume-profile-info"> 251 <div class="main__resume-profile-info">
252 <h2 class="main__resume-profile-info-title">Данные о прошлых компаниях</h2> 252 <h2 class="main__resume-profile-info-title">Данные о прошлых компаниях</h2>
253 <div class="main__resume-profile-info-body"> 253 <div class="main__resume-profile-info-body">
254 @if ((isset($Query[0]->prev_company)) && ($Query[0]->prev_company->count())) 254 @if ((isset($Query[0]->prev_company)) && ($Query[0]->prev_company->count()))
255 @foreach ($Query[0]->prev_company as $it) 255 @foreach ($Query[0]->prev_company as $it)
256 <div class="main__resume-profile-info-body-item"> 256 <div class="main__resume-profile-info-body-item">
257 <h3 class="main__resume-profile-info-body-subtitle">{{ $it->name_company }}</h3> 257 <h3 class="main__resume-profile-info-body-subtitle">{{ $it->name_company }}</h3>
258 <ul class="main__resume-profile-info-body-inner"> 258 <ul class="main__resume-profile-info-body-inner">
259 <li> 259 <li>
260 <b>Руководитель</b> 260 <b>Руководитель</b>
261 <span>{{ $it->direct }}</span> 261 <span>{{ $it->direct }}</span>
262 </li> 262 </li>
263 <li> 263 <li>
264 <b>Телефон того, кто может дать рекомендацию</b> 264 <b>Телефон того, кто может дать рекомендацию</b>
265 <span> 265 <span>
266 @if (!empty($it->telephone)) 266 @if (!empty($it->telephone))
267 <a href="tel:{{$it->telephone }}">{{ $it->telephone }}</a> 267 <a href="tel:{{$it->telephone }}">{{ $it->telephone }}</a>
268 @endif 268 @endif
269 @if (!empty($it->telephone2)) 269 @if (!empty($it->telephone2))
270 <a href="tel:{{$it->telephone2 }}">{{ $it->telephone2 }}</a> 270 <a href="tel:{{$it->telephone2 }}">{{ $it->telephone2 }}</a>
271 @endif 271 @endif
272 </span> 272 </span>
273 </li> 273 </li>
274 </ul> 274 </ul>
275 </div> 275 </div>
276 @endforeach 276 @endforeach
277 @else 277 @else
278 <div class="main__resume-profile-info-body-item"> 278 <div class="main__resume-profile-info-body-item">
279 <h3 class="main__resume-profile-info-body-subtitle">Нету данных о компании</h3> 279 <h3 class="main__resume-profile-info-body-subtitle">Нету данных о компании</h3>
280 </div> 280 </div>
281 @endif 281 @endif
282 </div> 282 </div>
283 </div> 283 </div>
284 284
285 <div class="main__resume-profile-review"> 285 <div class="main__resume-profile-review">
286 <form action="{{ route('stars_answer') }}" method="POST"> 286 <form action="{{ route('stars_answer') }}" method="POST">
287 @csrf 287 @csrf
288 <h2 class="main__resume-profile-review-title">Оставить отзыв о работнике</h2> 288 <h2 class="main__resume-profile-review-title">Оставить отзыв о работнике</h2>
289 <div class="rate"> 289 <div class="rate">
290 <div class="rate__label">Ваша оценка:</div> 290 <div class="rate__label">Ваша оценка:</div>
291 <div class="rate__stars"> 291 <div class="rate__stars">
292 <select name="stars" id="stars" class="star-rating js-stars"> 292 <select name="stars" id="stars" class="star-rating js-stars">
293 <option value="5">5</option> 293 <option value="5">5</option>
294 <option value="4">4</option> 294 <option value="4">4</option>
295 <option value="3">3</option> 295 <option value="3">3</option>
296 <option value="2">2</option> 296 <option value="2">2</option>
297 <option value="1" selected>1</option> 297 <option value="1" selected>1</option>
298 </select> 298 </select>
299 </div> 299 </div>
300 </div> 300 </div>
301 <input type="hidden" name="worker_id" id="worker_id" value="{{ $Query[0]->id }}"/> 301 <input type="hidden" name="worker_id" id="worker_id" value="{{ $Query[0]->id }}"/>
302 <div class="main__resume-profile-review-body"> 302 <div class="main__resume-profile-review-body">
303 <h3>Ваш отзыв</h3> 303 <h3>Ваш отзыв</h3>
304 <textarea class="textarea" name="message" id="message" placeholder="Текст отзыва&hellip;" required></textarea> 304 <textarea class="textarea" name="message" id="message" placeholder="Текст отзыва&hellip;" required></textarea>
305 <button type="submit" class="button">Оставить отзыв</button> 305 <button type="submit" class="button">Оставить отзыв</button>
306 </div> 306 </div>
307 </form> 307 </form>
308 </div> 308 </div>
309 </div> 309 </div>
310 </div> 310 </div>
311 </main> 311 </main>
312 </div> 312 </div>
313 @endsection 313 @endsection
314 314
1 <?php 1 <?php
2 2
3 use App\Http\Controllers\Ad_jobsController; 3 use App\Http\Controllers\Ad_jobsController;
4 use App\Http\Controllers\AdEmployerController; 4 use App\Http\Controllers\AdEmployerController;
5 use App\Http\Controllers\Admin\AdminController; 5 use App\Http\Controllers\Admin\AdminController;
6 use App\Http\Controllers\Admin\CategoryController; 6 use App\Http\Controllers\Admin\CategoryController;
7 use App\Http\Controllers\Admin\CategoryEmpController; 7 use App\Http\Controllers\Admin\CategoryEmpController;
8 use App\Http\Controllers\Admin\EducationController; 8 use App\Http\Controllers\Admin\EducationController;
9 use App\Http\Controllers\Admin\EmployersController; 9 use App\Http\Controllers\Admin\EmployersController;
10 use App\Http\Controllers\EmployerController as FrontEmployersController; 10 use App\Http\Controllers\EmployerController as FrontEmployersController;
11 use App\Http\Controllers\Admin\InfoBloksController; 11 use App\Http\Controllers\Admin\InfoBloksController;
12 use App\Http\Controllers\Admin\JobTitlesController; 12 use App\Http\Controllers\Admin\JobTitlesController;
13 use App\Http\Controllers\Admin\UsersController; 13 use App\Http\Controllers\Admin\UsersController;
14 use App\Http\Controllers\Admin\WorkersController; 14 use App\Http\Controllers\Admin\WorkersController;
15 use App\Http\Controllers\Auth\ForgotPasswordController; 15 use App\Http\Controllers\Auth\ForgotPasswordController;
16 use App\Http\Controllers\Auth\LoginController; 16 use App\Http\Controllers\Auth\LoginController;
17 use App\Http\Controllers\Auth\RegisterController; 17 use App\Http\Controllers\Auth\RegisterController;
18 use App\Http\Controllers\CKEditorController; 18 use App\Http\Controllers\CKEditorController;
19 use App\Http\Controllers\MediaController; 19 use App\Http\Controllers\MediaController;
20 use App\Http\Controllers\WorkerController; 20 use App\Http\Controllers\WorkerController;
21 use App\Models\Ad_jobs; 21 use App\Models\Ad_jobs;
22 use App\Models\User; 22 use App\Models\User;
23 use App\Http\Controllers\MainController; 23 use App\Http\Controllers\MainController;
24 use App\Http\Controllers\HomeController; 24 use App\Http\Controllers\HomeController;
25 use Illuminate\Support\Facades\Route; 25 use Illuminate\Support\Facades\Route;
26 use App\Http\Controllers\Admin\CompanyController; 26 use App\Http\Controllers\Admin\CompanyController;
27 use App\Http\Controllers\Admin\Ad_EmployersController; 27 use App\Http\Controllers\Admin\Ad_EmployersController;
28 use App\Http\Controllers\Admin\MsgAnswersController; 28 use App\Http\Controllers\Admin\MsgAnswersController;
29 use App\Http\Controllers\Admin\GroupsController; 29 use App\Http\Controllers\Admin\GroupsController;
30 use App\Http\Controllers\PagesController; 30 use App\Http\Controllers\PagesController;
31 use Illuminate\Support\Facades\Storage; 31 use Illuminate\Support\Facades\Storage;
32 use App\Http\Controllers\EmployerController; 32 use App\Http\Controllers\EmployerController;
33 use App\Http\Controllers\CompanyController as FrontCompanyController; 33 use App\Http\Controllers\CompanyController as FrontCompanyController;
34 34
35 35
36 /* 36 /*
37 |-------------------------------------------------------------------------- 37 |--------------------------------------------------------------------------
38 | Web Routes 38 | Web Routes
39 |-------------------------------------------------------------------------- 39 |--------------------------------------------------------------------------
40 | 40 |
41 | Here is where you can register web routes for your application. These 41 | Here is where you can register web routes for your application. These
42 | routes are loaded by the RouteServiceProvider within a group which 42 | routes are loaded by the RouteServiceProvider within a group which
43 | contains the "web" middleware group. Now create something great! 43 | contains the "web" middleware group. Now create something great!
44 | 44 |
45 */ 45 */
46 /* 46 /*
47 Route::get('/', function () { 47 Route::get('/', function () {
48 return view('welcome'); 48 return view('welcome');
49 })->name('index'); 49 })->name('index');
50 */ 50 */
51 51
52 Route::get('/', [MainController::class, 'index'])->name('index'); 52 Route::get('/', [MainController::class, 'index'])->name('index');
53 53
54 //Роуты авторизации, регистрации, восстановления, аутентификации 54 //Роуты авторизации, регистрации, восстановления, аутентификации
55 Auth::routes(['verify' => true]); 55 Auth::routes(['verify' => true]);
56 56
57 // роуты регистрации, авторизации, восстановления пароля, верификации почты 57 // роуты регистрации, авторизации, восстановления пароля, верификации почты
58 /*Route::group([ 58 /*Route::group([
59 'as' => 'auth.', //имя маршрута, например auth.index 59 'as' => 'auth.', //имя маршрута, например auth.index
60 'prefix' => 'auth', // префикс маршрута, например, auth/index 60 'prefix' => 'auth', // префикс маршрута, например, auth/index
61 ], function () { 61 ], function () {
62 //форма регистрации 62 //форма регистрации
63 Route::get('register', [RegisterController::class, 'register'])->name('register'); 63 Route::get('register', [RegisterController::class, 'register'])->name('register');
64 64
65 //создание пользователя 65 //создание пользователя
66 Route::post('register', [RegisterController::class, 'create'])->name('create'); 66 Route::post('register', [RegisterController::class, 'create'])->name('create');
67 67
68 //форма входа авторизации 68 //форма входа авторизации
69 Route::get('login', [LoginController::class, 'login'])->name('login'); 69 Route::get('login', [LoginController::class, 'login'])->name('login');
70 70
71 //аутентификация 71 //аутентификация
72 Route::post('login', [LoginController::class, 'authenticate'])->name('auth'); 72 Route::post('login', [LoginController::class, 'authenticate'])->name('auth');
73 73
74 //выход 74 //выход
75 Route::get('logout', [LoginController::class, 'logout'])->name('logout'); 75 Route::get('logout', [LoginController::class, 'logout'])->name('logout');
76 76
77 //форма ввода адреса почты 77 //форма ввода адреса почты
78 Route::get('forgot-password', [ForgotPasswordController::class, 'form'])->name('forgot-form'); 78 Route::get('forgot-password', [ForgotPasswordController::class, 'form'])->name('forgot-form');
79 79
80 //письмо на почту 80 //письмо на почту
81 Route::post('forgot-password', [ForgotPasswordController::class, 'mail'])->name('forgot-mail'); 81 Route::post('forgot-password', [ForgotPasswordController::class, 'mail'])->name('forgot-mail');
82 82
83 //форма восстановления пароля 83 //форма восстановления пароля
84 Route::get('reset-password/token/{token}/email/{email}', 84 Route::get('reset-password/token/{token}/email/{email}',
85 [ResetPasswordController::class, 'form'] 85 [ResetPasswordController::class, 'form']
86 )->name('reset-form'); 86 )->name('reset-form');
87 87
88 //восстановление пароля 88 //восстановление пароля
89 Route::post('reset-password', 89 Route::post('reset-password',
90 [ResetPasswordController::class, 'reset'] 90 [ResetPasswordController::class, 'reset']
91 )->name('reset-password'); 91 )->name('reset-password');
92 92
93 //сообщение о необходимости проверки адреса почты 93 //сообщение о необходимости проверки адреса почты
94 Route::get('verify-message', [VerifyEmailController::class, 'message'])->name('verify-message'); 94 Route::get('verify-message', [VerifyEmailController::class, 'message'])->name('verify-message');
95 95
96 //подтверждение адреса почты нового пользователя 96 //подтверждение адреса почты нового пользователя
97 Route::get('verify-email/token/{token}/id/{id}', [VerifyEmailController::class, 'verify']) 97 Route::get('verify-email/token/{token}/id/{id}', [VerifyEmailController::class, 'verify'])
98 ->where('token', '[a-f0-9]{32}') 98 ->where('token', '[a-f0-9]{32}')
99 ->where('id', '[0-9]+') 99 ->where('id', '[0-9]+')
100 ->name('verify-email'); 100 ->name('verify-email');
101 });*/ 101 });*/
102 102
103 //Личный кабинет пользователя 103 //Личный кабинет пользователя
104 Route::get('/home', [HomeController::class, 'index'])->name('home'); 104 Route::get('/home', [HomeController::class, 'index'])->name('home');
105 105
106 /* 106 /*
107 Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) { 107 Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) {
108 $user = User::where('email',$request->input('email'))->first(); 108 $user = User::where('email',$request->input('email'))->first();
109 109
110 $user->sendEmailVerificationNotification(); 110 $user->sendEmailVerificationNotification();
111 111
112 return 'your response'; 112 return 'your response';
113 })->middleware('throttle:6,1')->name('verification.resend'); 113 })->middleware('throttle:6,1')->name('verification.resend');
114 */ 114 */
115 115
116 // Авторизация, регистрация в админку 116 // Авторизация, регистрация в админку
117 Route::group([ 117 Route::group([
118 'as' => 'admin.', // имя маршрута, например auth.index 118 'as' => 'admin.', // имя маршрута, например auth.index
119 'prefix' => 'admin', // префикс маршрута, например auth/index 119 'prefix' => 'admin', // префикс маршрута, например auth/index
120 'middleware' => ['guest'], 120 'middleware' => ['guest'],
121 ], function () { 121 ], function () {
122 // Форма регистрации 122 // Форма регистрации
123 Route::get('register', [AdminController::class, 'register'])->name('register'); 123 Route::get('register', [AdminController::class, 'register'])->name('register');
124 // Создание пользователя 124 // Создание пользователя
125 Route::post('register', [AdminController::class, 'create'])->name('create'); 125 Route::post('register', [AdminController::class, 'create'])->name('create');
126 126
127 //Форма входа 127 //Форма входа
128 Route::get('login', [AdminController::class, 'login'])->name('login'); 128 Route::get('login', [AdminController::class, 'login'])->name('login');
129 129
130 // аутентификация 130 // аутентификация
131 Route::post('login', [AdminController::class, 'autenticate'])->name('auth'); 131 Route::post('login', [AdminController::class, 'autenticate'])->name('auth');
132 132
133 }); 133 });
134 134
135 // Личный кабинет админки 135 // Личный кабинет админки
136 Route::group([ 136 Route::group([
137 'as' => 'admin.', // имя маршрута, например auth.index 137 'as' => 'admin.', // имя маршрута, например auth.index
138 'prefix' => 'admin', // префикс маршрута, например auth/index 138 'prefix' => 'admin', // префикс маршрута, например auth/index
139 'middleware' => ['auth'], ['admin'], 139 'middleware' => ['auth'], ['admin'],
140 ], function() { 140 ], function() {
141 141
142 // выход 142 // выход
143 Route::get('logout', [AdminController::class, 'logout'])->name('logout'); 143 Route::get('logout', [AdminController::class, 'logout'])->name('logout');
144 144
145 // кабинет главная страница 145 // кабинет главная страница
146 Route::get('cabinet', [AdminController::class, 'index'])->name('index'); 146 Route::get('cabinet', [AdminController::class, 'index'])->name('index');
147 147
148 // кабинет профиль админа - форма 148 // кабинет профиль админа - форма
149 Route::get('profile', [AdminController::class, 'profile'])->name('profile'); 149 Route::get('profile', [AdminController::class, 'profile'])->name('profile');
150 // кабинет профиль админа - сохранение формы 150 // кабинет профиль админа - сохранение формы
151 Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile'); 151 Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile');
152 152
153 //кабинет сообщения админа 153 //кабинет сообщения админа
154 //Route::get('messages', [AdminController::class, 'profile'])->name('profile'); 154 //Route::get('messages', [AdminController::class, 'profile'])->name('profile');
155 155
156 156
157 // кабинет профиль - форма пароли 157 // кабинет профиль - форма пароли
158 Route::get('password', [AdminController::class, 'profile_password'])->name('password'); 158 Route::get('password', [AdminController::class, 'profile_password'])->name('password');
159 // кабинет профиль - сохранение формы пароля 159 // кабинет профиль - сохранение формы пароля
160 Route::post('password', [AdminController::class, 'profile_password_new'])->name('password'); 160 Route::post('password', [AdminController::class, 'profile_password_new'])->name('password');
161 161
162 162
163 // кабинет профиль пользователя - форма 163 // кабинет профиль пользователя - форма
164 Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile'); 164 Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile');
165 // кабинет профиль пользователя - сохранение формы 165 // кабинет профиль пользователя - сохранение формы
166 Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile'); 166 Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile');
167 167
168 // кабинет профиль работодатель - форма 168 // кабинет профиль работодатель - форма
169 Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile'); 169 Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile');
170 // кабинет профиль работодатель - сохранение формы 170 // кабинет профиль работодатель - сохранение формы
171 Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile'); 171 Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile');
172 // кабинет удаление профиль работодателя и юзера 172 // кабинет удаление профиль работодателя и юзера
173 Route::delete('employers/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer'); 173 Route::delete('employers/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer');
174 174
175 // кабинет профиль работник - форма 175 // кабинет профиль работник - форма
176 Route::get('worker-profile/add/{user}', [WorkersController::class, 'form_add_worker'])->name('worker-profile-add'); 176 Route::get('worker-profile/add/{user}', [WorkersController::class, 'form_add_worker'])->name('worker-profile-add');
177 Route::post('worker-profile/add/{user}', [WorkersController::class, 'form_store_worker'])->name('worker-profile-store'); 177 Route::post('worker-profile/add/{user}', [WorkersController::class, 'form_store_worker'])->name('worker-profile-store');
178 Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit'); 178 Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit');
179 // кабинет профиль работник - сохранение формы 179 // кабинет профиль работник - сохранение формы
180 Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update'); 180 Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update');
181 181
182 // Медиа 182 // Медиа
183 Route::get('media', [MediaController::class, 'index'])->name('media'); 183 Route::get('media', [MediaController::class, 'index'])->name('media');
184 Route::delete('media/{media}', [MediaController::class, 'delete'])->name('delete-media'); 184 Route::delete('media/{media}', [MediaController::class, 'delete'])->name('delete-media');
185 185
186 // кабинет настройки сайта - форма 186 // кабинет настройки сайта - форма
187 Route::get('config', [AdminController::class, 'config_form'])->name('config'); 187 Route::get('config', [AdminController::class, 'config_form'])->name('config');
188 // кабинет настройки сайта сохранение формы 188 // кабинет настройки сайта сохранение формы
189 Route::post('config', [AdminController::class, 'store_config'])->name('store_config'); 189 Route::post('config', [AdminController::class, 'store_config'])->name('store_config');
190 190
191 // кабинет - новости 191 // кабинет - новости
192 Route::get('news-list', [AdminController::class, 'news_admin'])->name('news_admin'); 192 Route::get('news-list', [AdminController::class, 'news_admin'])->name('news_admin');
193 Route::get('news/add', [AdminController::class, 'new_admin_add'])->name('new_admin_add'); 193 Route::get('news/add', [AdminController::class, 'new_admin_add'])->name('new_admin_add');
194 Route::post('news/add', [AdminController::class, 'new_admin_add_save'])->name('new_admin_save_add'); 194 Route::post('news/add', [AdminController::class, 'new_admin_add_save'])->name('new_admin_save_add');
195 Route::get('news/edit/{new}', [AdminController::class, 'new_admin_edit'])->name('new_admin_edit'); 195 Route::get('news/edit/{new}', [AdminController::class, 'new_admin_edit'])->name('new_admin_edit');
196 Route::post('news/edit/{new}', [AdminController::class, 'new_admin_update_save'])->name('new_admin_update'); 196 Route::post('news/edit/{new}', [AdminController::class, 'new_admin_update_save'])->name('new_admin_update');
197 Route::get('news/delete/{new}', [AdminController::class, 'new_admin_delete'])->name('new_admin_delete'); 197 Route::get('news/delete/{new}', [AdminController::class, 'new_admin_delete'])->name('new_admin_delete');
198 198
199 // кабинет - пользователи 199 // кабинет - пользователи
200 Route::get('users', [UsersController::class, 'index'])->name('users'); 200 Route::get('users', [UsersController::class, 'index'])->name('users');
201 201
202 // кабинет - пользователи 202 // кабинет - пользователи
203 Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users'); 203 Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users');
204 204
205 // кабинет - работодатели 205 // кабинет - работодатели
206 Route::get('employers', [EmployersController::class, 'index'])->name('employers'); 206 Route::get('employers', [EmployersController::class, 'index'])->name('employers');
207 207
208 Route::get('employers/comment/{employer}', [EmployersController::class, 'comment_read'])->name('comment-employer'); 208 Route::get('employers/comment/{employer}', [EmployersController::class, 'comment_read'])->name('comment-employer');
209 209
210 Route::get('flot/add/{employer}', [EmployersController::class, 'add_flot'])->name('flot_add'); 210 Route::get('flot/add/{employer}', [EmployersController::class, 'add_flot'])->name('flot_add');
211 Route::post('flot/add', [EmployersController::class, 'save_add_flot'])->name('flot_add_save'); 211 Route::post('flot/add', [EmployersController::class, 'save_add_flot'])->name('flot_add_save');
212 Route::get('flot/{flot}/{employer}', [EmployersController::class, 'edit_flot'])->name('flot'); 212 Route::get('flot/{flot}/{employer}', [EmployersController::class, 'edit_flot'])->name('flot');
213 Route::put('flot/{flot}', [EmployersController::class, 'edit_save_flot'])->name('flot_edit'); 213 Route::put('flot/{flot}', [EmployersController::class, 'edit_save_flot'])->name('flot_edit');
214 Route::get('flot/{flot}/{employer_id}/delete', [EmployersController::class, 'delete_flot'])->name('flot_delete'); 214 Route::get('flot/{flot}/{employer_id}/delete', [EmployersController::class, 'delete_flot'])->name('flot_delete');
215 215
216 // кабинет - соискатели 216 // кабинет - соискатели
217 Route::get('workers', [WorkersController::class, 'index'])->name('workers'); 217 Route::get('workers', [WorkersController::class, 'index'])->name('workers');
218 218
219 // кабинет - база данных 219 // кабинет - база данных
220 Route::get('basedata', [UsersController::class, 'index_bd'])->name('basedata'); 220 Route::get('basedata', [UsersController::class, 'index_bd'])->name('basedata');
221 Route::get('basedata/add', [UsersController::class, 'add_bd'])->name('add-basedata'); 221 Route::get('basedata/add', [UsersController::class, 'add_bd'])->name('add-basedata');
222 Route::post('basedata/add', [UsersController::class, 'add_store_bd'])->name('add-store-basedata'); 222 Route::post('basedata/add', [UsersController::class, 'add_store_bd'])->name('add-store-basedata');
223 Route::get('basedata/edit/{user}', [UsersController::class, 'edit_bd'])->name('edit-basedata'); 223 Route::get('basedata/edit/{user}', [UsersController::class, 'edit_bd'])->name('edit-basedata');
224 Route::put('basedata/edit/{user}', [UsersController::class, 'update_bd'])->name('update-basedata'); 224 Route::put('basedata/edit/{user}', [UsersController::class, 'update_bd'])->name('update-basedata');
225 Route::delete('basedata/delete/{user}', [UsersController::class, 'destroy_bd'])->name('delete-basedata'); 225 Route::delete('basedata/delete/{user}', [UsersController::class, 'destroy_bd'])->name('delete-basedata');
226 Route::get('basedata/doc/{user}', [UsersController::class, 'doc_bd'])->name('doc-basedata'); 226 Route::get('basedata/doc/{user}', [UsersController::class, 'doc_bd'])->name('doc-basedata');
227 227
228 // кабинет - вакансии 228 // кабинет - вакансии
229 Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers'); 229 Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers');
230 Route::get('ad-employers/add', [Ad_EmployersController::class, 'create'])->name('add-ad-employers'); 230 Route::get('ad-employers/add', [Ad_EmployersController::class, 'create'])->name('add-ad-employers');
231 Route::post('ad-employers/add', [Ad_EmployersController::class, 'store'])->name('store-ad-employers'); 231 Route::post('ad-employers/add', [Ad_EmployersController::class, 'store'])->name('store-ad-employers');
232 Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers'); 232 Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers');
233 Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers'); 233 Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers');
234 Route::delete('ad-employers/delete/{ad_employer}', [Ad_EmployersController::class, 'destroy'])->name('delete-ad-employer'); 234 Route::delete('ad-employers/delete/{ad_employer}', [Ad_EmployersController::class, 'destroy'])->name('delete-ad-employer');
235 235
236 // Редактирование должности в вакансии 236 // Редактирование должности в вакансии
237 Route::put('update-jobs/{ad_jobs}', [Ad_EmployersController::class, 'update_ad_jobs'])->name('update_jobs'); 237 Route::put('update-jobs/{ad_jobs}', [Ad_EmployersController::class, 'update_ad_jobs'])->name('update_jobs');
238 Route::get('edit-jobs/{ad_jobs}', [Ad_EmployersController::class, 'edit_jobs'])->name('edit_jobs'); 238 Route::get('edit-jobs/{ad_jobs}', [Ad_EmployersController::class, 'edit_jobs'])->name('edit_jobs');
239 239
240 240
241 // кабинет - категории 241 // кабинет - категории
242 //Route::get('categories', [AdminController::class, 'index'])->name('categories'); 242 //Route::get('categories', [AdminController::class, 'index'])->name('categories');
243 243
244 // СRUD-операции над Справочником Категории 244 // СRUD-операции над Справочником Категории
245 245
246 Route::resource('categories', CategoryController::class, ['except' => ['show']]); 246 Route::resource('categories', CategoryController::class, ['except' => ['show']]);
247 247
248 // CRUD-операции над справочником Категории для работодателей 248 // CRUD-операции над справочником Категории для работодателей
249 Route::resource('category-emp', CategoryEmpController::class, ['except' => ['show']]); 249 Route::resource('category-emp', CategoryEmpController::class, ['except' => ['show']]);
250 250
251 // CRUD-операции над справочником Образование 251 // CRUD-операции над справочником Образование
252 Route::resource('education', EducationController::class, ['except' => ['show']]); 252 Route::resource('education', EducationController::class, ['except' => ['show']]);
253 253
254 Route::get('rename-program-education', [EducationController::class, 'rename_program'])->name('rename-program-education'); 254 Route::get('rename-program-education', [EducationController::class, 'rename_program'])->name('rename-program-education');
255 Route::get('program-education', [EducationController::class, 'add_program'])->name('add-program-education'); 255 Route::get('program-education', [EducationController::class, 'add_program'])->name('add-program-education');
256 Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education'); 256 Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education');
257 257
258 Route::get('program-education/edit/{program}/{education}', [EducationController::class, 'edit_program'])->name('edit-program-education'); 258 Route::get('program-education/edit/{program}/{education}', [EducationController::class, 'edit_program'])->name('edit-program-education');
259 Route::post('program-education/edit/{program}/{education}', [EducationController::class, 'update_program'])->name('update-program-education'); 259 Route::post('program-education/edit/{program}/{education}', [EducationController::class, 'update_program'])->name('update-program-education');
260 260
261 Route::get('program-education/delete/{program}/{education}', [EducationController::class, 'delete_program'])->name('delete-program-education'); 261 Route::get('program-education/delete/{program}/{education}', [EducationController::class, 'delete_program'])->name('delete-program-education');
262 262
263 //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles'); 263 //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles');
264 /* 264 /*
265 * кабинет - CRUD-операции по справочнику должности 265 * кабинет - CRUD-операции по справочнику должности
266 * 266 *
267 */ 267 */
268 Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]); 268 Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]);
269 269
270 // кабинет - сообщения (чтение чужих) 270 // кабинет - сообщения (чтение чужих)
271 Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages'); 271 Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages');
272 // кабинет - просмотр сообщения чужого (чтение) 272 // кабинет - просмотр сообщения чужого (чтение)
273 Route::get('messages/{message}', [MsgAnswersController::class, 'read_message'])->name('read-message'); 273 Route::get('messages/{message}', [MsgAnswersController::class, 'read_message'])->name('read-message');
274 274
275 // кабинет - сообщения (админские) 275 // кабинет - сообщения (админские)
276 Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages'); 276 Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages');
277 // кабинет - сообщения (админские) 277 // кабинет - сообщения (админские)
278 Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post'); 278 Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post');
279 // кабинет - sql - конструкция запросов 279 // кабинет - sql - конструкция запросов
280 Route::get('messages-sql', [MsgAnswersController::class, 'messages_sql'])->name('messages-sql'); 280 Route::get('messages-sql', [MsgAnswersController::class, 'messages_sql'])->name('messages-sql');
281 281
282 /* 282 /*
283 * Расписанный подход в описании каждой директорий групп пользователей. 283 * Расписанный подход в описании каждой директорий групп пользователей.
284 */ 284 */
285 // кабинет - группы пользователей 285 // кабинет - группы пользователей
286 Route::get('groups', [GroupsController::class, 'index'])->name('groups'); 286 Route::get('groups', [GroupsController::class, 'index'])->name('groups');
287 // кабинет - добавление форма группы пользователей 287 // кабинет - добавление форма группы пользователей
288 Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group'); 288 Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group');
289 // кабинет - сохранение формы группы пользователей 289 // кабинет - сохранение формы группы пользователей
290 Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store'); 290 Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store');
291 // кабинет - редактирование форма группы пользователей 291 // кабинет - редактирование форма группы пользователей
292 Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group'); 292 Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group');
293 // кабинет - сохранение редактированной формы группы пользователей 293 // кабинет - сохранение редактированной формы группы пользователей
294 Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group'); 294 Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group');
295 // кабинет - удаление группы пользователей 295 // кабинет - удаление группы пользователей
296 Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group'); 296 Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group');
297 297
298 298
299 // кабинет - список админов 299 // кабинет - список админов
300 Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin'); 300 Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin');
301 301
302 // справочник Позиции 302 // справочник Позиции
303 Route::get('positions', [AdminController::class, 'position'])->name('position'); 303 Route::get('positions', [AdminController::class, 'position'])->name('position');
304 Route::get('positions/add', [AdminController::class, 'position_add'])->name('add-position'); 304 Route::get('positions/add', [AdminController::class, 'position_add'])->name('add-position');
305 Route::post('positions/add', [AdminController::class, 'position_add_save'])->name('add-save-position'); 305 Route::post('positions/add', [AdminController::class, 'position_add_save'])->name('add-save-position');
306 Route::get('positions/edit/{position}', [AdminController::class, 'position_edit'])->name('edit-position'); 306 Route::get('positions/edit/{position}', [AdminController::class, 'position_edit'])->name('edit-position');
307 Route::post('position/edit/{position}', [AdminController::class, 'position_update'])->name('update-position'); 307 Route::post('position/edit/{position}', [AdminController::class, 'position_update'])->name('update-position');
308 Route::get('position/delete/{position}', [AdminController::class, 'position_delete'])->name('delete-position'); 308 Route::get('position/delete/{position}', [AdminController::class, 'position_delete'])->name('delete-position');
309 309
310 /////редактор////// кабинет - редактор сайта//////////////////////// 310 /////редактор////// кабинет - редактор сайта////////////////////////
311 Route::get('editor-site', function() { 311 Route::get('editor-site', function() {
312 return view('admin.editor.index'); 312 return view('admin.editor.index');
313 })->name('editor-site'); 313 })->name('editor-site');
314 314
315 315
316 // кабинет - редактор шапки-футера сайта 316 // кабинет - редактор шапки-футера сайта
317 Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks'); 317 Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks');
318 Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block'); 318 Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block');
319 Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store'); 319 Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store');
320 Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block'); 320 Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block');
321 Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block'); 321 Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block');
322 Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block'); 322 Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block');
323 Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block'); 323 Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block');
324 324
325 325
326 // кабинет - редактор должности на главной 326 // кабинет - редактор должности на главной
327 Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main'); 327 Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main');
328 328
329 // кабинет - редактор работодатели на главной 329 // кабинет - редактор работодатели на главной
330 Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main'); 330 Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main');
331 331
332 332
333 // кабинет - редактор seo-сайта 333 // кабинет - редактор seo-сайта
334 Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo'); 334 Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo');
335 Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo'); 335 Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo');
336 Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store'); 336 Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store');
337 Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo'); 337 Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo');
338 Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo'); 338 Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo');
339 Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo'); 339 Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo');
340 Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo'); 340 Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo');
341 341
342 342
343 // кабинет - редактор страниц 343 // кабинет - редактор страниц
344 Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages'); 344 Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages');
345 // кабинет - добавление страницы 345 // кабинет - добавление страницы
346 Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page'); 346 Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page');
347 // кабинет - сохранение формы страницы 347 // кабинет - сохранение формы страницы
348 Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store'); 348 Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store');
349 // кабинет - редактирование форма страницы 349 // кабинет - редактирование форма страницы
350 Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page'); 350 Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page');
351 // кабинет - сохранение редактированной формы страницы 351 // кабинет - сохранение редактированной формы страницы
352 Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page'); 352 Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page');
353 // кабинет - удаление страницы 353 // кабинет - удаление страницы
354 Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page'); 354 Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page');
355 355
356 356
357 // кабинет - реклама сайта 357 // кабинет - реклама сайта
358 Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames'); 358 Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames');
359 Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames'); 359 Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames');
360 Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store'); 360 Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store');
361 Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames'); 361 Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames');
362 Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames'); 362 Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames');
363 Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames'); 363 Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames');
364 //////////////////////////////////////////////////////////////////////// 364 ////////////////////////////////////////////////////////////////////////
365 365
366 366
367 // кабинет - отзывы о работодателе для модерации 367 // кабинет - отзывы о работодателе для модерации
368 Route::get('answers', [EmployersController::class, 'answers'])->name('answers'); 368 Route::get('answers', [EmployersController::class, 'answers'])->name('answers');
369 369
370 // Общая страница статистики 370 // Общая страница статистики
371 Route::get('statics', function () { 371 Route::get('statics', function () {
372 return view('admin.static.index'); 372 return view('admin.static.index');
373 })->name('statics'); 373 })->name('statics');
374 374
375 // кабинет - статистика работников 375 // кабинет - статистика работников
376 Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers'); 376 Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers');
377 377
378 // кабинет - статистика вакансий работодателя 378 // кабинет - статистика вакансий работодателя
379 Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads'); 379 Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads');
380 380
381 // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника 381 // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника
382 /* 382 /*
383 * CRUD-операции над справочником дипломы и документы 383 * CRUD-операции над справочником дипломы и документы
384 */ 384 */
385 //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks'); 385 //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks');
386 Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]); 386 Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]);
387 387
388 // кабинет - роли пользователя 388 // кабинет - роли пользователя
389 Route::get('roles', [UsersController::class, 'roles'])->name('roles'); 389 Route::get('roles', [UsersController::class, 'roles'])->name('roles');
390 390
391 Route::get('admin_roles', [UsersController::class, 'admin_roles'])->name('admin_roles'); 391 Route::get('admin_roles', [UsersController::class, 'admin_roles'])->name('admin_roles');
392 392
393 Route::get('logs', function() { 393 Route::get('logs', function() {
394 $files = Storage::files('logs/laravel.log'); 394 $files = Storage::files('logs/laravel.log');
395 })->name('logs'); 395 })->name('logs');
396 }); 396 });
397 397
398 // Инструментальные страницы 398 // Инструментальные страницы
399 Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload'); 399 Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload');
400 400
401 Route::get('redis/', [PagesController::class, 'redis'])->name('redis'); 401 Route::get('redis/', [PagesController::class, 'redis'])->name('redis');
402 402
403 Route::get('excel/', [PagesController::class, 'excel'])->name('excel'); 403 Route::get('excel/', [PagesController::class, 'excel'])->name('excel');
404 404
405 // Страницы с произвольным контентом 405 // Страницы с произвольным контентом
406 Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page'); 406 Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page');
407 407
408 // Публичные страницы соискателя 408 // Публичные страницы соискателя
409 Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page'); 409 Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page');
410 410
411 //Страница вакансии 411 //Страница вакансии
412 Route::get('employer/ad/{ad_employer}', [AdEmployerController::class, 'ad_employer'])->name('ad-employer'); 412 Route::get('employer/ad/{ad_employer}', [AdEmployerController::class, 'ad_employer'])->name('ad-employer');
413 413
414 //Вакансии 414 //Вакансии
415 Route::get('vacancies', [MainController::class, 'vacancies'])->name('vacancies'); 415 Route::get('vacancies', [MainController::class, 'vacancies'])->name('vacancies');
416 416
417 //Вакансии поиск на главной 417 //Вакансии поиск на главной
418 Route::get('search-vacancies', [MainController::class, 'search_vacancies'])->name('search_vacancies'); 418 Route::get('search-vacancies', [MainController::class, 'search_vacancies'])->name('search_vacancies');
419 419
420 //Вакансии категория детальная 420 //Вакансии категория детальная
421 Route::get('list-vacancies/{categories?}', [MainController::class, 'list_vacancies'])->name('list-vacancies'); 421 Route::get('list-vacancies/{categories?}', [MainController::class, 'list_vacancies'])->name('list-vacancies');
422 422
423 // Лайк вакансии 423 // Лайк вакансии
424 Route::get('like-vacancy', [MainController::class, 'like_vacancy'])->name('like-vacancy'); 424 Route::get('like-vacancy', [MainController::class, 'like_vacancy'])->name('like-vacancy');
425 425
426 //Детальная страница вакансии - работодателя 426 //Детальная страница вакансии - работодателя
427 Route::get('vacancie/{vacancy}', [FrontEmployersController::class, 'vacancie'])->name('vacancie'); 427 Route::get('vacancie/{vacancy}', [FrontEmployersController::class, 'vacancie'])->name('vacancie');
428 428
429 //Судоходные компании 429 //Судоходные компании
430 Route::get('shipping-companies', [FrontCompanyController::class, 'shipping_companies'])->name('shipping_companies'); 430 Route::get('shipping-companies', [FrontCompanyController::class, 'shipping_companies'])->name('shipping_companies');
431 431
432 //Детальная инфа о компании 432 //Детальная инфа о компании
433 Route::get('info-company/{company}', [FrontCompanyController::class, 'info_company'])->name('info_company'); 433 Route::get('info-company/{company}', [FrontCompanyController::class, 'info_company'])->name('info_company');
434 434
435 //Образование 435 //Образование
436 Route::get('education', [MainController::class, 'education'])->name('education'); 436 Route::get('education', [MainController::class, 'education'])->name('education');
437 437
438 //Новости 438 //Новости
439 Route::get('news', [MainController::class, 'news'])->name('news'); 439 Route::get('news', [MainController::class, 'news'])->name('news');
440 Route::get('detail-new/{new}', [MainController::class, 'detail_new'])->name('detail_new'); 440 Route::get('detail-new/{new}', [MainController::class, 'detail_new'])->name('detail_new');
441 441
442 //Контакты 442 //Контакты
443 Route::get('contacts', [MainController::class, 'contacts'])->name('contacts'); 443 Route::get('contacts', [MainController::class, 'contacts'])->name('contacts');
444 444
445 //База резюме 445 //База резюме
446 Route::get('bd-resume', [WorkerController::class, 'bd_resume'])->name('bd_resume'); 446 Route::get('bd-resume', [WorkerController::class, 'bd_resume'])->name('bd_resume');
447 447
448 Route::get('like-resume', [MainController::class, 'like_worker'])->name('like_resume'); 448 Route::get('like-resume', [MainController::class, 'like_worker'])->name('like_resume');
449 449
450 //Анкета соискателя 450 //Анкета соискателя
451 Route::get('resume-profile/{worker}', [WorkerController::class, 'resume_profile'])->name('resume_profile'); 451 Route::get('resume-profile/{worker}', [WorkerController::class, 'resume_profile'])->name('resume_profile');
452 452
453 //Скачать резюме 453 //Скачать резюме
454 Route::get('resume-download/{worker}', [WorkerController::class, 'resume_download'])->name('resume_download'); 454 Route::get('resume-download/{worker}', [WorkerController::class, 'resume_download'])->name('resume_download');
455 Route::get('resume-download/all', [WorkerController::class, 'resume_download_all'])->name('resume_download_all2'); 455 Route::get('resume-download/all', [WorkerController::class, 'resume_download_all'])->name('resume_download_all2');
456 Route::get('resume-download', [WorkerController::class, 'resume_download_all'])->name('resume_download_all'); 456 Route::get('resume-download', [WorkerController::class, 'resume_download_all'])->name('resume_download_all');
457 457
458 458
459 //Вход в кабинет 459 //Вход в кабинет
460 Route::get('login', [MainController::class, 'input_login'])->name('login'); 460 Route::get('login', [MainController::class, 'input_login'])->name('login');
461 461
462 // Выход из кабинета 462 // Выход из кабинета
463 Route::get('logout', [EmployerController::class, 'logout'])->name('logout'); 463 Route::get('logout', [EmployerController::class, 'logout'])->name('logout');
464 464
465 Route::get( 'register_worker', [WorkerController::class, 'register_worker'])->name('register_worker'); 465 Route::get( 'register_worker', [WorkerController::class, 'register_worker'])->name('register_worker');
466 Route::get('register_employer', [EmployerController::class, 'register_employer'])->name('register_employer'); 466 Route::get('register_employer', [EmployerController::class, 'register_employer'])->name('register_employer');
467 467
468 //восстановление пароля 468 //восстановление пароля
469 Route::get('repair-password', [MainController::class, 'repair_password'])->name('repair_password'); 469 Route::get('repair-password', [MainController::class, 'repair_password'])->name('repair_password');
470 // Звезда сообщения 470 // Звезда сообщения
471 Route::post('stars-answer', [WorkerController::class, 'stars_answer'])->name('stars_answer'); 471 Route::post('stars-answer', [WorkerController::class, 'stars_answer'])->name('stars_answer');
472 472
473 // Борьба 473 // Борьба
474 Route::get('clear_cookie', function() { 474 Route::get('clear_cookie', function() {
475 \App\Classes\Cookies_vacancy::clear_vacancy(); 475 \App\Classes\Cookies_vacancy::clear_vacancy();
476 return redirect()->route('index'); 476 return redirect()->route('index');
477 })->name('clear_cookie'); 477 })->name('clear_cookie');
478 478
479 Route::get('cookies', function() { 479 Route::get('cookies', function() {
480 return view('cookies'); 480 return view('cookies');
481 })->name('cookies'); 481 })->name('cookies');
482 482
483 483
484 484
485 485
486 // Личный кабинет работник 486 // Личный кабинет работник
487 Route::group([ 487 Route::group([
488 'as' => 'worker.', // имя маршрута, например auth.index 488 'as' => 'worker.', // имя маршрута, например auth.index
489 'prefix' => 'worker', // префикс маршрута, например auth/index 489 'prefix' => 'worker', // префикс маршрута, например auth/index
490 'middleware' => ['auth'], ['is_worker'], 490 'middleware' => ['auth'], ['is_worker'],
491 ], function() { 491 ], function() {
492 // 1 страница - Моя анкета 492 // 1 страница - Моя анкета
493 Route::get('cabinet', [WorkerController::class, 'cabinet'])->name('cabinet'); 493 Route::get('cabinet', [WorkerController::class, 'cabinet'])->name('cabinet');
494 Route::post('cabinet/{worker}', [WorkerController::class, 'cabinet_save'])->name('cabinet_save'); 494 Route::post('cabinet/{worker}', [WorkerController::class, 'cabinet_save'])->name('cabinet_save');
495 495
496 // 2 страница - Сообщения 496 // 2 страница - Сообщения
497 Route::get('cabinet/messages/{type_message}', [WorkerController::class, 'messages'])->name('messages'); 497 Route::get('cabinet/messages/{type_message}', [WorkerController::class, 'messages'])->name('messages');
498 Route::get('cabinet/dialog/{user1}/{user2}', [WorkerController::class, 'dialog'])->name('dialog'); 498 Route::get('cabinet/dialog/{user1}/{user2}', [WorkerController::class, 'dialog'])->name('dialog');
499 // 3 страница - Избранные вакансии 499 // 3 страница - Избранные вакансии
500 Route::get('cabinet/favorite', [WorkerController::class, 'favorite'])->name('favorite'); 500 Route::get('cabinet/favorite', [WorkerController::class, 'favorite'])->name('favorite');
501 // Продолжение борьбы против колорадов - избранные вакансии 501 // Продолжение борьбы против колорадов - избранные вакансии
502 Route::get('кабинет/favorite', [WorkerController::class, 'colorado'])->name('colorado'); 502 Route::get('кабинет/favorite', [WorkerController::class, 'colorado'])->name('colorado');
503 503
504 // 4 страница - Сменить пароль 504 // 4 страница - Сменить пароль
505 Route::get('кабинет/new_password', [WorkerController::class, 'new_password'])->name('new_password'); 505 Route::get('кабинет/new_password', [WorkerController::class, 'new_password'])->name('new_password');
506 Route::post('кабинет/new_password/save', [WorkerController::class, 'save_new_password'])->name('save_new_password'); 506 Route::post('кабинет/new_password/save', [WorkerController::class, 'save_new_password'])->name('save_new_password');
507 507
508 // 5 страница - Удалить профиль 508 // 5 страница - Удалить профиль
509 Route::get('кабинет/delete_profile', [WorkerController::class, 'delete_profile'])->name('delete_profile'); 509 Route::get('кабинет/delete_profile', [WorkerController::class, 'delete_profile'])->name('delete_profile');
510 Route::post('кабинет/delete_profile/delete', [WorkerController::class, 'delete_profile_result'])->name('deleteprofile_result'); 510 Route::post('кабинет/delete_profile/delete', [WorkerController::class, 'delete_profile_result'])->name('deleteprofile_result');
511 511
512 // Резюме -pdf 512 // Резюме -pdf
513 Route::get('кабинет/download/{worker}', [WorkerController::class, 'download'])->name('download'); 513 Route::get('кабинет/download/{worker}', [WorkerController::class, 'download'])->name('download');
514 514
515 // Поднятие анкеты 515 // Поднятие анкеты
516 Route::get('кабинет/up/{worker}', [WorkerController::class, 'up'])->name('up'); 516 Route::get('кабинет/up/{worker}', [WorkerController::class, 'up'])->name('up');
517 517
518 // Добавление сертификата 518 // Добавление сертификата
519 Route::get('кабинет/new_sertificate/{worker}', [WorkerController::class, 'new_sertificate'])->name('new_sertificate'); 519 Route::get('кабинет/new_sertificate/{worker}', [WorkerController::class, 'new_sertificate'])->name('new_sertificate');
520 Route::get('кабинет/add_sertificate', [WorkerController::class, 'add_serificate'])->name('add_serificate'); 520 Route::get('кабинет/add_sertificate', [WorkerController::class, 'add_serificate'])->name('add_serificate');
521 Route::get('кабинет/edit_sertificate/{worker}/{doc}', [WorkerController::class, 'edit_sertificate'])->name('edit_sertificate'); 521 Route::get('кабинет/edit_sertificate/{worker}/{doc}', [WorkerController::class, 'edit_sertificate'])->name('edit_sertificate');
522 Route::get('кабинет/edit_sertificate/{doc}', [WorkerController::class, 'update_serificate'])->name('update_serificate'); 522 Route::get('кабинет/edit_sertificate/{doc}', [WorkerController::class, 'update_serificate'])->name('update_serificate');
523 Route::get('кабинет/delete_sertificate/{doc}', [WorkerController::class, 'delete_sertificate'])->name('delete_sertificate'); 523 Route::get('кабинет/delete_sertificate/{doc}', [WorkerController::class, 'delete_sertificate'])->name('delete_sertificate');
524 524
525 // Добавление предыдущих контактов компании 525 // Добавление предыдущих контактов компании
526 Route::get('кабинет/prev_company/{worker}', [WorkerController::class, 'new_prev_company'])->name('new_prev_company'); 526 Route::get('кабинет/prev_company/{worker}', [WorkerController::class, 'new_prev_company'])->name('new_prev_company');
527 Route::get('кабинет/add_prev_company', [WorkerController::class, 'add_prev_company'])->name('add_prev_company'); 527 Route::get('кабинет/add_prev_company', [WorkerController::class, 'add_prev_company'])->name('add_prev_company');
528 Route::get('кабинет/delete_prev_company/{doc}', [WorkerController::class, 'delete_prev_company'])->name('delete_prev_company'); 528 Route::get('кабинет/delete_prev_company/{doc}', [WorkerController::class, 'delete_prev_company'])->name('delete_prev_company');
529 529
530 // Добавление документа-диплома 530 // Добавление документа-диплома
531 Route::get('кабинет/add_diplom/{worker}', [WorkerController::class, 'add_diplom'])->name('add_diplom'); 531 Route::get('кабинет/add_diplom/{worker}', [WorkerController::class, 'add_diplom'])->name('add_diplom');
532 Route::post('кабинет/add_diplom', [WorkerController::class, 'add_diplom_save'])->name('dop_info_save'); 532 Route::post('кабинет/add_diplom', [WorkerController::class, 'add_diplom_save'])->name('dop_info_save');
533 Route::get('кабинет/delete_ad_diplom/{worker}', [WorkerController::class, 'delete_add_diplom'])->name('delete_add_diplom'); 533 Route::get('кабинет/delete_ad_diplom/{worker}', [WorkerController::class, 'delete_add_diplom'])->name('delete_add_diplom');
534 534
535 // Добавление стандартного диплома 535 // Добавление стандартного диплома
536 Route::get('кабинет/add_document/{worker}', [WorkerController::class, 'add_document'])->name('add_document'); 536 Route::get('кабинет/add_document/{worker}', [WorkerController::class, 'add_document'])->name('add_document');
537 Route::post('кабинет/add_document/', [WorkerController::class, 'add_document_save'])->name('add_document_save'); 537 Route::post('кабинет/add_document/', [WorkerController::class, 'add_document_save'])->name('add_document_save');
538 Route::get('кабинет/edit_document/{doc}/{worker}', [WorkerController::class, 'edit_document'])->name('edit_document'); 538 Route::get('кабинет/edit_document/{doc}/{worker}', [WorkerController::class, 'edit_document'])->name('edit_document');
539 Route::post('кабинет/edit_document/{doc}', [WorkerController::class, 'edit_document_save'])->name('edit_document_save'); 539 Route::post('кабинет/edit_document/{doc}', [WorkerController::class, 'edit_document_save'])->name('edit_document_save');
540 Route::get('кабинет/delete_document/{doc}', [WorkerController::class, 'delete_document'])->name('delete_document'); 540 Route::get('кабинет/delete_document/{doc}', [WorkerController::class, 'delete_document'])->name('delete_document');
541 541
542 // Отправка сообщения работодателю от соискателя 542 // Отправка сообщения работодателю от соискателя
543 Route::post('сообщение/', [WorkerController::class, 'new_message'])->name('new_message'); 543 Route::post('сообщение/', [WorkerController::class, 'new_message'])->name('new_message');
544 }); 544 });
545 545
546 // Личный кабинет работодателя 546 // Личный кабинет работодателя
547 Route::group([ 547 Route::group([
548 'as' => 'employer.', // имя маршрута, например auth.index 548 'as' => 'employer.', // имя маршрута, например auth.index
549 'prefix' => 'employer', // префикс маршрута, например auth/index 549 'prefix' => 'employer', // префикс маршрута, например auth/index
550 'middleware' => ['auth'], !['is_worker'], 550 'middleware' => ['auth'], !['is_worker'],
551 ], function() { 551 ], function() {
552 // 1 страница - Профиль 552 // 1 страница - Профиль
553 Route::get('cabinet', [EmployerController::class, 'cabinet'])->name('cabinet'); 553 Route::get('cabinet', [EmployerController::class, 'cabinet'])->name('cabinet');
554 Route::post('cabinet/{Employer}', [EmployerController::class, 'cabinet_save'])->name('cabinet_save'); 554 Route::post('cabinet/{Employer}', [EmployerController::class, 'cabinet_save'])->name('cabinet_save');
555 Route::post('flot_add_ajax', [EmployerController::class, 'save_add_flot'])->name('save_add_flot'); 555 Route::post('flot_add_ajax', [EmployerController::class, 'save_add_flot'])->name('save_add_flot');
556 Route::get('flot_delete_ajax/{Flot}', [EmployerController::class, 'delete_flot'])->name('delete_flot'); 556 Route::get('flot_delete_ajax/{Flot}', [EmployerController::class, 'delete_flot'])->name('delete_flot');
557 Route::get('cabinet/flot', [EmployerController::class, 'slider_flot'])->name('slider_flot'); 557 Route::get('cabinet/flot', [EmployerController::class, 'slider_flot'])->name('slider_flot');
558 558
559 // 2 страница - Добавление вакансий 559 // 2 страница - Добавление вакансий
560 Route::get('cabinet/vacancie', [EmployerController::class, 'cabinet_vacancie'])->name('cabinet_vacancie'); 560 Route::get('cabinet/vacancie', [EmployerController::class, 'cabinet_vacancie'])->name('cabinet_vacancie');
561 Route::post('vacancie', [EmployerController::class, 'cabinet_vacancy_save1'])->name('vac_save'); 561 Route::post('vacancie', [EmployerController::class, 'cabinet_vacancy_save1'])->name('vac_save');
562 Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); 562 Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people');
563 563
564 564
565 565
566 Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); 566 Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people');
567 567
568 568
569 // 3 страница - Мои вакансии 569 // 3 страница - Мои вакансии
570 Route::get('cabinet/vacancy_list', [EmployerController::class, 'vacancy_list'])->name('vacancy_list'); 570 Route::get('cabinet/vacancy_list', [EmployerController::class, 'vacancy_list'])->name('vacancy_list');
571 Route::get('cabinet/vacancy/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); 571 Route::get('cabinet/vacancy/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit');
572 Route::get('cabinet/vacancy-delete/{ad_employer}', [EmployerController::class, 'vacancy_delete'])->name('vacancy_delete'); 572 Route::get('cabinet/vacancy-delete/{ad_employer}', [EmployerController::class, 'vacancy_delete'])->name('vacancy_delete');
573 Route::get('cabinet/vacancy-up/{ad_employer}', [EmployerController::class, 'vacancy_up'])->name('vacancy_up'); 573 Route::get('cabinet/vacancy-up/{ad_employer}', [EmployerController::class, 'vacancy_up'])->name('vacancy_up');
574 Route::get('cabinet/vacancy-eye/{ad_employer}/{status}', [EmployerController::class, 'vacancy_eye'])->name('vacancy_eye'); 574 Route::get('cabinet/vacancy-eye/{ad_employer}/{status}', [EmployerController::class, 'vacancy_eye'])->name('vacancy_eye');
575 Route::get('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); 575 Route::get('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit');
576 Route::post('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_save_me'])->name('vacancy_save_me'); 576 Route::post('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_save_me'])->name('vacancy_save_me');
577 577
578 // 4.1Ю. 578 // 4.1Ю.
579 Route::get('cabinet/ad_jobs/create/{ad_employer}', [Ad_jobsController::class, 'add_job_in_vac'])->name('add_job_in_vac'); 579 Route::get('cabinet/ad_jobs/create/{ad_employer}', [Ad_jobsController::class, 'add_job_in_vac'])->name('add_job_in_vac');
580 Route::post('cabinet/ad_jobs/create', [Ad_jobsController::class, 'add_job_in_vac_save'])->name('add_job_in_vac_save'); 580 Route::post('cabinet/ad_jobs/create', [Ad_jobsController::class, 'add_job_in_vac_save'])->name('add_job_in_vac_save');
581 Route::get('cabinet/ad_jobs/edit/{ad_job}/{ad_employer}', [Ad_jobsController::class, 'edit_job_in_vac'])->name('edit_job_in_vac'); 581 Route::get('cabinet/ad_jobs/edit/{ad_job}/{ad_employer}', [Ad_jobsController::class, 'edit_job_in_vac'])->name('edit_job_in_vac');
582 Route::post('cabinet/ad_jobs/edit/{ad_job}', [Ad_jobsController::class, 'edit_job_in_vac_save'])->name('edit_job_in_vac_save'); 582 Route::post('cabinet/ad_jobs/edit/{ad_job}', [Ad_jobsController::class, 'edit_job_in_vac_save'])->name('edit_job_in_vac_save');
583 Route::get('cabinet/ad_jobs/delete/{ad_job}', [Ad_jobsController::class, 'delete_job_in_vac'])->name('delete_job_in_vac'); 583 Route::get('cabinet/ad_jobs/delete/{ad_job}', [Ad_jobsController::class, 'delete_job_in_vac'])->name('delete_job_in_vac');
584 584
585 // 4 страница - Отклики на вакансии 585 // 4 страница - Отклики на вакансии
586 Route::get('cabinet/answers/{employer}', [EmployerController::class, 'answers'])->name('answers'); 586 Route::get('cabinet/answers/{employer}', [EmployerController::class, 'answers'])->name('answers');
587 Route::get('cabinet/status/{employer}', [EmployerController::class, 'supple_status2'])->name('supple'); 587 Route::get('cabinet/status/{employer}', [EmployerController::class, 'supple_status2'])->name('supple');
588 Route::get('status/{employer}/{ad_response}/{flag}', [EmployerController::class, 'supple_status'])->name('status_msg'); 588 Route::get('status/{employer}/{ad_response}/{flag}', [EmployerController::class, 'supple_status'])->name('status_msg');
589 589
590 // 5 страница - Сообщения 590 // 5 страница - Сообщения
591 Route::get('cabinet/messages/{type_message}', [EmployerController::class, 'messages'])->name('messages'); 591 Route::get('cabinet/messages/{type_message}', [EmployerController::class, 'messages'])->name('messages');
592 Route::get('cabinet/dialog/{user1}/{user2}', [EmployerController::class, 'dialog'])->name('dialog'); 592 Route::get('cabinet/dialog/{user1}/{user2}', [EmployerController::class, 'dialog'])->name('dialog');
593 Route::post('cabinet/send-message', [EmployerController::class, 'send_message'])->name('send_message'); 593 Route::post('cabinet/send-message', [EmployerController::class, 'send_message'])->name('send_message');
594 Route::post('test123', [EmployerController::class, 'test123'])->name('test123'); 594 Route::post('test123', [EmployerController::class, 'test123'])->name('test123');
595 595
596 // 6 страница - Избранный 596 // 6 страница - Избранный
597 Route::get('cabinet/favorites', [EmployerController::class, 'favorites'])->name('favorites'); 597 Route::get('cabinet/favorites', [EmployerController::class, 'favorites'])->name('favorites');
598 598
599 //7 страница - База данных 599 //7 страница - База данных
600 Route::get('cabinet/bd', [EmployerController::class, 'bd'])->name('bd'); 600 Route::get('cabinet/bd', [EmployerController::class, 'bd'])->name('bd');
601 601
602 //8 страница - База резюме 602 //8 страница - База резюме
603 Route::get('cabinet/bd-tupe', [EmployerController::class, 'bd_tupe'])->name('bd-tupe'); 603 Route::get('cabinet/bd-tupe', [EmployerController::class, 'bd_tupe'])->name('bd-tupe');
604 604
605 // 9 рассылка сообщений 605 // 9 рассылка сообщений
606 Route::get('cabinet/send-all-messages', [EmployerController::class, 'send_all_messages'])->name('send_all_messages'); 606 Route::get('cabinet/send-all-messages', [EmployerController::class, 'send_all_messages'])->name('send_all_messages');
607 Route::post('cabinet/send-all-messages/send', [EmployerController::class, 'send_all_post'])->name('send_all_post'); 607 Route::post('cabinet/send-all-messages/send', [EmployerController::class, 'send_all_post'])->name('send_all_post');
608 608
609 // 10 страница FAQ вопросы 609 // 10 страница FAQ вопросы
610 Route::get('cabinet/faq', [EmployerController::class, 'faq'])->name('faq'); 610 Route::get('cabinet/faq', [EmployerController::class, 'faq'])->name('faq');
611 611
612 // 11 страница - Настройка уведомлений 612 // 11 страница - Настройка уведомлений
613 Route::get('cabinet/subscribe', [EmployerController::class, 'subscribe'])->name('subscribe'); 613 Route::get('cabinet/subscribe', [EmployerController::class, 'subscribe'])->name('subscribe');
614 Route::get('cabinet/subscribe/save', [EmployerController::class, 'save_subscribe'])->name('save_subscribe'); 614 Route::get('cabinet/subscribe/save', [EmployerController::class, 'save_subscribe'])->name('save_subscribe');
615 615
616 // 12 страница - Сменить пароль 616 // 12 страница - Сменить пароль
617 Route::get('cabinet/password-reset', [EmployerController::class, 'password_reset'])->name('password_reset'); 617 Route::get('cabinet/password-reset', [EmployerController::class, 'password_reset'])->name('password_reset');
618 Route::get('cabinet/password-reset/new', [EmployerController::class, 'new_password'])->name('new_password'); 618 Route::get('cabinet/password-reset/new', [EmployerController::class, 'new_password'])->name('new_password');
619 619
620 // 13 страница - Удаление профиля 620 // 13 страница - Удаление профиля
621 Route::get('cabinet/delete-people', [EmployerController::class, 'delete_people'])->name('delete_people'); 621 Route::get('cabinet/delete-people', [EmployerController::class, 'delete_people'])->name('delete_people');
622 Route::get('cabinet/action-delete-people', [EmployerController::class, 'action_delete_user'])->name('action_delete_user'); 622 Route::get('cabinet/action-delete-people', [EmployerController::class, 'action_delete_user'])->name('action_delete_user');
623 Route::get('cabinet/action-ajax-delete-people', [EmployerController::class, 'ajax_delete_user'])->name('ajax_delete_user'); 623 Route::get('cabinet/action-ajax-delete-people', [EmployerController::class, 'ajax_delete_user'])->name('ajax_delete_user');
624 624
625 // Отправил сообщение 625 // Отправил сообщение
626 Route::post('сообщение/', [EmployerController::class, 'new_message'])->name('new_message'); 626 Route::post('сообщение/', [EmployerController::class, 'new_message'])->name('new_message');
627 });
627 }); 628
628 629 Route::get('TestWorker', [WorkerController::class, 'TestWorker'])->name('TestWorker');
629 630
630 631