Commit f0628fd4610da1e0b388765383b8285744b614cf

Authored by Hayk Nazaryan
1 parent e1cd480e5d
Exists in master

fix worker register

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

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\Classes\Tools; 6 use App\Classes\Tools;
7 use App\Http\Requests\DocumentsRequest; 7 use App\Http\Requests\DocumentsRequest;
8 use App\Http\Requests\PrevCompanyRequest; 8 use App\Http\Requests\PrevCompanyRequest;
9 use App\Http\Requests\SertificationRequest; 9 use App\Http\Requests\SertificationRequest;
10 use App\Models\Ad_employer; 10 use App\Models\Ad_employer;
11 use App\Models\ad_response; 11 use App\Models\ad_response;
12 use App\Models\Chat; 12 use App\Models\Chat;
13 use App\Models\Dop_info; 13 use App\Models\Dop_info;
14 use App\Models\Employer; 14 use App\Models\Employer;
15 use App\Models\EmployerAutoliftOption; 15 use App\Models\EmployerAutoliftOption;
16 use App\Models\infobloks; 16 use App\Models\infobloks;
17 use App\Models\Job_title; 17 use App\Models\Job_title;
18 use App\Models\Like_vacancy; 18 use App\Models\Like_vacancy;
19 use App\Models\Message; 19 use App\Models\Message;
20 use App\Models\place_works; 20 use App\Models\place_works;
21 use App\Models\PrevCompany; 21 use App\Models\PrevCompany;
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 App\Models\WorkerAutoliftOption; 29 use App\Models\WorkerAutoliftOption;
30 use Barryvdh\DomPDF\Facade\Pdf; 30 use Barryvdh\DomPDF\Facade\Pdf;
31 use Carbon\Carbon; 31 use Carbon\Carbon;
32 use Illuminate\Auth\Events\Registered; 32 use Illuminate\Auth\Events\Registered;
33 use Illuminate\Database\Eloquent\Builder; 33 use Illuminate\Database\Eloquent\Builder;
34 use Illuminate\Http\RedirectResponse; 34 use Illuminate\Http\RedirectResponse;
35 use Illuminate\Http\Request; 35 use Illuminate\Http\Request;
36 use Illuminate\Pagination\LengthAwarePaginator; 36 use Illuminate\Pagination\LengthAwarePaginator;
37 use Illuminate\Support\Facades\Auth; 37 use Illuminate\Support\Facades\Auth;
38 use Illuminate\Support\Facades\DB; 38 use Illuminate\Support\Facades\DB;
39 use Illuminate\Support\Facades\Hash; 39 use Illuminate\Support\Facades\Hash;
40 use Illuminate\Support\Facades\Storage; 40 use Illuminate\Support\Facades\Storage;
41 use Illuminate\Support\Facades\Validator; 41 use Illuminate\Support\Facades\Validator;
42 use Illuminate\View\View; 42 use Illuminate\View\View;
43 use JsonException; 43 use JsonException;
44 use PhpOffice\PhpSpreadsheet\Spreadsheet; 44 use PhpOffice\PhpSpreadsheet\Spreadsheet;
45 use PhpOffice\PhpSpreadsheet\Writer\Xlsx; 45 use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
46 use Symfony\Component\HttpFoundation\StreamedResponse; 46 use Symfony\Component\HttpFoundation\StreamedResponse;
47 use App\Enums\DbExportColumns; 47 use App\Enums\DbExportColumns;
48 use App\Enums\WorkerStatuses; 48 use App\Enums\WorkerStatuses;
49 use DateTime; 49 use DateTime;
50 50
51 class WorkerController extends Controller 51 class WorkerController extends Controller
52 { 52 {
53 //профиль 53 //профиль
54 public function profile(Worker $worker) 54 public function profile(Worker $worker)
55 { 55 {
56 $get_date = date('Y.m'); 56 $get_date = date('Y.m');
57 57
58 $c = Static_worker::query()->where('year_month', '=', $get_date) 58 $c = Static_worker::query()->where('year_month', '=', $get_date)
59 ->where('user_id', '=', $worker->users->id) 59 ->where('user_id', '=', $worker->users->id)
60 ->get(); 60 ->get();
61 61
62 if ($c->count() > 0) { 62 if ($c->count() > 0) {
63 $upd = Static_worker::find($c[0]->id); 63 $upd = Static_worker::find($c[0]->id);
64 $upd->lookin = $upd->lookin + 1; 64 $upd->lookin = $upd->lookin + 1;
65 $upd->save(); 65 $upd->save();
66 } else { 66 } else {
67 $crt = new Static_worker(); 67 $crt = new Static_worker();
68 $crt->lookin = 1; 68 $crt->lookin = 1;
69 $crt->year_month = $get_date; 69 $crt->year_month = $get_date;
70 $crt->user_id = $worker->user_id; 70 $crt->user_id = $worker->user_id;
71 $crt->save(); 71 $crt->save();
72 } 72 }
73 73
74 $stat = Static_worker::query()->where('year_month', '=', $get_date) 74 $stat = Static_worker::query()->where('year_month', '=', $get_date)
75 ->where('user_id', '=', $worker->users->id) 75 ->where('user_id', '=', $worker->users->id)
76 ->get(); 76 ->get();
77 77
78 return view('public.workers.profile', compact('worker', 'stat')); 78 return view('public.workers.profile', compact('worker', 'stat'));
79 } 79 }
80 80
81 // лист база резюме 81 // лист база резюме
82 public function bd_resume(Request $request) 82 public function bd_resume(Request $request)
83 { 83 {
84 84
85 if (!Auth::check()) { 85 if (!Auth::check()) {
86 86
87 return redirect()->route('page', ['pages' => "Usloviya-razmescheniya"])->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); 87 return redirect()->route('page', ['pages' => "Usloviya-razmescheniya"])->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]);
88 88
89 } 89 }
90 if ((Auth::user()->is_worker) || (!Auth()->user()->is_lookin)) 90 if ((Auth::user()->is_worker) || (!Auth()->user()->is_lookin))
91 return redirect()->route('page', ['pages' => "Usloviya-razmescheniya"])->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); 91 return redirect()->route('page', ['pages' => "Usloviya-razmescheniya"])->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]);
92 92
93 93
94 $status_work = WorkerStatuses::getWorkerStatuses(); 94 $status_work = WorkerStatuses::getWorkerStatuses();
95 95
96 $resumes = Worker::query()->with('users')->with('job_titles')->orderByDesc('updated_at'); 96 $resumes = Worker::query()->with('users')->with('job_titles')->orderByDesc('updated_at');
97 $resumes = $resumes->whereHas('users', function (Builder $query) { 97 $resumes = $resumes->whereHas('users', function (Builder $query) {
98 $query->Where('is_worker', '=', '1') 98 $query->Where('is_worker', '=', '1')
99 ->Where('is_bd', '=', '0'); 99 ->Where('is_bd', '=', '0');
100 }); 100 });
101 101
102 if (($request->has('job')) && ($request->get('job') > 0)) { 102 if (($request->has('job')) && ($request->get('job') > 0)) {
103 $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { 103 $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) {
104 $query->Where('job_titles.id', $request->get('job')); 104 $query->Where('job_titles.id', $request->get('job'));
105 }); 105 });
106 } 106 }
107 107
108 $Job_title = Job_title::query() 108 $Job_title = Job_title::query()
109 ->where('is_remove', '=', '0') 109 ->where('is_remove', '=', '0')
110 ->where('is_bd', '=' , '1') 110 ->where('is_bd', '=' , '1')
111 ->orderByDesc('sort') 111 ->orderByDesc('sort')
112 ->get(); 112 ->get();
113 113
114 if ($request->get('sort')) { 114 if ($request->get('sort')) {
115 $sort = $request->get('sort'); 115 $sort = $request->get('sort');
116 switch ($sort) { 116 switch ($sort) {
117 case 'looking_for_work': 117 case 'looking_for_work':
118 $resumes->where('status_work', '=', WorkerStatuses::LookingForWork->value); 118 $resumes->where('status_work', '=', WorkerStatuses::LookingForWork->value);
119 break; 119 break;
120 case 'considering_offers': 120 case 'considering_offers':
121 $resumes->where('status_work', '=', WorkerStatuses::ConsideringOffers->value); 121 $resumes->where('status_work', '=', WorkerStatuses::ConsideringOffers->value);
122 break; 122 break;
123 case 'not_looking_for_work': 123 case 'not_looking_for_work':
124 $resumes->where('status_work', '=', WorkerStatuses::NotLookingForWork->value); 124 $resumes->where('status_work', '=', WorkerStatuses::NotLookingForWork->value);
125 break; 125 break;
126 } 126 }
127 } 127 }
128 128
129 $resumes = $resumes->get()->filter(function ($worker) { 129 $resumes = $resumes->get()->filter(function ($worker) {
130 return Tools::getWorkerProfilePercent($worker) >= 50; 130 return Tools::getWorkerProfilePercent($worker) >= 50;
131 }); 131 });
132 132
133 $res_count = $resumes->count(); 133 $res_count = $resumes->count();
134 134
135 $currentPage = $_GET['page'] ?? 1; 135 $currentPage = $_GET['page'] ?? 1;
136 $resumes = new LengthAwarePaginator( 136 $resumes = new LengthAwarePaginator(
137 items: $resumes->slice(4 * ($currentPage - 1), 4), 137 items: $resumes->slice(4 * ($currentPage - 1), 4),
138 total: $res_count, 138 total: $res_count,
139 perPage: 4, 139 perPage: 4,
140 ); 140 );
141 $resumes->setPath('bd-resume'); 141 $resumes->setPath('bd-resume');
142 142
143 if ($request->ajax()) { 143 if ($request->ajax()) {
144 // Условия обставлены 144 // Условия обставлены
145 if ($request->has('block') && ($request->get('block') == 1)) { 145 if ($request->has('block') && ($request->get('block') == 1)) {
146 return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count')); 146 return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count'));
147 } 147 }
148 } else { 148 } else {
149 return view('resume', compact('resumes', 'status_work', 'res_count', 'Job_title')); 149 return view('resume', compact('resumes', 'status_work', 'res_count', 'Job_title'));
150 } 150 }
151 } 151 }
152 152
153 public function basic_information(){ 153 public function basic_information(){
154 if (!isset(Auth()->user()->id)) { 154 if (!isset(Auth()->user()->id)) {
155 abort(404); 155 abort(404);
156 } 156 }
157 157
158 $user_id = Auth()->user()->id; 158 $user_id = Auth()->user()->id;
159 159
160 $user = User::query() 160 $user = User::query()
161 ->with('workers') 161 ->with('workers')
162 ->with(['jobtitles' => function ($query) { 162 ->with(['jobtitles' => function ($query) {
163 $query->select('job_titles.id'); 163 $query->select('job_titles.id');
164 }]) 164 }])
165 ->where('id', '=', $user_id) 165 ->where('id', '=', $user_id)
166 ->first(); 166 ->first();
167 $user->workers[0]->job_titles = $user->workers[0]->job_titles->pluck('id')->toArray(); 167 $user->workers[0]->job_titles = $user->workers[0]->job_titles->pluck('id')->toArray();
168 168
169 $job_titles = Job_title::query() 169 $job_titles = Job_title::query()
170 ->where('is_remove', '=', 0) 170 ->where('is_remove', '=', 0)
171 ->where('is_bd', '=', 1) 171 ->where('is_bd', '=', 1)
172 ->orderByDesc('sort') 172 ->orderByDesc('sort')
173 ->get() 173 ->get()
174 ; 174 ;
175 175
176 return view('workers.form_basic_information', compact('user', 'job_titles')); 176 return view('workers.form_basic_information', compact('user', 'job_titles'));
177 } 177 }
178 178
179 public function additional_documents(){ 179 public function additional_documents(){
180 if (!isset(Auth()->user()->id)) { 180 if (!isset(Auth()->user()->id)) {
181 abort(404); 181 abort(404);
182 } 182 }
183 183
184 $user_id = Auth()->user()->id; 184 $user_id = Auth()->user()->id;
185 185
186 $info_blocks = infobloks::query()->OrderBy('name')->get(); 186 $info_blocks = infobloks::query()->OrderBy('name')->get();
187 $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует']; 187 $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует'];
188 188
189 $worker = Worker::query() 189 $worker = Worker::query()
190 ->with('users') 190 ->with('users')
191 ->with('infobloks') 191 ->with('infobloks')
192 ->WhereHas('users', function (Builder $query) use ($user_id) { 192 ->WhereHas('users', function (Builder $query) use ($user_id) {
193 $query->Where('id', $user_id); 193 $query->Where('id', $user_id);
194 }) 194 })
195 ->first(); 195 ->first();
196 if ($worker->dop_info->count()){ 196 if ($worker->dop_info->count()){
197 $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray(); 197 $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray();
198 } 198 }
199 199
200 return view('workers.form_additional_documents', compact('worker', 'info_blocks', 'additional_document_statuses')); 200 return view('workers.form_additional_documents', compact('worker', 'info_blocks', 'additional_document_statuses'));
201 } 201 }
202 202
203 //Лайк резюме 203 //Лайк резюме
204 public function like_controller() { 204 public function like_controller() {
205 205
206 } 206 }
207 207
208 // анкета соискателя 208 // анкета соискателя
209 public function resume_profile(Worker $worker) 209 public function resume_profile(Worker $worker)
210 { 210 {
211 if (isset(Auth()->user()->id)) { 211 if (isset(Auth()->user()->id)) {
212 $idiot = Auth()->user()->id; 212 $idiot = Auth()->user()->id;
213 } else { 213 } else {
214 $idiot = 0; 214 $idiot = 0;
215 } 215 }
216 216
217 $status_work = WorkerStatuses::getWorkerStatuses(); 217 $status_work = WorkerStatuses::getWorkerStatuses();
218 $Query = Worker::query()->with('users')->with('job_titles') 218 $Query = Worker::query()->with('users')->with('job_titles')
219 ->with('place_worker')->with('sertificate')->with('prev_company') 219 ->with('place_worker')->with('sertificate')->with('prev_company')
220 ->with('infobloks')->with('response'); 220 ->with('infobloks')->with('response');
221 $Query = $Query->where('id', '=', $worker->id); 221 $Query = $Query->where('id', '=', $worker->id);
222 $Query = $Query->get(); 222 $Query = $Query->get();
223 223
224 $get_date = date('Y.m'); 224 $get_date = date('Y.m');
225 225
226 $infoblocks = infobloks::query()->get(); 226 $infoblocks = infobloks::query()->get();
227 227
228 $c = Static_worker::query()->where('year_month', '=', $get_date) 228 $c = Static_worker::query()->where('year_month', '=', $get_date)
229 ->where('user_id', '=', $worker->user_id) 229 ->where('user_id', '=', $worker->user_id)
230 ->get(); 230 ->get();
231 231
232 if ($c->count() > 0) { 232 if ($c->count() > 0) {
233 $upd = Static_worker::find($c[0]->id); 233 $upd = Static_worker::find($c[0]->id);
234 $upd->lookin = $upd->lookin + 1; 234 $upd->lookin = $upd->lookin + 1;
235 $upd->save(); 235 $upd->save();
236 } else { 236 } else {
237 $crt = new Static_worker(); 237 $crt = new Static_worker();
238 $crt->lookin = 1; 238 $crt->lookin = 1;
239 $crt->year_month = $get_date; 239 $crt->year_month = $get_date;
240 $crt->user_id = $worker->user_id; 240 $crt->user_id = $worker->user_id;
241 $status = $crt->save(); 241 $status = $crt->save();
242 } 242 }
243 243
244 $stat = Static_worker::query()->where('year_month', '=', $get_date) 244 $stat = Static_worker::query()->where('year_month', '=', $get_date)
245 ->where('user_id', '=', $worker->user_id) 245 ->where('user_id', '=', $worker->user_id)
246 ->get(); 246 ->get();
247 247
248 return view('worker', compact('Query', 'infoblocks', 'status_work', 'idiot', 'stat')); 248 return view('worker', compact('Query', 'infoblocks', 'status_work', 'idiot', 'stat'));
249 } 249 }
250 250
251 // скачать анкету соискателя 251 // скачать анкету соискателя
252 public function resume_download(Worker $worker) 252 public function resume_download(Worker $worker)
253 { 253 {
254 $status_work = WorkerStatuses::getWorkerStatuses(); 254 $status_work = WorkerStatuses::getWorkerStatuses();
255 $Query = Worker::query()->with('users')->with('job_titles') 255 $Query = Worker::query()->with('users')->with('job_titles')
256 ->with('place_worker')->with('sertificate')->with('prev_company') 256 ->with('place_worker')->with('sertificate')->with('prev_company')
257 ->with('infobloks'); 257 ->with('infobloks');
258 $Query = $Query->where('id', '=', $worker->id); 258 $Query = $Query->where('id', '=', $worker->id);
259 $Query = $Query->get(); 259 $Query = $Query->get();
260 260
261 view()->share('Query',$Query); 261 view()->share('Query',$Query);
262 262
263 $status_work = WorkerStatuses::getWorkerStatuses(); 263 $status_work = WorkerStatuses::getWorkerStatuses();
264 $infoblocks = infobloks::query()->get(); 264 $infoblocks = infobloks::query()->get();
265 265
266 //return view('layout.pdf', compact('Query', 'status_work', 'infoblocks')); 266 //return view('layout.pdf', compact('Query', 'status_work', 'infoblocks'));
267 $pdf = PDF::loadView('layout.pdf', [ 267 $pdf = PDF::loadView('layout.pdf', [
268 'Query' => $Query, 268 'Query' => $Query,
269 'status_work' => $status_work, 269 'status_work' => $status_work,
270 'infoblocks' => $infoblocks 270 'infoblocks' => $infoblocks
271 ])->setPaper('a4', 'landscape'); 271 ])->setPaper('a4', 'landscape');
272 272
273 return $pdf->download(); 273 return $pdf->download();
274 } 274 }
275 275
276 public function resume_download_all(Request $request) { 276 public function resume_download_all(Request $request) {
277 $spreadsheet = new Spreadsheet(); 277 $spreadsheet = new Spreadsheet();
278 $sheet = $spreadsheet->getActiveSheet(); 278 $sheet = $spreadsheet->getActiveSheet();
279 279
280 $columnMap = range('A', 'Z'); 280 $columnMap = range('A', 'Z');
281 $columns = []; 281 $columns = [];
282 282
283 foreach (DbExportColumns::toArray() as $key => $value){ 283 foreach (DbExportColumns::toArray() as $key => $value){
284 if ($request->input($key, 0)){ 284 if ($request->input($key, 0)){
285 $sheet->setCellValue("{$columnMap[count($columns)]}1", ucfirst($value)); 285 $sheet->setCellValue("{$columnMap[count($columns)]}1", ucfirst($value));
286 $columns[] = str_replace('__', '.', $key); 286 $columns[] = str_replace('__', '.', $key);
287 } 287 }
288 } 288 }
289 289
290 if (empty($columns)) { 290 if (empty($columns)) {
291 return redirect()->back()->with('error', 'Пожалуйста выберите хотя бы 1 колонку для экспорта.'); 291 return redirect()->back()->with('error', 'Пожалуйста выберите хотя бы 1 колонку для экспорта.');
292 } 292 }
293 293
294 $jobIds = $request->input('job_title_list', []); 294 $jobIds = $request->input('job_title_list', []);
295 295
296 /* //query for mysql ver 8.0 or higher 296 /* //query for mysql ver 8.0 or higher
297 $users = DB::select( 297 $users = DB::select(
298 "select `job_titles`.`name`, `users`.`surname`, `users`.`name_man`, `users`.`surname2`, `users`.`email`, `users`.`telephone` 298 "select `job_titles`.`name`, `users`.`surname`, `users`.`name_man`, `users`.`surname2`, `users`.`email`, `users`.`telephone`
299 from users 299 from users
300 join workers on `users`.`id` = `workers`.`user_id` 300 join workers on `users`.`id` = `workers`.`user_id`
301 join `job_titles` 301 join `job_titles`
302 where `users`.`is_bd` = 1 302 where `users`.`is_bd` = 1
303 and (`workers`.`position_work` = `job_titles`.`id` 303 and (`workers`.`position_work` = `job_titles`.`id`
304 or exists (select 1 304 or exists (select 1
305 from JSON_TABLE( 305 from JSON_TABLE(
306 workers.positions_work, 306 workers.positions_work,
307 '$[*]' COLUMNS (id INT PATH '$')) pw 307 '$[*]' COLUMNS (id INT PATH '$')) pw
308 where pw.id = job_titles.id) 308 where pw.id = job_titles.id)
309 )". ((!empty($jobIds)) ? 'and job_titles.id in ('. implode(',', $jobIds).')' : '') 309 )". ((!empty($jobIds)) ? 'and job_titles.id in ('. implode(',', $jobIds).')' : '')
310 );*/ 310 );*/
311 311
312 $selectFields = implode(',', $columns); 312 $selectFields = implode(',', $columns);
313 313
314 $users = DB::select("SELECT $selectFields FROM users 314 $users = DB::select("SELECT $selectFields FROM users
315 JOIN workers ON `users`.`id` = `workers`.`user_id` 315 JOIN workers ON `users`.`id` = `workers`.`user_id`
316 JOIN job_titles ON (`workers`.`position_work` = `job_titles`.`id` 316 JOIN job_titles ON (`workers`.`position_work` = `job_titles`.`id`
317 OR JSON_CONTAINS(`workers`.`positions_work`, JSON_QUOTE(CAST(`job_titles`.`id` AS CHAR)), '$')) 317 OR JSON_CONTAINS(`workers`.`positions_work`, JSON_QUOTE(CAST(`job_titles`.`id` AS CHAR)), '$'))
318 WHERE `users`.`is_bd` = 1 " . ((!empty($jobIds)) ? 'AND job_titles.id IN (' . implode(',', $jobIds) . ')' : '') . ""); 318 WHERE `users`.`is_bd` = 1 " . ((!empty($jobIds)) ? 'AND job_titles.id IN (' . implode(',', $jobIds) . ')' : '') . "");
319 319
320 $users = collect($users); 320 $users = collect($users);
321 321
322 if ($users->count()) { 322 if ($users->count()) {
323 $i = 2; 323 $i = 2;
324 foreach ($users->toArray() as $user){ 324 foreach ($users->toArray() as $user){
325 $j = 0; 325 $j = 0;
326 foreach ($user as $field){ 326 foreach ($user as $field){
327 $sheet->setCellValue("{$columnMap[$j++]}$i", $field); 327 $sheet->setCellValue("{$columnMap[$j++]}$i", $field);
328 } 328 }
329 $i++; 329 $i++;
330 } 330 }
331 } 331 }
332 $writer = new Xlsx($spreadsheet); 332 $writer = new Xlsx($spreadsheet);
333 $fileName = 'DB.xlsx'; 333 $fileName = 'DB.xlsx';
334 334
335 $response = new StreamedResponse(function() use ($writer) { 335 $response = new StreamedResponse(function() use ($writer) {
336 $writer->save('php://output'); 336 $writer->save('php://output');
337 }); 337 });
338 338
339 $response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); 339 $response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
340 $response->headers->set('Content-Disposition', 'attachment;filename="' . $fileName . '"'); 340 $response->headers->set('Content-Disposition', 'attachment;filename="' . $fileName . '"');
341 $response->headers->set('Cache-Control', 'max-age=0'); 341 $response->headers->set('Cache-Control', 'max-age=0');
342 342
343 return $response; 343 return $response;
344 } 344 }
345 345
346 // Кабинет работника 346 // Кабинет работника
347 public function cabinet(Request $request) 347 public function cabinet(Request $request)
348 { 348 {
349 // дата год и месяц 349 // дата год и месяц
350 $get_date = date('Y.m'); 350 $get_date = date('Y.m');
351 351
352 $id = Auth()->user()->id; 352 $id = Auth()->user()->id;
353 353
354 $Infobloks = infobloks::query()->get(); 354 $Infobloks = infobloks::query()->get();
355 355
356 $Worker = Worker::query() 356 $Worker = Worker::query()
357 ->with(['users', 'sertificate', 'prev_company', 'infobloks', 'place_worker']) 357 ->with(['users', 'sertificate', 'prev_company', 'infobloks', 'place_worker'])
358 ->WhereHas('users', function (Builder $query) use ($id) { 358 ->WhereHas('users', function (Builder $query) use ($id) {
359 $query->Where('id', $id); 359 $query->Where('id', $id);
360 })->first(); 360 })->first();
361 361
362 $Job_titles = Job_title::query()->where('is_remove', '=', '0') 362 $Job_titles = Job_title::query()->where('is_remove', '=', '0')
363 ->where('is_bd', '=' , '1') 363 ->where('is_bd', '=' , '1')
364 ->OrderByDesc('sort')->OrderBy('name') 364 ->OrderByDesc('sort')->OrderBy('name')
365 ->get(); 365 ->get();
366 366
367 $stat = Static_worker::query()->where('year_month', '=', $get_date) 367 $stat = Static_worker::query()->where('year_month', '=', $get_date)
368 ->where('user_id', '=', $id) 368 ->where('user_id', '=', $id)
369 ->get(); 369 ->get();
370 370
371 $persent = Tools::getWorkerProfilePercent($Worker); 371 $persent = Tools::getWorkerProfilePercent($Worker);
372 372
373 $status_work = WorkerStatuses::getWorkerStatuses(); 373 $status_work = WorkerStatuses::getWorkerStatuses();
374 $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует']; 374 $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует'];
375 $info_blocks = infobloks::query()->OrderBy('name')->get(); 375 $info_blocks = infobloks::query()->OrderBy('name')->get();
376 376
377 $worker = Worker::query() 377 $worker = Worker::query()
378 ->with('users') 378 ->with('users')
379 ->with('sertificate') 379 ->with('sertificate')
380 ->with('prev_company') 380 ->with('prev_company')
381 ->with('infobloks') 381 ->with('infobloks')
382 ->with('place_worker') 382 ->with('place_worker')
383 ->with('job_titles') 383 ->with('job_titles')
384 ->WhereHas('users', function (Builder $query) use ($id) { 384 ->WhereHas('users', function (Builder $query) use ($id) {
385 $query->Where('id', $id); 385 $query->Where('id', $id);
386 }) 386 })
387 ->first(); 387 ->first();
388 if ($worker->dop_info->count()){ 388 if ($worker->dop_info->count()){
389 $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray(); 389 $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray();
390 } 390 }
391 391
392 //dd($worker->dop_info); 392 //dd($worker->dop_info);
393 393
394 if ($request->has('print')) { 394 if ($request->has('print')) {
395 dd($Worker); 395 dd($Worker);
396 } else { 396 } else {
397 return view('workers.cabinet', compact( 'persent', 'Job_titles', 'stat', 397 return view('workers.cabinet', compact( 'persent', 'Job_titles', 'stat',
398 'worker', 'info_blocks', 'status_work', 'additional_document_statuses' 398 'worker', 'info_blocks', 'status_work', 'additional_document_statuses'
399 )); 399 ));
400 } 400 }
401 } 401 }
402 402
403 // Сохранение данных 403 // Сохранение данных
404 public function cabinet_save(Worker $worker, Request $request) 404 public function cabinet_save(Worker $worker, Request $request)
405 { 405 {
406 $id = $worker->id; 406 $id = $worker->id;
407 $params = $request->all(); 407 $params = $request->all();
408 $job_title_id = $request->get('job_title_id'); 408 $job_title_id = $request->get('job_title_id');
409 409
410 $rules = [ 410 $rules = [
411 'surname' => ['required', 'string', 'max:255'], 411 'surname' => ['required', 'string', 'max:255'],
412 'name_man' => ['required', 'string', 'max:255'], 412 'name_man' => ['required', 'string', 'max:255'],
413 'email' => ['required', 'string', 'email', 'max:255'], 413 'email' => ['required', 'string', 'email', 'max:255'],
414 414
415 ]; 415 ];
416 416
417 $messages = [ 417 $messages = [
418 'required' => 'Укажите обязательное поле', 418 'required' => 'Укажите обязательное поле',
419 'min' => [ 419 'min' => [
420 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 420 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
421 'integer' => 'Поле «:attribute» должно быть :min или больше', 421 'integer' => 'Поле «:attribute» должно быть :min или больше',
422 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 422 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
423 ], 423 ],
424 'max' => [ 424 'max' => [
425 'string' => 'Поле «:attribute» должно быть не больше :max символов', 425 'string' => 'Поле «:attribute» должно быть не больше :max символов',
426 'integer' => 'Поле «:attribute» должно быть :max или меньше', 426 'integer' => 'Поле «:attribute» должно быть :max или меньше',
427 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 427 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
428 ] 428 ]
429 ]; 429 ];
430 430
431 $validator = Validator::make($params, $rules, $messages); 431 $validator = Validator::make($params, $rules, $messages);
432 432
433 if ($validator->fails()) { 433 if ($validator->fails()) {
434 return redirect()->route('worker.cabinet')->withErrors($validator); 434 return redirect()->route('worker.cabinet')->withErrors($validator);
435 } else { 435 } else {
436 436
437 if ($request->has('photo')) { 437 if ($request->has('photo')) {
438 if (!empty($worker->photo)) { 438 if (!empty($worker->photo)) {
439 Storage::delete($worker->photo); 439 Storage::delete($worker->photo);
440 } 440 }
441 $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); 441 $params['photo'] = $request->file('photo')->store("worker/$id", 'public');
442 } 442 }
443 443
444 if ($request->has('file')) { 444 if ($request->has('file')) {
445 if (!empty($worker->file)) { 445 if (!empty($worker->file)) {
446 Storage::delete($worker->file); 446 Storage::delete($worker->file);
447 } 447 }
448 $params['file'] = $request->file('file')->store("worker/$id", 'public'); 448 $params['file'] = $request->file('file')->store("worker/$id", 'public');
449 } 449 }
450 450
451 $worker->update($params); 451 $worker->update($params);
452 $use = User::find($worker->user_id); 452 $use = User::find($worker->user_id);
453 $use->surname = $request->get('surname'); 453 $use->surname = $request->get('surname');
454 $use->name_man = $request->get('name_man'); 454 $use->name_man = $request->get('name_man');
455 $use->surname2 = $request->get('surname2'); 455 $use->surname2 = $request->get('surname2');
456 456
457 $use->save(); 457 $use->save();
458 $worker->job_titles()->sync($job_title_id); 458 $worker->job_titles()->sync($job_title_id);
459 459
460 return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); 460 return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены');
461 } 461 }
462 } 462 }
463 463
464 public function cabinet_save_foto(Worker $worker, Request $request){ 464 public function cabinet_save_foto(Worker $worker, Request $request){
465 $params = ['photo' => null]; 465 $params = ['photo' => null];
466 466
467 if ($request->has('photo')) { 467 if ($request->has('photo')) {
468 if (!empty($worker->photo)) { 468 if (!empty($worker->photo)) {
469 Storage::delete($worker->photo); 469 Storage::delete($worker->photo);
470 } 470 }
471 $params['photo'] = $request->file('photo')->store("worker/$worker->id", 'public'); 471 $params['photo'] = $request->file('photo')->store("worker/$worker->id", 'public');
472 } 472 }
473 473
474 if ($request->has('file')) { 474 if ($request->has('file')) {
475 if (!empty($worker->file)) { 475 if (!empty($worker->file)) {
476 Storage::delete($worker->file); 476 Storage::delete($worker->file);
477 } 477 }
478 $params['file'] = $request->file('file')->store("worker/$worker->id", 'public'); 478 $params['file'] = $request->file('file')->store("worker/$worker->id", 'public');
479 } 479 }
480 480
481 $worker->update($params); 481 $worker->update($params);
482 482
483 return redirect()->route('worker.cabinet'); 483 return redirect()->route('worker.cabinet');
484 } 484 }
485 485
486 // Сообщения данные 486 // Сообщения данные
487 public function messages($type_message) 487 public function messages($type_message)
488 { 488 {
489 $user_id = Auth()->user()->id; 489 $user_id = Auth()->user()->id;
490 490
491 $chats = Chat::get_user_chats($user_id); 491 $chats = Chat::get_user_chats($user_id);
492 $admin_chat = Chat::get_user_admin_chat($user_id); 492 $admin_chat = Chat::get_user_admin_chat($user_id);
493 $user_type = 'worker'; 493 $user_type = 'worker';
494 494
495 return view('workers.messages', compact('chats', 'admin_chat','user_id', 'user_type')); 495 return view('workers.messages', compact('chats', 'admin_chat','user_id', 'user_type'));
496 } 496 }
497 497
498 // Избранный 498 // Избранный
499 public function favorite() 499 public function favorite()
500 { 500 {
501 return view('workers.favorite'); 501 return view('workers.favorite');
502 } 502 }
503 503
504 // Сменить пароль 504 // Сменить пароль
505 public function new_password() 505 public function new_password()
506 { 506 {
507 $email = Auth()->user()->email; 507 $email = Auth()->user()->email;
508 return view('workers.new_password', compact('email')); 508 return view('workers.new_password', compact('email'));
509 } 509 }
510 510
511 // Обновление пароля 511 // Обновление пароля
512 public function save_new_password(Request $request) { 512 public function save_new_password(Request $request) {
513 $use = Auth()->user(); 513 $use = Auth()->user();
514 $request->validate([ 514 $request->validate([
515 'password' => 'required|string', 515 'password' => 'required|string',
516 'new_password' => 'required|string', 516 'new_password' => 'required|string',
517 'new_password2' => 'required|string' 517 'new_password2' => 'required|string'
518 ]); 518 ]);
519 519
520 if ($request->get('new_password') == $request->get('new_password2')) 520 if ($request->get('new_password') == $request->get('new_password2'))
521 if ($request->get('password') !== $request->get('new_password')) { 521 if ($request->get('password') !== $request->get('new_password')) {
522 $credentials = $request->only('email', 'password'); 522 $credentials = $request->only('email', 'password');
523 if (Auth::attempt($credentials, $request->has('save_me'))) { 523 if (Auth::attempt($credentials, $request->has('save_me'))) {
524 524
525 if (!is_null($use->email_verified_at)){ 525 if (!is_null($use->email_verified_at)){
526 526
527 $user_data = User_Model::find($use->id); 527 $user_data = User_Model::find($use->id);
528 $user_data->update([ 528 $user_data->update([
529 'password' => Hash::make($request->get('new_password')), 529 'password' => Hash::make($request->get('new_password')),
530 'pubpassword' => base64_encode($request->get('new_password')), 530 'pubpassword' => base64_encode($request->get('new_password')),
531 ]); 531 ]);
532 return redirect() 532 return redirect()
533 ->route('worker.new_password') 533 ->route('worker.new_password')
534 ->with('success', 'Поздравляю! Вы обновили свой пароль!'); 534 ->with('success', 'Поздравляю! Вы обновили свой пароль!');
535 } 535 }
536 536
537 return redirect() 537 return redirect()
538 ->route('worker.new_password') 538 ->route('worker.new_password')
539 ->withError('Данная учетная запись не было верифицированна!'); 539 ->withError('Данная учетная запись не было верифицированна!');
540 } 540 }
541 } 541 }
542 542
543 return redirect() 543 return redirect()
544 ->route('worker.new_password') 544 ->route('worker.new_password')
545 ->withErrors('Не совпадение данных, обновите пароли!'); 545 ->withErrors('Не совпадение данных, обновите пароли!');
546 } 546 }
547 547
548 // Удаление профиля форма 548 // Удаление профиля форма
549 public function delete_profile() 549 public function delete_profile()
550 { 550 {
551 $login = Auth()->user()->email; 551 $login = Auth()->user()->email;
552 return view('workers.delete_profile', compact('login')); 552 return view('workers.delete_profile', compact('login'));
553 } 553 }
554 554
555 // Удаление профиля код 555 // Удаление профиля код
556 public function delete_profile_result(Request $request) { 556 public function delete_profile_result(Request $request) {
557 $Answer = $request->all(); 557 $Answer = $request->all();
558 $user_id = Auth()->user()->id; 558 $user_id = Auth()->user()->id;
559 $request->validate([ 559 $request->validate([
560 'password' => 'required|string', 560 'password' => 'required|string',
561 ]); 561 ]);
562 562
563 $credentials = $request->only('email', 'password'); 563 $credentials = $request->only('email', 'password');
564 if (Auth::attempt($credentials)) { 564 if (Auth::attempt($credentials)) {
565 Auth::logout(); 565 Auth::logout();
566 $it = User_Model::find($user_id); 566 $it = User_Model::find($user_id);
567 $it->delete(); 567 $it->delete();
568 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); 568 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт');
569 } else { 569 } else {
570 return redirect()->route('worker.delete_profile') 570 return redirect()->route('worker.delete_profile')
571 ->withErrors( 'Неверный пароль! Нужен корректный пароль'); 571 ->withErrors( 'Неверный пароль! Нужен корректный пароль');
572 } 572 }
573 } 573 }
574 574
575 // Регистрация соискателя 575 // Регистрация соискателя
576 public function register_worker(Request $request) 576 public function register_worker(Request $request)
577 { 577 {
578 $rules = [ 578 $rules = [
579 'surname' => ['required', 'string', 'max:255'], 579 'surname' => ['required', 'string', 'max:255'],
580 'name_man' => ['required', 'string', 'max:255'], 580 'name_man' => ['required', 'string', 'max:255'],
581 'email' => ['required', 'email', 'max:255', 'unique:users'], 581 'email' => ['required', 'email', 'max:255', 'unique:users'],
582 'password' => ['required', 'string', 'min:6'], 582 'password' => ['required', 'string', 'min:6'],
583 'password_confirmation' => ['required', 'same:password'], 583 'password_confirmation' => ['required', 'same:password'],
584 'politik' => ['required', 'accepted'], 584 'politik' => ['required', 'accepted'],
585 'job_titles' => ['required', 'numeric'] 585 'job_titles' => ['nullable']
586 ]; 586 ];
587 587
588 $messages = [ 588 $messages = [
589 'required' => 'Укажите обязательное поле', 589 'required' => 'Укажите обязательное поле',
590 'email' => 'Введите корректный email', 590 'email' => 'Введите корректный email',
591 'unique' => 'Email уже зарегистрирован', 591 'unique' => 'Email уже зарегистрирован',
592 'same' => 'Пароль и подтверждение пароля не совпадают', 592 'same' => 'Пароль и подтверждение пароля не совпадают',
593 'min' => [ 593 'min' => [
594 'string' => 'Поле должно быть не менее :min символов', 594 'string' => 'Поле должно быть не менее :min символов',
595 ], 595 ],
596 'accepted' => 'Необходимо согласиться с политикой конфиденциальности', 596 'accepted' => 'Необходимо согласиться с политикой конфиденциальности',
597 'numeric' => 'Укажите обязательное поле',
598 ]; 597 ];
599 598
600 $validator = Validator::make($request->all(), $rules, $messages); 599 $validator = Validator::make($request->all(), $rules, $messages);
601 600
602 if ($validator->fails()) { 601 if ($validator->fails()) {
603 return response()->json(['ERRORS' => $validator->errors()], 422); 602 return response()->json(['ERRORS' => $validator->errors()], 422);
604 } 603 }
605 604
606 $params = $request->all(); 605 $params = $request->all();
607 $params['is_worker'] = 1; 606 $params['is_worker'] = 1;
608 607
609 if ($user = $this->create($params)) { 608 if ($user = $this->create($params)) {
610 event(new Registered($user)); 609 event(new Registered($user));
611 return response()->json([ 610 return response()->json([
612 'REDIRECT' => url('/') 611 'REDIRECT' => url('/')
613 ]); 612 ]);
614 } 613 }
615 614
616 return response()->json([ 615 return response()->json([
617 'ERROR' => 'Произошла ошибка при регистрации. Попробуйте снова.' 616 'ERROR' => 'Произошла ошибка при регистрации. Попробуйте снова.'
618 ]); 617 ]);
619 } 618 }
620 619
621 // Звездная оценка и ответ 620 // Звездная оценка и ответ
622 public function stars_answer(Request $request) { 621 public function stars_answer(Request $request) {
623 $params = $request->all(); 622 $params = $request->all();
624 $rules = [ 623 $rules = [
625 'message' => ['required', 'string', 'max:255'], 624 'message' => ['required', 'string', 'max:255'],
626 ]; 625 ];
627 626
628 $messages = [ 627 $messages = [
629 'required' => 'Укажите обязательное поле', 628 'required' => 'Укажите обязательное поле',
630 'min' => [ 629 'min' => [
631 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 630 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
632 'integer' => 'Поле «:attribute» должно быть :min или больше', 631 'integer' => 'Поле «:attribute» должно быть :min или больше',
633 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 632 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
634 ], 633 ],
635 'max' => [ 634 'max' => [
636 'string' => 'Поле «:attribute» должно быть не больше :max символов', 635 'string' => 'Поле «:attribute» должно быть не больше :max символов',
637 'integer' => 'Поле «:attribute» должно быть :max или меньше', 636 'integer' => 'Поле «:attribute» должно быть :max или меньше',
638 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 637 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
639 ] 638 ]
640 ]; 639 ];
641 $response_worker = ResponseWork::create($params); 640 $response_worker = ResponseWork::create($params);
642 return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); 641 return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!');
643 } 642 }
644 643
645 public function TestWorker() 644 public function TestWorker()
646 { 645 {
647 $Use = new User(); 646 $Use = new User();
648 647
649 $Code_user = $Use->create([ 648 $Code_user = $Use->create([
650 'name' => 'surname name_man', 649 'name' => 'surname name_man',
651 'name_man' => 'name_man', 650 'name_man' => 'name_man',
652 'surname' => 'surname', 651 'surname' => 'surname',
653 'surname2' => 'surname2', 652 'surname2' => 'surname2',
654 'subscribe_email' => '1', 653 'subscribe_email' => '1',
655 'email' => 'email@mail.com', 654 'email' => 'email@mail.com',
656 'telephone' => '1234567890', 655 'telephone' => '1234567890',
657 'password' => Hash::make('password'), 656 'password' => Hash::make('password'),
658 'pubpassword' => base64_encode('password'), 657 'pubpassword' => base64_encode('password'),
659 // 'email_verified_at' => Carbon::now(), 658 // 'email_verified_at' => Carbon::now(),
660 'is_worker' => 1, 659 'is_worker' => 1,
661 ]); 660 ]);
662 661
663 if ($Code_user->id > 0) { 662 if ($Code_user->id > 0) {
664 $Worker = new Worker(); 663 $Worker = new Worker();
665 $Worker->user_id = $Code_user->id; 664 $Worker->user_id = $Code_user->id;
666 $Worker->position_work = 1; //'job_titles'; 665 $Worker->position_work = 1; //'job_titles';
667 $Worker->email = 'email@email.com'; 666 $Worker->email = 'email@email.com';
668 $Worker->telephone = '1234567890'; 667 $Worker->telephone = '1234567890';
669 $status = $Worker->save(); 668 $status = $Worker->save();
670 669
671 $Title_Worker = new Title_worker(); 670 $Title_Worker = new Title_worker();
672 $Title_Worker->worker_id = $Worker->id; 671 $Title_Worker->worker_id = $Worker->id;
673 $Title_Worker->job_title_id = 1; 672 $Title_Worker->job_title_id = 1;
674 $Title_Worker->save(); 673 $Title_Worker->save();
675 } 674 }
676 } 675 }
677 676
678 // Создание пользователя 677 // Создание пользователя
679 protected function create(array $data) 678 protected function create(array $data)
680 { 679 {
681 $Use = new User(); 680 $Use = new User();
682 681
683 $Code_user = $Use->create([ 682 $Code_user = $Use->create([
684 'name' => $data['surname']." ".$data['name_man'], 683 'name' => $data['surname']." ".$data['name_man'],
685 'name_man' => $data['name_man'], 684 'name_man' => $data['name_man'],
686 'surname' => $data['surname'], 685 'surname' => $data['surname'],
687 'surname2' => $data['surname2'], 686 'surname2' => $data['surname2'],
688 'subscribe_email' => $data['email'], 687 'subscribe_email' => $data['email'],
689 'email' => $data['email'], 688 'email' => $data['email'],
690 'telephone' => $data['telephone'], 689 'telephone' => $data['telephone'],
691 'password' => Hash::make($data['password']), 690 'password' => Hash::make($data['password']),
692 'pubpassword' => base64_encode($data['password']), 691 'pubpassword' => base64_encode($data['password']),
693 'is_worker' => $data['is_worker'], 692 'is_worker' => $data['is_worker'],
694 ]); 693 ]);
695 694
696 if ($Code_user->id > 0) { 695 if ($Code_user->id > 0) {
697 $Worker = new Worker(); 696 $Worker = new Worker();
698 $Worker->user_id = $Code_user->id; 697 $Worker->user_id = $Code_user->id;
699 $Worker->position_work = $data['job_titles'] ?? null; 698 $Worker->position_work = $data['job_titles'] ?? null;
700 $Worker->email = $data['email']; 699 $Worker->email = $data['email'];
701 $Worker->telephone = $data['telephone']; 700 $Worker->telephone = $data['telephone'];
702 $Worker->save(); 701 $Worker->save();
703 702
704 if (isset($Worker->id) && !empty($data['job_titles'])) { 703 if (isset($Worker->id) && !empty($data['job_titles'])) {
705 $existJob = Job_title::query()->find($data['job_titles']); 704 $existJob = Job_title::query()->find($data['job_titles']);
706 if ($existJob) { 705 if ($existJob) {
707 $Title_Worker = new Title_worker(); 706 $Title_Worker = new Title_worker();
708 $Title_Worker->worker_id = $Worker->id; 707 $Title_Worker->worker_id = $Worker->id;
709 $Title_Worker->job_title_id = $data['job_titles']; 708 $Title_Worker->job_title_id = $data['job_titles'];
710 $Title_Worker->save(); 709 $Title_Worker->save();
711 } 710 }
712 711
713 } 712 }
714 713
715 return $Code_user; 714 return $Code_user;
716 } 715 }
717 } 716 }
718 717
719 // Вакансии избранные 718 // Вакансии избранные
720 public function colorado(Request $request) { 719 public function colorado(Request $request) {
721 $Arr = Like_vacancy::Query() 720 $Arr = Like_vacancy::Query()
722 ->select('code_record') 721 ->select('code_record')
723 ->where('user_id', Auth::user()->id) 722 ->where('user_id', Auth::user()->id)
724 ->get(); 723 ->get();
725 724
726 if ($Arr->count()) { 725 if ($Arr->count()) {
727 $A = Array(); 726 $A = Array();
728 foreach ($Arr as $it) { 727 foreach ($Arr as $it) {
729 $A[] = $it->code_record; 728 $A[] = $it->code_record;
730 } 729 }
731 730
732 $Query = Ad_employer::query()->whereIn('id', $A); 731 $Query = Ad_employer::query()->whereIn('id', $A);
733 } else { 732 } else {
734 $Query = Ad_employer::query()->where('id', '=', '0'); 733 $Query = Ad_employer::query()->where('id', '=', '0');
735 } 734 }
736 735
737 $Query = $Query->with(['jobs', 'cat', 'employer']) 736 $Query = $Query->with(['jobs', 'cat', 'employer'])
738 ->whereHas('jobs_code', function ($query) use ($request) { 737 ->whereHas('jobs_code', function ($query) use ($request) {
739 if ($request->ajax()) { 738 if ($request->ajax()) {
740 if (null !== ($request->get('job'))) { 739 if (null !== ($request->get('job'))) {
741 $query->where('job_title_id', $request->get('job')); 740 $query->where('job_title_id', $request->get('job'));
742 } 741 }
743 } 742 }
744 }) 743 })
745 ->select('ad_employers.*'); 744 ->select('ad_employers.*');
746 745
747 if ($request->get('search') !== null) { 746 if ($request->get('search') !== null) {
748 $search = $request->get('search'); 747 $search = $request->get('search');
749 $Query->where('name', 'LIKE', "%$search%"); 748 $Query->where('name', 'LIKE', "%$search%");
750 } 749 }
751 750
752 //dd($Query->get()); 751 //dd($Query->get());
753 752
754 $Job_title = Job_title::query()->OrderBy('name')->get(); 753 $Job_title = Job_title::query()->OrderBy('name')->get();
755 754
756 $Query_count = $Query->count(); 755 $Query_count = $Query->count();
757 756
758 $Query = $Query->OrderBy('updated_at')->paginate(3); 757 $Query = $Query->OrderBy('updated_at')->paginate(3);
759 758
760 return view('workers.favorite', compact('Query', 759 return view('workers.favorite', compact('Query',
761 'Query_count', 760 'Query_count',
762 'Job_title')); 761 'Job_title'));
763 762
764 } 763 }
765 public function pin_chat(Request $request){ 764 public function pin_chat(Request $request){
766 $chat_id = $request->get('id'); 765 $chat_id = $request->get('id');
767 $is_fixed = $request->get('is_fixed'); 766 $is_fixed = $request->get('is_fixed');
768 Chat::pin_chat($chat_id, $is_fixed); 767 Chat::pin_chat($chat_id, $is_fixed);
769 } 768 }
770 //Переписка 769 //Переписка
771 public function dialog(Chat $chat, Request $request) { 770 public function dialog(Chat $chat, Request $request) {
772 // Получение параметров. 771 // Получение параметров.
773 if ($request->has('ad_employer')){ 772 if ($request->has('ad_employer')){
774 $ad_employer = $request->get('ad_employer'); 773 $ad_employer = $request->get('ad_employer');
775 } else { 774 } else {
776 $ad_employer = 0; 775 $ad_employer = 0;
777 } 776 }
778 $supeAdmin=User::superAdmin(); 777 $supeAdmin=User::superAdmin();
779 $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first(); 778 $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first();
780 $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first(); 779 $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first();
781 780
782 $Messages = Chat::get_chat_messages($chat); 781 $Messages = Chat::get_chat_messages($chat);
783 782
784 Message::where('chat_id_to', '=', $chat->id)->update(['flag_new' => 0]); 783 Message::where('chat_id_to', '=', $chat->id)->update(['flag_new' => 0]);
785 784
786 return view('workers.dialog', compact('companion', 'sender', 'chat', 'Messages', 'ad_employer','supeAdmin')); 785 return view('workers.dialog', compact('companion', 'sender', 'chat', 'Messages', 'ad_employer','supeAdmin'));
787 } 786 }
788 787
789 // Даунылоады 788 // Даунылоады
790 public function download(Worker $worker) { 789 public function download(Worker $worker) {
791 $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; 790 $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...'];
792 view()->share('house',$arr_house); 791 view()->share('house',$arr_house);
793 $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); 792 $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape');
794 return $pdf->stream(); 793 return $pdf->stream();
795 } 794 }
796 795
797 // Поднятие анкеты 796 // Поднятие анкеты
798 public function up(Worker $worker) { 797 public function up(Worker $worker) {
799 $worker->updated_at = Carbon::now(); 798 $worker->updated_at = Carbon::now();
800 $worker->save(); 799 $worker->save();
801 // 0 800 // 0
802 return redirect()->route('worker.cabinet')->with('success', 'Резюме подняли'); 801 return redirect()->route('worker.cabinet')->with('success', 'Резюме подняли');
803 } 802 }
804 803
805 // Форма сертификате 804 // Форма сертификате
806 public function new_sertificate(Worker $worker) { 805 public function new_sertificate(Worker $worker) {
807 return view('workers.sertificate_add', compact('worker')); 806 return view('workers.sertificate_add', compact('worker'));
808 } 807 }
809 808
810 // Добавление сертификата 809 // Добавление сертификата
811 public function add_serificate(SertificationRequest $request) { 810 public function add_serificate(SertificationRequest $request) {
812 $request->validate([ 811 $request->validate([
813 'name' => 'required|string|max:255', 812 'name' => 'required|string|max:255',
814 'end_begin' => 'required|date|date_format:d.m.Y' 813 'end_begin' => 'required|date|date_format:d.m.Y'
815 ], 814 ],
816 [ 815 [
817 'name' => 'Навание сертификата обязательно для заполнения.', 816 'name' => 'Навание сертификата обязательно для заполнения.',
818 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' 817 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг'
819 ]); 818 ]);
820 819
821 $params = $request->all(); 820 $params = $request->all();
822 821
823 $end_begin = DateTime::createFromFormat('d.m.Y', $params['end_begin']); 822 $end_begin = DateTime::createFromFormat('d.m.Y', $params['end_begin']);
824 $params['end_begin'] = $end_begin->format('Y-m-d'); 823 $params['end_begin'] = $end_begin->format('Y-m-d');
825 824
826 $Sertificate = new sertification(); 825 $Sertificate = new sertification();
827 $Sertificate->create($params); 826 $Sertificate->create($params);
828 827
829 return response()->json([ 828 return response()->json([
830 'success' => true 829 'success' => true
831 ]); 830 ]);
832 } 831 }
833 832
834 // Удалить сертификат 833 // Удалить сертификат
835 public function delete_sertificate(sertification $doc) { 834 public function delete_sertificate(sertification $doc) {
836 $doc->delete(); 835 $doc->delete();
837 836
838 return redirect()->route('worker.cabinet'); 837 return redirect()->route('worker.cabinet');
839 } 838 }
840 839
841 // Редактирование сертификата 840 // Редактирование сертификата
842 public function edit_sertificate(Worker $worker, sertification $doc) { 841 public function edit_sertificate(Worker $worker, sertification $doc) {
843 return view('workers.sertificate_edit', compact('doc', 'worker')); 842 return view('workers.sertificate_edit', compact('doc', 'worker'));
844 } 843 }
845 844
846 // Редактирование обновление сертификата 845 // Редактирование обновление сертификата
847 public function update_serificate(SertificationRequest $request, sertification $doc) { 846 public function update_serificate(SertificationRequest $request, sertification $doc) {
848 $request->validate([ 847 $request->validate([
849 'name' => 'required|string|max:255', 848 'name' => 'required|string|max:255',
850 'end_begin' => 'required|date|date_format:d.m.Y' 849 'end_begin' => 'required|date|date_format:d.m.Y'
851 ], 850 ],
852 [ 851 [
853 'name' => 'Навание сертификата обязательно для заполнения.', 852 'name' => 'Навание сертификата обязательно для заполнения.',
854 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' 853 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг'
855 ]); 854 ]);
856 855
857 $all = $request->all(); 856 $all = $request->all();
858 857
859 $end_begin = DateTime::createFromFormat('d.m.Y', $all['end_begin']); 858 $end_begin = DateTime::createFromFormat('d.m.Y', $all['end_begin']);
860 $all['end_begin'] = $end_begin->format('Y-m-d'); 859 $all['end_begin'] = $end_begin->format('Y-m-d');
861 860
862 $doc->worker_id = $all['worker_id']; 861 $doc->worker_id = $all['worker_id'];
863 $doc->name = $all['name']; 862 $doc->name = $all['name'];
864 $doc->end_begin = $all['end_begin']; 863 $doc->end_begin = $all['end_begin'];
865 $doc->save(); 864 $doc->save();
866 865
867 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); 866 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!');
868 } 867 }
869 868
870 public function edit_diploms(Request $request, Worker $worker) { 869 public function edit_diploms(Request $request, Worker $worker) {
871 $dop_info_data = $request->input('diploms'); 870 $dop_info_data = $request->input('diploms');
872 871
873 if (empty($dop_info_data)) { 872 if (empty($dop_info_data)) {
874 return redirect()->route('worker.additional_documents')->with('error', 'Данные не предоставлены!'); 873 return redirect()->route('worker.additional_documents')->with('error', 'Данные не предоставлены!');
875 } 874 }
876 875
877 foreach ($dop_info_data as $infoblok_id => $status) { 876 foreach ($dop_info_data as $infoblok_id => $status) {
878 Dop_info::updateOrCreate( 877 Dop_info::updateOrCreate(
879 ['worker_id' => $worker->id, 'infoblok_id' => $infoblok_id], 878 ['worker_id' => $worker->id, 'infoblok_id' => $infoblok_id],
880 ['status' => $status] 879 ['status' => $status]
881 ); 880 );
882 } 881 }
883 882
884 return redirect()->route('worker.cabinet')->with('success', 'Успешно сохранено!'); 883 return redirect()->route('worker.cabinet')->with('success', 'Успешно сохранено!');
885 } 884 }
886 public function subscribe() { 885 public function subscribe() {
887 886
888 $user= Auth::user(); 887 $user= Auth::user();
889 return view('workers.subcribe',compact('user')); 888 return view('workers.subcribe',compact('user'));
890 } 889 }
891 890
892 //Установка уведомлений сохранение 891 //Установка уведомлений сохранение
893 public function save_subscribe(Request $request) { 892 public function save_subscribe(Request $request) {
894 893
895 $msg = $request->validate([ 894 $msg = $request->validate([
896 'email' => 'required|email|min:5|max:255', 895 'email' => 'required|email|min:5|max:255',
897 ]); 896 ]);
898 897
899 $user= Auth::user(); 898 $user= Auth::user();
900 899
901 User_Model::updateOrCreate( 900 User_Model::updateOrCreate(
902 ['id' => $user->id], 901 ['id' => $user->id],
903 ['subscribe_email' => $request->email, 902 ['subscribe_email' => $request->email,
904 'subscribe' => request()->has('email_msg') && request('email_msg') === 'on' ? 1 : 0 903 'subscribe' => request()->has('email_msg') && request('email_msg') === 'on' ? 1 : 0
905 ] 904 ]
906 ); 905 );
907 return redirect()->route('worker.subscribe')->with('success', 'Ваши изменения успешно сохранены'); 906 return redirect()->route('worker.subscribe')->with('success', 'Ваши изменения успешно сохранены');
908 907
909 } 908 }
910 public function delete_add_diplom(Request $request, Worker $worker) { 909 public function delete_add_diplom(Request $request, Worker $worker) {
911 $infoblok_id = $request->get('infoblok_id'); 910 $infoblok_id = $request->get('infoblok_id');
912 911
913 if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) 912 if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0)
914 $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); 913 $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete();
915 else { 914 else {
916 $params['infoblok_id'] = $infoblok_id; 915 $params['infoblok_id'] = $infoblok_id;
917 $params['worker_id'] = $worker->id; 916 $params['worker_id'] = $worker->id;
918 $params['status'] = $request->get('val'); 917 $params['status'] = $request->get('val');
919 $id = Dop_info::create($params); 918 $id = Dop_info::create($params);
920 //$id = $worker->infobloks()->sync([$infoblok_id]); 919 //$id = $worker->infobloks()->sync([$infoblok_id]);
921 } 920 }
922 921
923 //$Infoblocks = infobloks::query()->get(); 922 //$Infoblocks = infobloks::query()->get();
924 return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); 923 return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks'));
925 } 924 }
926 925
927 926
928 927
929 // Добавление диплома 928 // Добавление диплома
930 public function add_diplom_ajax(Request $request) { 929 public function add_diplom_ajax(Request $request) {
931 // конец 930 // конец
932 $params = $request->all(); 931 $params = $request->all();
933 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); 932 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count();
934 933
935 if ($count == 0) $dop_info = Dop_info::create($params); 934 if ($count == 0) $dop_info = Dop_info::create($params);
936 $Infoblocks = infobloks::query()->get(); 935 $Infoblocks = infobloks::query()->get();
937 $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); 936 $Worker = Worker::query()->where('id', $request->get('worker_id'))->get();
938 $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); 937 $data = Dop_info::query()->where('worker_id', $request->has('worker_id'));
939 return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); 938 return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker'));
940 } 939 }
941 940
942 // Добавление диплома без ajax 941 // Добавление диплома без ajax
943 public function add_diplom(Worker $worker) { 942 public function add_diplom(Worker $worker) {
944 $worker_id = $worker->id; 943 $worker_id = $worker->id;
945 $Infoblocks = infobloks::query()->get(); 944 $Infoblocks = infobloks::query()->get();
946 return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); 945 return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks'));
947 } 946 }
948 // Сохранить 947 // Сохранить
949 // Сохраняю диплом 948 // Сохраняю диплом
950 public function add_diplom_save(Request $request) { 949 public function add_diplom_save(Request $request) {
951 $params = $request->all(); 950 $params = $request->all();
952 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); 951 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count();
953 if ($count == 0) $dop_info = Dop_info::create($params); 952 if ($count == 0) $dop_info = Dop_info::create($params);
954 return redirect()->route('worker.cabinet'); 953 return redirect()->route('worker.cabinet');
955 } 954 }
956 955
957 // Добавление стандартного документа 956 // Добавление стандартного документа
958 public function add_document(Worker $worker) { 957 public function add_document(Worker $worker) {
959 return view('workers.docs', compact('worker')); 958 return view('workers.docs', compact('worker'));
960 } 959 }
961 960
962 //Сохранение стандартого документа 961 //Сохранение стандартого документа
963 public function add_document_save(DocumentsRequest $request) { 962 public function add_document_save(DocumentsRequest $request) {
964 $params = $request->all(); 963 $params = $request->all();
965 place_works::create($params); 964 place_works::create($params);
966 return response()->json(['success' => true]); 965 return response()->json(['success' => true]);
967 } 966 }
968 967
969 // Редактирование документа 968 // Редактирование документа
970 public function edit_document(place_works $doc, Worker $worker) { 969 public function edit_document(place_works $doc, Worker $worker) {
971 970
972 return view('workers.docs-edit', compact('doc', 'worker')); 971 return view('workers.docs-edit', compact('doc', 'worker'));
973 } 972 }
974 973
975 //Сохранение отредактированного документа 974 //Сохранение отредактированного документа
976 public function edit_document_save(DocumentsRequest $request, place_works $doc) { 975 public function edit_document_save(DocumentsRequest $request, place_works $doc) {
977 $params = $request->all(); 976 $params = $request->all();
978 $doc->update($params); 977 $doc->update($params);
979 978
980 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); 979 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!');
981 } 980 }
982 981
983 // Удаление документа 982 // Удаление документа
984 public function delete_document(place_works $doc) { 983 public function delete_document(place_works $doc) {
985 $doc->delete(); 984 $doc->delete();
986 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); 985 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!');
987 } 986 }
988 987
989 //Отправка нового сообщения 988 //Отправка нового сообщения
990 public function new_message(Request $request) 989 public function new_message(Request $request)
991 { 990 {
992 $params = $request->all(); 991 $params = $request->all();
993 992
994 $id = $params['user_from']; 993 $id = $params['user_from'];
995 994
996 Message::add_message( 995 Message::add_message(
997 $request, 996 $request,
998 $params['user_from'], 997 $params['user_from'],
999 $params['user_to'], 998 $params['user_to'],
1000 [ 999 [
1001 'text' => $params['comment'] ?? null, 1000 'text' => $params['comment'] ?? null,
1002 'ad_employer_id' => $params['vacancy'], 1001 'ad_employer_id' => $params['vacancy'],
1003 'flag_new' => 1 1002 'flag_new' => 1
1004 ], 1003 ],
1005 file_store_path: "worker/$id" 1004 file_store_path: "worker/$id"
1006 ); 1005 );
1007 1006
1008 if ($request->ajax()) { 1007 if ($request->ajax()) {
1009 return response([]); 1008 return response([]);
1010 } 1009 }
1011 return redirect()->back(); 1010 return redirect()->back();
1012 } 1011 }
1013 1012
1014 1013
1015 public function test123(Request $request) { 1014 public function test123(Request $request) {
1016 $params = $request->all(); 1015 $params = $request->all();
1017 $user1 = $params['user_id']; 1016 $user1 = $params['user_id'];
1018 $user2 = $params['to_user_id']; 1017 $user2 = $params['to_user_id'];
1019 1018
1020 $rules = [ 1019 $rules = [
1021 'text' => 'nullable|required_without:file|min:1|max:150000', 1020 'text' => 'nullable|required_without:file|min:1|max:150000',
1022 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' 1021 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000'
1023 ]; 1022 ];
1024 $messages = [ 1023 $messages = [
1025 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', 1024 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен',
1026 'min' => [ 1025 'min' => [
1027 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 1026 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
1028 'integer' => 'Поле «:attribute» должно быть :min или больше', 1027 'integer' => 'Поле «:attribute» должно быть :min или больше',
1029 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 1028 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
1030 ], 1029 ],
1031 'max' => [ 1030 'max' => [
1032 'string' => 'Поле «:attribute» должно быть не больше :max символов', 1031 'string' => 'Поле «:attribute» должно быть не больше :max символов',
1033 'integer' => 'Поле «:attribute» должно быть :max или меньше', 1032 'integer' => 'Поле «:attribute» должно быть :max или меньше',
1034 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 1033 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
1035 ] 1034 ]
1036 ]; 1035 ];
1037 1036
1038 $validator = Validator::make($request->all(), $rules, $messages); 1037 $validator = Validator::make($request->all(), $rules, $messages);
1039 1038
1040 if ($validator->fails()) { 1039 if ($validator->fails()) {
1041 $chat = Chat::where('user_id', $user1) 1040 $chat = Chat::where('user_id', $user1)
1042 ->where('to_user_id', $user2) 1041 ->where('to_user_id', $user2)
1043 ->where('is_removed', 0) 1042 ->where('is_removed', 0)
1044 ->first(); 1043 ->first();
1045 1044
1046 if ($chat->id){ 1045 if ($chat->id){
1047 return redirect()->route('worker.dialog', ['chat' => $chat->id])->withErrors($validator); 1046 return redirect()->route('worker.dialog', ['chat' => $chat->id])->withErrors($validator);
1048 } else { 1047 } else {
1049 return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); 1048 return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator);
1050 } 1049 }
1051 } else { 1050 } else {
1052 $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); 1051 $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages');
1053 1052
1054 //dd('new message', $new_message); 1053 //dd('new message', $new_message);
1055 return redirect()->route('worker.dialog', ['chat' => $new_message->chat_id_from]); 1054 return redirect()->route('worker.dialog', ['chat' => $new_message->chat_id_from]);
1056 } 1055 }
1057 } 1056 }
1058 1057
1059 // Информация о предыдущих компаниях 1058 // Информация о предыдущих компаниях
1060 public function new_prev_company(Worker $worker) { 1059 public function new_prev_company(Worker $worker) {
1061 return view('workers.prev_company_form', compact('worker')); 1060 return view('workers.prev_company_form', compact('worker'));
1062 } 1061 }
1063 1062
1064 // Добавление контакта компании 1063 // Добавление контакта компании
1065 public function add_prev_company(PrevCompanyRequest $request) { 1064 public function add_prev_company(PrevCompanyRequest $request) {
1066 // Возвращение параметров 1065 // Возвращение параметров
1067 $all = $request->all(); 1066 $all = $request->all();
1068 PrevCompany::create($all); 1067 PrevCompany::create($all);
1069 1068
1070 return response()->json(['success' => true]); 1069 return response()->json(['success' => true]);
1071 } 1070 }
1072 1071
1073 // Редактирование контакта компании 1072 // Редактирование контакта компании
1074 public function edit_prev_company(PrevCompany $doc, Worker $worker) { 1073 public function edit_prev_company(PrevCompany $doc, Worker $worker) {
1075 return view('workers.prev_company_edit_form', compact('doc', 'worker')); 1074 return view('workers.prev_company_edit_form', compact('doc', 'worker'));
1076 } 1075 }
1077 1076
1078 //Сохранение редактирования контакта компании 1077 //Сохранение редактирования контакта компании
1079 public function update_prev_company(PrevCompany $doc, Request $request){ 1078 public function update_prev_company(PrevCompany $doc, Request $request){
1080 $all = $request->all(); 1079 $all = $request->all();
1081 $doc->update($all); 1080 $doc->update($all);
1082 1081
1083 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); 1082 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись');
1084 } 1083 }
1085 1084
1086 // Удаление контакта предыдущей компании 1085 // Удаление контакта предыдущей компании
1087 public function delete_prev_company(PrevCompany $doc) { 1086 public function delete_prev_company(PrevCompany $doc) {
1088 $doc->delete(); 1087 $doc->delete();
1089 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); 1088 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!');
1090 } 1089 }
1091 1090
1092 public function autoresponder() 1091 public function autoresponder()
1093 { 1092 {
1094 $user = Auth::user(); 1093 $user = Auth::user();
1095 return view('workers.autoresponder', compact('user')); 1094 return view('workers.autoresponder', compact('user'));
1096 } 1095 }
1097 1096
1098 public function autoresponderSave(Request $request): RedirectResponse 1097 public function autoresponderSave(Request $request): RedirectResponse
1099 { 1098 {
1100 /** @var Employer $employer */ 1099 /** @var Employer $employer */
1101 $employer = Auth::user(); 1100 $employer = Auth::user();
1102 $employer->autoresponder = $request->get('autoresponder', false) === 'on'; 1101 $employer->autoresponder = $request->get('autoresponder', false) === 'on';
1103 $employer->autoresponder_message = $request->get('autoresponder_message'); 1102 $employer->autoresponder_message = $request->get('autoresponder_message');
1104 $employer->save(); 1103 $employer->save();
1105 1104
1106 return redirect(route('worker.autoresponder')); 1105 return redirect(route('worker.autoresponder'));
1107 } 1106 }
1108 /** 1107 /**
1109 * @throws JsonException 1108 * @throws JsonException
1110 */ 1109 */
1111 public function resumeAutoLiftForm(): View 1110 public function resumeAutoLiftForm(): View
1112 { 1111 {
1113 $worker = Auth::user()->workers[0]; 1112 $worker = Auth::user()->workers[0];
1114 1113
1115 $options = $worker->autoliftOptions ?? new WorkerAutoliftOption(); 1114 $options = $worker->autoliftOptions ?? new WorkerAutoliftOption();
1116 1115
1117 return view('workers.resume_autolift', compact('worker', 'options')); 1116 return view('workers.resume_autolift', compact('worker', 'options'));
1118 } 1117 }
1119 1118
1120 /** 1119 /**
1121 * @throws JsonException 1120 * @throws JsonException
1122 */ 1121 */
1123 public function resumeAutoLiftSave(Request $request) 1122 public function resumeAutoLiftSave(Request $request)
1124 { 1123 {
1125 $worker = Auth::user()->workers[0]; 1124 $worker = Auth::user()->workers[0];
1126 1125
1127 $worker->autoliftOptions()->updateOrCreate( 1126 $worker->autoliftOptions()->updateOrCreate(
1128 [ 1127 [
1129 'worker_id' => $worker->id, 1128 'worker_id' => $worker->id,
1130 ], 1129 ],
1131 [ 1130 [
1132 'is_enabled' => $request->get('is_enabled') === 'true', 1131 'is_enabled' => $request->get('is_enabled') === 'true',
1133 'times_per_day' => $request->get('times_per_day'), 1132 'times_per_day' => $request->get('times_per_day'),
1134 'days_repeat' => $request->get('days_repeat'), 1133 'days_repeat' => $request->get('days_repeat'),
1135 'time_send_first' => $request->get('time_send_first'), 1134 'time_send_first' => $request->get('time_send_first'),
1136 'time_send_second' => $request->get('time_send_second'), 1135 'time_send_second' => $request->get('time_send_second'),
1137 'time_send_third' => $request->get('time_send_third'), 1136 'time_send_third' => $request->get('time_send_third'),
1138 'time_send_tg' => $request->get('time_send_tg'), 1137 'time_send_tg' => $request->get('time_send_tg'),
1139 'autolift_site' => $request->get('autolift_site') === 'on', 1138 'autolift_site' => $request->get('autolift_site') === 'on',
1140 ] 1139 ]
1141 ); 1140 );
1142 1141
1143 return response()->json(['success' => true]); 1142 return response()->json(['success' => true]);
1144 } 1143 }
1145 } 1144 }
1146 1145
1147 1146
resources/views/modals/register.blade.php
1 <style> 1 <style>
2 #captcha { 2 #captcha {
3 background-color: #d0d0d0; 3 background-color: #d0d0d0;
4 } 4 }
5 5
6 #captcha2 { 6 #captcha2 {
7 background-color: #d0d0d0; 7 background-color: #d0d0d0;
8 } 8 }
9 </style> 9 </style>
10 10
11 @include('modals.successful_registration_worker') 11 @include('modals.successful_registration_worker')
12 @include('modals.successful_registration_employer') 12 @include('modals.successful_registration_employer')
13 13
14 <div id="reg" class="modal"> 14 <div id="reg" class="modal">
15 <div class="modal__body"> 15 <div class="modal__body">
16 <div class="modal__title left">Регистрация</div> 16 <div class="modal__title left">Регистрация</div>
17 <div class="notify notify_red" style="display:none" id="block-info"> 17 <div class="notify notify_red" style="display:none" id="block-info">
18 <svg> 18 <svg>
19 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> 19 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use>
20 </svg><br> 20 </svg><br>
21 <span id="messages_error_reg" name="messages_error_reg"></span> 21 <span id="messages_error_reg" name="messages_error_reg"></span>
22 </div> 22 </div>
23 <div class="modal__tabs"> 23 <div class="modal__tabs">
24 <button type="button" class="modal__tabs-item button button_light active" data-tab="1">Кандидат</button> 24 <button type="button" class="modal__tabs-item button button_light active" data-tab="1">Кандидат</button>
25 <button type="button" class="modal__tabs-item button button_light" data-tab="2">Работодатель</button> 25 <button type="button" class="modal__tabs-item button button_light" data-tab="2">Работодатель</button>
26 </div> 26 </div>
27 <form class="modal__reg showed" data-body="1" id="form1" name="form1" onsubmit="return validateCaptcha()" method="POST" action="{{ route('register_worker') }}"> 27 <form class="modal__reg showed" data-body="1" id="form1" name="form1" onsubmit="return validateCaptcha()" method="POST" action="{{ route('register_worker') }}">
28 @csrf 28 @csrf
29 <input type="hidden" name="is_worker" id="is_worker" value="1"/> 29 <input type="hidden" name="is_worker" id="is_worker" value="1"/>
30 30
31 <div class="modal__reg-item form-group"> 31 <div class="modal__reg-item form-group">
32 <label class="form-group__label">Электронная почта *</label> 32 <label class="form-group__label">Электронная почта *</label>
33 <div class="form-group__item"> 33 <div class="form-group__item">
34 <input type="email" id="email_worker" name="email" class="input" placeholder="info@rekamore.su"> 34 <input type="email" id="email_worker" name="email" class="input" placeholder="info@rekamore.su">
35 <span id="email_error" class="error-message"></span> 35 <span id="email_error" class="error-message"></span>
36 </div> 36 </div>
37 </div> 37 </div>
38 38
39 <div class="modal__reg-item form-group"> 39 <div class="modal__reg-item form-group">
40 <label class="form-group__label">Пароль *</label> 40 <label class="form-group__label">Пароль *</label>
41 <div class="form-group__item"> 41 <div class="form-group__item">
42 <input type="password" id="password_worker" name="password" class="input" placeholder="**********"> 42 <input type="password" id="password_worker" name="password" class="input" placeholder="**********">
43 <button type="button" class="eye"> 43 <button type="button" class="eye">
44 <svg class="js-password-show"> 44 <svg class="js-password-show">
45 <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> 45 <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use>
46 </svg> 46 </svg>
47 <svg class="js-password-hide"> 47 <svg class="js-password-hide">
48 <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use> 48 <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use>
49 </svg> 49 </svg>
50 </button> 50 </button>
51 <span id="password_error" class="error-message"></span> 51 <span id="password_error" class="error-message"></span>
52 </div> 52 </div>
53 </div> 53 </div>
54 54
55 <div class="modal__reg-item form-group"> 55 <div class="modal__reg-item form-group">
56 <label class="form-group__label">Подтвердить пароль *</label> 56 <label class="form-group__label">Подтвердить пароль *</label>
57 <div class="form-group__item"> 57 <div class="form-group__item">
58 <input type="password" id="password_confirmation_worker" name="password_confirmation" class="input" placeholder="**********"> 58 <input type="password" id="password_confirmation_worker" name="password_confirmation" class="input" placeholder="**********">
59 <button type="button" class="eye"> 59 <button type="button" class="eye">
60 <svg class="js-password-show"> 60 <svg class="js-password-show">
61 <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> 61 <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use>
62 </svg> 62 </svg>
63 <svg class="js-password-hide"> 63 <svg class="js-password-hide">
64 <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use> 64 <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use>
65 </svg> 65 </svg>
66 </button> 66 </button>
67 </div> 67 </div>
68 <span id="password_confirmation_error" class="error-message"></span> 68 <span id="password_confirmation_error" class="error-message"></span>
69 </div> 69 </div>
70 70
71 <div class="modal__reg-item form-group"> 71 <div class="modal__reg-item form-group">
72 <label class="form-group__label">Фамилия *</label> 72 <label class="form-group__label">Фамилия *</label>
73 <div class="form-group__item"> 73 <div class="form-group__item">
74 <input type="text" id="surname_worker" name="surname" class="input" placeholder="Шестаков"> 74 <input type="text" id="surname_worker" name="surname" class="input" placeholder="Шестаков">
75 <span id="surname_error" class="error-message"></span> 75 <span id="surname_error" class="error-message"></span>
76 </div> 76 </div>
77 </div> 77 </div>
78 78
79 <div class="modal__reg-item form-group"> 79 <div class="modal__reg-item form-group">
80 <label class="form-group__label">Имя *</label> 80 <label class="form-group__label">Имя *</label>
81 <div class="form-group__item"> 81 <div class="form-group__item">
82 <input type="text" id="name_man_worker" name="name_man" class="input" placeholder="Андрей"> 82 <input type="text" id="name_man_worker" name="name_man" class="input" placeholder="Андрей">
83 <span id="name_man_error" class="error-message"></span> 83 <span id="name_man_error" class="error-message"></span>
84 </div> 84 </div>
85 </div> 85 </div>
86 86
87 <div class="modal__reg-item form-group"> 87 <div class="modal__reg-item form-group">
88 <label class="form-group__label">Отчество</label> 88 <label class="form-group__label">Отчество</label>
89 <div class="form-group__item"> 89 <div class="form-group__item">
90 <input type="text" id="surname2_worker" name="surname2" class="input" placeholder="Васильевич"> 90 <input type="text" id="surname2_worker" name="surname2" class="input" placeholder="Васильевич">
91 </div> 91 </div>
92 </div> 92 </div>
93 <!-- 93 <!--
94 <div class="modal__reg-item form-group"> 94 <div class="modal__reg-item form-group">
95 <label class="form-group__label">Должность</label> 95 <label class="form-group__label">Должность</label>
96 <div class="form-group__item"> 96 <div class="form-group__item">
97 <input type="text" class="input" placeholder="Палуба" required> 97 <input type="text" class="input" placeholder="Палуба" required>
98 </div> 98 </div>
99 </div>--> 99 </div>-->
100 100
101 <div class="modal__reg-item form-group"> 101 <div class="modal__reg-item form-group">
102 <label class="form-group__label">Должность</label> 102 <label class="form-group__label">Должность</label>
103 <div class="form-group__item"> 103 <div class="form-group__item">
104 <div class="select"> 104 <div class="select">
105 <select class="js-select2" name="job_titles" id="job_titles_worker"> 105 <select class="js-select2" name="job_titles" id="job_titles_worker">
106 <option selected>Не указано</option> 106 <option value="" selected>Не указано</option>
107 @if ($Job_titles->count()) 107 @if ($Job_titles->count())
108 @foreach($Job_titles as $it) 108 @foreach($Job_titles as $it)
109 <option value="{{ $it->id }}">{{ $it->name }}</option> 109 <option value="{{ $it->id }}">{{ $it->name }}</option>
110 @endforeach 110 @endforeach
111 @endif 111 @endif
112 </select> 112 </select>
113 <span id="job_titles_error" class="error-message"></span> 113 <span id="job_titles_error" class="error-message"></span>
114 </div> 114 </div>
115 </div> 115 </div>
116 </div> 116 </div>
117 117
118 <div class="modal__reg-item form-group"> 118 <div class="modal__reg-item form-group">
119 <label class="form-group__label">Номер телефона</label> 119 <label class="form-group__label">Номер телефона</label>
120 <div class="form-group__item"> 120 <div class="form-group__item">
121 <input type="tel" name="telephone" id="telephone_worker" class="input" placeholder="+7 (___) ___-__-__"> 121 <input type="tel" name="telephone" id="telephone_worker" class="input" placeholder="+7 (___) ___-__-__">
122 <span id="telephone_error" class="error-message"></span> 122 <span id="telephone_error" class="error-message"></span>
123 </div> 123 </div>
124 </div> 124 </div>
125 <!--<div class="modal__reg-item"> 125 <!--<div class="modal__reg-item">
126 <img src="images/catpcha.jpg" alt="" class="captcha"> 126 <img src="images/catpcha.jpg" alt="" class="captcha">
127 </div>--> 127 </div>-->
128 <div id="Reloadcapcha1" name="Reloadcapcha1" class="button">Обновить капчу</div> 128 <div id="Reloadcapcha1" name="Reloadcapcha1" class="button">Обновить капчу</div>
129 <div id="captcha1" style="width:190px" class="modal__reg-item form-group">321</div> 129 <div id="captcha1" style="width:190px" class="modal__reg-item form-group">321</div>
130 <input type="text" placeholder="Captcha" class="input registr-form__input" id="cpatchaTextBox1" style="width: 100%"/> 130 <input type="text" placeholder="Captcha" class="input registr-form__input" id="cpatchaTextBox1" style="width: 100%"/>
131 131
132 <div class="modal__reg-item"> 132 <div class="modal__reg-item">
133 <span id="captcha_error" class="error-message"></span> 133 <span id="captcha_error" class="error-message"></span>
134 <label class="checkbox"> 134 <label class="checkbox">
135 <input type="checkbox" name="politik" id="politik" value="1" class="checkbox__input"> 135 <input type="checkbox" name="politik" id="politik" value="1" class="checkbox__input">
136 <span class="checkbox__icon"> 136 <span class="checkbox__icon">
137 <svg> 137 <svg>
138 <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use> 138 <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use>
139 </svg> 139 </svg>
140 </span> 140 </span>
141 <span class="checkbox__text"> 141 <span class="checkbox__text">
142 <span> 142 <span>
143 Я согласен(на) с <a href="{{ route('page', ['pages' => 'Politika-konfidencialnosti']) }}">Политикой конфиденциальности</a> 143 Я согласен(на) с <a href="{{ route('page', ['pages' => 'Politika-konfidencialnosti']) }}">Политикой конфиденциальности</a>
144 </span> 144 </span>
145 </span> 145 </span>
146 </label> 146 </label>
147 <span id="politik_error" class="error-message"></span> 147 <span id="politik_error" class="error-message"></span>
148 </div> 148 </div>
149 <button type="submit" id="button_reg_worker" name="button_reg_worker" class="button">Зарегистрироваться</button> 149 <button type="submit" id="button_reg_worker" name="button_reg_worker" class="button">Зарегистрироваться</button>
150 </form> 150 </form>
151 151
152 <form class="modal__reg" data-body="2" id="form2" name="name2" onsubmit="return validateCaptcha2()" method="POST" action="{{ route('register_employer') }}"> 152 <form class="modal__reg" data-body="2" id="form2" name="name2" onsubmit="return validateCaptcha2()" method="POST" action="{{ route('register_employer') }}">
153 @csrf 153 @csrf
154 <div class="modal__reg-item form-group"> 154 <div class="modal__reg-item form-group">
155 <label class="form-group__label">Электронная почта *</label> 155 <label class="form-group__label">Электронная почта *</label>
156 <div class="form-group__item"> 156 <div class="form-group__item">
157 <input type="email" id="email_employer" name="email" class="input" placeholder="info@rekamore.su"> 157 <input type="email" id="email_employer" name="email" class="input" placeholder="info@rekamore.su">
158 <span id="email_employer_error" class="employer_error-message"></span> 158 <span id="email_employer_error" class="employer_error-message"></span>
159 </div> 159 </div>
160 </div> 160 </div>
161 <div class="modal__reg-item form-group"> 161 <div class="modal__reg-item form-group">
162 <label class="form-group__label">Пароль *</label> 162 <label class="form-group__label">Пароль *</label>
163 <div class="form-group__item"> 163 <div class="form-group__item">
164 <input type="password" id="password_employer" name="password" class="input" placeholder="**********"> 164 <input type="password" id="password_employer" name="password" class="input" placeholder="**********">
165 <button type="button" class="eye"> 165 <button type="button" class="eye">
166 <svg class="js-password-show"> 166 <svg class="js-password-show">
167 <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> 167 <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use>
168 </svg> 168 </svg>
169 <svg class="js-password-hide"> 169 <svg class="js-password-hide">
170 <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use> 170 <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use>
171 </svg> 171 </svg>
172 </button> 172 </button>
173 <span id="password_employer_error" class="employer_error-message"></span> 173 <span id="password_employer_error" class="employer_error-message"></span>
174 </div> 174 </div>
175 </div> 175 </div>
176 <div class="modal__reg-item form-group"> 176 <div class="modal__reg-item form-group">
177 <label class="form-group__label">Подтвердить пароль *</label> 177 <label class="form-group__label">Подтвердить пароль *</label>
178 <div class="form-group__item"> 178 <div class="form-group__item">
179 <input type="password" id="password_confirmation_employer" name="password_confirmation" class="input" placeholder="**********"> 179 <input type="password" id="password_confirmation_employer" name="password_confirmation" class="input" placeholder="**********">
180 <button type="button" class="eye"> 180 <button type="button" class="eye">
181 <svg class="js-password-show"> 181 <svg class="js-password-show">
182 <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> 182 <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use>
183 </svg> 183 </svg>
184 <svg class="js-password-hide"> 184 <svg class="js-password-hide">
185 <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use> 185 <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use>
186 </svg> 186 </svg>
187 </button> 187 </button>
188 </div> 188 </div>
189 <span id="password_confirmation_employer_error" class="employer_error-message"></span> 189 <span id="password_confirmation_employer_error" class="employer_error-message"></span>
190 </div> 190 </div>
191 191
192 192
193 <div class="modal__reg-item form-group"> 193 <div class="modal__reg-item form-group">
194 <label class="form-group__label">Фамилия работодателя *</label> 194 <label class="form-group__label">Фамилия работодателя *</label>
195 <div class="form-group__item"> 195 <div class="form-group__item">
196 <input type="text" id="surname_employer" name="surname" class="input" placeholder="Шестаков"> 196 <input type="text" id="surname_employer" name="surname" class="input" placeholder="Шестаков">
197 <span id="surname_employer_error" class="employer_error-message"></span> 197 <span id="surname_employer_error" class="employer_error-message"></span>
198 </div> 198 </div>
199 </div> 199 </div>
200 200
201 <div class="modal__reg-item form-group"> 201 <div class="modal__reg-item form-group">
202 <label class="form-group__label">Имя работодателя *</label> 202 <label class="form-group__label">Имя работодателя *</label>
203 <div class="form-group__item"> 203 <div class="form-group__item">
204 <input type="text" id="name_man_employer" name="name_man" class="input" placeholder="Андрей"> 204 <input type="text" id="name_man_employer" name="name_man" class="input" placeholder="Андрей">
205 </div> 205 </div>
206 </div> 206 </div>
207 207
208 <div class="modal__reg-item form-group"> 208 <div class="modal__reg-item form-group">
209 <label class="form-group__label">Отчество работодателя</label> 209 <label class="form-group__label">Отчество работодателя</label>
210 <div class="form-group__item"> 210 <div class="form-group__item">
211 <input type="text" id="surname2_employer" name="surname2" class="input" placeholder="Васильевич"> 211 <input type="text" id="surname2_employer" name="surname2" class="input" placeholder="Васильевич">
212 </div> 212 </div>
213 </div> 213 </div>
214 214
215 <div class="modal__reg-item form-group"> 215 <div class="modal__reg-item form-group">
216 <label class="form-group__label">Название судоходной компании *</label> 216 <label class="form-group__label">Название судоходной компании *</label>
217 <div class="form-group__item"> 217 <div class="form-group__item">
218 <input type="text" name="name_company" id="name_company_employer" class="input" placeholder="ООО Река Море"> 218 <input type="text" name="name_company" id="name_company_employer" class="input" placeholder="ООО Река Море">
219 <span id="name_company_employer_error" class="employer_error-message"></span> 219 <span id="name_company_employer_error" class="employer_error-message"></span>
220 </div> 220 </div>
221 </div> 221 </div>
222 222
223 <div class="modal__reg-item form-group"> 223 <div class="modal__reg-item form-group">
224 <label class="form-group__label">Номер телефона</label> 224 <label class="form-group__label">Номер телефона</label>
225 <div class="form-group__item"> 225 <div class="form-group__item">
226 <input type="tel" name="telephone" id="telephone_employer" class="input" placeholder="+7 (___) ___-__-__"> 226 <input type="tel" name="telephone" id="telephone_employer" class="input" placeholder="+7 (___) ___-__-__">
227 </div> 227 </div>
228 </div> 228 </div>
229 <!--<div class="modal__reg-item"> 229 <!--<div class="modal__reg-item">
230 <img src="images/catpcha.jpg" alt="" class="captcha"> 230 <img src="images/catpcha.jpg" alt="" class="captcha">
231 </div>--> 231 </div>-->
232 232
233 <div id="Reloadcapcha2" name="Reloadcapcha2" class="button">Обновить капчу</div> 233 <div id="Reloadcapcha2" name="Reloadcapcha2" class="button">Обновить капчу</div>
234 <div id="captcha2" style="width:190px" class="modal__reg-item form-group">123</div> 234 <div id="captcha2" style="width:190px" class="modal__reg-item form-group">123</div>
235 <input type="text" placeholder="Captcha" class="input registr-form__input" id="cpatchaTextBox2" style="width: 100%"/> 235 <input type="text" placeholder="Captcha" class="input registr-form__input" id="cpatchaTextBox2" style="width: 100%"/>
236 236
237 <div class="modal__reg-item"> 237 <div class="modal__reg-item">
238 <span id="captcha_employer_error" class="employer_error-message"></span> 238 <span id="captcha_employer_error" class="employer_error-message"></span>
239 <label class="checkbox"> 239 <label class="checkbox">
240 <input type="checkbox" name="politik" id="politik_employer" value="1" class="checkbox__input"> 240 <input type="checkbox" name="politik" id="politik_employer" value="1" class="checkbox__input">
241 <span class="checkbox__icon"> 241 <span class="checkbox__icon">
242 <svg> 242 <svg>
243 <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use> 243 <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use>
244 </svg> 244 </svg>
245 </span> 245 </span>
246 <span class="checkbox__text"> 246 <span class="checkbox__text">
247 <span> 247 <span>
248 Я согласен(на) с <a href="{{ route('page', ['pages' => 'Politika-konfidencialnosti']) }}">Политикой конфиденциальности</a> 248 Я согласен(на) с <a href="{{ route('page', ['pages' => 'Politika-konfidencialnosti']) }}">Политикой конфиденциальности</a>
249 </span> 249 </span>
250 </span> 250 </span>
251 </label> 251 </label>
252 <span id="politik_employer_error" class="employer_error-message"></span> 252 <span id="politik_employer_error" class="employer_error-message"></span>
253 </div> 253 </div>
254 <button type="submit" id="button_reg_employer" name="button_reg_employer" class="button">Зарегистрироваться</button> 254 <button type="submit" id="button_reg_employer" name="button_reg_employer" class="button">Зарегистрироваться</button>
255 </form> 255 </form>
256 <div class="modal__text"> 256 <div class="modal__text">
257 <span>Вспомнили пароль?</span> 257 <span>Вспомнили пароль?</span>
258 &nbsp; 258 &nbsp;
259 <a data-fancybox data-src="#sign" data-options='{"touch":false,"autoFocus":false}'>Войти</a> 259 <a data-fancybox data-src="#sign" data-options='{"touch":false,"autoFocus":false}'>Войти</a>
260 </div> 260 </div>
261 </div> 261 </div>
262 </div> 262 </div>
263 263