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