Commit cd59d5933aa3cb40d8c01507e9886a5dc81b3ae4

Authored by Hayk Nazaryan
Exists in master

Merge branch 'master' of http://gitlab.nologostudio.ru/alarionov/rekamore-su

Showing 10 changed files 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' => ['required', 'numeric']
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' => 'Укажите обязательное поле', 597 'numeric' => 'Укажите обязательное поле',
598 ]; 598 ];
599 599
600 $validator = Validator::make($request->all(), $rules, $messages); 600 $validator = Validator::make($request->all(), $rules, $messages);
601 601
602 if ($validator->fails()) { 602 if ($validator->fails()) {
603 return response()->json(['ERRORS' => $validator->errors()], 422); 603 return response()->json(['ERRORS' => $validator->errors()], 422);
604 } 604 }
605 605
606 $params = $request->all(); 606 $params = $request->all();
607 $params['is_worker'] = 1; 607 $params['is_worker'] = 1;
608 608
609 if ($user = $this->create($params)) { 609 if ($user = $this->create($params)) {
610 event(new Registered($user)); 610 event(new Registered($user));
611 return response()->json([ 611 return response()->json([
612 'REDIRECT' => url('/') 612 'REDIRECT' => url('/')
613 ]); 613 ]);
614 } 614 }
615 615
616 return response()->json([ 616 return response()->json([
617 'ERROR' => 'Произошла ошибка при регистрации. Попробуйте снова.' 617 'ERROR' => 'Произошла ошибка при регистрации. Попробуйте снова.'
618 ]); 618 ]);
619 } 619 }
620 620
621 // Звездная оценка и ответ 621 // Звездная оценка и ответ
622 public function stars_answer(Request $request) { 622 public function stars_answer(Request $request) {
623 $params = $request->all(); 623 $params = $request->all();
624 $rules = [ 624 $rules = [
625 'message' => ['required', 'string', 'max:255'], 625 'message' => ['required', 'string', 'max:255'],
626 ]; 626 ];
627 627
628 $messages = [ 628 $messages = [
629 'required' => 'Укажите обязательное поле', 629 'required' => 'Укажите обязательное поле',
630 'min' => [ 630 'min' => [
631 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 631 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
632 'integer' => 'Поле «:attribute» должно быть :min или больше', 632 'integer' => 'Поле «:attribute» должно быть :min или больше',
633 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 633 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
634 ], 634 ],
635 'max' => [ 635 'max' => [
636 'string' => 'Поле «:attribute» должно быть не больше :max символов', 636 'string' => 'Поле «:attribute» должно быть не больше :max символов',
637 'integer' => 'Поле «:attribute» должно быть :max или меньше', 637 'integer' => 'Поле «:attribute» должно быть :max или меньше',
638 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 638 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
639 ] 639 ]
640 ]; 640 ];
641 $response_worker = ResponseWork::create($params); 641 $response_worker = ResponseWork::create($params);
642 return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); 642 return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!');
643 } 643 }
644 644
645 public function TestWorker() 645 public function TestWorker()
646 { 646 {
647 $Use = new User(); 647 $Use = new User();
648 648
649 $Code_user = $Use->create([ 649 $Code_user = $Use->create([
650 'name' => 'surname name_man', 650 'name' => 'surname name_man',
651 'name_man' => 'name_man', 651 'name_man' => 'name_man',
652 'surname' => 'surname', 652 'surname' => 'surname',
653 'surname2' => 'surname2', 653 'surname2' => 'surname2',
654 'subscribe_email' => '1', 654 'subscribe_email' => '1',
655 'email' => 'email@mail.com', 655 'email' => 'email@mail.com',
656 'telephone' => '1234567890', 656 'telephone' => '1234567890',
657 'password' => Hash::make('password'), 657 'password' => Hash::make('password'),
658 'pubpassword' => base64_encode('password'), 658 'pubpassword' => base64_encode('password'),
659 // 'email_verified_at' => Carbon::now(), 659 // 'email_verified_at' => Carbon::now(),
660 'is_worker' => 1, 660 'is_worker' => 1,
661 ]); 661 ]);
662 662
663 if ($Code_user->id > 0) { 663 if ($Code_user->id > 0) {
664 $Worker = new Worker(); 664 $Worker = new Worker();
665 $Worker->user_id = $Code_user->id; 665 $Worker->user_id = $Code_user->id;
666 $Worker->position_work = 1; //'job_titles'; 666 $Worker->position_work = 1; //'job_titles';
667 $Worker->email = 'email@email.com'; 667 $Worker->email = 'email@email.com';
668 $Worker->telephone = '1234567890'; 668 $Worker->telephone = '1234567890';
669 $status = $Worker->save(); 669 $status = $Worker->save();
670 670
671 $Title_Worker = new Title_worker(); 671 $Title_Worker = new Title_worker();
672 $Title_Worker->worker_id = $Worker->id; 672 $Title_Worker->worker_id = $Worker->id;
673 $Title_Worker->job_title_id = 1; 673 $Title_Worker->job_title_id = 1;
674 $Title_Worker->save(); 674 $Title_Worker->save();
675 } 675 }
676 } 676 }
677 677
678 // Создание пользователя 678 // Создание пользователя
679 protected function create(array $data) 679 protected function create(array $data)
680 { 680 {
681 $Use = new User(); 681 $Use = new User();
682 682
683 $Code_user = $Use->create([ 683 $Code_user = $Use->create([
684 'name' => $data['surname']." ".$data['name_man'], 684 'name' => $data['surname']." ".$data['name_man'],
685 'name_man' => $data['name_man'], 685 'name_man' => $data['name_man'],
686 'surname' => $data['surname'], 686 'surname' => $data['surname'],
687 'surname2' => $data['surname2'], 687 'surname2' => $data['surname2'],
688 'subscribe_email' => $data['email'], 688 'subscribe_email' => $data['email'],
689 'email' => $data['email'], 689 'email' => $data['email'],
690 'telephone' => $data['telephone'], 690 'telephone' => $data['telephone'],
691 'password' => Hash::make($data['password']), 691 'password' => Hash::make($data['password']),
692 'pubpassword' => base64_encode($data['password']), 692 'pubpassword' => base64_encode($data['password']),
693 'is_worker' => $data['is_worker'], 693 'is_worker' => $data['is_worker'],
694 ]); 694 ]);
695 695
696 if ($Code_user->id > 0) { 696 if ($Code_user->id > 0) {
697 $Worker = new Worker(); 697 $Worker = new Worker();
698 $Worker->user_id = $Code_user->id; 698 $Worker->user_id = $Code_user->id;
699 $Worker->position_work = $data['job_titles'] ?? null; 699 $Worker->position_work = $data['job_titles'] ?? null;
700 $Worker->email = $data['email']; 700 $Worker->email = $data['email'];
701 $Worker->telephone = $data['telephone']; 701 $Worker->telephone = $data['telephone'];
702 $Worker->save(); 702 $Worker->save();
703 703
704 if (isset($Worker->id) && !empty($data['job_titles'])) { 704 if (isset($Worker->id) && !empty($data['job_titles'])) {
705 $existJob = Job_title::query()->find($data['job_titles']); 705 $existJob = Job_title::query()->find($data['job_titles']);
706 if ($existJob) { 706 if ($existJob) {
707 $Title_Worker = new Title_worker(); 707 $Title_Worker = new Title_worker();
708 $Title_Worker->worker_id = $Worker->id; 708 $Title_Worker->worker_id = $Worker->id;
709 $Title_Worker->job_title_id = $data['job_titles']; 709 $Title_Worker->job_title_id = $data['job_titles'];
710 $Title_Worker->save(); 710 $Title_Worker->save();
711 } 711 }
712 712
713 } 713 }
714 714
715 return $Code_user; 715 return $Code_user;
716 } 716 }
717 } 717 }
718 718
719 // Вакансии избранные 719 // Вакансии избранные
720 public function colorado(Request $request) { 720 public function colorado(Request $request) {
721 $Arr = Like_vacancy::Query() 721 $Arr = Like_vacancy::Query()
722 ->select('code_record') 722 ->select('code_record')
723 ->where('user_id', Auth::user()->id) 723 ->where('user_id', Auth::user()->id)
724 ->get(); 724 ->get();
725 725
726 if ($Arr->count()) { 726 if ($Arr->count()) {
727 $A = Array(); 727 $A = Array();
728 foreach ($Arr as $it) { 728 foreach ($Arr as $it) {
729 $A[] = $it->code_record; 729 $A[] = $it->code_record;
730 } 730 }
731 731
732 $Query = Ad_employer::query()->whereIn('id', $A); 732 $Query = Ad_employer::query()->whereIn('id', $A);
733 } else { 733 } else {
734 $Query = Ad_employer::query()->where('id', '=', '0'); 734 $Query = Ad_employer::query()->where('id', '=', '0');
735 } 735 }
736 736
737 $Query = $Query->with(['jobs', 'cat', 'employer']) 737 $Query = $Query->with(['jobs', 'cat', 'employer'])
738 ->whereHas('jobs_code', function ($query) use ($request) { 738 ->whereHas('jobs_code', function ($query) use ($request) {
739 if ($request->ajax()) { 739 if ($request->ajax()) {
740 if (null !== ($request->get('job'))) { 740 if (null !== ($request->get('job'))) {
741 $query->where('job_title_id', $request->get('job')); 741 $query->where('job_title_id', $request->get('job'));
742 } 742 }
743 } 743 }
744 }) 744 })
745 ->select('ad_employers.*'); 745 ->select('ad_employers.*');
746 746
747 if ($request->get('search') !== null) { 747 if ($request->get('search') !== null) {
748 $search = $request->get('search'); 748 $search = $request->get('search');
749 $Query->where('name', 'LIKE', "%$search%"); 749 $Query->where('name', 'LIKE', "%$search%");
750 } 750 }
751 751
752 //dd($Query->get()); 752 //dd($Query->get());
753 753
754 $Job_title = Job_title::query()->OrderBy('name')->get(); 754 $Job_title = Job_title::query()->OrderBy('name')->get();
755 755
756 $Query_count = $Query->count(); 756 $Query_count = $Query->count();
757 757
758 $Query = $Query->OrderBy('updated_at')->paginate(3); 758 $Query = $Query->OrderBy('updated_at')->paginate(3);
759 759
760 return view('workers.favorite', compact('Query', 760 return view('workers.favorite', compact('Query',
761 'Query_count', 761 'Query_count',
762 'Job_title')); 762 'Job_title'));
763 763
764 } 764 }
765 public function pin_chat(Request $request){ 765 public function pin_chat(Request $request){
766 $chat_id = $request->get('id'); 766 $chat_id = $request->get('id');
767 $is_fixed = $request->get('is_fixed'); 767 $is_fixed = $request->get('is_fixed');
768 Chat::pin_chat($chat_id, $is_fixed); 768 Chat::pin_chat($chat_id, $is_fixed);
769 } 769 }
770 //Переписка 770 //Переписка
771 public function dialog(Chat $chat, Request $request) { 771 public function dialog(Chat $chat, Request $request) {
772 // Получение параметров. 772 // Получение параметров.
773 if ($request->has('ad_employer')){ 773 if ($request->has('ad_employer')){
774 $ad_employer = $request->get('ad_employer'); 774 $ad_employer = $request->get('ad_employer');
775 } else { 775 } else {
776 $ad_employer = 0; 776 $ad_employer = 0;
777 } 777 }
778 $supeAdmin=User::superAdmin(); 778 $supeAdmin=User::superAdmin();
779 $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first(); 779 $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(); 780 $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first();
781 781
782 $Messages = Chat::get_chat_messages($chat); 782 $Messages = Chat::get_chat_messages($chat);
783 783
784 Message::where('chat_id_to', '=', $chat->id)->update(['flag_new' => 0]); 784 Message::where('chat_id_to', '=', $chat->id)->update(['flag_new' => 0]);
785 785
786 return view('workers.dialog', compact('companion', 'sender', 'chat', 'Messages', 'ad_employer','supeAdmin')); 786 return view('workers.dialog', compact('companion', 'sender', 'chat', 'Messages', 'ad_employer','supeAdmin'));
787 } 787 }
788 788
789 // Даунылоады 789 // Даунылоады
790 public function download(Worker $worker) { 790 public function download(Worker $worker) {
791 $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; 791 $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...'];
792 view()->share('house',$arr_house); 792 view()->share('house',$arr_house);
793 $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); 793 $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape');
794 return $pdf->stream(); 794 return $pdf->stream();
795 } 795 }
796 796
797 // Поднятие анкеты 797 // Поднятие анкеты
798 public function up(Worker $worker) { 798 public function up(Worker $worker) {
799 $worker->updated_at = Carbon::now(); 799 $worker->updated_at = Carbon::now();
800 $worker->save(); 800 $worker->save();
801 // 0 801 // 0
802 return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); 802 return redirect()->route('worker.cabinet')->with('success', 'Резюме подняли');
803 } 803 }
804 804
805 // Форма сертификате 805 // Форма сертификате
806 public function new_sertificate(Worker $worker) { 806 public function new_sertificate(Worker $worker) {
807 return view('workers.sertificate_add', compact('worker')); 807 return view('workers.sertificate_add', compact('worker'));
808 } 808 }
809 809
810 // Добавление сертификата 810 // Добавление сертификата
811 public function add_serificate(SertificationRequest $request) { 811 public function add_serificate(SertificationRequest $request) {
812 $request->validate([ 812 $request->validate([
813 'name' => 'required|string|max:255', 813 'name' => 'required|string|max:255',
814 'end_begin' => 'required|date|date_format:d.m.Y' 814 'end_begin' => 'required|date|date_format:d.m.Y'
815 ], 815 ],
816 [ 816 [
817 'name' => 'Навание сертификата обязательно для заполнения.', 817 'name' => 'Навание сертификата обязательно для заполнения.',
818 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' 818 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг'
819 ]); 819 ]);
820 820
821 $params = $request->all(); 821 $params = $request->all();
822 822
823 $end_begin = DateTime::createFromFormat('d.m.Y', $params['end_begin']); 823 $end_begin = DateTime::createFromFormat('d.m.Y', $params['end_begin']);
824 $params['end_begin'] = $end_begin->format('Y-m-d'); 824 $params['end_begin'] = $end_begin->format('Y-m-d');
825 825
826 $Sertificate = new sertification(); 826 $Sertificate = new sertification();
827 $Sertificate->create($params); 827 $Sertificate->create($params);
828 828
829 return response()->json([ 829 return response()->json([
830 'success' => true 830 'success' => true
831 ]); 831 ]);
832 } 832 }
833 833
834 // Удалить сертификат 834 // Удалить сертификат
835 public function delete_sertificate(sertification $doc) { 835 public function delete_sertificate(sertification $doc) {
836 $doc->delete(); 836 $doc->delete();
837 837
838 return redirect()->route('worker.cabinet'); 838 return redirect()->route('worker.cabinet');
839 } 839 }
840 840
841 // Редактирование сертификата 841 // Редактирование сертификата
842 public function edit_sertificate(Worker $worker, sertification $doc) { 842 public function edit_sertificate(Worker $worker, sertification $doc) {
843 return view('workers.sertificate_edit', compact('doc', 'worker')); 843 return view('workers.sertificate_edit', compact('doc', 'worker'));
844 } 844 }
845 845
846 // Редактирование обновление сертификата 846 // Редактирование обновление сертификата
847 public function update_serificate(SertificationRequest $request, sertification $doc) { 847 public function update_serificate(SertificationRequest $request, sertification $doc) {
848 $request->validate([ 848 $request->validate([
849 'name' => 'required|string|max:255', 849 'name' => 'required|string|max:255',
850 'end_begin' => 'required|date|date_format:d.m.Y' 850 'end_begin' => 'required|date|date_format:d.m.Y'
851 ], 851 ],
852 [ 852 [
853 'name' => 'Навание сертификата обязательно для заполнения.', 853 'name' => 'Навание сертификата обязательно для заполнения.',
854 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' 854 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг'
855 ]); 855 ]);
856 856
857 $all = $request->all(); 857 $all = $request->all();
858 858
859 $end_begin = DateTime::createFromFormat('d.m.Y', $all['end_begin']); 859 $end_begin = DateTime::createFromFormat('d.m.Y', $all['end_begin']);
860 $all['end_begin'] = $end_begin->format('Y-m-d'); 860 $all['end_begin'] = $end_begin->format('Y-m-d');
861 861
862 $doc->worker_id = $all['worker_id']; 862 $doc->worker_id = $all['worker_id'];
863 $doc->name = $all['name']; 863 $doc->name = $all['name'];
864 $doc->end_begin = $all['end_begin']; 864 $doc->end_begin = $all['end_begin'];
865 $doc->save(); 865 $doc->save();
866 866
867 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); 867 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!');
868 } 868 }
869 869
870 public function edit_diploms(Request $request, Worker $worker) { 870 public function edit_diploms(Request $request, Worker $worker) {
871 $dop_info_data = $request->input('diploms'); 871 $dop_info_data = $request->input('diploms');
872 872
873 if (empty($dop_info_data)) { 873 if (empty($dop_info_data)) {
874 return redirect()->route('worker.additional_documents')->with('error', 'Данные не предоставлены!'); 874 return redirect()->route('worker.additional_documents')->with('error', 'Данные не предоставлены!');
875 } 875 }
876 876
877 foreach ($dop_info_data as $infoblok_id => $status) { 877 foreach ($dop_info_data as $infoblok_id => $status) {
878 Dop_info::updateOrCreate( 878 Dop_info::updateOrCreate(
879 ['worker_id' => $worker->id, 'infoblok_id' => $infoblok_id], 879 ['worker_id' => $worker->id, 'infoblok_id' => $infoblok_id],
880 ['status' => $status] 880 ['status' => $status]
881 ); 881 );
882 } 882 }
883 883
884 return redirect()->route('worker.additional_documents')->with('success', 'Успешно сохранено!'); 884 return redirect()->route('worker.cabinet')->with('success', 'Успешно сохранено!');
885 } 885 }
886 public function subscribe() { 886 public function subscribe() {
887 887
888 $user= Auth::user(); 888 $user= Auth::user();
889 return view('workers.subcribe',compact('user')); 889 return view('workers.subcribe',compact('user'));
890 } 890 }
891 891
892 //Установка уведомлений сохранение 892 //Установка уведомлений сохранение
893 public function save_subscribe(Request $request) { 893 public function save_subscribe(Request $request) {
894 894
895 $msg = $request->validate([ 895 $msg = $request->validate([
896 'email' => 'required|email|min:5|max:255', 896 'email' => 'required|email|min:5|max:255',
897 ]); 897 ]);
898 898
899 $user= Auth::user(); 899 $user= Auth::user();
900 900
901 User_Model::updateOrCreate( 901 User_Model::updateOrCreate(
902 ['id' => $user->id], 902 ['id' => $user->id],
903 ['subscribe_email' => $request->email, 903 ['subscribe_email' => $request->email,
904 'subscribe' => request()->has('email_msg') && request('email_msg') === 'on' ? 1 : 0 904 'subscribe' => request()->has('email_msg') && request('email_msg') === 'on' ? 1 : 0
905 ] 905 ]
906 ); 906 );
907 return redirect()->route('worker.subscribe')->with('success', 'Ваши изменения успешно сохранены'); 907 return redirect()->route('worker.subscribe')->with('success', 'Ваши изменения успешно сохранены');
908 908
909 } 909 }
910 public function delete_add_diplom(Request $request, Worker $worker) { 910 public function delete_add_diplom(Request $request, Worker $worker) {
911 $infoblok_id = $request->get('infoblok_id'); 911 $infoblok_id = $request->get('infoblok_id');
912 912
913 if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) 913 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(); 914 $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete();
915 else { 915 else {
916 $params['infoblok_id'] = $infoblok_id; 916 $params['infoblok_id'] = $infoblok_id;
917 $params['worker_id'] = $worker->id; 917 $params['worker_id'] = $worker->id;
918 $params['status'] = $request->get('val'); 918 $params['status'] = $request->get('val');
919 $id = Dop_info::create($params); 919 $id = Dop_info::create($params);
920 //$id = $worker->infobloks()->sync([$infoblok_id]); 920 //$id = $worker->infobloks()->sync([$infoblok_id]);
921 } 921 }
922 922
923 //$Infoblocks = infobloks::query()->get(); 923 //$Infoblocks = infobloks::query()->get();
924 return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); 924 return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks'));
925 } 925 }
926 926
927 927
928 928
929 // Добавление диплома 929 // Добавление диплома
930 public function add_diplom_ajax(Request $request) { 930 public function add_diplom_ajax(Request $request) {
931 // конец 931 // конец
932 $params = $request->all(); 932 $params = $request->all();
933 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); 933 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count();
934 934
935 if ($count == 0) $dop_info = Dop_info::create($params); 935 if ($count == 0) $dop_info = Dop_info::create($params);
936 $Infoblocks = infobloks::query()->get(); 936 $Infoblocks = infobloks::query()->get();
937 $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); 937 $Worker = Worker::query()->where('id', $request->get('worker_id'))->get();
938 $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); 938 $data = Dop_info::query()->where('worker_id', $request->has('worker_id'));
939 return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); 939 return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker'));
940 } 940 }
941 941
942 // Добавление диплома без ajax 942 // Добавление диплома без ajax
943 public function add_diplom(Worker $worker) { 943 public function add_diplom(Worker $worker) {
944 $worker_id = $worker->id; 944 $worker_id = $worker->id;
945 $Infoblocks = infobloks::query()->get(); 945 $Infoblocks = infobloks::query()->get();
946 return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); 946 return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks'));
947 } 947 }
948 // Сохранить 948 // Сохранить
949 // Сохраняю диплом 949 // Сохраняю диплом
950 public function add_diplom_save(Request $request) { 950 public function add_diplom_save(Request $request) {
951 $params = $request->all(); 951 $params = $request->all();
952 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); 952 $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); 953 if ($count == 0) $dop_info = Dop_info::create($params);
954 return redirect()->route('worker.cabinet'); 954 return redirect()->route('worker.cabinet');
955 } 955 }
956 956
957 // Добавление стандартного документа 957 // Добавление стандартного документа
958 public function add_document(Worker $worker) { 958 public function add_document(Worker $worker) {
959 return view('workers.docs', compact('worker')); 959 return view('workers.docs', compact('worker'));
960 } 960 }
961 961
962 //Сохранение стандартого документа 962 //Сохранение стандартого документа
963 public function add_document_save(DocumentsRequest $request) { 963 public function add_document_save(DocumentsRequest $request) {
964 $params = $request->all(); 964 $params = $request->all();
965 place_works::create($params); 965 place_works::create($params);
966 return response()->json(['success' => true]); 966 return response()->json(['success' => true]);
967 } 967 }
968 968
969 // Редактирование документа 969 // Редактирование документа
970 public function edit_document(place_works $doc, Worker $worker) { 970 public function edit_document(place_works $doc, Worker $worker) {
971 971
972 return view('workers.docs-edit', compact('doc', 'worker')); 972 return view('workers.docs-edit', compact('doc', 'worker'));
973 } 973 }
974 974
975 //Сохранение отредактированного документа 975 //Сохранение отредактированного документа
976 public function edit_document_save(DocumentsRequest $request, place_works $doc) { 976 public function edit_document_save(DocumentsRequest $request, place_works $doc) {
977 $params = $request->all(); 977 $params = $request->all();
978 $doc->update($params); 978 $doc->update($params);
979 979
980 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); 980 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!');
981 } 981 }
982 982
983 // Удаление документа 983 // Удаление документа
984 public function delete_document(place_works $doc) { 984 public function delete_document(place_works $doc) {
985 $doc->delete(); 985 $doc->delete();
986 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); 986 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!');
987 } 987 }
988 988
989 //Отправка нового сообщения 989 //Отправка нового сообщения
990 public function new_message(Request $request) 990 public function new_message(Request $request)
991 { 991 {
992 $params = $request->all(); 992 $params = $request->all();
993 993
994 $id = $params['user_from']; 994 $id = $params['user_from'];
995 995
996 Message::add_message( 996 Message::add_message(
997 $request, 997 $request,
998 $params['user_from'], 998 $params['user_from'],
999 $params['user_to'], 999 $params['user_to'],
1000 [ 1000 [
1001 'text' => $params['comment'] ?? null, 1001 'text' => $params['comment'] ?? null,
1002 'ad_employer_id' => $params['vacancy'], 1002 'ad_employer_id' => $params['vacancy'],
1003 'flag_new' => 1 1003 'flag_new' => 1
1004 ], 1004 ],
1005 file_store_path: "worker/$id" 1005 file_store_path: "worker/$id"
1006 ); 1006 );
1007 1007
1008 if ($request->ajax()) { 1008 if ($request->ajax()) {
1009 return response([]); 1009 return response([]);
1010 } 1010 }
1011 return redirect()->back(); 1011 return redirect()->back();
1012 } 1012 }
1013 1013
1014 1014
1015 public function test123(Request $request) { 1015 public function test123(Request $request) {
1016 $params = $request->all(); 1016 $params = $request->all();
1017 $user1 = $params['user_id']; 1017 $user1 = $params['user_id'];
1018 $user2 = $params['to_user_id']; 1018 $user2 = $params['to_user_id'];
1019 1019
1020 $rules = [ 1020 $rules = [
1021 'text' => 'nullable|required_without:file|min:1|max:150000', 1021 'text' => 'nullable|required_without:file|min:1|max:150000',
1022 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' 1022 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000'
1023 ]; 1023 ];
1024 $messages = [ 1024 $messages = [
1025 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', 1025 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен',
1026 'min' => [ 1026 'min' => [
1027 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 1027 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
1028 'integer' => 'Поле «:attribute» должно быть :min или больше', 1028 'integer' => 'Поле «:attribute» должно быть :min или больше',
1029 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 1029 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
1030 ], 1030 ],
1031 'max' => [ 1031 'max' => [
1032 'string' => 'Поле «:attribute» должно быть не больше :max символов', 1032 'string' => 'Поле «:attribute» должно быть не больше :max символов',
1033 'integer' => 'Поле «:attribute» должно быть :max или меньше', 1033 'integer' => 'Поле «:attribute» должно быть :max или меньше',
1034 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 1034 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
1035 ] 1035 ]
1036 ]; 1036 ];
1037 1037
1038 $validator = Validator::make($request->all(), $rules, $messages); 1038 $validator = Validator::make($request->all(), $rules, $messages);
1039 1039
1040 if ($validator->fails()) { 1040 if ($validator->fails()) {
1041 $chat = Chat::where('user_id', $user1) 1041 $chat = Chat::where('user_id', $user1)
1042 ->where('to_user_id', $user2) 1042 ->where('to_user_id', $user2)
1043 ->where('is_removed', 0) 1043 ->where('is_removed', 0)
1044 ->first(); 1044 ->first();
1045 1045
1046 if ($chat->id){ 1046 if ($chat->id){
1047 return redirect()->route('worker.dialog', ['chat' => $chat->id])->withErrors($validator); 1047 return redirect()->route('worker.dialog', ['chat' => $chat->id])->withErrors($validator);
1048 } else { 1048 } else {
1049 return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); 1049 return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator);
1050 } 1050 }
1051 } else { 1051 } else {
1052 $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); 1052 $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages');
1053 1053
1054 //dd('new message', $new_message); 1054 //dd('new message', $new_message);
1055 return redirect()->route('worker.dialog', ['chat' => $new_message->chat_id_from]); 1055 return redirect()->route('worker.dialog', ['chat' => $new_message->chat_id_from]);
1056 } 1056 }
1057 } 1057 }
1058 1058
1059 // Информация о предыдущих компаниях 1059 // Информация о предыдущих компаниях
1060 public function new_prev_company(Worker $worker) { 1060 public function new_prev_company(Worker $worker) {
1061 return view('workers.prev_company_form', compact('worker')); 1061 return view('workers.prev_company_form', compact('worker'));
1062 } 1062 }
1063 1063
1064 // Добавление контакта компании 1064 // Добавление контакта компании
1065 public function add_prev_company(PrevCompanyRequest $request) { 1065 public function add_prev_company(PrevCompanyRequest $request) {
1066 // Возвращение параметров 1066 // Возвращение параметров
1067 $all = $request->all(); 1067 $all = $request->all();
1068 PrevCompany::create($all); 1068 PrevCompany::create($all);
1069 1069
1070 return response()->json(['success' => true]); 1070 return response()->json(['success' => true]);
1071 } 1071 }
1072 1072
1073 // Редактирование контакта компании 1073 // Редактирование контакта компании
1074 public function edit_prev_company(PrevCompany $doc, Worker $worker) { 1074 public function edit_prev_company(PrevCompany $doc, Worker $worker) {
1075 return view('workers.prev_company_edit_form', compact('doc', 'worker')); 1075 return view('workers.prev_company_edit_form', compact('doc', 'worker'));
1076 } 1076 }
1077 1077
1078 //Сохранение редактирования контакта компании 1078 //Сохранение редактирования контакта компании
1079 public function update_prev_company(PrevCompany $doc, Request $request){ 1079 public function update_prev_company(PrevCompany $doc, Request $request){
1080 $all = $request->all(); 1080 $all = $request->all();
1081 $doc->update($all); 1081 $doc->update($all);
1082 1082
1083 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); 1083 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись');
1084 } 1084 }
1085 1085
1086 // Удаление контакта предыдущей компании 1086 // Удаление контакта предыдущей компании
1087 public function delete_prev_company(PrevCompany $doc) { 1087 public function delete_prev_company(PrevCompany $doc) {
1088 $doc->delete(); 1088 $doc->delete();
1089 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); 1089 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!');
1090 } 1090 }
1091 1091
1092 public function autoresponder() 1092 public function autoresponder()
1093 { 1093 {
1094 $user = Auth::user(); 1094 $user = Auth::user();
1095 return view('workers.autoresponder', compact('user')); 1095 return view('workers.autoresponder', compact('user'));
1096 } 1096 }
1097 1097
1098 public function autoresponderSave(Request $request): RedirectResponse 1098 public function autoresponderSave(Request $request): RedirectResponse
1099 { 1099 {
1100 /** @var Employer $employer */ 1100 /** @var Employer $employer */
1101 $employer = Auth::user(); 1101 $employer = Auth::user();
1102 $employer->autoresponder = $request->get('autoresponder', false) === 'on'; 1102 $employer->autoresponder = $request->get('autoresponder', false) === 'on';
1103 $employer->autoresponder_message = $request->get('autoresponder_message'); 1103 $employer->autoresponder_message = $request->get('autoresponder_message');
1104 $employer->save(); 1104 $employer->save();
1105 1105
1106 return redirect(route('worker.autoresponder')); 1106 return redirect(route('worker.autoresponder'));
1107 } 1107 }
1108 /** 1108 /**
1109 * @throws JsonException 1109 * @throws JsonException
1110 */ 1110 */
1111 public function resumeAutoLiftForm(): View 1111 public function resumeAutoLiftForm(): View
1112 { 1112 {
1113 $worker = Auth::user()->workers[0]; 1113 $worker = Auth::user()->workers[0];
1114 1114
1115 $options = $worker->autoliftOptions ?? new WorkerAutoliftOption(); 1115 $options = $worker->autoliftOptions ?? new WorkerAutoliftOption();
1116 1116
1117 return view('workers.resume_autolift', compact('worker', 'options')); 1117 return view('workers.resume_autolift', compact('worker', 'options'));
1118 } 1118 }
1119 1119
1120 /** 1120 /**
1121 * @throws JsonException 1121 * @throws JsonException
1122 */ 1122 */
1123 public function resumeAutoLiftSave(Request $request) 1123 public function resumeAutoLiftSave(Request $request)
1124 { 1124 {
1125 $worker = Auth::user()->workers[0]; 1125 $worker = Auth::user()->workers[0];
1126 1126
1127 $worker->autoliftOptions()->updateOrCreate( 1127 $worker->autoliftOptions()->updateOrCreate(
1128 [ 1128 [
1129 'worker_id' => $worker->id, 1129 'worker_id' => $worker->id,
1130 ], 1130 ],
1131 [ 1131 [
1132 'is_enabled' => $request->get('is_enabled') === 'true', 1132 'is_enabled' => $request->get('is_enabled') === 'true',
1133 'times_per_day' => $request->get('times_per_day'), 1133 'times_per_day' => $request->get('times_per_day'),
1134 'days_repeat' => $request->get('days_repeat'), 1134 'days_repeat' => $request->get('days_repeat'),
1135 'time_send_first' => $request->get('time_send_first'), 1135 'time_send_first' => $request->get('time_send_first'),
1136 'time_send_second' => $request->get('time_send_second'), 1136 'time_send_second' => $request->get('time_send_second'),
1137 'time_send_third' => $request->get('time_send_third'), 1137 'time_send_third' => $request->get('time_send_third'),
1138 'time_send_tg' => $request->get('time_send_tg'), 1138 'time_send_tg' => $request->get('time_send_tg'),
1139 'autolift_site' => $request->get('autolift_site') === 'on', 1139 'autolift_site' => $request->get('autolift_site') === 'on',
1140 ] 1140 ]
1141 ); 1141 );
1142 1142
1143 return response()->json(['success' => true]); 1143 return response()->json(['success' => true]);
1144 } 1144 }
1145 } 1145 }
1146 1146
1147 1147
public/css/general.css
1 /* Диалог модал */ 1 /* Диалог модал */
2 .modal-dialog{ 2 .modal-dialog{
3 border-radius: 10px; 3 border-radius: 10px;
4 } 4 }
5 .modal-dialog .modal-dialog-footer{ 5 .modal-dialog .modal-dialog-footer{
6 display: flex; 6 display: flex;
7 justify-content: space-between; 7 justify-content: space-between;
8 } 8 }
9 .modal-dialog .modal-dialog-footer.center{ 9 .modal-dialog .modal-dialog-footer.center{
10 display: flex; 10 display: flex;
11 justify-content: center; 11 justify-content: center;
12 } 12 }
13 .modal-dialog .modal-dialog-title h2{ 13 .modal-dialog .modal-dialog-title h2{
14 font-weight: bold; 14 font-weight: bold;
15 font-size: 24px; 15 font-size: 24px;
16 text-align: center; 16 text-align: center;
17 } 17 }
18 .modal-dialog .modal-dialog-body{ 18 .modal-dialog .modal-dialog-body{
19 padding-top: 20px; 19 padding-top: 20px;
20 padding-bottom: 20px; 20 padding-bottom: 20px;
21 } 21 }
22 .modal-dialog .modal-dialog-footer .button-admin{ 22 .modal-dialog .modal-dialog-footer .button-admin{
23 padding: 5px 10px; 23 padding: 5px 10px;
24 border: 1px #000 solid; 24 border: 1px #000 solid;
25 border-radius: 8px; 25 border-radius: 8px;
26 } 26 }
27 /* Конец Диалог модал */ 27 /* Конец Диалог модал */
28 28
29 .button-loader { 29 .button-loader {
30 display: inline-block; 30 display: inline-block;
31 border: 2px solid #f3f3f3; 31 border: 2px solid #f3f3f3;
32 -webkit-animation: spin 1s linear infinite; 32 -webkit-animation: spin 1s linear infinite;
33 animation: spin 1s linear infinite; 33 animation: spin 1s linear infinite;
34 border-top: 2px solid #555; 34 border-top: 2px solid #555;
35 border-radius: 50%; 35 border-radius: 50%;
36 width: 20px; 36 width: 20px;
37 height: 20px; 37 height: 20px;
38 margin-right: 10px; 38 margin-right: 10px;
39 } 39 }
40 @keyframes spin { 40 @keyframes spin {
41 0% { transform: rotate(0deg); } 41 0% { transform: rotate(0deg); }
42 100% { transform: rotate(360deg); } 42 100% { transform: rotate(360deg); }
43 } 43 }
44 .error-block{ 44 .error-block{
45 color:red; 45 color:red;
46 padding: 0; 46 padding: 0;
47 width: 100%; 47 width: 100%;
48 } 48 }
49 49
50 .review-image-modal{ 50 .review-image-modal{
51 cursor: pointer; 51 cursor: pointer;
52 } 52 }
53 53
54 .error-message, .employer_error-message { 54 .error-message, .employer_error-message {
55 margin-top: 5px; 55 margin-top: 5px;
56 color: #dc3546 56 color: #dc3546
57 } 57 }
58 58
59 #captcha_error, #captcha_employer_error { 59 #captcha_error, #captcha_employer_error {
60 margin-top: 0; 60 margin-top: 0;
61 margin-bottom: 15px; 61 margin-bottom: 15px;
62 } 62 }
63
64 .sertificate-form-inputs {
65 align-items: normal!important;
66 }
63 67
resources/views/workers/cabinet.blade.php
1 @extends('layout.frontend', ['title' => 'Моя анкета - РекаМоре']) 1 @extends('layout.frontend', ['title' => 'Моя анкета - РекаМоре'])
2 2
3 @section('scripts') 3 @section('scripts')
4 @include('modals.flash-message', [
5 'title' => 'Успешно!',
6 'message' => session('success')
7 ])
4 <script> 8 <script>
5 $(function() { 9 $(function() {
6 $('.cabinet__avatar-form [type="file"][name="photo"]').change(function (event) { 10 $('.cabinet__avatar-form [type="file"][name="photo"]').change(function (event) {
7 var form = $(this).closest('form'); 11 var form = $(this).closest('form');
8 const file = event.target.files[0]; 12 const file = event.target.files[0];
9 13
10 if (file) { 14 if (file) {
11 var img_wrap = $('.cabinet__avatar-pic'); 15 var img_wrap = $('.cabinet__avatar-pic');
12 var img = $('<img src="#"/>'); 16 var img = $('<img src="#"/>');
13 const reader = new FileReader(); 17 const reader = new FileReader();
14 18
15 reader.onload = function(e) { 19 reader.onload = function(e) {
16 img.attr('src', e.target.result); 20 img.attr('src', e.target.result);
17 img_wrap.find('svg, img').remove(); 21 img_wrap.find('svg, img').remove();
18 img_wrap.append(img); 22 img_wrap.append(img);
19 23
20 setTimeout(function () { 24 setTimeout(function () {
21 form.submit(); 25 form.submit();
22 }, 1000); 26 }, 1000);
23 }; 27 };
24 28
25 reader.readAsDataURL(file); 29 reader.readAsDataURL(file);
26 } 30 }
27 }); 31 });
28 }); 32 });
29 33
30 $(document).on('click', '#old_year', function() { 34 $(document).on('click', '#old_year', function() {
31 var this_ = $(this); 35 var this_ = $(this);
32 var val = this_.val(); 36 var val = this_.val();
33 37
34 if (val < 0) 38 if (val < 0)
35 $('#old_year').val(0); 39 $('#old_year').val(0);
36 }); 40 });
37 </script> 41 </script>
38 @endsection 42 @endsection
39 43
40 @section('content') 44 @section('content')
41 @php 45 @php
42 $user = $worker->users 46 $user = $worker->users
43 @endphp 47 @endphp
44 <section class="cabinet"> 48 <section class="cabinet">
45 <div class="container"> 49 <div class="container">
46 <ul class="breadcrumbs cabinet__breadcrumbs"> 50 <ul class="breadcrumbs cabinet__breadcrumbs">
47 <li><a href="{{ route('index') }}">Главная</a></li> 51 <li><a href="{{ route('index') }}">Главная</a></li>
48 <li><b>Личный кабинет</b></li> 52 <li><b>Личный кабинет</b></li>
49 </ul> 53 </ul>
50 <div class="cabinet__wrapper"> 54 <div class="cabinet__wrapper">
51 <div class="cabinet__side"> 55 <div class="cabinet__side">
52 <div class="cabinet__side-toper"> 56 <div class="cabinet__side-toper">
53 @include('workers.emblema') 57 @include('workers.emblema')
54 58
55 </div> 59 </div>
56 60
57 @include('workers.menu', ['item' => 1]) 61 @include('workers.menu', ['item' => 1])
58 </div> 62 </div>
59 <div class="cabinet__body"> 63 <div class="cabinet__body">
60 <div class="cabinet__body-item"> 64 <div class="cabinet__body-item">
61 <div class="cabinet__anketa"> 65 <div class="cabinet__anketa">
62 <h2 class="title cabinet__title">Моя анкета</h2> 66 <h2 class="title cabinet__title">Моя анкета</h2>
63 <div class="cabinet__anketa-buttons"> 67 <div class="cabinet__anketa-buttons">
64 <a href="{{ route('worker.up', ['worker' => $worker->id]) }}" class="button">Поднять резюме</a> 68 <a href="{{ route('worker.up', ['worker' => $worker->id]) }}" class="button">Поднять резюме</a>
65 <a href="{{ route('resume_download', ['worker' => $worker->id]) }}" target="_blank" class="button"> 69 <a href="{{ route('resume_download', ['worker' => $worker->id]) }}" target="_blank" class="button">
66 <svg> 70 <svg>
67 <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use> 71 <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use>
68 </svg> 72 </svg>
69 Скачать резюме 73 Скачать резюме
70 </a> 74 </a>
71 </div> 75 </div>
72 </div> 76 </div>
73 </div> 77 </div>
74 78
75 <div class="cabinet__body-item"> 79 <div class="cabinet__body-item">
76 <div class="cabinet__stats"> 80 <div class="cabinet__stats">
77 <h3 class="cabinet__subtitle cabinet__stats-title">Статистика</h3> 81 <h3 class="cabinet__subtitle cabinet__stats-title">Статистика</h3>
78 <div class="cabinet__stats-body"> 82 <div class="cabinet__stats-body">
79 <div class="cabinet__stats-item"> 83 <div class="cabinet__stats-item">
80 <svg> 84 <svg>
81 <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> 85 <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use>
82 </svg> 86 </svg>
83 <span>Просмотров:</span> 87 <span>Просмотров:</span>
84 <b>@if (isset($stat[0]->lookin)) {{ $stat[0]->lookin }} @else 0 @endif</b> 88 <b>@if (isset($stat[0]->lookin)) {{ $stat[0]->lookin }} @else 0 @endif</b>
85 </div> 89 </div>
86 <div class="cabinet__stats-item"> 90 <div class="cabinet__stats-item">
87 <svg> 91 <svg>
88 <use xlink:href="{{ asset('images/sprite.svg#warning') }}"></use> 92 <use xlink:href="{{ asset('images/sprite.svg#warning') }}"></use>
89 </svg> 93 </svg>
90 <span>Отзывов:</span> 94 <span>Отзывов:</span>
91 <b>@if(isset($worker->response)) {{ $worker->response->count() }} @else 0 @endif</b> 95 <b>@if(isset($worker->response)) {{ $worker->response->count() }} @else 0 @endif</b>
92 </div> 96 </div>
93 </div> 97 </div>
94 <div class="cabinet__stats-subtitle">Анкета заполнена на {{ $persent }}%</div> 98 <div class="cabinet__stats-subtitle">Анкета заполнена на {{ $persent }}%</div>
95 <div class="cabinet__stats-line"> 99 <div class="cabinet__stats-line">
96 <span style="width:{{ $persent }}%"></span> 100 <span style="width:{{ $persent }}%"></span>
97 </div> 101 </div>
98 @if($persent < 80) 102 @if($persent < 80)
99 <div class="cabinet__stats-bottom">Заполните профиль, чтобы повысить процент анкеты на 80%</div> 103 <div class="cabinet__stats-bottom">Заполните профиль, чтобы повысить процент анкеты на 80%</div>
100 @endif 104 @endif
101 </div> 105 </div>
102 </div> 106 </div>
103 107
104 <form class="" action="{{ route('worker.cabinet_save_foto', ['worker' => $worker->id]) }}" enctype="multipart/form-data" method="POST"> 108 <form class="" action="{{ route('worker.cabinet_save_foto', ['worker' => $worker->id]) }}" enctype="multipart/form-data" method="POST">
105 @csrf 109 @csrf
106 @include('messages_error') 110 @include('messages_error')
107 111
108 <div class="cabinet__body-item"> 112 <div class="cabinet__body-item">
109 <h3 class="cabinet__subtitle">Профиль</h3> 113 <h3 class="cabinet__subtitle">Профиль</h3>
110 <div class="cabinet__avatar"> 114 <div class="cabinet__avatar">
111 <div class="cabinet__avatar-pic"> 115 <div class="cabinet__avatar-pic">
112 116
113 @if (!empty($worker->photo)) 117 @if (!empty($worker->photo))
114 <img src="{{ asset(Storage::url($worker->photo)) }}"/> 118 <img src="{{ asset(Storage::url($worker->photo)) }}"/>
115 @else 119 @else
116 <svg> 120 <svg>
117 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 121 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
118 </svg> 122 </svg>
119 @endif 123 @endif
120 </div> 124 </div>
121 <div class="cabinet__avatar-form"> 125 <div class="cabinet__avatar-form">
122 <label class="file"> 126 <label class="file">
123 <span class="file__input flex"> 127 <span class="file__input flex">
124 <input type="file" name="photo" id="photo"> 128 <input type="file" name="photo" id="photo">
125 129
126 <span class="button mr-20"> 130 <span class="button mr-20">
127 <svg> 131 <svg>
128 <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use> 132 <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use>
129 </svg> 133 </svg>
130 Загрузить 134 Загрузить
131 </span> 135 </span>
132 @if (!empty($worker->photo)) 136 @if (!empty($worker->photo))
133 <button type="submit" class="button">Удалить фото</button> 137 <button type="submit" class="button">Удалить фото</button>
134 @endif 138 @endif
135 </span> 139 </span>
136 </label> 140 </label>
137 <p class="cabinet__text">Загрузите фотографию в формате svg., jpg., jpeg., png.</p> 141 <p class="cabinet__text">Загрузите фотографию в формате svg., jpg., jpeg., png.</p>
138 </div> 142 </div>
139 </div> 143 </div>
140 </div> 144 </div>
141 </form> 145 </form>
142 146
143 <div class="cabinet__body-item mb-40"> 147 <div class="cabinet__body-item mb-40">
144 <h3 class="cabinet__subtitle font30">Основная информация</h3> 148 <h3 class="cabinet__subtitle font30">Основная информация</h3>
145 149
146 <div class="cabinet__inputs"> 150 <div class="cabinet__inputs">
147 <div class="cabinet__inputs_to_columns_wrap"> 151 <div class="cabinet__inputs_to_columns_wrap">
148 <div class="cabinet__inputs_to_column cabinet__inputs_to_columns_left"> 152 <div class="cabinet__inputs_to_column cabinet__inputs_to_columns_left">
149 <div class="cabinet__inputs-item form-group"> 153 <div class="cabinet__inputs-item form-group">
150 <label class="form-group__label">Фамилия:</label> 154 <label class="form-group__label">Фамилия:</label>
151 <div class="form-group__item"> 155 <div class="form-group__item">
152 {{ $user->surname }} 156 {{ $user->surname }}
153 </div> 157 </div>
154 </div> 158 </div>
155 <div class="cabinet__inputs-item form-group"> 159 <div class="cabinet__inputs-item form-group">
156 <label class="form-group__label">Имя:</label> 160 <label class="form-group__label">Имя:</label>
157 <div class="form-group__item"> 161 <div class="form-group__item">
158 {{ $user->name_man }} 162 {{ $user->name_man }}
159 </div> 163 </div>
160 </div> 164 </div>
161 <div class="cabinet__inputs-item form-group"> 165 <div class="cabinet__inputs-item form-group">
162 <label class="form-group__label">Отчество:</label> 166 <label class="form-group__label">Отчество:</label>
163 <div class="form-group__item"> 167 <div class="form-group__item">
164 {{ $user->surname2 }} 168 {{ $user->surname2 }}
165 </div> 169 </div>
166 </div> 170 </div>
167 <div class="cabinet__inputs-item form-group"> 171 <div class="cabinet__inputs-item form-group">
168 <label class="form-group__label">Возраст:</label> 172 <label class="form-group__label">Возраст:</label>
169 <div class="form-group__item"> 173 <div class="form-group__item">
170 {{ $worker->old_year ?? '-' }} 174 {{ $worker->old_year ?? '-' }}
171 </div> 175 </div>
172 </div> 176 </div>
173 <div class="cabinet__inputs-item form-group"> 177 <div class="cabinet__inputs-item form-group">
174 <label class="form-group__label">Статус:</label> 178 <label class="form-group__label">Статус:</label>
175 <div class="form-group__item"> 179 <div class="form-group__item">
176 {{ $status_work[$worker->status_work] ?? '-' }} 180 {{ $status_work[$worker->status_work] ?? '-' }}
177 </div> 181 </div>
178 </div> 182 </div>
179 <div class="cabinet__inputs-item form-group"> 183 <div class="cabinet__inputs-item form-group">
180 <label class="form-group__label">Желаемые вакансии:</label> 184 <label class="form-group__label">Желаемые вакансии:</label>
181 <div class="form-group__item"> 185 <div class="form-group__item">
182 @if ($worker->job_titles->count()) 186 @if ($worker->job_titles->count())
183 @foreach($worker->job_titles as $job_title) 187 @foreach($worker->job_titles as $job_title)
184 {{ $job_title->name }} 188 {{ $job_title->name }}
185 @if (!$loop->last) / @endif 189 @if (!$loop->last) / @endif
186 @endforeach 190 @endforeach
187 @endif 191 @endif
188 </div> 192 </div>
189 </div> 193 </div>
190 <div class="cabinet__inputs-item form-group"> 194 <div class="cabinet__inputs-item form-group">
191 <label class="form-group__label">Пожелания к З/П:</label> 195 <label class="form-group__label">Пожелания к З/П:</label>
192 <div class="form-group__item"> 196 <div class="form-group__item">
193 {{ $worker->salary_expectations ?? '-' }} 197 {{ $worker->salary_expectations ?? '-' }}
194 </div> 198 </div>
195 </div> 199 </div>
196 <div class="cabinet__inputs-item form-group"> 200 <div class="cabinet__inputs-item form-group">
197 <label class="form-group__label">Уровень английского:</label> 201 <label class="form-group__label">Уровень английского:</label>
198 <div class="form-group__item"> 202 <div class="form-group__item">
199 {{ $worker->english_level ?? '-' }} 203 {{ $worker->english_level ?? '-' }}
200 </div> 204 </div>
201 </div> 205 </div>
202 <div class="cabinet__inputs-item form-group"> 206 <div class="cabinet__inputs-item form-group">
203 <label class="form-group__label">Дата готовности к посадке:</label> 207 <label class="form-group__label">Дата готовности к посадке:</label>
204 <div class="form-group__item"> 208 <div class="form-group__item">
205 {{ $worker->ready_boart_date ?? '-' }} 209 {{ $worker->ready_boart_date ?? '-' }}
206 </div> 210 </div>
207 </div> 211 </div>
208 <div class="cabinet__inputs-item form-group"> 212 <div class="cabinet__inputs-item form-group">
209 <label class="form-group__label">Предпочтение по типу судна:</label> 213 <label class="form-group__label">Предпочтение по типу судна:</label>
210 <div class="form-group__item"> 214 <div class="form-group__item">
211 {{ $worker->boart_type_preference ?? '-' }} 215 {{ $worker->boart_type_preference ?? '-' }}
212 </div> 216 </div>
213 </div> 217 </div>
214 </div> 218 </div>
215 219
216 <div class="cabinet__inputs_to_column cabinet__inputs_to_columns_right"> 220 <div class="cabinet__inputs_to_column cabinet__inputs_to_columns_right">
217 <div class="cabinet__inputs-item form-group"> 221 <div class="cabinet__inputs-item form-group">
218 <label class="form-group__label">Наличие визы:</label> 222 <label class="form-group__label">Наличие визы:</label>
219 <div class="form-group__item"> 223 <div class="form-group__item">
220 {{ $worker->visa_available }} 224 {{ $worker->visa_available }}
221 </div> 225 </div>
222 </div> 226 </div>
223 227
224 228
225 <div class="cabinet__inputs-item form-group"> 229 <div class="cabinet__inputs-item form-group">
226 <label class="form-group__label">Наличие танкерных документов:</label> 230 <label class="form-group__label">Наличие танкерных документов:</label>
227 <div class="form-group__item"> 231 <div class="form-group__item">
228 {{ $worker->tanker_documents_available ?? '-' }} 232 {{ $worker->tanker_documents_available ?? '-' }}
229 </div> 233 </div>
230 </div> 234 </div>
231 235
232 236
233 <div class="cabinet__inputs-item form-group"> 237 <div class="cabinet__inputs-item form-group">
234 <label class="form-group__label">Наличие подтверждения для работы на ВВП:</label> 238 <label class="form-group__label">Наличие подтверждения для работы на ВВП:</label>
235 <div class="form-group__item"> 239 <div class="form-group__item">
236 {{ $worker->confirmation_work_for_vvp ?? '-' }} 240 {{ $worker->confirmation_work_for_vvp ?? '-' }}
237 </div> 241 </div>
238 </div> 242 </div>
239 243
240 244
241 <div class="cabinet__inputs-item form-group"> 245 <div class="cabinet__inputs-item form-group">
242 <label class="form-group__label">Наличие военного билета / приписного свидетельства:</label> 246 <label class="form-group__label">Наличие военного билета / приписного свидетельства:</label>
243 <div class="form-group__item"> 247 <div class="form-group__item">
244 {{ $worker->military_id_available ?? '-' }} 248 {{ $worker->military_id_available ?? '-' }}
245 </div> 249 </div>
246 </div> 250 </div>
247 251
248 252
249 <div class="cabinet__inputs-item form-group"> 253 <div class="cabinet__inputs-item form-group">
250 <label class="form-group__label">Город проживания:</label> 254 <label class="form-group__label">Город проживания:</label>
251 <div class="form-group__item"> 255 <div class="form-group__item">
252 {{ $worker->city ?? '-' }} 256 {{ $worker->city ?? '-' }}
253 </div> 257 </div>
254 </div> 258 </div>
255 259
256 260
257 <div class="cabinet__inputs-item form-group"> 261 <div class="cabinet__inputs-item form-group">
258 <label class="form-group__label">Телефон:</label> 262 <label class="form-group__label">Телефон:</label>
259 <div class="form-group__item"> 263 <div class="form-group__item">
260 {{ $worker->telephone ?? '-' }} 264 {{ $worker->telephone ?? '-' }}
261 </div> 265 </div>
262 </div> 266 </div>
263 267
264 268
265 <div class="cabinet__inputs-item form-group"> 269 <div class="cabinet__inputs-item form-group">
266 <label class="form-group__label">E-mail:</label> 270 <label class="form-group__label">E-mail:</label>
267 <div class="form-group__item"> 271 <div class="form-group__item">
268 {{ $worker->email ?? '-' }} 272 {{ $worker->email ?? '-' }}
269 </div> 273 </div>
270 </div> 274 </div>
271 275
272 276
273 <div class="cabinet__inputs-item form-group"> 277 <div class="cabinet__inputs-item form-group">
274 <label class="form-group__label">Контакты родственников:</label> 278 <label class="form-group__label">Контакты родственников:</label>
275 <div class="form-group__item"> 279 <div class="form-group__item">
276 {{ $worker->telephone2 ?? '-' }} 280 {{ $worker->telephone2 ?? '-' }}
277 </div> 281 </div>
278 </div> 282 </div>
279 </div> 283 </div>
280 </div> 284 </div>
281 <div class="width100"> 285 <div class="width100">
282 <h4 class="cabinet__h4 mb-10">О себе</h4> 286 <h4 class="cabinet__h4 mb-10">О себе</h4>
283 <div style="white-space:break-spaces; word-break: break-word;">{{ $worker->text }}</div> 287 <div style="white-space:break-spaces; word-break: break-word;">{{ $worker->text }}</div>
284 </div> 288 </div>
285 <div class=""> 289 <div class="">
286 <a href="{{ route('worker.basic_information') }}" class="button active">Редактировать основную информацию</a> 290 <a href="{{ route('worker.basic_information') }}" class="button active">Редактировать основную информацию</a>
287 </div> 291 </div>
288 </div> 292 </div>
289 </div> 293 </div>
290 294
291 <div class="mb-40" id="sertificate" name="sertificate"> 295 <div class="mb-40" id="sertificate" name="sertificate">
292 <h3 class="cabinet__subtitle font30 mb-20">Сертификаты / документы</h3> 296 <h3 class="cabinet__subtitle font30 mb-20">Сертификаты / документы</h3>
293 297
294 @if($worker->sertificate->count()) 298 @if($worker->sertificate->count())
295 @foreach($worker->sertificate as $sertificate) 299 @foreach($worker->sertificate as $sertificate)
296 <div class="one-sertificate"> 300 <div class="one-sertificate">
297 <div class="sertificate-field sertificate-name"> 301 <div class="sertificate-field sertificate-name">
298 <label class="bold">Название сертификата:</label> 302 <label class="bold">Название сертификата:</label>
299 <div>{{ $sertificate->name }}</div> 303 <div>{{ $sertificate->name }}</div>
300 </div> 304 </div>
301 <div class="sertificate-field"> 305 <div class="sertificate-field">
302 <label class="bold">Действителен до:</label> 306 <label class="bold">Действителен до:</label>
303 <div>{{ date('d.m.Y', strtotime($sertificate->end_begin)) }}</div> 307 <div>{{ date('d.m.Y', strtotime($sertificate->end_begin)) }}</div>
304 </div> 308 </div>
305 <div class="sertificate-field sertificate-buttons"> 309 <div class="sertificate-field sertificate-buttons">
306 <a href="{{ route('worker.edit_sertificate', ['worker' => $worker->id, 'doc' => $sertificate->id ]) }}" class="button button_light mr-10"> 310 <a href="{{ route('worker.edit_sertificate', ['worker' => $worker->id, 'doc' => $sertificate->id ]) }}" class="button button_light mr-10">
307 <svg><use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use></svg> 311 <svg><use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use></svg>
308 </a> 312 </a>
309 <a href="{{ route('worker.delete_sertificate', ['doc' => $sertificate->id]) }}" class="button button_light"> 313 <a href="{{ route('worker.delete_sertificate', ['doc' => $sertificate->id]) }}" class="button button_light">
310 <svg><use xlink:href="{{ asset('images/sprite.svg#del') }}"></use></svg> 314 <svg><use xlink:href="{{ asset('images/sprite.svg#del') }}"></use></svg>
311 </a> 315 </a>
312 </div> 316 </div>
313 </div> 317 </div>
314 @endforeach 318 @endforeach
315 @endif 319 @endif
316 320
317 <a class="button fit-content" href="{{ route('worker.new_sertificate',['worker' => $worker->id]) }}" id="button_new_doc" name="button_new_doc"> 321 <a class="button fit-content" href="{{ route('worker.new_sertificate',['worker' => $worker->id]) }}" id="button_new_doc" name="button_new_doc">
318 Добавить сертификат / документ 322 Добавить сертификат / документ
319 </a> 323 </a>
320 </div> 324 </div>
321 325
322 <div class="cabinet__body-item mb-40" name="ajax_dop_diplomi" id="ajax_dop_diplomi"> 326 <div class="cabinet__body-item mb-40" name="ajax_dop_diplomi" id="ajax_dop_diplomi">
323 <h3 class="cabinet__subtitle font30">Дополнительные документы</h3> 327 <h3 class="cabinet__subtitle font30">Дополнительные документы</h3>
324 328
325 <div class="cabinet__inputs" id="block_sertificate"> 329 <div class="cabinet__inputs" id="block_sertificate">
326 @if ($info_blocks->count()) 330 @if ($info_blocks->count())
327 @foreach ($info_blocks as $info_block) 331 @foreach ($info_blocks as $info_block)
328 <div class="cabinet__inputs-item column-count-3 form-group"> 332 <div class="cabinet__inputs-item column-count-3 form-group">
329 <label class="form-group__label">{{ $info_block->name }}:</label> 333 <label class="form-group__label">{{ $info_block->name }}:</label>
330 334
331 <div class="form-group__item"> 335 <div class="form-group__item">
332 @php $status = 0; @endphp 336 @php $status = 0; @endphp
333 @if (!empty($worker->dop_info[$info_block->id]) && $worker->dop_info[$info_block->id]['status']) 337 @if (!empty($worker->dop_info[$info_block->id]) && $worker->dop_info[$info_block->id]['status'])
334 @php $status = $worker->dop_info[$info_block->id]['status']; @endphp 338 @php $status = $worker->dop_info[$info_block->id]['status']; @endphp
335 @endif 339 @endif
336 {{ $additional_document_statuses[$status] }} 340 {{ $additional_document_statuses[$status] }}
337 </div> 341 </div>
338 </div> 342 </div>
339 @endforeach 343 @endforeach
340 @endif 344 @endif
341 </div> 345 </div>
342 346
343 <a class="button fit-content" href="{{ route('worker.additional_documents') }}"> 347 <a class="button fit-content" href="{{ route('worker.additional_documents') }}">
344 Редактировать дополнительные документы 348 Редактировать дополнительные документы
345 </a> 349 </a>
346 </div> 350 </div>
347 351
348 <div class="cabinet__body-item mb-20"> 352 <div class="cabinet__body-item mb-20">
349 <div> 353 <div>
350 <h3 class="cabinet__subtitle font30">Опыт работы</h3> 354 <h3 class="cabinet__subtitle font30">Опыт работы</h3>
351 <div class="">Начните заполнение анкеты с указания последнего места работы</div> 355 <div class="">Начните заполнение анкеты с указания последнего места работы</div>
352 </div> 356 </div>
353 357
354 <div class="cabinet__works"> 358 <div class="cabinet__works">
355 @if (isset($worker->place_worker)) 359 @if (isset($worker->place_worker))
356 @foreach($worker->place_worker as $company) 360 @foreach($worker->place_worker as $company)
357 <div class="cabinet__works-item"> 361 <div class="cabinet__works-item">
358 <div class="cabinet__works-spoiler active"> 362 <div class="cabinet__works-spoiler active">
359 <div class="cabinet__works-spoiler-left"> 363 <div class="cabinet__works-spoiler-left">
360 <div class="cabinet__works-spoiler-text">Место работы {{ $loop->iteration }}</div> 364 <div class="cabinet__works-spoiler-text">Место работы {{ $loop->iteration }}</div>
361 </div> 365 </div>
362 <div class="cabinet__works-spoiler-buttons"> 366 <div class="cabinet__works-spoiler-buttons">
363 <a href="{{ route('worker.edit_document', ['doc' => $company->id, 'worker' => $worker->id]) }}" type="button" class="button button_light mr-10 js-works-edit"> 367 <a href="{{ route('worker.edit_document', ['doc' => $company->id, 'worker' => $worker->id]) }}" type="button" class="button button_light mr-10 js-works-edit">
364 <svg> 368 <svg>
365 <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> 369 <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use>
366 </svg> 370 </svg>
367 </a> 371 </a>
368 <a href="{{ route('worker.delete_document', ['doc' => $company->id]) }}" class="button button_light js-works-remove"> 372 <a href="{{ route('worker.delete_document', ['doc' => $company->id]) }}" class="button button_light js-works-remove">
369 <svg> 373 <svg>
370 <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> 374 <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use>
371 </svg> 375 </svg>
372 </a> 376 </a>
373 </div> 377 </div>
374 </div> 378 </div>
375 379
376 <div class="cabinet__works-body"> 380 <div class="cabinet__works-body">
377 <div class="cabinet__inputs"> 381 <div class="cabinet__inputs">
378 <div class="cabinet__inputs-item column-count-3 form-group"> 382 <div class="cabinet__inputs-item column-count-3 form-group">
379 <label class="form-group__label">Должность:</label> 383 <label class="form-group__label">Должность:</label>
380 <div class="form-group__item"> 384 <div class="form-group__item">
381 {{ $company->job_title ?? '-' }} 385 {{ $company->job_title ?? '-' }}
382 </div> 386 </div>
383 </div> 387 </div>
384 388
385 <div class="cabinet__inputs-item column-count-3 form-group"> 389 <div class="cabinet__inputs-item column-count-3 form-group">
386 <label class="form-group__label">Название т/х:</label> 390 <label class="form-group__label">Название т/х:</label>
387 <div class="form-group__item"> 391 <div class="form-group__item">
388 {{ $company->teplohod ?? '-' }} 392 {{ $company->teplohod ?? '-' }}
389 </div> 393 </div>
390 </div> 394 </div>
391 <div class="cabinet__inputs-item column-count-3 form-group"> 395 <div class="cabinet__inputs-item column-count-3 form-group">
392 <label class="form-group__label">Тип суда:</label> 396 <label class="form-group__label">Тип суда:</label>
393 <div class="form-group__item"> 397 <div class="form-group__item">
394 {{ $company->GWT ?? '-' }} 398 {{ $company->GWT ?? '-' }}
395 </div> 399 </div>
396 </div> 400 </div>
397 <div class="cabinet__inputs-item column-count-3 form-group"> 401 <div class="cabinet__inputs-item column-count-3 form-group">
398 <label class="form-group__label">Марка ГД:</label> 402 <label class="form-group__label">Марка ГД:</label>
399 <div class="form-group__item"> 403 <div class="form-group__item">
400 {{ $company->Marka_GD ?? '-' }} 404 {{ $company->Marka_GD ?? '-' }}
401 </div> 405 </div>
402 </div> 406 </div>
403 <div class="cabinet__inputs-item column-count-3 form-group"> 407 <div class="cabinet__inputs-item column-count-3 form-group">
404 <label class="form-group__label">Мощность ГД (кВТ):</label> 408 <label class="form-group__label">Мощность ГД (кВТ):</label>
405 <div class="form-group__item"> 409 <div class="form-group__item">
406 {{ $company->KBT ?? '-' }} 410 {{ $company->KBT ?? '-' }}
407 </div> 411 </div>
408 </div> 412 </div>
409 <div class="cabinet__inputs-item column-count-3 form-group"> 413 <div class="cabinet__inputs-item column-count-3 form-group">
410 <label class="form-group__label">Водоизмещение (DWT):</label> 414 <label class="form-group__label">Водоизмещение (DWT):</label>
411 <div class="form-group__item"> 415 <div class="form-group__item">
412 {{ $company->GRT ?? '-' }} 416 {{ $company->GRT ?? '-' }}
413 </div> 417 </div>
414 </div> 418 </div>
415 <div class="cabinet__inputs-item column-count-3 form-group"> 419 <div class="cabinet__inputs-item column-count-3 form-group">
416 <label class="form-group__label">Название компании:</label> 420 <label class="form-group__label">Название компании:</label>
417 <div class="form-group__item"> 421 <div class="form-group__item">
418 {{ $company->name_company ?? '-' }} 422 {{ $company->name_company ?? '-' }}
419 </div> 423 </div>
420 </div> 424 </div>
421 <div class="cabinet__inputs-item column-count-3 form-group"> 425 <div class="cabinet__inputs-item column-count-3 form-group">
422 <label class="form-group__label">Начало контракта:</label> 426 <label class="form-group__label">Начало контракта:</label>
423 <div class="form-group__item"> 427 <div class="form-group__item">
424 {{ $company->begin_work ?? '-' }} 428 {{ $company->begin_work ?? '-' }}
425 </div> 429 </div>
426 </div> 430 </div>
427 <div class="cabinet__inputs-item column-count-3 form-group"> 431 <div class="cabinet__inputs-item column-count-3 form-group">
428 <label class="form-group__label">Окончание контракта:</label> 432 <label class="form-group__label">Окончание контракта:</label>
429 <div class="form-group__item"> 433 <div class="form-group__item">
430 {{ $company->end_work ?? '-' }} 434 {{ $company->end_work ?? '-' }}
431 </div> 435 </div>
432 </div> 436 </div>
433 437
434 </div> 438 </div>
435 </div> 439 </div>
436 </div> 440 </div>
437 @endforeach 441 @endforeach
438 @endif 442 @endif
439 </div> 443 </div>
440 444
441 <a href="{{ route('worker.add_document', ['worker' => $worker->id]) }}" id="new_work" name="new_work" class="button fit-content"> 445 <a href="{{ route('worker.add_document', ['worker' => $worker->id]) }}" id="new_work" name="new_work" class="button fit-content">
442 Добавить место работы 446 Добавить место работы
443 </a> 447 </a>
444 </div> 448 </div>
445 449
446 <div id="prev_worker" name="prev_worker"> 450 <div id="prev_worker" name="prev_worker">
447 <div> 451 <div>
448 <h3 class="cabinet__subtitle font30">Рекомендации</h3> 452 <h3 class="cabinet__subtitle font30">Рекомендации</h3>
449 <div class="">Укажите контакты компаний, которые могут дать рекомендации</div> 453 <div class="">Укажите контакты компаний, которые могут дать рекомендации</div>
450 </div> 454 </div>
451 455
452 @if ((isset($worker->prev_company)) && ($worker->prev_company->count() > 0)) 456 @if ((isset($worker->prev_company)) && ($worker->prev_company->count() > 0))
453 @foreach($worker->prev_company as $it) 457 @foreach($worker->prev_company as $it)
454 <div class="cabinet__body-item"> 458 <div class="cabinet__body-item">
455 <div class="cabinet__inputs mt-30"> 459 <div class="cabinet__inputs mt-30">
456 <div class="cabinet__inputs-item column-count-3 form-group"> 460 <div class="cabinet__inputs-item column-count-3 form-group">
457 <label class="form-group__label">Название компании:</label> 461 <label class="form-group__label">Название компании:</label>
458 <div class="form-group__item"> 462 <div class="form-group__item">
459 {{ $it->name_company }} 463 {{ $it->name_company }}
460 </div> 464 </div>
461 </div> 465 </div>
462 <div class="cabinet__inputs-item column-count-3 form-group"> 466 <div class="cabinet__inputs-item column-count-3 form-group">
463 <label class="form-group__label">ФИО сотрудника:</label> 467 <label class="form-group__label">ФИО сотрудника:</label>
464 <div class="form-group__item"> 468 <div class="form-group__item">
465 {{ $it->direct }} 469 {{ $it->direct }}
466 </div> 470 </div>
467 </div> 471 </div>
468 <div class="cabinet__inputs-item column-count-3 form-group cabinet__inputs-item-buttons"> 472 <div class="cabinet__inputs-item column-count-3 form-group cabinet__inputs-item-buttons">
469 <div class="flex"> 473 <div class="flex">
470 <a href="{{ route('worker.edit_prev_company', ['worker' => $worker->id, 'doc' => $it->id ]) }}" class="button button_light mr-10"> 474 <a href="{{ route('worker.edit_prev_company', ['worker' => $worker->id, 'doc' => $it->id ]) }}" class="button button_light mr-10">
471 <svg> 475 <svg>
472 <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> 476 <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use>
473 </svg> 477 </svg>
474 </a> 478 </a>
475 <a href="{{ route('worker.delete_prev_company', ['doc' => $it->id]) }}" class="button button_light"> 479 <a href="{{ route('worker.delete_prev_company', ['doc' => $it->id]) }}" class="button button_light">
476 <svg> 480 <svg>
477 <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> 481 <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use>
478 </svg> 482 </svg>
479 </a> 483 </a>
480 </div> 484 </div>
481 </div> 485 </div>
482 <div class="cabinet__inputs-item column-count-3 form-group"> 486 <div class="cabinet__inputs-item column-count-3 form-group">
483 <label class="form-group__label">Должность сотрудника:</label> 487 <label class="form-group__label">Должность сотрудника:</label>
484 <div class="form-group__item"> 488 <div class="form-group__item">
485 {{ $it->telephone }} 489 {{ $it->telephone }}
486 </div> 490 </div>
487 </div> 491 </div>
488 <div class="cabinet__inputs-item column-count-3 form-group"> 492 <div class="cabinet__inputs-item column-count-3 form-group">
489 <label class="form-group__label">Телефон сотрудника:</label> 493 <label class="form-group__label">Телефон сотрудника:</label>
490 <div class="form-group__item"> 494 <div class="form-group__item">
491 {{ $it->telephone2 }} 495 {{ $it->telephone2 }}
492 </div> 496 </div>
493 </div> 497 </div>
494 <div class="cabinet__inputs-item column-count-3 form-group cabinet__inputs-item-buttons"></div> 498 <div class="cabinet__inputs-item column-count-3 form-group cabinet__inputs-item-buttons"></div>
495 </div> 499 </div>
496 </div> 500 </div>
497 @endforeach 501 @endforeach
498 @endif 502 @endif
499 </div> 503 </div>
500 504
501 <div class="cabinet__body-item"> 505 <div class="cabinet__body-item">
502 <a class="button fit-content" href="{{ route('worker.new_prev_company',['worker' => $worker->id]) }}"> 506 <a class="button fit-content" href="{{ route('worker.new_prev_company',['worker' => $worker->id]) }}">
503 Добавить контакт для рекомендации 507 Добавить контакт для рекомендации
504 </a> 508 </a>
505 </div> 509 </div>
506 </div> 510 </div>
507 </div> 511 </div>
508 </div> 512 </div>
509 </section> 513 </section>
510 @endsection 514 @endsection
511 515
resources/views/workers/docs.blade.php
1 @extends('workers.cabinet_layout', ['title' => 'Добавление стандартного документа - РекаМоре']) 1 @extends('workers.cabinet_layout', ['title' => 'Добавление стандартного документа - РекаМоре'])
2 2
3 @section('cabinet_content') 3 @section('cabinet_content')
4 <h3 class="cabinet__h4 font30">Место работы</h3> 4 <h3 class="cabinet__h4 font30">Место работы</h3>
5 <div class="cabinet__inputs"> 5 <div class="cabinet__inputs">
6 @csrf 6 @csrf
7 <input type="hidden" name="worker_id" id="worker_id" class="input" value="{{ $worker->id }}"> 7 <input type="hidden" name="worker_id" id="worker_id" class="input" value="{{ $worker->id }}">
8 8
9 <div class="error-block"></div> 9 <div class="error-block"></div>
10 10
11 <div class="cabinet__body-item width100"> 11 <div class="cabinet__body-item width100">
12 <div class="cabinet__inputs"> 12 <div class="cabinet__inputs">
13 <div class="cabinet__inputs-item form-group"> 13 <div class="cabinet__inputs-item form-group">
14 <label class="form-group__label">Должность</label> 14 <label class="form-group__label">Должность</label>
15 <div class="form-group__item"> 15 <div class="form-group__item">
16 <input type="text" name="job_title" id="job_title" class="input" value="{{ old('job_title') ?? $doc->job_title ?? '' }}" required> 16 <input type="text" name="job_title" id="job_title" class="input" value="{{ old('job_title') ?? $doc->job_title ?? '' }}" required>
17 </div> 17 </div>
18 </div> 18 </div>
19 19
20 <div class="cabinet__inputs-item form-group"> 20 <div class="cabinet__inputs-item form-group">
21 <label class="form-group__label">Название т/х</label> 21 <label class="form-group__label">Название т/х</label>
22 <div class="form-group__item"> 22 <div class="form-group__item">
23 <input type="text" name="teplohod" id="teplohod" class="input" value="{{ old('teplohod') ?? $doc->teplohod ?? '' }}" required> 23 <input type="text" name="teplohod" id="teplohod" class="input" value="{{ old('teplohod') ?? $doc->teplohod ?? '' }}" required>
24 </div> 24 </div>
25 </div> 25 </div>
26 26
27 <div class="cabinet__inputs-item form-group"> 27 <div class="cabinet__inputs-item form-group">
28 <label class="form-group__label">Тип судна</label> 28 <label class="form-group__label">Тип судна</label>
29 <div class="form-group__item"> 29 <div class="form-group__item">
30 <input type="text" name="GWT" id="GWT" class="input" value="{{ old('GWT') ?? $doc->GWT ?? '' }}" required> 30 <input type="text" name="GWT" id="GWT" class="input" value="{{ old('GWT') ?? $doc->GWT ?? '' }}" required>
31 </div> 31 </div>
32 </div> 32 </div>
33 33
34 <div class="cabinet__inputs-item form-group"> 34 <div class="cabinet__inputs-item form-group">
35 <label class="form-group__label">Марка ГД</label> 35 <label class="form-group__label">Марка ГД</label>
36 <div class="form-group__item"> 36 <div class="form-group__item">
37 <input type="text" name="Marka_GD" id="Marka_GD" class="input" value="{{ old('Marka_GD') ?? $doc->Marka_GD ?? '' }}"> 37 <input type="text" name="Marka_GD" id="Marka_GD" class="input" value="{{ old('Marka_GD') ?? $doc->Marka_GD ?? '' }}">
38 </div> 38 </div>
39 </div> 39 </div>
40 40
41 <div class="cabinet__inputs-item form-group"> 41 <div class="cabinet__inputs-item form-group">
42 <label class="form-group__label">Мощность (кВт)</label> 42 <label class="form-group__label">Мощность (кВт)</label>
43 <div class="form-group__item"> 43 <div class="form-group__item">
44 <input type="text" name="KBT" id="KBT" class="input" value="{{ old('KBT') ?? $doc->KBT ?? '' }}"> 44 <input type="text" name="KBT" id="KBT" class="input" value="{{ old('KBT') ?? $doc->KBT ?? '' }}">
45 </div> 45 </div>
46 </div> 46 </div>
47 47
48 <div class="cabinet__inputs-item form-group"> 48 <div class="cabinet__inputs-item form-group">
49 <label class="form-group__label">Водоизмещение (GRT)</label> 49 <label class="form-group__label">Водоизмещение (GRT)</label>
50 <div class="form-group__item"> 50 <div class="form-group__item">
51 <input type="text" name="GRT" id="GRT" class="input" value="{{ old('GRT') ?? $doc->GRT ?? '' }}" required> 51 <input type="text" name="GRT" id="GRT" class="input" value="{{ old('GRT') ?? $doc->GRT ?? '' }}" required>
52 </div> 52 </div>
53 </div> 53 </div>
54 54
55 <div class="cabinet__inputs-item form-group"> 55 <div class="cabinet__inputs-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="text" name="name_company" id="name_company" class="input" value="{{ old('name_company') ?? $doc->name_company ?? '' }}" required> 58 <input type="text" name="name_company" id="name_company" class="input" value="{{ old('name_company') ?? $doc->name_company ?? '' }}" required>
59 </div> 59 </div>
60 </div> 60 </div>
61 61
62 <div class="cabinet__inputs-item form-group"> 62 <div class="cabinet__inputs-item form-group">
63 <label class="form-group__label">Начало контракта</label> 63 <label class="form-group__label">Начало контракта</label>
64 <div class="form-group__item"> 64 <div class="form-group__item">
65 <input type="text" name="Begin_work" id="Begin_work" class="input" value="{{ old('begin_work') ?? $doc->begin_work ?? '' }}"> 65 <input
66 type="text"
67 name="Begin_work"
68 id="Begin_work"
69 class="input"
70 placeholder="11.11.2011"
71 value="{{ old('begin_work') ?? $doc->begin_work ?? '' }}">
66 </div> 72 </div>
67 </div> 73 </div>
68 74
69 <div class="cabinet__inputs-item form-group"> 75 <div class="cabinet__inputs-item form-group">
70 <label class="form-group__label">Окончание контракта</label> 76 <label class="form-group__label">Окончание контракта</label>
71 <div class="form-group__item"> 77 <div class="form-group__item">
72 <input type="text" name="End_work" id="End_work" class="input" value="{{ old('end_work') ?? $doc->end_work ?? '' }}"> 78 <input
79 type="text"
80 name="End_work"
81 id="End_work"
82 class="input"
83 placeholder="11.11.2011"
84 value="{{ old('end_work') ?? $doc->end_work ?? '' }}">
73 </div> 85 </div>
74 </div> 86 </div>
87
75 </div> 88 </div>
76 89
77 <div class="flex"> 90 <div class="flex">
78 <button class="button add-place-of-work-button mr-10">Сохранить</button> 91 <button class="button add-place-of-work-button mr-10">Сохранить</button>
79 <a href="{{ route('worker.cabinet') }}" class="button button_light">Назад</a> 92 <a href="{{ route('worker.cabinet') }}" class="button button_light">Назад</a>
80 </div> 93 </div>
81 </div> 94 </div>
82 </div> 95 </div>
83 96
84 <div class="hide"> 97 <div class="hide">
85 <div id="after_add_place_of_work_chat" class="modal-dialog"> 98 <div id="after_add_place_of_work_chat" class="modal-dialog">
86 <div class="modal-dialog-title"> 99 <div class="modal-dialog-title">
87 <h2>Место работы успешно добавлено</h2> 100 <h2>Место работы успешно добавлено</h2>
88 </div> 101 </div>
89 <div class="modal-dialog-body pt-20"></div> 102 <div class="modal-dialog-body pt-20"></div>
90 <div class="modal-dialog-footer center"> 103 <div class="modal-dialog-footer center">
91 <a href="{{ route('worker.add_document', ['worker' => $worker->id]) }}" class="button remove-chat-button mr-20">Добавить еще</a> 104 <a href="{{ route('worker.add_document', ['worker' => $worker->id]) }}" class="button remove-chat-button mr-20">Добавить еще</a>
92 <a href="{{ route('worker.cabinet') }}" class="button button_light" onclick="$.fancybox.close();">Закончить</a> 105 <a href="{{ route('worker.cabinet') }}" class="button button_light" onclick="$.fancybox.close();">Закончить</a>
93 </div> 106 </div>
94 </div> 107 </div>
95 <button class="open-after_add_place_of_work_chat-button" data-fancybox data-src="#after_add_place_of_work_chat"></button> 108 <button class="open-after_add_place_of_work_chat-button" data-fancybox data-src="#after_add_place_of_work_chat"></button>
96 </div> 109 </div>
97 @endsection 110 @endsection
98 111
99 @section('scripts') 112 @section('scripts')
100 <script> 113 <script>
101 $(function(){ 114 $(function(){
102 $('.add-place-of-work-button').click(function(){ 115 $('.add-place-of-work-button').click(function(){
103 var this_btn = $(this); 116 var this_btn = $(this);
104 spinStart(this_btn); 117 spinStart(this_btn);
105 var wrap = this_btn.closest('.cabinet__inputs'); 118 var wrap = this_btn.closest('.cabinet__inputs');
106 var data = {}; 119 var data = {};
107 var form_is_not_filled = false; 120 var form_is_not_filled = false;
121 var date_format_regex = /^\d{2}\.\d{2}\.\d{4}$/;
108 122
109 wrap.find('.error-block').html(''); 123 wrap.find('.error-block').html('');
110 wrap.find('input').removeClass('border-red'); 124 wrap.find('input').removeClass('border-red');
111 125
112 wrap.find('input').each(function(){ 126 wrap.find('input').each(function(){
113 var val = $(this).val().trim(); 127 var val = $(this).val().trim();
128 var name = $(this).attr('name');
114 129
115 if ($(this).is('[required]') && !val){ 130 if ($(this).is('[required]') && !val){
116 $(this).addClass('border-red'); 131 $(this).addClass('border-red');
117 form_is_not_filled = true; 132 form_is_not_filled = true;
133 } else if ($(this).attr('name') === 'Begin_work' || $(this).attr('name') === 'End_work') {
134 if (!date_format_regex.test(val)) {
135 $(this).addClass('border-red');
136 $(this).after('<span class="error-block">Неверный формат даты (дд.мм.гггг).</span>');
137 form_is_not_filled = true;
138 }
118 } 139 }
119 140
120 var name = $(this).attr('name');
121 data[name] = val; 141 data[name] = val;
122 }); 142 });
123 143
124 if (form_is_not_filled){ 144 if (form_is_not_filled) {
125 spinStop(this_btn); 145 spinStop(this_btn);
126 return; 146 return;
127 } 147 }
128 148
129 $.ajax({ 149 $.ajax({
130 type: 'POST', 150 type: 'POST',
131 url: "{{ route('worker.add_document_save') }}", 151 url: "{{ route('worker.add_document_save') }}",
132 data: data, 152 data: data,
133 dataType: 'json', 153 dataType: 'json',
134 headers: { 154 headers: {
135 'X-CSRF-TOKEN': $('[name="_token"]').val() 155 'X-CSRF-TOKEN': $('[name="_token"]').val()
136 }, 156 },
137 success: function(res){ 157 success: function(res){
138 spinStop(this_btn); 158 spinStop(this_btn);
139 $('.open-after_add_place_of_work_chat-button').click(); 159 $('.open-after_add_place_of_work_chat-button').click();
140 }, 160 },
141 error: function(jqXHR, exception){ 161 error: function(jqXHR, exception){
142 if (jqXHR && jqXHR.responseJSON && jqXHR.responseJSON.message){ 162 if (jqXHR && jqXHR.responseJSON && jqXHR.responseJSON.message){
143 wrap.find('.error-block').html(jqXHR.responseJSON.message); 163 wrap.find('.error-block').html(jqXHR.responseJSON.message);
144 } 164 }
145 spinStop(this_btn); 165 spinStop(this_btn);
146 } 166 }
147 }); 167 });
148 }); 168 });
149 169
150 170
151 }); 171 });
152 </script> 172 </script>
153 @endsection 173 @endsection
resources/views/workers/favorite.blade.php
1 @extends('layout.frontend', ['title' => 'Избранные - РекаМоре']) 1 @extends('layout.frontend', ['title' => 'Избранные - РекаМоре'])
2 2
3 @section('scripts') 3 @section('scripts')
4 @include('js.favorite-vacancy-45') 4 @include('js.favorite-vacancy-45')
5 @endsection 5 @endsection
6 6
7 @section('content') 7 @section('content')
8 <section class="cabinet"> 8 <section class="cabinet">
9 <div class="container"> 9 <div class="container">
10 <ul class="breadcrumbs cabinet__breadcrumbs"> 10 <ul class="breadcrumbs cabinet__breadcrumbs">
11 <li><a href="{{ route('index') }}">Главная</a></li> 11 <li><a href="{{ route('index') }}">Главная</a></li>
12 <li><b>Личный кабинет</b></li> 12 <li><b>Личный кабинет</b></li>
13 </ul> 13 </ul>
14 <div class="cabinet__wrapper"> 14 <div class="cabinet__wrapper">
15 <div class="cabinet__side"> 15 <div class="cabinet__side">
16 <div class="cabinet__side-toper"> 16 <div class="cabinet__side-toper">
17 @include('workers.emblema') 17 @include('workers.emblema')
18 18
19 </div> 19 </div>
20 @include('workers.menu', ['item' => 3]) 20 @include('workers.menu', ['item' => 3])
21 </div> 21 </div>
22 22
23 <div class="cabinet__body"> 23 <div class="cabinet__body">
24 <div class="cabinet__body-item"> 24 <div class="cabinet__body-item">
25 <h2 class="title cabinet__title">Избранные вакансии</h2> 25 <h2 class="title cabinet__title">Избранные вакансии</h2>
26 </div> 26 </div>
27 <div class="cabinet__body-item"> 27 <div class="cabinet__body-item">
28 <div class="cabinet__filters"> 28 <div class="cabinet__filters">
29 <div class="cabinet__filters-item"> 29 <div class="cabinet__filters-item">
30 <form class="search" action="{{ route('worker.colorado') }}" method="GET"> 30 <form class="search" action="{{ route('worker.colorado') }}" method="GET">
31 <input type="search" name="search" id="search" class="input" placeholder="Поиск&hellip;"> 31 <input type="search" name="search" id="search" class="input" placeholder="Поиск&hellip;">
32 <button type="submit" class="button">Найти</button> 32 <button type="submit" class="button">Найти</button>
33 <span> 33 <span>
34 <svg> 34 <svg>
35 <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> 35 <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use>
36 </svg> 36 </svg>
37 </span> 37 </span>
38 </form> 38 </form>
39 </div> 39 </div>
40 <!--<div class="cabinet__filters-item"> 40 <!--<div class="cabinet__filters-item">
41 <div class="select"> 41 <div class="select">
42 <select class="js-select2" id="sort_ajax" name="sort_ajax"> 42 <select class="js-select2" id="sort_ajax" name="sort_ajax">
43 <option value="default">Сортировка (по умолчанию)</option> 43 <option value="default">Сортировка (по умолчанию)</option>
44 <option value="name (asc)">По имени (возрастание)</option> 44 <option value="name (asc)">По имени (возрастание)</option>
45 <option value="name (desc)">По имени (убывание)</option> 45 <option value="name (desc)">По имени (убывание)</option>
46 <option value="created_at (asc)">По дате (возрастание)</option> 46 <option value="created_at (asc)">По дате (возрастание)</option>
47 <option value="created_at (desc)">По дате (убывание)</option> 47 <option value="created_at (desc)">По дате (убывание)</option>
48 </select> 48 </select>
49 </div> 49 </div>
50 </div>--> 50 </div>-->
51 </div> 51 </div>
52 @if ($Query->count()) 52 @if ($Query->count())
53 <div class="cabinet__vacs"> 53 <div class="cabinet__vacs">
54 <div id="main_ockar" name="main_ockar" class="cabinet__vacs-body" style="width:100%;"> 54 <div id="main_ockar" name="main_ockar" class="cabinet__vacs-body" style="width:100%;">
55 @foreach ($Query as $Q) 55 @foreach ($Query as $Q)
56 <div class="main__vacancies-item main__employer-page-two-item"> 56 <div class="main__vacancies-item main__employer-page-two-item">
57 <a href="{{ route('list-vacancies') }}" class="back main__employer-page-two-item-back"> 57 <a href="{{ route('list-vacancies') }}" class="back main__employer-page-two-item-back">
58 <svg> 58 <svg>
59 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> 59 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use>
60 </svg> 60 </svg>
61 <span> 61 <span>
62 Вернуться к списку вакансий 62 Вернуться к списку вакансий
63 </span> 63 </span>
64 </a> 64 </a>
65 <div class="main__employer-page-two-item-toper"> 65 <div class="main__employer-page-two-item-toper">
66 @if (!empty($Q->employer->logo)) 66 @if (!empty($Q->employer->logo))
67 <img src="{{ asset(Storage::url($Q->employer->logo)) }}" alt="{{ $Q->employer->name }}"> 67 <img src="{{ asset(Storage::url($Q->employer->logo)) }}" alt="{{ $Q->employer->name }}">
68 @else 68 @else
69 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $Q->employer->name }}" class="main__vacancies-thing-pic"> 69 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $Q->employer->name }}" class="main__vacancies-thing-pic">
70 @endif 70 @endif
71 <span>@if (isset($Q->employer->name_company)) {{ $Q->employer->name_company }} @else Не определена @endif </span> 71 <span>@if (isset($Q->employer->name_company)) {{ $Q->employer->name_company }} @else Не определена @endif </span>
72 </div> 72 </div>
73 <div class="main__employer-page-two-item-text"> 73 <div class="main__employer-page-two-item-text">
74 <div class="main__employer-page-two-item-text-name"> 74 <div class="main__employer-page-two-item-text-name">
75 <h2>@if (!empty($Q->name)) {{ $Q->name }}@else Не указано @endif </h2> 75 <h2>@if (!empty($Q->name)) {{ $Q->name }}@else Не указано @endif </h2>
76 </div> 76 </div>
77 <!-- Судоходная компания ведет набор 77 <!-- Судоходная компания ведет набор
78 специалистов на следующие должности:</div> 78 специалистов на следующие должности:</div>
79 <div class="main__employer-page-two-item-text-links"> 79 <div class="main__employer-page-two-item-text-links">
80 if (isset($Q->jobs)) 80 if (isset($Q->jobs))
81 foreach ($Q->jobs as $key => $j) 81 foreach ($Q->jobs as $key => $j)
82 <a>“{ $j->name }}” 82 <a>“{ $j->name }}”
83 <!-- з/п от if (isset($Q->jobs_code[$key]->min_salary)) { $Q->jobs_code[$key]->min_salary }} endif - if (isset($Q->jobs_code[$key]->max_salary)) { $Q->jobs_code[$key]->max_salary }} endif рублей (на руки)--> 83 <!-- з/п от if (isset($Q->jobs_code[$key]->min_salary)) { $Q->jobs_code[$key]->min_salary }} endif - if (isset($Q->jobs_code[$key]->max_salary)) { $Q->jobs_code[$key]->max_salary }} endif рублей (на руки)-->
84 <!-- </a> 84 <!-- </a>
85 endforeach 85 endforeach
86 endif 86 endif
87 </div>--> 87 </div>-->
88 </div> 88 </div>
89 <div class="main__employer-page-two-item-text"> 89 <div class="main__employer-page-two-item-text">
90 <div class="main__employer-page-two-item-text-name">Мы предлагаем:</div> 90 <div class="main__employer-page-two-item-text-name">Мы предлагаем:</div>
91 <div class="main__employer-page-two-item-text-body"> 91 <div class="main__employer-page-two-item-text-body">
92 {!! $Q->text !!} 92 {!! $Q->text !!}
93 </div> 93 </div>
94 </div> 94 </div>
95 <!--<div class="main__employer-page-two-item-text"> 95 <!--<div class="main__employer-page-two-item-text">
96 <div class="main__employer-page-two-item-text-name">Наши ожидания:</div> 96 <div class="main__employer-page-two-item-text-name">Наши ожидания:</div>
97 <div class="main__employer-page-two-item-text-body"> 97 <div class="main__employer-page-two-item-text-body">
98 !! $Q->description !!} 98 !! $Q->description !!}
99 </div> 99 </div>
100 </div> 100 </div>
101 <div class="main__employer-page-two-item-text"> 101 <div class="main__employer-page-two-item-text">
102 <div class="main__employer-page-two-item-text-name">Резюме направляйте на почту:</div> 102 <div class="main__employer-page-two-item-text-name">Резюме направляйте на почту:</div>
103 <div class="main__employer-page-two-item-text-body"> 103 <div class="main__employer-page-two-item-text-body">
104 !! $Q->contacts_emails !!} 104 !! $Q->contacts_emails !!}
105 </div> 105 </div>
106 </div> 106 </div>
107 <div class="main__employer-page-two-item-text"> 107 <div class="main__employer-page-two-item-text">
108 <div class="main__employer-page-two-item-text-name">Или звоните:</div> 108 <div class="main__employer-page-two-item-text-name">Или звоните:</div>
109 <div class="main__employer-page-two-item-text-body"> 109 <div class="main__employer-page-two-item-text-body">
110 !! $Q->contacts_telephones !!} 110 !! $Q->contacts_telephones !!}
111 </div> 111 </div>
112 </div>--> 112 </div>-->
113 <div class="main__employer-page-two-item-tags"> 113 <div class="main__employer-page-two-item-tags">
114 @if (isset($Q->jobs)) 114 @if (isset($Q->jobs))
115 @foreach ($Q->jobs as $key => $j) 115 @foreach ($Q->jobs as $key => $j)
116 <span class="main__employer-page-two-item-tag">#{{ $j->name }}</span> 116 <span class="main__employer-page-two-item-tag">#{{ $j->name }}</span>
117 @endforeach 117 @endforeach
118 @endif 118 @endif
119 </div> 119 </div>
120 <div class="main__employer-page-two-item-buttons"> 120 <div class="main__employer-page-two-item-buttons">
121 <!--<button type="button" 121 <!--<button type="button"
122 class="button main__employer-page-two-item-button">Откликнуться</button>--> 122 class="button main__employer-page-two-item-button">Откликнуться</button>-->
123 <a href="{{ route('vacancie', ['vacancy' => $Q->id]) }}" class="button button_light main__employer-page-two-item-button">Подробнее</a> 123 <a href="{{ route('vacancie', ['vacancy' => $Q->id]) }}" class="button button_light main__employer-page-two-item-button">Подробнее</a>
124 </div> 124 </div>
125 <div class="main__employer-page-two-item-bottom"> 125 <div class="main__employer-page-two-item-bottom">
126 <div class="main__employer-page-two-item-bottom-date">{{ $Q->created_at }}</div> 126 <div class="main__employer-page-two-item-bottom-date">{{ $Q->created_at }}</div>
127 <button type="button" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js-toggle js_vac_favorite {{ \App\Classes\LikesClass::get_status_vacancy($Q) }}?>"> 127 <button type="button" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js-toggle js_vac_favorite {{ \App\Classes\LikesClass::get_status_vacancy($Q) }}">
128 <svg> 128 <svg>
129 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> 129 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use>
130 </svg> 130 </svg>
131 </button> 131 </button>
132 </div> 132 </div>
133 </div> 133 </div>
134 @endforeach 134 @endforeach
135 <div style="margin-top: 20px"> 135 <div style="margin-top: 20px">
136 {{ $Query->appends($_GET)->links('paginate') }} 136 {{ $Query->appends($_GET)->links('paginate') }}
137 </div> 137 </div>
138 </div> 138 </div>
139 @else 139 @else
140 <div class="notify"> 140 <div class="notify">
141 <svg> 141 <svg>
142 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> 142 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use>
143 </svg> 143 </svg>
144 <span>Нет избранных вакансий</span> 144 <span>Нет избранных вакансий</span>
145 </div> 145 </div>
146 @endif 146 @endif
147 </div> 147 </div>
148 </div> 148 </div>
149 </div> 149 </div>
150 </div> 150 </div>
151 </section> 151 </section>
152 </div> 152 </div>
153 153
154 @endsection 154 @endsection
155 155
resources/views/workers/form_additional_documents.blade.php
1 @extends('workers.cabinet_layout', ['title' => 'Дополнительные документы - РекаМоре']) 1 @extends('workers.cabinet_layout', ['title' => 'Дополнительные документы - РекаМоре'])
2 2
3 @section('cabinet_content') 3 @section('cabinet_content')
4 <form action="{{ route('worker.edit_diploms', ['worker' => $worker->id]) }}" class="cabinet__inputs" method="POST"> 4 <form action="{{ route('worker.edit_diploms', ['worker' => $worker->id]) }}" class="cabinet__inputs" method="POST">
5 @csrf 5 @csrf
6 @method('PUT') 6 @method('PUT')
7 7
8 <div class="mb-40" name="ajax_dop_diplomi" id="ajax_dop_diplomi"> 8 <div class="mb-40" name="ajax_dop_diplomi" id="ajax_dop_diplomi">
9 <div class="cabinet__body-item"> 9 <div class="cabinet__body-item">
10 <div class="cabinet__anketa"> 10 <div class="cabinet__anketa">
11 <h2 class="title cabinet__title">Дополнительные документы</h2> 11 <h2 class="title cabinet__title">Дополнительные документы</h2>
12 </div> 12 </div>
13 </div> 13 </div>
14 14
15 <div class="cabinet__body-item"> 15 <div class="cabinet__body-item">
16 <div class="cabinet__inputs"> 16 <div class="cabinet__inputs">
17 @if ($info_blocks->count()) 17 @if ($info_blocks->count())
18 @foreach ($info_blocks as $info_block) 18 @foreach ($info_blocks as $info_block)
19 <div class="cabinet__inputs-item form-group"> 19 <div class="cabinet__inputs-item form-group">
20 <label class="form-group__label">{{ $info_block->name }}:</label> 20 <label class="form-group__label">{{ $info_block->name }}:</label>
21 21
22 <div class="form-group__item"> 22 <div class="form-group__item">
23 @php $status = 0; @endphp 23 @php $status = 0; @endphp
24 @if (!empty($worker->dop_info[$info_block->id]) && $worker->dop_info[$info_block->id]['status']) 24 @if (!empty($worker->dop_info[$info_block->id]) && $worker->dop_info[$info_block->id]['status'])
25 @php $status = $worker->dop_info[$info_block->id]['status']; @endphp 25 @php $status = $worker->dop_info[$info_block->id]['status']; @endphp
26 @endif 26 @endif
27 27
28 <select name="diploms[{{ $info_block->id }}]" data-info="{{ $info_block->id }}" class="js-select2 sertificates_js"> 28 <select name="diploms[{{ $info_block->id }}]" data-info="{{ $info_block->id }}" class="js-select2 sertificates_js">
29 @foreach($additional_document_statuses as $key => $value) 29 @foreach($additional_document_statuses as $key => $value)
30 <option value="{{ $key }}" @if ($status == $key) selected @endif>{{ $value }}</option> 30 <option value="{{ $key }}" @if ($status == $key) selected @endif>{{ $value }}</option>
31 @endforeach 31 @endforeach
32 </select> 32 </select>
33 </div> 33 </div>
34 </div> 34 </div>
35 @endforeach 35 @endforeach
36 @endif 36 @endif
37 37
38 <div class="cabinet__body-item cabinet__inputs-item-full-row"> 38 <div class="cabinet__body-item cabinet__inputs-item-full-row">
39 <div class="cabinet__buttons_flex"> 39 <div class="cabinet__buttons_flex">
40 <button type="submit" class="button mr-10">Сохранить</button> 40 <button type="submit" class="button mr-10">Сохранить</button>
41 <a href="{{ route('worker.cabinet') }}" class="button button_light active">Назад</a> 41 <a href="{{ route('worker.cabinet') }}" class="button button_light active">Вернуться к моей анкете</a>
42 </div> 42 </div>
43 </div> 43 </div>
44 </div> 44 </div>
45 </div> 45 </div>
46 </div> 46 </div>
47 </form> 47 </form>
48 @endsection 48 @endsection
49 49
resources/views/workers/form_basic_information.blade.php
1 @extends('workers.cabinet_layout', ['title' => 'Основная информация - РекаМоре']) 1 @extends('workers.cabinet_layout', ['title' => 'Основная информация - РекаМоре'])
2 2
3 @section('cabinet_content') 3 @section('cabinet_content')
4 @php 4 @php
5 $worker = $user->workers[0] 5 $worker = $user->workers[0]
6 @endphp 6 @endphp
7 <form action="{{ route('worker.cabinet_save', ['worker' => $worker->id]) }}" enctype="multipart/form-data" method="POST"> 7 <form action="{{ route('worker.cabinet_save', ['worker' => $worker->id]) }}" enctype="multipart/form-data" method="POST">
8 @csrf 8 @csrf
9 @include('messages_error') 9 @include('messages_error')
10 10
11 <div class="cabinet__body-item"> 11 <div class="cabinet__body-item">
12 <div class="cabinet__anketa"> 12 <div class="cabinet__anketa">
13 <h2 class="title cabinet__title">Основная информация</h2> 13 <h2 class="title cabinet__title">Основная информация</h2>
14 </div> 14 </div>
15 </div> 15 </div>
16 16
17 <div class="cabinet__body-item"> 17 <div class="cabinet__body-item">
18 <div class="cabinet__inputs"> 18 <div class="cabinet__inputs">
19 <div class="cabinet__inputs-item form-group"> 19 <div class="cabinet__inputs-item form-group">
20 <label class="form-group__label">Фамилия:</label> 20 <label class="form-group__label">Фамилия:</label>
21 <div class="form-group__item"> 21 <div class="form-group__item">
22 <input type="text" name="surname" id="surmane" class="input" value="{{ $user->surname }}" placeholder="Филиппов" required> 22 <input type="text" name="surname" id="surmane" class="input" value="{{ $user->surname }}" placeholder="Филиппов" required>
23 </div> 23 </div>
24 </div> 24 </div>
25 <div class="cabinet__inputs-item form-group"> 25 <div class="cabinet__inputs-item form-group">
26 <label class="form-group__label">Имя:</label> 26 <label class="form-group__label">Имя:</label>
27 <div class="form-group__item"> 27 <div class="form-group__item">
28 <input type="text" name="name_man" id="name_man" class="input" value="{{ $user->name_man }}" placeholder="Егор" required> 28 <input type="text" name="name_man" id="name_man" class="input" value="{{ $user->name_man }}" placeholder="Егор" required>
29 </div> 29 </div>
30 </div> 30 </div>
31 31
32 <div class="cabinet__inputs-item form-group"> 32 <div class="cabinet__inputs-item form-group">
33 <label class="form-group__label">Отчество:</label> 33 <label class="form-group__label">Отчество:</label>
34 <div class="form-group__item"> 34 <div class="form-group__item">
35 <input type="text" class="input" name="surname2" id="surmane2" value="{{ $user->surname2 }}" placeholder="Алексеевич"> 35 <input type="text" class="input" name="surname2" id="surmane2" value="{{ $user->surname2 }}" placeholder="Алексеевич">
36 </div> 36 </div>
37 </div> 37 </div>
38 <div class="cabinet__inputs-item form-group"> 38 <div class="cabinet__inputs-item form-group">
39 <label class="form-group__label">Возраст</label> 39 <label class="form-group__label">Возраст</label>
40 <div class="form-group__item"> 40 <div class="form-group__item">
41 <input type="number" name="old_year" id="old_year" value="{{ $worker->old_year }}" class="input" placeholder="0" required> 41 <input type="number" name="old_year" id="old_year" value="{{ $worker->old_year }}" class="input" placeholder="0" required>
42 </div> 42 </div>
43 </div> 43 </div>
44 44
45 <div class="cabinet__inputs-item form-group"> 45 <div class="cabinet__inputs-item form-group">
46 <label class="form-group__label">Статус</label> 46 <label class="form-group__label">Статус</label>
47 <div class="form-group__item"> 47 <div class="form-group__item">
48 <div class="select"> 48 <div class="select">
49 <select class="js-select2" name="status_work" id="status_work"> 49 <select class="js-select2" name="status_work" id="status_work">
50 @foreach(App\Enums\WorkerStatuses::getWorkerStatuses() as $status_id => $status_label) 50 @foreach(App\Enums\WorkerStatuses::getWorkerStatuses() as $status_id => $status_label)
51 <option value="{{ $status_id }}" @if ($worker->status_work == $status_id) selected @endif> {{ $status_label }} </option> 51 <option value="{{ $status_id }}" @if ($worker->status_work == $status_id) selected @endif> {{ $status_label }} </option>
52 @endforeach 52 @endforeach
53 </select> 53 </select>
54 </div> 54 </div>
55 </div> 55 </div>
56 </div> 56 </div>
57 57
58 <div class="cabinet__inputs-item cabinet__inputs-item_max form-group cabinet__inputs-item-full-row"> 58 <div class="cabinet__inputs-item cabinet__inputs-item_max form-group cabinet__inputs-item-full-row">
59 <label class="form-group__label">Желаемые вакансии:</label> 59 <label class="form-group__label">Желаемые вакансии:</label>
60 <div class="form-group__item"> 60 <div class="form-group__item">
61 <div class="select"> 61 <div class="select">
62 <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple"> 62 <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple">
63 @if ($job_titles->count()) 63 @if ($job_titles->count())
64 @foreach($job_titles as $job_title) 64 @foreach($job_titles as $job_title)
65 <option value="{{ $job_title->id }}" @if (in_array($job_title->id, $worker->job_titles)) selected @endif>{{ $job_title->name }}</option> 65 <option value="{{ $job_title->id }}" @if (in_array($job_title->id, $worker->job_titles)) selected @endif>{{ $job_title->name }}</option>
66 @endforeach 66 @endforeach
67 @endif 67 @endif
68 </select> 68 </select>
69 </div> 69 </div>
70 </div> 70 </div>
71 </div> 71 </div>
72 72
73 <div class="cabinet__inputs-item form-group"> 73 <div class="cabinet__inputs-item form-group">
74 <label class="form-group__label">Пожелания к З/П:</label> 74 <label class="form-group__label">Пожелания к З/П:</label>
75 <div class="form-group__item"> 75 <div class="form-group__item">
76 <input type="text" name="salary_expectations" id="salary_expectations" value="{{ $worker->salary_expectations }}" class="input" placeholder="От 150 000 руб"> 76 <input type="text" name="salary_expectations" id="salary_expectations" value="{{ $worker->salary_expectations }}" class="input" placeholder="От 150 000 руб">
77 </div> 77 </div>
78 </div> 78 </div>
79 <div class="cabinet__inputs-item form-group"> 79 <div class="cabinet__inputs-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 <div class="select"> 82 <div class="select">
83 <select class="js-select2" id="experience" name="experience"> 83 <select class="js-select2" id="experience" name="experience">
84 <option value="Не указано" @if (empty($worker->experience)) selected @endif>Не указано</option> 84 <option value="Не указано" @if (empty($worker->experience)) selected @endif>Не указано</option>
85 <option value="меньше 1 года" @if ($worker->experience == 'меньше 1 года') selected @endif>меньше 1 года</option> 85 <option value="меньше 1 года" @if ($worker->experience == 'меньше 1 года') selected @endif>меньше 1 года</option>
86 <option value="от 1 года до 3 лет" @if ($worker->experience == 'от 1 года до 3 лет') selected @endif>от 1 года до 3 лет</option> 86 <option value="от 1 года до 3 лет" @if ($worker->experience == 'от 1 года до 3 лет') selected @endif>от 1 года до 3 лет</option>
87 <option value="от 3 до 5 лет" @if ($worker->experience == 'от 3 до 5 лет') selected @endif>от 3 до 5 лет</option> 87 <option value="от 3 до 5 лет" @if ($worker->experience == 'от 3 до 5 лет') selected @endif>от 3 до 5 лет</option>
88 <option value="от 5 до 10 лет" @if ($worker->experience == 'от 5 до 10 лет') selected @endif>от 5 до 10 лет</option> 88 <option value="от 5 до 10 лет" @if ($worker->experience == 'от 5 до 10 лет') selected @endif>от 5 до 10 лет</option>
89 <option value="Больше 10 лет" @if ($worker->experience == 'Больше 10 лет') selected @endif>Больше 10 лет</option> 89 <option value="Больше 10 лет" @if ($worker->experience == 'Больше 10 лет') selected @endif>Больше 10 лет</option>
90 </select> 90 </select>
91 </div> 91 </div>
92 </div> 92 </div>
93 </div> 93 </div>
94 94
95 <div class="cabinet__inputs-item form-group"> 95 <div class="cabinet__inputs-item form-group">
96 <label class="form-group__label">Уровень английского:</label> 96 <label class="form-group__label">Уровень английского:</label>
97 <div class="form-group__item"> 97 <div class="form-group__item">
98 <input type="text" name="english_level" id="english_level" value="{{ $worker->english_level }}" class="input" placeholder="Средний"> 98 <input type="text" name="english_level" id="english_level" value="{{ $worker->english_level }}" class="input" placeholder="Средний">
99 </div> 99 </div>
100 </div> 100 </div>
101 <div class="cabinet__inputs-item form-group"> 101 <div class="cabinet__inputs-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 <input type="text" name="ready_boart_date" id="ready_boart_date" value="{{ $worker->ready_boart_date }}" class="input" placeholder="С 1 января {{ date('Y')}}"> 104 <input type="text" name="ready_boart_date" id="ready_boart_date" value="{{ $worker->ready_boart_date }}" class="input" placeholder="С 1 января {{ date('Y')}}">
105 </div> 105 </div>
106 </div> 106 </div>
107 107
108 <div class="cabinet__inputs-item form-group"> 108 <div class="cabinet__inputs-item form-group">
109 <label class="form-group__label">Предпочтение по типу судна:</label> 109 <label class="form-group__label">Предпочтение по типу судна:</label>
110 <div class="form-group__item"> 110 <div class="form-group__item">
111 <input type="text" name="boart_type_preference" id="boart_type_preference" value="{{ $worker->boart_type_preference }}" class="input" placeholder="Балкер, сухогруз, контейнеровоз"> 111 <input type="text" name="boart_type_preference" id="boart_type_preference" value="{{ $worker->boart_type_preference }}" class="input" placeholder="Балкер, сухогруз, контейнеровоз">
112 </div> 112 </div>
113 </div> 113 </div>
114 <div class="cabinet__inputs-item form-group"> 114 <div class="cabinet__inputs-item form-group">
115 <label class="form-group__label">Наличие визы:</label> 115 <label class="form-group__label">Наличие визы:</label>
116 <div class="form-group__item"> 116 <div class="form-group__item">
117 <input type="text" name="visa_available" id="visa_available" value="{{ $worker->visa_available }}" class="input" placeholder="Да"> 117 <input type="text" name="visa_available" id="visa_available" value="{{ $worker->visa_available }}" class="input" placeholder="В наличии / Отсутствует">
118 </div> 118 </div>
119 </div> 119 </div>
120 120
121 <div class="cabinet__inputs-item form-group"> 121 <div class="cabinet__inputs-item form-group">
122 <label class="form-group__label">Наличие танкерных документов:</label> 122 <label class="form-group__label">Наличие танкерных документов:</label>
123 <div class="form-group__item"> 123 <div class="form-group__item">
124 <input type="text" name="tanker_documents_available" id="tanker_documents_available" value="{{ $worker->tanker_documents_available }}" class="input" placeholder="Нет"> 124 <input type="text" name="tanker_documents_available" id="tanker_documents_available" value="{{ $worker->tanker_documents_available }}" class="input" placeholder="В наличии / Отсутствует">
125 </div> 125 </div>
126 </div> 126 </div>
127 <div class="cabinet__inputs-item form-group"> 127 <div class="cabinet__inputs-item form-group">
128 <label class="form-group__label">Наличие подтверждения для работы на ВВП:</label> 128 <label class="form-group__label">Наличие подтверждения для работы на ВВП:</label>
129 <div class="form-group__item"> 129 <div class="form-group__item">
130 <input type="text" name="confirmation_work_for_vvp" id="confirmation_work_for_vvp" value="{{ $worker->confirmation_work_for_vvp }}" class="input" placeholder="Нет"> 130 <input type="text" name="confirmation_work_for_vvp" id="confirmation_work_for_vvp" value="{{ $worker->confirmation_work_for_vvp }}" class="input" placeholder="В наличии / Отсутствует">
131 </div> 131 </div>
132 </div> 132 </div>
133 133
134 <div class="cabinet__inputs-item form-group"> 134 <div class="cabinet__inputs-item form-group">
135 <label class="form-group__label">Наличие военного билета / приписного свидетельства:</label> 135 <label class="form-group__label">Наличие военного билета / приписного свидетельства:</label>
136 <div class="form-group__item"> 136 <div class="form-group__item">
137 <input type="text" name="military_id_available" id="military_id_available" value="{{ $worker->military_id_available }}" class="input" placeholder="Нет"> 137 <input type="text" name="military_id_available" id="military_id_available" value="{{ $worker->military_id_available }}" class="input" placeholder="НВ наличии / Отсутствуетет">
138 </div> 138 </div>
139 </div> 139 </div>
140 <div class="cabinet__inputs-item form-group"> 140 <div class="cabinet__inputs-item form-group">
141 <label class="form-group__label">Город проживания:</label> 141 <label class="form-group__label">Город проживания:</label>
142 <div class="form-group__item"> 142 <div class="form-group__item">
143 <input type="text" name="city" id="city" value="{{ $worker->city }}" class="input" placeholder="Челябинск" required> 143 <input type="text" name="city" id="city" value="{{ $worker->city }}" class="input" placeholder="Челябинск" required>
144 </div> 144 </div>
145 </div> 145 </div>
146 146
147 <div class="cabinet__inputs-item form-group"> 147 <div class="cabinet__inputs-item form-group">
148 <label class="form-group__label">Телефон:</label> 148 <label class="form-group__label">Телефон:</label>
149 <div class="form-group__item"> 149 <div class="form-group__item">
150 <input type="tel" name="telephone" id="telephone" value="{{ old('telephone') ?? $worker->telephone ?? '' }}" class="input" placeholder="+7 (___) ___-__-__" required> 150 <input type="tel" name="telephone" id="telephone" value="{{ old('telephone') ?? $worker->telephone ?? '' }}" class="input" placeholder="+7 (___) ___-__-__" required>
151 </div> 151 </div>
152 </div> 152 </div>
153 <div class="cabinet__inputs-item form-group"> 153 <div class="cabinet__inputs-item form-group">
154 <label class="form-group__label">E-mail:</label> 154 <label class="form-group__label">E-mail:</label>
155 <div class="form-group__item"> 155 <div class="form-group__item">
156 <input type="email" name="email" id="email" value="{{ $worker->email }}" class="input" placeholder="name@rekamore.su" required> 156 <input type="email" name="email" id="email" value="{{ $worker->email }}" class="input" placeholder="name@rekamore.su" required>
157 </div> 157 </div>
158 </div> 158 </div>
159 159
160 <div class="cabinet__inputs-item form-group"> 160 <div class="cabinet__inputs-item form-group">
161 <label class="form-group__label">Контакты родственников:</label> 161 <label class="form-group__label">Контакты родственников:</label>
162 <div class="form-group__item"> 162 <div class="form-group__item">
163 <input type="text" name="telephone2" id="telephon2" value="{{ old('telephone2') ?? $worker->telephone2 ?? '' }}" class="input"> 163 <input type="text" name="telephone2" id="telephon2" value="{{ old('telephone2') ?? $worker->telephone2 ?? '' }}" class="input" placeholder="+7 (___) ___-__-__ - мама">
164 </div> 164 </div>
165 </div> 165 </div>
166 <div class="cabinet__inputs-item form-group"></div> 166 <div class="cabinet__inputs-item form-group"></div>
167 167
168 <div class="cabinet__body-item cabinet__inputs-item-full-row"> 168 <div class="cabinet__body-item cabinet__inputs-item-full-row">
169 <h4 class="cabinet__h4">О себе</h4> 169 <h4 class="cabinet__h4">О себе</h4>
170 <textarea class="textarea" name="text" id="text" placeholder="Не указано">{{ $worker->text }}</textarea> 170 <textarea class="textarea" name="text" id="text"
171 placeholder="Укажите информацию, которая поможет работодателю или укажите недостающую информацию, которую не смогли указать при заполнении анкеты.">
172 {{ $worker->text }}
173 </textarea>
171 </div> 174 </div>
172 175
173 <div class="cabinet__body-item cabinet__inputs-item-full-row"> 176 <div class="cabinet__body-item cabinet__inputs-item-full-row">
174 <div class="cabinet__buttons_flex"> 177 <div class="cabinet__buttons_flex">
175 <button type="submit" class="button">Сохранить</button> 178 <button type="submit" class="button">Сохранить</button>
176 <a href="{{ route('worker.cabinet') }}" class="button button_light active">Назад</a> 179 <a href="{{ route('worker.cabinet') }}" class="button button_light active">Назад</a>
177 </div> 180 </div>
178 </div> 181 </div>
179 </div> 182 </div>
180 </div> 183 </div>
181 </form> 184 </form>
182 @endsection 185 @endsection
183 186
resources/views/workers/menu.blade.php
1 <div class="cabinet__side-item"> 1 <div class="cabinet__side-item">
2 <div class="cabinet__menu"> 2 <div class="cabinet__menu">
3 <button type="button" class="cabinet__menu-toper js-toggle"> 3 <button type="button" class="cabinet__menu-toper js-toggle">
4 <span class="cabinet__menu-toper-text"></span> 4 <span class="cabinet__menu-toper-text"></span>
5 <i class="cabinet__menu-toper-arrow"> 5 <i class="cabinet__menu-toper-arrow">
6 <svg> 6 <svg>
7 <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> 7 <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use>
8 </svg> 8 </svg>
9 </i> 9 </i>
10 </button> 10 </button>
11 <div class="cabinet__menu-body"> 11 <div class="cabinet__menu-body">
12 <div class="cabinet__menu-items"> 12 <div class="cabinet__menu-items">
13 <a href="{{ route('worker.cabinet') }}" class="cabinet__menu-item @if ($item==1) active @endif"> 13 <a href="{{ route('worker.cabinet') }}" class="cabinet__menu-item @if ($item==1) active @endif">
14 <i> 14 <i>
15 <svg> 15 <svg>
16 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> 16 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
17 </svg> 17 </svg>
18 </i> 18 </i>
19 <span>Моя анкета</span> 19 <span>Моя анкета</span>
20 </a> 20 </a>
21 <a href="{{ route('worker.messages', ['type_message' => 'input']) }}" class="cabinet__menu-item @if ($item==2) active @endif"> 21 <a href="{{ route('worker.messages', ['type_message' => 'input']) }}" class="cabinet__menu-item @if ($item==2) active @endif">
22 <i> 22 <i>
23 <svg> 23 <svg>
24 <use xlink:href="{{ asset('images/sprite.svg#cabinet-5') }}"></use> 24 <use xlink:href="{{ asset('images/sprite.svg#cabinet-5') }}"></use>
25 </svg> 25 </svg>
26 </i> 26 </i>
27 <span>Сообщения</span> 27 <span>Сообщения</span>
28 </a> 28 </a>
29 <a href="{{ route('worker.autolift') }}" class="cabinet__menu-item @if ($item==7) active @endif"> 29 <a href="{{ route('worker.autolift') }}" class="cabinet__menu-item @if ($item==15) active @endif">
30 <i> 30 <i>
31 <svg> 31 <svg>
32 <use xlink:href="{{ asset('images/sprite.svg#refresh') }}"></use> 32 <use xlink:href="{{ asset('images/sprite.svg#refresh') }}"></use>
33 </svg> 33 </svg>
34 </i> 34 </i>
35 <span>Автоподнятие резюме</span> 35 <span>Автоподнятие резюме</span>
36 </a> 36 </a>
37 <a href="{{ route('worker.autoresponder') }}" class="cabinet__menu-item @if ($item==6) active @endif"> 37 <a href="{{ route('worker.autoresponder') }}" class="cabinet__menu-item @if ($item==16) active @endif">
38 <i> 38 <i>
39 <svg> 39 <svg>
40 <use xlink:href="{{ asset('images/sprite.svg#answering') }}"></use> 40 <use xlink:href="{{ asset('images/sprite.svg#answering') }}"></use>
41 </svg> 41 </svg>
42 </i> 42 </i>
43 <span>Автоответчик</span> 43 <span>Автоответчик</span>
44 </a> 44 </a>
45 <a href="{{ route('worker.colorado') }}" class="cabinet__menu-item @if ($item==3) active @endif"> 45 <a href="{{ route('worker.colorado') }}" class="cabinet__menu-item @if ($item==3) active @endif">
46 <i> 46 <i>
47 <svg> 47 <svg>
48 <use xlink:href="{{ asset('images/sprite.svg#cabinet-6') }}"></use> 48 <use xlink:href="{{ asset('images/sprite.svg#cabinet-6') }}"></use>
49 </svg> 49 </svg>
50 </i> 50 </i>
51 <span>Избранные вакансии</span> 51 <span>Избранные вакансии</span>
52 </a> 52 </a>
53 53
54 <a href="{{ route('worker.subscribe') }}" class="cabinet__menu-item @if ($item==11) active @endif"> 54 <a href="{{ route('worker.subscribe') }}" class="cabinet__menu-item @if ($item==11) active @endif">
55 <i><svg> 55 <i><svg>
56 <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use> 56 <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use>
57 </svg></i> 57 </svg></i>
58 <span>Настройки уведомлений</span> 58 <span>Настройки уведомлений</span>
59 </a> 59 </a>
60 <a href="{{ route('worker.new_password') }}" class="cabinet__menu-item green @if ($item==4) active @endif"> 60 <a href="{{ route('worker.new_password') }}" class="cabinet__menu-item green @if ($item==4) active @endif">
61 <i></i> 61 <i></i>
62 <span>Сменить пароль</span> 62 <span>Сменить пароль</span>
63 </a> 63 </a>
64 <a href="{{ route('worker.delete_profile') }}" class="cabinet__menu-item red @if ($item==5) active @endif"> 64 <a href="{{ route('worker.delete_profile') }}" class="cabinet__menu-item red @if ($item==5) active @endif">
65 <i></i> 65 <i></i>
66 <span>Удалить профиль</span> 66 <span>Удалить профиль</span>
67 </a> 67 </a>
68 </div> 68 </div>
69 <div class="cabinet__menu-bottom"> 69 <div class="cabinet__menu-bottom">
70 <a href="{{ route('logout') }}" class="button cabinet__menu-leave"> 70 <a href="{{ route('logout') }}" class="button cabinet__menu-leave">
71 <svg> 71 <svg>
72 <use xlink:href="{{ asset('images/sprite.svg#leave') }}"></use> 72 <use xlink:href="{{ asset('images/sprite.svg#leave') }}"></use>
73 </svg> 73 </svg>
74 Выход 74 Выход
75 </a> 75 </a>
76 <span class="cabinet__menu-copy"> 76 <span class="cabinet__menu-copy">
77 &copy; 2020 &ndash; Rekamore.su 77 &copy; 2020 &ndash; Rekamore.su
78 </span> 78 </span>
79 </div> 79 </div>
80 </div> 80 </div>
81 </div> 81 </div>
82 </div> 82 </div>
83 83
84 <script> 84 <script>
85 $(function(){ 85 $(function(){
86 var active_menu = $('.cabinet__menu-item.active'); 86 var active_menu = $('.cabinet__menu-item.active');
87 console.log(active_menu.length);
87 if (active_menu.length === 1){ 88 if (active_menu.length === 1){
89
88 $('.cabinet__menu-toper-text').html(active_menu.html()); 90 $('.cabinet__menu-toper-text').html(active_menu.html());
89 } 91 }
90 }); 92 });
91 </script> 93 </script>
92 94
resources/views/workers/sertificate_add.blade.php
1 @extends('workers.cabinet_layout', ['title' => 'Добавление стандартного документа - РекаМоре']) 1 @extends('workers.cabinet_layout', ['title' => 'Добавление стандартного документа - РекаМоре'])
2 2
3 @section('cabinet_content') 3 @section('cabinet_content')
4 <h3 class="cabinet__h4 font30">Сертификат / документ</h3> 4 <h3 class="cabinet__h4 font30">Сертификат / документ</h3>
5 <div class="cabinet__inputs"> 5 <div class="cabinet__inputs">
6 @csrf 6 @csrf
7 <input type="hidden" name="worker_id" id="worker_id" class="input" value="{{ $worker->id }}"> 7 <input type="hidden" name="worker_id" id="worker_id" class="input" value="{{ $worker->id }}">
8 8
9 <div class="error-block"></div> 9 <div class="error-block"></div>
10 10
11 <div class="cabinet__body-item width100"> 11 <div class="cabinet__body-item width100">
12 <div class="cabinet__inputs"> 12 <div class="cabinet__inputs sertificate-form-inputs">
13 <div class="cabinet__inputs-item form-group"> 13 <div class="cabinet__inputs-item form-group">
14 <label class="form-group__label">Название сертификата:</label> 14 <label class="form-group__label">Название сертификата:</label>
15 <div class="form-group__item"> 15 <div class="form-group__item">
16 @error('name') 16 @error('name')
17 <div class="error red">{{ $message }}</div> 17 <div class="error red">{{ $message }}</div>
18 @enderror 18 @enderror
19 <input type="text" name="name" id="name" class="input" value="{{ old('name') ?? '' }}" required> 19 <input type="text" name="name" id="name" class="input" value="{{ old('name') ?? '' }}" required>
20 </div> 20 </div>
21 </div> 21 </div>
22 <div class="cabinet__inputs-item form-group"> 22 <div class="cabinet__inputs-item form-group">
23 <label class="form-group__label">Действия сертификата до:</label> 23 <label class="form-group__label">Действия сертификата до:</label>
24 <div class="form-group__item"> 24 <div class="form-group__item">
25 @error('end_begin') 25 @error('end_begin')
26 <div class="error red">{{ $message }}</div> 26 <div class="error red">{{ $message }}</div>
27 @enderror 27 @enderror
28 <input type="text" name="end_begin" id="end_begin" class="input" value="{{ old('end_begin') ?? '' }}" required> 28 <input
29 type="text"
30 name="end_begin"
31 id="end_begin"
32 class="input"
33 placeholder="11.11.2011"
34 value="{{ old('end_begin') ?? '' }}"
35 required>
29 </div> 36 </div>
30 </div> 37 </div>
31 </div> 38 </div>
32 39
33 <div class="flex"> 40 <div class="flex">
34 <button class="button add-serificate-button mr-10">Сохранить</button> 41 <button class="button add-serificate-button mr-10">Сохранить</button>
35 <a href="{{ route('worker.cabinet') }}" class="button button_light">Назад</a> 42 <a href="{{ route('worker.cabinet') }}" class="button button_light">Назад</a>
36 </div> 43 </div>
37 </div> 44 </div>
38 </div> 45 </div>
39 46
40 <div class="hide"> 47 <div class="hide">
41 <div id="after_add_serificate_chat" class="modal-dialog"> 48 <div id="after_add_serificate_chat" class="modal-dialog">
42 <div class="modal-dialog-title"> 49 <div class="modal-dialog-title">
43 <h2>Сертификат / документ успешно добавлен</h2> 50 <h2>Сертификат / документ успешно добавлен</h2>
44 </div> 51 </div>
45 <div class="modal-dialog-body pt-20"></div> 52 <div class="modal-dialog-body pt-20"></div>
46 <div class="modal-dialog-footer center"> 53 <div class="modal-dialog-footer center">
47 <a href="{{ route('worker.new_sertificate',['worker' => $worker->id]) }}" class="button remove-chat-button mr-20">Добавить еще</a> 54 <a href="{{ route('worker.new_sertificate',['worker' => $worker->id]) }}" class="button remove-chat-button mr-20">Добавить еще</a>
48 <a href="{{ route('worker.cabinet') }}" class="button button_light" onclick="$.fancybox.close();">Закончить</a> 55 <a href="{{ route('worker.cabinet') }}" class="button button_light" onclick="$.fancybox.close();">Закончить</a>
49 </div> 56 </div>
50 </div> 57 </div>
51 <button class="open-after_add_serificate_chat-button" data-fancybox data-src="#after_add_serificate_chat"></button> 58 <button class="open-after_add_serificate_chat-button" data-fancybox data-src="#after_add_serificate_chat"></button>
52 </div> 59 </div>
53 @endsection 60 @endsection
54 61
55 @section('scripts') 62 @section('scripts')
56 <script> 63 <script>
57 $(function(){ 64 $(function(){
58 $('.add-serificate-button').click(function(){ 65 $('.add-serificate-button').click(function(){
59 var this_btn = $(this); 66 var this_btn = $(this);
60 spinStart(this_btn); 67 spinStart(this_btn);
61 var wrap = this_btn.closest('.cabinet__inputs'); 68 var wrap = this_btn.closest('.cabinet__inputs');
62 var name = wrap.find('[name="name"]').val(); 69 var name = wrap.find('[name="name"]').val().trim();
63 var end_date = wrap.find('[name="end_begin"]').val(); 70 var end_date = wrap.find('[name="end_begin"]').val().trim();
64 var worker_id = wrap.find('[name="worker_id"]').val(); 71 var worker_id = wrap.find('[name="worker_id"]').val();
72 var date_format_regex = /^\d{2}\.\d{2}\.\d{4}$/; // Format: DD.MM.YYYY
65 73
66 wrap.find('.error-block').html(''); 74 wrap.find('.error-block').html('');
67 wrap.find('input').removeClass('border-red'); 75 wrap.find('input').removeClass('border-red');
68 76
69 if (!name) { 77 if (!name) {
70 wrap.find('[name="name"]').addClass('border-red'); 78 wrap.find('[name="name"]').addClass('border-red');
71 spinStop(this_btn); 79 spinStop(this_btn);
72 return; 80 return;
73 } 81 }
74 if (!end_date) { 82 if (!end_date) {
75 wrap.find('[name="end_begin"]').addClass('border-red'); 83 wrap.find('[name="end_begin"]').addClass('border-red');
84 wrap.find('[name="end_begin"]').after('<span class="error-block">Поле "Дата окончания" обязательно для заполнения.</span>');
85 spinStop(this_btn);
86 return;
87 } else if (!date_format_regex.test(end_date)) {
88 wrap.find('[name="end_begin"]').addClass('border-red');
89 wrap.find('[name="end_begin"]').after('<span class="error-block">Неверный формат даты (дд.мм.гггг).</span>');
76 spinStop(this_btn); 90 spinStop(this_btn);
77 return; 91 return;
78 } 92 }
79 93
80 $.ajax({ 94 $.ajax({
81 type: 'POST', 95 type: 'POST',
82 url: "{{ route('worker.add_serificate') }}", 96 url: "{{ route('worker.add_serificate') }}",
83 data: { 97 data: {
84 worker_id: worker_id, 98 worker_id: worker_id,
85 name: name, 99 name: name,
86 end_begin: end_date 100 end_begin: end_date
87 }, 101 },
88 dataType: 'json', 102 dataType: 'json',
89 headers: { 103 headers: {
90 'X-CSRF-TOKEN': $('[name="_token"]').val() 104 'X-CSRF-TOKEN': $('[name="_token"]').val()
91 }, 105 },
92 success: function(res){ 106 success: function(res){
93 spinStop(this_btn); 107 spinStop(this_btn);
94 $('.open-after_add_serificate_chat-button').click(); 108 $('.open-after_add_serificate_chat-button').click();
95 }, 109 },
96 error: function(jqXHR, exception){ 110 error: function(jqXHR, exception){
97 if (jqXHR && jqXHR.responseJSON && jqXHR.responseJSON.message){ 111 if (jqXHR && jqXHR.responseJSON && jqXHR.responseJSON.message){
98 wrap.find('.error-block').html(jqXHR.responseJSON.message); 112 wrap.find('.error-block').html(jqXHR.responseJSON.message);
99 } 113 }
100 spinStop(this_btn); 114 spinStop(this_btn);
101 } 115 }
102 }); 116 });
103 }); 117 });
104 118
105 119
106 }); 120 });
107 </script> 121 </script>
108 @endsection 122 @endsection
109 123
resources/views/workers/sertificate_edit.blade.php
1 @extends('workers.cabinet_layout', ['title' => 'Редактирование стандартного документа - РекаМоре']) 1 @extends('workers.cabinet_layout', ['title' => 'Редактирование стандартного документа - РекаМоре'])
2 2
3 @section('cabinet_content') 3 @section('cabinet_content')
4 <h3 class="cabinet__h4 font30">Сертификат / документ</h3> 4 <h3 class="cabinet__h4 font30">Сертификат / документ</h3>
5 <form id="submit_form" name="submit_form" action="{{ route('worker.update_serificate', ['doc' => $doc->id]) }}" class="cabinet__inputs" method="GET"> 5 <form id="submit_form" name="submit_form" action="{{ route('worker.update_serificate', ['doc' => $doc->id]) }}" class="cabinet__inputs" method="GET">
6 @csrf 6 @csrf
7 <input type="hidden" name="worker_id" id="worker_id" class="input" value="{{ $worker->id }}"> 7 <input type="hidden" name="worker_id" id="worker_id" class="input" value="{{ $worker->id }}">
8 8
9 <div class="cabinet__body-item width100"> 9 <div class="cabinet__body-item width100">
10 <div class="cabinet__inputs"> 10 <div class="cabinet__inputs sertificate-form-inputs">
11 <div class="cabinet__inputs-item form-group"> 11 <div class="cabinet__inputs-item form-group">
12 <label class="form-group__label">Название сертификата:</label> 12 <label class="form-group__label">Название сертификата:</label>
13 <div class="form-group__item"> 13 <div class="form-group__item">
14 @error('name') 14 @error('name')
15 <div class="error red">{{ $message }}</div> 15 <div class="error red">{{ $message }}</div>
16 @enderror 16 @enderror
17 <input type="text" name="name" id="name" class="input" value="{{ old('name') ?? $doc->name }}" required> 17 <input type="text" name="name" id="name" class="input" value="{{ old('name') ?? $doc->name }}">
18 </div> 18 </div>
19 </div> 19 </div>
20 <div class="cabinet__inputs-item form-group"> 20 <div class="cabinet__inputs-item form-group">
21 <label class="form-group__label">Действия сертификата до:</label> 21 <label class="form-group__label">Действия сертификата до:</label>
22 <div class="form-group__item"> 22 <div class="form-group__item">
23 @error('end_begin') 23 @error('end_begin')
24 <div class="error red">{{ $message }}</div> 24 <div class="error red">{{ $message }}</div>
25 @enderror 25 @enderror
26 <input type="text" name="end_begin" id="end_begin" class="input" value="{{ old('end_begin') ?? date('d.m.Y', strtotime($doc->end_begin)) }}" required> 26 <input
27 type="text"
28 name="end_begin"
29 id="end_begin"
30 class="input"
31 placeholder="11.11.2011"
32 value="{{ old('end_begin') ?? date('d.m.Y', strtotime($doc->end_begin)) }}">
27 </div> 33 </div>
28 </div> 34 </div>
29 </div> 35 </div>
30 </div> 36 </div>
31 37
32 <div class="flex"> 38 <div class="flex">
33 <button type="submit" class="button mr-10">Сохранить</button> 39 <button type="submit" class="button mr-10">Сохранить</button>
34 <a href="{{ route('worker.cabinet') }}" class="button button_light">Назад</a> 40 <a href="{{ route('worker.cabinet') }}" class="button button_light">Назад</a>
35 </div> 41 </div>
36 </form> 42 </form>
37 @endsection 43 @endsection
44
45 @section('scripts')
46
47 <script>
48 $('#submit_form').on('submit', function (event) {
49 event.preventDefault();
50 var form = $(this);
51 var isValid = true;
52
53 form.find('.error-block').remove();
54 form.find('input').removeClass('border-red');
55
56 var name = form.find('[name="name"]').val().trim();
57 if (!name) {
58 form.find('[name="name"]').addClass('border-red');
59 isValid = false;
60 }
61
62 var endDate = form.find('[name="end_begin"]').val().trim();
63 var dateFormatRegex = /^\d{2}\.\d{2}\.\d{4}$/;
64 if (!endDate) {
65 form.find('[name="end_begin"]').addClass('border-red');
66 form.find('[name="end_begin"]').after('<span class="error-block">Поле "Действия сертификата до" обязательно для заполнения.</span>');
67 isValid = false;
68 } else if (!dateFormatRegex.test(endDate)) {
69 form.find('[name="end_begin"]').addClass('border-red');
70 form.find('[name="end_begin"]').after('<span class="error-block">Неверный формат даты (дд.мм.гггг).</span>');
71 isValid = false;
72 }
73
74 if (isValid) {
75 form.off('submit').submit();
76 }
77 });
78
79 </script>
80 @endsection
38 81