Commit 142d287bd2121b81beccd97aa148f5aa0284ee0c
1 parent
60451bb512
Exists in
master
and in
1 other branch
Шаблоны кабинета работника
Showing 11 changed files with 223 additions and 51 deletions Side-by-side Diff
- app/Http/Controllers/EmployerController.php
- app/Http/Controllers/WorkerController.php
- app/Providers/MyServiceProvider.php
- resources/views/index.blade.php
- resources/views/modals/register.blade.php
- resources/views/modals/send_login.blade.php
- resources/views/workers/delete_profile.blade.php
- resources/views/workers/favorite.blade.php
- resources/views/workers/messages.blade.php
- resources/views/workers/new_password.blade.php
- routes/web.php
app/Http/Controllers/EmployerController.php
... | ... | @@ -386,7 +386,7 @@ class EmployerController extends Controller |
386 | 386 | |
387 | 387 | // Данные |
388 | 388 | $users = $users->Baseuser()-> |
389 | - orderBy(Worker::select('position_work')->whereColumn('workers.user_id', 'users.id'))-> | |
389 | + orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id'))-> | |
390 | 390 | paginate(5); |
391 | 391 | |
392 | 392 | return view('employers.bd', compact('users')); |
app/Http/Controllers/WorkerController.php
... | ... | @@ -4,14 +4,22 @@ namespace App\Http\Controllers; |
4 | 4 | |
5 | 5 | use App\Models\Message; |
6 | 6 | use App\Models\Static_worker; |
7 | +use App\Models\User; | |
7 | 8 | use App\Models\Worker; |
9 | +use Illuminate\Auth\Events\Registered; | |
10 | +use Illuminate\Http\JsonResponse; | |
8 | 11 | use Illuminate\Http\Request; |
12 | +use Illuminate\Support\Facades\Auth; | |
13 | +use Illuminate\Support\Facades\Hash; | |
14 | +use Illuminate\Support\Facades\Validator; | |
9 | 15 | |
10 | 16 | class WorkerController extends Controller |
11 | 17 | { |
12 | - public $status_work = Array(0 => 'Ищу работу', 1=> 'Не указано', 2=>'Не ищу работу'); | |
18 | + public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу'); | |
19 | + | |
13 | 20 | //профиль |
14 | - public function profile(Worker $worker) { | |
21 | + public function profile(Worker $worker) | |
22 | + { | |
15 | 23 | $get_date = date('Y.m'); |
16 | 24 | |
17 | 25 | $c = Static_worker::query()->where('year_month', '=', $get_date) |
... | ... | @@ -31,14 +39,15 @@ class WorkerController extends Controller |
31 | 39 | } |
32 | 40 | |
33 | 41 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
34 | - ->where('user_id', '=', $worker->users->id) | |
35 | - ->get(); | |
42 | + ->where('user_id', '=', $worker->users->id) | |
43 | + ->get(); | |
36 | 44 | |
37 | 45 | return view('public.workers.profile', compact('worker', 'stat')); |
38 | 46 | } |
39 | 47 | |
40 | 48 | // лист база резюме |
41 | - public function bd_resume() { | |
49 | + public function bd_resume() | |
50 | + { | |
42 | 51 | $status_work = $this->status_work; |
43 | 52 | $resumes = Worker::query()->with('users')->with('job_titles'); |
44 | 53 | |
... | ... | @@ -49,7 +58,8 @@ class WorkerController extends Controller |
49 | 58 | } |
50 | 59 | |
51 | 60 | // анкета соискателя |
52 | - public function resume_profile(Worker $worker) { | |
61 | + public function resume_profile(Worker $worker) | |
62 | + { | |
53 | 63 | $status_work = $this->status_work; |
54 | 64 | $Query = Worker::query()->with('users')->with('job_titles') |
55 | 65 | ->with('place_worker')->with('sertificate')->with('prev_company') |
... | ... | @@ -60,22 +70,26 @@ class WorkerController extends Controller |
60 | 70 | } |
61 | 71 | |
62 | 72 | // скачать анкету соискателя |
63 | - public function resume_download(Worker $worker) { | |
73 | + public function resume_download(Worker $worker) | |
74 | + { | |
64 | 75 | print_r('Резюме для скачивания'); |
65 | 76 | } |
66 | 77 | |
67 | 78 | // Кабинет работника |
68 | - public function cabinet(Worker $worker) { | |
79 | + public function cabinet(Worker $worker) | |
80 | + { | |
69 | 81 | return view('workers.cabinet', compact('worker')); |
70 | 82 | } |
71 | 83 | |
72 | 84 | // Сохранение данных |
73 | - public function cabinet_save(Worker $worker, Request $request) { | |
85 | + public function cabinet_save(Worker $worker, Request $request) | |
86 | + { | |
74 | 87 | |
75 | 88 | } |
76 | 89 | |
77 | 90 | // Сообщения данные |
78 | - public function messages($type_message) { | |
91 | + public function messages($type_message) | |
92 | + { | |
79 | 93 | $user_id = Auth()->user()->id; |
80 | 94 | |
81 | 95 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> |
... | ... | @@ -101,20 +115,89 @@ class WorkerController extends Controller |
101 | 115 | } |
102 | 116 | |
103 | 117 | // Избранный |
104 | - public function favorite() { | |
118 | + public function favorite() | |
119 | + { | |
105 | 120 | |
106 | 121 | return view('workers.favorite'); |
107 | 122 | } |
108 | 123 | |
109 | 124 | |
110 | 125 | // Сменить пароль |
111 | - public function new_password() { | |
126 | + public function new_password() | |
127 | + { | |
112 | 128 | return view('workers.new_password'); |
113 | 129 | } |
114 | 130 | |
115 | 131 | // Удаление профиля |
116 | - public function delete_profile() { | |
132 | + public function delete_profile() | |
133 | + { | |
117 | 134 | |
118 | 135 | return view('workers.delete_profile'); |
119 | 136 | } |
137 | + | |
138 | + // Регистрация соискателя | |
139 | + public function register_worker(Request $request) | |
140 | + { | |
141 | + $params = $request->all(); | |
142 | + | |
143 | + $rules = [ | |
144 | + 'surname' => ['required', 'string', 'max:255'], | |
145 | + 'name_man' => ['required', 'string', 'max:255'], | |
146 | + 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], | |
147 | + 'password' => ['required', 'string', 'min:8'], | |
148 | + 'confirmed' => ['required', 'string', 'min:8'], | |
149 | + ]; | |
150 | + | |
151 | + $messages = [ | |
152 | + 'required' => 'Укажите обязательное поле', | |
153 | + 'min' => [ | |
154 | + 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | |
155 | + 'integer' => 'Поле «:attribute» должно быть :min или больше', | |
156 | + 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | |
157 | + ], | |
158 | + 'max' => [ | |
159 | + 'string' => 'Поле «:attribute» должно быть не больше :max символов', | |
160 | + 'integer' => 'Поле «:attribute» должно быть :max или меньше', | |
161 | + 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | |
162 | + ] | |
163 | + ]; | |
164 | + | |
165 | + | |
166 | + | |
167 | + if ($request->get('password') !== $request->get('confirmed')){ | |
168 | + return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | |
169 | + } | |
170 | + | |
171 | + $validator = Validator::make($request->all(), $rules, $messages); | |
172 | + | |
173 | + if ($validator->fails()) { | |
174 | + return json_encode(Array("ERROR" => "Error: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены")); | |
175 | + } else { | |
176 | + $user = $this->create($params); | |
177 | + event(new Registered($user)); | |
178 | + | |
179 | + Auth::guard()->login($user); | |
180 | + } | |
181 | + if ($user) { | |
182 | + return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; | |
183 | + } else { | |
184 | + return json_encode(Array("ERROR" => "Данные были утеряны!")); | |
185 | + } | |
186 | + } | |
187 | + | |
188 | + // Создание пользователя | |
189 | + protected function create(array $data) | |
190 | + { | |
191 | + $Use = new User(); | |
192 | + $Code_user = $Use->create([ | |
193 | + 'name' => $data['surname']." ".$data['name_man'], | |
194 | + 'subscribe_email' => $data['email'], | |
195 | + 'email' => $data['email'], | |
196 | + 'telephone' => $data['telephone'], | |
197 | + 'password' => Hash::make($data['password']), | |
198 | + 'pubpassword' => base64_encode($data['password']), | |
199 | + ]); | |
200 | + dd($Code_user); | |
201 | + } | |
120 | 202 | } |
203 | + |
app/Providers/MyServiceProvider.php
... | ... | @@ -108,5 +108,14 @@ class MyServiceProvider extends ServiceProvider |
108 | 108 | $view_worker->with(['id_worker' => $id_worker, 'Worker' => $Worker, 'User' => $user]); |
109 | 109 | } |
110 | 110 | ); |
111 | + | |
112 | + $view_job_title = ['modals.register']; | |
113 | + View::composer($view_job_title, | |
114 | + function($view_job_title) { | |
115 | + $Job_titles = Job_title::query()->get(); | |
116 | + $view_job_title->with(['Job_titles' => $Job_titles]); | |
117 | + } | |
118 | + ); | |
119 | + | |
111 | 120 | } |
112 | 121 | } |
resources/views/index.blade.php
... | ... | @@ -36,6 +36,62 @@ |
36 | 36 | } |
37 | 37 | }); |
38 | 38 | }); |
39 | + | |
40 | + $(document).on('click', '#button_reg_worker', function() { | |
41 | + var field_login = $('#email_worker'); | |
42 | + var field_pwd = $('#password_worker'); | |
43 | + var field_confirm_pwd = $('#password_confirmation_worker'); | |
44 | + var field_politik_worker = $('#politik_worker'); | |
45 | + var field_telephone_worker = $('#telephone_worker'); | |
46 | + var field_job_titles_worker = $('#job_titles_worker'); | |
47 | + var field_surname_worker = $('#surname_worker'); | |
48 | + var field_name_man = $('#name_man_worker'); | |
49 | + var field_surname2_worker = $('#surname2_worker'); | |
50 | + | |
51 | + var login = field_login.val(); | |
52 | + var pwd = field_pwd.val(); | |
53 | + var confirm_pwd = field_confirm_pwd.val(); | |
54 | + var politik = field_politik_worker.val(); | |
55 | + var telephone = field_telephone_worker.val(); | |
56 | + var job_titles = field_job_titles_worker.val(); | |
57 | + var surname = field_surname_worker.val(); | |
58 | + var name_man = field_name_man.val(); | |
59 | + var surname2 = field_surname2_worker.val(); | |
60 | + | |
61 | + | |
62 | + console.log('login: '+login+' password: '+pwd); | |
63 | + | |
64 | + $.ajax({ | |
65 | + type: "GET", | |
66 | + url: "{{ route('register_worker') }}", | |
67 | + data: "email="+login+"&password="+pwd+"&confirmed="+confirm_pwd+"&politik="+politik+ | |
68 | + "&telephone="+telephone+"&job_titles="+job_titles+"&surname="+surname+"&name_man="+name_man+ | |
69 | + "&surname2="+surname2+"&subscribe_email="+login, | |
70 | + success: function (data) { | |
71 | + console.log('Вход в систему'); | |
72 | + let d = JSON.parse(data); | |
73 | + if(typeof d['REDIRECT'] !== "undefined") { | |
74 | + console.log(d['REDIRECT']); | |
75 | + //location.href = d['REDIRECT']; | |
76 | + } | |
77 | + if (typeof d['ERROR'] !== "undefined") { | |
78 | + console.log(d['ERROR']); | |
79 | + //$('#message_error').html(d['ERROR']); | |
80 | + } | |
81 | + console.log(d['REDIRECT']); | |
82 | + //$('#block_1').html(data); | |
83 | + }, | |
84 | + headers: { | |
85 | + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | |
86 | + }, | |
87 | + error: function (data) { | |
88 | + data = JSON.stringify(data); | |
89 | + console.log('Error: ' + data); | |
90 | + } | |
91 | + }); | |
92 | + | |
93 | + return false; | |
94 | + }); | |
39 | 95 | </script> |
40 | 96 | @endsection |
41 | 97 |
resources/views/modals/register.blade.php
... | ... | @@ -9,91 +9,112 @@ |
9 | 9 | <div class="modal__reg-item form-group"> |
10 | 10 | <label class="form-group__label">Электронная почта</label> |
11 | 11 | <div class="form-group__item"> |
12 | - <input type="email" class="input" placeholder="info@rekamore.su" required> | |
12 | + <input type="email" id="email_worker" name="email_worker" class="input" placeholder="info@rekamore.su" required> | |
13 | 13 | </div> |
14 | 14 | </div> |
15 | + | |
15 | 16 | <div class="modal__reg-item form-group"> |
16 | 17 | <label class="form-group__label">Пароль</label> |
17 | 18 | <div class="form-group__item"> |
18 | - <input type="password" class="input" placeholder="**********" required> | |
19 | + <input type="password" id="password_worker" name="password_worker" class="input" placeholder="**********" required> | |
19 | 20 | <button type="button" class="eye"> |
20 | 21 | <svg class="js-password-show"> |
21 | - <use xlink:href="images/sprite.svg#eye"></use> | |
22 | + <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> | |
22 | 23 | </svg> |
23 | 24 | <svg class="js-password-hide"> |
24 | - <use xlink:href="images/sprite.svg#eye-2"></use> | |
25 | + <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use> | |
25 | 26 | </svg> |
26 | 27 | </button> |
27 | 28 | </div> |
28 | 29 | </div> |
30 | + | |
29 | 31 | <div class="modal__reg-item form-group"> |
30 | 32 | <label class="form-group__label">Подтвердить пароль</label> |
31 | 33 | <div class="form-group__item"> |
32 | - <input type="password" class="input" placeholder="**********" required> | |
34 | + <input type="password" name="password_confirmation_worker" id="password_confirmation_worker" class="input" placeholder="**********" required> | |
33 | 35 | <button type="button" class="eye"> |
34 | 36 | <svg class="js-password-show"> |
35 | - <use xlink:href="images/sprite.svg#eye"></use> | |
37 | + <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> | |
36 | 38 | </svg> |
37 | 39 | <svg class="js-password-hide"> |
38 | - <use xlink:href="images/sprite.svg#eye-2"></use> | |
40 | + <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use> | |
39 | 41 | </svg> |
40 | 42 | </button> |
41 | 43 | </div> |
42 | 44 | </div> |
45 | + | |
43 | 46 | <div class="modal__reg-item form-group"> |
44 | - <label class="form-group__label">Статус</label> | |
47 | + <label class="form-group__label">Фамилия</label> | |
45 | 48 | <div class="form-group__item"> |
46 | - <div class="select"> | |
47 | - <select class="js-select2"> | |
48 | - <option selected disabled>Не указано</option> | |
49 | - <option>Вариант 1</option> | |
50 | - <option>Вариант 2</option> | |
51 | - <option>Вариант 3</option> | |
52 | - <option>Вариант 4</option> | |
53 | - <option>Вариант 5</option> | |
54 | - <option>Вариант 6</option> | |
55 | - </select> | |
56 | - </div> | |
49 | + <input type="text" id="surname_worker" name="surname_worker" class="input" placeholder="Шестаков" required> | |
50 | + </div> | |
51 | + </div> | |
52 | + | |
53 | + <div class="modal__reg-item form-group"> | |
54 | + <label class="form-group__label">Имя</label> | |
55 | + <div class="form-group__item"> | |
56 | + <input type="text" id="name_man_worker" name="name_man_worker" class="input" placeholder="Андрей" required> | |
57 | 57 | </div> |
58 | 58 | </div> |
59 | + | |
59 | 60 | <div class="modal__reg-item form-group"> |
60 | - <label class="form-group__label">Ф.И.О.</label> | |
61 | + <label class="form-group__label">Отчество</label> | |
61 | 62 | <div class="form-group__item"> |
62 | - <input type="text" class="input" placeholder="Шестаков Михаил Юрьевич" required> | |
63 | + <input type="text" id="surname2_worker" name="surname2_worker" class="input" placeholder="Васильевич"> | |
63 | 64 | </div> |
64 | 65 | </div> |
66 | + <!-- | |
65 | 67 | <div class="modal__reg-item form-group"> |
66 | 68 | <label class="form-group__label">Должность</label> |
67 | 69 | <div class="form-group__item"> |
68 | 70 | <input type="text" class="input" placeholder="Палуба" required> |
69 | 71 | </div> |
72 | + </div>--> | |
73 | + | |
74 | + <div class="modal__reg-item form-group"> | |
75 | + <label class="form-group__label">Должность</label> | |
76 | + <div class="form-group__item"> | |
77 | + <div class="select"> | |
78 | + <select class="js-select2" name="job_titles_worker" id="job_titles_worker"> | |
79 | + <option selected>Не указано</option> | |
80 | + @if ($Job_titles->count()) | |
81 | + @foreach($Job_titles as $it) | |
82 | + <option value="{{ $it->id }}">{{ $it->name }}</option> | |
83 | + @endforeach | |
84 | + @endif | |
85 | + </select> | |
86 | + </div> | |
87 | + </div> | |
70 | 88 | </div> |
89 | + | |
71 | 90 | <div class="modal__reg-item form-group"> |
72 | 91 | <label class="form-group__label">Номер телефона</label> |
73 | 92 | <div class="form-group__item"> |
74 | - <input type="tel" class="input" placeholder="+7 (___) ___-__-__" required> | |
93 | + <input type="tel" name="telephone_worker" id="telephone_worker" class="input" placeholder="+7 (___) ___-__-__" required> | |
75 | 94 | </div> |
76 | 95 | </div> |
77 | 96 | <div class="modal__reg-item"> |
78 | 97 | <img src="images/catpcha.jpg" alt="" class="captcha"> |
79 | 98 | </div> |
99 | + | |
80 | 100 | <div class="modal__reg-item"> |
81 | 101 | <label class="checkbox"> |
82 | - <input type="checkbox" class="checkbox__input" required> | |
102 | + <input type="checkbox" name="politik_worker" id="politik_worker" class="checkbox__input" required> | |
83 | 103 | <span class="checkbox__icon"> |
84 | 104 | <svg> |
85 | - <use xlink:href="images/sprite.svg#v"></use> | |
105 | + <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use> | |
86 | 106 | </svg> |
87 | 107 | </span> |
88 | 108 | <span class="checkbox__text"> |
89 | - <span> | |
90 | - Я согласен(на) с <a href="#">Политикой конфиденциальности</a> | |
91 | - </span> | |
92 | - </span> | |
109 | + <span> | |
110 | + Я согласен(на) с <a href="{{ route('page', ['pages' => 'Politika-konfidencialnosti']) }}">Политикой конфиденциальности</a> | |
111 | + </span> | |
112 | + </span> | |
93 | 113 | </label> |
94 | 114 | </div> |
95 | - <button type="submit" class="button">Зарегистрироваться</button> | |
115 | + <button type="submit" id="button_reg_worker" name="button_reg_worker" class="button">Зарегистрироваться</button> | |
96 | 116 | </form> |
117 | + | |
97 | 118 | <form class="modal__reg" data-body="2"> |
98 | 119 | <div class="modal__reg-item form-group"> |
99 | 120 | <label class="form-group__label">Электронная почта</label> |
... | ... | @@ -159,12 +180,12 @@ |
159 | 180 | </span> |
160 | 181 | </label> |
161 | 182 | </div> |
162 | - <button type="submit" class="button">Зарегистрироваться</button> | |
183 | + <button type="submit" id="button_reg_employer" name="button_reg_employer" class="button">Зарегистрироваться</button> | |
163 | 184 | </form> |
164 | 185 | <div class="modal__text"> |
165 | 186 | <span>Вспомнили пароль?</span> |
166 | 187 | |
167 | - <a href="#">Войти</a> | |
188 | + <a data-fancybox data-src="#sign" data-options='{"touch":false,"autoFocus":false}'>Войти</a> | |
168 | 189 | </div> |
169 | 190 | </div> |
170 | 191 | </div> |
resources/views/modals/send_login.blade.php
resources/views/workers/delete_profile.blade.php
resources/views/workers/favorite.blade.php
resources/views/workers/messages.blade.php
resources/views/workers/new_password.blade.php
routes/web.php
... | ... | @@ -435,6 +435,10 @@ Route::get('login', [MainController::class, 'input_login'])->name('login'); |
435 | 435 | // Выход из кабинета |
436 | 436 | Route::get('logout', [EmployerController::class, 'logout'])->name('logout'); |
437 | 437 | |
438 | +// Регистрация соискателя | |
439 | +Route::get('register-worker', [WorkerController::class, 'register_worker'])->name('register_worker'); | |
440 | + | |
441 | + | |
438 | 442 | // Личный кабинет работника |
439 | 443 | Route::group([ |
440 | 444 | 'as' => 'worker.', // имя маршрута, например auth.index |
... | ... | @@ -458,7 +462,6 @@ Route::group([ |
458 | 462 | Route::get('cabinet/delete_profile', [WorkerController::class, 'delete_profile'])->name('delete_profile'); |
459 | 463 | |
460 | 464 | // 6 страница - Выход |
461 | - | |
462 | 465 | }); |
463 | 466 | |
464 | 467 | // Личный кабинет работодателя |