Commit 2702c67a9c390920f7039b5185b1d7acb10bd294
1 parent
24b5f80e87
Exists in
master
and in
1 other branch
Коммит по субботе
Showing 11 changed files with 105 additions and 47 deletions Inline Diff
- app/Http/Controllers/EmployerController.php
- app/Http/Controllers/MainController.php
- app/Http/Controllers/WorkerController.php
- resources/views/employers/add_vacancy.blade.php
- resources/views/employers/ajax/list_vacancy.blade.php
- resources/views/employers/cabinet45.blade.php
- resources/views/employers/edit_vacancy.blade.php
- resources/views/employers/list_answer.blade.php
- resources/views/employers/list_vacancy.blade.php
- resources/views/index.blade.php
- resources/views/modals/send_worker_new.blade.php
app/Http/Controllers/EmployerController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Classes\Tools; | 6 | use App\Classes\Tools; |
7 | use App\Http\Requests\BaseUser_min_Request; | 7 | use App\Http\Requests\BaseUser_min_Request; |
8 | use App\Http\Requests\BaseUserRequest; | 8 | use App\Http\Requests\BaseUserRequest; |
9 | use App\Http\Requests\FlotRequest; | 9 | use App\Http\Requests\FlotRequest; |
10 | use App\Http\Requests\MessagesRequiest; | 10 | use App\Http\Requests\MessagesRequiest; |
11 | use App\Http\Requests\VacancyRequestEdit; | 11 | use App\Http\Requests\VacancyRequestEdit; |
12 | use App\Http\Requests\VacansiaRequiest; | 12 | use App\Http\Requests\VacansiaRequiest; |
13 | use App\Mail\MailSotrudnichestvo; | 13 | use App\Mail\MailSotrudnichestvo; |
14 | use App\Mail\SendAllMessages; | 14 | use App\Mail\SendAllMessages; |
15 | use App\Models\Ad_employer; | 15 | use App\Models\Ad_employer; |
16 | use App\Models\Ad_jobs; | 16 | use App\Models\Ad_jobs; |
17 | use App\Models\ad_response; | 17 | use App\Models\ad_response; |
18 | use App\Models\Category; | 18 | use App\Models\Category; |
19 | use App\Models\Education; | 19 | use App\Models\Education; |
20 | use App\Models\Employer; | 20 | use App\Models\Employer; |
21 | use App\Models\employers_main; | 21 | use App\Models\employers_main; |
22 | use App\Models\Flot; | 22 | use App\Models\Flot; |
23 | use App\Models\Job_title; | 23 | use App\Models\Job_title; |
24 | use App\Models\Like_vacancy; | 24 | use App\Models\Like_vacancy; |
25 | use App\Models\Like_worker; | 25 | use App\Models\Like_worker; |
26 | use App\Models\Message; | 26 | use App\Models\Message; |
27 | use App\Models\Positions; | 27 | use App\Models\Positions; |
28 | use App\Models\Worker; | 28 | use App\Models\Worker; |
29 | use Carbon\Carbon; | 29 | use Carbon\Carbon; |
30 | use Illuminate\Auth\Events\Registered; | 30 | use Illuminate\Auth\Events\Registered; |
31 | use Illuminate\Database\Eloquent\Builder; | 31 | use Illuminate\Database\Eloquent\Builder; |
32 | use Illuminate\Database\Eloquent\Model; | 32 | use Illuminate\Database\Eloquent\Model; |
33 | use Illuminate\Foundation\Auth\User; | 33 | use Illuminate\Foundation\Auth\User; |
34 | use Illuminate\Http\Request; | 34 | use Illuminate\Http\Request; |
35 | use Illuminate\Support\Facades\Auth; | 35 | use Illuminate\Support\Facades\Auth; |
36 | use Illuminate\Support\Facades\Hash; | 36 | use Illuminate\Support\Facades\Hash; |
37 | use Illuminate\Support\Facades\Mail; | 37 | use Illuminate\Support\Facades\Mail; |
38 | use Illuminate\Support\Facades\Storage; | 38 | use Illuminate\Support\Facades\Storage; |
39 | use App\Models\User as User_Model; | 39 | use App\Models\User as User_Model; |
40 | use Illuminate\Support\Facades\Validator; | 40 | use Illuminate\Support\Facades\Validator; |
41 | 41 | ||
42 | class EmployerController extends Controller | 42 | class EmployerController extends Controller |
43 | { | 43 | { |
44 | public function vacancie($vacancy, Request $request) { | 44 | public function vacancie($vacancy, Request $request) { |
45 | $title = 'Заголовок вакансии'; | 45 | $title = 'Заголовок вакансии'; |
46 | $Query = Ad_employer::with('jobs')-> | 46 | $Query = Ad_employer::with('jobs')-> |
47 | with('cat')-> | 47 | with('cat')-> |
48 | with('employer')-> | 48 | with('employer')-> |
49 | with('jobs_code')-> | 49 | with('jobs_code')-> |
50 | select('ad_employers.*')-> | 50 | select('ad_employers.*')-> |
51 | where('id', '=', $vacancy)->get(); | 51 | where('id', '=', $vacancy)->get(); |
52 | 52 | ||
53 | if (isset(Auth()->user()->id)) | 53 | if (isset(Auth()->user()->id)) |
54 | $uid = Auth()->user()->id; | 54 | $uid = Auth()->user()->id; |
55 | else | 55 | else |
56 | $uid = 0; | 56 | $uid = 0; |
57 | $title = $Query[0]->name; | 57 | $title = $Query[0]->name; |
58 | if ($request->ajax()) { | 58 | if ($request->ajax()) { |
59 | return view('ajax.vacance-item', compact('Query','uid')); | 59 | return view('ajax.vacance-item', compact('Query','uid')); |
60 | } else { | 60 | } else { |
61 | return view('vacance-item', compact('title', 'Query', 'uid')); | 61 | return view('vacance-item', compact('title', 'Query', 'uid')); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | public function logout() { | 65 | public function logout() { |
66 | Auth::logout(); | 66 | Auth::logout(); |
67 | return redirect()->route('index') | 67 | return redirect()->route('index') |
68 | ->with('success', 'Вы вышли из личного кабинета'); | 68 | ->with('success', 'Вы вышли из личного кабинета'); |
69 | } | 69 | } |
70 | 70 | ||
71 | public function employer_info() { | 71 | public function employer_info() { |
72 | // код юзера | 72 | // код юзера |
73 | $user_info = Auth()->user(); | 73 | $user_info = Auth()->user(); |
74 | // вьюшка для вывода данных | 74 | // вьюшка для вывода данных |
75 | return view('employers.info', compact('user_info')); | 75 | return view('employers.info', compact('user_info')); |
76 | } | 76 | } |
77 | 77 | ||
78 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { | 78 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { |
79 | // Все данные через реквест | 79 | // Все данные через реквест |
80 | $all = $request->all(); | 80 | $all = $request->all(); |
81 | unset($all['_token']); | 81 | unset($all['_token']); |
82 | // обновление | 82 | // обновление |
83 | $user->update($all); | 83 | $user->update($all); |
84 | return redirect()->route('employer.employer_info'); | 84 | return redirect()->route('employer.employer_info'); |
85 | } | 85 | } |
86 | 86 | ||
87 | public function cabinet() { | 87 | public function cabinet() { |
88 | $id = Auth()->user()->id; | 88 | $id = Auth()->user()->id; |
89 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 89 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
90 | WhereHas('users', | 90 | WhereHas('users', |
91 | function (Builder $query) use ($id) {$query->Where('id', $id); | 91 | function (Builder $query) use ($id) {$query->Where('id', $id); |
92 | })->get(); | 92 | })->get(); |
93 | return view('employers.cabinet45', compact('Employer')); | 93 | return view('employers.cabinet45', compact('Employer')); |
94 | } | 94 | } |
95 | 95 | ||
96 | public function slider_flot() { | 96 | public function slider_flot() { |
97 | $id = Auth()->user()->id; | 97 | $id = Auth()->user()->id; |
98 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 98 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
99 | WhereHas('users', | 99 | WhereHas('users', |
100 | function (Builder $query) use ($id) {$query->Where('id', $id); | 100 | function (Builder $query) use ($id) {$query->Where('id', $id); |
101 | })->get(); | 101 | })->get(); |
102 | return view('employers.fly-flot', compact('Employer')); | 102 | return view('employers.fly-flot', compact('Employer')); |
103 | } | 103 | } |
104 | 104 | ||
105 | public function cabinet_save(Employer $Employer, Request $request) { | 105 | public function cabinet_save(Employer $Employer, Request $request) { |
106 | $params = $request->all(); | 106 | $params = $request->all(); |
107 | $params['user_id'] = Auth()->user()->id; | 107 | $params['user_id'] = Auth()->user()->id; |
108 | $id = $Employer->id; | 108 | $id = $Employer->id; |
109 | 109 | ||
110 | if ($request->has('logo')) { | 110 | if ($request->has('logo')) { |
111 | if (!empty($Employer->logo)) { | 111 | if (!empty($Employer->logo)) { |
112 | Storage::delete($Employer->logo); | 112 | Storage::delete($Employer->logo); |
113 | } | 113 | } |
114 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); | 114 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); |
115 | } | 115 | } |
116 | 116 | ||
117 | $Employer->update($params); | 117 | $Employer->update($params); |
118 | 118 | ||
119 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); | 119 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); |
120 | } | 120 | } |
121 | 121 | ||
122 | public function save_add_flot(FlotRequest $request) { | 122 | public function save_add_flot(FlotRequest $request) { |
123 | // отмена | 123 | // отмена |
124 | $params = $request->all(); | 124 | $params = $request->all(); |
125 | 125 | ||
126 | if ($request->has('image')) { | 126 | if ($request->has('image')) { |
127 | $params['image'] = $request->file('image')->store("flot", 'public'); | 127 | $params['image'] = $request->file('image')->store("flot", 'public'); |
128 | } | 128 | } |
129 | Flot::create($params); | 129 | Flot::create($params); |
130 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); | 130 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); |
131 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 131 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
132 | } | 132 | } |
133 | 133 | ||
134 | public function edit_flot(Flot $Flot, Employer $Employer) { | 134 | public function edit_flot(Flot $Flot, Employer $Employer) { |
135 | return view('employers.edit-flot', compact('Flot', 'Employer')); | 135 | return view('employers.edit-flot', compact('Flot', 'Employer')); |
136 | } | 136 | } |
137 | 137 | ||
138 | public function update_flot(FlotRequest $request, Flot $Flot) { | 138 | public function update_flot(FlotRequest $request, Flot $Flot) { |
139 | $params = $request->all(); | 139 | $params = $request->all(); |
140 | 140 | ||
141 | if ($request->has('image')) { | 141 | if ($request->has('image')) { |
142 | if (!empty($flot->image)) { | 142 | if (!empty($flot->image)) { |
143 | Storage::delete($flot->image); | 143 | Storage::delete($flot->image); |
144 | } | 144 | } |
145 | $params['image'] = $request->file('image')->store("flot", 'public'); | 145 | $params['image'] = $request->file('image')->store("flot", 'public'); |
146 | } else { | 146 | } else { |
147 | if (!empty($flot->image)) $params['image'] = $flot->image; | 147 | if (!empty($flot->image)) $params['image'] = $flot->image; |
148 | } | 148 | } |
149 | 149 | ||
150 | $Flot->update($params); | 150 | $Flot->update($params); |
151 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 151 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
152 | } | 152 | } |
153 | 153 | ||
154 | public function delete_flot(Flot $Flot) { | 154 | public function delete_flot(Flot $Flot) { |
155 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); | 155 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); |
156 | 156 | ||
157 | if (isset($Flot->id)) $Flot->delete(); | 157 | if (isset($Flot->id)) $Flot->delete(); |
158 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); | 158 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); |
159 | } | 159 | } |
160 | 160 | ||
161 | // Форма добавления вакансий | 161 | // Форма добавления вакансий |
162 | public function cabinet_vacancie() { | 162 | public function cabinet_vacancie() { |
163 | $id = Auth()->user()->id; | 163 | $id = Auth()->user()->id; |
164 | 164 | ||
165 | if (Auth()->user()->is_public) { | 165 | if (Auth()->user()->is_public) { |
166 | $categories = Category::query()->active()->get(); | 166 | $categories = Category::query()->active()->get(); |
167 | 167 | ||
168 | $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->where('is_bd', '=', '0')->get(); | 168 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
169 | where('is_remove', '=', '0')-> | ||
170 | where('is_bd', '=', '0')-> | ||
171 | get(); | ||
169 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 172 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
170 | 173 | ||
171 | WhereHas('users', | 174 | WhereHas('users', |
172 | function (Builder $query) use ($id) { | 175 | function (Builder $query) use ($id) { |
173 | $query->Where('id', $id); | 176 | $query->Where('id', $id); |
174 | })->get(); | 177 | })->get(); |
175 | 178 | ||
176 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); | 179 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); |
177 | } else { | 180 | } else { |
178 | return redirect()->route('employer.cabinet_vacancie_danger'); | 181 | return redirect()->route('employer.cabinet_vacancie_danger'); |
179 | } | 182 | } |
180 | } | 183 | } |
181 | 184 | ||
182 | // Форма предупреждения об оплате | 185 | // Форма предупреждения об оплате |
183 | public function cabinet_vacancie_danger() { | 186 | public function cabinet_vacancie_danger() { |
184 | return view('employers.add_vacancy_danger'); | 187 | return view('employers.add_vacancy_danger'); |
185 | } | 188 | } |
186 | 189 | ||
187 | // Сохранение вакансии | 190 | // Сохранение вакансии |
188 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { | 191 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { |
189 | $params_emp = $request->all(); | 192 | $params_emp = $request->all(); |
190 | 193 | ||
191 | $params_job["job_title_id"] = $params_emp['job_title_id']; | 194 | $params_job["job_title_id"] = $params_emp['job_title_id']; |
192 | //$params_job["min_salary"] = $params_emp['min_salary']; | 195 | //$params_job["min_salary"] = $params_emp['min_salary']; |
193 | //$params_job["max_salary"] = $params_emp['max_salary']; | 196 | //$params_job["max_salary"] = $params_emp['max_salary']; |
194 | //$params_job["region"] = $params_emp['region']; | 197 | //$params_job["region"] = $params_emp['region']; |
195 | //$params_job["power"] = $params_emp['power']; | 198 | //$params_job["power"] = $params_emp['power']; |
196 | //$params_job["sytki"] = $params_emp['sytki']; | 199 | //$params_job["sytki"] = $params_emp['sytki']; |
197 | //$params_job["start"] = $params_emp['start']; | 200 | //$params_job["start"] = $params_emp['start']; |
198 | //$params_job["flot"] = $params_emp['flot']; | 201 | //$params_job["flot"] = $params_emp['flot']; |
199 | //$params_job["description"] = $params_emp['description']; | 202 | //$params_job["description"] = $params_emp['description']; |
200 | 203 | ||
201 | $ad_jobs = Ad_employer::create($params_emp); | 204 | $ad_jobs = Ad_employer::create($params_emp); |
202 | //$params_job['ad_employer_id'] = $ad_jobs->id; | 205 | //$params_job['ad_employer_id'] = $ad_jobs->id; |
203 | //Ad_jobs::create($params_job); | 206 | //Ad_jobs::create($params_job); |
204 | $ad_jobs->jobs()->sync($request->get('job_title_id')); | 207 | $ad_jobs->jobs()->sync($request->get('job_title_id')); |
205 | 208 | ||
206 | return redirect()->route('employer.vacancy_list'); | 209 | return redirect()->route('employer.vacancy_list'); |
207 | } | 210 | } |
208 | 211 | ||
209 | // Список вакансий | 212 | // Список вакансий |
210 | public function vacancy_list(Request $request) { | 213 | public function vacancy_list(Request $request) { |
211 | $id = Auth()->user()->id; | 214 | $id = Auth()->user()->id; |
212 | $Employer = Employer::query()->where('user_id', $id)->first(); | 215 | $Employer = Employer::query()->where('user_id', $id)->first(); |
213 | $vacancy_list = Ad_employer::query()->with('jobs')-> | 216 | $vacancy_list = Ad_employer::query()->with('jobs')-> |
214 | with('jobs_code')-> | 217 | with('jobs_code')-> |
215 | where('employer_id', $Employer->id); | 218 | where('employer_id', $Employer->id); |
216 | 219 | ||
217 | if ($request->get('sort')) { | 220 | if ($request->get('sort')) { |
218 | $sort = $request->get('sort'); | 221 | $sort = $request->get('sort'); |
219 | switch ($sort) { | 222 | switch ($sort) { |
220 | case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; | 223 | case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; |
221 | case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; | 224 | case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; |
222 | case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; | 225 | case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; |
223 | case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; | 226 | case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; |
224 | case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; | 227 | case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; |
225 | default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; | 228 | default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; |
226 | } | 229 | } |
227 | } | 230 | } |
228 | $vacancy_list = $vacancy_list->paginate(4); | 231 | $vacancy_list = $vacancy_list->paginate(4); |
229 | 232 | ||
230 | //ajax | 233 | //ajax |
231 | if ($request->ajax()) { | 234 | if ($request->ajax()) { |
232 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); | 235 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); |
233 | } else { | 236 | } else { |
234 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); | 237 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); |
235 | } | 238 | } |
236 | } | 239 | } |
237 | 240 | ||
238 | // Карточка вакансии | 241 | // Карточка вакансии |
239 | public function vacancy_edit(Ad_employer $ad_employer) { | 242 | public function vacancy_edit(Ad_employer $ad_employer) { |
240 | $id = Auth()->user()->id; | 243 | $id = Auth()->user()->id; |
241 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); | 244 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); |
242 | $jobs = Job_title::query()->OrderBy('name')-> | 245 | $jobs = Job_title::query()->OrderBy('name')-> |
243 | where('is_remove', 0)->where('is_bd', '=' , '0')->get(); | 246 | where('is_remove', 0)->where('is_bd', '=' , '0')->get(); |
244 | 247 | ||
245 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 248 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
246 | where('user_id', $id)->first(); | 249 | where('user_id', $id)->first(); |
247 | 250 | ||
248 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); | 251 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); |
249 | } | 252 | } |
250 | 253 | ||
251 | // Сохранение-редактирование записи | 254 | // Сохранение-редактирование записи |
252 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { | 255 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { |
253 | $params = $request->all(); | 256 | $params = $request->all(); |
254 | 257 | ||
255 | //$jobs['flot'] = $params['flot']; | 258 | //$jobs['flot'] = $params['flot']; |
256 | //$jobs['job_title_id'] = $params['job_title_id']; | 259 | //$jobs['job_title_id'] = $params['job_title_id']; |
257 | //$titles['position_id'] = $params['position_id']; | 260 | //$titles['position_id'] = $params['position_id']; |
258 | //unset($params['job_title_id']); | 261 | //unset($params['job_title_id']); |
259 | 262 | ||
260 | $ad_employer->update($params); | 263 | $ad_employer->update($params); |
261 | 264 | ||
262 | //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> | 265 | //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> |
263 | // where('ad_employer_id', $ad_employer->id)->first(); | 266 | // where('ad_employer_id', $ad_employer->id)->first(); |
264 | //$data = Ad_jobs::find($job_->id); | 267 | //$data = Ad_jobs::find($job_->id); |
265 | //$ad_jobs = $data->update($jobs); | 268 | //$ad_jobs = $data->update($jobs); |
266 | 269 | ||
267 | return redirect()->route('employer.vacancy_list'); | 270 | return redirect()->route('employer.vacancy_list'); |
268 | } | 271 | } |
269 | 272 | ||
270 | // Сохранение карточки вакансии | 273 | // Сохранение карточки вакансии |
271 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { | 274 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { |
272 | $all = $request->all(); | 275 | $all = $request->all(); |
273 | $ad_employer->update($all); | 276 | $ad_employer->update($all); |
274 | return redirect()->route('employer.cabinet_vacancie'); | 277 | return redirect()->route('employer.cabinet_vacancie'); |
275 | } | 278 | } |
276 | 279 | ||
277 | // Удаление карточки вакансии | 280 | // Удаление карточки вакансии |
278 | public function vacancy_delete(Ad_employer $ad_employer) { | 281 | public function vacancy_delete(Ad_employer $ad_employer) { |
279 | $ad_employer->delete(); | 282 | $ad_employer->delete(); |
280 | 283 | ||
281 | return redirect()->route('employer.vacancy_list') | 284 | return redirect()->route('employer.vacancy_list') |
282 | ->with('success', 'Данные были успешно сохранены'); | 285 | ->with('success', 'Данные были успешно сохранены'); |
283 | } | 286 | } |
284 | 287 | ||
285 | // Обновление даты | 288 | // Обновление даты |
286 | public function vacancy_up(Ad_employer $ad_employer) { | 289 | public function vacancy_up(Ad_employer $ad_employer) { |
287 | $up = date('m/d/Y h:i:s', time());; | 290 | $up = date('m/d/Y h:i:s', time());; |
288 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 291 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
289 | $vac_emp->updated_at = $up; | 292 | $vac_emp->updated_at = $up; |
290 | $vac_emp->save(); | 293 | $vac_emp->save(); |
291 | 294 | ||
292 | return redirect()->route('employer.vacancy_list'); | 295 | return redirect()->route('employer.vacancy_list'); |
293 | // начало конца | 296 | // начало конца |
294 | } | 297 | } |
295 | 298 | ||
296 | //Видимость вакансии | 299 | //Видимость вакансии |
297 | public function vacancy_eye(Ad_employer $ad_employer, $status) { | 300 | public function vacancy_eye(Ad_employer $ad_employer, $status) { |
298 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 301 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
299 | $vac_emp->active_is = $status; | 302 | $vac_emp->active_is = $status; |
300 | $vac_emp->save(); | 303 | $vac_emp->save(); |
301 | 304 | ||
302 | return redirect()->route('employer.vacancy_list'); | 305 | return redirect()->route('employer.vacancy_list'); |
303 | } | 306 | } |
304 | 307 | ||
305 | //Вакансия редактирования (шаблон) | 308 | //Вакансия редактирования (шаблон) |
306 | public function vacancy_update(Ad_employer $id) { | 309 | public function vacancy_update(Ad_employer $id) { |
307 | 310 | ||
308 | } | 311 | } |
309 | 312 | ||
310 | //Отклики на вакансию - лист | 313 | //Отклики на вакансию - лист |
311 | public function answers(Employer $employer, Request $request) { | 314 | public function answers(Employer $employer, Request $request) { |
312 | $user_id = Auth()->user()->id; | 315 | $user_id = Auth()->user()->id; |
313 | $answer = Ad_employer::query()->where('employer_id', $employer->id); | 316 | $answer = Ad_employer::query()->where('employer_id', $employer->id); |
314 | if ($request->has('search')) { | 317 | if ($request->has('search')) { |
315 | $search = trim($request->get('search')); | 318 | $search = trim($request->get('search')); |
316 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); | 319 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); |
317 | } | 320 | } |
318 | 321 | ||
319 | $answer = $answer->with('response')->get(); | 322 | $answer = $answer->with('response')->OrderByDESC('id')->get(); |
320 | 323 | ||
321 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); | 324 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); |
322 | } | 325 | } |
323 | 326 | ||
324 | //Обновление статуса | 327 | //Обновление статуса |
325 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { | 328 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { |
326 | $ad_response->update(Array('flag' => $flag)); | 329 | $ad_response->update(Array('flag' => $flag)); |
327 | return redirect()->route('employer.answers', ['employer' => $employer->id]); | 330 | return redirect()->route('employer.answers', ['employer' => $employer->id]); |
328 | } | 331 | } |
329 | 332 | ||
330 | //Страницы сообщений список | 333 | //Страницы сообщений список |
331 | public function messages($type_message) { | 334 | public function messages($type_message) { |
332 | $user_id = Auth()->user()->id; | 335 | $user_id = Auth()->user()->id; |
333 | 336 | ||
334 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> | 337 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> |
335 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); | 338 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); |
336 | 339 | ||
337 | $messages_output = Message::query()->with('vacancies')-> | 340 | $messages_output = Message::query()->with('vacancies')-> |
338 | with('user_to')->where('user_id', $user_id)-> | 341 | with('user_to')->where('user_id', $user_id)-> |
339 | OrderByDesc('created_at'); | 342 | OrderByDesc('created_at'); |
340 | 343 | ||
341 | 344 | ||
342 | $count_input = $messages_input->count(); | 345 | $count_input = $messages_input->count(); |
343 | $count_output = $messages_output->count(); | 346 | $count_output = $messages_output->count(); |
344 | 347 | ||
345 | if ($type_message == 'input') { | 348 | if ($type_message == 'input') { |
346 | $messages = $messages_input->paginate(5); | 349 | $messages = $messages_input->paginate(5); |
347 | } | 350 | } |
348 | 351 | ||
349 | if ($type_message == 'output') { | 352 | if ($type_message == 'output') { |
350 | $messages = $messages_output->paginate(5); | 353 | $messages = $messages_output->paginate(5); |
351 | } | 354 | } |
352 | 355 | ||
353 | //dd($user_id, $messages[2]->vacancies); | 356 | //dd($user_id, $messages[2]->vacancies); |
354 | //jobs); | 357 | //jobs); |
355 | 358 | ||
356 | return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); | 359 | return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); |
357 | } | 360 | } |
358 | 361 | ||
359 | // Диалог между пользователями | 362 | // Диалог между пользователями |
360 | public function dialog(Request $request, User_Model $user1, User_Model $user2) { | 363 | public function dialog(Request $request, User_Model $user1, User_Model $user2) { |
361 | // Получение параметров. | 364 | // Получение параметров. |
362 | if ($request->has('ad_employer')){ | 365 | if ($request->has('ad_employer')){ |
363 | $ad_employer = $request->get('ad_employer'); | 366 | $ad_employer = $request->get('ad_employer'); |
364 | } else { | 367 | } else { |
365 | $ad_employer = 0; | 368 | $ad_employer = 0; |
366 | } | 369 | } |
367 | 370 | ||
368 | if (isset($user2->id)) { | 371 | if (isset($user2->id)) { |
369 | $companion = User_Model::query()->with('workers')-> | 372 | $companion = User_Model::query()->with('workers')-> |
370 | with('employers')-> | 373 | with('employers')-> |
371 | where('id', $user2->id)->first(); | 374 | where('id', $user2->id)->first(); |
372 | } | 375 | } |
373 | 376 | ||
374 | $Messages = Message::query()-> | 377 | $Messages = Message::query()-> |
375 | where('ad_employer_id', '=', $ad_employer)-> | 378 | where('ad_employer_id', '=', $ad_employer)-> |
376 | where(function($query) use ($user1, $user2) { | 379 | where(function($query) use ($user1, $user2) { |
377 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); | 380 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); |
378 | })->orWhere(function($query) use ($user1, $user2) { | 381 | })->orWhere(function($query) use ($user1, $user2) { |
379 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); | 382 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); |
380 | })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get(); | 383 | })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get(); |
381 | 384 | ||
382 | $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; | 385 | $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; |
383 | 386 | ||
384 | //$ad_employer = null; | 387 | //$ad_employer = null; |
385 | //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); | 388 | //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); |
386 | $sender = $user1; | 389 | $sender = $user1; |
387 | 390 | ||
388 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); | 391 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); |
389 | } | 392 | } |
390 | 393 | ||
391 | // Регистрация работодателя | 394 | // Регистрация работодателя |
392 | public function register_employer(Request $request) { | 395 | public function register_employer(Request $request) { |
393 | $params = $request->all(); | 396 | $params = $request->all(); |
394 | 397 | ||
395 | $rules = [ | 398 | $rules = [ |
396 | //'surname' => ['required', 'string', 'max:255'], | 399 | //'surname' => ['required', 'string', 'max:255'], |
397 | //'name_man' => ['required', 'string', 'max:255'], | 400 | //'name_man' => ['required', 'string', 'max:255'], |
398 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], | 401 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], |
399 | 'name_company' => ['required', 'string', 'max:255'], | 402 | 'name_company' => ['required', 'string', 'max:255'], |
400 | 'password' => ['required', 'string', 'min:6'], | 403 | 'password' => ['required', 'string', 'min:6'], |
401 | ]; | 404 | ]; |
402 | 405 | ||
403 | 406 | ||
404 | $messages = [ | 407 | $messages = [ |
405 | 'required' => 'Укажите обязательное поле', | 408 | 'required' => 'Укажите обязательное поле', |
406 | 'min' => [ | 409 | 'min' => [ |
407 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 410 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
408 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 411 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
409 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 412 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
410 | ], | 413 | ], |
411 | 'max' => [ | 414 | 'max' => [ |
412 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 415 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
413 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 416 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
414 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 417 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
415 | ] | 418 | ] |
416 | ]; | 419 | ]; |
417 | 420 | ||
418 | $email = $request->get('email'); | 421 | $email = $request->get('email'); |
419 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | 422 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { |
420 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | 423 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); |
421 | } | 424 | } |
422 | 425 | ||
423 | if ($request->get('password') !== $request->get('confirmed')){ | 426 | if ($request->get('password') !== $request->get('confirmed')){ |
424 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | 427 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); |
425 | } | 428 | } |
426 | 429 | ||
427 | if (strlen($request->get('password')) < 6) { | 430 | if (strlen($request->get('password')) < 6) { |
428 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | 431 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); |
429 | } | 432 | } |
430 | /* | 433 | /* |
431 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); | 434 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); |
432 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', | 435 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', |
433 | 'X', 'C', 'V', 'B', 'N', 'M'); | 436 | 'X', 'C', 'V', 'B', 'N', 'M'); |
434 | $spec_bool = false; | 437 | $spec_bool = false; |
435 | $alpha_bool = false; | 438 | $alpha_bool = false; |
436 | 439 | ||
437 | $haystack = $request->get('password'); | 440 | $haystack = $request->get('password'); |
438 | 441 | ||
439 | foreach ($specsumbol as $it) { | 442 | foreach ($specsumbol as $it) { |
440 | if (strpos($haystack, $it) !== false) { | 443 | if (strpos($haystack, $it) !== false) { |
441 | $spec_bool = true; | 444 | $spec_bool = true; |
442 | } | 445 | } |
443 | } | 446 | } |
444 | 447 | ||
445 | foreach ($alpha as $it) { | 448 | foreach ($alpha as $it) { |
446 | if (strpos($haystack, $it) !== false) { | 449 | if (strpos($haystack, $it) !== false) { |
447 | $alpha_bool = true; | 450 | $alpha_bool = true; |
448 | } | 451 | } |
449 | } | 452 | } |
450 | 453 | ||
451 | if ((!$spec_bool) || (!$alpha_bool)) { | 454 | if ((!$spec_bool) || (!$alpha_bool)) { |
452 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); | 455 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); |
453 | }*/ | 456 | }*/ |
454 | 457 | ||
455 | if (empty($request->get('surname'))) { | 458 | if (empty($request->get('surname'))) { |
456 | $params['surname'] = 'Неизвестно'; | 459 | $params['surname'] = 'Неизвестно'; |
457 | } | 460 | } |
458 | if (empty($request->get('name_man'))) { | 461 | if (empty($request->get('name_man'))) { |
459 | $params['name_man'] = 'Неизвестно'; | 462 | $params['name_man'] = 'Неизвестно'; |
460 | } | 463 | } |
461 | $validator = Validator::make($params, $rules, $messages); | 464 | $validator = Validator::make($params, $rules, $messages); |
462 | 465 | ||
463 | if ($validator->fails()) { | 466 | if ($validator->fails()) { |
464 | return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | 467 | return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); |
465 | } else { | 468 | } else { |
466 | $user = $this->create($params); | 469 | $user = $this->create($params); |
467 | event(new Registered($user)); | 470 | event(new Registered($user)); |
468 | Auth::guard()->login($user); | 471 | Auth::guard()->login($user); |
469 | } | 472 | } |
470 | 473 | ||
471 | if ($user) { | 474 | if ($user) { |
472 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; | 475 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; |
473 | } else { | 476 | } else { |
474 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | 477 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); |
475 | } | 478 | } |
476 | } | 479 | } |
477 | 480 | ||
478 | // Создание пользователя | 481 | // Создание пользователя |
479 | protected function create(array $data) | 482 | protected function create(array $data) |
480 | { | 483 | { |
481 | $Use = new User_Model(); | 484 | $Use = new User_Model(); |
482 | $Code_user = $Use->create([ | 485 | $Code_user = $Use->create([ |
483 | 'name' => $data['surname']." ".$data['name_man'], | 486 | 'name' => $data['surname']." ".$data['name_man'], |
484 | 'name_man' => $data['name_man'], | 487 | 'name_man' => $data['name_man'], |
485 | 'surname' => $data['surname'], | 488 | 'surname' => $data['surname'], |
486 | 'surname2' => $data['surname2'], | 489 | 'surname2' => $data['surname2'], |
487 | 'subscribe_email' => $data['email'], | 490 | 'subscribe_email' => $data['email'], |
488 | 'email' => $data['email'], | 491 | 'email' => $data['email'], |
489 | 'telephone' => $data['telephone'], | 492 | 'telephone' => $data['telephone'], |
490 | 'is_worker' => 0, | 493 | 'is_worker' => 0, |
491 | 'password' => Hash::make($data['password']), | 494 | 'password' => Hash::make($data['password']), |
492 | 'pubpassword' => base64_encode($data['password']), | 495 | 'pubpassword' => base64_encode($data['password']), |
493 | 'email_verified_at' => Carbon::now() | 496 | 'email_verified_at' => Carbon::now() |
494 | ]); | 497 | ]); |
495 | 498 | ||
496 | if ($Code_user->id > 0) { | 499 | if ($Code_user->id > 0) { |
497 | $Employer = new Employer(); | 500 | $Employer = new Employer(); |
498 | $Employer->user_id = $Code_user->id; | 501 | $Employer->user_id = $Code_user->id; |
499 | $Employer->name_company = $data['name_company']; | 502 | $Employer->name_company = $data['name_company']; |
500 | $Employer->email = $data['email']; | 503 | $Employer->email = $data['email']; |
501 | $Employer->telephone = $data['telephone']; | 504 | $Employer->telephone = $data['telephone']; |
502 | $Employer->code = Tools::generator_id(10); | 505 | $Employer->code = Tools::generator_id(10); |
503 | $Employer->save(); | 506 | $Employer->save(); |
504 | 507 | ||
505 | return $Code_user; | 508 | return $Code_user; |
506 | } | 509 | } |
507 | } | 510 | } |
508 | 511 | ||
509 | // Отправка сообщения от работодателя | 512 | // Отправка сообщения от работодателя |
510 | public function send_message(MessagesRequiest $request) { | 513 | public function send_message(MessagesRequiest $request) { |
511 | $params = $request->all(); | 514 | $params = $request->all(); |
512 | dd($params); | 515 | dd($params); |
513 | $user1 = $params['user_id']; | 516 | $user1 = $params['user_id']; |
514 | $user2 = $params['to_user_id']; | 517 | $user2 = $params['to_user_id']; |
515 | 518 | ||
516 | if ($request->has('file')) { | 519 | if ($request->has('file')) { |
517 | $params['file'] = $request->file('file')->store("messages", 'public'); | 520 | $params['file'] = $request->file('file')->store("messages", 'public'); |
518 | } | 521 | } |
519 | Message::create($params); | 522 | Message::create($params); |
520 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 523 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
521 | } | 524 | } |
522 | 525 | ||
523 | public function test123(Request $request) { | 526 | public function test123(Request $request) { |
524 | $params = $request->all(); | 527 | $params = $request->all(); |
525 | $user1 = $params['user_id']; | 528 | $user1 = $params['user_id']; |
526 | $user2 = $params['to_user_id']; | 529 | $user2 = $params['to_user_id']; |
527 | 530 | ||
528 | $rules = [ | 531 | $rules = [ |
529 | 'text' => 'required|min:1|max:150000', | 532 | 'text' => 'required|min:1|max:150000', |
530 | 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' | 533 | 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' |
531 | ]; | 534 | ]; |
532 | $messages = [ | 535 | $messages = [ |
533 | 'required' => 'Укажите обязательное поле', | 536 | 'required' => 'Укажите обязательное поле', |
534 | 'min' => [ | 537 | 'min' => [ |
535 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 538 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
536 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 539 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
537 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 540 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
538 | ], | 541 | ], |
539 | 'max' => [ | 542 | 'max' => [ |
540 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 543 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
541 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 544 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
542 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 545 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
543 | ] | 546 | ] |
544 | ]; | 547 | ]; |
545 | 548 | ||
546 | $validator = Validator::make($request->all(), $rules, $messages); | 549 | $validator = Validator::make($request->all(), $rules, $messages); |
547 | 550 | ||
548 | if ($validator->fails()) { | 551 | if ($validator->fails()) { |
549 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) | 552 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) |
550 | ->withErrors($validator); | 553 | ->withErrors($validator); |
551 | } else { | 554 | } else { |
552 | if ($request->has('file')) { | 555 | if ($request->has('file')) { |
553 | $params['file'] = $request->file('file')->store("messages", 'public'); | 556 | $params['file'] = $request->file('file')->store("messages", 'public'); |
554 | } | 557 | } |
555 | Message::create($params); | 558 | Message::create($params); |
556 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 559 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
557 | 560 | ||
558 | } | 561 | } |
559 | } | 562 | } |
560 | 563 | ||
561 | //Избранные люди | 564 | //Избранные люди |
562 | public function favorites(Request $request) { | 565 | public function favorites(Request $request) { |
563 | $IP_address = RusDate::ip_addr_client(); | 566 | $IP_address = RusDate::ip_addr_client(); |
564 | $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); | 567 | $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); |
565 | 568 | ||
566 | if ($Arr->count()) { | 569 | if ($Arr->count()) { |
567 | $A = Array(); | 570 | $A = Array(); |
568 | foreach ($Arr as $it) { | 571 | foreach ($Arr as $it) { |
569 | $A[] = $it->code_record; | 572 | $A[] = $it->code_record; |
570 | } | 573 | } |
571 | 574 | ||
572 | $Workers = Worker::query()->whereIn('id', $A); | 575 | $Workers = Worker::query()->whereIn('id', $A); |
573 | } else { | 576 | } else { |
574 | $Workers = Worker::query()->where('id', '=', '0'); | 577 | $Workers = Worker::query()->where('id', '=', '0'); |
575 | } | 578 | } |
576 | 579 | ||
577 | if (($request->has('search')) && (!empty($request->get('search')))) { | 580 | if (($request->has('search')) && (!empty($request->get('search')))) { |
578 | $search = $request->get('search'); | 581 | $search = $request->get('search'); |
579 | 582 | ||
580 | $Workers = $Workers->WhereHas('users', | 583 | $Workers = $Workers->WhereHas('users', |
581 | function (Builder $query) use ($search) { | 584 | function (Builder $query) use ($search) { |
582 | $query->Where('surname', 'LIKE', "%$search%") | 585 | $query->Where('surname', 'LIKE', "%$search%") |
583 | ->orWhere('name_man', 'LIKE', "%$search%") | 586 | ->orWhere('name_man', 'LIKE', "%$search%") |
584 | ->orWhere('surname2', 'LIKE', "%$search%"); | 587 | ->orWhere('surname2', 'LIKE', "%$search%"); |
585 | }); | 588 | }); |
586 | } else { | 589 | } else { |
587 | $Workers = $Workers->with('users'); | 590 | $Workers = $Workers->with('users'); |
588 | } | 591 | } |
589 | 592 | ||
590 | $Workers = $Workers->get(); | 593 | $Workers = $Workers->get(); |
591 | 594 | ||
592 | 595 | ||
593 | return view('employers.favorite', compact('Workers')); | 596 | return view('employers.favorite', compact('Workers')); |
594 | } | 597 | } |
595 | 598 | ||
596 | // База данных | 599 | // База данных |
597 | public function bd(Request $request) { | 600 | public function bd(Request $request) { |
598 | // для типа BelongsTo | 601 | // для типа BelongsTo |
599 | //$documents = Document::query()->orderBy(Location::select('name') | 602 | //$documents = Document::query()->orderBy(Location::select('name') |
600 | // ->whereColumn('locations.id', 'documents.location_id') | 603 | // ->whereColumn('locations.id', 'documents.location_id') |
601 | //); | 604 | //); |
602 | 605 | ||
603 | // для типа HasOne/Many | 606 | // для типа HasOne/Many |
604 | // $documents = Document::::query()->orderBy(Location::select('name') | 607 | // $documents = Document::::query()->orderBy(Location::select('name') |
605 | // ->whereColumn('locations.document_id', 'documents.id') | 608 | // ->whereColumn('locations.document_id', 'documents.id') |
606 | //); | 609 | //); |
607 | 610 | ||
608 | 611 | ||
609 | $users = User_Model::query()->with('workers'); | 612 | $users = User_Model::query()->with('workers'); |
610 | 613 | ||
611 | if ($request->has('search')) { | 614 | if ($request->has('search')) { |
612 | $find_key = $request->get('search'); | 615 | $find_key = $request->get('search'); |
613 | $users = $users->where('name', 'LIKE', "%$find_key%") | 616 | $users = $users->where('name', 'LIKE', "%$find_key%") |
614 | ->orWhere('surname', 'LIKE', "%$find_key%") | 617 | ->orWhere('surname', 'LIKE', "%$find_key%") |
615 | ->orWhere('name_man', 'LIKE', "%$find_key%") | 618 | ->orWhere('name_man', 'LIKE', "%$find_key%") |
616 | ->orWhere('email', 'LIKE', "%$find_key%") | 619 | ->orWhere('email', 'LIKE', "%$find_key%") |
617 | ->orWhere('telephone', 'LIKE', "%$find_key%"); | 620 | ->orWhere('telephone', 'LIKE', "%$find_key%"); |
618 | } | 621 | } |
619 | 622 | ||
620 | // Данные | 623 | // Данные |
621 | $users = $users->Baseuser()-> | 624 | $users = $users->Baseuser()-> |
622 | orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id')); | 625 | orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id')); |
623 | $count_users = $users; | 626 | $count_users = $users; |
624 | $users = $users->paginate(5); | 627 | $users = $users->paginate(5); |
625 | 628 | ||
626 | 629 | ||
627 | return view('employers.bd', compact('users', 'count_users')); | 630 | return view('employers.bd', compact('users', 'count_users')); |
628 | } | 631 | } |
629 | 632 | ||
630 | //Настройка уведомлений | 633 | //Настройка уведомлений |
631 | public function subscribe() { | 634 | public function subscribe() { |
632 | return view('employers.subcribe'); | 635 | return view('employers.subcribe'); |
633 | } | 636 | } |
634 | 637 | ||
635 | //Установка уведомлений сохранение | 638 | //Установка уведомлений сохранение |
636 | public function save_subscribe(Request $request) { | 639 | public function save_subscribe(Request $request) { |
637 | dd($request->all()); | 640 | dd($request->all()); |
638 | $msg = $request->validate([ | 641 | $msg = $request->validate([ |
639 | 'subscribe_email' => 'required|email|min:5|max:255', | 642 | 'subscribe_email' => 'required|email|min:5|max:255', |
640 | ]); | 643 | ]); |
641 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); | 644 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); |
642 | } | 645 | } |
643 | 646 | ||
644 | //Сбросить форму с паролем | 647 | //Сбросить форму с паролем |
645 | public function password_reset() { | 648 | public function password_reset() { |
646 | $email = Auth()->user()->email; | 649 | $email = Auth()->user()->email; |
647 | return view('employers.password-reset', compact('email')); | 650 | return view('employers.password-reset', compact('email')); |
648 | } | 651 | } |
649 | 652 | ||
650 | //Обновление пароля | 653 | //Обновление пароля |
651 | public function new_password(Request $request) { | 654 | public function new_password(Request $request) { |
652 | $use = Auth()->user(); | 655 | $use = Auth()->user(); |
653 | $request->validate([ | 656 | $request->validate([ |
654 | 'password' => 'required|string', | 657 | 'password' => 'required|string', |
655 | 'new_password' => 'required|string', | 658 | 'new_password' => 'required|string', |
656 | 'new_password2' => 'required|string' | 659 | 'new_password2' => 'required|string' |
657 | ]); | 660 | ]); |
658 | 661 | ||
659 | if ($request->get('new_password') == $request->get('new_password2')) | 662 | if ($request->get('new_password') == $request->get('new_password2')) |
660 | if ($request->get('password') !== $request->get('new_password')) { | 663 | if ($request->get('password') !== $request->get('new_password')) { |
661 | $credentials = $request->only('email', 'password'); | 664 | $credentials = $request->only('email', 'password'); |
662 | if (Auth::attempt($credentials)) { | 665 | if (Auth::attempt($credentials)) { |
663 | 666 | ||
664 | if (!is_null($use->email_verified_at)){ | 667 | if (!is_null($use->email_verified_at)){ |
665 | 668 | ||
666 | $user_data = User_Model::find($use->id); | 669 | $user_data = User_Model::find($use->id); |
667 | $user_data->update([ | 670 | $user_data->update([ |
668 | 'password' => Hash::make($request->get('new_password')), | 671 | 'password' => Hash::make($request->get('new_password')), |
669 | 'pubpassword' => base64_encode($request->get('new_password')), | 672 | 'pubpassword' => base64_encode($request->get('new_password')), |
670 | ]); | 673 | ]); |
671 | return redirect() | 674 | return redirect() |
672 | ->route('employer.password_reset') | 675 | ->route('employer.password_reset') |
673 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 676 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
674 | } | 677 | } |
675 | 678 | ||
676 | return redirect() | 679 | return redirect() |
677 | ->route('employer.password_reset') | 680 | ->route('employer.password_reset') |
678 | ->withError('Данная учетная запись не было верифицированна!'); | 681 | ->withError('Данная учетная запись не было верифицированна!'); |
679 | } | 682 | } |
680 | } | 683 | } |
681 | 684 | ||
682 | return redirect() | 685 | return redirect() |
683 | ->route('employer.password_reset') | 686 | ->route('employer.password_reset') |
684 | ->withErrors('Не совпадение данных, обновите пароли!'); | 687 | ->withErrors('Не совпадение данных, обновите пароли!'); |
685 | } | 688 | } |
686 | 689 | ||
687 | 690 | ||
688 | 691 | ||
689 | // Форма Удаление пипла | 692 | // Форма Удаление пипла |
690 | public function delete_people() { | 693 | public function delete_people() { |
691 | $login = Auth()->user()->email; | 694 | $login = Auth()->user()->email; |
692 | return view('employers.delete_people', compact('login')); | 695 | return view('employers.delete_people', compact('login')); |
693 | } | 696 | } |
694 | 697 | ||
695 | // Удаление аккаунта | 698 | // Удаление аккаунта |
696 | public function action_delete_user(Request $request) { | 699 | public function action_delete_user(Request $request) { |
697 | $Answer = $request->all(); | 700 | $Answer = $request->all(); |
698 | $user_id = Auth()->user()->id; | 701 | $user_id = Auth()->user()->id; |
699 | $request->validate([ | 702 | $request->validate([ |
700 | 'password' => 'required|string', | 703 | 'password' => 'required|string', |
701 | ]); | 704 | ]); |
702 | 705 | ||
703 | $credentials = $request->only('email', 'password'); | 706 | $credentials = $request->only('email', 'password'); |
704 | if (Auth::attempt($credentials)) { | 707 | if (Auth::attempt($credentials)) { |
705 | Auth::logout(); | 708 | Auth::logout(); |
706 | $it = User_Model::find($user_id); | 709 | $it = User_Model::find($user_id); |
707 | $it->delete(); | 710 | $it->delete(); |
708 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 711 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
709 | } else { | 712 | } else { |
710 | return redirect()->route('employer.delete_people') | 713 | return redirect()->route('employer.delete_people') |
711 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 714 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
712 | } | 715 | } |
713 | } | 716 | } |
714 | 717 | ||
715 | public function ajax_delete_user(Request $request) { | 718 | public function ajax_delete_user(Request $request) { |
716 | $Answer = $request->all(); | 719 | $Answer = $request->all(); |
717 | $user_id = Auth()->user()->id; | 720 | $user_id = Auth()->user()->id; |
718 | $request->validate([ | 721 | $request->validate([ |
719 | 'password' => 'required|string', | 722 | 'password' => 'required|string', |
720 | ]); | 723 | ]); |
721 | $credentials = $request->only('email', 'password'); | 724 | $credentials = $request->only('email', 'password'); |
722 | if (Auth::attempt($credentials)) { | 725 | if (Auth::attempt($credentials)) { |
723 | 726 | ||
724 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', | 727 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', |
725 | 'email' => $request->get('email'), | 728 | 'email' => $request->get('email'), |
726 | 'password' => $request->get('password'))); | 729 | 'password' => $request->get('password'))); |
727 | } else { | 730 | } else { |
728 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); | 731 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); |
729 | } | 732 | } |
730 | } | 733 | } |
731 | 734 | ||
732 | // FAQ - Вопросы/ответы для работодателей и соискателей | 735 | // FAQ - Вопросы/ответы для работодателей и соискателей |
733 | public function faq() { | 736 | public function faq() { |
734 | return view('employers.faq'); | 737 | return view('employers.faq'); |
735 | } | 738 | } |
736 | 739 | ||
737 | // Рассылка сообщений | 740 | // Рассылка сообщений |
738 | public function send_all_messages() { | 741 | public function send_all_messages() { |
739 | $id = Auth()->user()->id; | 742 | $id = Auth()->user()->id; |
740 | $sending = Employer::query()->where('id', '=', "$id")->first(); | 743 | $sending = Employer::query()->where('id', '=', "$id")->first(); |
741 | if ($sending->sending_is) | 744 | if ($sending->sending_is) |
742 | return view('employers.send_all'); | 745 | return view('employers.send_all'); |
743 | else | 746 | else |
744 | return view('employers.send_all_danger'); | 747 | return view('employers.send_all_danger'); |
745 | } | 748 | } |
746 | 749 | ||
747 | // Отправка сообщений для информации | 750 | // Отправка сообщений для информации |
748 | public function send_all_post(Request $request) { | 751 | public function send_all_post(Request $request) { |
749 | $data = $request->all(); | 752 | $data = $request->all(); |
750 | 753 | ||
751 | $emails = User_Model::query()->where('is_worker', '1')->get(); | 754 | $emails = User_Model::query()->where('is_worker', '1')->get(); |
752 | 755 | ||
753 | foreach ($emails as $e) { | 756 | foreach ($emails as $e) { |
754 | Mail::to($e->email)->send(new SendAllMessages($data)); | 757 | Mail::to($e->email)->send(new SendAllMessages($data)); |
755 | } | 758 | } |
756 | 759 | ||
757 | return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); | 760 | return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); |
758 | } | 761 | } |
759 | 762 | ||
760 | // База резюме | 763 | // База резюме |
761 | public function bd_tupe(Request $request) { | 764 | public function bd_tupe(Request $request) { |
762 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); | 765 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); |
763 | 766 | ||
764 | return view('employers.bd_tupe', compact('Resume')); | 767 | return view('employers.bd_tupe', compact('Resume')); |
765 | } | 768 | } |
766 | 769 | ||
767 | ////////////////////////////////////////////////////////////////// | 770 | ////////////////////////////////////////////////////////////////// |
768 | // Отправил сообщение | 771 | // Отправил сообщение |
769 | ////////////////////////////////////////////////////////////////// | 772 | ////////////////////////////////////////////////////////////////// |
770 | public function new_message(Request $request) { | 773 | public function new_message(Request $request) { |
771 | $params = $request->all(); | 774 | $params = $request->all(); |
772 | $id = $params['_user_id']; | 775 | $id = $params['_user_id']; |
773 | $message = new Message(); | 776 | $message = new Message(); |
774 | $message->user_id = $params['_user_id']; | 777 | $message->user_id = $params['_user_id']; |
775 | $message->to_user_id = $params['_to_user_id']; | 778 | $message->to_user_id = $params['_to_user_id']; |
776 | $message->title = $params['title']; | 779 | $message->title = $params['title']; |
777 | $message->text = $params['text']; | 780 | $message->text = $params['text']; |
778 | if ($request->has('_file')) { | 781 | if ($request->has('_file')) { |
779 | $message->file = $request->file('_file')->store("worker/$id", 'public'); | 782 | $message->file = $request->file('_file')->store("worker/$id", 'public'); |
780 | } | 783 | } |
781 | $message->ad_employer_id = $params['_vacancy']; | 784 | $message->ad_employer_id = $params['_vacancy']; |
782 | $message->flag_new = 1; | 785 | $message->flag_new = 1; |
783 | $id_message = $message->save(); | 786 | $id_message = $message->save(); |
784 | 787 | ||
785 | //$data['message_id'] = $id_message; | 788 | //$data['message_id'] = $id_message; |
786 | //$data['ad_employer_id'] = $params['_vacancy']; | 789 | //$data['ad_employer_id'] = $params['_vacancy']; |
787 | //$data['job_title_id'] = 0; | 790 | //$data['job_title_id'] = 0; |
788 | 791 | ||
789 | $data['flag'] = 1; | 792 | $data['flag'] = 1; |
790 | //$ad_responce = ad_response::create($data); | 793 | //$ad_responce = ad_response::create($data); |
791 | return redirect()->route('employer.messages', ['type_message' => 'output']); | 794 | return redirect()->route('employer.messages', ['type_message' => 'output']); |
792 | } | 795 | } |
793 | 796 | ||
794 | // Восстановление пароля | 797 | // Восстановление пароля |
795 | public function repair_password(Request $request) { | 798 | public function repair_password(Request $request) { |
796 | $params = $request->get('email'); | 799 | $params = $request->get('email'); |
797 | } | 800 | } |
798 | 801 | ||
799 | // Избранные люди на корабль | 802 | // Избранные люди на корабль |
800 | public function selected_people(Request $request) { | 803 | public function selected_people(Request $request) { |
801 | $id = $request->get('id'); | 804 | $id = $request->get('id'); |
802 | $favorite_people = Job_title::query()->Notbdif()->where('is_remove', '=', '0')->where('position_id', $id)->get(); | 805 | $favorite_people = Job_title::query()->Notbdif()->where('is_remove', '=', '0')->where('position_id', $id)->get(); |
803 | return view('favorite_people', compact('favorite_people')); | 806 | return view('favorite_people', compact('favorite_people')); |
804 | } | 807 | } |
805 | } | 808 | } |
806 | 809 |
app/Http/Controllers/MainController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Classes\Tools; | 6 | use App\Classes\Tools; |
7 | use App\Mail\MailRegistration; | 7 | use App\Mail\MailRegistration; |
8 | use App\Mail\MailRepair; | 8 | use App\Mail\MailRepair; |
9 | use App\Models\Ad_employer; | 9 | use App\Models\Ad_employer; |
10 | use App\Models\Ad_jobs; | 10 | use App\Models\Ad_jobs; |
11 | use App\Models\Category; | 11 | use App\Models\Category; |
12 | use App\Models\Education; | 12 | use App\Models\Education; |
13 | use App\Models\Employer; | 13 | use App\Models\Employer; |
14 | use App\Models\employers_main; | 14 | use App\Models\employers_main; |
15 | use App\Models\Job_title; | 15 | use App\Models\Job_title; |
16 | use App\Models\Like_vacancy; | 16 | use App\Models\Like_vacancy; |
17 | use App\Models\Like_worker; | 17 | use App\Models\Like_worker; |
18 | use App\Models\News; | 18 | use App\Models\News; |
19 | use App\Models\Positions; | 19 | use App\Models\Positions; |
20 | use App\Models\reclame; | 20 | use App\Models\reclame; |
21 | use App\Models\User; | 21 | use App\Models\User; |
22 | use Illuminate\Http\Request; | 22 | use Illuminate\Http\Request; |
23 | use Illuminate\Support\Facades\Auth; | 23 | use Illuminate\Support\Facades\Auth; |
24 | use Illuminate\Support\Facades\DB; | 24 | use Illuminate\Support\Facades\DB; |
25 | use Illuminate\Support\Facades\Hash; | 25 | use Illuminate\Support\Facades\Hash; |
26 | use Illuminate\Support\Facades\Mail; | 26 | use Illuminate\Support\Facades\Mail; |
27 | use Illuminate\Support\Facades\Validator; | 27 | use Illuminate\Support\Facades\Validator; |
28 | use App\Classes\StatusUser; | 28 | use App\Classes\StatusUser; |
29 | 29 | ||
30 | class MainController extends Controller | 30 | class MainController extends Controller |
31 | { | 31 | { |
32 | // Главная страница публичной части | 32 | // Главная страница публичной части |
33 | public function index() { | 33 | public function index() { |
34 | $news = News::query()->orderByDesc('id')->limit(6)->get(); | 34 | $news = News::query()->orderByDesc('id')->limit(6)->get(); |
35 | 35 | ||
36 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') | 36 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') |
37 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') | 37 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') |
38 | ->OrderByDesc('created_at') | 38 | ->OrderByDesc('created_at') |
39 | ->GroupBy('categories.id') | 39 | ->GroupBy('categories.id') |
40 | ->get(); | 40 | ->get(); |
41 | 41 | ||
42 | $Position = Category::query()->where('is_remove', '=', '0')->get(); | 42 | //$Position = Category::query()->where('is_remove', '=', '0')->get(); |
43 | $job_titles = Job_title::query()->where('is_remove', '=', 0)->get(); | 43 | $Job_title = Job_title::query()->where('is_remove', '=', '0')-> |
44 | where('is_bd', '=', '0')->orderBy('name')->get(); | ||
44 | 45 | ||
45 | /*$BigFlot = Array(); | 46 | /*$BigFlot = Array(); |
46 | foreach ($Position as $position) { | 47 | foreach ($Position as $position) { |
47 | $BigFlot[] = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> | 48 | $BigFlot[] = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> |
48 | orderBy('job_titles.sort')-> | 49 | orderBy('job_titles.sort')-> |
49 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 50 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
50 | where('position_ship', "$position->name")-> | 51 | where('position_ship', "$position->name")-> |
51 | groupby('job_title_id','position_ship')-> | 52 | groupby('job_title_id','position_ship')-> |
52 | get(); | 53 | get(); |
53 | } | 54 | } |
54 | $BigFlot = Array(); | 55 | $BigFlot = Array(); |
55 | foreach ($Position as $position) { | 56 | foreach ($Position as $position) { |
56 | $BigFlot[] = Ad_jobs::query()->with(['job_title' => function($query) { | 57 | $BigFlot[] = Ad_jobs::query()->with(['job_title' => function($query) { |
57 | $query->OrderBy('sort'); | 58 | $query->OrderBy('sort'); |
58 | }])->whereHas('job_title', function ($query) use ($position) { | 59 | }])->whereHas('job_title', function ($query) use ($position) { |
59 | $query->where('position_id', $position->id); | 60 | $query->where('position_id', $position->id); |
60 | })-> | 61 | })-> |
61 | distinct('job_title_id')-> | 62 | distinct('job_title_id')-> |
62 | get(); | 63 | get(); |
63 | }*/ | 64 | }*/ |
64 | /*$BigFlot = Array(); | 65 | /*$BigFlot = Array(); |
65 | foreach ($Position as $position) { | 66 | foreach ($Position as $position) { |
66 | $BigFlot[$position->id] = DB::table('ad_jobs')-> | 67 | $BigFlot[$position->id] = DB::table('ad_jobs')-> |
67 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name, job_titles.position_id')-> | 68 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name, job_titles.position_id')-> |
68 | orderByDesc('job_titles.sort')-> | 69 | orderByDesc('job_titles.sort')-> |
69 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 70 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
70 | where('job_titles.position_id', $position->id)-> | 71 | where('job_titles.position_id', $position->id)-> |
71 | groupby('job_title_id')-> | 72 | groupby('job_title_id')-> |
72 | get(); | 73 | get(); |
73 | }*/ | 74 | }*/ |
74 | $Data = DB::table('job_titles')-> | 75 | $Data = DB::table('job_titles')-> |
75 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> | 76 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> |
76 | where('categories.is_remove', '=', '0')-> | 77 | where('categories.is_remove', '=', '0')-> |
77 | where('job_titles.is_remove', '=', '0')-> | 78 | where('job_titles.is_remove', '=', '0')-> |
78 | where('job_titles.is_bd', '=' , '0')-> | 79 | where('job_titles.is_bd', '=' , '0')-> |
79 | leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> | 80 | leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> |
80 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> | 81 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> |
81 | groupBy('job_titles.id')->orderByDesc('job_titles.position_id')-> | 82 | groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')-> |
82 | orderByDesc('job_titles.sort')->get()->toArray(); | 83 | orderByDesc('job_titles.sort')->get()->toArray(); |
83 | 84 | ||
84 | $Main_Job = array(); | 85 | $Main_Job = array(); |
85 | $name_cat = ''; | 86 | $name_cat = ''; |
86 | foreach ($Data as $it) { | 87 | foreach ($Data as $it) { |
87 | $it_arr = (array)$it; | 88 | $it_arr = (array)$it; |
88 | if ($name_cat != $it_arr['catname']) $name_cat = $it_arr['catname']; | 89 | if ($name_cat != $it_arr['catname']) $name_cat = $it_arr['catname']; |
89 | $Main_Job[$name_cat][] = $it_arr; | 90 | $Main_Job[$name_cat][] = $it_arr; |
90 | } | 91 | } |
91 | 92 | ||
92 | $employers = employers_main::query()->with('employer')->orderBy('id')->limit(8)->get(); | 93 | $employers = employers_main::query()->with('employer')->orderBy('id')->limit(8)->get(); |
93 | $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get(); | 94 | $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get(); |
94 | return view('index', compact('news', 'job_titles', 'categories', 'employers', 'vacancy', 'Main_Job')); | 95 | return view('index', compact('news', 'Job_title', 'categories', 'employers', 'vacancy', 'Main_Job')); |
95 | } | 96 | } |
96 | 97 | ||
97 | public function search_vacancies(Request $request) { | 98 | public function search_vacancies(Request $request) { |
98 | if ($request->has('search')) { | 99 | if ($request->has('search')) { |
99 | $search = $request->get('search'); | 100 | $search = $request->get('search'); |
100 | $job_titles = Job_title::query()->where('name', 'LIKE', "%$search%")->first(); | 101 | $job_titles = Job_title::query()->where('name', 'LIKE', "%$search%")->first(); |
101 | if (isset($job_titles->id)) | 102 | if (isset($job_titles->id)) |
102 | if ($job_titles->id > 0) | 103 | if ($job_titles->id > 0) |
103 | return redirect()->route('vacancies', ['job' => $job_titles->id]); | 104 | return redirect()->route('vacancies', ['job' => $job_titles->id]); |
104 | } | 105 | } |
105 | } | 106 | } |
106 | 107 | ||
107 | // Лайк вакансии | 108 | // Лайк вакансии |
108 | public function like_vacancy(Request $request) { | 109 | public function like_vacancy(Request $request) { |
109 | $IP_address = RusDate::ip_addr_client(); | 110 | $IP_address = RusDate::ip_addr_client(); |
110 | 111 | ||
111 | if ($request->has('code_record')) { | 112 | if ($request->has('code_record')) { |
112 | if ($request->has('delete')) { | 113 | if ($request->has('delete')) { |
113 | $code = $request->get('code_record'); | 114 | $code = $request->get('code_record'); |
114 | $atomic_era = Like_vacancy::select('id')-> | 115 | $atomic_era = Like_vacancy::select('id')-> |
115 | where('code_record', '=', $code)->toSql(); | 116 | where('code_record', '=', $code)->toSql(); |
116 | DB::table('like_vacancy')->where('code_record', $request->get('code_record'))->delete(); | 117 | DB::table('like_vacancy')->where('code_record', $request->get('code_record'))->delete(); |
117 | 118 | ||
118 | } else { | 119 | } else { |
119 | $params = $request->all(); | 120 | $params = $request->all(); |
120 | $params['ip_address'] = $IP_address; | 121 | $params['ip_address'] = $IP_address; |
121 | Like_vacancy::create($params); | 122 | Like_vacancy::create($params); |
122 | } | 123 | } |
123 | } | 124 | } |
124 | } | 125 | } |
125 | 126 | ||
126 | // Лайк соискателю. | 127 | // Лайк соискателю. |
127 | public function like_worker(Request $request) { | 128 | public function like_worker(Request $request) { |
128 | $IP_address = RusDate::ip_addr_client(); | 129 | $IP_address = RusDate::ip_addr_client(); |
129 | 130 | ||
130 | if ($request->has('code_record')) { | 131 | if ($request->has('code_record')) { |
131 | if ($request->has('delete')) { | 132 | if ($request->has('delete')) { |
132 | $atomic_era = Like_worker::select('id')-> | 133 | $atomic_era = Like_worker::select('id')-> |
133 | where('code_record', '=', $request-> | 134 | where('code_record', '=', $request-> |
134 | get('code_record'))->first(); | 135 | get('code_record'))->first(); |
135 | 136 | ||
136 | DB::table('like_worker')->where('code_record', $request->get('code_record'))->delete(); | 137 | DB::table('like_worker')->where('code_record', $request->get('code_record'))->delete(); |
137 | 138 | ||
138 | return "Вот и результат удаления!"; | 139 | return "Вот и результат удаления!"; |
139 | 140 | ||
140 | } else { | 141 | } else { |
141 | $params = $request->all(); | 142 | $params = $request->all(); |
142 | $params['ip_address'] = $IP_address; | 143 | $params['ip_address'] = $IP_address; |
143 | Like_worker::create($params); | 144 | Like_worker::create($params); |
144 | } | 145 | } |
145 | } | 146 | } |
146 | } | 147 | } |
147 | 148 | ||
148 | public function vacancies(Request $request) { | 149 | public function vacancies(Request $request) { |
149 | //должности | 150 | //должности |
150 | $Job_title = Job_title::query()->where('is_remove', '=', '0')->orderBy('name')->get(); | 151 | $Job_title = Job_title::query()->where('is_remove', '=', '0')-> |
152 | where('is_bd', '=', '0')->orderBy('name')->get(); | ||
151 | 153 | ||
152 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') | 154 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') |
153 | ->selectRaw('min(ad_employers.salary) as min_salary, max(ad_employers.salary) as max_salary') | 155 | ->selectRaw('min(ad_employers.salary) as min_salary, max(ad_employers.salary) as max_salary') |
154 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') | 156 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') |
155 | ->join('ad_jobs', 'ad_jobs.ad_employer_id', '=', 'ad_employers.id'); | 157 | ->join('ad_jobs', 'ad_jobs.ad_employer_id', '=', 'ad_employers.id'); |
156 | 158 | ||
157 | //категории и вакансии | 159 | //категории и вакансии |
158 | if (($request->has('job')) && ($request->get('job') > 0)) { | 160 | if (($request->has('job')) && ($request->get('job') > 0)) { |
159 | $categories = $categories->Where('job_title_id', '=', $request->get('job')); | 161 | $categories = $categories->Where('job_title_id', '=', $request->get('job')); |
160 | } | 162 | } |
161 | 163 | ||
162 | $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get(); | 164 | $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get(); |
163 | 165 | ||
164 | //$Position = Category::query()->where('is_remove', '=', '0')->get(); | 166 | //$Position = Category::query()->where('is_remove', '=', '0')->get(); |
165 | 167 | ||
166 | /*$BigFlot = Array(); | 168 | /*$BigFlot = Array(); |
167 | foreach ($Position as $position) { | 169 | foreach ($Position as $position) { |
168 | $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> | 170 | $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> |
169 | orderBy('job_titles.sort')-> | 171 | orderBy('job_titles.sort')-> |
170 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 172 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
171 | where('position_ship', "$position->name"); | 173 | where('position_ship', "$position->name"); |
172 | if (($request->has('job')) && ($request->get('job') > 0)) { | 174 | if (($request->has('job')) && ($request->get('job') > 0)) { |
173 | $War_flot = $War_flot->where('job_title_id', $request->get('job')); | 175 | $War_flot = $War_flot->where('job_title_id', $request->get('job')); |
174 | } | 176 | } |
175 | $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); | 177 | $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); |
176 | $BigFlot[] = $War_flot; | 178 | $BigFlot[] = $War_flot; |
177 | }*/ | 179 | }*/ |
178 | /* | 180 | /* |
179 | $BigFlot = Array(); | 181 | $BigFlot = Array(); |
180 | foreach ($Position as $position) { | 182 | foreach ($Position as $position) { |
181 | $WarFlot = DB::table('ad_jobs')-> | 183 | $WarFlot = DB::table('ad_jobs')-> |
182 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> | 184 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> |
183 | orderByDesc('job_titles.sort')-> | 185 | orderByDesc('job_titles.sort')-> |
184 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 186 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
185 | where('job_titles.position_id', $position->id); | 187 | where('job_titles.position_id', $position->id); |
186 | if (($request->has('job')) && ($request->get('job') > 0)) { | 188 | if (($request->has('job')) && ($request->get('job') > 0)) { |
187 | $WarFlot = $WarFlot->where('job_title_id', $request->get('job')); | 189 | $WarFlot = $WarFlot->where('job_title_id', $request->get('job')); |
188 | } | 190 | } |
189 | $WarFlot = $WarFlot->groupby('job_title_id')->get(); | 191 | $WarFlot = $WarFlot->groupby('job_title_id')->get(); |
190 | $BigFlot[] = $WarFlot; | 192 | $BigFlot[] = $WarFlot; |
191 | } | 193 | } |
192 | */ | 194 | */ |
193 | 195 | ||
194 | $Data = DB::table('job_titles')-> | 196 | $Data = DB::table('job_titles')-> |
195 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> | 197 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> |
196 | where('categories.is_remove', '=', '0')-> | 198 | where('categories.is_remove', '=', '0')-> |
197 | where('job_titles.is_bd', '=' , '0')-> | 199 | where('job_titles.is_bd', '=' , '0')-> |
198 | where('job_titles.is_remove', '=', '0'); | 200 | where('job_titles.is_remove', '=', '0'); |
199 | if (($request->has('job')) && ($request->get('job') > 0)) { | 201 | if (($request->has('job')) && ($request->get('job') > 0)) { |
200 | $Data = $Data->where('job_title_id', $request->get('job')); | 202 | $Data = $Data->where('job_title_id', $request->get('job')); |
201 | } | 203 | } |
202 | $Data = $Data->leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> | 204 | $Data = $Data->leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> |
203 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> | 205 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> |
204 | groupBy('job_titles.id')->orderByDesc('job_titles.position_id')-> | 206 | groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')-> |
205 | orderByDesc('job_titles.sort')->get()->toArray(); | 207 | orderByDesc('job_titles.sort')->get()->toArray(); |
206 | 208 | ||
207 | $Main_Job = array(); | 209 | $Main_Job = array(); |
208 | $name_cat = ''; | 210 | $name_cat = ''; |
209 | foreach ($Data as $it) { | 211 | foreach ($Data as $it) { |
210 | $it_arr = (array)$it; | 212 | $it_arr = (array)$it; |
211 | if ($name_cat != $it_arr['catname']) | 213 | if ($name_cat != $it_arr['catname']) |
212 | $name_cat = $it_arr['catname']; | 214 | $name_cat = $it_arr['catname']; |
213 | $Main_Job[$name_cat][] = $it_arr; | 215 | $Main_Job[$name_cat][] = $it_arr; |
214 | } | 216 | } |
215 | 217 | ||
216 | if ($request->ajax()) { | 218 | if ($request->ajax()) { |
217 | return view('ajax.new_sky', compact('categories', 'Main_Job')); | 219 | return view('ajax.new_sky', compact('categories', 'Main_Job')); |
218 | } else { | 220 | } else { |
219 | return view('new_sky', compact('Job_title', 'categories', 'Main_Job')); | 221 | return view('new_sky', compact('Job_title', 'categories', 'Main_Job')); |
220 | } | 222 | } |
221 | } | 223 | } |
222 | 224 | ||
223 | //Вакансии категория детальная | 225 | //Вакансии категория детальная |
224 | public function list_vacancies(Category $categories, Request $request) { | 226 | public function list_vacancies(Category $categories, Request $request) { |
225 | if (isset(Auth()->user()->id)) | 227 | if (isset(Auth()->user()->id)) |
226 | $uid = Auth()->user()->id; | 228 | $uid = Auth()->user()->id; |
227 | else | 229 | else |
228 | $uid = 0; | 230 | $uid = 0; |
229 | 231 | ||
230 | if ($request->get('job') == 0) | 232 | if ($request->get('job') == 0) |
231 | $job_search = ''; | 233 | $job_search = ''; |
232 | else | 234 | else |
233 | $job_search = $request->get('job'); | 235 | $job_search = $request->get('job'); |
234 | 236 | ||
235 | $Query = Ad_employer::with('jobs')-> | 237 | $Query = Ad_employer::with('jobs')-> |
236 | with('cat')-> | 238 | with('cat')-> |
237 | with('employer')-> | 239 | with('employer')-> |
238 | 240 | ||
239 | whereHas('jobs_code', function ($query) use ($job_search) { | 241 | whereHas('jobs_code', function ($query) use ($job_search) { |
240 | if (!empty($job_search)) { | 242 | if (!empty($job_search)) { |
241 | $query->where('job_title_id', $job_search); | 243 | $query->where('job_title_id', $job_search); |
242 | } | 244 | } |
243 | })->select('ad_employers.*'); | 245 | })->select('ad_employers.*'); |
244 | 246 | ||
245 | if (isset($categories->id) && ($categories->id > 0)) { | 247 | if (isset($categories->id) && ($categories->id > 0)) { |
246 | $Query = $Query->where('category_id', '=', $categories->id); | 248 | $Query = $Query->where('category_id', '=', $categories->id); |
247 | $Name_categori = Category::query()->where('id', '=', $categories->id)->get(); | 249 | $Name_categori = Category::query()->where('id', '=', $categories->id)->get(); |
248 | } else { | 250 | } else { |
249 | $Name_categori = ''; | 251 | $Name_categori = ''; |
250 | } | 252 | } |
251 | 253 | ||
252 | if ($request->get('sort')) { | 254 | if ($request->get('sort')) { |
253 | $sort = $request->get('sort'); | 255 | $sort = $request->get('sort'); |
254 | switch ($sort) { | 256 | switch ($sort) { |
255 | case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break; | 257 | case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break; |
256 | case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break; | 258 | case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break; |
257 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; | 259 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; |
258 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; | 260 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; |
259 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 261 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
260 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 262 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
261 | } | 263 | } |
262 | } | 264 | } |
263 | 265 | ||
264 | $Job_title = Job_title::query()->OrderBy('name')->get(); | 266 | $Job_title = Job_title::query()->where('is_bd', '=', '0')->OrderBy('name')->get(); |
265 | 267 | ||
266 | $Query_count = $Query->count(); | 268 | $Query_count = $Query->count(); |
267 | 269 | ||
268 | $Query = $Query->OrderBy('updated_at')->paginate(3); | 270 | $Query = $Query->OrderBy('updated_at')->paginate(3); |
269 | 271 | ||
270 | $Reclama = reclame::query()->get(); | 272 | $Reclama = reclame::query()->get(); |
271 | 273 | ||
272 | if ($request->ajax()) { | 274 | if ($request->ajax()) { |
273 | if ($request->has('title')) { | 275 | if ($request->has('title')) { |
274 | return view('ajax.list_category', compact( | 276 | return view('ajax.list_category', compact( |
275 | 'Name_categori' | 277 | 'Name_categori' |
276 | )); | 278 | )); |
277 | } else { | 279 | } else { |
278 | return view('ajax.list_vacancies', compact('Query', | 280 | return view('ajax.list_vacancies', compact('Query', |
279 | 'Query_count', | 281 | 'Query_count', |
280 | 'Name_categori', | 282 | 'Name_categori', |
281 | 'Reclama', | 283 | 'Reclama', |
282 | 'categories', | 284 | 'categories', |
283 | 'Job_title', | 285 | 'Job_title', |
284 | 'uid')); | 286 | 'uid')); |
285 | } | 287 | } |
286 | } else { | 288 | } else { |
287 | //Вернуть все | 289 | //Вернуть все |
288 | return view('list_vacancies', compact('Query', | 290 | return view('list_vacancies', compact('Query', |
289 | 'Query_count', | 291 | 'Query_count', |
290 | 'Reclama', | 292 | 'Reclama', |
291 | 'Name_categori', | 293 | 'Name_categori', |
292 | 'categories', | 294 | 'categories', |
293 | 'Job_title', | 295 | 'Job_title', |
294 | 'uid')); | 296 | 'uid')); |
295 | } | 297 | } |
296 | } | 298 | } |
297 | 299 | ||
298 | // Образование | 300 | // Образование |
299 | public function education(Request $request) { | 301 | public function education(Request $request) { |
300 | $educations = Education::query(); | 302 | $educations = Education::query(); |
301 | if (($request->has('search')) && (!empty($request->get('search')))) { | 303 | if (($request->has('search')) && (!empty($request->get('search')))) { |
302 | $search = trim($request->get('search')); | 304 | $search = trim($request->get('search')); |
303 | $educations = $educations->where('name', 'LIKE', "%$search%"); | 305 | $educations = $educations->where('name', 'LIKE', "%$search%"); |
304 | } | 306 | } |
305 | 307 | ||
306 | if ($request->get('sort')) { | 308 | if ($request->get('sort')) { |
307 | $sort = $request->get('sort'); | 309 | $sort = $request->get('sort'); |
308 | switch ($sort) { | 310 | switch ($sort) { |
309 | case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break; | 311 | case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break; |
310 | case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break; | 312 | case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break; |
311 | case 'created_at_up': $educations = $educations->OrderBy('created_at')->orderBy('id'); break; | 313 | case 'created_at_up': $educations = $educations->OrderBy('created_at')->orderBy('id'); break; |
312 | case 'created_at_down': $educations = $educations->orderByDesc('created_at')->orderBy('id'); break; | 314 | case 'created_at_down': $educations = $educations->orderByDesc('created_at')->orderBy('id'); break; |
313 | case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break; | 315 | case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break; |
314 | default: $educations = $educations->orderBy('id')->orderby('updated_at'); break; | 316 | default: $educations = $educations->orderBy('id')->orderby('updated_at'); break; |
315 | } | 317 | } |
316 | } | 318 | } |
317 | 319 | ||
318 | $count_edu = $educations->count(); | 320 | $count_edu = $educations->count(); |
319 | $educations = $educations->paginate(6); | 321 | $educations = $educations->paginate(6); |
320 | if ($request->ajax()) { | 322 | if ($request->ajax()) { |
321 | return view('ajax.education', compact('educations')); | 323 | return view('ajax.education', compact('educations')); |
322 | } else { | 324 | } else { |
323 | return view('education', compact('educations', 'count_edu')); | 325 | return view('education', compact('educations', 'count_edu')); |
324 | } | 326 | } |
325 | } | 327 | } |
326 | 328 | ||
327 | // Контакты | 329 | // Контакты |
328 | public function contacts() { | 330 | public function contacts() { |
329 | return view('contacts'); | 331 | return view('contacts'); |
330 | } | 332 | } |
331 | 333 | ||
332 | // Вход в личный кабинет | 334 | // Вход в личный кабинет |
333 | public function input_login(Request $request) | 335 | public function input_login(Request $request) |
334 | { | 336 | { |
335 | $params = $request->all(); | 337 | $params = $request->all(); |
336 | 338 | ||
337 | 339 | ||
338 | $rules = [ | 340 | $rules = [ |
339 | 'email' => 'required|string|email', | 341 | 'email' => 'required|string|email', |
340 | 'password' => 'required|string|min:3|max:25', | 342 | 'password' => 'required|string|min:3|max:25', |
341 | ]; | 343 | ]; |
342 | 344 | ||
343 | $messages = [ | 345 | $messages = [ |
344 | 'required' => 'Укажите обязательное поле «:attribute»', | 346 | 'required' => 'Укажите обязательное поле «:attribute»', |
345 | 'email' => 'Введите корректный email', | 347 | 'email' => 'Введите корректный email', |
346 | 'min' => [ | 348 | 'min' => [ |
347 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 349 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
348 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 350 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
349 | ], | 351 | ], |
350 | 'max' => [ | 352 | 'max' => [ |
351 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 353 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
352 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 354 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
353 | ], | 355 | ], |
354 | ]; | 356 | ]; |
355 | $validator = Validator::make($request->all(), $rules, $messages); | 357 | $validator = Validator::make($request->all(), $rules, $messages); |
356 | if ($validator->fails()) { | 358 | if ($validator->fails()) { |
357 | if (Auth::check()) | 359 | if (Auth::check()) |
358 | $user_id = $request->user()->id; | 360 | $user_id = $request->user()->id; |
359 | else | 361 | else |
360 | $user_id = 0; | 362 | $user_id = 0; |
361 | 363 | ||
362 | if ($user_id > 0) | 364 | if ($user_id > 0) |
363 | return json_encode(Array("ERROR" => "Email или пароль невалидный!")); | 365 | return json_encode(Array("ERROR" => "Email или пароль невалидный!")); |
364 | else | 366 | else |
365 | return redirect()->route('index')->with('Error', "Email или пароль невалидный"); | 367 | return redirect()->route('index')->with('Error', "Email или пароль невалидный"); |
366 | } else { | 368 | } else { |
367 | $credentials = $request->only('email', 'password'); | 369 | $credentials = $request->only('email', 'password'); |
368 | 370 | ||
369 | if (Auth::attempt($credentials, $request->has('remember'))) { | 371 | if (Auth::attempt($credentials, $request->has('remember'))) { |
370 | 372 | ||
371 | if (is_null(Auth::user()->email_verified_at)) { | 373 | if (is_null(Auth::user()->email_verified_at)) { |
372 | Auth::logout(); | 374 | Auth::logout(); |
373 | return json_encode(Array("ERROR" => "Адрес почты не подтвержден")); | 375 | return json_encode(Array("ERROR" => "Адрес почты не подтвержден")); |
374 | } | 376 | } |
375 | 377 | ||
376 | if (Auth::user()->is_worker) { | 378 | if (Auth::user()->is_worker) { |
377 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl())); | 379 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl())); |
378 | } else { | 380 | } else { |
379 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl())); | 381 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl())); |
380 | } | 382 | } |
381 | 383 | ||
382 | return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет")); | 384 | return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет")); |
383 | //->route('index') | 385 | //->route('index') |
384 | //->with('success', 'Вы вошли в личный кабинет.'); | 386 | //->with('success', 'Вы вошли в личный кабинет.'); |
385 | } else { | 387 | } else { |
386 | return json_encode(Array("ERROR" => "Неверный логин или пароль!")); | 388 | return json_encode(Array("ERROR" => "Неверный логин или пароль!")); |
387 | } | 389 | } |
388 | } | 390 | } |
389 | } | 391 | } |
390 | 392 | ||
391 | // Восстановление пароля | 393 | // Восстановление пароля |
392 | public function repair_password(Request $request) { | 394 | public function repair_password(Request $request) { |
393 | $rules = [ | 395 | $rules = [ |
394 | 'email' => 'required|string|email', | 396 | 'email' => 'required|string|email', |
395 | ]; | 397 | ]; |
396 | 398 | ||
397 | $messages = [ | 399 | $messages = [ |
398 | 'required' => 'Укажите обязательное поле «:attribute»', | 400 | 'required' => 'Укажите обязательное поле «:attribute»', |
399 | 'email' => 'Введите корректный email', | 401 | 'email' => 'Введите корректный email', |
400 | 'min' => [ | 402 | 'min' => [ |
401 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 403 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
402 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 404 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
403 | ], | 405 | ], |
404 | 'max' => [ | 406 | 'max' => [ |
405 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 407 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
406 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 408 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
407 | ], | 409 | ], |
408 | ]; | 410 | ]; |
409 | 411 | ||
410 | $validator = Validator::make($request->all(), $rules, $messages); | 412 | $validator = Validator::make($request->all(), $rules, $messages); |
411 | 413 | ||
412 | if ($validator->fails()) { | 414 | if ($validator->fails()) { |
413 | return redirect()->back()->with('Error', "Email невалидный"); | 415 | return redirect()->back()->with('Error', "Email невалидный"); |
414 | } else { | 416 | } else { |
415 | $new_password = Tools::generator_id(10); | 417 | $new_password = Tools::generator_id(10); |
416 | $hash_password = Hash::make($new_password); | 418 | $hash_password = Hash::make($new_password); |
417 | $user = User::query()->where('email', $request->get('email'))->first(); | 419 | $user = User::query()->where('email', $request->get('email'))->first(); |
418 | $EditRec = User::find($user->id); | 420 | $EditRec = User::find($user->id); |
419 | $EditRec->password = $hash_password; | 421 | $EditRec->password = $hash_password; |
420 | $EditRec->save(); | 422 | $EditRec->save(); |
421 | 423 | ||
422 | foreach ([$request->get('email')] as $recipient) { | 424 | foreach ([$request->get('email')] as $recipient) { |
423 | Mail::to($recipient)->send(new MailRepair($new_password)); | 425 | Mail::to($recipient)->send(new MailRepair($new_password)); |
424 | } | 426 | } |
425 | return redirect()->route('index'); | 427 | return redirect()->route('index'); |
426 | 428 | ||
427 | } | 429 | } |
428 | 430 | ||
429 | } | 431 | } |
430 | 432 | ||
431 | // Вывод новостей | 433 | // Вывод новостей |
432 | public function news(Request $request) { | 434 | public function news(Request $request) { |
433 | $Query = News::query(); | 435 | $Query = News::query(); |
434 | if ($request->has('search')) { | 436 | if ($request->has('search')) { |
435 | $search = $request->get('search'); | 437 | $search = $request->get('search'); |
436 | $Query = $Query->where('title', 'LIKE', "%$search%")-> | 438 | $Query = $Query->where('title', 'LIKE', "%$search%")-> |
437 | orWhere('text', 'LIKE', "%$search%"); | 439 | orWhere('text', 'LIKE', "%$search%"); |
438 | } | 440 | } |
439 | 441 | ||
440 | if ($request->ajax()) { | 442 | if ($request->ajax()) { |
441 | if ($request->get('sort')) { | 443 | if ($request->get('sort')) { |
442 | $sort = $request->get('sort'); | 444 | $sort = $request->get('sort'); |
443 | switch ($sort) { | 445 | switch ($sort) { |
444 | case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break; | 446 | case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break; |
445 | case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break; | 447 | case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break; |
446 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; | 448 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; |
447 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; | 449 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; |
448 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 450 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
449 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 451 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
450 | } | 452 | } |
451 | } | 453 | } |
452 | } | 454 | } |
453 | $Query_count = $Query->count(); | 455 | $Query_count = $Query->count(); |
454 | $Query = $Query->paginate(6); | 456 | $Query = $Query->paginate(6); |
455 | 457 | ||
456 | if ($request->ajax()) { | 458 | if ($request->ajax()) { |
457 | return view('ajax.news-list', compact('Query', 'Query_count')); | 459 | return view('ajax.news-list', compact('Query', 'Query_count')); |
458 | } else { | 460 | } else { |
459 | return view('news-list', compact('Query', 'Query_count')); | 461 | return view('news-list', compact('Query', 'Query_count')); |
460 | } | 462 | } |
461 | } | 463 | } |
462 | 464 | ||
463 | //Детальная новость | 465 | //Детальная новость |
464 | public function detail_new(News $new) { | 466 | public function detail_new(News $new) { |
465 | // Наборка | 467 | // Наборка |
466 | $Query = News::query()->where('id', $new->id)->get(); | 468 | $Query = News::query()->where('id', $new->id)->get(); |
467 | $title = $Query[0]->title; | 469 | $title = $Query[0]->title; |
468 | $All_Query = News::query()->paginate(8); | 470 | $All_Query = News::query()->paginate(8); |
469 | return view('detail_new', compact('Query', 'All_Query', 'title')); | 471 | return view('detail_new', compact('Query', 'All_Query', 'title')); |
470 | } | 472 | } |
471 | } | 473 | } |
472 | 474 |
app/Http/Controllers/WorkerController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Http\Requests\DocumentsRequest; | 6 | use App\Http\Requests\DocumentsRequest; |
7 | use App\Http\Requests\PrevCompanyRequest; | 7 | use App\Http\Requests\PrevCompanyRequest; |
8 | use App\Http\Requests\SertificationRequest; | 8 | use App\Http\Requests\SertificationRequest; |
9 | use App\Models\Ad_employer; | 9 | use App\Models\Ad_employer; |
10 | use App\Models\ad_response; | 10 | use App\Models\ad_response; |
11 | use App\Models\Category; | 11 | use App\Models\Category; |
12 | use App\Models\Dop_info; | 12 | use App\Models\Dop_info; |
13 | use App\Models\Employer; | 13 | use App\Models\Employer; |
14 | use App\Models\infobloks; | 14 | use App\Models\infobloks; |
15 | use App\Models\Job_title; | 15 | use App\Models\Job_title; |
16 | use App\Models\Like_vacancy; | 16 | use App\Models\Like_vacancy; |
17 | use App\Models\Like_worker; | 17 | use App\Models\Like_worker; |
18 | use App\Models\Message; | 18 | use App\Models\Message; |
19 | use App\Models\place_works; | 19 | use App\Models\place_works; |
20 | use App\Models\PrevCompany; | 20 | use App\Models\PrevCompany; |
21 | use App\Models\reclame; | 21 | use App\Models\reclame; |
22 | use App\Models\ResponseWork; | 22 | use App\Models\ResponseWork; |
23 | use App\Models\sertification; | 23 | use App\Models\sertification; |
24 | use App\Models\Static_worker; | 24 | use App\Models\Static_worker; |
25 | use App\Models\Title_worker; | 25 | use App\Models\Title_worker; |
26 | use App\Models\User; | 26 | use App\Models\User; |
27 | use App\Models\User as User_Model; | 27 | use App\Models\User as User_Model; |
28 | use App\Models\Worker; | 28 | use App\Models\Worker; |
29 | use Barryvdh\DomPDF\Facade\Pdf; | 29 | use Barryvdh\DomPDF\Facade\Pdf; |
30 | use Carbon\Carbon; | 30 | use Carbon\Carbon; |
31 | use Illuminate\Auth\Events\Registered; | 31 | use Illuminate\Auth\Events\Registered; |
32 | use Illuminate\Database\Eloquent\Builder; | 32 | use Illuminate\Database\Eloquent\Builder; |
33 | use Illuminate\Database\Eloquent\Model; | 33 | use Illuminate\Database\Eloquent\Model; |
34 | use Illuminate\Http\JsonResponse; | 34 | use Illuminate\Http\JsonResponse; |
35 | use Illuminate\Http\Request; | 35 | use Illuminate\Http\Request; |
36 | use Illuminate\Support\Facades\Auth; | 36 | use Illuminate\Support\Facades\Auth; |
37 | use Illuminate\Support\Facades\Hash; | 37 | use Illuminate\Support\Facades\Hash; |
38 | use Illuminate\Support\Facades\Storage; | 38 | use Illuminate\Support\Facades\Storage; |
39 | use Illuminate\Support\Facades\Validator; | 39 | use Illuminate\Support\Facades\Validator; |
40 | 40 | ||
41 | class WorkerController extends Controller | 41 | class WorkerController extends Controller |
42 | { | 42 | { |
43 | public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу'); | 43 | public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу'); |
44 | 44 | ||
45 | //профиль | 45 | //профиль |
46 | public function profile(Worker $worker) | 46 | public function profile(Worker $worker) |
47 | { | 47 | { |
48 | $get_date = date('Y.m'); | 48 | $get_date = date('Y.m'); |
49 | 49 | ||
50 | $c = Static_worker::query()->where('year_month', '=', $get_date) | 50 | $c = Static_worker::query()->where('year_month', '=', $get_date) |
51 | ->where('user_id', '=', $worker->users->id) | 51 | ->where('user_id', '=', $worker->users->id) |
52 | ->get(); | 52 | ->get(); |
53 | 53 | ||
54 | if ($c->count() > 0) { | 54 | if ($c->count() > 0) { |
55 | $upd = Static_worker::find($c[0]->id); | 55 | $upd = Static_worker::find($c[0]->id); |
56 | $upd->lookin = $upd->lookin + 1; | 56 | $upd->lookin = $upd->lookin + 1; |
57 | $upd->save(); | 57 | $upd->save(); |
58 | } else { | 58 | } else { |
59 | $crt = new Static_worker(); | 59 | $crt = new Static_worker(); |
60 | $crt->lookin = 1; | 60 | $crt->lookin = 1; |
61 | $crt->year_month = $get_date; | 61 | $crt->year_month = $get_date; |
62 | $crt->user_id = $worker->user_id; | 62 | $crt->user_id = $worker->user_id; |
63 | $crt->save(); | 63 | $crt->save(); |
64 | } | 64 | } |
65 | 65 | ||
66 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 66 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
67 | ->where('user_id', '=', $worker->users->id) | 67 | ->where('user_id', '=', $worker->users->id) |
68 | ->get(); | 68 | ->get(); |
69 | 69 | ||
70 | return view('public.workers.profile', compact('worker', 'stat')); | 70 | return view('public.workers.profile', compact('worker', 'stat')); |
71 | } | 71 | } |
72 | 72 | ||
73 | // лист база резюме | 73 | // лист база резюме |
74 | public function bd_resume(Request $request) | 74 | public function bd_resume(Request $request) |
75 | { | 75 | { |
76 | $look = false; | 76 | $look = false; |
77 | $idiot = 0; | 77 | $idiot = 0; |
78 | if (isset(Auth()->user()->id)) { | 78 | if (isset(Auth()->user()->id)) { |
79 | $idiot = Auth()->user()->id; | 79 | $idiot = Auth()->user()->id; |
80 | if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin)) | 80 | if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin)) |
81 | $look = true; | 81 | $look = true; |
82 | } | 82 | } |
83 | 83 | ||
84 | if ($look) { | 84 | if ($look) { |
85 | $status_work = $this->status_work; | 85 | $status_work = $this->status_work; |
86 | $resumes = Worker::query()->with('users')->with('job_titles'); | 86 | $resumes = Worker::query()->with('users')->with('job_titles'); |
87 | $resumes = $resumes->whereHas('users', function (Builder $query) { | 87 | $resumes = $resumes->whereHas('users', function (Builder $query) { |
88 | $query->Where('is_worker', '=', '1') | 88 | $query->Where('is_worker', '=', '1') |
89 | ->Where('is_bd', '=', '0'); | 89 | ->Where('is_bd', '=', '0'); |
90 | }); | 90 | }); |
91 | 91 | ||
92 | //dd($request->get('job')); | 92 | //dd($request->get('job')); |
93 | if (($request->has('job')) && ($request->get('job') > 0)) { | 93 | if (($request->has('job')) && ($request->get('job') > 0)) { |
94 | $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { | 94 | $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { |
95 | $query->Where('job_titles.id', $request->get('job')); | 95 | $query->Where('job_titles.id', $request->get('job')); |
96 | }); | 96 | }); |
97 | } | 97 | } |
98 | 98 | ||
99 | $Job_title = Job_title::query()->get(); | 99 | $Job_title = Job_title::query()->get(); |
100 | 100 | ||
101 | if ($request->get('sort')) { | 101 | if ($request->get('sort')) { |
102 | $sort = $request->get('sort'); | 102 | $sort = $request->get('sort'); |
103 | switch ($sort) { | 103 | switch ($sort) { |
104 | case 'name_up': | 104 | case 'name_up': |
105 | $resumes = $resumes->orderBy(User::select('surname') | 105 | $resumes = $resumes->orderBy(User::select('surname') |
106 | ->whereColumn('Workers.user_id', 'users.id') | 106 | ->whereColumn('Workers.user_id', 'users.id') |
107 | ); | 107 | ); |
108 | break; | 108 | break; |
109 | case 'name_down': | 109 | case 'name_down': |
110 | $resumes = $resumes->orderByDesc(User::select('surname') | 110 | $resumes = $resumes->orderByDesc(User::select('surname') |
111 | ->whereColumn('Workers.user_id', 'users.id') | 111 | ->whereColumn('Workers.user_id', 'users.id') |
112 | ); | 112 | ); |
113 | break; | 113 | break; |
114 | case 'created_at_up': | 114 | case 'created_at_up': |
115 | $resumes = $resumes->OrderBy('created_at')->orderBy('id'); | 115 | $resumes = $resumes->OrderBy('created_at')->orderBy('id'); |
116 | break; | 116 | break; |
117 | case 'created_at_down': | 117 | case 'created_at_down': |
118 | $resumes = $resumes->orderByDesc('created_at')->orderBy('id'); | 118 | $resumes = $resumes->orderByDesc('created_at')->orderBy('id'); |
119 | break; | 119 | break; |
120 | case 'default': | 120 | case 'default': |
121 | $resumes = $resumes->orderBy('id')->orderby('updated_at'); | 121 | $resumes = $resumes->orderBy('id')->orderby('updated_at'); |
122 | break; | 122 | break; |
123 | default: | 123 | default: |
124 | $resumes = $resumes->orderBy('id')->orderby('updated_at'); | 124 | $resumes = $resumes->orderBy('id')->orderby('updated_at'); |
125 | break; | 125 | break; |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | $res_count = $resumes->count(); | 129 | $res_count = $resumes->count(); |
130 | //$resumes = $resumes->get(); | 130 | //$resumes = $resumes->get(); |
131 | $resumes = $resumes->paginate(4); | 131 | $resumes = $resumes->paginate(4); |
132 | if ($request->ajax()) { | 132 | if ($request->ajax()) { |
133 | // Условия обставлены | 133 | // Условия обставлены |
134 | if ($request->has('block') && ($request->get('block') == 1)) { | 134 | if ($request->has('block') && ($request->get('block') == 1)) { |
135 | return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); | 135 | return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); |
136 | } | 136 | } |
137 | 137 | ||
138 | if ($request->has('block') && ($request->get('block') == 2)) { | 138 | if ($request->has('block') && ($request->get('block') == 2)) { |
139 | return view('ajax.resume_2', compact('resumes', 'status_work', 'res_count', 'idiot')); | 139 | return view('ajax.resume_2', compact('resumes', 'status_work', 'res_count', 'idiot')); |
140 | } | 140 | } |
141 | } else { | 141 | } else { |
142 | return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title')); | 142 | return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title')); |
143 | } | 143 | } |
144 | } else { | 144 | } else { |
145 | return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); | 145 | return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); |
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | //Лайк резюме | 149 | //Лайк резюме |
150 | public function like_controller() { | 150 | public function like_controller() { |
151 | 151 | ||
152 | } | 152 | } |
153 | 153 | ||
154 | // анкета соискателя | 154 | // анкета соискателя |
155 | public function resume_profile(Worker $worker) | 155 | public function resume_profile(Worker $worker) |
156 | { | 156 | { |
157 | if (isset(Auth()->user()->id)) { | 157 | if (isset(Auth()->user()->id)) { |
158 | $idiot = Auth()->user()->id; | 158 | $idiot = Auth()->user()->id; |
159 | } else { | 159 | } else { |
160 | $idiot = 0; | 160 | $idiot = 0; |
161 | } | 161 | } |
162 | 162 | ||
163 | $status_work = $this->status_work; | 163 | $status_work = $this->status_work; |
164 | $Query = Worker::query()->with('users')->with('job_titles') | 164 | $Query = Worker::query()->with('users')->with('job_titles') |
165 | ->with('place_worker')->with('sertificate')->with('prev_company') | 165 | ->with('place_worker')->with('sertificate')->with('prev_company') |
166 | ->with('infobloks'); | 166 | ->with('infobloks'); |
167 | $Query = $Query->where('id', '=', $worker->id); | 167 | $Query = $Query->where('id', '=', $worker->id); |
168 | $Query = $Query->get(); | 168 | $Query = $Query->get(); |
169 | 169 | ||
170 | $get_date = date('Y.m'); | 170 | $get_date = date('Y.m'); |
171 | $c = Static_worker::query()->where('year_month', '=', $get_date) | 171 | $c = Static_worker::query()->where('year_month', '=', $get_date) |
172 | ->where('user_id', '=', $worker->id) | 172 | ->where('user_id', '=', $worker->id) |
173 | ->get(); | 173 | ->get(); |
174 | 174 | ||
175 | if ($c->count() > 0) { | 175 | if ($c->count() > 0) { |
176 | $upd = Static_worker::find($c[0]->id); | 176 | $upd = Static_worker::find($c[0]->id); |
177 | $upd->lookin = $upd->lookin + 1; | 177 | $upd->lookin = $upd->lookin + 1; |
178 | $upd->save(); | 178 | $upd->save(); |
179 | } else { | 179 | } else { |
180 | $crt = new Static_worker(); | 180 | $crt = new Static_worker(); |
181 | $crt->lookin = 1; | 181 | $crt->lookin = 1; |
182 | $crt->year_month = $get_date; | 182 | $crt->year_month = $get_date; |
183 | $crt->user_id = $worker->user_id; | 183 | $crt->user_id = $worker->user_id; |
184 | $crt->save(); | 184 | $crt->save(); |
185 | } | 185 | } |
186 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 186 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
187 | ->where('user_id', '=', $worker->id) | 187 | ->where('user_id', '=', $worker->id) |
188 | ->get(); | 188 | ->get(); |
189 | return view('worker', compact('Query', 'status_work', 'idiot')); | 189 | return view('worker', compact('Query', 'status_work', 'idiot')); |
190 | } | 190 | } |
191 | 191 | ||
192 | // скачать анкету соискателя | 192 | // скачать анкету соискателя |
193 | public function resume_download(Worker $worker) | 193 | public function resume_download(Worker $worker) |
194 | { | 194 | { |
195 | $status_work = $this->status_work; | 195 | $status_work = $this->status_work; |
196 | $Query = Worker::query()->with('users')->with('job_titles') | 196 | $Query = Worker::query()->with('users')->with('job_titles') |
197 | ->with('place_worker')->with('sertificate')->with('prev_company') | 197 | ->with('place_worker')->with('sertificate')->with('prev_company') |
198 | ->with('infobloks'); | 198 | ->with('infobloks'); |
199 | $Query = $Query->where('id', '=', $worker->id); | 199 | $Query = $Query->where('id', '=', $worker->id); |
200 | $Query = $Query->get()->toArray(); | 200 | $Query = $Query->get()->toArray(); |
201 | 201 | ||
202 | view()->share('Query',$Query); | 202 | view()->share('Query',$Query); |
203 | 203 | ||
204 | 204 | ||
205 | $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape'); | 205 | $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape'); |
206 | 206 | ||
207 | return $pdf->stream(); | 207 | return $pdf->stream(); |
208 | } | 208 | } |
209 | 209 | ||
210 | public function resume_download_all() { | 210 | public function resume_download_all() { |
211 | $status_work = $this->status_work; | 211 | $status_work = $this->status_work; |
212 | $Query = Worker::query()->with('users')->with('job_titles') | 212 | $Query = Worker::query()->with('users')->with('job_titles') |
213 | ->with('place_worker')->with('sertificate')->with('prev_company') | 213 | ->with('place_worker')->with('sertificate')->with('prev_company') |
214 | ->with('infobloks')-> | 214 | ->with('infobloks')-> |
215 | whereHas('users', function (Builder $query) { | 215 | whereHas('users', function (Builder $query) { |
216 | $query->Where('is_worker', '=', '1') | 216 | $query->Where('is_worker', '=', '1') |
217 | ->Where('is_bd', '=', '1'); | 217 | ->Where('is_bd', '=', '1'); |
218 | }); | 218 | }); |
219 | //$Query = $Query->where('id', '=', $worker->id); | 219 | //$Query = $Query->where('id', '=', $worker->id); |
220 | $Query = $Query->get()->toArray(); | 220 | $Query = $Query->get()->toArray(); |
221 | 221 | ||
222 | view()->share('Query',$Query); | 222 | view()->share('Query',$Query); |
223 | 223 | ||
224 | $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape'); | 224 | $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape'); |
225 | 225 | ||
226 | return $pdf->stream(); | 226 | return $pdf->stream(); |
227 | } | 227 | } |
228 | 228 | ||
229 | // Кабинет работника | 229 | // Кабинет работника |
230 | public function cabinet(Request $request) | 230 | public function cabinet(Request $request) |
231 | { | 231 | { |
232 | // дата год и месяц | 232 | // дата год и месяц |
233 | $get_date = date('Y.m'); | 233 | $get_date = date('Y.m'); |
234 | 234 | ||
235 | $id = Auth()->user()->id; | 235 | $id = Auth()->user()->id; |
236 | 236 | ||
237 | $Infobloks = infobloks::query()->get(); | 237 | $Infobloks = infobloks::query()->get(); |
238 | 238 | ||
239 | $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')-> | 239 | $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')-> |
240 | with('infobloks')->with('place_worker')-> | 240 | with('infobloks')->with('place_worker')-> |
241 | WhereHas('users', | 241 | WhereHas('users', |
242 | function (Builder $query) use ($id) {$query->Where('id', $id); | 242 | function (Builder $query) use ($id) {$query->Where('id', $id); |
243 | })->get(); | 243 | })->get(); |
244 | 244 | ||
245 | $Job_titles = Job_title::query()->where('is_remove', '=', '0')-> | 245 | $Job_titles = Job_title::query()->where('is_remove', '=', '0')-> |
246 | where('is_bd', '=' , '1')-> | 246 | where('is_bd', '=' , '1')-> |
247 | OrderBy('name')->get(); | 247 | OrderByDesc('sort')->OrderBy('name')->get(); |
248 | $Infoblocks = infobloks::query()->OrderBy('name')->get(); | 248 | $Infoblocks = infobloks::query()->OrderBy('name')->get(); |
249 | 249 | ||
250 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 250 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
251 | ->where('user_id', '=', $Worker[0]->id) | 251 | ->where('user_id', '=', $Worker[0]->id) |
252 | ->get(); | 252 | ->get(); |
253 | 253 | ||
254 | // 10% | 254 | // 10% |
255 | 255 | ||
256 | $persent = 10; | 256 | $persent = 10; |
257 | $persent1 = 0; | 257 | $persent1 = 0; |
258 | $persent2 = 0; | 258 | $persent2 = 0; |
259 | $persent3 = 0; | 259 | $persent3 = 0; |
260 | $persent4 = 0; | 260 | $persent4 = 0; |
261 | $persent5 = 0; | 261 | $persent5 = 0; |
262 | 262 | ||
263 | if ((!empty($Worker[0]->telephone)) && | 263 | if ((!empty($Worker[0]->telephone)) && |
264 | (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) && | 264 | (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) && |
265 | (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) { | 265 | (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) { |
266 | // 40% | 266 | // 40% |
267 | $persent = $persent + 40; | 267 | $persent = $persent + 40; |
268 | $persent1 = 40; | 268 | $persent1 = 40; |
269 | } | 269 | } |
270 | 270 | ||
271 | //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year); | 271 | //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year); |
272 | 272 | ||
273 | if ($Worker[0]->sertificate->count() > 0) { | 273 | if ($Worker[0]->sertificate->count() > 0) { |
274 | // 15% | 274 | // 15% |
275 | $persent = $persent + 15; | 275 | $persent = $persent + 15; |
276 | $persent2 = 15; | 276 | $persent2 = 15; |
277 | } | 277 | } |
278 | 278 | ||
279 | if ($Worker[0]->infobloks->count() > 0) { | 279 | if ($Worker[0]->infobloks->count() > 0) { |
280 | // 20% | 280 | // 20% |
281 | $persent = $persent + 20; | 281 | $persent = $persent + 20; |
282 | $persent3 = 20; | 282 | $persent3 = 20; |
283 | } | 283 | } |
284 | 284 | ||
285 | if ($Worker[0]->prev_company->count() > 0) { | 285 | if ($Worker[0]->prev_company->count() > 0) { |
286 | // 10% | 286 | // 10% |
287 | $persent = $persent + 10; | 287 | $persent = $persent + 10; |
288 | $persent4 = 10; | 288 | $persent4 = 10; |
289 | } | 289 | } |
290 | 290 | ||
291 | if (!empty($Worker[0]->photo)) { | 291 | if (!empty($Worker[0]->photo)) { |
292 | // 5% | 292 | // 5% |
293 | $persent = $persent + 5; | 293 | $persent = $persent + 5; |
294 | $persent5 = 5; | 294 | $persent5 = 5; |
295 | } | 295 | } |
296 | if ($request->has('print')) { | 296 | if ($request->has('print')) { |
297 | dd($Worker); | 297 | dd($Worker); |
298 | } else { | 298 | } else { |
299 | return view('workers.cabinet', compact('Worker', 'Infobloks', 'persent', 'Job_titles', 'Infoblocks', 'stat')); | 299 | return view('workers.cabinet', compact('Worker', 'Infobloks', 'persent', 'Job_titles', 'Infoblocks', 'stat')); |
300 | } | 300 | } |
301 | } | 301 | } |
302 | 302 | ||
303 | // Сохранение данных | 303 | // Сохранение данных |
304 | public function cabinet_save(Worker $worker, Request $request) | 304 | public function cabinet_save(Worker $worker, Request $request) |
305 | { | 305 | { |
306 | $id = $worker->id; | 306 | $id = $worker->id; |
307 | $params = $request->all(); | 307 | $params = $request->all(); |
308 | 308 | ||
309 | $job_title_id = $request->get('job_title_id'); | 309 | $job_title_id = $request->get('job_title_id'); |
310 | 310 | ||
311 | unset($params['new_diplom']); | 311 | unset($params['new_diplom']); |
312 | unset($params['new_data_begin']); | 312 | unset($params['new_data_begin']); |
313 | unset($params['new_data_end']); | 313 | unset($params['new_data_end']); |
314 | unset($params['new_job_title']); | 314 | unset($params['new_job_title']); |
315 | unset($params['new_teplohod']); | 315 | unset($params['new_teplohod']); |
316 | unset($params['new_GWT']); | 316 | unset($params['new_GWT']); |
317 | unset($params['new_KBT']); | 317 | unset($params['new_KBT']); |
318 | unset($params['new_Begin_work']); | 318 | unset($params['new_Begin_work']); |
319 | unset($params['new_End_work']); | 319 | unset($params['new_End_work']); |
320 | unset($params['new_name_company']); | 320 | unset($params['new_name_company']); |
321 | 321 | ||
322 | $rules = [ | 322 | $rules = [ |
323 | 'surname' => ['required', 'string', 'max:255'], | 323 | 'surname' => ['required', 'string', 'max:255'], |
324 | 'name_man' => ['required', 'string', 'max:255'], | 324 | 'name_man' => ['required', 'string', 'max:255'], |
325 | 'email' => ['required', 'string', 'email', 'max:255'], | 325 | 'email' => ['required', 'string', 'email', 'max:255'], |
326 | 326 | ||
327 | ]; | 327 | ]; |
328 | 328 | ||
329 | $messages = [ | 329 | $messages = [ |
330 | 'required' => 'Укажите обязательное поле', | 330 | 'required' => 'Укажите обязательное поле', |
331 | 'min' => [ | 331 | 'min' => [ |
332 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 332 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
333 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 333 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
334 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 334 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
335 | ], | 335 | ], |
336 | 'max' => [ | 336 | 'max' => [ |
337 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 337 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
338 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 338 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
339 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 339 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
340 | ] | 340 | ] |
341 | ]; | 341 | ]; |
342 | 342 | ||
343 | $validator = Validator::make($params, $rules, $messages); | 343 | $validator = Validator::make($params, $rules, $messages); |
344 | 344 | ||
345 | if ($validator->fails()) { | 345 | if ($validator->fails()) { |
346 | return redirect()->route('worker.cabinet')->withErrors($validator); | 346 | return redirect()->route('worker.cabinet')->withErrors($validator); |
347 | } else { | 347 | } else { |
348 | 348 | ||
349 | if ($request->has('photo')) { | 349 | if ($request->has('photo')) { |
350 | if (!empty($Worker->photo)) { | 350 | if (!empty($Worker->photo)) { |
351 | Storage::delete($Worker->photo); | 351 | Storage::delete($Worker->photo); |
352 | } | 352 | } |
353 | $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); | 353 | $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); |
354 | } | 354 | } |
355 | 355 | ||
356 | if ($request->has('file')) { | 356 | if ($request->has('file')) { |
357 | if (!empty($Worker->file)) { | 357 | if (!empty($Worker->file)) { |
358 | Storage::delete($Worker->file); | 358 | Storage::delete($Worker->file); |
359 | } | 359 | } |
360 | $params['file'] = $request->file('file')->store("worker/$id", 'public'); | 360 | $params['file'] = $request->file('file')->store("worker/$id", 'public'); |
361 | } | 361 | } |
362 | 362 | ||
363 | $id_wor = $worker->update($params); | 363 | $id_wor = $worker->update($params); |
364 | $use = User::find($worker->user_id); | 364 | $use = User::find($worker->user_id); |
365 | $use->surname = $request->get('surname'); | 365 | $use->surname = $request->get('surname'); |
366 | $use->name_man = $request->get('name_man'); | 366 | $use->name_man = $request->get('name_man'); |
367 | $use->surname2 = $request->get('surname2'); | 367 | $use->surname2 = $request->get('surname2'); |
368 | 368 | ||
369 | $use->save(); | 369 | $use->save(); |
370 | $worker->job_titles()->sync($job_title_id); | 370 | $worker->job_titles()->sync($job_title_id); |
371 | 371 | ||
372 | return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); | 372 | return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); |
373 | } | 373 | } |
374 | } | 374 | } |
375 | 375 | ||
376 | // Сообщения данные | 376 | // Сообщения данные |
377 | public function messages($type_message) | 377 | public function messages($type_message) |
378 | { | 378 | { |
379 | $user_id = Auth()->user()->id; | 379 | $user_id = Auth()->user()->id; |
380 | 380 | ||
381 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> | 381 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> |
382 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); | 382 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); |
383 | 383 | ||
384 | $messages_output = Message::query()->with('vacancies')-> | 384 | $messages_output = Message::query()->with('vacancies')-> |
385 | with('user_to')->where('user_id', $user_id)-> | 385 | with('user_to')->where('user_id', $user_id)-> |
386 | OrderByDesc('created_at'); | 386 | OrderByDesc('created_at'); |
387 | 387 | ||
388 | 388 | ||
389 | $count_input = $messages_input->count(); | 389 | $count_input = $messages_input->count(); |
390 | $count_output = $messages_output->count(); | 390 | $count_output = $messages_output->count(); |
391 | 391 | ||
392 | if ($type_message == 'input') { | 392 | if ($type_message == 'input') { |
393 | $messages = $messages_input->paginate(5); | 393 | $messages = $messages_input->paginate(5); |
394 | } | 394 | } |
395 | 395 | ||
396 | if ($type_message == 'output') { | 396 | if ($type_message == 'output') { |
397 | $messages = $messages_output->paginate(5); | 397 | $messages = $messages_output->paginate(5); |
398 | } | 398 | } |
399 | 399 | ||
400 | // Вернуть все 100% | 400 | // Вернуть все 100% |
401 | return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); | 401 | return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); |
402 | } | 402 | } |
403 | 403 | ||
404 | // Избранный | 404 | // Избранный |
405 | public function favorite() | 405 | public function favorite() |
406 | { | 406 | { |
407 | return view('workers.favorite'); | 407 | return view('workers.favorite'); |
408 | } | 408 | } |
409 | 409 | ||
410 | // Сменить пароль | 410 | // Сменить пароль |
411 | public function new_password() | 411 | public function new_password() |
412 | { | 412 | { |
413 | $email = Auth()->user()->email; | 413 | $email = Auth()->user()->email; |
414 | return view('workers.new_password', compact('email')); | 414 | return view('workers.new_password', compact('email')); |
415 | } | 415 | } |
416 | 416 | ||
417 | // Обновление пароля | 417 | // Обновление пароля |
418 | public function save_new_password(Request $request) { | 418 | public function save_new_password(Request $request) { |
419 | $use = Auth()->user(); | 419 | $use = Auth()->user(); |
420 | $request->validate([ | 420 | $request->validate([ |
421 | 'password' => 'required|string', | 421 | 'password' => 'required|string', |
422 | 'new_password' => 'required|string', | 422 | 'new_password' => 'required|string', |
423 | 'new_password2' => 'required|string' | 423 | 'new_password2' => 'required|string' |
424 | ]); | 424 | ]); |
425 | 425 | ||
426 | if ($request->get('new_password') == $request->get('new_password2')) | 426 | if ($request->get('new_password') == $request->get('new_password2')) |
427 | if ($request->get('password') !== $request->get('new_password')) { | 427 | if ($request->get('password') !== $request->get('new_password')) { |
428 | $credentials = $request->only('email', 'password'); | 428 | $credentials = $request->only('email', 'password'); |
429 | if (Auth::attempt($credentials, $request->has('save_me'))) { | 429 | if (Auth::attempt($credentials, $request->has('save_me'))) { |
430 | 430 | ||
431 | if (!is_null($use->email_verified_at)){ | 431 | if (!is_null($use->email_verified_at)){ |
432 | 432 | ||
433 | $user_data = User_Model::find($use->id); | 433 | $user_data = User_Model::find($use->id); |
434 | $user_data->update([ | 434 | $user_data->update([ |
435 | 'password' => Hash::make($request->get('new_password')), | 435 | 'password' => Hash::make($request->get('new_password')), |
436 | 'pubpassword' => base64_encode($request->get('new_password')), | 436 | 'pubpassword' => base64_encode($request->get('new_password')), |
437 | ]); | 437 | ]); |
438 | return redirect() | 438 | return redirect() |
439 | ->route('worker.new_password') | 439 | ->route('worker.new_password') |
440 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 440 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
441 | } | 441 | } |
442 | 442 | ||
443 | return redirect() | 443 | return redirect() |
444 | ->route('worker.new_password') | 444 | ->route('worker.new_password') |
445 | ->withError('Данная учетная запись не было верифицированна!'); | 445 | ->withError('Данная учетная запись не было верифицированна!'); |
446 | } | 446 | } |
447 | } | 447 | } |
448 | 448 | ||
449 | return redirect() | 449 | return redirect() |
450 | ->route('worker.new_password') | 450 | ->route('worker.new_password') |
451 | ->withErrors('Не совпадение данных, обновите пароли!'); | 451 | ->withErrors('Не совпадение данных, обновите пароли!'); |
452 | } | 452 | } |
453 | 453 | ||
454 | // Удаление профиля форма | 454 | // Удаление профиля форма |
455 | public function delete_profile() | 455 | public function delete_profile() |
456 | { | 456 | { |
457 | $login = Auth()->user()->email; | 457 | $login = Auth()->user()->email; |
458 | return view('workers.delete_profile', compact('login')); | 458 | return view('workers.delete_profile', compact('login')); |
459 | } | 459 | } |
460 | 460 | ||
461 | // Удаление профиля код | 461 | // Удаление профиля код |
462 | public function delete_profile_result(Request $request) { | 462 | public function delete_profile_result(Request $request) { |
463 | $Answer = $request->all(); | 463 | $Answer = $request->all(); |
464 | $user_id = Auth()->user()->id; | 464 | $user_id = Auth()->user()->id; |
465 | $request->validate([ | 465 | $request->validate([ |
466 | 'password' => 'required|string', | 466 | 'password' => 'required|string', |
467 | ]); | 467 | ]); |
468 | 468 | ||
469 | $credentials = $request->only('email', 'password'); | 469 | $credentials = $request->only('email', 'password'); |
470 | if (Auth::attempt($credentials)) { | 470 | if (Auth::attempt($credentials)) { |
471 | Auth::logout(); | 471 | Auth::logout(); |
472 | $it = User_Model::find($user_id); | 472 | $it = User_Model::find($user_id); |
473 | $it->delete(); | 473 | $it->delete(); |
474 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 474 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
475 | } else { | 475 | } else { |
476 | return redirect()->route('worker.delete_profile') | 476 | return redirect()->route('worker.delete_profile') |
477 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 477 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
478 | } | 478 | } |
479 | } | 479 | } |
480 | 480 | ||
481 | // Регистрация соискателя | 481 | // Регистрация соискателя |
482 | public function register_worker(Request $request) | 482 | public function register_worker(Request $request) |
483 | { | 483 | { |
484 | $params = $request->all(); | 484 | $params = $request->all(); |
485 | $params['is_worker'] = 1; | 485 | $params['is_worker'] = 1; |
486 | 486 | ||
487 | $rules = [ | 487 | $rules = [ |
488 | 'surname' => ['required', 'string', 'max:255'], | 488 | 'surname' => ['required', 'string', 'max:255'], |
489 | 'name_man' => ['required', 'string', 'max:255'], | 489 | 'name_man' => ['required', 'string', 'max:255'], |
490 | 'email' => ['required', 'email', 'max:255', 'unique:users'], | 490 | 'email' => ['required', 'email', 'max:255', 'unique:users'], |
491 | 'password' => ['required', 'string', 'min:6'] | 491 | 'password' => ['required', 'string', 'min:6'] |
492 | ]; | 492 | ]; |
493 | 493 | ||
494 | $messages = [ | 494 | $messages = [ |
495 | 'required' => 'Укажите обязательное поле', | 495 | 'required' => 'Укажите обязательное поле', |
496 | 'min' => [ | 496 | 'min' => [ |
497 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 497 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
498 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 498 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
499 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 499 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
500 | ], | 500 | ], |
501 | 'max' => [ | 501 | 'max' => [ |
502 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 502 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
503 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 503 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
504 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 504 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
505 | ] | 505 | ] |
506 | ]; | 506 | ]; |
507 | 507 | ||
508 | $email = $request->get('email'); | 508 | $email = $request->get('email'); |
509 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | 509 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { |
510 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | 510 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); |
511 | } | 511 | } |
512 | 512 | ||
513 | if ($request->get('password') !== $request->get('confirmed')){ | 513 | if ($request->get('password') !== $request->get('confirmed')){ |
514 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | 514 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); |
515 | } | 515 | } |
516 | 516 | ||
517 | if (strlen($request->get('password')) < 6) { | 517 | if (strlen($request->get('password')) < 6) { |
518 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | 518 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); |
519 | } | 519 | } |
520 | 520 | ||
521 | /*$haystack = $request->get('password'); | 521 | /*$haystack = $request->get('password'); |
522 | 522 | ||
523 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); | 523 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); |
524 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', | 524 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', |
525 | 'X', 'C', 'V', 'B', 'N', 'M'); | 525 | 'X', 'C', 'V', 'B', 'N', 'M'); |
526 | $lenpwd_bool = true; | 526 | $lenpwd_bool = true; |
527 | $spec_bool = false; | 527 | $spec_bool = false; |
528 | $alpha_bool = false; | 528 | $alpha_bool = false; |
529 | 529 | ||
530 | if (strlen($haystack) < 8) $lenpwd_bool = false; | 530 | if (strlen($haystack) < 8) $lenpwd_bool = false; |
531 | 531 | ||
532 | foreach ($specsumbol as $it) { | 532 | foreach ($specsumbol as $it) { |
533 | if (strpos($haystack, $it) !== false) { | 533 | if (strpos($haystack, $it) !== false) { |
534 | $spec_bool = true; | 534 | $spec_bool = true; |
535 | } | 535 | } |
536 | } | 536 | } |
537 | 537 | ||
538 | foreach ($alpha as $it) { | 538 | foreach ($alpha as $it) { |
539 | if (strpos($haystack, $it) !== false) { | 539 | if (strpos($haystack, $it) !== false) { |
540 | $alpha_bool = true; | 540 | $alpha_bool = true; |
541 | } | 541 | } |
542 | } | 542 | } |
543 | 543 | ||
544 | if ((!$spec_bool) || (!$alpha_bool)) { | 544 | if ((!$spec_bool) || (!$alpha_bool)) { |
545 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); | 545 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); |
546 | }*/ | 546 | }*/ |
547 | 547 | ||
548 | if (($request->has('politik')) && ($request->get('politik') == 1)) { | 548 | if (($request->has('politik')) && ($request->get('politik') == 1)) { |
549 | $validator = Validator::make($params, $rules, $messages); | 549 | $validator = Validator::make($params, $rules, $messages); |
550 | 550 | ||
551 | if ($validator->fails()) { | 551 | if ($validator->fails()) { |
552 | return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | 552 | return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); |
553 | } else { | 553 | } else { |
554 | //dd($params); | 554 | //dd($params); |
555 | $user = $this->create($params); | 555 | $user = $this->create($params); |
556 | event(new Registered($user)); | 556 | event(new Registered($user)); |
557 | Auth::guard()->login($user); | 557 | Auth::guard()->login($user); |
558 | } | 558 | } |
559 | if ($user) { | 559 | if ($user) { |
560 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; | 560 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; |
561 | } else { | 561 | } else { |
562 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | 562 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); |
563 | } | 563 | } |
564 | 564 | ||
565 | } else { | 565 | } else { |
566 | return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); | 566 | return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); |
567 | } | 567 | } |
568 | } | 568 | } |
569 | 569 | ||
570 | // Звездная оценка и ответ | 570 | // Звездная оценка и ответ |
571 | public function stars_answer(Request $request) { | 571 | public function stars_answer(Request $request) { |
572 | $params = $request->all(); | 572 | $params = $request->all(); |
573 | $rules = [ | 573 | $rules = [ |
574 | 'message' => ['required', 'string', 'max:255'], | 574 | 'message' => ['required', 'string', 'max:255'], |
575 | ]; | 575 | ]; |
576 | 576 | ||
577 | $messages = [ | 577 | $messages = [ |
578 | 'required' => 'Укажите обязательное поле', | 578 | 'required' => 'Укажите обязательное поле', |
579 | 'min' => [ | 579 | 'min' => [ |
580 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 580 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
581 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 581 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
582 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 582 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
583 | ], | 583 | ], |
584 | 'max' => [ | 584 | 'max' => [ |
585 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 585 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
586 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 586 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
587 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 587 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
588 | ] | 588 | ] |
589 | ]; | 589 | ]; |
590 | $response_worker = ResponseWork::create($params); | 590 | $response_worker = ResponseWork::create($params); |
591 | return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); | 591 | return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); |
592 | } | 592 | } |
593 | 593 | ||
594 | public function TestWorker() | 594 | public function TestWorker() |
595 | { | 595 | { |
596 | $Use = new User(); | 596 | $Use = new User(); |
597 | 597 | ||
598 | $Code_user = $Use->create([ | 598 | $Code_user = $Use->create([ |
599 | 'name' => 'surname name_man', | 599 | 'name' => 'surname name_man', |
600 | 'name_man' => 'name_man', | 600 | 'name_man' => 'name_man', |
601 | 'surname' => 'surname', | 601 | 'surname' => 'surname', |
602 | 'surname2' => 'surname2', | 602 | 'surname2' => 'surname2', |
603 | 'subscribe_email' => '1', | 603 | 'subscribe_email' => '1', |
604 | 'email' => 'email@mail.com', | 604 | 'email' => 'email@mail.com', |
605 | 'telephone' => '1234567890', | 605 | 'telephone' => '1234567890', |
606 | 'password' => Hash::make('password'), | 606 | 'password' => Hash::make('password'), |
607 | 'pubpassword' => base64_encode('password'), | 607 | 'pubpassword' => base64_encode('password'), |
608 | 'email_verified_at' => Carbon::now(), | 608 | 'email_verified_at' => Carbon::now(), |
609 | 'is_worker' => 1, | 609 | 'is_worker' => 1, |
610 | ]); | 610 | ]); |
611 | 611 | ||
612 | if ($Code_user->id > 0) { | 612 | if ($Code_user->id > 0) { |
613 | $Worker = new Worker(); | 613 | $Worker = new Worker(); |
614 | $Worker->user_id = $Code_user->id; | 614 | $Worker->user_id = $Code_user->id; |
615 | $Worker->position_work = 1; //'job_titles'; | 615 | $Worker->position_work = 1; //'job_titles'; |
616 | $Worker->email = 'email@email.com'; | 616 | $Worker->email = 'email@email.com'; |
617 | $Worker->telephone = '1234567890'; | 617 | $Worker->telephone = '1234567890'; |
618 | $status = $Worker->save(); | 618 | $status = $Worker->save(); |
619 | 619 | ||
620 | $Title_Worker = new Title_worker(); | 620 | $Title_Worker = new Title_worker(); |
621 | $Title_Worker->worker_id = $Worker->id; | 621 | $Title_Worker->worker_id = $Worker->id; |
622 | $Title_Worker->job_title_id = 1; | 622 | $Title_Worker->job_title_id = 1; |
623 | $Title_Worker->save(); | 623 | $Title_Worker->save(); |
624 | } | 624 | } |
625 | } | 625 | } |
626 | 626 | ||
627 | // Создание пользователя | 627 | // Создание пользователя |
628 | protected function create(array $data) | 628 | protected function create(array $data) |
629 | { | 629 | { |
630 | $Use = new User(); | 630 | $Use = new User(); |
631 | 631 | ||
632 | $Code_user = $Use->create([ | 632 | $Code_user = $Use->create([ |
633 | 'name' => $data['surname']." ".$data['name_man'], | 633 | 'name' => $data['surname']." ".$data['name_man'], |
634 | 'name_man' => $data['name_man'], | 634 | 'name_man' => $data['name_man'], |
635 | 'surname' => $data['surname'], | 635 | 'surname' => $data['surname'], |
636 | 'surname2' => $data['surname2'], | 636 | 'surname2' => $data['surname2'], |
637 | 'subscribe_email' => $data['email'], | 637 | 'subscribe_email' => $data['email'], |
638 | 'email' => $data['email'], | 638 | 'email' => $data['email'], |
639 | 'telephone' => $data['telephone'], | 639 | 'telephone' => $data['telephone'], |
640 | 'password' => Hash::make($data['password']), | 640 | 'password' => Hash::make($data['password']), |
641 | 'pubpassword' => base64_encode($data['password']), | 641 | 'pubpassword' => base64_encode($data['password']), |
642 | 'email_verified_at' => Carbon::now(), | 642 | 'email_verified_at' => Carbon::now(), |
643 | 'is_worker' => $data['is_worker'], | 643 | 'is_worker' => $data['is_worker'], |
644 | ]); | 644 | ]); |
645 | 645 | ||
646 | if ($Code_user->id > 0) { | 646 | if ($Code_user->id > 0) { |
647 | $Worker = new Worker(); | 647 | $Worker = new Worker(); |
648 | $Worker->user_id = $Code_user->id; | 648 | $Worker->user_id = $Code_user->id; |
649 | $Worker->position_work = $data['job_titles']; | 649 | $Worker->position_work = $data['job_titles']; |
650 | $Worker->email = $data['email']; | 650 | $Worker->email = $data['email']; |
651 | $Worker->telephone = $data['telephone']; | 651 | $Worker->telephone = $data['telephone']; |
652 | $Worker->save(); | 652 | $Worker->save(); |
653 | 653 | ||
654 | if (isset($Worker->id)) { | 654 | if (isset($Worker->id)) { |
655 | $Title_Worker = new Title_worker(); | 655 | $Title_Worker = new Title_worker(); |
656 | $Title_Worker->worker_id = $Worker->id; | 656 | $Title_Worker->worker_id = $Worker->id; |
657 | $Title_Worker->job_title_id = $data['job_titles']; | 657 | $Title_Worker->job_title_id = $data['job_titles']; |
658 | $Title_Worker->save(); | 658 | $Title_Worker->save(); |
659 | } | 659 | } |
660 | 660 | ||
661 | return $Code_user; | 661 | return $Code_user; |
662 | } | 662 | } |
663 | } | 663 | } |
664 | 664 | ||
665 | // Вакансии избранные | 665 | // Вакансии избранные |
666 | public function colorado(Request $request) { | 666 | public function colorado(Request $request) { |
667 | $IP_address = RusDate::ip_addr_client(); | 667 | $IP_address = RusDate::ip_addr_client(); |
668 | $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); | 668 | $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); |
669 | 669 | ||
670 | if ($Arr->count()) { | 670 | if ($Arr->count()) { |
671 | $A = Array(); | 671 | $A = Array(); |
672 | foreach ($Arr as $it) { | 672 | foreach ($Arr as $it) { |
673 | $A[] = $it->code_record; | 673 | $A[] = $it->code_record; |
674 | } | 674 | } |
675 | 675 | ||
676 | $Query = Ad_employer::query()->whereIn('id', $A); | 676 | $Query = Ad_employer::query()->whereIn('id', $A); |
677 | } else { | 677 | } else { |
678 | $Query = Ad_employer::query()->where('id', '=', '0'); | 678 | $Query = Ad_employer::query()->where('id', '=', '0'); |
679 | } | 679 | } |
680 | 680 | ||
681 | $Query = $Query->with('jobs')-> | 681 | $Query = $Query->with('jobs')-> |
682 | with('cat')-> | 682 | with('cat')-> |
683 | with('employer')-> | 683 | with('employer')-> |
684 | whereHas('jobs_code', function ($query) use ($request) { | 684 | whereHas('jobs_code', function ($query) use ($request) { |
685 | if ($request->ajax()) { | 685 | if ($request->ajax()) { |
686 | if (null !== ($request->get('job'))) { | 686 | if (null !== ($request->get('job'))) { |
687 | $query->where('job_title_id', $request->get('job')); | 687 | $query->where('job_title_id', $request->get('job')); |
688 | } | 688 | } |
689 | } | 689 | } |
690 | })->select('ad_employers.*'); | 690 | })->select('ad_employers.*'); |
691 | 691 | ||
692 | $Job_title = Job_title::query()->OrderBy('name')->get(); | 692 | $Job_title = Job_title::query()->OrderBy('name')->get(); |
693 | 693 | ||
694 | $Query_count = $Query->count(); | 694 | $Query_count = $Query->count(); |
695 | 695 | ||
696 | $Query = $Query->OrderBy('updated_at')->paginate(3); | 696 | $Query = $Query->OrderBy('updated_at')->paginate(3); |
697 | 697 | ||
698 | return view('workers.favorite', compact('Query', | 698 | return view('workers.favorite', compact('Query', |
699 | 'Query_count', | 699 | 'Query_count', |
700 | 'Job_title')); | 700 | 'Job_title')); |
701 | 701 | ||
702 | } | 702 | } |
703 | 703 | ||
704 | //Переписка | 704 | //Переписка |
705 | public function dialog(User_Model $user1, User_Model $user2) { | 705 | public function dialog(User_Model $user1, User_Model $user2) { |
706 | if (isset($user2->id)) { | 706 | if (isset($user2->id)) { |
707 | $companion = User_Model::query()->with('workers')-> | 707 | $companion = User_Model::query()->with('workers')-> |
708 | with('employers')-> | 708 | with('employers')-> |
709 | where('id', $user2->id)->first(); | 709 | where('id', $user2->id)->first(); |
710 | } | 710 | } |
711 | 711 | ||
712 | $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) { | 712 | $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) { |
713 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); | 713 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); |
714 | })->orWhere(function($query) use ($user1, $user2) { | 714 | })->orWhere(function($query) use ($user1, $user2) { |
715 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); | 715 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); |
716 | })->OrderBy('created_at')->get(); | 716 | })->OrderBy('created_at')->get(); |
717 | 717 | ||
718 | $id_vac = null; | 718 | $id_vac = null; |
719 | foreach ($Messages as $it) { | 719 | foreach ($Messages as $it) { |
720 | if (isset($it->response)) { | 720 | if (isset($it->response)) { |
721 | foreach ($it->response as $r) { | 721 | foreach ($it->response as $r) { |
722 | if (isset($r->ad_employer_id)) { | 722 | if (isset($r->ad_employer_id)) { |
723 | $id_vac = $r->ad_employer_id; | 723 | $id_vac = $r->ad_employer_id; |
724 | break; | 724 | break; |
725 | } | 725 | } |
726 | } | 726 | } |
727 | } | 727 | } |
728 | if (!is_null($id_vac)) break; | 728 | if (!is_null($id_vac)) break; |
729 | } | 729 | } |
730 | 730 | ||
731 | $ad_employer = null; | 731 | $ad_employer = null; |
732 | if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); | 732 | if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); |
733 | $sender = $user1; | 733 | $sender = $user1; |
734 | 734 | ||
735 | return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); | 735 | return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); |
736 | } | 736 | } |
737 | 737 | ||
738 | // Даунылоады | 738 | // Даунылоады |
739 | public function download(Worker $worker) { | 739 | public function download(Worker $worker) { |
740 | $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; | 740 | $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; |
741 | view()->share('house',$arr_house); | 741 | view()->share('house',$arr_house); |
742 | $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); | 742 | $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); |
743 | return $pdf->stream(); | 743 | return $pdf->stream(); |
744 | } | 744 | } |
745 | 745 | ||
746 | // Поднятие анкеты | 746 | // Поднятие анкеты |
747 | public function up(Worker $worker) { | 747 | public function up(Worker $worker) { |
748 | $worker->updated_at = Carbon::now(); | 748 | $worker->updated_at = Carbon::now(); |
749 | $worker->save(); | 749 | $worker->save(); |
750 | // 0 | 750 | // 0 |
751 | return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); | 751 | return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); |
752 | } | 752 | } |
753 | 753 | ||
754 | // Форма сертификате | 754 | // Форма сертификате |
755 | public function new_sertificate(Worker $worker) { | 755 | public function new_sertificate(Worker $worker) { |
756 | return view('workers.sertificate_add', compact('worker')); | 756 | return view('workers.sertificate_add', compact('worker')); |
757 | } | 757 | } |
758 | 758 | ||
759 | // Добавление сертификата | 759 | // Добавление сертификата |
760 | public function add_serificate(SertificationRequest $request) { | 760 | public function add_serificate(SertificationRequest $request) { |
761 | $params = $request->all(); | 761 | $params = $request->all(); |
762 | 762 | ||
763 | $Sertificate = new sertification(); | 763 | $Sertificate = new sertification(); |
764 | $Sertificate->create($params); | 764 | $Sertificate->create($params); |
765 | $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get(); | 765 | $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get(); |
766 | return redirect()->route('worker.cabinet'); | 766 | return redirect()->route('worker.cabinet'); |
767 | //return view('ajax.documents', compact('Docs')); | 767 | //return view('ajax.documents', compact('Docs')); |
768 | } | 768 | } |
769 | 769 | ||
770 | // Удалить сертификат | 770 | // Удалить сертификат |
771 | public function delete_sertificate(sertification $doc) { | 771 | public function delete_sertificate(sertification $doc) { |
772 | $doc->delete(); | 772 | $doc->delete(); |
773 | 773 | ||
774 | return redirect()->route('worker.cabinet'); | 774 | return redirect()->route('worker.cabinet'); |
775 | } | 775 | } |
776 | 776 | ||
777 | // Редактирование сертификата | 777 | // Редактирование сертификата |
778 | public function edit_sertificate(Worker $worker, sertification $doc) { | 778 | public function edit_sertificate(Worker $worker, sertification $doc) { |
779 | return view('workers.sertificate_edit', compact('doc', 'worker')); | 779 | return view('workers.sertificate_edit', compact('doc', 'worker')); |
780 | } | 780 | } |
781 | 781 | ||
782 | // Редактирование обновление сертификата | 782 | // Редактирование обновление сертификата |
783 | public function update_serificate(SertificationRequest $request, sertification $doc) { | 783 | public function update_serificate(SertificationRequest $request, sertification $doc) { |
784 | $all = $request->all(); | 784 | $all = $request->all(); |
785 | $doc->worker_id = $all['worker_id']; | 785 | $doc->worker_id = $all['worker_id']; |
786 | $doc->name = $all['name']; | 786 | $doc->name = $all['name']; |
787 | $doc->end_begin = $all['end_begin']; | 787 | $doc->end_begin = $all['end_begin']; |
788 | $doc->save(); | 788 | $doc->save(); |
789 | 789 | ||
790 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); | 790 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); |
791 | } | 791 | } |
792 | 792 | ||
793 | public function delete_add_diplom(Request $request, Worker $worker) { | 793 | public function delete_add_diplom(Request $request, Worker $worker) { |
794 | $infoblok_id = $request->get('infoblok_id'); | 794 | $infoblok_id = $request->get('infoblok_id'); |
795 | 795 | ||
796 | if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) | 796 | if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) |
797 | $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); | 797 | $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); |
798 | else { | 798 | else { |
799 | $params['infoblok_id'] = $infoblok_id; | 799 | $params['infoblok_id'] = $infoblok_id; |
800 | $params['worker_id'] = $worker->id; | 800 | $params['worker_id'] = $worker->id; |
801 | $params['status'] = $request->get('val'); | 801 | $params['status'] = $request->get('val'); |
802 | $id = Dop_info::create($params); | 802 | $id = Dop_info::create($params); |
803 | //$id = $worker->infobloks()->sync([$infoblok_id]); | 803 | //$id = $worker->infobloks()->sync([$infoblok_id]); |
804 | } | 804 | } |
805 | 805 | ||
806 | //$Infoblocks = infobloks::query()->get(); | 806 | //$Infoblocks = infobloks::query()->get(); |
807 | return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); | 807 | return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); |
808 | } | 808 | } |
809 | 809 | ||
810 | 810 | ||
811 | 811 | ||
812 | // Добавление диплома | 812 | // Добавление диплома |
813 | public function add_diplom_ajax(Request $request) { | 813 | public function add_diplom_ajax(Request $request) { |
814 | // конец | 814 | // конец |
815 | $params = $request->all(); | 815 | $params = $request->all(); |
816 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); | 816 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); |
817 | 817 | ||
818 | if ($count == 0) $dop_info = Dop_info::create($params); | 818 | if ($count == 0) $dop_info = Dop_info::create($params); |
819 | $Infoblocks = infobloks::query()->get(); | 819 | $Infoblocks = infobloks::query()->get(); |
820 | $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); | 820 | $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); |
821 | $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); | 821 | $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); |
822 | return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); | 822 | return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); |
823 | } | 823 | } |
824 | 824 | ||
825 | // Добавление диплома без ajax | 825 | // Добавление диплома без ajax |
826 | public function add_diplom(Worker $worker) { | 826 | public function add_diplom(Worker $worker) { |
827 | $worker_id = $worker->id; | 827 | $worker_id = $worker->id; |
828 | $Infoblocks = infobloks::query()->get(); | 828 | $Infoblocks = infobloks::query()->get(); |
829 | return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); | 829 | return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); |
830 | } | 830 | } |
831 | // Сохранить | 831 | // Сохранить |
832 | // Сохраняю диплом | 832 | // Сохраняю диплом |
833 | public function add_diplom_save(Request $request) { | 833 | public function add_diplom_save(Request $request) { |
834 | $params = $request->all(); | 834 | $params = $request->all(); |
835 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); | 835 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); |
836 | if ($count == 0) $dop_info = Dop_info::create($params); | 836 | if ($count == 0) $dop_info = Dop_info::create($params); |
837 | return redirect()->route('worker.cabinet'); | 837 | return redirect()->route('worker.cabinet'); |
838 | } | 838 | } |
839 | 839 | ||
840 | // Добавление стандартного документа | 840 | // Добавление стандартного документа |
841 | public function add_document(Worker $worker) { | 841 | public function add_document(Worker $worker) { |
842 | return view('workers.docs', compact('worker')); | 842 | return view('workers.docs', compact('worker')); |
843 | } | 843 | } |
844 | 844 | ||
845 | //Сохранение стандартого документа | 845 | //Сохранение стандартого документа |
846 | public function add_document_save(DocumentsRequest $request) { | 846 | public function add_document_save(DocumentsRequest $request) { |
847 | $params = $request->all(); | 847 | $params = $request->all(); |
848 | $place_work = place_works::create($params); | 848 | $place_work = place_works::create($params); |
849 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!'); | 849 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!'); |
850 | } | 850 | } |
851 | 851 | ||
852 | // Редактирование документа | 852 | // Редактирование документа |
853 | public function edit_document(place_works $doc, Worker $worker) { | 853 | public function edit_document(place_works $doc, Worker $worker) { |
854 | return view('workers.docs-edit', compact('doc', 'worker')); | 854 | return view('workers.docs-edit', compact('doc', 'worker')); |
855 | } | 855 | } |
856 | 856 | ||
857 | //Сохранение отредактированного документа | 857 | //Сохранение отредактированного документа |
858 | public function edit_document_save(DocumentsRequest $request, place_works $doc) { | 858 | public function edit_document_save(DocumentsRequest $request, place_works $doc) { |
859 | $params = $request->all(); | 859 | $params = $request->all(); |
860 | $doc->update($params); | 860 | $doc->update($params); |
861 | 861 | ||
862 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); | 862 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); |
863 | } | 863 | } |
864 | 864 | ||
865 | // Удаление документа | 865 | // Удаление документа |
866 | public function delete_document(place_works $doc) { | 866 | public function delete_document(place_works $doc) { |
867 | $doc->delete(); | 867 | $doc->delete(); |
868 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); | 868 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); |
869 | } | 869 | } |
870 | 870 | ||
871 | //Отправка нового сообщения | 871 | //Отправка нового сообщения |
872 | public function new_message(Request $request) { | 872 | public function new_message(Request $request) { |
873 | $params = $request->all(); | 873 | $params = $request->all(); |
874 | 874 | ||
875 | $id = $params['send_user_id']; | 875 | $id = $params['send_user_id']; |
876 | $message = new Message(); | 876 | $message = new Message(); |
877 | $message->user_id = $params['send_user_id']; | 877 | $message->user_id = $params['send_user_id']; |
878 | $message->to_user_id = $params['send_to_user_id']; | 878 | $message->to_user_id = $params['send_to_user_id']; |
879 | $message->title = $params['send_title']; | 879 | $message->title = $params['send_title']; |
880 | $message->text = $params['send_text']; | 880 | $message->text = $params['send_text']; |
881 | $message->ad_employer_id = $params['send_vacancy']; | ||
881 | if ($request->has('send_file')) { | 882 | if ($request->has('send_file')) { |
882 | $message->file = $request->file('send_file')->store("worker/$id", 'public'); | 883 | $message->file = $request->file('send_file')->store("worker/$id", 'public'); |
883 | } | 884 | } |
884 | $message->flag_new = 1; | 885 | $message->flag_new = 1; |
885 | $id_message = $message->save(); | 886 | $id_message = $message->save(); |
886 | 887 | ||
887 | $data['message_id'] = $id_message; | 888 | $data['message_id'] = $id_message; |
888 | $data['ad_employer_id'] = $params['send_vacancy']; | 889 | $data['ad_employer_id'] = $params['send_vacancy']; |
889 | $data['job_title_id'] = $params['send_job_title_id']; | 890 | $data['job_title_id'] = $params['send_job_title_id']; |
890 | $data['flag'] = 1; | 891 | $data['flag'] = 1; |
891 | $ad_responce = ad_response::create($data); | 892 | $ad_responce = ad_response::create($data); |
892 | return redirect()->route('worker.messages', ['type_message' => 'output']); | 893 | return redirect()->route('worker.messages', ['type_message' => 'output']); |
893 | } | 894 | } |
894 | 895 | ||
895 | // Информация о предыдущих компаниях | 896 | // Информация о предыдущих компаниях |
896 | public function new_prev_company(Worker $worker) { | 897 | public function new_prev_company(Worker $worker) { |
897 | return view('workers.prev_company_form', compact('worker')); | 898 | return view('workers.prev_company_form', compact('worker')); |
898 | } | 899 | } |
899 | 900 | ||
900 | // Добавление контакта компании | 901 | // Добавление контакта компании |
901 | public function add_prev_company(PrevCompanyRequest $request) { | 902 | public function add_prev_company(PrevCompanyRequest $request) { |
902 | // Возвращение параметров | 903 | // Возвращение параметров |
903 | $all = $request->all(); | 904 | $all = $request->all(); |
904 | $PrevCompany = PrevCompany::create($all); | 905 | $PrevCompany = PrevCompany::create($all); |
905 | 906 | ||
906 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); | 907 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); |
907 | } | 908 | } |
908 | 909 | ||
909 | // Редактирование контакта компании | 910 | // Редактирование контакта компании |
910 | public function edit_prev_company(PrevCompany $doc, Worker $worker) { | 911 | public function edit_prev_company(PrevCompany $doc, Worker $worker) { |
911 | return view('workers.prev_company_edit_form', compact('doc', 'worker')); | 912 | return view('workers.prev_company_edit_form', compact('doc', 'worker')); |
912 | } | 913 | } |
913 | 914 | ||
914 | //Сохранение редактирования контакта компании | 915 | //Сохранение редактирования контакта компании |
915 | public function update_prev_company(PrevCompany $doc, Request $request){ | 916 | public function update_prev_company(PrevCompany $doc, Request $request){ |
916 | $all = $request->all(); | 917 | $all = $request->all(); |
917 | $doc->update($all); | 918 | $doc->update($all); |
918 | 919 | ||
919 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); | 920 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); |
920 | } | 921 | } |
921 | 922 | ||
922 | // Удаление контакта предыдущей компании | 923 | // Удаление контакта предыдущей компании |
923 | public function delete_prev_company(PrevCompany $doc) { | 924 | public function delete_prev_company(PrevCompany $doc) { |
924 | $doc->delete(); | 925 | $doc->delete(); |
925 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); | 926 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); |
926 | } | 927 | } |
927 | } | 928 | } |
928 | 929 | ||
929 | 930 |
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"> | ||
79 | <label class="form-group__label">Добавление должностей</label> | ||
80 | <div class="form-group__item"> | ||
81 | <div class="select"> | ||
82 | <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple"> | ||
83 | @php $i = 1 @endphp | ||
84 | @if ($jobs->count()) | ||
85 | @foreach($jobs as $it) | ||
86 | @php $selected = false; @endphp | ||
87 | @if (isset($Worker[0]->job_titles)) | ||
88 | @if ($Worker[0]->job_titles->count()) | ||
89 | @foreach($Worker[0]->job_titles as $select) | ||
90 | @if ($it->id == $select->id) | ||
91 | @php $selected = true; @endphp | ||
92 | @endif | ||
93 | @endforeach | ||
94 | @endif | ||
95 | @endif | ||
96 | <option value="{{ $it->id }}" @if ($selected) selected @endif>{{ $it->name }}</option> | ||
97 | @endforeach | ||
98 | @endif | ||
99 | </select> | ||
100 | </div> | ||
101 | </div> | ||
102 | </div> | ||
103 | |||
78 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | 104 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> |
79 | <label class="form-group__label">Телефон</label> | 105 | <label class="form-group__label">Телефон</label> |
80 | <div class="form-group__item"> | 106 | <div class="form-group__item"> |
81 | <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $Employer[0]->telephone ?? '' }}" placeholder="Свой телефон"> | 107 | <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $Employer[0]->telephone ?? '' }}" placeholder="Свой телефон"> |
82 | @error('telephone') | 108 | @error('telephone') |
83 | <span class="text-xs text-red-600 dark:text-red-400"> | 109 | <span class="text-xs text-red-600 dark:text-red-400"> |
84 | {{ $message }} | 110 | {{ $message }} |
85 | </span> | 111 | </span> |
86 | @enderror | 112 | @enderror |
87 | </div> | 113 | </div> |
88 | </div> | 114 | </div> |
89 | 115 | ||
90 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | 116 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> |
91 | <label class="form-group__label">Емайл</label> | 117 | <label class="form-group__label">Емайл</label> |
92 | <div class="form-group__item"> | 118 | <div class="form-group__item"> |
93 | <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $Employer[0]->email ?? '' }}" placeholder="Своя почту"> | 119 | <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $Employer[0]->email ?? '' }}" placeholder="Своя почту"> |
94 | @error('email') | 120 | @error('email') |
95 | <span class="text-xs text-red-600 dark:text-red-400"> | 121 | <span class="text-xs text-red-600 dark:text-red-400"> |
96 | {{ $message }} | 122 | {{ $message }} |
97 | </span> | 123 | </span> |
98 | @enderror | 124 | @enderror |
99 | </div> | 125 | </div> |
100 | </div> | 126 | </div> |
101 | 127 | ||
102 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | 128 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> |
103 | <label class="form-group__label">Зарплата среднестатистическая для вакансии</label> | 129 | <label class="form-group__label">Зарплата среднестатистическая для вакансии</label> |
104 | <div class="form-group__item"> | 130 | <div class="form-group__item"> |
105 | <input type="text" class="input" name="salary" id="salary" value="0" placeholder="Среднестатистическая зарплата"> | 131 | <input type="text" class="input" name="salary" id="salary" value="0" placeholder="Среднестатистическая зарплата"> |
106 | @error('salary') | 132 | @error('salary') |
107 | <span class="text-xs text-red-600 dark:text-red-400"> | 133 | <span class="text-xs text-red-600 dark:text-red-400"> |
108 | {{ $message }} | 134 | {{ $message }} |
109 | </span> | 135 | </span> |
110 | @enderror | 136 | @enderror |
111 | </div> | 137 | </div> |
112 | </div> | 138 | </div> |
113 | 139 | ||
114 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | 140 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> |
115 | <label class="form-group__label">Город посадки</label> | 141 | <label class="form-group__label">Город посадки</label> |
116 | <div class="form-group__item"> | 142 | <div class="form-group__item"> |
117 | <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $Employer[0]->city ?? '' }}" placeholder="Севастополь"> | 143 | <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $Employer[0]->city ?? '' }}" placeholder="Севастополь"> |
118 | @error('city') | 144 | @error('city') |
119 | <span class="text-xs text-red-600"> | 145 | <span class="text-xs text-red-600"> |
120 | {{ $message }} | 146 | {{ $message }} |
121 | </span> | 147 | </span> |
122 | @enderror | 148 | @enderror |
123 | </div> | 149 | </div> |
124 | </div> | 150 | </div> |
125 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 151 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
126 | <label class="form-group__label">Категория (локация)</label> | 152 | <label class="form-group__label">Категория (локация)</label> |
127 | <div class="form-group__item"> | 153 | <div class="form-group__item"> |
128 | <div class="select"> | 154 | <div class="select"> |
129 | <select class="js-select2" name="category_id" id="category_id"> | 155 | <select class="js-select2" name="category_id" id="category_id"> |
130 | <option selected> Выберите категорию из списка</option> | 156 | <option selected> Выберите категорию из списка</option> |
131 | _php $i = 1 _endphp | 157 | _php $i = 1 _endphp |
132 | _if ($categories->count()) | 158 | _if ($categories->count()) |
133 | _foreach($categories as $j) | 159 | _foreach($categories as $j) |
134 | <option value=" $j->id }}"> $j->name }}</option> | 160 | <option value=" $j->id }}"> $j->name }}</option> |
135 | _php $i++ _endphp | 161 | _php $i++ _endphp |
136 | _endforeach | 162 | _endforeach |
137 | _endif | 163 | _endif |
138 | </select> | 164 | </select> |
139 | _error('category_id') | 165 | _error('category_id') |
140 | <span class="text-xs text-red-600 dark:text-red-400"> | 166 | <span class="text-xs text-red-600 dark:text-red-400"> |
141 | $message }} | 167 | $message }} |
142 | </span> | 168 | </span> |
143 | _enderror | 169 | _enderror |
144 | </div> | 170 | </div> |
145 | </div> | 171 | </div> |
146 | </div>--> | 172 | </div>--> |
147 | 173 | ||
148 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 174 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
149 | <label class="form-group__label">Описание вакансии</label> | 175 | <label class="form-group__label">Описание вакансии</label> |
150 | <div class="form-group__item"> | 176 | <div class="form-group__item"> |
151 | <textarea class="textarea" name="text" id="text">{{ old('text') ?? '' }}</textarea> | 177 | <textarea class="textarea ckeditor" name="text" id="text">{{ old('text') ?? '' }}</textarea> |
152 | @error('text') | 178 | @error('text') |
153 | <span class="text-xs text-red-600"> | 179 | <span class="text-xs text-red-600"> |
154 | {{ $message }} | 180 | {{ $message }} |
155 | </span> | 181 | </span> |
156 | @enderror | 182 | @enderror |
157 | </div> | 183 | </div> |
158 | </div> | 184 | </div> |
159 | </div> | 185 | </div> |
160 | </div> | 186 | </div> |
161 | 187 | ||
162 | <div class="cabinet__body-item"> | 188 | <div class="cabinet__body-item"> |
163 | <div class="cabinet__body-item"> | 189 | <!-- <div class="cabinet__body-item"> |
164 | <div class="cabinet__descr"> | 190 | <div class="cabinet__descr"> |
165 | <p class="cabinet__text"><b>Добавление должности</b></p> | 191 | <p class="cabinet__text"><b>Добавление должности</b></p> |
166 | </div> | 192 | </div> |
167 | </div> | 193 | </div> |
168 | 194 | ||
169 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 195 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
170 | <label class="form-group__label">Должность соискателя</label> | 196 | <label class="form-group__label">Должность соискателя</label> |
171 | <div class="form-group__item"> | 197 | <div class="form-group__item"> |
172 | <div class="select"> | 198 | <div class="select"> |
173 | <select class="js-select2" name="job_title_id" id="job_title_id"> | 199 | <select class="js-select2" name="job_title_id" id="job_title_id"> |
174 | php $i = 1 endphp | 200 | php $i = 1 endphp |
175 | if ($jobs->count()) | 201 | if ($jobs->count()) |
176 | foreach($jobs as $j) | 202 | foreach($jobs as $j) |
177 | if ($i == 1) <option selected> Выберите должность из списка</option> | 203 | if ($i == 1) <option selected> Выберите должность из списка</option> |
178 | else | 204 | else |
179 | <option value=" $j->id }}"> $j->name }}</option> | 205 | <option value=" $j->id }}"> $j->name }}</option> |
180 | endif | 206 | endif |
181 | php $i++ endphp | 207 | php $i++ endphp |
182 | endforeach | 208 | endforeach |
183 | endif | 209 | endif |
184 | </select> | 210 | </select> |
185 | error('job_title_id') | 211 | error('job_title_id') |
186 | <span class="text-xs text-red-600 dark:text-red-400"> | 212 | <span class="text-xs text-red-600 dark:text-red-400"> |
187 | $message }} | 213 | $message }} |
188 | </span> | 214 | </span> |
189 | enderror | 215 | enderror |
190 | </div> | 216 | </div> |
191 | </div> | 217 | </div> |
192 | </div>--> | 218 | </div>--> |
193 | 219 | ||
194 | <div class="cabinet__inputs-item cabinet__inputs-item_max form-group"> | 220 | <div class="cabinet__inputs-item cabinet__inputs-item_max form-group"> |
195 | <label class="form-group__label">Добавление должностей</label> | 221 | |
196 | <div class="form-group__item"> | ||
197 | <div class="select"> | ||
198 | <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple"> | ||
199 | @php $i = 1 @endphp | ||
200 | @if ($jobs->count()) | ||
201 | @foreach($jobs as $it) | ||
202 | @php $selected = false; @endphp | ||
203 | @if (isset($Worker[0]->job_titles)) | ||
204 | @if ($Worker[0]->job_titles->count()) | ||
205 | @foreach($Worker[0]->job_titles as $select) | ||
206 | @if ($it->id == $select->id) | ||
207 | @php $selected = true; @endphp | ||
208 | @endif | ||
209 | @endforeach | ||
210 | @endif | ||
211 | @endif | ||
212 | <option value="{{ $it->id }}" @if ($selected) selected @endif>{{ $it->name }}</option> | ||
213 | @endforeach | ||
214 | @endif | ||
215 | </select> | ||
216 | </div> | ||
217 | </div> | ||
218 | </div> | 222 | </div> |
219 | 223 | ||
220 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 224 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
221 | <label class="form-group__label">Минимальная зарплата</label> | 225 | <label class="form-group__label">Минимальная зарплата</label> |
222 | <div class="form-group__item"> | 226 | <div class="form-group__item"> |
223 | <input type="text" class="input" name="min_salary" id="min_salary" value=" old('min_salary') ?? '' }}" placeholder="Минимальная зарплата"> | 227 | <input type="text" class="input" name="min_salary" id="min_salary" value=" old('min_salary') ?? '' }}" placeholder="Минимальная зарплата"> |
224 | error('min_salary') | 228 | error('min_salary') |
225 | <span class="text-xs text-red-600"> | 229 | <span class="text-xs text-red-600"> |
226 | $message }} | 230 | $message }} |
227 | </span> | 231 | </span> |
228 | enderror | 232 | enderror |
229 | </div> | 233 | </div> |
230 | </div> | 234 | </div> |
231 | 235 | ||
232 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 236 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
233 | <label class="form-group__label">Максимальная зарплата</label> | 237 | <label class="form-group__label">Максимальная зарплата</label> |
234 | <div class="form-group__item"> | 238 | <div class="form-group__item"> |
235 | <input type="text" class="input" name="max_salary" id="max_salary" value=" old('max_salary') ?? '' }}" placeholder="Максимальная зарплата"> | 239 | <input type="text" class="input" name="max_salary" id="max_salary" value=" old('max_salary') ?? '' }}" placeholder="Максимальная зарплата"> |
236 | error('salary') | 240 | error('salary') |
237 | <span class="text-xs text-red-600 dark:text-red-400"> | 241 | <span class="text-xs text-red-600 dark:text-red-400"> |
238 | $message }} | 242 | $message }} |
239 | </span> | 243 | </span> |
240 | enderror | 244 | enderror |
241 | </div> | 245 | </div> |
242 | </div> | 246 | </div> |
243 | 247 | ||
244 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 248 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
245 | <label class="form-group__label">Регион отплытия</label> | 249 | <label class="form-group__label">Регион отплытия</label> |
246 | <div class="form-group__item"> | 250 | <div class="form-group__item"> |
247 | <input type="text" class="input" name="region" id="region" value=" old('region') ?? $Employer[0]->city ?? '' }}" placeholder="Севастополь"> | 251 | <input type="text" class="input" name="region" id="region" value=" old('region') ?? $Employer[0]->city ?? '' }}" placeholder="Севастополь"> |
248 | error('region') | 252 | error('region') |
249 | <span class="text-xs text-red-600"> | 253 | <span class="text-xs text-red-600"> |
250 | $message }} | 254 | $message }} |
251 | </span> | 255 | </span> |
252 | enderror | 256 | enderror |
253 | </div> | 257 | </div> |
254 | </div> | 258 | </div> |
255 | 259 | ||
256 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 260 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
257 | <label class="form-group__label">Мощность</label> | 261 | <label class="form-group__label">Мощность</label> |
258 | <div class="form-group__item"> | 262 | <div class="form-group__item"> |
259 | <input type="text" class="input" name="power" id="power" value=" old('power') ?? '' }}" placeholder="POWER-45"> | 263 | <input type="text" class="input" name="power" id="power" value=" old('power') ?? '' }}" placeholder="POWER-45"> |
260 | error('power') | 264 | error('power') |
261 | <span class="text-xs text-red-600"> | 265 | <span class="text-xs text-red-600"> |
262 | $message }} | 266 | $message }} |
263 | </span> | 267 | </span> |
264 | enderror | 268 | enderror |
265 | </div> | 269 | </div> |
266 | </div> | 270 | </div> |
267 | 271 | ||
268 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 272 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
269 | <label class="form-group__label">Суточные выплаты</label> | 273 | <label class="form-group__label">Суточные выплаты</label> |
270 | <div class="form-group__item"> | 274 | <div class="form-group__item"> |
271 | <input type="text" class="input" name="sytki" id="sytki" value=" old('sytki') ?? '' }}" placeholder="2000"> | 275 | <input type="text" class="input" name="sytki" id="sytki" value=" old('sytki') ?? '' }}" placeholder="2000"> |
272 | error('power') | 276 | error('power') |
273 | <span class="text-xs text-red-600"> | 277 | <span class="text-xs text-red-600"> |
274 | $message }} | 278 | $message }} |
275 | </span> | 279 | </span> |
276 | enderror | 280 | enderror |
277 | </div> | 281 | </div> |
278 | </div> | 282 | </div> |
279 | 283 | ||
280 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 284 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
281 | <label class="form-group__label">Начало отплытия</label> | 285 | <label class="form-group__label">Начало отплытия</label> |
282 | <div class="form-group__item"> | 286 | <div class="form-group__item"> |
283 | <input type="text" class="input" name="start" id="start" value=" old('start') ?? '' }}" placeholder="20 сентября 2024"> | 287 | <input type="text" class="input" name="start" id="start" value=" old('start') ?? '' }}" placeholder="20 сентября 2024"> |
284 | error('power') | 288 | error('power') |
285 | <span class="text-xs text-red-600"> | 289 | <span class="text-xs text-red-600"> |
286 | $message }} | 290 | $message }} |
287 | </span> | 291 | </span> |
288 | enderror | 292 | enderror |
289 | </div> | 293 | </div> |
290 | </div> | 294 | </div> |
291 | 295 | ||
292 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 296 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
293 | <label class="form-group__label">Корабль для посадки</label> | 297 | <label class="form-group__label">Корабль для посадки</label> |
294 | <div class="form-group__item"> | 298 | <div class="form-group__item"> |
295 | <div class="select"> | 299 | <div class="select"> |
296 | <select class="js-select2" name="flot" id="flot"> | 300 | <select class="js-select2" name="flot" id="flot"> |
297 | <option value="" selected> Не указан корабль</option> | 301 | <option value="" selected> Не указан корабль</option> |
298 | if ($Employer[0]->flots->count()) | 302 | if ($Employer[0]->flots->count()) |
299 | foreach($Employer[0]->flots as $j) | 303 | foreach($Employer[0]->flots as $j) |
300 | <option value=" $j->name }}"> $j->name }} ( $j->id }})</option> | 304 | <option value=" $j->name }}"> $j->name }} ( $j->id }})</option> |
301 | endforeach | 305 | endforeach |
302 | endif | 306 | endif |
303 | </select> | 307 | </select> |
304 | error('flot') | 308 | error('flot') |
305 | <span class="text-xs text-red-600"> | 309 | <span class="text-xs text-red-600"> |
306 | $message }} | 310 | $message }} |
307 | </span> | 311 | </span> |
308 | enderror | 312 | enderror |
309 | </div> | 313 | </div> |
310 | </div> | 314 | </div> |
311 | </div>--> | 315 | </div>--> |
312 | 316 | ||
313 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 317 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
314 | <label class="form-group__label">Дополнительная информация</label> | 318 | <label class="form-group__label">Дополнительная информация</label> |
315 | <div class="form-group__item"> | 319 | <div class="form-group__item"> |
316 | <textarea class="textarea" name="description" id="description"> old('description') ?? '' }}</textarea> | 320 | <textarea class="textarea" name="description" id="description"> old('description') ?? '' }}</textarea> |
317 | error('description') | 321 | error('description') |
318 | <span class="text-xs text-red-600"> | 322 | <span class="text-xs text-red-600"> |
319 | $message }} | 323 | $message }} |
320 | </span> | 324 | </span> |
321 | enderror | 325 | enderror |
322 | </div> | 326 | </div> |
resources/views/employers/ajax/list_vacancy.blade.php
1 | @if ($vacancy_list->count()) | 1 | @if ($vacancy_list->count()) |
2 | <div class="table__scroll"> | 2 | <div class="table__scroll"> |
3 | <div class="table__body table__body_min-width"> | 3 | <div class="table__body table__body_min-width"> |
4 | <table> | 4 | <table> |
5 | <thead> | 5 | <thead> |
6 | <tr> | 6 | <tr> |
7 | <th>№</th> | 7 | <th>№</th> |
8 | <th>Название</th> | 8 | <th>Название</th> |
9 | <th>Дата добавления<br>/ обновления</th> | 9 | <th>Дата добавления<br>/ обновления</th> |
10 | <th>Должности</th> | 10 | <th style="display:none">Должности</th> |
11 | <th>Статус</th> | 11 | <th>Статус</th> |
12 | <th>Действия</th> | 12 | <th>Действия</th> |
13 | </tr> | 13 | </tr> |
14 | </thead> | 14 | </thead> |
15 | <tbody> | 15 | <tbody> |
16 | @foreach($vacancy_list as $it) | 16 | @foreach($vacancy_list as $it) |
17 | <tr> | 17 | <tr> |
18 | <td>{{ $it->id }}</td> | 18 | <td>{{ $it->id }}</td> |
19 | <td>{{ $it->name }}</td> | 19 | <td>{{ $it->name }}</td> |
20 | <td>{{ date('d.m.Y H:i:s', strtotime($it->created_at)) }} <br>/ {{ date('d.m.Y H:i:s', strtotime($it->updated_at)) }}</td> | 20 | <td>{{ date('d.m.Y H:i:s', strtotime($it->created_at)) }} <br>/ {{ date('d.m.Y H:i:s', strtotime($it->updated_at)) }}</td> |
21 | <td> <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $it->id]) }}" class="button">Добавить</a> | 21 | <td style="display:none"> <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $it->id]) }}" class="button">Добавить</a> |
22 | 22 | ||
23 | @if ($it->jobs->count()) | 23 | @if ($it->jobs->count()) |
24 | @foreach ($it->jobs as $key => $it_um) | 24 | @foreach ($it->jobs as $key => $it_um) |
25 | <p>@if (isset($it->jobs_code[$key])) | 25 | <p>@if (isset($it->jobs_code[$key])) |
26 | <a href="{{ route('employer.edit_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id, 'ad_employer' => $it->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">{{$it_um->name}}</a> | 26 | <a href="{{ route('employer.edit_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id, 'ad_employer' => $it->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">{{$it_um->name}}</a> |
27 | <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a> | 27 | <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a> |
28 | @endif | 28 | @endif |
29 | </p> | 29 | </p> |
30 | @endforeach | 30 | @endforeach |
31 | @else | 31 | @else |
32 | Нет связанных <br> с вакансией должностей | 32 | Нет связанных <br> с вакансией должностей |
33 | @endif | 33 | @endif |
34 | </td> | 34 | </td> |
35 | <td> | 35 | <td> |
36 | @if ($it->active_is) | 36 | @if ($it->active_is) |
37 | <span class="table__status green"><i></i>Опубликовано</span> | 37 | <span class="table__status green"><i></i>Опубликовано</span> |
38 | @else | 38 | @else |
39 | <span class="table__status"><i></i>Не опубликовано</span> | 39 | <span class="table__status"><i></i>Не опубликовано</span> |
40 | @endif | 40 | @endif |
41 | </td> | 41 | </td> |
42 | <td> | 42 | <td> |
43 | <span class="table__controls"> | 43 | <span class="table__controls"> |
44 | <a class="table__controls-item up-it" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}"> | 44 | <a class="table__controls-item up-it" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}"> |
45 | <svg> | 45 | <svg> |
46 | <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use> | 46 | <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use> |
47 | </svg> | 47 | </svg> |
48 | </a> | 48 | </a> |
49 | <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" class="table__controls-item"> | 49 | <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" class="table__controls-item"> |
50 | <svg> | 50 | <svg> |
51 | <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> | 51 | <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> |
52 | </svg> | 52 | </svg> |
53 | </a> | 53 | </a> |
54 | <a class="table__controls-item" href="{{ route('employer.vacancy_delete', ['ad_employer' => $it->id]) }}"> | 54 | <a class="table__controls-item" href="{{ route('employer.vacancy_delete', ['ad_employer' => $it->id]) }}"> |
55 | <svg> | 55 | <svg> |
56 | <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> | 56 | <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> |
57 | </svg> | 57 | </svg> |
58 | </a> | 58 | </a> |
59 | @if ($it->active_is) | 59 | @if ($it->active_is) |
60 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" class="table__controls-item"> | 60 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" class="table__controls-item"> |
61 | <svg> | 61 | <svg> |
62 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> | 62 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> |
63 | </svg> | 63 | </svg> |
64 | </a> | 64 | </a> |
65 | @else | 65 | @else |
66 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" class="table__controls-item"> | 66 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" class="table__controls-item"> |
67 | <svg> | 67 | <svg> |
68 | <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> | 68 | <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> |
69 | </svg> | 69 | </svg> |
70 | </a> | 70 | </a> |
71 | @endif | 71 | @endif |
72 | 72 | ||
73 | <!--<button type="button" class="table__controls-item"> | 73 | <!--<button type="button" class="table__controls-item"> |
74 | <svg> | 74 | <svg> |
75 | <use xlink:href=" asset('images/sprite.svg#tg') }}"></use> | 75 | <use xlink:href=" asset('images/sprite.svg#tg') }}"></use> |
76 | </svg> | 76 | </svg> |
77 | </button> | 77 | </button> |
78 | --> | 78 | --> |
79 | </span> | 79 | </span> |
80 | </td> | 80 | </td> |
81 | </tr> | 81 | </tr> |
82 | @endforeach | 82 | @endforeach |
83 | </tbody> | 83 | </tbody> |
84 | </table> | 84 | </table> |
85 | </div><br> | 85 | </div><br> |
86 | {{ $vacancy_list->appends($_GET)->links('paginate') }} | 86 | {{ $vacancy_list->appends($_GET)->links('paginate') }} |
87 | </div> | 87 | </div> |
88 | @else | 88 | @else |
89 | 89 | ||
90 | <div class="notify"> | 90 | <div class="notify"> |
91 | <svg> | 91 | <svg> |
92 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> | 92 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> |
93 | </svg> | 93 | </svg> |
94 | <span>Вы ещё не разместили ни одной вакансии</span> | 94 | <span>Вы ещё не разместили ни одной вакансии</span> |
95 | </div> | 95 | </div> |
96 | @endif | 96 | @endif |
97 | 97 |
resources/views/employers/cabinet45.blade.php
1 | @extends('layout.frontend', ['title' => 'Кабинет работодателя - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Кабинет работодателя - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script src="https://cdn.ckeditor.com/ckeditor5/23.0.0/classic/ckeditor.js"></script> | 4 | <script src="https://cdn.ckeditor.com/ckeditor5/23.0.0/classic/ckeditor.js"></script> |
5 | <script> | 5 | <script> |
6 | ClassicEditor | 6 | ClassicEditor |
7 | .create( document.querySelector( '#text' ) ) | 7 | .create( document.querySelector( '#text' ) ) |
8 | .catch( error => { | 8 | .catch( error => { |
9 | console.error( error ); | 9 | console.error( error ); |
10 | } ); | 10 | } ); |
11 | </script> | 11 | </script> |
12 | @endsection | 12 | @endsection |
13 | @section('content') | 13 | @section('content') |
14 | <section class="cabinet"> | 14 | <section class="cabinet"> |
15 | <div class="container"> | 15 | <div class="container"> |
16 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 16 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
17 | <li><a href="{{ route('index') }}">Главная</a></li> | 17 | <li><a href="{{ route('index') }}">Главная</a></li> |
18 | <li><b>Личный кабинет</b></li> | 18 | <li><b>Личный кабинет</b></li> |
19 | </ul> | 19 | </ul> |
20 | <div class="cabinet__wrapper"> | 20 | <div class="cabinet__wrapper"> |
21 | <div class="cabinet__side"> | 21 | <div class="cabinet__side"> |
22 | <div class="cabinet__side-toper"> | 22 | <div class="cabinet__side-toper"> |
23 | @include('employers.emblema') | 23 | @include('employers.emblema') |
24 | </div> | 24 | </div> |
25 | 25 | ||
26 | @include('employers.menu', ['item' => 1]) | 26 | @include('employers.menu', ['item' => 1]) |
27 | 27 | ||
28 | </div> | 28 | </div> |
29 | <div class="cabinet__body"> | 29 | <div class="cabinet__body"> |
30 | @include('messages_error') | 30 | @include('messages_error') |
31 | 31 | ||
32 | <form action="{{ route('employer.cabinet_save', ['Employer' => $Employer[0]->id]) }}" method="POST" enctype="multipart/form-data"> | 32 | <form action="{{ route('employer.cabinet_save', ['Employer' => $Employer[0]->id]) }}" method="POST" enctype="multipart/form-data"> |
33 | @csrf | 33 | @csrf |
34 | <div class="cabinet__body-item"> | 34 | <div class="cabinet__body-item"> |
35 | <div class="cabinet__descr"> | 35 | <div class="cabinet__descr"> |
36 | <h2 class="title cabinet__title">Мой профиль</h2> | 36 | <h2 class="title cabinet__title">Мой профиль</h2> |
37 | <p class="cabinet__text">Все поля обязательны для заполнения *</p> | 37 | <p class="cabinet__text">Все поля обязательны для заполнения *</p> |
38 | </div> | 38 | </div> |
39 | <div class="cabinet__avatar"> | 39 | <div class="cabinet__avatar"> |
40 | <div class="cabinet__avatar-pic"> | 40 | <div class="cabinet__avatar-pic"> |
41 | @if (!empty($Employer[0]->logo)) | 41 | @if (!empty($Employer[0]->logo)) |
42 | <img src="{{ asset(Storage::url($Employer[0]->logo)) }}" width="150" alt="{{ $Employer[0]->name_company }}"> | 42 | <img src="{{ asset(Storage::url($Employer[0]->logo)) }}" width="150" alt="{{ $Employer[0]->name_company }}"> |
43 | @else | 43 | @else |
44 | <img src="{{ asset('images/logo_emp.png') }}" width="150" alt="{{ $Employer[0]->name_company }}"/> | 44 | <img src="{{ asset('images/logo_emp.png') }}" width="150" alt="{{ $Employer[0]->name_company }}"/> |
45 | @endif | 45 | @endif |
46 | </div> | 46 | </div> |
47 | <div class="cabinet__avatar-form"> | 47 | <div class="cabinet__avatar-form"> |
48 | <label class="file"> | 48 | <label class="file"> |
49 | <span class="file__input"> | 49 | <span class="file__input"> |
50 | <input type="file" name="logo"> | 50 | <input type="file" name="logo"> |
51 | <span class="button"> | 51 | <span class="button"> |
52 | <svg> | 52 | <svg> |
53 | <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use> | 53 | <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use> |
54 | </svg> | 54 | </svg> |
55 | Загрузить | 55 | Загрузить |
56 | </span> | 56 | </span> |
57 | </span> | 57 | </span> |
58 | </label> | 58 | </label> |
59 | <p class="cabinet__text">Загрузите логотип в формате .svg, .jpg, .png или .jpeg</p> | 59 | <p class="cabinet__text">Загрузите логотип в формате .svg, .jpg, .png или .jpeg</p> |
60 | </div> | 60 | </div> |
61 | </div> | 61 | </div> |
62 | <div class="cabinet__inputs"> | 62 | <div class="cabinet__inputs"> |
63 | <div class="cabinet__inputs-item form-group"> | 63 | <div class="cabinet__inputs-item form-group"> |
64 | <label class="form-group__label">Название судоходной компании</label> | 64 | <label class="form-group__label">Название судоходной компании</label> |
65 | <div class="form-group__item"> | 65 | <div class="form-group__item"> |
66 | <input type="text" class="input" name="name_company" id="name_company" placeholder="ООО Река Море" value="{{ old('name_company') ?? $Employer[0]->name_company ?? '' }}" required> | 66 | <input type="text" class="input" name="name_company" id="name_company" placeholder="ООО Река Море" value="{{ old('name_company') ?? $Employer[0]->name_company ?? '' }}" required> |
67 | @error('name_company') | 67 | @error('name_company') |
68 | <span class="text-xs text-red-600"> | 68 | <span class="text-xs text-red-600"> |
69 | {{ $message }} | 69 | {{ $message }} |
70 | </span> | 70 | </span> |
71 | @enderror | 71 | @enderror |
72 | </div> | 72 | </div> |
73 | </div> | 73 | </div> |
74 | <div class="cabinet__inputs-item form-group"> | 74 | <div class="cabinet__inputs-item form-group"> |
75 | <label class="form-group__label">Электронная почта</label> | 75 | <label class="form-group__label">Электронная почта</label> |
76 | <div class="form-group__item"> | 76 | <div class="form-group__item"> |
77 | <input type="email" name="email" class="input" placeholder="info@rekamore.su" value="{{ old('email') ?? $Employer[0]->email ?? '' }}" required> | 77 | <input type="email" name="email" class="input" placeholder="info@rekamore.su" value="{{ old('email') ?? $Employer[0]->email ?? '' }}" required> |
78 | @error('email') | 78 | @error('email') |
79 | <span class="text-xs text-red-600"> | 79 | <span class="text-xs text-red-600"> |
80 | {{ $message }} | 80 | {{ $message }} |
81 | </span> | 81 | </span> |
82 | @enderror | 82 | @enderror |
83 | </div> | 83 | </div> |
84 | </div> | 84 | </div> |
85 | 85 | ||
86 | <div class="cabinet__inputs-item form-group"> | 86 | <div class="cabinet__inputs-item form-group"> |
87 | <label class="form-group__label">Электронная почта (alt)</label> | 87 | <label class="form-group__label">Электронная почта (alt)</label> |
88 | <div class="form-group__item"> | 88 | <div class="form-group__item"> |
89 | <input type="email" name="email_2" class="input" placeholder="info@rekamore.su" value="{{ old('email_2') ?? $Employer[0]->email_2 ?? '' }}"> | 89 | <input type="email" name="email_2" class="input" placeholder="info@rekamore.su" value="{{ old('email_2') ?? $Employer[0]->email_2 ?? '' }}"> |
90 | @error('email') | 90 | @error('email') |
91 | <span class="text-xs text-red-600"> | 91 | <span class="text-xs text-red-600"> |
92 | {{ $message }} | 92 | {{ $message }} |
93 | </span> | 93 | </span> |
94 | @enderror | 94 | @enderror |
95 | </div> | 95 | </div> |
96 | </div> | 96 | </div> |
97 | 97 | ||
98 | <div class="cabinet__inputs-item form-group"> | 98 | <div class="cabinet__inputs-item form-group"> |
99 | <label class="form-group__label">Номер телефона</label> | 99 | <label class="form-group__label">Номер телефона</label> |
100 | <div class="form-group__item"> | 100 | <div class="form-group__item"> |
101 | <input type="tel" name="telephone" class="input" placeholder="+7 (___) ___-__-__" value="{{ old('telephone') ?? $Employer[0]->telephone ?? '' }}" required> | 101 | <input type="tel" name="telephone" class="input" placeholder="+7 (___) ___-__-__" value="{{ old('telephone') ?? $Employer[0]->telephone ?? '' }}" required> |
102 | @error('telephone') | 102 | @error('telephone') |
103 | <span class="text-xs text-red-600"> | 103 | <span class="text-xs text-red-600"> |
104 | {{ $message }} | 104 | {{ $message }} |
105 | </span> | 105 | </span> |
106 | @enderror | 106 | @enderror |
107 | </div> | 107 | </div> |
108 | </div> | 108 | </div> |
109 | 109 | ||
110 | <div class="cabinet__inputs-item form-group"> | 110 | <div class="cabinet__inputs-item form-group"> |
111 | <label class="form-group__label">Номер телефона (alt)</label> | 111 | <label class="form-group__label">Номер телефона (alt)</label> |
112 | <div class="form-group__item"> | 112 | <div class="form-group__item"> |
113 | <input type="tel" name="telephone_2" class="input" placeholder="+7 (___) ___-__-__" value="{{ old('telephone_2') ?? $Employer[0]->telephone_2 ?? '' }}"> | 113 | <input type="tel" name="telephone_2" class="input" placeholder="+7 (___) ___-__-__" value="{{ old('telephone_2') ?? $Employer[0]->telephone_2 ?? '' }}"> |
114 | @error('telephone') | 114 | @error('telephone') |
115 | <span class="text-xs text-red-600"> | 115 | <span class="text-xs text-red-600"> |
116 | {{ $message }} | 116 | {{ $message }} |
117 | </span> | 117 | </span> |
118 | @enderror | 118 | @enderror |
119 | </div> | 119 | </div> |
120 | </div> | 120 | </div> |
121 | 121 | ||
122 | <div class="cabinet__inputs-item form-group"> | 122 | <div class="cabinet__inputs-item form-group"> |
123 | <label class="form-group__label">Адрес компании</label> | 123 | <label class="form-group__label">Адрес компании</label> |
124 | <div class="form-group__item"> | 124 | <div class="form-group__item"> |
125 | <input type="text" name="address" class="input" value="{{ old('address') ?? $Employer[0]->address ?? '' }}" placeholder="692904, Приморский край, г. Находка, ул. Портовая 3А, 5 этаж" required> | 125 | <input type="text" name="address" class="input" value="{{ old('address') ?? $Employer[0]->address ?? '' }}" placeholder="692904, Приморский край, г. Находка, ул. Портовая 3А, 5 этаж" required> |
126 | @error('address') | 126 | @error('address') |
127 | <span class="text-xs text-red-600"> | 127 | <span class="text-xs text-red-600"> |
128 | {{ $message }} | 128 | {{ $message }} |
129 | </span> | 129 | </span> |
130 | @enderror | 130 | @enderror |
131 | </div> | 131 | </div> |
132 | </div> | 132 | </div> |
133 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 133 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
134 | <label class="form-group__label">Ссылка на сайт</label> | 134 | <label class="form-group__label">Ссылка на сайт</label> |
135 | <div class="form-group__item"> | 135 | <div class="form-group__item"> |
136 | <input type="url" name="site" class="input" value="{{ old('site') ?? $Employer[0]->site ?? '' }}" placeholder="https://rekamore.su" required> | 136 | <input type="url" name="site" class="input" value="{{ old('site') ?? $Employer[0]->site ?? '' }}" placeholder="https://rekamore.su" required> |
137 | @error('site') | 137 | @error('site') |
138 | <span class="text-xs text-red-600"> | 138 | <span class="text-xs text-red-600"> |
139 | {{ $message }} | 139 | {{ $message }} |
140 | </span> | 140 | </span> |
141 | @enderror | 141 | @enderror |
142 | </div> | 142 | </div> |
143 | </div> | 143 | </div> |
144 | 144 | ||
145 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 145 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
146 | <label class="form-group__label">О компании</label> | 146 | <label class="form-group__label">О компании</label> |
147 | <div class="form-group__item"> | 147 | <div class="form-group__item"> |
148 | <textarea name="text" id="txtarea" class="textarea ckeditor" required>{{ old('text') ?? $Employer[0]->text ?? '' }}</textarea> | 148 | <textarea name="text" id="txtarea" class="textarea ckeditor" required>{{ old('text') ?? $Employer[0]->text ?? '' }}</textarea> |
149 | @error('text') | 149 | @error('text') |
150 | <span class="text-xs text-red-600"> | 150 | <span class="text-xs text-red-600"> |
151 | {{ $message }} | 151 | {{ $message }} |
152 | </span> | 152 | </span> |
153 | @enderror | 153 | @enderror |
154 | </div> | 154 | </div> |
155 | </div> | 155 | </div> |
156 | </div> | 156 | </div> |
157 | </div><br> | 157 | </div><br> |
158 | <button type="submit" class="button cabinet__submit">Сохранить изменения</button> | 158 | <button type="submit" class="button cabinet__submit">Сохранить изменения</button> |
159 | </form> | 159 | </form> |
160 | 160 | ||
161 | </div> | 161 | </div> |
162 | </div> | 162 | </div> |
163 | </div> | 163 | </div> |
164 | 164 | ||
165 | </section> | 165 | </section> |
166 | </div> | 166 | </div> |
167 | <!-- END TOP WRAPPER --> | 167 | <!-- END TOP WRAPPER --> |
168 | <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> | ||
169 | <script> | ||
170 | CKEDITOR.replace('txtarea'); | ||
171 | //CKEDITOR.replace( 'text', { | ||
172 | // filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", | ||
173 | // filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", | ||
174 | // filebrowserUploadMethod: 'form' | ||
175 | // }); | ||
176 | </script> | ||
177 | |||
168 | @endsection | 178 | @endsection |
169 | 179 |
resources/views/employers/edit_vacancy.blade.php
1 | @extends('layout.frontend', ['title' => 'Редактирование вакансии РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Редактирование вакансии РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script> | 4 | <script> |
5 | console.log('Приближаемся к системе, нас рой тут...'); | 5 | console.log('Приближаемся к системе, нас рой тут...'); |
6 | $(document).on('change', '#position_id', function() { | 6 | $(document).on('change', '#position_id', function() { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var val_ = this_.val(); | 8 | var val_ = this_.val(); |
9 | var ajax_ = $('#job_title_id'); | 9 | var ajax_ = $('#job_title_id'); |
10 | 10 | ||
11 | console.log('Создания списка людей, которые поднимутся на корабль...'); | 11 | console.log('Создания списка людей, которые поднимутся на корабль...'); |
12 | 12 | ||
13 | $.ajax({ | 13 | $.ajax({ |
14 | type: "GET", | 14 | type: "GET", |
15 | url: "{{ route('employer.selected_people') }}", | 15 | url: "{{ route('employer.selected_people') }}", |
16 | data: "id="+val_, | 16 | data: "id="+val_, |
17 | success: function (data) { | 17 | success: function (data) { |
18 | console.log('Ответка пришла'); | 18 | console.log('Ответка пришла'); |
19 | console.log('Список избранных людей создан'); | 19 | console.log('Список избранных людей создан'); |
20 | ajax_.html(data); | 20 | ajax_.html(data); |
21 | }, | 21 | }, |
22 | headers: { | 22 | headers: { |
23 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 23 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
24 | }, | 24 | }, |
25 | error: function (data) { | 25 | error: function (data) { |
26 | console.log('Обрыв связи'); | 26 | console.log('Обрыв связи'); |
27 | console.log('Error: ' + data); | 27 | console.log('Error: ' + data); |
28 | } | 28 | } |
29 | }); | 29 | }); |
30 | }); | 30 | }); |
31 | </script> | 31 | </script> |
32 | @endsection | 32 | @endsection |
33 | @section('content') | 33 | @section('content') |
34 | <section class="cabinet"> | 34 | <section class="cabinet"> |
35 | <div class="container"> | 35 | <div class="container"> |
36 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 36 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
37 | <li><a href="{{ route('index') }}">Главная</a></li> | 37 | <li><a href="{{ route('index') }}">Главная</a></li> |
38 | <li><b>Личный кабинет</b></li> | 38 | <li><b>Личный кабинет</b></li> |
39 | </ul> | 39 | </ul> |
40 | <div class="cabinet__wrapper"> | 40 | <div class="cabinet__wrapper"> |
41 | <div class="cabinet__side"> | 41 | <div class="cabinet__side"> |
42 | <div class="cabinet__side-toper"> | 42 | <div class="cabinet__side-toper"> |
43 | 43 | ||
44 | @include('employers.emblema') | 44 | @include('employers.emblema') |
45 | 45 | ||
46 | </div> | 46 | </div> |
47 | 47 | ||
48 | @include('employers.menu', ['item' => 3]) | 48 | @include('employers.menu', ['item' => 3]) |
49 | 49 | ||
50 | </div> | 50 | </div> |
51 | 51 | ||
52 | <form class="cabinet__body" action="{{ route('employer.vacancy_save_me', ['ad_employer' => $Employer->id]) }}" method="POST"> | 52 | <form class="cabinet__body" action="{{ route('employer.vacancy_save_me', ['ad_employer' => $Employer->id]) }}" method="POST"> |
53 | @csrf | 53 | @csrf |
54 | <input type="hidden" name="employer_id" value="{{ $Employer->id }}"/> | 54 | <input type="hidden" name="employer_id" value="{{ $Employer->id }}"/> |
55 | <div class="cabinet__body-item"> | 55 | <div class="cabinet__body-item"> |
56 | <div class="cabinet__descr"> | 56 | <div class="cabinet__descr"> |
57 | <h2 class="title cabinet__title">Редактировать вакансию</h2> | 57 | <h2 class="title cabinet__title">Редактировать вакансию</h2> |
58 | <p class="cabinet__text"><b>Данные по вакансии</b></p> | 58 | <p class="cabinet__text"><b>Данные по вакансии</b></p> |
59 | <p class="cabinet__text">Все поля обязательны для заполнения *</p> | 59 | <p class="cabinet__text">Все поля обязательны для заполнения *</p> |
60 | </div> | 60 | </div> |
61 | </div> | 61 | </div> |
62 | <div class="cabinet__body-item"> | 62 | <div class="cabinet__body-item"> |
63 | <h4>Поля для вакансии</h4> | 63 | <h4>Поля для вакансии</h4> |
64 | <div class="cabinet__inputs"> | 64 | <div class="cabinet__inputs"> |
65 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 65 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
66 | <label class="form-group__label">Название вакансии</label> | 66 | <label class="form-group__label">Название вакансии</label> |
67 | <div class="form-group__item"> | 67 | <div class="form-group__item"> |
68 | <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $ad_employer->name ?? '' }}" required> | 68 | <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $ad_employer->name ?? '' }}" required> |
69 | @error('name') | 69 | @error('name') |
70 | <span class="text-xs text-red-600 dark:text-red-400"> | 70 | <span class="text-xs text-red-600 dark:text-red-400"> |
71 | {{ $message }} | 71 | {{ $message }} |
72 | </span> | 72 | </span> |
73 | @enderror | 73 | @enderror |
74 | </div> | 74 | </div> |
75 | </div> | 75 | </div> |
76 | 76 | ||
77 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | 77 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> |
78 | <label class="form-group__label">Телефон</label> | 78 | <label class="form-group__label">Телефон</label> |
79 | <div class="form-group__item"> | 79 | <div class="form-group__item"> |
80 | <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $ad_employer->telephone ?? '' }}" placeholder="Свой телефон"> | 80 | <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $ad_employer->telephone ?? '' }}" placeholder="Свой телефон"> |
81 | @error('telephone') | 81 | @error('telephone') |
82 | <span class="text-xs text-red-600 dark:text-red-400"> | 82 | <span class="text-xs text-red-600 dark:text-red-400"> |
83 | {{ $message }} | 83 | {{ $message }} |
84 | </span> | 84 | </span> |
85 | @enderror | 85 | @enderror |
86 | </div> | 86 | </div> |
87 | </div> | 87 | </div> |
88 | 88 | ||
89 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | 89 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> |
90 | <label class="form-group__label">Емайл</label> | 90 | <label class="form-group__label">Емайл</label> |
91 | <div class="form-group__item"> | 91 | <div class="form-group__item"> |
92 | <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $ad_employer->email ?? '' }}" placeholder="Своя почту"> | 92 | <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $ad_employer->email ?? '' }}" placeholder="Своя почту"> |
93 | @error('email') | 93 | @error('email') |
94 | <span class="text-xs text-red-600 dark:text-red-400"> | 94 | <span class="text-xs text-red-600 dark:text-red-400"> |
95 | {{ $message }} | 95 | {{ $message }} |
96 | </span> | 96 | </span> |
97 | @enderror | 97 | @enderror |
98 | </div> | 98 | </div> |
99 | </div> | 99 | </div> |
100 | 100 | ||
101 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | 101 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> |
102 | <label class="form-group__label">Зарплата среднестатистическая для вакансии</label> | 102 | <label class="form-group__label">Зарплата среднестатистическая для вакансии</label> |
103 | <div class="form-group__item"> | 103 | <div class="form-group__item"> |
104 | <input type="text" class="input" name="salary" id="salary" value="{{ old('salary') ?? $ad_employer->salary ??'' }}" placeholder="Среднестатистическая зарплата"> | 104 | <input type="text" class="input" name="salary" id="salary" value="{{ old('salary') ?? $ad_employer->salary ??'' }}" placeholder="Среднестатистическая зарплата"> |
105 | @error('salary') | 105 | @error('salary') |
106 | <span class="text-xs text-red-600 dark:text-red-400"> | 106 | <span class="text-xs text-red-600 dark:text-red-400"> |
107 | {{ $message }} | 107 | {{ $message }} |
108 | </span> | 108 | </span> |
109 | @enderror | 109 | @enderror |
110 | </div> | 110 | </div> |
111 | </div> | 111 | </div> |
112 | 112 | ||
113 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 113 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
114 | <label class="form-group__label">Город посадки</label> | 114 | <label class="form-group__label">Город посадки</label> |
115 | <div class="form-group__item"> | 115 | <div class="form-group__item"> |
116 | <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $ad_employer->city ?? '' }}" placeholder="Севастополь"> | 116 | <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $ad_employer->city ?? '' }}" placeholder="Севастополь"> |
117 | @error('city') | 117 | @error('city') |
118 | <span class="text-xs text-red-600"> | 118 | <span class="text-xs text-red-600"> |
119 | {{ $message }} | 119 | {{ $message }} |
120 | </span> | 120 | </span> |
121 | @enderror | 121 | @enderror |
122 | </div> | 122 | </div> |
123 | </div> | 123 | </div> |
124 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style=""> | 124 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style=""> |
125 | <label class="form-group__label">Категория (локация)</label> | 125 | <label class="form-group__label">Категория (локация)</label> |
126 | <div class="form-group__item"> | 126 | <div class="form-group__item"> |
127 | <div class="select"> | 127 | <div class="select"> |
128 | <select class="js-select2" name="category_id" id="category_id"> | 128 | <select class="js-select2" name="category_id" id="category_id"> |
129 | php $i = 1 endphp | 129 | php $i = 1 endphp |
130 | if ($Positions->count()) | 130 | if ($Positions->count()) |
131 | foreach($Positions as $j) | 131 | foreach($Positions as $j) |
132 | if ($i == 1) <option> Выберите категорию из списка</option> | 132 | if ($i == 1) <option> Выберите категорию из списка</option> |
133 | else | 133 | else |
134 | <option value=" $j->id }}" if ($ad_employer->category_id == $j->id) selected endif>$j->name }}</option> | 134 | <option value=" $j->id }}" if ($ad_employer->category_id == $j->id) selected endif>$j->name }}</option> |
135 | endif | 135 | endif |
136 | php $i++ endphp | 136 | php $i++ endphp |
137 | endforeach | 137 | endforeach |
138 | endif | 138 | endif |
139 | </select> | 139 | </select> |
140 | error('category_id') | 140 | error('category_id') |
141 | <span class="text-xs text-red-600 dark:text-red-400"> | 141 | <span class="text-xs text-red-600 dark:text-red-400"> |
142 | $message }} | 142 | $message }} |
143 | </span> | 143 | </span> |
144 | enderror | 144 | enderror |
145 | </div> | 145 | </div> |
146 | </div> | 146 | </div> |
147 | </div>--> | 147 | </div>--> |
148 | 148 | ||
149 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 149 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
150 | <label class="form-group__label">Описание вакансии</label> | 150 | <label class="form-group__label">Описание вакансии</label> |
151 | <div class="form-group__item"> | 151 | <div class="form-group__item"> |
152 | <textarea class="textarea" name="text" id="text">{{ old('text') ?? $ad_employer->text ?? '' }}</textarea> | 152 | <textarea class="textarea ckeditor" name="text" id="text">{{ old('text') ?? $ad_employer->text ?? '' }}</textarea> |
153 | @error('text') | 153 | @error('text') |
154 | <span class="text-xs text-red-600"> | 154 | <span class="text-xs text-red-600"> |
155 | {{ $message }} | 155 | {{ $message }} |
156 | </span> | 156 | </span> |
157 | @enderror | 157 | @enderror |
158 | </div> | 158 | </div> |
159 | </div> | 159 | </div> |
160 | 160 | ||
161 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 161 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
162 | <h4 class="form-group__label">Редактирование должностей</h4> | 162 | <h4 class="form-group__label">Редактирование должностей</h4> |
163 | <div class="form-group__item"> | 163 | <div class="form-group__item"> |
164 | <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $ad_employer->id]) }}" class="button">Добавить</a> | 164 | <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $ad_employer->id]) }}" class="button">Добавить</a> |
165 | 165 | ||
166 | @if ($ad_employer->jobs->count()) | 166 | @if ($ad_employer->jobs->count()) |
167 | @foreach ($ad_employer->jobs as $key => $it_um) | 167 | @foreach ($ad_employer->jobs as $key => $it_um) |
168 | <p>@if (isset($ad_employer->jobs_code[$key])) | 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> | 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> | 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 | 171 | @endif |
172 | </p> | 172 | </p> |
173 | @endforeach | 173 | @endforeach |
174 | @else | 174 | @else |
175 | Нет связанных <br> с вакансией должностей | 175 | Нет связанных <br> с вакансией должностей |
176 | @endif | 176 | @endif |
177 | </div> | 177 | </div> |
178 | </div> | 178 | </div> |
179 | </div> | 179 | </div> |
180 | 180 | ||
181 | <a class="button cabinet__submit" href="{{ route('employer.vacancy_list') }}">Назад</a> | 181 | <a class="button cabinet__submit" href="{{ route('employer.vacancy_list') }}">Назад</a> |
182 | <button type="submit" class="button cabinet__submit">Опубликовать</button> | 182 | <button type="submit" class="button cabinet__submit">Опубликовать</button> |
183 | </div> | 183 | </div> |
184 | </form> | 184 | </form> |
185 | </div> | 185 | </div> |
186 | </div> | 186 | </div> |
187 | </section> | 187 | </section> |
188 | </div> | 188 | </div> |
189 | <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> | ||
190 | <script> | ||
191 | CKEDITOR.replace('text'); | ||
192 | //CKEDITOR.replace( 'text', { | ||
193 | // filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", | ||
194 | // filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", | ||
195 | // filebrowserUploadMethod: 'form' | ||
196 | // }); | ||
197 | </script> | ||
189 | @endsection | 198 | @endsection |
190 | 199 |
resources/views/employers/list_answer.blade.php
1 | @extends('layout.frontend', ['title' => 'Список откликов на вакансии - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Список откликов на вакансии - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script> | 4 | <script> |
5 | console.log('Test system'); | 5 | console.log('Test system'); |
6 | $(document).on('change', '#sort_ajax', function() { | 6 | $(document).on('change', '#sort_ajax', function() { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var val_ = this_.val(); | 8 | var val_ = this_.val(); |
9 | console.log('sort items '+val_); | 9 | console.log('sort items '+val_); |
10 | 10 | ||
11 | $.ajax({ | 11 | $.ajax({ |
12 | type: "GET", | 12 | type: "GET", |
13 | url: "{{ route('shipping_companies') }}", | 13 | url: "{{ route('shipping_companies') }}", |
14 | data: "sort="+val_+"&block=1", | 14 | data: "sort="+val_+"&block=1", |
15 | success: function (data) { | 15 | success: function (data) { |
16 | console.log('Выбор сортировки'); | 16 | console.log('Выбор сортировки'); |
17 | console.log(data); | 17 | console.log(data); |
18 | $('#block_1').html(data); | 18 | $('#block_1').html(data); |
19 | }, | 19 | }, |
20 | headers: { | 20 | headers: { |
21 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 21 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
22 | }, | 22 | }, |
23 | error: function (data) { | 23 | error: function (data) { |
24 | data = JSON.stringify(data); | 24 | data = JSON.stringify(data); |
25 | console.log('Error: ' + data); | 25 | console.log('Error: ' + data); |
26 | } | 26 | } |
27 | }); | 27 | }); |
28 | 28 | ||
29 | $.ajax({ | 29 | $.ajax({ |
30 | type: "GET", | 30 | type: "GET", |
31 | url: "{{ route('shipping_companies') }}", | 31 | url: "{{ route('shipping_companies') }}", |
32 | data: "sort="+val_+"&block=2", | 32 | data: "sort="+val_+"&block=2", |
33 | success: function (data) { | 33 | success: function (data) { |
34 | console.log('Выбор сортировки2'); | 34 | console.log('Выбор сортировки2'); |
35 | console.log(data); | 35 | console.log(data); |
36 | history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | 36 | history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); |
37 | $('#block_2').html(data); | 37 | $('#block_2').html(data); |
38 | }, | 38 | }, |
39 | headers: { | 39 | headers: { |
40 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 40 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
41 | }, | 41 | }, |
42 | error: function (data) { | 42 | error: function (data) { |
43 | data = JSON.stringify(data); | 43 | data = JSON.stringify(data); |
44 | console.log('Error: ' + data); | 44 | console.log('Error: ' + data); |
45 | } | 45 | } |
46 | }); | 46 | }); |
47 | }); | 47 | }); |
48 | </script> | 48 | </script> |
49 | @endsection | 49 | @endsection |
50 | 50 | ||
51 | @section('content') | 51 | @section('content') |
52 | <section class="cabinet"> | 52 | <section class="cabinet"> |
53 | <div class="container"> | 53 | <div class="container"> |
54 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 54 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
55 | <li><a href="{{ route('index') }}">Главная</a></li> | 55 | <li><a href="{{ route('index') }}">Главная</a></li> |
56 | <li><b>Личный кабинет</b></li> | 56 | <li><b>Личный кабинет</b></li> |
57 | </ul> | 57 | </ul> |
58 | <div class="cabinet__wrapper"> | 58 | <div class="cabinet__wrapper"> |
59 | <div class="cabinet__side"> | 59 | <div class="cabinet__side"> |
60 | <div class="cabinet__side-toper"> | 60 | <div class="cabinet__side-toper"> |
61 | 61 | ||
62 | @include('employers.emblema') | 62 | @include('employers.emblema') |
63 | 63 | ||
64 | </div> | 64 | </div> |
65 | 65 | ||
66 | @include('employers.menu', ['item' => 4]) | 66 | @include('employers.menu', ['item' => 4]) |
67 | </div> | 67 | </div> |
68 | <div class="cabinet__body"> | 68 | <div class="cabinet__body"> |
69 | <div class="cabinet__body-item"> | 69 | <div class="cabinet__body-item"> |
70 | <h2 class="title cabinet__title">Отклики на вакансию</h2> | 70 | <h2 class="title cabinet__title">Отклики на вакансию</h2> |
71 | </div> | 71 | </div> |
72 | <div class="cabinet__body-item"> | 72 | <div class="cabinet__body-item"> |
73 | <div class="cabinet__filters"> | 73 | <div class="cabinet__filters"> |
74 | <div class="cabinet__filters-item"> | 74 | <div class="cabinet__filters-item"> |
75 | <form class="search" action="{{ route('employer.answers', ['employer' => $employer->id]) }}" method="GET"> | 75 | <form class="search" action="{{ route('employer.answers', ['employer' => $employer->id]) }}" method="GET"> |
76 | <input type="search" class="input" name="search" id="search" placeholder="Поиск…" value="@isset($_GET['search']) {{ $_GET['search'] }} @endisset"> | 76 | <input type="search" class="input" name="search" id="search" placeholder="Поиск…" value="@isset($_GET['search']) {{ $_GET['search'] }} @endisset"> |
77 | <button type="submit" class="button">Найти</button> | 77 | <button type="submit" class="button">Найти</button> |
78 | <span> | 78 | <span> |
79 | <svg> | 79 | <svg> |
80 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> | 80 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> |
81 | </svg> | 81 | </svg> |
82 | </span> | 82 | </span> |
83 | </form> | 83 | </form> |
84 | </div> | 84 | </div> |
85 | <div class="cabinet__filters-item"> | 85 | <div class="cabinet__filters-item"> |
86 | <div class="select"> | 86 | <div class="select"> |
87 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> | 87 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> |
88 | <option value="default">Сортировка (по умолчанию)</option> | 88 | <option value="default">Сортировка (по умолчанию)</option> |
89 | <option value="name (asc)">По имени (возрастание)</option> | 89 | <option value="name (asc)">По имени (возрастание)</option> |
90 | <option value="name (desc)">По имени (убывание)</option> | 90 | <option value="name (desc)">По имени (убывание)</option> |
91 | <option value="created_at (asc)">По дате (возрастание)</option> | 91 | <option value="created_at (asc)">По дате (возрастание)</option> |
92 | <option value="created_at (desc)">По дате (убывание)</option> | 92 | <option value="created_at (desc)">По дате (убывание)</option> |
93 | </select> | 93 | </select> |
94 | </div> | 94 | </div> |
95 | <!--<div class="select"> | 95 | <!--<div class="select"> |
96 | <select class="js-select2"> | 96 | <select class="js-select2"> |
97 | <option>Фильтр по вакансиям</option> | 97 | <option>Фильтр по вакансиям</option> |
98 | <option>Вариант 1</option> | 98 | <option>Вариант 1</option> |
99 | <option>Вариант 2</option> | 99 | <option>Вариант 2</option> |
100 | <option>Вариант 3</option> | 100 | <option>Вариант 3</option> |
101 | </select> | 101 | </select> |
102 | </div>--> | 102 | </div>--> |
103 | </div> | 103 | </div> |
104 | </div> | 104 | </div> |
105 | <div class="responses"> | 105 | <div class="responses"> |
106 | <!--<button type="button" class="messages__button js-toggle js-parent-toggle button button_light button_more"> | 106 | <!--<button type="button" class="messages__button js-toggle js-parent-toggle button button_light button_more"> |
107 | <span>Показать ещё</span> | 107 | <span>Показать ещё</span> |
108 | <span>Скрыть</span> | 108 | <span>Скрыть</span> |
109 | </button>--> | 109 | </button>--> |
110 | <div class="responses__body"> | 110 | <div class="responses__body"> |
111 | @if ($answer->count()) | 111 | @if ($answer->count()) |
112 | @foreach ($answer as $it) | 112 | @foreach ($answer as $it) |
113 | @if ($it->response->count()) | 113 | @if ($it->response->count()) |
114 | @foreach($it->response as $el) | 114 | @foreach($it->response as $el) |
115 | <div class="responses__item"> | 115 | <div class="responses__item"> |
116 | <div class="responses__item-date">{{ $el->created_at }}</div> | 116 | <div class="responses__item-date">{{ $el->created_at }}</div> |
117 | <div class="responses__item-wrapper"> | 117 | <div class="responses__item-wrapper"> |
118 | <div class="responses__item-inner"> | 118 | <div class="responses__item-inner"> |
119 | <div class="responses__item-row"> | 119 | <div class="responses__item-row"> |
120 | <span>Название вакансии</span> | 120 | <span>Название вакансии</span> |
121 | {{ $it->name }} | 121 | {{ $it->name }} |
122 | </div> | 122 | </div> |
123 | <div class="responses__item-row"> | 123 | <div class="responses__item-row"> |
124 | <span>Имя кандидата</span> | 124 | <span>Имя кандидата</span> |
125 | @if (isset($el->message->user_from->name)) | 125 | @if (isset($el->message->user_from->name)) |
126 | {{ $el->message->user_from->name }} | 126 | {{ $el->message->user_from->name }} |
127 | @else | 127 | @else |
128 | Удален пользователь | 128 | Удален пользователь |
129 | @endif | 129 | @endif |
130 | </div> | 130 | </div> |
131 | <div class="responses__item-row"> | 131 | <div class="responses__item-row"> |
132 | <span>Статус</span> | 132 | <span>Статус</span> |
133 | @if ($el->flag == 1) | 133 | @if ($el->flag == 1) |
134 | Новое | 134 | Новое |
135 | @elseif ($el->flag == 2) | 135 | @elseif ($el->flag == 2) |
136 | Отклонить | 136 | Отклонить |
137 | @elseif ($el->flag == 3) | 137 | @elseif ($el->flag == 3) |
138 | Удержать | 138 | Удержать |
139 | @elseif ($el->flag ==4) | 139 | @elseif ($el->flag ==4) |
140 | Удалено | 140 | Удалено |
141 | @endif | 141 | @endif |
142 | </div> | 142 | </div> |
143 | </div> | 143 | </div> |
144 | <div class="responses__item-buttons"> | 144 | <div class="responses__item-buttons"> |
145 | <a href="{{ route('employer.status_msg', ['employer' => $employer->id,'ad_response' => $el->id, 'flag' => 1]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle supple-btn @if ($el->flag == 1) active @endif"> | 145 | <a href="{{ route('employer.status_msg', ['employer' => $employer->id,'ad_response' => $el->id, 'flag' => 1]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle supple-btn @if ($el->flag == 1) active @endif"> |
146 | <svg> | 146 | <svg> |
147 | <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use> | 147 | <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use> |
148 | </svg> | 148 | </svg> |
149 | Принят | 149 | Принят |
150 | </a> | 150 | </a> |
151 | <a href="{{ route('employer.status_msg', ['employer' => $employer->id, 'ad_response' => $el->id, 'flag' => 2]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle cancel-btn @if ($el->flag == 2) active @endif"> | 151 | <a href="{{ route('employer.status_msg', ['employer' => $employer->id, 'ad_response' => $el->id, 'flag' => 2]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle cancel-btn @if ($el->flag == 2) active @endif"> |
152 | <svg> | 152 | <svg> |
153 | <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> | 153 | <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> |
154 | </svg> | 154 | </svg> |
155 | Отклонить | 155 | Отклонить |
156 | </a> | 156 | </a> |
157 | <a href="{{ route('employer.status_msg', ['employer' => $employer->id, 'ad_response' => $el->id, 'flag' => 3]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle time-btn @if ($el->flag == 3) active @endif"> | 157 | <a href="{{ route('employer.status_msg', ['employer' => $employer->id, 'ad_response' => $el->id, 'flag' => 3]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle time-btn @if ($el->flag == 3) active @endif"> |
158 | <svg> | 158 | <svg> |
159 | <use xlink:href="{{ asset('images/sprite.svg#time') }}"></use> | 159 | <use xlink:href="{{ asset('images/sprite.svg#time') }}"></use> |
160 | </svg> | 160 | </svg> |
161 | Удержать | 161 | Удержать |
162 | </a> | 162 | </a> |
163 | <a href="{{ route('employer.status_msg', ['employer' => $employer->id, 'ad_response' => $el->id, 'flag' => 4]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle delete-btn @if ($el->flag == 4) active @endif"> | 163 | <a href="{{ route('employer.status_msg', ['employer' => $employer->id, 'ad_response' => $el->id, 'flag' => 4]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle delete-btn @if ($el->flag == 4) active @endif"> |
164 | <svg> | 164 | <svg> |
165 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> | 165 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> |
166 | </svg> | 166 | </svg> |
167 | Удалить | 167 | Удалить |
168 | </a> | 168 | </a> |
169 | </div> | 169 | </div> |
170 | </div> | 170 | </div> |
171 | </div> | 171 | </div> |
172 | @endforeach | 172 | @endforeach |
173 | |||
174 | <!-- $it->response->appends($_GET)->links('paginate') --> | ||
173 | @endif | 175 | @endif |
174 | @endforeach | 176 | @endforeach |
177 | |||
178 | |||
175 | @else | 179 | @else |
176 | <div class="notify"> | 180 | <div class="notify"> |
177 | <svg> | 181 | <svg> |
178 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> | 182 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> |
179 | </svg> | 183 | </svg> |
180 | <span>Вам еще никто не написал сообщений</span> | 184 | <span>Вам еще никто не написал сообщений</span> |
181 | </div> | 185 | </div> |
182 | @endif | 186 | @endif |
183 | </div> | 187 | </div> |
184 | </div> | 188 | </div> |
185 | </div> | 189 | </div> |
186 | </div> | 190 | </div> |
187 | 191 | ||
188 | </div> | 192 | </div> |
189 | </div> | 193 | </div> |
190 | </section> | 194 | </section> |
191 | </div> | 195 | </div> |
192 | @endsection | 196 | @endsection |
193 | 197 |
resources/views/employers/list_vacancy.blade.php
1 | @extends('layout.frontend', ['title' => 'Список вакансий - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Список вакансий - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script> | 4 | <script> |
5 | console.log('Test system'); | 5 | console.log('Test system'); |
6 | $(document).on('change', '#sort_ajax', function() { | 6 | $(document).on('change', '#sort_ajax', function() { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var val_ = this_.val(); | 8 | var val_ = this_.val(); |
9 | console.log('sort items '+val_); | 9 | console.log('sort items '+val_); |
10 | 10 | ||
11 | $.ajax({ | 11 | $.ajax({ |
12 | type: "GET", | 12 | type: "GET", |
13 | url: "{{ route('employer.vacancy_list') }}", | 13 | url: "{{ route('employer.vacancy_list') }}", |
14 | data: "sort="+val_, | 14 | data: "sort="+val_, |
15 | success: function (data) { | 15 | success: function (data) { |
16 | console.log('Выбор сортировки'); | 16 | console.log('Выбор сортировки'); |
17 | console.log(data); | 17 | console.log(data); |
18 | history.pushState({}, '', "{{ route('employer.vacancy_list') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | 18 | history.pushState({}, '', "{{ route('employer.vacancy_list') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); |
19 | $('#main_ockar').html(data); | 19 | $('#main_ockar').html(data); |
20 | }, | 20 | }, |
21 | headers: { | 21 | headers: { |
22 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 22 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
23 | }, | 23 | }, |
24 | error: function (data) { | 24 | error: function (data) { |
25 | data = JSON.stringify(data); | 25 | data = JSON.stringify(data); |
26 | console.log('Error: ' + data); | 26 | console.log('Error: ' + data); |
27 | } | 27 | } |
28 | }); | 28 | }); |
29 | }); | 29 | }); |
30 | </script> | 30 | </script> |
31 | @endsection | 31 | @endsection |
32 | 32 | ||
33 | @section('content') | 33 | @section('content') |
34 | <section class="cabinet"> | 34 | <section class="cabinet"> |
35 | <div class="container"> | 35 | <div class="container"> |
36 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 36 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
37 | <li><a href="{{ route('index') }}">Главная</a></li> | 37 | <li><a href="{{ route('index') }}">Главная</a></li> |
38 | <li><b>Личный кабинет</b></li> | 38 | <li><b>Личный кабинет</b></li> |
39 | </ul> | 39 | </ul> |
40 | <div class="cabinet__wrapper"> | 40 | <div class="cabinet__wrapper"> |
41 | <div class="cabinet__side"> | 41 | <div class="cabinet__side"> |
42 | <div class="cabinet__side-toper"> | 42 | <div class="cabinet__side-toper"> |
43 | 43 | ||
44 | @include('employers.emblema') | 44 | @include('employers.emblema') |
45 | 45 | ||
46 | </div> | 46 | </div> |
47 | 47 | ||
48 | @include('employers.menu', ['item' => 3]) | 48 | @include('employers.menu', ['item' => 3]) |
49 | </div> | 49 | </div> |
50 | <div class="cabinet__body"> | 50 | <div class="cabinet__body"> |
51 | <div class="cabinet__body-item"> | 51 | <div class="cabinet__body-item"> |
52 | <h2 class="title cabinet__title">Мои вакансии</h2> | 52 | <h2 class="title cabinet__title">Мои вакансии</h2> |
53 | </div> | 53 | </div> |
54 | <div class="cabinet__body-item"> | 54 | <div class="cabinet__body-item"> |
55 | <div class="cabinet__filters"> | 55 | <div class="cabinet__filters"> |
56 | <div class="cabinet__filters-item"> | 56 | <div class="cabinet__filters-item"> |
57 | <form class="search"> | 57 | <form class="search"> |
58 | <input type="search" class="input" placeholder="Поиск…" required> | 58 | <input type="search" class="input" placeholder="Поиск…" required> |
59 | <button type="submit" class="button">Найти</button> | 59 | <button type="submit" class="button">Найти</button> |
60 | <span> | 60 | <span> |
61 | <svg> | 61 | <svg> |
62 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> | 62 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> |
63 | </svg> | 63 | </svg> |
64 | </span> | 64 | </span> |
65 | </form> | 65 | </form> |
66 | </div> | 66 | </div> |
67 | <div class="cabinet__filters-item"> | 67 | <div class="cabinet__filters-item"> |
68 | <div class="select"> | 68 | <div class="select"> |
69 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> | 69 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> |
70 | <option value="default">Сортировка (по умолчанию)</option> | 70 | <option value="default">Сортировка (по умолчанию)</option> |
71 | <option value="name_up">По имени (возрастание)</option> | 71 | <option value="name_up">По имени (возрастание)</option> |
72 | <option value="name_down">По имени (убывание)</option> | 72 | <option value="name_down">По имени (убывание)</option> |
73 | <option value="created_at_up">По дате (возрастание)</option> | 73 | <option value="created_at_up">По дате (возрастание)</option> |
74 | <option value="created_at_down">По дате (убывание)</option> | 74 | <option value="created_at_down">По дате (убывание)</option> |
75 | </select> | 75 | </select> |
76 | </div> | 76 | </div> |
77 | </div> | 77 | </div> |
78 | </div> | 78 | </div> |
79 | 79 | ||
80 | <div class="table table_spoiler" id="main_ockar" name="main_oskar"> | 80 | <div class="table table_spoiler" id="main_ockar" name="main_oskar"> |
81 | @if ($vacancy_list->count()) | 81 | @if ($vacancy_list->count()) |
82 | <div class="table__scroll"> | 82 | <div class="table__scroll"> |
83 | <div class="table__body table__body_min-width"> | 83 | <div class="table__body table__body_min-width"> |
84 | <table> | 84 | <table> |
85 | <thead> | 85 | <thead> |
86 | <tr> | 86 | <tr> |
87 | <th>№</th> | 87 | <th>№</th> |
88 | <th>Название</th> | 88 | <th>Название</th> |
89 | <th>Дата добавления<br>/ обновления</th> | 89 | <th>Дата добавления<br>/ обновления</th> |
90 | <th>Должности</th> | 90 | <th style="display:none">Должности</th> |
91 | <th>Статус</th> | 91 | <th>Статус</th> |
92 | <th>Действия</th> | 92 | <th>Действия</th> |
93 | </tr> | 93 | </tr> |
94 | </thead> | 94 | </thead> |
95 | <tbody> | 95 | <tbody> |
96 | @foreach($vacancy_list as $it) | 96 | @foreach($vacancy_list as $it) |
97 | <tr> | 97 | <tr> |
98 | <td>{{ $it->id }}</td> | 98 | <td>{{ $it->id }}</td> |
99 | <td>{{ $it->name }}</td> | 99 | <td>{{ $it->name }}</td> |
100 | <td>{{ date('d.m.Y H:i:s', strtotime($it->created_at)) }} <br>/ {{ date('d.m.Y H:i:s', strtotime($it->updated_at)) }}</td> | 100 | <td>{{ date('d.m.Y H:i:s', strtotime($it->created_at)) }} <br>/ {{ date('d.m.Y H:i:s', strtotime($it->updated_at)) }}</td> |
101 | <td> <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $it->id]) }}" class="button">Добавить</a> | 101 | <td style="display:none"> <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $it->id]) }}" class="button">Добавить</a> |
102 | 102 | ||
103 | @if ($it->jobs->count()) | 103 | @if ($it->jobs->count()) |
104 | @foreach ($it->jobs as $key => $it_um) | 104 | @foreach ($it->jobs as $key => $it_um) |
105 | <p>@if (isset($it->jobs_code[$key])) | 105 | <p>@if (isset($it->jobs_code[$key])) |
106 | <a href="{{ route('employer.edit_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id, 'ad_employer' => $it->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">{{$it_um->name}}</a> | 106 | <a href="{{ route('employer.edit_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id, 'ad_employer' => $it->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">{{$it_um->name}}</a> |
107 | <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a> | 107 | <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a> |
108 | @endif | 108 | @endif |
109 | </p> | 109 | </p> |
110 | @endforeach | 110 | @endforeach |
111 | @else | 111 | @else |
112 | Нет связанных <br> с вакансией должностей | 112 | Нет связанных <br> с вакансией должностей |
113 | @endif | 113 | @endif |
114 | </td> | 114 | </td> |
115 | <td> | 115 | <td> |
116 | @if ($it->active_is) | 116 | @if ($it->active_is) |
117 | <span class="table__status green"><i></i>Опубликовано</span> | 117 | <span class="table__status green"><i></i>Опубликовано</span> |
118 | @else | 118 | @else |
119 | <span class="table__status"><i></i>Не опубликовано</span> | 119 | <span class="table__status"><i></i>Не опубликовано</span> |
120 | @endif | 120 | @endif |
121 | </td> | 121 | </td> |
122 | <td> | 122 | <td> |
123 | <span class="table__controls"> | 123 | <span class="table__controls"> |
124 | <a class="table__controls-item up-it" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}"> | 124 | <a class="table__controls-item up-it" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}"> |
125 | <svg> | 125 | <svg> |
126 | <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use> | 126 | <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use> |
127 | </svg> | 127 | </svg> |
128 | </a> | 128 | </a> |
129 | <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" class="table__controls-item"> | 129 | <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" class="table__controls-item"> |
130 | <svg> | 130 | <svg> |
131 | <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> | 131 | <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> |
132 | </svg> | 132 | </svg> |
133 | </a> | 133 | </a> |
134 | <a class="table__controls-item" href="{{ route('employer.vacancy_delete', ['ad_employer' => $it->id]) }}"> | 134 | <a class="table__controls-item" href="{{ route('employer.vacancy_delete', ['ad_employer' => $it->id]) }}"> |
135 | <svg> | 135 | <svg> |
136 | <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> | 136 | <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> |
137 | </svg> | 137 | </svg> |
138 | </a> | 138 | </a> |
139 | @if ($it->active_is) | 139 | @if ($it->active_is) |
140 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" class="table__controls-item"> | 140 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" class="table__controls-item"> |
141 | <svg> | 141 | <svg> |
142 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> | 142 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> |
143 | </svg> | 143 | </svg> |
144 | </a> | 144 | </a> |
145 | @else | 145 | @else |
146 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" class="table__controls-item"> | 146 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" class="table__controls-item"> |
147 | <svg> | 147 | <svg> |
148 | <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> | 148 | <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> |
149 | </svg> | 149 | </svg> |
150 | </a> | 150 | </a> |
151 | @endif | 151 | @endif |
152 | <!--<a class="btn_telegram_share table__controls-item" href="https://telegram.me/share/url?url=ВАШ_URL&text={{ $it->name }}"> | 152 | <!--<a class="btn_telegram_share table__controls-item" href="https://telegram.me/share/url?url=ВАШ_URL&text={{ $it->name }}"> |
153 | <svg> | 153 | <svg> |
154 | <use xlink:href=" asset('images/sprite.svg#arrow-radius') }}"></use> | 154 | <use xlink:href=" asset('images/sprite.svg#arrow-radius') }}"></use> |
155 | </svg> | 155 | </svg> |
156 | </a>--> | 156 | </a>--> |
157 | 157 | ||
158 | <!--<button type="button" class="table__controls-item"> | 158 | <!--<button type="button" class="table__controls-item"> |
159 | <svg> | 159 | <svg> |
160 | <use xlink:href=" asset('images/sprite.svg#tg') }}"></use> | 160 | <use xlink:href=" asset('images/sprite.svg#tg') }}"></use> |
161 | </svg> | 161 | </svg> |
162 | </button> | 162 | </button> |
163 | --> | 163 | --> |
164 | </span> | 164 | </span> |
165 | </td> | 165 | </td> |
166 | </tr> | 166 | </tr> |
167 | @endforeach | 167 | @endforeach |
168 | </tbody> | 168 | </tbody> |
169 | </table> | 169 | </table> |
170 | </div><br> | 170 | </div><br> |
171 | {{ $vacancy_list->appends($_GET)->links('paginate') }} | 171 | {{ $vacancy_list->appends($_GET)->links('paginate') }} |
172 | </div> | 172 | </div> |
173 | 173 | ||
174 | 174 | ||
175 | @else | 175 | @else |
176 | 176 | ||
177 | <div class="notify"> | 177 | <div class="notify"> |
178 | <svg> | 178 | <svg> |
179 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> | 179 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> |
180 | </svg> | 180 | </svg> |
181 | <span>Вы ещё не разместили ни одной вакансии</span> | 181 | <span>Вы ещё не разместили ни одной вакансии</span> |
182 | </div> | 182 | </div> |
183 | @endif | 183 | @endif |
184 | </div> | 184 | </div> |
185 | </div> | 185 | </div> |
186 | </div> | 186 | </div> |
187 | </div> | 187 | </div> |
188 | </div> | 188 | </div> |
189 | </section> | 189 | </section> |
190 | </div> | 190 | </div> |
191 | @endsection | 191 | @endsection |
192 | 192 |
resources/views/index.blade.php
1 | @extends('layout.frontend', ['title' => 'Главная страница РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Главная страница РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | 4 | ||
5 | @endsection | 5 | @endsection |
6 | 6 | ||
7 | @section('content') | 7 | @section('content') |
8 | @include('messages_error') | 8 | @include('messages_error') |
9 | <section class="work"> | 9 | <section class="work"> |
10 | <div class="container"> | 10 | <div class="container"> |
11 | <img src="{{ asset('images/1.png') }}" alt="" class="work__pic"> | 11 | <img src="{{ asset('images/1.png') }}" alt="" class="work__pic"> |
12 | <div class="work__body"> | 12 | <div class="work__body"> |
13 | <div class="work__title"> | 13 | <div class="work__title"> |
14 | <h4>Работа в море / | 14 | <h4>Работа в море / |
15 | <span class="br">Работа на реке</span></h4> | 15 | <span class="br">Работа на реке</span></h4> |
16 | </div> | 16 | </div> |
17 | <div class="work__text">Профессиональная сеть морского сообщества «RekaMore.su» приветствует вас — | 17 | <div class="work__text">Профессиональная сеть морского сообщества «RekaMore.su» приветствует вас — |
18 | тех, кто не представляет себе жизнь без моря, тех, кто готов связать свою жизнь с работой в | 18 | тех, кто не представляет себе жизнь без моря, тех, кто готов связать свою жизнь с работой в |
19 | сложных, но очень интересных условиях. </div> | 19 | сложных, но очень интересных условиях. </div> |
20 | <div class="work__list"> | 20 | <div class="work__list"> |
21 | <div>Тысячи соискателей увидят Ваше объявление</div> | 21 | <div>Тысячи соискателей увидят Ваше объявление</div> |
22 | <div>Десятки компаний выкладывают объявления каждый день</div> | 22 | <div>Десятки компаний выкладывают объявления каждый день</div> |
23 | </div> | 23 | </div> |
24 | <form class="search work__form" action="{{ route('search_vacancies') }}" method="GET"> | 24 | <form class="search work__form" action="{{ route('search_vacancies') }}" method="GET"> |
25 | <input type="search" id="search" name="search" class="input" placeholder="Желаемая должность" required> | 25 | <input type="search" id="search" name="search" class="input" placeholder="Желаемая должность" required> |
26 | <!--<div class="select select_search thing__select"> | ||
27 | <div class="select__icon"> | ||
28 | <svg> | ||
29 | <use xlink:href=" asset('images/sprite.svg#search') }}"></use> | ||
30 | </svg> | ||
31 | </div> | ||
32 | <select class="js-select2 jobs" id="search" name="search"> | ||
33 | <option value="0">Выберите должность</option> | ||
34 | if ($Job_title->count()) | ||
35 | foreach($Job_title as $JT) | ||
36 | <option value=" $JT->id }}" if ((isset($_GET['job'])) && ($_GET['job'] == $JT->id)) selected endif> $JT->name }}</option> | ||
37 | endforeach | ||
38 | endif | ||
39 | </select> | ||
40 | </div>--> | ||
26 | <button type="submit" class="button button_light">Посмотреть вакансии</button> | 41 | <button type="submit" class="button button_light">Посмотреть вакансии</button> |
27 | <span> | 42 | <span> |
28 | <svg> | 43 | <svg> |
29 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> | 44 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> |
30 | </svg> | 45 | </svg> |
31 | </span> | 46 | </span> |
32 | </form> | 47 | </form> |
33 | @guest | 48 | @guest |
34 | <a data-fancybox data-src="#question2" data-options='{"touch":false,"autoFocus":false}' class="button work__search">Я ищу сотрудника</a> | 49 | <a data-fancybox data-src="#question2" data-options='{"touch":false,"autoFocus":false}' class="button work__search">Я ищу сотрудника</a> |
35 | @else | 50 | @else |
36 | <a href="{{ route('bd_resume') }}" class="button work__search">Я ищу сотрудника</a> | 51 | <a href="{{ route('bd_resume') }}" class="button work__search">Я ищу сотрудника</a> |
37 | @endguest | 52 | @endguest |
38 | <div class="work__get"> | 53 | <div class="work__get"> |
39 | <b>Скачать приложение</b> | 54 | <b>Скачать приложение</b> |
40 | <a href=""> | 55 | <a href=""> |
41 | <img src="{{ asset('images/google.svg') }}" alt=""> | 56 | <img src="{{ asset('images/google.svg') }}" alt=""> |
42 | </a> | 57 | </a> |
43 | <a href=""> | 58 | <a href=""> |
44 | <img src="{{ asset('images/apple.svg') }}" alt=""> | 59 | <img src="{{ asset('images/apple.svg') }}" alt=""> |
45 | </a> | 60 | </a> |
46 | </div> | 61 | </div> |
47 | </div> | 62 | </div> |
48 | </div> | 63 | </div> |
49 | </section> | 64 | </section> |
50 | <section class="numbers"> | 65 | <section class="numbers"> |
51 | <div class="container"> | 66 | <div class="container"> |
52 | <div class="numbers__body"> | 67 | <div class="numbers__body"> |
53 | <div class="numbers__item"> | 68 | <div class="numbers__item"> |
54 | <b>500+</b> | 69 | <b>500+</b> |
55 | <span>Резюме</span> | 70 | <span>Резюме</span> |
56 | Банальные, но неопровержимые выводы, а также элементы политического процесса лишь добавляют | 71 | Банальные, но неопровержимые выводы, а также элементы политического процесса лишь добавляют |
57 | фракционных разногласий и призваны к ответу. | 72 | фракционных разногласий и призваны к ответу. |
58 | </div> | 73 | </div> |
59 | <div class="numbers__item"> | 74 | <div class="numbers__item"> |
60 | <b>1 000+</b> | 75 | <b>1 000+</b> |
61 | <span>Вакансий</span> | 76 | <span>Вакансий</span> |
62 | В рамках спецификации современных стандартов, диаграммы связей заблокированы в рамках своих | 77 | В рамках спецификации современных стандартов, диаграммы связей заблокированы в рамках своих |
63 | собственных рациональных ограничений. | 78 | собственных рациональных ограничений. |
64 | </div> | 79 | </div> |
65 | <div class="numbers__item"> | 80 | <div class="numbers__item"> |
66 | <b>265</b> | 81 | <b>265</b> |
67 | <span>Компаний</span> | 82 | <span>Компаний</span> |
68 | Но сторонники тоталитаризма в науке заблокированы в рамках своих собственных рациональных | 83 | Но сторонники тоталитаризма в науке заблокированы в рамках своих собственных рациональных |
69 | ограничений. | 84 | ограничений. |
70 | </div> | 85 | </div> |
71 | </div> | 86 | </div> |
72 | </div> | 87 | </div> |
73 | </section> | 88 | </section> |
74 | <!--<section class="vacancies"> | 89 | <!--<section class="vacancies"> |
75 | <div class="container"> | 90 | <div class="container"> |
76 | <div class="title"><h4>Новые вакансии</h4></div> | 91 | <div class="title"><h4>Новые вакансии</h4></div> |
77 | <div class="vacancies__body"> | 92 | <div class="vacancies__body"> |
78 | <a class="vacancies__more button button_light js-parent-toggle" href="{{ route('vacancies') }}">Все должности</a> | 93 | <a class="vacancies__more button button_light js-parent-toggle" href="{{ route('vacancies') }}">Все должности</a> |
79 | <div class="vacancies__list"> | 94 | <div class="vacancies__list"> |
80 | _if ($categories->count()) | 95 | _if ($categories->count()) |
81 | _foreach ($categories as $cat) | 96 | _foreach ($categories as $cat) |
82 | <a href=" route('list-vacancies', ['categories' => $cat->id]) }}" class="vacancies__item"> | 97 | <a href=" route('list-vacancies', ['categories' => $cat->id]) }}" class="vacancies__item"> |
83 | <span style="border-color:#F4C4C2"> | 98 | <span style="border-color:#F4C4C2"> |
84 | <b> $cat->name }}</b> | 99 | <b> $cat->name }}</b> |
85 | <i>Вакансий: <span> $cat->cnt }}</span></i> | 100 | <i>Вакансий: <span> $cat->cnt }}</span></i> |
86 | </span> | 101 | </span> |
87 | </a> | 102 | </a> |
88 | _endforeach | 103 | _endforeach |
89 | _else | 104 | _else |
90 | Тут пока нет никаких вакансий | 105 | Тут пока нет никаких вакансий |
91 | _endif | 106 | _endif |
92 | </div> | 107 | </div> |
93 | </div> | 108 | </div> |
94 | </div> | 109 | </div> |
95 | </section>--> | 110 | </section>--> |
96 | 111 | ||
97 | <main class="main"> | 112 | <main class="main"> |
98 | <div class="container"> | 113 | <div class="container"> |
99 | <div class="main__vacancies"> | 114 | <div class="main__vacancies"> |
100 | <h2 class="main__vacancies-title">Категории вакансий</h2> | 115 | <h2 class="main__vacancies-title">Категории вакансий</h2> |
101 | <div class="vacancies__body"> | 116 | <div class="vacancies__body"> |
102 | <div class="vacancies__list" id="block_ajax" name="block_ajax"> | 117 | <div class="vacancies__list" id="block_ajax" name="block_ajax"> |
103 | @foreach($Main_Job as $key => $it_main) | 118 | @foreach($Main_Job as $key => $it_main) |
104 | <div class="vacancies__list-col"> | 119 | <div class="vacancies__list-col"> |
105 | @include('block_real_new', ['it_main' => $it_main, 'category' => $key]) | 120 | @include('block_real_new', ['it_main' => $it_main, 'category' => $key]) |
106 | </div> | 121 | </div> |
107 | @endforeach | 122 | @endforeach |
108 | <!--_include('block_real', ['flot' => $flot, 'position' => $Position[$flot->position_id]])--> | 123 | <!--_include('block_real', ['flot' => $flot, 'position' => $Position[$flot->position_id]])--> |
109 | </div> | 124 | </div> |
110 | </div> | 125 | </div> |
111 | </div> | 126 | </div> |
112 | </div> | 127 | </div> |
113 | </main> | 128 | </main> |
114 | 129 | ||
115 | <section class="employer"> | 130 | <section class="employer"> |
116 | <div class="container"> | 131 | <div class="container"> |
117 | <div class="title"><h4>Работодатели</h4></div> | 132 | <div class="title"><h4>Работодатели</h4></div> |
118 | <div class="swiper js-employer-swiper"> | 133 | <div class="swiper js-employer-swiper"> |
119 | <div class="swiper-wrapper"> | 134 | <div class="swiper-wrapper"> |
120 | 135 | ||
121 | @if ($employers->count()) | 136 | @if ($employers->count()) |
122 | @php | 137 | @php |
123 | $rec = 0; | 138 | $rec = 0; |
124 | $count = $employers->count(); | 139 | $count = $employers->count(); |
125 | 140 | ||
126 | @endphp | 141 | @endphp |
127 | 142 | ||
128 | @foreach($employers as $emp) | 143 | @foreach($employers as $emp) |
129 | @php $rec++ @endphp | 144 | @php $rec++ @endphp |
130 | @if (($rec==1) || ($rec==5) || ($rec==9) || ($rec==13) || ($rec==17)) | 145 | @if (($rec==1) || ($rec==5) || ($rec==9) || ($rec==13) || ($rec==17)) |
131 | <div class="swiper-slide"> | 146 | <div class="swiper-slide"> |
132 | <div class="employer__item"> | 147 | <div class="employer__item"> |
133 | @endif | 148 | @endif |
134 | @if (!empty($emp->employer->logo)) | 149 | @if (!empty($emp->employer->logo)) |
135 | <a href="{{ route('ad-employer', ['ad_employer' => $emp->employer->id]) }}"> | 150 | <a href="{{ route('ad-employer', ['ad_employer' => $emp->employer->id]) }}"> |
136 | <img src="{{ asset(Storage::url($emp->employer->logo)) }}" alt="{{ $emp->employer->name_company }}"> | 151 | <img src="{{ asset(Storage::url($emp->employer->logo)) }}" alt="{{ $emp->employer->name_company }}"> |
137 | </a> | 152 | </a> |
138 | @else | 153 | @else |
139 | <a href="{{ route('ad-employer', ['ad_employer' => $emp->employer->id]) }}"> | 154 | <a href="{{ route('ad-employer', ['ad_employer' => $emp->employer->id]) }}"> |
140 | <img src="{{ asset('images/logo_emp.png') }}" alt="{{ $emp->employer->name_company }}"> | 155 | <img src="{{ asset('images/logo_emp.png') }}" alt="{{ $emp->employer->name_company }}"> |
141 | </a> | 156 | </a> |
142 | @endif | 157 | @endif |
143 | @if (($rec==4) || ($rec==8) || ($rec==12) || ($rec==16) || ($rec==20) || ($rec == $count)) | 158 | @if (($rec==4) || ($rec==8) || ($rec==12) || ($rec==16) || ($rec==20) || ($rec == $count)) |
144 | </div> | 159 | </div> |
145 | </div> | 160 | </div> |
146 | @endif | 161 | @endif |
147 | @endforeach | 162 | @endforeach |
148 | @else | 163 | @else |
149 | <h5>Тут нет никаких записей</h5> | 164 | <h5>Тут нет никаких записей</h5> |
150 | @endif | 165 | @endif |
151 | </div> | 166 | </div> |
152 | <div class="swiper-pagination"></div> | 167 | <div class="swiper-pagination"></div> |
153 | </div> | 168 | </div> |
154 | <a href="{{ route('shipping_companies') }}" class="employer__more button button_light">Все работодатели</a> | 169 | <a href="{{ route('shipping_companies') }}" class="employer__more button button_light">Все работодатели</a> |
155 | </div> | 170 | </div> |
156 | </section> | 171 | </section> |
157 | <section class="about"> | 172 | <section class="about"> |
158 | <div class="container"> | 173 | <div class="container"> |
159 | <div class="about__wrapper"> | 174 | <div class="about__wrapper"> |
160 | <div class="title about__title"><h4>О нас</h4></div> | 175 | <div class="title about__title"><h4>О нас</h4></div> |
161 | <div class="about__body"> | 176 | <div class="about__body"> |
162 | <div class="about__line"></div> | 177 | <div class="about__line"></div> |
163 | <div class="about__item"> | 178 | <div class="about__item"> |
164 | <b>Для работодателей</b> | 179 | <b>Для работодателей</b> |
165 | <span>Наш ресурс позволит Вам за демократичную цену найти нужных специалистов в кратчайшие | 180 | <span>Наш ресурс позволит Вам за демократичную цену найти нужных специалистов в кратчайшие |
166 | сроки, подробнее об условиях можно узнать <a href="{{ route('page', ['pages' => 'Stoimost-razmescheniya']) }}">здесь</a>.</span> | 181 | сроки, подробнее об условиях можно узнать <a href="{{ route('page', ['pages' => 'Stoimost-razmescheniya']) }}">здесь</a>.</span> |
167 | <a class="about__button button button_whited" style="text-decoration: none" href="{{ route('bd_resume') }}">Поиск сотрудников</a> | 182 | <a class="about__button button button_whited" style="text-decoration: none" href="{{ route('bd_resume') }}">Поиск сотрудников</a> |
168 | </div> | 183 | </div> |
169 | <div class="about__item"> | 184 | <div class="about__item"> |
170 | <b>Для сотрудников</b> | 185 | <b>Для сотрудников</b> |
171 | <span>Наше преимущество — это большой объем вакансий, более 70 судоходных компаний России и | 186 | <span>Наше преимущество — это большой объем вакансий, более 70 судоходных компаний России и |
172 | СНГ ищут сотрудников через наши ресурсы</span> | 187 | СНГ ищут сотрудников через наши ресурсы</span> |
173 | <a class="about__button button button_whited" style="text-decoration: none" href="{{ route('vacancies') }}">Ищу работу</a> | 188 | <a class="about__button button button_whited" style="text-decoration: none" href="{{ route('vacancies') }}">Ищу работу</a> |
174 | </div> | 189 | </div> |
175 | </div> | 190 | </div> |
176 | </div> | 191 | </div> |
177 | </div> | 192 | </div> |
178 | </section> | 193 | </section> |
179 | 194 | ||
180 | @if ($news->count()) | 195 | @if ($news->count()) |
181 | <section class="news"> | 196 | <section class="news"> |
182 | <div class="container"> | 197 | <div class="container"> |
183 | <div class="news__toper"> | 198 | <div class="news__toper"> |
184 | <div class="title"><h4>Новости и статьи</h4></div> | 199 | <div class="title"><h4>Новости и статьи</h4></div> |
185 | <div class="navs"> | 200 | <div class="navs"> |
186 | <button class="js-news-swiper-button-prev"> | 201 | <button class="js-news-swiper-button-prev"> |
187 | <svg class="rotate180"> | 202 | <svg class="rotate180"> |
188 | <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> | 203 | <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> |
189 | </svg> | 204 | </svg> |
190 | </button> | 205 | </button> |
191 | <button class="js-news-swiper-button-next"> | 206 | <button class="js-news-swiper-button-next"> |
192 | <svg> | 207 | <svg> |
193 | <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> | 208 | <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> |
194 | </svg> | 209 | </svg> |
195 | </button> | 210 | </button> |
196 | </div> | 211 | </div> |
197 | </div> | 212 | </div> |
198 | 213 | ||
199 | <div class="swiper js-news-swiper"> | 214 | <div class="swiper js-news-swiper"> |
200 | <div class="swiper-wrapper"> | 215 | <div class="swiper-wrapper"> |
201 | 216 | ||
202 | @foreach ($news as $new) | 217 | @foreach ($news as $new) |
203 | <div class="swiper-slide"> | 218 | <div class="swiper-slide"> |
204 | <div class="news__item"> | 219 | <div class="news__item"> |
205 | @if (empty($new->image)) | 220 | @if (empty($new->image)) |
206 | <img src="{{ asset('/images/default_ship.jpg') }}" alt="" class="news__item-pic"> | 221 | <img src="{{ asset('/images/default_ship.jpg') }}" alt="" class="news__item-pic"> |
207 | @else | 222 | @else |
208 | <img src="{{ asset(Storage::url($new->image)) }}" alt="" class="news__item-pic"> | 223 | <img src="{{ asset(Storage::url($new->image)) }}" alt="" class="news__item-pic"> |
209 | @endif | 224 | @endif |
210 | <div class="news__item-body"> | 225 | <div class="news__item-body"> |
211 | <time datetime="{{ date('d.m.Y H:i:s', strtotime($new->created_at)) }}" class="news__item-date">{{ date('d.m.Y H:i:s', strtotime($new->created_at)) }}</time> | 226 | <time datetime="{{ date('d.m.Y H:i:s', strtotime($new->created_at)) }}" class="news__item-date">{{ date('d.m.Y H:i:s', strtotime($new->created_at)) }}</time> |
212 | <span class="news__item-title">{{ $new->title }}</span> | 227 | <span class="news__item-title">{{ $new->title }}</span> |
213 | <span class="news__item-text">{!! mb_strimwidth($new->text, 0, 100) !!}</span> | 228 | <span class="news__item-text">{!! mb_strimwidth($new->text, 0, 100) !!}</span> |
214 | <a href="{{ route('detail_new', ['new' => $new->id]) }}" class="news__item-more button button_light">Читать далее</a> | 229 | <a href="{{ route('detail_new', ['new' => $new->id]) }}" class="news__item-more button button_light">Читать далее</a> |
215 | </div> | 230 | </div> |
216 | </div> | 231 | </div> |
217 | </div> | 232 | </div> |
218 | @endforeach | 233 | @endforeach |
219 | 234 | ||
220 | </div> | 235 | </div> |
221 | <div class="swiper-pagination"></div> | 236 | <div class="swiper-pagination"></div> |
222 | </div> | 237 | </div> |
223 | <a href="{{ route('news') }}" class="news__all button button_light">Все новости</a> | 238 | <a href="{{ route('news') }}" class="news__all button button_light">Все новости</a> |
224 | 239 | ||
225 | </div> | 240 | </div> |
226 | </section> | 241 | </section> |
227 | @endif | 242 | @endif |
228 | 243 | ||
229 | <section class="info"> | 244 | <section class="info"> |
230 | <div class="container"> | 245 | <div class="container"> |
231 | <img src="images/5.png" alt="" class="info__pic"> | 246 | <img src="images/5.png" alt="" class="info__pic"> |
232 | <div class="info__body"> | 247 | <div class="info__body"> |
233 | <div class="title info__title"><h4>Мы в социальных сетях</h4></div> | 248 | <div class="title info__title"><h4>Мы в социальных сетях</h4></div> |
234 | <div class="info__item"> | 249 | <div class="info__item"> |
235 | <div class="info__text">Телеграм — Подпишитесь на наш телеграм канал и получайте уведомления о | 250 | <div class="info__text">Телеграм — Подпишитесь на наш телеграм канал и получайте уведомления о |
236 | новых вакансиях прямо на свой смартфон</div> | 251 | новых вакансиях прямо на свой смартфон</div> |
237 | <a href="{{ $companies[0]->telegram }}" class="info__link" style="background:#20A0E1"> | 252 | <a href="{{ $companies[0]->telegram }}" class="info__link" style="background:#20A0E1"> |
238 | <svg> | 253 | <svg> |
239 | <use xlink:href="{{ asset('images/sprite.svg#tg') }}"></use> | 254 | <use xlink:href="{{ asset('images/sprite.svg#tg') }}"></use> |
240 | </svg> | 255 | </svg> |
241 | Телеграм | 256 | Телеграм |
242 | </a> | 257 | </a> |
243 | </div> | 258 | </div> |
244 | <div class="info__item"> | 259 | <div class="info__item"> |
245 | <div class="info__text">ВКонтакте — Лучшие вакансии за неделю выкладываем именно тут, информация | 260 | <div class="info__text">ВКонтакте — Лучшие вакансии за неделю выкладываем именно тут, информация |
246 | о судоходных компаниях, инструкции по работе с сайтом, конкурсы и многое другое</div> | 261 | о судоходных компаниях, инструкции по работе с сайтом, конкурсы и многое другое</div> |
247 | <a href="{{ $companies[0]->vkontact }}" class="info__link" style="background:#2787F5"> | 262 | <a href="{{ $companies[0]->vkontact }}" class="info__link" style="background:#2787F5"> |
248 | <svg> | 263 | <svg> |
249 | <use xlink:href="{{ asset('images/sprite.svg#vk') }}"></use> | 264 | <use xlink:href="{{ asset('images/sprite.svg#vk') }}"></use> |
250 | </svg> | 265 | </svg> |
251 | ВКонтакте | 266 | ВКонтакте |
252 | </a> | 267 | </a> |
253 | </div> | 268 | </div> |
254 | </div> | 269 | </div> |
255 | </div> | 270 | </div> |
256 | </section> | 271 | </section> |
257 | @endsection | 272 | @endsection |
258 | 273 |
resources/views/modals/send_worker_new.blade.php
1 | <script> | 1 | <script> |
2 | console.log('Сообщение работнику'); | 2 | console.log('Сообщение работнику'); |
3 | $("#form_worker" ).submit(function(event) { | 3 | $("#form_worker" ).submit(function(event) { |
4 | var val = $(this).val(); | 4 | var val = $(this).val(); |
5 | var send_title = $('#send_title'); | 5 | var send_title = $('#send_title'); |
6 | var send_title_val = send_title.val(); | 6 | var send_title_val = send_title.val(); |
7 | 7 | ||
8 | console.log('Click form.'); | 8 | console.log('Click form.'); |
9 | }); | 9 | }); |
10 | 10 | ||
11 | $(document).on('change', '#btn_send_file', function() { | 11 | $(document).on('change', '#btn_send_file', function() { |
12 | 12 | ||
13 | var send_name = $('#send_name'); | 13 | var send_name = $('#send_name'); |
14 | var send_name_val = send_name.val(); | 14 | var send_name_val = send_name.val(); |
15 | var send_name_file = $('#send_name_file'); | 15 | var send_name_file = $('#send_name_file'); |
16 | 16 | ||
17 | console.log(send_name_val); | 17 | console.log(send_name_val); |
18 | send_name_file.html(send_name_val); | 18 | send_name_file.html(send_name_val); |
19 | 19 | ||
20 | }); | 20 | }); |
21 | </script> | 21 | </script> |
22 | <div id="send" class="modal"> | 22 | <div id="send" class="modal"> |
23 | <div class="modal__body"> | 23 | <div class="modal__body"> |
24 | <div class="modal__title">Отправить сообщение работодателю</div> | 24 | <div class="modal__title">Отправить сообщение работодателю</div> |
25 | <div class="modal__text">Если вы готовы владеете компитентыми навыками, напишите данному работодателю письмо</div> | 25 | <div class="modal__text">Если вы готовы владеете компитентыми навыками, напишите данному работодателю письмо</div> |
26 | <form class="modal__form" id="form_worker" name="form_worker" enctype="multipart/form-data" action="{{ route('worker.new_message') }}" method="POST"> | 26 | <form class="modal__form" id="form_worker" name="form_worker" enctype="multipart/form-data" action="{{ route('worker.new_message') }}" method="POST"> |
27 | @csrf | 27 | @csrf |
28 | <div class="modal__form-item"> | 28 | <div class="modal__form-item"> |
29 | Отправитель сообщения: | 29 | Отправитель сообщения: |
30 | <input type="text" id="send_user_id" name="send_user_id" class="input" placeholder="user_id" value=""> | 30 | <input type="text" id="send_user_id" name="send_user_id" class="input" placeholder="user_id" value=""> |
31 | Получатель сообщения: | 31 | Получатель сообщения: |
32 | <input type="text" id="send_to_user_id" name="send_to_user_id" class="input" placeholder="to_user_id" value=""> | 32 | <input type="text" id="send_to_user_id" name="send_to_user_id" class="input" placeholder="to_user_id" value=""> |
33 | Вакансия: | 33 | Вакансия: |
34 | <input type="text" id="send_vacancy" name="send_vacancy" class="input" placeholder="vacancy" value=""> | 34 | <input type="text" id="send_vacancy" name="send_vacancy" class="input" placeholder="vacancy" value=""> |
35 | </div> | 35 | </div> |
36 | <div class="modal__form-item send_title_div error_"> | 36 | <div class="modal__form-item send_title_div error_"> |
37 | <input id="send_title" name="send_title" type="text" class="input" placeholder="Тема" required> | 37 | <input id="send_title" name="send_title" type="text" class="input" placeholder="Тема" required> |
38 | <label for="title">Не заполнено поле</label> | 38 | <label for="title">Не заполнено поле</label> |
39 | </div> | 39 | </div> |
40 | <div class="modal__form-item send_title_div error_"> | 40 | <!--<div class="modal__form-item send_title_div error_"> |
41 | <select class="js-select2" name="send_job_title_id" id="send_job_title_id"> | 41 | <select class="js-select2" name="send_job_title_id" id="send_job_title_id"> |
42 | @if ($jobs->count()) | 42 | if ($jobs->count()) |
43 | @foreach($jobs as $j) | 43 | foreach($jobs as $j) |
44 | <option value="{{ $j->id }}">{{ $j->name }} ({{ $j->id }})</option> | 44 | <option value=" $j->id }}"> $j->name }} ( $j->id }})</option> |
45 | @endforeach | 45 | endforeach |
46 | @endif | 46 | endif |
47 | </select> | 47 | </select> |
48 | <label for="title">Не заполнено поле</label> | 48 | <label for="title">Не заполнено поле</label> |
49 | </div> | 49 | </div>--> |
50 | <div class="modal__form-item send_text_div"> | 50 | <div class="modal__form-item send_text_div"> |
51 | <textarea id="i2" class="textarea" id="send_text" name="send_text" placeholder="Напишите текст с предложением о работе" required></textarea> | 51 | <textarea id="i2" class="textarea" id="send_text" name="send_text" placeholder="Напишите текст с предложением о работе" required></textarea> |
52 | <label for="i2">Не заполнено поле</label> | 52 | <label for="i2">Не заполнено поле</label> |
53 | </div> | 53 | </div> |
54 | <div class="modal__form-item"> | 54 | <div class="modal__form-item"> |
55 | <div class="file"> | 55 | <div class="file"> |
56 | <label class="file__input" id="btn_send_file" name="btn_send_file"> | 56 | <label class="file__input" id="btn_send_file" name="btn_send_file"> |
57 | <input type="file" name="send_file" id="send_name"> | 57 | <input type="file" name="send_file" id="send_name"> |
58 | <span class="button button_light"> | 58 | <span class="button button_light"> |
59 | <svg> | 59 | <svg> |
60 | <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use> | 60 | <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use> |
61 | </svg> | 61 | </svg> |
62 | Прикрепить файл-документ | 62 | Прикрепить файл-документ |
63 | </span> | 63 | </span> |
64 | </label> | 64 | </label> |
65 | 65 | ||
66 | <div class="file__list" id="div_file" name="div_file"> | 66 | <div class="file__list" id="div_file" name="div_file"> |
67 | <div class="file__list-item"> | 67 | <div class="file__list-item"> |
68 | <div class="file__list-item-left"> | 68 | <div class="file__list-item-left"> |
69 | <svg> | 69 | <svg> |
70 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | 70 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> |
71 | </svg> | 71 | </svg> |
72 | <span id="send_name_file" name="send_name_file"></span> | 72 | <span id="send_name_file" name="send_name_file"></span> |
73 | </div> | 73 | </div> |
74 | <button type="button" class="file__list-item-right js-parent-remove"> | 74 | <button type="button" class="file__list-item-right js-parent-remove"> |
75 | <svg> | 75 | <svg> |
76 | <use xlink:href="{{ asset('images/sprite.svg#cross-bold') }}"></use> | 76 | <use xlink:href="{{ asset('images/sprite.svg#cross-bold') }}"></use> |
77 | </svg> | 77 | </svg> |
78 | </button> | 78 | </button> |
79 | </div> | 79 | </div> |
80 | </div> | 80 | </div> |
81 | </div> | 81 | </div> |
82 | </div> | 82 | </div> |
83 | <div class="modal__form-item"> | 83 | <div class="modal__form-item"> |
84 | <button type="submit" id="submit_form_worker" name="submit_form_worker" class="button">Отправить</button> | 84 | <button type="submit" id="submit_form_worker" name="submit_form_worker" class="button">Отправить</button> |
85 | </div> | 85 | </div> |
86 | </form> | 86 | </form> |
87 | </div> | 87 | </div> |
88 | </div> | 88 | </div> |
89 | 89 | ||
90 | 90 |