Commit 2abfe67133768173c732f3a0b1824953fe9d448e

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

uncommited files

Showing 2 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\Http\Requests\DocumentsRequest; 6 use App\Http\Requests\DocumentsRequest;
7 use App\Http\Requests\PrevCompanyRequest; 7 use App\Http\Requests\PrevCompanyRequest;
8 use App\Http\Requests\SertificationRequest; 8 use App\Http\Requests\SertificationRequest;
9 use App\Models\Ad_employer; 9 use App\Models\Ad_employer;
10 use App\Models\ad_response; 10 use App\Models\ad_response;
11 use App\Models\Dop_info; 11 use App\Models\Dop_info;
12 use App\Models\infobloks; 12 use App\Models\infobloks;
13 use App\Models\Job_title; 13 use App\Models\Job_title;
14 use App\Models\Like_vacancy; 14 use App\Models\Like_vacancy;
15 use App\Models\Message; 15 use App\Models\Message;
16 use App\Models\place_works; 16 use App\Models\place_works;
17 use App\Models\PrevCompany; 17 use App\Models\PrevCompany;
18 use App\Models\ResponseWork; 18 use App\Models\ResponseWork;
19 use App\Models\sertification; 19 use App\Models\sertification;
20 use App\Models\Static_worker; 20 use App\Models\Static_worker;
21 use App\Models\Title_worker; 21 use App\Models\Title_worker;
22 use App\Models\User; 22 use App\Models\User;
23 use App\Models\User as User_Model; 23 use App\Models\User as User_Model;
24 use App\Models\Worker; 24 use App\Models\Worker;
25 use Barryvdh\DomPDF\Facade\Pdf; 25 use Barryvdh\DomPDF\Facade\Pdf;
26 use Carbon\Carbon; 26 use Carbon\Carbon;
27 use Illuminate\Auth\Events\Registered; 27 use Illuminate\Auth\Events\Registered;
28 use Illuminate\Database\Eloquent\Builder; 28 use Illuminate\Database\Eloquent\Builder;
29 use Illuminate\Http\Request; 29 use Illuminate\Http\Request;
30 use Illuminate\Support\Facades\Auth; 30 use Illuminate\Support\Facades\Auth;
31 use Illuminate\Support\Facades\Hash; 31 use Illuminate\Support\Facades\Hash;
32 use Illuminate\Support\Facades\Storage; 32 use Illuminate\Support\Facades\Storage;
33 use Illuminate\Support\Facades\Validator; 33 use Illuminate\Support\Facades\Validator;
34 use PhpOffice\PhpSpreadsheet\Spreadsheet; 34 use PhpOffice\PhpSpreadsheet\Spreadsheet;
35 use PhpOffice\PhpSpreadsheet\Writer\Xlsx; 35 use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
36 use Symfony\Component\HttpFoundation\StreamedResponse; 36 use Symfony\Component\HttpFoundation\StreamedResponse;
37 use App\Enums\DbExportColumns; 37 use App\Enums\DbExportColumns;
38 use DateTime; 38 use DateTime;
39 39
40 class WorkerController extends Controller 40 class WorkerController extends Controller
41 { 41 {
42 public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу'); 42 public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу');
43 43
44 //профиль 44 //профиль
45 public function profile(Worker $worker) 45 public function profile(Worker $worker)
46 { 46 {
47 $get_date = date('Y.m'); 47 $get_date = date('Y.m');
48 48
49 $c = Static_worker::query()->where('year_month', '=', $get_date) 49 $c = Static_worker::query()->where('year_month', '=', $get_date)
50 ->where('user_id', '=', $worker->users->id) 50 ->where('user_id', '=', $worker->users->id)
51 ->get(); 51 ->get();
52 52
53 if ($c->count() > 0) { 53 if ($c->count() > 0) {
54 $upd = Static_worker::find($c[0]->id); 54 $upd = Static_worker::find($c[0]->id);
55 $upd->lookin = $upd->lookin + 1; 55 $upd->lookin = $upd->lookin + 1;
56 $upd->save(); 56 $upd->save();
57 } else { 57 } else {
58 $crt = new Static_worker(); 58 $crt = new Static_worker();
59 $crt->lookin = 1; 59 $crt->lookin = 1;
60 $crt->year_month = $get_date; 60 $crt->year_month = $get_date;
61 $crt->user_id = $worker->user_id; 61 $crt->user_id = $worker->user_id;
62 $crt->save(); 62 $crt->save();
63 } 63 }
64 64
65 $stat = Static_worker::query()->where('year_month', '=', $get_date) 65 $stat = Static_worker::query()->where('year_month', '=', $get_date)
66 ->where('user_id', '=', $worker->users->id) 66 ->where('user_id', '=', $worker->users->id)
67 ->get(); 67 ->get();
68 68
69 return view('public.workers.profile', compact('worker', 'stat')); 69 return view('public.workers.profile', compact('worker', 'stat'));
70 } 70 }
71 71
72 // лист база резюме 72 // лист база резюме
73 public function bd_resume(Request $request) 73 public function bd_resume(Request $request)
74 { 74 {
75 $look = false; 75 $look = false;
76 $idiot = 0; 76 $idiot = 0;
77 if (isset(Auth()->user()->id)) { 77 if (isset(Auth()->user()->id)) {
78 $idiot = Auth()->user()->id; 78 $idiot = Auth()->user()->id;
79 if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin)) 79 if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin))
80 $look = true; 80 $look = true;
81 } 81 }
82 82
83 if ($look) { 83 if ($look) {
84 $status_work = $this->status_work; 84 $status_work = $this->status_work;
85 $resumes = Worker::query()->with('users')->with('job_titles'); 85 $resumes = Worker::query()->with('users')->with('job_titles');
86 $resumes = $resumes->whereHas('users', function (Builder $query) { 86 $resumes = $resumes->whereHas('users', function (Builder $query) {
87 $query->Where('is_worker', '=', '1') 87 $query->Where('is_worker', '=', '1')
88 ->Where('is_bd', '=', '0'); 88 ->Where('is_bd', '=', '0');
89 }); 89 });
90 90
91 //dd($request->get('job')); 91 //dd($request->get('job'));
92 if (($request->has('job')) && ($request->get('job') > 0)) { 92 if (($request->has('job')) && ($request->get('job') > 0)) {
93 $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { 93 $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) {
94 $query->Where('job_titles.id', $request->get('job')); 94 $query->Where('job_titles.id', $request->get('job'));
95 }); 95 });
96 } 96 }
97 97
98 $Job_title = Job_title::query()-> 98 $Job_title = Job_title::query()->
99 where('is_remove', '=', '0')-> 99 where('is_remove', '=', '0')->
100 where('is_bd', '=' , '1')-> 100 where('is_bd', '=' , '1')->
101 get(); 101 get();
102 102
103 if ($request->get('sort')) { 103 if ($request->get('sort')) {
104 $sort = $request->get('sort'); 104 $sort = $request->get('sort');
105 switch ($sort) { 105 switch ($sort) {
106 case 'name_up': 106 case 'name_up':
107 $resumes = $resumes->orderBy(User::select('surname') 107 $resumes = $resumes->orderBy(User::select('surname')
108 ->whereColumn('workers.user_id', 'users.id') 108 ->whereColumn('workers.user_id', 'users.id')
109 ); 109 );
110 break; 110 break;
111 case 'name_down': 111 case 'name_down':
112 $resumes = $resumes->orderByDesc(User::select('surname') 112 $resumes = $resumes->orderByDesc(User::select('surname')
113 ->whereColumn('workers.user_id', 'users.id') 113 ->whereColumn('workers.user_id', 'users.id')
114 ); 114 );
115 break; 115 break;
116 case 'created_at_up': 116 case 'created_at_up':
117 $resumes = $resumes->OrderBy('created_at')->orderBy('id'); 117 $resumes = $resumes->OrderBy('created_at')->orderBy('id');
118 break; 118 break;
119 case 'created_at_down': 119 case 'created_at_down':
120 $resumes = $resumes->orderByDesc('created_at')->orderBy('id'); 120 $resumes = $resumes->orderByDesc('created_at')->orderBy('id');
121 break; 121 break;
122 case 'default': 122 case 'default':
123 $resumes = $resumes->orderBy('id')->orderby('updated_at'); 123 $resumes = $resumes->orderBy('id')->orderby('updated_at');
124 break; 124 break;
125 default: 125 default:
126 $resumes = $resumes->orderBy('id')->orderby('updated_at'); 126 $resumes = $resumes->orderBy('id')->orderby('updated_at');
127 break; 127 break;
128 } 128 }
129 } 129 }
130 130
131 $res_count = $resumes->count(); 131 $res_count = $resumes->count();
132 //$resumes = $resumes->get(); 132 //$resumes = $resumes->get();
133 $resumes = $resumes->paginate(4); 133 $resumes = $resumes->paginate(4);
134 if ($request->ajax()) { 134 if ($request->ajax()) {
135 // Условия обставлены 135 // Условия обставлены
136 if ($request->has('block') && ($request->get('block') == 1)) { 136 if ($request->has('block') && ($request->get('block') == 1)) {
137 return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); 137 return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot'));
138 } 138 }
139 } else { 139 } else {
140 return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title')); 140 return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title'));
141 } 141 }
142 } else { 142 } else {
143 return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); 143 return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]);
144 } 144 }
145 } 145 }
146 146
147 public function basic_information(){ 147 public function basic_information(){
148 if (!isset(Auth()->user()->id)) { 148 if (!isset(Auth()->user()->id)) {
149 abort(404); 149 abort(404);
150 } 150 }
151 151
152 $user_id = Auth()->user()->id; 152 $user_id = Auth()->user()->id;
153 153
154 $user = User::query() 154 $user = User::query()
155 ->with('workers') 155 ->with('workers')
156 ->with(['jobtitles' => function ($query) { 156 ->with(['jobtitles' => function ($query) {
157 $query->select('job_titles.id'); 157 $query->select('job_titles.id');
158 }]) 158 }])
159 ->where('id', '=', $user_id) 159 ->where('id', '=', $user_id)
160 ->first(); 160 ->first();
161 $user->workers[0]->job_titles = $user->workers[0]->job_titles->pluck('id')->toArray(); 161 $user->workers[0]->job_titles = $user->workers[0]->job_titles->pluck('id')->toArray();
162 162
163 $job_titles = Job_title::query() 163 $job_titles = Job_title::query()
164 ->where('is_remove', '=', 0) 164 ->where('is_remove', '=', 0)
165 ->where('is_bd', '=', 1) 165 ->where('is_bd', '=', 1)
166 ->orderByDesc('sort') 166 ->orderByDesc('sort')
167 ->get() 167 ->get()
168 ; 168 ;
169 169
170 return view('workers.form_basic_information', compact('user', 'job_titles')); 170 return view('workers.form_basic_information', compact('user', 'job_titles'));
171 } 171 }
172 172
173 public function additional_documents(){ 173 public function additional_documents(){
174 if (!isset(Auth()->user()->id)) { 174 if (!isset(Auth()->user()->id)) {
175 abort(404); 175 abort(404);
176 } 176 }
177 177
178 $user_id = Auth()->user()->id; 178 $user_id = Auth()->user()->id;
179 179
180 $info_blocks = infobloks::query()->OrderBy('name')->get(); 180 $info_blocks = infobloks::query()->OrderBy('name')->get();
181 $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует']; 181 $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует'];
182 182
183 $worker = Worker::query() 183 $worker = Worker::query()
184 ->with('users') 184 ->with('users')
185 ->with('infobloks') 185 ->with('infobloks')
186 ->WhereHas('users', function (Builder $query) use ($user_id) { 186 ->WhereHas('users', function (Builder $query) use ($user_id) {
187 $query->Where('id', $user_id); 187 $query->Where('id', $user_id);
188 }) 188 })
189 ->first(); 189 ->first();
190 if ($worker->dop_info->count()){ 190 if ($worker->dop_info->count()){
191 $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray(); 191 $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray();
192 } 192 }
193 193
194 return view('workers.form_additional_documents', compact('worker', 'info_blocks', 'additional_document_statuses')); 194 return view('workers.form_additional_documents', compact('worker', 'info_blocks', 'additional_document_statuses'));
195 } 195 }
196 196
197 //Лайк резюме 197 //Лайк резюме
198 public function like_controller() { 198 public function like_controller() {
199 199
200 } 200 }
201 201
202 // анкета соискателя 202 // анкета соискателя
203 public function resume_profile(Worker $worker) 203 public function resume_profile(Worker $worker)
204 { 204 {
205 if (isset(Auth()->user()->id)) { 205 if (isset(Auth()->user()->id)) {
206 $idiot = Auth()->user()->id; 206 $idiot = Auth()->user()->id;
207 } else { 207 } else {
208 $idiot = 0; 208 $idiot = 0;
209 } 209 }
210 210
211 $status_work = $this->status_work; 211 $status_work = $this->status_work;
212 $Query = Worker::query()->with('users')->with('job_titles') 212 $Query = Worker::query()->with('users')->with('job_titles')
213 ->with('place_worker')->with('sertificate')->with('prev_company') 213 ->with('place_worker')->with('sertificate')->with('prev_company')
214 ->with('infobloks')->with('response'); 214 ->with('infobloks')->with('response');
215 $Query = $Query->where('id', '=', $worker->id); 215 $Query = $Query->where('id', '=', $worker->id);
216 $Query = $Query->get(); 216 $Query = $Query->get();
217 217
218 $get_date = date('Y.m'); 218 $get_date = date('Y.m');
219 219
220 $infoblocks = infobloks::query()->get(); 220 $infoblocks = infobloks::query()->get();
221 221
222 $c = Static_worker::query()->where('year_month', '=', $get_date) 222 $c = Static_worker::query()->where('year_month', '=', $get_date)
223 ->where('user_id', '=', $worker->user_id) 223 ->where('user_id', '=', $worker->user_id)
224 ->get(); 224 ->get();
225 225
226 if ($c->count() > 0) { 226 if ($c->count() > 0) {
227 $upd = Static_worker::find($c[0]->id); 227 $upd = Static_worker::find($c[0]->id);
228 $upd->lookin = $upd->lookin + 1; 228 $upd->lookin = $upd->lookin + 1;
229 $upd->save(); 229 $upd->save();
230 } else { 230 } else {
231 $crt = new Static_worker(); 231 $crt = new Static_worker();
232 $crt->lookin = 1; 232 $crt->lookin = 1;
233 $crt->year_month = $get_date; 233 $crt->year_month = $get_date;
234 $crt->user_id = $worker->user_id; 234 $crt->user_id = $worker->user_id;
235 $status = $crt->save(); 235 $status = $crt->save();
236 } 236 }
237 237
238 $stat = Static_worker::query()->where('year_month', '=', $get_date) 238 $stat = Static_worker::query()->where('year_month', '=', $get_date)
239 ->where('user_id', '=', $worker->user_id) 239 ->where('user_id', '=', $worker->user_id)
240 ->get(); 240 ->get();
241 241
242 return view('worker', compact('Query', 'infoblocks', 'status_work', 'idiot', 'stat')); 242 return view('worker', compact('Query', 'infoblocks', 'status_work', 'idiot', 'stat'));
243 } 243 }
244 244
245 // скачать анкету соискателя 245 // скачать анкету соискателя
246 public function resume_download(Worker $worker) 246 public function resume_download(Worker $worker)
247 { 247 {
248 $status_work = $this->status_work; 248 $status_work = $this->status_work;
249 $Query = Worker::query()->with('users')->with('job_titles') 249 $Query = Worker::query()->with('users')->with('job_titles')
250 ->with('place_worker')->with('sertificate')->with('prev_company') 250 ->with('place_worker')->with('sertificate')->with('prev_company')
251 ->with('infobloks'); 251 ->with('infobloks');
252 $Query = $Query->where('id', '=', $worker->id); 252 $Query = $Query->where('id', '=', $worker->id);
253 $Query = $Query->get(); 253 $Query = $Query->get();
254 254
255 view()->share('Query',$Query); 255 view()->share('Query',$Query);
256 256
257 $status_work = $this->status_work; 257 $status_work = $this->status_work;
258 $infoblocks = infobloks::query()->get(); 258 $infoblocks = infobloks::query()->get();
259 259
260 260 //return view('layout.pdf', compact('Query', 'status_work', 'infoblocks'));
261 $pdf = PDF::loadView('layout.pdf', [ 261 $pdf = PDF::loadView('layout.pdf', [
262 'Query' => $Query, 262 'Query' => $Query,
263 'status_work' => $status_work, 263 'status_work' => $status_work,
264 'infoblocks' => $infoblocks 264 'infoblocks' => $infoblocks
265 ])->setPaper('a4', 'landscape'); 265 ])->setPaper('a4', 'landscape');
266 266
267 return $pdf->stream(); 267 return $pdf->stream();
268 } 268 }
269 269
270 public function resume_download_all(Request $request) { 270 public function resume_download_all(Request $request) {
271 $spreadsheet = new Spreadsheet(); 271 $spreadsheet = new Spreadsheet();
272 $sheet = $spreadsheet->getActiveSheet(); 272 $sheet = $spreadsheet->getActiveSheet();
273 273
274 $columnMap = range('A', 'Z'); 274 $columnMap = range('A', 'Z');
275 $columns = []; 275 $columns = [];
276 276
277 foreach (DbExportColumns::toArray() as $key => $value){ 277 foreach (DbExportColumns::toArray() as $key => $value){
278 if ($request->input($key, 0)){ 278 if ($request->input($key, 0)){
279 $sheet->setCellValue("{$columnMap[count($columns)]}1", ucfirst($value)); 279 $sheet->setCellValue("{$columnMap[count($columns)]}1", ucfirst($value));
280 $columns[] = str_replace('__', '.', $key); 280 $columns[] = str_replace('__', '.', $key);
281 } 281 }
282 } 282 }
283 283
284 if (empty($columns)) { 284 if (empty($columns)) {
285 return redirect()->back()->with('error', 'Пожалуйста выберите хотя бы 1 колонку для экспорта.'); 285 return redirect()->back()->with('error', 'Пожалуйста выберите хотя бы 1 колонку для экспорта.');
286 } 286 }
287 287
288 $query = User::select($columns) 288 $query = User::select($columns)
289 ->leftJoin('workers', 'users.id', '=', 'workers.user_id') 289 ->leftJoin('workers', 'users.id', '=', 'workers.user_id')
290 ->leftJoin('job_titles', 'workers.position_work', '=', 'job_titles.id') 290 ->leftJoin('job_titles', 'workers.position_work', '=', 'job_titles.id')
291 ->where('users.is_bd', '=', 1) 291 ->where('users.is_bd', '=', 1)
292 ; 292 ;
293 293
294 $job_title_list = $request->input('job_title_list', []); 294 $job_title_list = $request->input('job_title_list', []);
295 if (!empty($job_title_list)){ 295 if (!empty($job_title_list)){
296 $query->whereIn('job_titles.id', $job_title_list); 296 $query->whereIn('job_titles.id', $job_title_list);
297 } 297 }
298 298
299 $users = $query->get(); 299 $users = $query->get();
300 if ($users->count()){ 300 if ($users->count()){
301 $i = 2; 301 $i = 2;
302 foreach ($users->toArray() as $user){ 302 foreach ($users->toArray() as $user){
303 $j = 0; 303 $j = 0;
304 foreach ($user as $field){ 304 foreach ($user as $field){
305 $sheet->setCellValue("{$columnMap[$j++]}$i", $field); 305 $sheet->setCellValue("{$columnMap[$j++]}$i", $field);
306 } 306 }
307 $i++; 307 $i++;
308 } 308 }
309 } 309 }
310 $writer = new Xlsx($spreadsheet); 310 $writer = new Xlsx($spreadsheet);
311 $fileName = 'DB.xlsx'; 311 $fileName = 'DB.xlsx';
312 312
313 $response = new StreamedResponse(function() use ($writer) { 313 $response = new StreamedResponse(function() use ($writer) {
314 $writer->save('php://output'); 314 $writer->save('php://output');
315 }); 315 });
316 316
317 $response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); 317 $response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
318 $response->headers->set('Content-Disposition', 'attachment;filename="' . $fileName . '"'); 318 $response->headers->set('Content-Disposition', 'attachment;filename="' . $fileName . '"');
319 $response->headers->set('Cache-Control', 'max-age=0'); 319 $response->headers->set('Cache-Control', 'max-age=0');
320 320
321 return $response; 321 return $response;
322 } 322 }
323 323
324 // Кабинет работника 324 // Кабинет работника
325 public function cabinet(Request $request) 325 public function cabinet(Request $request)
326 { 326 {
327 // дата год и месяц 327 // дата год и месяц
328 $get_date = date('Y.m'); 328 $get_date = date('Y.m');
329 329
330 $id = Auth()->user()->id; 330 $id = Auth()->user()->id;
331 331
332 $Infobloks = infobloks::query()->get(); 332 $Infobloks = infobloks::query()->get();
333 333
334 $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')-> 334 $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')->
335 with('infobloks')->with('place_worker')-> 335 with('infobloks')->with('place_worker')->
336 WhereHas('users', 336 WhereHas('users',
337 function (Builder $query) use ($id) {$query->Where('id', $id); 337 function (Builder $query) use ($id) {$query->Where('id', $id);
338 })->get(); 338 })->get();
339 339
340 $Job_titles = Job_title::query()->where('is_remove', '=', '0')-> 340 $Job_titles = Job_title::query()->where('is_remove', '=', '0')->
341 where('is_bd', '=' , '1')-> 341 where('is_bd', '=' , '1')->
342 OrderByDesc('sort')->OrderBy('name')->get(); 342 OrderByDesc('sort')->OrderBy('name')->get();
343 343
344 344
345 $stat = Static_worker::query()->where('year_month', '=', $get_date) 345 $stat = Static_worker::query()->where('year_month', '=', $get_date)
346 ->where('user_id', '=', $id) 346 ->where('user_id', '=', $id)
347 ->get(); 347 ->get();
348 348
349 349
350 // 10% 350 // 10%
351 351
352 $persent = 10; 352 $persent = 10;
353 $persent1 = 0; 353 $persent1 = 0;
354 $persent2 = 0; 354 $persent2 = 0;
355 $persent3 = 0; 355 $persent3 = 0;
356 $persent4 = 0; 356 $persent4 = 0;
357 $persent5 = 0; 357 $persent5 = 0;
358 358
359 if ((!empty($Worker[0]->telephone)) && 359 if ((!empty($Worker[0]->telephone)) &&
360 (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) && 360 (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) &&
361 (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) { 361 (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) {
362 // 40% 362 // 40%
363 $persent = $persent + 40; 363 $persent = $persent + 40;
364 $persent1 = 40; 364 $persent1 = 40;
365 } 365 }
366 366
367 //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year); 367 //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year);
368 368
369 if ($Worker[0]->sertificate->count() > 0) { 369 if ($Worker[0]->sertificate->count() > 0) {
370 // 15% 370 // 15%
371 $persent = $persent + 15; 371 $persent = $persent + 15;
372 $persent2 = 15; 372 $persent2 = 15;
373 } 373 }
374 374
375 if ($Worker[0]->infobloks->count() > 0) { 375 if ($Worker[0]->infobloks->count() > 0) {
376 // 20% 376 // 20%
377 $persent = $persent + 20; 377 $persent = $persent + 20;
378 $persent3 = 20; 378 $persent3 = 20;
379 } 379 }
380 380
381 if ($Worker[0]->prev_company->count() > 0) { 381 if ($Worker[0]->prev_company->count() > 0) {
382 // 10% 382 // 10%
383 $persent = $persent + 10; 383 $persent = $persent + 10;
384 $persent4 = 10; 384 $persent4 = 10;
385 } 385 }
386 386
387 if (!empty($Worker[0]->photo)) { 387 if (!empty($Worker[0]->photo)) {
388 // 5% 388 // 5%
389 $persent = $persent + 5; 389 $persent = $persent + 5;
390 $persent5 = 5; 390 $persent5 = 5;
391 } 391 }
392 392
393 $status_work = $this->status_work; 393 $status_work = $this->status_work;
394 $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует']; 394 $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует'];
395 $info_blocks = infobloks::query()->OrderBy('name')->get(); 395 $info_blocks = infobloks::query()->OrderBy('name')->get();
396 396
397 $worker = Worker::query() 397 $worker = Worker::query()
398 ->with('users') 398 ->with('users')
399 ->with('sertificate') 399 ->with('sertificate')
400 ->with('prev_company') 400 ->with('prev_company')
401 ->with('infobloks') 401 ->with('infobloks')
402 ->with('place_worker') 402 ->with('place_worker')
403 ->with('job_titles') 403 ->with('job_titles')
404 ->WhereHas('users', function (Builder $query) use ($id) { 404 ->WhereHas('users', function (Builder $query) use ($id) {
405 $query->Where('id', $id); 405 $query->Where('id', $id);
406 }) 406 })
407 ->first(); 407 ->first();
408 if ($worker->dop_info->count()){ 408 if ($worker->dop_info->count()){
409 $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray(); 409 $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray();
410 } 410 }
411 411
412 //dd($worker->dop_info); 412 //dd($worker->dop_info);
413 413
414 if ($request->has('print')) { 414 if ($request->has('print')) {
415 dd($Worker); 415 dd($Worker);
416 } else { 416 } else {
417 return view('workers.cabinet', compact( 'persent', 'Job_titles', 'stat', 417 return view('workers.cabinet', compact( 'persent', 'Job_titles', 'stat',
418 'worker', 'info_blocks', 'status_work', 'additional_document_statuses' 418 'worker', 'info_blocks', 'status_work', 'additional_document_statuses'
419 )); 419 ));
420 } 420 }
421 } 421 }
422 422
423 // Сохранение данных 423 // Сохранение данных
424 public function cabinet_save(Worker $worker, Request $request) 424 public function cabinet_save(Worker $worker, Request $request)
425 { 425 {
426 $id = $worker->id; 426 $id = $worker->id;
427 $params = $request->all(); 427 $params = $request->all();
428 $job_title_id = $request->get('job_title_id'); 428 $job_title_id = $request->get('job_title_id');
429 429
430 $rules = [ 430 $rules = [
431 'surname' => ['required', 'string', 'max:255'], 431 'surname' => ['required', 'string', 'max:255'],
432 'name_man' => ['required', 'string', 'max:255'], 432 'name_man' => ['required', 'string', 'max:255'],
433 'email' => ['required', 'string', 'email', 'max:255'], 433 'email' => ['required', 'string', 'email', 'max:255'],
434 434
435 ]; 435 ];
436 436
437 $messages = [ 437 $messages = [
438 'required' => 'Укажите обязательное поле', 438 'required' => 'Укажите обязательное поле',
439 'min' => [ 439 'min' => [
440 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 440 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
441 'integer' => 'Поле «:attribute» должно быть :min или больше', 441 'integer' => 'Поле «:attribute» должно быть :min или больше',
442 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 442 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
443 ], 443 ],
444 'max' => [ 444 'max' => [
445 'string' => 'Поле «:attribute» должно быть не больше :max символов', 445 'string' => 'Поле «:attribute» должно быть не больше :max символов',
446 'integer' => 'Поле «:attribute» должно быть :max или меньше', 446 'integer' => 'Поле «:attribute» должно быть :max или меньше',
447 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 447 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
448 ] 448 ]
449 ]; 449 ];
450 450
451 $validator = Validator::make($params, $rules, $messages); 451 $validator = Validator::make($params, $rules, $messages);
452 452
453 if ($validator->fails()) { 453 if ($validator->fails()) {
454 return redirect()->route('worker.cabinet')->withErrors($validator); 454 return redirect()->route('worker.cabinet')->withErrors($validator);
455 } else { 455 } else {
456 456
457 if ($request->has('photo')) { 457 if ($request->has('photo')) {
458 if (!empty($worker->photo)) { 458 if (!empty($worker->photo)) {
459 Storage::delete($worker->photo); 459 Storage::delete($worker->photo);
460 } 460 }
461 $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); 461 $params['photo'] = $request->file('photo')->store("worker/$id", 'public');
462 } 462 }
463 463
464 if ($request->has('file')) { 464 if ($request->has('file')) {
465 if (!empty($worker->file)) { 465 if (!empty($worker->file)) {
466 Storage::delete($worker->file); 466 Storage::delete($worker->file);
467 } 467 }
468 $params['file'] = $request->file('file')->store("worker/$id", 'public'); 468 $params['file'] = $request->file('file')->store("worker/$id", 'public');
469 } 469 }
470 470
471 $worker->update($params); 471 $worker->update($params);
472 $use = User::find($worker->user_id); 472 $use = User::find($worker->user_id);
473 $use->surname = $request->get('surname'); 473 $use->surname = $request->get('surname');
474 $use->name_man = $request->get('name_man'); 474 $use->name_man = $request->get('name_man');
475 $use->surname2 = $request->get('surname2'); 475 $use->surname2 = $request->get('surname2');
476 476
477 $use->save(); 477 $use->save();
478 $worker->job_titles()->sync($job_title_id); 478 $worker->job_titles()->sync($job_title_id);
479 479
480 return redirect()->route('worker.basic_information')->with('success', 'Данные были успешно сохранены'); 480 return redirect()->route('worker.basic_information')->with('success', 'Данные были успешно сохранены');
481 } 481 }
482 } 482 }
483 483
484 public function cabinet_save_foto(Worker $worker, Request $request){ 484 public function cabinet_save_foto(Worker $worker, Request $request){
485 $params = ['photo' => null]; 485 $params = ['photo' => null];
486 486
487 if ($request->has('photo')) { 487 if ($request->has('photo')) {
488 if (!empty($worker->photo)) { 488 if (!empty($worker->photo)) {
489 Storage::delete($worker->photo); 489 Storage::delete($worker->photo);
490 } 490 }
491 $params['photo'] = $request->file('photo')->store("worker/$worker->id", 'public'); 491 $params['photo'] = $request->file('photo')->store("worker/$worker->id", 'public');
492 } 492 }
493 493
494 if ($request->has('file')) { 494 if ($request->has('file')) {
495 if (!empty($worker->file)) { 495 if (!empty($worker->file)) {
496 Storage::delete($worker->file); 496 Storage::delete($worker->file);
497 } 497 }
498 $params['file'] = $request->file('file')->store("worker/$worker->id", 'public'); 498 $params['file'] = $request->file('file')->store("worker/$worker->id", 'public');
499 } 499 }
500 500
501 $worker->update($params); 501 $worker->update($params);
502 502
503 return redirect()->route('worker.cabinet'); 503 return redirect()->route('worker.cabinet');
504 } 504 }
505 505
506 // Сообщения данные 506 // Сообщения данные
507 public function messages($type_message) 507 public function messages($type_message)
508 { 508 {
509 $user_id = Auth()->user()->id; 509 $user_id = Auth()->user()->id;
510 510
511 $messages_input = Message::query()->with('vacancies')->with('user_from')-> 511 $messages_input = Message::query()->with('vacancies')->with('user_from')->
512 Where('to_user_id', $user_id)->OrderByDesc('created_at'); 512 Where('to_user_id', $user_id)->OrderByDesc('created_at');
513 513
514 $messages_output = Message::query()->with('vacancies')-> 514 $messages_output = Message::query()->with('vacancies')->
515 with('user_to')->where('user_id', $user_id)-> 515 with('user_to')->where('user_id', $user_id)->
516 OrderByDesc('created_at'); 516 OrderByDesc('created_at');
517 517
518 $count_input = $messages_input->count(); 518 $count_input = $messages_input->count();
519 $count_output = $messages_output->count(); 519 $count_output = $messages_output->count();
520 520
521 if ($type_message == 'input') { 521 if ($type_message == 'input') {
522 $messages = $messages_input->paginate(5); 522 $messages = $messages_input->paginate(5);
523 } 523 }
524 524
525 if ($type_message == 'output') { 525 if ($type_message == 'output') {
526 $messages = $messages_output->paginate(5); 526 $messages = $messages_output->paginate(5);
527 } 527 }
528 528
529 //dd($messages); 529 //dd($messages);
530 // Вернуть все 100% 530 // Вернуть все 100%
531 return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); 531 return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id'));
532 } 532 }
533 533
534 // Избранный 534 // Избранный
535 public function favorite() 535 public function favorite()
536 { 536 {
537 return view('workers.favorite'); 537 return view('workers.favorite');
538 } 538 }
539 539
540 // Сменить пароль 540 // Сменить пароль
541 public function new_password() 541 public function new_password()
542 { 542 {
543 $email = Auth()->user()->email; 543 $email = Auth()->user()->email;
544 return view('workers.new_password', compact('email')); 544 return view('workers.new_password', compact('email'));
545 } 545 }
546 546
547 // Обновление пароля 547 // Обновление пароля
548 public function save_new_password(Request $request) { 548 public function save_new_password(Request $request) {
549 $use = Auth()->user(); 549 $use = Auth()->user();
550 $request->validate([ 550 $request->validate([
551 'password' => 'required|string', 551 'password' => 'required|string',
552 'new_password' => 'required|string', 552 'new_password' => 'required|string',
553 'new_password2' => 'required|string' 553 'new_password2' => 'required|string'
554 ]); 554 ]);
555 555
556 if ($request->get('new_password') == $request->get('new_password2')) 556 if ($request->get('new_password') == $request->get('new_password2'))
557 if ($request->get('password') !== $request->get('new_password')) { 557 if ($request->get('password') !== $request->get('new_password')) {
558 $credentials = $request->only('email', 'password'); 558 $credentials = $request->only('email', 'password');
559 if (Auth::attempt($credentials, $request->has('save_me'))) { 559 if (Auth::attempt($credentials, $request->has('save_me'))) {
560 560
561 if (!is_null($use->email_verified_at)){ 561 if (!is_null($use->email_verified_at)){
562 562
563 $user_data = User_Model::find($use->id); 563 $user_data = User_Model::find($use->id);
564 $user_data->update([ 564 $user_data->update([
565 'password' => Hash::make($request->get('new_password')), 565 'password' => Hash::make($request->get('new_password')),
566 'pubpassword' => base64_encode($request->get('new_password')), 566 'pubpassword' => base64_encode($request->get('new_password')),
567 ]); 567 ]);
568 return redirect() 568 return redirect()
569 ->route('worker.new_password') 569 ->route('worker.new_password')
570 ->with('success', 'Поздравляю! Вы обновили свой пароль!'); 570 ->with('success', 'Поздравляю! Вы обновили свой пароль!');
571 } 571 }
572 572
573 return redirect() 573 return redirect()
574 ->route('worker.new_password') 574 ->route('worker.new_password')
575 ->withError('Данная учетная запись не было верифицированна!'); 575 ->withError('Данная учетная запись не было верифицированна!');
576 } 576 }
577 } 577 }
578 578
579 return redirect() 579 return redirect()
580 ->route('worker.new_password') 580 ->route('worker.new_password')
581 ->withErrors('Не совпадение данных, обновите пароли!'); 581 ->withErrors('Не совпадение данных, обновите пароли!');
582 } 582 }
583 583
584 // Удаление профиля форма 584 // Удаление профиля форма
585 public function delete_profile() 585 public function delete_profile()
586 { 586 {
587 $login = Auth()->user()->email; 587 $login = Auth()->user()->email;
588 return view('workers.delete_profile', compact('login')); 588 return view('workers.delete_profile', compact('login'));
589 } 589 }
590 590
591 // Удаление профиля код 591 // Удаление профиля код
592 public function delete_profile_result(Request $request) { 592 public function delete_profile_result(Request $request) {
593 $Answer = $request->all(); 593 $Answer = $request->all();
594 $user_id = Auth()->user()->id; 594 $user_id = Auth()->user()->id;
595 $request->validate([ 595 $request->validate([
596 'password' => 'required|string', 596 'password' => 'required|string',
597 ]); 597 ]);
598 598
599 $credentials = $request->only('email', 'password'); 599 $credentials = $request->only('email', 'password');
600 if (Auth::attempt($credentials)) { 600 if (Auth::attempt($credentials)) {
601 Auth::logout(); 601 Auth::logout();
602 $it = User_Model::find($user_id); 602 $it = User_Model::find($user_id);
603 $it->delete(); 603 $it->delete();
604 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); 604 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт');
605 } else { 605 } else {
606 return redirect()->route('worker.delete_profile') 606 return redirect()->route('worker.delete_profile')
607 ->withErrors( 'Неверный пароль! Нужен корректный пароль'); 607 ->withErrors( 'Неверный пароль! Нужен корректный пароль');
608 } 608 }
609 } 609 }
610 610
611 // Регистрация соискателя 611 // Регистрация соискателя
612 public function register_worker(Request $request) 612 public function register_worker(Request $request)
613 { 613 {
614 $params = $request->all(); 614 $params = $request->all();
615 $params['is_worker'] = 1; 615 $params['is_worker'] = 1;
616 616
617 $rules = [ 617 $rules = [
618 'surname' => ['required', 'string', 'max:255'], 618 'surname' => ['required', 'string', 'max:255'],
619 'name_man' => ['required', 'string', 'max:255'], 619 'name_man' => ['required', 'string', 'max:255'],
620 'email' => ['required', 'email', 'max:255', 'unique:users'], 620 'email' => ['required', 'email', 'max:255', 'unique:users'],
621 'password' => ['required', 'string', 'min:6'] 621 'password' => ['required', 'string', 'min:6']
622 ]; 622 ];
623 623
624 $messages = [ 624 $messages = [
625 'required' => 'Укажите обязательное поле', 625 'required' => 'Укажите обязательное поле',
626 'min' => [ 626 'min' => [
627 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 627 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
628 'integer' => 'Поле «:attribute» должно быть :min или больше', 628 'integer' => 'Поле «:attribute» должно быть :min или больше',
629 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 629 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
630 ], 630 ],
631 'max' => [ 631 'max' => [
632 'string' => 'Поле «:attribute» должно быть не больше :max символов', 632 'string' => 'Поле «:attribute» должно быть не больше :max символов',
633 'integer' => 'Поле «:attribute» должно быть :max или меньше', 633 'integer' => 'Поле «:attribute» должно быть :max или меньше',
634 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 634 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
635 ] 635 ]
636 ]; 636 ];
637 637
638 $email = $request->get('email'); 638 $email = $request->get('email');
639 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { 639 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) {
640 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); 640 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл"));
641 } 641 }
642 642
643 if ($request->get('password') !== $request->get('confirmed')){ 643 if ($request->get('password') !== $request->get('confirmed')){
644 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); 644 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля"));
645 } 645 }
646 646
647 if (strlen($request->get('password')) < 6) { 647 if (strlen($request->get('password')) < 6) {
648 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); 648 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!"));
649 } 649 }
650 650
651 /*$haystack = $request->get('password'); 651 /*$haystack = $request->get('password');
652 652
653 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); 653 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?');
654 $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 654 $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z',
655 'X', 'C', 'V', 'B', 'N', 'M'); 655 'X', 'C', 'V', 'B', 'N', 'M');
656 $lenpwd_bool = true; 656 $lenpwd_bool = true;
657 $spec_bool = false; 657 $spec_bool = false;
658 $alpha_bool = false; 658 $alpha_bool = false;
659 659
660 if (strlen($haystack) < 8) $lenpwd_bool = false; 660 if (strlen($haystack) < 8) $lenpwd_bool = false;
661 661
662 foreach ($specsumbol as $it) { 662 foreach ($specsumbol as $it) {
663 if (strpos($haystack, $it) !== false) { 663 if (strpos($haystack, $it) !== false) {
664 $spec_bool = true; 664 $spec_bool = true;
665 } 665 }
666 } 666 }
667 667
668 foreach ($alpha as $it) { 668 foreach ($alpha as $it) {
669 if (strpos($haystack, $it) !== false) { 669 if (strpos($haystack, $it) !== false) {
670 $alpha_bool = true; 670 $alpha_bool = true;
671 } 671 }
672 } 672 }
673 673
674 if ((!$spec_bool) || (!$alpha_bool)) { 674 if ((!$spec_bool) || (!$alpha_bool)) {
675 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); 675 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?"));
676 }*/ 676 }*/
677 677
678 if (($request->has('politik')) && ($request->get('politik') == 1)) { 678 if (($request->has('politik')) && ($request->get('politik') == 1)) {
679 $validator = Validator::make($params, $rules, $messages); 679 $validator = Validator::make($params, $rules, $messages);
680 680
681 if ($validator->fails()) { 681 if ($validator->fails()) {
682 return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); 682 return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе."));
683 } else { 683 } else {
684 //dd($params); 684 //dd($params);
685 $user = $this->create($params); 685 $user = $this->create($params);
686 event(new Registered($user)); 686 event(new Registered($user));
687 Auth::guard()->login($user); 687 Auth::guard()->login($user);
688 } 688 }
689 if ($user) { 689 if ($user) {
690 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; 690 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));;
691 } else { 691 } else {
692 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); 692 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!"));
693 } 693 }
694 694
695 } else { 695 } else {
696 return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); 696 return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!"));
697 } 697 }
698 } 698 }
699 699
700 // Звездная оценка и ответ 700 // Звездная оценка и ответ
701 public function stars_answer(Request $request) { 701 public function stars_answer(Request $request) {
702 $params = $request->all(); 702 $params = $request->all();
703 $rules = [ 703 $rules = [
704 'message' => ['required', 'string', 'max:255'], 704 'message' => ['required', 'string', 'max:255'],
705 ]; 705 ];
706 706
707 $messages = [ 707 $messages = [
708 'required' => 'Укажите обязательное поле', 708 'required' => 'Укажите обязательное поле',
709 'min' => [ 709 'min' => [
710 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 710 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
711 'integer' => 'Поле «:attribute» должно быть :min или больше', 711 'integer' => 'Поле «:attribute» должно быть :min или больше',
712 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 712 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
713 ], 713 ],
714 'max' => [ 714 'max' => [
715 'string' => 'Поле «:attribute» должно быть не больше :max символов', 715 'string' => 'Поле «:attribute» должно быть не больше :max символов',
716 'integer' => 'Поле «:attribute» должно быть :max или меньше', 716 'integer' => 'Поле «:attribute» должно быть :max или меньше',
717 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 717 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
718 ] 718 ]
719 ]; 719 ];
720 $response_worker = ResponseWork::create($params); 720 $response_worker = ResponseWork::create($params);
721 return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); 721 return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!');
722 } 722 }
723 723
724 public function TestWorker() 724 public function TestWorker()
725 { 725 {
726 $Use = new User(); 726 $Use = new User();
727 727
728 $Code_user = $Use->create([ 728 $Code_user = $Use->create([
729 'name' => 'surname name_man', 729 'name' => 'surname name_man',
730 'name_man' => 'name_man', 730 'name_man' => 'name_man',
731 'surname' => 'surname', 731 'surname' => 'surname',
732 'surname2' => 'surname2', 732 'surname2' => 'surname2',
733 'subscribe_email' => '1', 733 'subscribe_email' => '1',
734 'email' => 'email@mail.com', 734 'email' => 'email@mail.com',
735 'telephone' => '1234567890', 735 'telephone' => '1234567890',
736 'password' => Hash::make('password'), 736 'password' => Hash::make('password'),
737 'pubpassword' => base64_encode('password'), 737 'pubpassword' => base64_encode('password'),
738 'email_verified_at' => Carbon::now(), 738 'email_verified_at' => Carbon::now(),
739 'is_worker' => 1, 739 'is_worker' => 1,
740 ]); 740 ]);
741 741
742 if ($Code_user->id > 0) { 742 if ($Code_user->id > 0) {
743 $Worker = new Worker(); 743 $Worker = new Worker();
744 $Worker->user_id = $Code_user->id; 744 $Worker->user_id = $Code_user->id;
745 $Worker->position_work = 1; //'job_titles'; 745 $Worker->position_work = 1; //'job_titles';
746 $Worker->email = 'email@email.com'; 746 $Worker->email = 'email@email.com';
747 $Worker->telephone = '1234567890'; 747 $Worker->telephone = '1234567890';
748 $status = $Worker->save(); 748 $status = $Worker->save();
749 749
750 $Title_Worker = new Title_worker(); 750 $Title_Worker = new Title_worker();
751 $Title_Worker->worker_id = $Worker->id; 751 $Title_Worker->worker_id = $Worker->id;
752 $Title_Worker->job_title_id = 1; 752 $Title_Worker->job_title_id = 1;
753 $Title_Worker->save(); 753 $Title_Worker->save();
754 } 754 }
755 } 755 }
756 756
757 // Создание пользователя 757 // Создание пользователя
758 protected function create(array $data) 758 protected function create(array $data)
759 { 759 {
760 $Use = new User(); 760 $Use = new User();
761 761
762 $Code_user = $Use->create([ 762 $Code_user = $Use->create([
763 'name' => $data['surname']." ".$data['name_man'], 763 'name' => $data['surname']." ".$data['name_man'],
764 'name_man' => $data['name_man'], 764 'name_man' => $data['name_man'],
765 'surname' => $data['surname'], 765 'surname' => $data['surname'],
766 'surname2' => $data['surname2'], 766 'surname2' => $data['surname2'],
767 'subscribe_email' => $data['email'], 767 'subscribe_email' => $data['email'],
768 'email' => $data['email'], 768 'email' => $data['email'],
769 'telephone' => $data['telephone'], 769 'telephone' => $data['telephone'],
770 'password' => Hash::make($data['password']), 770 'password' => Hash::make($data['password']),
771 'pubpassword' => base64_encode($data['password']), 771 'pubpassword' => base64_encode($data['password']),
772 'email_verified_at' => Carbon::now(), 772 'email_verified_at' => Carbon::now(),
773 'is_worker' => $data['is_worker'], 773 'is_worker' => $data['is_worker'],
774 ]); 774 ]);
775 775
776 if ($Code_user->id > 0) { 776 if ($Code_user->id > 0) {
777 $Worker = new Worker(); 777 $Worker = new Worker();
778 $Worker->user_id = $Code_user->id; 778 $Worker->user_id = $Code_user->id;
779 $Worker->position_work = $data['job_titles']; 779 $Worker->position_work = $data['job_titles'];
780 $Worker->email = $data['email']; 780 $Worker->email = $data['email'];
781 $Worker->telephone = $data['telephone']; 781 $Worker->telephone = $data['telephone'];
782 $Worker->save(); 782 $Worker->save();
783 783
784 if (isset($Worker->id)) { 784 if (isset($Worker->id)) {
785 $Title_Worker = new Title_worker(); 785 $Title_Worker = new Title_worker();
786 $Title_Worker->worker_id = $Worker->id; 786 $Title_Worker->worker_id = $Worker->id;
787 $Title_Worker->job_title_id = $data['job_titles']; 787 $Title_Worker->job_title_id = $data['job_titles'];
788 $Title_Worker->save(); 788 $Title_Worker->save();
789 } 789 }
790 790
791 return $Code_user; 791 return $Code_user;
792 } 792 }
793 } 793 }
794 794
795 // Вакансии избранные 795 // Вакансии избранные
796 public function colorado(Request $request) { 796 public function colorado(Request $request) {
797 $IP_address = RusDate::ip_addr_client(); 797 $IP_address = RusDate::ip_addr_client();
798 $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); 798 $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get();
799 799
800 if ($Arr->count()) { 800 if ($Arr->count()) {
801 $A = Array(); 801 $A = Array();
802 foreach ($Arr as $it) { 802 foreach ($Arr as $it) {
803 $A[] = $it->code_record; 803 $A[] = $it->code_record;
804 } 804 }
805 805
806 $Query = Ad_employer::query()->whereIn('id', $A); 806 $Query = Ad_employer::query()->whereIn('id', $A);
807 } else { 807 } else {
808 $Query = Ad_employer::query()->where('id', '=', '0'); 808 $Query = Ad_employer::query()->where('id', '=', '0');
809 } 809 }
810 810
811 $Query = $Query->with('jobs')-> 811 $Query = $Query->with('jobs')->
812 with('cat')-> 812 with('cat')->
813 with('employer')-> 813 with('employer')->
814 whereHas('jobs_code', function ($query) use ($request) { 814 whereHas('jobs_code', function ($query) use ($request) {
815 if ($request->ajax()) { 815 if ($request->ajax()) {
816 if (null !== ($request->get('job'))) { 816 if (null !== ($request->get('job'))) {
817 $query->where('job_title_id', $request->get('job')); 817 $query->where('job_title_id', $request->get('job'));
818 } 818 }
819 } 819 }
820 })->select('ad_employers.*'); 820 })->select('ad_employers.*');
821 821
822 $Job_title = Job_title::query()->OrderBy('name')->get(); 822 $Job_title = Job_title::query()->OrderBy('name')->get();
823 823
824 $Query_count = $Query->count(); 824 $Query_count = $Query->count();
825 825
826 $Query = $Query->OrderBy('updated_at')->paginate(3); 826 $Query = $Query->OrderBy('updated_at')->paginate(3);
827 827
828 return view('workers.favorite', compact('Query', 828 return view('workers.favorite', compact('Query',
829 'Query_count', 829 'Query_count',
830 'Job_title')); 830 'Job_title'));
831 831
832 } 832 }
833 833
834 //Переписка 834 //Переписка
835 public function dialog(User_Model $user1, User_Model $user2, Request $request) { 835 public function dialog(User_Model $user1, User_Model $user2, Request $request) {
836 // Получение параметров. 836 // Получение параметров.
837 if ($request->has('ad_employer')){ 837 if ($request->has('ad_employer')){
838 $ad_employer = $request->get('ad_employer'); 838 $ad_employer = $request->get('ad_employer');
839 } else { 839 } else {
840 $ad_employer = 0; 840 $ad_employer = 0;
841 } 841 }
842 842
843 if (isset($user1->id)) { 843 if (isset($user1->id)) {
844 $sender = User_Model::query()->with('workers')-> 844 $sender = User_Model::query()->with('workers')->
845 with('employers')-> 845 with('employers')->
846 where('id', $user1->id)->first(); 846 where('id', $user1->id)->first();
847 } 847 }
848 848
849 if (isset($user2->id)) { 849 if (isset($user2->id)) {
850 $companion = User_Model::query()->with('workers')-> 850 $companion = User_Model::query()->with('workers')->
851 with('employers')-> 851 with('employers')->
852 where('id', $user2->id)->first(); 852 where('id', $user2->id)->first();
853 } 853 }
854 854
855 $Messages = Message::query()-> 855 $Messages = Message::query()->
856 //with('response')-> 856 //with('response')->
857 where(function($query) use ($user1, $user2) { 857 where(function($query) use ($user1, $user2) {
858 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); 858 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id);
859 })->orWhere(function($query) use ($user1, $user2) { 859 })->orWhere(function($query) use ($user1, $user2) {
860 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); 860 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id);
861 })->OrderBy('created_at')->get(); 861 })->OrderBy('created_at')->get();
862 862
863 $id_vac = null; 863 $id_vac = null;
864 /*foreach ($Messages as $it) { 864 /*foreach ($Messages as $it) {
865 if (isset($it->response)) { 865 if (isset($it->response)) {
866 foreach ($it->response as $r) { 866 foreach ($it->response as $r) {
867 if (isset($r->ad_employer_id)) { 867 if (isset($r->ad_employer_id)) {
868 $id_vac = $r->ad_employer_id; 868 $id_vac = $r->ad_employer_id;
869 break; 869 break;
870 } 870 }
871 } 871 }
872 } 872 }
873 if (!is_null($id_vac)) break; 873 if (!is_null($id_vac)) break;
874 }*/ 874 }*/
875 875
876 //$ad_employer = null; 876 //$ad_employer = null;
877 //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); 877 //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first();
878 878
879 return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); 879 return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer'));
880 } 880 }
881 881
882 // Даунылоады 882 // Даунылоады
883 public function download(Worker $worker) { 883 public function download(Worker $worker) {
884 $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; 884 $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...'];
885 view()->share('house',$arr_house); 885 view()->share('house',$arr_house);
886 $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); 886 $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape');
887 return $pdf->stream(); 887 return $pdf->stream();
888 } 888 }
889 889
890 // Поднятие анкеты 890 // Поднятие анкеты
891 public function up(Worker $worker) { 891 public function up(Worker $worker) {
892 $worker->updated_at = Carbon::now(); 892 $worker->updated_at = Carbon::now();
893 $worker->save(); 893 $worker->save();
894 // 0 894 // 0
895 return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); 895 return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных');
896 } 896 }
897 897
898 // Форма сертификате 898 // Форма сертификате
899 public function new_sertificate(Worker $worker) { 899 public function new_sertificate(Worker $worker) {
900 return view('workers.sertificate_add', compact('worker')); 900 return view('workers.sertificate_add', compact('worker'));
901 } 901 }
902 902
903 // Добавление сертификата 903 // Добавление сертификата
904 public function add_serificate(SertificationRequest $request) { 904 public function add_serificate(SertificationRequest $request) {
905 $request->validate([ 905 $request->validate([
906 'name' => 'required|string|max:255', 906 'name' => 'required|string|max:255',
907 'end_begin' => 'required|date|date_format:d.m.Y' 907 'end_begin' => 'required|date|date_format:d.m.Y'
908 ], 908 ],
909 [ 909 [
910 'name' => 'Навание сертификата обязательно для заполнения.', 910 'name' => 'Навание сертификата обязательно для заполнения.',
911 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' 911 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг'
912 ]); 912 ]);
913 913
914 $params = $request->all(); 914 $params = $request->all();
915 915
916 $end_begin = DateTime::createFromFormat('d.m.Y', $params['end_begin']); 916 $end_begin = DateTime::createFromFormat('d.m.Y', $params['end_begin']);
917 $params['end_begin'] = $end_begin->format('Y-m-d'); 917 $params['end_begin'] = $end_begin->format('Y-m-d');
918 918
919 $Sertificate = new sertification(); 919 $Sertificate = new sertification();
920 $Sertificate->create($params); 920 $Sertificate->create($params);
921 $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get(); 921 $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get();
922 return redirect()->route('worker.cabinet'); 922 return redirect()->route('worker.cabinet');
923 //return view('ajax.documents', compact('Docs')); 923 //return view('ajax.documents', compact('Docs'));
924 } 924 }
925 925
926 // Удалить сертификат 926 // Удалить сертификат
927 public function delete_sertificate(sertification $doc) { 927 public function delete_sertificate(sertification $doc) {
928 $doc->delete(); 928 $doc->delete();
929 929
930 return redirect()->route('worker.cabinet'); 930 return redirect()->route('worker.cabinet');
931 } 931 }
932 932
933 // Редактирование сертификата 933 // Редактирование сертификата
934 public function edit_sertificate(Worker $worker, sertification $doc) { 934 public function edit_sertificate(Worker $worker, sertification $doc) {
935 return view('workers.sertificate_edit', compact('doc', 'worker')); 935 return view('workers.sertificate_edit', compact('doc', 'worker'));
936 } 936 }
937 937
938 // Редактирование обновление сертификата 938 // Редактирование обновление сертификата
939 public function update_serificate(SertificationRequest $request, sertification $doc) { 939 public function update_serificate(SertificationRequest $request, sertification $doc) {
940 $request->validate([ 940 $request->validate([
941 'name' => 'required|string|max:255', 941 'name' => 'required|string|max:255',
942 'end_begin' => 'required|date|date_format:d.m.Y' 942 'end_begin' => 'required|date|date_format:d.m.Y'
943 ], 943 ],
944 [ 944 [
945 'name' => 'Навание сертификата обязательно для заполнения.', 945 'name' => 'Навание сертификата обязательно для заполнения.',
946 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' 946 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг'
947 ]); 947 ]);
948 948
949 $all = $request->all(); 949 $all = $request->all();
950 950
951 $end_begin = DateTime::createFromFormat('d.m.Y', $all['end_begin']); 951 $end_begin = DateTime::createFromFormat('d.m.Y', $all['end_begin']);
952 $all['end_begin'] = $end_begin->format('Y-m-d'); 952 $all['end_begin'] = $end_begin->format('Y-m-d');
953 953
954 $doc->worker_id = $all['worker_id']; 954 $doc->worker_id = $all['worker_id'];
955 $doc->name = $all['name']; 955 $doc->name = $all['name'];
956 $doc->end_begin = $all['end_begin']; 956 $doc->end_begin = $all['end_begin'];
957 $doc->save(); 957 $doc->save();
958 958
959 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); 959 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!');
960 } 960 }
961 961
962 public function edit_diploms(Request $request, Worker $worker) { 962 public function edit_diploms(Request $request, Worker $worker) {
963 $dop_info_data = $request->input('diploms'); 963 $dop_info_data = $request->input('diploms');
964 964
965 if (empty($dop_info_data)) { 965 if (empty($dop_info_data)) {
966 return redirect()->route('worker.additional_documents')->with('error', 'Данные не предоставлены!'); 966 return redirect()->route('worker.additional_documents')->with('error', 'Данные не предоставлены!');
967 } 967 }
968 968
969 foreach ($dop_info_data as $infoblok_id => $status) { 969 foreach ($dop_info_data as $infoblok_id => $status) {
970 Dop_info::updateOrCreate( 970 Dop_info::updateOrCreate(
971 ['worker_id' => $worker->id, 'infoblok_id' => $infoblok_id], 971 ['worker_id' => $worker->id, 'infoblok_id' => $infoblok_id],
972 ['status' => $status] 972 ['status' => $status]
973 ); 973 );
974 } 974 }
975 975
976 return redirect()->route('worker.additional_documents')->with('success', 'Успешно сохранено!'); 976 return redirect()->route('worker.additional_documents')->with('success', 'Успешно сохранено!');
977 } 977 }
978 978
979 public function delete_add_diplom(Request $request, Worker $worker) { 979 public function delete_add_diplom(Request $request, Worker $worker) {
980 $infoblok_id = $request->get('infoblok_id'); 980 $infoblok_id = $request->get('infoblok_id');
981 981
982 if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) 982 if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0)
983 $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); 983 $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete();
984 else { 984 else {
985 $params['infoblok_id'] = $infoblok_id; 985 $params['infoblok_id'] = $infoblok_id;
986 $params['worker_id'] = $worker->id; 986 $params['worker_id'] = $worker->id;
987 $params['status'] = $request->get('val'); 987 $params['status'] = $request->get('val');
988 $id = Dop_info::create($params); 988 $id = Dop_info::create($params);
989 //$id = $worker->infobloks()->sync([$infoblok_id]); 989 //$id = $worker->infobloks()->sync([$infoblok_id]);
990 } 990 }
991 991
992 //$Infoblocks = infobloks::query()->get(); 992 //$Infoblocks = infobloks::query()->get();
993 return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); 993 return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks'));
994 } 994 }
995 995
996 996
997 997
998 // Добавление диплома 998 // Добавление диплома
999 public function add_diplom_ajax(Request $request) { 999 public function add_diplom_ajax(Request $request) {
1000 // конец 1000 // конец
1001 $params = $request->all(); 1001 $params = $request->all();
1002 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); 1002 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count();
1003 1003
1004 if ($count == 0) $dop_info = Dop_info::create($params); 1004 if ($count == 0) $dop_info = Dop_info::create($params);
1005 $Infoblocks = infobloks::query()->get(); 1005 $Infoblocks = infobloks::query()->get();
1006 $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); 1006 $Worker = Worker::query()->where('id', $request->get('worker_id'))->get();
1007 $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); 1007 $data = Dop_info::query()->where('worker_id', $request->has('worker_id'));
1008 return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); 1008 return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker'));
1009 } 1009 }
1010 1010
1011 // Добавление диплома без ajax 1011 // Добавление диплома без ajax
1012 public function add_diplom(Worker $worker) { 1012 public function add_diplom(Worker $worker) {
1013 $worker_id = $worker->id; 1013 $worker_id = $worker->id;
1014 $Infoblocks = infobloks::query()->get(); 1014 $Infoblocks = infobloks::query()->get();
1015 return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); 1015 return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks'));
1016 } 1016 }
1017 // Сохранить 1017 // Сохранить
1018 // Сохраняю диплом 1018 // Сохраняю диплом
1019 public function add_diplom_save(Request $request) { 1019 public function add_diplom_save(Request $request) {
1020 $params = $request->all(); 1020 $params = $request->all();
1021 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); 1021 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count();
1022 if ($count == 0) $dop_info = Dop_info::create($params); 1022 if ($count == 0) $dop_info = Dop_info::create($params);
1023 return redirect()->route('worker.cabinet'); 1023 return redirect()->route('worker.cabinet');
1024 } 1024 }
1025 1025
1026 // Добавление стандартного документа 1026 // Добавление стандартного документа
1027 public function add_document(Worker $worker) { 1027 public function add_document(Worker $worker) {
1028 return view('workers.docs', compact('worker')); 1028 return view('workers.docs', compact('worker'));
1029 } 1029 }
1030 1030
1031 //Сохранение стандартого документа 1031 //Сохранение стандартого документа
1032 public function add_document_save(DocumentsRequest $request) { 1032 public function add_document_save(DocumentsRequest $request) {
1033 $params = $request->all(); 1033 $params = $request->all();
1034 $place_work = place_works::create($params); 1034 $place_work = place_works::create($params);
1035 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!'); 1035 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!');
1036 } 1036 }
1037 1037
1038 // Редактирование документа 1038 // Редактирование документа
1039 public function edit_document(place_works $doc, Worker $worker) { 1039 public function edit_document(place_works $doc, Worker $worker) {
1040 return view('workers.docs-edit', compact('doc', 'worker')); 1040 return view('workers.docs-edit', compact('doc', 'worker'));
1041 } 1041 }
1042 1042
1043 //Сохранение отредактированного документа 1043 //Сохранение отредактированного документа
1044 public function edit_document_save(DocumentsRequest $request, place_works $doc) { 1044 public function edit_document_save(DocumentsRequest $request, place_works $doc) {
1045 $params = $request->all(); 1045 $params = $request->all();
1046 $doc->update($params); 1046 $doc->update($params);
1047 1047
1048 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); 1048 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!');
1049 } 1049 }
1050 1050
1051 // Удаление документа 1051 // Удаление документа
1052 public function delete_document(place_works $doc) { 1052 public function delete_document(place_works $doc) {
1053 $doc->delete(); 1053 $doc->delete();
1054 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); 1054 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!');
1055 } 1055 }
1056 1056
1057 //Отправка нового сообщения 1057 //Отправка нового сообщения
1058 public function new_message(Request $request) { 1058 public function new_message(Request $request) {
1059 $params = $request->all(); 1059 $params = $request->all();
1060 1060
1061 $id = $params['send_user_id']; 1061 $id = $params['send_user_id'];
1062 $message = new Message(); 1062 $message = new Message();
1063 $message->user_id = $params['send_user_id']; 1063 $message->user_id = $params['send_user_id'];
1064 $message->to_user_id = $params['send_to_user_id']; 1064 $message->to_user_id = $params['send_to_user_id'];
1065 $message->title = $params['send_title']; 1065 $message->title = $params['send_title'];
1066 $message->text = $params['send_text']; 1066 $message->text = $params['send_text'];
1067 $message->ad_employer_id = $params['send_vacancy']; 1067 $message->ad_employer_id = $params['send_vacancy'];
1068 if ($request->has('send_file')) { 1068 if ($request->has('send_file')) {
1069 $message->file = $request->file('send_file')->store("worker/$id", 'public'); 1069 $message->file = $request->file('send_file')->store("worker/$id", 'public');
1070 } 1070 }
1071 $message->flag_new = 1; 1071 $message->flag_new = 1;
1072 $id_message = $message->save(); 1072 $id_message = $message->save();
1073 1073
1074 $data['message_id'] = $id_message; 1074 $data['message_id'] = $id_message;
1075 $data['ad_employer_id'] = $params['send_vacancy']; 1075 $data['ad_employer_id'] = $params['send_vacancy'];
1076 $data['job_title_id'] = $params['send_job_title_id']; 1076 $data['job_title_id'] = $params['send_job_title_id'];
1077 $data['flag'] = 1; 1077 $data['flag'] = 1;
1078 $ad_responce = ad_response::create($data); 1078 $ad_responce = ad_response::create($data);
1079 return redirect()->route('worker.messages', ['type_message' => 'output']); 1079 return redirect()->route('worker.messages', ['type_message' => 'output']);
1080 } 1080 }
1081 1081
1082 1082
1083 public function test123(Request $request) { 1083 public function test123(Request $request) {
1084 $params = $request->all(); 1084 $params = $request->all();
1085 $user1 = $params['user_id']; 1085 $user1 = $params['user_id'];
1086 $user2 = $params['to_user_id']; 1086 $user2 = $params['to_user_id'];
1087 $id_vacancy = $params['ad_employer_id']; 1087 $id_vacancy = $params['ad_employer_id'];
1088 $ad_name = $params['ad_name']; 1088 $ad_name = $params['ad_name'];
1089 1089
1090 $rules = [ 1090 $rules = [
1091 'text' => 'required|min:1|max:150000', 1091 'text' => 'required|min:1|max:150000',
1092 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' 1092 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000'
1093 ]; 1093 ];
1094 $messages = [ 1094 $messages = [
1095 'required' => 'Укажите обязательное поле', 1095 'required' => 'Укажите обязательное поле',
1096 'min' => [ 1096 'min' => [
1097 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 1097 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
1098 'integer' => 'Поле «:attribute» должно быть :min или больше', 1098 'integer' => 'Поле «:attribute» должно быть :min или больше',
1099 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 1099 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
1100 ], 1100 ],
1101 'max' => [ 1101 'max' => [
1102 'string' => 'Поле «:attribute» должно быть не больше :max символов', 1102 'string' => 'Поле «:attribute» должно быть не больше :max символов',
1103 'integer' => 'Поле «:attribute» должно быть :max или меньше', 1103 'integer' => 'Поле «:attribute» должно быть :max или меньше',
1104 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 1104 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
1105 ] 1105 ]
1106 ]; 1106 ];
1107 1107
1108 $validator = Validator::make($request->all(), $rules, $messages); 1108 $validator = Validator::make($request->all(), $rules, $messages);
1109 1109
1110 if ($validator->fails()) { 1110 if ($validator->fails()) {
1111 return redirect()->route('worker.dialog', ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]) 1111 return redirect()->route('worker.dialog', ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name])
1112 ->withErrors($validator); 1112 ->withErrors($validator);
1113 } else { 1113 } else {
1114 if ($request->has('file')) { 1114 if ($request->has('file')) {
1115 $params['file'] = $request->file('file')->store("messages", 'public'); 1115 $params['file'] = $request->file('file')->store("messages", 'public');
1116 } 1116 }
1117 Message::create($params); 1117 Message::create($params);
1118 //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); 1118 //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
1119 return redirect()->route('worker.dialog', 1119 return redirect()->route('worker.dialog',
1120 ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]); 1120 ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]);
1121 1121
1122 } 1122 }
1123 } 1123 }
1124 1124
1125 // Информация о предыдущих компаниях 1125 // Информация о предыдущих компаниях
1126 public function new_prev_company(Worker $worker) { 1126 public function new_prev_company(Worker $worker) {
1127 return view('workers.prev_company_form', compact('worker')); 1127 return view('workers.prev_company_form', compact('worker'));
1128 } 1128 }
1129 1129
1130 // Добавление контакта компании 1130 // Добавление контакта компании
1131 public function add_prev_company(PrevCompanyRequest $request) { 1131 public function add_prev_company(PrevCompanyRequest $request) {
1132 // Возвращение параметров 1132 // Возвращение параметров
1133 $all = $request->all(); 1133 $all = $request->all();
1134 $PrevCompany = PrevCompany::create($all); 1134 $PrevCompany = PrevCompany::create($all);
1135 1135
1136 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); 1136 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись');
1137 } 1137 }
1138 1138
1139 // Редактирование контакта компании 1139 // Редактирование контакта компании
1140 public function edit_prev_company(PrevCompany $doc, Worker $worker) { 1140 public function edit_prev_company(PrevCompany $doc, Worker $worker) {
1141 return view('workers.prev_company_edit_form', compact('doc', 'worker')); 1141 return view('workers.prev_company_edit_form', compact('doc', 'worker'));
1142 } 1142 }
1143 1143
1144 //Сохранение редактирования контакта компании 1144 //Сохранение редактирования контакта компании
1145 public function update_prev_company(PrevCompany $doc, Request $request){ 1145 public function update_prev_company(PrevCompany $doc, Request $request){
1146 $all = $request->all(); 1146 $all = $request->all();
1147 $doc->update($all); 1147 $doc->update($all);
1148 1148
1149 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); 1149 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись');
1150 } 1150 }
1151 1151
1152 // Удаление контакта предыдущей компании 1152 // Удаление контакта предыдущей компании
1153 public function delete_prev_company(PrevCompany $doc) { 1153 public function delete_prev_company(PrevCompany $doc) {
1154 $doc->delete(); 1154 $doc->delete();
1155 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); 1155 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!');
1156 } 1156 }
1157 } 1157 }
1158 1158
1159 1159
resources/views/layout/pdf.blade.php
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html lang="ru"> 2 <html lang="ru">
3 3
4 @php 4 @php
5 $worker = $Query[0]; 5 $worker = $Query[0];
6 @endphp 6 @endphp
7 7
8 <head> 8 <head>
9 <meta charset="utf-8"> 9 <meta charset="utf-8">
10 <title>Резюме соискателя</title> 10 <title>Резюме соискателя</title>
11 <meta name="viewport" content="width=device-width,initial-scale=1"> 11 <meta name="viewport" content="width=device-width,initial-scale=1">
12 <meta name="theme-color" content="#377D87"> 12 <meta name="theme-color" content="#377D87">
13 <style> 13 <style>
14 body { 14 body {
15 font-family:'DejaVu Sans',sans-serif; 15 font-family:'DejaVu Sans',sans-serif;
16 background:#fff; 16 background:#fff;
17 font-size:1.6rem; 17 font-size:1.6rem;
18 font-weight:400; 18 font-weight:400;
19 color:#363A3F; 19 color:#363A3F;
20 } 20 }
21 21
22 .main { 22 .main {
23 padding: 30px 0; 23 padding: 30px 0;
24 } 24 }
25 25
26 .thing { 26 .thing {
27 color: #3a3b3c; 27 color: #3a3b3c;
28 /* background-color: #f2f5fc; */
29 }
30
31 .thing__profile {
32
33 } 28 }
34 29
35 .thing__profile-photo { 30 .thing__profile-photo {
36 width: 200px; 31 width: 200px;
37 border-radius: 8px; 32 border-radius: 8px;
38 float: left; 33 float: left;
39 margin-right: 20px; 34 margin-right: 20px;
40 } 35 }
41 36
42 .thing__profile-body {
43
44 }
45
46 .thing__title { 37 .thing__title {
47 width: 100%; 38 width: 100%;
48 font-size: 32px; 39 font-size: 32px;
49 font-weight: 700; 40 font-weight: 700;
50 line-height: 1.1; 41 line-height: 1.1;
51 margin: 0; 42 margin: 0;
52 } 43 }
53 44
54 .thing__text { 45 .thing__text {
55 font-size: 14px; 46 font-size: 14px;
56 line-height: 1.4; 47 line-height: 1.4;
57 margin: 15px 0 0 0; 48 margin: 15px 0 0 0;
58 } 49 }
59 50
60 .main__spoiler { 51 .main__spoiler {
61 margin: 0px 0px 32px 0px; 52 margin: 0px 0px 32px 0px;
62 } 53 }
63 54
64 .main__spoiler-body {
65
66 }
67
68 .main__table { 55 .main__table {
69 border-collapse: collapse; 56 border-collapse: collapse;
70 table-layout: fixed; 57 table-layout: fixed;
71 font-size: 14px; 58 font-size: 14px;
72 width: 100%; 59 width: 100%;
73 background: #ffffff; 60 background: #ffffff;
74 } 61 }
75 62
76 .main__table thead { 63 .main__table thead {
77 color: #ffffff; 64 color: #ffffff;
78 font-size: 16px; 65 font-size: 16px;
79 background-color: #377d87; 66 background-color: #377d87;
80 } 67 }
81 68
82 .main__table th { 69 .main__table th {
83 padding: 8px 16px; 70 padding: 8px 16px;
84 } 71 }
85 72
86 .main__table td { 73 .main__table td {
87 width: 40%; 74 width: 40%;
88 padding: 8px 16px; 75 padding: 8px 16px;
89 border: 1px solid #cecece; 76 border: 1px solid #cecece;
90 } 77 }
91 78
92 .main__table td b { 79 .main__table td b {
93 font-weight: 700; 80 font-weight: 700;
94 } 81 }
95 82
96 .main__table b { 83 .main__table b {
97 display: block; 84 display: block;
98 } 85 }
99 86
100 .main__table a { 87 .main__table a {
101 color: #377d87; 88 color: #377d87;
102 text-decoration: underline; 89 text-decoration: underline;
103 } 90 }
104 91
105 .main__table td + td { 92 .main__table td + td {
106 width: 60%; 93 width: 60%;
107 } 94 }
108 95
109 .main__table_three td { 96 .main__table_three td {
110 width: 25% !important; 97 width: 25% !important;
111 } 98 }
112 99
100 .main__table_experience td {
101 width: 25% !important;
102 hyphens: auto;
103 overflow: hidden;
104 }
105 .main__table_experience body td:nth-child(1){
106 width: 50% !important;
107 }
108
113 .main__table_three td:last-child { 109 .main__table_three td:last-child {
114 width: 50% !important; 110 width: 50% !important;
115 } 111 }
116 112
117 .main h2 { 113 .main h2 {
118 margin: 0; 114 margin: 0;
119 font-weight: 700; 115 font-weight: 700;
120 font-size: 30px; 116 font-size: 30px;
121 } 117 }
122 118
123 .main p { 119 .main p {
124 margin: 0; 120 margin: 0;
125 font-size: 14px; 121 font-size: 14px;
126 line-height: 1.4; 122 line-height: 1.4;
127 margin: 15px 0 0 0; 123 margin: 15px 0 0 0;
128 } 124 }
129 125
130 .main__resume-profile-info {
131 margin: 30px 0px 0px 0px;
132 }
133
134 .main__resume-profile-info-title {
135 margin-bottom: 20px !important;
136 color: #3a3b3c;
137 }
138
139 .main__resume-profile-info-body-item {
140 margin: 0px 0px 20px 0px;
141 }
142
143 .main__resume-profile-info-body-subtitle {
144 color: #4d88d9;
145 margin: 0px 0px 10px 0px;
146 font-weight: 700;
147 font-size: 22px;
148 }
149
150 .main__resume-profile-info-body-inner {
151 margin: 0;
152 padding: 0;
153 font-size: 12px;
154 }
155
156 .main__resume-profile-info-body-inner li { 126 .main__resume-profile-info-body-inner li {
157 list-style-type: none; 127 list-style-type: none;
158 margin: 0px 0px 20px 0px; 128 margin: 0px 0px 20px 0px;
159 } 129 }
160 130
161 .main__resume-profile-info-body-inner b { 131 .main__resume-profile-info-body-inner b {
162 display: block; 132 display: block;
163 margin: 0px 0px 6px 0px; 133 margin: 0px 0px 6px 0px;
164 color: #377d87; 134 color: #377d87;
165 font-size: 14px; 135 font-size: 14px;
166 } 136 }
167 137
168 .main__resume-profile-info-body-inner span { 138 .main__resume-profile-info-body-inner span {
169 display: block; 139 display: block;
170 } 140 }
171 141
172 .main__resume-profile-info-body-inner a { 142 .main__resume-profile-info-body-inner a {
173 display: block; 143 display: block;
174 text-decoration: none; 144 text-decoration: none;
175 color: inherit; 145 color: inherit;
176 } 146 }
177 147
178 </style> 148 </style>
179 </head> 149 </head>
180 150
181 <body id="body" class="pdf"> 151 <body id="body" class="pdf">
182 <section class="thing thing_pdf"> 152 <section class="thing thing_pdf">
183 <div class="container"> 153 <div class="container">
184 <div class="thing__profile"> 154 <div class="thing__profile">
185 @if (!empty($Query[0]['photo'])) 155 @if (!empty($Query[0]['photo']))
186 <img src="{{ asset(Storage::url($Query[0]['photo'])) }}" alt="" class="thing__profile-photo"> 156 <img src="{{ asset(Storage::url($Query[0]['photo'])) }}" alt="" class="thing__profile-photo">
187 @else 157 @else
188 <img src="{{ asset('images/default_man.jpg') }}" alt="" class="thing__profile-photo"> 158 <img src="{{ asset('images/default_man.jpg') }}" alt="" class="thing__profile-photo">
189 @endif 159 @endif
190 <div class="thing__profile-body"> 160 <div class="thing__profile-body">
191 <h1 class="thing__title">{{ $Query[0]['users']['surname']." ".$Query[0]['users']['name_man']." ".$Query[0]['users']['surname2'] }}</h1> 161 <h1 class="thing__title">{{ $Query[0]['users']['surname']." ".$Query[0]['users']['name_man']." ".$Query[0]['users']['surname2'] }}</h1>
192 <div style="clear:both;"></div> 162 <div style="clear:both;"></div>
193 <p class="thing__text">{{ $Query[0]['text'] }}</p> 163 <p class="thing__text">{{ $Query[0]['text'] }}</p>
194 </div> 164 </div>
195 </div> 165 </div>
196 @if (!empty($Query[0]['users']['file'])) 166 @if (!empty($Query[0]['users']['file']))
197 <a href="{{ asset(Storage::url($Query[0]['users']['file'])) }}">Анкета-файл</a> 167 <a href="{{ asset(Storage::url($Query[0]['users']['file'])) }}">Анкета-файл</a>
198 @endif 168 @endif
199 </div> 169 </div>
200 </section> 170 </section>
201 <main class="main"> 171 <main class="main">
202 <div class="container"> 172 <div class="container">
203 <div class="main__resume-profile"> 173 <div class="main__resume-profile">
204 <div class="main__content"> 174 <div class="main__content">
205 <div class="main__spoiler"> 175 <div class="main__spoiler">
206 <div class="main__spoiler-body"> 176 <div class="main__spoiler-body">
207 <table class="main__table"> 177 <table class="main__table">
208 <thead> 178 <thead>
209 <tr> 179 <tr>
210 <th colspan="2">Основная информация</th> 180 <th colspan="2">Основная информация</th>
211 </tr> 181 </tr>
212 </thead> 182 </thead>
213 <tbody> 183 <tbody>
214 <tr> 184 <tr>
215 <td><b>Статус:</b></td> 185 <td><b>Статус:</b></td>
216 <td>{{ $status_work[$worker->status_work] }}</td> 186 <td>{{ $status_work[$worker->status_work] }}</td>
217 </tr> 187 </tr>
218 <tr> 188 <tr>
219 <td><b>ФИО:</b></td> 189 <td><b>ФИО:</b></td>
220 <td>{{ $worker->users->surname." ".$worker->users->name_man." ".$worker->users->surname2 }}</td> 190 <td>{{ $worker->users->surname." ".$worker->users->name_man." ".$worker->users->surname2 }}</td>
221 </tr> 191 </tr>
222 <tr> 192 <tr>
223 <td><b>Возраст:</b></td> 193 <td><b>Возраст:</b></td>
224 <td>{{ $worker->old_year ?? '-' }}</td> 194 <td>{{ $worker->old_year ?? '-' }}</td>
225 </tr> 195 </tr>
226 <tr> 196 <tr>
227 <td><b>Желаемые вакансии:</b></td> 197 <td><b>Желаемые вакансии:</b></td>
228 <td> 198 <td>
229 @if ($Query[0]->job_titles->count()) 199 @if ($Query[0]->job_titles->count())
230 @foreach ($Query[0]->job_titles as $it) 200 @foreach ($Query[0]->job_titles as $it)
231 @if ($it->is_remove == 0) 201 @if ($it->is_remove == 0)
232 {{ $it->name }} / 202 {{ $it->name }} /
233 @endif 203 @endif
234 @endforeach 204 @endforeach
235 @else 205 @else
236 - 206 -
237 @endif 207 @endif
238 </td> 208 </td>
239 </tr> 209 </tr>
240 <tr> 210 <tr>
241 <td><b>Пожелания по З/П:</b></td> 211 <td><b>Пожелания по З/П:</b></td>
242 <td>{{ $worker->salary_expectations ?? '-' }}</td> 212 <td>{{ $worker->salary_expectations ?? '-' }}</td>
243 </tr> 213 </tr>
244 <tr> 214 <tr>
245 <td><b>Опыт работы:</b></td> 215 <td><b>Опыт работы:</b></td>
246 <td>{{ $worker->experience ?? '-' }}</td> 216 <td>{{ $worker->experience ?? '-' }}</td>
247 </tr> 217 </tr>
248 <tr> 218 <tr>
249 <td><b>Уровень английского:</b></td> 219 <td><b>Уровень английского:</b></td>
250 <td>{{ $worker->english_level ?? '-' }}</td> 220 <td>{{ $worker->english_level ?? '-' }}</td>
251 </tr> 221 </tr>
252 <tr> 222 <tr>
253 <td><b>Дата готовности к посадке:</b></td> 223 <td><b>Дата готовности к посадке:</b></td>
254 <td>{{ $worker->ready_boart_date ?? '-' }}</td> 224 <td>{{ $worker->ready_boart_date ?? '-' }}</td>
255 </tr> 225 </tr>
256 <tr> 226 <tr>
257 <td><b>Предпочтение по типу судна:</b></td> 227 <td><b>Предпочтение по типу судна:</b></td>
258 <td>{{ $worker->boart_type_preference ?? '-' }}</td> 228 <td>{{ $worker->boart_type_preference ?? '-' }}</td>
259 </tr> 229 </tr>
260 <tr> 230 <tr>
261 <td><b>Наличие визы:</b></td> 231 <td><b>Наличие визы:</b></td>
262 <td>{{ $worker->visa_available ?? '-' }}</td> 232 <td>{{ $worker->visa_available ?? '-' }}</td>
263 </tr> 233 </tr>
264 <tr> 234 <tr>
265 <td><b>Наличие танкерных документов:</b></td> 235 <td><b>Наличие танкерных документов:</b></td>
266 <td>{{ $worker->tanker_documents_available ?? '-' }}</td> 236 <td>{{ $worker->tanker_documents_available ?? '-' }}</td>
267 </tr> 237 </tr>
268 <tr> 238 <tr>
269 <td><b>Наличие подтверждения для работы на ВВП:</b></td> 239 <td><b>Наличие подтверждения для работы на ВВП:</b></td>
270 <td>{{ $worker->confirmation_work_for_vvp ?? '-' }}</td> 240 <td>{{ $worker->confirmation_work_for_vvp ?? '-' }}</td>
271 </tr> 241 </tr>
272 <tr> 242 <tr>
273 <td><b>Наличие военного билета / приписного свидетельства:</b></td> 243 <td><b>Наличие военного билета / приписного свидетельства:</b></td>
274 <td>{{ $worker->military_id_available ?? '-' }}</td> 244 <td>{{ $worker->military_id_available ?? '-' }}</td>
275 </tr> 245 </tr>
276 <tr> 246 <tr>
277 <td><b>Город проживания:</b></td> 247 <td><b>Город проживания:</b></td>
278 <td>{{ $worker->city ?? '-' }}</td> 248 <td>{{ $worker->city ?? '-' }}</td>
279 </tr> 249 </tr>
280 <tr> 250 <tr>
281 <td><b>Телефон:</b></td> 251 <td><b>Телефон:</b></td>
282 <td>{{ $worker->telephone ?? '-' }}</td> 252 <td>{{ $worker->telephone ?? '-' }}</td>
283 </tr> 253 </tr>
284 <tr> 254 <tr>
285 <td><b>E-mail:</b></td> 255 <td><b>E-mail:</b></td>
286 <td>{{ $worker->email ?? '-' }}</td> 256 <td>{{ $worker->email ?? '-' }}</td>
287 </tr> 257 </tr>
288 <tr> 258 <tr>
289 <td><b>Контакты родственников:</b></td> 259 <td><b>Контакты родственников:</b></td>
290 <td>{{ $worker->telephone2 ?? '-' }}</td> 260 <td>{{ $worker->telephone2 ?? '-' }}</td>
291 </tr> 261 </tr>
292 </tbody> 262 </tbody>
293 </table> 263 </table>
294 </div> 264 </div>
295 </div> 265 </div>
296 266
297 <div class="main__spoiler"> 267 <div class="main__spoiler">
298 <div class="main__spoiler-body"> 268 <div class="main__spoiler-body">
299 <table class="main__table"> 269 <table class="main__table">
300 <thead> 270 <thead>
301 <tr> 271 <tr>
302 <th colspan="2">Сертификаты / документы</th> 272 <th colspan="2">Сертификаты / документы</th>
303 </tr> 273 </tr>
304 </thead> 274 </thead>
305 <tbody> 275 <tbody>
306 <tr> 276 <tr>
307 <td><b>Название сертификата:</b></td> 277 <td><b>Название сертификата:</b></td>
308 <td><b>Действителен до:</b></td> 278 <td><b>Действителен до:</b></td>
309 </tr> 279 </tr>
310 @if (isset($Query[0]->sertificate) && $Query[0]->sertificate->count()) 280 @if (isset($Query[0]->sertificate) && $Query[0]->sertificate->count())
311 @foreach($Query[0]->sertificate as $it) 281 @foreach($Query[0]->sertificate as $it)
312 <tr> 282 <tr>
313 <td>{{ $it->name }}</td> 283 <td>{{ $it->name }}</td>
314 <td>{{ date('d.m.Y', strtotime($it->end_begin)) }}</td> 284 <td>{{ date('d.m.Y', strtotime($it->end_begin)) }}</td>
315 </tr> 285 </tr>
316 @endforeach 286 @endforeach
317 @else 287 @else
318 <tr> 288 <tr>
319 <td> - </td> 289 <td> - </td>
320 <td> - </td> 290 <td> - </td>
321 </tr> 291 </tr>
322 @endif 292 @endif
323 </tbody> 293 </tbody>
324 </table> 294 </table>
325 </div> 295 </div>
326 </div> 296 </div>
327 297
328 <div class="main__spoiler"> 298 <div class="main__spoiler">
329 <div class="main__spoiler-body"> 299 <div class="main__spoiler-body">
330 <table class="main__table"> 300 <table class="main__table">
331 <thead> 301 <thead>
332 <tr> 302 <tr>
333 <th colspan="2">Дополнительные документы</th> 303 <th colspan="2">Дополнительные документы</th>
334 </tr> 304 </tr>
335 </thead> 305 </thead>
336 <tbody> 306 <tbody>
337 @if ($infoblocks->count()) 307 @if ($infoblocks->count())
338 @foreach ($infoblocks as $info) 308 @foreach ($infoblocks as $info)
339 @php $finder = false; @endphp 309 @php $finder = false; @endphp
340 @if (isset($Query[0]->infobloks)) 310 @if (isset($Query[0]->infobloks))
341 @if ($Query[0]->infobloks->count()) 311 @if ($Query[0]->infobloks->count())
342 312
343 @foreach($Query[0]->infobloks as $it) 313 @foreach($Query[0]->infobloks as $it)
344 @if ($info->id == $it->id) 314 @if ($info->id == $it->id)
345 <tr> 315 <tr>
346 <td><b>{{ $it->name }}</b></td> 316 <td><b>{{ $it->name }}</b></td>
347 <td> 317 <td>
348 @if ($it->model_dop_info[0]->status == 0) Не указано 318 @if ($it->model_dop_info[0]->status == 0) Не указано
349 @elseif($it->model_dop_info[0]->status==1) В наличии 319 @elseif($it->model_dop_info[0]->status==1) В наличии
350 @else Отсутствует 320 @else Отсутствует
351 @endif 321 @endif
352 </td> 322 </td>
353 </tr> 323 </tr>
354 @php $finder = true; @endphp 324 @php $finder = true; @endphp
355 @endif 325 @endif
356 @endforeach 326 @endforeach
357 @endif 327 @endif
358 @endif 328 @endif
359 @if (!$finder) 329 @if (!$finder)
360 <tr> 330 <tr>
361 <td><b>{{ $info->name }}</b></td> 331 <td><b>{{ $info->name }}</b></td>
362 <td> 332 <td>
363 Не указано 333 Не указано
364 </td> 334 </td>
365 </tr> 335 </tr>
366 @endif 336 @endif
367 @endforeach 337 @endforeach
368 @endif 338 @endif
369 </tbody> 339 </tbody>
370 </table> 340 </table>
371 </div> 341 </div>
372 </div> 342 </div>
373 343
374 <div class="main__spoiler"> 344 <div class="main__spoiler">
375 <div class="main__spoiler-body"> 345 <div class="main__spoiler-body">
376 <table class="main__table main__table_three"> 346 <table class="main__table main__table_experience">
377 <thead> 347 <thead>
378 <tr> 348 <tr>
379 <th colspan="9">Опыт работы</th> 349 <th colspan="9">Опыт работы</th>
380 </tr> 350 </tr>
381 </thead> 351 </thead>
382 <tbody> 352 <tbody>
383 <tr> 353 <tr>
384 <td><b>Должность:</b></td> 354 <td style="width: 20.1%;"><b>Должность</b></td>
385 <td><b>Название т/х:</b></td> 355 <td style="width: 11.1%;"><b>Название т/х</b></td>
386 <td><b>Тип судна:</b></td> 356 <td style="width: 11.1%;"><b>Тип судна</b></td>
387 <td><b>Марка ГД:</b></td> 357 <td style="width: 11.1%;"><b>Марка ГД</b></td>
388 <td><b>Мощность ГД (кВТ):</b></td> 358 <td style="width: 11.1%;"><b>Мощность ГД (кВТ)</b></td>
389 <td><b>Водоизмещение (DWT):</b></td> 359 <td style="width: 11.1%;"><b>Водо- измещение (DWT)</b></td>
390 <td><b>Название компании:</b></td> 360 <td style="width: 11.1%;"><b>Название компании</b></td>
391 <td><b>Начало контракта:</b></td> 361 <td style="width: 11.1%;"><b>Начало контракта</b></td>
392 <td><b>Окончание контракта:</b></td> 362 <td style="width: 11.1%;"><b>Окончание контракта</b></td>
393 </tr> 363 </tr>
394 @if (count($Query[0]->place_worker) > 0) 364 @if (count($Query[0]->place_worker) > 0)
395 @foreach($Query[0]->place_worker as $it) 365 @foreach($Query[0]->place_worker as $it)
396 <tr> 366 <tr>
397 <td>{{ $it->job_title }}</td> 367 <td>{{ $it->job_title }}</td>
398 <td>{{ $it->teplohod }}</td> 368 <td>{{ $it->teplohod }}</td>
399 <td>{{ $it->GWT }}</td> 369 <td>{{ $it->GWT }}</td>
400 <td>{{ $it->Marka_GD }}</td> 370 <td>{{ $it->Marka_GD }}</td>
401 <td>{{ $it->KBT }}</td> 371 <td>{{ $it->KBT }}</td>
402 <td>{{ $it->GRT }}</td> 372 <td>{{ $it->GRT }}</td>
403 <td>{{ $it->name_company }}</td> 373 <td>{{ $it->name_company }}</td>
404 <td>{{ date('d.m.Y', strtotime($it->begin_work)) }}</td> 374 <td>{{ date('d.m.Y', strtotime($it->begin_work)) }}</td>
405 <td>{{ date('d.m.Y', strtotime($it->end_work)) }}</td> 375 <td>{{ date('d.m.Y', strtotime($it->end_work)) }}</td>
406 </tr> 376 </tr>
407 @endforeach 377 @endforeach
408 @else 378 @else
409 <td>-</td> 379 <td>-</td>
410 <td>-</td> 380 <td>-</td>
411 <td>-</td> 381 <td>-</td>
412 <td>-</td> 382 <td>-</td>
413 <td>-</td> 383 <td>-</td>
414 <td>-</td> 384 <td>-</td>
415 <td>-</td> 385 <td>-</td>
416 <td>-</td> 386 <td>-</td>
417 <td>-</td> 387 <td>-</td>
418 @endif 388 @endif
419 </tbody> 389 </tbody>
420 </table> 390 </table>
421 </div> 391 </div>
422 </div> 392 </div>
423 393
424 <div class="main__spoiler"> 394 <div class="main__spoiler">
425 <div class="main__spoiler-body"> 395 <div class="main__spoiler-body">
426 <table class="main__table main__table_three"> 396 <table class="main__table main__table_three">
427 <thead> 397 <thead>
428 <tr> 398 <tr>
429 <th colspan="4">Данные о прошлых компаниях</th> 399 <th colspan="4">Данные о прошлых компаниях</th>
430 </tr> 400 </tr>
431 </thead> 401 </thead>
432 <tbody> 402 <tbody>
433 <tr> 403 <tr>
434 <td><b>Название компании:</b></td> 404 <td><b>Название компании</b></td>
435 <td><b>ФИО сотрудника:</b></td> 405 <td><b>ФИО сотрудника</b></td>
436 <td><b>Должность сотрудника:</b></td> 406 <td><b>Должность сотрудника</b></td>
437 <td><b>Телефон сотрудника:</b></td> 407 <td><b>Телефон сотрудника</b></td>
438 </tr> 408 </tr>
439 @if ((isset($worker->prev_company)) && ($worker->prev_company->count())) 409 @if ((isset($worker->prev_company)) && ($worker->prev_company->count()))
440 @foreach ($worker->prev_company as $prev_company) 410 @foreach ($worker->prev_company as $prev_company)
441 <tr> 411 <tr>
442 <td>{{ $prev_company->name_company }}</td> 412 <td>{{ $prev_company->name_company }}</td>
443 <td>{{ $prev_company->direct }}</td> 413 <td>{{ $prev_company->direct }}</td>
444 <td>{{ $prev_company->telephone }}</td> 414 <td>{{ $prev_company->telephone }}</td>
445 <td>{{ $prev_company->telephone2 }}</td> 415 <td>{{ $prev_company->telephone2 }}</td>
446 </tr> 416 </tr>
447 @endforeach 417 @endforeach
448 @else 418 @else
449 <tr> 419 <tr>
450 <td>-</td> 420 <td>-</td>
451 <td>-</td> 421 <td>-</td>
452 <td>-</td> 422 <td>-</td>
453 <td>-</td> 423 <td>-</td>
454 </tr> 424 </tr>
455 @endif 425 @endif
456 </tbody> 426 </tbody>
457 </table> 427 </table>