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