Commit 15f704551e57f2b64fb9f790acbef6fd75f5cfa1

Authored by Hayk Nazaryan
1 parent 288dd2a041
Exists in master

employer personal cabinet new fixes

Showing 5 changed files with 33 additions and 17 deletions Inline Diff

app/Http/Controllers/EmployerController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers; 3 namespace App\Http\Controllers;
4 4
5 use App\Classes\RusDate; 5 use App\Classes\RusDate;
6 use App\Classes\Tools; 6 use App\Classes\Tools;
7 use App\Http\Requests\BaseUser_min_Request; 7 use App\Http\Requests\BaseUser_min_Request;
8 use App\Http\Requests\FlotRequest; 8 use App\Http\Requests\FlotRequest;
9 use App\Http\Requests\MessagesRequiest; 9 use App\Http\Requests\MessagesRequiest;
10 use App\Http\Requests\VacancyRequestEdit; 10 use App\Http\Requests\VacancyRequestEdit;
11 use App\Mail\MailCreateEmployer; 11 use App\Mail\MailCreateEmployer;
12 use App\Mail\MailSotrudnichestvo; 12 use App\Mail\MailSotrudnichestvo;
13 use App\Mail\MassSendingMessages; 13 use App\Mail\MassSendingMessages;
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_response; 16 use App\Models\ad_response;
17 use App\Models\Category; 17 use App\Models\Category;
18 use App\Models\Chat; 18 use App\Models\Chat;
19 use App\Models\Employer; 19 use App\Models\Employer;
20 use App\Models\EmployerAutoliftOption; 20 use App\Models\EmployerAutoliftOption;
21 use App\Models\Flot; 21 use App\Models\Flot;
22 use App\Models\Job_title; 22 use App\Models\Job_title;
23 use App\Models\Like_worker; 23 use App\Models\Like_worker;
24 use App\Models\Message; 24 use App\Models\Message;
25 use App\Models\Worker; 25 use App\Models\Worker;
26 use App\Models\MessagesRequests; 26 use App\Models\MessagesRequests;
27 use Carbon\Carbon; 27 use Carbon\Carbon;
28 use Illuminate\Auth\Events\Registered; 28 use Illuminate\Auth\Events\Registered;
29 use Illuminate\Database\Eloquent\Builder; 29 use Illuminate\Database\Eloquent\Builder;
30 use Illuminate\Http\RedirectResponse; 30 use Illuminate\Http\RedirectResponse;
31 use Illuminate\Http\Request; 31 use Illuminate\Http\Request;
32 use Illuminate\Support\Facades\Auth; 32 use Illuminate\Support\Facades\Auth;
33 use Illuminate\Support\Facades\Cache; 33 use Illuminate\Support\Facades\Cache;
34 use Illuminate\Support\Facades\Hash; 34 use Illuminate\Support\Facades\Hash;
35 use Illuminate\Support\Facades\Log; 35 use Illuminate\Support\Facades\Log;
36 use Illuminate\Support\Facades\Mail; 36 use Illuminate\Support\Facades\Mail;
37 use Illuminate\Support\Facades\Storage; 37 use Illuminate\Support\Facades\Storage;
38 use App\Models\User as User_Model; 38 use App\Models\User as User_Model;
39 use Illuminate\Support\Facades\Validator; 39 use Illuminate\Support\Facades\Validator;
40 use App\Enums\DbExportColumns; 40 use App\Enums\DbExportColumns;
41 use Illuminate\View\View; 41 use Illuminate\View\View;
42 use JsonException; 42 use JsonException;
43 use Throwable; 43 use Throwable;
44 44
45 class EmployerController extends Controller 45 class EmployerController extends Controller
46 { 46 {
47 public function vacancie($vacancy, Request $request) { 47 public function vacancie($vacancy, Request $request) {
48 $title = 'Заголовок вакансии'; 48 $title = 'Заголовок вакансии';
49 $Query = Ad_employer::with('jobs')-> 49 $Query = Ad_employer::with('jobs')->
50 with('cat')-> 50 with('cat')->
51 with('employer')-> 51 with('employer')->
52 with('jobs_code')-> 52 with('jobs_code')->
53 select('ad_employers.*')-> 53 select('ad_employers.*')->
54 where('id', '=', $vacancy)->get(); 54 where('id', '=', $vacancy)->get();
55 55
56 if ($Query[0]->active_is===0 || $Query[0]->is_remove!=0){ 56 if ($Query[0]->active_is===0 || $Query[0]->is_remove!=0){
57 57
58 abort(404); 58 abort(404);
59 59
60 } 60 }
61 61
62 if (isset(Auth()->user()->id)) 62 if (isset(Auth()->user()->id))
63 $uid = Auth()->user()->id; 63 $uid = Auth()->user()->id;
64 else 64 else
65 $uid = 0; 65 $uid = 0;
66 $title = $Query[0]->name; 66 $title = $Query[0]->name;
67 if ($request->ajax()) { 67 if ($request->ajax()) {
68 return view('ajax.vacance-item', compact('Query','uid')); 68 return view('ajax.vacance-item', compact('Query','uid'));
69 } else { 69 } else {
70 return view('vacance-item', compact('title', 'Query', 'uid')); 70 return view('vacance-item', compact('title', 'Query', 'uid'));
71 } 71 }
72 } 72 }
73 73
74 public function logout() { 74 public function logout() {
75 Auth::logout(); 75 Auth::logout();
76 return redirect()->route('index') 76 return redirect()->route('index')
77 ->with('success', 'Вы вышли из личного кабинета'); 77 ->with('success', 'Вы вышли из личного кабинета');
78 } 78 }
79 79
80 public function employer_info() { 80 public function employer_info() {
81 // код юзера 81 // код юзера
82 $user_info = Auth()->user(); 82 $user_info = Auth()->user();
83 // вьюшка для вывода данных 83 // вьюшка для вывода данных
84 return view('employers.info', compact('user_info')); 84 return view('employers.info', compact('user_info'));
85 } 85 }
86 86
87 public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { 87 public function employer_info_save(User_Model $user, BaseUser_min_Request $request) {
88 // Все данные через реквест 88 // Все данные через реквест
89 $all = $request->all(); 89 $all = $request->all();
90 unset($all['_token']); 90 unset($all['_token']);
91 // обновление 91 // обновление
92 $user->update($all); 92 $user->update($all);
93 return redirect()->route('employer.employer_info'); 93 return redirect()->route('employer.employer_info');
94 } 94 }
95 95
96 public function cabinet() { 96 public function cabinet() {
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.cabinet45', compact('Employer')); 102 return view('employers.cabinet45', compact('Employer'));
103 } 103 }
104 104
105 public function slider_flot() { 105 public function slider_flot() {
106 $id = Auth()->user()->id; 106 $id = Auth()->user()->id;
107 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 107 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
108 WhereHas('users', 108 WhereHas('users',
109 function (Builder $query) use ($id) {$query->Where('id', $id); 109 function (Builder $query) use ($id) {$query->Where('id', $id);
110 })->get(); 110 })->get();
111 return view('employers.fly-flot', compact('Employer')); 111 return view('employers.fly-flot', compact('Employer'));
112 } 112 }
113 113
114 public function cabinet_save(Employer $Employer, Request $request) { 114 public function cabinet_save(Employer $Employer, Request $request) {
115 $params = $request->all(); 115 $params = $request->all();
116 $params['user_id'] = Auth()->user()->id; 116 $params['user_id'] = Auth()->user()->id;
117 $id = $Employer->id; 117 $id = $Employer->id;
118 118
119 if ($request->has('logo')) { 119 if ($request->has('logo')) {
120 if (!empty($Employer->logo)) { 120 if (!empty($Employer->logo)) {
121 Storage::delete($Employer->logo); 121 Storage::delete($Employer->logo);
122 } 122 }
123 $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); 123 $params['logo'] = $request->file('logo')->store("employer/$id", 'public');
124 } 124 }
125 125
126 $Employer->update($params); 126 $Employer->update($params);
127 127
128 return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); 128 return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены');
129 } 129 }
130 130
131 public function save_add_flot(FlotRequest $request) { 131 public function save_add_flot(FlotRequest $request) {
132 // отмена 132 // отмена
133 $params = $request->all(); 133 $params = $request->all();
134 134
135 if ($request->has('image')) { 135 if ($request->has('image')) {
136 $params['image'] = $request->file('image')->store("flot", 'public'); 136 $params['image'] = $request->file('image')->store("flot", 'public');
137 } 137 }
138 Flot::create($params); 138 Flot::create($params);
139 $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); 139 $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get();
140 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); 140 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен');
141 } 141 }
142 142
143 public function edit_flot(Flot $Flot, Employer $Employer) { 143 public function edit_flot(Flot $Flot, Employer $Employer) {
144 return view('employers.edit-flot', compact('Flot', 'Employer')); 144 return view('employers.edit-flot', compact('Flot', 'Employer'));
145 } 145 }
146 146
147 public function update_flot(FlotRequest $request, Flot $Flot) { 147 public function update_flot(FlotRequest $request, Flot $Flot) {
148 $params = $request->all(); 148 $params = $request->all();
149 149
150 if ($request->has('image')) { 150 if ($request->has('image')) {
151 if (!empty($flot->image)) { 151 if (!empty($flot->image)) {
152 Storage::delete($flot->image); 152 Storage::delete($flot->image);
153 } 153 }
154 $params['image'] = $request->file('image')->store("flot", 'public'); 154 $params['image'] = $request->file('image')->store("flot", 'public');
155 } else { 155 } else {
156 if (!empty($flot->image)) $params['image'] = $flot->image; 156 if (!empty($flot->image)) $params['image'] = $flot->image;
157 } 157 }
158 158
159 $Flot->update($params); 159 $Flot->update($params);
160 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); 160 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен');
161 } 161 }
162 162
163 public function delete_flot(Flot $Flot) { 163 public function delete_flot(Flot $Flot) {
164 $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); 164 $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get();
165 165
166 if (isset($Flot->id)) $Flot->delete(); 166 if (isset($Flot->id)) $Flot->delete();
167 return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); 167 return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален');
168 } 168 }
169 169
170 // Форма добавления вакансий 170 // Форма добавления вакансий
171 public function cabinet_vacancie() { 171 public function cabinet_vacancie() {
172 /** @var User_Model $user */ 172 /** @var User_Model $user */
173 $user = Auth()->user(); 173 $user = Auth()->user();
174 174
175 if ($user->is_public) { 175 if ($user->is_public) {
176 $categories = Category::query()->active()->get(); 176 $categories = Category::query()->active()->get();
177 177
178 $jobs = Job_title::query() 178 $jobs = Job_title::query()
179 ->orderByDesc('sort') 179 ->orderByDesc('sort')
180 ->OrderBy('name') 180 ->OrderBy('name')
181 ->where('is_remove', '=', '0') 181 ->where('is_remove', '=', '0')
182 ->where('is_bd', '=', '0') 182 ->where('is_bd', '=', '0')
183 ->get(); 183 ->get();
184 184
185 $Employer = Employer::query() 185 $Employer = Employer::query()
186 ->with(['users', 'ads', 'flots']) 186 ->with(['users', 'ads', 'flots'])
187 ->whereHas('users', fn (Builder $query) => $query->where('id', $user->id)) 187 ->whereHas('users', fn (Builder $query) => $query->where('id', $user->id))
188 ->get(); 188 ->get();
189 189
190 return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); 190 return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories'));
191 } 191 }
192 192
193 return redirect()->route('employer.cabinet_vacancie_danger'); 193 return redirect()->route('employer.cabinet_vacancie_danger');
194 } 194 }
195 195
196 // Форма предупреждения об оплате 196 // Форма предупреждения об оплате
197 public function cabinet_vacancie_danger() { 197 public function cabinet_vacancie_danger() {
198 return view('employers.add_vacancy_danger'); 198 return view('employers.add_vacancy_danger');
199 } 199 }
200 200
201 // Сохранение вакансии 201 // Сохранение вакансии
202 public function cabinet_vacancy_save1(VacancyRequestEdit $request) { 202 public function cabinet_vacancy_save1(VacancyRequestEdit $request) {
203 $params_emp = $request->all(); 203 $params_emp = $request->all();
204 204
205 $params_job["job_title_id"] = $params_emp['job_title_id']; 205 $params_job["job_title_id"] = $params_emp['job_title_id'];
206 206
207 $ad_jobs = Ad_employer::create($params_emp); 207 $ad_jobs = Ad_employer::create($params_emp);
208 $ad_jobs->jobs()->sync($request->get('job_title_id')); 208 $ad_jobs->jobs()->sync($request->get('job_title_id'));
209 209
210 return redirect()->route('employer.vacancy_list')->with('success', 'Вакансия успешно опубликована'); 210 return redirect()->route('employer.vacancy_list')->with('success', 'Вакансия успешно опубликована');
211 } 211 }
212 212
213 // Список вакансий 213 // Список вакансий
214 public function vacancy_list(Request $request) { 214 public function vacancy_list(Request $request) {
215 $id = Auth()->user()->id; 215 $id = Auth()->user()->id;
216 216
217 $Employer = Employer::query()->where('user_id', $id)->first(); 217 $Employer = Employer::query()->where('user_id', $id)->first();
218 $vacancy_list = Ad_employer::query() 218 $vacancy_list = Ad_employer::query()
219 ->with('jobs') 219 ->with('jobs')
220 ->with('jobs_code') 220 ->with('jobs_code')
221 ->where('employer_id', $Employer->id) 221 ->where('employer_id', $Employer->id)
222 ->where('is_remove', 0) 222 ->where('is_remove', 0)
223 ->orderbyDesc('updated_at') 223 ->orderbyDesc('updated_at')
224 ; 224 ;
225 225
226 if (($request->has('search')) && (!empty($request->get('search')))) { 226 if (($request->has('search')) && (!empty($request->get('search')))) {
227 $search = $request->get('search'); 227 $search = $request->get('search');
228 $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); 228 $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%");
229 } 229 }
230 230
231 if ($request->get('sort')) { 231 if ($request->get('sort')) {
232 $sort = $request->get('sort'); 232 $sort = $request->get('sort');
233 switch ($sort) { 233 switch ($sort) {
234 case 'nopublic': $vacancy_list->orderByDesc('updated_at') 234 case 'nopublic': $vacancy_list->orderByDesc('updated_at')
235 ->where('active_is', 0); 235 ->where('active_is', 0);
236 break; 236 break;
237 case 'public': $vacancy_list->orderByDesc('updated_at') 237 case 'public': $vacancy_list->orderByDesc('updated_at')
238 ->where('active_is',1); 238 ->where('active_is',1);
239 break; 239 break;
240 default: $vacancy_list->orderByDesc('updated_at'); 240 default: $vacancy_list->orderByDesc('updated_at');
241 break; 241 break;
242 } 242 }
243 } else { 243 } else {
244 $vacancy_list = $vacancy_list->orderByDesc('updated_at')->orderBy('id'); 244 $vacancy_list = $vacancy_list->orderByDesc('updated_at')->orderBy('id');
245 } 245 }
246 246
247 $vacancy_list = $vacancy_list->paginate(10); 247 $vacancy_list = $vacancy_list->paginate(10);
248 248
249 if ($request->ajax()) { 249 if ($request->ajax()) {
250 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); 250 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer'));
251 } else { 251 } else {
252 return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); 252 return view('employers.list_vacancy', compact('vacancy_list', 'Employer'));
253 } 253 }
254 } 254 }
255 255
256 // Карточка вакансии 256 // Карточка вакансии
257 public function vacancy_edit(Ad_employer $ad_employer) { 257 public function vacancy_edit(Ad_employer $ad_employer) {
258 $id = Auth()->user()->id; 258 $id = Auth()->user()->id;
259 $Positions = Category::query()->where('is_remove', '=', '0')->get(); 259 $Positions = Category::query()->where('is_remove', '=', '0')->get();
260 260
261 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> 261 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')->
262 where('is_remove', '=', '0')-> 262 where('is_remove', '=', '0')->
263 where('is_bd', '=', '0')->get(); 263 where('is_bd', '=', '0')->get();
264 264
265 $Employer = Employer::query()->with('users')->with('ads')-> 265 $Employer = Employer::query()->with('users')->with('ads')->
266 with('flots')->where('user_id', $id)->first(); 266 with('flots')->where('user_id', $id)->first();
267 267
268 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); 268 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs'));
269 } 269 }
270 270
271 // Сохранение-редактирование записи 271 // Сохранение-редактирование записи
272 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { 272 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) {
273 $params = $request->all(); 273 $params = $request->all();
274 274
275 $ad_employer->update($params); 275 $ad_employer->update($params);
276 $ad_employer->active_is = 1; 276 $ad_employer->active_is = 1;
277 $ad_employer->save(); 277 $ad_employer->save();
278 $ad_employer->jobs()->sync($request->get('job_title_id')); 278 $ad_employer->jobs()->sync($request->get('job_title_id'));
279 279
280 $id = Auth()->user()->id; 280 $id = Auth()->user()->id;
281 $Positions = Category::query()->where('is_remove', '=', '0')->get(); 281 $Positions = Category::query()->where('is_remove', '=', '0')->get();
282 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name') 282 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')
283 ->where('is_remove', '=', '0') 283 ->where('is_remove', '=', '0')
284 ->where('is_bd', '=', '0') 284 ->where('is_bd', '=', '0')
285 ->get(); 285 ->get();
286 286
287 $Employer = Employer::query() 287 $Employer = Employer::query()
288 ->with('users')->with('ads')->with('flots')->where('user_id', $id)->first(); 288 ->with('users')->with('ads')->with('flots')->where('user_id', $id)->first();
289 289
290 return redirect()->route('employer.vacancy_list')->with('success', 'Вакансия успешно отредактирована'); 290 return redirect()->route('employer.vacancy_list')->with('success', 'Вакансия успешно отредактирована');
291 } 291 }
292 292
293 // Сохранение карточки вакансии 293 // Сохранение карточки вакансии
294 public function vacancy_save(Request $request, Ad_employer $ad_employer) { 294 public function vacancy_save(Request $request, Ad_employer $ad_employer) {
295 $all = $request->all(); 295 $all = $request->all();
296 $ad_employer->update($all); 296 $ad_employer->update($all);
297 return redirect()->route('employer.cabinet_vacancie'); 297 return redirect()->route('employer.cabinet_vacancie');
298 } 298 }
299 299
300 // Удаление карточки вакансии 300 // Удаление карточки вакансии
301 public function vacancy_delete(Ad_employer $ad_employer) { 301 public function vacancy_delete(Ad_employer $ad_employer) {
302 $ad_employer->delete(); 302 $ad_employer->delete();
303 303
304 return redirect()->route('employer.vacancy_list') 304 return redirect()->route('employer.vacancy_list')
305 ->with('success', 'Вакансия удалена'); 305 ->with('success', 'Вакансия удалена');
306 } 306 }
307 307
308 // Обновление даты 308 // Обновление даты
309 public function vacancy_up(Ad_employer $ad_employer) { 309 public function vacancy_up(Ad_employer $ad_employer) {
310 $up = date('m/d/Y h:i:s', time()); 310 $up = date('m/d/Y h:i:s', time());
311 $ad_employer->updated_at = $up; 311 $ad_employer->updated_at = $up;
312 $ad_employer->save(); 312 $ad_employer->save();
313 313
314 return redirect()->route('employer.vacancy_list') 314 return redirect()->route('employer.vacancy_list')
315 ->with('success', 'Вакансия поднята'); 315 ->with('success', 'Вакансия поднята');
316 } 316 }
317 317
318 //Видимость вакансии 318 //Видимость вакансии
319 public function vacancy_eye(Ad_employer $ad_employer, $status) { 319 public function vacancy_eye(Ad_employer $ad_employer, $status) {
320 $statusMessages = [ 320 $statusMessages = [
321 'Вакансия скрыта', 321 'Вакансия скрыта',
322 'Вакансия видна работникам' 322 'Вакансия видна работникам'
323 ]; 323 ];
324 324
325 $vac_emp = Ad_employer::findOrFail($ad_employer->id); 325 $vac_emp = Ad_employer::findOrFail($ad_employer->id);
326 $vac_emp->active_is = $status; 326 $vac_emp->active_is = $status;
327 $vac_emp->save(); 327 $vac_emp->save();
328 328
329 return redirect()->route('employer.vacancy_list') 329 return redirect()->route('employer.vacancy_list')
330 ->with('success', $statusMessages[$status]); 330 ->with('success', $statusMessages[$status]);
331 } 331 }
332 332
333 //Вакансия редактирования (шаблон) 333 //Вакансия редактирования (шаблон)
334 public function vacancy_update(Ad_employer $id) { 334 public function vacancy_update(Ad_employer $id) {
335 335
336 } 336 }
337 337
338 //Отклики на вакансию - лист 338 //Отклики на вакансию - лист
339 public function answers(Employer $employer, Request $request) { 339 public function answers(Employer $employer, Request $request) {
340 $user_id = Auth()->user()->id; 340 $user_id = Auth()->user()->id;
341 $answer = Ad_employer::query()->where('employer_id', $employer->id); 341 $answer = Ad_employer::query()->where('employer_id', $employer->id);
342 if ($request->has('search')) { 342 if ($request->has('search')) {
343 $search = trim($request->get('search')); 343 $search = trim($request->get('search'));
344 if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); 344 if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%");
345 } 345 }
346 346
347 $answer = $answer->with('response')->OrderByDESC('id')->get(); 347 $answer = $answer->with('response')->OrderByDESC('id')->get();
348 348
349 return view('employers.list_answer', compact('answer', 'user_id', 'employer')); 349 return view('employers.list_answer', compact('answer', 'user_id', 'employer'));
350 } 350 }
351 351
352 //Обновление статуса 352 //Обновление статуса
353 public function supple_status(employer $employer, ad_response $ad_response, $flag) { 353 public function supple_status(employer $employer, ad_response $ad_response, $flag) {
354 $ad_response->update(Array('flag' => $flag)); 354 $ad_response->update(Array('flag' => $flag));
355 return redirect()->route('employer.answers', ['employer' => $employer->id]); 355 return redirect()->route('employer.answers', ['employer' => $employer->id]);
356 } 356 }
357 357
358 //Страницы сообщений список 358 //Страницы сообщений список
359 public function messages($type_message) { 359 public function messages($type_message) {
360 $user_id = Auth()->user()->id; 360 $user_id = Auth()->user()->id;
361 $superAdmin =User_Model::superAdmin(); 361 $superAdmin =User_Model::superAdmin();
362 $chats = Chat::get_user_chats($user_id); 362 $chats = Chat::get_user_chats($user_id);
363 $admin_chat = Chat::get_user_admin_chat($user_id); 363 $admin_chat = Chat::get_user_admin_chat($user_id);
364 $user_type = 'employer'; 364 $user_type = 'employer';
365 365
366 return view('employers.messages', compact('chats', 'admin_chat', 'user_id', 'user_type','superAdmin')); 366 return view('employers.messages', compact('chats', 'admin_chat', 'user_id', 'user_type','superAdmin'));
367 } 367 }
368 368
369 // Диалог между пользователями 369 // Диалог между пользователями
370 public function dialog(Chat $chat, Request $request) { 370 public function dialog(Chat $chat, Request $request) {
371 // Получение параметров. 371 // Получение параметров.
372 if ($request->has('ad_employer')){ 372 if ($request->has('ad_employer')){
373 $ad_employer = $request->get('ad_employer'); 373 $ad_employer = $request->get('ad_employer');
374 } else { 374 } else {
375 $ad_employer = 0; 375 $ad_employer = 0;
376 } 376 }
377 $superAdmin =User_Model::superAdmin(); 377 $superAdmin =User_Model::superAdmin();
378 378
379 $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first(); 379 $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first();
380 $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first(); 380 $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first();
381 381
382 $Messages = Chat::get_chat_messages($chat); 382 $Messages = Chat::get_chat_messages($chat);
383 383
384 Message::where('user_id', '=', $chat->to_user_id)->where('to_user_id', '=', $chat->user_id)->update(['flag_new' => 0]); 384 Message::where('user_id', '=', $chat->to_user_id)->where('to_user_id', '=', $chat->user_id)->update(['flag_new' => 0]);
385 385
386 return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages','chat','superAdmin')); 386 return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages','chat','superAdmin'));
387 } 387 }
388 388
389 public function pin_chat(Request $request){ 389 public function pin_chat(Request $request){
390 $chat_id = $request->get('id'); 390 $chat_id = $request->get('id');
391 $is_fixed = $request->get('is_fixed'); 391 $is_fixed = $request->get('is_fixed');
392 392
393 $new_state = Chat::pin_chat($chat_id, $is_fixed); 393 $chat = Chat::pin_chat($chat_id, $is_fixed);
394 394 $message = $chat->is_fixed ? 'Сообщение закреплено' : 'Сообщение откреплено';
395 if ($new_state !== null) { 395 return redirect()->back()->with('success', $message);
396 $message = $new_state ? 'Сообщение закреплено' : 'Сообщение откреплено';
397 return redirect()->back()->with('success', $message);
398 }
399
400 return redirect()->back()->withErrors(['message' => 'Ошибка: сообщение не удалось обновить.']);
401 } 396 }
402 397
403 public function remove_chat(Request $request){ 398 public function remove_chat(Request $request){
404 $chat_id = $request->get('id'); 399 $chat_id = $request->get('id');
405 Chat::remove_chat($chat_id); 400 Chat::remove_chat($chat_id);
406 } 401 }
407 402
408 // Регистрация работодателя 403 // Регистрация работодателя
409 public function register_employer(Request $request) { 404 public function register_employer(Request $request) {
410 $params = $request->all(); 405 $params = $request->all();
411 406
412 $rules = [ 407 $rules = [
413 //'surname' => ['required', 'string', 'max:255'], 408 //'surname' => ['required', 'string', 'max:255'],
414 //'name_man' => ['required', 'string', 'max:255'], 409 //'name_man' => ['required', 'string', 'max:255'],
415 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 410 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
416 'name_company' => ['required', 'string', 'max:255'], 411 'name_company' => ['required', 'string', 'max:255'],
417 'password' => ['required', 'string', 'min:6'], 412 'password' => ['required', 'string', 'min:6'],
418 ]; 413 ];
419 414
420 $messages = [ 415 $messages = [
421 'required' => 'Укажите обязательное поле', 416 'required' => 'Укажите обязательное поле',
422 'min' => [ 417 'min' => [
423 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 418 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
424 'integer' => 'Поле «:attribute» должно быть :min или больше', 419 'integer' => 'Поле «:attribute» должно быть :min или больше',
425 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 420 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
426 ], 421 ],
427 'max' => [ 422 'max' => [
428 'string' => 'Поле «:attribute» должно быть не больше :max символов', 423 'string' => 'Поле «:attribute» должно быть не больше :max символов',
429 'integer' => 'Поле «:attribute» должно быть :max или меньше', 424 'integer' => 'Поле «:attribute» должно быть :max или меньше',
430 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 425 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
431 ] 426 ]
432 ]; 427 ];
433 428
434 $email = $request->get('email'); 429 $email = $request->get('email');
435 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { 430 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) {
436 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); 431 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл"));
437 } 432 }
438 433
439 if ($request->get('password') !== $request->get('confirmed')){ 434 if ($request->get('password') !== $request->get('confirmed')){
440 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); 435 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля"));
441 } 436 }
442 437
443 if (strlen($request->get('password')) < 6) { 438 if (strlen($request->get('password')) < 6) {
444 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); 439 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!"));
445 } 440 }
446 441
447 if (empty($request->get('surname'))) { 442 if (empty($request->get('surname'))) {
448 $params['surname'] = 'Неизвестно'; 443 $params['surname'] = 'Неизвестно';
449 } 444 }
450 if (empty($request->get('name_man'))) { 445 if (empty($request->get('name_man'))) {
451 $params['name_man'] = 'Неизвестно'; 446 $params['name_man'] = 'Неизвестно';
452 } 447 }
453 $validator = Validator::make($params, $rules, $messages); 448 $validator = Validator::make($params, $rules, $messages);
454 449
455 if ($validator->fails()) { 450 if ($validator->fails()) {
456 return json_encode(Array("ERROR" => "Error: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); 451 return json_encode(Array("ERROR" => "Error: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе."));
457 } else { 452 } else {
458 $user = $this->create($params); 453 $user = $this->create($params);
459 event(new Registered($user)); 454 event(new Registered($user));
460 455
461 try { 456 try {
462 Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params)); 457 Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params));
463 } catch (Throwable $e) { 458 } catch (Throwable $e) {
464 Log::error($e); 459 Log::error($e);
465 } 460 }
466 461
467 Auth::guard()->login($user); 462 Auth::guard()->login($user);
468 } 463 }
469 464
470 if ($user) { 465 if ($user) {
471 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; 466 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));;
472 } else { 467 } else {
473 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); 468 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!"));
474 } 469 }
475 } 470 }
476 471
477 // Создание пользователя 472 // Создание пользователя
478 protected function create(array $data) 473 protected function create(array $data)
479 { 474 {
480 $Use = new User_Model(); 475 $Use = new User_Model();
481 $Code_user = $Use->create([ 476 $Code_user = $Use->create([
482 'name' => $data['surname']." ".$data['name_man'], 477 'name' => $data['surname']." ".$data['name_man'],
483 'name_man' => $data['name_man'], 478 'name_man' => $data['name_man'],
484 'surname' => $data['surname'], 479 'surname' => $data['surname'],
485 'surname2' => $data['surname2'], 480 'surname2' => $data['surname2'],
486 'subscribe_email' => $data['email'], 481 'subscribe_email' => $data['email'],
487 'email' => $data['email'], 482 'email' => $data['email'],
488 'telephone' => $data['telephone'], 483 'telephone' => $data['telephone'],
489 'is_worker' => 0, 484 'is_worker' => 0,
490 'password' => Hash::make($data['password']), 485 'password' => Hash::make($data['password']),
491 'pubpassword' => base64_encode($data['password']), 486 'pubpassword' => base64_encode($data['password']),
492 'email_verified_at' => Carbon::now() 487 'email_verified_at' => Carbon::now()
493 ]); 488 ]);
494 489
495 if ($Code_user->id > 0) { 490 if ($Code_user->id > 0) {
496 $Employer = new Employer(); 491 $Employer = new Employer();
497 $Employer->user_id = $Code_user->id; 492 $Employer->user_id = $Code_user->id;
498 $Employer->name_company = $data['name_company']; 493 $Employer->name_company = $data['name_company'];
499 $Employer->email = $data['email']; 494 $Employer->email = $data['email'];
500 $Employer->telephone = $data['telephone']; 495 $Employer->telephone = $data['telephone'];
501 $Employer->code = Tools::generator_id(10); 496 $Employer->code = Tools::generator_id(10);
502 $Employer->save(); 497 $Employer->save();
503 498
504 return $Code_user; 499 return $Code_user;
505 } 500 }
506 } 501 }
507 502
508 // Отправка сообщения от работодателя 503 // Отправка сообщения от работодателя
509 public function send_message(MessagesRequiest $request) { 504 public function send_message(MessagesRequiest $request) {
510 $params = $request->all(); 505 $params = $request->all();
511 506
512 $user1 = $params['user_id']; 507 $user1 = $params['user_id'];
513 $user2 = $params['to_user_id']; 508 $user2 = $params['to_user_id'];
514 509
515 if ($request->has('file')) { 510 if ($request->has('file')) {
516 $params['file'] = $request->file('file')->store("messages", 'public'); 511 $params['file'] = $request->file('file')->store("messages", 'public');
517 } 512 }
518 Message::create($params); 513 Message::create($params);
519 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); 514 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
520 } 515 }
521 516
522 public function test123(Request $request) { 517 public function test123(Request $request) {
523 $params = $request->all(); 518 $params = $request->all();
524 $user1 = $params['user_id']; 519 $user1 = $params['user_id'];
525 $user2 = $params['to_user_id']; 520 $user2 = $params['to_user_id'];
526 521
527 $rules = [ 522 $rules = [
528 'text' => 'nullable|required_without:file|min:1|max:150000', 523 'text' => 'nullable|required_without:file|min:1|max:150000',
529 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' 524 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000'
530 ]; 525 ];
531 $messages = [ 526 $messages = [
532 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', 527 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен',
533 'min' => [ 528 'min' => [
534 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 529 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
535 'integer' => 'Поле «:attribute» должно быть :min или больше', 530 'integer' => 'Поле «:attribute» должно быть :min или больше',
536 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 531 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
537 ], 532 ],
538 'max' => [ 533 'max' => [
539 'string' => 'Поле «:attribute» должно быть не больше :max символов', 534 'string' => 'Поле «:attribute» должно быть не больше :max символов',
540 'integer' => 'Поле «:attribute» должно быть :max или меньше', 535 'integer' => 'Поле «:attribute» должно быть :max или меньше',
541 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 536 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
542 ] 537 ]
543 ]; 538 ];
544 539
545 $validator = Validator::make($request->all(), $rules, $messages); 540 $validator = Validator::make($request->all(), $rules, $messages);
546 541
547 if ($validator->fails()) { 542 if ($validator->fails()) {
548 return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); 543 return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator);
549 } 544 }
550 545
551 $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); 546 $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages');
552 return redirect()->route('employer.dialog', ['chat' => $new_message->chat_id_from]); 547 return redirect()->route('employer.dialog', ['chat' => $new_message->chat_id_from]);
553 548
554 } 549 }
555 550
556 //Избранные люди 551 //Избранные люди
557 public function favorites(Request $request) 552 public function favorites(Request $request)
558 { 553 {
559 $likedWorkersIds = Like_worker::query() 554 $likedWorkersIds = Like_worker::query()
560 ->where('user_id', Auth::user()->id) 555 ->where('user_id', Auth::user()->id)
561 ->get() 556 ->get()
562 ->pluck('code_record') 557 ->pluck('code_record')
563 ->toArray(); 558 ->toArray();
564 559
565 $workerBuilder = Worker::query() 560 $workerBuilder = Worker::query()
566 ->whereIn('id', $likedWorkersIds); 561 ->whereIn('id', $likedWorkersIds);
567 562
568 if (($request->has('search')) && (!empty($request->get('search')))) { 563 if (($request->has('search')) && (!empty($request->get('search')))) {
569 $search = $request->get('search'); 564 $search = $request->get('search');
570 565
571 $workerBuilder->whereHas('users', function (Builder $query) use ($search) { 566 $workerBuilder->whereHas('users', function (Builder $query) use ($search) {
572 $query->where('surname', 'LIKE', "%$search%") 567 $query->where('surname', 'LIKE', "%$search%")
573 ->orWhere('name_man', 'LIKE', "%$search%") 568 ->orWhere('name_man', 'LIKE', "%$search%")
574 ->orWhere('surname2', 'LIKE', "%$search%"); 569 ->orWhere('surname2', 'LIKE', "%$search%");
575 }); 570 });
576 } 571 }
577 572
578 $Workers = $workerBuilder->get(); 573 $Workers = $workerBuilder->get();
579 574
580 return view('employers.favorite', compact('Workers')); 575 return view('employers.favorite', compact('Workers'));
581 } 576 }
582 577
583 // База данных 578 // База данных
584 public function bd(Request $request) { 579 public function bd(Request $request) {
585 if (!Auth::user()->show_database) { 580 if (!Auth::user()->show_database) {
586 return redirect()->route('employer.employer_info'); 581 return redirect()->route('employer.employer_info');
587 } 582 }
588 583
589 $users = User_Model::query()->with('workers')->with('jobtitles'); 584 $users = User_Model::query()->with('workers')->with('jobtitles');
590 585
591 if ($request->has('search')) { 586 if ($request->has('search')) {
592 $find_key = $request->get('search'); 587 $find_key = $request->get('search');
593 $users = $users->where('name', 'LIKE', "%$find_key%") 588 $users = $users->where('name', 'LIKE', "%$find_key%")
594 ->orWhere('surname', 'LIKE', "%$find_key%") 589 ->orWhere('surname', 'LIKE', "%$find_key%")
595 ->orWhere('name_man', 'LIKE', "%$find_key%") 590 ->orWhere('name_man', 'LIKE', "%$find_key%")
596 ->orWhere('email', 'LIKE', "%$find_key%") 591 ->orWhere('email', 'LIKE', "%$find_key%")
597 ->orWhere('telephone', 'LIKE', "%$find_key%"); 592 ->orWhere('telephone', 'LIKE', "%$find_key%");
598 } 593 }
599 $count_users = $users->count(); 594 $count_users = $users->count();
600 595
601 // Данные 596 // Данные
602 $users = $users 597 $users = $users
603 ->Baseuser() 598 ->Baseuser()
604 ->orderByDesc('created_at') 599 ->orderByDesc('created_at')
605 ->paginate(10); 600 ->paginate(10);
606 601
607 $export_options = DbExportColumns::toArray(); 602 $export_options = DbExportColumns::toArray();
608 603
609 $jobs_titles = Job_title::select('id', 'name') 604 $jobs_titles = Job_title::select('id', 'name')
610 ->where('is_remove', '=', 0) 605 ->where('is_remove', '=', 0)
611 ->where('is_bd', '=', 2) 606 ->where('is_bd', '=', 2)
612 ->orderByDesc('sort') 607 ->orderByDesc('sort')
613 ->orderBy('name', 'asc') 608 ->orderBy('name', 'asc')
614 ->get() 609 ->get()
615 ->toArray() 610 ->toArray()
616 ; 611 ;
617 612
618 return view('employers.bd', compact('users', 'count_users', 'export_options', 'jobs_titles')); 613 return view('employers.bd', compact('users', 'count_users', 'export_options', 'jobs_titles'));
619 } 614 }
620 615
621 //Настройка уведомлений 616 //Настройка уведомлений
622 public function subscribe() { 617 public function subscribe() {
623 618
624 $user=Auth::user(); 619 $user=Auth::user();
625 620
626 return view('employers.subcribe',compact('user')); 621 return view('employers.subcribe',compact('user'));
627 } 622 }
628 623
629 //Установка уведомлений сохранение 624 //Установка уведомлений сохранение
630 public function save_subscribe(Request $request) { 625 public function save_subscribe(Request $request) {
631 626
632 $msg = $request->validate([ 627 $msg = $request->validate([
633 'email' => 'required|email|min:5|max:255', 628 'email' => 'required|email|min:5|max:255',
634 ]); 629 ]);
635 $user= Auth::user(); 630 $user= Auth::user();
636 631
637 User_Model::updateOrCreate( 632 User_Model::updateOrCreate(
638 ['id' => $user->id], 633 ['id' => $user->id],
639 ['subscribe_email' => $request->email, 634 ['subscribe_email' => $request->email,
640 'subscribe' => request()->has('email_msg') && request('email_msg') === 'on' ? 1 : 0 635 'subscribe' => request()->has('email_msg') && request('email_msg') === 'on' ? 1 : 0
641 ] 636 ]
642 ); 637 );
643 return redirect()->route('employer.subscribe')->with('success', 'Ваши изменения успешно сохранены'); 638 return redirect()->route('employer.subscribe')->with('success', 'Ваши изменения успешно сохранены');
644 } 639 }
645 //Сбросить форму с паролем 640 //Сбросить форму с паролем
646 public function password_reset() { 641 public function password_reset() {
647 $email = Auth()->user()->email; 642 $email = Auth()->user()->email;
648 return view('employers.password-reset', compact('email')); 643 return view('employers.password-reset', compact('email'));
649 } 644 }
650 645
651 //Обновление пароля 646 //Обновление пароля
652 public function new_password(Request $request) { 647 public function new_password(Request $request) {
653 $use = Auth()->user(); 648 $use = Auth()->user();
654 $request->validate([ 649 $request->validate([
655 'password' => 'required|string', 650 'password' => 'required|string',
656 'new_password' => 'required|string', 651 'new_password' => 'required|string',
657 'new_password2' => 'required|string' 652 'new_password2' => 'required|string'
658 ]); 653 ]);
659 654
660 if ($request->get('new_password') == $request->get('new_password2')) 655 if ($request->get('new_password') == $request->get('new_password2'))
661 if ($request->get('password') !== $request->get('new_password')) { 656 if ($request->get('password') !== $request->get('new_password')) {
662 $credentials = $request->only('email', 'password'); 657 $credentials = $request->only('email', 'password');
663 if (Auth::attempt($credentials)) { 658 if (Auth::attempt($credentials)) {
664 659
665 if (!is_null($use->email_verified_at)){ 660 if (!is_null($use->email_verified_at)){
666 661
667 $user_data = User_Model::find($use->id); 662 $user_data = User_Model::find($use->id);
668 $user_data->update([ 663 $user_data->update([
669 'password' => Hash::make($request->get('new_password')), 664 'password' => Hash::make($request->get('new_password')),
670 'pubpassword' => base64_encode($request->get('new_password')), 665 'pubpassword' => base64_encode($request->get('new_password')),
671 ]); 666 ]);
672 return redirect() 667 return redirect()
673 ->route('employer.password_reset') 668 ->route('employer.password_reset')
674 ->with('success', 'Поздравляю! Вы обновили свой пароль!'); 669 ->with('success', 'Поздравляю! Вы обновили свой пароль!');
675 } 670 }
676 671
677 return redirect() 672 return redirect()
678 ->route('employer.password_reset') 673 ->route('employer.password_reset')
679 ->withError('Данная учетная запись не было верифицированна!'); 674 ->withError('Данная учетная запись не было верифицированна!');
680 } 675 }
681 } 676 }
682 677
683 return redirect() 678 return redirect()
684 ->route('employer.password_reset') 679 ->route('employer.password_reset')
685 ->withErrors('Не совпадение данных, обновите пароли!'); 680 ->withErrors('Не совпадение данных, обновите пароли!');
686 } 681 }
687 682
688 683
689 684
690 // Форма Удаление пипла 685 // Форма Удаление пипла
691 public function delete_people() { 686 public function delete_people() {
692 $login = Auth()->user()->email; 687 $login = Auth()->user()->email;
693 return view('employers.delete_people', compact('login')); 688 return view('employers.delete_people', compact('login'));
694 } 689 }
695 690
696 // Удаление аккаунта 691 // Удаление аккаунта
697 public function action_delete_user(Request $request) { 692 public function action_delete_user(Request $request) {
698 $Answer = $request->all(); 693 $Answer = $request->all();
699 $user_id = Auth()->user()->id; 694 $user_id = Auth()->user()->id;
700 $request->validate([ 695 $request->validate([
701 'password' => 'required|string', 696 'password' => 'required|string',
702 ]); 697 ]);
703 698
704 $credentials = $request->only('email', 'password'); 699 $credentials = $request->only('email', 'password');
705 if (Auth::attempt($credentials)) { 700 if (Auth::attempt($credentials)) {
706 Auth::logout(); 701 Auth::logout();
707 $it = User_Model::find($user_id); 702 $it = User_Model::find($user_id);
708 $it->delete(); 703 $it->delete();
709 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); 704 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт');
710 } else { 705 } else {
711 return redirect()->route('employer.delete_people') 706 return redirect()->route('employer.delete_people')
712 ->withErrors( 'Неверный пароль! Нужен корректный пароль'); 707 ->withErrors( 'Неверный пароль! Нужен корректный пароль');
713 } 708 }
714 } 709 }
715 710
716 public function ajax_delete_user(Request $request) { 711 public function ajax_delete_user(Request $request) {
717 $Answer = $request->all(); 712 $Answer = $request->all();
718 $user_id = Auth()->user()->id; 713 $user_id = Auth()->user()->id;
719 $request->validate([ 714 $request->validate([
720 'password' => 'required|string', 715 'password' => 'required|string',
721 ]); 716 ]);
722 $credentials = $request->only('email', 'password'); 717 $credentials = $request->only('email', 'password');
723 if (Auth::attempt($credentials)) { 718 if (Auth::attempt($credentials)) {
724 719
725 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', 720 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт',
726 'email' => $request->get('email'), 721 'email' => $request->get('email'),
727 'password' => $request->get('password'))); 722 'password' => $request->get('password')));
728 } else { 723 } else {
729 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); 724 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль'));
730 } 725 }
731 } 726 }
732 727
733 // Рассылка сообщений 728 // Рассылка сообщений
734 public function send_all_messages() { 729 public function send_all_messages() {
735 $id = Auth()->user()->id; 730 $id = Auth()->user()->id;
736 $sending = Employer::query()->where('user_id', '=', "$id")->first(); 731 $sending = Employer::query()->where('user_id', '=', "$id")->first();
737 732
738 $job_titles = Job_title::query() 733 $job_titles = Job_title::query()
739 ->where('is_remove', '=', 0) 734 ->where('is_remove', '=', 0)
740 ->where('is_bd', '=', 1) 735 ->where('is_bd', '=', 1)
741 ->orderByDesc('sort') 736 ->orderByDesc('sort')
742 ->get(); 737 ->get();
743 738
744 if ($sending->sending_is) 739 if ($sending->sending_is)
745 return view('employers.send_all', compact('job_titles')); 740 return view('employers.send_all', compact('job_titles'));
746 else 741 else
747 return view('employers.send_all_danger'); 742 return view('employers.send_all_danger');
748 } 743 }
749 744
750 // Отправка сообщений для информации 745 // Отправка сообщений для информации
751 public function send_all_post(Request $request) { 746 public function send_all_post(Request $request) {
752 $data = $request->all(); 747 $data = $request->all();
753 $data['user'] = Auth()->user(); 748 $data['user'] = Auth()->user();
754 749
755 $id = MessagesRequests::create([ 750 $id = MessagesRequests::create([
756 'user_id' => $data['user']->id, 751 'user_id' => $data['user']->id,
757 'job_titles' => isset($data['job_title_ids']) ? json_encode($data['job_title_ids']) : null, 752 'job_titles' => isset($data['job_title_ids']) ? json_encode($data['job_title_ids']) : null,
758 'text' => $data['message_text'], 753 'text' => $data['message_text'],
759 ]); 754 ]);
760 755
761 try { 756 try {
762 if (!empty($id)) { 757 if (!empty($id)) {
763 Mail::to(env('EMAIL_ADMIN'))->send(new MassSendingMessages($data)); 758 Mail::to(env('EMAIL_ADMIN'))->send(new MassSendingMessages($data));
764 } 759 }
765 } catch (Throwable $e) { 760 } catch (Throwable $e) {
766 Log::error($e); 761 Log::error($e);
767 return redirect()->route('employer.send_all_messages')->with('error', 'Ошибка почтового сервера, пожалуйста, повторите рассылку позднее'); 762 return redirect()->route('employer.send_all_messages')->with('error', 'Ошибка почтового сервера, пожалуйста, повторите рассылку позднее');
768 } 763 }
769 764
770 return redirect()->route('employer.send_all_messages')->with('success', 'Запрос на рассылку был успешно отправлен.'); 765 return redirect()->route('employer.send_all_messages')->with('success', 'Запрос на рассылку был успешно отправлен.');
771 } 766 }
772 767
773 // База резюме 768 // База резюме
774 public function bd_tupe(Request $request) { 769 public function bd_tupe(Request $request) {
775 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); 770 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get();
776 771
777 return view('employers.bd_tupe', compact('Resume')); 772 return view('employers.bd_tupe', compact('Resume'));
778 } 773 }
779 774
780 ////////////////////////////////////////////////////////////////// 775 //////////////////////////////////////////////////////////////////
781 // Отправил сообщение 776 // Отправил сообщение
782 ////////////////////////////////////////////////////////////////// 777 //////////////////////////////////////////////////////////////////
783 public function new_message(Request $request) 778 public function new_message(Request $request)
784 { 779 {
785 $params = $request->all(); 780 $params = $request->all();
786 781
787 $id = $params['_user_id']; 782 $id = $params['_user_id'];
788 $message_params = [ 783 $message_params = [
789 'title' => $params['title'], 784 'title' => $params['title'],
790 'text' => $params['text'], 785 'text' => $params['text'],
791 'ad_employer_id' => $params['_vacancy'], 786 'ad_employer_id' => $params['_vacancy'],
792 'flag_new' => 1 787 'flag_new' => 1
793 ]; 788 ];
794 789
795 $message = Message::add_message( 790 $message = Message::add_message(
796 $request, 791 $request,
797 $params['_user_id'], 792 $params['_user_id'],
798 $params['_to_user_id'], 793 $params['_to_user_id'],
799 $message_params, 794 $message_params,
800 file_store_path: "worker/$id" 795 file_store_path: "worker/$id"
801 ); 796 );
802 797
803 return redirect()->route('employer.dialog', ['chat' => $message->chat_id_to]); 798 return redirect()->route('employer.dialog', ['chat' => $message->chat_id_to]);
804 } 799 }
805 800
806 // Восстановление пароля 801 // Восстановление пароля
807 public function repair_password(Request $request) { 802 public function repair_password(Request $request) {
808 $params = $request->get('email'); 803 $params = $request->get('email');
809 } 804 }
810 805
811 // Избранные люди на корабль 806 // Избранные люди на корабль
812 public function selected_people(Request $request) { 807 public function selected_people(Request $request) {
813 $id = $request->get('id'); 808 $id = $request->get('id');
814 $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> 809 $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')->
815 where('is_remove', '=', '0')-> 810 where('is_remove', '=', '0')->
816 where('is_bd', '=', '0')-> 811 where('is_bd', '=', '0')->
817 where('position_id', $id)-> 812 where('position_id', $id)->
818 get(); 813 get();
819 return view('favorite_people', compact('favorite_people')); 814 return view('favorite_people', compact('favorite_people'));
820 } 815 }
821 816
822 /** 817 /**
823 * @throws JsonException 818 * @throws JsonException
824 */ 819 */
825 public function vacancyAutoLiftForm(): View|RedirectResponse 820 public function vacancyAutoLiftForm(): View|RedirectResponse
826 { 821 {
827 if (!Auth::user()->can_autolift) { 822 if (!Auth::user()->can_autolift) {
828 return redirect()->route('employer.employer_info'); 823 return redirect()->route('employer.employer_info');
829 } 824 }
830 825
831 $employer = Auth::user()->employers[0]; 826 $employer = Auth::user()->employers[0];
832 $vacancies = $employer 827 $vacancies = $employer
833 ->ads() 828 ->ads()
834 ->where('is_remove', 0) 829 ->where('is_remove', 0)
835 ->where('active_is', 1) 830 ->where('active_is', 1)
836 ->get(); 831 ->get();
837 832
838 $options = $employer->autoliftOptions ?? new EmployerAutoliftOption(); 833 $options = $employer->autoliftOptions ?? new EmployerAutoliftOption();
839 834
840 $leftDays = 0; 835 $leftDays = 0;
841 836
842 if ($options->days_repeat) { 837 if ($options->days_repeat) {
843 $leftDays = $options->days_repeat - now()->diffInDays(Carbon::parse($options->created_at)); 838 $leftDays = $options->days_repeat - now()->diffInDays(Carbon::parse($options->created_at));
844 } 839 }
845 840
846 841
847 return view('employers.vacancy_autolift', compact('vacancies', 'options', 'leftDays')); 842 return view('employers.vacancy_autolift', compact('vacancies', 'options', 'leftDays'));
848 } 843 }
849 844
850 /** 845 /**
851 * @throws JsonException 846 * @throws JsonException
852 */ 847 */
853 public function vacancyAutoLiftSave(Request $request) 848 public function vacancyAutoLiftSave(Request $request)
854 { 849 {
855 $employer = Auth::user()->employers[0]; 850 $employer = Auth::user()->employers[0];
856 851
857 $employer->autoliftOptions()->updateOrCreate( 852 $employer->autoliftOptions()->updateOrCreate(
858 [ 853 [
859 'employer_id' => $employer->id, 854 'employer_id' => $employer->id,
860 ], 855 ],
861 [ 856 [
862 'is_enabled' => $request->get('is_enabled') === 'true', 857 'is_enabled' => $request->get('is_enabled') === 'true',
863 'times_per_day' => $request->get('times_per_day'), 858 'times_per_day' => $request->get('times_per_day'),
864 'days_repeat' => $request->get('days_repeat'), 859 'days_repeat' => $request->get('days_repeat'),
865 'time_send_first' => $request->get('time_send_first'), 860 'time_send_first' => $request->get('time_send_first'),
866 'time_send_second' => $request->get('time_send_second'), 861 'time_send_second' => $request->get('time_send_second'),
867 'time_send_third' => $request->get('time_send_third'), 862 'time_send_third' => $request->get('time_send_third'),
868 'time_send_tg' => $request->get('time_send_tg'), 863 'time_send_tg' => $request->get('time_send_tg'),
869 ] 864 ]
870 ); 865 );
871 866
872 foreach ($request->get('vacancies') as $vacancy) { 867 foreach ($request->get('vacancies') as $vacancy) {
873 Ad_employer::query() 868 Ad_employer::query()
874 ->where('id', $vacancy['id']) 869 ->where('id', $vacancy['id'])
875 ->update([ 870 ->update([
876 'autolift_site' => $vacancy['autolift_site'] === 'true', //they're arriving as strings 871 'autolift_site' => $vacancy['autolift_site'] === 'true', //they're arriving as strings
877 'autosend_tg' => $vacancy['autosend_tg'] === 'true', 872 'autosend_tg' => $vacancy['autosend_tg'] === 'true',
878 ]); 873 ]);
879 } 874 }
880 875
881 return response(['success' => true]); 876 return response(['success' => true]);
882 } 877 }
883 878
884 public function autoresponder() 879 public function autoresponder()
885 { 880 {
886 $user = Auth::user(); 881 $user = Auth::user();
887 return view('employers.autoresponder', compact('user')); 882 return view('employers.autoresponder', compact('user'));
888 } 883 }
889 884
890 public function autoresponderSave(Request $request): RedirectResponse 885 public function autoresponderSave(Request $request): RedirectResponse
891 { 886 {
892 $user = Auth::user(); 887 $user = Auth::user();
893 $user->autoresponder = $request->get('autoresponder', false) === 'on'; 888 $user->autoresponder = $request->get('autoresponder', false) === 'on';
894 $user->autoresponder_message = $request->get('autoresponder_message'); 889 $user->autoresponder_message = $request->get('autoresponder_message');
895 $user->save(); 890 $user->save();
896 891
897 return redirect(route('employer.autoresponder')); 892 return redirect(route('employer.autoresponder'));
898 } 893 }
899 } 894 }
900 895
1 <?php 1 <?php
2 2
3 namespace App\Models; 3 namespace App\Models;
4 4
5 use Illuminate\Database\Eloquent\Factories\HasFactory; 5 use Illuminate\Database\Eloquent\Factories\HasFactory;
6 use Illuminate\Database\Eloquent\Model; 6 use Illuminate\Database\Eloquent\Model;
7 use Carbon\Carbon; 7 use Carbon\Carbon;
8 8
9 class Chat extends Model 9 class Chat extends Model
10 { 10 {
11 use HasFactory; 11 use HasFactory;
12 12
13 protected $fillable = [ 13 protected $fillable = [
14 'user_id', 14 'user_id',
15 'to_user_id', 15 'to_user_id',
16 'is_removed', 16 'is_removed',
17 'is_fixed', 17 'is_fixed',
18 'last_message_date', 18 'last_message_date',
19 'last_message_id', 19 'last_message_id',
20 'fixed_time', 20 'fixed_time',
21 'is_admin_chat' 21 'is_admin_chat'
22 ]; 22 ];
23 23
24 public function user() { 24 public function user() {
25 return $this->belongsTo(User::class, 'to_user_id'); 25 return $this->belongsTo(User::class, 'to_user_id');
26 } 26 }
27 27
28 public function worker() { 28 public function worker() {
29 return $this->belongsTo(Worker::class, 'to_user_id', 'user_id'); 29 return $this->belongsTo(Worker::class, 'to_user_id', 'user_id');
30 } 30 }
31 31
32 public function employer() { 32 public function employer() {
33 return $this->belongsTo(Employer::class, 'to_user_id', 'user_id'); 33 return $this->belongsTo(Employer::class, 'to_user_id', 'user_id');
34 } 34 }
35 35
36 public function last_message() { 36 public function last_message() {
37 return $this->belongsTo(Message::class, 'last_message_id'); 37 return $this->belongsTo(Message::class, 'last_message_id');
38 } 38 }
39 39
40 public function unread_messages() 40 public function unread_messages()
41 { 41 {
42 return $this->hasMany(Message::class, 'user_id', 'to_user_id'); 42 return $this->hasMany(Message::class, 'user_id', 'to_user_id');
43 } 43 }
44 44
45 public function admin_chat_unread_messages() 45 public function admin_chat_unread_messages()
46 { 46 {
47 return $this->hasMany(Message::class, 'to_user_id', 'to_user_id'); 47 return $this->hasMany(Message::class, 'to_user_id', 'to_user_id');
48 } 48 }
49 49
50 public static function pin_chat(int $chat_id, $fixed) 50 public static function pin_chat(int $chat_id, $fixed)
51 { 51 {
52 52 $chat = self::query()->find($chat_id);
53 return self::where('id', '=', $chat_id) 53 $chat->update([
54 ->update([
55 'is_fixed' => !empty($fixed) ? 1 : 0, 54 'is_fixed' => !empty($fixed) ? 1 : 0,
56 'fixation_date' => !empty($fixed) ? Carbon::now() : null 55 'fixation_date' => !empty($fixed) ? Carbon::now() : null
57 ]); 56 ]);
57 return $chat;
58 } 58 }
59 59
60 public static function remove_chat(int $chat_id) 60 public static function remove_chat(int $chat_id)
61 { 61 {
62 return self::where('id', '=', $chat_id) 62 return self::where('id', '=', $chat_id)
63 ->update(['is_removed' => 1]); 63 ->update(['is_removed' => 1]);
64 } 64 }
65 65
66 public static function get_user_chats(int $user_id){ 66 public static function get_user_chats(int $user_id){
67 return Chat::query() 67 return Chat::query()
68 ->with('user') 68 ->with('user')
69 ->with('worker') 69 ->with('worker')
70 ->with('employer') 70 ->with('employer')
71 ->with('last_message') 71 ->with('last_message')
72 ->withCount(['unread_messages' => function ($query) use($user_id) { 72 ->withCount(['unread_messages' => function ($query) use($user_id) {
73 $query 73 $query
74 ->where('to_user_id', '=', $user_id) 74 ->where('to_user_id', '=', $user_id)
75 ->whereNotNull('chat_id_from') 75 ->whereNotNull('chat_id_from')
76 ->where('flag_new', '=', 1) 76 ->where('flag_new', '=', 1)
77 ; 77 ;
78 }]) 78 }])
79 ->where('user_id', '=', $user_id) 79 ->where('user_id', '=', $user_id)
80 ->where('is_removed', '=', 0) 80 ->where('is_removed', '=', 0)
81 ->orderByDesc('is_fixed') 81 ->orderByDesc('is_fixed')
82 ->orderByDesc('fixation_date') 82 ->orderByDesc('fixation_date')
83 ->orderByDesc('last_message_date') 83 ->orderByDesc('last_message_date')
84 ->paginate(5) 84 ->paginate(5)
85 ; 85 ;
86 } 86 }
87 87
88 public static function get_user_admin_chat(int $user_id) 88 public static function get_user_admin_chat(int $user_id)
89 { 89 {
90 return Chat::query() 90 return Chat::query()
91 ->with('last_message') 91 ->with('last_message')
92 ->withCount(['unread_messages' => function ($query) use($user_id) { 92 ->withCount(['unread_messages' => function ($query) use($user_id) {
93 $query->where('to_user_id', '=', $user_id)->where('flag_new', '=', 1); 93 $query->where('to_user_id', '=', $user_id)->where('flag_new', '=', 1);
94 }]) 94 }])
95 ->where('user_id', '=', $user_id) 95 ->where('user_id', '=', $user_id)
96 ->where('is_admin_chat', 1) 96 ->where('is_admin_chat', 1)
97 ->first() 97 ->first()
98 ; 98 ;
99 } 99 }
100 100
101 public static function get_chat_messages(Chat $chat){ 101 public static function get_chat_messages(Chat $chat){
102 102
103 return Message::query() 103 return Message::query()
104 ->where(function ($query) use ($chat) { 104 ->where(function ($query) use ($chat) {
105 $query->where('chat_id_from', $chat->id)->orWhere('chat_id_to', $chat->id); 105 $query->where('chat_id_from', $chat->id)->orWhere('chat_id_to', $chat->id);
106 }) 106 })
107 ->where(function($query) use ($chat) { 107 ->where(function($query) use ($chat) {
108 $query 108 $query
109 ->where(function($query) use ($chat) { 109 ->where(function($query) use ($chat) {
110 $query->where('user_id', $chat->user_id)->where('to_user_id', $chat->to_user_id); 110 $query->where('user_id', $chat->user_id)->where('to_user_id', $chat->to_user_id);
111 }) 111 })
112 ->orWhere(function($query) use ($chat) { 112 ->orWhere(function($query) use ($chat) {
113 $query->where('user_id', $chat->to_user_id)->where('to_user_id', $chat->user_id); 113 $query->where('user_id', $chat->to_user_id)->where('to_user_id', $chat->user_id);
114 }) 114 })
115 ; 115 ;
116 }) 116 })
117 ->OrderBy('created_at') 117 ->OrderBy('created_at')
118 ->get() 118 ->get()
119 ; 119 ;
120 } 120 }
121 121
122 } 122 }
resources/views/employers/bd.blade.php
1 @extends('layout.frontend', ['title' => 'База данных - РекаМоре']) 1 @extends('layout.frontend', ['title' => 'База данных - РекаМоре'])
2 2
3 @section('scripts') 3 @section('scripts')
4 <script> 4 <script>
5 $(document).ready(function(){ 5 $(document).ready(function(){
6 $('#job_title_list').chosen({ 6 $('#job_title_list').chosen({
7 width: '100%' 7 width: '100%'
8 }) 8 })
9 $('#job_title_list').change(function(){ 9 $('#job_title_list').change(function(){
10 if ($(this).is(':checked')){ 10 if ($(this).is(':checked')){
11 $(".job-title-list-wrap").css("display", "block"); 11 $(".job-title-list-wrap").css("display", "block");
12 } else { 12 } else {
13 $(".job-title-list-wrap").css("display", "none"); 13 $(".job-title-list-wrap").css("display", "none");
14 } 14 }
15 }); 15 });
16 $('.cabinet__export-button-wrap button').click(function(){ 16 $('.cabinet__export-button-wrap button').click(function(){
17 $('.cabinet__export-error').parent().remove(); 17 $('.cabinet__export-error').parent().remove();
18 }); 18 });
19 19
20 $('.search-reset-button').click(function(){ 20 $('.search-reset-button').click(function(){
21 var wrap = $(this).closest('.cabinet__filters'); 21 var wrap = $(this).closest('.cabinet__filters');
22 wrap.find('[name="search"]').val(''); 22 wrap.find('[name="search"]').val('');
23 wrap.find('button').click(); 23 wrap.find('button').click();
24 }); 24 });
25 25
26 26
27 }); 27 });
28 28
29 29
30 $(document).on('click', '.die_black', function() { 30 $(document).on('click', '.die_black', function() {
31 var this_ = $(this); 31 var this_ = $(this);
32 var ajax_ = $('#ajax_flot_div'); 32 var ajax_ = $('#ajax_flot_div');
33 var id_ = this_.attr('data-test'); 33 var id_ = this_.attr('data-test');
34 var url_ = this_.attr('data-link'); 34 var url_ = this_.attr('data-link');
35 35
36 console.log(url_); 36 console.log(url_);
37 $.ajax({ 37 $.ajax({
38 type: "GET", 38 type: "GET",
39 url: url_, 39 url: url_,
40 success: function (data) { 40 success: function (data) {
41 console.log('Ответка'); 41 console.log('Ответка');
42 ajax_.html(data); 42 ajax_.html(data);
43 }, 43 },
44 headers: { 44 headers: {
45 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 45 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
46 }, 46 },
47 error: function (data) { 47 error: function (data) {
48 console.log('Error: ' + data); 48 console.log('Error: ' + data);
49 } 49 }
50 }); 50 });
51 51
52 }); 52 });
53 </script> 53 </script>
54 @endsection 54 @endsection
55 55
56 @section('content') 56 @section('content')
57 <section class="cabinet"> 57 <section class="cabinet">
58 <div class="container"> 58 <div class="container">
59 <ul class="breadcrumbs cabinet__breadcrumbs"> 59 <ul class="breadcrumbs cabinet__breadcrumbs">
60 <li><a href="{{ route('index') }}">Главная</a></li> 60 <li><a href="{{ route('index') }}">Главная</a></li>
61 <li><b>Личный кабинет</b></li> 61 <li><b>Личный кабинет</b></li>
62 </ul> 62 </ul>
63 <div class="cabinet__wrapper"> 63 <div class="cabinet__wrapper">
64 <div class="cabinet__side"> 64 <div class="cabinet__side">
65 <div class="cabinet__side-toper"> 65 <div class="cabinet__side-toper">
66 @include('employers.emblema') 66 @include('employers.emblema')
67 </div> 67 </div>
68 @include('employers.menu', ['item' => 7]) 68 @include('employers.menu', ['item' => 7])
69 </div> 69 </div>
70 70
71 <div class="cabinet__body"> 71 <div class="cabinet__body">
72 <div class="cabinet__body-item"> 72 <div class="cabinet__body-item">
73 <h2 class="title cabinet__title">База данных</h2> 73 <h2 class="title cabinet__title">База данных</h2>
74 </div> 74 </div>
75 <div class="cabinet__body-item"> 75 <div class="cabinet__body-item">
76 <div class="cabinet__filters" style="display: flex;flex-direction: unset;justify-content: left;align-items: center;"> 76 <div class="cabinet__filters" style="display: flex;flex-direction: unset;justify-content: left;align-items: center;">
77 <div class="cabinet__filters-item"> 77 <div class="cabinet__filters-item">
78 <form class="search" action="{{ route('employer.bd') }}"> 78 <form class="search" action="{{ route('employer.bd') }}">
79 <input type="search" name="search" id="search" class="input" placeholder="Поиск&hellip;" value="@if (isset($_GET['search'])) {{ $_GET['search'] }} @endif"> 79 <input type="search" name="search" id="search" class="input" placeholder="Поиск&hellip;" value="@if (isset($_GET['search'])) {{ $_GET['search'] }} @endif">
80 <button type="submit" class="button">Найти</button> 80 <button type="submit" class="button">Найти</button>
81 <span> 81 <span>
82 <svg> 82 <svg>
83 <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> 83 <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use>
84 </svg> 84 </svg>
85 </span> 85 </span>
86 </form> 86 </form>
87 </div> 87 </div>
88 <a href="javascript:void(0)" class="search-reset-button bold font18" style="color: #377d87;">Сбросить поиск</a> 88 <a href="javascript:void(0)" class="search-reset-button bold font18" style="color: #377d87;">Сбросить поиск</a>
89 </div> 89 </div>
90 <div class="cabinet__filters"> 90 <div class="cabinet__filters">
91 <div class="cabinet__export-wrap"> 91 <div class="cabinet__export-wrap">
92 <form action="{{ route('resume_download_all') }}" method="GET" target="_blank"> 92 <form action="{{ route('resume_download_all') }}" method="GET" target="_blank">
93 <div class="cabinet__export-button-wrap"> 93 <div class="cabinet__export-button-wrap">
94 <button type="submit" class="button"> 94 <button type="submit" class="button">
95 <svg> 95 <svg>
96 <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use> 96 <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use>
97 </svg> 97 </svg>
98 Экспорт 98 Экспорт
99 </button> 99 </button>
100 </div> 100 </div>
101 <div class="cabinet__export-options-wrap"> 101 <div class="cabinet__export-options-wrap">
102 @foreach ($export_options as $key => $value) 102 @foreach ($export_options as $key => $value)
103 <label class="checkbox"> 103 <label class="checkbox">
104 <input type="checkbox" value="1" name="{{$key}}" class="checkbox__input" checked=""> 104 <input type="checkbox" value="1" name="{{$key}}" class="checkbox__input" checked="">
105 <span class="checkbox__icon"> 105 <span class="checkbox__icon">
106 <svg> 106 <svg>
107 <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use> 107 <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use>
108 </svg> 108 </svg>
109 </span> 109 </span>
110 <span class="checkbox__text"> 110 <span class="checkbox__text">
111 <span>{{$value}}</span> 111 <span>{{$value}}</span>
112 </span> 112 </span>
113 </label> 113 </label>
114 @endforeach 114 @endforeach
115 </div> 115 </div>
116 <div class="job-title-list-wrap"> 116 <div class="job-title-list-wrap">
117 <select id="job_title_list" name="job_title_list[]" data-placeholder="Выберите должности" multiple > 117 <select id="job_title_list" name="job_title_list[]" data-placeholder="Выберите должности" multiple >
118 @foreach($jobs_titles as $job_title) 118 @foreach($jobs_titles as $job_title)
119 <option hover="background-color: #377d87;" value="{{$job_title['id']}}">{{$job_title['name']}}</option> 119 <option hover="background-color: #377d87;" value="{{$job_title['id']}}">{{$job_title['name']}}</option>
120 @endforeach 120 @endforeach
121 </select> 121 </select>
122 </div> 122 </div>
123 </form> 123 </form>
124 </div> 124 </div>
125 </div> 125 </div>
126 @if(session('error')) 126 @if(session('error'))
127 <div class="cabinet__filters"> 127 <div class="cabinet__filters">
128 <p class="cabinet__export-error">{{ session('error') }}</p> 128 <p class="cabinet__export-error">{{ session('error') }}</p>
129 </div> 129 </div>
130 @endif 130 @endif
131 131
132 </div> 132 </div>
133 133
134 <div class="cabinet__body-item"> 134 <div class="cabinet__body-item">
135 <div class="cabinet__table-header"> 135 <div class="cabinet__table-header">
136 <div> 136 <div>
137 Позиции работников 137 Позиции работников
138 </div> 138 </div>
139 <span> 139 <span>
140 Пользователей найдено: 140 Пользователей найдено:
141 <b>{{ $count_users }}</b> 141 <b>{{ $count_users }}</b>
142 </span> 142 </span>
143 </div> 143 </div>
144 <div class="table table_spoiler"> 144 <div class="table table_spoiler">
145 145
146 <div class="table__scroll"> 146 <div class="table__scroll">
147 <div class="table__body table__body_min-width"> 147 <div class="table__body table__body_min-width">
148 <table> 148 <table>
149 <thead> 149 <thead>
150 <tr> 150 <tr>
151 <th></th>
151 <th>ФИО соискателя</th> 152 <th>ФИО соискателя</th>
152 <th>Должность</th> 153 <th>Должность</th>
153 <th>Наличие<br>анкеты</th> 154 <th>Наличие<br>анкеты</th>
154 </tr> 155 </tr>
155 </thead> 156 </thead>
156 <tbody> 157 <tbody>
157 @php 158 @php
158 $categories = 0; 159 $categories = 0;
159 160
160 @endphp 161 @endphp
161 162
162 @if ($users->count()) 163 @if ($users->count())
163 @foreach ($users as $key => $it) 164 @foreach ($users as $key => $it)
164 @php $worker = !empty($it->workers[0]) ? $it->workers[0] : ''; @endphp 165 @php $worker = !empty($it->workers[0]) ? $it->workers[0] : ''; @endphp
165 <tr> 166 <tr>
167 <td style="max-width: 40px; min-width: 30px; font-size: 1.5rem">
168 {{ $it->workers[0]->comment }}
169 </td>
170
166 <td>{{ $it->surname." ".$it->name_man }}<br>{{ $it->surname2 }}</td> 171 <td>{{ $it->surname." ".$it->name_man }}<br>{{ $it->surname2 }}</td>
167 172
168 <td> 173 <td>
169 @if($worker && $worker->positions_work) 174 @if($worker && $worker->positions_work)
170 {{ !empty($worker->jobs) ? $worker->jobs->first()->name : '' }} 175 {{ !empty($worker->jobs) ? $worker->jobs->first()->name : '' }}
171 @endif 176 @endif
172 </td> 177 </td>
173 178
174 <td> 179 <td>
175 @if ($it->file !== null) 180 @if ($it->file !== null)
176 <a href="{{ asset(Storage::url($it->file)) }}" class="table__link"> 181 <a href="{{ asset(Storage::url($it->file)) }}" class="table__link">
177 <svg> 182 <svg>
178 <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use> 183 <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use>
179 </svg> 184 </svg>
180 Скачать 185 Скачать
181 </a> 186 </a>
182 @endif 187 @endif
183 </td> 188 </td>
184 </tr> 189 </tr>
185 @endforeach 190 @endforeach
186 @endif 191 @endif
187 </tbody> 192 </tbody>
188 </table> 193 </table>
189 </div> 194 </div>
190 195
191 </div> 196 </div>
192 </div> 197 </div>
193 {{ $users->onEachSide(0)->appends($_GET)->links('paginate') }} 198 {{ $users->onEachSide(0)->appends($_GET)->links('paginate') }}
194 </div> 199 </div>
195 </div> 200 </div>
196 </div> 201 </div>
197 </div> 202 </div>
198 </section> 203 </section>
199 </div> 204 </div>
200 @endsection 205 @endsection
201 206
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 @include('modals.flash-message', [ 35 @include('modals.flash-message', [
36 'title' => 'Спасибо!', 36 'title' => 'Спасибо!',
37 'message' => session('success') 37 'message' => session('success')
38 ]) 38 ])
39 <div class="container"> 39 <div class="container">
40 <ul class="breadcrumbs cabinet__breadcrumbs"> 40 <ul class="breadcrumbs cabinet__breadcrumbs">
41 <li><a href="{{ route('index') }}">Главная</a></li> 41 <li><a href="{{ route('index') }}">Главная</a></li>
42 <li><b>Личный кабинет</b></li> 42 <li><b>Личный кабинет</b></li>
43 </ul> 43 </ul>
44 <div class="cabinet__wrapper"> 44 <div class="cabinet__wrapper">
45 <div class="cabinet__side"> 45 <div class="cabinet__side">
46 <div class="cabinet__side-toper"> 46 <div class="cabinet__side-toper">
47 47
48 @include('employers.emblema') 48 @include('employers.emblema')
49 49
50 </div> 50 </div>
51 51
52 @include('employers.menu', ['item' => 3]) 52 @include('employers.menu', ['item' => 3])
53 53
54 </div> 54 </div>
55 55
56 <form class="cabinet__body" action="{{ route('employer.vacancy_save_me', ['ad_employer' => $ad_employer->id]) }}" method="POST"> 56 <form class="cabinet__body" action="{{ route('employer.vacancy_save_me', ['ad_employer' => $ad_employer->id]) }}" method="POST">
57 @csrf 57 @csrf
58 <input type="hidden" name="employer_id" value="{{ $Employer->id }}"/> 58 <input type="hidden" name="employer_id" value="{{ $Employer->id }}"/>
59 <div class="cabinet__body-item"> 59 <div class="cabinet__body-item">
60 <div class="cabinet__descr"> 60 <div class="cabinet__descr">
61 <h2 class="title cabinet__title">Редактировать вакансию</h2> 61 <h2 class="title cabinet__title">Редактировать вакансию</h2>
62 <p class="cabinet__text"><b>Данные по вакансии</b></p> 62 <p class="cabinet__text"><b>Данные по вакансии</b></p>
63 <p class="cabinet__text">Все поля обязательны для заполнения *</p> 63 <p class="cabinet__text">Все поля обязательны для заполнения *</p>
64 </div> 64 </div>
65 </div> 65 </div>
66 <div class="cabinet__body-item"> 66 <div class="cabinet__body-item">
67 <h4>Поля для вакансии</h4> 67 <h4>Поля для вакансии</h4>
68 <div class="cabinet__inputs"> 68 <div class="cabinet__inputs">
69 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 69 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
70 <label class="form-group__label">Название вакансии</label> 70 <label class="form-group__label">Название вакансии</label>
71 <div class="form-group__item"> 71 <div class="form-group__item">
72 <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $ad_employer->name ?? '' }}" required> 72 <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $ad_employer->name ?? '' }}" required>
73 @error('name') 73 @error('name')
74 <span class="text-xs text-red-600 dark:text-red-400"> 74 <span class="text-xs text-red-600 dark:text-red-400">
75 {{ $message }} 75 {{ $message }}
76 </span> 76 </span>
77 @enderror 77 @enderror
78 </div> 78 </div>
79 </div> 79 </div>
80 80
81 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> 81 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
82 <label class="form-group__label">Телефон</label> 82 <label class="form-group__label">Телефон</label>
83 <div class="form-group__item"> 83 <div class="form-group__item">
84 <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $ad_employer->telephone ?? '' }}" placeholder="Свой телефон"> 84 <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $ad_employer->telephone ?? '' }}" placeholder="Свой телефон">
85 @error('telephone') 85 @error('telephone')
86 <span class="text-xs text-red-600 dark:text-red-400"> 86 <span class="text-xs text-red-600 dark:text-red-400">
87 {{ $message }} 87 {{ $message }}
88 </span> 88 </span>
89 @enderror 89 @enderror
90 </div> 90 </div>
91 </div> 91 </div>
92 92
93 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> 93 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
94 <label class="form-group__label">Емайл</label> 94 <label class="form-group__label">Емайл</label>
95 <div class="form-group__item"> 95 <div class="form-group__item">
96 <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $ad_employer->email ?? '' }}" placeholder="Своя почту"> 96 <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $ad_employer->email ?? '' }}" placeholder="Своя почту">
97 @error('email') 97 @error('email')
98 <span class="text-xs text-red-600 dark:text-red-400"> 98 <span class="text-xs text-red-600 dark:text-red-400">
99 {{ $message }} 99 {{ $message }}
100 </span> 100 </span>
101 @enderror 101 @enderror
102 </div> 102 </div>
103 </div> 103 </div>
104 104
105 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> 105 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
106 <label class="form-group__label">Зарплата среднестатистическая для вакансии</label> 106 <label class="form-group__label">Зарплата среднестатистическая для вакансии</label>
107 <div class="form-group__item"> 107 <div class="form-group__item">
108 <input type="text" class="input" name="salary" id="salary" value="{{ old('salary') ?? $ad_employer->salary ??'' }}" placeholder="Среднестатистическая зарплата"> 108 <input type="text" class="input" name="salary" id="salary" value="{{ old('salary') ?? $ad_employer->salary ??'' }}" placeholder="Среднестатистическая зарплата">
109 @error('salary') 109 @error('salary')
110 <span class="text-xs text-red-600 dark:text-red-400"> 110 <span class="text-xs text-red-600 dark:text-red-400">
111 {{ $message }} 111 {{ $message }}
112 </span> 112 </span>
113 @enderror 113 @enderror
114 </div> 114 </div>
115 </div> 115 </div>
116 116
117 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display: none"> 117 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display: none">
118 <label class="form-group__label">Город посадки</label> 118 <label class="form-group__label">Город посадки</label>
119 <div class="form-group__item"> 119 <div class="form-group__item">
120 <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $ad_employer->city ?? 'Не указан' }}" placeholder="Севастополь"> 120 <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $ad_employer->city ?? 'Не указан' }}" placeholder="Севастополь">
121 @error('city') 121 @error('city')
122 <span class="text-xs text-red-600"> 122 <span class="text-xs text-red-600">
123 {{ $message }} 123 {{ $message }}
124 </span> 124 </span>
125 @enderror 125 @enderror
126 </div> 126 </div>
127 </div> 127 </div>
128 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 128 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
129 <label class="form-group__label">Редактирование должностей</label> 129 <label class="form-group__label">Редактирование должностей</label>
130 <div class="form-group__item"> 130 <div class="form-group__item">
131 <div class="select"> 131 <div class="select">
132 <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple"> 132 <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple">
133 @php $i = 1 @endphp 133 @php $i = 1 @endphp
134 @if ($jobs->count()) 134 @if ($jobs->count())
135 @foreach($jobs as $it) 135 @foreach($jobs as $it)
136 @php $selected = false; @endphp 136 @php $selected = false; @endphp
137 @foreach ($ad_employer->jobs_code as $it_um) 137 @foreach ($ad_employer->jobs_code as $it_um)
138 @if (isset($it_um->job_title_id)) 138 @if (isset($it_um->job_title_id))
139 @if ($it_um->job_title_id == $it->id)) 139 @if ($it_um->job_title_id == $it->id))
140 @php $selected = true; @endphp 140 @php $selected = true; @endphp
141 @endif 141 @endif
142 @endif 142 @endif
143 @endforeach 143 @endforeach
144 <option value="{{ $it->id }}" @if ($selected) selected @endif>{{ $it->name }}</option> 144 <option value="{{ $it->id }}" @if ($selected) selected @endif>{{ $it->name }}</option>
145 @endforeach 145 @endforeach
146 @endif 146 @endif
147 </select> 147 </select>
148 </div> 148 </div>
149 </div> 149 </div>
150 </div> 150 </div>
151 151
152 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 152 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
153 <label class="form-group__label">Описание вакансии</label> 153 <label class="form-group__label">Описание вакансии</label>
154 <div class="form-group__item"> 154 <div class="form-group__item">
155 <textarea class="textarea ckeditor" name="text" id="text">{{ old('text') ?? $ad_employer->text ?? '' }}</textarea> 155 <textarea class="textarea ckeditor" name="text" id="text">{{ old('text') ?? $ad_employer->text ?? '' }}</textarea>
156 @error('text') 156 @error('text')
157 <span class="text-xs text-red-600"> 157 <span class="text-xs text-red-600">
158 {{ $message }} 158 {{ $message }}
159 </span> 159 </span>
160 @enderror 160 @enderror
161 </div> 161 </div>
162 </div> 162 </div>
163 </div> 163 </div>
164 164
165 <a class="button cabinet__submit" href="{{ route('employer.vacancy_list') }}">Назад</a> 165 <a class="button cabinet__submit" href="{{ route('employer.vacancy_list') }}">Назад</a>
166 <button type="submit" class="button cabinet__submit">Сохранить и опубликовать</button> 166 <button type="submit" class="button cabinet__submit">Сохранить и опубликовать</button>
167 </div> 167 </div>
168 </form> 168 </form>
169 </div> 169 </div>
170 </div> 170 </div>
171 </section> 171 </section>
172 </div> 172 </div>
173 <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> 173 <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script>
174 <script> 174 <script>
175 CKEDITOR.replace('text'); 175 CKEDITOR.replace('text', {
176 allowedContent: true,
177 extraAllowedContent: 'p br strong em u ul ol li span;*{*}',
178
179 on: {
180 paste: function (event) {
181 let data = event.data.dataValue;
182 data = data.replace(/<br\s*\/?>\s*<br\s*\/?>/g, '<br>');
183 event.data.dataValue = data.trim();
184 }
185 },
186
187 contentsCss: [
188 CKEDITOR.basePath + 'contents.css',
189 '/css/custom-ckeditor.css'
190 ]
191 });
176 //CKEDITOR.replace( 'text', { 192 //CKEDITOR.replace( 'text', {
177 // filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", 193 // filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}",
178 // filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", 194 // filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}",
179 // filebrowserUploadMethod: 'form' 195 // filebrowserUploadMethod: 'form'
180 // }); 196 // });
181 </script> 197 </script>
182 @endsection 198 @endsection
183 199
resources/views/employers/list_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 $(document).on('change', '#sort_ajax', function() { 5 $(document).on('change', '#sort_ajax', function() {
6 var this_ = $(this); 6 var this_ = $(this);
7 var val_ = this_.val(); 7 var val_ = this_.val();
8 console.log('sort items '+val_); 8 console.log('sort items '+val_);
9 9
10 $.ajax({ 10 $.ajax({
11 type: "GET", 11 type: "GET",
12 url: "{{ url()->current() }}", 12 url: "{{ url()->current() }}",
13 data: "sort="+val_+"&search=@if ((isset($_GET['search']))&&(!empty($_GET['search']))){{$_GET['search']}}@endif", 13 data: "sort="+val_+"&search=@if ((isset($_GET['search']))&&(!empty($_GET['search']))){{$_GET['search']}}@endif",
14 success: function (data) { 14 success: function (data) {
15 console.log('Выбор сортировки'); 15 console.log('Выбор сортировки');
16 console.log(data); 16 console.log(data);
17 history.pushState({}, '', "{{ route('employer.vacancy_list') }}?search=@if ((isset($_GET['search']))&&(!empty($_GET['search']))){{$_GET['search']}}@endif"+"&sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); 17 history.pushState({}, '', "{{ route('employer.vacancy_list') }}?search=@if ((isset($_GET['search']))&&(!empty($_GET['search']))){{$_GET['search']}}@endif"+"&sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif");
18 $('#main_ockar').html(data); 18 $('#main_ockar').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 29
30 $(document).on('click', '.js-delete-trigger', function () { 30 $(document).on('click', '.js-delete-trigger', function () {
31 var targetModal = $(this).data('target'); 31 var targetModal = $(this).data('target');
32 $.fancybox.open({ 32 $.fancybox.open({
33 src: targetModal, 33 src: targetModal,
34 type: 'inline', 34 type: 'inline',
35 opts: { touch: false } 35 opts: { touch: false }
36 }); 36 });
37 }); 37 });
38 38
39 </script> 39 </script>
40 @endsection 40 @endsection
41 41
42 @section('content') 42 @section('content')
43 <section class="cabinet"> 43 <section class="cabinet">
44 @include('modals.flash-message', [ 44 @include('modals.flash-message', [
45 'title' => 'Успешно!', 45 'title' => 'Успешно!',
46 'message' => session('success') 46 'message' => session('success')
47 ]) 47 ])
48 <div class="container"> 48 <div class="container">
49 <ul class="breadcrumbs cabinet__breadcrumbs"> 49 <ul class="breadcrumbs cabinet__breadcrumbs">
50 <li><a href="{{ route('index') }}">Главная</a></li> 50 <li><a href="{{ route('index') }}">Главная</a></li>
51 <li><b>Личный кабинет</b></li> 51 <li><b>Личный кабинет</b></li>
52 </ul> 52 </ul>
53 <div class="cabinet__wrapper"> 53 <div class="cabinet__wrapper">
54 <div class="cabinet__side"> 54 <div class="cabinet__side">
55 <div class="cabinet__side-toper"> 55 <div class="cabinet__side-toper">
56 56
57 @include('employers.emblema') 57 @include('employers.emblema')
58 58
59 </div> 59 </div>
60 60
61 @include('employers.menu', ['item' => 3]) 61 @include('employers.menu', ['item' => 3])
62 </div> 62 </div>
63 <div class="cabinet__body"> 63 <div class="cabinet__body">
64 <div class="cabinet__body-item"> 64 <div class="cabinet__body-item">
65 <h2 class="title cabinet__title">Мои вакансии</h2> 65 <h2 class="title cabinet__title">Мои вакансии</h2>
66 </div> 66 </div>
67 <div class="cabinet__body-item"> 67 <div class="cabinet__body-item">
68 <div class="cabinet__filters"> 68 <div class="cabinet__filters">
69 <div class="cabinet__filters-item"> 69 <div class="cabinet__filters-item">
70 <form class="search" action="{{ url()->current() }}" method="GET"> 70 <form class="search" action="{{ url()->current() }}" method="GET">
71 <input type="search" name="search" class="input" placeholder="Поиск&hellip;" value="@if ((isset($_GET['search'])) && (!empty($_GET['search']))) {{ $_GET['search'] }}@endif"> 71 <input type="search" name="search" class="input" placeholder="Поиск&hellip;" value="@if ((isset($_GET['search'])) && (!empty($_GET['search']))) {{ $_GET['search'] }}@endif">
72 <button type="submit" class="button">Найти</button> 72 <button type="submit" class="button">Найти</button>
73 <span> 73 <span>
74 <svg> 74 <svg>
75 <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> 75 <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use>
76 </svg> 76 </svg>
77 </span> 77 </span>
78 </form> 78 </form>
79 </div> 79 </div>
80 <div class="cabinet__filters-item"> 80 <div class="cabinet__filters-item">
81 <div class="select"> 81 <div class="select">
82 <select class="js-select2" id="sort_ajax" name="sort_ajax"> 82 <select class="js-select2" id="sort_ajax" name="sort_ajax">
83 <option value="default" @if (isset($_GET['sort']) && ($_GET['sort'] == 'default')) selected @endif>От новых к старым (по умолчанию)</option> 83 <option value="default" @if (isset($_GET['sort']) && ($_GET['sort'] == 'default')) selected @endif>От новых к старым (по умолчанию)</option>
84 <option value="public" @if (isset($_GET['sort']) && ($_GET['sort'] == 'public')) selected @endif>Опубликовано</option> 84 <option value="public" @if (isset($_GET['sort']) && ($_GET['sort'] == 'public')) selected @endif>Опубликовано</option>
85 <option value="nopublic" @if (isset($_GET['sort']) && ($_GET['sort'] == 'nopublic')) selected @endif>Не опубликовано</option> 85 <option value="nopublic" @if (isset($_GET['sort']) && ($_GET['sort'] == 'nopublic')) selected @endif>Не опубликовано</option>
86 <!--<option value="name_up">По имени (возрастание)</option> 86 <!--<option value="name_up">По имени (возрастание)</option>
87 <option value="name_down">По имени (убывание)</option> 87 <option value="name_down">По имени (убывание)</option>
88 <option value="created_at_up">По дате (возрастание)</option> 88 <option value="created_at_up">По дате (возрастание)</option>
89 <option value="created_at_down">По дате (убывание)</option>--> 89 <option value="created_at_down">По дате (убывание)</option>-->
90 </select> 90 </select>
91 </div> 91 </div>
92 </div> 92 </div>
93 </div> 93 </div>
94 94
95 <div class="table table_spoiler" id="main_ockar" name="main_oskar"> 95 <div class="table table_spoiler" id="main_ockar" name="main_oskar">
96 @if ($vacancy_list->count()) 96 @if ($vacancy_list->count())
97 <div class="table__scroll"> 97 <div class="table__scroll">
98 <div class="table__body table__body_min-width"> 98 <div class="table__body table__body_min-width">
99 <table> 99 <table>
100 <thead> 100 <thead>
101 <tr> 101 <tr>
102 <th>№</th> 102 <th>№</th>
103 <th>Название</th> 103 <th>Название</th>
104 <th>Дата добавления<br>/&nbsp;обновления</th> 104 <th>Дата добавления<br>/&nbsp;обновления</th>
105 <th style="display:none">Должности</th> 105 <th style="display:none">Должности</th>
106 <th>Статус</th> 106 <th>Статус</th>
107 <th>Действия</th> 107 <th>Действия</th>
108 </tr> 108 </tr>
109 </thead> 109 </thead>
110 <tbody> 110 <tbody>
111 @foreach($vacancy_list as $it) 111 @foreach($vacancy_list as $it)
112 <tr> 112 <tr>
113 <td>{{ $it->id }}</td> 113 <td>{{ $it->id }}</td>
114 <td>{{ $it->name }}</td> 114 <td>{{ $it->name }}</td>
115 <td>{{ date('d.m.Y', strtotime($it->created_at)) }} <br>/ {{ date('d.m.Y', strtotime($it->updated_at)) }}</td> 115 <td>{{ date('d.m.Y', strtotime($it->created_at)) }} <br>/ {{ date('d.m.Y', strtotime($it->updated_at)) }}</td>
116 <td style="display:none"> <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $it->id]) }}" class="button">Добавить</a> 116 <td style="display:none"> <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $it->id]) }}" class="button">Добавить</a>
117 117
118 @if ($it->jobs->count()) 118 @if ($it->jobs->count())
119 @foreach ($it->jobs as $key => $it_um) 119 @foreach ($it->jobs as $key => $it_um)
120 <p>@if (isset($it->jobs_code[$key])) 120 <p>@if (isset($it->jobs_code[$key]))
121 <a href="{{ route('employer.edit_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id, 'ad_employer' => $it->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">{{$it_um->name}}</a> 121 <a href="{{ route('employer.edit_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id, 'ad_employer' => $it->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">{{$it_um->name}}</a>
122 <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a> 122 <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a>
123 @endif 123 @endif
124 </p> 124 </p>
125 @endforeach 125 @endforeach
126 @else 126 @else
127 Нет связанных <br> с вакансией должностей 127 Нет связанных <br> с вакансией должностей
128 @endif 128 @endif
129 </td> 129 </td>
130 <td> 130 <td>
131 @if ($it->active_is) 131 @if ($it->active_is)
132 <span class="table__status green"><i></i>Опубликовано</span> 132 <span class="table__status green"><i></i>Опубликовано</span>
133 @else 133 @else
134 <span class="table__status"><i></i>Не опубликовано</span> 134 <span class="table__status"><i></i>Не опубликовано</span>
135 @endif 135 @endif
136 </td> 136 </td>
137 <td> 137 <td>
138 <span class="table__controls"> 138 <span class="table__controls">
139 <a class="table__controls-item up-it" title="Поднять вакансию" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}"> 139 <a class="table__controls-item up-it" title="Поднять вакансию" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}">
140 <svg> 140 <svg>
141 <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use> 141 <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use>
142 </svg> 142 </svg>
143 </a> 143 </a>
144 <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" title="Редактировать вакансию" class="table__controls-item"> 144 <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" title="Редактировать вакансию" class="table__controls-item">
145 <svg> 145 <svg>
146 <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> 146 <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use>
147 </svg> 147 </svg>
148 </a> 148 </a>
149 <a class="table__controls-item js-delete-trigger" 149 <a class="table__controls-item js-delete-trigger"
150 title="Удалить вакансию" 150 title="Удалить вакансию"
151 href="javascript:void(0)" 151 href="javascript:void(0)"
152 data-target="#delete-{{ $it->id }}"> 152 data-target="#delete-{{ $it->id }}">
153 <svg> 153 <svg>
154 <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> 154 <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use>
155 </svg> 155 </svg>
156 </a> 156 </a>
157 @include('modals.vacancy.delete_vacancy', ['modalId' => "delete-{$it->id}", 'vacancyId' => $it->id, 'vacancyName' => $it->name]) 157 @include('modals.vacancy.delete_vacancy', ['modalId' => "delete-{$it->id}", 'vacancyId' => $it->id, 'vacancyName' => $it->name])
158 @if ($it->active_is) 158 @if ($it->active_is)
159 <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" title="Скрыть вакансию" class="table__controls-item"> 159 <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" title="Скрыть вакансию" class="table__controls-item">
160 <svg preserveAspectRatio="xMidYMid meet"> 160 <svg preserveAspectRatio="xMidYMid meet">
161 <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> 161 <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use>
162 </svg> 162 </svg>
163 </a> 163 </a>
164 @else 164 @else
165 <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" title="Показать вакансию" class="table__controls-item"> 165 <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" title="Показать вакансию" class="table__controls-item">
166 <svg preserveAspectRatio="xMidYMid meet"> 166 <svg preserveAspectRatio="xMidYMid meet">
167 <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> 167 <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use>
168 </svg> 168 </svg>
169 </a> 169 </a>
170 @endif 170 @endif
171 @if ($Employer->social_is == 1) 171 @if ($Employer->social_is == 1)
172 <a href="{{ route('employer.send-vacancy-to-social', ['social' => 'tg', 'vacancy' => $it->id]) }}" title="Отправить вакансию в телеграм" class="table__controls-item"> 172 <a href="{{ route('employer.send-vacancy-to-social', ['social' => 'tg', 'vacancy' => $it->id]) }}" title="Отправить вакансию в телеграм" class="table__controls-item">
173 <svg> 173 <svg>
174 <use xlink:href="{{ asset('images/sprite.svg#tg') }}"></use> 174 <use xlink:href="{{ asset('images/sprite.svg#tg') }}"></use>
175 </svg> 175 </svg>
176 </a> 176 </a>
177 @endif 177 @endif
178 </span> 178 </span>
179 </td> 179 </td>
180 </tr> 180 </tr>
181 @endforeach 181 @endforeach
182 </tbody> 182 </tbody>
183 </table> 183 </table>
184 </div><br> 184 </div><br>
185 {{ $vacancy_list->appends($_GET)->links('paginate') }} 185 {{ $vacancy_list->appends($_GET)->links('paginate') }}
186 </div> 186 </div>
187 187
188 188
189 @else 189 @else
190 190
191 <div class="notify"> 191 <div class="notify">
192 <svg> 192 <svg>
193 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> 193 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use>
194 </svg> 194 </svg>
195 <span>Вы ещё не разместили ни одной вакансии</span> 195 <span>Вы ещё не разместили ни одной вакансии</span>
196 </div> 196 </div>
197 @endif 197 @endif
198 </div> 198 </div>
199 </div> 199 </div>
200 </div> 200 </div>
201 </div> 201 </div>
202 </div> 202 </div>
203 </section> 203 </section>
204 </div> 204 </div>
205 @endsection 205 @endsection
206 206