Commit b8701187c1cd1e25e6025f705c06598792d4dac4

Authored by Андрей Ларионов
1 parent 5104f48b21

Работодатель - кабинет должности

Showing 2 changed files with 1 additions and 7 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\BaseUserRequest; 8 use App\Http\Requests\BaseUserRequest;
9 use App\Http\Requests\FlotRequest; 9 use App\Http\Requests\FlotRequest;
10 use App\Http\Requests\MessagesRequiest; 10 use App\Http\Requests\MessagesRequiest;
11 use App\Http\Requests\VacancyRequestEdit; 11 use App\Http\Requests\VacancyRequestEdit;
12 use App\Http\Requests\VacansiaRequiest; 12 use App\Http\Requests\VacansiaRequiest;
13 use App\Mail\MailSotrudnichestvo; 13 use App\Mail\MailSotrudnichestvo;
14 use App\Mail\SendAllMessages; 14 use App\Mail\SendAllMessages;
15 use App\Models\Ad_employer; 15 use App\Models\Ad_employer;
16 use App\Models\Ad_jobs; 16 use App\Models\Ad_jobs;
17 use App\Models\ad_response; 17 use App\Models\ad_response;
18 use App\Models\Category; 18 use App\Models\Category;
19 use App\Models\Education; 19 use App\Models\Education;
20 use App\Models\Employer; 20 use App\Models\Employer;
21 use App\Models\employers_main; 21 use App\Models\employers_main;
22 use App\Models\Flot; 22 use App\Models\Flot;
23 use App\Models\Job_title; 23 use App\Models\Job_title;
24 use App\Models\Like_vacancy; 24 use App\Models\Like_vacancy;
25 use App\Models\Like_worker; 25 use App\Models\Like_worker;
26 use App\Models\Message; 26 use App\Models\Message;
27 use App\Models\Positions; 27 use App\Models\Positions;
28 use App\Models\Worker; 28 use App\Models\Worker;
29 use Carbon\Carbon; 29 use Carbon\Carbon;
30 use Illuminate\Auth\Events\Registered; 30 use Illuminate\Auth\Events\Registered;
31 use Illuminate\Database\Eloquent\Builder; 31 use Illuminate\Database\Eloquent\Builder;
32 use Illuminate\Database\Eloquent\Model; 32 use Illuminate\Database\Eloquent\Model;
33 use Illuminate\Foundation\Auth\User; 33 use Illuminate\Foundation\Auth\User;
34 use Illuminate\Http\Request; 34 use Illuminate\Http\Request;
35 use Illuminate\Support\Facades\Auth; 35 use Illuminate\Support\Facades\Auth;
36 use Illuminate\Support\Facades\Hash; 36 use Illuminate\Support\Facades\Hash;
37 use Illuminate\Support\Facades\Mail; 37 use Illuminate\Support\Facades\Mail;
38 use Illuminate\Support\Facades\Storage; 38 use Illuminate\Support\Facades\Storage;
39 use App\Models\User as User_Model; 39 use App\Models\User as User_Model;
40 use Illuminate\Support\Facades\Validator; 40 use Illuminate\Support\Facades\Validator;
41 41
42 class EmployerController extends Controller 42 class EmployerController extends Controller
43 { 43 {
44 public function vacancie($vacancy, Request $request) { 44 public function vacancie($vacancy, Request $request) {
45 $title = 'Заголовок вакансии'; 45 $title = 'Заголовок вакансии';
46 $Query = Ad_employer::with('jobs')-> 46 $Query = Ad_employer::with('jobs')->
47 with('cat')-> 47 with('cat')->
48 with('employer')-> 48 with('employer')->
49 with('jobs_code')-> 49 with('jobs_code')->
50 select('ad_employers.*')-> 50 select('ad_employers.*')->
51 where('id', '=', $vacancy)->get(); 51 where('id', '=', $vacancy)->get();
52 52
53 if (isset(Auth()->user()->id)) 53 if (isset(Auth()->user()->id))
54 $uid = Auth()->user()->id; 54 $uid = Auth()->user()->id;
55 else 55 else
56 $uid = 0; 56 $uid = 0;
57 $title = $Query[0]->name; 57 $title = $Query[0]->name;
58 if ($request->ajax()) { 58 if ($request->ajax()) {
59 return view('ajax.vacance-item', compact('Query','uid')); 59 return view('ajax.vacance-item', compact('Query','uid'));
60 } else { 60 } else {
61 return view('vacance-item', compact('title', 'Query', 'uid')); 61 return view('vacance-item', compact('title', 'Query', 'uid'));
62 } 62 }
63 } 63 }
64 64
65 public function logout() { 65 public function logout() {
66 Auth::logout(); 66 Auth::logout();
67 return redirect()->route('index') 67 return redirect()->route('index')
68 ->with('success', 'Вы вышли из личного кабинета'); 68 ->with('success', 'Вы вышли из личного кабинета');
69 } 69 }
70 70
71 public function employer_info() { 71 public function employer_info() {
72 // код юзера 72 // код юзера
73 $user_info = Auth()->user(); 73 $user_info = Auth()->user();
74 // вьюшка для вывода данных 74 // вьюшка для вывода данных
75 return view('employers.info', compact('user_info')); 75 return view('employers.info', compact('user_info'));
76 } 76 }
77 77
78 public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { 78 public function employer_info_save(User_Model $user, BaseUser_min_Request $request) {
79 // Все данные через реквест 79 // Все данные через реквест
80 $all = $request->all(); 80 $all = $request->all();
81 unset($all['_token']); 81 unset($all['_token']);
82 // обновление 82 // обновление
83 $user->update($all); 83 $user->update($all);
84 return redirect()->route('employer.employer_info'); 84 return redirect()->route('employer.employer_info');
85 } 85 }
86 86
87 public function cabinet() { 87 public function cabinet() {
88 $id = Auth()->user()->id; 88 $id = Auth()->user()->id;
89 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 89 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
90 WhereHas('users', 90 WhereHas('users',
91 function (Builder $query) use ($id) {$query->Where('id', $id); 91 function (Builder $query) use ($id) {$query->Where('id', $id);
92 })->get(); 92 })->get();
93 return view('employers.cabinet45', compact('Employer')); 93 return view('employers.cabinet45', compact('Employer'));
94 } 94 }
95 95
96 public function slider_flot() { 96 public function slider_flot() {
97 $id = Auth()->user()->id; 97 $id = Auth()->user()->id;
98 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 98 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
99 WhereHas('users', 99 WhereHas('users',
100 function (Builder $query) use ($id) {$query->Where('id', $id); 100 function (Builder $query) use ($id) {$query->Where('id', $id);
101 })->get(); 101 })->get();
102 return view('employers.fly-flot', compact('Employer')); 102 return view('employers.fly-flot', compact('Employer'));
103 } 103 }
104 104
105 public function cabinet_save(Employer $Employer, Request $request) { 105 public function cabinet_save(Employer $Employer, Request $request) {
106 $params = $request->all(); 106 $params = $request->all();
107 $params['user_id'] = Auth()->user()->id; 107 $params['user_id'] = Auth()->user()->id;
108 $id = $Employer->id; 108 $id = $Employer->id;
109 109
110 if ($request->has('logo')) { 110 if ($request->has('logo')) {
111 if (!empty($Employer->logo)) { 111 if (!empty($Employer->logo)) {
112 Storage::delete($Employer->logo); 112 Storage::delete($Employer->logo);
113 } 113 }
114 $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); 114 $params['logo'] = $request->file('logo')->store("employer/$id", 'public');
115 } 115 }
116 116
117 $Employer->update($params); 117 $Employer->update($params);
118 118
119 return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); 119 return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены');
120 } 120 }
121 121
122 public function save_add_flot(FlotRequest $request) { 122 public function save_add_flot(FlotRequest $request) {
123 // отмена 123 // отмена
124 $params = $request->all(); 124 $params = $request->all();
125 125
126 if ($request->has('image')) { 126 if ($request->has('image')) {
127 $params['image'] = $request->file('image')->store("flot", 'public'); 127 $params['image'] = $request->file('image')->store("flot", 'public');
128 } 128 }
129 Flot::create($params); 129 Flot::create($params);
130 $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); 130 $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get();
131 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); 131 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен');
132 } 132 }
133 133
134 public function edit_flot(Flot $Flot, Employer $Employer) { 134 public function edit_flot(Flot $Flot, Employer $Employer) {
135 return view('employers.edit-flot', compact('Flot', 'Employer')); 135 return view('employers.edit-flot', compact('Flot', 'Employer'));
136 } 136 }
137 137
138 public function update_flot(FlotRequest $request, Flot $Flot) { 138 public function update_flot(FlotRequest $request, Flot $Flot) {
139 $params = $request->all(); 139 $params = $request->all();
140 140
141 if ($request->has('image')) { 141 if ($request->has('image')) {
142 if (!empty($flot->image)) { 142 if (!empty($flot->image)) {
143 Storage::delete($flot->image); 143 Storage::delete($flot->image);
144 } 144 }
145 $params['image'] = $request->file('image')->store("flot", 'public'); 145 $params['image'] = $request->file('image')->store("flot", 'public');
146 } else { 146 } else {
147 if (!empty($flot->image)) $params['image'] = $flot->image; 147 if (!empty($flot->image)) $params['image'] = $flot->image;
148 } 148 }
149 149
150 $Flot->update($params); 150 $Flot->update($params);
151 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); 151 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен');
152 } 152 }
153 153
154 public function delete_flot(Flot $Flot) { 154 public function delete_flot(Flot $Flot) {
155 $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); 155 $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get();
156 156
157 if (isset($Flot->id)) $Flot->delete(); 157 if (isset($Flot->id)) $Flot->delete();
158 return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); 158 return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален');
159 } 159 }
160 160
161 // Форма добавления вакансий 161 // Форма добавления вакансий
162 public function cabinet_vacancie() { 162 public function cabinet_vacancie() {
163 $id = Auth()->user()->id; 163 $id = Auth()->user()->id;
164 164
165 $categories = Category::query()->active()->get(); 165 $categories = Category::query()->active()->get();
166 //if ($categories->count()) { 166 //if ($categories->count()) {
167 // $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', $categories[0]->id)->get(); 167 // $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', $categories[0]->id)->get();
168 //} else { 168 //} else {
169 // $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', 0)->get(); 169 // $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', 0)->get();
170 //} 170 //}
171 $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->get(); 171 $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->get();
172 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 172 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
173 WhereHas('users', 173 WhereHas('users',
174 function (Builder $query) use ($id) {$query->Where('id', $id); 174 function (Builder $query) use ($id) {$query->Where('id', $id);
175 })->get(); 175 })->get();
176 return view('employers.add_vacancy', compact('Employer', 'jobs' , 'categories')); 176 return view('employers.add_vacancy', compact('Employer', 'jobs' , 'categories'));
177 } 177 }
178 178
179 // Сохранение вакансии 179 // Сохранение вакансии
180 public function cabinet_vacancy_save1(VacancyRequestEdit $request) { 180 public function cabinet_vacancy_save1(VacancyRequestEdit $request) {
181 $params_emp = $request->all(); 181 $params_emp = $request->all();
182 182
183 $params_job["job_title_id"] = $params_emp['job_title_id']; 183 $params_job["job_title_id"] = $params_emp['job_title_id'];
184 //$params_job["min_salary"] = $params_emp['min_salary']; 184 //$params_job["min_salary"] = $params_emp['min_salary'];
185 //$params_job["max_salary"] = $params_emp['max_salary']; 185 //$params_job["max_salary"] = $params_emp['max_salary'];
186 //$params_job["region"] = $params_emp['region']; 186 //$params_job["region"] = $params_emp['region'];
187 //$params_job["power"] = $params_emp['power']; 187 //$params_job["power"] = $params_emp['power'];
188 //$params_job["sytki"] = $params_emp['sytki']; 188 //$params_job["sytki"] = $params_emp['sytki'];
189 //$params_job["start"] = $params_emp['start']; 189 //$params_job["start"] = $params_emp['start'];
190 //$params_job["flot"] = $params_emp['flot']; 190 //$params_job["flot"] = $params_emp['flot'];
191 //$params_job["description"] = $params_emp['description']; 191 //$params_job["description"] = $params_emp['description'];
192 192
193 $ad_jobs = Ad_employer::create($params_emp); 193 $ad_jobs = Ad_employer::create($params_emp);
194 //$params_job['ad_employer_id'] = $ad_jobs->id; 194 //$params_job['ad_employer_id'] = $ad_jobs->id;
195 //Ad_jobs::create($params_job); 195 //Ad_jobs::create($params_job);
196 $ad_jobs->jobs()->sync($request->get('job_title_id')); 196 $ad_jobs->jobs()->sync($request->get('job_title_id'));
197 197
198 return redirect()->route('employer.vacancy_list'); 198 return redirect()->route('employer.vacancy_list');
199 } 199 }
200 200
201 // Список вакансий 201 // Список вакансий
202 public function vacancy_list(Request $request) { 202 public function vacancy_list(Request $request) {
203 $id = Auth()->user()->id; 203 $id = Auth()->user()->id;
204 $Employer = Employer::query()->where('user_id', $id)->first(); 204 $Employer = Employer::query()->where('user_id', $id)->first();
205 $vacancy_list = Ad_employer::query()->with('jobs')-> 205 $vacancy_list = Ad_employer::query()->with('jobs')->
206 with('jobs_code')-> 206 with('jobs_code')->
207 where('employer_id', $Employer->id); 207 where('employer_id', $Employer->id);
208 208
209 if ($request->get('sort')) { 209 if ($request->get('sort')) {
210 $sort = $request->get('sort'); 210 $sort = $request->get('sort');
211 switch ($sort) { 211 switch ($sort) {
212 case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; 212 case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break;
213 case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; 213 case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break;
214 case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; 214 case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break;
215 case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; 215 case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break;
216 case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; 216 case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break;
217 default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; 217 default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break;
218 } 218 }
219 } 219 }
220 $vacancy_list = $vacancy_list->paginate(4); 220 $vacancy_list = $vacancy_list->paginate(4);
221 221
222 //ajax 222 //ajax
223 if ($request->ajax()) { 223 if ($request->ajax()) {
224 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); 224 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer'));
225 } else { 225 } else {
226 return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); 226 return view('employers.list_vacancy', compact('vacancy_list', 'Employer'));
227 } 227 }
228 } 228 }
229 229
230 // Карточка вакансии 230 // Карточка вакансии
231 public function vacancy_edit(Ad_employer $ad_employer) { 231 public function vacancy_edit(Ad_employer $ad_employer) {
232 $id = Auth()->user()->id; 232 $id = Auth()->user()->id;
233
234 $Positions = Category::query()->where('is_remove', '=', '0')->get(); 233 $Positions = Category::query()->where('is_remove', '=', '0')->get();
235 //if ($Positions->count()) {
236 // $jobs = Job_title::query()->OrderBy('name')->where('position_id', $Positions[0]->id)->get();
237 //} else {
238 // $jobs = Job_title::query()->OrderBy('name')->where('position_id', 0)->get();
239 //}
240 $jobs = Job_title::query()->OrderBy('name')->where('is_remove', 0)->get(); 234 $jobs = Job_title::query()->OrderBy('name')->where('is_remove', 0)->get();
241 235
242 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 236 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
243 where('user_id', $id)->first(); 237 where('user_id', $id)->first();
244 238
245 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); 239 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs'));
246 } 240 }
247 241
248 // Сохранение-редактирование записи 242 // Сохранение-редактирование записи
249 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { 243 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) {
250 $params = $request->all(); 244 $params = $request->all();
251 245
252 //$jobs['flot'] = $params['flot']; 246 //$jobs['flot'] = $params['flot'];
253 //$jobs['job_title_id'] = $params['job_title_id']; 247 //$jobs['job_title_id'] = $params['job_title_id'];
254 //$titles['position_id'] = $params['position_id']; 248 //$titles['position_id'] = $params['position_id'];
255 //unset($params['job_title_id']); 249 //unset($params['job_title_id']);
256 250
257 $ad_employer->update($params); 251 $ad_employer->update($params);
258 252
259 //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> 253 //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])->
260 // where('ad_employer_id', $ad_employer->id)->first(); 254 // where('ad_employer_id', $ad_employer->id)->first();
261 //$data = Ad_jobs::find($job_->id); 255 //$data = Ad_jobs::find($job_->id);
262 //$ad_jobs = $data->update($jobs); 256 //$ad_jobs = $data->update($jobs);
263 257
264 return redirect()->route('employer.vacancy_list'); 258 return redirect()->route('employer.vacancy_list');
265 } 259 }
266 260
267 // Сохранение карточки вакансии 261 // Сохранение карточки вакансии
268 public function vacancy_save(Request $request, Ad_employer $ad_employer) { 262 public function vacancy_save(Request $request, Ad_employer $ad_employer) {
269 $all = $request->all(); 263 $all = $request->all();
270 $ad_employer->update($all); 264 $ad_employer->update($all);
271 return redirect()->route('employer.cabinet_vacancie'); 265 return redirect()->route('employer.cabinet_vacancie');
272 } 266 }
273 267
274 // Удаление карточки вакансии 268 // Удаление карточки вакансии
275 public function vacancy_delete(Ad_employer $ad_employer) { 269 public function vacancy_delete(Ad_employer $ad_employer) {
276 $ad_employer->delete(); 270 $ad_employer->delete();
277 271
278 return redirect()->route('employer.vacancy_list') 272 return redirect()->route('employer.vacancy_list')
279 ->with('success', 'Данные были успешно сохранены'); 273 ->with('success', 'Данные были успешно сохранены');
280 } 274 }
281 275
282 // Обновление даты 276 // Обновление даты
283 public function vacancy_up(Ad_employer $ad_employer) { 277 public function vacancy_up(Ad_employer $ad_employer) {
284 $up = date('m/d/Y h:i:s', time());; 278 $up = date('m/d/Y h:i:s', time());;
285 $vac_emp = Ad_employer::findOrFail($ad_employer->id); 279 $vac_emp = Ad_employer::findOrFail($ad_employer->id);
286 $vac_emp->updated_at = $up; 280 $vac_emp->updated_at = $up;
287 $vac_emp->save(); 281 $vac_emp->save();
288 282
289 return redirect()->route('employer.vacancy_list'); 283 return redirect()->route('employer.vacancy_list');
290 // начало конца 284 // начало конца
291 } 285 }
292 286
293 //Видимость вакансии 287 //Видимость вакансии
294 public function vacancy_eye(Ad_employer $ad_employer, $status) { 288 public function vacancy_eye(Ad_employer $ad_employer, $status) {
295 $vac_emp = Ad_employer::findOrFail($ad_employer->id); 289 $vac_emp = Ad_employer::findOrFail($ad_employer->id);
296 $vac_emp->active_is = $status; 290 $vac_emp->active_is = $status;
297 $vac_emp->save(); 291 $vac_emp->save();
298 292
299 return redirect()->route('employer.vacancy_list'); 293 return redirect()->route('employer.vacancy_list');
300 } 294 }
301 295
302 //Вакансия редактирования (шаблон) 296 //Вакансия редактирования (шаблон)
303 public function vacancy_update(Ad_employer $id) { 297 public function vacancy_update(Ad_employer $id) {
304 298
305 } 299 }
306 300
307 //Отклики на вакансию - лист 301 //Отклики на вакансию - лист
308 public function answers(Employer $employer, Request $request) { 302 public function answers(Employer $employer, Request $request) {
309 $user_id = Auth()->user()->id; 303 $user_id = Auth()->user()->id;
310 $answer = Ad_employer::query()->where('employer_id', $employer->id); 304 $answer = Ad_employer::query()->where('employer_id', $employer->id);
311 if ($request->has('search')) { 305 if ($request->has('search')) {
312 $search = trim($request->get('search')); 306 $search = trim($request->get('search'));
313 if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); 307 if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%");
314 } 308 }
315 309
316 $answer = $answer->with('response')->get(); 310 $answer = $answer->with('response')->get();
317 311
318 return view('employers.list_answer', compact('answer', 'user_id', 'employer')); 312 return view('employers.list_answer', compact('answer', 'user_id', 'employer'));
319 } 313 }
320 314
321 //Обновление статуса 315 //Обновление статуса
322 public function supple_status(employer $employer, ad_response $ad_response, $flag) { 316 public function supple_status(employer $employer, ad_response $ad_response, $flag) {
323 $ad_response->update(Array('flag' => $flag)); 317 $ad_response->update(Array('flag' => $flag));
324 return redirect()->route('employer.answers', ['employer' => $employer->id]); 318 return redirect()->route('employer.answers', ['employer' => $employer->id]);
325 } 319 }
326 320
327 //Страницы сообщений список 321 //Страницы сообщений список
328 public function messages($type_message) { 322 public function messages($type_message) {
329 $user_id = Auth()->user()->id; 323 $user_id = Auth()->user()->id;
330 324
331 $messages_input = Message::query()->with('vacancies')->with('user_from')-> 325 $messages_input = Message::query()->with('vacancies')->with('user_from')->
332 Where('to_user_id', $user_id)->OrderByDesc('created_at'); 326 Where('to_user_id', $user_id)->OrderByDesc('created_at');
333 327
334 $messages_output = Message::query()->with('vacancies')-> 328 $messages_output = Message::query()->with('vacancies')->
335 with('user_to')->where('user_id', $user_id)-> 329 with('user_to')->where('user_id', $user_id)->
336 OrderByDesc('created_at'); 330 OrderByDesc('created_at');
337 331
338 332
339 $count_input = $messages_input->count(); 333 $count_input = $messages_input->count();
340 $count_output = $messages_output->count(); 334 $count_output = $messages_output->count();
341 335
342 if ($type_message == 'input') { 336 if ($type_message == 'input') {
343 $messages = $messages_input->paginate(5); 337 $messages = $messages_input->paginate(5);
344 } 338 }
345 339
346 if ($type_message == 'output') { 340 if ($type_message == 'output') {
347 $messages = $messages_output->paginate(5); 341 $messages = $messages_output->paginate(5);
348 } 342 }
349 343
350 //dd($user_id, $messages[2]->vacancies); 344 //dd($user_id, $messages[2]->vacancies);
351 //jobs); 345 //jobs);
352 346
353 return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); 347 return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id'));
354 } 348 }
355 349
356 // Диалог между пользователями 350 // Диалог между пользователями
357 public function dialog(Request $request, User_Model $user1, User_Model $user2) { 351 public function dialog(Request $request, User_Model $user1, User_Model $user2) {
358 // Получение параметров. 352 // Получение параметров.
359 if ($request->has('ad_employer')){ 353 if ($request->has('ad_employer')){
360 $ad_employer = $request->get('ad_employer'); 354 $ad_employer = $request->get('ad_employer');
361 } else { 355 } else {
362 $ad_employer = 0; 356 $ad_employer = 0;
363 } 357 }
364 358
365 if (isset($user2->id)) { 359 if (isset($user2->id)) {
366 $companion = User_Model::query()->with('workers')-> 360 $companion = User_Model::query()->with('workers')->
367 with('employers')-> 361 with('employers')->
368 where('id', $user2->id)->first(); 362 where('id', $user2->id)->first();
369 } 363 }
370 364
371 $Messages = Message::query()-> 365 $Messages = Message::query()->
372 where('ad_employer_id', '=', $ad_employer)-> 366 where('ad_employer_id', '=', $ad_employer)->
373 where(function($query) use ($user1, $user2) { 367 where(function($query) use ($user1, $user2) {
374 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); 368 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id);
375 })->orWhere(function($query) use ($user1, $user2) { 369 })->orWhere(function($query) use ($user1, $user2) {
376 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); 370 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id);
377 })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get(); 371 })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get();
378 372
379 $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; 373 $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id;
380 374
381 //$ad_employer = null; 375 //$ad_employer = null;
382 //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); 376 //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first();
383 $sender = $user1; 377 $sender = $user1;
384 378
385 return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); 379 return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages'));
386 } 380 }
387 381
388 // Регистрация работодателя 382 // Регистрация работодателя
389 public function register_employer(Request $request) { 383 public function register_employer(Request $request) {
390 $params = $request->all(); 384 $params = $request->all();
391 385
392 $rules = [ 386 $rules = [
393 //'surname' => ['required', 'string', 'max:255'], 387 //'surname' => ['required', 'string', 'max:255'],
394 //'name_man' => ['required', 'string', 'max:255'], 388 //'name_man' => ['required', 'string', 'max:255'],
395 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 389 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
396 'name_company' => ['required', 'string', 'max:255'], 390 'name_company' => ['required', 'string', 'max:255'],
397 'password' => ['required', 'string', 'min:6'], 391 'password' => ['required', 'string', 'min:6'],
398 ]; 392 ];
399 393
400 394
401 $messages = [ 395 $messages = [
402 'required' => 'Укажите обязательное поле', 396 'required' => 'Укажите обязательное поле',
403 'min' => [ 397 'min' => [
404 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 398 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
405 'integer' => 'Поле «:attribute» должно быть :min или больше', 399 'integer' => 'Поле «:attribute» должно быть :min или больше',
406 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 400 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
407 ], 401 ],
408 'max' => [ 402 'max' => [
409 'string' => 'Поле «:attribute» должно быть не больше :max символов', 403 'string' => 'Поле «:attribute» должно быть не больше :max символов',
410 'integer' => 'Поле «:attribute» должно быть :max или меньше', 404 'integer' => 'Поле «:attribute» должно быть :max или меньше',
411 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 405 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
412 ] 406 ]
413 ]; 407 ];
414 408
415 $email = $request->get('email'); 409 $email = $request->get('email');
416 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { 410 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) {
417 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); 411 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл"));
418 } 412 }
419 413
420 if ($request->get('password') !== $request->get('confirmed')){ 414 if ($request->get('password') !== $request->get('confirmed')){
421 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); 415 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля"));
422 } 416 }
423 417
424 if (strlen($request->get('password')) < 6) { 418 if (strlen($request->get('password')) < 6) {
425 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); 419 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!"));
426 } 420 }
427 /* 421 /*
428 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); 422 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?');
429 $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 423 $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z',
430 'X', 'C', 'V', 'B', 'N', 'M'); 424 'X', 'C', 'V', 'B', 'N', 'M');
431 $spec_bool = false; 425 $spec_bool = false;
432 $alpha_bool = false; 426 $alpha_bool = false;
433 427
434 $haystack = $request->get('password'); 428 $haystack = $request->get('password');
435 429
436 foreach ($specsumbol as $it) { 430 foreach ($specsumbol as $it) {
437 if (strpos($haystack, $it) !== false) { 431 if (strpos($haystack, $it) !== false) {
438 $spec_bool = true; 432 $spec_bool = true;
439 } 433 }
440 } 434 }
441 435
442 foreach ($alpha as $it) { 436 foreach ($alpha as $it) {
443 if (strpos($haystack, $it) !== false) { 437 if (strpos($haystack, $it) !== false) {
444 $alpha_bool = true; 438 $alpha_bool = true;
445 } 439 }
446 } 440 }
447 441
448 if ((!$spec_bool) || (!$alpha_bool)) { 442 if ((!$spec_bool) || (!$alpha_bool)) {
449 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); 443 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?"));
450 }*/ 444 }*/
451 445
452 if (empty($request->get('surname'))) { 446 if (empty($request->get('surname'))) {
453 $params['surname'] = 'Неизвестно'; 447 $params['surname'] = 'Неизвестно';
454 } 448 }
455 if (empty($request->get('name_man'))) { 449 if (empty($request->get('name_man'))) {
456 $params['name_man'] = 'Неизвестно'; 450 $params['name_man'] = 'Неизвестно';
457 } 451 }
458 $validator = Validator::make($params, $rules, $messages); 452 $validator = Validator::make($params, $rules, $messages);
459 453
460 if ($validator->fails()) { 454 if ($validator->fails()) {
461 return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); 455 return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе."));
462 } else { 456 } else {
463 $user = $this->create($params); 457 $user = $this->create($params);
464 event(new Registered($user)); 458 event(new Registered($user));
465 Auth::guard()->login($user); 459 Auth::guard()->login($user);
466 } 460 }
467 461
468 if ($user) { 462 if ($user) {
469 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; 463 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));;
470 } else { 464 } else {
471 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); 465 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!"));
472 } 466 }
473 } 467 }
474 468
475 // Создание пользователя 469 // Создание пользователя
476 protected function create(array $data) 470 protected function create(array $data)
477 { 471 {
478 $Use = new User_Model(); 472 $Use = new User_Model();
479 $Code_user = $Use->create([ 473 $Code_user = $Use->create([
480 'name' => $data['surname']." ".$data['name_man'], 474 'name' => $data['surname']." ".$data['name_man'],
481 'name_man' => $data['name_man'], 475 'name_man' => $data['name_man'],
482 'surname' => $data['surname'], 476 'surname' => $data['surname'],
483 'surname2' => $data['surname2'], 477 'surname2' => $data['surname2'],
484 'subscribe_email' => $data['email'], 478 'subscribe_email' => $data['email'],
485 'email' => $data['email'], 479 'email' => $data['email'],
486 'telephone' => $data['telephone'], 480 'telephone' => $data['telephone'],
487 'is_worker' => 0, 481 'is_worker' => 0,
488 'password' => Hash::make($data['password']), 482 'password' => Hash::make($data['password']),
489 'pubpassword' => base64_encode($data['password']), 483 'pubpassword' => base64_encode($data['password']),
490 'email_verified_at' => Carbon::now() 484 'email_verified_at' => Carbon::now()
491 ]); 485 ]);
492 486
493 if ($Code_user->id > 0) { 487 if ($Code_user->id > 0) {
494 $Employer = new Employer(); 488 $Employer = new Employer();
495 $Employer->user_id = $Code_user->id; 489 $Employer->user_id = $Code_user->id;
496 $Employer->name_company = $data['name_company']; 490 $Employer->name_company = $data['name_company'];
497 $Employer->email = $data['email']; 491 $Employer->email = $data['email'];
498 $Employer->telephone = $data['telephone']; 492 $Employer->telephone = $data['telephone'];
499 $Employer->code = Tools::generator_id(10); 493 $Employer->code = Tools::generator_id(10);
500 $Employer->save(); 494 $Employer->save();
501 495
502 return $Code_user; 496 return $Code_user;
503 } 497 }
504 } 498 }
505 499
506 // Отправка сообщения от работодателя 500 // Отправка сообщения от работодателя
507 public function send_message(MessagesRequiest $request) { 501 public function send_message(MessagesRequiest $request) {
508 $params = $request->all(); 502 $params = $request->all();
509 dd($params); 503 dd($params);
510 $user1 = $params['user_id']; 504 $user1 = $params['user_id'];
511 $user2 = $params['to_user_id']; 505 $user2 = $params['to_user_id'];
512 506
513 if ($request->has('file')) { 507 if ($request->has('file')) {
514 $params['file'] = $request->file('file')->store("messages", 'public'); 508 $params['file'] = $request->file('file')->store("messages", 'public');
515 } 509 }
516 Message::create($params); 510 Message::create($params);
517 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); 511 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
518 } 512 }
519 513
520 public function test123(Request $request) { 514 public function test123(Request $request) {
521 $params = $request->all(); 515 $params = $request->all();
522 $user1 = $params['user_id']; 516 $user1 = $params['user_id'];
523 $user2 = $params['to_user_id']; 517 $user2 = $params['to_user_id'];
524 518
525 $rules = [ 519 $rules = [
526 'text' => 'required|min:1|max:150000', 520 'text' => 'required|min:1|max:150000',
527 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' 521 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000'
528 ]; 522 ];
529 $messages = [ 523 $messages = [
530 'required' => 'Укажите обязательное поле', 524 'required' => 'Укажите обязательное поле',
531 'min' => [ 525 'min' => [
532 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 526 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
533 'integer' => 'Поле «:attribute» должно быть :min или больше', 527 'integer' => 'Поле «:attribute» должно быть :min или больше',
534 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 528 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
535 ], 529 ],
536 'max' => [ 530 'max' => [
537 'string' => 'Поле «:attribute» должно быть не больше :max символов', 531 'string' => 'Поле «:attribute» должно быть не больше :max символов',
538 'integer' => 'Поле «:attribute» должно быть :max или меньше', 532 'integer' => 'Поле «:attribute» должно быть :max или меньше',
539 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 533 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
540 ] 534 ]
541 ]; 535 ];
542 536
543 $validator = Validator::make($request->all(), $rules, $messages); 537 $validator = Validator::make($request->all(), $rules, $messages);
544 538
545 if ($validator->fails()) { 539 if ($validator->fails()) {
546 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) 540 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2])
547 ->withErrors($validator); 541 ->withErrors($validator);
548 } else { 542 } else {
549 if ($request->has('file')) { 543 if ($request->has('file')) {
550 $params['file'] = $request->file('file')->store("messages", 'public'); 544 $params['file'] = $request->file('file')->store("messages", 'public');
551 } 545 }
552 Message::create($params); 546 Message::create($params);
553 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); 547 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
554 548
555 } 549 }
556 } 550 }
557 551
558 //Избранные люди 552 //Избранные люди
559 public function favorites(Request $request) { 553 public function favorites(Request $request) {
560 $IP_address = RusDate::ip_addr_client(); 554 $IP_address = RusDate::ip_addr_client();
561 $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); 555 $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get();
562 556
563 if ($Arr->count()) { 557 if ($Arr->count()) {
564 $A = Array(); 558 $A = Array();
565 foreach ($Arr as $it) { 559 foreach ($Arr as $it) {
566 $A[] = $it->code_record; 560 $A[] = $it->code_record;
567 } 561 }
568 562
569 $Workers = Worker::query()->whereIn('id', $A); 563 $Workers = Worker::query()->whereIn('id', $A);
570 } else { 564 } else {
571 $Workers = Worker::query()->where('id', '=', '0'); 565 $Workers = Worker::query()->where('id', '=', '0');
572 } 566 }
573 567
574 if (($request->has('search')) && (!empty($request->get('search')))) { 568 if (($request->has('search')) && (!empty($request->get('search')))) {
575 $search = $request->get('search'); 569 $search = $request->get('search');
576 570
577 $Workers = $Workers->WhereHas('users', 571 $Workers = $Workers->WhereHas('users',
578 function (Builder $query) use ($search) { 572 function (Builder $query) use ($search) {
579 $query->Where('surname', 'LIKE', "%$search%") 573 $query->Where('surname', 'LIKE', "%$search%")
580 ->orWhere('name_man', 'LIKE', "%$search%") 574 ->orWhere('name_man', 'LIKE', "%$search%")
581 ->orWhere('surname2', 'LIKE', "%$search%"); 575 ->orWhere('surname2', 'LIKE', "%$search%");
582 }); 576 });
583 } else { 577 } else {
584 $Workers = $Workers->with('users'); 578 $Workers = $Workers->with('users');
585 } 579 }
586 580
587 $Workers = $Workers->get(); 581 $Workers = $Workers->get();
588 582
589 583
590 return view('employers.favorite', compact('Workers')); 584 return view('employers.favorite', compact('Workers'));
591 } 585 }
592 586
593 // База данных 587 // База данных
594 public function bd(Request $request) { 588 public function bd(Request $request) {
595 // для типа BelongsTo 589 // для типа BelongsTo
596 //$documents = Document::query()->orderBy(Location::select('name') 590 //$documents = Document::query()->orderBy(Location::select('name')
597 // ->whereColumn('locations.id', 'documents.location_id') 591 // ->whereColumn('locations.id', 'documents.location_id')
598 //); 592 //);
599 593
600 // для типа HasOne/Many 594 // для типа HasOne/Many
601 // $documents = Document::::query()->orderBy(Location::select('name') 595 // $documents = Document::::query()->orderBy(Location::select('name')
602 // ->whereColumn('locations.document_id', 'documents.id') 596 // ->whereColumn('locations.document_id', 'documents.id')
603 //); 597 //);
604 598
605 599
606 $users = User_Model::query()->with('workers'); 600 $users = User_Model::query()->with('workers');
607 601
608 if ($request->has('search')) { 602 if ($request->has('search')) {
609 $find_key = $request->get('search'); 603 $find_key = $request->get('search');
610 $users = $users->where('name', 'LIKE', "%$find_key%") 604 $users = $users->where('name', 'LIKE', "%$find_key%")
611 ->orWhere('surname', 'LIKE', "%$find_key%") 605 ->orWhere('surname', 'LIKE', "%$find_key%")
612 ->orWhere('name_man', 'LIKE', "%$find_key%") 606 ->orWhere('name_man', 'LIKE', "%$find_key%")
613 ->orWhere('email', 'LIKE', "%$find_key%") 607 ->orWhere('email', 'LIKE', "%$find_key%")
614 ->orWhere('telephone', 'LIKE', "%$find_key%"); 608 ->orWhere('telephone', 'LIKE', "%$find_key%");
615 } 609 }
616 610
617 // Данные 611 // Данные
618 $users = $users->Baseuser()-> 612 $users = $users->Baseuser()->
619 orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id')); 613 orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id'));
620 $count_users = $users; 614 $count_users = $users;
621 $users = $users->paginate(5); 615 $users = $users->paginate(5);
622 616
623 617
624 return view('employers.bd', compact('users', 'count_users')); 618 return view('employers.bd', compact('users', 'count_users'));
625 } 619 }
626 620
627 //Настройка уведомлений 621 //Настройка уведомлений
628 public function subscribe() { 622 public function subscribe() {
629 return view('employers.subcribe'); 623 return view('employers.subcribe');
630 } 624 }
631 625
632 //Установка уведомлений сохранение 626 //Установка уведомлений сохранение
633 public function save_subscribe(Request $request) { 627 public function save_subscribe(Request $request) {
634 dd($request->all()); 628 dd($request->all());
635 $msg = $request->validate([ 629 $msg = $request->validate([
636 'subscribe_email' => 'required|email|min:5|max:255', 630 'subscribe_email' => 'required|email|min:5|max:255',
637 ]); 631 ]);
638 return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); 632 return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку');
639 } 633 }
640 634
641 //Сбросить форму с паролем 635 //Сбросить форму с паролем
642 public function password_reset() { 636 public function password_reset() {
643 $email = Auth()->user()->email; 637 $email = Auth()->user()->email;
644 return view('employers.password-reset', compact('email')); 638 return view('employers.password-reset', compact('email'));
645 } 639 }
646 640
647 //Обновление пароля 641 //Обновление пароля
648 public function new_password(Request $request) { 642 public function new_password(Request $request) {
649 $use = Auth()->user(); 643 $use = Auth()->user();
650 $request->validate([ 644 $request->validate([
651 'password' => 'required|string', 645 'password' => 'required|string',
652 'new_password' => 'required|string', 646 'new_password' => 'required|string',
653 'new_password2' => 'required|string' 647 'new_password2' => 'required|string'
654 ]); 648 ]);
655 649
656 if ($request->get('new_password') == $request->get('new_password2')) 650 if ($request->get('new_password') == $request->get('new_password2'))
657 if ($request->get('password') !== $request->get('new_password')) { 651 if ($request->get('password') !== $request->get('new_password')) {
658 $credentials = $request->only('email', 'password'); 652 $credentials = $request->only('email', 'password');
659 if (Auth::attempt($credentials)) { 653 if (Auth::attempt($credentials)) {
660 654
661 if (!is_null($use->email_verified_at)){ 655 if (!is_null($use->email_verified_at)){
662 656
663 $user_data = User_Model::find($use->id); 657 $user_data = User_Model::find($use->id);
664 $user_data->update([ 658 $user_data->update([
665 'password' => Hash::make($request->get('new_password')), 659 'password' => Hash::make($request->get('new_password')),
666 'pubpassword' => base64_encode($request->get('new_password')), 660 'pubpassword' => base64_encode($request->get('new_password')),
667 ]); 661 ]);
668 return redirect() 662 return redirect()
669 ->route('employer.password_reset') 663 ->route('employer.password_reset')
670 ->with('success', 'Поздравляю! Вы обновили свой пароль!'); 664 ->with('success', 'Поздравляю! Вы обновили свой пароль!');
671 } 665 }
672 666
673 return redirect() 667 return redirect()
674 ->route('employer.password_reset') 668 ->route('employer.password_reset')
675 ->withError('Данная учетная запись не было верифицированна!'); 669 ->withError('Данная учетная запись не было верифицированна!');
676 } 670 }
677 } 671 }
678 672
679 return redirect() 673 return redirect()
680 ->route('employer.password_reset') 674 ->route('employer.password_reset')
681 ->withErrors('Не совпадение данных, обновите пароли!'); 675 ->withErrors('Не совпадение данных, обновите пароли!');
682 } 676 }
683 677
684 678
685 679
686 // Форма Удаление пипла 680 // Форма Удаление пипла
687 public function delete_people() { 681 public function delete_people() {
688 $login = Auth()->user()->email; 682 $login = Auth()->user()->email;
689 return view('employers.delete_people', compact('login')); 683 return view('employers.delete_people', compact('login'));
690 } 684 }
691 685
692 // Удаление аккаунта 686 // Удаление аккаунта
693 public function action_delete_user(Request $request) { 687 public function action_delete_user(Request $request) {
694 $Answer = $request->all(); 688 $Answer = $request->all();
695 $user_id = Auth()->user()->id; 689 $user_id = Auth()->user()->id;
696 $request->validate([ 690 $request->validate([
697 'password' => 'required|string', 691 'password' => 'required|string',
698 ]); 692 ]);
699 693
700 $credentials = $request->only('email', 'password'); 694 $credentials = $request->only('email', 'password');
701 if (Auth::attempt($credentials)) { 695 if (Auth::attempt($credentials)) {
702 Auth::logout(); 696 Auth::logout();
703 $it = User_Model::find($user_id); 697 $it = User_Model::find($user_id);
704 $it->delete(); 698 $it->delete();
705 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); 699 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт');
706 } else { 700 } else {
707 return redirect()->route('employer.delete_people') 701 return redirect()->route('employer.delete_people')
708 ->withErrors( 'Неверный пароль! Нужен корректный пароль'); 702 ->withErrors( 'Неверный пароль! Нужен корректный пароль');
709 } 703 }
710 } 704 }
711 705
712 public function ajax_delete_user(Request $request) { 706 public function ajax_delete_user(Request $request) {
713 $Answer = $request->all(); 707 $Answer = $request->all();
714 $user_id = Auth()->user()->id; 708 $user_id = Auth()->user()->id;
715 $request->validate([ 709 $request->validate([
716 'password' => 'required|string', 710 'password' => 'required|string',
717 ]); 711 ]);
718 $credentials = $request->only('email', 'password'); 712 $credentials = $request->only('email', 'password');
719 if (Auth::attempt($credentials)) { 713 if (Auth::attempt($credentials)) {
720 714
721 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', 715 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт',
722 'email' => $request->get('email'), 716 'email' => $request->get('email'),
723 'password' => $request->get('password'))); 717 'password' => $request->get('password')));
724 } else { 718 } else {
725 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); 719 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль'));
726 } 720 }
727 } 721 }
728 722
729 // FAQ - Вопросы/ответы для работодателей и соискателей 723 // FAQ - Вопросы/ответы для работодателей и соискателей
730 public function faq() { 724 public function faq() {
731 return view('employers.faq'); 725 return view('employers.faq');
732 } 726 }
733 727
734 // Рассылка сообщений 728 // Рассылка сообщений
735 public function send_all_messages() { 729 public function send_all_messages() {
736 return view('employers.send_all'); 730 return view('employers.send_all');
737 } 731 }
738 732
739 // Отправка сообщений для информации 733 // Отправка сообщений для информации
740 public function send_all_post(Request $request) { 734 public function send_all_post(Request $request) {
741 $data = $request->all(); 735 $data = $request->all();
742 736
743 $emails = User_Model::query()->where('is_worker', '1')->get(); 737 $emails = User_Model::query()->where('is_worker', '1')->get();
744 738
745 foreach ($emails as $e) { 739 foreach ($emails as $e) {
746 Mail::to($e->email)->send(new SendAllMessages($data)); 740 Mail::to($e->email)->send(new SendAllMessages($data));
747 } 741 }
748 742
749 return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); 743 return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены');
750 } 744 }
751 745
752 // База резюме 746 // База резюме
753 public function bd_tupe(Request $request) { 747 public function bd_tupe(Request $request) {
754 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); 748 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get();
755 749
756 return view('employers.bd_tupe', compact('Resume')); 750 return view('employers.bd_tupe', compact('Resume'));
757 } 751 }
758 752
759 ////////////////////////////////////////////////////////////////// 753 //////////////////////////////////////////////////////////////////
760 // Отправил сообщение 754 // Отправил сообщение
761 ////////////////////////////////////////////////////////////////// 755 //////////////////////////////////////////////////////////////////
762 public function new_message(Request $request) { 756 public function new_message(Request $request) {
763 $params = $request->all(); 757 $params = $request->all();
764 $id = $params['_user_id']; 758 $id = $params['_user_id'];
765 $message = new Message(); 759 $message = new Message();
766 $message->user_id = $params['_user_id']; 760 $message->user_id = $params['_user_id'];
767 $message->to_user_id = $params['_to_user_id']; 761 $message->to_user_id = $params['_to_user_id'];
768 $message->title = $params['title']; 762 $message->title = $params['title'];
769 $message->text = $params['text']; 763 $message->text = $params['text'];
770 if ($request->has('_file')) { 764 if ($request->has('_file')) {
771 $message->file = $request->file('_file')->store("worker/$id", 'public'); 765 $message->file = $request->file('_file')->store("worker/$id", 'public');
772 } 766 }
773 $message->ad_employer_id = $params['_vacancy']; 767 $message->ad_employer_id = $params['_vacancy'];
774 $message->flag_new = 1; 768 $message->flag_new = 1;
775 $id_message = $message->save(); 769 $id_message = $message->save();
776 770
777 //$data['message_id'] = $id_message; 771 //$data['message_id'] = $id_message;
778 //$data['ad_employer_id'] = $params['_vacancy']; 772 //$data['ad_employer_id'] = $params['_vacancy'];
779 //$data['job_title_id'] = 0; 773 //$data['job_title_id'] = 0;
780 774
781 $data['flag'] = 1; 775 $data['flag'] = 1;
782 //$ad_responce = ad_response::create($data); 776 //$ad_responce = ad_response::create($data);
783 return redirect()->route('employer.messages', ['type_message' => 'output']); 777 return redirect()->route('employer.messages', ['type_message' => 'output']);
784 } 778 }
785 779
786 // Восстановление пароля 780 // Восстановление пароля
787 public function repair_password(Request $request) { 781 public function repair_password(Request $request) {
788 $params = $request->get('email'); 782 $params = $request->get('email');
789 } 783 }
790 784
791 // Избранные люди на корабль 785 // Избранные люди на корабль
792 public function selected_people(Request $request) { 786 public function selected_people(Request $request) {
793 $id = $request->get('id'); 787 $id = $request->get('id');
794 $favorite_people = Job_title::query()->Notbdif()->where('is_remove', '=', '0')->where('position_id', $id)->get(); 788 $favorite_people = Job_title::query()->Notbdif()->where('is_remove', '=', '0')->where('position_id', $id)->get();
795 return view('favorite_people', compact('favorite_people')); 789 return view('favorite_people', compact('favorite_people'));
796 } 790 }
797 } 791 }
798 792
resources/views/employers/add_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', '#category_id', function() { 6 $(document).on('change', '#category_id', function() {
7 var this_ = $(this); 7 var this_ = $(this);
8 var val_ = this_.val(); 8 var val_ = this_.val();
9 var ajax_ = $('#job_title_id'); 9 var ajax_ = $('#job_title_id');
10 10
11 console.log('Создания списка людей, которые поднимутся на корабль...'); 11 console.log('Создания списка людей, которые поднимутся на корабль...');
12 12
13 $.ajax({ 13 $.ajax({
14 type: "GET", 14 type: "GET",
15 url: "{{ route('employer.selected_people') }}", 15 url: "{{ route('employer.selected_people') }}",
16 data: "id="+val_, 16 data: "id="+val_,
17 success: function (data) { 17 success: function (data) {
18 console.log('Ответка пришла'); 18 console.log('Ответка пришла');
19 console.log('Список избранных людей создан'); 19 console.log('Список избранных людей создан');
20 ajax_.html(data); 20 ajax_.html(data);
21 }, 21 },
22 headers: { 22 headers: {
23 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 23 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
24 }, 24 },
25 error: function (data) { 25 error: function (data) {
26 console.log('Обрыв связи'); 26 console.log('Обрыв связи');
27 console.log('Error: ' + data); 27 console.log('Error: ' + data);
28 } 28 }
29 }); 29 });
30 }); 30 });
31 </script> 31 </script>
32 @endsection 32 @endsection
33 @section('content') 33 @section('content')
34 <section class="cabinet"> 34 <section class="cabinet">
35 <div class="container"> 35 <div class="container">
36 <ul class="breadcrumbs cabinet__breadcrumbs"> 36 <ul class="breadcrumbs cabinet__breadcrumbs">
37 <li><a href="{{ route('index') }}">Главная</a></li> 37 <li><a href="{{ route('index') }}">Главная</a></li>
38 <li><b>Личный кабинет</b></li> 38 <li><b>Личный кабинет</b></li>
39 </ul> 39 </ul>
40 <div class="cabinet__wrapper"> 40 <div class="cabinet__wrapper">
41 <div class="cabinet__side"> 41 <div class="cabinet__side">
42 <div class="cabinet__side-toper"> 42 <div class="cabinet__side-toper">
43 43
44 @include('employers.emblema') 44 @include('employers.emblema')
45 45
46 </div> 46 </div>
47 47
48 @include('employers.menu', ['item' => 2]) 48 @include('employers.menu', ['item' => 2])
49 49
50 </div> 50 </div>
51 51
52 <form class="cabinet__body" action="{{ route('employer.vac_save') }}" method="POST"> 52 <form class="cabinet__body" action="{{ route('employer.vac_save') }}" method="POST">
53 @csrf 53 @csrf
54 <input type="hidden" name="employer_id" value="{{ $Employer[0]->id }}"/> 54 <input type="hidden" name="employer_id" value="{{ $Employer[0]->id }}"/>
55 <div class="cabinet__body-item"> 55 <div class="cabinet__body-item">
56 <div class="cabinet__descr"> 56 <div class="cabinet__descr">
57 <h2 class="title cabinet__title">Разместить вакансию</h2> 57 <h2 class="title cabinet__title">Разместить вакансию</h2>
58 <p class="cabinet__text"><b>Данные по вакансии</b></p> 58 <p class="cabinet__text"><b>Данные по вакансии</b></p>
59 <p class="cabinet__text">Все поля обязательны для заполнения *</p> 59 <p class="cabinet__text">Все поля обязательны для заполнения *</p>
60 </div> 60 </div>
61 </div> 61 </div>
62 62
63 <div class="cabinet__body-item"> 63 <div class="cabinet__body-item">
64 <h4>Поля для вакансии</h4> 64 <h4>Поля для вакансии</h4>
65 <div class="cabinet__inputs"> 65 <div class="cabinet__inputs">
66 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 66 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
67 <label class="form-group__label">Название вакансии</label> 67 <label class="form-group__label">Название вакансии</label>
68 <div class="form-group__item"> 68 <div class="form-group__item">
69 <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $Employer[0]->name ?? '' }}" required> 69 <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $Employer[0]->name ?? '' }}" required>
70 @error('name') 70 @error('name')
71 <span class="text-xs text-red-600 dark:text-red-400"> 71 <span class="text-xs text-red-600 dark:text-red-400">
72 {{ $message }} 72 {{ $message }}
73 </span> 73 </span>
74 @enderror 74 @enderror
75 </div> 75 </div>
76 </div> 76 </div>
77 77
78 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> 78 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
79 <label class="form-group__label">Телефон</label> 79 <label class="form-group__label">Телефон</label>
80 <div class="form-group__item"> 80 <div class="form-group__item">
81 <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $Employer[0]->telephone ?? '' }}" placeholder="Свой телефон"> 81 <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $Employer[0]->telephone ?? '' }}" placeholder="Свой телефон">
82 @error('telephone') 82 @error('telephone')
83 <span class="text-xs text-red-600 dark:text-red-400"> 83 <span class="text-xs text-red-600 dark:text-red-400">
84 {{ $message }} 84 {{ $message }}
85 </span> 85 </span>
86 @enderror 86 @enderror
87 </div> 87 </div>
88 </div> 88 </div>
89 89
90 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> 90 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
91 <label class="form-group__label">Емайл</label> 91 <label class="form-group__label">Емайл</label>
92 <div class="form-group__item"> 92 <div class="form-group__item">
93 <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $Employer[0]->email ?? '' }}" placeholder="Своя почту"> 93 <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $Employer[0]->email ?? '' }}" placeholder="Своя почту">
94 @error('email') 94 @error('email')
95 <span class="text-xs text-red-600 dark:text-red-400"> 95 <span class="text-xs text-red-600 dark:text-red-400">
96 {{ $message }} 96 {{ $message }}
97 </span> 97 </span>
98 @enderror 98 @enderror
99 </div> 99 </div>
100 </div> 100 </div>
101 101
102 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> 102 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
103 <label class="form-group__label">Зарплата среднестатистическая для вакансии</label> 103 <label class="form-group__label">Зарплата среднестатистическая для вакансии</label>
104 <div class="form-group__item"> 104 <div class="form-group__item">
105 <input type="text" class="input" name="salary" id="salary" value="0" placeholder="Среднестатистическая зарплата"> 105 <input type="text" class="input" name="salary" id="salary" value="0" placeholder="Среднестатистическая зарплата">
106 @error('salary') 106 @error('salary')
107 <span class="text-xs text-red-600 dark:text-red-400"> 107 <span class="text-xs text-red-600 dark:text-red-400">
108 {{ $message }} 108 {{ $message }}
109 </span> 109 </span>
110 @enderror 110 @enderror
111 </div> 111 </div>
112 </div> 112 </div>
113 113
114 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> 114 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
115 <label class="form-group__label">Город посадки</label> 115 <label class="form-group__label">Город посадки</label>
116 <div class="form-group__item"> 116 <div class="form-group__item">
117 <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $Employer[0]->city ?? '' }}" placeholder="Севастополь"> 117 <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $Employer[0]->city ?? '' }}" placeholder="Севастополь">
118 @error('city') 118 @error('city')
119 <span class="text-xs text-red-600"> 119 <span class="text-xs text-red-600">
120 {{ $message }} 120 {{ $message }}
121 </span> 121 </span>
122 @enderror 122 @enderror
123 </div> 123 </div>
124 </div> 124 </div>
125 <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 125 <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
126 <label class="form-group__label">Категория (локация)</label> 126 <label class="form-group__label">Категория (локация)</label>
127 <div class="form-group__item"> 127 <div class="form-group__item">
128 <div class="select"> 128 <div class="select">
129 <select class="js-select2" name="category_id" id="category_id"> 129 <select class="js-select2" name="category_id" id="category_id">
130 <option selected> Выберите категорию из списка</option> 130 <option selected> Выберите категорию из списка</option>
131 _php $i = 1 _endphp 131 _php $i = 1 _endphp
132 _if ($categories->count()) 132 _if ($categories->count())
133 _foreach($categories as $j) 133 _foreach($categories as $j)
134 <option value=" $j->id }}"> $j->name }}</option> 134 <option value=" $j->id }}"> $j->name }}</option>
135 _php $i++ _endphp 135 _php $i++ _endphp
136 _endforeach 136 _endforeach
137 _endif 137 _endif
138 </select> 138 </select>
139 _error('category_id') 139 _error('category_id')
140 <span class="text-xs text-red-600 dark:text-red-400"> 140 <span class="text-xs text-red-600 dark:text-red-400">
141 $message }} 141 $message }}
142 </span> 142 </span>
143 _enderror 143 _enderror
144 </div> 144 </div>
145 </div> 145 </div>
146 </div>--> 146 </div>-->
147 147
148 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 148 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
149 <label class="form-group__label">Описание вакансии</label> 149 <label class="form-group__label">Описание вакансии</label>
150 <div class="form-group__item"> 150 <div class="form-group__item">
151 <textarea class="textarea" name="text" id="text">{{ $Employer[0]->text ?? '' }}</textarea> 151 <textarea class="textarea" name="text" id="text">{{ old('text') ?? '' }}</textarea>
152 @error('text') 152 @error('text')
153 <span class="text-xs text-red-600"> 153 <span class="text-xs text-red-600">
154 {{ $message }} 154 {{ $message }}
155 </span> 155 </span>
156 @enderror 156 @enderror
157 </div> 157 </div>
158 </div> 158 </div>
159 </div> 159 </div>
160 </div> 160 </div>
161 161
162 <div class="cabinet__body-item"> 162 <div class="cabinet__body-item">
163 <div class="cabinet__body-item"> 163 <div class="cabinet__body-item">
164 <div class="cabinet__descr"> 164 <div class="cabinet__descr">
165 <p class="cabinet__text"><b>Добавление должности</b></p> 165 <p class="cabinet__text"><b>Добавление должности</b></p>
166 </div> 166 </div>
167 </div> 167 </div>
168 168
169 <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 169 <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
170 <label class="form-group__label">Должность соискателя</label> 170 <label class="form-group__label">Должность соискателя</label>
171 <div class="form-group__item"> 171 <div class="form-group__item">
172 <div class="select"> 172 <div class="select">
173 <select class="js-select2" name="job_title_id" id="job_title_id"> 173 <select class="js-select2" name="job_title_id" id="job_title_id">
174 php $i = 1 endphp 174 php $i = 1 endphp
175 if ($jobs->count()) 175 if ($jobs->count())
176 foreach($jobs as $j) 176 foreach($jobs as $j)
177 if ($i == 1) <option selected> Выберите должность из списка</option> 177 if ($i == 1) <option selected> Выберите должность из списка</option>
178 else 178 else
179 <option value=" $j->id }}"> $j->name }}</option> 179 <option value=" $j->id }}"> $j->name }}</option>
180 endif 180 endif
181 php $i++ endphp 181 php $i++ endphp
182 endforeach 182 endforeach
183 endif 183 endif
184 </select> 184 </select>
185 error('job_title_id') 185 error('job_title_id')
186 <span class="text-xs text-red-600 dark:text-red-400"> 186 <span class="text-xs text-red-600 dark:text-red-400">
187 $message }} 187 $message }}
188 </span> 188 </span>
189 enderror 189 enderror
190 </div> 190 </div>
191 </div> 191 </div>
192 </div>--> 192 </div>-->
193 193
194 <div class="cabinet__inputs-item cabinet__inputs-item_max form-group"> 194 <div class="cabinet__inputs-item cabinet__inputs-item_max form-group">
195 <label class="form-group__label">Добавление должностей</label> 195 <label class="form-group__label">Добавление должностей</label>
196 <div class="form-group__item"> 196 <div class="form-group__item">
197 <div class="select"> 197 <div class="select">
198 <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple"> 198 <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple">
199 @php $i = 1 @endphp 199 @php $i = 1 @endphp
200 @if ($jobs->count()) 200 @if ($jobs->count())
201 @foreach($jobs as $it) 201 @foreach($jobs as $it)
202 @php $selected = false; @endphp 202 @php $selected = false; @endphp
203 @if (isset($Worker[0]->job_titles)) 203 @if (isset($Worker[0]->job_titles))
204 @if ($Worker[0]->job_titles->count()) 204 @if ($Worker[0]->job_titles->count())
205 @foreach($Worker[0]->job_titles as $select) 205 @foreach($Worker[0]->job_titles as $select)
206 @if ($it->id == $select->id) 206 @if ($it->id == $select->id)
207 @php $selected = true; @endphp 207 @php $selected = true; @endphp
208 @endif 208 @endif
209 @endforeach 209 @endforeach
210 @endif 210 @endif
211 @endif 211 @endif
212 <option value="{{ $it->id }}" @if ($selected) selected @endif>{{ $it->name }}</option> 212 <option value="{{ $it->id }}" @if ($selected) selected @endif>{{ $it->name }}</option>
213 @endforeach 213 @endforeach
214 @endif 214 @endif
215 </select> 215 </select>
216 </div> 216 </div>
217 </div> 217 </div>
218 </div> 218 </div>
219 219
220 <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 220 <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
221 <label class="form-group__label">Минимальная зарплата</label> 221 <label class="form-group__label">Минимальная зарплата</label>
222 <div class="form-group__item"> 222 <div class="form-group__item">
223 <input type="text" class="input" name="min_salary" id="min_salary" value=" old('min_salary') ?? '' }}" placeholder="Минимальная зарплата"> 223 <input type="text" class="input" name="min_salary" id="min_salary" value=" old('min_salary') ?? '' }}" placeholder="Минимальная зарплата">
224 error('min_salary') 224 error('min_salary')
225 <span class="text-xs text-red-600"> 225 <span class="text-xs text-red-600">
226 $message }} 226 $message }}
227 </span> 227 </span>
228 enderror 228 enderror
229 </div> 229 </div>
230 </div> 230 </div>
231 231
232 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 232 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
233 <label class="form-group__label">Максимальная зарплата</label> 233 <label class="form-group__label">Максимальная зарплата</label>
234 <div class="form-group__item"> 234 <div class="form-group__item">
235 <input type="text" class="input" name="max_salary" id="max_salary" value=" old('max_salary') ?? '' }}" placeholder="Максимальная зарплата"> 235 <input type="text" class="input" name="max_salary" id="max_salary" value=" old('max_salary') ?? '' }}" placeholder="Максимальная зарплата">
236 error('salary') 236 error('salary')
237 <span class="text-xs text-red-600 dark:text-red-400"> 237 <span class="text-xs text-red-600 dark:text-red-400">
238 $message }} 238 $message }}
239 </span> 239 </span>
240 enderror 240 enderror
241 </div> 241 </div>
242 </div> 242 </div>
243 243
244 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 244 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
245 <label class="form-group__label">Регион отплытия</label> 245 <label class="form-group__label">Регион отплытия</label>
246 <div class="form-group__item"> 246 <div class="form-group__item">
247 <input type="text" class="input" name="region" id="region" value=" old('region') ?? $Employer[0]->city ?? '' }}" placeholder="Севастополь"> 247 <input type="text" class="input" name="region" id="region" value=" old('region') ?? $Employer[0]->city ?? '' }}" placeholder="Севастополь">
248 error('region') 248 error('region')
249 <span class="text-xs text-red-600"> 249 <span class="text-xs text-red-600">
250 $message }} 250 $message }}
251 </span> 251 </span>
252 enderror 252 enderror
253 </div> 253 </div>
254 </div> 254 </div>
255 255
256 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 256 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
257 <label class="form-group__label">Мощность</label> 257 <label class="form-group__label">Мощность</label>
258 <div class="form-group__item"> 258 <div class="form-group__item">
259 <input type="text" class="input" name="power" id="power" value=" old('power') ?? '' }}" placeholder="POWER-45"> 259 <input type="text" class="input" name="power" id="power" value=" old('power') ?? '' }}" placeholder="POWER-45">
260 error('power') 260 error('power')
261 <span class="text-xs text-red-600"> 261 <span class="text-xs text-red-600">
262 $message }} 262 $message }}
263 </span> 263 </span>
264 enderror 264 enderror
265 </div> 265 </div>
266 </div> 266 </div>
267 267
268 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 268 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
269 <label class="form-group__label">Суточные выплаты</label> 269 <label class="form-group__label">Суточные выплаты</label>
270 <div class="form-group__item"> 270 <div class="form-group__item">
271 <input type="text" class="input" name="sytki" id="sytki" value=" old('sytki') ?? '' }}" placeholder="2000"> 271 <input type="text" class="input" name="sytki" id="sytki" value=" old('sytki') ?? '' }}" placeholder="2000">
272 error('power') 272 error('power')
273 <span class="text-xs text-red-600"> 273 <span class="text-xs text-red-600">
274 $message }} 274 $message }}
275 </span> 275 </span>
276 enderror 276 enderror
277 </div> 277 </div>
278 </div> 278 </div>
279 279
280 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 280 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
281 <label class="form-group__label">Начало отплытия</label> 281 <label class="form-group__label">Начало отплытия</label>
282 <div class="form-group__item"> 282 <div class="form-group__item">
283 <input type="text" class="input" name="start" id="start" value=" old('start') ?? '' }}" placeholder="20 сентября 2024"> 283 <input type="text" class="input" name="start" id="start" value=" old('start') ?? '' }}" placeholder="20 сентября 2024">
284 error('power') 284 error('power')
285 <span class="text-xs text-red-600"> 285 <span class="text-xs text-red-600">
286 $message }} 286 $message }}
287 </span> 287 </span>
288 enderror 288 enderror
289 </div> 289 </div>
290 </div> 290 </div>
291 291
292 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 292 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
293 <label class="form-group__label">Корабль для посадки</label> 293 <label class="form-group__label">Корабль для посадки</label>
294 <div class="form-group__item"> 294 <div class="form-group__item">
295 <div class="select"> 295 <div class="select">
296 <select class="js-select2" name="flot" id="flot"> 296 <select class="js-select2" name="flot" id="flot">
297 <option value="" selected> Не указан корабль</option> 297 <option value="" selected> Не указан корабль</option>
298 if ($Employer[0]->flots->count()) 298 if ($Employer[0]->flots->count())
299 foreach($Employer[0]->flots as $j) 299 foreach($Employer[0]->flots as $j)
300 <option value=" $j->name }}"> $j->name }} ( $j->id }})</option> 300 <option value=" $j->name }}"> $j->name }} ( $j->id }})</option>
301 endforeach 301 endforeach
302 endif 302 endif
303 </select> 303 </select>
304 error('flot') 304 error('flot')
305 <span class="text-xs text-red-600"> 305 <span class="text-xs text-red-600">
306 $message }} 306 $message }}
307 </span> 307 </span>
308 enderror 308 enderror
309 </div> 309 </div>
310 </div> 310 </div>
311 </div>--> 311 </div>-->
312 312
313 <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 313 <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
314 <label class="form-group__label">Дополнительная информация</label> 314 <label class="form-group__label">Дополнительная информация</label>
315 <div class="form-group__item"> 315 <div class="form-group__item">
316 <textarea class="textarea" name="description" id="description"> old('description') ?? '' }}</textarea> 316 <textarea class="textarea" name="description" id="description"> old('description') ?? '' }}</textarea>
317 error('description') 317 error('description')
318 <span class="text-xs text-red-600"> 318 <span class="text-xs text-red-600">
319 $message }} 319 $message }}
320 </span> 320 </span>
321 enderror 321 enderror
322 </div> 322 </div>
323 </div>--> 323 </div>-->
324 324
325 </div> 325 </div>
326 <button type="submit" class="button cabinet__submit">Опубликовать</button> 326 <button type="submit" class="button cabinet__submit">Опубликовать</button>
327 </div> 327 </div>
328 </form> 328 </form>
329 </div> 329 </div>
330 </div> 330 </div>
331 </section> 331 </section>
332 </div> 332 </div>
333 @endsection 333 @endsection
334 334