Commit 971031d9c2bd0433d862b9d281b2aac82119fbb6

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

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

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