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