Commit 18842830e4719ee2427e59b3569e2100af824eb3
Exists in
master
Merge branch 'master' of http://gitlab.nologostudio.ru/alarionov/rekamore-su
Showing 10 changed files Inline Diff
- app/Enums/WorkerStatuses.php
- app/Http/Controllers/Admin/UsersController.php
- app/Http/Controllers/Admin/WorkersController.php
- app/Http/Controllers/EmployerController.php
- app/Http/Controllers/WorkerController.php
- resources/views/employers/favorite.blade.php
- resources/views/info_company_new.blade.php
- resources/views/layout/pdf-list-people.blade.php
- resources/views/resume.blade.php
- resources/views/workers/form_basic_information.blade.php
app/Enums/WorkerStatuses.php
File was created | 1 | <?php | |
2 | |||
3 | namespace App\Enums; | ||
4 | |||
5 | use App\Enums\EnumTraits\EnumToArray; | ||
6 | |||
7 | enum WorkerStatuses: int | ||
8 | { | ||
9 | use EnumToArray; | ||
10 | |||
11 | case NotIndicated = 1; | ||
12 | case LookingForWork = 0; | ||
13 | case NotLookingForWork = 2; | ||
14 | case ConsideringOffers = 3; | ||
15 | |||
16 | public function label(): string | ||
17 | { | ||
18 | return match($this) | ||
19 | { | ||
20 | self::LookingForWork => 'Ищу работу', | ||
21 | self::NotIndicated => 'Не указано', | ||
22 | self::NotLookingForWork => 'Не ищу работу', | ||
23 | self::ConsideringOffers => 'Рассматриваю предложения', | ||
24 | }; | ||
25 | } | ||
26 | |||
27 | public static function getWorkerStatuses(): array { | ||
28 | $statuses_names = self::names(); | ||
29 | |||
30 | $result = []; | ||
31 | foreach ($statuses_names as $status_name){ | ||
32 | $result[self::{$status_name}->value] = self::{$status_name}->label(); | ||
33 | } | ||
34 | return $result; | ||
35 | } | ||
36 | } | ||
37 |
app/Http/Controllers/Admin/UsersController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers\Admin; | 3 | namespace App\Http\Controllers\Admin; |
4 | 4 | ||
5 | use App\Http\Controllers\Controller; | 5 | use App\Http\Controllers\Controller; |
6 | use App\Http\Requests\BaseUserRequest; | 6 | use App\Http\Requests\BaseUserRequest; |
7 | use App\Models\ContentRoles; | 7 | use App\Models\ContentRoles; |
8 | use App\Models\Job_title; | 8 | use App\Models\Job_title; |
9 | use App\Models\User; | 9 | use App\Models\User; |
10 | use App\Models\Worker; | 10 | use App\Models\Worker; |
11 | use Illuminate\Http\Request; | 11 | use Illuminate\Http\Request; |
12 | use Illuminate\Support\Facades\Auth; | 12 | use Illuminate\Support\Facades\Auth; |
13 | use Illuminate\Support\Facades\Storage; | 13 | use Illuminate\Support\Facades\Storage; |
14 | use PhpOffice\PhpSpreadsheet\Spreadsheet; | 14 | use PhpOffice\PhpSpreadsheet\Spreadsheet; |
15 | use PhpOffice\PhpSpreadsheet\Style\Alignment; | 15 | use PhpOffice\PhpSpreadsheet\Style\Alignment; |
16 | use PhpOffice\PhpSpreadsheet\Style\Border; | 16 | use PhpOffice\PhpSpreadsheet\Style\Border; |
17 | use PhpOffice\PhpSpreadsheet\Style\Font; | 17 | use PhpOffice\PhpSpreadsheet\Style\Font; |
18 | use PhpOffice\PhpSpreadsheet\Writer\Xlsx; | 18 | use PhpOffice\PhpSpreadsheet\Writer\Xlsx; |
19 | 19 | ||
20 | class UsersController extends Controller | 20 | class UsersController extends Controller |
21 | { | 21 | { |
22 | public function index(Request $request) { | 22 | public function index(Request $request) { |
23 | $title = 'Админка - Пользователи системы'; | 23 | $title = 'Админка - Пользователи системы'; |
24 | $id_admin = Auth::user()->id; | 24 | $id_admin = Auth::user()->id; |
25 | if ($request->ajax()) { | 25 | if ($request->ajax()) { |
26 | $user = User::find($request->id); | 26 | $user = User::find($request->id); |
27 | $request->offsetUnset('id'); | 27 | $request->offsetUnset('id'); |
28 | $user->update($request->all()); | 28 | $user->update($request->all()); |
29 | } | 29 | } |
30 | 30 | ||
31 | $find_key = ""; | 31 | $find_key = ""; |
32 | $users = User::query(); | 32 | $users = User::query(); |
33 | if (isset($request->find)) { | 33 | if (isset($request->find)) { |
34 | $find_key = $request->find; | 34 | $find_key = $request->find; |
35 | $users = $users->where('name', 'LIKE', "%$find_key%") | 35 | $users = $users->where('name', 'LIKE', "%$find_key%") |
36 | ->orWhere('email', 'LIKE', "%$find_key%"); | 36 | ->orWhere('email', 'LIKE', "%$find_key%"); |
37 | } | 37 | } |
38 | 38 | ||
39 | $users = $users->paginate(15); | 39 | $users = $users->paginate(15); |
40 | 40 | ||
41 | if ($request->ajax()) { | 41 | if ($request->ajax()) { |
42 | return view('admin.users.index_ajax', compact('users', 'id_admin')); | 42 | return view('admin.users.index_ajax', compact('users', 'id_admin')); |
43 | } else { | 43 | } else { |
44 | return view('admin.users.index', compact('users', 'title', 'id_admin', 'find_key')); | 44 | return view('admin.users.index', compact('users', 'title', 'id_admin', 'find_key')); |
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
48 | public function user_delete(User $user) { | 48 | public function user_delete(User $user) { |
49 | $id = $user->delete(); | 49 | $id = $user->delete(); |
50 | 50 | ||
51 | return redirect()->route('admin.users')->with('Пользователь был удален из системы'); | 51 | return redirect()->route('admin.users')->with('Пользователь был удален из системы'); |
52 | } | 52 | } |
53 | 53 | ||
54 | public function index_bd(Request $request) { | 54 | public function index_bd(Request $request) { |
55 | $title = 'Админка - Пользователи базы данных'; | 55 | $title = 'Админка - Пользователи базы данных'; |
56 | 56 | ||
57 | $find_key = ""; | 57 | $find_key = ""; |
58 | $users = User::query(); | 58 | $users = User::query(); |
59 | if (isset($request->find)) { | 59 | if (isset($request->find)) { |
60 | $find_key = $request->find; | 60 | $find_key = $request->find; |
61 | $users = $users->where('name', 'LIKE', "%$find_key%") | 61 | $users = $users->where('name', 'LIKE', "%$find_key%") |
62 | ->orWhere('email', 'LIKE', "%$find_key%") | 62 | ->orWhere('email', 'LIKE', "%$find_key%") |
63 | ->orWhere('telephone', 'LIKE', "%$find_key%"); | 63 | ->orWhere('telephone', 'LIKE', "%$find_key%"); |
64 | } | 64 | } |
65 | 65 | ||
66 | $users = $users->Baseuser()->paginate(15); | 66 | $users = $users->Baseuser() |
67 | ->orderByDesc(Worker::select('created_at')->whereColumn('workers.user_id', 'users.id')) | ||
68 | ->paginate(15); | ||
67 | 69 | ||
68 | if ($request->ajax()) { | 70 | if ($request->ajax()) { |
69 | return view('admin.users.index_bd_ajax', compact('users')); | 71 | return view('admin.users.index_bd_ajax', compact('users')); |
70 | } else { | 72 | } else { |
71 | return view('admin.users.index_bd', compact('users', 'title', 'find_key')); | 73 | return view('admin.users.index_bd', compact('users', 'title', 'find_key')); |
72 | } | 74 | } |
73 | } | 75 | } |
74 | 76 | ||
75 | public function add_bd() { | 77 | public function add_bd() { |
76 | $list_job_titles = Job_title::query()->active()->where('is_bd', '=' , '2')->orderBy('name', 'asc')->get(); | 78 | $list_job_titles = Job_title::query()->active()->where('is_bd', '=' , '2')->orderBy('name', 'asc')->get(); |
77 | return view('admin.users.add', compact('list_job_titles')); | 79 | return view('admin.users.add', compact('list_job_titles')); |
78 | } | 80 | } |
79 | 81 | ||
80 | public function add_store_bd(BaseUserRequest $request) { | 82 | public function add_store_bd(BaseUserRequest $request) { |
81 | $params = $request->all(); | 83 | $params = $request->all(); |
82 | $position_work = $request->position_work; | 84 | $position_work = $request->position_work; |
83 | 85 | ||
84 | if ($request->has('file')) { | 86 | if ($request->has('file')) { |
85 | $params['file'] = $request->file('file')->store('basedata', 'public'); | 87 | $params['file'] = $request->file('file')->store('basedata', 'public'); |
86 | } | 88 | } |
87 | 89 | ||
88 | if (isset($request->name)) { | 90 | if (isset($request->name)) { |
89 | $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2; | 91 | $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2; |
90 | } | 92 | } |
91 | 93 | ||
92 | $user = User::create($params); | 94 | $user = User::create($params); |
93 | $user_id = $user->id; | 95 | $user_id = $user->id; |
94 | $worker = new Worker(); | 96 | $worker = new Worker(); |
95 | $worker->position_work = $position_work; | 97 | $worker->position_work = $position_work; |
96 | $worker->user_id = $user_id; | 98 | $worker->user_id = $user_id; |
97 | $worker->save(); | 99 | $worker->save(); |
98 | 100 | ||
99 | return redirect()->route('admin.basedata'); | 101 | return redirect()->route('admin.basedata'); |
100 | } | 102 | } |
101 | 103 | ||
102 | public function edit_bd(User $user) { | 104 | public function edit_bd(User $user) { |
103 | $list_job_titles = Job_title::query()->active()->where('is_bd', '=' , '2')-> | 105 | $list_job_titles = Job_title::query()->active()->where('is_bd', '=' , '2')-> |
104 | orderByDesc('sort')->orderBy('name', 'asc')->get(); | 106 | orderByDesc('sort')->orderBy('name', 'asc')->get(); |
105 | return view('admin.users.edit', compact('user', 'list_job_titles')); | 107 | return view('admin.users.edit', compact('user', 'list_job_titles')); |
106 | } | 108 | } |
107 | 109 | ||
108 | public function update_bd(BaseUserRequest $request, User $user) { | 110 | public function update_bd(BaseUserRequest $request, User $user) { |
109 | $params = $request->all(); | 111 | $params = $request->all(); |
110 | $position_work = $request->position_work; | 112 | $position_work = $request->position_work; |
111 | 113 | ||
112 | if ($request->has('file')) { | 114 | if ($request->has('file')) { |
113 | if (!empty($user->file)) Storage::delete($user->file); | 115 | if (!empty($user->file)) Storage::delete($user->file); |
114 | $params['file'] = $request->file('file')->store('basedata', 'public'); | 116 | $params['file'] = $request->file('file')->store('basedata', 'public'); |
115 | } else { | 117 | } else { |
116 | if (!empty($user->image)) $params['file'] = $user->file; | 118 | if (!empty($user->image)) $params['file'] = $user->file; |
117 | } | 119 | } |
118 | 120 | ||
119 | if (isset($request->name)) { | 121 | if (isset($request->name)) { |
120 | $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2; | 122 | $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2; |
121 | } | 123 | } |
122 | 124 | ||
123 | $user->update($params); | 125 | $user->update($params); |
124 | if (isset($user->workers[0]->id)) { | 126 | if (isset($user->workers[0]->id)) { |
125 | $worker = Worker::find($user->workers[0]->id); | 127 | $worker = Worker::find($user->workers[0]->id); |
126 | $worker->position_work = $position_work; | 128 | $worker->position_work = $position_work; |
127 | $worker->save(); | 129 | $worker->save(); |
128 | } else { | 130 | } else { |
129 | $worker = new Worker(); | 131 | $worker = new Worker(); |
130 | $worker->user_id = $user->id; | 132 | $worker->user_id = $user->id; |
131 | $worker->position_work = $position_work; | 133 | $worker->position_work = $position_work; |
132 | $worker->save(); | 134 | $worker->save(); |
133 | } | 135 | } |
134 | 136 | ||
135 | return redirect()->route('admin.basedata'); | 137 | return redirect()->route('admin.basedata'); |
136 | } | 138 | } |
137 | 139 | ||
138 | public function destroy_bd(User $user) { | 140 | public function destroy_bd(User $user) { |
139 | $user->delete(); | 141 | $user->delete(); |
140 | return redirect()->route('admin.basedata'); | 142 | return redirect()->route('admin.basedata'); |
141 | } | 143 | } |
142 | 144 | ||
143 | public function roles(Request $request) { | 145 | public function roles(Request $request) { |
144 | if ($request->ajax()) { | 146 | if ($request->ajax()) { |
145 | $user = User::find($request->id); | 147 | $user = User::find($request->id); |
146 | $request->offsetUnset('id'); | 148 | $request->offsetUnset('id'); |
147 | $user->update($request->all()); | 149 | $user->update($request->all()); |
148 | } | 150 | } |
149 | 151 | ||
150 | $users = User::query()->Realuser()->paginate(15); | 152 | $users = User::query()->Realuser()->paginate(15); |
151 | 153 | ||
152 | if ($request->ajax()) { | 154 | if ($request->ajax()) { |
153 | return view('admin.users.roles.index_ajax', compact('users')); | 155 | return view('admin.users.roles.index_ajax', compact('users')); |
154 | } else { | 156 | } else { |
155 | return view('admin.users.roles.index', compact('users')); | 157 | return view('admin.users.roles.index', compact('users')); |
156 | } | 158 | } |
157 | } | 159 | } |
158 | 160 | ||
159 | public function admin_roles(Request $request) { | 161 | public function admin_roles(Request $request) { |
160 | 162 | ||
161 | if ($request->ajax()) { | 163 | if ($request->ajax()) { |
162 | $id = $request->id; | 164 | $id = $request->id; |
163 | $request->offsetUnset('id'); | 165 | $request->offsetUnset('id'); |
164 | ContentRoles::where('id', '=', $id)->update($request->all()); | 166 | ContentRoles::where('id', '=', $id)->update($request->all()); |
165 | } | 167 | } |
166 | $roles = ContentRoles::query()->OrderBy('id')->paginate(25); | 168 | $roles = ContentRoles::query()->OrderBy('id')->paginate(25); |
167 | 169 | ||
168 | 170 | ||
169 | if ($request->ajax()) { | 171 | if ($request->ajax()) { |
170 | return view('admin.content.roles_index_ajax', compact('roles')); | 172 | return view('admin.content.roles_index_ajax', compact('roles')); |
171 | } else { | 173 | } else { |
172 | return view('admin.content.roles_index', compact('roles')); | 174 | return view('admin.content.roles_index', compact('roles')); |
173 | } | 175 | } |
174 | } | 176 | } |
175 | 177 | ||
176 | public function doc_bd(User $user) { | 178 | public function doc_bd(User $user) { |
177 | $id = $user->id; | 179 | $id = $user->id; |
178 | $spreadsheet = new Spreadsheet(); | 180 | $spreadsheet = new Spreadsheet(); |
179 | $activeWorksheet = $spreadsheet->getActiveSheet(); | 181 | $activeWorksheet = $spreadsheet->getActiveSheet(); |
180 | $activeWorksheet->setCellValue('A1', 'Отчет по соискателю'); | 182 | $activeWorksheet->setCellValue('A1', 'Отчет по соискателю'); |
181 | $activeWorksheet->getStyle('A1')->applyFromArray([ | 183 | $activeWorksheet->getStyle('A1')->applyFromArray([ |
182 | 'font' => [ | 184 | 'font' => [ |
183 | 'name' => 'Arial', | 185 | 'name' => 'Arial', |
184 | 'bold' => true, | 186 | 'bold' => true, |
185 | 'italic' => false, | 187 | 'italic' => false, |
186 | 'underline' => Font::UNDERLINE_DOUBLE, | 188 | 'underline' => Font::UNDERLINE_DOUBLE, |
187 | 'strikethrough' => false, | 189 | 'strikethrough' => false, |
188 | 'color' => [ | 190 | 'color' => [ |
189 | 'rgb' => '808080' | 191 | 'rgb' => '808080' |
190 | ] | 192 | ] |
191 | ], | 193 | ], |
192 | 'borders' => [ | 194 | 'borders' => [ |
193 | 'allBorders' => [ | 195 | 'allBorders' => [ |
194 | 'borderStyle' => Border::BORDER_THIN, | 196 | 'borderStyle' => Border::BORDER_THIN, |
195 | 'color' => [ | 197 | 'color' => [ |
196 | 'rgb' => '808080' | 198 | 'rgb' => '808080' |
197 | ] | 199 | ] |
198 | ], | 200 | ], |
199 | 'outline' => array( | 201 | 'outline' => array( |
200 | 'style' => Border::BORDER_THIN, | 202 | 'style' => Border::BORDER_THIN, |
201 | 'color' => array('rgb' => '000000') | 203 | 'color' => array('rgb' => '000000') |
202 | ), | 204 | ), |
203 | ], | 205 | ], |
204 | 206 | ||
205 | 'alignment' => [ | 207 | 'alignment' => [ |
206 | 'horizontal' => Alignment::HORIZONTAL_CENTER, | 208 | 'horizontal' => Alignment::HORIZONTAL_CENTER, |
207 | 'vertical' => Alignment::VERTICAL_CENTER, | 209 | 'vertical' => Alignment::VERTICAL_CENTER, |
208 | 'wrapText' => true, | 210 | 'wrapText' => true, |
209 | ] | 211 | ] |
210 | ]); | 212 | ]); |
211 | 213 | ||
212 | $activeWorksheet->setCellValue('A2', "Псевдоним/имя: ".$user->name); | 214 | $activeWorksheet->setCellValue('A2', "Псевдоним/имя: ".$user->name); |
213 | $activeWorksheet->setCellValue('A3', "Фамилия: ".$user->surname); | 215 | $activeWorksheet->setCellValue('A3', "Фамилия: ".$user->surname); |
214 | $activeWorksheet->setCellValue('A4', "Имя: ".$user->name_man); | 216 | $activeWorksheet->setCellValue('A4', "Имя: ".$user->name_man); |
215 | $activeWorksheet->setCellValue('A5', "Отчество: ".$user->surname2); | 217 | $activeWorksheet->setCellValue('A5', "Отчество: ".$user->surname2); |
216 | $activeWorksheet->setCellValue('A6', "Телефон: ".$user->telephone); | 218 | $activeWorksheet->setCellValue('A6', "Телефон: ".$user->telephone); |
217 | $activeWorksheet->setCellValue('A7', "Емайл: ".$user->email); | 219 | $activeWorksheet->setCellValue('A7', "Емайл: ".$user->email); |
218 | 220 | ||
219 | if (isset($user->workers[0]->id)) { | 221 | if (isset($user->workers[0]->id)) { |
220 | $activeWorksheet->setCellValue('A9', "Анкета: "); | 222 | $activeWorksheet->setCellValue('A9', "Анкета: "); |
221 | $activeWorksheet->setCellValue('A10', "Телефон: " . $user->workers[0]->telephone); | 223 | $activeWorksheet->setCellValue('A10', "Телефон: " . $user->workers[0]->telephone); |
222 | $activeWorksheet->setCellValue('A11', "Емайл: " . $user->workers[0]->email); | 224 | $activeWorksheet->setCellValue('A11', "Емайл: " . $user->workers[0]->email); |
223 | } | 225 | } |
224 | 226 | ||
225 | if (isset($user->jobtitles[0]->id)) { | 227 | if (isset($user->jobtitles[0]->id)) { |
226 | $activeWorksheet->setCellValue('A12', "Должность: " . $user->jobtitles[0]->name); | 228 | $activeWorksheet->setCellValue('A12', "Должность: " . $user->jobtitles[0]->name); |
227 | } | 229 | } |
228 | $activeWorksheet->getColumnDimension("A")->setWidth(100); | 230 | $activeWorksheet->getColumnDimension("A")->setWidth(100); |
229 | $writer = new Xlsx($spreadsheet); | 231 | $writer = new Xlsx($spreadsheet); |
230 | 232 | ||
231 | header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); | 233 | header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); |
232 | header('Content-Disposition: attachment; filename="user'.$id.'.xlsx"'); | 234 | header('Content-Disposition: attachment; filename="user'.$id.'.xlsx"'); |
233 | header('Cache-Control: no-cache'); | 235 | header('Cache-Control: no-cache'); |
234 | 236 | ||
235 | $writer->save('php://output'); | 237 | $writer->save('php://output'); |
236 | $writer->save(storage_path("app/public/export/user$id.xlsx")); | 238 | $writer->save(storage_path("app/public/export/user$id.xlsx")); |
237 | 239 | ||
238 | //$spreadsheet->disconnectWorksheets(); | 240 | //$spreadsheet->disconnectWorksheets(); |
239 | return redirect()->route('admin.basedata'); | 241 | return redirect()->route('admin.basedata'); |
240 | 242 | ||
241 | } | 243 | } |
242 | } | 244 | } |
243 | 245 |
app/Http/Controllers/Admin/WorkersController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers\Admin; | 3 | namespace App\Http\Controllers\Admin; |
4 | 4 | ||
5 | use App\Http\Controllers\Controller; | 5 | use App\Http\Controllers\Controller; |
6 | use App\Http\Requests\WorkerRequest; | 6 | use App\Http\Requests\WorkerRequest; |
7 | use App\Models\Company; | 7 | use App\Models\Company; |
8 | use App\Models\Job_title; | 8 | use App\Models\Job_title; |
9 | use App\Models\Static_worker; | 9 | use App\Models\Static_worker; |
10 | use App\Models\User; | 10 | use App\Models\User; |
11 | use App\Models\Worker; | 11 | use App\Models\Worker; |
12 | use Carbon\Carbon; | 12 | use Carbon\Carbon; |
13 | use Illuminate\Database\Eloquent\Builder; | 13 | use Illuminate\Database\Eloquent\Builder; |
14 | use Illuminate\Http\Request; | 14 | use Illuminate\Http\Request; |
15 | use Illuminate\Support\Facades\DB; | ||
16 | use Illuminate\Support\Facades\Storage; | 15 | use Illuminate\Support\Facades\Storage; |
17 | use Illuminate\Support\Facades\Validator; | 16 | use Illuminate\Support\Facades\Validator; |
17 | use App\Enums\WorkerStatuses; | ||
18 | 18 | ||
19 | class WorkersController extends Controller | 19 | class WorkersController extends Controller |
20 | { | 20 | { |
21 | |||
22 | public $Status_work = [ | ||
23 | '0' => 'Не ищу работу', | ||
24 | '1' => 'Ищу работу', | ||
25 | '2' => 'Не указано' | ||
26 | ]; | ||
27 | |||
28 | public function index(Request $request) { | 21 | public function index(Request $request) { |
29 | if ($request->ajax()) { | 22 | if ($request->ajax()) { |
30 | $user = User::find($request->id); | 23 | $user = User::find($request->id); |
31 | $request->offsetUnset('id'); | 24 | $request->offsetUnset('id'); |
32 | $user->update($request->all()); | 25 | $user->update($request->all()); |
33 | } | 26 | } |
34 | 27 | ||
35 | $status_work = Job_title::query()->active()->orderBy('name')->get(); | 28 | $status_work = Job_title::query()->active()->orderBy('name')->get(); |
36 | $users = User::with('jobtitles')->worker()->realuser(); | 29 | $users = User::with('jobtitles')->worker()->realuser(); |
37 | $all_worker = $users->count(); | 30 | $all_worker = $users->count(); |
38 | 31 | ||
39 | $find_status_work = ""; | 32 | $find_status_work = ""; |
40 | if (isset($request->status_work)) { | 33 | if (isset($request->status_work)) { |
41 | $find_status_work = $request->status_work; | 34 | $find_status_work = $request->status_work; |
42 | 35 | ||
43 | if ($request->status_work > 0) { | 36 | if ($request->status_work > 0) { |
44 | $users = $users->with('workers')-> | 37 | $users = $users->with('workers')-> |
45 | whereHas('workers', | 38 | whereHas('workers', |
46 | function (Builder $query) use ($find_status_work) { | 39 | function (Builder $query) use ($find_status_work) { |
47 | $query->where('position_work', $find_status_work); | 40 | $query->where('position_work', $find_status_work); |
48 | } | 41 | } |
49 | ); | 42 | ); |
50 | } else { | 43 | } else { |
51 | $users = $users->with('workers'); | 44 | $users = $users->with('workers'); |
52 | } | 45 | } |
53 | 46 | ||
54 | } else { | 47 | } else { |
55 | $users = $users->with('workers'); | 48 | $users = $users->with('workers'); |
56 | } | 49 | } |
57 | 50 | ||
58 | $find_key = ""; | 51 | $find_key = ""; |
59 | if (isset($request->find)) { | 52 | if (isset($request->find)) { |
60 | $find_key = $request->find; | 53 | $find_key = $request->find; |
61 | $users = $users->where(function($query) use($find_key) { | 54 | $users = $users->where(function($query) use($find_key) { |
62 | $query->Where('name_man', 'LIKE', "%$find_key%") | 55 | $query->Where('name_man', 'LIKE', "%$find_key%") |
63 | ->orWhere('email', 'LIKE', "%$find_key%") | 56 | ->orWhere('email', 'LIKE', "%$find_key%") |
64 | ->orWhere('telephone', 'LIKE', "%$find_key%") | 57 | ->orWhere('telephone', 'LIKE', "%$find_key%") |
65 | ->orWhere('surname', 'LIKE', "%$find_key%") | 58 | ->orWhere('surname', 'LIKE', "%$find_key%") |
66 | ->orWhere('surname2', 'LIKE', "%$find_key%"); | 59 | ->orWhere('surname2', 'LIKE', "%$find_key%"); |
67 | }); | 60 | }); |
68 | } | 61 | } |
69 | 62 | ||
70 | $users = $users->orderByDesc('id')->Realuser()->paginate(15); | 63 | $users = $users->orderByDesc('id')->Realuser()->paginate(15); |
71 | 64 | ||
72 | $status_wor = $this->Status_work; | 65 | $status_wor = WorkerStatuses::getWorkerStatuses(); |
73 | 66 | ||
74 | if ($request->ajax()) { | 67 | if ($request->ajax()) { |
75 | return view('admin.worker.index_ajax', compact('users', 'status_wor')); | 68 | return view('admin.worker.index_ajax', compact('users', 'status_wor')); |
76 | } else { | 69 | } else { |
77 | return view('admin.worker.index', compact('users', | 70 | return view('admin.worker.index', compact('users', |
78 | 'find_key', | 71 | 'find_key', |
79 | 'find_status_work', | 72 | 'find_status_work', |
80 | 'status_work', | 73 | 'status_work', |
81 | 'status_wor', | 74 | 'status_wor', |
82 | 'all_worker')); | 75 | 'all_worker')); |
83 | } | 76 | } |
84 | } | 77 | } |
85 | 78 | ||
86 | public function form_add_worker(User $user) { | 79 | public function form_add_worker(User $user) { |
87 | $job_titles = Job_title::query()->active()->orderBy('name')->get(); | 80 | $job_titles = Job_title::query()->active()->orderBy('name')->get(); |
88 | 81 | ||
89 | $time_end_anketa = 'Создана только'; | 82 | $time_end_anketa = 'Создана только'; |
90 | $long_days = Company::find(1)->time_resume; | 83 | $long_days = Company::find(1)->time_resume; |
91 | $time_end_anketa = date("d.m.Y H:i:s", strtotime(Carbon::now() . "+$long_days days")); | 84 | $time_end_anketa = date("d.m.Y H:i:s", strtotime(Carbon::now() . "+$long_days days")); |
92 | 85 | ||
93 | return view('admin.worker.add', compact('user', 'job_titles', 'time_end_anketa')); | 86 | return view('admin.worker.add', compact('user', 'job_titles', 'time_end_anketa')); |
94 | } | 87 | } |
95 | 88 | ||
96 | public function form_store_worker(WorkerRequest $request, User $user) { | 89 | public function form_store_worker(WorkerRequest $request, User $user) { |
97 | $params = $request->all(); | 90 | $params = $request->all(); |
98 | $worker = Worker::create($params); | 91 | $worker = Worker::create($params); |
99 | return redirect()->route('admin.basedata'); | 92 | return redirect()->route('admin.basedata'); |
100 | } | 93 | } |
101 | 94 | ||
102 | public function form_edit_worker(Worker $worker) { | 95 | public function form_edit_worker(Worker $worker) { |
103 | $job_titles = Job_title::query()->active()->orderBy('name')->get(); | 96 | $job_titles = Job_title::query()->active()->orderBy('name')->get(); |
104 | 97 | ||
105 | $time_end_anketa = 'Бессрочно'; | 98 | $time_end_anketa = 'Бессрочно'; |
106 | if (!empty($worker->updated_at)) { | 99 | if (!empty($worker->updated_at)) { |
107 | $long_days = Company::find(1)->time_resume; | 100 | $long_days = Company::find(1)->time_resume; |
108 | $time_end_anketa = date("d.m.Y H:i:s", strtotime($worker->updated_at . "+$long_days days")); | 101 | $time_end_anketa = date("d.m.Y H:i:s", strtotime($worker->updated_at . "+$long_days days")); |
109 | } | 102 | } |
110 | return view('admin.worker.edit', compact('worker', 'job_titles', 'time_end_anketa')); | 103 | return view('admin.worker.edit', compact('worker', 'job_titles', 'time_end_anketa')); |
111 | } | 104 | } |
112 | 105 | ||
113 | public function form_update_worker(Request $request, Worker $worker) | 106 | public function form_update_worker(Request $request, Worker $worker) |
114 | { | 107 | { |
115 | $params = $request->all(); | 108 | $params = $request->all(); |
116 | 109 | ||
117 | $rules = [ | 110 | $rules = [ |
118 | 'email' => 'email|string|max:255', | 111 | 'email' => 'email|string|max:255', |
119 | //'photo' => 'mimes:jpeg,jpg,png|max:15000', | 112 | //'photo' => 'mimes:jpeg,jpg,png|max:15000', |
120 | ]; | 113 | ]; |
121 | 114 | ||
122 | $messages = [ | 115 | $messages = [ |
123 | 'required' => 'Укажите обязательное поле «:attribute»', | 116 | 'required' => 'Укажите обязательное поле «:attribute»', |
124 | 'confirmed' => 'Пароли не совпадают', | 117 | 'confirmed' => 'Пароли не совпадают', |
125 | 'email' => 'Введите корректный email', | 118 | 'email' => 'Введите корректный email', |
126 | 'min' => [ | 119 | 'min' => [ |
127 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 120 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
128 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 121 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
129 | ], | 122 | ], |
130 | 'max' => [ | 123 | 'max' => [ |
131 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 124 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
132 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 125 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
133 | ], | 126 | ], |
134 | ]; | 127 | ]; |
135 | 128 | ||
136 | $validator = Validator::make($params, $rules, $messages); | 129 | $validator = Validator::make($params, $rules, $messages); |
137 | 130 | ||
138 | if ($validator->fails()) { | 131 | if ($validator->fails()) { |
139 | return back()->withErrors($validator)->withInput(); | 132 | return back()->withErrors($validator)->withInput(); |
140 | } else { | 133 | } else { |
141 | $user_id = $worker->user_id; | 134 | $user_id = $worker->user_id; |
142 | if ($request->has('photo')) { | 135 | if ($request->has('photo')) { |
143 | if (!empty($worker->photo)) { | 136 | if (!empty($worker->photo)) { |
144 | Storage::delete($worker->photo); | 137 | Storage::delete($worker->photo); |
145 | } | 138 | } |
146 | if (!empty($request->photo)) | 139 | if (!empty($request->photo)) |
147 | $params['photo'] = $request->file('photo')->store("workers/$user_id", 'public'); | 140 | $params['photo'] = $request->file('photo')->store("workers/$user_id", 'public'); |
148 | } | 141 | } |
149 | $worker->update($params); | 142 | $worker->update($params); |
150 | 143 | ||
151 | return redirect()->route('admin.workers'); | 144 | return redirect()->route('admin.workers'); |
152 | } | 145 | } |
153 | } | 146 | } |
154 | 147 | ||
155 | // кабинет - статистика работников | 148 | // кабинет - статистика работников |
156 | public function static_workers(Request $request) { | 149 | public function static_workers(Request $request) { |
157 | $stat = Static_worker::with('users'); | 150 | $stat = Static_worker::with('users'); |
158 | //->join('users', 'users.id', '=', 'static_workers.user_id'); | 151 | //->join('users', 'users.id', '=', 'static_workers.user_id'); |
159 | $users = User::query()->active()->OrderBy('id')->get(); | 152 | $users = User::query()->active()->OrderBy('id')->get(); |
160 | $periods = Static_worker::query()->distinct('year_month')->select('year_month')->get(); | 153 | $periods = Static_worker::query()->distinct('year_month')->select('year_month')->get(); |
161 | if ($request->ajax()) { | 154 | if ($request->ajax()) { |
162 | if (isset($request->user_id)) | 155 | if (isset($request->user_id)) |
163 | if (!$request->user_id == "0") | 156 | if (!$request->user_id == "0") |
164 | $stat = $stat->Where('user_id', '=', $request->user_id); | 157 | $stat = $stat->Where('user_id', '=', $request->user_id); |
165 | if (isset($request->year_month)) { | 158 | if (isset($request->year_month)) { |
166 | if (!$request->year_month == "0") | 159 | if (!$request->year_month == "0") |
167 | $stat = $stat->Where('year_month', '=', $request->year_month); | 160 | $stat = $stat->Where('year_month', '=', $request->year_month); |
168 | } | 161 | } |
169 | } | 162 | } |
170 | 163 | ||
171 | $stat = $stat->OrderByDesc('year_month'); | 164 | $stat = $stat->OrderByDesc('year_month'); |
172 | //->OrderBy('users.name'); | 165 | //->OrderBy('users.name'); |
173 | //OrderBy('users.name')-> | 166 | //OrderBy('users.name')-> |
174 | /*$stat->implode() loadMissing(['users' => function (Builder $query) { | 167 | /*$stat->implode() loadMissing(['users' => function (Builder $query) { |
175 | $query->orderBy('name', 'asc'); | 168 | $query->orderBy('name', 'asc'); |
176 | }]);*/ | 169 | }]);*/ |
177 | 170 | ||
178 | $stat = $stat->paginate(15); | 171 | $stat = $stat->paginate(15); |
179 | 172 | ||
180 | if ($request->ajax()) | 173 | if ($request->ajax()) |
181 | return view('admin.static.index_workers_ajax', compact('stat')); | 174 | return view('admin.static.index_workers_ajax', compact('stat')); |
182 | else | 175 | else |
183 | return view('admin.static.index_workers', compact('stat', 'users', 'periods')); | 176 | return view('admin.static.index_workers', compact('stat', 'users', 'periods')); |
184 | 177 | ||
185 | } | 178 | } |
186 | 179 | ||
187 | } | 180 | } |
app/Http/Controllers/EmployerController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Classes\Tools; | 6 | use App\Classes\Tools; |
7 | use App\Http\Requests\BaseUser_min_Request; | 7 | use App\Http\Requests\BaseUser_min_Request; |
8 | use App\Http\Requests\FlotRequest; | 8 | use App\Http\Requests\FlotRequest; |
9 | use App\Http\Requests\MessagesRequiest; | 9 | use App\Http\Requests\MessagesRequiest; |
10 | use App\Http\Requests\VacancyRequestEdit; | 10 | use App\Http\Requests\VacancyRequestEdit; |
11 | use App\Mail\MailCreateEmployer; | 11 | use App\Mail\MailCreateEmployer; |
12 | use App\Mail\MailSotrudnichestvo; | 12 | use App\Mail\MailSotrudnichestvo; |
13 | use App\Mail\SendAllMessages; | 13 | use App\Mail\SendAllMessages; |
14 | use App\Models\Ad_employer; | 14 | use App\Models\Ad_employer; |
15 | use App\Models\ad_response; | 15 | use App\Models\ad_response; |
16 | use App\Models\Category; | 16 | use App\Models\Category; |
17 | use App\Models\Employer; | 17 | use App\Models\Employer; |
18 | use App\Models\Flot; | 18 | use App\Models\Flot; |
19 | use App\Models\Job_title; | 19 | use App\Models\Job_title; |
20 | use App\Models\Like_worker; | 20 | use App\Models\Like_worker; |
21 | use App\Models\Message; | 21 | use App\Models\Message; |
22 | use App\Models\Worker; | 22 | use App\Models\Worker; |
23 | use Carbon\Carbon; | 23 | use Carbon\Carbon; |
24 | use Illuminate\Auth\Events\Registered; | 24 | use Illuminate\Auth\Events\Registered; |
25 | use Illuminate\Database\Eloquent\Builder; | 25 | use Illuminate\Database\Eloquent\Builder; |
26 | use Illuminate\Http\Request; | 26 | use Illuminate\Http\Request; |
27 | use Illuminate\Support\Facades\Auth; | 27 | use Illuminate\Support\Facades\Auth; |
28 | use Illuminate\Support\Facades\Hash; | 28 | use Illuminate\Support\Facades\Hash; |
29 | use Illuminate\Support\Facades\Mail; | 29 | use Illuminate\Support\Facades\Mail; |
30 | use Illuminate\Support\Facades\Storage; | 30 | use Illuminate\Support\Facades\Storage; |
31 | use App\Models\User as User_Model; | 31 | use App\Models\User as User_Model; |
32 | use Illuminate\Support\Facades\Validator; | 32 | use Illuminate\Support\Facades\Validator; |
33 | use App\Enums\DbExportColumns; | 33 | use App\Enums\DbExportColumns; |
34 | 34 | ||
35 | class EmployerController extends Controller | 35 | class EmployerController extends Controller |
36 | { | 36 | { |
37 | public function vacancie($vacancy, Request $request) { | 37 | public function vacancie($vacancy, Request $request) { |
38 | $title = 'Заголовок вакансии'; | 38 | $title = 'Заголовок вакансии'; |
39 | $Query = Ad_employer::with('jobs')-> | 39 | $Query = Ad_employer::with('jobs')-> |
40 | with('cat')-> | 40 | with('cat')-> |
41 | with('employer')-> | 41 | with('employer')-> |
42 | with('jobs_code')-> | 42 | with('jobs_code')-> |
43 | select('ad_employers.*')-> | 43 | select('ad_employers.*')-> |
44 | where('id', '=', $vacancy)->get(); | 44 | where('id', '=', $vacancy)->get(); |
45 | 45 | ||
46 | if (isset(Auth()->user()->id)) | 46 | if (isset(Auth()->user()->id)) |
47 | $uid = Auth()->user()->id; | 47 | $uid = Auth()->user()->id; |
48 | else | 48 | else |
49 | $uid = 0; | 49 | $uid = 0; |
50 | $title = $Query[0]->name; | 50 | $title = $Query[0]->name; |
51 | if ($request->ajax()) { | 51 | if ($request->ajax()) { |
52 | return view('ajax.vacance-item', compact('Query','uid')); | 52 | return view('ajax.vacance-item', compact('Query','uid')); |
53 | } else { | 53 | } else { |
54 | return view('vacance-item', compact('title', 'Query', 'uid')); | 54 | return view('vacance-item', compact('title', 'Query', 'uid')); |
55 | } | 55 | } |
56 | } | 56 | } |
57 | 57 | ||
58 | public function logout() { | 58 | public function logout() { |
59 | Auth::logout(); | 59 | Auth::logout(); |
60 | return redirect()->route('index') | 60 | return redirect()->route('index') |
61 | ->with('success', 'Вы вышли из личного кабинета'); | 61 | ->with('success', 'Вы вышли из личного кабинета'); |
62 | } | 62 | } |
63 | 63 | ||
64 | public function employer_info() { | 64 | public function employer_info() { |
65 | // код юзера | 65 | // код юзера |
66 | $user_info = Auth()->user(); | 66 | $user_info = Auth()->user(); |
67 | // вьюшка для вывода данных | 67 | // вьюшка для вывода данных |
68 | return view('employers.info', compact('user_info')); | 68 | return view('employers.info', compact('user_info')); |
69 | } | 69 | } |
70 | 70 | ||
71 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { | 71 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { |
72 | // Все данные через реквест | 72 | // Все данные через реквест |
73 | $all = $request->all(); | 73 | $all = $request->all(); |
74 | unset($all['_token']); | 74 | unset($all['_token']); |
75 | // обновление | 75 | // обновление |
76 | $user->update($all); | 76 | $user->update($all); |
77 | return redirect()->route('employer.employer_info'); | 77 | return redirect()->route('employer.employer_info'); |
78 | } | 78 | } |
79 | 79 | ||
80 | public function cabinet() { | 80 | public function cabinet() { |
81 | $id = Auth()->user()->id; | 81 | $id = Auth()->user()->id; |
82 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 82 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
83 | WhereHas('users', | 83 | WhereHas('users', |
84 | function (Builder $query) use ($id) {$query->Where('id', $id); | 84 | function (Builder $query) use ($id) {$query->Where('id', $id); |
85 | })->get(); | 85 | })->get(); |
86 | return view('employers.cabinet45', compact('Employer')); | 86 | return view('employers.cabinet45', compact('Employer')); |
87 | } | 87 | } |
88 | 88 | ||
89 | public function slider_flot() { | 89 | public function slider_flot() { |
90 | $id = Auth()->user()->id; | 90 | $id = Auth()->user()->id; |
91 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 91 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
92 | WhereHas('users', | 92 | WhereHas('users', |
93 | function (Builder $query) use ($id) {$query->Where('id', $id); | 93 | function (Builder $query) use ($id) {$query->Where('id', $id); |
94 | })->get(); | 94 | })->get(); |
95 | return view('employers.fly-flot', compact('Employer')); | 95 | return view('employers.fly-flot', compact('Employer')); |
96 | } | 96 | } |
97 | 97 | ||
98 | public function cabinet_save(Employer $Employer, Request $request) { | 98 | public function cabinet_save(Employer $Employer, Request $request) { |
99 | $params = $request->all(); | 99 | $params = $request->all(); |
100 | $params['user_id'] = Auth()->user()->id; | 100 | $params['user_id'] = Auth()->user()->id; |
101 | $id = $Employer->id; | 101 | $id = $Employer->id; |
102 | 102 | ||
103 | if ($request->has('logo')) { | 103 | if ($request->has('logo')) { |
104 | if (!empty($Employer->logo)) { | 104 | if (!empty($Employer->logo)) { |
105 | Storage::delete($Employer->logo); | 105 | Storage::delete($Employer->logo); |
106 | } | 106 | } |
107 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); | 107 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); |
108 | } | 108 | } |
109 | 109 | ||
110 | $Employer->update($params); | 110 | $Employer->update($params); |
111 | 111 | ||
112 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); | 112 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); |
113 | } | 113 | } |
114 | 114 | ||
115 | public function save_add_flot(FlotRequest $request) { | 115 | public function save_add_flot(FlotRequest $request) { |
116 | // отмена | 116 | // отмена |
117 | $params = $request->all(); | 117 | $params = $request->all(); |
118 | 118 | ||
119 | if ($request->has('image')) { | 119 | if ($request->has('image')) { |
120 | $params['image'] = $request->file('image')->store("flot", 'public'); | 120 | $params['image'] = $request->file('image')->store("flot", 'public'); |
121 | } | 121 | } |
122 | Flot::create($params); | 122 | Flot::create($params); |
123 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); | 123 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); |
124 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 124 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
125 | } | 125 | } |
126 | 126 | ||
127 | public function edit_flot(Flot $Flot, Employer $Employer) { | 127 | public function edit_flot(Flot $Flot, Employer $Employer) { |
128 | return view('employers.edit-flot', compact('Flot', 'Employer')); | 128 | return view('employers.edit-flot', compact('Flot', 'Employer')); |
129 | } | 129 | } |
130 | 130 | ||
131 | public function update_flot(FlotRequest $request, Flot $Flot) { | 131 | public function update_flot(FlotRequest $request, Flot $Flot) { |
132 | $params = $request->all(); | 132 | $params = $request->all(); |
133 | 133 | ||
134 | if ($request->has('image')) { | 134 | if ($request->has('image')) { |
135 | if (!empty($flot->image)) { | 135 | if (!empty($flot->image)) { |
136 | Storage::delete($flot->image); | 136 | Storage::delete($flot->image); |
137 | } | 137 | } |
138 | $params['image'] = $request->file('image')->store("flot", 'public'); | 138 | $params['image'] = $request->file('image')->store("flot", 'public'); |
139 | } else { | 139 | } else { |
140 | if (!empty($flot->image)) $params['image'] = $flot->image; | 140 | if (!empty($flot->image)) $params['image'] = $flot->image; |
141 | } | 141 | } |
142 | 142 | ||
143 | $Flot->update($params); | 143 | $Flot->update($params); |
144 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 144 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
145 | } | 145 | } |
146 | 146 | ||
147 | public function delete_flot(Flot $Flot) { | 147 | public function delete_flot(Flot $Flot) { |
148 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); | 148 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); |
149 | 149 | ||
150 | if (isset($Flot->id)) $Flot->delete(); | 150 | if (isset($Flot->id)) $Flot->delete(); |
151 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); | 151 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); |
152 | } | 152 | } |
153 | 153 | ||
154 | // Форма добавления вакансий | 154 | // Форма добавления вакансий |
155 | public function cabinet_vacancie() { | 155 | public function cabinet_vacancie() { |
156 | $id = Auth()->user()->id; | 156 | $id = Auth()->user()->id; |
157 | 157 | ||
158 | if (Auth()->user()->is_public) { | 158 | if (Auth()->user()->is_public) { |
159 | $categories = Category::query()->active()->get(); | 159 | $categories = Category::query()->active()->get(); |
160 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | 160 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
161 | where('is_remove', '=', '0')-> | 161 | where('is_remove', '=', '0')-> |
162 | where('is_bd', '=', '0')-> | 162 | where('is_bd', '=', '0')-> |
163 | get(); | 163 | get(); |
164 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 164 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
165 | WhereHas('users', | 165 | WhereHas('users', |
166 | function (Builder $query) use ($id) { | 166 | function (Builder $query) use ($id) { |
167 | $query->Where('id', $id); | 167 | $query->Where('id', $id); |
168 | })->get(); | 168 | })->get(); |
169 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); | 169 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); |
170 | } else { | 170 | } else { |
171 | return redirect()->route('employer.cabinet_vacancie_danger'); | 171 | return redirect()->route('employer.cabinet_vacancie_danger'); |
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
175 | // Форма предупреждения об оплате | 175 | // Форма предупреждения об оплате |
176 | public function cabinet_vacancie_danger() { | 176 | public function cabinet_vacancie_danger() { |
177 | return view('employers.add_vacancy_danger'); | 177 | return view('employers.add_vacancy_danger'); |
178 | } | 178 | } |
179 | 179 | ||
180 | // Сохранение вакансии | 180 | // Сохранение вакансии |
181 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { | 181 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { |
182 | $params_emp = $request->all(); | 182 | $params_emp = $request->all(); |
183 | 183 | ||
184 | $params_job["job_title_id"] = $params_emp['job_title_id']; | 184 | $params_job["job_title_id"] = $params_emp['job_title_id']; |
185 | //$params_job["min_salary"] = $params_emp['min_salary']; | 185 | //$params_job["min_salary"] = $params_emp['min_salary']; |
186 | //$params_job["max_salary"] = $params_emp['max_salary']; | 186 | //$params_job["max_salary"] = $params_emp['max_salary']; |
187 | //$params_job["region"] = $params_emp['region']; | 187 | //$params_job["region"] = $params_emp['region']; |
188 | //$params_job["power"] = $params_emp['power']; | 188 | //$params_job["power"] = $params_emp['power']; |
189 | //$params_job["sytki"] = $params_emp['sytki']; | 189 | //$params_job["sytki"] = $params_emp['sytki']; |
190 | //$params_job["start"] = $params_emp['start']; | 190 | //$params_job["start"] = $params_emp['start']; |
191 | //$params_job["flot"] = $params_emp['flot']; | 191 | //$params_job["flot"] = $params_emp['flot']; |
192 | //$params_job["description"] = $params_emp['description']; | 192 | //$params_job["description"] = $params_emp['description']; |
193 | 193 | ||
194 | $ad_jobs = Ad_employer::create($params_emp); | 194 | $ad_jobs = Ad_employer::create($params_emp); |
195 | //$params_job['ad_employer_id'] = $ad_jobs->id; | 195 | //$params_job['ad_employer_id'] = $ad_jobs->id; |
196 | //Ad_jobs::create($params_job); | 196 | //Ad_jobs::create($params_job); |
197 | $ad_jobs->jobs()->sync($request->get('job_title_id')); | 197 | $ad_jobs->jobs()->sync($request->get('job_title_id')); |
198 | 198 | ||
199 | return redirect()->route('employer.vacancy_list'); | 199 | return redirect()->route('employer.vacancy_list'); |
200 | } | 200 | } |
201 | 201 | ||
202 | // Список вакансий | 202 | // Список вакансий |
203 | public function vacancy_list(Request $request) { | 203 | public function vacancy_list(Request $request) { |
204 | $id = Auth()->user()->id; | 204 | $id = Auth()->user()->id; |
205 | 205 | ||
206 | //dd($request->all()); | 206 | //dd($request->all()); |
207 | $Employer = Employer::query()->where('user_id', $id)->first(); | 207 | $Employer = Employer::query()->where('user_id', $id)->first(); |
208 | $vacancy_list = Ad_employer::query()->with('jobs')-> | 208 | $vacancy_list = Ad_employer::query()->with('jobs')-> |
209 | with('jobs_code')-> | 209 | with('jobs_code')-> |
210 | where('employer_id', $Employer->id); | 210 | where('employer_id', $Employer->id); |
211 | 211 | ||
212 | if (($request->has('search')) && (!empty($request->get('search')))) { | 212 | if (($request->has('search')) && (!empty($request->get('search')))) { |
213 | $search = $request->get('search'); | 213 | $search = $request->get('search'); |
214 | $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); | 214 | $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); |
215 | } | 215 | } |
216 | 216 | ||
217 | if ($request->get('sort')) { | 217 | if ($request->get('sort')) { |
218 | $sort = $request->get('sort'); | 218 | $sort = $request->get('sort'); |
219 | switch ($sort) { | 219 | switch ($sort) { |
220 | case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; | 220 | case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; |
221 | case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; | 221 | case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; |
222 | case 'nopublic': $vacancy_list->where('active_is', '=', 0)->orderBy('id');break; | 222 | case 'nopublic': $vacancy_list->where('active_is', '=', 0)->orderBy('id');break; |
223 | case 'public':$vacancy_list->where('active_is', '=', 1)->orderBy('id');break; | 223 | case 'public':$vacancy_list->where('active_is', '=', 1)->orderBy('id');break; |
224 | case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; | 224 | case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; |
225 | case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; | 225 | case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; |
226 | case 'default': $vacancy_list = $vacancy_list->orderbyDesc('updated_at')->orderBy('name'); break; | 226 | case 'default': $vacancy_list = $vacancy_list->orderbyDesc('updated_at')->orderBy('name'); break; |
227 | default: $vacancy_list = $vacancy_list->orderByDesc('id')->orderbyDesc('updated_at'); break; | 227 | default: $vacancy_list = $vacancy_list->orderByDesc('id')->orderbyDesc('updated_at'); break; |
228 | } | 228 | } |
229 | } else { | 229 | } else { |
230 | $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); | 230 | $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); |
231 | } | 231 | } |
232 | 232 | ||
233 | $vacancy_list = $vacancy_list->paginate(10); | 233 | $vacancy_list = $vacancy_list->paginate(10); |
234 | 234 | ||
235 | //ajax | 235 | //ajax |
236 | if ($request->ajax()) { | 236 | if ($request->ajax()) { |
237 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); | 237 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); |
238 | } else { | 238 | } else { |
239 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); | 239 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); |
240 | } | 240 | } |
241 | } | 241 | } |
242 | 242 | ||
243 | // Карточка вакансии | 243 | // Карточка вакансии |
244 | public function vacancy_edit(Ad_employer $ad_employer) { | 244 | public function vacancy_edit(Ad_employer $ad_employer) { |
245 | $id = Auth()->user()->id; | 245 | $id = Auth()->user()->id; |
246 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); | 246 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); |
247 | 247 | ||
248 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | 248 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
249 | where('is_remove', '=', '0')-> | 249 | where('is_remove', '=', '0')-> |
250 | where('is_bd', '=', '0')->get(); | 250 | where('is_bd', '=', '0')->get(); |
251 | 251 | ||
252 | $Employer = Employer::query()->with('users')->with('ads')-> | 252 | $Employer = Employer::query()->with('users')->with('ads')-> |
253 | with('flots')->where('user_id', $id)->first(); | 253 | with('flots')->where('user_id', $id)->first(); |
254 | 254 | ||
255 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); | 255 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); |
256 | } | 256 | } |
257 | 257 | ||
258 | // Сохранение-редактирование записи | 258 | // Сохранение-редактирование записи |
259 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { | 259 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { |
260 | $params = $request->all(); | 260 | $params = $request->all(); |
261 | $params_job["job_title_id"] = $params['job_title_id']; | 261 | $params_job["job_title_id"] = $params['job_title_id']; |
262 | 262 | ||
263 | $ad_employer->update($params); | 263 | $ad_employer->update($params); |
264 | $ad_employer->jobs()->sync($request->get('job_title_id')); | 264 | $ad_employer->jobs()->sync($request->get('job_title_id')); |
265 | 265 | ||
266 | $id = Auth()->user()->id; | 266 | $id = Auth()->user()->id; |
267 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); | 267 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); |
268 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name') | 268 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name') |
269 | ->where('is_remove', '=', '0') | 269 | ->where('is_remove', '=', '0') |
270 | ->where('is_bd', '=', '0') | 270 | ->where('is_bd', '=', '0') |
271 | ->get(); | 271 | ->get(); |
272 | 272 | ||
273 | $Employer = Employer::query() | 273 | $Employer = Employer::query() |
274 | ->with('users')->with('ads')->with('flots')->where('user_id', $id)->first(); | 274 | ->with('users')->with('ads')->with('flots')->where('user_id', $id)->first(); |
275 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); | 275 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); |
276 | } | 276 | } |
277 | 277 | ||
278 | // Сохранение карточки вакансии | 278 | // Сохранение карточки вакансии |
279 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { | 279 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { |
280 | $all = $request->all(); | 280 | $all = $request->all(); |
281 | $ad_employer->update($all); | 281 | $ad_employer->update($all); |
282 | return redirect()->route('employer.cabinet_vacancie'); | 282 | return redirect()->route('employer.cabinet_vacancie'); |
283 | } | 283 | } |
284 | 284 | ||
285 | // Удаление карточки вакансии | 285 | // Удаление карточки вакансии |
286 | public function vacancy_delete(Ad_employer $ad_employer) { | 286 | public function vacancy_delete(Ad_employer $ad_employer) { |
287 | $ad_employer->delete(); | 287 | $ad_employer->delete(); |
288 | 288 | ||
289 | return redirect()->route('employer.vacancy_list') | 289 | return redirect()->route('employer.vacancy_list') |
290 | ->with('success', 'Данные были успешно сохранены'); | 290 | ->with('success', 'Данные были успешно сохранены'); |
291 | } | 291 | } |
292 | 292 | ||
293 | // Обновление даты | 293 | // Обновление даты |
294 | public function vacancy_up(Ad_employer $ad_employer) { | 294 | public function vacancy_up(Ad_employer $ad_employer) { |
295 | $up = date('m/d/Y h:i:s', time());; | 295 | $up = date('m/d/Y h:i:s', time());; |
296 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 296 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
297 | $vac_emp->updated_at = $up; | 297 | $vac_emp->updated_at = $up; |
298 | $vac_emp->save(); | 298 | $vac_emp->save(); |
299 | 299 | ||
300 | return redirect()->back(); //route('employer.vacancy_list'); | 300 | return redirect()->back(); //route('employer.vacancy_list'); |
301 | // начало конца | 301 | // начало конца |
302 | } | 302 | } |
303 | 303 | ||
304 | //Видимость вакансии | 304 | //Видимость вакансии |
305 | public function vacancy_eye(Ad_employer $ad_employer, $status) { | 305 | public function vacancy_eye(Ad_employer $ad_employer, $status) { |
306 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 306 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
307 | $vac_emp->active_is = $status; | 307 | $vac_emp->active_is = $status; |
308 | $vac_emp->save(); | 308 | $vac_emp->save(); |
309 | 309 | ||
310 | return redirect()->route('employer.vacancy_list'); | 310 | return redirect()->route('employer.vacancy_list'); |
311 | } | 311 | } |
312 | 312 | ||
313 | //Вакансия редактирования (шаблон) | 313 | //Вакансия редактирования (шаблон) |
314 | public function vacancy_update(Ad_employer $id) { | 314 | public function vacancy_update(Ad_employer $id) { |
315 | 315 | ||
316 | } | 316 | } |
317 | 317 | ||
318 | //Отклики на вакансию - лист | 318 | //Отклики на вакансию - лист |
319 | public function answers(Employer $employer, Request $request) { | 319 | public function answers(Employer $employer, Request $request) { |
320 | $user_id = Auth()->user()->id; | 320 | $user_id = Auth()->user()->id; |
321 | $answer = Ad_employer::query()->where('employer_id', $employer->id); | 321 | $answer = Ad_employer::query()->where('employer_id', $employer->id); |
322 | if ($request->has('search')) { | 322 | if ($request->has('search')) { |
323 | $search = trim($request->get('search')); | 323 | $search = trim($request->get('search')); |
324 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); | 324 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); |
325 | } | 325 | } |
326 | 326 | ||
327 | $answer = $answer->with('response')->OrderByDESC('id')->get(); | 327 | $answer = $answer->with('response')->OrderByDESC('id')->get(); |
328 | 328 | ||
329 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); | 329 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); |
330 | } | 330 | } |
331 | 331 | ||
332 | //Обновление статуса | 332 | //Обновление статуса |
333 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { | 333 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { |
334 | $ad_response->update(Array('flag' => $flag)); | 334 | $ad_response->update(Array('flag' => $flag)); |
335 | return redirect()->route('employer.answers', ['employer' => $employer->id]); | 335 | return redirect()->route('employer.answers', ['employer' => $employer->id]); |
336 | } | 336 | } |
337 | 337 | ||
338 | //Страницы сообщений список | 338 | //Страницы сообщений список |
339 | public function messages($type_message) { | 339 | public function messages($type_message) { |
340 | $user_id = Auth()->user()->id; | 340 | $user_id = Auth()->user()->id; |
341 | 341 | ||
342 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> | 342 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> |
343 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); | 343 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); |
344 | 344 | ||
345 | $messages_output = Message::query()->with('vacancies')-> | 345 | $messages_output = Message::query()->with('vacancies')-> |
346 | with('user_to')->where('user_id', $user_id)-> | 346 | with('user_to')->where('user_id', $user_id)-> |
347 | OrderByDesc('created_at'); | 347 | OrderByDesc('created_at'); |
348 | 348 | ||
349 | $count_input = $messages_input->count(); | 349 | $count_input = $messages_input->count(); |
350 | $count_output = $messages_output->count(); | 350 | $count_output = $messages_output->count(); |
351 | 351 | ||
352 | if ($type_message == 'input') { | 352 | if ($type_message == 'input') { |
353 | $messages = $messages_input->paginate(5); | 353 | $messages = $messages_input->paginate(5); |
354 | } | 354 | } |
355 | 355 | ||
356 | if ($type_message == 'output') { | 356 | if ($type_message == 'output') { |
357 | $messages = $messages_output->paginate(5); | 357 | $messages = $messages_output->paginate(5); |
358 | } | 358 | } |
359 | 359 | ||
360 | //dd($user_id, $messages[2]->vacancies); | 360 | //dd($user_id, $messages[2]->vacancies); |
361 | //jobs); | 361 | //jobs); |
362 | 362 | ||
363 | return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); | 363 | return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); |
364 | } | 364 | } |
365 | 365 | ||
366 | // Диалог между пользователями | 366 | // Диалог между пользователями |
367 | public function dialog(Request $request, User_Model $user1, User_Model $user2) { | 367 | public function dialog(Request $request, User_Model $user1, User_Model $user2) { |
368 | // Получение параметров. | 368 | // Получение параметров. |
369 | if ($request->has('ad_employer')){ | 369 | if ($request->has('ad_employer')){ |
370 | $ad_employer = $request->get('ad_employer'); | 370 | $ad_employer = $request->get('ad_employer'); |
371 | } else { | 371 | } else { |
372 | $ad_employer = 0; | 372 | $ad_employer = 0; |
373 | } | 373 | } |
374 | 374 | ||
375 | if (isset($user2->id)) { | 375 | if (isset($user2->id)) { |
376 | $companion = User_Model::query()->with('workers')-> | 376 | $companion = User_Model::query()->with('workers')-> |
377 | with('employers')-> | 377 | with('employers')-> |
378 | where('id', $user2->id)->first(); | 378 | where('id', $user2->id)->first(); |
379 | } | 379 | } |
380 | 380 | ||
381 | $Messages = Message::query()-> | 381 | $Messages = Message::query()-> |
382 | where('ad_employer_id', '=', $ad_employer)-> | 382 | where('ad_employer_id', '=', $ad_employer)-> |
383 | where(function($query) use ($user1, $user2) { | 383 | where(function($query) use ($user1, $user2) { |
384 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); | 384 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); |
385 | })->orWhere(function($query) use ($user1, $user2) { | 385 | })->orWhere(function($query) use ($user1, $user2) { |
386 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); | 386 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); |
387 | })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get(); | 387 | })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get(); |
388 | 388 | ||
389 | $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; | 389 | $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; |
390 | 390 | ||
391 | //$ad_employer = null; | 391 | //$ad_employer = null; |
392 | //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); | 392 | //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); |
393 | $sender = $user1; | 393 | $sender = $user1; |
394 | 394 | ||
395 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); | 395 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); |
396 | } | 396 | } |
397 | 397 | ||
398 | // Регистрация работодателя | 398 | // Регистрация работодателя |
399 | public function register_employer(Request $request) { | 399 | public function register_employer(Request $request) { |
400 | $params = $request->all(); | 400 | $params = $request->all(); |
401 | 401 | ||
402 | $rules = [ | 402 | $rules = [ |
403 | //'surname' => ['required', 'string', 'max:255'], | 403 | //'surname' => ['required', 'string', 'max:255'], |
404 | //'name_man' => ['required', 'string', 'max:255'], | 404 | //'name_man' => ['required', 'string', 'max:255'], |
405 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], | 405 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], |
406 | 'name_company' => ['required', 'string', 'max:255'], | 406 | 'name_company' => ['required', 'string', 'max:255'], |
407 | 'password' => ['required', 'string', 'min:6'], | 407 | 'password' => ['required', 'string', 'min:6'], |
408 | ]; | 408 | ]; |
409 | 409 | ||
410 | 410 | ||
411 | $messages = [ | 411 | $messages = [ |
412 | 'required' => 'Укажите обязательное поле', | 412 | 'required' => 'Укажите обязательное поле', |
413 | 'min' => [ | 413 | 'min' => [ |
414 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 414 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
415 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 415 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
416 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 416 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
417 | ], | 417 | ], |
418 | 'max' => [ | 418 | 'max' => [ |
419 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 419 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
420 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 420 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
421 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 421 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
422 | ] | 422 | ] |
423 | ]; | 423 | ]; |
424 | 424 | ||
425 | $email = $request->get('email'); | 425 | $email = $request->get('email'); |
426 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | 426 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { |
427 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | 427 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); |
428 | } | 428 | } |
429 | 429 | ||
430 | if ($request->get('password') !== $request->get('confirmed')){ | 430 | if ($request->get('password') !== $request->get('confirmed')){ |
431 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | 431 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); |
432 | } | 432 | } |
433 | 433 | ||
434 | if (strlen($request->get('password')) < 6) { | 434 | if (strlen($request->get('password')) < 6) { |
435 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | 435 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); |
436 | } | 436 | } |
437 | 437 | ||
438 | if (empty($request->get('surname'))) { | 438 | if (empty($request->get('surname'))) { |
439 | $params['surname'] = 'Неизвестно'; | 439 | $params['surname'] = 'Неизвестно'; |
440 | } | 440 | } |
441 | if (empty($request->get('name_man'))) { | 441 | if (empty($request->get('name_man'))) { |
442 | $params['name_man'] = 'Неизвестно'; | 442 | $params['name_man'] = 'Неизвестно'; |
443 | } | 443 | } |
444 | $validator = Validator::make($params, $rules, $messages); | 444 | $validator = Validator::make($params, $rules, $messages); |
445 | 445 | ||
446 | if ($validator->fails()) { | 446 | if ($validator->fails()) { |
447 | return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | 447 | return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); |
448 | } else { | 448 | } else { |
449 | $user = $this->create($params); | 449 | $user = $this->create($params); |
450 | event(new Registered($user)); | 450 | event(new Registered($user)); |
451 | 451 | ||
452 | Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params)); | 452 | Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params)); |
453 | 453 | ||
454 | Auth::guard()->login($user); | 454 | Auth::guard()->login($user); |
455 | } | 455 | } |
456 | 456 | ||
457 | if ($user) { | 457 | if ($user) { |
458 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; | 458 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; |
459 | } else { | 459 | } else { |
460 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | 460 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); |
461 | } | 461 | } |
462 | } | 462 | } |
463 | 463 | ||
464 | // Создание пользователя | 464 | // Создание пользователя |
465 | protected function create(array $data) | 465 | protected function create(array $data) |
466 | { | 466 | { |
467 | $Use = new User_Model(); | 467 | $Use = new User_Model(); |
468 | $Code_user = $Use->create([ | 468 | $Code_user = $Use->create([ |
469 | 'name' => $data['surname']." ".$data['name_man'], | 469 | 'name' => $data['surname']." ".$data['name_man'], |
470 | 'name_man' => $data['name_man'], | 470 | 'name_man' => $data['name_man'], |
471 | 'surname' => $data['surname'], | 471 | 'surname' => $data['surname'], |
472 | 'surname2' => $data['surname2'], | 472 | 'surname2' => $data['surname2'], |
473 | 'subscribe_email' => $data['email'], | 473 | 'subscribe_email' => $data['email'], |
474 | 'email' => $data['email'], | 474 | 'email' => $data['email'], |
475 | 'telephone' => $data['telephone'], | 475 | 'telephone' => $data['telephone'], |
476 | 'is_worker' => 0, | 476 | 'is_worker' => 0, |
477 | 'password' => Hash::make($data['password']), | 477 | 'password' => Hash::make($data['password']), |
478 | 'pubpassword' => base64_encode($data['password']), | 478 | 'pubpassword' => base64_encode($data['password']), |
479 | 'email_verified_at' => Carbon::now() | 479 | 'email_verified_at' => Carbon::now() |
480 | ]); | 480 | ]); |
481 | 481 | ||
482 | if ($Code_user->id > 0) { | 482 | if ($Code_user->id > 0) { |
483 | $Employer = new Employer(); | 483 | $Employer = new Employer(); |
484 | $Employer->user_id = $Code_user->id; | 484 | $Employer->user_id = $Code_user->id; |
485 | $Employer->name_company = $data['name_company']; | 485 | $Employer->name_company = $data['name_company']; |
486 | $Employer->email = $data['email']; | 486 | $Employer->email = $data['email']; |
487 | $Employer->telephone = $data['telephone']; | 487 | $Employer->telephone = $data['telephone']; |
488 | $Employer->code = Tools::generator_id(10); | 488 | $Employer->code = Tools::generator_id(10); |
489 | $Employer->save(); | 489 | $Employer->save(); |
490 | 490 | ||
491 | return $Code_user; | 491 | return $Code_user; |
492 | } | 492 | } |
493 | } | 493 | } |
494 | 494 | ||
495 | // Отправка сообщения от работодателя | 495 | // Отправка сообщения от работодателя |
496 | public function send_message(MessagesRequiest $request) { | 496 | public function send_message(MessagesRequiest $request) { |
497 | $params = $request->all(); | 497 | $params = $request->all(); |
498 | dd($params); | 498 | dd($params); |
499 | $user1 = $params['user_id']; | 499 | $user1 = $params['user_id']; |
500 | $user2 = $params['to_user_id']; | 500 | $user2 = $params['to_user_id']; |
501 | 501 | ||
502 | if ($request->has('file')) { | 502 | if ($request->has('file')) { |
503 | $params['file'] = $request->file('file')->store("messages", 'public'); | 503 | $params['file'] = $request->file('file')->store("messages", 'public'); |
504 | } | 504 | } |
505 | Message::create($params); | 505 | Message::create($params); |
506 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 506 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
507 | } | 507 | } |
508 | 508 | ||
509 | public function test123(Request $request) { | 509 | public function test123(Request $request) { |
510 | $params = $request->all(); | 510 | $params = $request->all(); |
511 | $user1 = $params['user_id']; | 511 | $user1 = $params['user_id']; |
512 | $user2 = $params['to_user_id']; | 512 | $user2 = $params['to_user_id']; |
513 | $id_vacancy = $params['ad_employer_id']; | 513 | $id_vacancy = $params['ad_employer_id']; |
514 | $ad_name = $params['ad_name']; | 514 | $ad_name = $params['ad_name']; |
515 | 515 | ||
516 | $rules = [ | 516 | $rules = [ |
517 | 'text' => 'required|min:1|max:150000', | 517 | 'text' => 'required|min:1|max:150000', |
518 | 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' | 518 | 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' |
519 | ]; | 519 | ]; |
520 | $messages = [ | 520 | $messages = [ |
521 | 'required' => 'Укажите обязательное поле', | 521 | 'required' => 'Укажите обязательное поле', |
522 | 'min' => [ | 522 | 'min' => [ |
523 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 523 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
524 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 524 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
525 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 525 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
526 | ], | 526 | ], |
527 | 'max' => [ | 527 | 'max' => [ |
528 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 528 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
529 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 529 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
530 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 530 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
531 | ] | 531 | ] |
532 | ]; | 532 | ]; |
533 | 533 | ||
534 | $validator = Validator::make($request->all(), $rules, $messages); | 534 | $validator = Validator::make($request->all(), $rules, $messages); |
535 | 535 | ||
536 | if ($validator->fails()) { | 536 | if ($validator->fails()) { |
537 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) | 537 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) |
538 | ->withErrors($validator); | 538 | ->withErrors($validator); |
539 | } else { | 539 | } else { |
540 | if ($request->has('file')) { | 540 | if ($request->has('file')) { |
541 | $params['file'] = $request->file('file')->store("messages", 'public'); | 541 | $params['file'] = $request->file('file')->store("messages", 'public'); |
542 | } | 542 | } |
543 | Message::create($params); | 543 | Message::create($params); |
544 | //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 544 | //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
545 | return redirect()->route('employer.dialog', | 545 | return redirect()->route('employer.dialog', |
546 | ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]); | 546 | ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]); |
547 | 547 | ||
548 | } | 548 | } |
549 | } | 549 | } |
550 | 550 | ||
551 | //Избранные люди | 551 | //Избранные люди |
552 | public function favorites(Request $request) { | 552 | public function favorites(Request $request) { |
553 | $IP_address = RusDate::ip_addr_client(); | 553 | $IP_address = RusDate::ip_addr_client(); |
554 | $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); | 554 | $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); |
555 | 555 | ||
556 | if ($Arr->count()) { | 556 | if ($Arr->count()) { |
557 | $A = Array(); | 557 | $A = Array(); |
558 | foreach ($Arr as $it) { | 558 | foreach ($Arr as $it) { |
559 | $A[] = $it->code_record; | 559 | $A[] = $it->code_record; |
560 | } | 560 | } |
561 | 561 | ||
562 | $Workers = Worker::query()->whereIn('id', $A); | 562 | $Workers = Worker::query()->whereIn('id', $A); |
563 | } else { | 563 | } else { |
564 | $Workers = Worker::query()->where('id', '=', '0'); | 564 | $Workers = Worker::query()->where('id', '=', '0'); |
565 | } | 565 | } |
566 | 566 | ||
567 | if (($request->has('search')) && (!empty($request->get('search')))) { | 567 | if (($request->has('search')) && (!empty($request->get('search')))) { |
568 | $search = $request->get('search'); | 568 | $search = $request->get('search'); |
569 | 569 | ||
570 | $Workers = $Workers->WhereHas('users', | 570 | $Workers = $Workers->WhereHas('users', |
571 | function (Builder $query) use ($search) { | 571 | function (Builder $query) use ($search) { |
572 | $query->Where('surname', 'LIKE', "%$search%") | 572 | $query->Where('surname', 'LIKE', "%$search%") |
573 | ->orWhere('name_man', 'LIKE', "%$search%") | 573 | ->orWhere('name_man', 'LIKE', "%$search%") |
574 | ->orWhere('surname2', 'LIKE', "%$search%"); | 574 | ->orWhere('surname2', 'LIKE', "%$search%"); |
575 | }); | 575 | }); |
576 | } else { | 576 | } else { |
577 | $Workers = $Workers->with('users'); | 577 | $Workers = $Workers->with('users'); |
578 | } | 578 | } |
579 | 579 | ||
580 | $Workers = $Workers->get(); | 580 | $Workers = $Workers->get(); |
581 | 581 | ||
582 | 582 | ||
583 | return view('employers.favorite', compact('Workers')); | 583 | return view('employers.favorite', compact('Workers')); |
584 | } | 584 | } |
585 | 585 | ||
586 | // База данных | 586 | // База данных |
587 | public function bd(Request $request) { | 587 | public function bd(Request $request) { |
588 | $users = User_Model::query()->with('workers')->with('jobtitles'); | 588 | $users = User_Model::query()->with('workers')->with('jobtitles'); |
589 | 589 | ||
590 | if ($request->has('search')) { | 590 | if ($request->has('search')) { |
591 | $find_key = $request->get('search'); | 591 | $find_key = $request->get('search'); |
592 | $users = $users->where('name', 'LIKE', "%$find_key%") | 592 | $users = $users->where('name', 'LIKE', "%$find_key%") |
593 | ->orWhere('surname', 'LIKE', "%$find_key%") | 593 | ->orWhere('surname', 'LIKE', "%$find_key%") |
594 | ->orWhere('name_man', 'LIKE', "%$find_key%") | 594 | ->orWhere('name_man', 'LIKE', "%$find_key%") |
595 | ->orWhere('email', 'LIKE', "%$find_key%") | 595 | ->orWhere('email', 'LIKE', "%$find_key%") |
596 | ->orWhere('telephone', 'LIKE', "%$find_key%"); | 596 | ->orWhere('telephone', 'LIKE', "%$find_key%"); |
597 | } | 597 | } |
598 | 598 | ||
599 | // Данные | 599 | // Данные |
600 | $users = $users->Baseuser()-> | 600 | $users = $users->Baseuser()-> |
601 | orderBy(Worker::select('position_work')->whereColumn('workers.user_id', 'users.id')); | 601 | orderByDesc(Worker::select('created_at')->whereColumn('workers.user_id', 'users.id')); |
602 | $count_users = $users; | 602 | $count_users = $users; |
603 | $users = $users->paginate(5); | 603 | $users = $users->paginate(5); |
604 | 604 | ||
605 | $export_options = DbExportColumns::toArray(); | 605 | $export_options = DbExportColumns::toArray(); |
606 | 606 | ||
607 | $jobs_titles = Job_title::select('id', 'name') | 607 | $jobs_titles = Job_title::select('id', 'name') |
608 | ->where('is_remove', '=', 0) | 608 | ->where('is_remove', '=', 0) |
609 | ->where('is_bd', '=', 2) | 609 | ->where('is_bd', '=', 2) |
610 | ->orderByDesc('sort') | 610 | ->orderByDesc('sort') |
611 | ->orderBy('name', 'asc') | 611 | ->orderBy('name', 'asc') |
612 | ->get() | 612 | ->get() |
613 | ->toArray() | 613 | ->toArray() |
614 | ; | 614 | ; |
615 | 615 | ||
616 | return view('employers.bd', compact('users', 'count_users', 'export_options', 'jobs_titles')); | 616 | return view('employers.bd', compact('users', 'count_users', 'export_options', 'jobs_titles')); |
617 | } | 617 | } |
618 | 618 | ||
619 | //Настройка уведомлений | 619 | //Настройка уведомлений |
620 | public function subscribe() { | 620 | public function subscribe() { |
621 | return view('employers.subcribe'); | 621 | return view('employers.subcribe'); |
622 | } | 622 | } |
623 | 623 | ||
624 | //Установка уведомлений сохранение | 624 | //Установка уведомлений сохранение |
625 | public function save_subscribe(Request $request) { | 625 | public function save_subscribe(Request $request) { |
626 | dd($request->all()); | 626 | dd($request->all()); |
627 | $msg = $request->validate([ | 627 | $msg = $request->validate([ |
628 | 'subscribe_email' => 'required|email|min:5|max:255', | 628 | 'subscribe_email' => 'required|email|min:5|max:255', |
629 | ]); | 629 | ]); |
630 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); | 630 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); |
631 | } | 631 | } |
632 | 632 | ||
633 | //Сбросить форму с паролем | 633 | //Сбросить форму с паролем |
634 | public function password_reset() { | 634 | public function password_reset() { |
635 | $email = Auth()->user()->email; | 635 | $email = Auth()->user()->email; |
636 | return view('employers.password-reset', compact('email')); | 636 | return view('employers.password-reset', compact('email')); |
637 | } | 637 | } |
638 | 638 | ||
639 | //Обновление пароля | 639 | //Обновление пароля |
640 | public function new_password(Request $request) { | 640 | public function new_password(Request $request) { |
641 | $use = Auth()->user(); | 641 | $use = Auth()->user(); |
642 | $request->validate([ | 642 | $request->validate([ |
643 | 'password' => 'required|string', | 643 | 'password' => 'required|string', |
644 | 'new_password' => 'required|string', | 644 | 'new_password' => 'required|string', |
645 | 'new_password2' => 'required|string' | 645 | 'new_password2' => 'required|string' |
646 | ]); | 646 | ]); |
647 | 647 | ||
648 | if ($request->get('new_password') == $request->get('new_password2')) | 648 | if ($request->get('new_password') == $request->get('new_password2')) |
649 | if ($request->get('password') !== $request->get('new_password')) { | 649 | if ($request->get('password') !== $request->get('new_password')) { |
650 | $credentials = $request->only('email', 'password'); | 650 | $credentials = $request->only('email', 'password'); |
651 | if (Auth::attempt($credentials)) { | 651 | if (Auth::attempt($credentials)) { |
652 | 652 | ||
653 | if (!is_null($use->email_verified_at)){ | 653 | if (!is_null($use->email_verified_at)){ |
654 | 654 | ||
655 | $user_data = User_Model::find($use->id); | 655 | $user_data = User_Model::find($use->id); |
656 | $user_data->update([ | 656 | $user_data->update([ |
657 | 'password' => Hash::make($request->get('new_password')), | 657 | 'password' => Hash::make($request->get('new_password')), |
658 | 'pubpassword' => base64_encode($request->get('new_password')), | 658 | 'pubpassword' => base64_encode($request->get('new_password')), |
659 | ]); | 659 | ]); |
660 | return redirect() | 660 | return redirect() |
661 | ->route('employer.password_reset') | 661 | ->route('employer.password_reset') |
662 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 662 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
663 | } | 663 | } |
664 | 664 | ||
665 | return redirect() | 665 | return redirect() |
666 | ->route('employer.password_reset') | 666 | ->route('employer.password_reset') |
667 | ->withError('Данная учетная запись не было верифицированна!'); | 667 | ->withError('Данная учетная запись не было верифицированна!'); |
668 | } | 668 | } |
669 | } | 669 | } |
670 | 670 | ||
671 | return redirect() | 671 | return redirect() |
672 | ->route('employer.password_reset') | 672 | ->route('employer.password_reset') |
673 | ->withErrors('Не совпадение данных, обновите пароли!'); | 673 | ->withErrors('Не совпадение данных, обновите пароли!'); |
674 | } | 674 | } |
675 | 675 | ||
676 | 676 | ||
677 | 677 | ||
678 | // Форма Удаление пипла | 678 | // Форма Удаление пипла |
679 | public function delete_people() { | 679 | public function delete_people() { |
680 | $login = Auth()->user()->email; | 680 | $login = Auth()->user()->email; |
681 | return view('employers.delete_people', compact('login')); | 681 | return view('employers.delete_people', compact('login')); |
682 | } | 682 | } |
683 | 683 | ||
684 | // Удаление аккаунта | 684 | // Удаление аккаунта |
685 | public function action_delete_user(Request $request) { | 685 | public function action_delete_user(Request $request) { |
686 | $Answer = $request->all(); | 686 | $Answer = $request->all(); |
687 | $user_id = Auth()->user()->id; | 687 | $user_id = Auth()->user()->id; |
688 | $request->validate([ | 688 | $request->validate([ |
689 | 'password' => 'required|string', | 689 | 'password' => 'required|string', |
690 | ]); | 690 | ]); |
691 | 691 | ||
692 | $credentials = $request->only('email', 'password'); | 692 | $credentials = $request->only('email', 'password'); |
693 | if (Auth::attempt($credentials)) { | 693 | if (Auth::attempt($credentials)) { |
694 | Auth::logout(); | 694 | Auth::logout(); |
695 | $it = User_Model::find($user_id); | 695 | $it = User_Model::find($user_id); |
696 | $it->delete(); | 696 | $it->delete(); |
697 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 697 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
698 | } else { | 698 | } else { |
699 | return redirect()->route('employer.delete_people') | 699 | return redirect()->route('employer.delete_people') |
700 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 700 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
701 | } | 701 | } |
702 | } | 702 | } |
703 | 703 | ||
704 | public function ajax_delete_user(Request $request) { | 704 | public function ajax_delete_user(Request $request) { |
705 | $Answer = $request->all(); | 705 | $Answer = $request->all(); |
706 | $user_id = Auth()->user()->id; | 706 | $user_id = Auth()->user()->id; |
707 | $request->validate([ | 707 | $request->validate([ |
708 | 'password' => 'required|string', | 708 | 'password' => 'required|string', |
709 | ]); | 709 | ]); |
710 | $credentials = $request->only('email', 'password'); | 710 | $credentials = $request->only('email', 'password'); |
711 | if (Auth::attempt($credentials)) { | 711 | if (Auth::attempt($credentials)) { |
712 | 712 | ||
713 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', | 713 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', |
714 | 'email' => $request->get('email'), | 714 | 'email' => $request->get('email'), |
715 | 'password' => $request->get('password'))); | 715 | 'password' => $request->get('password'))); |
716 | } else { | 716 | } else { |
717 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); | 717 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); |
718 | } | 718 | } |
719 | } | 719 | } |
720 | 720 | ||
721 | // FAQ - Вопросы/ответы для работодателей и соискателей | 721 | // FAQ - Вопросы/ответы для работодателей и соискателей |
722 | public function faq() { | 722 | public function faq() { |
723 | return view('employers.faq'); | 723 | return view('employers.faq'); |
724 | } | 724 | } |
725 | 725 | ||
726 | // Рассылка сообщений | 726 | // Рассылка сообщений |
727 | public function send_all_messages() { | 727 | public function send_all_messages() { |
728 | $id = Auth()->user()->id; | 728 | $id = Auth()->user()->id; |
729 | $sending = Employer::query()->where('user_id', '=', "$id")->first(); | 729 | $sending = Employer::query()->where('user_id', '=', "$id")->first(); |
730 | 730 | ||
731 | if ($sending->sending_is) | 731 | if ($sending->sending_is) |
732 | return view('employers.send_all'); | 732 | return view('employers.send_all'); |
733 | else | 733 | else |
734 | return view('employers.send_all_danger'); | 734 | return view('employers.send_all_danger'); |
735 | } | 735 | } |
736 | 736 | ||
737 | // Отправка сообщений для информации | 737 | // Отправка сообщений для информации |
738 | public function send_all_post(Request $request) { | 738 | public function send_all_post(Request $request) { |
739 | $data = $request->all(); | 739 | $data = $request->all(); |
740 | 740 | ||
741 | $emails = User_Model::query()->where('is_worker', '1')->get(); | 741 | $emails = User_Model::query()->where('is_worker', '1')->get(); |
742 | 742 | ||
743 | foreach ($emails as $e) { | 743 | foreach ($emails as $e) { |
744 | Mail::to($e->email)->send(new SendAllMessages($data)); | 744 | Mail::to($e->email)->send(new SendAllMessages($data)); |
745 | } | 745 | } |
746 | 746 | ||
747 | return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); | 747 | return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); |
748 | } | 748 | } |
749 | 749 | ||
750 | // База резюме | 750 | // База резюме |
751 | public function bd_tupe(Request $request) { | 751 | public function bd_tupe(Request $request) { |
752 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); | 752 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); |
753 | 753 | ||
754 | return view('employers.bd_tupe', compact('Resume')); | 754 | return view('employers.bd_tupe', compact('Resume')); |
755 | } | 755 | } |
756 | 756 | ||
757 | ////////////////////////////////////////////////////////////////// | 757 | ////////////////////////////////////////////////////////////////// |
758 | // Отправил сообщение | 758 | // Отправил сообщение |
759 | ////////////////////////////////////////////////////////////////// | 759 | ////////////////////////////////////////////////////////////////// |
760 | public function new_message(Request $request) { | 760 | public function new_message(Request $request) { |
761 | $params = $request->all(); | 761 | $params = $request->all(); |
762 | $id = $params['_user_id']; | 762 | $id = $params['_user_id']; |
763 | $message = new Message(); | 763 | $message = new Message(); |
764 | $message->user_id = $params['_user_id']; | 764 | $message->user_id = $params['_user_id']; |
765 | $message->to_user_id = $params['_to_user_id']; | 765 | $message->to_user_id = $params['_to_user_id']; |
766 | $message->title = $params['title']; | 766 | $message->title = $params['title']; |
767 | $message->text = $params['text']; | 767 | $message->text = $params['text']; |
768 | if ($request->has('_file')) { | 768 | if ($request->has('_file')) { |
769 | $message->file = $request->file('_file')->store("worker/$id", 'public'); | 769 | $message->file = $request->file('_file')->store("worker/$id", 'public'); |
770 | } | 770 | } |
771 | $message->ad_employer_id = $params['_vacancy']; | 771 | $message->ad_employer_id = $params['_vacancy']; |
772 | $message->flag_new = 1; | 772 | $message->flag_new = 1; |
773 | $id_message = $message->save(); | 773 | $id_message = $message->save(); |
774 | 774 | ||
775 | //$data['message_id'] = $id_message; | 775 | //$data['message_id'] = $id_message; |
776 | //$data['ad_employer_id'] = $params['_vacancy']; | 776 | //$data['ad_employer_id'] = $params['_vacancy']; |
777 | //$data['job_title_id'] = 0; | 777 | //$data['job_title_id'] = 0; |
778 | 778 | ||
779 | $data['flag'] = 1; | 779 | $data['flag'] = 1; |
780 | //$ad_responce = ad_response::create($data); | 780 | //$ad_responce = ad_response::create($data); |
781 | return redirect()->route('employer.messages', ['type_message' => 'output']); | 781 | return redirect()->route('employer.messages', ['type_message' => 'output']); |
782 | } | 782 | } |
783 | 783 | ||
784 | // Восстановление пароля | 784 | // Восстановление пароля |
785 | public function repair_password(Request $request) { | 785 | public function repair_password(Request $request) { |
786 | $params = $request->get('email'); | 786 | $params = $request->get('email'); |
787 | } | 787 | } |
788 | 788 | ||
789 | // Избранные люди на корабль | 789 | // Избранные люди на корабль |
790 | public function selected_people(Request $request) { | 790 | public function selected_people(Request $request) { |
791 | $id = $request->get('id'); | 791 | $id = $request->get('id'); |
792 | $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | 792 | $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
793 | where('is_remove', '=', '0')-> | 793 | where('is_remove', '=', '0')-> |
794 | where('is_bd', '=', '0')-> | 794 | where('is_bd', '=', '0')-> |
795 | where('position_id', $id)-> | 795 | where('position_id', $id)-> |
796 | get(); | 796 | get(); |
797 | return view('favorite_people', compact('favorite_people')); | 797 | return view('favorite_people', compact('favorite_people')); |
798 | } | 798 | } |
799 | } | 799 | } |
800 | 800 |
app/Http/Controllers/WorkerController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Http\Requests\DocumentsRequest; | 6 | use App\Http\Requests\DocumentsRequest; |
7 | use App\Http\Requests\PrevCompanyRequest; | 7 | use App\Http\Requests\PrevCompanyRequest; |
8 | use App\Http\Requests\SertificationRequest; | 8 | use App\Http\Requests\SertificationRequest; |
9 | use App\Models\Ad_employer; | 9 | use App\Models\Ad_employer; |
10 | use App\Models\ad_response; | 10 | use App\Models\ad_response; |
11 | use App\Models\Dop_info; | 11 | use App\Models\Dop_info; |
12 | use App\Models\infobloks; | 12 | use App\Models\infobloks; |
13 | use App\Models\Job_title; | 13 | use App\Models\Job_title; |
14 | use App\Models\Like_vacancy; | 14 | use App\Models\Like_vacancy; |
15 | use App\Models\Message; | 15 | use App\Models\Message; |
16 | use App\Models\place_works; | 16 | use App\Models\place_works; |
17 | use App\Models\PrevCompany; | 17 | use App\Models\PrevCompany; |
18 | use App\Models\ResponseWork; | 18 | use App\Models\ResponseWork; |
19 | use App\Models\sertification; | 19 | use App\Models\sertification; |
20 | use App\Models\Static_worker; | 20 | use App\Models\Static_worker; |
21 | use App\Models\Title_worker; | 21 | use App\Models\Title_worker; |
22 | use App\Models\User; | 22 | use App\Models\User; |
23 | use App\Models\User as User_Model; | 23 | use App\Models\User as User_Model; |
24 | use App\Models\Worker; | 24 | use App\Models\Worker; |
25 | use Barryvdh\DomPDF\Facade\Pdf; | 25 | use Barryvdh\DomPDF\Facade\Pdf; |
26 | use Carbon\Carbon; | 26 | use Carbon\Carbon; |
27 | use Illuminate\Auth\Events\Registered; | 27 | use Illuminate\Auth\Events\Registered; |
28 | use Illuminate\Database\Eloquent\Builder; | 28 | use Illuminate\Database\Eloquent\Builder; |
29 | use Illuminate\Http\Request; | 29 | use Illuminate\Http\Request; |
30 | use Illuminate\Support\Facades\Auth; | 30 | use Illuminate\Support\Facades\Auth; |
31 | use Illuminate\Support\Facades\Hash; | 31 | use Illuminate\Support\Facades\Hash; |
32 | use Illuminate\Support\Facades\Storage; | 32 | use Illuminate\Support\Facades\Storage; |
33 | use Illuminate\Support\Facades\Validator; | 33 | use Illuminate\Support\Facades\Validator; |
34 | use PhpOffice\PhpSpreadsheet\Spreadsheet; | 34 | use PhpOffice\PhpSpreadsheet\Spreadsheet; |
35 | use PhpOffice\PhpSpreadsheet\Writer\Xlsx; | 35 | use PhpOffice\PhpSpreadsheet\Writer\Xlsx; |
36 | use Symfony\Component\HttpFoundation\StreamedResponse; | 36 | use Symfony\Component\HttpFoundation\StreamedResponse; |
37 | use App\Enums\DbExportColumns; | 37 | use App\Enums\DbExportColumns; |
38 | use App\Enums\WorkerStatuses; | ||
38 | use DateTime; | 39 | use DateTime; |
39 | 40 | ||
40 | class WorkerController extends Controller | 41 | class WorkerController extends Controller |
41 | { | 42 | { |
42 | public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу'); | ||
43 | |||
44 | //профиль | 43 | //профиль |
45 | public function profile(Worker $worker) | 44 | public function profile(Worker $worker) |
46 | { | 45 | { |
47 | $get_date = date('Y.m'); | 46 | $get_date = date('Y.m'); |
48 | 47 | ||
49 | $c = Static_worker::query()->where('year_month', '=', $get_date) | 48 | $c = Static_worker::query()->where('year_month', '=', $get_date) |
50 | ->where('user_id', '=', $worker->users->id) | 49 | ->where('user_id', '=', $worker->users->id) |
51 | ->get(); | 50 | ->get(); |
52 | 51 | ||
53 | if ($c->count() > 0) { | 52 | if ($c->count() > 0) { |
54 | $upd = Static_worker::find($c[0]->id); | 53 | $upd = Static_worker::find($c[0]->id); |
55 | $upd->lookin = $upd->lookin + 1; | 54 | $upd->lookin = $upd->lookin + 1; |
56 | $upd->save(); | 55 | $upd->save(); |
57 | } else { | 56 | } else { |
58 | $crt = new Static_worker(); | 57 | $crt = new Static_worker(); |
59 | $crt->lookin = 1; | 58 | $crt->lookin = 1; |
60 | $crt->year_month = $get_date; | 59 | $crt->year_month = $get_date; |
61 | $crt->user_id = $worker->user_id; | 60 | $crt->user_id = $worker->user_id; |
62 | $crt->save(); | 61 | $crt->save(); |
63 | } | 62 | } |
64 | 63 | ||
65 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 64 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
66 | ->where('user_id', '=', $worker->users->id) | 65 | ->where('user_id', '=', $worker->users->id) |
67 | ->get(); | 66 | ->get(); |
68 | 67 | ||
69 | return view('public.workers.profile', compact('worker', 'stat')); | 68 | return view('public.workers.profile', compact('worker', 'stat')); |
70 | } | 69 | } |
71 | 70 | ||
72 | // лист база резюме | 71 | // лист база резюме |
73 | public function bd_resume(Request $request) | 72 | public function bd_resume(Request $request) |
74 | { | 73 | { |
75 | $look = false; | 74 | $look = false; |
76 | $idiot = 0; | 75 | $idiot = 0; |
77 | if (isset(Auth()->user()->id)) { | 76 | if (isset(Auth()->user()->id)) { |
78 | $idiot = Auth()->user()->id; | 77 | $idiot = Auth()->user()->id; |
79 | if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin)) | 78 | if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin)) |
80 | $look = true; | 79 | $look = true; |
81 | } | 80 | } |
82 | 81 | ||
83 | if ($look) { | 82 | if ($look) { |
84 | $status_work = $this->status_work; | 83 | $status_work = WorkerStatuses::getWorkerStatuses(); |
85 | $resumes = Worker::query()->with('users')->with('job_titles'); | 84 | $resumes = Worker::query()->with('users')->with('job_titles')->orderByDesc('updated_at');; |
86 | $resumes = $resumes->whereHas('users', function (Builder $query) { | 85 | $resumes = $resumes->whereHas('users', function (Builder $query) { |
87 | $query->Where('is_worker', '=', '1') | 86 | $query->Where('is_worker', '=', '1') |
88 | ->Where('is_bd', '=', '0'); | 87 | ->Where('is_bd', '=', '0'); |
89 | }); | 88 | }); |
90 | 89 | ||
91 | //dd($request->get('job')); | 90 | //dd($request->get('job')); |
92 | if (($request->has('job')) && ($request->get('job') > 0)) { | 91 | if (($request->has('job')) && ($request->get('job') > 0)) { |
93 | $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { | 92 | $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { |
94 | $query->Where('job_titles.id', $request->get('job')); | 93 | $query->Where('job_titles.id', $request->get('job')); |
95 | }); | 94 | }); |
96 | } | 95 | } |
97 | 96 | ||
98 | $Job_title = Job_title::query()-> | 97 | $Job_title = Job_title::query()-> |
99 | where('is_remove', '=', '0')-> | 98 | where('is_remove', '=', '0')-> |
100 | where('is_bd', '=' , '1')-> | 99 | where('is_bd', '=' , '1')-> |
101 | get(); | 100 | get(); |
102 | 101 | ||
103 | if ($request->get('sort')) { | 102 | if ($request->get('sort')) { |
104 | $sort = $request->get('sort'); | 103 | $sort = $request->get('sort'); |
105 | switch ($sort) { | 104 | switch ($sort) { |
106 | case 'name_up': | 105 | case 'looking_for_work': |
107 | $resumes = $resumes->orderBy(User::select('surname') | 106 | $resumes->where('status_work', '=', WorkerStatuses::LookingForWork->value); |
108 | ->whereColumn('workers.user_id', 'users.id') | ||
109 | ); | ||
110 | break; | ||
111 | case 'name_down': | ||
112 | $resumes = $resumes->orderByDesc(User::select('surname') | ||
113 | ->whereColumn('workers.user_id', 'users.id') | ||
114 | ); | ||
115 | break; | ||
116 | case 'created_at_up': | ||
117 | $resumes = $resumes->OrderBy('created_at')->orderBy('id'); | ||
118 | break; | ||
119 | case 'created_at_down': | ||
120 | $resumes = $resumes->orderByDesc('created_at')->orderBy('id'); | ||
121 | break; | 107 | break; |
122 | case 'default': | 108 | case 'considering_offers': |
123 | $resumes = $resumes->orderBy('id')->orderby('updated_at'); | 109 | $resumes->where('status_work', '=', WorkerStatuses::ConsideringOffers->value); |
124 | break; | 110 | break; |
125 | default: | 111 | case 'not_looking_for_work': |
126 | $resumes = $resumes->orderBy('id')->orderby('updated_at'); | 112 | $resumes->where('status_work', '=', WorkerStatuses::NotLookingForWork->value); |
127 | break; | 113 | break; |
128 | } | 114 | } |
129 | } | 115 | } |
130 | 116 | ||
131 | $res_count = $resumes->count(); | 117 | $res_count = $resumes->count(); |
132 | //$resumes = $resumes->get(); | 118 | //$resumes = $resumes->get(); |
133 | $resumes = $resumes->paginate(4); | 119 | $resumes = $resumes->paginate(4); |
134 | if ($request->ajax()) { | 120 | if ($request->ajax()) { |
135 | // Условия обставлены | 121 | // Условия обставлены |
136 | if ($request->has('block') && ($request->get('block') == 1)) { | 122 | if ($request->has('block') && ($request->get('block') == 1)) { |
137 | return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); | 123 | return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); |
138 | } | 124 | } |
139 | } else { | 125 | } else { |
140 | return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title')); | 126 | return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title')); |
141 | } | 127 | } |
142 | } else { | 128 | } else { |
143 | return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); | 129 | return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); |
144 | } | 130 | } |
145 | } | 131 | } |
146 | 132 | ||
147 | public function basic_information(){ | 133 | public function basic_information(){ |
148 | if (!isset(Auth()->user()->id)) { | 134 | if (!isset(Auth()->user()->id)) { |
149 | abort(404); | 135 | abort(404); |
150 | } | 136 | } |
151 | 137 | ||
152 | $user_id = Auth()->user()->id; | 138 | $user_id = Auth()->user()->id; |
153 | 139 | ||
154 | $user = User::query() | 140 | $user = User::query() |
155 | ->with('workers') | 141 | ->with('workers') |
156 | ->with(['jobtitles' => function ($query) { | 142 | ->with(['jobtitles' => function ($query) { |
157 | $query->select('job_titles.id'); | 143 | $query->select('job_titles.id'); |
158 | }]) | 144 | }]) |
159 | ->where('id', '=', $user_id) | 145 | ->where('id', '=', $user_id) |
160 | ->first(); | 146 | ->first(); |
161 | $user->workers[0]->job_titles = $user->workers[0]->job_titles->pluck('id')->toArray(); | 147 | $user->workers[0]->job_titles = $user->workers[0]->job_titles->pluck('id')->toArray(); |
162 | 148 | ||
163 | $job_titles = Job_title::query() | 149 | $job_titles = Job_title::query() |
164 | ->where('is_remove', '=', 0) | 150 | ->where('is_remove', '=', 0) |
165 | ->where('is_bd', '=', 1) | 151 | ->where('is_bd', '=', 1) |
166 | ->orderByDesc('sort') | 152 | ->orderByDesc('sort') |
167 | ->get() | 153 | ->get() |
168 | ; | 154 | ; |
169 | 155 | ||
170 | return view('workers.form_basic_information', compact('user', 'job_titles')); | 156 | return view('workers.form_basic_information', compact('user', 'job_titles')); |
171 | } | 157 | } |
172 | 158 | ||
173 | public function additional_documents(){ | 159 | public function additional_documents(){ |
174 | if (!isset(Auth()->user()->id)) { | 160 | if (!isset(Auth()->user()->id)) { |
175 | abort(404); | 161 | abort(404); |
176 | } | 162 | } |
177 | 163 | ||
178 | $user_id = Auth()->user()->id; | 164 | $user_id = Auth()->user()->id; |
179 | 165 | ||
180 | $info_blocks = infobloks::query()->OrderBy('name')->get(); | 166 | $info_blocks = infobloks::query()->OrderBy('name')->get(); |
181 | $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует']; | 167 | $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует']; |
182 | 168 | ||
183 | $worker = Worker::query() | 169 | $worker = Worker::query() |
184 | ->with('users') | 170 | ->with('users') |
185 | ->with('infobloks') | 171 | ->with('infobloks') |
186 | ->WhereHas('users', function (Builder $query) use ($user_id) { | 172 | ->WhereHas('users', function (Builder $query) use ($user_id) { |
187 | $query->Where('id', $user_id); | 173 | $query->Where('id', $user_id); |
188 | }) | 174 | }) |
189 | ->first(); | 175 | ->first(); |
190 | if ($worker->dop_info->count()){ | 176 | if ($worker->dop_info->count()){ |
191 | $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray(); | 177 | $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray(); |
192 | } | 178 | } |
193 | 179 | ||
194 | return view('workers.form_additional_documents', compact('worker', 'info_blocks', 'additional_document_statuses')); | 180 | return view('workers.form_additional_documents', compact('worker', 'info_blocks', 'additional_document_statuses')); |
195 | } | 181 | } |
196 | 182 | ||
197 | //Лайк резюме | 183 | //Лайк резюме |
198 | public function like_controller() { | 184 | public function like_controller() { |
199 | 185 | ||
200 | } | 186 | } |
201 | 187 | ||
202 | // анкета соискателя | 188 | // анкета соискателя |
203 | public function resume_profile(Worker $worker) | 189 | public function resume_profile(Worker $worker) |
204 | { | 190 | { |
205 | if (isset(Auth()->user()->id)) { | 191 | if (isset(Auth()->user()->id)) { |
206 | $idiot = Auth()->user()->id; | 192 | $idiot = Auth()->user()->id; |
207 | } else { | 193 | } else { |
208 | $idiot = 0; | 194 | $idiot = 0; |
209 | } | 195 | } |
210 | 196 | ||
211 | $status_work = $this->status_work; | 197 | $status_work = WorkerStatuses::getWorkerStatuses(); |
212 | $Query = Worker::query()->with('users')->with('job_titles') | 198 | $Query = Worker::query()->with('users')->with('job_titles') |
213 | ->with('place_worker')->with('sertificate')->with('prev_company') | 199 | ->with('place_worker')->with('sertificate')->with('prev_company') |
214 | ->with('infobloks')->with('response'); | 200 | ->with('infobloks')->with('response'); |
215 | $Query = $Query->where('id', '=', $worker->id); | 201 | $Query = $Query->where('id', '=', $worker->id); |
216 | $Query = $Query->get(); | 202 | $Query = $Query->get(); |
217 | 203 | ||
218 | $get_date = date('Y.m'); | 204 | $get_date = date('Y.m'); |
219 | 205 | ||
220 | $infoblocks = infobloks::query()->get(); | 206 | $infoblocks = infobloks::query()->get(); |
221 | 207 | ||
222 | $c = Static_worker::query()->where('year_month', '=', $get_date) | 208 | $c = Static_worker::query()->where('year_month', '=', $get_date) |
223 | ->where('user_id', '=', $worker->user_id) | 209 | ->where('user_id', '=', $worker->user_id) |
224 | ->get(); | 210 | ->get(); |
225 | 211 | ||
226 | if ($c->count() > 0) { | 212 | if ($c->count() > 0) { |
227 | $upd = Static_worker::find($c[0]->id); | 213 | $upd = Static_worker::find($c[0]->id); |
228 | $upd->lookin = $upd->lookin + 1; | 214 | $upd->lookin = $upd->lookin + 1; |
229 | $upd->save(); | 215 | $upd->save(); |
230 | } else { | 216 | } else { |
231 | $crt = new Static_worker(); | 217 | $crt = new Static_worker(); |
232 | $crt->lookin = 1; | 218 | $crt->lookin = 1; |
233 | $crt->year_month = $get_date; | 219 | $crt->year_month = $get_date; |
234 | $crt->user_id = $worker->user_id; | 220 | $crt->user_id = $worker->user_id; |
235 | $status = $crt->save(); | 221 | $status = $crt->save(); |
236 | } | 222 | } |
237 | 223 | ||
238 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 224 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
239 | ->where('user_id', '=', $worker->user_id) | 225 | ->where('user_id', '=', $worker->user_id) |
240 | ->get(); | 226 | ->get(); |
241 | 227 | ||
242 | return view('worker', compact('Query', 'infoblocks', 'status_work', 'idiot', 'stat')); | 228 | return view('worker', compact('Query', 'infoblocks', 'status_work', 'idiot', 'stat')); |
243 | } | 229 | } |
244 | 230 | ||
245 | // скачать анкету соискателя | 231 | // скачать анкету соискателя |
246 | public function resume_download(Worker $worker) | 232 | public function resume_download(Worker $worker) |
247 | { | 233 | { |
248 | $status_work = $this->status_work; | 234 | $status_work = WorkerStatuses::getWorkerStatuses(); |
249 | $Query = Worker::query()->with('users')->with('job_titles') | 235 | $Query = Worker::query()->with('users')->with('job_titles') |
250 | ->with('place_worker')->with('sertificate')->with('prev_company') | 236 | ->with('place_worker')->with('sertificate')->with('prev_company') |
251 | ->with('infobloks'); | 237 | ->with('infobloks'); |
252 | $Query = $Query->where('id', '=', $worker->id); | 238 | $Query = $Query->where('id', '=', $worker->id); |
253 | $Query = $Query->get(); | 239 | $Query = $Query->get(); |
254 | 240 | ||
255 | view()->share('Query',$Query); | 241 | view()->share('Query',$Query); |
256 | 242 | ||
257 | $status_work = $this->status_work; | 243 | $status_work = WorkerStatuses::getWorkerStatuses(); |
258 | $infoblocks = infobloks::query()->get(); | 244 | $infoblocks = infobloks::query()->get(); |
259 | 245 | ||
260 | //return view('layout.pdf', compact('Query', 'status_work', 'infoblocks')); | 246 | //return view('layout.pdf', compact('Query', 'status_work', 'infoblocks')); |
261 | $pdf = PDF::loadView('layout.pdf', [ | 247 | $pdf = PDF::loadView('layout.pdf', [ |
262 | 'Query' => $Query, | 248 | 'Query' => $Query, |
263 | 'status_work' => $status_work, | 249 | 'status_work' => $status_work, |
264 | 'infoblocks' => $infoblocks | 250 | 'infoblocks' => $infoblocks |
265 | ])->setPaper('a4', 'landscape'); | 251 | ])->setPaper('a4', 'landscape'); |
266 | 252 | ||
267 | return $pdf->stream(); | 253 | return $pdf->stream(); |
268 | } | 254 | } |
269 | 255 | ||
270 | public function resume_download_all(Request $request) { | 256 | public function resume_download_all(Request $request) { |
271 | $spreadsheet = new Spreadsheet(); | 257 | $spreadsheet = new Spreadsheet(); |
272 | $sheet = $spreadsheet->getActiveSheet(); | 258 | $sheet = $spreadsheet->getActiveSheet(); |
273 | 259 | ||
274 | $columnMap = range('A', 'Z'); | 260 | $columnMap = range('A', 'Z'); |
275 | $columns = []; | 261 | $columns = []; |
276 | 262 | ||
277 | foreach (DbExportColumns::toArray() as $key => $value){ | 263 | foreach (DbExportColumns::toArray() as $key => $value){ |
278 | if ($request->input($key, 0)){ | 264 | if ($request->input($key, 0)){ |
279 | $sheet->setCellValue("{$columnMap[count($columns)]}1", ucfirst($value)); | 265 | $sheet->setCellValue("{$columnMap[count($columns)]}1", ucfirst($value)); |
280 | $columns[] = str_replace('__', '.', $key); | 266 | $columns[] = str_replace('__', '.', $key); |
281 | } | 267 | } |
282 | } | 268 | } |
283 | 269 | ||
284 | if (empty($columns)) { | 270 | if (empty($columns)) { |
285 | return redirect()->back()->with('error', 'Пожалуйста выберите хотя бы 1 колонку для экспорта.'); | 271 | return redirect()->back()->with('error', 'Пожалуйста выберите хотя бы 1 колонку для экспорта.'); |
286 | } | 272 | } |
287 | 273 | ||
288 | $query = User::select($columns) | 274 | $query = User::select($columns) |
289 | ->leftJoin('workers', 'users.id', '=', 'workers.user_id') | 275 | ->leftJoin('workers', 'users.id', '=', 'workers.user_id') |
290 | ->leftJoin('job_titles', 'workers.position_work', '=', 'job_titles.id') | 276 | ->leftJoin('job_titles', 'workers.position_work', '=', 'job_titles.id') |
291 | ->where('users.is_bd', '=', 1) | 277 | ->where('users.is_bd', '=', 1) |
292 | ; | 278 | ; |
293 | 279 | ||
294 | $job_title_list = $request->input('job_title_list', []); | 280 | $job_title_list = $request->input('job_title_list', []); |
295 | if (!empty($job_title_list)){ | 281 | if (!empty($job_title_list)){ |
296 | $query->whereIn('job_titles.id', $job_title_list); | 282 | $query->whereIn('job_titles.id', $job_title_list); |
297 | } | 283 | } |
298 | 284 | ||
299 | $users = $query->get(); | 285 | $users = $query->get(); |
300 | if ($users->count()){ | 286 | if ($users->count()){ |
301 | $i = 2; | 287 | $i = 2; |
302 | foreach ($users->toArray() as $user){ | 288 | foreach ($users->toArray() as $user){ |
303 | $j = 0; | 289 | $j = 0; |
304 | foreach ($user as $field){ | 290 | foreach ($user as $field){ |
305 | $sheet->setCellValue("{$columnMap[$j++]}$i", $field); | 291 | $sheet->setCellValue("{$columnMap[$j++]}$i", $field); |
306 | } | 292 | } |
307 | $i++; | 293 | $i++; |
308 | } | 294 | } |
309 | } | 295 | } |
310 | $writer = new Xlsx($spreadsheet); | 296 | $writer = new Xlsx($spreadsheet); |
311 | $fileName = 'DB.xlsx'; | 297 | $fileName = 'DB.xlsx'; |
312 | 298 | ||
313 | $response = new StreamedResponse(function() use ($writer) { | 299 | $response = new StreamedResponse(function() use ($writer) { |
314 | $writer->save('php://output'); | 300 | $writer->save('php://output'); |
315 | }); | 301 | }); |
316 | 302 | ||
317 | $response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); | 303 | $response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); |
318 | $response->headers->set('Content-Disposition', 'attachment;filename="' . $fileName . '"'); | 304 | $response->headers->set('Content-Disposition', 'attachment;filename="' . $fileName . '"'); |
319 | $response->headers->set('Cache-Control', 'max-age=0'); | 305 | $response->headers->set('Cache-Control', 'max-age=0'); |
320 | 306 | ||
321 | return $response; | 307 | return $response; |
322 | } | 308 | } |
323 | 309 | ||
324 | // Кабинет работника | 310 | // Кабинет работника |
325 | public function cabinet(Request $request) | 311 | public function cabinet(Request $request) |
326 | { | 312 | { |
327 | // дата год и месяц | 313 | // дата год и месяц |
328 | $get_date = date('Y.m'); | 314 | $get_date = date('Y.m'); |
329 | 315 | ||
330 | $id = Auth()->user()->id; | 316 | $id = Auth()->user()->id; |
331 | 317 | ||
332 | $Infobloks = infobloks::query()->get(); | 318 | $Infobloks = infobloks::query()->get(); |
333 | 319 | ||
334 | $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')-> | 320 | $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')-> |
335 | with('infobloks')->with('place_worker')-> | 321 | with('infobloks')->with('place_worker')-> |
336 | WhereHas('users', | 322 | WhereHas('users', |
337 | function (Builder $query) use ($id) {$query->Where('id', $id); | 323 | function (Builder $query) use ($id) {$query->Where('id', $id); |
338 | })->get(); | 324 | })->get(); |
339 | 325 | ||
340 | $Job_titles = Job_title::query()->where('is_remove', '=', '0')-> | 326 | $Job_titles = Job_title::query()->where('is_remove', '=', '0')-> |
341 | where('is_bd', '=' , '1')-> | 327 | where('is_bd', '=' , '1')-> |
342 | OrderByDesc('sort')->OrderBy('name')->get(); | 328 | OrderByDesc('sort')->OrderBy('name')->get(); |
343 | 329 | ||
344 | 330 | ||
345 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 331 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
346 | ->where('user_id', '=', $id) | 332 | ->where('user_id', '=', $id) |
347 | ->get(); | 333 | ->get(); |
348 | 334 | ||
349 | 335 | ||
350 | // 10% | 336 | // 10% |
351 | 337 | ||
352 | $persent = 10; | 338 | $persent = 10; |
353 | $persent1 = 0; | 339 | $persent1 = 0; |
354 | $persent2 = 0; | 340 | $persent2 = 0; |
355 | $persent3 = 0; | 341 | $persent3 = 0; |
356 | $persent4 = 0; | 342 | $persent4 = 0; |
357 | $persent5 = 0; | 343 | $persent5 = 0; |
358 | 344 | ||
359 | if ((!empty($Worker[0]->telephone)) && | 345 | if ((!empty($Worker[0]->telephone)) && |
360 | (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) && | 346 | (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) && |
361 | (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) { | 347 | (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) { |
362 | // 40% | 348 | // 40% |
363 | $persent = $persent + 40; | 349 | $persent = $persent + 40; |
364 | $persent1 = 40; | 350 | $persent1 = 40; |
365 | } | 351 | } |
366 | 352 | ||
367 | //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year); | 353 | //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year); |
368 | 354 | ||
369 | if ($Worker[0]->sertificate->count() > 0) { | 355 | if ($Worker[0]->sertificate->count() > 0) { |
370 | // 15% | 356 | // 15% |
371 | $persent = $persent + 15; | 357 | $persent = $persent + 15; |
372 | $persent2 = 15; | 358 | $persent2 = 15; |
373 | } | 359 | } |
374 | 360 | ||
375 | if ($Worker[0]->infobloks->count() > 0) { | 361 | if ($Worker[0]->infobloks->count() > 0) { |
376 | // 20% | 362 | // 20% |
377 | $persent = $persent + 20; | 363 | $persent = $persent + 20; |
378 | $persent3 = 20; | 364 | $persent3 = 20; |
379 | } | 365 | } |
380 | 366 | ||
381 | if ($Worker[0]->prev_company->count() > 0) { | 367 | if ($Worker[0]->prev_company->count() > 0) { |
382 | // 10% | 368 | // 10% |
383 | $persent = $persent + 10; | 369 | $persent = $persent + 10; |
384 | $persent4 = 10; | 370 | $persent4 = 10; |
385 | } | 371 | } |
386 | 372 | ||
387 | if (!empty($Worker[0]->photo)) { | 373 | if (!empty($Worker[0]->photo)) { |
388 | // 5% | 374 | // 5% |
389 | $persent = $persent + 5; | 375 | $persent = $persent + 5; |
390 | $persent5 = 5; | 376 | $persent5 = 5; |
391 | } | 377 | } |
392 | 378 | ||
393 | $status_work = $this->status_work; | 379 | $status_work = WorkerStatuses::getWorkerStatuses(); |
394 | $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует']; | 380 | $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует']; |
395 | $info_blocks = infobloks::query()->OrderBy('name')->get(); | 381 | $info_blocks = infobloks::query()->OrderBy('name')->get(); |
396 | 382 | ||
397 | $worker = Worker::query() | 383 | $worker = Worker::query() |
398 | ->with('users') | 384 | ->with('users') |
399 | ->with('sertificate') | 385 | ->with('sertificate') |
400 | ->with('prev_company') | 386 | ->with('prev_company') |
401 | ->with('infobloks') | 387 | ->with('infobloks') |
402 | ->with('place_worker') | 388 | ->with('place_worker') |
403 | ->with('job_titles') | 389 | ->with('job_titles') |
404 | ->WhereHas('users', function (Builder $query) use ($id) { | 390 | ->WhereHas('users', function (Builder $query) use ($id) { |
405 | $query->Where('id', $id); | 391 | $query->Where('id', $id); |
406 | }) | 392 | }) |
407 | ->first(); | 393 | ->first(); |
408 | if ($worker->dop_info->count()){ | 394 | if ($worker->dop_info->count()){ |
409 | $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray(); | 395 | $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray(); |
410 | } | 396 | } |
411 | 397 | ||
412 | //dd($worker->dop_info); | 398 | //dd($worker->dop_info); |
413 | 399 | ||
414 | if ($request->has('print')) { | 400 | if ($request->has('print')) { |
415 | dd($Worker); | 401 | dd($Worker); |
416 | } else { | 402 | } else { |
417 | return view('workers.cabinet', compact( 'persent', 'Job_titles', 'stat', | 403 | return view('workers.cabinet', compact( 'persent', 'Job_titles', 'stat', |
418 | 'worker', 'info_blocks', 'status_work', 'additional_document_statuses' | 404 | 'worker', 'info_blocks', 'status_work', 'additional_document_statuses' |
419 | )); | 405 | )); |
420 | } | 406 | } |
421 | } | 407 | } |
422 | 408 | ||
423 | // Сохранение данных | 409 | // Сохранение данных |
424 | public function cabinet_save(Worker $worker, Request $request) | 410 | public function cabinet_save(Worker $worker, Request $request) |
425 | { | 411 | { |
426 | $id = $worker->id; | 412 | $id = $worker->id; |
427 | $params = $request->all(); | 413 | $params = $request->all(); |
428 | $job_title_id = $request->get('job_title_id'); | 414 | $job_title_id = $request->get('job_title_id'); |
429 | 415 | ||
430 | $rules = [ | 416 | $rules = [ |
431 | 'surname' => ['required', 'string', 'max:255'], | 417 | 'surname' => ['required', 'string', 'max:255'], |
432 | 'name_man' => ['required', 'string', 'max:255'], | 418 | 'name_man' => ['required', 'string', 'max:255'], |
433 | 'email' => ['required', 'string', 'email', 'max:255'], | 419 | 'email' => ['required', 'string', 'email', 'max:255'], |
434 | 420 | ||
435 | ]; | 421 | ]; |
436 | 422 | ||
437 | $messages = [ | 423 | $messages = [ |
438 | 'required' => 'Укажите обязательное поле', | 424 | 'required' => 'Укажите обязательное поле', |
439 | 'min' => [ | 425 | 'min' => [ |
440 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 426 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
441 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 427 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
442 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 428 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
443 | ], | 429 | ], |
444 | 'max' => [ | 430 | 'max' => [ |
445 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 431 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
446 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 432 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
447 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 433 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
448 | ] | 434 | ] |
449 | ]; | 435 | ]; |
450 | 436 | ||
451 | $validator = Validator::make($params, $rules, $messages); | 437 | $validator = Validator::make($params, $rules, $messages); |
452 | 438 | ||
453 | if ($validator->fails()) { | 439 | if ($validator->fails()) { |
454 | return redirect()->route('worker.cabinet')->withErrors($validator); | 440 | return redirect()->route('worker.cabinet')->withErrors($validator); |
455 | } else { | 441 | } else { |
456 | 442 | ||
457 | if ($request->has('photo')) { | 443 | if ($request->has('photo')) { |
458 | if (!empty($worker->photo)) { | 444 | if (!empty($worker->photo)) { |
459 | Storage::delete($worker->photo); | 445 | Storage::delete($worker->photo); |
460 | } | 446 | } |
461 | $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); | 447 | $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); |
462 | } | 448 | } |
463 | 449 | ||
464 | if ($request->has('file')) { | 450 | if ($request->has('file')) { |
465 | if (!empty($worker->file)) { | 451 | if (!empty($worker->file)) { |
466 | Storage::delete($worker->file); | 452 | Storage::delete($worker->file); |
467 | } | 453 | } |
468 | $params['file'] = $request->file('file')->store("worker/$id", 'public'); | 454 | $params['file'] = $request->file('file')->store("worker/$id", 'public'); |
469 | } | 455 | } |
470 | 456 | ||
471 | $worker->update($params); | 457 | $worker->update($params); |
472 | $use = User::find($worker->user_id); | 458 | $use = User::find($worker->user_id); |
473 | $use->surname = $request->get('surname'); | 459 | $use->surname = $request->get('surname'); |
474 | $use->name_man = $request->get('name_man'); | 460 | $use->name_man = $request->get('name_man'); |
475 | $use->surname2 = $request->get('surname2'); | 461 | $use->surname2 = $request->get('surname2'); |
476 | 462 | ||
477 | $use->save(); | 463 | $use->save(); |
478 | $worker->job_titles()->sync($job_title_id); | 464 | $worker->job_titles()->sync($job_title_id); |
479 | 465 | ||
480 | return redirect()->route('worker.basic_information')->with('success', 'Данные были успешно сохранены'); | 466 | return redirect()->route('worker.basic_information')->with('success', 'Данные были успешно сохранены'); |
481 | } | 467 | } |
482 | } | 468 | } |
483 | 469 | ||
484 | public function cabinet_save_foto(Worker $worker, Request $request){ | 470 | public function cabinet_save_foto(Worker $worker, Request $request){ |
485 | $params = ['photo' => null]; | 471 | $params = ['photo' => null]; |
486 | 472 | ||
487 | if ($request->has('photo')) { | 473 | if ($request->has('photo')) { |
488 | if (!empty($worker->photo)) { | 474 | if (!empty($worker->photo)) { |
489 | Storage::delete($worker->photo); | 475 | Storage::delete($worker->photo); |
490 | } | 476 | } |
491 | $params['photo'] = $request->file('photo')->store("worker/$worker->id", 'public'); | 477 | $params['photo'] = $request->file('photo')->store("worker/$worker->id", 'public'); |
492 | } | 478 | } |
493 | 479 | ||
494 | if ($request->has('file')) { | 480 | if ($request->has('file')) { |
495 | if (!empty($worker->file)) { | 481 | if (!empty($worker->file)) { |
496 | Storage::delete($worker->file); | 482 | Storage::delete($worker->file); |
497 | } | 483 | } |
498 | $params['file'] = $request->file('file')->store("worker/$worker->id", 'public'); | 484 | $params['file'] = $request->file('file')->store("worker/$worker->id", 'public'); |
499 | } | 485 | } |
500 | 486 | ||
501 | $worker->update($params); | 487 | $worker->update($params); |
502 | 488 | ||
503 | return redirect()->route('worker.cabinet'); | 489 | return redirect()->route('worker.cabinet'); |
504 | } | 490 | } |
505 | 491 | ||
506 | // Сообщения данные | 492 | // Сообщения данные |
507 | public function messages($type_message) | 493 | public function messages($type_message) |
508 | { | 494 | { |
509 | $user_id = Auth()->user()->id; | 495 | $user_id = Auth()->user()->id; |
510 | 496 | ||
511 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> | 497 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> |
512 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); | 498 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); |
513 | 499 | ||
514 | $messages_output = Message::query()->with('vacancies')-> | 500 | $messages_output = Message::query()->with('vacancies')-> |
515 | with('user_to')->where('user_id', $user_id)-> | 501 | with('user_to')->where('user_id', $user_id)-> |
516 | OrderByDesc('created_at'); | 502 | OrderByDesc('created_at'); |
517 | 503 | ||
518 | $count_input = $messages_input->count(); | 504 | $count_input = $messages_input->count(); |
519 | $count_output = $messages_output->count(); | 505 | $count_output = $messages_output->count(); |
520 | 506 | ||
521 | if ($type_message == 'input') { | 507 | if ($type_message == 'input') { |
522 | $messages = $messages_input->paginate(5); | 508 | $messages = $messages_input->paginate(5); |
523 | } | 509 | } |
524 | 510 | ||
525 | if ($type_message == 'output') { | 511 | if ($type_message == 'output') { |
526 | $messages = $messages_output->paginate(5); | 512 | $messages = $messages_output->paginate(5); |
527 | } | 513 | } |
528 | 514 | ||
529 | //dd($messages); | 515 | //dd($messages); |
530 | // Вернуть все 100% | 516 | // Вернуть все 100% |
531 | return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); | 517 | return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); |
532 | } | 518 | } |
533 | 519 | ||
534 | // Избранный | 520 | // Избранный |
535 | public function favorite() | 521 | public function favorite() |
536 | { | 522 | { |
537 | return view('workers.favorite'); | 523 | return view('workers.favorite'); |
538 | } | 524 | } |
539 | 525 | ||
540 | // Сменить пароль | 526 | // Сменить пароль |
541 | public function new_password() | 527 | public function new_password() |
542 | { | 528 | { |
543 | $email = Auth()->user()->email; | 529 | $email = Auth()->user()->email; |
544 | return view('workers.new_password', compact('email')); | 530 | return view('workers.new_password', compact('email')); |
545 | } | 531 | } |
546 | 532 | ||
547 | // Обновление пароля | 533 | // Обновление пароля |
548 | public function save_new_password(Request $request) { | 534 | public function save_new_password(Request $request) { |
549 | $use = Auth()->user(); | 535 | $use = Auth()->user(); |
550 | $request->validate([ | 536 | $request->validate([ |
551 | 'password' => 'required|string', | 537 | 'password' => 'required|string', |
552 | 'new_password' => 'required|string', | 538 | 'new_password' => 'required|string', |
553 | 'new_password2' => 'required|string' | 539 | 'new_password2' => 'required|string' |
554 | ]); | 540 | ]); |
555 | 541 | ||
556 | if ($request->get('new_password') == $request->get('new_password2')) | 542 | if ($request->get('new_password') == $request->get('new_password2')) |
557 | if ($request->get('password') !== $request->get('new_password')) { | 543 | if ($request->get('password') !== $request->get('new_password')) { |
558 | $credentials = $request->only('email', 'password'); | 544 | $credentials = $request->only('email', 'password'); |
559 | if (Auth::attempt($credentials, $request->has('save_me'))) { | 545 | if (Auth::attempt($credentials, $request->has('save_me'))) { |
560 | 546 | ||
561 | if (!is_null($use->email_verified_at)){ | 547 | if (!is_null($use->email_verified_at)){ |
562 | 548 | ||
563 | $user_data = User_Model::find($use->id); | 549 | $user_data = User_Model::find($use->id); |
564 | $user_data->update([ | 550 | $user_data->update([ |
565 | 'password' => Hash::make($request->get('new_password')), | 551 | 'password' => Hash::make($request->get('new_password')), |
566 | 'pubpassword' => base64_encode($request->get('new_password')), | 552 | 'pubpassword' => base64_encode($request->get('new_password')), |
567 | ]); | 553 | ]); |
568 | return redirect() | 554 | return redirect() |
569 | ->route('worker.new_password') | 555 | ->route('worker.new_password') |
570 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 556 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
571 | } | 557 | } |
572 | 558 | ||
573 | return redirect() | 559 | return redirect() |
574 | ->route('worker.new_password') | 560 | ->route('worker.new_password') |
575 | ->withError('Данная учетная запись не было верифицированна!'); | 561 | ->withError('Данная учетная запись не было верифицированна!'); |
576 | } | 562 | } |
577 | } | 563 | } |
578 | 564 | ||
579 | return redirect() | 565 | return redirect() |
580 | ->route('worker.new_password') | 566 | ->route('worker.new_password') |
581 | ->withErrors('Не совпадение данных, обновите пароли!'); | 567 | ->withErrors('Не совпадение данных, обновите пароли!'); |
582 | } | 568 | } |
583 | 569 | ||
584 | // Удаление профиля форма | 570 | // Удаление профиля форма |
585 | public function delete_profile() | 571 | public function delete_profile() |
586 | { | 572 | { |
587 | $login = Auth()->user()->email; | 573 | $login = Auth()->user()->email; |
588 | return view('workers.delete_profile', compact('login')); | 574 | return view('workers.delete_profile', compact('login')); |
589 | } | 575 | } |
590 | 576 | ||
591 | // Удаление профиля код | 577 | // Удаление профиля код |
592 | public function delete_profile_result(Request $request) { | 578 | public function delete_profile_result(Request $request) { |
593 | $Answer = $request->all(); | 579 | $Answer = $request->all(); |
594 | $user_id = Auth()->user()->id; | 580 | $user_id = Auth()->user()->id; |
595 | $request->validate([ | 581 | $request->validate([ |
596 | 'password' => 'required|string', | 582 | 'password' => 'required|string', |
597 | ]); | 583 | ]); |
598 | 584 | ||
599 | $credentials = $request->only('email', 'password'); | 585 | $credentials = $request->only('email', 'password'); |
600 | if (Auth::attempt($credentials)) { | 586 | if (Auth::attempt($credentials)) { |
601 | Auth::logout(); | 587 | Auth::logout(); |
602 | $it = User_Model::find($user_id); | 588 | $it = User_Model::find($user_id); |
603 | $it->delete(); | 589 | $it->delete(); |
604 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 590 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
605 | } else { | 591 | } else { |
606 | return redirect()->route('worker.delete_profile') | 592 | return redirect()->route('worker.delete_profile') |
607 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 593 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
608 | } | 594 | } |
609 | } | 595 | } |
610 | 596 | ||
611 | // Регистрация соискателя | 597 | // Регистрация соискателя |
612 | public function register_worker(Request $request) | 598 | public function register_worker(Request $request) |
613 | { | 599 | { |
614 | $params = $request->all(); | 600 | $params = $request->all(); |
615 | $params['is_worker'] = 1; | 601 | $params['is_worker'] = 1; |
616 | 602 | ||
617 | $rules = [ | 603 | $rules = [ |
618 | 'surname' => ['required', 'string', 'max:255'], | 604 | 'surname' => ['required', 'string', 'max:255'], |
619 | 'name_man' => ['required', 'string', 'max:255'], | 605 | 'name_man' => ['required', 'string', 'max:255'], |
620 | 'email' => ['required', 'email', 'max:255', 'unique:users'], | 606 | 'email' => ['required', 'email', 'max:255', 'unique:users'], |
621 | 'password' => ['required', 'string', 'min:6'] | 607 | 'password' => ['required', 'string', 'min:6'] |
622 | ]; | 608 | ]; |
623 | 609 | ||
624 | $messages = [ | 610 | $messages = [ |
625 | 'required' => 'Укажите обязательное поле', | 611 | 'required' => 'Укажите обязательное поле', |
626 | 'min' => [ | 612 | 'min' => [ |
627 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 613 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
628 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 614 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
629 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 615 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
630 | ], | 616 | ], |
631 | 'max' => [ | 617 | 'max' => [ |
632 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 618 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
633 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 619 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
634 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 620 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
635 | ] | 621 | ] |
636 | ]; | 622 | ]; |
637 | 623 | ||
638 | $email = $request->get('email'); | 624 | $email = $request->get('email'); |
639 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | 625 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { |
640 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | 626 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); |
641 | } | 627 | } |
642 | 628 | ||
643 | if ($request->get('password') !== $request->get('confirmed')){ | 629 | if ($request->get('password') !== $request->get('confirmed')){ |
644 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | 630 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); |
645 | } | 631 | } |
646 | 632 | ||
647 | if (strlen($request->get('password')) < 6) { | 633 | if (strlen($request->get('password')) < 6) { |
648 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | 634 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); |
649 | } | 635 | } |
650 | 636 | ||
651 | /*$haystack = $request->get('password'); | 637 | /*$haystack = $request->get('password'); |
652 | 638 | ||
653 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); | 639 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); |
654 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', | 640 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', |
655 | 'X', 'C', 'V', 'B', 'N', 'M'); | 641 | 'X', 'C', 'V', 'B', 'N', 'M'); |
656 | $lenpwd_bool = true; | 642 | $lenpwd_bool = true; |
657 | $spec_bool = false; | 643 | $spec_bool = false; |
658 | $alpha_bool = false; | 644 | $alpha_bool = false; |
659 | 645 | ||
660 | if (strlen($haystack) < 8) $lenpwd_bool = false; | 646 | if (strlen($haystack) < 8) $lenpwd_bool = false; |
661 | 647 | ||
662 | foreach ($specsumbol as $it) { | 648 | foreach ($specsumbol as $it) { |
663 | if (strpos($haystack, $it) !== false) { | 649 | if (strpos($haystack, $it) !== false) { |
664 | $spec_bool = true; | 650 | $spec_bool = true; |
665 | } | 651 | } |
666 | } | 652 | } |
667 | 653 | ||
668 | foreach ($alpha as $it) { | 654 | foreach ($alpha as $it) { |
669 | if (strpos($haystack, $it) !== false) { | 655 | if (strpos($haystack, $it) !== false) { |
670 | $alpha_bool = true; | 656 | $alpha_bool = true; |
671 | } | 657 | } |
672 | } | 658 | } |
673 | 659 | ||
674 | if ((!$spec_bool) || (!$alpha_bool)) { | 660 | if ((!$spec_bool) || (!$alpha_bool)) { |
675 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); | 661 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); |
676 | }*/ | 662 | }*/ |
677 | 663 | ||
678 | if (($request->has('politik')) && ($request->get('politik') == 1)) { | 664 | if (($request->has('politik')) && ($request->get('politik') == 1)) { |
679 | $validator = Validator::make($params, $rules, $messages); | 665 | $validator = Validator::make($params, $rules, $messages); |
680 | 666 | ||
681 | if ($validator->fails()) { | 667 | if ($validator->fails()) { |
682 | return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | 668 | return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); |
683 | } else { | 669 | } else { |
684 | //dd($params); | 670 | //dd($params); |
685 | $user = $this->create($params); | 671 | $user = $this->create($params); |
686 | event(new Registered($user)); | 672 | event(new Registered($user)); |
687 | Auth::guard()->login($user); | 673 | Auth::guard()->login($user); |
688 | } | 674 | } |
689 | if ($user) { | 675 | if ($user) { |
690 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; | 676 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; |
691 | } else { | 677 | } else { |
692 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | 678 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); |
693 | } | 679 | } |
694 | 680 | ||
695 | } else { | 681 | } else { |
696 | return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); | 682 | return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); |
697 | } | 683 | } |
698 | } | 684 | } |
699 | 685 | ||
700 | // Звездная оценка и ответ | 686 | // Звездная оценка и ответ |
701 | public function stars_answer(Request $request) { | 687 | public function stars_answer(Request $request) { |
702 | $params = $request->all(); | 688 | $params = $request->all(); |
703 | $rules = [ | 689 | $rules = [ |
704 | 'message' => ['required', 'string', 'max:255'], | 690 | 'message' => ['required', 'string', 'max:255'], |
705 | ]; | 691 | ]; |
706 | 692 | ||
707 | $messages = [ | 693 | $messages = [ |
708 | 'required' => 'Укажите обязательное поле', | 694 | 'required' => 'Укажите обязательное поле', |
709 | 'min' => [ | 695 | 'min' => [ |
710 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 696 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
711 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 697 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
712 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 698 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
713 | ], | 699 | ], |
714 | 'max' => [ | 700 | 'max' => [ |
715 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 701 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
716 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 702 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
717 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 703 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
718 | ] | 704 | ] |
719 | ]; | 705 | ]; |
720 | $response_worker = ResponseWork::create($params); | 706 | $response_worker = ResponseWork::create($params); |
721 | return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); | 707 | return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); |
722 | } | 708 | } |
723 | 709 | ||
724 | public function TestWorker() | 710 | public function TestWorker() |
725 | { | 711 | { |
726 | $Use = new User(); | 712 | $Use = new User(); |
727 | 713 | ||
728 | $Code_user = $Use->create([ | 714 | $Code_user = $Use->create([ |
729 | 'name' => 'surname name_man', | 715 | 'name' => 'surname name_man', |
730 | 'name_man' => 'name_man', | 716 | 'name_man' => 'name_man', |
731 | 'surname' => 'surname', | 717 | 'surname' => 'surname', |
732 | 'surname2' => 'surname2', | 718 | 'surname2' => 'surname2', |
733 | 'subscribe_email' => '1', | 719 | 'subscribe_email' => '1', |
734 | 'email' => 'email@mail.com', | 720 | 'email' => 'email@mail.com', |
735 | 'telephone' => '1234567890', | 721 | 'telephone' => '1234567890', |
736 | 'password' => Hash::make('password'), | 722 | 'password' => Hash::make('password'), |
737 | 'pubpassword' => base64_encode('password'), | 723 | 'pubpassword' => base64_encode('password'), |
738 | 'email_verified_at' => Carbon::now(), | 724 | 'email_verified_at' => Carbon::now(), |
739 | 'is_worker' => 1, | 725 | 'is_worker' => 1, |
740 | ]); | 726 | ]); |
741 | 727 | ||
742 | if ($Code_user->id > 0) { | 728 | if ($Code_user->id > 0) { |
743 | $Worker = new Worker(); | 729 | $Worker = new Worker(); |
744 | $Worker->user_id = $Code_user->id; | 730 | $Worker->user_id = $Code_user->id; |
745 | $Worker->position_work = 1; //'job_titles'; | 731 | $Worker->position_work = 1; //'job_titles'; |
746 | $Worker->email = 'email@email.com'; | 732 | $Worker->email = 'email@email.com'; |
747 | $Worker->telephone = '1234567890'; | 733 | $Worker->telephone = '1234567890'; |
748 | $status = $Worker->save(); | 734 | $status = $Worker->save(); |
749 | 735 | ||
750 | $Title_Worker = new Title_worker(); | 736 | $Title_Worker = new Title_worker(); |
751 | $Title_Worker->worker_id = $Worker->id; | 737 | $Title_Worker->worker_id = $Worker->id; |
752 | $Title_Worker->job_title_id = 1; | 738 | $Title_Worker->job_title_id = 1; |
753 | $Title_Worker->save(); | 739 | $Title_Worker->save(); |
754 | } | 740 | } |
755 | } | 741 | } |
756 | 742 | ||
757 | // Создание пользователя | 743 | // Создание пользователя |
758 | protected function create(array $data) | 744 | protected function create(array $data) |
759 | { | 745 | { |
760 | $Use = new User(); | 746 | $Use = new User(); |
761 | 747 | ||
762 | $Code_user = $Use->create([ | 748 | $Code_user = $Use->create([ |
763 | 'name' => $data['surname']." ".$data['name_man'], | 749 | 'name' => $data['surname']." ".$data['name_man'], |
764 | 'name_man' => $data['name_man'], | 750 | 'name_man' => $data['name_man'], |
765 | 'surname' => $data['surname'], | 751 | 'surname' => $data['surname'], |
766 | 'surname2' => $data['surname2'], | 752 | 'surname2' => $data['surname2'], |
767 | 'subscribe_email' => $data['email'], | 753 | 'subscribe_email' => $data['email'], |
768 | 'email' => $data['email'], | 754 | 'email' => $data['email'], |
769 | 'telephone' => $data['telephone'], | 755 | 'telephone' => $data['telephone'], |
770 | 'password' => Hash::make($data['password']), | 756 | 'password' => Hash::make($data['password']), |
771 | 'pubpassword' => base64_encode($data['password']), | 757 | 'pubpassword' => base64_encode($data['password']), |
772 | 'email_verified_at' => Carbon::now(), | 758 | 'email_verified_at' => Carbon::now(), |
773 | 'is_worker' => $data['is_worker'], | 759 | 'is_worker' => $data['is_worker'], |
774 | ]); | 760 | ]); |
775 | 761 | ||
776 | if ($Code_user->id > 0) { | 762 | if ($Code_user->id > 0) { |
777 | $Worker = new Worker(); | 763 | $Worker = new Worker(); |
778 | $Worker->user_id = $Code_user->id; | 764 | $Worker->user_id = $Code_user->id; |
779 | $Worker->position_work = $data['job_titles']; | 765 | $Worker->position_work = $data['job_titles']; |
780 | $Worker->email = $data['email']; | 766 | $Worker->email = $data['email']; |
781 | $Worker->telephone = $data['telephone']; | 767 | $Worker->telephone = $data['telephone']; |
782 | $Worker->save(); | 768 | $Worker->save(); |
783 | 769 | ||
784 | if (isset($Worker->id)) { | 770 | if (isset($Worker->id)) { |
785 | $Title_Worker = new Title_worker(); | 771 | $Title_Worker = new Title_worker(); |
786 | $Title_Worker->worker_id = $Worker->id; | 772 | $Title_Worker->worker_id = $Worker->id; |
787 | $Title_Worker->job_title_id = $data['job_titles']; | 773 | $Title_Worker->job_title_id = $data['job_titles']; |
788 | $Title_Worker->save(); | 774 | $Title_Worker->save(); |
789 | } | 775 | } |
790 | 776 | ||
791 | return $Code_user; | 777 | return $Code_user; |
792 | } | 778 | } |
793 | } | 779 | } |
794 | 780 | ||
795 | // Вакансии избранные | 781 | // Вакансии избранные |
796 | public function colorado(Request $request) { | 782 | public function colorado(Request $request) { |
797 | $IP_address = RusDate::ip_addr_client(); | 783 | $IP_address = RusDate::ip_addr_client(); |
798 | $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); | 784 | $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); |
799 | 785 | ||
800 | if ($Arr->count()) { | 786 | if ($Arr->count()) { |
801 | $A = Array(); | 787 | $A = Array(); |
802 | foreach ($Arr as $it) { | 788 | foreach ($Arr as $it) { |
803 | $A[] = $it->code_record; | 789 | $A[] = $it->code_record; |
804 | } | 790 | } |
805 | 791 | ||
806 | $Query = Ad_employer::query()->whereIn('id', $A); | 792 | $Query = Ad_employer::query()->whereIn('id', $A); |
807 | } else { | 793 | } else { |
808 | $Query = Ad_employer::query()->where('id', '=', '0'); | 794 | $Query = Ad_employer::query()->where('id', '=', '0'); |
809 | } | 795 | } |
810 | 796 | ||
811 | $Query = $Query->with('jobs')-> | 797 | $Query = $Query->with('jobs')-> |
812 | with('cat')-> | 798 | with('cat')-> |
813 | with('employer')-> | 799 | with('employer')-> |
814 | whereHas('jobs_code', function ($query) use ($request) { | 800 | whereHas('jobs_code', function ($query) use ($request) { |
815 | if ($request->ajax()) { | 801 | if ($request->ajax()) { |
816 | if (null !== ($request->get('job'))) { | 802 | if (null !== ($request->get('job'))) { |
817 | $query->where('job_title_id', $request->get('job')); | 803 | $query->where('job_title_id', $request->get('job')); |
818 | } | 804 | } |
819 | } | 805 | } |
820 | })->select('ad_employers.*'); | 806 | })->select('ad_employers.*'); |
821 | 807 | ||
822 | $Job_title = Job_title::query()->OrderBy('name')->get(); | 808 | $Job_title = Job_title::query()->OrderBy('name')->get(); |
823 | 809 | ||
824 | $Query_count = $Query->count(); | 810 | $Query_count = $Query->count(); |
825 | 811 | ||
826 | $Query = $Query->OrderBy('updated_at')->paginate(3); | 812 | $Query = $Query->OrderBy('updated_at')->paginate(3); |
827 | 813 | ||
828 | return view('workers.favorite', compact('Query', | 814 | return view('workers.favorite', compact('Query', |
829 | 'Query_count', | 815 | 'Query_count', |
830 | 'Job_title')); | 816 | 'Job_title')); |
831 | 817 | ||
832 | } | 818 | } |
833 | 819 | ||
834 | //Переписка | 820 | //Переписка |
835 | public function dialog(User_Model $user1, User_Model $user2, Request $request) { | 821 | public function dialog(User_Model $user1, User_Model $user2, Request $request) { |
836 | // Получение параметров. | 822 | // Получение параметров. |
837 | if ($request->has('ad_employer')){ | 823 | if ($request->has('ad_employer')){ |
838 | $ad_employer = $request->get('ad_employer'); | 824 | $ad_employer = $request->get('ad_employer'); |
839 | } else { | 825 | } else { |
840 | $ad_employer = 0; | 826 | $ad_employer = 0; |
841 | } | 827 | } |
842 | 828 | ||
843 | if (isset($user1->id)) { | 829 | if (isset($user1->id)) { |
844 | $sender = User_Model::query()->with('workers')-> | 830 | $sender = User_Model::query()->with('workers')-> |
845 | with('employers')-> | 831 | with('employers')-> |
846 | where('id', $user1->id)->first(); | 832 | where('id', $user1->id)->first(); |
847 | } | 833 | } |
848 | 834 | ||
849 | if (isset($user2->id)) { | 835 | if (isset($user2->id)) { |
850 | $companion = User_Model::query()->with('workers')-> | 836 | $companion = User_Model::query()->with('workers')-> |
851 | with('employers')-> | 837 | with('employers')-> |
852 | where('id', $user2->id)->first(); | 838 | where('id', $user2->id)->first(); |
853 | } | 839 | } |
854 | 840 | ||
855 | $Messages = Message::query()-> | 841 | $Messages = Message::query()-> |
856 | //with('response')-> | 842 | //with('response')-> |
857 | where(function($query) use ($user1, $user2) { | 843 | where(function($query) use ($user1, $user2) { |
858 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); | 844 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); |
859 | })->orWhere(function($query) use ($user1, $user2) { | 845 | })->orWhere(function($query) use ($user1, $user2) { |
860 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); | 846 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); |
861 | })->OrderBy('created_at')->get(); | 847 | })->OrderBy('created_at')->get(); |
862 | 848 | ||
863 | $id_vac = null; | 849 | $id_vac = null; |
864 | /*foreach ($Messages as $it) { | 850 | /*foreach ($Messages as $it) { |
865 | if (isset($it->response)) { | 851 | if (isset($it->response)) { |
866 | foreach ($it->response as $r) { | 852 | foreach ($it->response as $r) { |
867 | if (isset($r->ad_employer_id)) { | 853 | if (isset($r->ad_employer_id)) { |
868 | $id_vac = $r->ad_employer_id; | 854 | $id_vac = $r->ad_employer_id; |
869 | break; | 855 | break; |
870 | } | 856 | } |
871 | } | 857 | } |
872 | } | 858 | } |
873 | if (!is_null($id_vac)) break; | 859 | if (!is_null($id_vac)) break; |
874 | }*/ | 860 | }*/ |
875 | 861 | ||
876 | //$ad_employer = null; | 862 | //$ad_employer = null; |
877 | //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); | 863 | //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); |
878 | 864 | ||
879 | return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); | 865 | return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); |
880 | } | 866 | } |
881 | 867 | ||
882 | // Даунылоады | 868 | // Даунылоады |
883 | public function download(Worker $worker) { | 869 | public function download(Worker $worker) { |
884 | $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; | 870 | $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; |
885 | view()->share('house',$arr_house); | 871 | view()->share('house',$arr_house); |
886 | $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); | 872 | $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); |
887 | return $pdf->stream(); | 873 | return $pdf->stream(); |
888 | } | 874 | } |
889 | 875 | ||
890 | // Поднятие анкеты | 876 | // Поднятие анкеты |
891 | public function up(Worker $worker) { | 877 | public function up(Worker $worker) { |
892 | $worker->updated_at = Carbon::now(); | 878 | $worker->updated_at = Carbon::now(); |
893 | $worker->save(); | 879 | $worker->save(); |
894 | // 0 | 880 | // 0 |
895 | return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); | 881 | return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); |
896 | } | 882 | } |
897 | 883 | ||
898 | // Форма сертификате | 884 | // Форма сертификате |
899 | public function new_sertificate(Worker $worker) { | 885 | public function new_sertificate(Worker $worker) { |
900 | return view('workers.sertificate_add', compact('worker')); | 886 | return view('workers.sertificate_add', compact('worker')); |
901 | } | 887 | } |
902 | 888 | ||
903 | // Добавление сертификата | 889 | // Добавление сертификата |
904 | public function add_serificate(SertificationRequest $request) { | 890 | public function add_serificate(SertificationRequest $request) { |
905 | $request->validate([ | 891 | $request->validate([ |
906 | 'name' => 'required|string|max:255', | 892 | 'name' => 'required|string|max:255', |
907 | 'end_begin' => 'required|date|date_format:d.m.Y' | 893 | 'end_begin' => 'required|date|date_format:d.m.Y' |
908 | ], | 894 | ], |
909 | [ | 895 | [ |
910 | 'name' => 'Навание сертификата обязательно для заполнения.', | 896 | 'name' => 'Навание сертификата обязательно для заполнения.', |
911 | 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' | 897 | 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' |
912 | ]); | 898 | ]); |
913 | 899 | ||
914 | $params = $request->all(); | 900 | $params = $request->all(); |
915 | 901 | ||
916 | $end_begin = DateTime::createFromFormat('d.m.Y', $params['end_begin']); | 902 | $end_begin = DateTime::createFromFormat('d.m.Y', $params['end_begin']); |
917 | $params['end_begin'] = $end_begin->format('Y-m-d'); | 903 | $params['end_begin'] = $end_begin->format('Y-m-d'); |
918 | 904 | ||
919 | $Sertificate = new sertification(); | 905 | $Sertificate = new sertification(); |
920 | $Sertificate->create($params); | 906 | $Sertificate->create($params); |
921 | $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get(); | 907 | $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get(); |
922 | return redirect()->route('worker.cabinet'); | 908 | return redirect()->route('worker.cabinet'); |
923 | //return view('ajax.documents', compact('Docs')); | 909 | //return view('ajax.documents', compact('Docs')); |
924 | } | 910 | } |
925 | 911 | ||
926 | // Удалить сертификат | 912 | // Удалить сертификат |
927 | public function delete_sertificate(sertification $doc) { | 913 | public function delete_sertificate(sertification $doc) { |
928 | $doc->delete(); | 914 | $doc->delete(); |
929 | 915 | ||
930 | return redirect()->route('worker.cabinet'); | 916 | return redirect()->route('worker.cabinet'); |
931 | } | 917 | } |
932 | 918 | ||
933 | // Редактирование сертификата | 919 | // Редактирование сертификата |
934 | public function edit_sertificate(Worker $worker, sertification $doc) { | 920 | public function edit_sertificate(Worker $worker, sertification $doc) { |
935 | return view('workers.sertificate_edit', compact('doc', 'worker')); | 921 | return view('workers.sertificate_edit', compact('doc', 'worker')); |
936 | } | 922 | } |
937 | 923 | ||
938 | // Редактирование обновление сертификата | 924 | // Редактирование обновление сертификата |
939 | public function update_serificate(SertificationRequest $request, sertification $doc) { | 925 | public function update_serificate(SertificationRequest $request, sertification $doc) { |
940 | $request->validate([ | 926 | $request->validate([ |
941 | 'name' => 'required|string|max:255', | 927 | 'name' => 'required|string|max:255', |
942 | 'end_begin' => 'required|date|date_format:d.m.Y' | 928 | 'end_begin' => 'required|date|date_format:d.m.Y' |
943 | ], | 929 | ], |
944 | [ | 930 | [ |
945 | 'name' => 'Навание сертификата обязательно для заполнения.', | 931 | 'name' => 'Навание сертификата обязательно для заполнения.', |
946 | 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' | 932 | 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' |
947 | ]); | 933 | ]); |
948 | 934 | ||
949 | $all = $request->all(); | 935 | $all = $request->all(); |
950 | 936 | ||
951 | $end_begin = DateTime::createFromFormat('d.m.Y', $all['end_begin']); | 937 | $end_begin = DateTime::createFromFormat('d.m.Y', $all['end_begin']); |
952 | $all['end_begin'] = $end_begin->format('Y-m-d'); | 938 | $all['end_begin'] = $end_begin->format('Y-m-d'); |
953 | 939 | ||
954 | $doc->worker_id = $all['worker_id']; | 940 | $doc->worker_id = $all['worker_id']; |
955 | $doc->name = $all['name']; | 941 | $doc->name = $all['name']; |
956 | $doc->end_begin = $all['end_begin']; | 942 | $doc->end_begin = $all['end_begin']; |
957 | $doc->save(); | 943 | $doc->save(); |
958 | 944 | ||
959 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); | 945 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); |
960 | } | 946 | } |
961 | 947 | ||
962 | public function edit_diploms(Request $request, Worker $worker) { | 948 | public function edit_diploms(Request $request, Worker $worker) { |
963 | $dop_info_data = $request->input('diploms'); | 949 | $dop_info_data = $request->input('diploms'); |
964 | 950 | ||
965 | if (empty($dop_info_data)) { | 951 | if (empty($dop_info_data)) { |
966 | return redirect()->route('worker.additional_documents')->with('error', 'Данные не предоставлены!'); | 952 | return redirect()->route('worker.additional_documents')->with('error', 'Данные не предоставлены!'); |
967 | } | 953 | } |
968 | 954 | ||
969 | foreach ($dop_info_data as $infoblok_id => $status) { | 955 | foreach ($dop_info_data as $infoblok_id => $status) { |
970 | Dop_info::updateOrCreate( | 956 | Dop_info::updateOrCreate( |
971 | ['worker_id' => $worker->id, 'infoblok_id' => $infoblok_id], | 957 | ['worker_id' => $worker->id, 'infoblok_id' => $infoblok_id], |
972 | ['status' => $status] | 958 | ['status' => $status] |
973 | ); | 959 | ); |
974 | } | 960 | } |
975 | 961 | ||
976 | return redirect()->route('worker.additional_documents')->with('success', 'Успешно сохранено!'); | 962 | return redirect()->route('worker.additional_documents')->with('success', 'Успешно сохранено!'); |
977 | } | 963 | } |
978 | 964 | ||
979 | public function delete_add_diplom(Request $request, Worker $worker) { | 965 | public function delete_add_diplom(Request $request, Worker $worker) { |
980 | $infoblok_id = $request->get('infoblok_id'); | 966 | $infoblok_id = $request->get('infoblok_id'); |
981 | 967 | ||
982 | if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) | 968 | if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) |
983 | $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); | 969 | $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); |
984 | else { | 970 | else { |
985 | $params['infoblok_id'] = $infoblok_id; | 971 | $params['infoblok_id'] = $infoblok_id; |
986 | $params['worker_id'] = $worker->id; | 972 | $params['worker_id'] = $worker->id; |
987 | $params['status'] = $request->get('val'); | 973 | $params['status'] = $request->get('val'); |
988 | $id = Dop_info::create($params); | 974 | $id = Dop_info::create($params); |
989 | //$id = $worker->infobloks()->sync([$infoblok_id]); | 975 | //$id = $worker->infobloks()->sync([$infoblok_id]); |
990 | } | 976 | } |
991 | 977 | ||
992 | //$Infoblocks = infobloks::query()->get(); | 978 | //$Infoblocks = infobloks::query()->get(); |
993 | return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); | 979 | return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); |
994 | } | 980 | } |
995 | 981 | ||
996 | 982 | ||
997 | 983 | ||
998 | // Добавление диплома | 984 | // Добавление диплома |
999 | public function add_diplom_ajax(Request $request) { | 985 | public function add_diplom_ajax(Request $request) { |
1000 | // конец | 986 | // конец |
1001 | $params = $request->all(); | 987 | $params = $request->all(); |
1002 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); | 988 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); |
1003 | 989 | ||
1004 | if ($count == 0) $dop_info = Dop_info::create($params); | 990 | if ($count == 0) $dop_info = Dop_info::create($params); |
1005 | $Infoblocks = infobloks::query()->get(); | 991 | $Infoblocks = infobloks::query()->get(); |
1006 | $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); | 992 | $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); |
1007 | $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); | 993 | $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); |
1008 | return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); | 994 | return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); |
1009 | } | 995 | } |
1010 | 996 | ||
1011 | // Добавление диплома без ajax | 997 | // Добавление диплома без ajax |
1012 | public function add_diplom(Worker $worker) { | 998 | public function add_diplom(Worker $worker) { |
1013 | $worker_id = $worker->id; | 999 | $worker_id = $worker->id; |
1014 | $Infoblocks = infobloks::query()->get(); | 1000 | $Infoblocks = infobloks::query()->get(); |
1015 | return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); | 1001 | return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); |
1016 | } | 1002 | } |
1017 | // Сохранить | 1003 | // Сохранить |
1018 | // Сохраняю диплом | 1004 | // Сохраняю диплом |
1019 | public function add_diplom_save(Request $request) { | 1005 | public function add_diplom_save(Request $request) { |
1020 | $params = $request->all(); | 1006 | $params = $request->all(); |
1021 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); | 1007 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); |
1022 | if ($count == 0) $dop_info = Dop_info::create($params); | 1008 | if ($count == 0) $dop_info = Dop_info::create($params); |
1023 | return redirect()->route('worker.cabinet'); | 1009 | return redirect()->route('worker.cabinet'); |
1024 | } | 1010 | } |
1025 | 1011 | ||
1026 | // Добавление стандартного документа | 1012 | // Добавление стандартного документа |
1027 | public function add_document(Worker $worker) { | 1013 | public function add_document(Worker $worker) { |
1028 | return view('workers.docs', compact('worker')); | 1014 | return view('workers.docs', compact('worker')); |
1029 | } | 1015 | } |
1030 | 1016 | ||
1031 | //Сохранение стандартого документа | 1017 | //Сохранение стандартого документа |
1032 | public function add_document_save(DocumentsRequest $request) { | 1018 | public function add_document_save(DocumentsRequest $request) { |
1033 | $params = $request->all(); | 1019 | $params = $request->all(); |
1034 | $place_work = place_works::create($params); | 1020 | $place_work = place_works::create($params); |
1035 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!'); | 1021 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!'); |
1036 | } | 1022 | } |
1037 | 1023 | ||
1038 | // Редактирование документа | 1024 | // Редактирование документа |
1039 | public function edit_document(place_works $doc, Worker $worker) { | 1025 | public function edit_document(place_works $doc, Worker $worker) { |
1040 | return view('workers.docs-edit', compact('doc', 'worker')); | 1026 | return view('workers.docs-edit', compact('doc', 'worker')); |
1041 | } | 1027 | } |
1042 | 1028 | ||
1043 | //Сохранение отредактированного документа | 1029 | //Сохранение отредактированного документа |
1044 | public function edit_document_save(DocumentsRequest $request, place_works $doc) { | 1030 | public function edit_document_save(DocumentsRequest $request, place_works $doc) { |
1045 | $params = $request->all(); | 1031 | $params = $request->all(); |
1046 | $doc->update($params); | 1032 | $doc->update($params); |
1047 | 1033 | ||
1048 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); | 1034 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); |
1049 | } | 1035 | } |
1050 | 1036 | ||
1051 | // Удаление документа | 1037 | // Удаление документа |
1052 | public function delete_document(place_works $doc) { | 1038 | public function delete_document(place_works $doc) { |
1053 | $doc->delete(); | 1039 | $doc->delete(); |
1054 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); | 1040 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); |
1055 | } | 1041 | } |
1056 | 1042 | ||
1057 | //Отправка нового сообщения | 1043 | //Отправка нового сообщения |
1058 | public function new_message(Request $request) { | 1044 | public function new_message(Request $request) { |
1059 | $params = $request->all(); | 1045 | $params = $request->all(); |
1060 | 1046 | ||
1061 | $id = $params['send_user_id']; | 1047 | $id = $params['send_user_id']; |
1062 | $message = new Message(); | 1048 | $message = new Message(); |
1063 | $message->user_id = $params['send_user_id']; | 1049 | $message->user_id = $params['send_user_id']; |
1064 | $message->to_user_id = $params['send_to_user_id']; | 1050 | $message->to_user_id = $params['send_to_user_id']; |
1065 | $message->title = $params['send_title']; | 1051 | $message->title = $params['send_title']; |
1066 | $message->text = $params['send_text']; | 1052 | $message->text = $params['send_text']; |
1067 | $message->ad_employer_id = $params['send_vacancy']; | 1053 | $message->ad_employer_id = $params['send_vacancy']; |
1068 | if ($request->has('send_file')) { | 1054 | if ($request->has('send_file')) { |
1069 | $message->file = $request->file('send_file')->store("worker/$id", 'public'); | 1055 | $message->file = $request->file('send_file')->store("worker/$id", 'public'); |
1070 | } | 1056 | } |
1071 | $message->flag_new = 1; | 1057 | $message->flag_new = 1; |
1072 | $id_message = $message->save(); | 1058 | $id_message = $message->save(); |
1073 | 1059 | ||
1074 | $data['message_id'] = $id_message; | 1060 | $data['message_id'] = $id_message; |
1075 | $data['ad_employer_id'] = $params['send_vacancy']; | 1061 | $data['ad_employer_id'] = $params['send_vacancy']; |
1076 | $data['job_title_id'] = $params['send_job_title_id']; | 1062 | $data['job_title_id'] = $params['send_job_title_id']; |
1077 | $data['flag'] = 1; | 1063 | $data['flag'] = 1; |
1078 | $ad_responce = ad_response::create($data); | 1064 | $ad_responce = ad_response::create($data); |
1079 | return redirect()->route('worker.messages', ['type_message' => 'output']); | 1065 | return redirect()->route('worker.messages', ['type_message' => 'output']); |
1080 | } | 1066 | } |
1081 | 1067 | ||
1082 | 1068 | ||
1083 | public function test123(Request $request) { | 1069 | public function test123(Request $request) { |
1084 | $params = $request->all(); | 1070 | $params = $request->all(); |
1085 | $user1 = $params['user_id']; | 1071 | $user1 = $params['user_id']; |
1086 | $user2 = $params['to_user_id']; | 1072 | $user2 = $params['to_user_id']; |
1087 | $id_vacancy = $params['ad_employer_id']; | 1073 | $id_vacancy = $params['ad_employer_id']; |
1088 | $ad_name = $params['ad_name']; | 1074 | $ad_name = $params['ad_name']; |
1089 | 1075 | ||
1090 | $rules = [ | 1076 | $rules = [ |
1091 | 'text' => 'required|min:1|max:150000', | 1077 | 'text' => 'required|min:1|max:150000', |
1092 | 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' | 1078 | 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' |
1093 | ]; | 1079 | ]; |
1094 | $messages = [ | 1080 | $messages = [ |
1095 | 'required' => 'Укажите обязательное поле', | 1081 | 'required' => 'Укажите обязательное поле', |
1096 | 'min' => [ | 1082 | 'min' => [ |
1097 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 1083 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
1098 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 1084 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
1099 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 1085 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
1100 | ], | 1086 | ], |
1101 | 'max' => [ | 1087 | 'max' => [ |
1102 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 1088 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
1103 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 1089 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
1104 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 1090 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
1105 | ] | 1091 | ] |
1106 | ]; | 1092 | ]; |
1107 | 1093 | ||
1108 | $validator = Validator::make($request->all(), $rules, $messages); | 1094 | $validator = Validator::make($request->all(), $rules, $messages); |
1109 | 1095 | ||
1110 | if ($validator->fails()) { | 1096 | if ($validator->fails()) { |
1111 | return redirect()->route('worker.dialog', ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]) | 1097 | return redirect()->route('worker.dialog', ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]) |
1112 | ->withErrors($validator); | 1098 | ->withErrors($validator); |
1113 | } else { | 1099 | } else { |
1114 | if ($request->has('file')) { | 1100 | if ($request->has('file')) { |
1115 | $params['file'] = $request->file('file')->store("messages", 'public'); | 1101 | $params['file'] = $request->file('file')->store("messages", 'public'); |
1116 | } | 1102 | } |
1117 | Message::create($params); | 1103 | Message::create($params); |
1118 | //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 1104 | //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
1119 | return redirect()->route('worker.dialog', | 1105 | return redirect()->route('worker.dialog', |
1120 | ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]); | 1106 | ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]); |
1121 | 1107 | ||
1122 | } | 1108 | } |
1123 | } | 1109 | } |
1124 | 1110 | ||
1125 | // Информация о предыдущих компаниях | 1111 | // Информация о предыдущих компаниях |
1126 | public function new_prev_company(Worker $worker) { | 1112 | public function new_prev_company(Worker $worker) { |
1127 | return view('workers.prev_company_form', compact('worker')); | 1113 | return view('workers.prev_company_form', compact('worker')); |
1128 | } | 1114 | } |
1129 | 1115 | ||
1130 | // Добавление контакта компании | 1116 | // Добавление контакта компании |
1131 | public function add_prev_company(PrevCompanyRequest $request) { | 1117 | public function add_prev_company(PrevCompanyRequest $request) { |
1132 | // Возвращение параметров | 1118 | // Возвращение параметров |
1133 | $all = $request->all(); | 1119 | $all = $request->all(); |
1134 | $PrevCompany = PrevCompany::create($all); | 1120 | $PrevCompany = PrevCompany::create($all); |
1135 | 1121 | ||
1136 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); | 1122 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); |
1137 | } | 1123 | } |
1138 | 1124 | ||
1139 | // Редактирование контакта компании | 1125 | // Редактирование контакта компании |
1140 | public function edit_prev_company(PrevCompany $doc, Worker $worker) { | 1126 | public function edit_prev_company(PrevCompany $doc, Worker $worker) { |
1141 | return view('workers.prev_company_edit_form', compact('doc', 'worker')); | 1127 | return view('workers.prev_company_edit_form', compact('doc', 'worker')); |
1142 | } | 1128 | } |
1143 | 1129 | ||
1144 | //Сохранение редактирования контакта компании | 1130 | //Сохранение редактирования контакта компании |
1145 | public function update_prev_company(PrevCompany $doc, Request $request){ | 1131 | public function update_prev_company(PrevCompany $doc, Request $request){ |
1146 | $all = $request->all(); | 1132 | $all = $request->all(); |
1147 | $doc->update($all); | 1133 | $doc->update($all); |
1148 | 1134 | ||
1149 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); | 1135 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); |
1150 | } | 1136 | } |
1151 | 1137 | ||
1152 | // Удаление контакта предыдущей компании | 1138 | // Удаление контакта предыдущей компании |
1153 | public function delete_prev_company(PrevCompany $doc) { | 1139 | public function delete_prev_company(PrevCompany $doc) { |
1154 | $doc->delete(); | 1140 | $doc->delete(); |
1155 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); | 1141 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); |
1156 | } | 1142 | } |
1157 | } | 1143 | } |
1158 | 1144 |
resources/views/employers/favorite.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 | console.log('Test system'); | 5 | console.log('Test system'); |
6 | $(document).on('change', '#sort_ajax', function() { | 6 | $(document).on('change', '#sort_ajax', function() { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var val_ = this_.val(); | 8 | var val_ = this_.val(); |
9 | console.log('sort items '+val_); | 9 | console.log('sort items '+val_); |
10 | 10 | ||
11 | $.ajax({ | 11 | $.ajax({ |
12 | type: "GET", | 12 | type: "GET", |
13 | url: "{{ route('shipping_companies') }}", | 13 | url: "{{ route('shipping_companies') }}", |
14 | data: "sort="+val_+"&block=1", | 14 | data: "sort="+val_+"&block=1", |
15 | success: function (data) { | 15 | success: function (data) { |
16 | console.log('Выбор сортировки'); | 16 | console.log('Выбор сортировки'); |
17 | console.log(data); | 17 | console.log(data); |
18 | $('#block_1').html(data); | 18 | $('#block_1').html(data); |
19 | }, | 19 | }, |
20 | headers: { | 20 | headers: { |
21 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 21 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
22 | }, | 22 | }, |
23 | error: function (data) { | 23 | error: function (data) { |
24 | data = JSON.stringify(data); | 24 | data = JSON.stringify(data); |
25 | console.log('Error: ' + data); | 25 | console.log('Error: ' + data); |
26 | } | 26 | } |
27 | }); | 27 | }); |
28 | 28 | ||
29 | $.ajax({ | 29 | $.ajax({ |
30 | type: "GET", | 30 | type: "GET", |
31 | url: "{{ route('shipping_companies') }}", | 31 | url: "{{ route('shipping_companies') }}", |
32 | data: "sort="+val_+"&block=2", | 32 | data: "sort="+val_+"&block=2", |
33 | success: function (data) { | 33 | success: function (data) { |
34 | console.log('Выбор сортировки2'); | 34 | console.log('Выбор сортировки2'); |
35 | console.log(data); | 35 | console.log(data); |
36 | history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | 36 | history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); |
37 | $('#block_2').html(data); | 37 | $('#block_2').html(data); |
38 | }, | 38 | }, |
39 | headers: { | 39 | headers: { |
40 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 40 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
41 | }, | 41 | }, |
42 | error: function (data) { | 42 | error: function (data) { |
43 | data = JSON.stringify(data); | 43 | data = JSON.stringify(data); |
44 | console.log('Error: ' + data); | 44 | console.log('Error: ' + data); |
45 | } | 45 | } |
46 | }); | 46 | }); |
47 | }); | 47 | }); |
48 | </script> | 48 | </script> |
49 | @include('js.favorite-worker') | 49 | @include('js.favorite-worker') |
50 | @endsection | 50 | @endsection |
51 | 51 | ||
52 | @section('content') | 52 | @section('content') |
53 | <section class="cabinet"> | 53 | <section class="cabinet"> |
54 | <div class="container"> | 54 | <div class="container"> |
55 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 55 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
56 | <li><a href="{{ route('index') }}">Главная</a></li> | 56 | <li><a href="{{ route('index') }}">Главная</a></li> |
57 | <li><b>Личный кабинет</b></li> | 57 | <li><b>Личный кабинет</b></li> |
58 | </ul> | 58 | </ul> |
59 | <div class="cabinet__wrapper"> | 59 | <div class="cabinet__wrapper"> |
60 | <div class="cabinet__side"> | 60 | <div class="cabinet__side"> |
61 | <div class="cabinet__side-toper"> | 61 | <div class="cabinet__side-toper"> |
62 | @include('employers.emblema') | 62 | @include('employers.emblema') |
63 | </div> | 63 | </div> |
64 | 64 | ||
65 | @include('employers.menu', ['item' => 6]) | 65 | @include('employers.menu', ['item' => 6]) |
66 | 66 | ||
67 | </div> | 67 | </div> |
68 | 68 | ||
69 | <div class="cabinet__body"> | 69 | <div class="cabinet__body"> |
70 | <div class="cabinet__body-item"> | 70 | <div class="cabinet__body-item"> |
71 | <h2 class="title cabinet__title">Избранные кандидаты</h2> | 71 | <h2 class="title cabinet__title">Избранные кандидаты</h2> |
72 | </div> | 72 | </div> |
73 | <div class="cabinet__body-item"> | 73 | <div class="cabinet__body-item"> |
74 | <div class="cabinet__filters"> | 74 | <div class="cabinet__filters"> |
75 | <div class="cabinet__filters-item"> | 75 | <div class="cabinet__filters-item"> |
76 | <form class="search" action="{{ route('employer.favorites') }}"> | 76 | <form class="search" action="{{ route('employer.favorites') }}"> |
77 | <input type="search" name="search" id="search" class="input" placeholder="Поиск…" value="@if ((isset($_GET['search'])) && (!empty($_GET['search']))) {{ $_GET['search'] }} @endif"> | 77 | <input type="search" name="search" id="search" class="input" placeholder="Поиск…" value="@if ((isset($_GET['search'])) && (!empty($_GET['search']))) {{ $_GET['search'] }} @endif"> |
78 | <button type="submit" class="button">Найти</button> | 78 | <button type="submit" class="button">Найти</button> |
79 | <span> | 79 | <span> |
80 | <svg> | 80 | <svg> |
81 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> | 81 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> |
82 | </svg> | 82 | </svg> |
83 | </span> | 83 | </span> |
84 | </form> | 84 | </form> |
85 | </div> | 85 | </div> |
86 | </div> | 86 | </div> |
87 | <div class="cvs"> | 87 | <div class="cvs"> |
88 | @if ((isset($Workers) && ($Workers->count()))) | 88 | @if ((isset($Workers) && ($Workers->count()))) |
89 | @foreach ($Workers as $it) | 89 | @foreach ($Workers as $it) |
90 | <div class="cvs__body"> | 90 | <div class="cvs__body"> |
91 | <div class="cvs__item"> | 91 | <div class="cvs__item"> |
92 | 92 | ||
93 | <div class="cvs__item-header"> | 93 | <div class="cvs__item-header"> |
94 | <div class="cvs__item-photo"> | 94 | <div class="cvs__item-photo"> |
95 | <svg> | 95 | <svg> |
96 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 96 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
97 | </svg> | 97 | </svg> |
98 | @if (!empty($it->photo)) | 98 | @if (!empty($it->photo)) |
99 | <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($it->photo)) }}" alt=""> | 99 | <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($it->photo)) }}" alt=""> |
100 | @else | 100 | @else |
101 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 101 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
102 | @endif | 102 | @endif |
103 | </div> | 103 | </div> |
104 | 104 | ||
105 | <div class="cvs__item-buttons"> | 105 | <div class="cvs__item-buttons"> |
106 | <button type="button" id="elem_{{ $it->id }}" data-val="{{ $it->id }}" class="like cvs__item-like js_box_favorit js-toggle {{ \App\Classes\LikesClass::get_status_worker($it) }}"> | 106 | <button type="button" id="elem_{{ $it->id }}" data-val="{{ $it->id }}" class="like cvs__item-like js_box_favorit js-toggle {{ \App\Classes\LikesClass::get_status_worker($it) }}"> |
107 | <svg class="mr-10"> | 107 | <svg class="mr-10"> |
108 | <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> | 108 | <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> |
109 | </svg> | 109 | </svg> |
110 | <span class="to-favorites">Добавить в избранное</span> | 110 | <span class="to-favorites">Добавить в избранное</span> |
111 | <span class="in-favorites">Убрать из избранного</span> | 111 | <span class="in-favorites">Убрать из избранного</span> |
112 | </button> | 112 | </button> |
113 | 113 | ||
114 | @guest | 114 | @guest |
115 | <button type="button" data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' | 115 | <button type="button" data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' |
116 | class="chat"> | 116 | class="chat"> |
117 | <svg class="mr-10"> | 117 | <svg class="mr-10"> |
118 | <use xlink:href="{{ asset('images/sprite.svg#chat') }}"></use> | 118 | <use xlink:href="{{ asset('images/sprite.svg#chat') }}"></use> |
119 | </svg> | 119 | </svg> |
120 | <span>Написать</span> | 120 | <span>Написать</span> |
121 | </button> | 121 | </button> |
122 | @else | 122 | @else |
123 | @if (App\Classes\StatusUser::Status()==0) | 123 | @if (App\Classes\StatusUser::Status()==0) |
124 | @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_message)) | 124 | @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_message)) |
125 | <button type="button" class="chat" data-fancybox data-src="#send2" data-vacancy="0" data-uid="{{ Auth()->user()->id }}" data-tuid="{{ $it->users->id }}" data-options='{"touch":false,"autoFocus":false}'> | 125 | <button type="button" class="chat" data-fancybox data-src="#send2" data-vacancy="0" data-uid="{{ Auth()->user()->id }}" data-tuid="{{ $it->users->id }}" data-options='{"touch":false,"autoFocus":false}'> |
126 | <svg class="mr-10"> | 126 | <svg class="mr-10"> |
127 | <use xlink:href="{{ asset('images/sprite.svg#chat') }}"></use> | 127 | <use xlink:href="{{ asset('images/sprite.svg#chat') }}"></use> |
128 | </svg> | 128 | </svg> |
129 | <span>Написать</span> | 129 | <span>Написать</span> |
130 | </button> | 130 | </button> |
131 | @endif | 131 | @endif |
132 | @else | 132 | @else |
133 | <button type="button" data-fancybox data-src="#question2" data-options='{"touch":false,"autoFocus":false}' | 133 | <button type="button" data-fancybox data-src="#question2" data-options='{"touch":false,"autoFocus":false}' |
134 | class="chat"> | 134 | class="chat"> |
135 | <svg class="mr-10"> | 135 | <svg class="mr-10"> |
136 | <use xlink:href="{{ asset('images/sprite.svg#chat') }}"></use> | 136 | <use xlink:href="{{ asset('images/sprite.svg#chat') }}"></use> |
137 | </svg> | 137 | </svg> |
138 | <span>Написать</span> | 138 | <span>Написать</span> |
139 | </button> | 139 | </button> |
140 | @endif | 140 | @endif |
141 | @endif | 141 | @endif |
142 | 142 | ||
143 | <a href="{{ route('resume_profile', ['worker' => $it->id]) }}" class="button">Подробнее</a> | 143 | <a href="{{ route('resume_profile', ['worker' => $it->id]) }}" class="button">Подробнее</a> |
144 | </div> | 144 | </div> |
145 | </div> | 145 | </div> |
146 | 146 | ||
147 | 147 | ||
148 | <div class="cvs__item-text"> | 148 | <div class="cvs__item-text"> |
149 | <div class="cvs__item-text-row"> | 149 | <div class="cvs__item-text-row"> |
150 | <div class="flex" style="align-items: start;"> | 150 | <div class="flex" style="align-items: start;"> |
151 | <div class="cvs__item-text-status @if ($it->status_work == 0) looking-for-job @endif"> | 151 | <div class="cvs__item-text-status @if ($it->status_work == 0) looking-for-job @endif"> |
152 | @if ($it->status_work == 0) Ищу работу | 152 | @php |
153 | @elseif ($it->status_work == 1) Не указано | 153 | $worker_statuses = App\Enums\WorkerStatuses::getWorkerStatuses(); |
154 | @elseif ($it->status_work == 2) Не ищу работу | 154 | @endphp |
155 | @endif | 155 | {{ $worker_statuses[$it->status_work] }} |
156 | </div> | 156 | </div> |
157 | <div class="cvs__item-text-updated-at"> | 157 | <div class="cvs__item-text-updated-at"> |
158 | Обновлено: {{ date('d.m.Y', strtotime($it->updated_at)) }} | 158 | Обновлено: {{ date('d.m.Y', strtotime($it->updated_at)) }} |
159 | </div> | 159 | </div> |
160 | </div> | 160 | </div> |
161 | <div> | 161 | <div> |
162 | <b>Предпочтение по типу судна:</b> | 162 | <b>Предпочтение по типу судна:</b> |
163 | <div>{{ $it->boart_type_preference ?? '-' }}</div> | 163 | <div>{{ $it->boart_type_preference ?? '-' }}</div> |
164 | </div> | 164 | </div> |
165 | </div> | 165 | </div> |
166 | 166 | ||
167 | <div class="cvs__item-text-row"> | 167 | <div class="cvs__item-text-row"> |
168 | <div> | 168 | <div> |
169 | <b>ФИО:</b> | 169 | <b>ФИО:</b> |
170 | <div>@if (isset($it->users)){{ $it->users->surname." ".$it->users->name_man." ".$it->users->surname2 }} @endif</div> | 170 | <div>@if (isset($it->users)){{ $it->users->surname." ".$it->users->name_man." ".$it->users->surname2 }} @endif</div> |
171 | </div> | 171 | </div> |
172 | <div> | 172 | <div> |
173 | <b>Наличие визы:</b> | 173 | <b>Наличие визы:</b> |
174 | <div>{{ $it->visa_available ?? '-' }}</div> | 174 | <div>{{ $it->visa_available ?? '-' }}</div> |
175 | </div> | 175 | </div> |
176 | </div> | 176 | </div> |
177 | 177 | ||
178 | <div class="cvs__item-text-row"> | 178 | <div class="cvs__item-text-row"> |
179 | <div> | 179 | <div> |
180 | <b>Возраст:</b> | 180 | <b>Возраст:</b> |
181 | <div>{{ $it->old_year ?? '-' }}</div> | 181 | <div>{{ $it->old_year ?? '-' }}</div> |
182 | </div> | 182 | </div> |
183 | <div> | 183 | <div> |
184 | <b>Наличие танкерных документов:</b> | 184 | <b>Наличие танкерных документов:</b> |
185 | <div>{{ $it->tanker_documents_available ?? '-' }}</div> | 185 | <div>{{ $it->tanker_documents_available ?? '-' }}</div> |
186 | </div> | 186 | </div> |
187 | </div> | 187 | </div> |
188 | 188 | ||
189 | <div class="cvs__item-text-row"> | 189 | <div class="cvs__item-text-row"> |
190 | <div> | 190 | <div> |
191 | <b>Желаемые вакансии:</b> | 191 | <b>Желаемые вакансии:</b> |
192 | <div> | 192 | <div> |
193 | @if ($it->job_titles->count()) | 193 | @if ($it->job_titles->count()) |
194 | @foreach ($it->job_titles as $job_title) | 194 | @foreach ($it->job_titles as $job_title) |
195 | {{ $job_title->name }} | 195 | {{ $job_title->name }} |
196 | @if (!$loop->last) / @endif | 196 | @if (!$loop->last) / @endif |
197 | @endforeach | 197 | @endforeach |
198 | @else | 198 | @else |
199 | - | 199 | - |
200 | @endif | 200 | @endif |
201 | </div> | 201 | </div> |
202 | </div> | 202 | </div> |
203 | <div> | 203 | <div> |
204 | <b>Наличие подтверждения для работы на ВВП:</b> | 204 | <b>Наличие подтверждения для работы на ВВП:</b> |
205 | <div>{{ $it->confirmation_work_for_vvp ?? '-' }}</div> | 205 | <div>{{ $it->confirmation_work_for_vvp ?? '-' }}</div> |
206 | </div> | 206 | </div> |
207 | </div> | 207 | </div> |
208 | 208 | ||
209 | <div class="cvs__item-text-row"> | 209 | <div class="cvs__item-text-row"> |
210 | <div> | 210 | <div> |
211 | <b>Пожелание к З/П:</b> | 211 | <b>Пожелание к З/П:</b> |
212 | <div>{{ $it->salary_expectations ?? '-' }}</div> | 212 | <div>{{ $it->salary_expectations ?? '-' }}</div> |
213 | </div> | 213 | </div> |
214 | <div> | 214 | <div> |
215 | <b>Город проживания</b> | 215 | <b>Город проживания</b> |
216 | <div>{{ $it->city ?? "-" }}</div> | 216 | <div>{{ $it->city ?? "-" }}</div> |
217 | </div> | 217 | </div> |
218 | </div> | 218 | </div> |
219 | 219 | ||
220 | <div class="cvs__item-text-row"> | 220 | <div class="cvs__item-text-row"> |
221 | <div> | 221 | <div> |
222 | <b>Уровень английского:</b> | 222 | <b>Уровень английского:</b> |
223 | <div>{{ $it->english_level ?? '-' }}</div> | 223 | <div>{{ $it->english_level ?? '-' }}</div> |
224 | </div> | 224 | </div> |
225 | <div> | 225 | <div> |
226 | <b>Телефон:</b> | 226 | <b>Телефон:</b> |
227 | <div><a href="tel:{{ $it->telephone }}">{{ $it->telephone ?? '-' }}</a></div> | 227 | <div><a href="tel:{{ $it->telephone }}">{{ $it->telephone ?? '-' }}</a></div> |
228 | </div> | 228 | </div> |
229 | </div> | 229 | </div> |
230 | 230 | ||
231 | <div class="cvs__item-text-row"> | 231 | <div class="cvs__item-text-row"> |
232 | <div> | 232 | <div> |
233 | <b>Дата готовности к посадке:</b> | 233 | <b>Дата готовности к посадке:</b> |
234 | <div>{{ $it->ready_boart_date ?? '-' }}</div> | 234 | <div>{{ $it->ready_boart_date ?? '-' }}</div> |
235 | </div> | 235 | </div> |
236 | <div> | 236 | <div> |
237 | <b>E-mail:</b> | 237 | <b>E-mail:</b> |
238 | <div><a href="mailto:{{ $it->email }}">{{ $it->email }}</a></div> | 238 | <div><a href="mailto:{{ $it->email }}">{{ $it->email }}</a></div> |
239 | </div> | 239 | </div> |
240 | </div> | 240 | </div> |
241 | </div> | 241 | </div> |
242 | </div> | 242 | </div> |
243 | </div> | 243 | </div> |
244 | @endforeach | 244 | @endforeach |
245 | </div> | 245 | </div> |
246 | @else | 246 | @else |
247 | <div class="notify"> | 247 | <div class="notify"> |
248 | <svg> | 248 | <svg> |
249 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> | 249 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> |
250 | </svg> | 250 | </svg> |
251 | <span>Нет избранных кандидатов</span> | 251 | <span>Нет избранных кандидатов</span> |
252 | </div> | 252 | </div> |
253 | @endif | 253 | @endif |
254 | </div> | 254 | </div> |
255 | </div> | 255 | </div> |
256 | </div> | 256 | </div> |
257 | </div> | 257 | </div> |
258 | 258 | ||
259 | </section> | 259 | </section> |
260 | </div> | 260 | </div> |
261 | @endsection | 261 | @endsection |
262 | 262 |
resources/views/info_company_new.blade.php
1 | @extends('layout.frontend', ['title' => 'Описание компании '.$title.'- РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Описание компании '.$title.'- РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script> | 4 | <script> |
5 | console.log('Test system'); | 5 | console.log('Test system'); |
6 | $(document).on('change', '#sort_ajax', function() { | 6 | $(document).on('change', '#sort_ajax', function() { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var val_ = this_.val(); | 8 | var val_ = this_.val(); |
9 | console.log('sort items '+val_); | 9 | console.log('sort items '+val_); |
10 | 10 | ||
11 | $.ajax({ | 11 | $.ajax({ |
12 | type: "GET", | 12 | type: "GET", |
13 | url: "{{ route('shipping_companies') }}", | 13 | url: "{{ route('shipping_companies') }}", |
14 | data: "sort="+val_+"&block=1", | 14 | data: "sort="+val_+"&block=1", |
15 | success: function (data) { | 15 | success: function (data) { |
16 | console.log('Выбор сортировки'); | 16 | console.log('Выбор сортировки'); |
17 | console.log(data); | 17 | console.log(data); |
18 | $('#block_1').html(data); | 18 | $('#block_1').html(data); |
19 | }, | 19 | }, |
20 | headers: { | 20 | headers: { |
21 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 21 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
22 | }, | 22 | }, |
23 | error: function (data) { | 23 | error: function (data) { |
24 | data = JSON.stringify(data); | 24 | data = JSON.stringify(data); |
25 | console.log('Error: ' + data); | 25 | console.log('Error: ' + data); |
26 | } | 26 | } |
27 | }); | 27 | }); |
28 | 28 | ||
29 | $.ajax({ | 29 | $.ajax({ |
30 | type: "GET", | 30 | type: "GET", |
31 | url: "{{ route('shipping_companies') }}", | 31 | url: "{{ route('shipping_companies') }}", |
32 | data: "sort="+val_+"&block=2", | 32 | data: "sort="+val_+"&block=2", |
33 | success: function (data) { | 33 | success: function (data) { |
34 | console.log('Выбор сортировки2'); | 34 | console.log('Выбор сортировки2'); |
35 | console.log(data); | 35 | console.log(data); |
36 | history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | 36 | history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); |
37 | $('#block_2').html(data); | 37 | $('#block_2').html(data); |
38 | }, | 38 | }, |
39 | headers: { | 39 | headers: { |
40 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 40 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
41 | }, | 41 | }, |
42 | error: function (data) { | 42 | error: function (data) { |
43 | data = JSON.stringify(data); | 43 | data = JSON.stringify(data); |
44 | console.log('Error: ' + data); | 44 | console.log('Error: ' + data); |
45 | } | 45 | } |
46 | }); | 46 | }); |
47 | }); | 47 | }); |
48 | 48 | ||
49 | $(document).ready(function(){ | 49 | $(document).ready(function(){ |
50 | var sel = $('#select2-sort_ajax-container'); | 50 | var sel = $('#select2-sort_ajax-container'); |
51 | var key = getUrlParameter('sort'); | 51 | var key = getUrlParameter('sort'); |
52 | if (key !=='') { | 52 | if (key !=='') { |
53 | console.log(key); | 53 | console.log(key); |
54 | switch (key) { | 54 | switch (key) { |
55 | case "default": sel.html('Сортировка (по умолчанию)'); break; | 55 | case "default": sel.html('Сортировка (по умолчанию)'); break; |
56 | case "name_up": sel.html('По имени (возрастание)'); break; | 56 | case "name_up": sel.html('По имени (возрастание)'); break; |
57 | case "name_down": sel.html('По дате (убывание)'); break; | 57 | case "name_down": sel.html('По дате (убывание)'); break; |
58 | case "created_at_up": sel.html('По дате (возрастание)'); break; | 58 | case "created_at_up": sel.html('По дате (возрастание)'); break; |
59 | case "created_at_down": sel.html('По дате (убывание)'); break; | 59 | case "created_at_down": sel.html('По дате (убывание)'); break; |
60 | } | 60 | } |
61 | 61 | ||
62 | } | 62 | } |
63 | }); | 63 | }); |
64 | 64 | ||
65 | //end | 65 | //end |
66 | $(document).on('click', '.js_send_it_button', function() { | 66 | $(document).on('click', '.js_send_it_button', function() { |
67 | var this_ = $(this); | 67 | var this_ = $(this); |
68 | var code_user_id = this_.attr('data-uid'); | 68 | var code_user_id = this_.attr('data-uid'); |
69 | var code_to_user_id = this_.attr('data-tuid'); | 69 | var code_to_user_id = this_.attr('data-tuid'); |
70 | var code_vacancy = this_.attr('data-vacancy'); | 70 | var code_vacancy = this_.attr('data-vacancy'); |
71 | var user_id = $('#send_user_id'); | 71 | var user_id = $('#send_user_id'); |
72 | var to_user_id = $('#send_to_user_id'); | 72 | var to_user_id = $('#send_to_user_id'); |
73 | var vacancy = $('#send_vacancy'); | 73 | var vacancy = $('#send_vacancy'); |
74 | 74 | ||
75 | console.log('Клик на кнопки...'); | 75 | console.log('Клик на кнопки...'); |
76 | 76 | ||
77 | user_id.val(code_user_id); | 77 | user_id.val(code_user_id); |
78 | to_user_id.val(code_to_user_id); | 78 | to_user_id.val(code_to_user_id); |
79 | vacancy.val(code_vacancy); | 79 | vacancy.val(code_vacancy); |
80 | }); | 80 | }); |
81 | </script> | 81 | </script> |
82 | @include('js.favorite-vacancy-45') | 82 | @include('js.favorite-vacancy-45') |
83 | @endsection | 83 | @endsection |
84 | 84 | ||
85 | @section('content') | 85 | @section('content') |
86 | <section class="thing"> | 86 | <section class="thing"> |
87 | <div class="container"> | 87 | <div class="container"> |
88 | <div class="thing__body"> | 88 | <div class="thing__body"> |
89 | <ul class="breadcrumbs thing__breadcrumbs"> | 89 | <ul class="breadcrumbs thing__breadcrumbs"> |
90 | <li><a href="{{ route('index') }}">Главная</a></li> | 90 | <li><a href="{{ route('index') }}">Главная</a></li> |
91 | <li><a href="{{ route('shipping_companies') }}">Работодатели</a></li> | 91 | <li><a href="{{ route('shipping_companies') }}">Работодатели</a></li> |
92 | <li><b>@isset($title) {{ $title }} @else Не указано @endif</b></li> | 92 | <li><b>@isset($title) {{ $title }} @else Не указано @endif</b></li> |
93 | </ul> | 93 | </ul> |
94 | @if ($company[0]->oficial_status == 1) | 94 | @if ($company[0]->oficial_status == 1) |
95 | <div class="thing__badge"> | 95 | <div class="thing__badge"> |
96 | <svg> | 96 | <svg> |
97 | <use xlink:href="{{ asset('images/sprite.svg#badge') }}"></use> | 97 | <use xlink:href="{{ asset('images/sprite.svg#badge') }}"></use> |
98 | </svg> | 98 | </svg> |
99 | Компания проверена | 99 | Компания проверена |
100 | </div> | 100 | </div> |
101 | @endif | 101 | @endif |
102 | 102 | ||
103 | @if (!empty($company[0]->logo)) | 103 | @if (!empty($company[0]->logo)) |
104 | <img src="{{ asset(Storage::url($company[0]->logo)) }}" alt="{{ $company[0]->name_company }}" class="thing__pic"> | 104 | <img src="{{ asset(Storage::url($company[0]->logo)) }}" alt="{{ $company[0]->name_company }}" class="thing__pic"> |
105 | @else | 105 | @else |
106 | <img src="{{ asset('images/logo_emp.png') }}" alt="{{ $company[0]->name_company }}" class="thing__pic"> | 106 | <img src="{{ asset('images/logo_emp.png') }}" alt="{{ $company[0]->name_company }}" class="thing__pic"> |
107 | @endif | 107 | @endif |
108 | 108 | ||
109 | <h1 class="thing__title">{{ $company[0]->name_company }}</h1> | 109 | <h1 class="thing__title">{{ $company[0]->name_company }}</h1> |
110 | <!--<p class="thing__text"> $company[0]->text !!}</p>--> | 110 | <!--<p class="thing__text"> $company[0]->text !!}</p>--> |
111 | <div class="thing__buttons"> | 111 | <div class="thing__buttons"> |
112 | <button type="button" class="button"> | 112 | <button type="button" class="button"> |
113 | <svg> | 113 | <svg> |
114 | <use xlink:href="{{ asset('images/sprite.svg#grid-1') }}"></use> | 114 | <use xlink:href="{{ asset('images/sprite.svg#grid-1') }}"></use> |
115 | </svg> | 115 | </svg> |
116 | {{ $company[0]->ads->count() }} вакансии | 116 | {{ $company[0]->ads->count() }} вакансии |
117 | </button> | 117 | </button> |
118 | @if ($user_id == 0) | 118 | @if ($user_id == 0) |
119 | <a data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' class="js_send_it_button button"> | 119 | <a data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' class="js_send_it_button button"> |
120 | Написать сообщение | 120 | Написать сообщение |
121 | </a> | 121 | </a> |
122 | @else | 122 | @else |
123 | <a data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' class="js_send_it_button button"> | 123 | <button type="button" data-fancybox data-src="#send" data-vacancy="0" data-uid="{{ $user_id }}" data-tuid="{{ $company[0]->users->id }}" data-options='{"touch":false,"autoFocus":false}' |
124 | class="button js_send_it_button"> | ||
124 | Написать сообщение | 125 | Написать сообщение |
125 | </a> | 126 | </button> |
126 | @endif | 127 | @endif |
127 | </div> | 128 | </div> |
128 | </div> | 129 | </div> |
129 | </div> | 130 | </div> |
130 | </section> | 131 | </section> |
131 | <main class="main"> | 132 | <main class="main"> |
132 | <div class="container"> | 133 | <div class="container"> |
133 | <div class="main__employer-page"> | 134 | <div class="main__employer-page"> |
134 | <h2 class="main__employer-page-title">О компании</h2> | 135 | <h2 class="main__employer-page-title">О компании</h2> |
135 | <div class="main__employer-page-info"> | 136 | <div class="main__employer-page-info"> |
136 | <div class="main__employer-page-item"> | 137 | <div class="main__employer-page-item"> |
137 | <b>Адрес компании</b> | 138 | <b>Адрес компании</b> |
138 | <span> | 139 | <span> |
139 | {{ $company[0]->address }} | 140 | {{ $company[0]->address }} |
140 | </span> | 141 | </span> |
141 | </div> | 142 | </div> |
142 | <div class="main__employer-page-item"> | 143 | <div class="main__employer-page-item"> |
143 | <b>Сайт</b> | 144 | <b>Сайт</b> |
144 | <span> | 145 | <span> |
145 | <a href="{{ $company[0]->site }}">{{ $company[0]->site }}</a> | 146 | <a href="{{ $company[0]->site }}">{{ $company[0]->site }}</a> |
146 | </span> | 147 | </span> |
147 | </div> | 148 | </div> |
148 | <div class="main__employer-page-item"> | 149 | <div class="main__employer-page-item"> |
149 | <b>Почта</b> | 150 | <b>Почта</b> |
150 | <span> | 151 | <span> |
151 | <a href="mailto:">{{ $company[0]->email }}</a> | 152 | <a href="mailto:">{{ $company[0]->email }}</a> |
152 | </span> | 153 | </span> |
153 | </div> | 154 | </div> |
154 | <div class="main__employer-page-item"> | 155 | <div class="main__employer-page-item"> |
155 | <b>Телефон</b> | 156 | <b>Телефон</b> |
156 | <span> | 157 | <span> |
157 | <a href="tel:{{ $company[0]->telephone }}">{{ $company[0]->telephone }}</a> | 158 | <a href="tel:{{ $company[0]->telephone }}">{{ $company[0]->telephone }}</a> |
158 | </span> | 159 | </span> |
159 | </div> | 160 | </div> |
160 | </div> | 161 | </div> |
161 | <div class="main__employer-page-info"> | 162 | <div class="main__employer-page-info"> |
162 | <div class="main__employer-page-item"></div> | 163 | <div class="main__employer-page-item"></div> |
163 | <div class="main__employer-page-item"></div> | 164 | <div class="main__employer-page-item"></div> |
164 | <div class="main__employer-page-item"> | 165 | <div class="main__employer-page-item"> |
165 | <b>Почта (alt)</b> | 166 | <b>Почта (alt)</b> |
166 | <span> | 167 | <span> |
167 | {{ $company[0]->email_2 }} | 168 | {{ $company[0]->email_2 }} |
168 | </span> | 169 | </span> |
169 | </div> | 170 | </div> |
170 | <div class="main__employer-page-item"> | 171 | <div class="main__employer-page-item"> |
171 | <b>Телефон (alt)</b> | 172 | <b>Телефон (alt)</b> |
172 | <span> | 173 | <span> |
173 | <a href="{{ $company[0]->site }}">{{ $company[0]->telephone_2 }}</a> | 174 | <a href="{{ $company[0]->site }}">{{ $company[0]->telephone_2 }}</a> |
174 | </span> | 175 | </span> |
175 | </div> | 176 | </div> |
176 | </div> | 177 | </div> |
177 | 178 | ||
178 | <div class="main__employer-page-item main__employer-page-description"> | 179 | <div class="main__employer-page-item main__employer-page-description"> |
179 | <b>Описание</b> | 180 | <b>Описание</b> |
180 | <span> | 181 | <span> |
181 | {!! $company[0]->text !!} | 182 | {!! $company[0]->text !!} |
182 | </span> | 183 | </span> |
183 | </div> | 184 | </div> |
184 | 185 | ||
185 | <div> | 186 | <div> |
186 | 187 | ||
187 | <div class="main__employer-page-tabs"> | 188 | <div class="main__employer-page-tabs"> |
188 | <button type="button" class="main__employer-page-tabs-item active" | 189 | <button type="button" class="main__employer-page-tabs-item active" |
189 | data-tab="1">Флот</button> | 190 | data-tab="1">Флот</button> |
190 | <button type="button" class="main__employer-page-tabs-item" data-tab="2">Вакансии</button> | 191 | <button type="button" class="main__employer-page-tabs-item" data-tab="2">Вакансии</button> |
191 | </div> | 192 | </div> |
192 | 193 | ||
193 | <div class="main__employer-page-body"> | 194 | <div class="main__employer-page-body"> |
194 | <div class="main__employer-page-body-item showed" data-body="1"> | 195 | <div class="main__employer-page-body-item showed" data-body="1"> |
195 | <div class="main__employer-page-one"> | 196 | <div class="main__employer-page-one"> |
196 | @if ($company[0]->flots->count()) | 197 | @if ($company[0]->flots->count()) |
197 | @foreach ($company[0]->flots as $flot) | 198 | @foreach ($company[0]->flots as $flot) |
198 | <a href="" class="main__employer-page-one-item"> | 199 | <a href="" class="main__employer-page-one-item"> |
199 | @if (!empty($flot->image)) | 200 | @if (!empty($flot->image)) |
200 | <img src="{{ asset(Storage::url($flot->image)) }}" alt="{{ $flot->name }}"> | 201 | <img src="{{ asset(Storage::url($flot->image)) }}" alt="{{ $flot->name }}"> |
201 | @else | 202 | @else |
202 | <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $flot->name }}"> | 203 | <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $flot->name }}"> |
203 | @endif | 204 | @endif |
204 | <b>{{ $flot->name }}</b> | 205 | <b>{{ $flot->name }}</b> |
205 | <b>{{ $flot->region }}</b> | 206 | <b>{{ $flot->region }}</b> |
206 | <span><i>DWT</i> {{ $flot->DWT }}</span> | 207 | <span><i>DWT</i> {{ $flot->DWT }}</span> |
207 | <span><i>Мощность ГД</i> {{ $flot->POWER_GD }}</span> | 208 | <span><i>Мощность ГД</i> {{ $flot->POWER_GD }}</span> |
208 | <span><i>IMO</i> {{ $flot->IMO }}</span> | 209 | <span><i>IMO</i> {{ $flot->IMO }}</span> |
209 | <span>{{ $flot->power }}</span> | 210 | <span>{{ $flot->power }}</span> |
210 | </a> | 211 | </a> |
211 | @endforeach | 212 | @endforeach |
212 | @endif | 213 | @endif |
213 | </div> | 214 | </div> |
214 | </div> | 215 | </div> |
215 | 216 | ||
216 | <div class="main__employer-page-body-item" data-body="2"> | 217 | <div class="main__employer-page-body-item" data-body="2"> |
217 | <div class="main__employer-page-two"> | 218 | <div class="main__employer-page-two"> |
218 | @foreach ($ads as $job) | 219 | @foreach ($ads as $job) |
219 | <div class="main__employer-page-two-item"> | 220 | <div class="main__employer-page-two-item"> |
220 | <div class="main__employer-page-two-item-toper"> | 221 | <div class="main__employer-page-two-item-toper"> |
221 | @if (!empty($company[0]->logo)) | 222 | @if (!empty($company[0]->logo)) |
222 | <img src="{{ asset(Storage::url($company[0]->logo)) }}" alt="{{ $job->name }}"> | 223 | <img src="{{ asset(Storage::url($company[0]->logo)) }}" alt="{{ $job->name }}"> |
223 | @else | 224 | @else |
224 | <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $job->name }}"> | 225 | <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $job->name }}"> |
225 | @endif | 226 | @endif |
226 | <span>{{ $company[0]->name_company }}</span> | 227 | <span>{{ $company[0]->name_company }}</span> |
227 | </div> | 228 | </div> |
228 | <div class="main__employer-page-two-item-text-body"> | 229 | <div class="main__employer-page-two-item-text-body"> |
229 | <h3>{{ $job->name }}</h3> | 230 | <h3>{{ $job->name }}</h3> |
230 | <span>Описание: | 231 | <span>Описание: |
231 | {!! $job->text !!} | 232 | {!! $job->text !!} |
232 | </span> | 233 | </span> |
233 | </div> | 234 | </div> |
234 | 235 | ||
235 | @if ((isset($job->jobs)) && ($job->jobs->count())) | 236 | @if ((isset($job->jobs)) && ($job->jobs->count())) |
236 | <div class="main__employer-page-two-item-tags"> | 237 | <div class="main__employer-page-two-item-tags"> |
237 | @foreach ($job->jobs as $item) | 238 | @foreach ($job->jobs as $item) |
238 | <span class="main__employer-page-two-item-tag">#{{ $item->name }}</span> | 239 | <span class="main__employer-page-two-item-tag">#{{ $item->name }}</span> |
239 | @endforeach | 240 | @endforeach |
240 | </div> | 241 | </div> |
241 | @endif | 242 | @endif |
242 | <div class="main__employer-page-two-item-buttons"> | 243 | <div class="main__employer-page-two-item-buttons"> |
243 | 244 | ||
244 | <button type="button" data-fancybox data-src="#send" data-vacancy="{{ $job->id }}" data-uid="{{ $user_id }}" data-tuid="{{ $company[0]->users->id }}" data-options='{"touch":false,"autoFocus":false}' | 245 | <button type="button" data-fancybox data-src="#send" data-vacancy="{{ $job->id }}" data-uid="{{ $user_id }}" data-tuid="{{ $company[0]->users->id }}" data-options='{"touch":false,"autoFocus":false}' |
245 | class="button main__employer-page-two-item-button js_send_it_button">Оставить | 246 | class="button main__employer-page-two-item-button js_send_it_button">Оставить |
246 | отклик...</button> | 247 | отклик...</button> |
247 | 248 | ||
248 | <!--<a href="#" | 249 | <!--<a href="#" |
249 | class="button button_light main__employer-page-two-item-button">Подробнее</a>--> | 250 | class="button button_light main__employer-page-two-item-button">Подробнее</a>--> |
250 | </div> | 251 | </div> |
251 | <div class="main__employer-page-two-item-bottom"> | 252 | <div class="main__employer-page-two-item-bottom"> |
252 | <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($job->updated_at)) }}</div> | 253 | <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($job->updated_at)) }}</div> |
253 | <button type="button" id="like{{ $job->id }}" data-val="{{ $job->id }}" | 254 | <button type="button" id="like{{ $job->id }}" data-val="{{ $job->id }}" |
254 | class="like main__employer-page-two-item-bottom-like js-toggle js_vac_favorite {{ \App\Classes\LikesClass::get_status_vacancy($job) }}"> | 255 | class="like main__employer-page-two-item-bottom-like js-toggle js_vac_favorite {{ \App\Classes\LikesClass::get_status_vacancy($job) }}"> |
255 | <svg> | 256 | <svg> |
256 | <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> | 257 | <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> |
257 | </svg> | 258 | </svg> |
258 | </button> | 259 | </button> |
259 | </div> | 260 | </div> |
260 | </div> | 261 | </div> |
261 | @endforeach | 262 | @endforeach |
262 | 263 | ||
263 | <div style="margin-top: 20px"> | 264 | <div style="margin-top: 20px"> |
264 | {{ $ads->onEachSide(0)->appends($_GET)->links('paginate') }} | 265 | {{ $ads->onEachSide(0)->appends($_GET)->links('paginate') }} |
265 | </div> | 266 | </div> |
266 | <!--<button type="button" class="button button_light button_more main__employer-page-two-more js-toggle js-parent-toggle"> | 267 | <!--<button type="button" class="button button_light button_more main__employer-page-two-more js-toggle js-parent-toggle"> |
267 | <span>Показать ещё</span> | 268 | <span>Показать ещё</span> |
268 | <span>Скрыть</span> | 269 | <span>Скрыть</span> |
269 | </button>--> | 270 | </button>--> |
270 | </div> | 271 | </div> |
271 | </div> | 272 | </div> |
272 | </div> | 273 | </div> |
273 | </div> | 274 | </div> |
274 | </div> | 275 | </div> |
275 | </div> | 276 | </div> |
276 | </main> | 277 | </main> |
277 | @endsection | 278 | @endsection |
278 | 279 |
resources/views/layout/pdf-list-people.blade.php
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <html lang="ru"> | 2 | <html lang="ru"> |
3 | 3 | ||
4 | <head> | 4 | <head> |
5 | <meta charset="utf-8"> | 5 | <meta charset="utf-8"> |
6 | <title>Резюме соискателя</title> | 6 | <title>Резюме соискателя</title> |
7 | <meta name="viewport" content="width=device-width,initial-scale=1"> | 7 | <meta name="viewport" content="width=device-width,initial-scale=1"> |
8 | <meta name="theme-color" content="#377D87"> | 8 | <meta name="theme-color" content="#377D87"> |
9 | 9 | ||
10 | <!--<link rel="stylesheet" href=" asset('css/style.css') }}">--> | 10 | <!--<link rel="stylesheet" href=" asset('css/style.css') }}">--> |
11 | 11 | ||
12 | <style> | 12 | <style> |
13 | body { | 13 | body { |
14 | font-family:'DejaVu Sans',sans-serif; | 14 | font-family:'DejaVu Sans',sans-serif; |
15 | background:#fff; | 15 | background:#fff; |
16 | font-size:1.6rem; | 16 | font-size:1.6rem; |
17 | font-weight:400; | 17 | font-weight:400; |
18 | color:#363A3F; | 18 | color:#363A3F; |
19 | } | 19 | } |
20 | 20 | ||
21 | .main { | 21 | .main { |
22 | padding: 30px 0; | 22 | padding: 30px 0; |
23 | } | 23 | } |
24 | 24 | ||
25 | .thing { | 25 | .thing { |
26 | color: #3a3b3c; | 26 | color: #3a3b3c; |
27 | /* background-color: #f2f5fc; */ | 27 | /* background-color: #f2f5fc; */ |
28 | } | 28 | } |
29 | 29 | ||
30 | .thing__profile { | 30 | .thing__profile { |
31 | 31 | ||
32 | } | 32 | } |
33 | 33 | ||
34 | .thing__profile-photo { | 34 | .thing__profile-photo { |
35 | width: 200px; | 35 | width: 200px; |
36 | border-radius: 8px; | 36 | border-radius: 8px; |
37 | float: left; | 37 | float: left; |
38 | margin-right: 20px; | 38 | margin-right: 20px; |
39 | } | 39 | } |
40 | 40 | ||
41 | .thing__profile-body { | 41 | .thing__profile-body { |
42 | 42 | ||
43 | } | 43 | } |
44 | 44 | ||
45 | .thing__title { | 45 | .thing__title { |
46 | width: 100%; | 46 | width: 100%; |
47 | font-size: 32px; | 47 | font-size: 32px; |
48 | font-weight: 700; | 48 | font-weight: 700; |
49 | line-height: 1.1; | 49 | line-height: 1.1; |
50 | margin: 0; | 50 | margin: 0; |
51 | } | 51 | } |
52 | 52 | ||
53 | .thing__text { | 53 | .thing__text { |
54 | font-size: 14px; | 54 | font-size: 14px; |
55 | line-height: 1.4; | 55 | line-height: 1.4; |
56 | margin: 15px 0 0 0; | 56 | margin: 15px 0 0 0; |
57 | } | 57 | } |
58 | 58 | ||
59 | .main__spoiler { | 59 | .main__spoiler { |
60 | margin: 0px 0px 32px 0px; | 60 | margin: 0px 0px 32px 0px; |
61 | } | 61 | } |
62 | 62 | ||
63 | .main__spoiler-body { | 63 | .main__spoiler-body { |
64 | 64 | ||
65 | } | 65 | } |
66 | 66 | ||
67 | .main__table { | 67 | .main__table { |
68 | border-collapse: collapse; | 68 | border-collapse: collapse; |
69 | table-layout: fixed; | 69 | table-layout: fixed; |
70 | font-size: 14px; | 70 | font-size: 14px; |
71 | width: 100%; | 71 | width: 100%; |
72 | background: #ffffff; | 72 | background: #ffffff; |
73 | } | 73 | } |
74 | 74 | ||
75 | .main__table thead { | 75 | .main__table thead { |
76 | color: #ffffff; | 76 | color: #ffffff; |
77 | font-size: 16px; | 77 | font-size: 16px; |
78 | background-color: #377d87; | 78 | background-color: #377d87; |
79 | } | 79 | } |
80 | 80 | ||
81 | .main__table th { | 81 | .main__table th { |
82 | padding: 8px 16px; | 82 | padding: 8px 16px; |
83 | } | 83 | } |
84 | 84 | ||
85 | .main__table td { | 85 | .main__table td { |
86 | width: 40%; | 86 | width: 40%; |
87 | padding: 8px 16px; | 87 | padding: 8px 16px; |
88 | border: 1px solid #cecece; | 88 | border: 1px solid #cecece; |
89 | } | 89 | } |
90 | 90 | ||
91 | .main__table td b { | 91 | .main__table td b { |
92 | font-weight: 700; | 92 | font-weight: 700; |
93 | } | 93 | } |
94 | 94 | ||
95 | .main__table b { | 95 | .main__table b { |
96 | display: block; | 96 | display: block; |
97 | } | 97 | } |
98 | 98 | ||
99 | .main__table a { | 99 | .main__table a { |
100 | color: #377d87; | 100 | color: #377d87; |
101 | text-decoration: underline; | 101 | text-decoration: underline; |
102 | } | 102 | } |
103 | 103 | ||
104 | .main__table td + td { | 104 | .main__table td + td { |
105 | width: 60%; | 105 | width: 60%; |
106 | } | 106 | } |
107 | 107 | ||
108 | .main__table_three td { | 108 | .main__table_three td { |
109 | width: 25% !important; | 109 | width: 25% !important; |
110 | } | 110 | } |
111 | 111 | ||
112 | .main__table_three td:last-child { | 112 | .main__table_three td:last-child { |
113 | width: 50% !important; | 113 | width: 50% !important; |
114 | } | 114 | } |
115 | 115 | ||
116 | .main h2 { | 116 | .main h2 { |
117 | margin: 0; | 117 | margin: 0; |
118 | font-weight: 700; | 118 | font-weight: 700; |
119 | font-size: 30px; | 119 | font-size: 30px; |
120 | } | 120 | } |
121 | 121 | ||
122 | .main p { | 122 | .main p { |
123 | margin: 0; | 123 | margin: 0; |
124 | font-size: 14px; | 124 | font-size: 14px; |
125 | line-height: 1.4; | 125 | line-height: 1.4; |
126 | margin: 15px 0 0 0; | 126 | margin: 15px 0 0 0; |
127 | } | 127 | } |
128 | 128 | ||
129 | .main__resume-profile-info { | 129 | .main__resume-profile-info { |
130 | margin: 30px 0px 0px 0px; | 130 | margin: 30px 0px 0px 0px; |
131 | } | 131 | } |
132 | 132 | ||
133 | .main__resume-profile-info-title { | 133 | .main__resume-profile-info-title { |
134 | margin-bottom: 20px !important; | 134 | margin-bottom: 20px !important; |
135 | color: #3a3b3c; | 135 | color: #3a3b3c; |
136 | } | 136 | } |
137 | 137 | ||
138 | .main__resume-profile-info-body-item { | 138 | .main__resume-profile-info-body-item { |
139 | margin: 0px 0px 20px 0px; | 139 | margin: 0px 0px 20px 0px; |
140 | } | 140 | } |
141 | 141 | ||
142 | .main__resume-profile-info-body-subtitle { | 142 | .main__resume-profile-info-body-subtitle { |
143 | color: #4d88d9; | 143 | color: #4d88d9; |
144 | margin: 0px 0px 10px 0px; | 144 | margin: 0px 0px 10px 0px; |
145 | font-weight: 700; | 145 | font-weight: 700; |
146 | font-size: 22px; | 146 | font-size: 22px; |
147 | } | 147 | } |
148 | 148 | ||
149 | .main__resume-profile-info-body-inner { | 149 | .main__resume-profile-info-body-inner { |
150 | margin: 0; | 150 | margin: 0; |
151 | padding: 0; | 151 | padding: 0; |
152 | font-size: 12px; | 152 | font-size: 12px; |
153 | } | 153 | } |
154 | 154 | ||
155 | .main__resume-profile-info-body-inner li { | 155 | .main__resume-profile-info-body-inner li { |
156 | list-style-type: none; | 156 | list-style-type: none; |
157 | margin: 0px 0px 20px 0px; | 157 | margin: 0px 0px 20px 0px; |
158 | } | 158 | } |
159 | 159 | ||
160 | .main__resume-profile-info-body-inner b { | 160 | .main__resume-profile-info-body-inner b { |
161 | display: block; | 161 | display: block; |
162 | margin: 0px 0px 6px 0px; | 162 | margin: 0px 0px 6px 0px; |
163 | color: #377d87; | 163 | color: #377d87; |
164 | font-size: 14px; | 164 | font-size: 14px; |
165 | } | 165 | } |
166 | 166 | ||
167 | .main__resume-profile-info-body-inner span { | 167 | .main__resume-profile-info-body-inner span { |
168 | display: block; | 168 | display: block; |
169 | } | 169 | } |
170 | 170 | ||
171 | .main__resume-profile-info-body-inner a { | 171 | .main__resume-profile-info-body-inner a { |
172 | display: block; | 172 | display: block; |
173 | text-decoration: none; | 173 | text-decoration: none; |
174 | color: inherit; | 174 | color: inherit; |
175 | } | 175 | } |
176 | 176 | ||
177 | </style> | 177 | </style> |
178 | </head> | 178 | </head> |
179 | 179 | ||
180 | <body id="body" class="pdf"> | 180 | <body id="body" class="pdf"> |
181 | @if (count($Query) > 0) | 181 | @if (count($Query) > 0) |
182 | @foreach ($Query as $Q) | 182 | @foreach ($Query as $Q) |
183 | <section class="thing thing_pdf"> | 183 | <section class="thing thing_pdf"> |
184 | <div class="container"> | 184 | <div class="container"> |
185 | <div class="thing__profile"> | 185 | <div class="thing__profile"> |
186 | @if (!empty($Q['photo'])) | 186 | @if (!empty($Q['photo'])) |
187 | <img src="{{ asset(Storage::url($Q['photo'])) }}" alt="" class="thing__profile-photo"> | 187 | <img src="{{ asset(Storage::url($Q['photo'])) }}" alt="" class="thing__profile-photo"> |
188 | @else | 188 | @else |
189 | <img src="{{ asset('images/default_man.jpg') }}" alt="" class="thing__profile-photo"> | 189 | <img src="{{ asset('images/default_man.jpg') }}" alt="" class="thing__profile-photo"> |
190 | @endif | 190 | @endif |
191 | <div class="thing__profile-body"> | 191 | <div class="thing__profile-body"> |
192 | <h1 class="thing__title">@if (isset($Q['users']['surname'])) {{ $Q['users']['surname']." ".$Q['users']['name_man']." ".$Q['users']['surname2'] }} @endif</h1> | 192 | <h1 class="thing__title">@if (isset($Q['users']['surname'])) {{ $Q['users']['surname']." ".$Q['users']['name_man']." ".$Q['users']['surname2'] }} @endif</h1> |
193 | <div style="clear:both;"></div> | 193 | <div style="clear:both;"></div> |
194 | <p class="thing__text">{{ $Q['text'] }}</p> | 194 | <p class="thing__text">{{ $Q['text'] }}</p> |
195 | </div> | 195 | </div> |
196 | </div> | 196 | </div> |
197 | @if (!empty($Q['users']['file'])) | 197 | @if (!empty($Q['users']['file'])) |
198 | <a href="{{ asset(Storage::url($Q['users']['file'])) }}">Анкета-файл</a> | 198 | <a href="{{ asset(Storage::url($Q['users']['file'])) }}">Анкета-файл</a> |
199 | @endif | 199 | @endif |
200 | </div> | 200 | </div> |
201 | </section> | 201 | </section> |
202 | 202 | ||
203 | <main class="main"> | 203 | <main class="main"> |
204 | <div class="container"> | 204 | <div class="container"> |
205 | 205 | ||
206 | <!--php dd($Query); endphp--> | 206 | <!--php dd($Query); endphp--> |
207 | 207 | ||
208 | <div class="main__resume-profile"> | 208 | <div class="main__resume-profile"> |
209 | <div class="main__content"> | 209 | <div class="main__content"> |
210 | <div class="main__spoiler"> | 210 | <div class="main__spoiler"> |
211 | 211 | ||
212 | <!-- <button type="button" class="main__spoiler-toper js-toggle active">Основная | 212 | <!-- <button type="button" class="main__spoiler-toper js-toggle active">Основная |
213 | информация</button> --> | 213 | информация</button> --> |
214 | <div class="main__spoiler-body"> | 214 | <div class="main__spoiler-body"> |
215 | <table class="main__table"> | 215 | <table class="main__table"> |
216 | <thead> | 216 | <thead> |
217 | <tr> | 217 | <tr> |
218 | <th colspan="2">Основная информация</th> | 218 | <th colspan="2">Основная информация</th> |
219 | </tr> | 219 | </tr> |
220 | </thead> | 220 | </thead> |
221 | <tbody> | 221 | <tbody> |
222 | <tr> | 222 | <tr> |
223 | <td>Имя:</td> | 223 | <td>Имя:</td> |
224 | <td><b>@if (isset($Q['users']['name_man'])) {{ $Q['users']['name_man'] }} @endif</b></td> | 224 | <td><b>@if (isset($Q['users']['name_man'])) {{ $Q['users']['name_man'] }} @endif</b></td> |
225 | </tr> | 225 | </tr> |
226 | <tr> | 226 | <tr> |
227 | <td>Должность:</td> | 227 | <td>Должность:</td> |
228 | <td> | 228 | <td> |
229 | @foreach ($Q['job_titles'] as $it) | 229 | @foreach ($Q['job_titles'] as $it) |
230 | <b>{{ $it['name'] }}</b><br> | 230 | <b>{{ $it['name'] }}</b><br> |
231 | @endforeach | 231 | @endforeach |
232 | </td> | 232 | </td> |
233 | </tr> | 233 | </tr> |
234 | <tr> | 234 | <tr> |
235 | <td>Телефон:</td> | 235 | <td>Телефон:</td> |
236 | <td><b><a>{{ $Q['telephone'] }}</a></b> | 236 | <td><b><a>{{ $Q['telephone'] }}</a></b> |
237 | <b><a>{{ $Q['telephone2'] }}</a></b> | 237 | <b><a>{{ $Q['telephone2'] }}</a></b> |
238 | </td> | 238 | </td> |
239 | </tr> | 239 | </tr> |
240 | <tr> | 240 | <tr> |
241 | <td>E-mail:</td> | 241 | <td>E-mail:</td> |
242 | <td><b><a>{{ $Q['email'] }}</a></b></td> | 242 | <td><b><a>{{ $Q['email'] }}</a></b></td> |
243 | </tr> | 243 | </tr> |
244 | <tr> | 244 | <tr> |
245 | <td>Возраст:</td> | 245 | <td>Возраст:</td> |
246 | <td><b>{{ $Q['old_year'] }}</b></td> | 246 | <td><b>{{ $Q['old_year'] }}</b></td> |
247 | </tr> | 247 | </tr> |
248 | <tr> | 248 | <tr> |
249 | <td>Статус:</td> | 249 | <td>Статус:</td> |
250 | <td> | 250 | <td> |
251 | @php | ||
252 | $worker_statuses = App\Enums\WorkerStatuses::getWorkerStatuses(); | ||
253 | $code = $Q['status_work']; | ||
254 | @endphp | ||
251 | @php $code = $Q['status_work']; @endphp | 255 | <b>{{ $worker_statuses[$code] }}</b> |
252 | <b>@if ($code == 0) Ищу работу @elseif($code == 1) Не указано @else Не ищу работу @endif</b></td> | 256 | </td> |
253 | </tr> | 257 | </tr> |
254 | <tr> | 258 | <tr> |
255 | <td>Город проживания:</td> | 259 | <td>Город проживания:</td> |
256 | <td><b>{{ $Q['city'] }}</b></td> | 260 | <td><b>{{ $Q['city'] }}</b></td> |
257 | </tr> | 261 | </tr> |
258 | <tr> | 262 | <tr> |
259 | <td>Уровень английского:</td> | 263 | <td>Уровень английского:</td> |
260 | <td><b>{{ $Q['en_is'] }}</b></td> | 264 | <td><b>{{ $Q['en_is'] }}</b></td> |
261 | </tr> | 265 | </tr> |
262 | <tr> | 266 | <tr> |
263 | <td>Опыт работы:</td> | 267 | <td>Опыт работы:</td> |
264 | <td><b>{{ $Q['old_year'] }}</b></td> | 268 | <td><b>{{ $Q['old_year'] }}</b></td> |
265 | </tr> | 269 | </tr> |
266 | </tbody> | 270 | </tbody> |
267 | </table> | 271 | </table> |
268 | </div> | 272 | </div> |
269 | </div> | 273 | </div> |
270 | <div class="main__spoiler"> | 274 | <div class="main__spoiler"> |
271 | <div class="main__spoiler-body"> | 275 | <div class="main__spoiler-body"> |
272 | <table class="main__table"> | 276 | <table class="main__table"> |
273 | <thead> | 277 | <thead> |
274 | <tr> | 278 | <tr> |
275 | <th colspan="2">Сертификаты / документы</th> | 279 | <th colspan="2">Сертификаты / документы</th> |
276 | </tr> | 280 | </tr> |
277 | </thead> | 281 | </thead> |
278 | <tbody> | 282 | <tbody> |
279 | @if (count($Q['sertificate'])) | 283 | @if (count($Q['sertificate'])) |
280 | @foreach($Q['sertificate'] as $it) | 284 | @foreach($Q['sertificate'] as $it) |
281 | <tr> | 285 | <tr> |
282 | <td>{{ $it['name']." ".$it['education'] }}</td> | 286 | <td>{{ $it['name']." ".$it['education'] }}</td> |
283 | <td><a>{{ date('d.m.Y H:i:s', strtotime($it['date_begin']))."-".date('d.m.Y H:i:s', strtotime($it['end_begin'])) }}</a></td> | 287 | <td><a>{{ date('d.m.Y H:i:s', strtotime($it['date_begin']))."-".date('d.m.Y H:i:s', strtotime($it['end_begin'])) }}</a></td> |
284 | </tr> | 288 | </tr> |
285 | @endforeach | 289 | @endforeach |
286 | @else | 290 | @else |
287 | <tr> | 291 | <tr> |
288 | <td> - </td> | 292 | <td> - </td> |
289 | <td> - </td> | 293 | <td> - </td> |
290 | </tr> | 294 | </tr> |
291 | @endif | 295 | @endif |
292 | </tbody> | 296 | </tbody> |
293 | </table> | 297 | </table> |
294 | </div> | 298 | </div> |
295 | </div> | 299 | </div> |
296 | <div class="main__spoiler"> | 300 | <div class="main__spoiler"> |
297 | <div class="main__spoiler-body"> | 301 | <div class="main__spoiler-body"> |
298 | <table class="main__table main__table_three"> | 302 | <table class="main__table main__table_three"> |
299 | <thead> | 303 | <thead> |
300 | <tr> | 304 | <tr> |
301 | <th colspan="3">Опыт работы</th> | 305 | <th colspan="3">Опыт работы</th> |
302 | </tr> | 306 | </tr> |
303 | </thead> | 307 | </thead> |
304 | <tbody> | 308 | <tbody> |
305 | @if (count($Q['place_worker']) > 0) | 309 | @if (count($Q['place_worker']) > 0) |
306 | @foreach($Q['place_worker'] as $it) | 310 | @foreach($Q['place_worker'] as $it) |
307 | <tr> | 311 | <tr> |
308 | <td>{{ $it['begin_work']." - ".$it['end_work'] }} | 312 | <td>{{ $it['begin_work']." - ".$it['end_work'] }} |
309 | </td> | 313 | </td> |
310 | <td><b>{{ $it['name_company'] }}</b> | 314 | <td><b>{{ $it['name_company'] }}</b> |
311 | </td> | 315 | </td> |
312 | <td><b>{{ $it['job_title'] }}</b> | 316 | <td><b>{{ $it['job_title'] }}</b> |
313 | Судно: {{ $it['teplohod'] }} | 317 | Судно: {{ $it['teplohod'] }} |
314 | </td> | 318 | </td> |
315 | </tr> | 319 | </tr> |
316 | @endforeach | 320 | @endforeach |
317 | @endif | 321 | @endif |
318 | </tbody> | 322 | </tbody> |
319 | </table> | 323 | </table> |
320 | </div> | 324 | </div> |
321 | </div> | 325 | </div> |
322 | </div> | 326 | </div> |
323 | <div class="main__resume-profile-about"> | 327 | <div class="main__resume-profile-about"> |
324 | <h2 class="main__resume-profile-about-title">О себе</h2> | 328 | <h2 class="main__resume-profile-about-title">О себе</h2> |
325 | <p class="main__resume-profile-about-text">{{ $Q['text'] }}</p> | 329 | <p class="main__resume-profile-about-text">{{ $Q['text'] }}</p> |
326 | 330 | ||
327 | </div> | 331 | </div> |
328 | <div class="main__resume-profile-info"> | 332 | <div class="main__resume-profile-info"> |
329 | <h2 class="main__resume-profile-info-title">Данные о прошлых компаниях</h2> | 333 | <h2 class="main__resume-profile-info-title">Данные о прошлых компаниях</h2> |
330 | <div class="main__resume-profile-info-body"> | 334 | <div class="main__resume-profile-info-body"> |
331 | @if ((isset($Q['prev_company'])) && (count($Q['prev_company']) > 0)) | 335 | @if ((isset($Q['prev_company'])) && (count($Q['prev_company']) > 0)) |
332 | @foreach ($Q['prev_company'] as $it) | 336 | @foreach ($Q['prev_company'] as $it) |
333 | <div class="main__resume-profile-info-body-item"> | 337 | <div class="main__resume-profile-info-body-item"> |
334 | <h3 class="main__resume-profile-info-body-subtitle">{{ $it['name_company'] }}</h3> | 338 | <h3 class="main__resume-profile-info-body-subtitle">{{ $it['name_company'] }}</h3> |
335 | <ul class="main__resume-profile-info-body-inner"> | 339 | <ul class="main__resume-profile-info-body-inner"> |
336 | <li> | 340 | <li> |
337 | <b>Руководитель</b> | 341 | <b>Руководитель</b> |
338 | <span>{{ $it['direct'] }}</span> | 342 | <span>{{ $it['direct'] }}</span> |
339 | </li> | 343 | </li> |
340 | <li> | 344 | <li> |
341 | <b>Телефон того, кто может дать рекомендацию</b> | 345 | <b>Телефон того, кто может дать рекомендацию</b> |
342 | <span> | 346 | <span> |
343 | <a>{{ $it['telephone'] }}</a> | 347 | <a>{{ $it['telephone'] }}</a> |
344 | <a>{{ $it['telephone2'] }}</a> | 348 | <a>{{ $it['telephone2'] }}</a> |
345 | </span> | 349 | </span> |
346 | </li> | 350 | </li> |
347 | </ul> | 351 | </ul> |
348 | </div> | 352 | </div> |
349 | @endforeach | 353 | @endforeach |
350 | @else | 354 | @else |
351 | <div class="main__resume-profile-info-body-item"> | 355 | <div class="main__resume-profile-info-body-item"> |
352 | <h3 class="main__resume-profile-info-body-subtitle">Не указано</h3> | 356 | <h3 class="main__resume-profile-info-body-subtitle">Не указано</h3> |
353 | <ul class="main__resume-profile-info-body-inner"> | 357 | <ul class="main__resume-profile-info-body-inner"> |
354 | <li> | 358 | <li> |
355 | <b>Руководитель</b> | 359 | <b>Руководитель</b> |
356 | <span>Нет сведений</span> | 360 | <span>Нет сведений</span> |
357 | </li> | 361 | </li> |
358 | <li> | 362 | <li> |
359 | <b>Телефон того, кто может дать рекомендацию</b> | 363 | <b>Телефон того, кто может дать рекомендацию</b> |
360 | <span> | 364 | <span> |
361 | <a>Нет сведений</a> | 365 | <a>Нет сведений</a> |
362 | </span> | 366 | </span> |
363 | </li> | 367 | </li> |
364 | </ul> | 368 | </ul> |
365 | </div> | 369 | </div> |
366 | 370 | ||
367 | @endif | 371 | @endif |
368 | </div> | 372 | </div> |
369 | </div> | 373 | </div> |
370 | </div> | 374 | </div> |
371 | 375 | ||
372 | </div> | 376 | </div> |
373 | </main> | 377 | </main> |
374 | @endforeach | 378 | @endforeach |
375 | @endif | 379 | @endif |
376 | </body> | 380 | </body> |
377 | </html> | 381 | </html> |
378 | 382 |
resources/views/resume.blade.php
1 | @extends('layout.frontend', ['title' => 'База резюме - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'База резюме - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script> | 4 | <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script> |
5 | <script> | 5 | <script> |
6 | console.log('Test system'); | 6 | console.log('Test system'); |
7 | $(document).on('change', '#jobs', function() { | 7 | $(document).on('change', '#jobs', function() { |
8 | var val = $(this).val(); | 8 | var val = $(this).val(); |
9 | var main_oskar = $('#main_ockar'); | 9 | var main_oskar = $('#main_ockar'); |
10 | 10 | ||
11 | console.log('Code='+val); | 11 | console.log('Code='+val); |
12 | console.log('Click change...'); | 12 | console.log('Click change...'); |
13 | $.ajax({ | 13 | $.ajax({ |
14 | type: "GET", | 14 | type: "GET", |
15 | url: "", | 15 | url: "", |
16 | data: "job="+val, | 16 | data: "job="+val, |
17 | success: function (data) { | 17 | success: function (data) { |
18 | console.log('Выбор сделан!'); | 18 | console.log('Выбор сделан!'); |
19 | console.log(data); | 19 | console.log(data); |
20 | main_oskar.html(data); | 20 | main_oskar.html(data); |
21 | }, | 21 | }, |
22 | headers: { | 22 | headers: { |
23 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 23 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
24 | }, | 24 | }, |
25 | error: function (data) { | 25 | error: function (data) { |
26 | data = JSON.stringify(data); | 26 | data = JSON.stringify(data); |
27 | console.log('Error: ' + data); | 27 | console.log('Error: ' + data); |
28 | } | 28 | } |
29 | }); | 29 | }); |
30 | }); | 30 | }); |
31 | </script> | 31 | </script> |
32 | 32 | ||
33 | <script> | 33 | <script> |
34 | $(document).ready(function() { | 34 | $(document).ready(function() { |
35 | $(document).on('click', '.js_box_favorites', function () { | 35 | $(document).on('click', '.js_box_favorites', function () { |
36 | var _this = $(this); | 36 | var _this = $(this); |
37 | var id_worker = _this.attr('data-val'); | 37 | var id_worker = _this.attr('data-val'); |
38 | 38 | ||
39 | if (_this.hasClass('active')) { | 39 | if (_this.hasClass('active')) { |
40 | add_in_array(id_worker); | 40 | add_in_array(id_worker); |
41 | console.log('Добавлено в избранное id=' + id_worker); | 41 | console.log('Добавлено в избранное id=' + id_worker); |
42 | } else { | 42 | } else { |
43 | delete_in_array(id_worker); | 43 | delete_in_array(id_worker); |
44 | console.log('Удалено из избранных id='+id_worker) | 44 | console.log('Удалено из избранных id='+id_worker) |
45 | } | 45 | } |
46 | var str = $.cookie('favorite_worker'); | 46 | var str = $.cookie('favorite_worker'); |
47 | console.log("Вывод куков "+str); | 47 | console.log("Вывод куков "+str); |
48 | 48 | ||
49 | }); | 49 | }); |
50 | }); | 50 | }); |
51 | 51 | ||
52 | //помеченный элемент | 52 | //помеченный элемент |
53 | function selected_item(obj) { | 53 | function selected_item(obj) { |
54 | var arr = read_array(); | 54 | var arr = read_array(); |
55 | var index = arr.indexOf(obj); | 55 | var index = arr.indexOf(obj); |
56 | 56 | ||
57 | if (index > 0) | 57 | if (index > 0) |
58 | return "active"; | 58 | return "active"; |
59 | else | 59 | else |
60 | return ""; | 60 | return ""; |
61 | } | 61 | } |
62 | 62 | ||
63 | // запись элемента массива в cookie | 63 | // запись элемента массива в cookie |
64 | function add_in_array(obj){ | 64 | function add_in_array(obj){ |
65 | var arr = read_array();//получаем текущее состояние массива | 65 | var arr = read_array();//получаем текущее состояние массива |
66 | arr[arr.length]=obj; //добавляем элемент в конец | 66 | arr[arr.length]=obj; //добавляем элемент в конец |
67 | //var str = JSON.stringify(arr);//конвертируем в строку | 67 | //var str = JSON.stringify(arr);//конвертируем в строку |
68 | //$.cookie('arr',str);//записываем массив в куки | 68 | //$.cookie('arr',str);//записываем массив в куки |
69 | $.cookie('favorite_worker', JSON.stringify(arr)); | 69 | $.cookie('favorite_worker', JSON.stringify(arr)); |
70 | 70 | ||
71 | } | 71 | } |
72 | 72 | ||
73 | // удаление элемента из массива в cookie | 73 | // удаление элемента из массива в cookie |
74 | function delete_in_array(obj) { | 74 | function delete_in_array(obj) { |
75 | var arr = read_array(); | 75 | var arr = read_array(); |
76 | var unique = [...new Set(arr)] | 76 | var unique = [...new Set(arr)] |
77 | var index = unique.indexOf(obj); | 77 | var index = unique.indexOf(obj); |
78 | 78 | ||
79 | unique.splice(index, 1); | 79 | unique.splice(index, 1); |
80 | 80 | ||
81 | //var str = JSON.stringify(arr);//конвертируем в строку | 81 | //var str = JSON.stringify(arr);//конвертируем в строку |
82 | //$.cookie('arr',str);//записываем массив в куки | 82 | //$.cookie('arr',str);//записываем массив в куки |
83 | $.cookie('favorite_worker', JSON.stringify(unique)); | 83 | $.cookie('favorite_worker', JSON.stringify(unique)); |
84 | 84 | ||
85 | } | 85 | } |
86 | 86 | ||
87 | function read_array(){ | 87 | function read_array(){ |
88 | var dataArr=$.cookie('favorite_worker');//считываем данные из куков | 88 | var dataArr=$.cookie('favorite_worker');//считываем данные из куков |
89 | 89 | ||
90 | //если массив не был обнаружен, иницилизируем его | 90 | //если массив не был обнаружен, иницилизируем его |
91 | if(dataArr===null){ | 91 | if(dataArr===null){ |
92 | dataArr = init_array(); //возвращаем инициализированный пустой маасив | 92 | dataArr = init_array(); //возвращаем инициализированный пустой маасив |
93 | } | 93 | } |
94 | //возвращаем полученный массив | 94 | //возвращаем полученный массив |
95 | //return JSON.parse(dataArr); | 95 | //return JSON.parse(dataArr); |
96 | return JSON.parse(dataArr); | 96 | return JSON.parse(dataArr); |
97 | } | 97 | } |
98 | 98 | ||
99 | //другими словами создаем пустой массив | 99 | //другими словами создаем пустой массив |
100 | function init_array(){ | 100 | function init_array(){ |
101 | //var str = JSON.stringify(new Array());//конвертируем в строку | 101 | //var str = JSON.stringify(new Array());//конвертируем в строку |
102 | var str = JSON.stringify(new Array()); | 102 | var str = JSON.stringify(new Array()); |
103 | $.cookie('favorite_worker',str);//записываем массив в куки | 103 | $.cookie('favorite_worker',str);//записываем массив в куки |
104 | 104 | ||
105 | return str; | 105 | return str; |
106 | } | 106 | } |
107 | </script> | 107 | </script> |
108 | <script> | 108 | <script> |
109 | $(document).on('click', '.js_it_button', function() { | 109 | $(document).on('click', '.js_it_button', function() { |
110 | var this_ = $(this); | 110 | var this_ = $(this); |
111 | var code_user_id = this_.attr('data-uid'); | 111 | var code_user_id = this_.attr('data-uid'); |
112 | var code_to_user_id = this_.attr('data-tuid'); | 112 | var code_to_user_id = this_.attr('data-tuid'); |
113 | var code_vacancy = this_.attr('data-vacancy'); | 113 | var code_vacancy = this_.attr('data-vacancy'); |
114 | var user_id = $('#_user_id'); | 114 | var user_id = $('#_user_id'); |
115 | var to_user_id = $('#_to_user_id'); | 115 | var to_user_id = $('#_to_user_id'); |
116 | var vacancy = $('#_vacancy'); | 116 | var vacancy = $('#_vacancy'); |
117 | 117 | ||
118 | console.log('code_to_user_id='+code_to_user_id); | 118 | console.log('code_to_user_id='+code_to_user_id); |
119 | console.log('code_user_id='+code_user_id); | 119 | console.log('code_user_id='+code_user_id); |
120 | console.log('code_vacancy='+code_vacancy); | 120 | console.log('code_vacancy='+code_vacancy); |
121 | console.log('Клик на кнопке...'); | 121 | console.log('Клик на кнопке...'); |
122 | 122 | ||
123 | user_id.val(code_user_id); | 123 | user_id.val(code_user_id); |
124 | to_user_id.val(code_to_user_id); | 124 | to_user_id.val(code_to_user_id); |
125 | vacancy.val(code_vacancy); | 125 | vacancy.val(code_vacancy); |
126 | }); | 126 | }); |
127 | </script> | 127 | </script> |
128 | <script> | 128 | <script> |
129 | $(document).on('change', '#sort_ajax', function() { | 129 | $(document).on('change', '#sort_ajax', function() { |
130 | var this_ = $(this); | 130 | var this_ = $(this); |
131 | var val_ = this_.val(); | 131 | var val_ = this_.val(); |
132 | console.log('sort items '+val_); | 132 | console.log('sort items '+val_); |
133 | 133 | ||
134 | $.ajax({ | 134 | $.ajax({ |
135 | type: "GET", | 135 | type: "GET", |
136 | url: "{{ route('bd_resume') }}", | 136 | url: "{{ route('bd_resume') }}", |
137 | data: "sort="+val_+"&block=1", | 137 | data: "sort="+val_+"&block=1", |
138 | success: function (data) { | 138 | success: function (data) { |
139 | console.log('Выбор сортировки'); | 139 | console.log('Выбор сортировки'); |
140 | console.log(data); | 140 | console.log(data); |
141 | $('#block1').html(data); | 141 | $('#block1').html(data); |
142 | history.pushState({}, '', "{{ route('bd_resume') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | 142 | history.pushState({}, '', "{{ route('bd_resume') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); |
143 | }, | 143 | }, |
144 | headers: { | 144 | headers: { |
145 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 145 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
146 | }, | 146 | }, |
147 | error: function (data) { | 147 | error: function (data) { |
148 | data = JSON.stringify(data); | 148 | data = JSON.stringify(data); |
149 | console.log('Error: ' + data); | 149 | console.log('Error: ' + data); |
150 | } | 150 | } |
151 | }); | 151 | }); |
152 | }); | 152 | }); |
153 | 153 | ||
154 | $(document).ready(function(){ | 154 | $(document).ready(function(){ |
155 | var sel = $('#select2-sort_ajax-container'); | 155 | var sel = $('#select2-sort_ajax-container'); |
156 | var key = getUrlParameter('sort'); | 156 | var key = getUrlParameter('sort'); |
157 | console.log(sel); | 157 | console.log(sel); |
158 | console.log(key); | 158 | console.log(key); |
159 | 159 | ||
160 | if (key !=='') { | 160 | if (key !=='') { |
161 | console.log(key); | 161 | console.log(key); |
162 | switch (key) { | 162 | switch (key) { |
163 | case "default": sel.html('Сортировка (по умолчанию)'); break; | 163 | case "default": sel.html('Сортировка (по умолчанию)'); break; |
164 | case "name_up": sel.html('По имени (возрастание)'); break; | 164 | case "name_up": sel.html('По имени (возрастание)'); break; |
165 | case "name_down": sel.html('По дате (убывание)'); break; | 165 | case "name_down": sel.html('По дате (убывание)'); break; |
166 | case "created_at_up": sel.html('По дате (возрастание)'); break; | 166 | case "created_at_up": sel.html('По дате (возрастание)'); break; |
167 | case "created_at_down": sel.html('По дате (убывание)'); break; | 167 | case "created_at_down": sel.html('По дате (убывание)'); break; |
168 | } | 168 | } |
169 | 169 | ||
170 | } | 170 | } |
171 | }); | 171 | }); |
172 | </script> | 172 | </script> |
173 | 173 | ||
174 | <script> | 174 | <script> |
175 | console.log('Test system'); | 175 | console.log('Test system'); |
176 | $(document).on('change', '.jobs', function() { | 176 | $(document).on('change', '.jobs', function() { |
177 | var val = $(this).val(); | 177 | var val = $(this).val(); |
178 | 178 | ||
179 | console.log('Click filter вакансии...'); | 179 | console.log('Click filter вакансии...'); |
180 | $.ajax({ | 180 | $.ajax({ |
181 | type: "GET", | 181 | type: "GET", |
182 | url: "{{ route('bd_resume') }}", | 182 | url: "{{ route('bd_resume') }}", |
183 | data: "job="+val+'&block=1', | 183 | data: "job="+val+'&block=1', |
184 | success: function (data) { | 184 | success: function (data) { |
185 | console.log('Выбор должности'); | 185 | console.log('Выбор должности'); |
186 | console.log(data); | 186 | console.log(data); |
187 | $('#block1').html(data); | 187 | $('#block1').html(data); |
188 | history.pushState({}, '', "{{ route('bd_resume') }}?job="+val+"@if (isset($_GET['sort']))&sort={{ $_GET['sort'] }}@endif"+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | 188 | history.pushState({}, '', "{{ route('bd_resume') }}?job="+val+"@if (isset($_GET['sort']))&sort={{ $_GET['sort'] }}@endif"+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); |
189 | }, | 189 | }, |
190 | headers: { | 190 | headers: { |
191 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 191 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
192 | }, | 192 | }, |
193 | error: function (data) { | 193 | error: function (data) { |
194 | data = JSON.stringify(data); | 194 | data = JSON.stringify(data); |
195 | console.log('Error: ' + data); | 195 | console.log('Error: ' + data); |
196 | } | 196 | } |
197 | }); | 197 | }); |
198 | }); | 198 | }); |
199 | </script> | 199 | </script> |
200 | @include('js.favorite-worker') | 200 | @include('js.favorite-worker') |
201 | @endsection | 201 | @endsection |
202 | 202 | ||
203 | 203 | ||
204 | @section('content') | 204 | @section('content') |
205 | <section class="thing"> | 205 | <section class="thing"> |
206 | <div class="container"> | 206 | <div class="container"> |
207 | <form class="thing__body" action="{{ url()->current() }}"> | 207 | <form class="thing__body" action="{{ url()->current() }}"> |
208 | <ul class="breadcrumbs thing__breadcrumbs"> | 208 | <ul class="breadcrumbs thing__breadcrumbs"> |
209 | <li><a href="{{ route('index') }}">Главная</a></li> | 209 | <li><a href="{{ route('index') }}">Главная</a></li> |
210 | <li><b>База резюме</b></li> | 210 | <li><b>База резюме</b></li> |
211 | </ul> | 211 | </ul> |
212 | <h1 class="thing__title">База резюме</h1> | 212 | <h1 class="thing__title">База резюме</h1> |
213 | <p class="thing__text">С другой стороны, социально-экономическое развитие не оставляет шанса для | 213 | <p class="thing__text">С другой стороны, социально-экономическое развитие не оставляет шанса для |
214 | существующих финансовых и административных условий.</p> | 214 | существующих финансовых и административных условий.</p> |
215 | 215 | ||
216 | <div class="select select_search thing__select"> | 216 | <div class="select select_search thing__select"> |
217 | <div class="select__icon"> | 217 | <div class="select__icon"> |
218 | <svg> | 218 | <svg> |
219 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> | 219 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> |
220 | </svg> | 220 | </svg> |
221 | </div> | 221 | </div> |
222 | <select class="js-select2 jobs" name="search" id="search"> | 222 | <select class="js-select2 jobs" name="search" id="search"> |
223 | <option value="0">Выберите должность</option> | 223 | <option value="0">Выберите должность</option> |
224 | @if($Job_title->count()) | 224 | @if($Job_title->count()) |
225 | @foreach($Job_title as $JT) | 225 | @foreach($Job_title as $JT) |
226 | <option value="{{ $JT->id }}" @if (isset($_GET['job'])) @if($_GET['job'] == $JT->id) selected @endif @endif>{{ $JT->name }}</option> | 226 | <option value="{{ $JT->id }}" @if (isset($_GET['job'])) @if($_GET['job'] == $JT->id) selected @endif @endif>{{ $JT->name }}</option> |
227 | @endforeach | 227 | @endforeach |
228 | @endif | 228 | @endif |
229 | </select> | 229 | </select> |
230 | </div> | 230 | </div> |
231 | </form> | 231 | </form> |
232 | </div> | 232 | </div> |
233 | </section> | 233 | </section> |
234 | <main class="main"> | 234 | <main class="main"> |
235 | <div class="container"> | 235 | <div class="container"> |
236 | <div class="main__resume-base"> | 236 | <div class="main__resume-base"> |
237 | <h2>Резюме работников</h2> | 237 | <h2>Резюме работников</h2> |
238 | <div class="filters"> | 238 | <div class="filters"> |
239 | <div class="filters__label">Показано {{ $resumes->firstItem() }} – {{ $resumes->lastItem() }} из {{ $res_count }} результатов поиска</div> | 239 | <div class="filters__label">Показано {{ $resumes->firstItem() }} – {{ $resumes->lastItem() }} из {{ $res_count }} результатов поиска</div> |
240 | <div class="filters__body"> | 240 | <div class="filters__body"> |
241 | <div class="select filters__select"> | 241 | <div class="select filters__select"> |
242 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> | 242 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> |
243 | <option value="default">Сортировка (по умолчанию)</option> | 243 | <option value="all_workers">Все кандидаты</option> |
244 | <option value="name_up">По имени (возрастание)</option> | 244 | <option value="looking_for_work">Ищу работу</option> |
245 | <option value="name_down">По имени (убывание)</option> | 245 | <option value="considering_offers">Рассматриваю предложения</option> |
246 | <option value="created_at_up">По дате (возрастание)</option> | 246 | <option value="not_looking_for_work">Не ищу работу</option> |
247 | <option value="created_at_down">По дате (убывание)</option> | ||
248 | </select> | 247 | </select> |
249 | </div> | 248 | </div> |
250 | </div> | 249 | </div> |
251 | </div> | 250 | </div> |
252 | <div class="main__resume-base-body showed" data-body="1"> | 251 | <div class="main__resume-base-body showed" data-body="1"> |
253 | <div class="main__resume-base-body-one" id="block1" name="block1"> | 252 | <div class="main__resume-base-body-one" id="block1" name="block1"> |
254 | @include('resume.resume_blocks') | 253 | @include('resume.resume_blocks') |
255 | </div> | 254 | </div> |
256 | </div> | 255 | </div> |
257 | </div> | 256 | </div> |
258 | </div> | 257 | </div> |
259 | </main> | 258 | </main> |
260 | </div> | 259 | </div> |
261 | </div> | 260 | </div> |
262 | @endsection | 261 | @endsection |
263 | 262 |
resources/views/workers/form_basic_information.blade.php
1 | @extends('workers.cabinet_layout', ['title' => 'Основная информация - РекаМоре']) | 1 | @extends('workers.cabinet_layout', ['title' => 'Основная информация - РекаМоре']) |
2 | 2 | ||
3 | @section('cabinet_content') | 3 | @section('cabinet_content') |
4 | @php | 4 | @php |
5 | $worker = $user->workers[0] | 5 | $worker = $user->workers[0] |
6 | @endphp | 6 | @endphp |
7 | <form action="{{ route('worker.cabinet_save', ['worker' => $worker->id]) }}" enctype="multipart/form-data" method="POST"> | 7 | <form action="{{ route('worker.cabinet_save', ['worker' => $worker->id]) }}" enctype="multipart/form-data" method="POST"> |
8 | @csrf | 8 | @csrf |
9 | @include('messages_error') | 9 | @include('messages_error') |
10 | 10 | ||
11 | <div class="cabinet__body-item"> | 11 | <div class="cabinet__body-item"> |
12 | <div class="cabinet__anketa"> | 12 | <div class="cabinet__anketa"> |
13 | <h2 class="title cabinet__title">Основная информация</h2> | 13 | <h2 class="title cabinet__title">Основная информация</h2> |
14 | </div> | 14 | </div> |
15 | </div> | 15 | </div> |
16 | 16 | ||
17 | <div class="cabinet__body-item"> | 17 | <div class="cabinet__body-item"> |
18 | <div class="cabinet__inputs"> | 18 | <div class="cabinet__inputs"> |
19 | <div class="cabinet__inputs-item form-group"> | 19 | <div class="cabinet__inputs-item form-group"> |
20 | <label class="form-group__label">Фамилия:</label> | 20 | <label class="form-group__label">Фамилия:</label> |
21 | <div class="form-group__item"> | 21 | <div class="form-group__item"> |
22 | <input type="text" name="surname" id="surmane" class="input" value="{{ $user->surname }}" placeholder="Филиппов" required> | 22 | <input type="text" name="surname" id="surmane" class="input" value="{{ $user->surname }}" placeholder="Филиппов" required> |
23 | </div> | 23 | </div> |
24 | </div> | 24 | </div> |
25 | <div class="cabinet__inputs-item form-group"> | 25 | <div class="cabinet__inputs-item form-group"> |
26 | <label class="form-group__label">Имя:</label> | 26 | <label class="form-group__label">Имя:</label> |
27 | <div class="form-group__item"> | 27 | <div class="form-group__item"> |
28 | <input type="text" name="name_man" id="name_man" class="input" value="{{ $user->name_man }}" placeholder="Егор" required> | 28 | <input type="text" name="name_man" id="name_man" class="input" value="{{ $user->name_man }}" placeholder="Егор" required> |
29 | </div> | 29 | </div> |
30 | </div> | 30 | </div> |
31 | 31 | ||
32 | <div class="cabinet__inputs-item form-group"> | 32 | <div class="cabinet__inputs-item form-group"> |
33 | <label class="form-group__label">Отчество:</label> | 33 | <label class="form-group__label">Отчество:</label> |
34 | <div class="form-group__item"> | 34 | <div class="form-group__item"> |
35 | <input type="text" class="input" name="surname2" id="surmane2" value="{{ $user->surname2 }}" placeholder="Алексеевич"> | 35 | <input type="text" class="input" name="surname2" id="surmane2" value="{{ $user->surname2 }}" placeholder="Алексеевич"> |
36 | </div> | 36 | </div> |
37 | </div> | 37 | </div> |
38 | <div class="cabinet__inputs-item form-group"> | 38 | <div class="cabinet__inputs-item form-group"> |
39 | <label class="form-group__label">Возраст</label> | 39 | <label class="form-group__label">Возраст</label> |
40 | <div class="form-group__item"> | 40 | <div class="form-group__item"> |
41 | <input type="number" name="old_year" id="old_year" value="{{ $worker->old_year }}" class="input" placeholder="0" required> | 41 | <input type="number" name="old_year" id="old_year" value="{{ $worker->old_year }}" class="input" placeholder="0" required> |
42 | </div> | 42 | </div> |
43 | </div> | 43 | </div> |
44 | 44 | ||
45 | <div class="cabinet__inputs-item form-group"> | 45 | <div class="cabinet__inputs-item form-group"> |
46 | <label class="form-group__label">Статус</label> | 46 | <label class="form-group__label">Статус</label> |
47 | <div class="form-group__item"> | 47 | <div class="form-group__item"> |
48 | <div class="select"> | 48 | <div class="select"> |
49 | <select class="js-select2" name="status_work" id="status_work"> | 49 | <select class="js-select2" name="status_work" id="status_work"> |
50 | <option value="1" @if ($worker->status_work == 1) selected @endif>Не указано</option> | 50 | @foreach(App\Enums\WorkerStatuses::getWorkerStatuses() as $status_id => $status_label) |
51 | <option value="2" @if ($worker->status_work == 2) selected @endif>Не ищу работу</option> | 51 | <option value="{{ $status_id }}" @if ($worker->status_work == $status_id) selected @endif> {{ $status_label }} </option> |
52 | <option value="0" @if ($worker->status_work == 0) selected @endif>Ищу работу</option> | 52 | @endforeach |
53 | </select> | 53 | </select> |
54 | </div> | 54 | </div> |
55 | </div> | 55 | </div> |
56 | </div> | 56 | </div> |
57 | 57 | ||
58 | <div class="cabinet__inputs-item cabinet__inputs-item_max form-group cabinet__inputs-item-full-row"> | 58 | <div class="cabinet__inputs-item cabinet__inputs-item_max form-group cabinet__inputs-item-full-row"> |
59 | <label class="form-group__label">Желаемые вакансии:</label> | 59 | <label class="form-group__label">Желаемые вакансии:</label> |
60 | <div class="form-group__item"> | 60 | <div class="form-group__item"> |
61 | <div class="select"> | 61 | <div class="select"> |
62 | <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple"> | 62 | <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple"> |
63 | @if ($job_titles->count()) | 63 | @if ($job_titles->count()) |
64 | @foreach($job_titles as $job_title) | 64 | @foreach($job_titles as $job_title) |
65 | <option value="{{ $job_title->id }}" @if (in_array($job_title->id, $worker->job_titles)) selected @endif>{{ $job_title->name }}</option> | 65 | <option value="{{ $job_title->id }}" @if (in_array($job_title->id, $worker->job_titles)) selected @endif>{{ $job_title->name }}</option> |
66 | @endforeach | 66 | @endforeach |
67 | @endif | 67 | @endif |
68 | </select> | 68 | </select> |
69 | </div> | 69 | </div> |
70 | </div> | 70 | </div> |
71 | </div> | 71 | </div> |
72 | 72 | ||
73 | <div class="cabinet__inputs-item form-group"> | 73 | <div class="cabinet__inputs-item form-group"> |
74 | <label class="form-group__label">Пожелания к З/П:</label> | 74 | <label class="form-group__label">Пожелания к З/П:</label> |
75 | <div class="form-group__item"> | 75 | <div class="form-group__item"> |
76 | <input type="text" name="salary_expectations" id="salary_expectations" value="{{ $worker->salary_expectations }}" class="input" placeholder="От 150 000 руб"> | 76 | <input type="text" name="salary_expectations" id="salary_expectations" value="{{ $worker->salary_expectations }}" class="input" placeholder="От 150 000 руб"> |
77 | </div> | 77 | </div> |
78 | </div> | 78 | </div> |
79 | <div class="cabinet__inputs-item form-group"> | 79 | <div class="cabinet__inputs-item form-group"> |
80 | <label class="form-group__label">Опыт работы</label> | 80 | <label class="form-group__label">Опыт работы</label> |
81 | <div class="form-group__item"> | 81 | <div class="form-group__item"> |
82 | <div class="select"> | 82 | <div class="select"> |
83 | <select class="js-select2" id="experience" name="experience"> | 83 | <select class="js-select2" id="experience" name="experience"> |
84 | <option value="Не указано" @if (empty($worker->experience)) selected @endif>Не указано</option> | 84 | <option value="Не указано" @if (empty($worker->experience)) selected @endif>Не указано</option> |
85 | <option value="меньше 1 года" @if ($worker->experience == 'меньше 1 года') selected @endif>меньше 1 года</option> | 85 | <option value="меньше 1 года" @if ($worker->experience == 'меньше 1 года') selected @endif>меньше 1 года</option> |
86 | <option value="от 1 года до 3 лет" @if ($worker->experience == 'от 1 года до 3 лет') selected @endif>от 1 года до 3 лет</option> | 86 | <option value="от 1 года до 3 лет" @if ($worker->experience == 'от 1 года до 3 лет') selected @endif>от 1 года до 3 лет</option> |
87 | <option value="от 3 до 5 лет" @if ($worker->experience == 'от 3 до 5 лет') selected @endif>от 3 до 5 лет</option> | 87 | <option value="от 3 до 5 лет" @if ($worker->experience == 'от 3 до 5 лет') selected @endif>от 3 до 5 лет</option> |
88 | <option value="от 5 до 10 лет" @if ($worker->experience == 'от 5 до 10 лет') selected @endif>от 5 до 10 лет</option> | 88 | <option value="от 5 до 10 лет" @if ($worker->experience == 'от 5 до 10 лет') selected @endif>от 5 до 10 лет</option> |
89 | <option value="Больше 10 лет" @if ($worker->experience == 'Больше 10 лет') selected @endif>Больше 10 лет</option> | 89 | <option value="Больше 10 лет" @if ($worker->experience == 'Больше 10 лет') selected @endif>Больше 10 лет</option> |
90 | </select> | 90 | </select> |
91 | </div> | 91 | </div> |
92 | </div> | 92 | </div> |
93 | </div> | 93 | </div> |
94 | 94 | ||
95 | <div class="cabinet__inputs-item form-group"> | 95 | <div class="cabinet__inputs-item form-group"> |
96 | <label class="form-group__label">Уровень английского:</label> | 96 | <label class="form-group__label">Уровень английского:</label> |
97 | <div class="form-group__item"> | 97 | <div class="form-group__item"> |
98 | <input type="text" name="english_level" id="english_level" value="{{ $worker->english_level }}" class="input" placeholder="Средний"> | 98 | <input type="text" name="english_level" id="english_level" value="{{ $worker->english_level }}" class="input" placeholder="Средний"> |
99 | </div> | 99 | </div> |
100 | </div> | 100 | </div> |
101 | <div class="cabinet__inputs-item form-group"> | 101 | <div class="cabinet__inputs-item form-group"> |
102 | <label class="form-group__label">Дата готовности к посадке:</label> | 102 | <label class="form-group__label">Дата готовности к посадке:</label> |
103 | <div class="form-group__item"> | 103 | <div class="form-group__item"> |
104 | <input type="text" name="ready_boart_date" id="ready_boart_date" value="{{ $worker->ready_boart_date }}" class="input" placeholder="С 1 января {{ date('Y')}}"> | 104 | <input type="text" name="ready_boart_date" id="ready_boart_date" value="{{ $worker->ready_boart_date }}" class="input" placeholder="С 1 января {{ date('Y')}}"> |
105 | </div> | 105 | </div> |
106 | </div> | 106 | </div> |
107 | 107 | ||
108 | <div class="cabinet__inputs-item form-group"> | 108 | <div class="cabinet__inputs-item form-group"> |
109 | <label class="form-group__label">Предпочтение по типу судна:</label> | 109 | <label class="form-group__label">Предпочтение по типу судна:</label> |
110 | <div class="form-group__item"> | 110 | <div class="form-group__item"> |
111 | <input type="text" name="boart_type_preference" id="boart_type_preference" value="{{ $worker->boart_type_preference }}" class="input" placeholder="Балкер, сухогруз, контейнеровоз"> | 111 | <input type="text" name="boart_type_preference" id="boart_type_preference" value="{{ $worker->boart_type_preference }}" class="input" placeholder="Балкер, сухогруз, контейнеровоз"> |
112 | </div> | 112 | </div> |
113 | </div> | 113 | </div> |
114 | <div class="cabinet__inputs-item form-group"> | 114 | <div class="cabinet__inputs-item form-group"> |
115 | <label class="form-group__label">Наличие визы:</label> | 115 | <label class="form-group__label">Наличие визы:</label> |
116 | <div class="form-group__item"> | 116 | <div class="form-group__item"> |
117 | <input type="text" name="visa_available" id="visa_available" value="{{ $worker->visa_available }}" class="input" placeholder="Да"> | 117 | <input type="text" name="visa_available" id="visa_available" value="{{ $worker->visa_available }}" class="input" placeholder="Да"> |
118 | </div> | 118 | </div> |
119 | </div> | 119 | </div> |
120 | 120 | ||
121 | <div class="cabinet__inputs-item form-group"> | 121 | <div class="cabinet__inputs-item form-group"> |
122 | <label class="form-group__label">Наличие танкерных документов:</label> | 122 | <label class="form-group__label">Наличие танкерных документов:</label> |
123 | <div class="form-group__item"> | 123 | <div class="form-group__item"> |
124 | <input type="text" name="tanker_documents_available" id="tanker_documents_available" value="{{ $worker->tanker_documents_available }}" class="input" placeholder="Нет"> | 124 | <input type="text" name="tanker_documents_available" id="tanker_documents_available" value="{{ $worker->tanker_documents_available }}" class="input" placeholder="Нет"> |
125 | </div> | 125 | </div> |
126 | </div> | 126 | </div> |
127 | <div class="cabinet__inputs-item form-group"> | 127 | <div class="cabinet__inputs-item form-group"> |
128 | <label class="form-group__label">Наличие подтверждения для работы на ВВП:</label> | 128 | <label class="form-group__label">Наличие подтверждения для работы на ВВП:</label> |
129 | <div class="form-group__item"> | 129 | <div class="form-group__item"> |
130 | <input type="text" name="confirmation_work_for_vvp" id="confirmation_work_for_vvp" value="{{ $worker->confirmation_work_for_vvp }}" class="input" placeholder="Нет"> | 130 | <input type="text" name="confirmation_work_for_vvp" id="confirmation_work_for_vvp" value="{{ $worker->confirmation_work_for_vvp }}" class="input" placeholder="Нет"> |
131 | </div> | 131 | </div> |
132 | </div> | 132 | </div> |
133 | 133 | ||
134 | <div class="cabinet__inputs-item form-group"> | 134 | <div class="cabinet__inputs-item form-group"> |
135 | <label class="form-group__label">Наличие военного билета / приписного свидетельства:</label> | 135 | <label class="form-group__label">Наличие военного билета / приписного свидетельства:</label> |
136 | <div class="form-group__item"> | 136 | <div class="form-group__item"> |
137 | <input type="text" name="military_id_available" id="military_id_available" value="{{ $worker->military_id_available }}" class="input" placeholder="Нет"> | 137 | <input type="text" name="military_id_available" id="military_id_available" value="{{ $worker->military_id_available }}" class="input" placeholder="Нет"> |
138 | </div> | 138 | </div> |
139 | </div> | 139 | </div> |
140 | <div class="cabinet__inputs-item form-group"> | 140 | <div class="cabinet__inputs-item form-group"> |
141 | <label class="form-group__label">Город проживания:</label> | 141 | <label class="form-group__label">Город проживания:</label> |
142 | <div class="form-group__item"> | 142 | <div class="form-group__item"> |
143 | <input type="text" name="city" id="city" value="{{ $worker->city }}" class="input" placeholder="Челябинск" required> | 143 | <input type="text" name="city" id="city" value="{{ $worker->city }}" class="input" placeholder="Челябинск" required> |
144 | </div> | 144 | </div> |
145 | </div> | 145 | </div> |
146 | 146 | ||
147 | <div class="cabinet__inputs-item form-group"> | 147 | <div class="cabinet__inputs-item form-group"> |
148 | <label class="form-group__label">Телефон:</label> | 148 | <label class="form-group__label">Телефон:</label> |
149 | <div class="form-group__item"> | 149 | <div class="form-group__item"> |
150 | <input type="tel" name="telephone" id="telephone" value="{{ old('telephone') ?? $worker->telephone ?? '' }}" class="input" placeholder="+7 (___) ___-__-__" required> | 150 | <input type="tel" name="telephone" id="telephone" value="{{ old('telephone') ?? $worker->telephone ?? '' }}" class="input" placeholder="+7 (___) ___-__-__" required> |
151 | </div> | 151 | </div> |
152 | </div> | 152 | </div> |
153 | <div class="cabinet__inputs-item form-group"> | 153 | <div class="cabinet__inputs-item form-group"> |
154 | <label class="form-group__label">E-mail:</label> | 154 | <label class="form-group__label">E-mail:</label> |
155 | <div class="form-group__item"> | 155 | <div class="form-group__item"> |
156 | <input type="email" name="email" id="email" value="{{ $worker->email }}" class="input" placeholder="name@rekamore.su" required> | 156 | <input type="email" name="email" id="email" value="{{ $worker->email }}" class="input" placeholder="name@rekamore.su" required> |
157 | </div> | 157 | </div> |
158 | </div> | 158 | </div> |
159 | 159 | ||
160 | <div class="cabinet__inputs-item form-group"> | 160 | <div class="cabinet__inputs-item form-group"> |
161 | <label class="form-group__label">Контакты родственников:</label> | 161 | <label class="form-group__label">Контакты родственников:</label> |
162 | <div class="form-group__item"> | 162 | <div class="form-group__item"> |
163 | <input type="text" name="telephone2" id="telephon2" value="{{ old('telephone2') ?? $worker->telephone2 ?? '' }}" class="input"> | 163 | <input type="text" name="telephone2" id="telephon2" value="{{ old('telephone2') ?? $worker->telephone2 ?? '' }}" class="input"> |
164 | </div> | 164 | </div> |
165 | </div> | 165 | </div> |
166 | <div class="cabinet__inputs-item form-group"></div> | 166 | <div class="cabinet__inputs-item form-group"></div> |
167 | 167 | ||
168 | <div class="cabinet__body-item cabinet__inputs-item-full-row"> | 168 | <div class="cabinet__body-item cabinet__inputs-item-full-row"> |
169 | <h4 class="cabinet__h4">О себе</h4> | 169 | <h4 class="cabinet__h4">О себе</h4> |
170 | <textarea class="textarea" name="text" id="text" placeholder="Не указано">{{ $worker->text }}</textarea> | 170 | <textarea class="textarea" name="text" id="text" placeholder="Не указано">{{ $worker->text }}</textarea> |
171 | </div> | 171 | </div> |
172 | 172 | ||
173 | <div class="cabinet__body-item cabinet__inputs-item-full-row"> | 173 | <div class="cabinet__body-item cabinet__inputs-item-full-row"> |
174 | <div class="cabinet__buttons_flex"> | 174 | <div class="cabinet__buttons_flex"> |
175 | <button type="submit" class="button">Сохранить</button> | 175 | <button type="submit" class="button">Сохранить</button> |
176 | <a href="{{ route('worker.cabinet') }}" class="button button_light active">Отменить</a> | 176 | <a href="{{ route('worker.cabinet') }}" class="button button_light active">Отменить</a> |
177 | </div> | 177 | </div> |
178 | </div> | 178 | </div> |
179 | </div> | 179 | </div> |
180 | </div> | 180 | </div> |
181 | </form> | 181 | </form> |
182 | @endsection | 182 | @endsection |
183 | 183 |