Commit a30fa93a81cfeea0ddc99b3fad8de32af79049a0

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

Коммит от субботы

Showing 13 changed files Inline Diff

app/Http/Controllers/Admin/InfoBloksController.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\Models\infobloks; 6 use App\Models\infobloks;
7 use Illuminate\Http\Request; 7 use Illuminate\Http\Request;
8 8
9 class InfoBloksController extends Controller 9 class InfoBloksController extends Controller
10 { 10 {
11 /** 11 /**
12 * Display a listing of the resource. 12 * Display a listing of the resource.
13 * 13 *
14 * @return \Illuminate\Http\Response 14 * @return \Illuminate\Http\Response
15 */ 15 */
16 public function index() 16 public function index()
17 { 17 {
18 $infobloks = infobloks::query()->active()->orderByDesc('sort')->orderBy('name')->paginate(15); 18 $infobloks = infobloks::query()->
19 //active()->
20 orderByDesc('sort')->orderBy('name')->paginate(15);
19 return view('admin.infobloks.index', compact('infobloks')); 21 return view('admin.infobloks.index', compact('infobloks'));
20 } 22 }
21 23
22 /** 24 /**
23 * Show the form for creating a new resource. 25 * Show the form for creating a new resource.
24 * 26 *
25 * @return \Illuminate\Http\Response 27 * @return \Illuminate\Http\Response
26 */ 28 */
27 public function create() 29 public function create()
28 { 30 {
29 return view('admin.infobloks.add'); 31 return view('admin.infobloks.add');
30 } 32 }
31 33
32 /** 34 /**
33 * Store a newly created resource in storage. 35 * Store a newly created resource in storage.
34 * 36 *
35 * @param \Illuminate\Http\Request $request 37 * @param \Illuminate\Http\Request $request
36 * @return \Illuminate\Http\Response 38 * @return \Illuminate\Http\Response
37 */ 39 */
38 public function store(Request $request) 40 public function store(Request $request)
39 { 41 {
40 infobloks::create($request->all()); 42 infobloks::create($request->all());
41 return redirect()->route('admin.infobloks.index'); 43 return redirect()->route('admin.infobloks.index');
42 } 44 }
43 45
44 /** 46 /**
45 * Display the specified resource. 47 * Display the specified resource.
46 * 48 *
47 * @param \App\Models\infobloks $infobloks 49 * @param \App\Models\infobloks $infobloks
48 * @return \Illuminate\Http\Response 50 * @return \Illuminate\Http\Response
49 */ 51 */
50 public function show(infobloks $infobloks) 52 public function show(infobloks $infobloks)
51 { 53 {
52 // 54 //
53 } 55 }
54 56
55 /** 57 /**
56 * Show the form for editing the specified resource. 58 * Show the form for editing the specified resource.
57 * 59 *
58 * @param \App\Models\infobloks $infoblok 60 * @param \App\Models\infobloks $infoblok
59 * @return \Illuminate\Http\Response 61 * @return \Illuminate\Http\Response
60 */ 62 */
61 public function edit(infobloks $infoblok) 63 public function edit(infobloks $infoblok)
62 { 64 {
63 return view('admin.infobloks.edit', compact('infoblok')); 65 return view('admin.infobloks.edit', compact('infoblok'));
64 } 66 }
65 67
66 /** 68 /**
67 * Update the specified resource in storage. 69 * Update the specified resource in storage.
68 * 70 *
69 * @param \Illuminate\Http\Request $request 71 * @param \Illuminate\Http\Request $request
70 * @param \App\Models\infobloks $infobloks 72 * @param \App\Models\infobloks $infobloks
71 * @return \Illuminate\Http\Response 73 * @return \Illuminate\Http\Response
72 */ 74 */
73 public function update(Request $request, infobloks $infoblok) 75 public function update(Request $request, infobloks $infoblok)
74 { 76 {
75 $infoblok->update($request->all()); 77 $infoblok->update($request->all());
76 return redirect()->route('admin.infobloks.index'); 78 return redirect()->route('admin.infobloks.index');
77 } 79 }
78 80
79 /** 81 /**
80 * Remove the specified resource from storage. 82 * Remove the specified resource from storage.
81 * 83 *
82 * @param \App\Models\infobloks $infobloks 84 * @param \App\Models\infobloks $infobloks
83 * @return \Illuminate\Http\Response 85 * @return \Illuminate\Http\Response
84 */ 86 */
85 public function destroy(infobloks $infoblok) 87 public function destroy(infobloks $infoblok)
86 { 88 {
87 $infoblok->update(['is_remove' => 1]); 89 $infoblok->delete(); // update(['is_remove' => 1]);
88 return redirect()->route('admin.infobloks.index'); 90 return redirect()->route('admin.infobloks.index');
89 } 91 }
90 } 92 }
91 93
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) {
49 $id = $user->delete();
50
51 return redirect()->route('admin.users')->with('Пользователь был удален из системы');
52 }
53
48 public function index_bd(Request $request) { 54 public function index_bd(Request $request) {
49 $title = 'Админка - Пользователи базы данных'; 55 $title = 'Админка - Пользователи базы данных';
50 56
51 $find_key = ""; 57 $find_key = "";
52 $users = User::query(); 58 $users = User::query();
53 if (isset($request->find)) { 59 if (isset($request->find)) {
54 $find_key = $request->find; 60 $find_key = $request->find;
55 $users = $users->where('name', 'LIKE', "%$find_key%") 61 $users = $users->where('name', 'LIKE', "%$find_key%")
56 ->orWhere('email', 'LIKE', "%$find_key%") 62 ->orWhere('email', 'LIKE', "%$find_key%")
57 ->orWhere('telephone', 'LIKE', "%$find_key%"); 63 ->orWhere('telephone', 'LIKE', "%$find_key%");
58 } 64 }
59 65
60 $users = $users->Baseuser()->paginate(15); 66 $users = $users->Baseuser()->paginate(15);
61 67
62 if ($request->ajax()) { 68 if ($request->ajax()) {
63 return view('admin.users.index_bd_ajax', compact('users')); 69 return view('admin.users.index_bd_ajax', compact('users'));
64 } else { 70 } else {
65 return view('admin.users.index_bd', compact('users', 'title', 'find_key')); 71 return view('admin.users.index_bd', compact('users', 'title', 'find_key'));
66 } 72 }
67 } 73 }
68 74
69 public function add_bd() { 75 public function add_bd() {
70 $list_job_titles = Job_title::query()->active()->where('is_bd', '=' , '2')->orderBy('name', 'asc')->get(); 76 $list_job_titles = Job_title::query()->active()->where('is_bd', '=' , '2')->orderBy('name', 'asc')->get();
71 return view('admin.users.add', compact('list_job_titles')); 77 return view('admin.users.add', compact('list_job_titles'));
72 } 78 }
73 79
74 public function add_store_bd(BaseUserRequest $request) { 80 public function add_store_bd(BaseUserRequest $request) {
75 $params = $request->all(); 81 $params = $request->all();
76 $position_work = $request->position_work; 82 $position_work = $request->position_work;
77 83
78 if ($request->has('file')) { 84 if ($request->has('file')) {
79 $params['file'] = $request->file('file')->store('basedata', 'public'); 85 $params['file'] = $request->file('file')->store('basedata', 'public');
80 } 86 }
81 87
82 if (isset($request->name)) { 88 if (isset($request->name)) {
83 $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2; 89 $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2;
84 } 90 }
85 91
86 $user = User::create($params); 92 $user = User::create($params);
87 $user_id = $user->id; 93 $user_id = $user->id;
88 $worker = new Worker(); 94 $worker = new Worker();
89 $worker->position_work = $position_work; 95 $worker->position_work = $position_work;
90 $worker->user_id = $user_id; 96 $worker->user_id = $user_id;
91 $worker->save(); 97 $worker->save();
92 98
93 return redirect()->route('admin.basedata'); 99 return redirect()->route('admin.basedata');
94 } 100 }
95 101
96 public function edit_bd(User $user) { 102 public function edit_bd(User $user) {
97 $list_job_titles = Job_title::query()->active()->where('is_bd', '=' , '2')-> 103 $list_job_titles = Job_title::query()->active()->where('is_bd', '=' , '2')->
98 orderByDesc('sort')->orderBy('name', 'asc')->get(); 104 orderByDesc('sort')->orderBy('name', 'asc')->get();
99 return view('admin.users.edit', compact('user', 'list_job_titles')); 105 return view('admin.users.edit', compact('user', 'list_job_titles'));
100 } 106 }
101 107
102 public function update_bd(BaseUserRequest $request, User $user) { 108 public function update_bd(BaseUserRequest $request, User $user) {
103 $params = $request->all(); 109 $params = $request->all();
104 $position_work = $request->position_work; 110 $position_work = $request->position_work;
105 111
106 if ($request->has('file')) { 112 if ($request->has('file')) {
107 if (!empty($user->file)) Storage::delete($user->file); 113 if (!empty($user->file)) Storage::delete($user->file);
108 $params['file'] = $request->file('file')->store('basedata', 'public'); 114 $params['file'] = $request->file('file')->store('basedata', 'public');
109 } else { 115 } else {
110 if (!empty($user->image)) $params['file'] = $user->file; 116 if (!empty($user->image)) $params['file'] = $user->file;
111 } 117 }
112 118
113 if (isset($request->name)) { 119 if (isset($request->name)) {
114 $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2; 120 $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2;
115 } 121 }
116 122
117 $user->update($params); 123 $user->update($params);
118 if (isset($user->workers[0]->id)) { 124 if (isset($user->workers[0]->id)) {
119 $worker = Worker::find($user->workers[0]->id); 125 $worker = Worker::find($user->workers[0]->id);
120 $worker->position_work = $position_work; 126 $worker->position_work = $position_work;
121 $worker->save(); 127 $worker->save();
122 } else { 128 } else {
123 $worker = new Worker(); 129 $worker = new Worker();
124 $worker->user_id = $user->id; 130 $worker->user_id = $user->id;
125 $worker->position_work = $position_work; 131 $worker->position_work = $position_work;
126 $worker->save(); 132 $worker->save();
127 } 133 }
128 134
129 return redirect()->route('admin.basedata'); 135 return redirect()->route('admin.basedata');
130 } 136 }
131 137
132 public function destroy_bd(User $user) { 138 public function destroy_bd(User $user) {
133 $user->delete(); 139 $user->delete();
134 return redirect()->route('admin.basedata'); 140 return redirect()->route('admin.basedata');
135 } 141 }
136 142
137 public function roles(Request $request) { 143 public function roles(Request $request) {
138 if ($request->ajax()) { 144 if ($request->ajax()) {
139 $user = User::find($request->id); 145 $user = User::find($request->id);
140 $request->offsetUnset('id'); 146 $request->offsetUnset('id');
141 $user->update($request->all()); 147 $user->update($request->all());
142 } 148 }
143 149
144 $users = User::query()->Realuser()->paginate(15); 150 $users = User::query()->Realuser()->paginate(15);
145 151
146 if ($request->ajax()) { 152 if ($request->ajax()) {
147 return view('admin.users.roles.index_ajax', compact('users')); 153 return view('admin.users.roles.index_ajax', compact('users'));
148 } else { 154 } else {
149 return view('admin.users.roles.index', compact('users')); 155 return view('admin.users.roles.index', compact('users'));
150 } 156 }
151 } 157 }
152 158
153 public function admin_roles(Request $request) { 159 public function admin_roles(Request $request) {
154 160
155 if ($request->ajax()) { 161 if ($request->ajax()) {
156 $id = $request->id; 162 $id = $request->id;
157 $request->offsetUnset('id'); 163 $request->offsetUnset('id');
158 ContentRoles::where('id', '=', $id)->update($request->all()); 164 ContentRoles::where('id', '=', $id)->update($request->all());
159 } 165 }
160 $roles = ContentRoles::query()->OrderBy('id')->paginate(25); 166 $roles = ContentRoles::query()->OrderBy('id')->paginate(25);
161 167
162 168
163 if ($request->ajax()) { 169 if ($request->ajax()) {
164 return view('admin.content.roles_index_ajax', compact('roles')); 170 return view('admin.content.roles_index_ajax', compact('roles'));
165 } else { 171 } else {
166 return view('admin.content.roles_index', compact('roles')); 172 return view('admin.content.roles_index', compact('roles'));
167 } 173 }
168 } 174 }
169 175
170 public function doc_bd(User $user) { 176 public function doc_bd(User $user) {
171 $id = $user->id; 177 $id = $user->id;
172 $spreadsheet = new Spreadsheet(); 178 $spreadsheet = new Spreadsheet();
173 $activeWorksheet = $spreadsheet->getActiveSheet(); 179 $activeWorksheet = $spreadsheet->getActiveSheet();
174 $activeWorksheet->setCellValue('A1', 'Отчет по соискателю'); 180 $activeWorksheet->setCellValue('A1', 'Отчет по соискателю');
175 $activeWorksheet->getStyle('A1')->applyFromArray([ 181 $activeWorksheet->getStyle('A1')->applyFromArray([
176 'font' => [ 182 'font' => [
177 'name' => 'Arial', 183 'name' => 'Arial',
178 'bold' => true, 184 'bold' => true,
179 'italic' => false, 185 'italic' => false,
180 'underline' => Font::UNDERLINE_DOUBLE, 186 'underline' => Font::UNDERLINE_DOUBLE,
181 'strikethrough' => false, 187 'strikethrough' => false,
182 'color' => [ 188 'color' => [
183 'rgb' => '808080' 189 'rgb' => '808080'
184 ] 190 ]
185 ], 191 ],
186 'borders' => [ 192 'borders' => [
187 'allBorders' => [ 193 'allBorders' => [
188 'borderStyle' => Border::BORDER_THIN, 194 'borderStyle' => Border::BORDER_THIN,
189 'color' => [ 195 'color' => [
190 'rgb' => '808080' 196 'rgb' => '808080'
191 ] 197 ]
192 ], 198 ],
193 'outline' => array( 199 'outline' => array(
194 'style' => Border::BORDER_THIN, 200 'style' => Border::BORDER_THIN,
195 'color' => array('rgb' => '000000') 201 'color' => array('rgb' => '000000')
196 ), 202 ),
197 ], 203 ],
198 204
199 'alignment' => [ 205 'alignment' => [
200 'horizontal' => Alignment::HORIZONTAL_CENTER, 206 'horizontal' => Alignment::HORIZONTAL_CENTER,
201 'vertical' => Alignment::VERTICAL_CENTER, 207 'vertical' => Alignment::VERTICAL_CENTER,
202 'wrapText' => true, 208 'wrapText' => true,
203 ] 209 ]
204 ]); 210 ]);
205 211
206 $activeWorksheet->setCellValue('A2', "Псевдоним/имя: ".$user->name); 212 $activeWorksheet->setCellValue('A2', "Псевдоним/имя: ".$user->name);
207 $activeWorksheet->setCellValue('A3', "Фамилия: ".$user->surname); 213 $activeWorksheet->setCellValue('A3', "Фамилия: ".$user->surname);
208 $activeWorksheet->setCellValue('A4', "Имя: ".$user->name_man); 214 $activeWorksheet->setCellValue('A4', "Имя: ".$user->name_man);
209 $activeWorksheet->setCellValue('A5', "Отчество: ".$user->surname2); 215 $activeWorksheet->setCellValue('A5', "Отчество: ".$user->surname2);
210 $activeWorksheet->setCellValue('A6', "Телефон: ".$user->telephone); 216 $activeWorksheet->setCellValue('A6', "Телефон: ".$user->telephone);
211 $activeWorksheet->setCellValue('A7', "Емайл: ".$user->email); 217 $activeWorksheet->setCellValue('A7', "Емайл: ".$user->email);
212 218
213 if (isset($user->workers[0]->id)) { 219 if (isset($user->workers[0]->id)) {
214 $activeWorksheet->setCellValue('A9', "Анкета: "); 220 $activeWorksheet->setCellValue('A9', "Анкета: ");
215 $activeWorksheet->setCellValue('A10', "Телефон: " . $user->workers[0]->telephone); 221 $activeWorksheet->setCellValue('A10', "Телефон: " . $user->workers[0]->telephone);
216 $activeWorksheet->setCellValue('A11', "Емайл: " . $user->workers[0]->email); 222 $activeWorksheet->setCellValue('A11', "Емайл: " . $user->workers[0]->email);
217 } 223 }
218 224
219 if (isset($user->jobtitles[0]->id)) { 225 if (isset($user->jobtitles[0]->id)) {
220 $activeWorksheet->setCellValue('A12', "Должность: " . $user->jobtitles[0]->name); 226 $activeWorksheet->setCellValue('A12', "Должность: " . $user->jobtitles[0]->name);
221 } 227 }
222 $activeWorksheet->getColumnDimension("A")->setWidth(100); 228 $activeWorksheet->getColumnDimension("A")->setWidth(100);
223 $writer = new Xlsx($spreadsheet); 229 $writer = new Xlsx($spreadsheet);
224 230
225 header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); 231 header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
226 header('Content-Disposition: attachment; filename="user'.$id.'.xlsx"'); 232 header('Content-Disposition: attachment; filename="user'.$id.'.xlsx"');
227 header('Cache-Control: no-cache'); 233 header('Cache-Control: no-cache');
228 234
229 $writer->save('php://output'); 235 $writer->save('php://output');
230 $writer->save(storage_path("app/public/export/user$id.xlsx")); 236 $writer->save(storage_path("app/public/export/user$id.xlsx"));
231 237
232 //$spreadsheet->disconnectWorksheets(); 238 //$spreadsheet->disconnectWorksheets();
233 return redirect()->route('admin.basedata'); 239 return redirect()->route('admin.basedata');
234 240
235 } 241 }
236 } 242 }
237 243
app/Http/Controllers/CompanyController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers; 3 namespace App\Http\Controllers;
4 4
5 use App\Models\Ad_employer;
5 use App\Models\Employer; 6 use App\Models\Employer;
6 use Illuminate\Http\Request; 7 use Illuminate\Http\Request;
7 8
8 class CompanyController extends Controller 9 class CompanyController extends Controller
9 { 10 {
10 public function shipping_companies(Request $request) { 11 public function shipping_companies(Request $request) {
11 $emps = Employer::query()->with('ads')->where('status_hidden', '=', '0'); 12 $emps = Employer::query()->with('ads')->where('status_hidden', '=', '0');
12 if (($request->has('search')) && (!empty($request->get('search')))) { 13 if (($request->has('search')) && (!empty($request->get('search')))) {
13 $search = $request->get('search'); 14 $search = $request->get('search');
14 $emps = $emps->where('name_company', 'LIKE', "%$search%"); 15 $emps = $emps->where('name_company', 'LIKE', "%$search%");
15 } 16 }
16 17
17 $count_emps = $emps->count(); 18 $count_emps = $emps->count();
18 19
19 if ($request->get('sort')) { 20 if ($request->get('sort')) {
20 $sort = $request->get('sort'); 21 $sort = $request->get('sort');
21 switch ($sort) { 22 switch ($sort) {
22 case 'name_up': $emps = $emps->orderBy('name_company')->orderBy('id'); break; 23 case 'name_up': $emps = $emps->orderBy('name_company')->orderBy('id'); break;
23 case 'name_down': $emps = $emps->orderByDesc('name_company')->orderby('id'); break; 24 case 'name_down': $emps = $emps->orderByDesc('name_company')->orderby('id'); break;
24 case 'created_at_up': $emps = $emps->OrderBy('created_at')->orderBy('id'); break; 25 case 'created_at_up': $emps = $emps->OrderBy('created_at')->orderBy('id'); break;
25 case 'created_at_down': $emps = $emps->orderByDesc('created_at')->orderBy('id'); break; 26 case 'created_at_down': $emps = $emps->orderByDesc('created_at')->orderBy('id'); break;
26 case 'default': $emps = $emps->orderBy('id')->orderby('updated_at'); break; 27 case 'default': $emps = $emps->orderBy('id')->orderby('updated_at'); break;
27 default: $emps = $emps->orderBy('id')->orderby('updated_at'); break; 28 default: $emps = $emps->orderBy('id')->orderby('updated_at'); break;
28 } 29 }
29 } 30 }
30 31
31 $emps = $emps->paginate(4); 32 $emps = $emps->paginate(4);
32 33
33 34
34 if ($request->ajax()) { 35 if ($request->ajax()) {
35 if ($request->get('block') == '1') 36 if ($request->get('block') == '1')
36 return view('ajax.companies', compact('emps', 'count_emps')); 37 return view('ajax.companies', compact('emps', 'count_emps'));
37 else 38 else
38 return view('ajax.companies2', compact('emps', 'count_emps')); 39 return view('ajax.companies2', compact('emps', 'count_emps'));
39 } else { 40 } else {
40 return view('companies', compact('emps', 'count_emps')); 41 return view('companies', compact('emps', 'count_emps'));
41 } 42 }
42 } 43 }
43 44
44 public function info_company(Employer $company) { 45 public function info_company(Employer $company) {
45 if (isset(Auth()->user()->id)) { 46 if (isset(Auth()->user()->id)) {
46 $user_id = Auth()->user()->id; 47 $user_id = Auth()->user()->id;
47 } else { 48 } else {
48 $user_id = 0; 49 $user_id = 0;
49 } 50 }
50 $company = Employer::with('ads')->with('flots')->with('users') 51 $company = Employer::with('ads')->with('flots')->with('users')
51 ->where('id', '=', $company->id)->get(); 52 ->where('id', '=', $company->id)->get();
52 53
53 $title = $company[0]->name_company; 54 $title = $company[0]->name_company;
54 55
55 return view('info_company_new', compact('company', 'user_id', 'title')); 56 $ads = Ad_employer::query()->with('jobs')->with('jobs_code')->
57 OrderByDesc('id')->
58 where('employer_id', '=', $company[0]->id)->paginate(2);
59
60 return view('info_company_new', compact('company', 'user_id', 'title', 'ads'));
56 } 61 }
57 } 62 }
58 63
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\BaseUserRequest; 8 use App\Http\Requests\BaseUserRequest;
9 use App\Http\Requests\FlotRequest; 9 use App\Http\Requests\FlotRequest;
10 use App\Http\Requests\MessagesRequiest; 10 use App\Http\Requests\MessagesRequiest;
11 use App\Http\Requests\VacancyRequestEdit; 11 use App\Http\Requests\VacancyRequestEdit;
12 use App\Http\Requests\VacansiaRequiest; 12 use App\Http\Requests\VacansiaRequiest;
13 use App\Mail\MailSotrudnichestvo; 13 use App\Mail\MailSotrudnichestvo;
14 use App\Mail\SendAllMessages; 14 use App\Mail\SendAllMessages;
15 use App\Models\Ad_employer; 15 use App\Models\Ad_employer;
16 use App\Models\Ad_jobs; 16 use App\Models\Ad_jobs;
17 use App\Models\ad_response; 17 use App\Models\ad_response;
18 use App\Models\Category; 18 use App\Models\Category;
19 use App\Models\Education; 19 use App\Models\Education;
20 use App\Models\Employer; 20 use App\Models\Employer;
21 use App\Models\employers_main; 21 use App\Models\employers_main;
22 use App\Models\Flot; 22 use App\Models\Flot;
23 use App\Models\Job_title; 23 use App\Models\Job_title;
24 use App\Models\Like_vacancy; 24 use App\Models\Like_vacancy;
25 use App\Models\Like_worker; 25 use App\Models\Like_worker;
26 use App\Models\Message; 26 use App\Models\Message;
27 use App\Models\Positions; 27 use App\Models\Positions;
28 use App\Models\Worker; 28 use App\Models\Worker;
29 use Carbon\Carbon; 29 use Carbon\Carbon;
30 use Illuminate\Auth\Events\Registered; 30 use Illuminate\Auth\Events\Registered;
31 use Illuminate\Database\Eloquent\Builder; 31 use Illuminate\Database\Eloquent\Builder;
32 use Illuminate\Database\Eloquent\Model; 32 use Illuminate\Database\Eloquent\Model;
33 use Illuminate\Foundation\Auth\User; 33 use Illuminate\Foundation\Auth\User;
34 use Illuminate\Http\Request; 34 use Illuminate\Http\Request;
35 use Illuminate\Support\Facades\Auth; 35 use Illuminate\Support\Facades\Auth;
36 use Illuminate\Support\Facades\Hash; 36 use Illuminate\Support\Facades\Hash;
37 use Illuminate\Support\Facades\Mail; 37 use Illuminate\Support\Facades\Mail;
38 use Illuminate\Support\Facades\Storage; 38 use Illuminate\Support\Facades\Storage;
39 use App\Models\User as User_Model; 39 use App\Models\User as User_Model;
40 use Illuminate\Support\Facades\Validator; 40 use Illuminate\Support\Facades\Validator;
41 41
42 class EmployerController extends Controller 42 class EmployerController extends Controller
43 { 43 {
44 public function vacancie($vacancy, Request $request) { 44 public function vacancie($vacancy, Request $request) {
45 $title = 'Заголовок вакансии'; 45 $title = 'Заголовок вакансии';
46 $Query = Ad_employer::with('jobs')-> 46 $Query = Ad_employer::with('jobs')->
47 with('cat')-> 47 with('cat')->
48 with('employer')-> 48 with('employer')->
49 with('jobs_code')-> 49 with('jobs_code')->
50 select('ad_employers.*')-> 50 select('ad_employers.*')->
51 where('id', '=', $vacancy)->get(); 51 where('id', '=', $vacancy)->get();
52 52
53 if (isset(Auth()->user()->id)) 53 if (isset(Auth()->user()->id))
54 $uid = Auth()->user()->id; 54 $uid = Auth()->user()->id;
55 else 55 else
56 $uid = 0; 56 $uid = 0;
57 $title = $Query[0]->name; 57 $title = $Query[0]->name;
58 if ($request->ajax()) { 58 if ($request->ajax()) {
59 return view('ajax.vacance-item', compact('Query','uid')); 59 return view('ajax.vacance-item', compact('Query','uid'));
60 } else { 60 } else {
61 return view('vacance-item', compact('title', 'Query', 'uid')); 61 return view('vacance-item', compact('title', 'Query', 'uid'));
62 } 62 }
63 } 63 }
64 64
65 public function logout() { 65 public function logout() {
66 Auth::logout(); 66 Auth::logout();
67 return redirect()->route('index') 67 return redirect()->route('index')
68 ->with('success', 'Вы вышли из личного кабинета'); 68 ->with('success', 'Вы вышли из личного кабинета');
69 } 69 }
70 70
71 public function employer_info() { 71 public function employer_info() {
72 // код юзера 72 // код юзера
73 $user_info = Auth()->user(); 73 $user_info = Auth()->user();
74 // вьюшка для вывода данных 74 // вьюшка для вывода данных
75 return view('employers.info', compact('user_info')); 75 return view('employers.info', compact('user_info'));
76 } 76 }
77 77
78 public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { 78 public function employer_info_save(User_Model $user, BaseUser_min_Request $request) {
79 // Все данные через реквест 79 // Все данные через реквест
80 $all = $request->all(); 80 $all = $request->all();
81 unset($all['_token']); 81 unset($all['_token']);
82 // обновление 82 // обновление
83 $user->update($all); 83 $user->update($all);
84 return redirect()->route('employer.employer_info'); 84 return redirect()->route('employer.employer_info');
85 } 85 }
86 86
87 public function cabinet() { 87 public function cabinet() {
88 $id = Auth()->user()->id; 88 $id = Auth()->user()->id;
89 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 89 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
90 WhereHas('users', 90 WhereHas('users',
91 function (Builder $query) use ($id) {$query->Where('id', $id); 91 function (Builder $query) use ($id) {$query->Where('id', $id);
92 })->get(); 92 })->get();
93 return view('employers.cabinet45', compact('Employer')); 93 return view('employers.cabinet45', compact('Employer'));
94 } 94 }
95 95
96 public function slider_flot() { 96 public function slider_flot() {
97 $id = Auth()->user()->id; 97 $id = Auth()->user()->id;
98 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 98 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
99 WhereHas('users', 99 WhereHas('users',
100 function (Builder $query) use ($id) {$query->Where('id', $id); 100 function (Builder $query) use ($id) {$query->Where('id', $id);
101 })->get(); 101 })->get();
102 return view('employers.fly-flot', compact('Employer')); 102 return view('employers.fly-flot', compact('Employer'));
103 } 103 }
104 104
105 public function cabinet_save(Employer $Employer, Request $request) { 105 public function cabinet_save(Employer $Employer, Request $request) {
106 $params = $request->all(); 106 $params = $request->all();
107 $params['user_id'] = Auth()->user()->id; 107 $params['user_id'] = Auth()->user()->id;
108 $id = $Employer->id; 108 $id = $Employer->id;
109 109
110 if ($request->has('logo')) { 110 if ($request->has('logo')) {
111 if (!empty($Employer->logo)) { 111 if (!empty($Employer->logo)) {
112 Storage::delete($Employer->logo); 112 Storage::delete($Employer->logo);
113 } 113 }
114 $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); 114 $params['logo'] = $request->file('logo')->store("employer/$id", 'public');
115 } 115 }
116 116
117 $Employer->update($params); 117 $Employer->update($params);
118 118
119 return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); 119 return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены');
120 } 120 }
121 121
122 public function save_add_flot(FlotRequest $request) { 122 public function save_add_flot(FlotRequest $request) {
123 // отмена 123 // отмена
124 $params = $request->all(); 124 $params = $request->all();
125 125
126 if ($request->has('image')) { 126 if ($request->has('image')) {
127 $params['image'] = $request->file('image')->store("flot", 'public'); 127 $params['image'] = $request->file('image')->store("flot", 'public');
128 } 128 }
129 Flot::create($params); 129 Flot::create($params);
130 $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); 130 $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get();
131 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); 131 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен');
132 } 132 }
133 133
134 public function edit_flot(Flot $Flot, Employer $Employer) { 134 public function edit_flot(Flot $Flot, Employer $Employer) {
135 return view('employers.edit-flot', compact('Flot', 'Employer')); 135 return view('employers.edit-flot', compact('Flot', 'Employer'));
136 } 136 }
137 137
138 public function update_flot(FlotRequest $request, Flot $Flot) { 138 public function update_flot(FlotRequest $request, Flot $Flot) {
139 $params = $request->all(); 139 $params = $request->all();
140 140
141 if ($request->has('image')) { 141 if ($request->has('image')) {
142 if (!empty($flot->image)) { 142 if (!empty($flot->image)) {
143 Storage::delete($flot->image); 143 Storage::delete($flot->image);
144 } 144 }
145 $params['image'] = $request->file('image')->store("flot", 'public'); 145 $params['image'] = $request->file('image')->store("flot", 'public');
146 } else { 146 } else {
147 if (!empty($flot->image)) $params['image'] = $flot->image; 147 if (!empty($flot->image)) $params['image'] = $flot->image;
148 } 148 }
149 149
150 $Flot->update($params); 150 $Flot->update($params);
151 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); 151 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен');
152 } 152 }
153 153
154 public function delete_flot(Flot $Flot) { 154 public function delete_flot(Flot $Flot) {
155 $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); 155 $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get();
156 156
157 if (isset($Flot->id)) $Flot->delete(); 157 if (isset($Flot->id)) $Flot->delete();
158 return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); 158 return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален');
159 } 159 }
160 160
161 // Форма добавления вакансий 161 // Форма добавления вакансий
162 public function cabinet_vacancie() { 162 public function cabinet_vacancie() {
163 $id = Auth()->user()->id; 163 $id = Auth()->user()->id;
164 164
165 if (Auth()->user()->is_public) { 165 if (Auth()->user()->is_public) {
166 $categories = Category::query()->active()->get(); 166 $categories = Category::query()->active()->get();
167
168 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> 167 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')->
169 where('is_remove', '=', '0')-> 168 where('is_remove', '=', '0')->
170 where('is_bd', '=', '0')-> 169 where('is_bd', '=', '0')->
171 get(); 170 get();
172 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 171 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
173
174 WhereHas('users', 172 WhereHas('users',
175 function (Builder $query) use ($id) { 173 function (Builder $query) use ($id) {
176 $query->Where('id', $id); 174 $query->Where('id', $id);
177 })->get(); 175 })->get();
178
179 return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); 176 return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories'));
180 } else { 177 } else {
181 return redirect()->route('employer.cabinet_vacancie_danger'); 178 return redirect()->route('employer.cabinet_vacancie_danger');
182 } 179 }
183 } 180 }
184 181
185 // Форма предупреждения об оплате 182 // Форма предупреждения об оплате
186 public function cabinet_vacancie_danger() { 183 public function cabinet_vacancie_danger() {
187 return view('employers.add_vacancy_danger'); 184 return view('employers.add_vacancy_danger');
188 } 185 }
189 186
190 // Сохранение вакансии 187 // Сохранение вакансии
191 public function cabinet_vacancy_save1(VacancyRequestEdit $request) { 188 public function cabinet_vacancy_save1(VacancyRequestEdit $request) {
192 $params_emp = $request->all(); 189 $params_emp = $request->all();
193 190
194 $params_job["job_title_id"] = $params_emp['job_title_id']; 191 $params_job["job_title_id"] = $params_emp['job_title_id'];
195 //$params_job["min_salary"] = $params_emp['min_salary']; 192 //$params_job["min_salary"] = $params_emp['min_salary'];
196 //$params_job["max_salary"] = $params_emp['max_salary']; 193 //$params_job["max_salary"] = $params_emp['max_salary'];
197 //$params_job["region"] = $params_emp['region']; 194 //$params_job["region"] = $params_emp['region'];
198 //$params_job["power"] = $params_emp['power']; 195 //$params_job["power"] = $params_emp['power'];
199 //$params_job["sytki"] = $params_emp['sytki']; 196 //$params_job["sytki"] = $params_emp['sytki'];
200 //$params_job["start"] = $params_emp['start']; 197 //$params_job["start"] = $params_emp['start'];
201 //$params_job["flot"] = $params_emp['flot']; 198 //$params_job["flot"] = $params_emp['flot'];
202 //$params_job["description"] = $params_emp['description']; 199 //$params_job["description"] = $params_emp['description'];
203 200
204 $ad_jobs = Ad_employer::create($params_emp); 201 $ad_jobs = Ad_employer::create($params_emp);
205 //$params_job['ad_employer_id'] = $ad_jobs->id; 202 //$params_job['ad_employer_id'] = $ad_jobs->id;
206 //Ad_jobs::create($params_job); 203 //Ad_jobs::create($params_job);
207 $ad_jobs->jobs()->sync($request->get('job_title_id')); 204 $ad_jobs->jobs()->sync($request->get('job_title_id'));
208 205
209 return redirect()->route('employer.vacancy_list'); 206 return redirect()->route('employer.vacancy_list');
210 } 207 }
211 208
212 // Список вакансий 209 // Список вакансий
213 public function vacancy_list(Request $request) { 210 public function vacancy_list(Request $request) {
214 $id = Auth()->user()->id; 211 $id = Auth()->user()->id;
215 212
216 //dd($request->all()); 213 //dd($request->all());
217 $Employer = Employer::query()->where('user_id', $id)->first(); 214 $Employer = Employer::query()->where('user_id', $id)->first();
218 $vacancy_list = Ad_employer::query()->with('jobs')-> 215 $vacancy_list = Ad_employer::query()->with('jobs')->
219 with('jobs_code')-> 216 with('jobs_code')->
220 where('employer_id', $Employer->id); 217 where('employer_id', $Employer->id);
221 218
222 if (($request->has('search')) && (!empty($request->get('search')))) { 219 if (($request->has('search')) && (!empty($request->get('search')))) {
223 $search = $request->get('search'); 220 $search = $request->get('search');
224 $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); 221 $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%");
225 } 222 }
226 223
227 if ($request->get('sort')) { 224 if ($request->get('sort')) {
228 $sort = $request->get('sort'); 225 $sort = $request->get('sort');
229 switch ($sort) { 226 switch ($sort) {
230 case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; 227 case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break;
231 case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; 228 case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break;
232 case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; 229 case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break;
233 case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; 230 case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break;
234 case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; 231 case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break;
235 default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; 232 default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break;
236 } 233 }
237 } 234 }
238 $vacancy_list = $vacancy_list->paginate(4); 235 $vacancy_list = $vacancy_list->paginate(4);
239 236
240 //ajax 237 //ajax
241 if ($request->ajax()) { 238 if ($request->ajax()) {
242 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); 239 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer'));
243 } else { 240 } else {
244 return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); 241 return view('employers.list_vacancy', compact('vacancy_list', 'Employer'));
245 } 242 }
246 } 243 }
247 244
248 // Карточка вакансии 245 // Карточка вакансии
249 public function vacancy_edit(Ad_employer $ad_employer) { 246 public function vacancy_edit(Ad_employer $ad_employer) {
250 $id = Auth()->user()->id; 247 $id = Auth()->user()->id;
251 $Positions = Category::query()->where('is_remove', '=', '0')->get(); 248 $Positions = Category::query()->where('is_remove', '=', '0')->get();
252 249
253 $jobs = Job_title::query()->OrderBy('name')-> 250 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')->
254 where('is_remove', 0)->where('is_bd', '=' , '0')->get(); 251 where('is_remove', '=', '0')->
255
256
257 $jobs = Job_title::query()->OrderBy('name')->where('is_remove', 0)->get(); 252 where('is_bd', '=', '0')->get();
253
254 $Employer = Employer::query()->with('users')->with('ads')->
258 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 255 with('flots')->where('user_id', $id)->first();
259 where('user_id', $id)->first(); 256
260 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); 257 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs'));
261 } 258 }
262 259
263 // Сохранение-редактирование записи 260 // Сохранение-редактирование записи
261 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) {
264 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { 262 $params = $request->all();
265 $params = $request->all(); 263 $params_job["job_title_id"] = $params['job_title_id'];
266 264
267 //$jobs['flot'] = $params['flot']; 265 //$jobs['flot'] = $params['flot'];
268 //$jobs['job_title_id'] = $params['job_title_id']; 266 //$jobs['job_title_id'] = $params['job_title_id'];
269 //$titles['position_id'] = $params['position_id']; 267 //$titles['position_id'] = $params['position_id'];
270 //unset($params['job_title_id']); 268 //unset($params['job_title_id']);
269
271 270 $ad_employer->update($params);
272 $ad_employer->update($params); 271 $ad_employer->jobs()->sync($request->get('job_title_id'));
273 272
274 //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> 273 //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])->
275 // where('ad_employer_id', $ad_employer->id)->first(); 274 // where('ad_employer_id', $ad_employer->id)->first();
276 //$data = Ad_jobs::find($job_->id); 275 //$data = Ad_jobs::find($job_->id);
277 //$ad_jobs = $data->update($jobs); 276 //$ad_jobs = $data->update($jobs);
278 return redirect()->route('employer.vacancy_list'); 277 return redirect()->route('employer.vacancy_list');
279 } 278 }
280 279
281 // Сохранение карточки вакансии 280 // Сохранение карточки вакансии
282 public function vacancy_save(Request $request, Ad_employer $ad_employer) { 281 public function vacancy_save(Request $request, Ad_employer $ad_employer) {
283 $all = $request->all(); 282 $all = $request->all();
284 $ad_employer->update($all); 283 $ad_employer->update($all);
285 return redirect()->route('employer.cabinet_vacancie'); 284 return redirect()->route('employer.cabinet_vacancie');
286 } 285 }
287 286
288 // Удаление карточки вакансии 287 // Удаление карточки вакансии
289 public function vacancy_delete(Ad_employer $ad_employer) { 288 public function vacancy_delete(Ad_employer $ad_employer) {
290 $ad_employer->delete(); 289 $ad_employer->delete();
291 290
292 return redirect()->route('employer.vacancy_list') 291 return redirect()->route('employer.vacancy_list')
293 ->with('success', 'Данные были успешно сохранены'); 292 ->with('success', 'Данные были успешно сохранены');
294 } 293 }
295 294
296 // Обновление даты 295 // Обновление даты
297 public function vacancy_up(Ad_employer $ad_employer) { 296 public function vacancy_up(Ad_employer $ad_employer) {
298 $up = date('m/d/Y h:i:s', time());; 297 $up = date('m/d/Y h:i:s', time());;
299 $vac_emp = Ad_employer::findOrFail($ad_employer->id); 298 $vac_emp = Ad_employer::findOrFail($ad_employer->id);
300 $vac_emp->updated_at = $up; 299 $vac_emp->updated_at = $up;
301 $vac_emp->save(); 300 $vac_emp->save();
302 301
303 return redirect()->route('employer.vacancy_list'); 302 return redirect()->route('employer.vacancy_list');
304 // начало конца 303 // начало конца
305 } 304 }
306 305
307 //Видимость вакансии 306 //Видимость вакансии
308 public function vacancy_eye(Ad_employer $ad_employer, $status) { 307 public function vacancy_eye(Ad_employer $ad_employer, $status) {
309 $vac_emp = Ad_employer::findOrFail($ad_employer->id); 308 $vac_emp = Ad_employer::findOrFail($ad_employer->id);
310 $vac_emp->active_is = $status; 309 $vac_emp->active_is = $status;
311 $vac_emp->save(); 310 $vac_emp->save();
312 311
313 return redirect()->route('employer.vacancy_list'); 312 return redirect()->route('employer.vacancy_list');
314 } 313 }
315 314
316 //Вакансия редактирования (шаблон) 315 //Вакансия редактирования (шаблон)
317 public function vacancy_update(Ad_employer $id) { 316 public function vacancy_update(Ad_employer $id) {
318 317
319 } 318 }
320 319
321 //Отклики на вакансию - лист 320 //Отклики на вакансию - лист
322 public function answers(Employer $employer, Request $request) { 321 public function answers(Employer $employer, Request $request) {
323 $user_id = Auth()->user()->id; 322 $user_id = Auth()->user()->id;
324 $answer = Ad_employer::query()->where('employer_id', $employer->id); 323 $answer = Ad_employer::query()->where('employer_id', $employer->id);
325 if ($request->has('search')) { 324 if ($request->has('search')) {
326 $search = trim($request->get('search')); 325 $search = trim($request->get('search'));
327 if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); 326 if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%");
328 } 327 }
329 328
330 $answer = $answer->with('response')->OrderByDESC('id')->get(); 329 $answer = $answer->with('response')->OrderByDESC('id')->get();
331 330
332 return view('employers.list_answer', compact('answer', 'user_id', 'employer')); 331 return view('employers.list_answer', compact('answer', 'user_id', 'employer'));
333 } 332 }
334 333
335 //Обновление статуса 334 //Обновление статуса
336 public function supple_status(employer $employer, ad_response $ad_response, $flag) { 335 public function supple_status(employer $employer, ad_response $ad_response, $flag) {
337 $ad_response->update(Array('flag' => $flag)); 336 $ad_response->update(Array('flag' => $flag));
338 return redirect()->route('employer.answers', ['employer' => $employer->id]); 337 return redirect()->route('employer.answers', ['employer' => $employer->id]);
339 } 338 }
340 339
341 //Страницы сообщений список 340 //Страницы сообщений список
342 public function messages($type_message) { 341 public function messages($type_message) {
343 $user_id = Auth()->user()->id; 342 $user_id = Auth()->user()->id;
344 343
345 $messages_input = Message::query()->with('vacancies')->with('user_from')-> 344 $messages_input = Message::query()->with('vacancies')->with('user_from')->
346 Where('to_user_id', $user_id)->OrderByDesc('created_at'); 345 Where('to_user_id', $user_id)->OrderByDesc('created_at');
347 346
348 $messages_output = Message::query()->with('vacancies')-> 347 $messages_output = Message::query()->with('vacancies')->
349 with('user_to')->where('user_id', $user_id)-> 348 with('user_to')->where('user_id', $user_id)->
350 OrderByDesc('created_at'); 349 OrderByDesc('created_at');
351 350
352 $count_input = $messages_input->count(); 351 $count_input = $messages_input->count();
353 $count_output = $messages_output->count(); 352 $count_output = $messages_output->count();
354 353
355 if ($type_message == 'input') { 354 if ($type_message == 'input') {
356 $messages = $messages_input->paginate(5); 355 $messages = $messages_input->paginate(5);
357 } 356 }
358 357
359 if ($type_message == 'output') { 358 if ($type_message == 'output') {
360 $messages = $messages_output->paginate(5); 359 $messages = $messages_output->paginate(5);
361 } 360 }
362 361
363 //dd($user_id, $messages[2]->vacancies); 362 //dd($user_id, $messages[2]->vacancies);
364 //jobs); 363 //jobs);
365 364
366 return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); 365 return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id'));
367 } 366 }
368 367
369 // Диалог между пользователями 368 // Диалог между пользователями
370 public function dialog(Request $request, User_Model $user1, User_Model $user2) { 369 public function dialog(Request $request, User_Model $user1, User_Model $user2) {
371 // Получение параметров. 370 // Получение параметров.
372 if ($request->has('ad_employer')){ 371 if ($request->has('ad_employer')){
373 $ad_employer = $request->get('ad_employer'); 372 $ad_employer = $request->get('ad_employer');
374 } else { 373 } else {
375 $ad_employer = 0; 374 $ad_employer = 0;
376 } 375 }
377 376
378 if (isset($user2->id)) { 377 if (isset($user2->id)) {
379 $companion = User_Model::query()->with('workers')-> 378 $companion = User_Model::query()->with('workers')->
380 with('employers')-> 379 with('employers')->
381 where('id', $user2->id)->first(); 380 where('id', $user2->id)->first();
382 } 381 }
383 382
384 $Messages = Message::query()-> 383 $Messages = Message::query()->
385 where('ad_employer_id', '=', $ad_employer)-> 384 where('ad_employer_id', '=', $ad_employer)->
386 where(function($query) use ($user1, $user2) { 385 where(function($query) use ($user1, $user2) {
387 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); 386 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id);
388 })->orWhere(function($query) use ($user1, $user2) { 387 })->orWhere(function($query) use ($user1, $user2) {
389 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); 388 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id);
390 })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get(); 389 })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get();
391 390
392 $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; 391 $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id;
393 392
394 //$ad_employer = null; 393 //$ad_employer = null;
395 //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); 394 //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first();
396 $sender = $user1; 395 $sender = $user1;
397 396
398 return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); 397 return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages'));
399 } 398 }
400 399
401 // Регистрация работодателя 400 // Регистрация работодателя
402 public function register_employer(Request $request) { 401 public function register_employer(Request $request) {
403 $params = $request->all(); 402 $params = $request->all();
404 403
405 $rules = [ 404 $rules = [
406 //'surname' => ['required', 'string', 'max:255'], 405 //'surname' => ['required', 'string', 'max:255'],
407 //'name_man' => ['required', 'string', 'max:255'], 406 //'name_man' => ['required', 'string', 'max:255'],
408 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 407 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
409 'name_company' => ['required', 'string', 'max:255'], 408 'name_company' => ['required', 'string', 'max:255'],
410 'password' => ['required', 'string', 'min:6'], 409 'password' => ['required', 'string', 'min:6'],
411 ]; 410 ];
412 411
413 412
414 $messages = [ 413 $messages = [
415 'required' => 'Укажите обязательное поле', 414 'required' => 'Укажите обязательное поле',
416 'min' => [ 415 'min' => [
417 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 416 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
418 'integer' => 'Поле «:attribute» должно быть :min или больше', 417 'integer' => 'Поле «:attribute» должно быть :min или больше',
419 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 418 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
420 ], 419 ],
421 'max' => [ 420 'max' => [
422 'string' => 'Поле «:attribute» должно быть не больше :max символов', 421 'string' => 'Поле «:attribute» должно быть не больше :max символов',
423 'integer' => 'Поле «:attribute» должно быть :max или меньше', 422 'integer' => 'Поле «:attribute» должно быть :max или меньше',
424 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 423 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
425 ] 424 ]
426 ]; 425 ];
427 426
428 $email = $request->get('email'); 427 $email = $request->get('email');
429 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { 428 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) {
430 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); 429 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл"));
431 } 430 }
432 431
433 if ($request->get('password') !== $request->get('confirmed')){ 432 if ($request->get('password') !== $request->get('confirmed')){
434 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); 433 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля"));
435 } 434 }
436 435
437 if (strlen($request->get('password')) < 6) { 436 if (strlen($request->get('password')) < 6) {
438 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); 437 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!"));
439 } 438 }
440 /* 439 /*
441 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); 440 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?');
442 $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 441 $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z',
443 'X', 'C', 'V', 'B', 'N', 'M'); 442 'X', 'C', 'V', 'B', 'N', 'M');
444 $spec_bool = false; 443 $spec_bool = false;
445 $alpha_bool = false; 444 $alpha_bool = false;
446 445
447 $haystack = $request->get('password'); 446 $haystack = $request->get('password');
448 447
449 foreach ($specsumbol as $it) { 448 foreach ($specsumbol as $it) {
450 if (strpos($haystack, $it) !== false) { 449 if (strpos($haystack, $it) !== false) {
451 $spec_bool = true; 450 $spec_bool = true;
452 } 451 }
453 } 452 }
454 453
455 foreach ($alpha as $it) { 454 foreach ($alpha as $it) {
456 if (strpos($haystack, $it) !== false) { 455 if (strpos($haystack, $it) !== false) {
457 $alpha_bool = true; 456 $alpha_bool = true;
458 } 457 }
459 } 458 }
460 459
461 if ((!$spec_bool) || (!$alpha_bool)) { 460 if ((!$spec_bool) || (!$alpha_bool)) {
462 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); 461 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?"));
463 }*/ 462 }*/
464 463
465 if (empty($request->get('surname'))) { 464 if (empty($request->get('surname'))) {
466 $params['surname'] = 'Неизвестно'; 465 $params['surname'] = 'Неизвестно';
467 } 466 }
468 if (empty($request->get('name_man'))) { 467 if (empty($request->get('name_man'))) {
469 $params['name_man'] = 'Неизвестно'; 468 $params['name_man'] = 'Неизвестно';
470 } 469 }
471 $validator = Validator::make($params, $rules, $messages); 470 $validator = Validator::make($params, $rules, $messages);
472 471
473 if ($validator->fails()) { 472 if ($validator->fails()) {
474 return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); 473 return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе."));
475 } else { 474 } else {
476 $user = $this->create($params); 475 $user = $this->create($params);
477 event(new Registered($user)); 476 event(new Registered($user));
478 Auth::guard()->login($user); 477 Auth::guard()->login($user);
479 } 478 }
480 479
481 if ($user) { 480 if ($user) {
482 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; 481 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));;
483 } else { 482 } else {
484 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); 483 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!"));
485 } 484 }
486 } 485 }
487 486
488 // Создание пользователя 487 // Создание пользователя
489 protected function create(array $data) 488 protected function create(array $data)
490 { 489 {
491 $Use = new User_Model(); 490 $Use = new User_Model();
492 $Code_user = $Use->create([ 491 $Code_user = $Use->create([
493 'name' => $data['surname']." ".$data['name_man'], 492 'name' => $data['surname']." ".$data['name_man'],
494 'name_man' => $data['name_man'], 493 'name_man' => $data['name_man'],
495 'surname' => $data['surname'], 494 'surname' => $data['surname'],
496 'surname2' => $data['surname2'], 495 'surname2' => $data['surname2'],
497 'subscribe_email' => $data['email'], 496 'subscribe_email' => $data['email'],
498 'email' => $data['email'], 497 'email' => $data['email'],
499 'telephone' => $data['telephone'], 498 'telephone' => $data['telephone'],
500 'is_worker' => 0, 499 'is_worker' => 0,
501 'password' => Hash::make($data['password']), 500 'password' => Hash::make($data['password']),
502 'pubpassword' => base64_encode($data['password']), 501 'pubpassword' => base64_encode($data['password']),
503 'email_verified_at' => Carbon::now() 502 'email_verified_at' => Carbon::now()
504 ]); 503 ]);
505 504
506 if ($Code_user->id > 0) { 505 if ($Code_user->id > 0) {
507 $Employer = new Employer(); 506 $Employer = new Employer();
508 $Employer->user_id = $Code_user->id; 507 $Employer->user_id = $Code_user->id;
509 $Employer->name_company = $data['name_company']; 508 $Employer->name_company = $data['name_company'];
510 $Employer->email = $data['email']; 509 $Employer->email = $data['email'];
511 $Employer->telephone = $data['telephone']; 510 $Employer->telephone = $data['telephone'];
512 $Employer->code = Tools::generator_id(10); 511 $Employer->code = Tools::generator_id(10);
513 $Employer->save(); 512 $Employer->save();
514 513
515 return $Code_user; 514 return $Code_user;
516 } 515 }
517 } 516 }
518 517
519 // Отправка сообщения от работодателя 518 // Отправка сообщения от работодателя
520 public function send_message(MessagesRequiest $request) { 519 public function send_message(MessagesRequiest $request) {
521 $params = $request->all(); 520 $params = $request->all();
522 dd($params); 521 dd($params);
523 $user1 = $params['user_id']; 522 $user1 = $params['user_id'];
524 $user2 = $params['to_user_id']; 523 $user2 = $params['to_user_id'];
525 524
526 if ($request->has('file')) { 525 if ($request->has('file')) {
527 $params['file'] = $request->file('file')->store("messages", 'public'); 526 $params['file'] = $request->file('file')->store("messages", 'public');
528 } 527 }
529 Message::create($params); 528 Message::create($params);
530 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); 529 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
531 } 530 }
532 531
533 public function test123(Request $request) { 532 public function test123(Request $request) {
534 $params = $request->all(); 533 $params = $request->all();
535 $user1 = $params['user_id']; 534 $user1 = $params['user_id'];
536 $user2 = $params['to_user_id']; 535 $user2 = $params['to_user_id'];
537 $id_vacancy = $params['ad_employer_id']; 536 $id_vacancy = $params['ad_employer_id'];
538 $ad_name = $params['ad_name']; 537 $ad_name = $params['ad_name'];
539 538
540 $rules = [ 539 $rules = [
541 'text' => 'required|min:1|max:150000', 540 'text' => 'required|min:1|max:150000',
542 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' 541 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000'
543 ]; 542 ];
544 $messages = [ 543 $messages = [
545 'required' => 'Укажите обязательное поле', 544 'required' => 'Укажите обязательное поле',
546 'min' => [ 545 'min' => [
547 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 546 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
548 'integer' => 'Поле «:attribute» должно быть :min или больше', 547 'integer' => 'Поле «:attribute» должно быть :min или больше',
549 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 548 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
550 ], 549 ],
551 'max' => [ 550 'max' => [
552 'string' => 'Поле «:attribute» должно быть не больше :max символов', 551 'string' => 'Поле «:attribute» должно быть не больше :max символов',
553 'integer' => 'Поле «:attribute» должно быть :max или меньше', 552 'integer' => 'Поле «:attribute» должно быть :max или меньше',
554 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 553 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
555 ] 554 ]
556 ]; 555 ];
557 556
558 $validator = Validator::make($request->all(), $rules, $messages); 557 $validator = Validator::make($request->all(), $rules, $messages);
559 558
560 if ($validator->fails()) { 559 if ($validator->fails()) {
561 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) 560 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2])
562 ->withErrors($validator); 561 ->withErrors($validator);
563 } else { 562 } else {
564 if ($request->has('file')) { 563 if ($request->has('file')) {
565 $params['file'] = $request->file('file')->store("messages", 'public'); 564 $params['file'] = $request->file('file')->store("messages", 'public');
566 } 565 }
567 Message::create($params); 566 Message::create($params);
568 //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); 567 //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
569 return redirect()->route('employer.dialog', 568 return redirect()->route('employer.dialog',
570 ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]); 569 ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]);
571 570
572 } 571 }
573 } 572 }
574 573
575 //Избранные люди 574 //Избранные люди
576 public function favorites(Request $request) { 575 public function favorites(Request $request) {
577 $IP_address = RusDate::ip_addr_client(); 576 $IP_address = RusDate::ip_addr_client();
578 $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); 577 $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get();
579 578
580 if ($Arr->count()) { 579 if ($Arr->count()) {
581 $A = Array(); 580 $A = Array();
582 foreach ($Arr as $it) { 581 foreach ($Arr as $it) {
583 $A[] = $it->code_record; 582 $A[] = $it->code_record;
584 } 583 }
585 584
586 $Workers = Worker::query()->whereIn('id', $A); 585 $Workers = Worker::query()->whereIn('id', $A);
587 } else { 586 } else {
588 $Workers = Worker::query()->where('id', '=', '0'); 587 $Workers = Worker::query()->where('id', '=', '0');
589 } 588 }
590 589
591 if (($request->has('search')) && (!empty($request->get('search')))) { 590 if (($request->has('search')) && (!empty($request->get('search')))) {
592 $search = $request->get('search'); 591 $search = $request->get('search');
593 592
594 $Workers = $Workers->WhereHas('users', 593 $Workers = $Workers->WhereHas('users',
595 function (Builder $query) use ($search) { 594 function (Builder $query) use ($search) {
596 $query->Where('surname', 'LIKE', "%$search%") 595 $query->Where('surname', 'LIKE', "%$search%")
597 ->orWhere('name_man', 'LIKE', "%$search%") 596 ->orWhere('name_man', 'LIKE', "%$search%")
598 ->orWhere('surname2', 'LIKE', "%$search%"); 597 ->orWhere('surname2', 'LIKE', "%$search%");
599 }); 598 });
600 } else { 599 } else {
601 $Workers = $Workers->with('users'); 600 $Workers = $Workers->with('users');
602 } 601 }
603 602
604 $Workers = $Workers->get(); 603 $Workers = $Workers->get();
605 604
606 605
607 return view('employers.favorite', compact('Workers')); 606 return view('employers.favorite', compact('Workers'));
608 } 607 }
609 608
610 // База данных 609 // База данных
611 public function bd(Request $request) { 610 public function bd(Request $request) {
612 // для типа BelongsTo 611 // для типа BelongsTo
613 //$documents = Document::query()->orderBy(Location::select('name') 612 //$documents = Document::query()->orderBy(Location::select('name')
614 // ->whereColumn('locations.id', 'documents.location_id') 613 // ->whereColumn('locations.id', 'documents.location_id')
615 //); 614 //);
616 615
617 // для типа HasOne/Many 616 // для типа HasOne/Many
618 // $documents = Document::::query()->orderBy(Location::select('name') 617 // $documents = Document::::query()->orderBy(Location::select('name')
619 // ->whereColumn('locations.document_id', 'documents.id') 618 // ->whereColumn('locations.document_id', 'documents.id')
620 //); 619 //);
621 620
622 621
623 $users = User_Model::query()->with('workers'); 622 $users = User_Model::query()->with('workers');
624 623
625 if ($request->has('search')) { 624 if ($request->has('search')) {
626 $find_key = $request->get('search'); 625 $find_key = $request->get('search');
627 $users = $users->where('name', 'LIKE', "%$find_key%") 626 $users = $users->where('name', 'LIKE', "%$find_key%")
628 ->orWhere('surname', 'LIKE', "%$find_key%") 627 ->orWhere('surname', 'LIKE', "%$find_key%")
629 ->orWhere('name_man', 'LIKE', "%$find_key%") 628 ->orWhere('name_man', 'LIKE', "%$find_key%")
630 ->orWhere('email', 'LIKE', "%$find_key%") 629 ->orWhere('email', 'LIKE', "%$find_key%")
631 ->orWhere('telephone', 'LIKE', "%$find_key%"); 630 ->orWhere('telephone', 'LIKE', "%$find_key%");
632 } 631 }
633 632
634 // Данные 633 // Данные
635 $users = $users->Baseuser()-> 634 $users = $users->Baseuser()->
636 orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id')); 635 orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id'));
637 $count_users = $users; 636 $count_users = $users;
638 $users = $users->paginate(5); 637 $users = $users->paginate(5);
639 638
640 639
641 return view('employers.bd', compact('users', 'count_users')); 640 return view('employers.bd', compact('users', 'count_users'));
642 } 641 }
643 642
644 //Настройка уведомлений 643 //Настройка уведомлений
645 public function subscribe() { 644 public function subscribe() {
646 return view('employers.subcribe'); 645 return view('employers.subcribe');
647 } 646 }
648 647
649 //Установка уведомлений сохранение 648 //Установка уведомлений сохранение
650 public function save_subscribe(Request $request) { 649 public function save_subscribe(Request $request) {
651 dd($request->all()); 650 dd($request->all());
652 $msg = $request->validate([ 651 $msg = $request->validate([
653 'subscribe_email' => 'required|email|min:5|max:255', 652 'subscribe_email' => 'required|email|min:5|max:255',
654 ]); 653 ]);
655 return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); 654 return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку');
656 } 655 }
657 656
658 //Сбросить форму с паролем 657 //Сбросить форму с паролем
659 public function password_reset() { 658 public function password_reset() {
660 $email = Auth()->user()->email; 659 $email = Auth()->user()->email;
661 return view('employers.password-reset', compact('email')); 660 return view('employers.password-reset', compact('email'));
662 } 661 }
663 662
664 //Обновление пароля 663 //Обновление пароля
665 public function new_password(Request $request) { 664 public function new_password(Request $request) {
666 $use = Auth()->user(); 665 $use = Auth()->user();
667 $request->validate([ 666 $request->validate([
668 'password' => 'required|string', 667 'password' => 'required|string',
669 'new_password' => 'required|string', 668 'new_password' => 'required|string',
670 'new_password2' => 'required|string' 669 'new_password2' => 'required|string'
671 ]); 670 ]);
672 671
673 if ($request->get('new_password') == $request->get('new_password2')) 672 if ($request->get('new_password') == $request->get('new_password2'))
674 if ($request->get('password') !== $request->get('new_password')) { 673 if ($request->get('password') !== $request->get('new_password')) {
675 $credentials = $request->only('email', 'password'); 674 $credentials = $request->only('email', 'password');
676 if (Auth::attempt($credentials)) { 675 if (Auth::attempt($credentials)) {
677 676
678 if (!is_null($use->email_verified_at)){ 677 if (!is_null($use->email_verified_at)){
679 678
680 $user_data = User_Model::find($use->id); 679 $user_data = User_Model::find($use->id);
681 $user_data->update([ 680 $user_data->update([
682 'password' => Hash::make($request->get('new_password')), 681 'password' => Hash::make($request->get('new_password')),
683 'pubpassword' => base64_encode($request->get('new_password')), 682 'pubpassword' => base64_encode($request->get('new_password')),
684 ]); 683 ]);
685 return redirect() 684 return redirect()
686 ->route('employer.password_reset') 685 ->route('employer.password_reset')
687 ->with('success', 'Поздравляю! Вы обновили свой пароль!'); 686 ->with('success', 'Поздравляю! Вы обновили свой пароль!');
688 } 687 }
689 688
690 return redirect() 689 return redirect()
691 ->route('employer.password_reset') 690 ->route('employer.password_reset')
692 ->withError('Данная учетная запись не было верифицированна!'); 691 ->withError('Данная учетная запись не было верифицированна!');
693 } 692 }
694 } 693 }
695 694
696 return redirect() 695 return redirect()
697 ->route('employer.password_reset') 696 ->route('employer.password_reset')
698 ->withErrors('Не совпадение данных, обновите пароли!'); 697 ->withErrors('Не совпадение данных, обновите пароли!');
699 } 698 }
700 699
701 700
702 701
703 // Форма Удаление пипла 702 // Форма Удаление пипла
704 public function delete_people() { 703 public function delete_people() {
705 $login = Auth()->user()->email; 704 $login = Auth()->user()->email;
706 return view('employers.delete_people', compact('login')); 705 return view('employers.delete_people', compact('login'));
707 } 706 }
708 707
709 // Удаление аккаунта 708 // Удаление аккаунта
710 public function action_delete_user(Request $request) { 709 public function action_delete_user(Request $request) {
711 $Answer = $request->all(); 710 $Answer = $request->all();
712 $user_id = Auth()->user()->id; 711 $user_id = Auth()->user()->id;
713 $request->validate([ 712 $request->validate([
714 'password' => 'required|string', 713 'password' => 'required|string',
715 ]); 714 ]);
716 715
717 $credentials = $request->only('email', 'password'); 716 $credentials = $request->only('email', 'password');
718 if (Auth::attempt($credentials)) { 717 if (Auth::attempt($credentials)) {
719 Auth::logout(); 718 Auth::logout();
720 $it = User_Model::find($user_id); 719 $it = User_Model::find($user_id);
721 $it->delete(); 720 $it->delete();
722 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); 721 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт');
723 } else { 722 } else {
724 return redirect()->route('employer.delete_people') 723 return redirect()->route('employer.delete_people')
725 ->withErrors( 'Неверный пароль! Нужен корректный пароль'); 724 ->withErrors( 'Неверный пароль! Нужен корректный пароль');
726 } 725 }
727 } 726 }
728 727
729 public function ajax_delete_user(Request $request) { 728 public function ajax_delete_user(Request $request) {
730 $Answer = $request->all(); 729 $Answer = $request->all();
731 $user_id = Auth()->user()->id; 730 $user_id = Auth()->user()->id;
732 $request->validate([ 731 $request->validate([
733 'password' => 'required|string', 732 'password' => 'required|string',
734 ]); 733 ]);
735 $credentials = $request->only('email', 'password'); 734 $credentials = $request->only('email', 'password');
736 if (Auth::attempt($credentials)) { 735 if (Auth::attempt($credentials)) {
737 736
738 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', 737 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт',
739 'email' => $request->get('email'), 738 'email' => $request->get('email'),
740 'password' => $request->get('password'))); 739 'password' => $request->get('password')));
741 } else { 740 } else {
742 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); 741 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль'));
743 } 742 }
744 } 743 }
745 744
746 // FAQ - Вопросы/ответы для работодателей и соискателей 745 // FAQ - Вопросы/ответы для работодателей и соискателей
747 public function faq() { 746 public function faq() {
748 return view('employers.faq'); 747 return view('employers.faq');
749 } 748 }
750 749
751 // Рассылка сообщений 750 // Рассылка сообщений
752 public function send_all_messages() { 751 public function send_all_messages() {
753 $id = Auth()->user()->id; 752 $id = Auth()->user()->id;
754 $sending = Employer::query()->where('user_id', '=', "$id")->first(); 753 $sending = Employer::query()->where('user_id', '=', "$id")->first();
755 754
756 if ($sending->sending_is) 755 if ($sending->sending_is)
757 return view('employers.send_all'); 756 return view('employers.send_all');
758 else 757 else
759 return view('employers.send_all_danger'); 758 return view('employers.send_all_danger');
760 } 759 }
761 760
762 // Отправка сообщений для информации 761 // Отправка сообщений для информации
763 public function send_all_post(Request $request) { 762 public function send_all_post(Request $request) {
764 $data = $request->all(); 763 $data = $request->all();
765 764
766 $emails = User_Model::query()->where('is_worker', '1')->get(); 765 $emails = User_Model::query()->where('is_worker', '1')->get();
767 766
768 foreach ($emails as $e) { 767 foreach ($emails as $e) {
769 Mail::to($e->email)->send(new SendAllMessages($data)); 768 Mail::to($e->email)->send(new SendAllMessages($data));
770 } 769 }
771 770
772 return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); 771 return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены');
773 } 772 }
774 773
775 // База резюме 774 // База резюме
776 public function bd_tupe(Request $request) { 775 public function bd_tupe(Request $request) {
777 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); 776 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get();
778 777
779 return view('employers.bd_tupe', compact('Resume')); 778 return view('employers.bd_tupe', compact('Resume'));
780 } 779 }
781 780
782 ////////////////////////////////////////////////////////////////// 781 //////////////////////////////////////////////////////////////////
783 // Отправил сообщение 782 // Отправил сообщение
784 ////////////////////////////////////////////////////////////////// 783 //////////////////////////////////////////////////////////////////
785 public function new_message(Request $request) { 784 public function new_message(Request $request) {
786 $params = $request->all(); 785 $params = $request->all();
787 $id = $params['_user_id']; 786 $id = $params['_user_id'];
788 $message = new Message(); 787 $message = new Message();
789 $message->user_id = $params['_user_id']; 788 $message->user_id = $params['_user_id'];
790 $message->to_user_id = $params['_to_user_id']; 789 $message->to_user_id = $params['_to_user_id'];
791 $message->title = $params['title']; 790 $message->title = $params['title'];
792 $message->text = $params['text']; 791 $message->text = $params['text'];
793 if ($request->has('_file')) { 792 if ($request->has('_file')) {
794 $message->file = $request->file('_file')->store("worker/$id", 'public'); 793 $message->file = $request->file('_file')->store("worker/$id", 'public');
795 } 794 }
796 $message->ad_employer_id = $params['_vacancy']; 795 $message->ad_employer_id = $params['_vacancy'];
797 $message->flag_new = 1; 796 $message->flag_new = 1;
798 $id_message = $message->save(); 797 $id_message = $message->save();
799 798
800 //$data['message_id'] = $id_message; 799 //$data['message_id'] = $id_message;
801 //$data['ad_employer_id'] = $params['_vacancy']; 800 //$data['ad_employer_id'] = $params['_vacancy'];
802 //$data['job_title_id'] = 0; 801 //$data['job_title_id'] = 0;
803 802
804 $data['flag'] = 1; 803 $data['flag'] = 1;
805 //$ad_responce = ad_response::create($data); 804 //$ad_responce = ad_response::create($data);
806 return redirect()->route('employer.messages', ['type_message' => 'output']); 805 return redirect()->route('employer.messages', ['type_message' => 'output']);
807 } 806 }
808 807
809 // Восстановление пароля 808 // Восстановление пароля
810 public function repair_password(Request $request) { 809 public function repair_password(Request $request) {
811 $params = $request->get('email'); 810 $params = $request->get('email');
812 } 811 }
813 812
814 // Избранные люди на корабль 813 // Избранные люди на корабль
815 public function selected_people(Request $request) { 814 public function selected_people(Request $request) {
816 $id = $request->get('id'); 815 $id = $request->get('id');
817 $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> 816 $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')->
818 where('is_remove', '=', '0')-> 817 where('is_remove', '=', '0')->
819 where('is_bd', '=', '0')-> 818 where('is_bd', '=', '0')->
820 where('position_id', $id)-> 819 where('position_id', $id)->
821 get(); 820 get();
app/Http/Controllers/MainController.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\Mail\MailRegistration; 7 use App\Mail\MailRegistration;
8 use App\Mail\MailRepair; 8 use App\Mail\MailRepair;
9 use App\Models\Ad_employer; 9 use App\Models\Ad_employer;
10 use App\Models\Ad_jobs; 10 use App\Models\Ad_jobs;
11 use App\Models\Category; 11 use App\Models\Category;
12 use App\Models\Education; 12 use App\Models\Education;
13 use App\Models\Employer; 13 use App\Models\Employer;
14 use App\Models\employers_main; 14 use App\Models\employers_main;
15 use App\Models\Job_title; 15 use App\Models\Job_title;
16 use App\Models\Like_vacancy; 16 use App\Models\Like_vacancy;
17 use App\Models\Like_worker; 17 use App\Models\Like_worker;
18 use App\Models\News; 18 use App\Models\News;
19 use App\Models\Positions; 19 use App\Models\Positions;
20 use App\Models\reclame; 20 use App\Models\reclame;
21 use App\Models\User; 21 use App\Models\User;
22 use Illuminate\Http\Request; 22 use Illuminate\Http\Request;
23 use Illuminate\Support\Facades\Auth; 23 use Illuminate\Support\Facades\Auth;
24 use Illuminate\Support\Facades\DB; 24 use Illuminate\Support\Facades\DB;
25 use Illuminate\Support\Facades\Hash; 25 use Illuminate\Support\Facades\Hash;
26 use Illuminate\Support\Facades\Mail; 26 use Illuminate\Support\Facades\Mail;
27 use Illuminate\Support\Facades\Validator; 27 use Illuminate\Support\Facades\Validator;
28 use App\Classes\StatusUser; 28 use App\Classes\StatusUser;
29 29
30 class MainController extends Controller 30 class MainController extends Controller
31 { 31 {
32 // Главная страница публичной части 32 // Главная страница публичной части
33 public function index() { 33 public function index() {
34 $news = News::query()->orderByDesc('id')->limit(6)->get(); 34 $news = News::query()->orderByDesc('id')->limit(6)->get();
35 35
36 $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') 36 $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*')
37 ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') 37 ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id')
38 ->OrderByDesc('created_at') 38 ->OrderByDesc('created_at')
39 ->GroupBy('categories.id') 39 ->GroupBy('categories.id')
40 ->get(); 40 ->get();
41 41
42 //$Position = Category::query()->where('is_remove', '=', '0')->get(); 42 //$Position = Category::query()->where('is_remove', '=', '0')->get();
43 $Job_title = Job_title::query()->where('is_remove', '=', '0')-> 43 $Job_title = Job_title::query()->where('is_remove', '=', '0')->
44 where('is_bd', '=', '0')->orderBy('name')->get(); 44 where('is_bd', '=', '0')->orderBy('name')->get();
45 45
46 /*$BigFlot = Array(); 46 /*$BigFlot = Array();
47 foreach ($Position as $position) { 47 foreach ($Position as $position) {
48 $BigFlot[] = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> 48 $BigFlot[] = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')->
49 orderBy('job_titles.sort')-> 49 orderBy('job_titles.sort')->
50 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> 50 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')->
51 where('position_ship', "$position->name")-> 51 where('position_ship', "$position->name")->
52 groupby('job_title_id','position_ship')-> 52 groupby('job_title_id','position_ship')->
53 get(); 53 get();
54 } 54 }
55 $BigFlot = Array(); 55 $BigFlot = Array();
56 foreach ($Position as $position) { 56 foreach ($Position as $position) {
57 $BigFlot[] = Ad_jobs::query()->with(['job_title' => function($query) { 57 $BigFlot[] = Ad_jobs::query()->with(['job_title' => function($query) {
58 $query->OrderBy('sort'); 58 $query->OrderBy('sort');
59 }])->whereHas('job_title', function ($query) use ($position) { 59 }])->whereHas('job_title', function ($query) use ($position) {
60 $query->where('position_id', $position->id); 60 $query->where('position_id', $position->id);
61 })-> 61 })->
62 distinct('job_title_id')-> 62 distinct('job_title_id')->
63 get(); 63 get();
64 }*/ 64 }*/
65 /*$BigFlot = Array(); 65 /*$BigFlot = Array();
66 foreach ($Position as $position) { 66 foreach ($Position as $position) {
67 $BigFlot[$position->id] = DB::table('ad_jobs')-> 67 $BigFlot[$position->id] = DB::table('ad_jobs')->
68 selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name, job_titles.position_id')-> 68 selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name, job_titles.position_id')->
69 orderByDesc('job_titles.sort')-> 69 orderByDesc('job_titles.sort')->
70 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> 70 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')->
71 where('job_titles.position_id', $position->id)-> 71 where('job_titles.position_id', $position->id)->
72 groupby('job_title_id')-> 72 groupby('job_title_id')->
73 get(); 73 get();
74 }*/ 74 }*/
75 $Data = DB::table('job_titles')-> 75 $Data = DB::table('job_titles')->
76 selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> 76 selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')->
77 where('categories.is_remove', '=', '0')-> 77 where('categories.is_remove', '=', '0')->
78 where('job_titles.is_remove', '=', '0')-> 78 where('job_titles.is_remove', '=', '0')->
79 where('job_titles.is_bd', '=' , '0')-> 79 where('job_titles.is_bd', '=' , '0')->
80 leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> 80 leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')->
81 join('categories', 'categories.id', '=', 'job_titles.position_id')-> 81 join('categories', 'categories.id', '=', 'job_titles.position_id')->
82 groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')-> 82 groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')->
83 orderByDesc('job_titles.sort')->get()->toArray(); 83 orderByDesc('job_titles.sort')->get()->toArray();
84 84
85 $Main_Job = array(); 85 $Main_Job = array();
86 $name_cat = ''; 86 $name_cat = '';
87 foreach ($Data as $it) { 87 foreach ($Data as $it) {
88 $it_arr = (array)$it; 88 $it_arr = (array)$it;
89 if ($name_cat != $it_arr['catname']) $name_cat = $it_arr['catname']; 89 if ($name_cat != $it_arr['catname']) $name_cat = $it_arr['catname'];
90 $Main_Job[$name_cat][] = $it_arr; 90 $Main_Job[$name_cat][] = $it_arr;
91 } 91 }
92 92
93 $employers = employers_main::query()->with('employer')-> 93 $employers = employers_main::query()->with('employer')->
94 whereHas('employer', function ($query) { 94 whereHas('employer', function ($query) {
95 $query->where('status_hidden', '=', '0'); 95 $query->where('status_hidden', '=', '0');
96 })-> 96 })->
97 orderBy('sort')->get(); 97 orderBy('sort')->get();
98 $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get(); 98 $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get();
99 return view('index', compact('news', 'Job_title', 'categories', 'employers', 'vacancy', 'Main_Job')); 99 return view('index', compact('news', 'Job_title', 'categories', 'employers', 'vacancy', 'Main_Job'));
100 } 100 }
101 101
102 public function search_vacancies(Request $request) { 102 public function search_vacancies(Request $request) {
103 if ($request->has('search')) { 103 if ($request->has('search')) {
104 $search = $request->get('search'); 104 $search = $request->get('search');
105 $job_titles = Job_title::query()->where('name', 'LIKE', "%$search%")->first(); 105 $job_titles = Job_title::query()->where('name', 'LIKE', "%$search%")->first();
106 if (isset($job_titles->id)) 106 if (isset($job_titles->id))
107 if ($job_titles->id > 0) 107 if ($job_titles->id > 0)
108 return redirect()->route('vacancies', ['job' => $job_titles->id]); 108 return redirect()->route('vacancies', ['job' => $job_titles->id]);
109 } 109 }
110 } 110 }
111 111
112 // Лайк вакансии 112 // Лайк вакансии
113 public function like_vacancy(Request $request) { 113 public function like_vacancy(Request $request) {
114 $IP_address = RusDate::ip_addr_client(); 114 $IP_address = RusDate::ip_addr_client();
115 115
116 if ($request->has('code_record')) { 116 if ($request->has('code_record')) {
117 if ($request->has('delete')) { 117 if ($request->has('delete')) {
118 $code = $request->get('code_record'); 118 $code = $request->get('code_record');
119 $atomic_era = Like_vacancy::select('id')-> 119 $atomic_era = Like_vacancy::select('id')->
120 where('code_record', '=', $code)->toSql(); 120 where('code_record', '=', $code)->toSql();
121 DB::table('like_vacancy')->where('code_record', $request->get('code_record'))->delete(); 121 DB::table('like_vacancy')->where('code_record', $request->get('code_record'))->delete();
122 122
123 } else { 123 } else {
124 $params = $request->all(); 124 $params = $request->all();
125 $params['ip_address'] = $IP_address; 125 $params['ip_address'] = $IP_address;
126 Like_vacancy::create($params); 126 Like_vacancy::create($params);
127 } 127 }
128 } 128 }
129 } 129 }
130 130
131 // Лайк соискателю. 131 // Лайк соискателю.
132 public function like_worker(Request $request) { 132 public function like_worker(Request $request) {
133 $IP_address = RusDate::ip_addr_client(); 133 $IP_address = RusDate::ip_addr_client();
134 134
135 if ($request->has('code_record')) { 135 if ($request->has('code_record')) {
136 if ($request->has('delete')) { 136 if ($request->has('delete')) {
137 $atomic_era = Like_worker::select('id')-> 137 $atomic_era = Like_worker::select('id')->
138 where('code_record', '=', $request-> 138 where('code_record', '=', $request->
139 get('code_record'))->first(); 139 get('code_record'))->first();
140 140
141 DB::table('like_worker')->where('code_record', $request->get('code_record'))->delete(); 141 DB::table('like_worker')->where('code_record', $request->get('code_record'))->delete();
142 142
143 return "Вот и результат удаления!"; 143 return "Вот и результат удаления!";
144 144
145 } else { 145 } else {
146 $params = $request->all(); 146 $params = $request->all();
147 $params['ip_address'] = $IP_address; 147 $params['ip_address'] = $IP_address;
148 Like_worker::create($params); 148 Like_worker::create($params);
149 } 149 }
150 } 150 }
151 } 151 }
152 152
153 public function vacancies(Request $request) { 153 public function vacancies(Request $request) {
154 //должности 154 //должности
155 $Job_title = Job_title::query()->where('is_remove', '=', '0')-> 155 $Job_title = Job_title::query()->where('is_remove', '=', '0')->
156 where('is_bd', '=', '0')->orderBy('name')->get(); 156 where('is_bd', '=', '0')->orderBy('name')->get();
157 157
158 $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') 158 $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*')
159 ->selectRaw('min(ad_employers.salary) as min_salary, max(ad_employers.salary) as max_salary') 159 ->selectRaw('min(ad_employers.salary) as min_salary, max(ad_employers.salary) as max_salary')
160 ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') 160 ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id')
161 ->join('ad_jobs', 'ad_jobs.ad_employer_id', '=', 'ad_employers.id'); 161 ->join('ad_jobs', 'ad_jobs.ad_employer_id', '=', 'ad_employers.id');
162 162
163 //категории и вакансии 163 //категории и вакансии
164 if (($request->has('job')) && ($request->get('job') > 0)) { 164 if (($request->has('job')) && ($request->get('job') > 0)) {
165 $categories = $categories->Where('job_title_id', '=', $request->get('job')); 165 $categories = $categories->Where('job_title_id', '=', $request->get('job'));
166 } 166 }
167 167
168 $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get(); 168 $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get();
169 169
170 //$Position = Category::query()->where('is_remove', '=', '0')->get(); 170 //$Position = Category::query()->where('is_remove', '=', '0')->get();
171 171
172 172
173 /*$BigFlot = Array(); 173 /*$BigFlot = Array();
174 foreach ($Position as $position) { 174 foreach ($Position as $position) {
175 $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> 175 $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')->
176 orderBy('job_titles.sort')-> 176 orderBy('job_titles.sort')->
177 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> 177 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')->
178 where('position_ship', "$position->name"); 178 where('position_ship', "$position->name");
179 if (($request->has('job')) && ($request->get('job') > 0)) { 179 if (($request->has('job')) && ($request->get('job') > 0)) {
180 $War_flot = $War_flot->where('job_title_id', $request->get('job')); 180 $War_flot = $War_flot->where('job_title_id', $request->get('job'));
181 } 181 }
182 $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); 182 $War_flot = $War_flot->groupby('job_title_id','position_ship')->get();
183 $BigFlot[] = $War_flot; 183 $BigFlot[] = $War_flot;
184 }*/ 184 }*/
185 /* 185 /*
186 $BigFlot = Array(); 186 $BigFlot = Array();
187 foreach ($Position as $position) { 187 foreach ($Position as $position) {
188 $WarFlot = DB::table('ad_jobs')-> 188 $WarFlot = DB::table('ad_jobs')->
189 selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> 189 selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')->
190 orderByDesc('job_titles.sort')-> 190 orderByDesc('job_titles.sort')->
191 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> 191 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')->
192 where('job_titles.position_id', $position->id); 192 where('job_titles.position_id', $position->id);
193 if (($request->has('job')) && ($request->get('job') > 0)) { 193 if (($request->has('job')) && ($request->get('job') > 0)) {
194 $WarFlot = $WarFlot->where('job_title_id', $request->get('job')); 194 $WarFlot = $WarFlot->where('job_title_id', $request->get('job'));
195 } 195 }
196 $WarFlot = $WarFlot->groupby('job_title_id')->get(); 196 $WarFlot = $WarFlot->groupby('job_title_id')->get();
197 $BigFlot[] = $WarFlot; 197 $BigFlot[] = $WarFlot;
198 } 198 }
199 */ 199 */
200 200
201 $Data = DB::table('job_titles')-> 201 $Data = DB::table('job_titles')->
202 selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> 202 selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')->
203 where('categories.is_remove', '=', '0')-> 203 where('categories.is_remove', '=', '0')->
204 where('job_titles.is_bd', '=' , '0')-> 204 where('job_titles.is_bd', '=' , '0')->
205 where('job_titles.is_remove', '=', '0'); 205 where('job_titles.is_remove', '=', '0');
206 if (($request->has('job')) && ($request->get('job') > 0)) { 206 if (($request->has('job')) && ($request->get('job') > 0)) {
207 $Data = $Data->where('job_title_id', $request->get('job')); 207 $Data = $Data->where('job_title_id', $request->get('job'));
208 } 208 }
209 $Data = $Data->leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> 209 $Data = $Data->leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')->
210 join('categories', 'categories.id', '=', 'job_titles.position_id')-> 210 join('categories', 'categories.id', '=', 'job_titles.position_id')->
211 groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')-> 211 groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')->
212 orderByDesc('job_titles.sort')->get()->toArray(); 212 orderByDesc('job_titles.sort')->get()->toArray();
213 213
214 $Main_Job = array(); 214 $Main_Job = array();
215 $name_cat = ''; 215 $name_cat = '';
216 foreach ($Data as $it) { 216 foreach ($Data as $it) {
217 $it_arr = (array)$it; 217 $it_arr = (array)$it;
218 if ($name_cat != $it_arr['catname']) 218 if ($name_cat != $it_arr['catname'])
219 $name_cat = $it_arr['catname']; 219 $name_cat = $it_arr['catname'];
220 $Main_Job[$name_cat][] = $it_arr; 220 $Main_Job[$name_cat][] = $it_arr;
221 } 221 }
222 222
223 if ($request->ajax()) { 223 if ($request->ajax()) {
224 return view('ajax.new_sky', compact('categories', 'Main_Job')); 224 return view('ajax.new_sky', compact('categories', 'Main_Job'));
225 } else { 225 } else {
226 return view('new_sky', compact('Job_title', 'categories', 'Main_Job')); 226 return view('new_sky', compact('Job_title', 'categories', 'Main_Job'));
227 } 227 }
228 } 228 }
229 229
230 //Вакансии категория детальная 230 //Вакансии категория детальная
231 public function list_vacancies(Category $categories, Request $request) { 231 public function list_vacancies(Category $categories, Request $request) {
232 if (isset(Auth()->user()->id)) 232 if (isset(Auth()->user()->id))
233 $uid = Auth()->user()->id; 233 $uid = Auth()->user()->id;
234 else 234 else
235 $uid = 0; 235 $uid = 0;
236 236
237 if ($request->get('job') == 0) 237 if ($request->get('job') == 0)
238 $job_search = ''; 238 $job_search = '';
239 else 239 else
240 $job_search = $request->get('job'); 240 $job_search = $request->get('job');
241 241
242 $Query = Ad_employer::with('jobs')-> 242 $Query = Ad_employer::with('jobs')->
243 with('cat')-> 243 with('cat')->
244 with('employer')-> 244 with('employer')->
245 245
246 whereHas('jobs_code', function ($query) use ($job_search) { 246 whereHas('jobs_code', function ($query) use ($job_search) {
247 if (!empty($job_search)) { 247 if (!empty($job_search)) {
248 $query->where('job_title_id', $job_search); 248 $query->where('job_title_id', $job_search);
249 } 249 }
250 })->select('ad_employers.*'); 250 })->select('ad_employers.*');
251 251
252 if (isset($categories->id) && ($categories->id > 0)) { 252 if (isset($categories->id) && ($categories->id > 0)) {
253 $Query = $Query->where('category_id', '=', $categories->id); 253 $Query = $Query->where('category_id', '=', $categories->id);
254 $Name_categori = Category::query()->where('id', '=', $categories->id)->get(); 254 $Name_categori = Category::query()->where('id', '=', $categories->id)->get();
255 } else { 255 } else {
256 $Name_categori = ''; 256 $Name_categori = '';
257 } 257 }
258 258
259 if ($request->get('sort')) { 259 if ($request->get('sort')) {
260 $sort = $request->get('sort'); 260 $sort = $request->get('sort');
261 switch ($sort) { 261 switch ($sort) {
262 case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break; 262 case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break;
263 case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break; 263 case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break;
264 case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; 264 case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break;
265 case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; 265 case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break;
266 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; 266 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break;
267 default: $Query = $Query->orderbyDesc('updated_at')->orderBy('id'); break; 267 default: $Query = $Query->orderbyDesc('updated_at')->orderBy('id'); break;
268 } 268 }
269 } 269 }
270 270
271 $Job_title = Job_title::query()->where('is_bd', '=', '0')->OrderBy('name')->get(); 271 $Job_title = Job_title::query()->where('is_bd', '=', '0')->OrderBy('name')->get();
272 272
273 $Query_count = $Query->count(); 273 $Query_count = $Query->count();
274 274
275 $Query = $Query->OrderByDesc('updated_at')->paginate(3); 275 $Query = $Query->OrderByDesc('updated_at')->paginate(3);
276 276
277 $Reclama = reclame::query()->get(); 277 $Reclama = reclame::query()->get();
278 278
279 if ($request->ajax()) { 279 if ($request->ajax()) {
280 if ($request->has('title')) { 280 if ($request->has('title')) {
281 return view('ajax.list_category', compact( 281 return view('ajax.list_category', compact(
282 'Name_categori' 282 'Name_categori'
283 )); 283 ));
284 } else { 284 } else {
285 return view('ajax.list_vacancies', compact('Query', 285 return view('ajax.list_vacancies', compact('Query',
286 'Query_count', 286 'Query_count',
287 'Name_categori', 287 'Name_categori',
288 'Reclama', 288 'Reclama',
289 'categories', 289 'categories',
290 'Job_title', 290 'Job_title',
291 'uid')); 291 'uid'));
292 } 292 }
293 } else { 293 } else {
294 //Вернуть все 294 //Вернуть все
295 return view('list_vacancies', compact('Query', 295 return view('list_vacancies', compact('Query',
296 'Query_count', 296 'Query_count',
297 'Reclama', 297 'Reclama',
298 'Name_categori', 298 'Name_categori',
299 'categories', 299 'categories',
300 'Job_title', 300 'Job_title',
301 'uid')); 301 'uid'));
302 } 302 }
303 } 303 }
304 304
305 // Образование 305 // Образование
306 public function education(Request $request) { 306 public function education(Request $request) {
307 $educations = Education::query(); 307 $educations = Education::query();
308 if (($request->has('search')) && (!empty($request->get('search')))) { 308 if (($request->has('search')) && (!empty($request->get('search')))) {
309 $search = trim($request->get('search')); 309 $search = trim($request->get('search'));
310 $educations = $educations->where('name', 'LIKE', "%$search%"); 310 $educations = $educations->where('name', 'LIKE', "%$search%");
311 } 311 }
312 312
313 if ($request->get('sort')) { 313 if ($request->get('sort')) {
314 $sort = $request->get('sort'); 314 $sort = $request->get('sort');
315 switch ($sort) { 315 switch ($sort) {
316 case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break; 316 case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break;
317 case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break; 317 case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break;
318 case 'created_at_up': $educations = $educations->OrderBy('created_at')->orderBy('id'); break; 318 case 'created_at_up': $educations = $educations->OrderBy('created_at')->orderBy('id'); break;
319 case 'created_at_down': $educations = $educations->orderByDesc('created_at')->orderBy('id'); break; 319 case 'created_at_down': $educations = $educations->orderByDesc('created_at')->orderBy('id'); break;
320 case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break; 320 case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break;
321 default: $educations = $educations->orderBy('id')->orderby('updated_at'); break; 321 default: $educations = $educations->orderBy('id')->orderby('updated_at'); break;
322 } 322 }
323 } 323 }
324 324
325 $count_edu = $educations->count(); 325 $count_edu = $educations->count();
326 $educations = $educations->paginate(6); 326 $educations = $educations->paginate(6);
327 if ($request->ajax()) { 327 if ($request->ajax()) {
328 return view('ajax.education', compact('educations')); 328 return view('ajax.education', compact('educations'));
329 } else { 329 } else {
330 return view('education', compact('educations', 'count_edu')); 330 return view('education', compact('educations', 'count_edu'));
331 } 331 }
332 } 332 }
333 333
334 // Контакты 334 // Контакты
335 public function contacts() { 335 public function contacts() {
336 return view('contacts'); 336 return view('contacts');
337 } 337 }
338 338
339 // Вход в личный кабинет 339 // Вход в личный кабинет
340 public function input_login(Request $request) 340 public function input_login(Request $request)
341 { 341 {
342 $params = $request->all(); 342 $params = $request->all();
343 343
344 344
345 $rules = [ 345 $rules = [
346 'email' => 'required|string|email', 346 'email' => 'required|string|email',
347 'password' => 'required|string|min:3|max:25', 347 'password' => 'required|string|min:3|max:25',
348 ]; 348 ];
349 349
350 $messages = [ 350 $messages = [
351 'required' => 'Укажите обязательное поле «:attribute»', 351 'required' => 'Укажите обязательное поле «:attribute»',
352 'email' => 'Введите корректный email', 352 'email' => 'Введите корректный email',
353 'min' => [ 353 'min' => [
354 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 354 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
355 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 355 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
356 ], 356 ],
357 'max' => [ 357 'max' => [
358 'string' => 'Поле «:attribute» должно быть не больше :max символов', 358 'string' => 'Поле «:attribute» должно быть не больше :max символов',
359 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 359 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
360 ], 360 ],
361 ]; 361 ];
362 $validator = Validator::make($request->all(), $rules, $messages); 362 $validator = Validator::make($request->all(), $rules, $messages);
363 if ($validator->fails()) { 363 if ($validator->fails()) {
364 if (Auth::check()) 364 if (Auth::check())
365 $user_id = $request->user()->id; 365 $user_id = $request->user()->id;
366 else 366 else
367 $user_id = 0; 367 $user_id = 0;
368 368
369 if ($user_id > 0) 369 if ($user_id > 0)
370 return json_encode(Array("ERROR" => "Email или пароль невалидный!")); 370 return json_encode(Array("ERROR" => "Email или пароль невалидный!"));
371 else 371 else
372 return redirect()->route('index')->with('Error', "Email или пароль невалидный"); 372 return redirect()->route('index')->with('Error', "Email или пароль невалидный");
373 } else { 373 } else {
374 $credentials = $request->only('email', 'password'); 374 $credentials = $request->only('email', 'password');
375 375
376 if (Auth::attempt($credentials, $request->has('remember'))) { 376 if (Auth::attempt($credentials, $request->has('remember'))) {
377 377
378 if (is_null(Auth::user()->email_verified_at)) { 378 if (is_null(Auth::user()->email_verified_at)) {
379 Auth::logout(); 379 Auth::logout();
380 return json_encode(Array("ERROR" => "Адрес почты не подтвержден")); 380 return json_encode(Array("ERROR" => "Адрес почты не подтвержден"));
381 } 381 }
382 382
383 if (Auth::user()->is_worker) { 383 if (Auth::user()->is_worker) {
384 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl())); 384 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));
385 } else { 385 } else {
386 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl())); 386 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));
387 } 387 }
388 388
389 return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет")); 389 return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет"));
390 //->route('index') 390 //->route('index')
391 //->with('success', 'Вы вошли в личный кабинет.'); 391 //->with('success', 'Вы вошли в личный кабинет.');
392 } else { 392 } else {
393 return json_encode(Array("ERROR" => "Неверный логин или пароль!")); 393 return json_encode(Array("ERROR" => "Неверный логин или пароль!"));
394 } 394 }
395 } 395 }
396 } 396 }
397 397
398 // Восстановление пароля 398 // Восстановление пароля
399 public function repair_password(Request $request) { 399 public function repair_password(Request $request) {
400 $rules = [ 400 $rules = [
401 'email' => 'required|string|email', 401 'email' => 'required|string|email',
402 ]; 402 ];
403 403
404 $messages = [ 404 $messages = [
405 'required' => 'Укажите обязательное поле «:attribute»', 405 'required' => 'Укажите обязательное поле «:attribute»',
406 'email' => 'Введите корректный email', 406 'email' => 'Введите корректный email',
407 'min' => [ 407 'min' => [
408 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 408 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
409 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 409 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
410 ], 410 ],
411 'max' => [ 411 'max' => [
412 'string' => 'Поле «:attribute» должно быть не больше :max символов', 412 'string' => 'Поле «:attribute» должно быть не больше :max символов',
413 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 413 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
414 ], 414 ],
415 ]; 415 ];
416 416
417 $validator = Validator::make($request->all(), $rules, $messages); 417 $validator = Validator::make($request->all(), $rules, $messages);
418 418
419 if ($validator->fails()) { 419 if ($validator->fails()) {
420 return redirect()->back()->with('Error', "Email невалидный"); 420 return redirect()->back()->with('Error', "Email невалидный");
421 } else { 421 } else {
422 $new_password = Tools::generator_id(10); 422 $new_password = Tools::generator_id(10);
423 $hash_password = Hash::make($new_password); 423 $hash_password = Hash::make($new_password);
424 $user = User::query()->where('email', $request->get('email'))->first(); 424 $user = User::query()->where('email', $request->get('email'))->first();
425 $EditRec = User::find($user->id); 425 $EditRec = User::find($user->id);
426 $EditRec->password = $hash_password; 426 $EditRec->password = $hash_password;
427 $EditRec->save(); 427 $EditRec->save();
428 428
429 foreach ([$request->get('email')] as $recipient) { 429 foreach ([$request->get('email')] as $recipient) {
430 Mail::to($recipient)->send(new MailRepair($new_password)); 430 Mail::to($recipient)->send(new MailRepair($new_password));
431 } 431 }
432 return redirect()->route('index'); 432 return redirect()->route('index');
433 433
434 } 434 }
435 435
436 } 436 }
437 437
438 // Вывод новостей 438 // Вывод новостей
439 public function news(Request $request) { 439 public function news(Request $request) {
440 $Query = News::query(); 440 $Query = News::query();
441 if ($request->has('search')) { 441 if ($request->has('search')) {
442 $search = $request->get('search'); 442 $search = $request->get('search');
443 $Query = $Query->where('title', 'LIKE', "%$search%")-> 443 $Query = $Query->where('title', 'LIKE', "%$search%")->
444 orWhere('text', 'LIKE', "%$search%"); 444 orWhere('text', 'LIKE', "%$search%");
445 } 445 }
446 446
447 if ($request->ajax()) { 447 if ($request->ajax()) {
448 if ($request->get('sort')) { 448 if ($request->get('sort')) {
449 $sort = $request->get('sort'); 449 $sort = $request->get('sort');
450 switch ($sort) { 450 switch ($sort) {
451 case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break; 451 case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break;
452 case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break; 452 case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break;
453 case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; 453 case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break;
454 case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; 454 case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break;
455 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; 455 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break;
456 default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; 456 default: $Query = $Query->orderBy('id')->orderby('updated_at'); break;
457 } 457 }
458 } 458 }
459 } 459 }
460 $Query_count = $Query->count(); 460 $Query_count = $Query->count();
461 $Query = $Query->paginate(6); 461 $Query = $Query->paginate(6);
462 462
463 if ($request->ajax()) { 463 if ($request->ajax()) {
464 return view('ajax.news-list', compact('Query', 'Query_count')); 464 return view('ajax.news-list', compact('Query', 'Query_count'));
465 } else { 465 } else {
466 return view('news-list', compact('Query', 'Query_count')); 466 return view('news-list', compact('Query', 'Query_count'));
467 } 467 }
468 } 468 }
469 469
470 //Детальная новость 470 //Детальная новость
471 public function detail_new(News $new) { 471 public function detail_new(News $new) {
472 // Наборка 472 // Наборка
473 $Query = News::query()->where('id', $new->id)->get(); 473 $Query = News::query()->where('id', $new->id)->get();
474 $title = $Query[0]->title; 474 $title = $Query[0]->title;
475 $All_Query = News::query()->paginate(8); 475 $All_Query = News::query()->paginate(8);
476 return view('detail_new', compact('Query', 'All_Query', 'title')); 476 return view('detail_new', compact('Query', 'All_Query', 'title'));
477 } 477 }
478 } 478 }
479 479
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\Category; 11 use App\Models\Category;
12 use App\Models\Dop_info; 12 use App\Models\Dop_info;
13 use App\Models\Employer; 13 use App\Models\Employer;
14 use App\Models\infobloks; 14 use App\Models\infobloks;
15 use App\Models\Job_title; 15 use App\Models\Job_title;
16 use App\Models\Like_vacancy; 16 use App\Models\Like_vacancy;
17 use App\Models\Like_worker; 17 use App\Models\Like_worker;
18 use App\Models\Message; 18 use App\Models\Message;
19 use App\Models\place_works; 19 use App\Models\place_works;
20 use App\Models\PrevCompany; 20 use App\Models\PrevCompany;
21 use App\Models\reclame; 21 use App\Models\reclame;
22 use App\Models\ResponseWork; 22 use App\Models\ResponseWork;
23 use App\Models\sertification; 23 use App\Models\sertification;
24 use App\Models\Static_worker; 24 use App\Models\Static_worker;
25 use App\Models\Title_worker; 25 use App\Models\Title_worker;
26 use App\Models\User; 26 use App\Models\User;
27 use App\Models\User as User_Model; 27 use App\Models\User as User_Model;
28 use App\Models\Worker; 28 use App\Models\Worker;
29 use Barryvdh\DomPDF\Facade\Pdf; 29 use Barryvdh\DomPDF\Facade\Pdf;
30 use Carbon\Carbon; 30 use Carbon\Carbon;
31 use Illuminate\Auth\Events\Registered; 31 use Illuminate\Auth\Events\Registered;
32 use Illuminate\Database\Eloquent\Builder; 32 use Illuminate\Database\Eloquent\Builder;
33 use Illuminate\Database\Eloquent\Model; 33 use Illuminate\Database\Eloquent\Model;
34 use Illuminate\Http\JsonResponse; 34 use Illuminate\Http\JsonResponse;
35 use Illuminate\Http\Request; 35 use Illuminate\Http\Request;
36 use Illuminate\Support\Facades\Auth; 36 use Illuminate\Support\Facades\Auth;
37 use Illuminate\Support\Facades\Hash; 37 use Illuminate\Support\Facades\Hash;
38 use Illuminate\Support\Facades\Storage; 38 use Illuminate\Support\Facades\Storage;
39 use Illuminate\Support\Facades\Validator; 39 use Illuminate\Support\Facades\Validator;
40 40
41 class WorkerController extends Controller 41 class WorkerController extends Controller
42 { 42 {
43 public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу'); 43 public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу');
44 44
45 //профиль 45 //профиль
46 public function profile(Worker $worker) 46 public function profile(Worker $worker)
47 { 47 {
48 $get_date = date('Y.m'); 48 $get_date = date('Y.m');
49 49
50 $c = Static_worker::query()->where('year_month', '=', $get_date) 50 $c = Static_worker::query()->where('year_month', '=', $get_date)
51 ->where('user_id', '=', $worker->users->id) 51 ->where('user_id', '=', $worker->users->id)
52 ->get(); 52 ->get();
53 53
54 if ($c->count() > 0) { 54 if ($c->count() > 0) {
55 $upd = Static_worker::find($c[0]->id); 55 $upd = Static_worker::find($c[0]->id);
56 $upd->lookin = $upd->lookin + 1; 56 $upd->lookin = $upd->lookin + 1;
57 $upd->save(); 57 $upd->save();
58 } else { 58 } else {
59 $crt = new Static_worker(); 59 $crt = new Static_worker();
60 $crt->lookin = 1; 60 $crt->lookin = 1;
61 $crt->year_month = $get_date; 61 $crt->year_month = $get_date;
62 $crt->user_id = $worker->user_id; 62 $crt->user_id = $worker->user_id;
63 $crt->save(); 63 $crt->save();
64 } 64 }
65 65
66 $stat = Static_worker::query()->where('year_month', '=', $get_date) 66 $stat = Static_worker::query()->where('year_month', '=', $get_date)
67 ->where('user_id', '=', $worker->users->id) 67 ->where('user_id', '=', $worker->users->id)
68 ->get(); 68 ->get();
69 69
70 return view('public.workers.profile', compact('worker', 'stat')); 70 return view('public.workers.profile', compact('worker', 'stat'));
71 } 71 }
72 72
73 // лист база резюме 73 // лист база резюме
74 public function bd_resume(Request $request) 74 public function bd_resume(Request $request)
75 { 75 {
76 $look = false; 76 $look = false;
77 $idiot = 0; 77 $idiot = 0;
78 if (isset(Auth()->user()->id)) { 78 if (isset(Auth()->user()->id)) {
79 $idiot = Auth()->user()->id; 79 $idiot = Auth()->user()->id;
80 if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin)) 80 if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin))
81 $look = true; 81 $look = true;
82 } 82 }
83 83
84 if ($look) { 84 if ($look) {
85 $status_work = $this->status_work; 85 $status_work = $this->status_work;
86 $resumes = Worker::query()->with('users')->with('job_titles'); 86 $resumes = Worker::query()->with('users')->with('job_titles');
87 $resumes = $resumes->whereHas('users', function (Builder $query) { 87 $resumes = $resumes->whereHas('users', function (Builder $query) {
88 $query->Where('is_worker', '=', '1') 88 $query->Where('is_worker', '=', '1')
89 ->Where('is_bd', '=', '0'); 89 ->Where('is_bd', '=', '0');
90 }); 90 });
91 91
92 //dd($request->get('job')); 92 //dd($request->get('job'));
93 if (($request->has('job')) && ($request->get('job') > 0)) { 93 if (($request->has('job')) && ($request->get('job') > 0)) {
94 $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { 94 $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) {
95 $query->Where('job_titles.id', $request->get('job')); 95 $query->Where('job_titles.id', $request->get('job'));
96 }); 96 });
97 } 97 }
98 98
99 $Job_title = Job_title::query()-> 99 $Job_title = Job_title::query()->
100 where('is_remove', '=', '0')-> 100 where('is_remove', '=', '0')->
101 where('is_bd', '=' , '1')-> 101 where('is_bd', '=' , '1')->
102 get(); 102 get();
103 103
104 if ($request->get('sort')) { 104 if ($request->get('sort')) {
105 $sort = $request->get('sort'); 105 $sort = $request->get('sort');
106 switch ($sort) { 106 switch ($sort) {
107 case 'name_up': 107 case 'name_up':
108 $resumes = $resumes->orderBy(User::select('surname') 108 $resumes = $resumes->orderBy(User::select('surname')
109 ->whereColumn('Workers.user_id', 'users.id') 109 ->whereColumn('Workers.user_id', 'users.id')
110 ); 110 );
111 break; 111 break;
112 case 'name_down': 112 case 'name_down':
113 $resumes = $resumes->orderByDesc(User::select('surname') 113 $resumes = $resumes->orderByDesc(User::select('surname')
114 ->whereColumn('Workers.user_id', 'users.id') 114 ->whereColumn('Workers.user_id', 'users.id')
115 ); 115 );
116 break; 116 break;
117 case 'created_at_up': 117 case 'created_at_up':
118 $resumes = $resumes->OrderBy('created_at')->orderBy('id'); 118 $resumes = $resumes->OrderBy('created_at')->orderBy('id');
119 break; 119 break;
120 case 'created_at_down': 120 case 'created_at_down':
121 $resumes = $resumes->orderByDesc('created_at')->orderBy('id'); 121 $resumes = $resumes->orderByDesc('created_at')->orderBy('id');
122 break; 122 break;
123 case 'default': 123 case 'default':
124 $resumes = $resumes->orderBy('id')->orderby('updated_at'); 124 $resumes = $resumes->orderBy('id')->orderby('updated_at');
125 break; 125 break;
126 default: 126 default:
127 $resumes = $resumes->orderBy('id')->orderby('updated_at'); 127 $resumes = $resumes->orderBy('id')->orderby('updated_at');
128 break; 128 break;
129 } 129 }
130 } 130 }
131 131
132 $res_count = $resumes->count(); 132 $res_count = $resumes->count();
133 //$resumes = $resumes->get(); 133 //$resumes = $resumes->get();
134 $resumes = $resumes->paginate(4); 134 $resumes = $resumes->paginate(4);
135 if ($request->ajax()) { 135 if ($request->ajax()) {
136 // Условия обставлены 136 // Условия обставлены
137 if ($request->has('block') && ($request->get('block') == 1)) { 137 if ($request->has('block') && ($request->get('block') == 1)) {
138 return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); 138 return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot'));
139 } 139 }
140 140
141 if ($request->has('block') && ($request->get('block') == 2)) { 141 if ($request->has('block') && ($request->get('block') == 2)) {
142 return view('ajax.resume_2', compact('resumes', 'status_work', 'res_count', 'idiot')); 142 return view('ajax.resume_2', compact('resumes', 'status_work', 'res_count', 'idiot'));
143 } 143 }
144 } else { 144 } else {
145 return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title')); 145 return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title'));
146 } 146 }
147 } else { 147 } else {
148 return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); 148 return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]);
149 } 149 }
150 } 150 }
151 151
152 //Лайк резюме 152 //Лайк резюме
153 public function like_controller() { 153 public function like_controller() {
154 154
155 } 155 }
156 156
157 // анкета соискателя 157 // анкета соискателя
158 public function resume_profile(Worker $worker) 158 public function resume_profile(Worker $worker)
159 { 159 {
160 if (isset(Auth()->user()->id)) { 160 if (isset(Auth()->user()->id)) {
161 $idiot = Auth()->user()->id; 161 $idiot = Auth()->user()->id;
162 } else { 162 } else {
163 $idiot = 0; 163 $idiot = 0;
164 } 164 }
165 165
166 $status_work = $this->status_work; 166 $status_work = $this->status_work;
167 $Query = Worker::query()->with('users')->with('job_titles') 167 $Query = Worker::query()->with('users')->with('job_titles')
168 ->with('place_worker')->with('sertificate')->with('prev_company') 168 ->with('place_worker')->with('sertificate')->with('prev_company')
169 ->with('infobloks')->with('response'); 169 ->with('infobloks')->with('response');
170 $Query = $Query->where('id', '=', $worker->id); 170 $Query = $Query->where('id', '=', $worker->id);
171 $Query = $Query->get(); 171 $Query = $Query->get();
172 172
173 $get_date = date('Y.m'); 173 $get_date = date('Y.m');
174
174 175 $c = Static_worker::query()->where('year_month', '=', $get_date)
175 $c = Static_worker::query()->where('year_month', '=', $get_date) 176 ->where('user_id', '=', $worker->user_id)
176 ->where('user_id', '=', $worker->user_id) 177 ->get();
177 ->get(); 178
178 179 if ($c->count() > 0) {
179 if ($c->count() > 0) { 180 $upd = Static_worker::find($c[0]->id);
180 $upd = Static_worker::find($c[0]->id); 181 $upd->lookin = $upd->lookin + 1;
181 $upd->lookin = $upd->lookin + 1; 182 $upd->save();
182 $upd->save(); 183 } else {
183 } else { 184 $crt = new Static_worker();
184 $crt = new Static_worker(); 185 $crt->lookin = 1;
185 $crt->lookin = 1; 186 $crt->year_month = $get_date;
186 $crt->year_month = $get_date; 187 $crt->user_id = $worker->user_id;
187 $crt->user_id = $worker->user_id; 188 $status = $crt->save();
188 $status = $crt->save(); 189 }
189 } 190 $stat = Static_worker::query()->where('year_month', '=', $get_date)
190 $stat = Static_worker::query()->where('year_month', '=', $get_date) 191 ->where('user_id', '=', $worker->user_id)
191 ->where('user_id', '=', $worker->user_id) 192 ->get();
192 ->get(); 193
193 194 return view('worker', compact('Query', 'status_work', 'idiot', 'stat'));
194 return view('worker', compact('Query', 'status_work', 'idiot', 'stat')); 195 }
195 } 196
196 197 // скачать анкету соискателя
197 // скачать анкету соискателя 198 public function resume_download(Worker $worker)
198 public function resume_download(Worker $worker) 199 {
199 { 200 $status_work = $this->status_work;
200 $status_work = $this->status_work; 201 $Query = Worker::query()->with('users')->with('job_titles')
201 $Query = Worker::query()->with('users')->with('job_titles') 202 ->with('place_worker')->with('sertificate')->with('prev_company')
202 ->with('place_worker')->with('sertificate')->with('prev_company') 203 ->with('infobloks');
203 ->with('infobloks'); 204 $Query = $Query->where('id', '=', $worker->id);
204 $Query = $Query->where('id', '=', $worker->id); 205 $Query = $Query->get()->toArray();
205 $Query = $Query->get()->toArray(); 206
206 207 view()->share('Query',$Query);
207 view()->share('Query',$Query); 208
208 209
209 210 $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape');
210 $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape'); 211
211 212 return $pdf->stream();
212 return $pdf->stream(); 213 }
213 } 214
214 215 public function resume_download_all() {
215 public function resume_download_all() { 216 $status_work = $this->status_work;
216 $status_work = $this->status_work; 217 $Query = Worker::query()->with('users')->with('job_titles')
217 $Query = Worker::query()->with('users')->with('job_titles') 218 ->with('place_worker')->with('sertificate')->with('prev_company')
218 ->with('place_worker')->with('sertificate')->with('prev_company') 219 ->with('infobloks')->
219 ->with('infobloks')-> 220 whereHas('users', function (Builder $query) {
220 whereHas('users', function (Builder $query) { 221 $query->Where('is_worker', '=', '1')
221 $query->Where('is_worker', '=', '1') 222 ->Where('is_bd', '=', '1');
222 ->Where('is_bd', '=', '1'); 223 });
223 }); 224 //$Query = $Query->where('id', '=', $worker->id);
224 //$Query = $Query->where('id', '=', $worker->id); 225 $Query = $Query->get()->toArray();
225 $Query = $Query->get()->toArray(); 226
226 227 view()->share('Query',$Query);
227 view()->share('Query',$Query); 228
228 229 $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape');
229 $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape'); 230
230 231 return $pdf->stream();
231 return $pdf->stream(); 232 }
232 } 233
233 234 // Кабинет работника
234 // Кабинет работника 235 public function cabinet(Request $request)
235 public function cabinet(Request $request) 236 {
236 { 237 // дата год и месяц
237 // дата год и месяц 238 $get_date = date('Y.m');
238 $get_date = date('Y.m'); 239
239 240 $id = Auth()->user()->id;
240 $id = Auth()->user()->id; 241
241 242 $Infobloks = infobloks::query()->get();
242 $Infobloks = infobloks::query()->get(); 243
243 244 $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')->
244 $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')-> 245 with('infobloks')->with('place_worker')->
245 with('infobloks')->with('place_worker')-> 246 WhereHas('users',
246 WhereHas('users', 247 function (Builder $query) use ($id) {$query->Where('id', $id);
247 function (Builder $query) use ($id) {$query->Where('id', $id); 248 })->get();
248 })->get(); 249
249 250 $Job_titles = Job_title::query()->where('is_remove', '=', '0')->
250 $Job_titles = Job_title::query()->where('is_remove', '=', '0')-> 251 where('is_bd', '=' , '1')->
251 where('is_bd', '=' , '1')-> 252 OrderByDesc('sort')->OrderBy('name')->get();
252 OrderByDesc('sort')->OrderBy('name')->get(); 253 $Infoblocks = infobloks::query()->OrderBy('name')->get();
253 $Infoblocks = infobloks::query()->OrderBy('name')->get(); 254
254 255 $stat = Static_worker::query()->where('year_month', '=', $get_date)
255 $stat = Static_worker::query()->where('year_month', '=', $get_date) 256 ->where('user_id', '=', $id)
256 ->where('user_id', '=', $id) 257 ->get();
257 ->get(); 258
259
258 260 // 10%
259 261
260 // 10% 262 $persent = 10;
261 263 $persent1 = 0;
262 $persent = 10; 264 $persent2 = 0;
263 $persent1 = 0; 265 $persent3 = 0;
264 $persent2 = 0; 266 $persent4 = 0;
265 $persent3 = 0; 267 $persent5 = 0;
266 $persent4 = 0; 268
267 $persent5 = 0; 269 if ((!empty($Worker[0]->telephone)) &&
268 270 (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) &&
269 if ((!empty($Worker[0]->telephone)) && 271 (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) {
270 (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) && 272 // 40%
271 (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) { 273 $persent = $persent + 40;
272 // 40% 274 $persent1 = 40;
273 $persent = $persent + 40; 275 }
274 $persent1 = 40; 276
275 } 277 //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year);
276 278
277 //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year); 279 if ($Worker[0]->sertificate->count() > 0) {
278 280 // 15%
279 if ($Worker[0]->sertificate->count() > 0) { 281 $persent = $persent + 15;
280 // 15% 282 $persent2 = 15;
281 $persent = $persent + 15; 283 }
282 $persent2 = 15; 284
283 } 285 if ($Worker[0]->infobloks->count() > 0) {
284 286 // 20%
285 if ($Worker[0]->infobloks->count() > 0) { 287 $persent = $persent + 20;
286 // 20% 288 $persent3 = 20;
287 $persent = $persent + 20; 289 }
288 $persent3 = 20; 290
289 } 291 if ($Worker[0]->prev_company->count() > 0) {
290 292 // 10%
291 if ($Worker[0]->prev_company->count() > 0) { 293 $persent = $persent + 10;
292 // 10% 294 $persent4 = 10;
293 $persent = $persent + 10; 295 }
294 $persent4 = 10; 296
295 } 297 if (!empty($Worker[0]->photo)) {
296 298 // 5%
297 if (!empty($Worker[0]->photo)) { 299 $persent = $persent + 5;
298 // 5% 300 $persent5 = 5;
299 $persent = $persent + 5; 301 }
300 $persent5 = 5; 302 if ($request->has('print')) {
301 } 303 dd($Worker);
302 if ($request->has('print')) { 304 } else {
303 dd($Worker); 305 return view('workers.cabinet', compact('Worker', 'Infobloks', 'persent', 'Job_titles', 'Infoblocks', 'stat'));
304 } else { 306 }
305 return view('workers.cabinet', compact('Worker', 'Infobloks', 'persent', 'Job_titles', 'Infoblocks', 'stat')); 307 }
306 } 308
307 } 309 // Сохранение данных
308 310 public function cabinet_save(Worker $worker, Request $request)
309 // Сохранение данных 311 {
310 public function cabinet_save(Worker $worker, Request $request) 312 $id = $worker->id;
311 { 313 $params = $request->all();
312 $id = $worker->id; 314
313 $params = $request->all(); 315 $job_title_id = $request->get('job_title_id');
314 316
315 $job_title_id = $request->get('job_title_id'); 317 unset($params['new_diplom']);
316 318 unset($params['new_data_begin']);
317 unset($params['new_diplom']); 319 unset($params['new_data_end']);
318 unset($params['new_data_begin']); 320 unset($params['new_job_title']);
319 unset($params['new_data_end']); 321 unset($params['new_teplohod']);
320 unset($params['new_job_title']); 322 unset($params['new_GWT']);
321 unset($params['new_teplohod']); 323 unset($params['new_KBT']);
322 unset($params['new_GWT']); 324 unset($params['new_Begin_work']);
323 unset($params['new_KBT']); 325 unset($params['new_End_work']);
324 unset($params['new_Begin_work']); 326 unset($params['new_name_company']);
325 unset($params['new_End_work']); 327
326 unset($params['new_name_company']); 328 $rules = [
327 329 'surname' => ['required', 'string', 'max:255'],
328 $rules = [ 330 'name_man' => ['required', 'string', 'max:255'],
329 'surname' => ['required', 'string', 'max:255'], 331 'email' => ['required', 'string', 'email', 'max:255'],
330 'name_man' => ['required', 'string', 'max:255'], 332
331 'email' => ['required', 'string', 'email', 'max:255'], 333 ];
332 334
333 ]; 335 $messages = [
334 336 'required' => 'Укажите обязательное поле',
335 $messages = [ 337 'min' => [
336 'required' => 'Укажите обязательное поле', 338 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
337 'min' => [ 339 'integer' => 'Поле «:attribute» должно быть :min или больше',
338 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 340 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
339 'integer' => 'Поле «:attribute» должно быть :min или больше', 341 ],
340 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 342 'max' => [
341 ], 343 'string' => 'Поле «:attribute» должно быть не больше :max символов',
342 'max' => [ 344 'integer' => 'Поле «:attribute» должно быть :max или меньше',
343 'string' => 'Поле «:attribute» должно быть не больше :max символов', 345 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
344 'integer' => 'Поле «:attribute» должно быть :max или меньше', 346 ]
345 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 347 ];
346 ] 348
347 ]; 349 $validator = Validator::make($params, $rules, $messages);
348 350
349 $validator = Validator::make($params, $rules, $messages); 351 if ($validator->fails()) {
350 352 return redirect()->route('worker.cabinet')->withErrors($validator);
351 if ($validator->fails()) { 353 } else {
352 return redirect()->route('worker.cabinet')->withErrors($validator); 354
353 } else { 355 if ($request->has('photo')) {
354 356 if (!empty($Worker->photo)) {
355 if ($request->has('photo')) { 357 Storage::delete($Worker->photo);
356 if (!empty($Worker->photo)) { 358 }
357 Storage::delete($Worker->photo); 359 $params['photo'] = $request->file('photo')->store("worker/$id", 'public');
358 } 360 }
359 $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); 361
360 } 362 if ($request->has('file')) {
361 363 if (!empty($Worker->file)) {
362 if ($request->has('file')) { 364 Storage::delete($Worker->file);
363 if (!empty($Worker->file)) { 365 }
364 Storage::delete($Worker->file); 366 $params['file'] = $request->file('file')->store("worker/$id", 'public');
365 } 367 }
366 $params['file'] = $request->file('file')->store("worker/$id", 'public'); 368
367 } 369 $id_wor = $worker->update($params);
368 370 $use = User::find($worker->user_id);
369 $id_wor = $worker->update($params); 371 $use->surname = $request->get('surname');
370 $use = User::find($worker->user_id); 372 $use->name_man = $request->get('name_man');
371 $use->surname = $request->get('surname'); 373 $use->surname2 = $request->get('surname2');
372 $use->name_man = $request->get('name_man'); 374
373 $use->surname2 = $request->get('surname2'); 375 $use->save();
374 376 $worker->job_titles()->sync($job_title_id);
375 $use->save(); 377
376 $worker->job_titles()->sync($job_title_id); 378 return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены');
377 379 }
378 return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); 380 }
379 } 381
380 } 382 // Сообщения данные
381 383 public function messages($type_message)
382 // Сообщения данные 384 {
383 public function messages($type_message) 385 $user_id = Auth()->user()->id;
384 { 386
385 $user_id = Auth()->user()->id; 387 $messages_input = Message::query()->with('vacancies')->with('user_from')->
386 388 Where('to_user_id', $user_id)->OrderByDesc('created_at');
387 $messages_input = Message::query()->with('vacancies')->with('user_from')-> 389
388 Where('to_user_id', $user_id)->OrderByDesc('created_at'); 390 $messages_output = Message::query()->with('vacancies')->
389 391 with('user_to')->where('user_id', $user_id)->
390 $messages_output = Message::query()->with('vacancies')-> 392 OrderByDesc('created_at');
391 with('user_to')->where('user_id', $user_id)-> 393
392 OrderByDesc('created_at'); 394 $count_input = $messages_input->count();
393 395 $count_output = $messages_output->count();
394 $count_input = $messages_input->count(); 396
395 $count_output = $messages_output->count(); 397 if ($type_message == 'input') {
396 398 $messages = $messages_input->paginate(5);
397 if ($type_message == 'input') { 399 }
398 $messages = $messages_input->paginate(5); 400
399 } 401 if ($type_message == 'output') {
400 402 $messages = $messages_output->paginate(5);
401 if ($type_message == 'output') { 403 }
402 $messages = $messages_output->paginate(5); 404
403 } 405 //dd($messages);
404 406 // Вернуть все 100%
405 //dd($messages); 407 return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id'));
406 // Вернуть все 100% 408 }
407 return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); 409
408 } 410 // Избранный
409 411 public function favorite()
410 // Избранный 412 {
411 public function favorite() 413 return view('workers.favorite');
412 { 414 }
413 return view('workers.favorite'); 415
414 } 416 // Сменить пароль
415 417 public function new_password()
416 // Сменить пароль 418 {
417 public function new_password() 419 $email = Auth()->user()->email;
418 { 420 return view('workers.new_password', compact('email'));
419 $email = Auth()->user()->email; 421 }
420 return view('workers.new_password', compact('email')); 422
421 } 423 // Обновление пароля
422 424 public function save_new_password(Request $request) {
423 // Обновление пароля 425 $use = Auth()->user();
424 public function save_new_password(Request $request) { 426 $request->validate([
425 $use = Auth()->user(); 427 'password' => 'required|string',
426 $request->validate([ 428 'new_password' => 'required|string',
427 'password' => 'required|string', 429 'new_password2' => 'required|string'
428 'new_password' => 'required|string', 430 ]);
429 'new_password2' => 'required|string' 431
430 ]); 432 if ($request->get('new_password') == $request->get('new_password2'))
431 433 if ($request->get('password') !== $request->get('new_password')) {
432 if ($request->get('new_password') == $request->get('new_password2')) 434 $credentials = $request->only('email', 'password');
433 if ($request->get('password') !== $request->get('new_password')) { 435 if (Auth::attempt($credentials, $request->has('save_me'))) {
434 $credentials = $request->only('email', 'password'); 436
435 if (Auth::attempt($credentials, $request->has('save_me'))) { 437 if (!is_null($use->email_verified_at)){
436 438
437 if (!is_null($use->email_verified_at)){ 439 $user_data = User_Model::find($use->id);
438 440 $user_data->update([
439 $user_data = User_Model::find($use->id); 441 'password' => Hash::make($request->get('new_password')),
440 $user_data->update([ 442 'pubpassword' => base64_encode($request->get('new_password')),
441 'password' => Hash::make($request->get('new_password')), 443 ]);
442 'pubpassword' => base64_encode($request->get('new_password')), 444 return redirect()
443 ]); 445 ->route('worker.new_password')
444 return redirect() 446 ->with('success', 'Поздравляю! Вы обновили свой пароль!');
445 ->route('worker.new_password') 447 }
446 ->with('success', 'Поздравляю! Вы обновили свой пароль!'); 448
447 } 449 return redirect()
448 450 ->route('worker.new_password')
449 return redirect() 451 ->withError('Данная учетная запись не было верифицированна!');
450 ->route('worker.new_password') 452 }
451 ->withError('Данная учетная запись не было верифицированна!'); 453 }
452 } 454
453 } 455 return redirect()
454 456 ->route('worker.new_password')
455 return redirect() 457 ->withErrors('Не совпадение данных, обновите пароли!');
456 ->route('worker.new_password') 458 }
457 ->withErrors('Не совпадение данных, обновите пароли!'); 459
458 } 460 // Удаление профиля форма
459 461 public function delete_profile()
460 // Удаление профиля форма 462 {
461 public function delete_profile() 463 $login = Auth()->user()->email;
462 { 464 return view('workers.delete_profile', compact('login'));
463 $login = Auth()->user()->email; 465 }
464 return view('workers.delete_profile', compact('login')); 466
465 } 467 // Удаление профиля код
466 468 public function delete_profile_result(Request $request) {
467 // Удаление профиля код 469 $Answer = $request->all();
468 public function delete_profile_result(Request $request) { 470 $user_id = Auth()->user()->id;
469 $Answer = $request->all(); 471 $request->validate([
470 $user_id = Auth()->user()->id; 472 'password' => 'required|string',
471 $request->validate([ 473 ]);
472 'password' => 'required|string', 474
473 ]); 475 $credentials = $request->only('email', 'password');
474 476 if (Auth::attempt($credentials)) {
475 $credentials = $request->only('email', 'password'); 477 Auth::logout();
476 if (Auth::attempt($credentials)) { 478 $it = User_Model::find($user_id);
477 Auth::logout(); 479 $it->delete();
478 $it = User_Model::find($user_id); 480 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт');
479 $it->delete(); 481 } else {
480 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); 482 return redirect()->route('worker.delete_profile')
481 } else { 483 ->withErrors( 'Неверный пароль! Нужен корректный пароль');
482 return redirect()->route('worker.delete_profile') 484 }
483 ->withErrors( 'Неверный пароль! Нужен корректный пароль'); 485 }
484 } 486
485 } 487 // Регистрация соискателя
486 488 public function register_worker(Request $request)
487 // Регистрация соискателя 489 {
488 public function register_worker(Request $request) 490 $params = $request->all();
489 { 491 $params['is_worker'] = 1;
490 $params = $request->all(); 492
491 $params['is_worker'] = 1; 493 $rules = [
492 494 'surname' => ['required', 'string', 'max:255'],
493 $rules = [ 495 'name_man' => ['required', 'string', 'max:255'],
494 'surname' => ['required', 'string', 'max:255'], 496 'email' => ['required', 'email', 'max:255', 'unique:users'],
495 'name_man' => ['required', 'string', 'max:255'], 497 'password' => ['required', 'string', 'min:6']
496 'email' => ['required', 'email', 'max:255', 'unique:users'], 498 ];
497 'password' => ['required', 'string', 'min:6'] 499
498 ]; 500 $messages = [
499 501 'required' => 'Укажите обязательное поле',
500 $messages = [ 502 'min' => [
501 'required' => 'Укажите обязательное поле', 503 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
502 'min' => [ 504 'integer' => 'Поле «:attribute» должно быть :min или больше',
503 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 505 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
504 'integer' => 'Поле «:attribute» должно быть :min или больше', 506 ],
505 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 507 'max' => [
506 ], 508 'string' => 'Поле «:attribute» должно быть не больше :max символов',
507 'max' => [ 509 'integer' => 'Поле «:attribute» должно быть :max или меньше',
508 'string' => 'Поле «:attribute» должно быть не больше :max символов', 510 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
509 'integer' => 'Поле «:attribute» должно быть :max или меньше', 511 ]
510 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 512 ];
511 ] 513
512 ]; 514 $email = $request->get('email');
513 515 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) {
514 $email = $request->get('email'); 516 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл"));
515 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { 517 }
516 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); 518
517 } 519 if ($request->get('password') !== $request->get('confirmed')){
518 520 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля"));
519 if ($request->get('password') !== $request->get('confirmed')){ 521 }
520 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); 522
521 } 523 if (strlen($request->get('password')) < 6) {
522 524 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!"));
523 if (strlen($request->get('password')) < 6) { 525 }
524 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); 526
525 } 527 /*$haystack = $request->get('password');
526 528
527 /*$haystack = $request->get('password'); 529 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?');
528 530 $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z',
529 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); 531 'X', 'C', 'V', 'B', 'N', 'M');
530 $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 532 $lenpwd_bool = true;
531 'X', 'C', 'V', 'B', 'N', 'M'); 533 $spec_bool = false;
532 $lenpwd_bool = true; 534 $alpha_bool = false;
533 $spec_bool = false; 535
534 $alpha_bool = false; 536 if (strlen($haystack) < 8) $lenpwd_bool = false;
535 537
536 if (strlen($haystack) < 8) $lenpwd_bool = false; 538 foreach ($specsumbol as $it) {
537 539 if (strpos($haystack, $it) !== false) {
538 foreach ($specsumbol as $it) { 540 $spec_bool = true;
539 if (strpos($haystack, $it) !== false) { 541 }
540 $spec_bool = true; 542 }
541 } 543
542 } 544 foreach ($alpha as $it) {
543 545 if (strpos($haystack, $it) !== false) {
544 foreach ($alpha as $it) { 546 $alpha_bool = true;
545 if (strpos($haystack, $it) !== false) { 547 }
546 $alpha_bool = true; 548 }
547 } 549
548 } 550 if ((!$spec_bool) || (!$alpha_bool)) {
549 551 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?"));
550 if ((!$spec_bool) || (!$alpha_bool)) { 552 }*/
551 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); 553
552 }*/ 554 if (($request->has('politik')) && ($request->get('politik') == 1)) {
553 555 $validator = Validator::make($params, $rules, $messages);
554 if (($request->has('politik')) && ($request->get('politik') == 1)) { 556
555 $validator = Validator::make($params, $rules, $messages); 557 if ($validator->fails()) {
556 558 return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе."));
557 if ($validator->fails()) { 559 } else {
558 return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); 560 //dd($params);
559 } else { 561 $user = $this->create($params);
560 //dd($params); 562 event(new Registered($user));
561 $user = $this->create($params); 563 Auth::guard()->login($user);
562 event(new Registered($user)); 564 }
563 Auth::guard()->login($user); 565 if ($user) {
564 } 566 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));;
565 if ($user) { 567 } else {
566 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; 568 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!"));
567 } else { 569 }
568 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); 570
569 } 571 } else {
570 572 return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!"));
571 } else { 573 }
572 return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); 574 }
573 } 575
574 } 576 // Звездная оценка и ответ
575 577 public function stars_answer(Request $request) {
576 // Звездная оценка и ответ 578 $params = $request->all();
577 public function stars_answer(Request $request) { 579 $rules = [
578 $params = $request->all(); 580 'message' => ['required', 'string', 'max:255'],
579 $rules = [ 581 ];
580 'message' => ['required', 'string', 'max:255'], 582
581 ]; 583 $messages = [
582 584 'required' => 'Укажите обязательное поле',
583 $messages = [ 585 'min' => [
584 'required' => 'Укажите обязательное поле', 586 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
585 'min' => [ 587 'integer' => 'Поле «:attribute» должно быть :min или больше',
586 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 588 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
587 'integer' => 'Поле «:attribute» должно быть :min или больше', 589 ],
588 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 590 'max' => [
589 ], 591 'string' => 'Поле «:attribute» должно быть не больше :max символов',
590 'max' => [ 592 'integer' => 'Поле «:attribute» должно быть :max или меньше',
591 'string' => 'Поле «:attribute» должно быть не больше :max символов', 593 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
592 'integer' => 'Поле «:attribute» должно быть :max или меньше', 594 ]
593 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 595 ];
594 ] 596 $response_worker = ResponseWork::create($params);
595 ]; 597 return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!');
596 $response_worker = ResponseWork::create($params); 598 }
597 return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); 599
598 } 600 public function TestWorker()
599 601 {
600 public function TestWorker() 602 $Use = new User();
601 { 603
602 $Use = new User(); 604 $Code_user = $Use->create([
603 605 'name' => 'surname name_man',
604 $Code_user = $Use->create([ 606 'name_man' => 'name_man',
605 'name' => 'surname name_man', 607 'surname' => 'surname',
606 'name_man' => 'name_man', 608 'surname2' => 'surname2',
607 'surname' => 'surname', 609 'subscribe_email' => '1',
608 'surname2' => 'surname2', 610 'email' => 'email@mail.com',
609 'subscribe_email' => '1', 611 'telephone' => '1234567890',
610 'email' => 'email@mail.com', 612 'password' => Hash::make('password'),
611 'telephone' => '1234567890', 613 'pubpassword' => base64_encode('password'),
612 'password' => Hash::make('password'), 614 'email_verified_at' => Carbon::now(),
613 'pubpassword' => base64_encode('password'), 615 'is_worker' => 1,
614 'email_verified_at' => Carbon::now(), 616 ]);
615 'is_worker' => 1, 617
616 ]); 618 if ($Code_user->id > 0) {
617 619 $Worker = new Worker();
618 if ($Code_user->id > 0) { 620 $Worker->user_id = $Code_user->id;
619 $Worker = new Worker(); 621 $Worker->position_work = 1; //'job_titles';
620 $Worker->user_id = $Code_user->id; 622 $Worker->email = 'email@email.com';
621 $Worker->position_work = 1; //'job_titles'; 623 $Worker->telephone = '1234567890';
622 $Worker->email = 'email@email.com'; 624 $status = $Worker->save();
623 $Worker->telephone = '1234567890'; 625
624 $status = $Worker->save(); 626 $Title_Worker = new Title_worker();
625 627 $Title_Worker->worker_id = $Worker->id;
626 $Title_Worker = new Title_worker(); 628 $Title_Worker->job_title_id = 1;
627 $Title_Worker->worker_id = $Worker->id; 629 $Title_Worker->save();
628 $Title_Worker->job_title_id = 1; 630 }
629 $Title_Worker->save(); 631 }
630 } 632
631 } 633 // Создание пользователя
632 634 protected function create(array $data)
633 // Создание пользователя 635 {
634 protected function create(array $data) 636 $Use = new User();
635 { 637
636 $Use = new User(); 638 $Code_user = $Use->create([
637 639 'name' => $data['surname']." ".$data['name_man'],
638 $Code_user = $Use->create([ 640 'name_man' => $data['name_man'],
639 'name' => $data['surname']." ".$data['name_man'], 641 'surname' => $data['surname'],
640 'name_man' => $data['name_man'], 642 'surname2' => $data['surname2'],
641 'surname' => $data['surname'], 643 'subscribe_email' => $data['email'],
642 'surname2' => $data['surname2'], 644 'email' => $data['email'],
643 'subscribe_email' => $data['email'], 645 'telephone' => $data['telephone'],
644 'email' => $data['email'], 646 'password' => Hash::make($data['password']),
645 'telephone' => $data['telephone'], 647 'pubpassword' => base64_encode($data['password']),
646 'password' => Hash::make($data['password']), 648 'email_verified_at' => Carbon::now(),
647 'pubpassword' => base64_encode($data['password']), 649 'is_worker' => $data['is_worker'],
648 'email_verified_at' => Carbon::now(), 650 ]);
649 'is_worker' => $data['is_worker'], 651
650 ]); 652 if ($Code_user->id > 0) {
651 653 $Worker = new Worker();
652 if ($Code_user->id > 0) { 654 $Worker->user_id = $Code_user->id;
653 $Worker = new Worker(); 655 $Worker->position_work = $data['job_titles'];
654 $Worker->user_id = $Code_user->id; 656 $Worker->email = $data['email'];
655 $Worker->position_work = $data['job_titles']; 657 $Worker->telephone = $data['telephone'];
656 $Worker->email = $data['email']; 658 $Worker->save();
657 $Worker->telephone = $data['telephone']; 659
658 $Worker->save(); 660 if (isset($Worker->id)) {
659 661 $Title_Worker = new Title_worker();
660 if (isset($Worker->id)) { 662 $Title_Worker->worker_id = $Worker->id;
661 $Title_Worker = new Title_worker(); 663 $Title_Worker->job_title_id = $data['job_titles'];
662 $Title_Worker->worker_id = $Worker->id; 664 $Title_Worker->save();
663 $Title_Worker->job_title_id = $data['job_titles']; 665 }
664 $Title_Worker->save(); 666
665 } 667 return $Code_user;
666 668 }
667 return $Code_user; 669 }
668 } 670
669 } 671 // Вакансии избранные
670 672 public function colorado(Request $request) {
671 // Вакансии избранные 673 $IP_address = RusDate::ip_addr_client();
672 public function colorado(Request $request) { 674 $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get();
673 $IP_address = RusDate::ip_addr_client(); 675
674 $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); 676 if ($Arr->count()) {
675 677 $A = Array();
676 if ($Arr->count()) { 678 foreach ($Arr as $it) {
677 $A = Array(); 679 $A[] = $it->code_record;
678 foreach ($Arr as $it) { 680 }
679 $A[] = $it->code_record; 681
680 } 682 $Query = Ad_employer::query()->whereIn('id', $A);
681 683 } else {
682 $Query = Ad_employer::query()->whereIn('id', $A); 684 $Query = Ad_employer::query()->where('id', '=', '0');
683 } else { 685 }
684 $Query = Ad_employer::query()->where('id', '=', '0'); 686
685 } 687 $Query = $Query->with('jobs')->
686 688 with('cat')->
687 $Query = $Query->with('jobs')-> 689 with('employer')->
688 with('cat')-> 690 whereHas('jobs_code', function ($query) use ($request) {
689 with('employer')-> 691 if ($request->ajax()) {
690 whereHas('jobs_code', function ($query) use ($request) { 692 if (null !== ($request->get('job'))) {
691 if ($request->ajax()) { 693 $query->where('job_title_id', $request->get('job'));
692 if (null !== ($request->get('job'))) { 694 }
693 $query->where('job_title_id', $request->get('job')); 695 }
694 } 696 })->select('ad_employers.*');
695 } 697
696 })->select('ad_employers.*'); 698 $Job_title = Job_title::query()->OrderBy('name')->get();
697 699
698 $Job_title = Job_title::query()->OrderBy('name')->get(); 700 $Query_count = $Query->count();
699 701
700 $Query_count = $Query->count(); 702 $Query = $Query->OrderBy('updated_at')->paginate(3);
701 703
702 $Query = $Query->OrderBy('updated_at')->paginate(3); 704
703 705 return view('workers.favorite', compact('Query',
704 706 'Query_count',
705 return view('workers.favorite', compact('Query', 707 'Job_title'));
706 'Query_count', 708
707 'Job_title')); 709 }
708 710
709 } 711 //Переписка
710 712 public function dialog(User_Model $user1, User_Model $user2, Request $request) {
711 //Переписка 713 // Получение параметров.
712 public function dialog(User_Model $user1, User_Model $user2, Request $request) { 714 if ($request->has('ad_employer')){
713 // Получение параметров. 715 $ad_employer = $request->get('ad_employer');
714 if ($request->has('ad_employer')){ 716 } else {
715 $ad_employer = $request->get('ad_employer'); 717 $ad_employer = 0;
716 } else { 718 }
719
720 if (isset($user1->id)) {
721 $sender = User_Model::query()->with('workers')->
722 with('employers')->
723 where('id', $user1->id)->first();
724 }
717 $ad_employer = 0; 725
718 } 726 if (isset($user2->id)) {
719 727 $companion = User_Model::query()->with('workers')->
720 if (isset($user1->id)) { 728 with('employers')->
721 $sender = User_Model::query()->with('workers')-> 729 where('id', $user2->id)->first();
722 with('employers')-> 730 }
723 where('id', $user1->id)->first(); 731
724 } 732 $Messages = Message::query()->
725 733 //with('response')->
726 if (isset($user2->id)) { 734 where(function($query) use ($user1, $user2) {
727 $companion = User_Model::query()->with('workers')-> 735 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id);
728 with('employers')-> 736 })->orWhere(function($query) use ($user1, $user2) {
729 where('id', $user2->id)->first(); 737 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id);
730 } 738 })->OrderBy('created_at')->get();
731 739
732 $Messages = Message::query()-> 740 $id_vac = null;
733 //with('response')-> 741 /*foreach ($Messages as $it) {
734 where(function($query) use ($user1, $user2) { 742 if (isset($it->response)) {
735 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); 743 foreach ($it->response as $r) {
736 })->orWhere(function($query) use ($user1, $user2) { 744 if (isset($r->ad_employer_id)) {
737 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); 745 $id_vac = $r->ad_employer_id;
738 })->OrderBy('created_at')->get(); 746 break;
739 747 }
740 $id_vac = null; 748 }
741 /*foreach ($Messages as $it) { 749 }
742 if (isset($it->response)) { 750 if (!is_null($id_vac)) break;
743 foreach ($it->response as $r) { 751 }*/
744 if (isset($r->ad_employer_id)) { 752
745 $id_vac = $r->ad_employer_id; 753 //$ad_employer = null;
746 break;
747 }
748 } 754 //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first();
749 } 755
750 if (!is_null($id_vac)) break; 756 return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer'));
751 }*/ 757 }
752 758
753 //$ad_employer = null; 759 // Даунылоады
754 //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); 760 public function download(Worker $worker) {
755 761 $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...'];
756 return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); 762 view()->share('house',$arr_house);
757 } 763 $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape');
758 764 return $pdf->stream();
759 // Даунылоады 765 }
760 public function download(Worker $worker) { 766
761 $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; 767 // Поднятие анкеты
762 view()->share('house',$arr_house); 768 public function up(Worker $worker) {
763 $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); 769 $worker->updated_at = Carbon::now();
764 return $pdf->stream(); 770 $worker->save();
765 } 771 // 0
766 772 return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных');
767 // Поднятие анкеты 773 }
768 public function up(Worker $worker) { 774
769 $worker->updated_at = Carbon::now(); 775 // Форма сертификате
770 $worker->save(); 776 public function new_sertificate(Worker $worker) {
771 // 0 777 return view('workers.sertificate_add', compact('worker'));
772 return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); 778 }
773 } 779
774 780 // Добавление сертификата
775 // Форма сертификате 781 public function add_serificate(SertificationRequest $request) {
776 public function new_sertificate(Worker $worker) { 782 $params = $request->all();
777 return view('workers.sertificate_add', compact('worker')); 783
778 } 784 $Sertificate = new sertification();
779 785 $Sertificate->create($params);
780 // Добавление сертификата 786 $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get();
781 public function add_serificate(SertificationRequest $request) { 787 return redirect()->route('worker.cabinet');
782 $params = $request->all(); 788 //return view('ajax.documents', compact('Docs'));
783 789 }
784 $Sertificate = new sertification(); 790
785 $Sertificate->create($params); 791 // Удалить сертификат
786 $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get(); 792 public function delete_sertificate(sertification $doc) {
787 return redirect()->route('worker.cabinet'); 793 $doc->delete();
788 //return view('ajax.documents', compact('Docs')); 794
789 } 795 return redirect()->route('worker.cabinet');
790 796 }
791 // Удалить сертификат 797
792 public function delete_sertificate(sertification $doc) { 798 // Редактирование сертификата
793 $doc->delete(); 799 public function edit_sertificate(Worker $worker, sertification $doc) {
794 800 return view('workers.sertificate_edit', compact('doc', 'worker'));
795 return redirect()->route('worker.cabinet'); 801 }
796 } 802
797 803 // Редактирование обновление сертификата
798 // Редактирование сертификата 804 public function update_serificate(SertificationRequest $request, sertification $doc) {
799 public function edit_sertificate(Worker $worker, sertification $doc) { 805 $all = $request->all();
800 return view('workers.sertificate_edit', compact('doc', 'worker')); 806 $doc->worker_id = $all['worker_id'];
801 } 807 $doc->name = $all['name'];
802 808 $doc->end_begin = $all['end_begin'];
803 // Редактирование обновление сертификата 809 $doc->save();
804 public function update_serificate(SertificationRequest $request, sertification $doc) { 810
805 $all = $request->all(); 811 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!');
806 $doc->worker_id = $all['worker_id']; 812 }
807 $doc->name = $all['name']; 813
808 $doc->end_begin = $all['end_begin']; 814 public function delete_add_diplom(Request $request, Worker $worker) {
809 $doc->save(); 815 $infoblok_id = $request->get('infoblok_id');
810 816
811 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); 817 if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0)
812 } 818 $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete();
813 819 else {
814 public function delete_add_diplom(Request $request, Worker $worker) { 820 $params['infoblok_id'] = $infoblok_id;
815 $infoblok_id = $request->get('infoblok_id'); 821 $params['worker_id'] = $worker->id;
816 822 $params['status'] = $request->get('val');
817 if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) 823 $id = Dop_info::create($params);
818 $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); 824 //$id = $worker->infobloks()->sync([$infoblok_id]);
819 else { 825 }
820 $params['infoblok_id'] = $infoblok_id; 826
821 $params['worker_id'] = $worker->id; 827 //$Infoblocks = infobloks::query()->get();
822 $params['status'] = $request->get('val'); 828 return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks'));
823 $id = Dop_info::create($params); 829 }
824 //$id = $worker->infobloks()->sync([$infoblok_id]); 830
825 } 831
826 832
827 //$Infoblocks = infobloks::query()->get(); 833 // Добавление диплома
828 return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); 834 public function add_diplom_ajax(Request $request) {
829 } 835 // конец
830 836 $params = $request->all();
831 837 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count();
832 838
833 // Добавление диплома 839 if ($count == 0) $dop_info = Dop_info::create($params);
834 public function add_diplom_ajax(Request $request) { 840 $Infoblocks = infobloks::query()->get();
835 // конец 841 $Worker = Worker::query()->where('id', $request->get('worker_id'))->get();
836 $params = $request->all(); 842 $data = Dop_info::query()->where('worker_id', $request->has('worker_id'));
837 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); 843 return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker'));
838 844 }
839 if ($count == 0) $dop_info = Dop_info::create($params); 845
840 $Infoblocks = infobloks::query()->get(); 846 // Добавление диплома без ajax
841 $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); 847 public function add_diplom(Worker $worker) {
842 $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); 848 $worker_id = $worker->id;
843 return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); 849 $Infoblocks = infobloks::query()->get();
844 } 850 return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks'));
845 851 }
846 // Добавление диплома без ajax 852 // Сохранить
847 public function add_diplom(Worker $worker) { 853 // Сохраняю диплом
848 $worker_id = $worker->id; 854 public function add_diplom_save(Request $request) {
849 $Infoblocks = infobloks::query()->get(); 855 $params = $request->all();
850 return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); 856 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count();
851 } 857 if ($count == 0) $dop_info = Dop_info::create($params);
852 // Сохранить 858 return redirect()->route('worker.cabinet');
853 // Сохраняю диплом 859 }
854 public function add_diplom_save(Request $request) { 860
855 $params = $request->all(); 861 // Добавление стандартного документа
856 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); 862 public function add_document(Worker $worker) {
857 if ($count == 0) $dop_info = Dop_info::create($params); 863 return view('workers.docs', compact('worker'));
858 return redirect()->route('worker.cabinet'); 864 }
859 } 865
860 866 //Сохранение стандартого документа
861 // Добавление стандартного документа 867 public function add_document_save(DocumentsRequest $request) {
862 public function add_document(Worker $worker) { 868 $params = $request->all();
863 return view('workers.docs', compact('worker')); 869 $place_work = place_works::create($params);
864 } 870 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!');
865 871 }
866 //Сохранение стандартого документа 872
867 public function add_document_save(DocumentsRequest $request) { 873 // Редактирование документа
868 $params = $request->all(); 874 public function edit_document(place_works $doc, Worker $worker) {
869 $place_work = place_works::create($params); 875 return view('workers.docs-edit', compact('doc', 'worker'));
870 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!'); 876 }
871 } 877
872 878 //Сохранение отредактированного документа
873 // Редактирование документа 879 public function edit_document_save(DocumentsRequest $request, place_works $doc) {
874 public function edit_document(place_works $doc, Worker $worker) { 880 $params = $request->all();
875 return view('workers.docs-edit', compact('doc', 'worker')); 881 $doc->update($params);
876 } 882
877 883 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!');
878 //Сохранение отредактированного документа 884 }
879 public function edit_document_save(DocumentsRequest $request, place_works $doc) { 885
880 $params = $request->all(); 886 // Удаление документа
881 $doc->update($params); 887 public function delete_document(place_works $doc) {
882 888 $doc->delete();
883 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); 889 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!');
884 } 890 }
885 891
886 // Удаление документа 892 //Отправка нового сообщения
887 public function delete_document(place_works $doc) { 893 public function new_message(Request $request) {
888 $doc->delete(); 894 $params = $request->all();
889 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); 895
890 } 896 $id = $params['send_user_id'];
891 897 $message = new Message();
892 //Отправка нового сообщения 898 $message->user_id = $params['send_user_id'];
893 public function new_message(Request $request) { 899 $message->to_user_id = $params['send_to_user_id'];
894 $params = $request->all(); 900 $message->title = $params['send_title'];
895 901 $message->text = $params['send_text'];
896 $id = $params['send_user_id']; 902 $message->ad_employer_id = $params['send_vacancy'];
897 $message = new Message(); 903 if ($request->has('send_file')) {
898 $message->user_id = $params['send_user_id']; 904 $message->file = $request->file('send_file')->store("worker/$id", 'public');
899 $message->to_user_id = $params['send_to_user_id']; 905 }
900 $message->title = $params['send_title']; 906 $message->flag_new = 1;
901 $message->text = $params['send_text']; 907 $id_message = $message->save();
902 $message->ad_employer_id = $params['send_vacancy']; 908
903 if ($request->has('send_file')) { 909 $data['message_id'] = $id_message;
904 $message->file = $request->file('send_file')->store("worker/$id", 'public'); 910 $data['ad_employer_id'] = $params['send_vacancy'];
905 } 911 $data['job_title_id'] = $params['send_job_title_id'];
906 $message->flag_new = 1; 912 $data['flag'] = 1;
907 $id_message = $message->save(); 913 $ad_responce = ad_response::create($data);
908 914 return redirect()->route('worker.messages', ['type_message' => 'output']);
909 $data['message_id'] = $id_message; 915 }
910 $data['ad_employer_id'] = $params['send_vacancy']; 916
911 $data['job_title_id'] = $params['send_job_title_id']; 917
912 $data['flag'] = 1; 918 public function test123(Request $request) {
913 $ad_responce = ad_response::create($data); 919 $params = $request->all();
914 return redirect()->route('worker.messages', ['type_message' => 'output']); 920 $user1 = $params['user_id'];
915 } 921 $user2 = $params['to_user_id'];
916 922 $id_vacancy = $params['ad_employer_id'];
917 923 $ad_name = $params['ad_name'];
918 public function test123(Request $request) { 924
919 $params = $request->all(); 925 $rules = [
920 $user1 = $params['user_id']; 926 'text' => 'required|min:1|max:150000',
921 $user2 = $params['to_user_id']; 927 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000'
922 $id_vacancy = $params['ad_employer_id']; 928 ];
923 $ad_name = $params['ad_name']; 929 $messages = [
924 930 'required' => 'Укажите обязательное поле',
925 $rules = [ 931 'min' => [
926 'text' => 'required|min:1|max:150000', 932 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
927 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' 933 'integer' => 'Поле «:attribute» должно быть :min или больше',
928 ]; 934 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
929 $messages = [ 935 ],
930 'required' => 'Укажите обязательное поле', 936 'max' => [
931 'min' => [ 937 'string' => 'Поле «:attribute» должно быть не больше :max символов',
932 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 938 'integer' => 'Поле «:attribute» должно быть :max или меньше',
933 'integer' => 'Поле «:attribute» должно быть :min или больше', 939 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
934 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 940 ]
935 ], 941 ];
936 'max' => [ 942
937 'string' => 'Поле «:attribute» должно быть не больше :max символов', 943 $validator = Validator::make($request->all(), $rules, $messages);
938 'integer' => 'Поле «:attribute» должно быть :max или меньше', 944
939 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 945 if ($validator->fails()) {
940 ] 946 return redirect()->route('worker.dialog', ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name])
941 ]; 947 ->withErrors($validator);
942 948 } else {
943 $validator = Validator::make($request->all(), $rules, $messages); 949 if ($request->has('file')) {
944 950 $params['file'] = $request->file('file')->store("messages", 'public');
945 if ($validator->fails()) { 951 }
946 return redirect()->route('worker.dialog', ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]) 952 Message::create($params);
947 ->withErrors($validator); 953 //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
948 } else { 954 return redirect()->route('worker.dialog',
949 if ($request->has('file')) { 955 ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]);
950 $params['file'] = $request->file('file')->store("messages", 'public'); 956
951 } 957 }
952 Message::create($params); 958 }
953 //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); 959
954 return redirect()->route('worker.dialog', 960 // Информация о предыдущих компаниях
955 ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]); 961 public function new_prev_company(Worker $worker) {
956 962 return view('workers.prev_company_form', compact('worker'));
957 } 963 }
958 } 964
959 965 // Добавление контакта компании
960 // Информация о предыдущих компаниях 966 public function add_prev_company(PrevCompanyRequest $request) {
961 public function new_prev_company(Worker $worker) { 967 // Возвращение параметров
962 return view('workers.prev_company_form', compact('worker')); 968 $all = $request->all();
963 } 969 $PrevCompany = PrevCompany::create($all);
964 970
965 // Добавление контакта компании 971 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись');
966 public function add_prev_company(PrevCompanyRequest $request) { 972 }
967 // Возвращение параметров 973
968 $all = $request->all(); 974 // Редактирование контакта компании
969 $PrevCompany = PrevCompany::create($all); 975 public function edit_prev_company(PrevCompany $doc, Worker $worker) {
970 976 return view('workers.prev_company_edit_form', compact('doc', 'worker'));
971 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); 977 }
972 } 978
973 979 //Сохранение редактирования контакта компании
974 // Редактирование контакта компании 980 public function update_prev_company(PrevCompany $doc, Request $request){
975 public function edit_prev_company(PrevCompany $doc, Worker $worker) { 981 $all = $request->all();
976 return view('workers.prev_company_edit_form', compact('doc', 'worker')); 982 $doc->update($all);
977 } 983
978 984 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись');
979 //Сохранение редактирования контакта компании 985 }
980 public function update_prev_company(PrevCompany $doc, Request $request){ 986
981 $all = $request->all(); 987 // Удаление контакта предыдущей компании
982 $doc->update($all); 988 public function delete_prev_company(PrevCompany $doc) {
983 989 $doc->delete();
984 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); 990 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!');
985 } 991 }
986 992 }
resources/views/admin/users/index.blade.php
1 @extends('layout.admin', ['title' => $title]) 1 @extends('layout.admin', ['title' => $title])
2 2
3 @section('script') 3 @section('script')
4 <script> 4 <script>
5 $(document).ready(function() { 5 $(document).ready(function() {
6 $(document).on('click', '.check_click', function () { 6 $(document).on('click', '.check_click', function () {
7 var this_ = $(this); 7 var this_ = $(this);
8 var value = this_.val(); 8 var value = this_.val();
9 var field = this_.attr('data-field'); 9 var field = this_.attr('data-field');
10 var value_id = this_.attr('data-id'); 10 var value_id = this_.attr('data-id');
11 var ajax_block = $('#ajax_block'); 11 var ajax_block = $('#ajax_block');
12 var bool = 0; 12 var bool = 0;
13 var str_get = ''; 13 var str_get = '';
14 14
15 if(this.checked){ 15 if(this.checked){
16 bool = 1; 16 bool = 1;
17 } else { 17 } else {
18 bool = 0; 18 bool = 0;
19 } 19 }
20 console.log(field); 20 console.log(field);
21 str_get = "id=" + value_id + "&" + field + "=" + bool; 21 str_get = "id=" + value_id + "&" + field + "=" + bool;
22 console.log(str_get); 22 console.log(str_get);
23 23
24 $.ajax({ 24 $.ajax({
25 type: "GET", 25 type: "GET",
26 url: "{{ url()->full()}}", 26 url: "{{ url()->full()}}",
27 data: str_get, 27 data: str_get,
28 success: function (data) { 28 success: function (data) {
29 console.log('Обновление таблицы пользователей '); 29 console.log('Обновление таблицы пользователей ');
30 //data = JSON.parse(data); 30 //data = JSON.parse(data);
31 //console.log(data); 31 //console.log(data);
32 ajax_block.html(data); 32 ajax_block.html(data);
33 }, 33 },
34 headers: { 34 headers: {
35 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 35 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
36 }, 36 },
37 error: function (data) { 37 error: function (data) {
38 console.log('Error: ' + data); 38 console.log('Error: ' + data);
39 } 39 }
40 }); 40 });
41 }); 41 });
42 }); 42 });
43 </script> 43 </script>
44 @endsection 44 @endsection
45 45
46 @section('search') 46 @section('search')
47 @include('admin.find') 47 @include('admin.find')
48 @endsection 48 @endsection
49 49
50 @section('content') 50 @section('content')
51 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> 51 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
52 <div class="w-full overflow-x-auto"> 52 <div class="w-full overflow-x-auto">
53 <table class="w-full whitespace-no-wrap"> 53 <table class="w-full whitespace-no-wrap">
54 <thead> 54 <thead>
55 <tr 55 <tr
56 class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800" 56 class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800"
57 > 57 >
58 <th class="px-4 py-3 text-xs">№</th> 58 <th class="px-4 py-3 text-xs">№</th>
59 <th class="px-4 py-3 text-xs">Имя</th> 59 <th class="px-4 py-3 text-xs">Имя</th>
60 <th class="px-4 py-3 text-xs">Email/логин</th> 60 <th class="px-4 py-3 text-xs">Email/логин</th>
61 <th class="px-4 py-3 text-xs">Работодатель/работник/администратор</th> 61 <th class="px-4 py-3 text-xs">Работодатель/работник/администратор</th>
62 <th class="px-4 py-3 text-xs">Админ</th> 62 <th class="px-4 py-3 text-xs">Админ</th>
63 <th class="px-4 py-3 text-xs">Менеджер</th> 63 <th class="px-4 py-3 text-xs">Менеджер</th>
64 <th class="px-4 py-3 text-xs">Дата регист.</th> 64 <th class="px-4 py-3 text-xs">Дата регист.</th>
65 <th class="px-4 py-3 text-xs">Удаление</th>
65 </tr> 66 </tr>
66 </thead> 67 </thead>
67 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> 68 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
68 @foreach($users as $user) 69 @foreach($users as $user)
69 <tr class="text-gray-700 dark:text-gray-400"> 70 <tr class="text-gray-700 dark:text-gray-400">
70 <td class="px-4 py-3 text-xs"> 71 <td class="px-4 py-3 text-xs">
71 {{$user->id}} 72 {{$user->id}}
72 </td> 73 </td>
73 <td class="px-4 py-3 text-xs"> 74 <td class="px-4 py-3 text-xs">
74 <a style="text-decoration: underline;" href="{{ route('admin.user-profile', ['user' => $user->id]) }}">{{ $user->name }}</a> 75 <a style="text-decoration: underline;" href="{{ route('admin.user-profile', ['user' => $user->id]) }}">{{ $user->name }}</a>
75 </td> 76 </td>
76 <td class="px-4 py-3 text-xs"> 77 <td class="px-4 py-3 text-xs">
77 {{ $user->email }} 78 {{ $user->email }}
78 </td> 79 </td>
79 <td class="px-4 py-3 text-xs"> 80 <td class="px-4 py-3 text-xs">
80 <span class="px-2 py-1 font-semibold leading-tight text-green-700 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100"> 81 <span class="px-2 py-1 font-semibold leading-tight text-green-700 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100">
81 @if ($user->is_worker) 82 @if ($user->is_worker)
82 Работник 83 Работник
83 @else 84 @else
84 Работодатель 85 Работодатель
85 @endif 86 @endif
86 </span> 87 </span>
87 @if ($user->admin) 88 @if ($user->admin)
88 <span class="px-2 py-1 font-semibold leading-tight text-orange-700 bg-orange-100 rounded-full dark:text-white dark:bg-orange-600"> 89 <span class="px-2 py-1 font-semibold leading-tight text-orange-700 bg-orange-100 rounded-full dark:text-white dark:bg-orange-600">
89 Администратор 90 Администратор
90 </span> 91 </span>
91 @endif 92 @endif
92 @if ($user->is_bd) 93 @if ($user->is_bd)
93 <span class="px-2 py-1 font-semibold leading-tight text-red-700 bg-red-100 rounded-full dark:text-red-100 dark:bg-red-700"> 94 <span class="px-2 py-1 font-semibold leading-tight text-red-700 bg-red-100 rounded-full dark:text-red-100 dark:bg-red-700">
94 База данных 95 База данных
95 </span> 96 </span>
96 @endif 97 @endif
97 </td> 98 </td>
98 99
99 <td class="px-4 py-3 text-xs"> 100 <td class="px-4 py-3 text-xs">
100 @if ($user->id > 1) 101 @if ($user->id > 1)
101 <input type="checkbox" class="check_click" data-id="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/> 102 <input type="checkbox" class="check_click" data-id="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/>
102 @endif 103 @endif
103 </td> 104 </td>
104 105
105 <td class="px-4 py-3 text-xs"> 106 <td class="px-4 py-3 text-xs">
106 @if ($user->id > 1) 107 @if ($user->id > 1)
107 <input type="checkbox" class="check_click" data-id="{{$user->id}}" data-field="is_manager" name="manager_{{$user->id}}" {{ ($user->is_manager) ? "checked" : "" }}/> 108 <input type="checkbox" class="check_click" data-id="{{$user->id}}" data-field="is_manager" name="manager_{{$user->id}}" {{ ($user->is_manager) ? "checked" : "" }}/>
108 @endif 109 @endif
109 </td> 110 </td>
110 111
111 <td class="px-4 py-3 text-xs"> 112 <td class="px-4 py-3 text-xs">
112 {{ date('d.m.Y', strtotime($user->created_at)) }} 113 {{ date('d.m.Y', strtotime($user->created_at)) }}
113 </td> 114 </td>
115
116 <td class="px-4 py-3 text-xs">
117 <a href="{{ route('admin.user_delete', ['user' => $user->id]) }}">Del</a>
118 </td>
114 </tr> 119 </tr>
115 @endforeach 120 @endforeach
116 </tbody> 121 </tbody>
117 </table> 122 </table>
118 </div> 123 </div>
119 124
120 <div class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800"> 125 <div class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800">
121 {{ $users->links('admin.pagginate') }} 126 {{ $users->links('admin.pagginate') }}
122 </div> 127 </div>
123 128
124 129
125 <!--<div 130 <!--<div
126 class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800" 131 class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800"
127 > 132 >
128 <span class="flex items-center col-span-3"> 133 <span class="flex items-center col-span-3">
129 Showing 21-30 of 100 134 Showing 21-30 of 100
130 </span> 135 </span>
131 <span class="col-span-2"></span> 136 <span class="col-span-2"></span>
132 137
133 <span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end"> 138 <span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end">
134 <nav aria-label="Table navigation"> 139 <nav aria-label="Table navigation">
135 <ul class="inline-flex items-center"> 140 <ul class="inline-flex items-center">
136 <li> 141 <li>
137 <button 142 <button
138 class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple" 143 class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple"
139 aria-label="Previous" 144 aria-label="Previous"
140 > 145 >
141 <svg 146 <svg
142 aria-hidden="true" 147 aria-hidden="true"
143 class="w-4 h-4 fill-current" 148 class="w-4 h-4 fill-current"
144 viewBox="0 0 20 20" 149 viewBox="0 0 20 20"
145 > 150 >
146 <path 151 <path
147 d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" 152 d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z"
148 clip-rule="evenodd" 153 clip-rule="evenodd"
149 fill-rule="evenodd" 154 fill-rule="evenodd"
150 ></path> 155 ></path>
151 </svg> 156 </svg>
152 </button> 157 </button>
153 </li> 158 </li>
154 <li> 159 <li>
155 <button 160 <button
156 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 161 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
157 > 162 >
158 1 163 1
159 </button> 164 </button>
160 </li> 165 </li>
161 <li> 166 <li>
162 <button 167 <button
163 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 168 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
164 > 169 >
165 2 170 2
166 </button> 171 </button>
167 </li> 172 </li>
168 <li> 173 <li>
169 <button 174 <button
170 class="px-3 py-1 text-white transition-colors duration-150 bg-purple-600 border border-r-0 border-purple-600 rounded-md focus:outline-none focus:shadow-outline-purple" 175 class="px-3 py-1 text-white transition-colors duration-150 bg-purple-600 border border-r-0 border-purple-600 rounded-md focus:outline-none focus:shadow-outline-purple"
171 > 176 >
172 3 177 3
173 </button> 178 </button>
174 </li> 179 </li>
175 <li> 180 <li>
176 <button 181 <button
177 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 182 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
178 > 183 >
179 4 184 4
180 </button> 185 </button>
181 </li> 186 </li>
182 <li> 187 <li>
183 <span class="px-3 py-1">...</span> 188 <span class="px-3 py-1">...</span>
184 </li> 189 </li>
185 <li> 190 <li>
186 <button 191 <button
187 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 192 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
188 > 193 >
189 8 194 8
190 </button> 195 </button>
191 </li> 196 </li>
192 <li> 197 <li>
193 <button 198 <button
194 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 199 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
195 > 200 >
196 9 201 9
197 </button> 202 </button>
198 </li> 203 </li>
199 <li> 204 <li>
200 <button 205 <button
201 class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple" 206 class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple"
202 aria-label="Next" 207 aria-label="Next"
203 > 208 >
204 <svg 209 <svg
205 class="w-4 h-4 fill-current" 210 class="w-4 h-4 fill-current"
206 aria-hidden="true" 211 aria-hidden="true"
207 viewBox="0 0 20 20" 212 viewBox="0 0 20 20"
208 > 213 >
209 <path 214 <path
210 d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" 215 d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
211 clip-rule="evenodd" 216 clip-rule="evenodd"
212 fill-rule="evenodd" 217 fill-rule="evenodd"
213 ></path> 218 ></path>
214 </svg> 219 </svg>
215 </button> 220 </button>
216 </li> 221 </li>
217 </ul> 222 </ul>
218 </nav> 223 </nav>
219 </span> 224 </span>
220 </div>--> 225 </div>-->
221 </div> 226 </div>
222 227
223 <?//=$users->appends($_GET)->links('catalogs.paginate'); ?> 228 <?//=$users->appends($_GET)->links('catalogs.paginate'); ?>
224 229
225 230
226 @endsection 231 @endsection
227 232
resources/views/employers/dialog.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', '#send_btn', function() { 6 $(document).on('change', '#send_btn', 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 @endsection 49 @endsection
50 50
51 @section('content') 51 @section('content')
52 <section class="cabinet"> 52 <section class="cabinet">
53 <div class="container"> 53 <div class="container">
54 <ul class="breadcrumbs cabinet__breadcrumbs"> 54 <ul class="breadcrumbs cabinet__breadcrumbs">
55 <li><a href="{{ route('index') }}">Главная</a></li> 55 <li><a href="{{ route('index') }}">Главная</a></li>
56 <li><b>Личный кабинет</b></li> 56 <li><b>Личный кабинет</b></li>
57 </ul> 57 </ul>
58 <div class="cabinet__wrapper"> 58 <div class="cabinet__wrapper">
59 <div class="cabinet__side"> 59 <div class="cabinet__side">
60 <div class="cabinet__side-toper"> 60 <div class="cabinet__side-toper">
61 @include('employers.emblema') 61 @include('employers.emblema')
62 </div> 62 </div>
63 @include('employers.menu', ['item' => 5]) 63 @include('employers.menu', ['item' => 5])
64 </div> 64 </div>
65 <div class="cabinet__body"> 65 <div class="cabinet__body">
66 <div class="cabinet__body-item"> 66 <div class="cabinet__body-item">
67 <h2 class="title cabinet__title">Сообщения</h2> 67 <h2 class="title cabinet__title">Сообщения</h2>
68 </div> 68 </div>
69 <div class="cabinet__body-item"> 69 <div class="cabinet__body-item">
70 <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="back"> 70 <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="back">
71 <svg> 71 <svg>
72 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> 72 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use>
73 </svg> 73 </svg>
74 <span> 74 <span>
75 К списку чатов 75 К списку чатов
76 </span> 76 </span>
77 </a> 77 </a>
78 <div class="chatbox"> 78 <div class="chatbox">
79 <div class="chatbox__toper"> 79 <div class="chatbox__toper">
80 @if ($companion->is_worker) 80 @if ($companion->is_worker)
81 <div class="chatbox__toper-info messages__item-info"> 81 <div class="chatbox__toper-info messages__item-info">
82 <div class="messages__item-photo"> 82 <div class="messages__item-photo">
83 <svg> 83 <svg>
84 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 84 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
85 </svg> 85 </svg>
86 @if ((isset($companion->workers[0]->photo)) && 86 @if ((isset($companion->workers[0]->photo)) &&
87 (!empty($companion->workers[0]->photo)))
88 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt="">
89 @else
90 <img src="{{ asset('images/default_man.jpg') }}" alt="">
91 @endif
87 (!empty($companion->workers[0]->photo))) 92 </div>
88 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt=""> 93 <div class="messages__item-text">
89 @else 94 <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div>
90 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 95 <div><span>Вакансия:</span>
91 @endif 96 @if ($ad_employer == 0)
92 </div> 97 @if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }}@else Не указано @endif
93 <div class="messages__item-text"> 98 @else
94 <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> 99 <a href="{{ route('vacancie', ['vacancy' => $ad_employer]) }}">
95 <div><span>Вакансия:</span> 100 @if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} ({{ $ad_employer }}) @else Не указано @endif
96 @if ($ad_employer == 0) 101 </a>
97 @if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }}@else Не указано @endif 102 @endif
98 @else 103 </div>
99 <a href="{{ route('vacancie', ['vacancy' => $ad_employer]) }}"> 104 </div>
100 @if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} ({{ $ad_employer }}) @else Не указано @endif 105 </div>
101 </a> 106 @if (isset($companion->workers[0]->id))
102 @endif 107 <a href="{{ route('resume_profile', ['worker' => $companion->workers[0]->id]) }}" class="button chatbox__toper-button">
103 </div> 108 <svg>
104 </div> 109 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
105 </div> 110 </svg>
106 @if (isset($companion->workers[0]->id)) 111 Перейти в резюме
107 <a href="{{ route('resume_profile', ['worker' => $companion->workers[0]->id]) }}" class="button chatbox__toper-button"> 112 </a>
108 <svg> 113 @endif
109 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> 114 @else
110 </svg> 115 <div class="chatbox__toper-info messages__item-info">
111 Перейти в резюме 116 <div class="messages__item-photo">
112 </a> 117 <svg>
113 @endif 118 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
114 @else 119 </svg>
115 <div class="chatbox__toper-info messages__item-info"> 120 @if ((isset($companion->employers[0]->logo)) &&
121 (!empty($companion->employers[0]->logo)))
122 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt="">
123 @else
124 <img src="{{ asset('images/default_man.jpg') }}" alt="">
125 @endif
116 <div class="messages__item-photo"> 126 </div>
117 <svg> 127 <div class="messages__item-text">
118 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 128 <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div>
119 </svg> 129 <div><span>Статус:</span> Работодатель или Администратор</div>
120 @if ((isset($companion->employers[0]->logo)) && 130 </div>
121 (!empty($companion->employers[0]->logo))) 131 </div>
122 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt=""> 132 @if (isset($companion->employer->id))
123 @else 133 <a href="" class="button chatbox__toper-button">
124 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 134 <svg>
125 @endif 135 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
126 </div> 136 </svg>
127 <div class="messages__item-text"> 137 Перейти в резюме
128 <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> 138 </a>
129 <div><span>Статус:</span> Работодатель или Администратор</div> 139 @endif
130 </div> 140 @endif
131 </div> 141 </div>
132 @if (isset($companion->employer->id)) 142
133 <a href="" class="button chatbox__toper-button"> 143 <div class="chatbox__list" id="dialogs" name="dialogs">
134 <svg> 144 @if ($Messages->count())
135 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> 145 @foreach ($Messages as $it)
136 </svg> 146 @if ($it->user_id == $companion->id)
137 Перейти в резюме 147 <div class="chatbox__item">
138 </a> 148 <div class="chatbox__item-photo">
139 @endif 149 <svg>
140 @endif 150 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
141 </div> 151 </svg>
142 152
153 @if ($companion->is_worker)
154 @if ((isset($companion->workers[0]->photo)) &&
155 (!empty($companion->workers[0]->photo)))
156 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt="">
157 @else
158 <img src="{{ asset('images/default_man.jpg') }}" alt="">
159 @endif
160 @else
161 @if ((isset($companion->employers[0]->logo)) &&
162 (!empty($companion->employers[0]->logo)))
163 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt="">
164 @else
165 <img src="{{ asset('images/default_man.jpg') }}" alt="">
166 @endif
167 @endif
168
143 <div class="chatbox__list" id="dialogs" name="dialogs"> 169 </div>
144 @if ($Messages->count()) 170 <div class="chatbox__item-body">
145 @foreach ($Messages as $it) 171 <div class="chatbox__item-text">{{ $it->text }}</div>
146 @if ($it->user_id == $companion->id) 172 </div>
147 <div class="chatbox__item"> 173 <div class="chatbox__item-time">{{ $it->created_at }}</div>
148 <div class="chatbox__item-photo"> 174 </div>
149 <svg> 175 @else
150 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 176 <div class="chatbox__item chatbox__item_reverse">
151 </svg> 177 <div class="chatbox__item-photo">
152 178 <svg>
153 @if ($companion->is_worker) 179 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
154 @if ((isset($companion->workers[0]->photo)) && 180 </svg>
155 (!empty($companion->workers[0]->photo))) 181
182 @if ($sender->is_worker)
183 @if ((isset($sender->workers[0]->photo)) &&
184 (!empty($sender->workers[0]->photo)))
185 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->workers[0]->photo)) }}" alt="">
186 @else
187 <img src="{{ asset('images/default_man.jpg') }}" alt="">
188 @endif
189 @else
190 @if ((isset($sender->employers[0]->logo)) &&
191 (!empty($sender->employers[0]->logo)))
192 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->employers[0]->logo)) }}" alt="">
193 @else
194 <img src="{{ asset('images/default_man.jpg') }}" alt="">
195 @endif
196 @endif
197
156 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt=""> 198 </div>
157 @else 199 <div class="chatbox__item-body">
158 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 200 <div class="chatbox__item-text">{{ $it->text }}</div>
159 @endif 201 @if ((isset($it->file)) && (!empty($it->file)))
160 @else 202 <a href="{{ asset(Storage::url($it->file)) }}" class="chatbox__item-text">
161 @if ((isset($companion->employers[0]->logo)) && 203 <svg>
162 (!empty($companion->employers[0]->logo))) 204 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use>
163 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt=""> 205 </svg>
164 @else 206 </a>
165 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 207 @endif
166 @endif 208 </div>
167 @endif 209 <div class="chatbox__item-time">{{ $it->created_at }}</div>
168 210 </div>
169 </div> 211 @endif
170 <div class="chatbox__item-body"> 212
171 <div class="chatbox__item-text">{{ $it->text }}</div> 213 @endforeach
172 </div> 214 @endif
173 <div class="chatbox__item-time">{{ $it->created_at }}</div> 215 </div>
174 </div> 216 <form action="{{ route('employer.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" >
175 @else 217 @csrf
176 <div class="chatbox__item chatbox__item_reverse"> 218 <label class="chatbox__bottom-file">
177 <div class="chatbox__item-photo"> 219 <input id="file" name="file" type="file">
178 <svg> 220 <svg>
179 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 221 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use>
180 </svg> 222 </svg>
181 223 </label>
182 @if ($sender->is_worker) 224 <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
183 @if ((isset($sender->workers[0]->photo)) && 225 <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/>
184 (!empty($sender->workers[0]->photo))) 226 <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/>
185 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->workers[0]->photo)) }}" alt=""> 227 <input type="hidden" id="ad_employer_id" name="ad_employer_id" value="{{ $ad_employer }}"/>
186 @else 228 <input type="hidden" id="ad_name" name="ad_name" value="@if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} @endif"/>
187 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 229 <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить">
188 @endif 230 <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send">
189 @else 231 <svg>
190 @if ((isset($sender->employers[0]->logo)) && 232 <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use>
191 (!empty($sender->employers[0]->logo))) 233 </svg>
192 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->employers[0]->logo)) }}" alt=""> 234 </button>
193 @else 235 </form>
194 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 236 </div>
195 @endif 237 </div>
196 @endif 238 </div>
197 239 </div>
198 </div> 240 </div>
199 <div class="chatbox__item-body"> 241 </section>
200 <div class="chatbox__item-text">{{ $it->text }}</div> 242 </div>
201 @if ((isset($it->file)) && (!empty($it->file))) 243 @endsection
202 <a href="{{ asset(Storage::url($it->file)) }}" class="chatbox__item-text"> 244
resources/views/employers/edit_vacancy.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('Приближаемся к системе, нас рой тут...'); 5 console.log('Приближаемся к системе, нас рой тут...');
6 $(document).on('change', '#position_id', function() { 6 $(document).on('change', '#position_id', function() {
7 var this_ = $(this); 7 var this_ = $(this);
8 var val_ = this_.val(); 8 var val_ = this_.val();
9 var ajax_ = $('#job_title_id'); 9 var ajax_ = $('#job_title_id');
10 10
11 console.log('Создания списка людей, которые поднимутся на корабль...'); 11 console.log('Создания списка людей, которые поднимутся на корабль...');
12 12
13 $.ajax({ 13 $.ajax({
14 type: "GET", 14 type: "GET",
15 url: "{{ route('employer.selected_people') }}", 15 url: "{{ route('employer.selected_people') }}",
16 data: "id="+val_, 16 data: "id="+val_,
17 success: function (data) { 17 success: function (data) {
18 console.log('Ответка пришла'); 18 console.log('Ответка пришла');
19 console.log('Список избранных людей создан'); 19 console.log('Список избранных людей создан');
20 ajax_.html(data); 20 ajax_.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 console.log('Обрыв связи'); 26 console.log('Обрыв связи');
27 console.log('Error: ' + data); 27 console.log('Error: ' + data);
28 } 28 }
29 }); 29 });
30 }); 30 });
31 </script> 31 </script>
32 @endsection 32 @endsection
33 @section('content') 33 @section('content')
34 <section class="cabinet"> 34 <section class="cabinet">
35 <div class="container"> 35 <div class="container">
36 <ul class="breadcrumbs cabinet__breadcrumbs"> 36 <ul class="breadcrumbs cabinet__breadcrumbs">
37 <li><a href="{{ route('index') }}">Главная</a></li> 37 <li><a href="{{ route('index') }}">Главная</a></li>
38 <li><b>Личный кабинет</b></li> 38 <li><b>Личный кабинет</b></li>
39 </ul> 39 </ul>
40 <div class="cabinet__wrapper"> 40 <div class="cabinet__wrapper">
41 <div class="cabinet__side"> 41 <div class="cabinet__side">
42 <div class="cabinet__side-toper"> 42 <div class="cabinet__side-toper">
43 43
44 @include('employers.emblema') 44 @include('employers.emblema')
45 45
46 </div> 46 </div>
47 47
48 @include('employers.menu', ['item' => 3]) 48 @include('employers.menu', ['item' => 3])
49 49
50 </div> 50 </div>
51 51
52 <form class="cabinet__body" action="{{ route('employer.vacancy_save_me', ['ad_employer' => $Employer->id]) }}" method="POST"> 52 <form class="cabinet__body" action="{{ route('employer.vacancy_save_me', ['ad_employer' => $Employer->id]) }}" method="POST">
53 @csrf 53 @csrf
54 <input type="hidden" name="employer_id" value="{{ $Employer->id }}"/> 54 <input type="hidden" name="employer_id" value="{{ $Employer->id }}"/>
55 <div class="cabinet__body-item"> 55 <div class="cabinet__body-item">
56 <div class="cabinet__descr"> 56 <div class="cabinet__descr">
57 <h2 class="title cabinet__title">Редактировать вакансию</h2> 57 <h2 class="title cabinet__title">Редактировать вакансию</h2>
58 <p class="cabinet__text"><b>Данные по вакансии</b></p> 58 <p class="cabinet__text"><b>Данные по вакансии</b></p>
59 <p class="cabinet__text">Все поля обязательны для заполнения *</p> 59 <p class="cabinet__text">Все поля обязательны для заполнения *</p>
60 </div> 60 </div>
61 </div> 61 </div>
62 <div class="cabinet__body-item"> 62 <div class="cabinet__body-item">
63 <h4>Поля для вакансии</h4> 63 <h4>Поля для вакансии</h4>
64 <div class="cabinet__inputs"> 64 <div class="cabinet__inputs">
65 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 65 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
66 <label class="form-group__label">Название вакансии</label> 66 <label class="form-group__label">Название вакансии</label>
67 <div class="form-group__item"> 67 <div class="form-group__item">
68 <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $ad_employer->name ?? '' }}" required> 68 <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $ad_employer->name ?? '' }}" required>
69 @error('name') 69 @error('name')
70 <span class="text-xs text-red-600 dark:text-red-400"> 70 <span class="text-xs text-red-600 dark:text-red-400">
71 {{ $message }} 71 {{ $message }}
72 </span> 72 </span>
73 @enderror 73 @enderror
74 </div> 74 </div>
75 </div> 75 </div>
76 76
77 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> 77 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
78 <label class="form-group__label">Телефон</label> 78 <label class="form-group__label">Телефон</label>
79 <div class="form-group__item"> 79 <div class="form-group__item">
80 <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $ad_employer->telephone ?? '' }}" placeholder="Свой телефон"> 80 <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $ad_employer->telephone ?? '' }}" placeholder="Свой телефон">
81 @error('telephone') 81 @error('telephone')
82 <span class="text-xs text-red-600 dark:text-red-400"> 82 <span class="text-xs text-red-600 dark:text-red-400">
83 {{ $message }} 83 {{ $message }}
84 </span> 84 </span>
85 @enderror 85 @enderror
86 </div> 86 </div>
87 </div> 87 </div>
88 88
89 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> 89 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
90 <label class="form-group__label">Емайл</label> 90 <label class="form-group__label">Емайл</label>
91 <div class="form-group__item"> 91 <div class="form-group__item">
92 <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $ad_employer->email ?? '' }}" placeholder="Своя почту"> 92 <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $ad_employer->email ?? '' }}" placeholder="Своя почту">
93 @error('email') 93 @error('email')
94 <span class="text-xs text-red-600 dark:text-red-400"> 94 <span class="text-xs text-red-600 dark:text-red-400">
95 {{ $message }} 95 {{ $message }}
96 </span> 96 </span>
97 @enderror 97 @enderror
98 </div> 98 </div>
99 </div> 99 </div>
100 100
101 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> 101 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
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" class="input" name="salary" id="salary" value="{{ old('salary') ?? $ad_employer->salary ??'' }}" placeholder="Среднестатистическая зарплата"> 104 <input type="text" class="input" name="salary" id="salary" value="{{ old('salary') ?? $ad_employer->salary ??'' }}" placeholder="Среднестатистическая зарплата">
105 @error('salary') 105 @error('salary')
106 <span class="text-xs text-red-600 dark:text-red-400"> 106 <span class="text-xs text-red-600 dark:text-red-400">
107 {{ $message }} 107 {{ $message }}
108 </span> 108 </span>
109 @enderror 109 @enderror
110 </div> 110 </div>
111 </div> 111 </div>
112 112
113 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 113 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display: none">
114 <label class="form-group__label">Город посадки</label> 114 <label class="form-group__label">Город посадки</label>
115 <div class="form-group__item"> 115 <div class="form-group__item">
116 <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $ad_employer->city ?? '' }}" placeholder="Севастополь"> 116 <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $ad_employer->city ?? 'Не указан' }}" placeholder="Севастополь">
117 @error('city') 117 @error('city')
118 <span class="text-xs text-red-600"> 118 <span class="text-xs text-red-600">
119 {{ $message }} 119 {{ $message }}
120 </span> 120 </span>
121 @enderror 121 @enderror
122 </div> 122 </div>
123 </div> 123 </div>
124 <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style=""> 124 <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="">
125 <label class="form-group__label">Категория (локация)</label> 125 <label class="form-group__label">Категория (локация)</label>
126 <div class="form-group__item"> 126 <div class="form-group__item">
127 <div class="select"> 127 <div class="select">
128 <select class="js-select2" name="category_id" id="category_id"> 128 <select class="js-select2" name="category_id" id="category_id">
129 php $i = 1 endphp 129 php $i = 1 endphp
130 if ($Positions->count()) 130 if ($Positions->count())
131 foreach($Positions as $j) 131 foreach($Positions as $j)
132 if ($i == 1) <option> Выберите категорию из списка</option> 132 if ($i == 1) <option> Выберите категорию из списка</option>
133 else 133 else
134 <option value=" $j->id }}" if ($ad_employer->category_id == $j->id) selected endif>$j->name }}</option> 134 <option value=" $j->id }}" if ($ad_employer->category_id == $j->id) selected endif>$j->name }}</option>
135 endif 135 endif
136 php $i++ endphp 136 php $i++ endphp
137 endforeach 137 endforeach
138 endif 138 endif
139 </select> 139 </select>
140 error('category_id') 140 error('category_id')
141 <span class="text-xs text-red-600 dark:text-red-400"> 141 <span class="text-xs text-red-600 dark:text-red-400">
142 $message }} 142 $message }}
143 </span> 143 </span>
144 enderror 144 enderror
145 </div> 145 </div>
146 </div> 146 </div>
147 </div>--> 147 </div>-->
148 148
149 <!--foreach ($ad_employer->jobs_code as $it_um)
150 <pre> print_r($it_um) }}</pre>
151 endforeach-->
152 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
153 <label class="form-group__label">Редактирование должностей</label>
154 <div class="form-group__item">
155 <div class="select">
156 <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple">
157 @php $i = 1 @endphp
158 @if ($jobs->count())
159 @foreach($jobs as $it)
160 @php $selected = false; @endphp
161 @foreach ($ad_employer->jobs_code as $it_um)
162 @if (isset($it_um->job_title_id))
163 @if ($it_um->job_title_id == $it->id))
164 @php $selected = true; @endphp
165 @endif
166 @endif
167 @endforeach
168 <option value="{{ $it->id }}" @if ($selected) selected @endif>{{ $it->name }}</option>
169 @endforeach
170 @endif
171 </select>
172 </div>
173 </div>
174 </div>
175
149 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 176 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
150 <label class="form-group__label">Описание вакансии</label> 177 <label class="form-group__label">Описание вакансии</label>
151 <div class="form-group__item"> 178 <div class="form-group__item">
152 <textarea class="textarea ckeditor" name="text" id="text">{{ old('text') ?? $ad_employer->text ?? '' }}</textarea> 179 <textarea class="textarea ckeditor" name="text" id="text">{{ old('text') ?? $ad_employer->text ?? '' }}</textarea>
153 @error('text') 180 @error('text')
154 <span class="text-xs text-red-600"> 181 <span class="text-xs text-red-600">
155 {{ $message }} 182 {{ $message }}
156 </span> 183 </span>
157 @enderror 184 @enderror
158 </div> 185 </div>
159 </div> 186 </div>
160 187
161 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 188 <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
162 <h4 class="form-group__label">Редактирование должностей</h4> 189 <h4 class="form-group__label">Редактирование должностей</h4>
163 <div class="form-group__item"> 190 <div class="form-group__item">
164 <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $ad_employer->id]) }}" class="button">Добавить</a> 191 <a href=" route('employer.add_job_in_vac', ['ad_employer' => $ad_employer->id]) }}" class="button">Добавить</a>
165 192
166 @if ($ad_employer->jobs->count()) 193 if ($ad_employer->jobs->count())
167 @foreach ($ad_employer->jobs as $key => $it_um) 194 foreach ($ad_employer->jobs as $key => $it_um)
168 <p>@if (isset($ad_employer->jobs_code[$key])) 195 <p>if (isset($ad_employer->jobs_code[$key]))
169 <a href="{{ route('employer.edit_job_in_vac', ['ad_job' => $ad_employer->jobs_code[$key]->id, 'ad_employer' => $ad_employer->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">{{$it_um->name}}</a> 196 <a href=" route('employer.edit_job_in_vac', ['ad_job' => $ad_employer->jobs_code[$key]->id, 'ad_employer' => $ad_employer->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">$it_um->name}}</a>
170 <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $ad_employer->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a> 197 <a href=" route('employer.delete_job_in_vac', ['ad_job' => $ad_employer->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a>
171 @endif 198 endif
172 </p> 199 </p>
173 @endforeach 200 endforeach
174 @else 201 else
175 Нет связанных <br> с вакансией должностей 202 Нет связанных <br> с вакансией должностей
176 @endif 203 endif
177 </div> 204 </div>
178 </div> 205 </div>-->
179 </div> 206 </div>
180 207
181 <a class="button cabinet__submit" href="{{ route('employer.vacancy_list') }}">Назад</a> 208 <a class="button cabinet__submit" href="{{ route('employer.vacancy_list') }}">Назад</a>
182 <button type="submit" class="button cabinet__submit">Опубликовать</button> 209 <button type="submit" class="button cabinet__submit">Опубликовать</button>
183 </div> 210 </div>
184 </form> 211 </form>
185 </div> 212 </div>
186 </div> 213 </div>
187 </section> 214 </section>
188 </div> 215 </div>
189 <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> 216 <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script>
190 <script> 217 <script>
191 CKEDITOR.replace('text'); 218 CKEDITOR.replace('text');
192 //CKEDITOR.replace( 'text', { 219 //CKEDITOR.replace( 'text', {
193 // filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", 220 // filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}",
194 // filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", 221 // filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}",
195 // filebrowserUploadMethod: 'form' 222 // filebrowserUploadMethod: 'form'
196 // }); 223 // });
197 </script> 224 </script>
198 @endsection 225 @endsection
199 226
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 @endsection 82 @endsection
83 83
84 @section('content') 84 @section('content')
85 <section class="thing"> 85 <section class="thing">
86 <div class="container"> 86 <div class="container">
87 <div class="thing__body"> 87 <div class="thing__body">
88 <ul class="breadcrumbs thing__breadcrumbs"> 88 <ul class="breadcrumbs thing__breadcrumbs">
89 <li><a href="{{ route('index') }}">Главная</a></li> 89 <li><a href="{{ route('index') }}">Главная</a></li>
90 <li><a href="{{ route('shipping_companies') }}">Работодатели</a></li> 90 <li><a href="{{ route('shipping_companies') }}">Работодатели</a></li>
91 <li><b>@isset($title) {{ $title }} @else Не указано @endif</b></li> 91 <li><b>@isset($title) {{ $title }} @else Не указано @endif</b></li>
92 </ul> 92 </ul>
93 @if ($company[0]->oficial_status == 1) 93 @if ($company[0]->oficial_status == 1)
94 <div class="thing__badge"> 94 <div class="thing__badge">
95 <svg> 95 <svg>
96 <use xlink:href="{{ asset('images/sprite.svg#badge') }}"></use> 96 <use xlink:href="{{ asset('images/sprite.svg#badge') }}"></use>
97 </svg> 97 </svg>
98 Компания проверена 98 Компания проверена
99 </div> 99 </div>
100 @endif 100 @endif
101 101
102 @if (!empty($company[0]->logo)) 102 @if (!empty($company[0]->logo))
103 <img src="{{ asset(Storage::url($company[0]->logo)) }}" alt="{{ $company[0]->name_company }}" class="thing__pic"> 103 <img src="{{ asset(Storage::url($company[0]->logo)) }}" alt="{{ $company[0]->name_company }}" class="thing__pic">
104 @else 104 @else
105 <img src="{{ asset('images/logo_emp.png') }}" alt="{{ $company[0]->name_company }}" class="thing__pic"> 105 <img src="{{ asset('images/logo_emp.png') }}" alt="{{ $company[0]->name_company }}" class="thing__pic">
106 @endif 106 @endif
107 107
108 <h1 class="thing__title">{{ $company[0]->name_company }}</h1> 108 <h1 class="thing__title">{{ $company[0]->name_company }}</h1>
109 <!--<p class="thing__text"> $company[0]->text !!}</p>--> 109 <!--<p class="thing__text"> $company[0]->text !!}</p>-->
110 <div class="thing__buttons"> 110 <div class="thing__buttons">
111 <button type="button" class="button"> 111 <button type="button" class="button">
112 <svg> 112 <svg>
113 <use xlink:href="{{ asset('images/sprite.svg#grid-1') }}"></use> 113 <use xlink:href="{{ asset('images/sprite.svg#grid-1') }}"></use>
114 </svg> 114 </svg>
115 {{ $company[0]->ads->count() }} вакансии 115 {{ $company[0]->ads->count() }} вакансии
116 </button> 116 </button>
117 @if ($user_id == 0) 117 @if ($user_id == 0)
118 <a data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' class="js_send_it_button button"> 118 <a data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' class="js_send_it_button button">
119 Написать сообщение 119 Написать сообщение
120 </a> 120 </a>
121 @else 121 @else
122 <a data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' class="js_send_it_button button"> 122 <a data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' class="js_send_it_button button">
123 Написать сообщение 123 Написать сообщение
124 </a> 124 </a>
125 @endif 125 @endif
126 </div> 126 </div>
127 </div> 127 </div>
128 </div> 128 </div>
129 </section> 129 </section>
130 <main class="main"> 130 <main class="main">
131 <div class="container"> 131 <div class="container">
132 <div class="main__employer-page"> 132 <div class="main__employer-page">
133 <h2 class="main__employer-page-title">О компании</h2> 133 <h2 class="main__employer-page-title">О компании</h2>
134 <div class="main__employer-page-info"> 134 <div class="main__employer-page-info">
135 <div class="main__employer-page-item"> 135 <div class="main__employer-page-item">
136 <b>Адрес компании</b> 136 <b>Адрес компании</b>
137 <span> 137 <span>
138 {{ $company[0]->address }} 138 {{ $company[0]->address }}
139 </span> 139 </span>
140 </div> 140 </div>
141 <div class="main__employer-page-item"> 141 <div class="main__employer-page-item">
142 <b>Сайт</b> 142 <b>Сайт</b>
143 <span> 143 <span>
144 <a href="{{ $company[0]->site }}">{{ $company[0]->site }}</a> 144 <a href="{{ $company[0]->site }}">{{ $company[0]->site }}</a>
145 </span> 145 </span>
146 </div> 146 </div>
147 <div class="main__employer-page-item"> 147 <div class="main__employer-page-item">
148 <b>Почта</b> 148 <b>Почта</b>
149 <span> 149 <span>
150 <a href="mailto:">{{ $company[0]->email }}</a> 150 <a href="mailto:">{{ $company[0]->email }}</a>
151 </span> 151 </span>
152 </div> 152 </div>
153 <div class="main__employer-page-item"> 153 <div class="main__employer-page-item">
154 <b>Телефон</b> 154 <b>Телефон</b>
155 <span> 155 <span>
156 <a href="tel:{{ $company[0]->telephone }}">{{ $company[0]->telephone }}</a> 156 <a href="tel:{{ $company[0]->telephone }}">{{ $company[0]->telephone }}</a>
157 </span> 157 </span>
158 </div> 158 </div>
159 </div> 159 </div>
160 160
161 <div class="main__employer-page-item"> 161 <div class="main__employer-page-item">
162 <b>Описание</b> 162 <b>Описание</b>
163 <span> 163 <span>
164 {!! $company[0]->text !!} 164 {!! $company[0]->text !!}
165 </span> 165 </span>
166 </div> 166 </div>
167 167
168 <div> 168 <div>
169 169
170 <div class="main__employer-page-tabs"> 170 <div class="main__employer-page-tabs">
171 <button type="button" class="main__employer-page-tabs-item active" 171 <button type="button" class="main__employer-page-tabs-item active"
172 data-tab="1">Флот</button> 172 data-tab="1">Флот</button>
173 <button type="button" class="main__employer-page-tabs-item" data-tab="2">Вакансии</button> 173 <button type="button" class="main__employer-page-tabs-item" data-tab="2">Вакансии</button>
174 </div> 174 </div>
175 175
176 <div class="main__employer-page-body"> 176 <div class="main__employer-page-body">
177 <div class="main__employer-page-body-item showed" data-body="1"> 177 <div class="main__employer-page-body-item showed" data-body="1">
178 <div class="main__employer-page-one"> 178 <div class="main__employer-page-one">
179 @if ($company[0]->flots->count()) 179 @if ($company[0]->flots->count())
180 @foreach ($company[0]->flots as $flot) 180 @foreach ($company[0]->flots as $flot)
181 <a href="" class="main__employer-page-one-item"> 181 <a href="" class="main__employer-page-one-item">
182 @if (!empty($flot->image)) 182 @if (!empty($flot->image))
183 <img src="{{ asset(Storage::url($flot->image)) }}" alt="{{ $flot->name }}"> 183 <img src="{{ asset(Storage::url($flot->image)) }}" alt="{{ $flot->name }}">
184 @else 184 @else
185 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $flot->name }}"> 185 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $flot->name }}">
186 @endif 186 @endif
187 <b>{{ $flot->name }}</b> 187 <b>{{ $flot->name }}</b>
188 <b>{{ $flot->region }}</b> 188 <b>{{ $flot->region }}</b>
189 <span><i>DWT</i> {{ $flot->DWT }}</span> 189 <span><i>DWT</i> {{ $flot->DWT }}</span>
190 <span><i>Мощность ГД</i> {{ $flot->POWER_GD }}</span> 190 <span><i>Мощность ГД</i> {{ $flot->POWER_GD }}</span>
191 <span><i>IMO</i> {{ $flot->IMO }}</span> 191 <span><i>IMO</i> {{ $flot->IMO }}</span>
192 <span>{{ $flot->power }}</span> 192 <span>{{ $flot->power }}</span>
193 </a> 193 </a>
194 @endforeach 194 @endforeach
195 @endif 195 @endif
196 </div> 196 </div>
197 </div> 197 </div>
198 198
199 <div class="main__employer-page-body-item" data-body="2"> 199 <div class="main__employer-page-body-item" data-body="2">
200 <div class="main__employer-page-two"> 200 <div class="main__employer-page-two">
201 @foreach ($company[0]->ads as $job) 201 @foreach ($ads as $job)
202 @foreach ($job->ad_job as $item)
203 <div class="main__employer-page-two-item"> 202 <div class="main__employer-page-two-item">
204 <div class="main__employer-page-two-item-toper"> 203 <div class="main__employer-page-two-item-toper">
205 @if (!empty($company[0]->logo)) 204 @if (!empty($company[0]->logo))
206 <img src="{{ asset(Storage::url($company[0]->logo)) }}" alt="{{ $job->name }}"> 205 <img src="{{ asset(Storage::url($company[0]->logo)) }}" alt="{{ $job->name }}">
207 @else 206 @else
208 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $job->name }}"> 207 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $job->name }}">
209 @endif 208 @endif
210 <span>{{ $job->name }}</span> 209 <span>{{ $job->name }}</span>
210 <!--<span>Описание:
211 $job->text !!}
212 </span>-->
211 </div> 213 </div>
212 <div class="main__employer-page-two-item-title">{{ $item->flot }}</div> 214 <!--<div class="main__employer-page-two-item-title"> $item->flot }}</div>-->
213 <div class="main__employer-page-two-item-text"> 215 <div class="main__employer-page-two-item-text">
214 <div class="main__employer-page-two-item-text-name"> 216 @if ((isset($job->jobs)) && ($job->jobs->count()))
215 {{ $item->job_title->name }} 217 @foreach($job->jobs as $item)
216 </div> 218 <a class="main__employer-page-two-item-text-name">
217 <div class="main__employer-page-two-item-text-body"> 219 {{ $item->name }}
218 <p>Зарплата:{{ $item->min_salary }} - {{ $item->max_salary }}р + {{ $item->sytki }} суточные.</p> 220 </a>
219 <p>Контракт: {{ $item->period }} мес.</p> 221 @endforeach
220 </div> 222 @endif
223 <!--<div class="main__employer-page-two-item-text-body">
224 <p>Зарплата: $item->min_salary }} - $item->max_salary }}р + $item->sytki }} суточные.</p>
225 <p>Контракт: $item->period }} мес.</p>
226 </div>-->
221 </div> 227 </div>
222 <div class="main__employer-page-two-item-text"> 228 <!--<div class="main__employer-page-two-item-text">
223 <div class="main__employer-page-two-item-text-name">Район работы</div> 229 <div class="main__employer-page-two-item-text-name">Район работы</div>
224 <div class="main__employer-page-two-item-text-body"> 230 <div class="main__employer-page-two-item-text-body">
225 <p>{{ $item->region }}</p> 231 <p> $item->region }}</p>
226 </div> 232 </div>
227 </div> 233 </div>
228 <div class="main__employer-page-two-item-text"> 234 <div class="main__employer-page-two-item-text">
229 <div class="main__employer-page-two-item-text-name">Посадка</div> 235 <div class="main__employer-page-two-item-text-name">Посадка</div>
230 <div class="main__employer-page-two-item-text-body"> 236 <div class="main__employer-page-two-item-text-body">
231 <p> {{ $item->start }}</p> 237 <p> $item->start }}</p>
232 {!! $item->description !!} 238 !! $item->description !!}
233 </div> 239 </div>
234 </div> 240 </div>-->
235 <div class="main__employer-page-two-item-text"> 241 <div class="main__employer-page-two-item-text">
236 <div class="main__employer-page-two-item-text-name">Звонить по вопросам на: 242 <div class="main__employer-page-two-item-text-name">Звонить по вопросам на:
237 </div> 243 </div>
238 <div class="main__employer-page-two-item-text-body"> 244 <div class="main__employer-page-two-item-text-body">
239 <a href="tel:{{ $job->telephone }}">{{ $job->telephone }}</a> 245 <a href="tel:{{ $job->telephone }}">{{ $job->telephone }}</a>
240 </div> 246 </div>
241 </div> 247 </div>
242 <div class="main__employer-page-two-item-text"> 248 <div class="main__employer-page-two-item-text">
243 <div class="main__employer-page-two-item-text-name">Анкеты присылать на 249 <div class="main__employer-page-two-item-text-name">Анкеты присылать на
244 почту: 250 почту:
245 </div> 251 </div>
246 <div class="main__employer-page-two-item-text-body"> 252 <div class="main__employer-page-two-item-text-body">
247 <a href="mailto: {{ $job->email }}">{{ $job->email }}</a> 253 <a href="mailto: {{ $job->email }}">{{ $job->email }}</a>
248 </div> 254 </div>
249 </div> 255 </div>
256 @if ((isset($job->jobs)) && ($job->jobs->count()))
250 <div class="main__employer-page-two-item-tags"> 257 <div class="main__employer-page-two-item-tags">
251 <span class="main__employer-page-two-item-tag">#{{ $item->job_title->name }}</span> 258 @foreach ($job->jobs as $item)
259 <span class="main__employer-page-two-item-tag">#{{ $item->name }}</span>
260 @endforeach
252 </div> 261 </div>
262 @endif
253 <div class="main__employer-page-two-item-buttons"> 263 <div class="main__employer-page-two-item-buttons">
254 264
255 <button type="button" data-fancybox data-src="#send" data-vacancy="{{ $item->job_title->id }}" data-uid="{{ $user_id }}" data-tuid="{{ $company[0]->users->id }}" data-options='{"touch":false,"autoFocus":false}' 265 <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}'
256 class="button main__employer-page-two-item-button js_send_it_button">Оставить 266 class="button main__employer-page-two-item-button js_send_it_button">Оставить
257 отклик...</button> 267 отклик...</button>
258 268
259 <!--<a href="#" 269 <!--<a href="#"
260 class="button button_light main__employer-page-two-item-button">Подробнее</a>--> 270 class="button button_light main__employer-page-two-item-button">Подробнее</a>-->
261 </div> 271 </div>
262 <div class="main__employer-page-two-item-bottom"> 272 <div class="main__employer-page-two-item-bottom">
263 <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($job->updated_at)) }}</div> 273 <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($job->updated_at)) }}</div>
264 <button type="button" 274 <button type="button"
265 class="like main__employer-page-two-item-bottom-like js-toggle"> 275 class="like main__employer-page-two-item-bottom-like js-toggle">
266 <svg> 276 <svg>
267 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> 277 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use>
268 </svg> 278 </svg>
269 </button> 279 </button>
270 </div> 280 </div>
271 </div> 281 </div>
272 @endforeach
273 @endforeach 282 @endforeach
283
284 <div style="margin-top: 20px">
285 {{ $ads->onEachSide(0)->appends($_GET)->links('paginate') }}
286 </div>
274 <!--<button type="button" class="button button_light button_more main__employer-page-two-more js-toggle js-parent-toggle"> 287 <!--<button type="button" class="button button_light button_more main__employer-page-two-more js-toggle js-parent-toggle">
275 <span>Показать ещё</span> 288 <span>Показать ещё</span>
276 <span>Скрыть</span> 289 <span>Скрыть</span>
277 </button>--> 290 </button>-->
278 </div> 291 </div>
279 </div> 292 </div>
280 </div> 293 </div>
281 </div> 294 </div>
282 </div> 295 </div>
283 </div> 296 </div>
284 </main> 297 </main>
resources/views/worker.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', '#jobs', function() { 6 $(document).on('change', '#jobs', function() {
7 var val = $(this).val(); 7 var val = $(this).val();
8 var main_oskar = $('#main_ockar'); 8 var main_oskar = $('#main_ockar');
9 9
10 console.log('Code='+val); 10 console.log('Code='+val);
11 console.log('Click change...'); 11 console.log('Click change...');
12 $.ajax({ 12 $.ajax({
13 type: "GET", 13 type: "GET",
14 url: "", 14 url: "",
15 data: "job="+val, 15 data: "job="+val,
16 success: function (data) { 16 success: function (data) {
17 console.log('Выбор сделан!'); 17 console.log('Выбор сделан!');
18 console.log(data); 18 console.log(data);
19 main_oskar.html(data); 19 main_oskar.html(data);
20 }, 20 },
21 headers: { 21 headers: {
22 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 22 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
23 }, 23 },
24 error: function (data) { 24 error: function (data) {
25 data = JSON.stringify(data); 25 data = JSON.stringify(data);
26 console.log('Error: ' + data); 26 console.log('Error: ' + data);
27 } 27 }
28 }); 28 });
29 }); 29 });
30 </script> 30 </script>
31 31
32 <script> 32 <script>
33 $(document).on('click', '.js_it_button', function() { 33 $(document).on('click', '.js_it_button', function() {
34 var this_ = $(this); 34 var this_ = $(this);
35 var code_user_id = this_.attr('data-uid'); 35 var code_user_id = this_.attr('data-uid');
36 var code_to_user_id = this_.attr('data-tuid'); 36 var code_to_user_id = this_.attr('data-tuid');
37 var code_vacancy = this_.attr('data-vacancy'); 37 var code_vacancy = this_.attr('data-vacancy');
38 var user_id = $('#_user_id'); 38 var user_id = $('#_user_id');
39 var to_user_id = $('#_to_user_id'); 39 var to_user_id = $('#_to_user_id');
40 var vacancy = $('#_vacancy'); 40 var vacancy = $('#_vacancy');
41 41
42 console.log('code_to_user_id='+code_to_user_id); 42 console.log('code_to_user_id='+code_to_user_id);
43 console.log('code_user_id='+code_user_id); 43 console.log('code_user_id='+code_user_id);
44 console.log('code_vacancy='+code_vacancy); 44 console.log('code_vacancy='+code_vacancy);
45 console.log('Клик на кнопке...'); 45 console.log('Клик на кнопке...');
46 46
47 user_id.val(code_user_id); 47 user_id.val(code_user_id);
48 to_user_id.val(code_to_user_id); 48 to_user_id.val(code_to_user_id);
49 vacancy.val(code_vacancy); 49 vacancy.val(code_vacancy);
50 }); 50 });
51 </script> 51 </script>
52 @include('js.favorite-worker') 52 @include('js.favorite-worker')
53 @endsection 53 @endsection
54 54
55 @section('content') 55 @section('content')
56 <section class="thing"> 56 <section class="thing">
57 <div class="container"> 57 <div class="container">
58 <ul class="breadcrumbs thing__breadcrumbs"> 58 <ul class="breadcrumbs thing__breadcrumbs">
59 <li><a href="{{ route('index') }}">Главная</a></li> 59 <li><a href="{{ route('index') }}">Главная</a></li>
60 <li><a href="{{ route('bd_resume') }}">База резюме</a></li> 60 <li><a href="{{ route('bd_resume') }}">База резюме</a></li>
61 <li><b>@if (isset($Query[0]->users)) {{ $Query[0]->users->surname." ".$Query[0]->users->name_man." ".$Query[0]->users->surname2 }} @else Неизвестно @endif</b></li> 61 <li><b>@if (isset($Query[0]->users)) {{ $Query[0]->users->surname." ".$Query[0]->users->name_man." ".$Query[0]->users->surname2 }} @else Неизвестно @endif</b></li>
62 </ul> 62 </ul>
63 <div class="thing__profile"> 63 <div class="thing__profile">
64 <img src="@if (isset($Query[0]->photo)) {{ asset(Storage::url($Query[0]->photo)) }} @else {{ asset('images/default_man.jpg') }} @endif" alt="" class="main__resume-base-body-item-photo"> 64 <img src="@if (isset($Query[0]->photo)) {{ asset(Storage::url($Query[0]->photo)) }} @else {{ asset('images/default_man.jpg') }} @endif" alt="" class="main__resume-base-body-item-photo">
65 <div class="thing__profile-body"> 65 <div class="thing__profile-body">
66 <h1 class="thing__title">@if (isset($Query[0]->users)) {{ $Query[0]->users->surname." ".$Query[0]->users->name_man." ".$Query[0]->users->surname2 }} @else Неизвестно @endif</h1> 66 <h1 class="thing__title">@if (isset($Query[0]->users)) {{ $Query[0]->users->surname." ".$Query[0]->users->name_man." ".$Query[0]->users->surname2 }} @else Неизвестно @endif</h1>
67 <p class="thing__text">Сложно сказать, почему ключевые особенности структуры проекта рассмотрены 67 <p class="thing__text">Сложно сказать, почему ключевые особенности структуры проекта рассмотрены
68 исключительно в разрезе маркетинговых и финансовых предпосылок.</p> 68 исключительно в разрезе маркетинговых и финансовых предпосылок.</p>
69 <div class="thing__bottom"> 69 <div class="thing__bottom">
70 <a class="button" href="{{ route('resume_download', ['worker' => $Query[0]->id]) }}"> 70 <a class="button" href="{{ route('resume_download', ['worker' => $Query[0]->id]) }}">
71 Скачать резюме 71 Скачать резюме
72 <svg> 72 <svg>
73 <use xlink:href="{{ asset('images/sprite.svg#download') }}"></use> 73 <use xlink:href="{{ asset('images/sprite.svg#download') }}"></use>
74 </svg> 74 </svg>
75 </a> 75 </a>
76 <button type="button" class="like js-toggle js_box_favorit {{ \App\Classes\LikesClass::get_status_worker($Query[0]) }}" data-val="{{ $Query[0]->id }}" id="elem{{ $Query[0]->id }}"> 76 <button type="button" class="like js-toggle js_box_favorit {{ \App\Classes\LikesClass::get_status_worker($Query[0]) }}" data-val="{{ $Query[0]->id }}" id="elem{{ $Query[0]->id }}">
77 <svg> 77 <svg>
78 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> 78 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use>
79 </svg> 79 </svg>
80 </button> 80 </button>
81 </div> 81 </div>
82 </div> 82 </div>
83 </div> 83 </div>
84 </div> 84 </div>
85 </section> 85 </section>
86 <main class="main"> 86 <main class="main">
87 <div class="container"> 87 <div class="container">
88 <div class="main__resume-profile"> 88 <div class="main__resume-profile">
89 <div class="main__content"> 89 <div class="main__content">
90 <div class="main__spoiler"> 90 <div class="main__spoiler">
91 <button type="button" class="main__spoiler-toper js-toggle active"> 91 <button type="button" class="main__spoiler-toper js-toggle active">
92 Основная информация</button> 92 Основная информация</button>
93 93
94 <div class="main__spoiler-body"> 94 <div class="main__spoiler-body">
95 <table class="main__table"> 95 <table class="main__table">
96 <tbody> 96 <tbody>
97 <tr> 97 <tr>
98 <td>Имя:</td> 98 <td>Имя:</td>
99 <td><b>{{ $Query[0]->users->name_man }}</b></td> 99 <td><b>{{ $Query[0]->users->name_man }}</b></td>
100 </tr> 100 </tr>
101 <tr> 101 <tr>
102 <td>Должность:</td> 102 <td>Должность:</td>
103 <td> 103 <td>
104 @if ($Query[0]->job_titles->count()) 104 @if ($Query[0]->job_titles->count())
105 @foreach ($Query[0]->job_titles as $it) 105 @foreach ($Query[0]->job_titles as $it)
106 @if ($it->is_remove == 0) 106 @if ($it->is_remove == 0)
107 <b>{{ $it->name }}</b> 107 <b>{{ $it->name }}</b>
108 @endif 108 @endif
109 @endforeach 109 @endforeach
110 @endif 110 @endif
111 </td> 111 </td>
112 </tr> 112 </tr>
113 <tr> 113 <tr>
114 <td>Телефон:</td> 114 <td>Телефон:</td>
115 <td><b><a href="tel:{{ $Query[0]->telephone }}">{{ $Query[0]->telephone }}</a></b></td> 115 <td><b><a href="tel:{{ $Query[0]->telephone }}">{{ $Query[0]->telephone }}</a></b></td>
116 </tr> 116 </tr>
117 <tr> 117 <tr>
118 <td>E-mail:</td> 118 <td>E-mail:</td>
119 <td><b><a href="mailto:{{ $Query[0]->email }}">{{ $Query[0]->email }}</a></b></td> 119 <td><b><a href="mailto:{{ $Query[0]->email }}">{{ $Query[0]->email }}</a></b></td>
120 </tr> 120 </tr>
121 <tr> 121 <tr>
122 <td>Возраст:</td> 122 <td>Возраст:</td>
123 <td><b>{{ $Query[0]->old_year }}</b></td> 123 <td><b>{{ $Query[0]->old_year }}</b></td>
124 </tr> 124 </tr>
125 <tr> 125 <tr>
126 <td>Статус:</td> 126 <td>Статус:</td>
127 <td><b>{{ $status_work[$Query[0]->status_work] }}</b></td> 127 <td><b>{{ $status_work[$Query[0]->status_work] }}</b></td>
128 </tr> 128 </tr>
129 <tr> 129 <tr>
130 <td>Город проживания:</td> 130 <td>Город проживания:</td>
131 <td><b>{{ $Query[0]->city }}</b></td> 131 <td><b>{{ $Query[0]->city }}</b></td>
132 </tr> 132 </tr>
133 <tr> 133 <tr>
134 <td>Уровень английского:</td> 134 <td>Уровень английского:</td>
135 <td><b>{{ $Query[0]->en_is }}</b></td> 135 <td><b>{{ $Query[0]->en_is }}</b></td>
136 </tr> 136 </tr>
137 <tr> 137 <tr>
138 <td>Опыт работы:</td> 138 <td>Опыт работы:</td>
139 <td><b>{{ $Query[0]->experience }}</b></td> 139 <td><b>{{ $Query[0]->experience }}</b></td>
140 </tr> 140 </tr>
141 </tbody> 141 </tbody>
142 </table> 142 </table>
143 </div> 143 </div>
144 </div> 144 </div>
145 <div class="main__spoiler"> 145 <div class="main__spoiler">
146 <button type="button" class="main__spoiler-toper js-toggle">Сертификаты / документы</button> 146 <button type="button" class="main__spoiler-toper js-toggle">Сертификаты / документы</button>
147 <div class="main__spoiler-body"> 147 <div class="main__spoiler-body">
148 148
149 @if (isset($Query[0]->sertificate)) 149 @if (isset($Query[0]->sertificate))
150 @if ($Query[0]->sertificate->count()) 150 @if ($Query[0]->sertificate->count())
151 @foreach($Query[0]->sertificate as $it) 151 @foreach($Query[0]->sertificate as $it)
152 <table class="main__table"> 152 <table class="main__table">
153 <tbody> 153 <tbody>
154 <tr> 154 <tr>
155 <td>Название сертификата:</td> 155 <td>Название сертификата:</td>
156 <td><b>{{ $it->name }}</b></td> 156 <td><b>{{ $it->name }}</b></td>
157 </tr> 157 </tr>
158 <tr> 158 <tr>
159 <td>Организация выдавшая документ:</td> 159 <td>Организация выдавшая документ:</td>
160 <td><b>{{ $it->education }}</b></td> 160 <td><b>{{ $it->education }}</b></td>
161 </tr> 161 </tr>
162 <tr> 162 <tr>
163 <td>Дата начала обучения:</td> 163 <td>Дата начала обучения:</td>
164 <td><b>{{ $it->date_begin }}</b></td> 164 <td><b>{{ $it->date_begin }}</b></td>
165 </tr> 165 </tr>
166 <tr> 166 <tr>
167 <td>Дата конца обучения:</td> 167 <td>Дата конца обучения:</td>
168 <td><b>{{ $it->end_begin }}</b></td> 168 <td><b>{{ $it->end_begin }}</b></td>
169 </tr> 169 </tr>
170 </tbody> 170 </tbody>
171 </table> 171 </table>
172 <br> 172 <br>
173 @endforeach 173 @endforeach
174 @endif 174 @endif
175 @endif 175 @endif
176 </div> 176 </div>
177 </div> 177 </div>
178 178
179 <div class="main__spoiler"> 179 <div class="main__spoiler">
180 <button type="button" class="main__spoiler-toper js-toggle">Опыт работы</button> 180 <button type="button" class="main__spoiler-toper js-toggle">Опыт работы</button>
181 <div class="main__spoiler-body"> 181 <div class="main__spoiler-body">
182 182
183 @if (isset($Query[0]->place_worker)) 183 @if (isset($Query[0]->place_worker))
184 @if ($Query[0]->place_worker->count()) 184 @if ($Query[0]->place_worker->count())
185 @foreach($Query[0]->place_worker as $it) 185 @foreach($Query[0]->place_worker as $it)
186 186
187 <table class="main__table"> 187 <table class="main__table">
188 <tbody> 188 <tbody>
189 <tr> 189 <tr>
190 <td>Должность:</td> 190 <td>Должность:</td>
191 <td><b>{{ $it->job_title }}</b></td> 191 <td><b>{{ $it->job_title }}</b></td>
192 </tr> 192 </tr>
193 <tr> 193 <tr>
194 <td>Опыт работы в танкерном флоте:</td> 194 <td>Опыт работы в танкерном флоте:</td>
195 <td><b>@if($it->tanker==1) Есть @else Нет @endif</b></td> 195 <td><b>@if($it->tanker==1) Есть @else Нет @endif</b></td>
196 </tr> 196 </tr>
197 <tr> 197 <tr>
198 <td>Дата начала работы:</td> 198 <td>Дата начала работы:</td>
199 <td><b>{{ $it->begin_work }}</b></td> 199 <td><b>{{ $it->begin_work }}</b></td>
200 </tr> 200 </tr>
201 <tr> 201 <tr>
202 <td>Дата конца работы:</td> 202 <td>Дата конца работы:</td>
203 <td><b>{{ $it->end_work }}</b></td> 203 <td><b>{{ $it->end_work }}</b></td>
204 </tr> 204 </tr>
205 <tr> 205 <tr>
206 <td>Название компании:</td> 206 <td>Название компании:</td>
207 <td><b>{{ $it->name_company }}</b></td> 207 <td><b>{{ $it->name_company }}</b></td>
208 </tr> 208 </tr>
209 <tr> 209 <tr>
210 <td>GWT тип</td> 210 <td>GWT тип</td>
211 <td><b>{{ $it->GWT }}</b></td> 211 <td><b>{{ $it->GWT }}</b></td>
212 </tr> 212 </tr>
213 <tr> 213 <tr>
214 <td>ГД:</td> 214 <td>ГД:</td>
215 <td><b>{{ $it->KBT }}</b></td> 215 <td><b>{{ $it->KBT }}</b></td>
216 </tr> 216 </tr>
217 </tbody> 217 </tbody>
218 </table> 218 </table>
219 <br> 219 <br>
220 @endforeach 220 @endforeach
221 @endif 221 @endif
222 @endif 222 @endif
223 </div> 223 </div>
224 </div> 224 </div>
225 225
226 <div class="main__spoiler"> 226 <div class="main__spoiler">
227 <button type="button" class="main__spoiler-toper js-toggle">Дополнительные документы</button> 227 <button type="button" class="main__spoiler-toper js-toggle">Дополнительные документы</button>
228 <div class="main__spoiler-body"> 228 <div class="main__spoiler-body">
229 229
230 @if (isset($Query[0]->infobloks)) 230 @if (isset($Query[0]->infobloks))
231 @if ($Query[0]->infobloks->count()) 231 @if ($Query[0]->infobloks->count())
232 <table class="main__table"> 232 <table class="main__table">
233 <tbody> 233 <tbody>
234 @foreach($Query[0]->infobloks as $it) 234 @foreach($Query[0]->infobloks as $it)
235 <tr> 235 <tr>
236 <td><b>{{ $it->name }}</b></td>
237 <td> 236 <td><b>{{ $it->name }}</b></td>
238 @if ($it->model_dop_info[0]->status == 0) Не указано 237 <td>
239 @elseif($it->model_dop_info[0]->status==1) В наличии 238 @if ($it->model_dop_info[0]->status == 0) Не указано
240 @else Отсутствует 239 @elseif($it->model_dop_info[0]->status==1) В наличии
241 @endif 240 @else Отсутствует
242 </td> 241 @endif
243 </tr> 242 </td>
244 @endforeach 243 </tr>
245 </tbody> 244 @endforeach
246 </table> 245 </tbody>
247 @endif 246 </table>
248 @endif 247 @endif
249 </div> 248 @endif
250 </div> 249 </div>
251 </div> 250 </div>
252 251 </div>
253 <div class="main__resume-profile-about"> 252
254 <h2 class="main__resume-profile-about-title">О себе</h2> 253 <div class="main__resume-profile-about">
255 <p class="main__resume-profile-about-text">{{ $Query[0]->text }}</p> 254 <h2 class="main__resume-profile-about-title">О себе</h2>
256 @if (App\Classes\StatusUser::Status()==0) 255 <p class="main__resume-profile-about-text">{{ $Query[0]->text }}</p>
257 @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_message)) 256 @if (App\Classes\StatusUser::Status()==0)
258 <div class="button main__resume-profile-about-button js_it_button" data-fancybox data-src="#send2" data-vacancy="0" data-uid="{{ $idiot }}" data-tuid="{{ $Query[0]->users->id }}" data-options='{"touch":false,"autoFocus":false}'>Написать сообщение</div> 257 @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_message))
259 @endif 258 <div class="button main__resume-profile-about-button js_it_button" data-fancybox data-src="#send2" data-vacancy="0" data-uid="{{ $idiot }}" data-tuid="{{ $Query[0]->users->id }}" data-options='{"touch":false,"autoFocus":false}'>Написать сообщение</div>
260 @endif 259 @endif
261 </div> 260 @endif
262 <div class="main__resume-profile-info"> 261 </div>
263 <h2 class="main__resume-profile-info-title">Данные о прошлых компаниях</h2> 262 <div class="main__resume-profile-info">
264 <div class="main__resume-profile-info-body"> 263 <h2 class="main__resume-profile-info-title">Данные о прошлых компаниях</h2>
265 @if ((isset($Query[0]->prev_company)) && ($Query[0]->prev_company->count())) 264 <div class="main__resume-profile-info-body">
266 @foreach ($Query[0]->prev_company as $it) 265 @if ((isset($Query[0]->prev_company)) && ($Query[0]->prev_company->count()))
267 <div class="main__resume-profile-info-body-item"> 266 @foreach ($Query[0]->prev_company as $it)
268 <h3 class="main__resume-profile-info-body-subtitle">{{ $it->name_company }}</h3> 267 <div class="main__resume-profile-info-body-item">
269 <ul class="main__resume-profile-info-body-inner"> 268 <h3 class="main__resume-profile-info-body-subtitle">{{ $it->name_company }}</h3>
270 <li> 269 <ul class="main__resume-profile-info-body-inner">
271 <b>Руководитель</b> 270 <li>
272 <span>{{ $it->direct }}</span> 271 <b>Руководитель</b>
273 </li> 272 <span>{{ $it->direct }}</span>
274 <li> 273 </li>
275 <b>Телефон того, кто может дать рекомендацию</b> 274 <li>
276 <span> 275 <b>Телефон того, кто может дать рекомендацию</b>
277 @if (!empty($it->telephone)) 276 <span>
278 <a href="tel:{{$it->telephone }}">{{ $it->telephone }}</a> 277 @if (!empty($it->telephone))
279 @endif 278 <a href="tel:{{$it->telephone }}">{{ $it->telephone }}</a>
280 @if (!empty($it->telephone2)) 279 @endif
281 <a href="tel:{{$it->telephone2 }}">{{ $it->telephone2 }}</a> 280 @if (!empty($it->telephone2))
282 @endif 281 <a href="tel:{{$it->telephone2 }}">{{ $it->telephone2 }}</a>
283 </span> 282 @endif
284 </li> 283 </span>
285 </ul> 284 </li>
286 </div> 285 </ul>
287 @endforeach 286 </div>
288 @else 287 @endforeach
289 <div class="main__resume-profile-info-body-item"> 288 @else
290 <h3 class="main__resume-profile-info-body-subtitle">Нету данных о компании</h3> 289 <div class="main__resume-profile-info-body-item">
291 </div> 290 <h3 class="main__resume-profile-info-body-subtitle">Нету данных о компании</h3>
292 @endif 291 </div>
293 </div> 292 @endif
294 </div> 293 </div>
295 294 </div>
296 <div class="main__resume-profile-info"> 295
297 <h2 class="main__resume-profile-info-title">Количество просмотров страницы: ({{ $stat[0]->lookin }})</h2> 296 <div class="main__resume-profile-info">
298 </div> 297 <h2 class="main__resume-profile-info-title">Количество просмотров страницы: ({{ $stat[0]->lookin }})</h2>
299 298 </div>
300 <div class="main__resume-profile-info"> 299
301 <h2 class="main__resume-profile-info-title">Отзывы о работнике ({{ $Query[0]->response->count() }})</h2> 300 <div class="main__resume-profile-info">
302 <div class="main__resume-profile-info-body"> 301 <h2 class="main__resume-profile-info-title">Отзывы о работнике ({{ $Query[0]->response->count() }})</h2>
303 @if ((isset($Query[0]->response)) && ($Query[0]->response->count())) 302 <div class="main__resume-profile-info-body">
304 <div class="main__resume-profile-info-body-item"> 303 @if ((isset($Query[0]->response)) && ($Query[0]->response->count()))
305 <ul class="main__resume-profile-info-body-inner"> 304 <div class="main__resume-profile-info-body-item">
306 @php $i = 1; @endphp 305 <ul class="main__resume-profile-info-body-inner">
307 @foreach($Query[0]->response as $it) 306 @php $i = 1; @endphp
308 <li> 307 @foreach($Query[0]->response as $it)
309 <span><h3>Комментарий №{{$i}}</h3></span> 308 <li>
310 <span><b>Оценка человека: {{ $it->stars }}</b></span> 309 <span><h3>Комментарий №{{$i}}</h3></span>
311 <span><b>Сообщение: </b>{{ $it->message }}</span> 310 <span><b>Оценка человека: {{ $it->stars }}</b></span>
312 </li> 311 <span><b>Сообщение: </b>{{ $it->message }}</span>
313 @php $i++; @endphp 312 </li>
314 @endforeach 313 @php $i++; @endphp
315 </ul> 314 @endforeach
316 </div> 315 </ul>
317 @else 316 </div>
318 <div class="main__resume-profile-info-body-item"> 317 @else
319 <h3 class="main__resume-profile-info-body-subtitle">Нету комментариев</h3> 318 <div class="main__resume-profile-info-body-item">
320 </div> 319 <h3 class="main__resume-profile-info-body-subtitle">Нету комментариев</h3>
321 @endif 320 </div>
322 </div> 321 @endif
323 </div> 322 </div>
324 323 </div>
325 <div class="main__resume-profile-review"> 324
326 <form action="{{ route('stars_answer') }}" method="POST"> 325 <div class="main__resume-profile-review">
327 @csrf 326 <form action="{{ route('stars_answer') }}" method="POST">
328 <h2 class="main__resume-profile-review-title">Оставить отзыв о работнике</h2> 327 @csrf
329 <div class="rate"> 328 <h2 class="main__resume-profile-review-title">Оставить отзыв о работнике</h2>
330 <div class="rate__label">Ваша оценка:</div> 329 <div class="rate">
331 <div class="rate__stars"> 330 <div class="rate__label">Ваша оценка:</div>
332 <select name="stars" id="stars" class="star-rating js-stars"> 331 <div class="rate__stars">
333 <option value="5">5</option> 332 <select name="stars" id="stars" class="star-rating js-stars">
334 <option value="4">4</option> 333 <option value="5">5</option>
335 <option value="3">3</option> 334 <option value="4">4</option>
336 <option value="2">2</option> 335 <option value="3">3</option>
337 <option value="1" selected>1</option> 336 <option value="2">2</option>
338 </select> 337 <option value="1" selected>1</option>
339 </div> 338 </select>
340 </div> 339 </div>
341 <input type="hidden" name="worker_id" id="worker_id" value="{{ $Query[0]->id }}"/> 340 </div>
342 <div class="main__resume-profile-review-body"> 341 <input type="hidden" name="worker_id" id="worker_id" value="{{ $Query[0]->id }}"/>
343 <h3>Ваш отзыв</h3> 342 <div class="main__resume-profile-review-body">
344 <textarea class="textarea" name="message" id="message" placeholder="Текст отзыва&hellip;" required></textarea> 343 <h3>Ваш отзыв</h3>
345 <button type="submit" class="button">Оставить отзыв</button> 344 <textarea class="textarea" name="message" id="message" placeholder="Текст отзыва&hellip;" required></textarea>
346 </div> 345 <button type="submit" class="button">Оставить отзыв</button>
347 </form> 346 </div>
348 </div> 347 </form>
349 </div> 348 </div>
350 </div> 349 </div>
351 </main> 350 </div>
352 </div> 351 </main>
353 @endsection 352 </div>
354 353 @endsection
resources/views/workers/dialog.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', '#send_btn', function() { 6 $(document).on('change', '#send_btn', 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 @endsection 49 @endsection
50 50
51 @section('content') 51 @section('content')
52 <section class="cabinet"> 52 <section class="cabinet">
53 <div class="container"> 53 <div class="container">
54 <ul class="breadcrumbs cabinet__breadcrumbs"> 54 <ul class="breadcrumbs cabinet__breadcrumbs">
55 <li><a href="{{ route('index') }}">Главная</a></li> 55 <li><a href="{{ route('index') }}">Главная</a></li>
56 <li><b>Личный кабинет</b></li> 56 <li><b>Личный кабинет</b></li>
57 </ul> 57 </ul>
58 <div class="cabinet__wrapper"> 58 <div class="cabinet__wrapper">
59 <div class="cabinet__side"> 59 <div class="cabinet__side">
60 <div class="cabinet__side-toper"> 60 <div class="cabinet__side-toper">
61 @include('workers.emblema') 61 @include('workers.emblema')
62 </div> 62 </div>
63 @include('workers.menu', ['item' => 2]) 63 @include('workers.menu', ['item' => 2])
64 </div> 64 </div>
65 <div class="cabinet__body"> 65 <div class="cabinet__body">
66 <div class="cabinet__body-item"> 66 <div class="cabinet__body-item">
67 <h2 class="title cabinet__title">Сообщения</h2> 67 <h2 class="title cabinet__title">Сообщения</h2>
68 </div> 68 </div>
69 <div class="cabinet__body-item"> 69 <div class="cabinet__body-item">
70 <a href="{{ route('worker.messages', ['type_message' => 'input']) }}" class="back"> 70 <a href="{{ route('worker.messages', ['type_message' => 'input']) }}" class="back">
71 <svg> 71 <svg>
72 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> 72 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use>
73 </svg> 73 </svg>
74 <span> 74 <span>
75 К списку чатов 75 К списку чатов
76 </span> 76 </span>
77 </a> 77 </a>
78 <div class="chatbox"> 78 <div class="chatbox">
79 <div class="chatbox__toper"> 79 <div class="chatbox__toper">
80 @if ($companion->is_worker) 80 @if ($companion->is_worker)
81 <div class="chatbox__toper-info messages__item-info"> 81 <div class="chatbox__toper-info messages__item-info">
82 <div class="messages__item-photo"> 82 <div class="messages__item-photo">
83 <svg> 83 <svg>
84 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 84 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
85 </svg> 85 </svg>
86 @if ((isset($companion->workers[0]->photo)) && 86 @if ((isset($companion->workers[0]->photo)) &&
87 (!empty($companion->workers[0]->photo)))
88 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt="">
89 @else
90 <img src="{{ asset('images/default_man.jpg') }}" alt="">
91 @endif
87 (!empty($companion->workers[0]->photo))) 92 </div>
88 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt=""> 93 <div class="messages__item-text">
89 @else 94 <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div>
90 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 95 <div><span>Вакансия:</span> @if (!is_null($ad_employer)) <a href="{{ route('vacancie', ['vacancy' => $ad_employer->id]) }}">{{ $ad_employer->name}}</a> @else Не указано @endif</div>
91 @endif 96 </div>
92 </div> 97 </div>
93 <div class="messages__item-text"> 98 @if (isset($companion->worker->id))
94 <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> 99 <a href="{{ route('resume_profile', ['worker' => $companion->worker->id]) }}" class="button chatbox__toper-button">
95 <div><span>Вакансия:</span> @if (!is_null($ad_employer)) <a href="{{ route('vacancie', ['vacancy' => $ad_employer->id]) }}">{{ $ad_employer->name}}</a> @else Не указано @endif</div> 100 <svg>
96 </div> 101 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
97 </div> 102 </svg>
98 @if (isset($companion->worker->id)) 103 Перейти в резюме
99 <a href="{{ route('resume_profile', ['worker' => $companion->worker->id]) }}" class="button chatbox__toper-button"> 104 </a>
100 <svg> 105 @endif
101 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> 106 @else
102 </svg> 107 <div class="chatbox__toper-info messages__item-info">
103 Перейти в резюме 108 <div class="messages__item-photo">
104 </a> 109 <svg>
105 @endif 110 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
106 @else 111 </svg>
107 <div class="chatbox__toper-info messages__item-info"> 112 @if ((isset($companion->employers[0]->logo)) &&
113 (!empty($companion->employers[0]->logo)))
114 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt="">
115 @else
116 <img src="{{ asset('images/default_man.jpg') }}" alt="">
117 @endif
108 <div class="messages__item-photo"> 118 </div>
109 <svg> 119 <div class="messages__item-text">
110 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 120 <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div>
111 </svg> 121 <div><span>Статус:</span> Работодатель или Администратор</div>
112 @if ((isset($companion->employers[0]->logo)) && 122 </div>
113 (!empty($companion->employers[0]->logo))) 123 </div>
114 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt=""> 124 @if (isset($companion->employer->id))
115 @else 125 <a href="" class="button chatbox__toper-button">
116 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 126 <svg>
117 @endif 127 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
118 </div> 128 </svg>
119 <div class="messages__item-text"> 129 Перейти в резюме
120 <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> 130 </a>
121 <div><span>Статус:</span> Работодатель или Администратор</div> 131 @endif
122 </div> 132 @endif
123 </div> 133 </div>
124 @if (isset($companion->employer->id)) 134
125 <a href="" class="button chatbox__toper-button"> 135 <div class="chatbox__list" id="dialogs" name="dialogs">
126 <svg> 136 @if ($Messages->count())
127 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> 137 @foreach ($Messages as $it)
128 </svg> 138 @if ($it->user_id == $companion->id)
129 Перейти в резюме 139 <div class="chatbox__item">
130 </a> 140 <div class="chatbox__item-photo">
131 @endif 141 <svg>
132 @endif 142 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
133 </div> 143 </svg>
134 144 @if ($companion->is_worker)
145 @if ((isset($companion->workers[0]->photo)) &&
146 (!empty($companion->workers[0]->photo)))
147 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt="">
148 @else
149 <img src="{{ asset('images/default_man.jpg') }}" alt="">
150 @endif
151 @else
152 @if ((isset($companion->employers[0]->logo)) &&
153 (!empty($companion->employers[0]->logo)))
154 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt="">
155 @else
156 <img src="{{ asset('images/default_man.jpg') }}" alt="">
157 @endif
158 @endif
135 <div class="chatbox__list" id="dialogs" name="dialogs"> 159 </div>
136 @if ($Messages->count()) 160 <div class="chatbox__item-body">
137 @foreach ($Messages as $it) 161 <div class="chatbox__item-text">{{ $it->text }}</div>
138 @if ($it->user_id == $companion->id) 162 </div>
139 <div class="chatbox__item"> 163 <div class="chatbox__item-time">{{ $it->created_at }}</div>
140 <div class="chatbox__item-photo"> 164 </div>
141 <svg> 165 @else
142 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 166 <div class="chatbox__item chatbox__item_reverse">
143 </svg> 167 <div class="chatbox__item-photo">
144 @if ($companion->is_worker) 168 <svg>
145 @if ((isset($companion->workers[0]->photo)) && 169 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
146 (!empty($companion->workers[0]->photo))) 170 </svg>
147 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt=""> 171 @if ($sender->is_worker)
172 @if ((isset($sender->workers[0]->photo)) &&
173 (!empty($sender->workers[0]->photo)))
174 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->workers[0]->photo)) }}" alt="">
175 @else
176 <img src="{{ asset('images/default_man.jpg') }}" alt="">
177 @endif
178 @else
179 @if ((isset($sender->employers[0]->logo)) &&
180 (!empty($sender->employers[0]->logo)))
181 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->employers[0]->logo)) }}" alt="">
182 @else
183 <img src="{{ asset('images/default_man.jpg') }}" alt="">
184 @endif
185 @endif
186
148 @else 187 </div>
149 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 188 <div class="chatbox__item-body">
150 @endif 189 <div class="chatbox__item-text">{{ $it->text }}</div>
151 @else 190 @if ((isset($it->file)) && (!empty($it->file)))
152 @if ((isset($companion->employers[0]->logo)) && 191 <a href="{{ asset(Storage::url($it->file)) }}" class="chatbox__item-text">
153 (!empty($companion->employers[0]->logo))) 192 <svg>
154 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt=""> 193 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use>
155 @else 194 </svg>
156 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 195 </a>
157 @endif 196 @endif
158 @endif 197 </div>
159 </div> 198 <div class="chatbox__item-time">{{ $it->created_at }}</div>
160 <div class="chatbox__item-body"> 199 </div>
161 <div class="chatbox__item-text">{{ $it->text }}</div> 200 @endif
162 </div> 201
163 <div class="chatbox__item-time">{{ $it->created_at }}</div> 202 @endforeach
164 </div> 203 @endif
165 @else 204 </div>
166 <div class="chatbox__item chatbox__item_reverse"> 205 <form action="{{ route('worker.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" >
167 <div class="chatbox__item-photo"> 206 @csrf
168 <svg> 207 <label class="chatbox__bottom-file">
169 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 208 <input id="file" name="file" type="file">
170 </svg> 209 <svg>
171 @if ($sender->is_worker) 210 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use>
172 @if ((isset($sender->workers[0]->photo)) && 211 </svg>
173 (!empty($sender->workers[0]->photo))) 212 </label>
174 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->workers[0]->photo)) }}" alt=""> 213 <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
175 @else 214 <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/>
176 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 215 <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/>
177 @endif 216 <input type="hidden" id="ad_employer_id" name="ad_employer_id" value="{{ $ad_employer }}"/>
178 @else 217 <input type="hidden" id="ad_name" name="ad_name" value="@if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} @endif"/>
179 @if ((isset($sender->employers[0]->logo)) && 218 <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить">
180 (!empty($sender->employers[0]->logo))) 219 <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send">
181 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->employers[0]->logo)) }}" alt=""> 220 <svg>
182 @else 221 <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use>
183 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 222 </svg>
184 @endif 223 </button>
185 @endif 224 </form>
186 225 </div>
187 </div> 226 </div>
188 <div class="chatbox__item-body"> 227 </div>
189 <div class="chatbox__item-text">{{ $it->text }}</div> 228 </div>
190 @if ((isset($it->file)) && (!empty($it->file))) 229 </div>
191 <a href="{{ asset(Storage::url($it->file)) }}" class="chatbox__item-text"> 230 </section>
192 <svg> 231 </div>
193 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> 232 @endsection
194 </svg> 233
1 <?php 1 <?php
2 2
3 use App\Http\Controllers\Ad_jobsController; 3 use App\Http\Controllers\Ad_jobsController;
4 use App\Http\Controllers\AdEmployerController; 4 use App\Http\Controllers\AdEmployerController;
5 use App\Http\Controllers\Admin\AdminController; 5 use App\Http\Controllers\Admin\AdminController;
6 use App\Http\Controllers\Admin\CategoryController; 6 use App\Http\Controllers\Admin\CategoryController;
7 use App\Http\Controllers\Admin\CategoryEmpController; 7 use App\Http\Controllers\Admin\CategoryEmpController;
8 use App\Http\Controllers\Admin\EducationController; 8 use App\Http\Controllers\Admin\EducationController;
9 use App\Http\Controllers\Admin\EmployersController; 9 use App\Http\Controllers\Admin\EmployersController;
10 use App\Http\Controllers\EmployerController as FrontEmployersController; 10 use App\Http\Controllers\EmployerController as FrontEmployersController;
11 use App\Http\Controllers\Admin\InfoBloksController; 11 use App\Http\Controllers\Admin\InfoBloksController;
12 use App\Http\Controllers\Admin\JobTitlesController; 12 use App\Http\Controllers\Admin\JobTitlesController;
13 use App\Http\Controllers\Admin\UsersController; 13 use App\Http\Controllers\Admin\UsersController;
14 use App\Http\Controllers\Admin\WorkersController; 14 use App\Http\Controllers\Admin\WorkersController;
15 use App\Http\Controllers\Auth\ForgotPasswordController; 15 use App\Http\Controllers\Auth\ForgotPasswordController;
16 use App\Http\Controllers\Auth\LoginController; 16 use App\Http\Controllers\Auth\LoginController;
17 use App\Http\Controllers\Auth\RegisterController; 17 use App\Http\Controllers\Auth\RegisterController;
18 use App\Http\Controllers\CKEditorController; 18 use App\Http\Controllers\CKEditorController;
19 use App\Http\Controllers\MediaController; 19 use App\Http\Controllers\MediaController;
20 use App\Http\Controllers\WorkerController; 20 use App\Http\Controllers\WorkerController;
21 use App\Models\Ad_jobs; 21 use App\Models\Ad_jobs;
22 use App\Models\User; 22 use App\Models\User;
23 use App\Http\Controllers\MainController; 23 use App\Http\Controllers\MainController;
24 use App\Http\Controllers\HomeController; 24 use App\Http\Controllers\HomeController;
25 use Illuminate\Support\Facades\Route; 25 use Illuminate\Support\Facades\Route;
26 use App\Http\Controllers\Admin\CompanyController; 26 use App\Http\Controllers\Admin\CompanyController;
27 use App\Http\Controllers\Admin\Ad_EmployersController; 27 use App\Http\Controllers\Admin\Ad_EmployersController;
28 use App\Http\Controllers\Admin\MsgAnswersController; 28 use App\Http\Controllers\Admin\MsgAnswersController;
29 use App\Http\Controllers\Admin\GroupsController; 29 use App\Http\Controllers\Admin\GroupsController;
30 use App\Http\Controllers\PagesController; 30 use App\Http\Controllers\PagesController;
31 use Illuminate\Support\Facades\Storage; 31 use Illuminate\Support\Facades\Storage;
32 use App\Http\Controllers\EmployerController; 32 use App\Http\Controllers\EmployerController;
33 use App\Http\Controllers\CompanyController as FrontCompanyController; 33 use App\Http\Controllers\CompanyController as FrontCompanyController;
34 34
35 35
36 /* 36 /*
37 |-------------------------------------------------------------------------- 37 |--------------------------------------------------------------------------
38 | Web Routes 38 | Web Routes
39 |-------------------------------------------------------------------------- 39 |--------------------------------------------------------------------------
40 | 40 |
41 | Here is where you can register web routes for your application. These 41 | Here is where you can register web routes for your application. These
42 | routes are loaded by the RouteServiceProvider within a group which 42 | routes are loaded by the RouteServiceProvider within a group which
43 | contains the "web" middleware group. Now create something great! 43 | contains the "web" middleware group. Now create something great!
44 | 44 |
45 */ 45 */
46 /* 46 /*
47 Route::get('/', function () { 47 Route::get('/', function () {
48 return view('welcome'); 48 return view('welcome');
49 })->name('index'); 49 })->name('index');
50 */ 50 */
51 51
52 Route::get('/', [MainController::class, 'index'])->name('index'); 52 Route::get('/', [MainController::class, 'index'])->name('index');
53 53
54 //Роуты авторизации, регистрации, восстановления, аутентификации 54 //Роуты авторизации, регистрации, восстановления, аутентификации
55 Auth::routes(['verify' => true]); 55 Auth::routes(['verify' => true]);
56 56
57 // роуты регистрации, авторизации, восстановления пароля, верификации почты 57 // роуты регистрации, авторизации, восстановления пароля, верификации почты
58 /*Route::group([ 58 /*Route::group([
59 'as' => 'auth.', //имя маршрута, например auth.index 59 'as' => 'auth.', //имя маршрута, например auth.index
60 'prefix' => 'auth', // префикс маршрута, например, auth/index 60 'prefix' => 'auth', // префикс маршрута, например, auth/index
61 ], function () { 61 ], function () {
62 //форма регистрации 62 //форма регистрации
63 Route::get('register', [RegisterController::class, 'register'])->name('register'); 63 Route::get('register', [RegisterController::class, 'register'])->name('register');
64 64
65 //создание пользователя 65 //создание пользователя
66 Route::post('register', [RegisterController::class, 'create'])->name('create'); 66 Route::post('register', [RegisterController::class, 'create'])->name('create');
67 67
68 //форма входа авторизации 68 //форма входа авторизации
69 Route::get('login', [LoginController::class, 'login'])->name('login'); 69 Route::get('login', [LoginController::class, 'login'])->name('login');
70 70
71 //аутентификация 71 //аутентификация
72 Route::post('login', [LoginController::class, 'authenticate'])->name('auth'); 72 Route::post('login', [LoginController::class, 'authenticate'])->name('auth');
73 73
74 //выход 74 //выход
75 Route::get('logout', [LoginController::class, 'logout'])->name('logout'); 75 Route::get('logout', [LoginController::class, 'logout'])->name('logout');
76 76
77 //форма ввода адреса почты 77 //форма ввода адреса почты
78 Route::get('forgot-password', [ForgotPasswordController::class, 'form'])->name('forgot-form'); 78 Route::get('forgot-password', [ForgotPasswordController::class, 'form'])->name('forgot-form');
79 79
80 //письмо на почту 80 //письмо на почту
81 Route::post('forgot-password', [ForgotPasswordController::class, 'mail'])->name('forgot-mail'); 81 Route::post('forgot-password', [ForgotPasswordController::class, 'mail'])->name('forgot-mail');
82 82
83 //форма восстановления пароля 83 //форма восстановления пароля
84 Route::get('reset-password/token/{token}/email/{email}', 84 Route::get('reset-password/token/{token}/email/{email}',
85 [ResetPasswordController::class, 'form'] 85 [ResetPasswordController::class, 'form']
86 )->name('reset-form'); 86 )->name('reset-form');
87 87
88 //восстановление пароля 88 //восстановление пароля
89 Route::post('reset-password', 89 Route::post('reset-password',
90 [ResetPasswordController::class, 'reset'] 90 [ResetPasswordController::class, 'reset']
91 )->name('reset-password'); 91 )->name('reset-password');
92 92
93 //сообщение о необходимости проверки адреса почты 93 //сообщение о необходимости проверки адреса почты
94 Route::get('verify-message', [VerifyEmailController::class, 'message'])->name('verify-message'); 94 Route::get('verify-message', [VerifyEmailController::class, 'message'])->name('verify-message');
95 95
96 //подтверждение адреса почты нового пользователя 96 //подтверждение адреса почты нового пользователя
97 Route::get('verify-email/token/{token}/id/{id}', [VerifyEmailController::class, 'verify']) 97 Route::get('verify-email/token/{token}/id/{id}', [VerifyEmailController::class, 'verify'])
98 ->where('token', '[a-f0-9]{32}') 98 ->where('token', '[a-f0-9]{32}')
99 ->where('id', '[0-9]+') 99 ->where('id', '[0-9]+')
100 ->name('verify-email'); 100 ->name('verify-email');
101 });*/ 101 });*/
102 102
103 //Личный кабинет пользователя 103 //Личный кабинет пользователя
104 Route::get('/home', [HomeController::class, 'index'])->name('home'); 104 Route::get('/home', [HomeController::class, 'index'])->name('home');
105 105
106 /* 106 /*
107 Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) { 107 Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) {
108 $user = User::where('email',$request->input('email'))->first(); 108 $user = User::where('email',$request->input('email'))->first();
109 109
110 $user->sendEmailVerificationNotification(); 110 $user->sendEmailVerificationNotification();
111 111
112 return 'your response'; 112 return 'your response';
113 })->middleware('throttle:6,1')->name('verification.resend'); 113 })->middleware('throttle:6,1')->name('verification.resend');
114 */ 114 */
115 115
116 // Авторизация, регистрация в админку 116 // Авторизация, регистрация в админку
117 Route::group([ 117 Route::group([
118 'as' => 'admin.', // имя маршрута, например auth.index 118 'as' => 'admin.', // имя маршрута, например auth.index
119 'prefix' => 'admin', // префикс маршрута, например auth/index 119 'prefix' => 'admin', // префикс маршрута, например auth/index
120 'middleware' => ['guest'], 120 'middleware' => ['guest'],
121 ], function () { 121 ], function () {
122 // Форма регистрации 122 // Форма регистрации
123 Route::get('register', [AdminController::class, 'register'])->name('register'); 123 Route::get('register', [AdminController::class, 'register'])->name('register');
124 // Создание пользователя 124 // Создание пользователя
125 Route::post('register', [AdminController::class, 'create'])->name('create'); 125 Route::post('register', [AdminController::class, 'create'])->name('create');
126 126
127 //Форма входа 127 //Форма входа
128 Route::get('login', [AdminController::class, 'login'])->name('login'); 128 Route::get('login', [AdminController::class, 'login'])->name('login');
129 129
130 // аутентификация 130 // аутентификация
131 Route::post('login', [AdminController::class, 'autenticate'])->name('auth'); 131 Route::post('login', [AdminController::class, 'autenticate'])->name('auth');
132 132
133 }); 133 });
134 134
135 // Личный кабинет админки 135 // Личный кабинет админки
136 Route::group([ 136 Route::group([
137 'as' => 'admin.', // имя маршрута, например auth.index 137 'as' => 'admin.', // имя маршрута, например auth.index
138 'prefix' => 'admin', // префикс маршрута, например auth/index 138 'prefix' => 'admin', // префикс маршрута, например auth/index
139 'middleware' => ['auth'], ['admin'], 139 'middleware' => ['auth'], ['admin'],
140 ], function() { 140 ], function() {
141 141
142 // выход 142 // выход
143 Route::get('logout', [AdminController::class, 'logout'])->name('logout'); 143 Route::get('logout', [AdminController::class, 'logout'])->name('logout');
144 144
145 // кабинет главная страница 145 // кабинет главная страница
146 Route::get('cabinet', [AdminController::class, 'index'])->name('index'); 146 Route::get('cabinet', [AdminController::class, 'index'])->name('index');
147 147
148 // кабинет профиль админа - форма 148 // кабинет профиль админа - форма
149 Route::get('profile', [AdminController::class, 'profile'])->name('profile'); 149 Route::get('profile', [AdminController::class, 'profile'])->name('profile');
150 // кабинет профиль админа - сохранение формы 150 // кабинет профиль админа - сохранение формы
151 Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile'); 151 Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile');
152 152
153 //кабинет сообщения админа 153 //кабинет сообщения админа
154 //Route::get('messages', [AdminController::class, 'profile'])->name('profile'); 154 //Route::get('messages', [AdminController::class, 'profile'])->name('profile');
155 155
156 156
157 // кабинет профиль - форма пароли 157 // кабинет профиль - форма пароли
158 Route::get('password', [AdminController::class, 'profile_password'])->name('password'); 158 Route::get('password', [AdminController::class, 'profile_password'])->name('password');
159 // кабинет профиль - сохранение формы пароля 159 // кабинет профиль - сохранение формы пароля
160 Route::post('password', [AdminController::class, 'profile_password_new'])->name('password'); 160 Route::post('password', [AdminController::class, 'profile_password_new'])->name('password');
161 161
162 162
163 // кабинет профиль пользователя - форма 163 // кабинет профиль пользователя - форма
164 Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile'); 164 Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile');
165 // кабинет профиль пользователя - сохранение формы 165 // кабинет профиль пользователя - сохранение формы
166 Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile'); 166 Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile');
167 167
168 // кабинет профиль работодатель - форма 168 // кабинет профиль работодатель - форма
169 Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile'); 169 Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile');
170 // кабинет профиль работодатель - сохранение формы 170 // кабинет профиль работодатель - сохранение формы
171 Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile'); 171 Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile');
172 // кабинет удаление профиль работодателя и юзера 172 // кабинет удаление профиль работодателя и юзера
173 Route::delete('employers/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer'); 173 Route::delete('employers/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer');
174 174
175 // кабинет профиль работник - форма 175 // кабинет профиль работник - форма
176 Route::get('worker-profile/add/{user}', [WorkersController::class, 'form_add_worker'])->name('worker-profile-add'); 176 Route::get('worker-profile/add/{user}', [WorkersController::class, 'form_add_worker'])->name('worker-profile-add');
177 Route::post('worker-profile/add/{user}', [WorkersController::class, 'form_store_worker'])->name('worker-profile-store'); 177 Route::post('worker-profile/add/{user}', [WorkersController::class, 'form_store_worker'])->name('worker-profile-store');
178 Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit'); 178 Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit');
179 // кабинет профиль работник - сохранение формы 179 // кабинет профиль работник - сохранение формы
180 Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update'); 180 Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update');
181 181
182 // Медиа 182 // Медиа
183 Route::get('media', [MediaController::class, 'index'])->name('media'); 183 Route::get('media', [MediaController::class, 'index'])->name('media');
184 Route::delete('media/{media}', [MediaController::class, 'delete'])->name('delete-media'); 184 Route::delete('media/{media}', [MediaController::class, 'delete'])->name('delete-media');
185 185
186 // кабинет настройки сайта - форма 186 // кабинет настройки сайта - форма
187 Route::get('config', [AdminController::class, 'config_form'])->name('config'); 187 Route::get('config', [AdminController::class, 'config_form'])->name('config');
188 // кабинет настройки сайта сохранение формы 188 // кабинет настройки сайта сохранение формы
189 Route::post('config', [AdminController::class, 'store_config'])->name('store_config'); 189 Route::post('config', [AdminController::class, 'store_config'])->name('store_config');
190 190
191 // кабинет - новости 191 // кабинет - новости
192 Route::get('news-list', [AdminController::class, 'news_admin'])->name('news_admin'); 192 Route::get('news-list', [AdminController::class, 'news_admin'])->name('news_admin');
193 Route::get('news/add', [AdminController::class, 'new_admin_add'])->name('new_admin_add'); 193 Route::get('news/add', [AdminController::class, 'new_admin_add'])->name('new_admin_add');
194 Route::post('news/add', [AdminController::class, 'new_admin_add_save'])->name('new_admin_save_add'); 194 Route::post('news/add', [AdminController::class, 'new_admin_add_save'])->name('new_admin_save_add');
195 Route::get('news/edit/{new}', [AdminController::class, 'new_admin_edit'])->name('new_admin_edit'); 195 Route::get('news/edit/{new}', [AdminController::class, 'new_admin_edit'])->name('new_admin_edit');
196 Route::post('news/edit/{new}', [AdminController::class, 'new_admin_update_save'])->name('new_admin_update'); 196 Route::post('news/edit/{new}', [AdminController::class, 'new_admin_update_save'])->name('new_admin_update');
197 Route::get('news/delete/{new}', [AdminController::class, 'new_admin_delete'])->name('new_admin_delete'); 197 Route::get('news/delete/{new}', [AdminController::class, 'new_admin_delete'])->name('new_admin_delete');
198 198
199 // кабинет - пользователи 199 // кабинет - пользователи
200 Route::get('users', [UsersController::class, 'index'])->name('users'); 200 Route::get('users', [UsersController::class, 'index'])->name('users');
201 Route::get('user-delete/{user}', [UsersController::class, 'user_delete'])->name('user_delete');
201 202
202 // кабинет - пользователи 203 // кабинет - пользователи
203 Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users'); 204 Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users');
204 205
205 // кабинет - работодатели 206 // кабинет - работодатели
206 Route::get('employers', [EmployersController::class, 'index'])->name('employers'); 207 Route::get('employers', [EmployersController::class, 'index'])->name('employers');
207 208
208 Route::get('employers/comment/{employer}', [EmployersController::class, 'comment_read'])->name('comment-employer'); 209 Route::get('employers/comment/{employer}', [EmployersController::class, 'comment_read'])->name('comment-employer');
209 210
210 Route::get('flot/add/{employer}', [EmployersController::class, 'add_flot'])->name('flot_add'); 211 Route::get('flot/add/{employer}', [EmployersController::class, 'add_flot'])->name('flot_add');
211 Route::post('flot/add', [EmployersController::class, 'save_add_flot'])->name('flot_add_save'); 212 Route::post('flot/add', [EmployersController::class, 'save_add_flot'])->name('flot_add_save');
212 Route::get('flot/{flot}/{employer}', [EmployersController::class, 'edit_flot'])->name('flot'); 213 Route::get('flot/{flot}/{employer}', [EmployersController::class, 'edit_flot'])->name('flot');
213 Route::put('flot/{flot}', [EmployersController::class, 'edit_save_flot'])->name('flot_edit'); 214 Route::put('flot/{flot}', [EmployersController::class, 'edit_save_flot'])->name('flot_edit');
214 Route::get('flot/{flot}/{employer_id}/delete', [EmployersController::class, 'delete_flot'])->name('flot_delete'); 215 Route::get('flot/{flot}/{employer_id}/delete', [EmployersController::class, 'delete_flot'])->name('flot_delete');
215 216
216 // кабинет - соискатели 217 // кабинет - соискатели
217 Route::get('workers', [WorkersController::class, 'index'])->name('workers'); 218 Route::get('workers', [WorkersController::class, 'index'])->name('workers');
218 219
219 // кабинет - база данных 220 // кабинет - база данных
220 Route::get('basedata', [UsersController::class, 'index_bd'])->name('basedata'); 221 Route::get('basedata', [UsersController::class, 'index_bd'])->name('basedata');
221 Route::get('basedata/add', [UsersController::class, 'add_bd'])->name('add-basedata'); 222 Route::get('basedata/add', [UsersController::class, 'add_bd'])->name('add-basedata');
222 Route::post('basedata/add', [UsersController::class, 'add_store_bd'])->name('add-store-basedata'); 223 Route::post('basedata/add', [UsersController::class, 'add_store_bd'])->name('add-store-basedata');
223 Route::get('basedata/edit/{user}', [UsersController::class, 'edit_bd'])->name('edit-basedata'); 224 Route::get('basedata/edit/{user}', [UsersController::class, 'edit_bd'])->name('edit-basedata');
224 Route::put('basedata/edit/{user}', [UsersController::class, 'update_bd'])->name('update-basedata'); 225 Route::put('basedata/edit/{user}', [UsersController::class, 'update_bd'])->name('update-basedata');
225 Route::delete('basedata/delete/{user}', [UsersController::class, 'destroy_bd'])->name('delete-basedata'); 226 Route::delete('basedata/delete/{user}', [UsersController::class, 'destroy_bd'])->name('delete-basedata');
226 Route::get('basedata/doc/{user}', [UsersController::class, 'doc_bd'])->name('doc-basedata'); 227 Route::get('basedata/doc/{user}', [UsersController::class, 'doc_bd'])->name('doc-basedata');
227 228
228 // кабинет - вакансии 229 // кабинет - вакансии
229 Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers'); 230 Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers');
230 Route::get('ad-employers/add', [Ad_EmployersController::class, 'create'])->name('add-ad-employers'); 231 Route::get('ad-employers/add', [Ad_EmployersController::class, 'create'])->name('add-ad-employers');
231 Route::post('ad-employers/add', [Ad_EmployersController::class, 'store'])->name('store-ad-employers'); 232 Route::post('ad-employers/add', [Ad_EmployersController::class, 'store'])->name('store-ad-employers');
232 Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers'); 233 Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers');
233 Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers'); 234 Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers');
234 Route::delete('ad-employers/delete/{ad_employer}', [Ad_EmployersController::class, 'destroy'])->name('delete-ad-employer'); 235 Route::delete('ad-employers/delete/{ad_employer}', [Ad_EmployersController::class, 'destroy'])->name('delete-ad-employer');
235 236
236 // Редактирование должности в вакансии 237 // Редактирование должности в вакансии
237 Route::put('update-jobs/{ad_jobs}', [Ad_EmployersController::class, 'update_ad_jobs'])->name('update_jobs'); 238 Route::put('update-jobs/{ad_jobs}', [Ad_EmployersController::class, 'update_ad_jobs'])->name('update_jobs');
238 Route::get('edit-jobs/{ad_jobs}', [Ad_EmployersController::class, 'edit_jobs'])->name('edit_jobs'); 239 Route::get('edit-jobs/{ad_jobs}', [Ad_EmployersController::class, 'edit_jobs'])->name('edit_jobs');
239 240
240 241
241 // кабинет - категории 242 // кабинет - категории
242 //Route::get('categories', [AdminController::class, 'index'])->name('categories'); 243 //Route::get('categories', [AdminController::class, 'index'])->name('categories');
243 244
244 // СRUD-операции над Справочником Категории 245 // СRUD-операции над Справочником Категории
245 246
246 Route::resource('categories', CategoryController::class, ['except' => ['show']]); 247 Route::resource('categories', CategoryController::class, ['except' => ['show']]);
247 248
248 // CRUD-операции над справочником Категории для работодателей 249 // CRUD-операции над справочником Категории для работодателей
249 Route::resource('category-emp', CategoryEmpController::class, ['except' => ['show']]); 250 Route::resource('category-emp', CategoryEmpController::class, ['except' => ['show']]);
250 251
251 // CRUD-операции над справочником Образование 252 // CRUD-операции над справочником Образование
252 Route::resource('education', EducationController::class, ['except' => ['show']]); 253 Route::resource('education', EducationController::class, ['except' => ['show']]);
253 254
254 Route::get('rename-program-education', [EducationController::class, 'rename_program'])->name('rename-program-education'); 255 Route::get('rename-program-education', [EducationController::class, 'rename_program'])->name('rename-program-education');
255 Route::get('program-education', [EducationController::class, 'add_program'])->name('add-program-education'); 256 Route::get('program-education', [EducationController::class, 'add_program'])->name('add-program-education');
256 Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education'); 257 Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education');
257 258
258 Route::get('program-education/edit/{program}/{education}', [EducationController::class, 'edit_program'])->name('edit-program-education'); 259 Route::get('program-education/edit/{program}/{education}', [EducationController::class, 'edit_program'])->name('edit-program-education');
259 Route::post('program-education/edit/{program}/{education}', [EducationController::class, 'update_program'])->name('update-program-education'); 260 Route::post('program-education/edit/{program}/{education}', [EducationController::class, 'update_program'])->name('update-program-education');
260 261
261 Route::get('program-education/delete/{program}/{education}', [EducationController::class, 'delete_program'])->name('delete-program-education'); 262 Route::get('program-education/delete/{program}/{education}', [EducationController::class, 'delete_program'])->name('delete-program-education');
262 263
263 //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles'); 264 //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles');
264 /* 265 /*
265 * кабинет - CRUD-операции по справочнику должности 266 * кабинет - CRUD-операции по справочнику должности
266 * 267 *
267 */ 268 */
268 Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]); 269 Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]);
269 270
270 // кабинет - сообщения (чтение чужих) 271 // кабинет - сообщения (чтение чужих)
271 Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages'); 272 Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages');
272 // кабинет - просмотр сообщения чужого (чтение) 273 // кабинет - просмотр сообщения чужого (чтение)
273 Route::get('messages/{message}', [MsgAnswersController::class, 'read_message'])->name('read-message'); 274 Route::get('messages/{message}', [MsgAnswersController::class, 'read_message'])->name('read-message');
274 275
275 // кабинет - сообщения (админские) 276 // кабинет - сообщения (админские)
276 Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages'); 277 Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages');
277 // кабинет - сообщения (админские) 278 // кабинет - сообщения (админские)
278 Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post'); 279 Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post');
279 // кабинет - sql - конструкция запросов 280 // кабинет - sql - конструкция запросов
280 Route::get('messages-sql', [MsgAnswersController::class, 'messages_sql'])->name('messages-sql'); 281 Route::get('messages-sql', [MsgAnswersController::class, 'messages_sql'])->name('messages-sql');
281 282
282 /* 283 /*
283 * Расписанный подход в описании каждой директорий групп пользователей. 284 * Расписанный подход в описании каждой директорий групп пользователей.
284 */ 285 */
285 // кабинет - группы пользователей 286 // кабинет - группы пользователей
286 Route::get('groups', [GroupsController::class, 'index'])->name('groups'); 287 Route::get('groups', [GroupsController::class, 'index'])->name('groups');
287 // кабинет - добавление форма группы пользователей 288 // кабинет - добавление форма группы пользователей
288 Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group'); 289 Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group');
289 // кабинет - сохранение формы группы пользователей 290 // кабинет - сохранение формы группы пользователей
290 Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store'); 291 Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store');
291 // кабинет - редактирование форма группы пользователей 292 // кабинет - редактирование форма группы пользователей
292 Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group'); 293 Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group');
293 // кабинет - сохранение редактированной формы группы пользователей 294 // кабинет - сохранение редактированной формы группы пользователей
294 Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group'); 295 Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group');
295 // кабинет - удаление группы пользователей 296 // кабинет - удаление группы пользователей
296 Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group'); 297 Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group');
297 298
298 299
299 // кабинет - список админов 300 // кабинет - список админов
300 Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin'); 301 Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin');
301 302
302 // справочник Позиции 303 // справочник Позиции
303 Route::get('positions', [AdminController::class, 'position'])->name('position'); 304 Route::get('positions', [AdminController::class, 'position'])->name('position');
304 Route::get('positions/add', [AdminController::class, 'position_add'])->name('add-position'); 305 Route::get('positions/add', [AdminController::class, 'position_add'])->name('add-position');
305 Route::post('positions/add', [AdminController::class, 'position_add_save'])->name('add-save-position'); 306 Route::post('positions/add', [AdminController::class, 'position_add_save'])->name('add-save-position');
306 Route::get('positions/edit/{position}', [AdminController::class, 'position_edit'])->name('edit-position'); 307 Route::get('positions/edit/{position}', [AdminController::class, 'position_edit'])->name('edit-position');
307 Route::post('position/edit/{position}', [AdminController::class, 'position_update'])->name('update-position'); 308 Route::post('position/edit/{position}', [AdminController::class, 'position_update'])->name('update-position');
308 Route::get('position/delete/{position}', [AdminController::class, 'position_delete'])->name('delete-position'); 309 Route::get('position/delete/{position}', [AdminController::class, 'position_delete'])->name('delete-position');
309 310
310 /////редактор////// кабинет - редактор сайта//////////////////////// 311 /////редактор////// кабинет - редактор сайта////////////////////////
311 Route::get('editor-site', function() { 312 Route::get('editor-site', function() {
312 return view('admin.editor.index'); 313 return view('admin.editor.index');
313 })->name('editor-site'); 314 })->name('editor-site');
314 315
315 316
316 // кабинет - редактор шапки-футера сайта 317 // кабинет - редактор шапки-футера сайта
317 Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks'); 318 Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks');
318 Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block'); 319 Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block');
319 Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store'); 320 Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store');
320 Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block'); 321 Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block');
321 Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block'); 322 Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block');
322 Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block'); 323 Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block');
323 Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block'); 324 Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block');
324 325
325 326
326 // кабинет - редактор должности на главной 327 // кабинет - редактор должности на главной
327 Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main'); 328 Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main');
328 329
329 // кабинет - редактор работодатели на главной 330 // кабинет - редактор работодатели на главной
330 Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main'); 331 Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main');
331 332
332 333
333 // кабинет - редактор seo-сайта 334 // кабинет - редактор seo-сайта
334 Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo'); 335 Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo');
335 Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo'); 336 Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo');
336 Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store'); 337 Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store');
337 Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo'); 338 Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo');
338 Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo'); 339 Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo');
339 Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo'); 340 Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo');
340 Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo'); 341 Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo');
341 342
342 343
343 // кабинет - редактор страниц 344 // кабинет - редактор страниц
344 Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages'); 345 Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages');
345 // кабинет - добавление страницы 346 // кабинет - добавление страницы
346 Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page'); 347 Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page');
347 // кабинет - сохранение формы страницы 348 // кабинет - сохранение формы страницы
348 Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store'); 349 Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store');
349 // кабинет - редактирование форма страницы 350 // кабинет - редактирование форма страницы
350 Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page'); 351 Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page');
351 // кабинет - сохранение редактированной формы страницы 352 // кабинет - сохранение редактированной формы страницы
352 Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page'); 353 Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page');
353 // кабинет - удаление страницы 354 // кабинет - удаление страницы
354 Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page'); 355 Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page');
355 356
356 357
357 // кабинет - реклама сайта 358 // кабинет - реклама сайта
358 Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames'); 359 Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames');
359 Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames'); 360 Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames');
360 Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store'); 361 Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store');
361 Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames'); 362 Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames');
362 Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames'); 363 Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames');
363 Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames'); 364 Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames');
364 //////////////////////////////////////////////////////////////////////// 365 ////////////////////////////////////////////////////////////////////////
365 366
366 367
367 // кабинет - отзывы о работодателе для модерации 368 // кабинет - отзывы о работодателе для модерации
368 Route::get('answers', [EmployersController::class, 'answers'])->name('answers'); 369 Route::get('answers', [EmployersController::class, 'answers'])->name('answers');
369 370
370 // Общая страница статистики 371 // Общая страница статистики
371 Route::get('statics', function () { 372 Route::get('statics', function () {
372 return view('admin.static.index'); 373 return view('admin.static.index');
373 })->name('statics'); 374 })->name('statics');
374 375
375 // кабинет - статистика работников 376 // кабинет - статистика работников
376 Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers'); 377 Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers');
377 378
378 // кабинет - статистика вакансий работодателя 379 // кабинет - статистика вакансий работодателя
379 Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads'); 380 Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads');
380 381
381 // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника 382 // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника
382 /* 383 /*
383 * CRUD-операции над справочником дипломы и документы 384 * CRUD-операции над справочником дипломы и документы
384 */ 385 */
385 //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks'); 386 //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks');
386 Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]); 387 Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]);
387 388
388 // кабинет - роли пользователя 389 // кабинет - роли пользователя
389 Route::get('roles', [UsersController::class, 'roles'])->name('roles'); 390 Route::get('roles', [UsersController::class, 'roles'])->name('roles');
390 391
391 Route::get('admin_roles', [UsersController::class, 'admin_roles'])->name('admin_roles'); 392 Route::get('admin_roles', [UsersController::class, 'admin_roles'])->name('admin_roles');
392 393
393 Route::get('logs', function() { 394 Route::get('logs', function() {
394 $files = Storage::files('logs/laravel.log'); 395 $files = Storage::files('logs/laravel.log');
395 })->name('logs'); 396 })->name('logs');
396 }); 397 });
397 398
398 // Инструментальные страницы 399 // Инструментальные страницы
399 Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload'); 400 Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload');
400 401
401 Route::get('redis/', [PagesController::class, 'redis'])->name('redis'); 402 Route::get('redis/', [PagesController::class, 'redis'])->name('redis');
402 403
403 Route::get('excel/', [PagesController::class, 'excel'])->name('excel'); 404 Route::get('excel/', [PagesController::class, 'excel'])->name('excel');
404 405
405 // Страницы с произвольным контентом 406 // Страницы с произвольным контентом
406 Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page'); 407 Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page');
407 408
408 // Форма обратной связи 409 // Форма обратной связи
409 Route::post('form_feedback', [PagesController::class, 'form_feedback'])->name('form_feedback'); 410 Route::post('form_feedback', [PagesController::class, 'form_feedback'])->name('form_feedback');
410 411
411 // Публичные страницы соискателя 412 // Публичные страницы соискателя
412 Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page'); 413 Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page');
413 414
414 //Страница вакансии 415 //Страница вакансии
415 Route::get('employer/ad/{ad_employer}', [AdEmployerController::class, 'ad_employer'])->name('ad-employer'); 416 Route::get('employer/ad/{ad_employer}', [AdEmployerController::class, 'ad_employer'])->name('ad-employer');
416 417
417 //Вакансии 418 //Вакансии
418 Route::get('vacancies', [MainController::class, 'vacancies'])->name('vacancies'); 419 Route::get('vacancies', [MainController::class, 'vacancies'])->name('vacancies');
419 420
420 //Вакансии поиск на главной 421 //Вакансии поиск на главной
421 Route::get('search-vacancies', [MainController::class, 'search_vacancies'])->name('search_vacancies'); 422 Route::get('search-vacancies', [MainController::class, 'search_vacancies'])->name('search_vacancies');
422 423
423 //Вакансии категория детальная 424 //Вакансии категория детальная
424 Route::get('list-vacancies/{categories?}', [MainController::class, 'list_vacancies'])->name('list-vacancies'); 425 Route::get('list-vacancies/{categories?}', [MainController::class, 'list_vacancies'])->name('list-vacancies');
425 426
426 // Лайк вакансии 427 // Лайк вакансии
427 Route::get('like-vacancy', [MainController::class, 'like_vacancy'])->name('like-vacancy'); 428 Route::get('like-vacancy', [MainController::class, 'like_vacancy'])->name('like-vacancy');
428 429
429 //Детальная страница вакансии - работодателя 430 //Детальная страница вакансии - работодателя
430 Route::get('vacancie/{vacancy}', [FrontEmployersController::class, 'vacancie'])->name('vacancie'); 431 Route::get('vacancie/{vacancy}', [FrontEmployersController::class, 'vacancie'])->name('vacancie');
431 432
432 //Судоходные компании 433 //Судоходные компании
433 Route::get('shipping-companies', [FrontCompanyController::class, 'shipping_companies'])->name('shipping_companies'); 434 Route::get('shipping-companies', [FrontCompanyController::class, 'shipping_companies'])->name('shipping_companies');
434 435
435 //Детальная инфа о компании 436 //Детальная инфа о компании
436 Route::get('info-company/{company}', [FrontCompanyController::class, 'info_company'])->name('info_company'); 437 Route::get('info-company/{company}', [FrontCompanyController::class, 'info_company'])->name('info_company');
437 438
438 //Образование 439 //Образование
439 Route::get('education', [MainController::class, 'education'])->name('education'); 440 Route::get('education', [MainController::class, 'education'])->name('education');
440 441
441 //Новости 442 //Новости
442 Route::get('news', [MainController::class, 'news'])->name('news'); 443 Route::get('news', [MainController::class, 'news'])->name('news');
443 Route::get('detail-new/{new}', [MainController::class, 'detail_new'])->name('detail_new'); 444 Route::get('detail-new/{new}', [MainController::class, 'detail_new'])->name('detail_new');
444 445
445 //Контакты 446 //Контакты
446 Route::get('contacts', [MainController::class, 'contacts'])->name('contacts'); 447 Route::get('contacts', [MainController::class, 'contacts'])->name('contacts');
447 448
448 //База резюме 449 //База резюме
449 Route::get('bd-resume', [WorkerController::class, 'bd_resume'])->name('bd_resume'); 450 Route::get('bd-resume', [WorkerController::class, 'bd_resume'])->name('bd_resume');
450 Route::get('bd_resume_danger', function(){ 451 Route::get('bd_resume_danger', function(){
451 return view('employers.bd_resume_danger'); 452 return view('employers.bd_resume_danger');
452 })->name('bd_resume_danger'); 453 })->name('bd_resume_danger');
453 454
454 Route::get('like-resume', [MainController::class, 'like_worker'])->name('like_resume'); 455 Route::get('like-resume', [MainController::class, 'like_worker'])->name('like_resume');
455 456
456 //Анкета соискателя 457 //Анкета соискателя
457 Route::get('resume-profile/{worker}', [WorkerController::class, 'resume_profile'])->name('resume_profile'); 458 Route::get('resume-profile/{worker}', [WorkerController::class, 'resume_profile'])->name('resume_profile');
458 459
459 //Скачать резюме 460 //Скачать резюме
460 Route::get('resume-download/{worker}', [WorkerController::class, 'resume_download'])->name('resume_download'); 461 Route::get('resume-download/{worker}', [WorkerController::class, 'resume_download'])->name('resume_download');
461 Route::get('resume-download/all', [WorkerController::class, 'resume_download_all'])->name('resume_download_all2'); 462 Route::get('resume-download/all', [WorkerController::class, 'resume_download_all'])->name('resume_download_all2');
462 Route::get('resume-download', [WorkerController::class, 'resume_download_all'])->name('resume_download_all'); 463 Route::get('resume-download', [WorkerController::class, 'resume_download_all'])->name('resume_download_all');
463 464
464 465
465 //Вход в кабинет 466 //Вход в кабинет
466 Route::get('login', [MainController::class, 'input_login'])->name('login'); 467 Route::get('login', [MainController::class, 'input_login'])->name('login');
467 468
468 // Выход из кабинета 469 // Выход из кабинета
469 Route::get('logout', [EmployerController::class, 'logout'])->name('logout'); 470 Route::get('logout', [EmployerController::class, 'logout'])->name('logout');
470 471
471 Route::get( 'register_worker', [WorkerController::class, 'register_worker'])->name('register_worker'); 472 Route::get( 'register_worker', [WorkerController::class, 'register_worker'])->name('register_worker');
472 Route::get('register_employer', [EmployerController::class, 'register_employer'])->name('register_employer'); 473 Route::get('register_employer', [EmployerController::class, 'register_employer'])->name('register_employer');
473 474
474 //восстановление пароля 475 //восстановление пароля
475 Route::get('repair-password', [MainController::class, 'repair_password'])->name('repair_password'); 476 Route::get('repair-password', [MainController::class, 'repair_password'])->name('repair_password');
476 // Звезда сообщения 477 // Звезда сообщения
477 Route::post('stars-answer', [WorkerController::class, 'stars_answer'])->name('stars_answer'); 478 Route::post('stars-answer', [WorkerController::class, 'stars_answer'])->name('stars_answer');
478 479
479 // Борьба 480 // Борьба
480 Route::get('clear_cookie', function() { 481 Route::get('clear_cookie', function() {
481 \App\Classes\Cookies_vacancy::clear_vacancy(); 482 \App\Classes\Cookies_vacancy::clear_vacancy();
482 return redirect()->route('index'); 483 return redirect()->route('index');
483 })->name('clear_cookie'); 484 })->name('clear_cookie');
484 485
485 Route::get('cookies', function() { 486 Route::get('cookies', function() {
486 return view('cookies'); 487 return view('cookies');
487 })->name('cookies'); 488 })->name('cookies');
488 489
489 // Личный кабинет работник 490 // Личный кабинет работник
490 Route::group([ 491 Route::group([
491 'as' => 'worker.', // имя маршрута, например auth.index 492 'as' => 'worker.', // имя маршрута, например auth.index
492 'prefix' => 'worker', // префикс маршрута, например auth/index 493 'prefix' => 'worker', // префикс маршрута, например auth/index
493 'middleware' => ['auth'], ['is_worker'], 494 'middleware' => ['auth'], ['is_worker'],
494 ], function() { 495 ], function() {
495 // 1 страница - Моя анкета 496 // 1 страница - Моя анкета
496 Route::get('cabinet', [WorkerController::class, 'cabinet'])->name('cabinet'); 497 Route::get('cabinet', [WorkerController::class, 'cabinet'])->name('cabinet');
497 Route::post('cabinet/{worker}', [WorkerController::class, 'cabinet_save'])->name('cabinet_save'); 498 Route::post('cabinet/{worker}', [WorkerController::class, 'cabinet_save'])->name('cabinet_save');
498 499
499 // 2 страница - Сообщения 500 // 2 страница - Сообщения
500 Route::get('cabinet/messages/{type_message}', [WorkerController::class, 'messages'])->name('messages'); 501 Route::get('cabinet/messages/{type_message}', [WorkerController::class, 'messages'])->name('messages');
501 Route::get('cabinet/dialog/{user1}/{user2}', [WorkerController::class, 'dialog'])->name('dialog'); 502 Route::get('cabinet/dialog/{user1}/{user2}', [WorkerController::class, 'dialog'])->name('dialog');
502 // 3 страница - Избранные вакансии 503 // 3 страница - Избранные вакансии
503 Route::get('cabinet/favorite', [WorkerController::class, 'favorite'])->name('favorite'); 504 Route::get('cabinet/favorite', [WorkerController::class, 'favorite'])->name('favorite');
504 // Продолжение борьбы против колорадов - избранные вакансии 505 // Продолжение борьбы против колорадов - избранные вакансии
505 Route::get('кабинет/favorite', [WorkerController::class, 'colorado'])->name('colorado'); 506 Route::get('кабинет/favorite', [WorkerController::class, 'colorado'])->name('colorado');
506 507
507 // 4 страница - Сменить пароль 508 // 4 страница - Сменить пароль
508 Route::get('кабинет/new_password', [WorkerController::class, 'new_password'])->name('new_password'); 509 Route::get('кабинет/new_password', [WorkerController::class, 'new_password'])->name('new_password');
509 Route::post('кабинет/new_password/save', [WorkerController::class, 'save_new_password'])->name('save_new_password'); 510 Route::post('кабинет/new_password/save', [WorkerController::class, 'save_new_password'])->name('save_new_password');
510 511
511 // 5 страница - Удалить профиль 512 // 5 страница - Удалить профиль
512 Route::get('кабинет/delete_profile', [WorkerController::class, 'delete_profile'])->name('delete_profile'); 513 Route::get('кабинет/delete_profile', [WorkerController::class, 'delete_profile'])->name('delete_profile');
513 Route::post('кабинет/delete_profile/delete', [WorkerController::class, 'delete_profile_result'])->name('deleteprofile_result'); 514 Route::post('кабинет/delete_profile/delete', [WorkerController::class, 'delete_profile_result'])->name('deleteprofile_result');
514 515
515 // Резюме -pdf 516 // Резюме -pdf
516 Route::get('кабинет/download/{worker}', [WorkerController::class, 'download'])->name('download'); 517 Route::get('кабинет/download/{worker}', [WorkerController::class, 'download'])->name('download');
517 518
518 // Поднятие анкеты 519 // Поднятие анкеты
519 Route::get('кабинет/up/{worker}', [WorkerController::class, 'up'])->name('up'); 520 Route::get('кабинет/up/{worker}', [WorkerController::class, 'up'])->name('up');
520 521
521 Route::post('test123', [WorkerController::class, 'test123'])->name('test123'); 522 Route::post('test123', [WorkerController::class, 'test123'])->name('test123');
522 523
523 // Добавление сертификата 524 // Добавление сертификата
524 Route::get('кабинет/new_sertificate/{worker}', [WorkerController::class, 'new_sertificate'])->name('new_sertificate'); 525 Route::get('кабинет/new_sertificate/{worker}', [WorkerController::class, 'new_sertificate'])->name('new_sertificate');
525 Route::get('кабинет/add_sertificate', [WorkerController::class, 'add_serificate'])->name('add_serificate'); 526 Route::get('кабинет/add_sertificate', [WorkerController::class, 'add_serificate'])->name('add_serificate');
526 Route::get('кабинет/edit_sertificate/{worker}/{doc}', [WorkerController::class, 'edit_sertificate'])->name('edit_sertificate'); 527 Route::get('кабинет/edit_sertificate/{worker}/{doc}', [WorkerController::class, 'edit_sertificate'])->name('edit_sertificate');
527 Route::get('кабинет/edit_sertificate/{doc}', [WorkerController::class, 'update_serificate'])->name('update_serificate'); 528 Route::get('кабинет/edit_sertificate/{doc}', [WorkerController::class, 'update_serificate'])->name('update_serificate');
528 Route::get('кабинет/delete_sertificate/{doc}', [WorkerController::class, 'delete_sertificate'])->name('delete_sertificate'); 529 Route::get('кабинет/delete_sertificate/{doc}', [WorkerController::class, 'delete_sertificate'])->name('delete_sertificate');
529 530
530 // Добавление предыдущих контактов компании 531 // Добавление предыдущих контактов компании
531 Route::get('кабинет/prev_company/{worker}', [WorkerController::class, 'new_prev_company'])->name('new_prev_company'); 532 Route::get('кабинет/prev_company/{worker}', [WorkerController::class, 'new_prev_company'])->name('new_prev_company');
532 Route::get('кабинет/add_prev_company', [WorkerController::class, 'add_prev_company'])->name('add_prev_company'); 533 Route::get('кабинет/add_prev_company', [WorkerController::class, 'add_prev_company'])->name('add_prev_company');
533 Route::get('кабинет/edit_prev_company/{doc}/{worker}', [WorkerController::class, 'edit_prev_company'])->name('edit_prev_company'); 534 Route::get('кабинет/edit_prev_company/{doc}/{worker}', [WorkerController::class, 'edit_prev_company'])->name('edit_prev_company');
534 Route::post('кабинет/update_prev_company/{doc}', [WorkerController::class, 'update_prev_company'])->name('update_prev_company'); 535 Route::post('кабинет/update_prev_company/{doc}', [WorkerController::class, 'update_prev_company'])->name('update_prev_company');
535 Route::get('кабинет/delete_prev_company/{doc}', [WorkerController::class, 'delete_prev_company'])->name('delete_prev_company'); 536 Route::get('кабинет/delete_prev_company/{doc}', [WorkerController::class, 'delete_prev_company'])->name('delete_prev_company');
536 537
537 // Добавление документа-диплома 538 // Добавление документа-диплома
538 Route::get('кабинет/add_diplom/{worker}', [WorkerController::class, 'add_diplom'])->name('add_diplom'); 539 Route::get('кабинет/add_diplom/{worker}', [WorkerController::class, 'add_diplom'])->name('add_diplom');
539 Route::post('кабинет/add_diplom', [WorkerController::class, 'add_diplom_save'])->name('dop_info_save'); 540 Route::post('кабинет/add_diplom', [WorkerController::class, 'add_diplom_save'])->name('dop_info_save');
540 Route::get('кабинет/delete_ad_diplom/{worker}', [WorkerController::class, 'delete_add_diplom'])->name('delete_add_diplom'); 541 Route::get('кабинет/delete_ad_diplom/{worker}', [WorkerController::class, 'delete_add_diplom'])->name('delete_add_diplom');
541 542
542 // Добавление стандартного диплома 543 // Добавление стандартного диплома
543 Route::get('кабинет/add_document/{worker}', [WorkerController::class, 'add_document'])->name('add_document'); 544 Route::get('кабинет/add_document/{worker}', [WorkerController::class, 'add_document'])->name('add_document');
544 Route::post('кабинет/add_document/', [WorkerController::class, 'add_document_save'])->name('add_document_save'); 545 Route::post('кабинет/add_document/', [WorkerController::class, 'add_document_save'])->name('add_document_save');
545 Route::get('кабинет/edit_document/{doc}/{worker}', [WorkerController::class, 'edit_document'])->name('edit_document'); 546 Route::get('кабинет/edit_document/{doc}/{worker}', [WorkerController::class, 'edit_document'])->name('edit_document');
546 Route::post('кабинет/edit_document/{doc}', [WorkerController::class, 'edit_document_save'])->name('edit_document_save'); 547 Route::post('кабинет/edit_document/{doc}', [WorkerController::class, 'edit_document_save'])->name('edit_document_save');
547 Route::get('кабинет/delete_document/{doc}', [WorkerController::class, 'delete_document'])->name('delete_document'); 548 Route::get('кабинет/delete_document/{doc}', [WorkerController::class, 'delete_document'])->name('delete_document');
548 549
549 // Отправка сообщения работодателю от соискателя 550 // Отправка сообщения работодателю от соискателя
550 Route::post('сообщение/', [WorkerController::class, 'new_message'])->name('new_message'); 551 Route::post('сообщение/', [WorkerController::class, 'new_message'])->name('new_message');
551 }); 552 });
552 553
553 // Личный кабинет работодателя 554 // Личный кабинет работодателя
554 Route::group([ 555 Route::group([
555 'as' => 'employer.', // имя маршрута, например auth.index 556 'as' => 'employer.', // имя маршрута, например auth.index
556 'prefix' => 'employer', // префикс маршрута, например auth/index 557 'prefix' => 'employer', // префикс маршрута, например auth/index
557 'middleware' => ['auth'], !['is_worker'], 558 'middleware' => ['auth'], !['is_worker'],
558 ], function() { 559 ], function() {
559 // 0 страница - Личные данные работодателя 560 // 0 страница - Личные данные работодателя
560 Route::get('cabinet/employer_info', [EmployerController::class, 'employer_info'])->name('employer_info'); 561 Route::get('cabinet/employer_info', [EmployerController::class, 'employer_info'])->name('employer_info');
561 Route::post('cabinet/employer_info/{user}', [EmployerController::class, 'employer_info_save'])->name('employer_info_save'); 562 Route::post('cabinet/employer_info/{user}', [EmployerController::class, 'employer_info_save'])->name('employer_info_save');
562 563
563 // 1 страница - Профиль 564 // 1 страница - Профиль
564 Route::get('cabinet', [EmployerController::class, 'cabinet'])->name('cabinet'); 565 Route::get('cabinet', [EmployerController::class, 'cabinet'])->name('cabinet');
565 Route::post('cabinet/{Employer}', [EmployerController::class, 'cabinet_save'])->name('cabinet_save'); 566 Route::post('cabinet/{Employer}', [EmployerController::class, 'cabinet_save'])->name('cabinet_save');
566 Route::post('flot_add_ajax', [EmployerController::class, 'save_add_flot'])->name('save_add_flot'); 567 Route::post('flot_add_ajax', [EmployerController::class, 'save_add_flot'])->name('save_add_flot');
567 Route::get('flot_delete_ajax/{Flot}', [EmployerController::class, 'delete_flot'])->name('delete_flot'); 568 Route::get('flot_delete_ajax/{Flot}', [EmployerController::class, 'delete_flot'])->name('delete_flot');
568 Route::get('cabinet/flot_edit/{Flot}/{Employer}', [EmployerController::class, 'edit_flot'])->name('edit_flot'); 569 Route::get('cabinet/flot_edit/{Flot}/{Employer}', [EmployerController::class, 'edit_flot'])->name('edit_flot');
569 Route::post('cabinet/flot_edit/{Flot}', [EmployerController::class, 'update_flot'])->name('update_flot_save'); 570 Route::post('cabinet/flot_edit/{Flot}', [EmployerController::class, 'update_flot'])->name('update_flot_save');
570 Route::get('cabinet/flot', [EmployerController::class, 'slider_flot'])->name('slider_flot'); 571 Route::get('cabinet/flot', [EmployerController::class, 'slider_flot'])->name('slider_flot');
571 572
572 // 2 страница - Добавление вакансий 573 // 2 страница - Добавление вакансий
573 Route::get('cabinet/vacancie', [EmployerController::class, 'cabinet_vacancie'])->name('cabinet_vacancie'); 574 Route::get('cabinet/vacancie', [EmployerController::class, 'cabinet_vacancie'])->name('cabinet_vacancie');
574 Route::post('vacancie', [EmployerController::class, 'cabinet_vacancy_save1'])->name('vac_save'); 575 Route::post('vacancie', [EmployerController::class, 'cabinet_vacancy_save1'])->name('vac_save');
575 //Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); 576 //Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people');
576 577
577 Route::get('cabinet/vacancie_danger', [EmployerController::class, 'cabinet_vacancie_danger'])->name('cabinet_vacancie_danger'); 578 Route::get('cabinet/vacancie_danger', [EmployerController::class, 'cabinet_vacancie_danger'])->name('cabinet_vacancie_danger');
578 579
579 580
580 581
581 Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); 582 Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people');
582 583
583 // 3 страница - Мои вакансии 584 // 3 страница - Мои вакансии
584 Route::get('cabinet/vacancy_list', [EmployerController::class, 'vacancy_list'])->name('vacancy_list'); 585 Route::get('cabinet/vacancy_list', [EmployerController::class, 'vacancy_list'])->name('vacancy_list');
585 Route::get('cabinet/vacancy/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); 586 Route::get('cabinet/vacancy/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit');
586 Route::get('cabinet/vacancy-delete/{ad_employer}', [EmployerController::class, 'vacancy_delete'])->name('vacancy_delete'); 587 Route::get('cabinet/vacancy-delete/{ad_employer}', [EmployerController::class, 'vacancy_delete'])->name('vacancy_delete');
587 Route::get('cabinet/vacancy-up/{ad_employer}', [EmployerController::class, 'vacancy_up'])->name('vacancy_up'); 588 Route::get('cabinet/vacancy-up/{ad_employer}', [EmployerController::class, 'vacancy_up'])->name('vacancy_up');
588 Route::get('cabinet/vacancy-eye/{ad_employer}/{status}', [EmployerController::class, 'vacancy_eye'])->name('vacancy_eye'); 589 Route::get('cabinet/vacancy-eye/{ad_employer}/{status}', [EmployerController::class, 'vacancy_eye'])->name('vacancy_eye');
589 Route::get('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); 590 Route::get('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit');
590 Route::post('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_save_me'])->name('vacancy_save_me'); 591 Route::post('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_save_me'])->name('vacancy_save_me');
591 592
592 // 4.1Ю. 593 // 4.1Ю.
593 Route::get('cabinet/ad_jobs/create/{ad_employer}', [Ad_jobsController::class, 'add_job_in_vac'])->name('add_job_in_vac'); 594 Route::get('cabinet/ad_jobs/create/{ad_employer}', [Ad_jobsController::class, 'add_job_in_vac'])->name('add_job_in_vac');
594 Route::post('cabinet/ad_jobs/create', [Ad_jobsController::class, 'add_job_in_vac_save'])->name('add_job_in_vac_save'); 595 Route::post('cabinet/ad_jobs/create', [Ad_jobsController::class, 'add_job_in_vac_save'])->name('add_job_in_vac_save');
595 Route::get('cabinet/ad_jobs/edit/{ad_job}/{ad_employer}', [Ad_jobsController::class, 'edit_job_in_vac'])->name('edit_job_in_vac'); 596 Route::get('cabinet/ad_jobs/edit/{ad_job}/{ad_employer}', [Ad_jobsController::class, 'edit_job_in_vac'])->name('edit_job_in_vac');
596 Route::post('cabinet/ad_jobs/edit/{ad_job}', [Ad_jobsController::class, 'edit_job_in_vac_save'])->name('edit_job_in_vac_save'); 597 Route::post('cabinet/ad_jobs/edit/{ad_job}', [Ad_jobsController::class, 'edit_job_in_vac_save'])->name('edit_job_in_vac_save');
597 Route::get('cabinet/ad_jobs/delete/{ad_job}', [Ad_jobsController::class, 'delete_job_in_vac'])->name('delete_job_in_vac'); 598 Route::get('cabinet/ad_jobs/delete/{ad_job}', [Ad_jobsController::class, 'delete_job_in_vac'])->name('delete_job_in_vac');
598 599
599 // 4 страница - Отклики на вакансии 600 // 4 страница - Отклики на вакансии
600 Route::get('cabinet/answers/{employer}', [EmployerController::class, 'answers'])->name('answers'); 601 Route::get('cabinet/answers/{employer}', [EmployerController::class, 'answers'])->name('answers');
601 Route::get('cabinet/status/{employer}', [EmployerController::class, 'supple_status2'])->name('supple'); 602 Route::get('cabinet/status/{employer}', [EmployerController::class, 'supple_status2'])->name('supple');
602 Route::get('status/{employer}/{ad_response}/{flag}', [EmployerController::class, 'supple_status'])->name('status_msg'); 603 Route::get('status/{employer}/{ad_response}/{flag}', [EmployerController::class, 'supple_status'])->name('status_msg');
603 604
604 // 5 страница - Сообщения 605 // 5 страница - Сообщения
605 Route::get('cabinet/messages/{type_message}', [EmployerController::class, 'messages'])->name('messages'); 606 Route::get('cabinet/messages/{type_message}', [EmployerController::class, 'messages'])->name('messages');
606 Route::get('cabinet/dialog/{user1}/{user2}', [EmployerController::class, 'dialog'])->name('dialog'); 607 Route::get('cabinet/dialog/{user1}/{user2}', [EmployerController::class, 'dialog'])->name('dialog');
607 Route::post('cabinet/send-message', [EmployerController::class, 'send_message'])->name('send_message'); 608 Route::post('cabinet/send-message', [EmployerController::class, 'send_message'])->name('send_message');
608 Route::post('test123', [EmployerController::class, 'test123'])->name('test123'); 609 Route::post('test123', [EmployerController::class, 'test123'])->name('test123');
609 610
610 // 6 страница - Избранный 611 // 6 страница - Избранный
611 Route::get('cabinet/favorites', [EmployerController::class, 'favorites'])->name('favorites'); 612 Route::get('cabinet/favorites', [EmployerController::class, 'favorites'])->name('favorites');
612 613
613 //7 страница - База данных 614 //7 страница - База данных
614 Route::get('cabinet/bd', [EmployerController::class, 'bd'])->name('bd'); 615 Route::get('cabinet/bd', [EmployerController::class, 'bd'])->name('bd');
615 616
616 //8 страница - База резюме 617 //8 страница - База резюме
617 Route::get('cabinet/bd-tupe', [EmployerController::class, 'bd_tupe'])->name('bd-tupe'); 618 Route::get('cabinet/bd-tupe', [EmployerController::class, 'bd_tupe'])->name('bd-tupe');
618 619
619 // 9 рассылка сообщений 620 // 9 рассылка сообщений
620 Route::get('cabinet/send-all-messages', [EmployerController::class, 'send_all_messages'])->name('send_all_messages'); 621 Route::get('cabinet/send-all-messages', [EmployerController::class, 'send_all_messages'])->name('send_all_messages');
621 Route::post('cabinet/send-all-messages/send', [EmployerController::class, 'send_all_post'])->name('send_all_post'); 622 Route::post('cabinet/send-all-messages/send', [EmployerController::class, 'send_all_post'])->name('send_all_post');
622 623
623 // 10 страница FAQ вопросы 624 // 10 страница FAQ вопросы
624 Route::get('cabinet/faq', [EmployerController::class, 'faq'])->name('faq'); 625 Route::get('cabinet/faq', [EmployerController::class, 'faq'])->name('faq');
625 626
626 // 11 страница - Настройка уведомлений 627 // 11 страница - Настройка уведомлений
627 Route::get('cabinet/subscribe', [EmployerController::class, 'subscribe'])->name('subscribe'); 628 Route::get('cabinet/subscribe', [EmployerController::class, 'subscribe'])->name('subscribe');
628 Route::get('cabinet/subscribe/save', [EmployerController::class, 'save_subscribe'])->name('save_subscribe'); 629 Route::get('cabinet/subscribe/save', [EmployerController::class, 'save_subscribe'])->name('save_subscribe');
629 630
630 // 12 страница - Сменить пароль 631 // 12 страница - Сменить пароль
631 Route::get('cabinet/password-reset', [EmployerController::class, 'password_reset'])->name('password_reset'); 632 Route::get('cabinet/password-reset', [EmployerController::class, 'password_reset'])->name('password_reset');
632 Route::get('cabinet/password-reset/new', [EmployerController::class, 'new_password'])->name('new_password'); 633 Route::get('cabinet/password-reset/new', [EmployerController::class, 'new_password'])->name('new_password');
633 634
634 // 13 страница - Удаление профиля 635 // 13 страница - Удаление профиля
635 Route::get('cabinet/delete-people', [EmployerController::class, 'delete_people'])->name('delete_people'); 636 Route::get('cabinet/delete-people', [EmployerController::class, 'delete_people'])->name('delete_people');
636 Route::get('cabinet/action-delete-people', [EmployerController::class, 'action_delete_user'])->name('action_delete_user'); 637 Route::get('cabinet/action-delete-people', [EmployerController::class, 'action_delete_user'])->name('action_delete_user');
637 Route::get('cabinet/action-ajax-delete-people', [EmployerController::class, 'ajax_delete_user'])->name('ajax_delete_user'); 638 Route::get('cabinet/action-ajax-delete-people', [EmployerController::class, 'ajax_delete_user'])->name('ajax_delete_user');
638 639
639 // Отправил сообщение 640 // Отправил сообщение
640 Route::post('сообщение/', [EmployerController::class, 'new_message'])->name('new_message'); 641 Route::post('сообщение/', [EmployerController::class, 'new_message'])->name('new_message');
641 }); 642 });
642 643
643 Route::get('TestWorker', [WorkerController::class, 'TestWorker'])->name('TestWorker'); 644 Route::get('TestWorker', [WorkerController::class, 'TestWorker'])->name('TestWorker');
644 645
645 646