Commit 2be890eeabec2f0588251c3db155dd44d6427a09

Authored by Андрей Ларионов
1 parent b17c06a233

коммит по изменениям структуры

Showing 16 changed files with 581 additions and 57 deletions 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 $Positions = Category::query()->active()->get(); 128 $Positions = Category::query()->active()->get();
129 if ($Positions->count()) { 129 if ($Positions->count()) {
130 $jobs = Job_title::query()->OrderBy('name')->where('position_id', $Positions[0]->id)->get(); 130 $jobs = Job_title::query()->OrderBy('name')->Notbdif()->where('position_id', $Positions[0]->id)->get();
131 } else { 131 } else {
132 $jobs = Job_title::query()->OrderBy('name')->where('position_id', 0)->get(); 132 $jobs = Job_title::query()->OrderBy('name')->Notbdif()->where('position_id', 0)->get();
133 } 133 }
134 134
135 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 135 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
136 WhereHas('users', 136 WhereHas('users',
137 function (Builder $query) use ($id) {$query->Where('id', $id); 137 function (Builder $query) use ($id) {$query->Where('id', $id);
138 })->get(); 138 })->get();
139 139
140 return view('employers.add_vacancy', compact('Employer', 'jobs' , 'categories', 'Positions')); 140 return view('employers.add_vacancy', compact('Employer', 'jobs' , 'categories', 'Positions'));
141 } 141 }
142 142
143 // Сохранение вакансии 143 // Сохранение вакансии
144 public function cabinet_vacancy_save1(VacancyRequestEdit $request) { 144 public function cabinet_vacancy_save1(VacancyRequestEdit $request) {
145 $params = $request->all(); 145 $params_emp = $request->all();
146 146 $params_job["job_title_id"] = $params_emp['job_title_id'];
147 $ad_jobs = Ad_employer::create($params); 147 $params_job["min_salary"] = $params_emp['min_salary'];
148 $params_job["max_salary"] = $params_emp['max_salary'];
149 $params_job["region"] = $params_emp['region'];
150 $params_job["power"] = $params_emp['power'];
151 $params_job["sytki"] = $params_emp['sytki'];
152 $params_job["start"] = $params_emp['start'];
153 $params_job["flot"] = $params_emp['flot'];
154 $params_job["description"] = $params_emp['description'];
155
156 $ad_jobs = Ad_employer::create($params_emp);
157 $params_job['ad_employer_id'] = $ad_jobs->id;
158 Ad_jobs::create($params_job);
148 return redirect()->route('employer.vacancy_list'); 159 return redirect()->route('employer.vacancy_list');
149 } 160 }
150 161
151 // Список вакансий 162 // Список вакансий
152 public function vacancy_list(Request $request) { 163 public function vacancy_list(Request $request) {
153 $id = Auth()->user()->id; 164 $id = Auth()->user()->id;
154 $Employer = Employer::query()->where('user_id', $id)->first(); 165 $Employer = Employer::query()->where('user_id', $id)->first();
155 $vacancy_list = Ad_employer::query()->with('jobs')->with('jobs_code')->where('employer_id', $Employer->id); 166 $vacancy_list = Ad_employer::query()->with('jobs')->
156 167 with('jobs_code')->
168 where('employer_id', $Employer->id);
157 169
158 if ($request->get('sort')) { 170 if ($request->get('sort')) {
159 $sort = $request->get('sort'); 171 $sort = $request->get('sort');
160 switch ($sort) { 172 switch ($sort) {
161 case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; 173 case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break;
162 case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; 174 case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break;
163 case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; 175 case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break;
164 case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; 176 case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break;
165 case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; 177 case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break;
166 default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; 178 default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break;
167 } 179 }
168 } 180 }
169 $vacancy_list = $vacancy_list->paginate(4); 181 $vacancy_list = $vacancy_list->paginate(4);
170 182
171 //ajax 183 //ajax
172 if ($request->ajax()) { 184 if ($request->ajax()) {
173 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); 185 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer'));
174 } else { 186 } else {
175 return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); 187 return view('employers.list_vacancy', compact('vacancy_list', 'Employer'));
176 } 188 }
177 } 189 }
178 190
179 // Карточка вакансии 191 // Карточка вакансии
180 public function vacancy_edit(Ad_employer $ad_employer) { 192 public function vacancy_edit(Ad_employer $ad_employer) {
181 $id = Auth()->user()->id; 193 $id = Auth()->user()->id;
182 194
183 $Positions = Category::query()->active()->get(); 195 $Positions = Category::query()->active()->get();
184 if ($Positions->count()) { 196 if ($Positions->count()) {
185 $jobs = Job_title::query()->OrderBy('name')->where('position_id', $Positions[0]->id)->get(); 197 $jobs = Job_title::query()->OrderBy('name')->where('position_id', $Positions[0]->id)->get();
186 } else { 198 } else {
187 $jobs = Job_title::query()->OrderBy('name')->where('position_id', 0)->get(); 199 $jobs = Job_title::query()->OrderBy('name')->where('position_id', 0)->get();
188 } 200 }
189 $categories = Category::query()->get(); 201 $categories = Category::query()->get();
190 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 202 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
191 where('user_id', $id)->first(); 203 where('user_id', $id)->first();
192 204
193 return view('employers.edit_vacancy', compact('ad_employer', 'Positions', 'categories','Employer', 'jobs')); 205 return view('employers.edit_vacancy', compact('ad_employer', 'Positions', 'categories','Employer', 'jobs'));
194 } 206 }
195 207
196 // Сохранение-редактирование записи 208 // Сохранение-редактирование записи
197 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { 209 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) {
198 $params = $request->all(); 210 $params = $request->all();
199 211
200 //$jobs['flot'] = $params['flot']; 212 //$jobs['flot'] = $params['flot'];
201 //$jobs['job_title_id'] = $params['job_title_id']; 213 //$jobs['job_title_id'] = $params['job_title_id'];
202 //$titles['position_id'] = $params['position_id']; 214 //$titles['position_id'] = $params['position_id'];
203 //unset($params['job_title_id']); 215 //unset($params['job_title_id']);
204 216
205 $ad_employer->update($params); 217 $ad_employer->update($params);
206 218
207 //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> 219 //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])->
208 // where('ad_employer_id', $ad_employer->id)->first(); 220 // where('ad_employer_id', $ad_employer->id)->first();
209 //$data = Ad_jobs::find($job_->id); 221 //$data = Ad_jobs::find($job_->id);
210 //$ad_jobs = $data->update($jobs); 222 //$ad_jobs = $data->update($jobs);
211 223
212 return redirect()->route('employer.vacancy_list'); 224 return redirect()->route('employer.vacancy_list');
213 } 225 }
214 226
215 // Сохранение карточки вакансии 227 // Сохранение карточки вакансии
216 public function vacancy_save(Request $request, Ad_employer $ad_employer) { 228 public function vacancy_save(Request $request, Ad_employer $ad_employer) {
217 $all = $request->all(); 229 $all = $request->all();
218 $ad_employer->update($all); 230 $ad_employer->update($all);
219 return redirect()->route('employer.cabinet_vacancie'); 231 return redirect()->route('employer.cabinet_vacancie');
220 } 232 }
221 233
222 // Удаление карточки вакансии 234 // Удаление карточки вакансии
223 public function vacancy_delete(Ad_employer $ad_employer) { 235 public function vacancy_delete(Ad_employer $ad_employer) {
224 $ad_employer->delete(); 236 $ad_employer->delete();
225 237
226 return redirect()->route('employer.vacancy_list') 238 return redirect()->route('employer.vacancy_list')
227 ->with('success', 'Данные были успешно сохранены'); 239 ->with('success', 'Данные были успешно сохранены');
228 } 240 }
229 241
230 // Обновление даты 242 // Обновление даты
231 public function vacancy_up(Ad_employer $ad_employer) { 243 public function vacancy_up(Ad_employer $ad_employer) {
232 $up = date('m/d/Y h:i:s', time());; 244 $up = date('m/d/Y h:i:s', time());;
233 $vac_emp = Ad_employer::findOrFail($ad_employer->id); 245 $vac_emp = Ad_employer::findOrFail($ad_employer->id);
234 $vac_emp->updated_at = $up; 246 $vac_emp->updated_at = $up;
235 $vac_emp->save(); 247 $vac_emp->save();
236 248
237 return redirect()->route('employer.vacancy_list'); 249 return redirect()->route('employer.vacancy_list');
238 // начало конца 250 // начало конца
239 } 251 }
240 252
241 //Видимость вакансии 253 //Видимость вакансии
242 public function vacancy_eye(Ad_employer $ad_employer, $status) { 254 public function vacancy_eye(Ad_employer $ad_employer, $status) {
243 $vac_emp = Ad_employer::findOrFail($ad_employer->id); 255 $vac_emp = Ad_employer::findOrFail($ad_employer->id);
244 $vac_emp->active_is = $status; 256 $vac_emp->active_is = $status;
245 $vac_emp->save(); 257 $vac_emp->save();
246 258
247 return redirect()->route('employer.vacancy_list'); 259 return redirect()->route('employer.vacancy_list');
248 } 260 }
249 261
250 //Вакансия редактирования (шаблон) 262 //Вакансия редактирования (шаблон)
251 public function vacancy_update(Ad_employer $id) { 263 public function vacancy_update(Ad_employer $id) {
252 264
253 } 265 }
254 266
255 //Отклики на вакансию - лист 267 //Отклики на вакансию - лист
256 public function answers(Employer $employer, Request $request) { 268 public function answers(Employer $employer, Request $request) {
257 $user_id = Auth()->user()->id; 269 $user_id = Auth()->user()->id;
258 $answer = Ad_employer::query()->where('employer_id', $employer->id); 270 $answer = Ad_employer::query()->where('employer_id', $employer->id);
259 if ($request->has('search')) { 271 if ($request->has('search')) {
260 $search = trim($request->get('search')); 272 $search = trim($request->get('search'));
261 if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); 273 if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%");
262 } 274 }
263 275
264 $answer = $answer->with('response')->get(); 276 $answer = $answer->with('response')->get();
265 277
266 return view('employers.list_answer', compact('answer', 'user_id', 'employer')); 278 return view('employers.list_answer', compact('answer', 'user_id', 'employer'));
267 } 279 }
268 280
269 //Обновление статуса 281 //Обновление статуса
270 public function supple_status(employer $employer, ad_response $ad_response, $flag) { 282 public function supple_status(employer $employer, ad_response $ad_response, $flag) {
271 $ad_response->update(Array('flag' => $flag)); 283 $ad_response->update(Array('flag' => $flag));
272 return redirect()->route('employer.answers', ['employer' => $employer->id]); 284 return redirect()->route('employer.answers', ['employer' => $employer->id]);
273 } 285 }
274 286
275 //Страницы сообщений список 287 //Страницы сообщений список
276 public function messages($type_message) { 288 public function messages($type_message) {
277 $user_id = Auth()->user()->id; 289 $user_id = Auth()->user()->id;
278 290
279 $messages_input = Message::query()->with('vacancies')->with('user_from')-> 291 $messages_input = Message::query()->with('vacancies')->with('user_from')->
280 Where('to_user_id', $user_id)->OrderByDesc('created_at'); 292 Where('to_user_id', $user_id)->OrderByDesc('created_at');
281 293
282 $messages_output = Message::query()->with('vacancies')-> 294 $messages_output = Message::query()->with('vacancies')->
283 with('user_to')->where('user_id', $user_id)-> 295 with('user_to')->where('user_id', $user_id)->
284 OrderByDesc('created_at'); 296 OrderByDesc('created_at');
285 297
286 298
287 $count_input = $messages_input->count(); 299 $count_input = $messages_input->count();
288 $count_output = $messages_output->count(); 300 $count_output = $messages_output->count();
289 301
290 if ($type_message == 'input') { 302 if ($type_message == 'input') {
291 $messages = $messages_input->paginate(15); 303 $messages = $messages_input->paginate(15);
292 } 304 }
293 305
294 if ($type_message == 'output') { 306 if ($type_message == 'output') {
295 $messages = $messages_output->paginate(15); 307 $messages = $messages_output->paginate(15);
296 } 308 }
297 309
298 return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); 310 return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id'));
299 } 311 }
300 312
301 // Диалог между пользователями 313 // Диалог между пользователями
302 public function dialog(User_Model $user1, User_Model $user2) { 314 public function dialog(User_Model $user1, User_Model $user2) {
303 if (isset($user2->id)) { 315 if (isset($user2->id)) {
304 $companion = User_Model::query()->with('workers')-> 316 $companion = User_Model::query()->with('workers')->
305 with('employers')-> 317 with('employers')->
306 where('id', $user2->id)->first(); 318 where('id', $user2->id)->first();
307 } 319 }
308 320
309 $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) { 321 $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) {
310 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); 322 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id);
311 })->orWhere(function($query) use ($user1, $user2) { 323 })->orWhere(function($query) use ($user1, $user2) {
312 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); 324 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id);
313 })->OrderBy('created_at')->get(); 325 })->OrderBy('created_at')->get();
314 326
315 $id_vac = null; 327 $id_vac = null;
316 foreach ($Messages as $it) { 328 foreach ($Messages as $it) {
317 if (isset($it->response)) { 329 if (isset($it->response)) {
318 foreach ($it->response as $r) { 330 foreach ($it->response as $r) {
319 if (isset($r->ad_employer_id)) { 331 if (isset($r->ad_employer_id)) {
320 $id_vac = $r->ad_employer_id; 332 $id_vac = $r->ad_employer_id;
321 break; 333 break;
322 } 334 }
323 } 335 }
324 } 336 }
325 if (!is_null($id_vac)) break; 337 if (!is_null($id_vac)) break;
326 } 338 }
327 339
328 $ad_employer = null; 340 $ad_employer = null;
329 if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); 341 if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first();
330 $sender = $user1; 342 $sender = $user1;
331 343
332 return view('employers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); 344 return view('employers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer'));
333 } 345 }
334 346
335 // Регистрация работодателя 347 // Регистрация работодателя
336 public function register_employer(Request $request) { 348 public function register_employer(Request $request) {
337 $params = $request->all(); 349 $params = $request->all();
338 350
339 $rules = [ 351 $rules = [
340 //'surname' => ['required', 'string', 'max:255'], 352 //'surname' => ['required', 'string', 'max:255'],
341 //'name_man' => ['required', 'string', 'max:255'], 353 //'name_man' => ['required', 'string', 'max:255'],
342 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 354 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
343 'name_company' => ['required', 'string', 'max:255'], 355 'name_company' => ['required', 'string', 'max:255'],
344 'password' => ['required', 'string', 'min:8'], 356 'password' => ['required', 'string', 'min:8'],
345 ]; 357 ];
346 358
347 359
348 $messages = [ 360 $messages = [
349 'required' => 'Укажите обязательное поле', 361 'required' => 'Укажите обязательное поле',
350 'min' => [ 362 'min' => [
351 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 363 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
352 'integer' => 'Поле «:attribute» должно быть :min или больше', 364 'integer' => 'Поле «:attribute» должно быть :min или больше',
353 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 365 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
354 ], 366 ],
355 'max' => [ 367 'max' => [
356 'string' => 'Поле «:attribute» должно быть не больше :max символов', 368 'string' => 'Поле «:attribute» должно быть не больше :max символов',
357 'integer' => 'Поле «:attribute» должно быть :max или меньше', 369 'integer' => 'Поле «:attribute» должно быть :max или меньше',
358 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 370 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
359 ] 371 ]
360 ]; 372 ];
361 373
374 $email = $request->get('email');
375 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) {
376 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл"));
377 }
378
362 if ($request->get('password') !== $request->get('confirmed')){ 379 if ($request->get('password') !== $request->get('confirmed')){
363 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); 380 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля"));
364 } 381 }
365 382
366 if (strlen($request->get('password')) < 8) { 383 if (strlen($request->get('password')) < 8) {
367 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); 384 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!"));
368 } 385 }
369 386
370 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); 387 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?');
371 $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 388 $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z',
372 'X', 'C', 'V', 'B', 'N', 'M'); 389 'X', 'C', 'V', 'B', 'N', 'M');
373 $spec_bool = false; 390 $spec_bool = false;
374 $alpha_bool = false; 391 $alpha_bool = false;
375 392
376 $haystack = $request->get('password'); 393 $haystack = $request->get('password');
377 394
378 foreach ($specsumbol as $it) { 395 foreach ($specsumbol as $it) {
379 if (strpos($haystack, $it) !== false) { 396 if (strpos($haystack, $it) !== false) {
380 $spec_bool = true; 397 $spec_bool = true;
381 } 398 }
382 } 399 }
383 400
384 foreach ($alpha as $it) { 401 foreach ($alpha as $it) {
385 if (strpos($haystack, $it) !== false) { 402 if (strpos($haystack, $it) !== false) {
386 $alpha_bool = true; 403 $alpha_bool = true;
387 } 404 }
388 } 405 }
389 406
390 if ((!$spec_bool) || (!$alpha_bool)) { 407 if ((!$spec_bool) || (!$alpha_bool)) {
391 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); 408 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?"));
392 } 409 }
393 410
394 if (empty($request->get('surname'))) { 411 if (empty($request->get('surname'))) {
395 $params['surname'] = 'Неизвестно'; 412 $params['surname'] = 'Неизвестно';
396 } 413 }
397 if (empty($request->get('name_man'))) { 414 if (empty($request->get('name_man'))) {
398 $params['name_man'] = 'Неизвестно'; 415 $params['name_man'] = 'Неизвестно';
399 } 416 }
400 $validator = Validator::make($params, $rules, $messages); 417 $validator = Validator::make($params, $rules, $messages);
401 418
402 if ($validator->fails()) { 419 if ($validator->fails()) {
403 return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); 420 return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе."));
404 } else { 421 } else {
405 $user = $this->create($params); 422 $user = $this->create($params);
406 event(new Registered($user)); 423 event(new Registered($user));
407 Auth::guard()->login($user); 424 Auth::guard()->login($user);
408 } 425 }
409 426
410 if ($user) { 427 if ($user) {
411 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; 428 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));;
412 } else { 429 } else {
413 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); 430 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!"));
414 } 431 }
415 } 432 }
416 433
417 // Создание пользователя 434 // Создание пользователя
418 protected function create(array $data) 435 protected function create(array $data)
419 { 436 {
420 $Use = new User_Model(); 437 $Use = new User_Model();
421 $Code_user = $Use->create([ 438 $Code_user = $Use->create([
422 'name' => $data['surname']." ".$data['name_man'], 439 'name' => $data['surname']." ".$data['name_man'],
423 'name_man' => $data['name_man'], 440 'name_man' => $data['name_man'],
424 'surname' => $data['surname'], 441 'surname' => $data['surname'],
425 'surname2' => $data['surname2'], 442 'surname2' => $data['surname2'],
426 'subscribe_email' => $data['email'], 443 'subscribe_email' => $data['email'],
427 'email' => $data['email'], 444 'email' => $data['email'],
428 'telephone' => $data['telephone'], 445 'telephone' => $data['telephone'],
429 'is_worker' => 0, 446 'is_worker' => 0,
430 'password' => Hash::make($data['password']), 447 'password' => Hash::make($data['password']),
431 'pubpassword' => base64_encode($data['password']), 448 'pubpassword' => base64_encode($data['password']),
432 'email_verified_at' => Carbon::now() 449 'email_verified_at' => Carbon::now()
433 ]); 450 ]);
434 451
435 if ($Code_user->id > 0) { 452 if ($Code_user->id > 0) {
436 $Employer = new Employer(); 453 $Employer = new Employer();
437 $Employer->user_id = $Code_user->id; 454 $Employer->user_id = $Code_user->id;
438 $Employer->name_company = $data['name_company']; 455 $Employer->name_company = $data['name_company'];
439 $Employer->email = $data['email']; 456 $Employer->email = $data['email'];
440 $Employer->telephone = $data['telephone']; 457 $Employer->telephone = $data['telephone'];
441 $Employer->code = Tools::generator_id(10); 458 $Employer->code = Tools::generator_id(10);
442 $Employer->save(); 459 $Employer->save();
443 460
444 return $Code_user; 461 return $Code_user;
445 } 462 }
446 } 463 }
447 464
448 // Отправка сообщения от работодателя 465 // Отправка сообщения от работодателя
449 public function send_message(MessagesRequiest $request) { 466 public function send_message(MessagesRequiest $request) {
450 $params = $request->all(); 467 $params = $request->all();
451 dd($params); 468 dd($params);
452 $user1 = $params['user_id']; 469 $user1 = $params['user_id'];
453 $user2 = $params['to_user_id']; 470 $user2 = $params['to_user_id'];
454 471
455 if ($request->has('file')) { 472 if ($request->has('file')) {
456 $params['file'] = $request->file('file')->store("messages", 'public'); 473 $params['file'] = $request->file('file')->store("messages", 'public');
457 } 474 }
458 Message::create($params); 475 Message::create($params);
459 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); 476 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
460 } 477 }
461 478
462 public function test123(Request $request) { 479 public function test123(Request $request) {
463 $params = $request->all(); 480 $params = $request->all();
464 $user1 = $params['user_id']; 481 $user1 = $params['user_id'];
465 $user2 = $params['to_user_id']; 482 $user2 = $params['to_user_id'];
466 483
467 $rules = [ 484 $rules = [
468 'text' => 'required|min:1|max:150000', 485 'text' => 'required|min:1|max:150000',
469 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' 486 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000'
470 ]; 487 ];
471 $messages = [ 488 $messages = [
472 'required' => 'Укажите обязательное поле', 489 'required' => 'Укажите обязательное поле',
473 'min' => [ 490 'min' => [
474 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 491 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
475 'integer' => 'Поле «:attribute» должно быть :min или больше', 492 'integer' => 'Поле «:attribute» должно быть :min или больше',
476 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 493 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
477 ], 494 ],
478 'max' => [ 495 'max' => [
479 'string' => 'Поле «:attribute» должно быть не больше :max символов', 496 'string' => 'Поле «:attribute» должно быть не больше :max символов',
480 'integer' => 'Поле «:attribute» должно быть :max или меньше', 497 'integer' => 'Поле «:attribute» должно быть :max или меньше',
481 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 498 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
482 ] 499 ]
483 ]; 500 ];
484 501
485 $validator = Validator::make($request->all(), $rules, $messages); 502 $validator = Validator::make($request->all(), $rules, $messages);
486 503
487 if ($validator->fails()) { 504 if ($validator->fails()) {
488 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) 505 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2])
489 ->withErrors($validator); 506 ->withErrors($validator);
490 } else { 507 } else {
491 if ($request->has('file')) { 508 if ($request->has('file')) {
492 $params['file'] = $request->file('file')->store("messages", 'public'); 509 $params['file'] = $request->file('file')->store("messages", 'public');
493 } 510 }
494 Message::create($params); 511 Message::create($params);
495 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); 512 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
496 513
497 } 514 }
498 } 515 }
499 516
500 //Избранные люди 517 //Избранные люди
501 public function favorites(Request $request) { 518 public function favorites(Request $request) {
502 $IP_address = RusDate::ip_addr_client(); 519 $IP_address = RusDate::ip_addr_client();
503 $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); 520 $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get();
504 521
505 if ($Arr->count()) { 522 if ($Arr->count()) {
506 $A = Array(); 523 $A = Array();
507 foreach ($Arr as $it) { 524 foreach ($Arr as $it) {
508 $A[] = $it->code_record; 525 $A[] = $it->code_record;
509 } 526 }
510 527
511 $Workers = Worker::query()->whereIn('id', $A); 528 $Workers = Worker::query()->whereIn('id', $A);
512 } else { 529 } else {
513 $Workers = Worker::query()->where('id', '=', '0'); 530 $Workers = Worker::query()->where('id', '=', '0');
514 } 531 }
515 532
516 if (($request->has('search')) && (!empty($request->get('search')))) { 533 if (($request->has('search')) && (!empty($request->get('search')))) {
517 $search = $request->get('search'); 534 $search = $request->get('search');
518 535
519 $Workers = $Workers->WhereHas('users', 536 $Workers = $Workers->WhereHas('users',
520 function (Builder $query) use ($search) { 537 function (Builder $query) use ($search) {
521 $query->Where('surname', 'LIKE', "%$search%") 538 $query->Where('surname', 'LIKE', "%$search%")
522 ->orWhere('name_man', 'LIKE', "%$search%") 539 ->orWhere('name_man', 'LIKE', "%$search%")
523 ->orWhere('surname2', 'LIKE', "%$search%"); 540 ->orWhere('surname2', 'LIKE', "%$search%");
524 }); 541 });
525 } else { 542 } else {
526 $Workers = $Workers->with('users'); 543 $Workers = $Workers->with('users');
527 } 544 }
528 545
529 $Workers = $Workers->get(); 546 $Workers = $Workers->get();
530 return view('employers.favorite', compact('Workers')); 547 return view('employers.favorite', compact('Workers'));
531 } 548 }
532 549
533 // База данных 550 // База данных
534 public function bd(Request $request) { 551 public function bd(Request $request) {
535 // для типа BelongsTo 552 // для типа BelongsTo
536 //$documents = Document::query()->orderBy(Location::select('name') 553 //$documents = Document::query()->orderBy(Location::select('name')
537 // ->whereColumn('locations.id', 'documents.location_id') 554 // ->whereColumn('locations.id', 'documents.location_id')
538 //); 555 //);
539 556
540 // для типа HasOne/Many 557 // для типа HasOne/Many
541 // $documents = Document::::query()->orderBy(Location::select('name') 558 // $documents = Document::::query()->orderBy(Location::select('name')
542 // ->whereColumn('locations.document_id', 'documents.id') 559 // ->whereColumn('locations.document_id', 'documents.id')
543 //); 560 //);
544 561
545 562
546 $users = User_Model::query()->with('workers'); 563 $users = User_Model::query()->with('workers');
547 564
548 if ($request->has('search')) { 565 if ($request->has('search')) {
549 $find_key = $request->get('search'); 566 $find_key = $request->get('search');
550 $users = $users->where('name', 'LIKE', "%$find_key%") 567 $users = $users->where('name', 'LIKE', "%$find_key%")
551 ->orWhere('surname', 'LIKE', "%$find_key%") 568 ->orWhere('surname', 'LIKE', "%$find_key%")
552 ->orWhere('name_man', 'LIKE', "%$find_key%") 569 ->orWhere('name_man', 'LIKE', "%$find_key%")
553 ->orWhere('email', 'LIKE', "%$find_key%") 570 ->orWhere('email', 'LIKE', "%$find_key%")
554 ->orWhere('telephone', 'LIKE', "%$find_key%"); 571 ->orWhere('telephone', 'LIKE', "%$find_key%");
555 } 572 }
556 573
557 // Данные 574 // Данные
558 $users = $users->Baseuser()-> 575 $users = $users->Baseuser()->
559 orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id'))-> 576 orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id'))->
560 paginate(5); 577 paginate(5);
561 578
562 579
563 return view('employers.bd', compact('users')); 580 return view('employers.bd', compact('users'));
564 } 581 }
565 582
566 //Настройка уведомлений 583 //Настройка уведомлений
567 public function subscribe() { 584 public function subscribe() {
568 return view('employers.subcribe'); 585 return view('employers.subcribe');
569 } 586 }
570 587
571 //Установка уведомлений сохранение 588 //Установка уведомлений сохранение
572 public function save_subscribe(Request $request) { 589 public function save_subscribe(Request $request) {
573 dd($request->all()); 590 dd($request->all());
574 $msg = $request->validate([ 591 $msg = $request->validate([
575 'subscribe_email' => 'required|email|min:5|max:255', 592 'subscribe_email' => 'required|email|min:5|max:255',
576 ]); 593 ]);
577 return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); 594 return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку');
578 } 595 }
579 596
580 //Сбросить форму с паролем 597 //Сбросить форму с паролем
581 public function password_reset() { 598 public function password_reset() {
582 $email = Auth()->user()->email; 599 $email = Auth()->user()->email;
583 return view('employers.password-reset', compact('email')); 600 return view('employers.password-reset', compact('email'));
584 } 601 }
585 602
586 //Обновление пароля 603 //Обновление пароля
587 public function new_password(Request $request) { 604 public function new_password(Request $request) {
588 $use = Auth()->user(); 605 $use = Auth()->user();
589 $request->validate([ 606 $request->validate([
590 'password' => 'required|string', 607 'password' => 'required|string',
591 'new_password' => 'required|string', 608 'new_password' => 'required|string',
592 'new_password2' => 'required|string' 609 'new_password2' => 'required|string'
593 ]); 610 ]);
594 611
595 if ($request->get('new_password') == $request->get('new_password2')) 612 if ($request->get('new_password') == $request->get('new_password2'))
596 if ($request->get('password') !== $request->get('new_password')) { 613 if ($request->get('password') !== $request->get('new_password')) {
597 $credentials = $request->only('email', 'password'); 614 $credentials = $request->only('email', 'password');
598 if (Auth::attempt($credentials)) { 615 if (Auth::attempt($credentials)) {
599 616
600 if (!is_null($use->email_verified_at)){ 617 if (!is_null($use->email_verified_at)){
601 618
602 $user_data = User_Model::find($use->id); 619 $user_data = User_Model::find($use->id);
603 $user_data->update([ 620 $user_data->update([
604 'password' => Hash::make($request->get('new_password')), 621 'password' => Hash::make($request->get('new_password')),
605 'pubpassword' => base64_encode($request->get('new_password')), 622 'pubpassword' => base64_encode($request->get('new_password')),
606 ]); 623 ]);
607 return redirect() 624 return redirect()
608 ->route('employer.password_reset') 625 ->route('employer.password_reset')
609 ->with('success', 'Поздравляю! Вы обновили свой пароль!'); 626 ->with('success', 'Поздравляю! Вы обновили свой пароль!');
610 } 627 }
611 628
612 return redirect() 629 return redirect()
613 ->route('employer.password_reset') 630 ->route('employer.password_reset')
614 ->withError('Данная учетная запись не было верифицированна!'); 631 ->withError('Данная учетная запись не было верифицированна!');
615 } 632 }
616 } 633 }
617 634
618 return redirect() 635 return redirect()
619 ->route('employer.password_reset') 636 ->route('employer.password_reset')
620 ->withErrors('Не совпадение данных, обновите пароли!'); 637 ->withErrors('Не совпадение данных, обновите пароли!');
621 } 638 }
622 639
623 640
624 641
625 // Форма Удаление пипла 642 // Форма Удаление пипла
626 public function delete_people() { 643 public function delete_people() {
627 $login = Auth()->user()->email; 644 $login = Auth()->user()->email;
628 return view('employers.delete_people', compact('login')); 645 return view('employers.delete_people', compact('login'));
629 } 646 }
630 647
631 // Удаление аккаунта 648 // Удаление аккаунта
632 public function action_delete_user(Request $request) { 649 public function action_delete_user(Request $request) {
633 $Answer = $request->all(); 650 $Answer = $request->all();
634 $user_id = Auth()->user()->id; 651 $user_id = Auth()->user()->id;
635 $request->validate([ 652 $request->validate([
636 'password' => 'required|string', 653 'password' => 'required|string',
637 ]); 654 ]);
638 655
639 $credentials = $request->only('email', 'password'); 656 $credentials = $request->only('email', 'password');
640 if (Auth::attempt($credentials)) { 657 if (Auth::attempt($credentials)) {
641 Auth::logout(); 658 Auth::logout();
642 $it = User_Model::find($user_id); 659 $it = User_Model::find($user_id);
643 $it->delete(); 660 $it->delete();
644 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); 661 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт');
645 } else { 662 } else {
646 return redirect()->route('employer.delete_people') 663 return redirect()->route('employer.delete_people')
647 ->withErrors( 'Неверный пароль! Нужен корректный пароль'); 664 ->withErrors( 'Неверный пароль! Нужен корректный пароль');
648 } 665 }
649 } 666 }
650 667
651 public function ajax_delete_user(Request $request) { 668 public function ajax_delete_user(Request $request) {
652 $Answer = $request->all(); 669 $Answer = $request->all();
653 $user_id = Auth()->user()->id; 670 $user_id = Auth()->user()->id;
654 $request->validate([ 671 $request->validate([
655 'password' => 'required|string', 672 'password' => 'required|string',
656 ]); 673 ]);
657 $credentials = $request->only('email', 'password'); 674 $credentials = $request->only('email', 'password');
658 if (Auth::attempt($credentials)) { 675 if (Auth::attempt($credentials)) {
659 676
660 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', 677 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт',
661 'email' => $request->get('email'), 678 'email' => $request->get('email'),
662 'password' => $request->get('password'))); 679 'password' => $request->get('password')));
663 } else { 680 } else {
664 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); 681 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль'));
665 } 682 }
666 } 683 }
667 684
668 // FAQ - Вопросы/ответы для работодателей и соискателей 685 // FAQ - Вопросы/ответы для работодателей и соискателей
669 public function faq() { 686 public function faq() {
670 return view('employers.faq'); 687 return view('employers.faq');
671 } 688 }
672 689
673 // Рассылка сообщений 690 // Рассылка сообщений
674 public function send_all_messages() { 691 public function send_all_messages() {
675 return view('employers.send_all'); 692 return view('employers.send_all');
676 } 693 }
677 694
678 // Отправка сообщений для информации 695 // Отправка сообщений для информации
679 public function send_all_post(Request $request) { 696 public function send_all_post(Request $request) {
680 $data = $request->all(); 697 $data = $request->all();
681 698
682 $emails = User_Model::query()->where('is_worker', '1')->get(); 699 $emails = User_Model::query()->where('is_worker', '1')->get();
683 700
684 foreach ($emails as $e) { 701 foreach ($emails as $e) {
685 Mail::to($e->email)->send(new SendAllMessages($data)); 702 Mail::to($e->email)->send(new SendAllMessages($data));
686 } 703 }
687 704
688 return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); 705 return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены');
689 } 706 }
690 707
691 // База резюме 708 // База резюме
692 public function bd_tupe(Request $request) { 709 public function bd_tupe(Request $request) {
693 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); 710 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get();
694 711
695 return view('employers.bd_tupe', compact('Resume')); 712 return view('employers.bd_tupe', compact('Resume'));
696 } 713 }
697 714
698 ////////////////////////////////////////////////////////////////// 715 //////////////////////////////////////////////////////////////////
699 // Отправил сообщение 716 // Отправил сообщение
700 ////////////////////////////////////////////////////////////////// 717 //////////////////////////////////////////////////////////////////
701 public function new_message(Request $request) { 718 public function new_message(Request $request) {
702 $params = $request->all(); 719 $params = $request->all();
703 $id = $params['_user_id']; 720 $id = $params['_user_id'];
704 $message = new Message(); 721 $message = new Message();
705 $message->user_id = $params['_user_id']; 722 $message->user_id = $params['_user_id'];
706 $message->to_user_id = $params['_to_user_id']; 723 $message->to_user_id = $params['_to_user_id'];
707 $message->title = $params['title']; 724 $message->title = $params['title'];
708 $message->text = $params['text']; 725 $message->text = $params['text'];
709 if ($request->has('_file')) { 726 if ($request->has('_file')) {
710 $message->file = $request->file('_file')->store("worker/$id", 'public'); 727 $message->file = $request->file('_file')->store("worker/$id", 'public');
711 } 728 }
712 $message->flag_new = 1; 729 $message->flag_new = 1;
713 $id_message = $message->save(); 730 $id_message = $message->save();
714 731
715 $data['message_id'] = $id_message; 732 $data['message_id'] = $id_message;
716 $data['ad_employer_id'] = $params['_vacancy']; 733 $data['ad_employer_id'] = $params['_vacancy'];
717 $data['job_title_id'] = 0; 734 $data['job_title_id'] = 0;
718 735
719 $data['flag'] = 1; 736 $data['flag'] = 1;
720 $ad_responce = ad_response::create($data); 737 $ad_responce = ad_response::create($data);
721 return redirect()->route('employer.messages', ['type_message' => 'output']); 738 return redirect()->route('employer.messages', ['type_message' => 'output']);
722 } 739 }
723 740
724 // Восстановление пароля 741 // Восстановление пароля
725 public function repair_password(Request $request) { 742 public function repair_password(Request $request) {
726 $params = $request->get('email'); 743 $params = $request->get('email');
727 } 744 }
728 745
729 // Избранные люди на корабль 746 // Избранные люди на корабль
730 public function selected_people(Request $request) { 747 public function selected_people(Request $request) {
731 $id = $request->get('id'); 748 $id = $request->get('id');
732 $favorite_people = Job_title::query()->Notbdif()->where('position_id', $id)->get(); 749 $favorite_people = Job_title::query()->Notbdif()->where('position_id', $id)->get();
733 return view('favorite_people', compact('favorite_people')); 750 return view('favorite_people', compact('favorite_people'));
734 } 751 }
735 } 752 }
736 753
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 /*$BigFlot = Array(); 164 /*$BigFlot = Array();
155 foreach ($Position as $position) { 165 foreach ($Position as $position) {
156 $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> 166 $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')->
157 orderBy('job_titles.sort')-> 167 orderBy('job_titles.sort')->
158 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> 168 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')->
159 where('position_ship', "$position->name"); 169 where('position_ship', "$position->name");
160 if (($request->has('job')) && ($request->get('job') > 0)) { 170 if (($request->has('job')) && ($request->get('job') > 0)) {
161 $War_flot = $War_flot->where('job_title_id', $request->get('job')); 171 $War_flot = $War_flot->where('job_title_id', $request->get('job'));
162 } 172 }
163 $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); 173 $War_flot = $War_flot->groupby('job_title_id','position_ship')->get();
164 $BigFlot[] = $War_flot; 174 $BigFlot[] = $War_flot;
165 }*/ 175 }*/
166 176 /*
167 $BigFlot = Array(); 177 $BigFlot = Array();
168 foreach ($Position as $position) { 178 foreach ($Position as $position) {
169 $WarFlot = DB::table('ad_jobs')-> 179 $WarFlot = DB::table('ad_jobs')->
170 selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> 180 selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')->
171 orderByDesc('job_titles.sort')-> 181 orderByDesc('job_titles.sort')->
172 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> 182 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')->
173 where('job_titles.position_id', $position->id); 183 where('job_titles.position_id', $position->id);
174 if (($request->has('job')) && ($request->get('job') > 0)) { 184 if (($request->has('job')) && ($request->get('job') > 0)) {
175 $WarFlot = $WarFlot->where('job_title_id', $request->get('job')); 185 $WarFlot = $WarFlot->where('job_title_id', $request->get('job'));
176 } 186 }
177 $WarFlot = $WarFlot->groupby('job_title_id')->get(); 187 $WarFlot = $WarFlot->groupby('job_title_id')->get();
178 $BigFlot[] = $WarFlot; 188 $BigFlot[] = $WarFlot;
179 } 189 }
190 */
191
192 $Data = DB::table('job_titles')->
193 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');
194 if (($request->has('job')) && ($request->get('job') > 0)) {
195 $Data = $Data->where('job_title_id', $request->get('job'));
196 }
197 $Data = $Data->leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')->
198 join('categories', 'categories.id', '=', 'job_titles.position_id')->
199 groupBy('job_titles.id')->orderByDesc('job_titles.position_id')->
200 orderByDesc('job_titles.sort')->get()->toArray();
201
202 $Main_Job = array();
203 $name_cat = '';
204 foreach ($Data as $it) {
205 $it_arr = (array)$it;
206 if ($name_cat != $it_arr['catname'])
207 $name_cat = $it_arr['catname'];
208 $Main_Job[$name_cat][] = $it_arr;
209 }
180 210
181 if ($request->ajax()) { 211 if ($request->ajax()) {
182 return view('ajax.new_sky', compact('categories', 'BigFlot', 'Position')); 212 return view('ajax.new_sky', compact('categories', 'Main_Job'));
183 } else { 213 } else {
184 return view('new_sky', compact('Job_title', 'categories', 'BigFlot', 'Position')); 214 return view('new_sky', compact('Job_title', 'categories', 'Main_Job'));
185 } 215 }
186 } 216 }
187 217
188 //Вакансии категория детальная 218 //Вакансии категория детальная
189 public function list_vacancies(Category $categories, Request $request) { 219 public function list_vacancies(Category $categories, Request $request) {
190 if (isset(Auth()->user()->id)) 220 if (isset(Auth()->user()->id))
191 $uid = Auth()->user()->id; 221 $uid = Auth()->user()->id;
192 else 222 else
193 $uid = 0; 223 $uid = 0;
194 224
195 if ($request->get('job') == 0) 225 if ($request->get('job') == 0)
196 $job_search = ''; 226 $job_search = '';
197 else 227 else
198 $job_search = $request->get('job'); 228 $job_search = $request->get('job');
199 229
200 $Query = Ad_employer::with('jobs')-> 230 $Query = Ad_employer::with('jobs')->
201 with('cat')-> 231 with('cat')->
202 with('employer')-> 232 with('employer')->
203 233
204 whereHas('jobs_code', function ($query) use ($job_search) { 234 whereHas('jobs_code', function ($query) use ($job_search) {
205 if (!empty($job_search)) { 235 if (!empty($job_search)) {
206 $query->where('job_title_id', $job_search); 236 $query->where('job_title_id', $job_search);
207 } 237 }
208 })->select('ad_employers.*'); 238 })->select('ad_employers.*');
209 239
210 if (isset($categories->id) && ($categories->id > 0)) { 240 if (isset($categories->id) && ($categories->id > 0)) {
211 $Query = $Query->where('category_id', '=', $categories->id); 241 $Query = $Query->where('category_id', '=', $categories->id);
212 $Name_categori = Category::query()->where('id', '=', $categories->id)->get(); 242 $Name_categori = Category::query()->where('id', '=', $categories->id)->get();
213 } else { 243 } else {
214 $Name_categori = ''; 244 $Name_categori = '';
215 } 245 }
216 246
217 if ($request->get('sort')) { 247 if ($request->get('sort')) {
218 $sort = $request->get('sort'); 248 $sort = $request->get('sort');
219 switch ($sort) { 249 switch ($sort) {
220 case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break; 250 case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break;
221 case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break; 251 case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break;
222 case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; 252 case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break;
223 case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; 253 case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break;
224 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; 254 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break;
225 default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; 255 default: $Query = $Query->orderBy('id')->orderby('updated_at'); break;
226 } 256 }
227 } 257 }
228 258
229 $Job_title = Job_title::query()->OrderBy('name')->get(); 259 $Job_title = Job_title::query()->OrderBy('name')->get();
230 260
231 $Query_count = $Query->count(); 261 $Query_count = $Query->count();
232 262
233 $Query = $Query->OrderBy('updated_at')->paginate(3); 263 $Query = $Query->OrderBy('updated_at')->paginate(3);
234 264
235 $Reclama = reclame::query()->get(); 265 $Reclama = reclame::query()->get();
236 266
237 if ($request->ajax()) { 267 if ($request->ajax()) {
238 if ($request->has('title')) { 268 if ($request->has('title')) {
239 return view('ajax.list_category', compact( 269 return view('ajax.list_category', compact(
240 'Name_categori' 270 'Name_categori'
241 )); 271 ));
242 } else { 272 } else {
243 return view('ajax.list_vacancies', compact('Query', 273 return view('ajax.list_vacancies', compact('Query',
244 'Query_count', 274 'Query_count',
245 'Name_categori', 275 'Name_categori',
246 'Reclama', 276 'Reclama',
247 'categories', 277 'categories',
248 'Job_title', 278 'Job_title',
249 'uid')); 279 'uid'));
250 } 280 }
251 } else { 281 } else {
252 //Вернуть все 282 //Вернуть все
253 return view('list_vacancies', compact('Query', 283 return view('list_vacancies', compact('Query',
254 'Query_count', 284 'Query_count',
255 'Reclama', 285 'Reclama',
256 'Name_categori', 286 'Name_categori',
257 'categories', 287 'categories',
258 'Job_title', 288 'Job_title',
259 'uid')); 289 'uid'));
260 } 290 }
261 } 291 }
262 292
263 // Образование 293 // Образование
264 public function education(Request $request) { 294 public function education(Request $request) {
265 $educations = Education::query(); 295 $educations = Education::query();
266 if (($request->has('search')) && (!empty($request->get('search')))) { 296 if (($request->has('search')) && (!empty($request->get('search')))) {
267 $search = trim($request->get('search')); 297 $search = trim($request->get('search'));
268 $educations = $educations->where('name', 'LIKE', "%$search%"); 298 $educations = $educations->where('name', 'LIKE', "%$search%");
269 } 299 }
270 300
271 if ($request->get('sort')) { 301 if ($request->get('sort')) {
272 $sort = $request->get('sort'); 302 $sort = $request->get('sort');
273 switch ($sort) { 303 switch ($sort) {
274 case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break; 304 case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break;
275 case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break; 305 case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break;
276 case 'created_at_up': $educations = $educations->OrderBy('created_at')->orderBy('id'); break; 306 case 'created_at_up': $educations = $educations->OrderBy('created_at')->orderBy('id'); break;
277 case 'created_at_down': $educations = $educations->orderByDesc('created_at')->orderBy('id'); break; 307 case 'created_at_down': $educations = $educations->orderByDesc('created_at')->orderBy('id'); break;
278 case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break; 308 case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break;
279 default: $educations = $educations->orderBy('id')->orderby('updated_at'); break; 309 default: $educations = $educations->orderBy('id')->orderby('updated_at'); break;
280 } 310 }
281 } 311 }
282 312
283 $count_edu = $educations->count(); 313 $count_edu = $educations->count();
284 $educations = $educations->paginate(6); 314 $educations = $educations->paginate(6);
285 if ($request->ajax()) { 315 if ($request->ajax()) {
286 return view('ajax.education', compact('educations')); 316 return view('ajax.education', compact('educations'));
287 } else { 317 } else {
288 return view('education', compact('educations', 'count_edu')); 318 return view('education', compact('educations', 'count_edu'));
289 } 319 }
290 } 320 }
291 321
292 // Контакты 322 // Контакты
293 public function contacts() { 323 public function contacts() {
294 return view('contacts'); 324 return view('contacts');
295 } 325 }
296 326
297 // Вход в личный кабинет 327 // Вход в личный кабинет
298 public function input_login(Request $request) 328 public function input_login(Request $request)
299 { 329 {
300 $params = $request->all(); 330 $params = $request->all();
301 331
302 332
303 $rules = [ 333 $rules = [
304 'email' => 'required|string|email', 334 'email' => 'required|string|email',
305 'password' => 'required|string|min:3|max:25', 335 'password' => 'required|string|min:3|max:25',
306 ]; 336 ];
307 337
308 $messages = [ 338 $messages = [
309 'required' => 'Укажите обязательное поле «:attribute»', 339 'required' => 'Укажите обязательное поле «:attribute»',
310 'email' => 'Введите корректный email', 340 'email' => 'Введите корректный email',
311 'min' => [ 341 'min' => [
312 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 342 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
313 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 343 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
314 ], 344 ],
315 'max' => [ 345 'max' => [
316 'string' => 'Поле «:attribute» должно быть не больше :max символов', 346 'string' => 'Поле «:attribute» должно быть не больше :max символов',
317 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 347 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
318 ], 348 ],
319 ]; 349 ];
320 350
321 $validator = Validator::make($request->all(), $rules, $messages); 351 $validator = Validator::make($request->all(), $rules, $messages);
322 352
323 353
324 if ($validator->fails()) { 354 if ($validator->fails()) {
325 return json_encode(Array("ERROR" => "Email или пароль невалидный!")); 355 return json_encode(Array("ERROR" => "Email или пароль невалидный!"));
326 //redirect()->route('index')->with('Error', "Email или пароль невалидный"); 356 //redirect()->route('index')->with('Error', "Email или пароль невалидный");
327 } else { 357 } else {
328 $credentials = $request->only('email', 'password'); 358 $credentials = $request->only('email', 'password');
329 359
330 if (Auth::attempt($credentials, $request->has('remember'))) { 360 if (Auth::attempt($credentials, $request->has('remember'))) {
331 361
332 if (is_null(Auth::user()->email_verified_at)) { 362 if (is_null(Auth::user()->email_verified_at)) {
333 Auth::logout(); 363 Auth::logout();
334 return json_encode(Array("ERROR" => "Адрес почты не подтвержден")); 364 return json_encode(Array("ERROR" => "Адрес почты не подтвержден"));
335 } 365 }
336 366
337 if (Auth::user()->is_worker) { 367 if (Auth::user()->is_worker) {
338 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl())); 368 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));
339 } else { 369 } else {
340 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl())); 370 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));
341 } 371 }
342 372
343 return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет")); 373 return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет"));
344 //->route('index') 374 //->route('index')
345 //->with('success', 'Вы вошли в личный кабинет.'); 375 //->with('success', 'Вы вошли в личный кабинет.');
346 } else { 376 } else {
347 return json_encode(Array("ERROR" => "Неверный логин или пароль!")); 377 return json_encode(Array("ERROR" => "Неверный логин или пароль!"));
348 } 378 }
349 } 379 }
350 } 380 }
351 381
352 // Восстановление пароля 382 // Восстановление пароля
353 public function repair_password(Request $request) { 383 public function repair_password(Request $request) {
354 $rules = [ 384 $rules = [
355 'email' => 'required|string|email', 385 'email' => 'required|string|email',
356 ]; 386 ];
357 387
358 $messages = [ 388 $messages = [
359 'required' => 'Укажите обязательное поле «:attribute»', 389 'required' => 'Укажите обязательное поле «:attribute»',
360 'email' => 'Введите корректный email', 390 'email' => 'Введите корректный email',
361 'min' => [ 391 'min' => [
362 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 392 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
363 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 393 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
364 ], 394 ],
365 'max' => [ 395 'max' => [
366 'string' => 'Поле «:attribute» должно быть не больше :max символов', 396 'string' => 'Поле «:attribute» должно быть не больше :max символов',
367 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 397 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
368 ], 398 ],
369 ]; 399 ];
370 400
371 $validator = Validator::make($request->all(), $rules, $messages); 401 $validator = Validator::make($request->all(), $rules, $messages);
372 402
373 if ($validator->fails()) { 403 if ($validator->fails()) {
374 return redirect()->back()->with('Error', "Email невалидный"); 404 return redirect()->back()->with('Error', "Email невалидный");
375 } else { 405 } else {
376 $new_password = Tools::generator_id(10); 406 $new_password = Tools::generator_id(10);
377 $hash_password = Hash::make($new_password); 407 $hash_password = Hash::make($new_password);
378 $user = User::query()->where('email', $request->get('email'))->first(); 408 $user = User::query()->where('email', $request->get('email'))->first();
379 $EditRec = User::find($user->id); 409 $EditRec = User::find($user->id);
380 $EditRec->password = $hash_password; 410 $EditRec->password = $hash_password;
381 $EditRec->save(); 411 $EditRec->save();
382 412
383 foreach ([$request->get('email')] as $recipient) { 413 foreach ([$request->get('email')] as $recipient) {
384 Mail::to($recipient)->send(new MailRepair($new_password)); 414 Mail::to($recipient)->send(new MailRepair($new_password));
385 } 415 }
386 return redirect()->route('index'); 416 return redirect()->route('index');
387 417
388 } 418 }
389 419
390 } 420 }
391 421
392 // Вывод новостей 422 // Вывод новостей
393 public function news(Request $request) { 423 public function news(Request $request) {
394 $Query = News::query(); 424 $Query = News::query();
395 if ($request->has('search')) { 425 if ($request->has('search')) {
396 $search = $request->get('search'); 426 $search = $request->get('search');
397 $Query = $Query->where('title', 'LIKE', "%$search%")-> 427 $Query = $Query->where('title', 'LIKE', "%$search%")->
398 orWhere('text', 'LIKE', "%$search%"); 428 orWhere('text', 'LIKE', "%$search%");
399 } 429 }
400 430
401 if ($request->ajax()) { 431 if ($request->ajax()) {
402 if ($request->get('sort')) { 432 if ($request->get('sort')) {
403 $sort = $request->get('sort'); 433 $sort = $request->get('sort');
404 switch ($sort) { 434 switch ($sort) {
405 case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break; 435 case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break;
406 case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break; 436 case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break;
407 case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; 437 case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break;
408 case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; 438 case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break;
409 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; 439 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break;
410 default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; 440 default: $Query = $Query->orderBy('id')->orderby('updated_at'); break;
411 } 441 }
412 } 442 }
413 } 443 }
414 $Query_count = $Query->count(); 444 $Query_count = $Query->count();
415 $Query = $Query->paginate(6); 445 $Query = $Query->paginate(6);
416 446
417 if ($request->ajax()) { 447 if ($request->ajax()) {
418 return view('ajax.news-list', compact('Query', 'Query_count')); 448 return view('ajax.news-list', compact('Query', 'Query_count'));
419 } else { 449 } else {
420 return view('news-list', compact('Query', 'Query_count')); 450 return view('news-list', compact('Query', 'Query_count'));
421 } 451 }
422 } 452 }
423 453
424 //Детальная новость 454 //Детальная новость
425 public function detail_new(News $new) { 455 public function detail_new(News $new) {
426 // Наборка 456 // Наборка
427 $Query = News::query()->where('id', $new->id)->get(); 457 $Query = News::query()->where('id', $new->id)->get();
428 $title = $Query[0]->title; 458 $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\Title_worker;
26 use App\Models\User; 26 use App\Models\User;
27 use App\Models\User as User_Model; 27 use App\Models\User as User_Model;
28 use App\Models\Worker; 28 use App\Models\Worker;
29 use Barryvdh\DomPDF\Facade\Pdf; 29 use Barryvdh\DomPDF\Facade\Pdf;
30 use Carbon\Carbon; 30 use Carbon\Carbon;
31 use Illuminate\Auth\Events\Registered; 31 use Illuminate\Auth\Events\Registered;
32 use Illuminate\Database\Eloquent\Builder; 32 use Illuminate\Database\Eloquent\Builder;
33 use Illuminate\Database\Eloquent\Model; 33 use Illuminate\Database\Eloquent\Model;
34 use Illuminate\Http\JsonResponse; 34 use Illuminate\Http\JsonResponse;
35 use Illuminate\Http\Request; 35 use Illuminate\Http\Request;
36 use Illuminate\Support\Facades\Auth; 36 use Illuminate\Support\Facades\Auth;
37 use Illuminate\Support\Facades\Hash; 37 use Illuminate\Support\Facades\Hash;
38 use Illuminate\Support\Facades\Storage; 38 use Illuminate\Support\Facades\Storage;
39 use Illuminate\Support\Facades\Validator; 39 use Illuminate\Support\Facades\Validator;
40 40
41 class WorkerController extends Controller 41 class WorkerController extends Controller
42 { 42 {
43 public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу'); 43 public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу');
44 44
45 //профиль 45 //профиль
46 public function profile(Worker $worker) 46 public function profile(Worker $worker)
47 { 47 {
48 $get_date = date('Y.m'); 48 $get_date = date('Y.m');
49 49
50 $c = Static_worker::query()->where('year_month', '=', $get_date) 50 $c = Static_worker::query()->where('year_month', '=', $get_date)
51 ->where('user_id', '=', $worker->users->id) 51 ->where('user_id', '=', $worker->users->id)
52 ->get(); 52 ->get();
53 53
54 if ($c->count() > 0) { 54 if ($c->count() > 0) {
55 $upd = Static_worker::find($c[0]->id); 55 $upd = Static_worker::find($c[0]->id);
56 $upd->lookin = $upd->lookin + 1; 56 $upd->lookin = $upd->lookin + 1;
57 $upd->save(); 57 $upd->save();
58 } else { 58 } else {
59 $crt = new Static_worker(); 59 $crt = new Static_worker();
60 $crt->lookin = 1; 60 $crt->lookin = 1;
61 $crt->year_month = $get_date; 61 $crt->year_month = $get_date;
62 $crt->user_id = $worker->user_id; 62 $crt->user_id = $worker->user_id;
63 $crt->save(); 63 $crt->save();
64 } 64 }
65 65
66 $stat = Static_worker::query()->where('year_month', '=', $get_date) 66 $stat = Static_worker::query()->where('year_month', '=', $get_date)
67 ->where('user_id', '=', $worker->users->id) 67 ->where('user_id', '=', $worker->users->id)
68 ->get(); 68 ->get();
69 69
70 return view('public.workers.profile', compact('worker', 'stat')); 70 return view('public.workers.profile', compact('worker', 'stat'));
71 } 71 }
72 72
73 // лист база резюме 73 // лист база резюме
74 public function bd_resume(Request $request) 74 public function bd_resume(Request $request)
75 { 75 {
76 if (isset(Auth()->user()->id)) { 76 if (isset(Auth()->user()->id)) {
77 $idiot = Auth()->user()->id; 77 $idiot = Auth()->user()->id;
78 } else { 78 } else {
79 $idiot = 0; 79 $idiot = 0;
80 } 80 }
81 81
82 $status_work = $this->status_work; 82 $status_work = $this->status_work;
83 $resumes = Worker::query()->with('users')->with('job_titles'); 83 $resumes = Worker::query()->with('users')->with('job_titles');
84 $resumes = $resumes->whereHas('users', function (Builder $query) { 84 $resumes = $resumes->whereHas('users', function (Builder $query) {
85 $query->Where('is_worker', '=', '1') 85 $query->Where('is_worker', '=', '1')
86 ->Where('is_bd', '=', '0'); 86 ->Where('is_bd', '=', '0');
87 }); 87 });
88 88
89 //dd($request->get('job')); 89 //dd($request->get('job'));
90 if (($request->has('job')) && ($request->get('job') > 0)) { 90 if (($request->has('job')) && ($request->get('job') > 0)) {
91 $resumes = $resumes->whereHas('job_titles', function(Builder $query) use ($request) { 91 $resumes = $resumes->whereHas('job_titles', function(Builder $query) use ($request) {
92 $query->Where('job_titles.id', $request->get('job')); 92 $query->Where('job_titles.id', $request->get('job'));
93 }); 93 });
94 } 94 }
95 95
96 $Job_title = Job_title::query()->get(); 96 $Job_title = Job_title::query()->get();
97 97
98 if ($request->get('sort')) { 98 if ($request->get('sort')) {
99 $sort = $request->get('sort'); 99 $sort = $request->get('sort');
100 switch ($sort) { 100 switch ($sort) {
101 case 'name_up': 101 case 'name_up':
102 $resumes = $resumes->orderBy(User::select('surname') 102 $resumes = $resumes->orderBy(User::select('surname')
103 ->whereColumn('Workers.user_id', 'users.id') 103 ->whereColumn('Workers.user_id', 'users.id')
104 ); 104 );
105 break; 105 break;
106 case 'name_down': 106 case 'name_down':
107 $resumes = $resumes->orderByDesc(User::select('surname') 107 $resumes = $resumes->orderByDesc(User::select('surname')
108 ->whereColumn('Workers.user_id', 'users.id') 108 ->whereColumn('Workers.user_id', 'users.id')
109 ); 109 );
110 break; 110 break;
111 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;
112 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;
113 case 'default': $resumes = $resumes->orderBy('id')->orderby('updated_at'); break; 113 case 'default': $resumes = $resumes->orderBy('id')->orderby('updated_at'); break;
114 default: $resumes = $resumes->orderBy('id')->orderby('updated_at'); break; 114 default: $resumes = $resumes->orderBy('id')->orderby('updated_at'); break;
115 } 115 }
116 } 116 }
117 117
118 $res_count = $resumes->count(); 118 $res_count = $resumes->count();
119 //$resumes = $resumes->get(); 119 //$resumes = $resumes->get();
120 120
121 $resumes = $resumes->paginate(4); 121 $resumes = $resumes->paginate(4);
122 if ($request->ajax()) { 122 if ($request->ajax()) {
123 // Условия обставлены 123 // Условия обставлены
124 if ($request->has('block') && ($request->get('block') == 1)) { 124 if ($request->has('block') && ($request->get('block') == 1)) {
125 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'));
126 } 126 }
127 127
128 if ($request->has('block') && ($request->get('block') == 2)) { 128 if ($request->has('block') && ($request->get('block') == 2)) {
129 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'));
130 } 130 }
131 } else { 131 } else {
132 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'));
133 } 133 }
134 } 134 }
135 135
136 //Лайк резюме 136 //Лайк резюме
137 public function like_controller() { 137 public function like_controller() {
138 138
139 } 139 }
140 140
141 // анкета соискателя 141 // анкета соискателя
142 public function resume_profile(Worker $worker) 142 public function resume_profile(Worker $worker)
143 { 143 {
144 if (isset(Auth()->user()->id)) { 144 if (isset(Auth()->user()->id)) {
145 $idiot = Auth()->user()->id; 145 $idiot = Auth()->user()->id;
146 } else { 146 } else {
147 $idiot = 0; 147 $idiot = 0;
148 } 148 }
149 149
150 $status_work = $this->status_work; 150 $status_work = $this->status_work;
151 $Query = Worker::query()->with('users')->with('job_titles') 151 $Query = Worker::query()->with('users')->with('job_titles')
152 ->with('place_worker')->with('sertificate')->with('prev_company') 152 ->with('place_worker')->with('sertificate')->with('prev_company')
153 ->with('infobloks'); 153 ->with('infobloks');
154 $Query = $Query->where('id', '=', $worker->id); 154 $Query = $Query->where('id', '=', $worker->id);
155 $Query = $Query->get(); 155 $Query = $Query->get();
156 156
157 $get_date = date('Y.m'); 157 $get_date = date('Y.m');
158 $c = Static_worker::query()->where('year_month', '=', $get_date) 158 $c = Static_worker::query()->where('year_month', '=', $get_date)
159 ->where('user_id', '=', $worker->id) 159 ->where('user_id', '=', $worker->id)
160 ->get(); 160 ->get();
161 161
162 if ($c->count() > 0) { 162 if ($c->count() > 0) {
163 $upd = Static_worker::find($c[0]->id); 163 $upd = Static_worker::find($c[0]->id);
164 $upd->lookin = $upd->lookin + 1; 164 $upd->lookin = $upd->lookin + 1;
165 $upd->save(); 165 $upd->save();
166 } else { 166 } else {
167 $crt = new Static_worker(); 167 $crt = new Static_worker();
168 $crt->lookin = 1; 168 $crt->lookin = 1;
169 $crt->year_month = $get_date; 169 $crt->year_month = $get_date;
170 $crt->user_id = $worker->user_id; 170 $crt->user_id = $worker->user_id;
171 $crt->save(); 171 $crt->save();
172 } 172 }
173 $stat = Static_worker::query()->where('year_month', '=', $get_date) 173 $stat = Static_worker::query()->where('year_month', '=', $get_date)
174 ->where('user_id', '=', $worker->id) 174 ->where('user_id', '=', $worker->id)
175 ->get(); 175 ->get();
176 return view('worker', compact('Query', 'status_work', 'idiot')); 176 return view('worker', compact('Query', 'status_work', 'idiot'));
177 } 177 }
178 178
179 // скачать анкету соискателя 179 // скачать анкету соискателя
180 public function resume_download(Worker $worker) 180 public function resume_download(Worker $worker)
181 { 181 {
182 $status_work = $this->status_work; 182 $status_work = $this->status_work;
183 $Query = Worker::query()->with('users')->with('job_titles') 183 $Query = Worker::query()->with('users')->with('job_titles')
184 ->with('place_worker')->with('sertificate')->with('prev_company') 184 ->with('place_worker')->with('sertificate')->with('prev_company')
185 ->with('infobloks'); 185 ->with('infobloks');
186 $Query = $Query->where('id', '=', $worker->id); 186 $Query = $Query->where('id', '=', $worker->id);
187 $Query = $Query->get()->toArray(); 187 $Query = $Query->get()->toArray();
188 188
189 view()->share('Query',$Query); 189 view()->share('Query',$Query);
190 190
191 $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape'); 191 $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape');
192 192
193 return $pdf->stream(); 193 return $pdf->stream();
194 } 194 }
195 195
196 public function resume_download_all() { 196 public function resume_download_all() {
197 $status_work = $this->status_work; 197 $status_work = $this->status_work;
198 $Query = Worker::query()->with('users')->with('job_titles') 198 $Query = Worker::query()->with('users')->with('job_titles')
199 ->with('place_worker')->with('sertificate')->with('prev_company') 199 ->with('place_worker')->with('sertificate')->with('prev_company')
200 ->with('infobloks'); 200 ->with('infobloks');
201 //$Query = $Query->where('id', '=', $worker->id); 201 //$Query = $Query->where('id', '=', $worker->id);
202 $Query = $Query->get()->toArray(); 202 $Query = $Query->get()->toArray();
203 203
204 view()->share('Query',$Query); 204 view()->share('Query',$Query);
205 205
206 $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape'); 206 $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape');
207 207
208 return $pdf->stream(); 208 return $pdf->stream();
209 } 209 }
210 210
211 // Кабинет работника 211 // Кабинет работника
212 public function cabinet(Request $request) 212 public function cabinet(Request $request)
213 { 213 {
214 // дата год и месяц 214 // дата год и месяц
215 $get_date = date('Y.m'); 215 $get_date = date('Y.m');
216 216
217 $id = Auth()->user()->id; 217 $id = Auth()->user()->id;
218 218
219 $Infobloks = infobloks::query()->get(); 219 $Infobloks = infobloks::query()->get();
220 220
221 $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')-> 221 $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')->
222 with('infobloks')->with('place_worker')-> 222 with('infobloks')->with('place_worker')->
223 WhereHas('users', 223 WhereHas('users',
224 function (Builder $query) use ($id) {$query->Where('id', $id); 224 function (Builder $query) use ($id) {$query->Where('id', $id);
225 })->get(); 225 })->get();
226 226
227 $Job_titles = Job_title::query()->OrderBy('name')->get(); 227 $Job_titles = Job_title::query()->OrderBy('name')->get();
228 $Infoblocks = infobloks::query()->OrderBy('name')->get(); 228 $Infoblocks = infobloks::query()->OrderBy('name')->get();
229 229
230 $stat = Static_worker::query()->where('year_month', '=', $get_date) 230 $stat = Static_worker::query()->where('year_month', '=', $get_date)
231 ->where('user_id', '=', $Worker[0]->id) 231 ->where('user_id', '=', $Worker[0]->id)
232 ->get(); 232 ->get();
233 233
234 // 10% 234 // 10%
235 235
236 $persent = 10; 236 $persent = 10;
237 $persent1 = 0; 237 $persent1 = 0;
238 $persent2 = 0; 238 $persent2 = 0;
239 $persent3 = 0; 239 $persent3 = 0;
240 $persent4 = 0; 240 $persent4 = 0;
241 $persent5 = 0; 241 $persent5 = 0;
242 242
243 if ((!empty($Worker[0]->telephone)) && 243 if ((!empty($Worker[0]->telephone)) &&
244 (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) && 244 (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) &&
245 (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) { 245 (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) {
246 // 40% 246 // 40%
247 $persent = $persent + 40; 247 $persent = $persent + 40;
248 $persent1 = 40; 248 $persent1 = 40;
249 } 249 }
250 250
251 //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);
252 252
253 if ($Worker[0]->sertificate->count() > 0) { 253 if ($Worker[0]->sertificate->count() > 0) {
254 // 15% 254 // 15%
255 $persent = $persent + 15; 255 $persent = $persent + 15;
256 $persent2 = 15; 256 $persent2 = 15;
257 } 257 }
258 258
259 if ($Worker[0]->infobloks->count() > 0) { 259 if ($Worker[0]->infobloks->count() > 0) {
260 // 20% 260 // 20%
261 $persent = $persent + 20; 261 $persent = $persent + 20;
262 $persent3 = 20; 262 $persent3 = 20;
263 } 263 }
264 264
265 if ($Worker[0]->prev_company->count() > 0) { 265 if ($Worker[0]->prev_company->count() > 0) {
266 // 10% 266 // 10%
267 $persent = $persent + 10; 267 $persent = $persent + 10;
268 $persent4 = 10; 268 $persent4 = 10;
269 } 269 }
270 270
271 if (!empty($Worker[0]->photo)) { 271 if (!empty($Worker[0]->photo)) {
272 // 5% 272 // 5%
273 $persent = $persent + 5; 273 $persent = $persent + 5;
274 $persent5 = 5; 274 $persent5 = 5;
275 } 275 }
276 276
277 //dd($persent1, $persent2, $persent3, $persent4, $persent5); 277 //dd($persent1, $persent2, $persent3, $persent4, $persent5);
278 278
279 if ($request->has('print')) { 279 if ($request->has('print')) {
280 dd($Worker); 280 dd($Worker);
281 } else { 281 } else {
282 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'));
283 } 283 }
284 } 284 }
285 285
286 // Сохранение данных 286 // Сохранение данных
287 public function cabinet_save(Worker $worker, Request $request) 287 public function cabinet_save(Worker $worker, Request $request)
288 { 288 {
289 $id = $worker->id; 289 $id = $worker->id;
290 $params = $request->all(); 290 $params = $request->all();
291 291
292 $job_title_id = $request->get('job_title_id'); 292 $job_title_id = $request->get('job_title_id');
293 293
294 unset($params['new_diplom']); 294 unset($params['new_diplom']);
295 unset($params['new_data_begin']); 295 unset($params['new_data_begin']);
296 unset($params['new_data_end']); 296 unset($params['new_data_end']);
297 unset($params['new_job_title']); 297 unset($params['new_job_title']);
298 unset($params['new_teplohod']); 298 unset($params['new_teplohod']);
299 unset($params['new_GWT']); 299 unset($params['new_GWT']);
300 unset($params['new_KBT']); 300 unset($params['new_KBT']);
301 unset($params['new_Begin_work']); 301 unset($params['new_Begin_work']);
302 unset($params['new_End_work']); 302 unset($params['new_End_work']);
303 unset($params['new_name_company']); 303 unset($params['new_name_company']);
304 304
305 $rules = [ 305 $rules = [
306 'surname' => ['required', 'string', 'max:255'], 306 'surname' => ['required', 'string', 'max:255'],
307 'name_man' => ['required', 'string', 'max:255'], 307 'name_man' => ['required', 'string', 'max:255'],
308 'email' => ['required', 'string', 'email', 'max:255'], 308 'email' => ['required', 'string', 'email', 'max:255'],
309 309
310 ]; 310 ];
311 311
312 $messages = [ 312 $messages = [
313 'required' => 'Укажите обязательное поле', 313 'required' => 'Укажите обязательное поле',
314 'min' => [ 314 'min' => [
315 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 315 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
316 'integer' => 'Поле «:attribute» должно быть :min или больше', 316 'integer' => 'Поле «:attribute» должно быть :min или больше',
317 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 317 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
318 ], 318 ],
319 'max' => [ 319 'max' => [
320 'string' => 'Поле «:attribute» должно быть не больше :max символов', 320 'string' => 'Поле «:attribute» должно быть не больше :max символов',
321 'integer' => 'Поле «:attribute» должно быть :max или меньше', 321 'integer' => 'Поле «:attribute» должно быть :max или меньше',
322 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 322 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
323 ] 323 ]
324 ]; 324 ];
325 325
326 $validator = Validator::make($params, $rules, $messages); 326 $validator = Validator::make($params, $rules, $messages);
327 327
328 if ($validator->fails()) { 328 if ($validator->fails()) {
329 return redirect()->route('worker.cabinet')->withErrors($validator); 329 return redirect()->route('worker.cabinet')->withErrors($validator);
330 } else { 330 } else {
331 331
332 if ($request->has('photo')) { 332 if ($request->has('photo')) {
333 if (!empty($Worker->photo)) { 333 if (!empty($Worker->photo)) {
334 Storage::delete($Worker->photo); 334 Storage::delete($Worker->photo);
335 } 335 }
336 $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); 336 $params['photo'] = $request->file('photo')->store("worker/$id", 'public');
337 } 337 }
338 338
339 if ($request->has('file')) { 339 if ($request->has('file')) {
340 if (!empty($Worker->file)) { 340 if (!empty($Worker->file)) {
341 Storage::delete($Worker->file); 341 Storage::delete($Worker->file);
342 } 342 }
343 $params['file'] = $request->file('file')->store("worker/$id", 'public'); 343 $params['file'] = $request->file('file')->store("worker/$id", 'public');
344 } 344 }
345 345
346 $id_wor = $worker->update($params); 346 $id_wor = $worker->update($params);
347 347 $use = User::find($worker->user_id);
348 $use = User_Model::find($id_wor);
349 $use->surname = $request->get('surname'); 348 $use->surname = $request->get('surname');
350 $use->name_man = $request->get('name_man'); 349 $use->name_man = $request->get('name_man');
351 $use->surname2 = $request->get('surname2'); 350 $use->surname2 = $request->get('surname2');
352 351
353 $use->save(); 352 $use->save();
354 $worker->job_titles()->sync($job_title_id); 353 $worker->job_titles()->sync($job_title_id);
355 354
356 return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); 355 return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены');
357 } 356 }
358 } 357 }
359 358
360 // Сообщения данные 359 // Сообщения данные
361 public function messages($type_message) 360 public function messages($type_message)
362 { 361 {
363 $user_id = Auth()->user()->id; 362 $user_id = Auth()->user()->id;
364 363
365 $messages_input = Message::query()->with('vacancies')->with('user_from')-> 364 $messages_input = Message::query()->with('vacancies')->with('user_from')->
366 Where('to_user_id', $user_id)->OrderByDesc('created_at'); 365 Where('to_user_id', $user_id)->OrderByDesc('created_at');
367 366
368 $messages_output = Message::query()->with('vacancies')-> 367 $messages_output = Message::query()->with('vacancies')->
369 with('user_to')->where('user_id', $user_id)-> 368 with('user_to')->where('user_id', $user_id)->
370 OrderByDesc('created_at'); 369 OrderByDesc('created_at');
371 370
372 371
373 $count_input = $messages_input->count(); 372 $count_input = $messages_input->count();
374 $count_output = $messages_output->count(); 373 $count_output = $messages_output->count();
375 374
376 if ($type_message == 'input') { 375 if ($type_message == 'input') {
377 $messages = $messages_input->paginate(15); 376 $messages = $messages_input->paginate(15);
378 } 377 }
379 378
380 if ($type_message == 'output') { 379 if ($type_message == 'output') {
381 $messages = $messages_output->paginate(15); 380 $messages = $messages_output->paginate(15);
382 } 381 }
383 // Вернуть все 100% 382 // Вернуть все 100%
384 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'));
385 } 384 }
386 385
387 // Избранный 386 // Избранный
388 public function favorite() 387 public function favorite()
389 { 388 {
390 return view('workers.favorite'); 389 return view('workers.favorite');
391 } 390 }
392 391
393 // Сменить пароль 392 // Сменить пароль
394 public function new_password() 393 public function new_password()
395 { 394 {
396 $email = Auth()->user()->email; 395 $email = Auth()->user()->email;
397 return view('workers.new_password', compact('email')); 396 return view('workers.new_password', compact('email'));
398 } 397 }
399 398
400 // Обновление пароля 399 // Обновление пароля
401 public function save_new_password(Request $request) { 400 public function save_new_password(Request $request) {
402 $use = Auth()->user(); 401 $use = Auth()->user();
403 $request->validate([ 402 $request->validate([
404 'password' => 'required|string', 403 'password' => 'required|string',
405 'new_password' => 'required|string', 404 'new_password' => 'required|string',
406 'new_password2' => 'required|string' 405 'new_password2' => 'required|string'
407 ]); 406 ]);
408 407
409 if ($request->get('new_password') == $request->get('new_password2')) 408 if ($request->get('new_password') == $request->get('new_password2'))
410 if ($request->get('password') !== $request->get('new_password')) { 409 if ($request->get('password') !== $request->get('new_password')) {
411 $credentials = $request->only('email', 'password'); 410 $credentials = $request->only('email', 'password');
412 if (Auth::attempt($credentials, $request->has('save_me'))) { 411 if (Auth::attempt($credentials, $request->has('save_me'))) {
413 412
414 if (!is_null($use->email_verified_at)){ 413 if (!is_null($use->email_verified_at)){
415 414
416 $user_data = User_Model::find($use->id); 415 $user_data = User_Model::find($use->id);
417 $user_data->update([ 416 $user_data->update([
418 'password' => Hash::make($request->get('new_password')), 417 'password' => Hash::make($request->get('new_password')),
419 'pubpassword' => base64_encode($request->get('new_password')), 418 'pubpassword' => base64_encode($request->get('new_password')),
420 ]); 419 ]);
421 return redirect() 420 return redirect()
422 ->route('worker.new_password') 421 ->route('worker.new_password')
423 ->with('success', 'Поздравляю! Вы обновили свой пароль!'); 422 ->with('success', 'Поздравляю! Вы обновили свой пароль!');
424 } 423 }
425 424
426 return redirect() 425 return redirect()
427 ->route('worker.new_password') 426 ->route('worker.new_password')
428 ->withError('Данная учетная запись не было верифицированна!'); 427 ->withError('Данная учетная запись не было верифицированна!');
429 } 428 }
430 } 429 }
431 430
432 return redirect() 431 return redirect()
433 ->route('worker.new_password') 432 ->route('worker.new_password')
434 ->withErrors('Не совпадение данных, обновите пароли!'); 433 ->withErrors('Не совпадение данных, обновите пароли!');
435 } 434 }
436 435
437 // Удаление профиля форма 436 // Удаление профиля форма
438 public function delete_profile() 437 public function delete_profile()
439 { 438 {
440 $login = Auth()->user()->email; 439 $login = Auth()->user()->email;
441 return view('workers.delete_profile', compact('login')); 440 return view('workers.delete_profile', compact('login'));
442 } 441 }
443 442
444 // Удаление профиля код 443 // Удаление профиля код
445 public function delete_profile_result(Request $request) { 444 public function delete_profile_result(Request $request) {
446 $Answer = $request->all(); 445 $Answer = $request->all();
447 $user_id = Auth()->user()->id; 446 $user_id = Auth()->user()->id;
448 $request->validate([ 447 $request->validate([
449 'password' => 'required|string', 448 'password' => 'required|string',
450 ]); 449 ]);
451 450
452 $credentials = $request->only('email', 'password'); 451 $credentials = $request->only('email', 'password');
453 if (Auth::attempt($credentials)) { 452 if (Auth::attempt($credentials)) {
454 Auth::logout(); 453 Auth::logout();
455 $it = User_Model::find($user_id); 454 $it = User_Model::find($user_id);
456 $it->delete(); 455 $it->delete();
457 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); 456 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт');
458 } else { 457 } else {
459 return redirect()->route('worker.delete_profile') 458 return redirect()->route('worker.delete_profile')
460 ->withErrors( 'Неверный пароль! Нужен корректный пароль'); 459 ->withErrors( 'Неверный пароль! Нужен корректный пароль');
461 } 460 }
462 } 461 }
463 462
464 // Регистрация соискателя 463 // Регистрация соискателя
465 public function register_worker(Request $request) 464 public function register_worker(Request $request)
466 { 465 {
467 $params = $request->all(); 466 $params = $request->all();
468 $params['is_worker'] = 1; 467 $params['is_worker'] = 1;
469 468
470 $rules = [ 469 $rules = [
471 'surname' => ['required', 'string', 'max:255'], 470 'surname' => ['required', 'string', 'max:255'],
472 'name_man' => ['required', 'string', 'max:255'], 471 'name_man' => ['required', 'string', 'max:255'],
473 'email' => ['required', 'email', 'max:255', 'unique:users'], 472 'email' => ['required', 'email', 'max:255', 'unique:users'],
474 'password' => ['required', 'string', 'min:8'] 473 'password' => ['required', 'string', 'min:8']
475 ]; 474 ];
476 475
477 $messages = [ 476 $messages = [
478 'required' => 'Укажите обязательное поле', 477 'required' => 'Укажите обязательное поле',
479 'min' => [ 478 'min' => [
480 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 479 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
481 'integer' => 'Поле «:attribute» должно быть :min или больше', 480 'integer' => 'Поле «:attribute» должно быть :min или больше',
482 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 481 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
483 ], 482 ],
484 'max' => [ 483 'max' => [
485 'string' => 'Поле «:attribute» должно быть не больше :max символов', 484 'string' => 'Поле «:attribute» должно быть не больше :max символов',
486 'integer' => 'Поле «:attribute» должно быть :max или меньше', 485 'integer' => 'Поле «:attribute» должно быть :max или меньше',
487 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 486 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
488 ] 487 ]
489 ]; 488 ];
490 489
491 if (empty($request->get('email'))) { 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: Отсутствует емайл или некорректный емайл")); 492 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл"));
493 } 493 }
494 494
495 if ($request->get('password') !== $request->get('confirmed')){ 495 if ($request->get('password') !== $request->get('confirmed')){
496 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); 496 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля"));
497 } 497 }
498 498
499 $haystack = $request->get('password'); 499 $haystack = $request->get('password');
500 500
501 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); 501 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?');
502 $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',
503 'X', 'C', 'V', 'B', 'N', 'M'); 503 'X', 'C', 'V', 'B', 'N', 'M');
504 $lenpwd_bool = true; 504 $lenpwd_bool = true;
505 $spec_bool = false; 505 $spec_bool = false;
506 $alpha_bool = false; 506 $alpha_bool = false;
507 507
508 if (strlen($haystack) < 8) $lenpwd_bool = false; 508 if (strlen($haystack) < 8) $lenpwd_bool = false;
509 509
510 foreach ($specsumbol as $it) { 510 foreach ($specsumbol as $it) {
511 if (strpos($haystack, $it) !== false) { 511 if (strpos($haystack, $it) !== false) {
512 $spec_bool = true; 512 $spec_bool = true;
513 } 513 }
514 } 514 }
515 515
516 foreach ($alpha as $it) { 516 foreach ($alpha as $it) {
517 if (strpos($haystack, $it) !== false) { 517 if (strpos($haystack, $it) !== false) {
518 $alpha_bool = true; 518 $alpha_bool = true;
519 } 519 }
520 } 520 }
521 521
522 if (!$lenpwd_bool) { 522 if (!$lenpwd_bool) {
523 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); 523 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!"));
524 } 524 }
525 525
526 if ((!$spec_bool) || (!$alpha_bool)) { 526 if ((!$spec_bool) || (!$alpha_bool)) {
527 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); 527 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?"));
528 } 528 }
529 529
530 if (($request->has('politik')) && ($request->get('politik') == 1)) { 530 if (($request->has('politik')) && ($request->get('politik') == 1)) {
531 $validator = Validator::make($params, $rules, $messages); 531 $validator = Validator::make($params, $rules, $messages);
532 532
533 if ($validator->fails()) { 533 if ($validator->fails()) {
534 return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); 534 return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе."));
535 } else { 535 } else {
536 //dd($params); 536 //dd($params);
537 $user = $this->create($params); 537 $user = $this->create($params);
538 event(new Registered($user)); 538 event(new Registered($user));
539 Auth::guard()->login($user); 539 Auth::guard()->login($user);
540 } 540 }
541 if ($user) { 541 if ($user) {
542 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; 542 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));;
543 } else { 543 } else {
544 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); 544 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!"));
545 } 545 }
546 546
547 } else { 547 } else {
548 return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); 548 return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!"));
549 } 549 }
550 } 550 }
551 551
552 // Звездная оценка и ответ 552 // Звездная оценка и ответ
553 public function stars_answer(Request $request) { 553 public function stars_answer(Request $request) {
554 $params = $request->all(); 554 $params = $request->all();
555 $rules = [ 555 $rules = [
556 'message' => ['required', 'string', 'max:255'], 556 'message' => ['required', 'string', 'max:255'],
557 ]; 557 ];
558 558
559 $messages = [ 559 $messages = [
560 'required' => 'Укажите обязательное поле', 560 'required' => 'Укажите обязательное поле',
561 'min' => [ 561 'min' => [
562 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 562 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
563 'integer' => 'Поле «:attribute» должно быть :min или больше', 563 'integer' => 'Поле «:attribute» должно быть :min или больше',
564 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 564 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
565 ], 565 ],
566 'max' => [ 566 'max' => [
567 'string' => 'Поле «:attribute» должно быть не больше :max символов', 567 'string' => 'Поле «:attribute» должно быть не больше :max символов',
568 'integer' => 'Поле «:attribute» должно быть :max или меньше', 568 'integer' => 'Поле «:attribute» должно быть :max или меньше',
569 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 569 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
570 ] 570 ]
571 ]; 571 ];
572 $response_worker = ResponseWork::create($params); 572 $response_worker = ResponseWork::create($params);
573 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', 'Ваше сообщение было отправлено!');
574 } 574 }
575 575
576 public function TestWorker() 576 public function TestWorker()
577 { 577 {
578 $Use = new User(); 578 $Use = new User();
579 579
580 $Code_user = $Use->create([ 580 $Code_user = $Use->create([
581 'name' => 'surname name_man', 581 'name' => 'surname name_man',
582 'name_man' => 'name_man', 582 'name_man' => 'name_man',
583 'surname' => 'surname', 583 'surname' => 'surname',
584 'surname2' => 'surname2', 584 'surname2' => 'surname2',
585 'subscribe_email' => '1', 585 'subscribe_email' => '1',
586 'email' => 'email@mail.com', 586 'email' => 'email@mail.com',
587 'telephone' => '1234567890', 587 'telephone' => '1234567890',
588 'password' => Hash::make('password'), 588 'password' => Hash::make('password'),
589 'pubpassword' => base64_encode('password'), 589 'pubpassword' => base64_encode('password'),
590 'email_verified_at' => Carbon::now(), 590 'email_verified_at' => Carbon::now(),
591 'is_worker' => 1, 591 'is_worker' => 1,
592 ]); 592 ]);
593 593
594 if ($Code_user->id > 0) { 594 if ($Code_user->id > 0) {
595 $Worker = new Worker(); 595 $Worker = new Worker();
596 $Worker->user_id = $Code_user->id; 596 $Worker->user_id = $Code_user->id;
597 $Worker->position_work = 1; //'job_titles'; 597 $Worker->position_work = 1; //'job_titles';
598 $Worker->email = 'email@email.com'; 598 $Worker->email = 'email@email.com';
599 $Worker->telephone = '1234567890'; 599 $Worker->telephone = '1234567890';
600 $status = $Worker->save(); 600 $status = $Worker->save();
601 601
602 $Title_Worker = new Title_worker(); 602 $Title_Worker = new Title_worker();
603 $Title_Worker->worker_id = $Worker->id; 603 $Title_Worker->worker_id = $Worker->id;
604 $Title_Worker->job_title_id = 1; 604 $Title_Worker->job_title_id = 1;
605 $Title_Worker->save(); 605 $Title_Worker->save();
606 } 606 }
607 } 607 }
608 608
609 // Создание пользователя 609 // Создание пользователя
610 protected function create(array $data) 610 protected function create(array $data)
611 { 611 {
612 $Use = new User(); 612 $Use = new User();
613 613
614 $Code_user = $Use->create([ 614 $Code_user = $Use->create([
615 'name' => $data['surname']." ".$data['name_man'], 615 'name' => $data['surname']." ".$data['name_man'],
616 'name_man' => $data['name_man'], 616 'name_man' => $data['name_man'],
617 'surname' => $data['surname'], 617 'surname' => $data['surname'],
618 'surname2' => $data['surname2'], 618 'surname2' => $data['surname2'],
619 'subscribe_email' => $data['email'], 619 'subscribe_email' => $data['email'],
620 'email' => $data['email'], 620 'email' => $data['email'],
621 'telephone' => $data['telephone'], 621 'telephone' => $data['telephone'],
622 'password' => Hash::make($data['password']), 622 'password' => Hash::make($data['password']),
623 'pubpassword' => base64_encode($data['password']), 623 'pubpassword' => base64_encode($data['password']),
624 'email_verified_at' => Carbon::now(), 624 'email_verified_at' => Carbon::now(),
625 'is_worker' => $data['is_worker'], 625 'is_worker' => $data['is_worker'],
626 ]); 626 ]);
627 627
628 if ($Code_user->id > 0) { 628 if ($Code_user->id > 0) {
629 $Worker = new Worker(); 629 $Worker = new Worker();
630 $Worker->user_id = $Code_user->id; 630 $Worker->user_id = $Code_user->id;
631 $Worker->position_work = $data['job_titles']; 631 $Worker->position_work = $data['job_titles'];
632 $Worker->email = $data['email']; 632 $Worker->email = $data['email'];
633 $Worker->telephone = $data['telephone']; 633 $Worker->telephone = $data['telephone'];
634 $Worker->save(); 634 $Worker->save();
635 635
636 if (isset($Worker->id)) { 636 if (isset($Worker->id)) {
637 $Title_Worker = new Title_worker(); 637 $Title_Worker = new Title_worker();
638 $Title_Worker->worker_id = $Worker->id; 638 $Title_Worker->worker_id = $Worker->id;
639 $Title_Worker->job_title_id = $data['job_titles']; 639 $Title_Worker->job_title_id = $data['job_titles'];
640 $Title_Worker->save(); 640 $Title_Worker->save();
641 } 641 }
642 642
643 return $Code_user; 643 return $Code_user;
644 } 644 }
645 } 645 }
646 646
647 // Вакансии избранные 647 // Вакансии избранные
648 public function colorado(Request $request) { 648 public function colorado(Request $request) {
649 $IP_address = RusDate::ip_addr_client(); 649 $IP_address = RusDate::ip_addr_client();
650 $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();
651 651
652 if ($Arr->count()) { 652 if ($Arr->count()) {
653 $A = Array(); 653 $A = Array();
654 foreach ($Arr as $it) { 654 foreach ($Arr as $it) {
655 $A[] = $it->code_record; 655 $A[] = $it->code_record;
656 } 656 }
657 657
658 $Query = Ad_employer::query()->whereIn('id', $A); 658 $Query = Ad_employer::query()->whereIn('id', $A);
659 } else { 659 } else {
660 $Query = Ad_employer::query()->where('id', '=', '0'); 660 $Query = Ad_employer::query()->where('id', '=', '0');
661 } 661 }
662 662
663 $Query = $Query->with('jobs')-> 663 $Query = $Query->with('jobs')->
664 with('cat')-> 664 with('cat')->
665 with('employer')-> 665 with('employer')->
666 whereHas('jobs_code', function ($query) use ($request) { 666 whereHas('jobs_code', function ($query) use ($request) {
667 if ($request->ajax()) { 667 if ($request->ajax()) {
668 if (null !== ($request->get('job'))) { 668 if (null !== ($request->get('job'))) {
669 $query->where('job_title_id', $request->get('job')); 669 $query->where('job_title_id', $request->get('job'));
670 } 670 }
671 } 671 }
672 })->select('ad_employers.*'); 672 })->select('ad_employers.*');
673 673
674 $Job_title = Job_title::query()->OrderBy('name')->get(); 674 $Job_title = Job_title::query()->OrderBy('name')->get();
675 675
676 $Query_count = $Query->count(); 676 $Query_count = $Query->count();
677 677
678 $Query = $Query->OrderBy('updated_at')->paginate(3); 678 $Query = $Query->OrderBy('updated_at')->paginate(3);
679 679
680 return view('workers.favorite', compact('Query', 680 return view('workers.favorite', compact('Query',
681 'Query_count', 681 'Query_count',
682 'Job_title')); 682 'Job_title'));
683 683
684 } 684 }
685 685
686 //Переписка 686 //Переписка
687 public function dialog(User_Model $user1, User_Model $user2) { 687 public function dialog(User_Model $user1, User_Model $user2) {
688 if (isset($user2->id)) { 688 if (isset($user2->id)) {
689 $companion = User_Model::query()->with('workers')-> 689 $companion = User_Model::query()->with('workers')->
690 with('employers')-> 690 with('employers')->
691 where('id', $user2->id)->first(); 691 where('id', $user2->id)->first();
692 } 692 }
693 693
694 $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) { 694 $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) {
695 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); 695 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id);
696 })->orWhere(function($query) use ($user1, $user2) { 696 })->orWhere(function($query) use ($user1, $user2) {
697 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); 697 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id);
698 })->OrderBy('created_at')->get(); 698 })->OrderBy('created_at')->get();
699 699
700 $id_vac = null; 700 $id_vac = null;
701 foreach ($Messages as $it) { 701 foreach ($Messages as $it) {
702 if (isset($it->response)) { 702 if (isset($it->response)) {
703 foreach ($it->response as $r) { 703 foreach ($it->response as $r) {
704 if (isset($r->ad_employer_id)) { 704 if (isset($r->ad_employer_id)) {
705 $id_vac = $r->ad_employer_id; 705 $id_vac = $r->ad_employer_id;
706 break; 706 break;
707 } 707 }
708 } 708 }
709 } 709 }
710 if (!is_null($id_vac)) break; 710 if (!is_null($id_vac)) break;
711 } 711 }
712 712
713 $ad_employer = null; 713 $ad_employer = null;
714 if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); 714 if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first();
715 $sender = $user1; 715 $sender = $user1;
716 716
717 return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); 717 return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer'));
718 } 718 }
719 719
720 // Даунылоады 720 // Даунылоады
721 public function download(Worker $worker) { 721 public function download(Worker $worker) {
722 $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; 722 $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...'];
723 view()->share('house',$arr_house); 723 view()->share('house',$arr_house);
724 $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); 724 $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape');
725 return $pdf->stream(); 725 return $pdf->stream();
726 } 726 }
727 727
728 // Поднятие анкеты 728 // Поднятие анкеты
729 public function up(Worker $worker) { 729 public function up(Worker $worker) {
730 $worker->updated_at = Carbon::now(); 730 $worker->updated_at = Carbon::now();
731 $worker->save(); 731 $worker->save();
732 // 0 732 // 0
733 return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); 733 return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных');
734 } 734 }
735 735
736 // Форма сертификате 736 // Форма сертификате
737 public function new_sertificate(Worker $worker) { 737 public function new_sertificate(Worker $worker) {
738 return view('workers.sertificate_add', compact('worker')); 738 return view('workers.sertificate_add', compact('worker'));
739 } 739 }
740 740
741 // Добавление сертификата 741 // Добавление сертификата
742 public function add_serificate(SertificationRequest $request) { 742 public function add_serificate(SertificationRequest $request) {
743 $params = $request->all(); 743 $params = $request->all();
744 744
745 $Sertificate = new sertification(); 745 $Sertificate = new sertification();
746 $Sertificate->create($params); 746 $Sertificate->create($params);
747 $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get(); 747 $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get();
748 return redirect()->route('worker.cabinet'); 748 return redirect()->route('worker.cabinet');
749 //return view('ajax.documents', compact('Docs')); 749 //return view('ajax.documents', compact('Docs'));
750 } 750 }
751 751
752 // Удалить сертификат 752 // Удалить сертификат
753 public function delete_sertificate(sertification $doc) { 753 public function delete_sertificate(sertification $doc) {
754 $doc->delete(); 754 $doc->delete();
755 755
756 return redirect()->route('worker.cabinet'); 756 return redirect()->route('worker.cabinet');
757 } 757 }
758 758
759 // Редактирование сертификата 759 // Редактирование сертификата
760 public function edit_sertificate(Worker $worker, sertification $doc) { 760 public function edit_sertificate(Worker $worker, sertification $doc) {
761 return view('workers.sertificate_edit', compact('doc', 'worker')); 761 return view('workers.sertificate_edit', compact('doc', 'worker'));
762 } 762 }
763 763
764 // Редактирование обновление сертификата 764 // Редактирование обновление сертификата
765 public function update_serificate(SertificationRequest $request, sertification $doc) { 765 public function update_serificate(SertificationRequest $request, sertification $doc) {
766 $all = $request->all(); 766 $all = $request->all();
767 $doc->worker_id = $all['worker_id']; 767 $doc->worker_id = $all['worker_id'];
768 $doc->name = $all['name']; 768 $doc->name = $all['name'];
769 $doc->end_begin = $all['end_begin']; 769 $doc->end_begin = $all['end_begin'];
770 $doc->save(); 770 $doc->save();
771 771
772 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); 772 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!');
773 } 773 }
774 774
775 public function delete_add_diplom(Request $request, Worker $worker) { 775 public function delete_add_diplom(Request $request, Worker $worker) {
776 $infoblok_id = $request->get('infoblok_id'); 776 $infoblok_id = $request->get('infoblok_id');
777 777
778 if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) 778 if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0)
779 $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); 779 $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete();
780 else { 780 else {
781 $params['infoblok_id'] = $infoblok_id; 781 $params['infoblok_id'] = $infoblok_id;
782 $params['worker_id'] = $worker->id; 782 $params['worker_id'] = $worker->id;
783 $id = Dop_info::create($params); 783 $id = Dop_info::create($params);
784 //$id = $worker->infobloks()->sync([$infoblok_id]); 784 //$id = $worker->infobloks()->sync([$infoblok_id]);
785 } 785 }
786 786
787 //$Infoblocks = infobloks::query()->get(); 787 //$Infoblocks = infobloks::query()->get();
788 return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); 788 return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks'));
789 } 789 }
790 790
791 791
792 792
793 // Добавление диплома 793 // Добавление диплома
794 public function add_diplom_ajax(Request $request) { 794 public function add_diplom_ajax(Request $request) {
795 // конец 795 // конец
796 $params = $request->all(); 796 $params = $request->all();
797 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); 797 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count();
798 798
799 if ($count == 0) $dop_info = Dop_info::create($params); 799 if ($count == 0) $dop_info = Dop_info::create($params);
800 $Infoblocks = infobloks::query()->get(); 800 $Infoblocks = infobloks::query()->get();
801 $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); 801 $Worker = Worker::query()->where('id', $request->get('worker_id'))->get();
802 $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); 802 $data = Dop_info::query()->where('worker_id', $request->has('worker_id'));
803 return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); 803 return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker'));
804 } 804 }
805 805
806 // Добавление диплома без ajax 806 // Добавление диплома без ajax
807 public function add_diplom(Worker $worker) { 807 public function add_diplom(Worker $worker) {
808 $worker_id = $worker->id; 808 $worker_id = $worker->id;
809 $Infoblocks = infobloks::query()->get(); 809 $Infoblocks = infobloks::query()->get();
810 return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); 810 return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks'));
811 } 811 }
812 // Сохранить 812 // Сохранить
813 // Сохраняю диплом 813 // Сохраняю диплом
814 public function add_diplom_save(Request $request) { 814 public function add_diplom_save(Request $request) {
815 $params = $request->all(); 815 $params = $request->all();
816 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); 816 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count();
817 if ($count == 0) $dop_info = Dop_info::create($params); 817 if ($count == 0) $dop_info = Dop_info::create($params);
818 return redirect()->route('worker.cabinet'); 818 return redirect()->route('worker.cabinet');
819 } 819 }
820 820
821 // Добавление стандартного документа 821 // Добавление стандартного документа
822 public function add_document(Worker $worker) { 822 public function add_document(Worker $worker) {
823 return view('workers.docs', compact('worker')); 823 return view('workers.docs', compact('worker'));
824 } 824 }
825 825
826 //Сохранение стандартого документа 826 //Сохранение стандартого документа
827 public function add_document_save(DocumentsRequest $request) { 827 public function add_document_save(DocumentsRequest $request) {
828 $params = $request->all(); 828 $params = $request->all();
829 $place_work = place_works::create($params); 829 $place_work = place_works::create($params);
830 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!'); 830 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!');
831 } 831 }
832 832
833 // Редактирование документа 833 // Редактирование документа
834 public function edit_document(place_works $doc, Worker $worker) { 834 public function edit_document(place_works $doc, Worker $worker) {
835 return view('workers.docs-edit', compact('doc', 'worker')); 835 return view('workers.docs-edit', compact('doc', 'worker'));
836 } 836 }
837 837
838 //Сохранение отредактированного документа 838 //Сохранение отредактированного документа
839 public function edit_document_save(DocumentsRequest $request, place_works $doc) { 839 public function edit_document_save(DocumentsRequest $request, place_works $doc) {
840 $params = $request->all(); 840 $params = $request->all();
841 $doc->update($params); 841 $doc->update($params);
842 842
843 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); 843 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!');
844 } 844 }
845 845
846 // Удаление документа 846 // Удаление документа
847 public function delete_document(place_works $doc) { 847 public function delete_document(place_works $doc) {
848 $doc->delete(); 848 $doc->delete();
849 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); 849 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!');
850 } 850 }
851 851
852 //Отправка нового сообщения 852 //Отправка нового сообщения
853 public function new_message(Request $request) { 853 public function new_message(Request $request) {
854 $params = $request->all(); 854 $params = $request->all();
855 855
856 $id = $params['send_user_id']; 856 $id = $params['send_user_id'];
857 $message = new Message(); 857 $message = new Message();
858 $message->user_id = $params['send_user_id']; 858 $message->user_id = $params['send_user_id'];
859 $message->to_user_id = $params['send_to_user_id']; 859 $message->to_user_id = $params['send_to_user_id'];
860 $message->title = $params['send_title']; 860 $message->title = $params['send_title'];
861 $message->text = $params['send_text']; 861 $message->text = $params['send_text'];
862 if ($request->has('send_file')) { 862 if ($request->has('send_file')) {
863 $message->file = $request->file('send_file')->store("worker/$id", 'public'); 863 $message->file = $request->file('send_file')->store("worker/$id", 'public');
864 } 864 }
865 $message->flag_new = 1; 865 $message->flag_new = 1;
866 $id_message = $message->save(); 866 $id_message = $message->save();
867 867
868 $data['message_id'] = $id_message; 868 $data['message_id'] = $id_message;
869 $data['ad_employer_id'] = $params['send_vacancy']; 869 $data['ad_employer_id'] = $params['send_vacancy'];
870 $data['job_title_id'] = $params['send_job_title_id']; 870 $data['job_title_id'] = $params['send_job_title_id'];
871 $data['flag'] = 1; 871 $data['flag'] = 1;
872 $ad_responce = ad_response::create($data); 872 $ad_responce = ad_response::create($data);
873 return redirect()->route('worker.messages', ['type_message' => 'output']); 873 return redirect()->route('worker.messages', ['type_message' => 'output']);
874 } 874 }
875 875
876 // Информация о предыдущих компаниях 876 // Информация о предыдущих компаниях
877 public function new_prev_company(Worker $worker) { 877 public function new_prev_company(Worker $worker) {
878 return view('workers.prev_company_form', compact('worker')); 878 return view('workers.prev_company_form', compact('worker'));
879 } 879 }
880 880
881 // Добавление контакта компании 881 // Добавление контакта компании
882 public function add_prev_company(PrevCompanyRequest $request) { 882 public function add_prev_company(PrevCompanyRequest $request) {
883 // Возвращение параметров 883 // Возвращение параметров
884 $all = $request->all(); 884 $all = $request->all();
885 $PrevCompany = PrevCompany::create($all); 885 $PrevCompany = PrevCompany::create($all);
886 886
887 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); 887 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись');
888 } 888 }
889 889
890 // Удаление контакта предыдущей компании 890 // Удаление контакта предыдущей компании
891 public function delete_prev_company(PrevCompany $doc) { 891 public function delete_prev_company(PrevCompany $doc) {
892 $doc->delete(); 892 $doc->delete();
893 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); 893 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!');
894 } 894 }
895 } 895 }
896 896
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') ?? (isset($new->slug)) ? $new->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"> 200 <div class="main__vacancies-item main__employer-page-two-item">
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 Вернуться к списку вакансий 207 Вернуться к списку вакансий
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