Commit ef73d19b1156015385ed358ab1c568f74b7afe6f
1 parent
a1df95236a
Exists in
master
worker/amployer recreate resistrations
Showing 7 changed files with 157 additions and 216 deletions Inline Diff
app/Http/Controllers/EmployerController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Classes\Tools; | 6 | use App\Classes\Tools; |
7 | use App\Http\Requests\BaseUser_min_Request; | 7 | use App\Http\Requests\BaseUser_min_Request; |
8 | use App\Http\Requests\FlotRequest; | 8 | use App\Http\Requests\FlotRequest; |
9 | use App\Http\Requests\MessagesRequiest; | 9 | use App\Http\Requests\MessagesRequiest; |
10 | use App\Http\Requests\VacancyRequestEdit; | 10 | use App\Http\Requests\VacancyRequestEdit; |
11 | use App\Mail\MailCreateEmployer; | 11 | use App\Mail\MailCreateEmployer; |
12 | use App\Mail\MailSotrudnichestvo; | 12 | use App\Mail\MailSotrudnichestvo; |
13 | use App\Mail\MassSendingMessages; | 13 | use App\Mail\MassSendingMessages; |
14 | use App\Mail\SendAllMessages; | 14 | use App\Mail\SendAllMessages; |
15 | use App\Models\Ad_employer; | 15 | use App\Models\Ad_employer; |
16 | use App\Models\ad_response; | 16 | use App\Models\ad_response; |
17 | use App\Models\Category; | 17 | use App\Models\Category; |
18 | use App\Models\Chat; | 18 | use App\Models\Chat; |
19 | use App\Models\Employer; | 19 | use App\Models\Employer; |
20 | use App\Models\EmployerAutoliftOption; | 20 | use App\Models\EmployerAutoliftOption; |
21 | use App\Models\Flot; | 21 | use App\Models\Flot; |
22 | use App\Models\Job_title; | 22 | use App\Models\Job_title; |
23 | use App\Models\Like_worker; | 23 | use App\Models\Like_worker; |
24 | use App\Models\Message; | 24 | use App\Models\Message; |
25 | use App\Models\Worker; | 25 | use App\Models\Worker; |
26 | use App\Models\MessagesRequests; | 26 | use App\Models\MessagesRequests; |
27 | use Carbon\Carbon; | 27 | use Carbon\Carbon; |
28 | use Illuminate\Auth\Events\Registered; | 28 | use Illuminate\Auth\Events\Registered; |
29 | use Illuminate\Database\Eloquent\Builder; | 29 | use Illuminate\Database\Eloquent\Builder; |
30 | use Illuminate\Http\RedirectResponse; | 30 | use Illuminate\Http\RedirectResponse; |
31 | use Illuminate\Http\Request; | 31 | use Illuminate\Http\Request; |
32 | use Illuminate\Support\Facades\Auth; | 32 | use Illuminate\Support\Facades\Auth; |
33 | use Illuminate\Support\Facades\Cache; | 33 | use Illuminate\Support\Facades\Cache; |
34 | use Illuminate\Support\Facades\Hash; | 34 | use Illuminate\Support\Facades\Hash; |
35 | use Illuminate\Support\Facades\Log; | 35 | use Illuminate\Support\Facades\Log; |
36 | use Illuminate\Support\Facades\Mail; | 36 | use Illuminate\Support\Facades\Mail; |
37 | use Illuminate\Support\Facades\Storage; | 37 | use Illuminate\Support\Facades\Storage; |
38 | use App\Models\User as User_Model; | 38 | use App\Models\User as User_Model; |
39 | use Illuminate\Support\Facades\Validator; | 39 | use Illuminate\Support\Facades\Validator; |
40 | use App\Enums\DbExportColumns; | 40 | use App\Enums\DbExportColumns; |
41 | use Illuminate\View\View; | 41 | use Illuminate\View\View; |
42 | use JsonException; | 42 | use JsonException; |
43 | use Throwable; | 43 | use Throwable; |
44 | 44 | ||
45 | class EmployerController extends Controller | 45 | class EmployerController extends Controller |
46 | { | 46 | { |
47 | public function vacancie($vacancy, Request $request) { | 47 | public function vacancie($vacancy, Request $request) { |
48 | $title = 'Заголовок вакансии'; | 48 | $title = 'Заголовок вакансии'; |
49 | $Query = Ad_employer::with('jobs')-> | 49 | $Query = Ad_employer::with('jobs')-> |
50 | with('cat')-> | 50 | with('cat')-> |
51 | with('employer')-> | 51 | with('employer')-> |
52 | with('jobs_code')-> | 52 | with('jobs_code')-> |
53 | select('ad_employers.*')-> | 53 | select('ad_employers.*')-> |
54 | where('id', '=', $vacancy)->get(); | 54 | where('id', '=', $vacancy)->get(); |
55 | 55 | ||
56 | if ($Query[0]->active_is===0 || $Query[0]->is_remove!=0){ | 56 | if ($Query[0]->active_is===0 || $Query[0]->is_remove!=0){ |
57 | 57 | ||
58 | abort(404); | 58 | abort(404); |
59 | 59 | ||
60 | } | 60 | } |
61 | 61 | ||
62 | if (isset(Auth()->user()->id)) | 62 | if (isset(Auth()->user()->id)) |
63 | $uid = Auth()->user()->id; | 63 | $uid = Auth()->user()->id; |
64 | else | 64 | else |
65 | $uid = 0; | 65 | $uid = 0; |
66 | $title = $Query[0]->name; | 66 | $title = $Query[0]->name; |
67 | if ($request->ajax()) { | 67 | if ($request->ajax()) { |
68 | return view('ajax.vacance-item', compact('Query','uid')); | 68 | return view('ajax.vacance-item', compact('Query','uid')); |
69 | } else { | 69 | } else { |
70 | return view('vacance-item', compact('title', 'Query', 'uid')); | 70 | return view('vacance-item', compact('title', 'Query', 'uid')); |
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
74 | public function logout() { | 74 | public function logout() { |
75 | Auth::logout(); | 75 | Auth::logout(); |
76 | return redirect()->route('index') | 76 | return redirect()->route('index') |
77 | ->with('success', 'Вы вышли из личного кабинета'); | 77 | ->with('success', 'Вы вышли из личного кабинета'); |
78 | } | 78 | } |
79 | 79 | ||
80 | public function employer_info() { | 80 | public function employer_info() { |
81 | // код юзера | 81 | // код юзера |
82 | $user_info = Auth()->user(); | 82 | $user_info = Auth()->user(); |
83 | // вьюшка для вывода данных | 83 | // вьюшка для вывода данных |
84 | return view('employers.info', compact('user_info')); | 84 | return view('employers.info', compact('user_info')); |
85 | } | 85 | } |
86 | 86 | ||
87 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { | 87 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { |
88 | // Все данные через реквест | 88 | // Все данные через реквест |
89 | $all = $request->all(); | 89 | $all = $request->all(); |
90 | unset($all['_token']); | 90 | unset($all['_token']); |
91 | // обновление | 91 | // обновление |
92 | $user->update($all); | 92 | $user->update($all); |
93 | return redirect()->route('employer.employer_info'); | 93 | return redirect()->route('employer.employer_info'); |
94 | } | 94 | } |
95 | 95 | ||
96 | public function cabinet() { | 96 | public function cabinet() { |
97 | $id = Auth()->user()->id; | 97 | $id = Auth()->user()->id; |
98 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 98 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
99 | WhereHas('users', | 99 | WhereHas('users', |
100 | function (Builder $query) use ($id) {$query->Where('id', $id); | 100 | function (Builder $query) use ($id) {$query->Where('id', $id); |
101 | })->get(); | 101 | })->get(); |
102 | return view('employers.cabinet45', compact('Employer')); | 102 | return view('employers.cabinet45', compact('Employer')); |
103 | } | 103 | } |
104 | 104 | ||
105 | public function slider_flot() { | 105 | public function slider_flot() { |
106 | $id = Auth()->user()->id; | 106 | $id = Auth()->user()->id; |
107 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 107 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
108 | WhereHas('users', | 108 | WhereHas('users', |
109 | function (Builder $query) use ($id) {$query->Where('id', $id); | 109 | function (Builder $query) use ($id) {$query->Where('id', $id); |
110 | })->get(); | 110 | })->get(); |
111 | return view('employers.fly-flot', compact('Employer')); | 111 | return view('employers.fly-flot', compact('Employer')); |
112 | } | 112 | } |
113 | 113 | ||
114 | public function cabinet_save(Employer $Employer, Request $request) { | 114 | public function cabinet_save(Employer $Employer, Request $request) { |
115 | $params = $request->all(); | 115 | $params = $request->all(); |
116 | $params['user_id'] = Auth()->user()->id; | 116 | $params['user_id'] = Auth()->user()->id; |
117 | $id = $Employer->id; | 117 | $id = $Employer->id; |
118 | 118 | ||
119 | if ($request->has('logo')) { | 119 | if ($request->has('logo')) { |
120 | if (!empty($Employer->logo)) { | 120 | if (!empty($Employer->logo)) { |
121 | Storage::delete($Employer->logo); | 121 | Storage::delete($Employer->logo); |
122 | } | 122 | } |
123 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); | 123 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); |
124 | } | 124 | } |
125 | 125 | ||
126 | $Employer->update($params); | 126 | $Employer->update($params); |
127 | 127 | ||
128 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); | 128 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); |
129 | } | 129 | } |
130 | 130 | ||
131 | public function save_add_flot(FlotRequest $request) { | 131 | public function save_add_flot(FlotRequest $request) { |
132 | // отмена | 132 | // отмена |
133 | $params = $request->all(); | 133 | $params = $request->all(); |
134 | 134 | ||
135 | if ($request->has('image')) { | 135 | if ($request->has('image')) { |
136 | $params['image'] = $request->file('image')->store("flot", 'public'); | 136 | $params['image'] = $request->file('image')->store("flot", 'public'); |
137 | } | 137 | } |
138 | Flot::create($params); | 138 | Flot::create($params); |
139 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); | 139 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); |
140 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 140 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
141 | } | 141 | } |
142 | 142 | ||
143 | public function edit_flot(Flot $Flot, Employer $Employer) { | 143 | public function edit_flot(Flot $Flot, Employer $Employer) { |
144 | return view('employers.edit-flot', compact('Flot', 'Employer')); | 144 | return view('employers.edit-flot', compact('Flot', 'Employer')); |
145 | } | 145 | } |
146 | 146 | ||
147 | public function update_flot(FlotRequest $request, Flot $Flot) { | 147 | public function update_flot(FlotRequest $request, Flot $Flot) { |
148 | $params = $request->all(); | 148 | $params = $request->all(); |
149 | 149 | ||
150 | if ($request->has('image')) { | 150 | if ($request->has('image')) { |
151 | if (!empty($flot->image)) { | 151 | if (!empty($flot->image)) { |
152 | Storage::delete($flot->image); | 152 | Storage::delete($flot->image); |
153 | } | 153 | } |
154 | $params['image'] = $request->file('image')->store("flot", 'public'); | 154 | $params['image'] = $request->file('image')->store("flot", 'public'); |
155 | } else { | 155 | } else { |
156 | if (!empty($flot->image)) $params['image'] = $flot->image; | 156 | if (!empty($flot->image)) $params['image'] = $flot->image; |
157 | } | 157 | } |
158 | 158 | ||
159 | $Flot->update($params); | 159 | $Flot->update($params); |
160 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 160 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
161 | } | 161 | } |
162 | 162 | ||
163 | public function delete_flot(Flot $Flot) { | 163 | public function delete_flot(Flot $Flot) { |
164 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); | 164 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); |
165 | 165 | ||
166 | if (isset($Flot->id)) $Flot->delete(); | 166 | if (isset($Flot->id)) $Flot->delete(); |
167 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); | 167 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); |
168 | } | 168 | } |
169 | 169 | ||
170 | // Форма добавления вакансий | 170 | // Форма добавления вакансий |
171 | public function cabinet_vacancie() { | 171 | public function cabinet_vacancie() { |
172 | /** @var User_Model $user */ | 172 | /** @var User_Model $user */ |
173 | $user = Auth()->user(); | 173 | $user = Auth()->user(); |
174 | 174 | ||
175 | if ($user->is_public) { | 175 | if ($user->is_public) { |
176 | $categories = Category::query()->active()->get(); | 176 | $categories = Category::query()->active()->get(); |
177 | 177 | ||
178 | $jobs = Job_title::query() | 178 | $jobs = Job_title::query() |
179 | ->orderByDesc('sort') | 179 | ->orderByDesc('sort') |
180 | ->OrderBy('name') | 180 | ->OrderBy('name') |
181 | ->where('is_remove', '=', '0') | 181 | ->where('is_remove', '=', '0') |
182 | ->where('is_bd', '=', '0') | 182 | ->where('is_bd', '=', '0') |
183 | ->get(); | 183 | ->get(); |
184 | 184 | ||
185 | $Employer = Employer::query() | 185 | $Employer = Employer::query() |
186 | ->with(['users', 'ads', 'flots']) | 186 | ->with(['users', 'ads', 'flots']) |
187 | ->whereHas('users', fn (Builder $query) => $query->where('id', $user->id)) | 187 | ->whereHas('users', fn (Builder $query) => $query->where('id', $user->id)) |
188 | ->get(); | 188 | ->get(); |
189 | 189 | ||
190 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); | 190 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); |
191 | } | 191 | } |
192 | 192 | ||
193 | return redirect()->route('employer.cabinet_vacancie_danger'); | 193 | return redirect()->route('employer.cabinet_vacancie_danger'); |
194 | } | 194 | } |
195 | 195 | ||
196 | // Форма предупреждения об оплате | 196 | // Форма предупреждения об оплате |
197 | public function cabinet_vacancie_danger() { | 197 | public function cabinet_vacancie_danger() { |
198 | return view('employers.add_vacancy_danger'); | 198 | return view('employers.add_vacancy_danger'); |
199 | } | 199 | } |
200 | 200 | ||
201 | // Сохранение вакансии | 201 | // Сохранение вакансии |
202 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { | 202 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { |
203 | $params_emp = $request->all(); | 203 | $params_emp = $request->all(); |
204 | 204 | ||
205 | $params_job["job_title_id"] = $params_emp['job_title_id']; | 205 | $params_job["job_title_id"] = $params_emp['job_title_id']; |
206 | 206 | ||
207 | $ad_jobs = Ad_employer::create($params_emp); | 207 | $ad_jobs = Ad_employer::create($params_emp); |
208 | $ad_jobs->jobs()->sync($request->get('job_title_id')); | 208 | $ad_jobs->jobs()->sync($request->get('job_title_id')); |
209 | 209 | ||
210 | return redirect()->route('employer.vacancy_list')->with('success', 'Вакансия успешно опубликована'); | 210 | return redirect()->route('employer.vacancy_list')->with('success', 'Вакансия успешно опубликована'); |
211 | } | 211 | } |
212 | 212 | ||
213 | // Список вакансий | 213 | // Список вакансий |
214 | public function vacancy_list(Request $request) { | 214 | public function vacancy_list(Request $request) { |
215 | $id = Auth()->user()->id; | 215 | $id = Auth()->user()->id; |
216 | 216 | ||
217 | $Employer = Employer::query()->where('user_id', $id)->first(); | 217 | $Employer = Employer::query()->where('user_id', $id)->first(); |
218 | $vacancy_list = Ad_employer::query() | 218 | $vacancy_list = Ad_employer::query() |
219 | ->with('jobs') | 219 | ->with('jobs') |
220 | ->with('jobs_code') | 220 | ->with('jobs_code') |
221 | ->where('employer_id', $Employer->id) | 221 | ->where('employer_id', $Employer->id) |
222 | ->where('is_remove', 0) | 222 | ->where('is_remove', 0) |
223 | ->orderbyDesc('updated_at') | 223 | ->orderbyDesc('updated_at') |
224 | ; | 224 | ; |
225 | 225 | ||
226 | if (($request->has('search')) && (!empty($request->get('search')))) { | 226 | if (($request->has('search')) && (!empty($request->get('search')))) { |
227 | $search = $request->get('search'); | 227 | $search = $request->get('search'); |
228 | $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); | 228 | $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); |
229 | } | 229 | } |
230 | 230 | ||
231 | if ($request->get('sort')) { | 231 | if ($request->get('sort')) { |
232 | $sort = $request->get('sort'); | 232 | $sort = $request->get('sort'); |
233 | switch ($sort) { | 233 | switch ($sort) { |
234 | case 'nopublic': $vacancy_list->orderByDesc('updated_at') | 234 | case 'nopublic': $vacancy_list->orderByDesc('updated_at') |
235 | ->where('active_is', 0); | 235 | ->where('active_is', 0); |
236 | break; | 236 | break; |
237 | case 'public': $vacancy_list->orderByDesc('updated_at') | 237 | case 'public': $vacancy_list->orderByDesc('updated_at') |
238 | ->where('active_is',1); | 238 | ->where('active_is',1); |
239 | break; | 239 | break; |
240 | default: $vacancy_list->orderByDesc('updated_at'); | 240 | default: $vacancy_list->orderByDesc('updated_at'); |
241 | break; | 241 | break; |
242 | } | 242 | } |
243 | } else { | 243 | } else { |
244 | $vacancy_list = $vacancy_list->orderByDesc('updated_at')->orderBy('id'); | 244 | $vacancy_list = $vacancy_list->orderByDesc('updated_at')->orderBy('id'); |
245 | } | 245 | } |
246 | 246 | ||
247 | $vacancy_list = $vacancy_list->paginate(10); | 247 | $vacancy_list = $vacancy_list->paginate(10); |
248 | 248 | ||
249 | if ($request->ajax()) { | 249 | if ($request->ajax()) { |
250 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); | 250 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); |
251 | } else { | 251 | } else { |
252 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); | 252 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); |
253 | } | 253 | } |
254 | } | 254 | } |
255 | 255 | ||
256 | // Карточка вакансии | 256 | // Карточка вакансии |
257 | public function vacancy_edit(Ad_employer $ad_employer) { | 257 | public function vacancy_edit(Ad_employer $ad_employer) { |
258 | $id = Auth()->user()->id; | 258 | $id = Auth()->user()->id; |
259 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); | 259 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); |
260 | 260 | ||
261 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | 261 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
262 | where('is_remove', '=', '0')-> | 262 | where('is_remove', '=', '0')-> |
263 | where('is_bd', '=', '0')->get(); | 263 | where('is_bd', '=', '0')->get(); |
264 | 264 | ||
265 | $Employer = Employer::query()->with('users')->with('ads')-> | 265 | $Employer = Employer::query()->with('users')->with('ads')-> |
266 | with('flots')->where('user_id', $id)->first(); | 266 | with('flots')->where('user_id', $id)->first(); |
267 | 267 | ||
268 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); | 268 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); |
269 | } | 269 | } |
270 | 270 | ||
271 | // Сохранение-редактирование записи | 271 | // Сохранение-редактирование записи |
272 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { | 272 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { |
273 | $params = $request->all(); | 273 | $params = $request->all(); |
274 | 274 | ||
275 | $ad_employer->update($params); | 275 | $ad_employer->update($params); |
276 | $ad_employer->active_is = 1; | 276 | $ad_employer->active_is = 1; |
277 | $ad_employer->save(); | 277 | $ad_employer->save(); |
278 | $ad_employer->jobs()->sync($request->get('job_title_id')); | 278 | $ad_employer->jobs()->sync($request->get('job_title_id')); |
279 | 279 | ||
280 | $id = Auth()->user()->id; | 280 | $id = Auth()->user()->id; |
281 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); | 281 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); |
282 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name') | 282 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name') |
283 | ->where('is_remove', '=', '0') | 283 | ->where('is_remove', '=', '0') |
284 | ->where('is_bd', '=', '0') | 284 | ->where('is_bd', '=', '0') |
285 | ->get(); | 285 | ->get(); |
286 | 286 | ||
287 | $Employer = Employer::query() | 287 | $Employer = Employer::query() |
288 | ->with('users')->with('ads')->with('flots')->where('user_id', $id)->first(); | 288 | ->with('users')->with('ads')->with('flots')->where('user_id', $id)->first(); |
289 | 289 | ||
290 | return redirect()->route('employer.vacancy_list')->with('success', 'Вакансия успешно отредактирована'); | 290 | return redirect()->route('employer.vacancy_list')->with('success', 'Вакансия успешно отредактирована'); |
291 | } | 291 | } |
292 | 292 | ||
293 | // Сохранение карточки вакансии | 293 | // Сохранение карточки вакансии |
294 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { | 294 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { |
295 | $all = $request->all(); | 295 | $all = $request->all(); |
296 | $ad_employer->update($all); | 296 | $ad_employer->update($all); |
297 | return redirect()->route('employer.cabinet_vacancie'); | 297 | return redirect()->route('employer.cabinet_vacancie'); |
298 | } | 298 | } |
299 | 299 | ||
300 | // Удаление карточки вакансии | 300 | // Удаление карточки вакансии |
301 | public function vacancy_delete(Ad_employer $ad_employer) { | 301 | public function vacancy_delete(Ad_employer $ad_employer) { |
302 | $ad_employer->delete(); | 302 | $ad_employer->delete(); |
303 | 303 | ||
304 | return redirect()->route('employer.vacancy_list') | 304 | return redirect()->route('employer.vacancy_list') |
305 | ->with('success', 'Вакансия удалена'); | 305 | ->with('success', 'Вакансия удалена'); |
306 | } | 306 | } |
307 | 307 | ||
308 | // Обновление даты | 308 | // Обновление даты |
309 | public function vacancy_up(Ad_employer $ad_employer) { | 309 | public function vacancy_up(Ad_employer $ad_employer) { |
310 | $up = date('m/d/Y h:i:s', time()); | 310 | $up = date('m/d/Y h:i:s', time()); |
311 | $ad_employer->updated_at = $up; | 311 | $ad_employer->updated_at = $up; |
312 | $ad_employer->save(); | 312 | $ad_employer->save(); |
313 | 313 | ||
314 | return redirect()->route('employer.vacancy_list') | 314 | return redirect()->route('employer.vacancy_list') |
315 | ->with('success', 'Вакансия поднята'); | 315 | ->with('success', 'Вакансия поднята'); |
316 | } | 316 | } |
317 | 317 | ||
318 | //Видимость вакансии | 318 | //Видимость вакансии |
319 | public function vacancy_eye(Ad_employer $ad_employer, $status) { | 319 | public function vacancy_eye(Ad_employer $ad_employer, $status) { |
320 | $statusMessages = [ | 320 | $statusMessages = [ |
321 | 'Вакансия скрыта', | 321 | 'Вакансия скрыта', |
322 | 'Вакансия видна работникам' | 322 | 'Вакансия видна работникам' |
323 | ]; | 323 | ]; |
324 | 324 | ||
325 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 325 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
326 | $vac_emp->active_is = $status; | 326 | $vac_emp->active_is = $status; |
327 | $vac_emp->save(); | 327 | $vac_emp->save(); |
328 | 328 | ||
329 | return redirect()->route('employer.vacancy_list') | 329 | return redirect()->route('employer.vacancy_list') |
330 | ->with('success', $statusMessages[$status]); | 330 | ->with('success', $statusMessages[$status]); |
331 | } | 331 | } |
332 | 332 | ||
333 | //Вакансия редактирования (шаблон) | 333 | //Вакансия редактирования (шаблон) |
334 | public function vacancy_update(Ad_employer $id) { | 334 | public function vacancy_update(Ad_employer $id) { |
335 | 335 | ||
336 | } | 336 | } |
337 | 337 | ||
338 | //Отклики на вакансию - лист | 338 | //Отклики на вакансию - лист |
339 | public function answers(Employer $employer, Request $request) { | 339 | public function answers(Employer $employer, Request $request) { |
340 | $user_id = Auth()->user()->id; | 340 | $user_id = Auth()->user()->id; |
341 | $answer = Ad_employer::query()->where('employer_id', $employer->id); | 341 | $answer = Ad_employer::query()->where('employer_id', $employer->id); |
342 | if ($request->has('search')) { | 342 | if ($request->has('search')) { |
343 | $search = trim($request->get('search')); | 343 | $search = trim($request->get('search')); |
344 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); | 344 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); |
345 | } | 345 | } |
346 | 346 | ||
347 | $answer = $answer->with('response')->OrderByDESC('id')->get(); | 347 | $answer = $answer->with('response')->OrderByDESC('id')->get(); |
348 | 348 | ||
349 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); | 349 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); |
350 | } | 350 | } |
351 | 351 | ||
352 | //Обновление статуса | 352 | //Обновление статуса |
353 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { | 353 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { |
354 | $ad_response->update(Array('flag' => $flag)); | 354 | $ad_response->update(Array('flag' => $flag)); |
355 | return redirect()->route('employer.answers', ['employer' => $employer->id]); | 355 | return redirect()->route('employer.answers', ['employer' => $employer->id]); |
356 | } | 356 | } |
357 | 357 | ||
358 | //Страницы сообщений список | 358 | //Страницы сообщений список |
359 | public function messages($type_message) { | 359 | public function messages($type_message) { |
360 | $user_id = Auth()->user()->id; | 360 | $user_id = Auth()->user()->id; |
361 | $superAdmin =User_Model::superAdmin(); | 361 | $superAdmin =User_Model::superAdmin(); |
362 | $chats = Chat::get_user_chats($user_id); | 362 | $chats = Chat::get_user_chats($user_id); |
363 | $admin_chat = Chat::get_user_admin_chat($user_id); | 363 | $admin_chat = Chat::get_user_admin_chat($user_id); |
364 | $user_type = 'employer'; | 364 | $user_type = 'employer'; |
365 | 365 | ||
366 | return view('employers.messages', compact('chats', 'admin_chat', 'user_id', 'user_type','superAdmin')); | 366 | return view('employers.messages', compact('chats', 'admin_chat', 'user_id', 'user_type','superAdmin')); |
367 | } | 367 | } |
368 | 368 | ||
369 | // Диалог между пользователями | 369 | // Диалог между пользователями |
370 | public function dialog(Chat $chat, Request $request) { | 370 | public function dialog(Chat $chat, Request $request) { |
371 | // Получение параметров. | 371 | // Получение параметров. |
372 | if ($request->has('ad_employer')){ | 372 | if ($request->has('ad_employer')){ |
373 | $ad_employer = $request->get('ad_employer'); | 373 | $ad_employer = $request->get('ad_employer'); |
374 | } else { | 374 | } else { |
375 | $ad_employer = 0; | 375 | $ad_employer = 0; |
376 | } | 376 | } |
377 | $superAdmin =User_Model::superAdmin(); | 377 | $superAdmin =User_Model::superAdmin(); |
378 | 378 | ||
379 | $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first(); | 379 | $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first(); |
380 | $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first(); | 380 | $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first(); |
381 | 381 | ||
382 | $Messages = Chat::get_chat_messages($chat); | 382 | $Messages = Chat::get_chat_messages($chat); |
383 | 383 | ||
384 | Message::where('user_id', '=', $chat->to_user_id)->where('to_user_id', '=', $chat->user_id)->update(['flag_new' => 0]); | 384 | Message::where('user_id', '=', $chat->to_user_id)->where('to_user_id', '=', $chat->user_id)->update(['flag_new' => 0]); |
385 | 385 | ||
386 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages','chat','superAdmin')); | 386 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages','chat','superAdmin')); |
387 | } | 387 | } |
388 | 388 | ||
389 | public function pin_chat(Request $request){ | 389 | public function pin_chat(Request $request){ |
390 | $chat_id = $request->get('id'); | 390 | $chat_id = $request->get('id'); |
391 | $is_fixed = $request->get('is_fixed'); | 391 | $is_fixed = $request->get('is_fixed'); |
392 | 392 | ||
393 | $chat = Chat::pin_chat($chat_id, $is_fixed); | 393 | $chat = Chat::pin_chat($chat_id, $is_fixed); |
394 | $message = $chat->is_fixed ? 'Сообщение закреплено' : 'Сообщение откреплено'; | 394 | $message = $chat->is_fixed ? 'Сообщение закреплено' : 'Сообщение откреплено'; |
395 | return redirect()->back()->with('success', $message); | 395 | return redirect()->back()->with('success', $message); |
396 | } | 396 | } |
397 | 397 | ||
398 | public function remove_chat(Request $request){ | 398 | public function remove_chat(Request $request){ |
399 | $chat_id = $request->get('id'); | 399 | $chat_id = $request->get('id'); |
400 | Chat::remove_chat($chat_id); | 400 | Chat::remove_chat($chat_id); |
401 | } | 401 | } |
402 | 402 | ||
403 | // Регистрация работодателя | 403 | // Регистрация работодателя |
404 | public function register_employer(Request $request) { | 404 | public function register_employer(Request $request) |
405 | $params = $request->all(); | 405 | { |
406 | |||
407 | $rules = [ | 406 | $rules = [ |
408 | //'surname' => ['required', 'string', 'max:255'], | 407 | 'surname' => ['nullable', 'string', 'max:255'], |
409 | //'name_man' => ['required', 'string', 'max:255'], | 408 | 'name_man' => ['nullable', 'string', 'max:255'], |
410 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], | 409 | 'email' => ['required', 'email', 'max:255', 'unique:users'], |
411 | 'name_company' => ['required', 'string', 'max:255'], | 410 | 'name_company' => ['required', 'string', 'max:255'], |
412 | 'password' => ['required', 'string', 'min:6'], | 411 | 'password' => ['required', 'string', 'min:6'], |
412 | 'password_confirmation' => ['required', 'same:password'], | ||
413 | 'politik' => ['required', 'accepted'], | ||
413 | ]; | 414 | ]; |
414 | 415 | ||
415 | $messages = [ | 416 | $messages = [ |
416 | 'required' => 'Укажите обязательное поле', | 417 | 'required' => 'Укажите обязательное поле', |
418 | 'email' => 'Введите корректный email', | ||
419 | 'unique' => 'Email уже зарегистрирован', | ||
420 | 'same' => 'Пароль и подтверждение пароля не совпадают', | ||
417 | 'min' => [ | 421 | 'min' => [ |
418 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 422 | 'string' => 'Поле должно быть не менее :min символов', |
419 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | ||
420 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | ||
421 | ], | 423 | ], |
422 | 'max' => [ | 424 | 'max' => [ |
423 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 425 | 'string' => 'Поле должно быть не более :max символов', |
424 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 426 | ], |
425 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 427 | 'accepted' => 'Необходимо согласиться с политикой конфиденциальности', |
426 | ] | ||
427 | ]; | 428 | ]; |
428 | 429 | ||
429 | $email = $request->get('email'); | 430 | $validator = Validator::make($request->all(), $rules, $messages); |
430 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | ||
431 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | ||
432 | } | ||
433 | 431 | ||
434 | if ($request->get('password') !== $request->get('confirmed')){ | 432 | if ($validator->fails()) { |
435 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | 433 | return response()->json(['ERRORS' => $validator->errors()], 422); |
436 | } | 434 | } |
437 | 435 | ||
438 | if (strlen($request->get('password')) < 6) { | 436 | $params = $request->all(); |
439 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | ||
440 | } | ||
441 | 437 | ||
442 | if (empty($request->get('surname'))) { | 438 | if (empty($params['surname'])) { |
443 | $params['surname'] = 'Неизвестно'; | 439 | $params['surname'] = 'Неизвестно'; |
444 | } | 440 | } |
445 | if (empty($request->get('name_man'))) { | 441 | if (empty($params['name_man'])) { |
446 | $params['name_man'] = 'Неизвестно'; | 442 | $params['name_man'] = 'Неизвестно'; |
447 | } | 443 | } |
448 | $validator = Validator::make($params, $rules, $messages); | ||
449 | 444 | ||
450 | if ($validator->fails()) { | 445 | if ($user = $this->create($params)) { |
451 | return json_encode(Array("ERROR" => "Error: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | ||
452 | } else { | ||
453 | $user = $this->create($params); | ||
454 | event(new Registered($user)); | 446 | event(new Registered($user)); |
455 | 447 | ||
456 | try { | 448 | try { |
457 | Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params)); | 449 | Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params)); |
458 | } catch (Throwable $e) { | 450 | } catch (Throwable $e) { |
459 | Log::error($e); | 451 | Log::error('Ошибка при отправке письма: ' . $e->getMessage()); |
460 | } | 452 | } |
461 | 453 | ||
462 | Auth::guard()->login($user); | 454 | Auth::guard()->login($user); |
463 | } | ||
464 | 455 | ||
465 | if ($user) { | 456 | return response()->json([ |
466 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; | 457 | 'REDIRECT' => route('employer.cabinet'), |
467 | } else { | 458 | ]); |
468 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | ||
469 | } | 459 | } |
460 | |||
461 | return response()->json([ | ||
462 | 'ERROR' => 'Произошла ошибка при регистрации. Попробуйте снова.', | ||
463 | ]); | ||
470 | } | 464 | } |
471 | 465 | ||
472 | // Создание пользователя | 466 | // Создание пользователя |
473 | protected function create(array $data) | 467 | protected function create(array $data) |
474 | { | 468 | { |
475 | $Use = new User_Model(); | 469 | $Use = new User_Model(); |
476 | $Code_user = $Use->create([ | 470 | $Code_user = $Use->create([ |
477 | 'name' => $data['surname']." ".$data['name_man'], | 471 | 'name' => $data['surname']." ".$data['name_man'], |
478 | 'name_man' => $data['name_man'], | 472 | 'name_man' => $data['name_man'], |
479 | 'surname' => $data['surname'], | 473 | 'surname' => $data['surname'], |
480 | 'surname2' => $data['surname2'], | 474 | 'surname2' => $data['surname2'], |
481 | 'subscribe_email' => $data['email'], | 475 | 'subscribe_email' => $data['email'], |
482 | 'email' => $data['email'], | 476 | 'email' => $data['email'], |
483 | 'telephone' => $data['telephone'], | 477 | 'telephone' => $data['telephone'], |
484 | 'is_worker' => 0, | 478 | 'is_worker' => 0, |
485 | 'password' => Hash::make($data['password']), | 479 | 'password' => Hash::make($data['password']), |
486 | 'pubpassword' => base64_encode($data['password']), | 480 | 'pubpassword' => base64_encode($data['password']), |
487 | 'email_verified_at' => Carbon::now() | 481 | 'email_verified_at' => Carbon::now() |
488 | ]); | 482 | ]); |
489 | 483 | ||
490 | if ($Code_user->id > 0) { | 484 | if ($Code_user->id > 0) { |
491 | $Employer = new Employer(); | 485 | $Employer = new Employer(); |
492 | $Employer->user_id = $Code_user->id; | 486 | $Employer->user_id = $Code_user->id; |
493 | $Employer->name_company = $data['name_company']; | 487 | $Employer->name_company = $data['name_company']; |
494 | $Employer->email = $data['email']; | 488 | $Employer->email = $data['email']; |
495 | $Employer->telephone = $data['telephone']; | 489 | $Employer->telephone = $data['telephone']; |
496 | $Employer->code = Tools::generator_id(10); | 490 | $Employer->code = Tools::generator_id(10); |
497 | $Employer->save(); | 491 | $Employer->save(); |
498 | 492 | ||
499 | return $Code_user; | 493 | return $Code_user; |
500 | } | 494 | } |
501 | } | 495 | } |
502 | 496 | ||
503 | // Отправка сообщения от работодателя | 497 | // Отправка сообщения от работодателя |
504 | public function send_message(MessagesRequiest $request) { | 498 | public function send_message(MessagesRequiest $request) { |
505 | $params = $request->all(); | 499 | $params = $request->all(); |
506 | 500 | ||
507 | $user1 = $params['user_id']; | 501 | $user1 = $params['user_id']; |
508 | $user2 = $params['to_user_id']; | 502 | $user2 = $params['to_user_id']; |
509 | 503 | ||
510 | if ($request->has('file')) { | 504 | if ($request->has('file')) { |
511 | $params['file'] = $request->file('file')->store("messages", 'public'); | 505 | $params['file'] = $request->file('file')->store("messages", 'public'); |
512 | } | 506 | } |
513 | Message::create($params); | 507 | Message::create($params); |
514 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 508 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
515 | } | 509 | } |
516 | 510 | ||
517 | public function test123(Request $request) { | 511 | public function test123(Request $request) { |
518 | $params = $request->all(); | 512 | $params = $request->all(); |
519 | $user1 = $params['user_id']; | 513 | $user1 = $params['user_id']; |
520 | $user2 = $params['to_user_id']; | 514 | $user2 = $params['to_user_id']; |
521 | 515 | ||
522 | $rules = [ | 516 | $rules = [ |
523 | 'text' => 'nullable|required_without:file|min:1|max:150000', | 517 | 'text' => 'nullable|required_without:file|min:1|max:150000', |
524 | 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' | 518 | 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' |
525 | ]; | 519 | ]; |
526 | $messages = [ | 520 | $messages = [ |
527 | 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', | 521 | 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', |
528 | 'min' => [ | 522 | 'min' => [ |
529 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 523 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
530 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 524 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
531 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 525 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
532 | ], | 526 | ], |
533 | 'max' => [ | 527 | 'max' => [ |
534 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 528 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
535 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 529 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
536 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 530 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
537 | ] | 531 | ] |
538 | ]; | 532 | ]; |
539 | 533 | ||
540 | $validator = Validator::make($request->all(), $rules, $messages); | 534 | $validator = Validator::make($request->all(), $rules, $messages); |
541 | 535 | ||
542 | if ($validator->fails()) { | 536 | if ($validator->fails()) { |
543 | return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); | 537 | return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); |
544 | } | 538 | } |
545 | 539 | ||
546 | $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); | 540 | $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); |
547 | return redirect()->route('employer.dialog', ['chat' => $new_message->chat_id_from]); | 541 | return redirect()->route('employer.dialog', ['chat' => $new_message->chat_id_from]); |
548 | 542 | ||
549 | } | 543 | } |
550 | 544 | ||
551 | //Избранные люди | 545 | //Избранные люди |
552 | public function favorites(Request $request) | 546 | public function favorites(Request $request) |
553 | { | 547 | { |
554 | $likedWorkersIds = Like_worker::query() | 548 | $likedWorkersIds = Like_worker::query() |
555 | ->where('user_id', Auth::user()->id) | 549 | ->where('user_id', Auth::user()->id) |
556 | ->get() | 550 | ->get() |
557 | ->pluck('code_record') | 551 | ->pluck('code_record') |
558 | ->toArray(); | 552 | ->toArray(); |
559 | 553 | ||
560 | $workerBuilder = Worker::query() | 554 | $workerBuilder = Worker::query() |
561 | ->whereIn('id', $likedWorkersIds); | 555 | ->whereIn('id', $likedWorkersIds); |
562 | 556 | ||
563 | if (($request->has('search')) && (!empty($request->get('search')))) { | 557 | if (($request->has('search')) && (!empty($request->get('search')))) { |
564 | $search = $request->get('search'); | 558 | $search = $request->get('search'); |
565 | 559 | ||
566 | $workerBuilder->whereHas('users', function (Builder $query) use ($search) { | 560 | $workerBuilder->whereHas('users', function (Builder $query) use ($search) { |
567 | $query->where('surname', 'LIKE', "%$search%") | 561 | $query->where('surname', 'LIKE', "%$search%") |
568 | ->orWhere('name_man', 'LIKE', "%$search%") | 562 | ->orWhere('name_man', 'LIKE', "%$search%") |
569 | ->orWhere('surname2', 'LIKE', "%$search%"); | 563 | ->orWhere('surname2', 'LIKE', "%$search%"); |
570 | }); | 564 | }); |
571 | } | 565 | } |
572 | 566 | ||
573 | $Workers = $workerBuilder->get(); | 567 | $Workers = $workerBuilder->get(); |
574 | 568 | ||
575 | return view('employers.favorite', compact('Workers')); | 569 | return view('employers.favorite', compact('Workers')); |
576 | } | 570 | } |
577 | 571 | ||
578 | // База данных | 572 | // База данных |
579 | public function bd(Request $request) { | 573 | public function bd(Request $request) { |
580 | if (!Auth::user()->show_database) { | 574 | if (!Auth::user()->show_database) { |
581 | return redirect()->route('employer.employer_info'); | 575 | return redirect()->route('employer.employer_info'); |
582 | } | 576 | } |
583 | 577 | ||
584 | $users = User_Model::query()->with('workers')->with('jobtitles'); | 578 | $users = User_Model::query()->with('workers')->with('jobtitles'); |
585 | 579 | ||
586 | if ($request->has('search')) { | 580 | if ($request->has('search')) { |
587 | $find_key = $request->get('search'); | 581 | $find_key = $request->get('search'); |
588 | $users = $users->where('name', 'LIKE', "%$find_key%") | 582 | $users = $users->where('name', 'LIKE', "%$find_key%") |
589 | ->orWhere('surname', 'LIKE', "%$find_key%") | 583 | ->orWhere('surname', 'LIKE', "%$find_key%") |
590 | ->orWhere('name_man', 'LIKE', "%$find_key%") | 584 | ->orWhere('name_man', 'LIKE', "%$find_key%") |
591 | ->orWhere('email', 'LIKE', "%$find_key%") | 585 | ->orWhere('email', 'LIKE', "%$find_key%") |
592 | ->orWhere('telephone', 'LIKE', "%$find_key%"); | 586 | ->orWhere('telephone', 'LIKE', "%$find_key%"); |
593 | } | 587 | } |
594 | $count_users = $users->count(); | 588 | $count_users = $users->count(); |
595 | 589 | ||
596 | // Данные | 590 | // Данные |
597 | $users = $users | 591 | $users = $users |
598 | ->Baseuser() | 592 | ->Baseuser() |
599 | ->orderByDesc('created_at') | 593 | ->orderByDesc('created_at') |
600 | ->paginate(10); | 594 | ->paginate(10); |
601 | 595 | ||
602 | $export_options = DbExportColumns::toArray(); | 596 | $export_options = DbExportColumns::toArray(); |
603 | 597 | ||
604 | $jobs_titles = Job_title::select('id', 'name') | 598 | $jobs_titles = Job_title::select('id', 'name') |
605 | ->where('is_remove', '=', 0) | 599 | ->where('is_remove', '=', 0) |
606 | ->where('is_bd', '=', 2) | 600 | ->where('is_bd', '=', 2) |
607 | ->orderByDesc('sort') | 601 | ->orderByDesc('sort') |
608 | ->orderBy('name', 'asc') | 602 | ->orderBy('name', 'asc') |
609 | ->get() | 603 | ->get() |
610 | ->toArray() | 604 | ->toArray() |
611 | ; | 605 | ; |
612 | 606 | ||
613 | return view('employers.bd', compact('users', 'count_users', 'export_options', 'jobs_titles')); | 607 | return view('employers.bd', compact('users', 'count_users', 'export_options', 'jobs_titles')); |
614 | } | 608 | } |
615 | 609 | ||
616 | //Настройка уведомлений | 610 | //Настройка уведомлений |
617 | public function subscribe() { | 611 | public function subscribe() { |
618 | 612 | ||
619 | $user=Auth::user(); | 613 | $user=Auth::user(); |
620 | 614 | ||
621 | return view('employers.subcribe',compact('user')); | 615 | return view('employers.subcribe',compact('user')); |
622 | } | 616 | } |
623 | 617 | ||
624 | //Установка уведомлений сохранение | 618 | //Установка уведомлений сохранение |
625 | public function save_subscribe(Request $request) { | 619 | public function save_subscribe(Request $request) { |
626 | 620 | ||
627 | $msg = $request->validate([ | 621 | $msg = $request->validate([ |
628 | 'email' => 'required|email|min:5|max:255', | 622 | 'email' => 'required|email|min:5|max:255', |
629 | ]); | 623 | ]); |
630 | $user= Auth::user(); | 624 | $user= Auth::user(); |
631 | 625 | ||
632 | User_Model::updateOrCreate( | 626 | User_Model::updateOrCreate( |
633 | ['id' => $user->id], | 627 | ['id' => $user->id], |
634 | ['subscribe_email' => $request->email, | 628 | ['subscribe_email' => $request->email, |
635 | 'subscribe' => request()->has('email_msg') && request('email_msg') === 'on' ? 1 : 0 | 629 | 'subscribe' => request()->has('email_msg') && request('email_msg') === 'on' ? 1 : 0 |
636 | ] | 630 | ] |
637 | ); | 631 | ); |
638 | return redirect()->route('employer.subscribe')->with('success', 'Ваши изменения успешно сохранены'); | 632 | return redirect()->route('employer.subscribe')->with('success', 'Ваши изменения успешно сохранены'); |
639 | } | 633 | } |
640 | //Сбросить форму с паролем | 634 | //Сбросить форму с паролем |
641 | public function password_reset() { | 635 | public function password_reset() { |
642 | $email = Auth()->user()->email; | 636 | $email = Auth()->user()->email; |
643 | return view('employers.password-reset', compact('email')); | 637 | return view('employers.password-reset', compact('email')); |
644 | } | 638 | } |
645 | 639 | ||
646 | //Обновление пароля | 640 | //Обновление пароля |
647 | public function new_password(Request $request) { | 641 | public function new_password(Request $request) { |
648 | $use = Auth()->user(); | 642 | $use = Auth()->user(); |
649 | $request->validate([ | 643 | $request->validate([ |
650 | 'password' => 'required|string', | 644 | 'password' => 'required|string', |
651 | 'new_password' => 'required|string', | 645 | 'new_password' => 'required|string', |
652 | 'new_password2' => 'required|string' | 646 | 'new_password2' => 'required|string' |
653 | ]); | 647 | ]); |
654 | 648 | ||
655 | if ($request->get('new_password') == $request->get('new_password2')) | 649 | if ($request->get('new_password') == $request->get('new_password2')) |
656 | if ($request->get('password') !== $request->get('new_password')) { | 650 | if ($request->get('password') !== $request->get('new_password')) { |
657 | $credentials = $request->only('email', 'password'); | 651 | $credentials = $request->only('email', 'password'); |
658 | if (Auth::attempt($credentials)) { | 652 | if (Auth::attempt($credentials)) { |
659 | 653 | ||
660 | if (!is_null($use->email_verified_at)){ | 654 | if (!is_null($use->email_verified_at)){ |
661 | 655 | ||
662 | $user_data = User_Model::find($use->id); | 656 | $user_data = User_Model::find($use->id); |
663 | $user_data->update([ | 657 | $user_data->update([ |
664 | 'password' => Hash::make($request->get('new_password')), | 658 | 'password' => Hash::make($request->get('new_password')), |
665 | 'pubpassword' => base64_encode($request->get('new_password')), | 659 | 'pubpassword' => base64_encode($request->get('new_password')), |
666 | ]); | 660 | ]); |
667 | return redirect() | 661 | return redirect() |
668 | ->route('employer.password_reset') | 662 | ->route('employer.password_reset') |
669 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 663 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
670 | } | 664 | } |
671 | 665 | ||
672 | return redirect() | 666 | return redirect() |
673 | ->route('employer.password_reset') | 667 | ->route('employer.password_reset') |
674 | ->withError('Данная учетная запись не было верифицированна!'); | 668 | ->withError('Данная учетная запись не было верифицированна!'); |
675 | } | 669 | } |
676 | } | 670 | } |
677 | 671 | ||
678 | return redirect() | 672 | return redirect() |
679 | ->route('employer.password_reset') | 673 | ->route('employer.password_reset') |
680 | ->withErrors('Не совпадение данных, обновите пароли!'); | 674 | ->withErrors('Не совпадение данных, обновите пароли!'); |
681 | } | 675 | } |
682 | 676 | ||
683 | 677 | ||
684 | 678 | ||
685 | // Форма Удаление пипла | 679 | // Форма Удаление пипла |
686 | public function delete_people() { | 680 | public function delete_people() { |
687 | $login = Auth()->user()->email; | 681 | $login = Auth()->user()->email; |
688 | return view('employers.delete_people', compact('login')); | 682 | return view('employers.delete_people', compact('login')); |
689 | } | 683 | } |
690 | 684 | ||
691 | // Удаление аккаунта | 685 | // Удаление аккаунта |
692 | public function action_delete_user(Request $request) { | 686 | public function action_delete_user(Request $request) { |
693 | $Answer = $request->all(); | 687 | $Answer = $request->all(); |
694 | $user_id = Auth()->user()->id; | 688 | $user_id = Auth()->user()->id; |
695 | $request->validate([ | 689 | $request->validate([ |
696 | 'password' => 'required|string', | 690 | 'password' => 'required|string', |
697 | ]); | 691 | ]); |
698 | 692 | ||
699 | $credentials = $request->only('email', 'password'); | 693 | $credentials = $request->only('email', 'password'); |
700 | if (Auth::attempt($credentials)) { | 694 | if (Auth::attempt($credentials)) { |
701 | Auth::logout(); | 695 | Auth::logout(); |
702 | $it = User_Model::find($user_id); | 696 | $it = User_Model::find($user_id); |
703 | $it->delete(); | 697 | $it->delete(); |
704 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 698 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
705 | } else { | 699 | } else { |
706 | return redirect()->route('employer.delete_people') | 700 | return redirect()->route('employer.delete_people') |
707 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 701 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
708 | } | 702 | } |
709 | } | 703 | } |
710 | 704 | ||
711 | public function ajax_delete_user(Request $request) { | 705 | public function ajax_delete_user(Request $request) { |
712 | $Answer = $request->all(); | 706 | $Answer = $request->all(); |
713 | $user_id = Auth()->user()->id; | 707 | $user_id = Auth()->user()->id; |
714 | $request->validate([ | 708 | $request->validate([ |
715 | 'password' => 'required|string', | 709 | 'password' => 'required|string', |
716 | ]); | 710 | ]); |
717 | $credentials = $request->only('email', 'password'); | 711 | $credentials = $request->only('email', 'password'); |
718 | if (Auth::attempt($credentials)) { | 712 | if (Auth::attempt($credentials)) { |
719 | 713 | ||
720 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', | 714 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', |
721 | 'email' => $request->get('email'), | 715 | 'email' => $request->get('email'), |
722 | 'password' => $request->get('password'))); | 716 | 'password' => $request->get('password'))); |
723 | } else { | 717 | } else { |
724 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); | 718 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); |
725 | } | 719 | } |
726 | } | 720 | } |
727 | 721 | ||
728 | // Рассылка сообщений | 722 | // Рассылка сообщений |
729 | public function send_all_messages() { | 723 | public function send_all_messages() { |
730 | $id = Auth()->user()->id; | 724 | $id = Auth()->user()->id; |
731 | $sending = Employer::query()->where('user_id', '=', "$id")->first(); | 725 | $sending = Employer::query()->where('user_id', '=', "$id")->first(); |
732 | 726 | ||
733 | $job_titles = Job_title::query() | 727 | $job_titles = Job_title::query() |
734 | ->where('is_remove', '=', 0) | 728 | ->where('is_remove', '=', 0) |
735 | ->where('is_bd', '=', 1) | 729 | ->where('is_bd', '=', 1) |
736 | ->orderByDesc('sort') | 730 | ->orderByDesc('sort') |
737 | ->get(); | 731 | ->get(); |
738 | 732 | ||
739 | if ($sending->sending_is) | 733 | if ($sending->sending_is) |
740 | return view('employers.send_all', compact('job_titles')); | 734 | return view('employers.send_all', compact('job_titles')); |
741 | else | 735 | else |
742 | return view('employers.send_all_danger'); | 736 | return view('employers.send_all_danger'); |
743 | } | 737 | } |
744 | 738 | ||
745 | // Отправка сообщений для информации | 739 | // Отправка сообщений для информации |
746 | public function send_all_post(Request $request) { | 740 | public function send_all_post(Request $request) { |
747 | $data = $request->all(); | 741 | $data = $request->all(); |
748 | $data['user'] = Auth()->user(); | 742 | $data['user'] = Auth()->user(); |
749 | 743 | ||
750 | $id = MessagesRequests::create([ | 744 | $id = MessagesRequests::create([ |
751 | 'user_id' => $data['user']->id, | 745 | 'user_id' => $data['user']->id, |
752 | 'job_titles' => isset($data['job_title_ids']) ? json_encode($data['job_title_ids']) : null, | 746 | 'job_titles' => isset($data['job_title_ids']) ? json_encode($data['job_title_ids']) : null, |
753 | 'text' => $data['message_text'], | 747 | 'text' => $data['message_text'], |
754 | ]); | 748 | ]); |
755 | 749 | ||
756 | try { | 750 | try { |
757 | if (!empty($id)) { | 751 | if (!empty($id)) { |
758 | Mail::to(env('EMAIL_ADMIN'))->send(new MassSendingMessages($data)); | 752 | Mail::to(env('EMAIL_ADMIN'))->send(new MassSendingMessages($data)); |
759 | } | 753 | } |
760 | } catch (Throwable $e) { | 754 | } catch (Throwable $e) { |
761 | Log::error($e); | 755 | Log::error($e); |
762 | return redirect()->route('employer.send_all_messages')->with('error', 'Ошибка почтового сервера, пожалуйста, повторите рассылку позднее'); | 756 | return redirect()->route('employer.send_all_messages')->with('error', 'Ошибка почтового сервера, пожалуйста, повторите рассылку позднее'); |
763 | } | 757 | } |
764 | 758 | ||
765 | return redirect()->route('employer.send_all_messages')->with('success', 'Запрос на рассылку был успешно отправлен.'); | 759 | return redirect()->route('employer.send_all_messages')->with('success', 'Запрос на рассылку был успешно отправлен.'); |
766 | } | 760 | } |
767 | 761 | ||
768 | // База резюме | 762 | // База резюме |
769 | public function bd_tupe(Request $request) { | 763 | public function bd_tupe(Request $request) { |
770 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); | 764 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); |
771 | 765 | ||
772 | return view('employers.bd_tupe', compact('Resume')); | 766 | return view('employers.bd_tupe', compact('Resume')); |
773 | } | 767 | } |
774 | 768 | ||
775 | ////////////////////////////////////////////////////////////////// | 769 | ////////////////////////////////////////////////////////////////// |
776 | // Отправил сообщение | 770 | // Отправил сообщение |
777 | ////////////////////////////////////////////////////////////////// | 771 | ////////////////////////////////////////////////////////////////// |
778 | public function new_message(Request $request) | 772 | public function new_message(Request $request) |
779 | { | 773 | { |
780 | $params = $request->all(); | 774 | $params = $request->all(); |
781 | 775 | ||
782 | $id = $params['_user_id']; | 776 | $id = $params['_user_id']; |
783 | $message_params = [ | 777 | $message_params = [ |
784 | 'title' => $params['title'], | 778 | 'title' => $params['title'], |
785 | 'text' => $params['text'], | 779 | 'text' => $params['text'], |
786 | 'ad_employer_id' => $params['_vacancy'], | 780 | 'ad_employer_id' => $params['_vacancy'], |
787 | 'flag_new' => 1 | 781 | 'flag_new' => 1 |
788 | ]; | 782 | ]; |
789 | 783 | ||
790 | $message = Message::add_message( | 784 | $message = Message::add_message( |
791 | $request, | 785 | $request, |
792 | $params['_user_id'], | 786 | $params['_user_id'], |
793 | $params['_to_user_id'], | 787 | $params['_to_user_id'], |
794 | $message_params, | 788 | $message_params, |
795 | file_store_path: "worker/$id" | 789 | file_store_path: "worker/$id" |
796 | ); | 790 | ); |
797 | 791 | ||
798 | return redirect()->route('employer.dialog', ['chat' => $message->chat_id_to]); | 792 | return redirect()->route('employer.dialog', ['chat' => $message->chat_id_to]); |
799 | } | 793 | } |
800 | 794 | ||
801 | // Восстановление пароля | 795 | // Восстановление пароля |
802 | public function repair_password(Request $request) { | 796 | public function repair_password(Request $request) { |
803 | $params = $request->get('email'); | 797 | $params = $request->get('email'); |
804 | } | 798 | } |
805 | 799 | ||
806 | // Избранные люди на корабль | 800 | // Избранные люди на корабль |
807 | public function selected_people(Request $request) { | 801 | public function selected_people(Request $request) { |
808 | $id = $request->get('id'); | 802 | $id = $request->get('id'); |
809 | $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | 803 | $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
810 | where('is_remove', '=', '0')-> | 804 | where('is_remove', '=', '0')-> |
811 | where('is_bd', '=', '0')-> | 805 | where('is_bd', '=', '0')-> |
812 | where('position_id', $id)-> | 806 | where('position_id', $id)-> |
813 | get(); | 807 | get(); |
814 | return view('favorite_people', compact('favorite_people')); | 808 | return view('favorite_people', compact('favorite_people')); |
815 | } | 809 | } |
816 | 810 | ||
817 | /** | 811 | /** |
818 | * @throws JsonException | 812 | * @throws JsonException |
819 | */ | 813 | */ |
820 | public function vacancyAutoLiftForm(): View|RedirectResponse | 814 | public function vacancyAutoLiftForm(): View|RedirectResponse |
821 | { | 815 | { |
822 | if (!Auth::user()->can_autolift) { | 816 | if (!Auth::user()->can_autolift) { |
823 | return redirect()->route('employer.employer_info'); | 817 | return redirect()->route('employer.employer_info'); |
824 | } | 818 | } |
825 | 819 | ||
826 | $employer = Auth::user()->employers[0]; | 820 | $employer = Auth::user()->employers[0]; |
827 | $vacancies = $employer | 821 | $vacancies = $employer |
828 | ->ads() | 822 | ->ads() |
829 | ->where('is_remove', 0) | 823 | ->where('is_remove', 0) |
830 | ->where('active_is', 1) | 824 | ->where('active_is', 1) |
831 | ->get(); | 825 | ->get(); |
832 | 826 | ||
833 | $options = $employer->autoliftOptions ?? new EmployerAutoliftOption(); | 827 | $options = $employer->autoliftOptions ?? new EmployerAutoliftOption(); |
834 | 828 | ||
835 | $leftDays = 0; | 829 | $leftDays = 0; |
836 | 830 | ||
837 | if ($options->days_repeat) { | 831 | if ($options->days_repeat) { |
838 | $leftDays = $options->days_repeat - now()->diffInDays(Carbon::parse($options->created_at)); | 832 | $leftDays = $options->days_repeat - now()->diffInDays(Carbon::parse($options->created_at)); |
839 | } | 833 | } |
840 | 834 | ||
841 | 835 | ||
842 | return view('employers.vacancy_autolift', compact('vacancies', 'options', 'leftDays')); | 836 | return view('employers.vacancy_autolift', compact('vacancies', 'options', 'leftDays')); |
843 | } | 837 | } |
844 | 838 | ||
845 | /** | 839 | /** |
846 | * @throws JsonException | 840 | * @throws JsonException |
847 | */ | 841 | */ |
848 | public function vacancyAutoLiftSave(Request $request) | 842 | public function vacancyAutoLiftSave(Request $request) |
849 | { | 843 | { |
850 | $employer = Auth::user()->employers[0]; | 844 | $employer = Auth::user()->employers[0]; |
851 | 845 | ||
852 | $employer->autoliftOptions()->updateOrCreate( | 846 | $employer->autoliftOptions()->updateOrCreate( |
853 | [ | 847 | [ |
854 | 'employer_id' => $employer->id, | 848 | 'employer_id' => $employer->id, |
855 | ], | 849 | ], |
856 | [ | 850 | [ |
857 | 'is_enabled' => $request->get('is_enabled') === 'true', | 851 | 'is_enabled' => $request->get('is_enabled') === 'true', |
858 | 'times_per_day' => $request->get('times_per_day'), | 852 | 'times_per_day' => $request->get('times_per_day'), |
859 | 'days_repeat' => $request->get('days_repeat'), | 853 | 'days_repeat' => $request->get('days_repeat'), |
860 | 'time_send_first' => $request->get('time_send_first'), | 854 | 'time_send_first' => $request->get('time_send_first'), |
861 | 'time_send_second' => $request->get('time_send_second'), | 855 | 'time_send_second' => $request->get('time_send_second'), |
862 | 'time_send_third' => $request->get('time_send_third'), | 856 | 'time_send_third' => $request->get('time_send_third'), |
863 | 'time_send_tg' => $request->get('time_send_tg'), | 857 | 'time_send_tg' => $request->get('time_send_tg'), |
864 | ] | 858 | ] |
865 | ); | 859 | ); |
866 | 860 | ||
867 | foreach ($request->get('vacancies') as $vacancy) { | 861 | foreach ($request->get('vacancies') as $vacancy) { |
868 | Ad_employer::query() | 862 | Ad_employer::query() |
869 | ->where('id', $vacancy['id']) | 863 | ->where('id', $vacancy['id']) |
870 | ->update([ | 864 | ->update([ |
871 | 'autolift_site' => $vacancy['autolift_site'] === 'true', //they're arriving as strings | 865 | 'autolift_site' => $vacancy['autolift_site'] === 'true', //they're arriving as strings |
872 | 'autosend_tg' => $vacancy['autosend_tg'] === 'true', | 866 | 'autosend_tg' => $vacancy['autosend_tg'] === 'true', |
873 | ]); | 867 | ]); |
874 | } | 868 | } |
875 | 869 | ||
876 | return response(['success' => true]); | 870 | return response(['success' => true]); |
877 | } | 871 | } |
878 | 872 | ||
879 | public function autoresponder() | 873 | public function autoresponder() |
880 | { | 874 | { |
881 | $user = Auth::user(); | 875 | $user = Auth::user(); |
882 | return view('employers.autoresponder', compact('user')); | 876 | return view('employers.autoresponder', compact('user')); |
883 | } | 877 | } |
884 | 878 | ||
885 | public function autoresponderSave(Request $request): RedirectResponse | 879 | public function autoresponderSave(Request $request): RedirectResponse |
886 | { | 880 | { |
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\Classes\Tools; | 6 | use App\Classes\Tools; |
7 | use App\Http\Requests\DocumentsRequest; | 7 | use App\Http\Requests\DocumentsRequest; |
8 | use App\Http\Requests\PrevCompanyRequest; | 8 | use App\Http\Requests\PrevCompanyRequest; |
9 | use App\Http\Requests\SertificationRequest; | 9 | use App\Http\Requests\SertificationRequest; |
10 | use App\Models\Ad_employer; | 10 | use App\Models\Ad_employer; |
11 | use App\Models\ad_response; | 11 | use App\Models\ad_response; |
12 | use App\Models\Chat; | 12 | use App\Models\Chat; |
13 | use App\Models\Dop_info; | 13 | use App\Models\Dop_info; |
14 | use App\Models\Employer; | 14 | use App\Models\Employer; |
15 | use App\Models\EmployerAutoliftOption; | 15 | use App\Models\EmployerAutoliftOption; |
16 | use App\Models\infobloks; | 16 | use App\Models\infobloks; |
17 | use App\Models\Job_title; | 17 | use App\Models\Job_title; |
18 | use App\Models\Like_vacancy; | 18 | use App\Models\Like_vacancy; |
19 | use App\Models\Message; | 19 | use App\Models\Message; |
20 | use App\Models\place_works; | 20 | use App\Models\place_works; |
21 | use App\Models\PrevCompany; | 21 | use App\Models\PrevCompany; |
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 App\Models\WorkerAutoliftOption; | 29 | use App\Models\WorkerAutoliftOption; |
30 | use Barryvdh\DomPDF\Facade\Pdf; | 30 | use Barryvdh\DomPDF\Facade\Pdf; |
31 | use Carbon\Carbon; | 31 | use Carbon\Carbon; |
32 | use Illuminate\Auth\Events\Registered; | 32 | use Illuminate\Auth\Events\Registered; |
33 | use Illuminate\Database\Eloquent\Builder; | 33 | use Illuminate\Database\Eloquent\Builder; |
34 | use Illuminate\Http\RedirectResponse; | 34 | use Illuminate\Http\RedirectResponse; |
35 | use Illuminate\Http\Request; | 35 | use Illuminate\Http\Request; |
36 | use Illuminate\Pagination\LengthAwarePaginator; | 36 | use Illuminate\Pagination\LengthAwarePaginator; |
37 | use Illuminate\Support\Facades\Auth; | 37 | use Illuminate\Support\Facades\Auth; |
38 | use Illuminate\Support\Facades\DB; | 38 | use Illuminate\Support\Facades\DB; |
39 | use Illuminate\Support\Facades\Hash; | 39 | use Illuminate\Support\Facades\Hash; |
40 | use Illuminate\Support\Facades\Storage; | 40 | use Illuminate\Support\Facades\Storage; |
41 | use Illuminate\Support\Facades\Validator; | 41 | use Illuminate\Support\Facades\Validator; |
42 | use Illuminate\View\View; | 42 | use Illuminate\View\View; |
43 | use JsonException; | 43 | use JsonException; |
44 | use PhpOffice\PhpSpreadsheet\Spreadsheet; | 44 | use PhpOffice\PhpSpreadsheet\Spreadsheet; |
45 | use PhpOffice\PhpSpreadsheet\Writer\Xlsx; | 45 | use PhpOffice\PhpSpreadsheet\Writer\Xlsx; |
46 | use Symfony\Component\HttpFoundation\StreamedResponse; | 46 | use Symfony\Component\HttpFoundation\StreamedResponse; |
47 | use App\Enums\DbExportColumns; | 47 | use App\Enums\DbExportColumns; |
48 | use App\Enums\WorkerStatuses; | 48 | use App\Enums\WorkerStatuses; |
49 | use DateTime; | 49 | use DateTime; |
50 | 50 | ||
51 | class WorkerController extends Controller | 51 | class WorkerController extends Controller |
52 | { | 52 | { |
53 | //профиль | 53 | //профиль |
54 | public function profile(Worker $worker) | 54 | public function profile(Worker $worker) |
55 | { | 55 | { |
56 | $get_date = date('Y.m'); | 56 | $get_date = date('Y.m'); |
57 | 57 | ||
58 | $c = Static_worker::query()->where('year_month', '=', $get_date) | 58 | $c = Static_worker::query()->where('year_month', '=', $get_date) |
59 | ->where('user_id', '=', $worker->users->id) | 59 | ->where('user_id', '=', $worker->users->id) |
60 | ->get(); | 60 | ->get(); |
61 | 61 | ||
62 | if ($c->count() > 0) { | 62 | if ($c->count() > 0) { |
63 | $upd = Static_worker::find($c[0]->id); | 63 | $upd = Static_worker::find($c[0]->id); |
64 | $upd->lookin = $upd->lookin + 1; | 64 | $upd->lookin = $upd->lookin + 1; |
65 | $upd->save(); | 65 | $upd->save(); |
66 | } else { | 66 | } else { |
67 | $crt = new Static_worker(); | 67 | $crt = new Static_worker(); |
68 | $crt->lookin = 1; | 68 | $crt->lookin = 1; |
69 | $crt->year_month = $get_date; | 69 | $crt->year_month = $get_date; |
70 | $crt->user_id = $worker->user_id; | 70 | $crt->user_id = $worker->user_id; |
71 | $crt->save(); | 71 | $crt->save(); |
72 | } | 72 | } |
73 | 73 | ||
74 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 74 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
75 | ->where('user_id', '=', $worker->users->id) | 75 | ->where('user_id', '=', $worker->users->id) |
76 | ->get(); | 76 | ->get(); |
77 | 77 | ||
78 | return view('public.workers.profile', compact('worker', 'stat')); | 78 | return view('public.workers.profile', compact('worker', 'stat')); |
79 | } | 79 | } |
80 | 80 | ||
81 | // лист база резюме | 81 | // лист база резюме |
82 | public function bd_resume(Request $request) | 82 | public function bd_resume(Request $request) |
83 | { | 83 | { |
84 | 84 | ||
85 | if (!Auth::check()) { | 85 | if (!Auth::check()) { |
86 | 86 | ||
87 | return redirect()->route('page', ['pages' => "Usloviya-razmescheniya"])->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); | 87 | return redirect()->route('page', ['pages' => "Usloviya-razmescheniya"])->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); |
88 | 88 | ||
89 | } | 89 | } |
90 | if ((Auth::user()->is_worker) || (!Auth()->user()->is_lookin)) | 90 | if ((Auth::user()->is_worker) || (!Auth()->user()->is_lookin)) |
91 | return redirect()->route('page', ['pages' => "Usloviya-razmescheniya"])->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); | 91 | return redirect()->route('page', ['pages' => "Usloviya-razmescheniya"])->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); |
92 | 92 | ||
93 | 93 | ||
94 | $status_work = WorkerStatuses::getWorkerStatuses(); | 94 | $status_work = WorkerStatuses::getWorkerStatuses(); |
95 | 95 | ||
96 | $resumes = Worker::query()->with('users')->with('job_titles')->orderByDesc('updated_at'); | 96 | $resumes = Worker::query()->with('users')->with('job_titles')->orderByDesc('updated_at'); |
97 | $resumes = $resumes->whereHas('users', function (Builder $query) { | 97 | $resumes = $resumes->whereHas('users', function (Builder $query) { |
98 | $query->Where('is_worker', '=', '1') | 98 | $query->Where('is_worker', '=', '1') |
99 | ->Where('is_bd', '=', '0'); | 99 | ->Where('is_bd', '=', '0'); |
100 | }); | 100 | }); |
101 | 101 | ||
102 | if (($request->has('job')) && ($request->get('job') > 0)) { | 102 | if (($request->has('job')) && ($request->get('job') > 0)) { |
103 | $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { | 103 | $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { |
104 | $query->Where('job_titles.id', $request->get('job')); | 104 | $query->Where('job_titles.id', $request->get('job')); |
105 | }); | 105 | }); |
106 | } | 106 | } |
107 | 107 | ||
108 | $Job_title = Job_title::query() | 108 | $Job_title = Job_title::query() |
109 | ->where('is_remove', '=', '0') | 109 | ->where('is_remove', '=', '0') |
110 | ->where('is_bd', '=' , '1') | 110 | ->where('is_bd', '=' , '1') |
111 | ->orderByDesc('sort') | 111 | ->orderByDesc('sort') |
112 | ->get(); | 112 | ->get(); |
113 | 113 | ||
114 | if ($request->get('sort')) { | 114 | if ($request->get('sort')) { |
115 | $sort = $request->get('sort'); | 115 | $sort = $request->get('sort'); |
116 | switch ($sort) { | 116 | switch ($sort) { |
117 | case 'looking_for_work': | 117 | case 'looking_for_work': |
118 | $resumes->where('status_work', '=', WorkerStatuses::LookingForWork->value); | 118 | $resumes->where('status_work', '=', WorkerStatuses::LookingForWork->value); |
119 | break; | 119 | break; |
120 | case 'considering_offers': | 120 | case 'considering_offers': |
121 | $resumes->where('status_work', '=', WorkerStatuses::ConsideringOffers->value); | 121 | $resumes->where('status_work', '=', WorkerStatuses::ConsideringOffers->value); |
122 | break; | 122 | break; |
123 | case 'not_looking_for_work': | 123 | case 'not_looking_for_work': |
124 | $resumes->where('status_work', '=', WorkerStatuses::NotLookingForWork->value); | 124 | $resumes->where('status_work', '=', WorkerStatuses::NotLookingForWork->value); |
125 | break; | 125 | break; |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | $resumes = $resumes->get()->filter(function ($worker) { | 129 | $resumes = $resumes->get()->filter(function ($worker) { |
130 | return Tools::getWorkerProfilePercent($worker) >= 50; | 130 | return Tools::getWorkerProfilePercent($worker) >= 50; |
131 | }); | 131 | }); |
132 | 132 | ||
133 | $res_count = $resumes->count(); | 133 | $res_count = $resumes->count(); |
134 | 134 | ||
135 | $currentPage = $_GET['page'] ?? 1; | 135 | $currentPage = $_GET['page'] ?? 1; |
136 | $resumes = new LengthAwarePaginator( | 136 | $resumes = new LengthAwarePaginator( |
137 | items: $resumes->slice(4 * ($currentPage - 1), 4), | 137 | items: $resumes->slice(4 * ($currentPage - 1), 4), |
138 | total: $res_count, | 138 | total: $res_count, |
139 | perPage: 4, | 139 | perPage: 4, |
140 | ); | 140 | ); |
141 | $resumes->setPath('bd-resume'); | 141 | $resumes->setPath('bd-resume'); |
142 | 142 | ||
143 | if ($request->ajax()) { | 143 | if ($request->ajax()) { |
144 | // Условия обставлены | 144 | // Условия обставлены |
145 | if ($request->has('block') && ($request->get('block') == 1)) { | 145 | if ($request->has('block') && ($request->get('block') == 1)) { |
146 | return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count')); | 146 | return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count')); |
147 | } | 147 | } |
148 | } else { | 148 | } else { |
149 | return view('resume', compact('resumes', 'status_work', 'res_count', 'Job_title')); | 149 | return view('resume', compact('resumes', 'status_work', 'res_count', 'Job_title')); |
150 | } | 150 | } |
151 | } | 151 | } |
152 | 152 | ||
153 | public function basic_information(){ | 153 | public function basic_information(){ |
154 | if (!isset(Auth()->user()->id)) { | 154 | if (!isset(Auth()->user()->id)) { |
155 | abort(404); | 155 | abort(404); |
156 | } | 156 | } |
157 | 157 | ||
158 | $user_id = Auth()->user()->id; | 158 | $user_id = Auth()->user()->id; |
159 | 159 | ||
160 | $user = User::query() | 160 | $user = User::query() |
161 | ->with('workers') | 161 | ->with('workers') |
162 | ->with(['jobtitles' => function ($query) { | 162 | ->with(['jobtitles' => function ($query) { |
163 | $query->select('job_titles.id'); | 163 | $query->select('job_titles.id'); |
164 | }]) | 164 | }]) |
165 | ->where('id', '=', $user_id) | 165 | ->where('id', '=', $user_id) |
166 | ->first(); | 166 | ->first(); |
167 | $user->workers[0]->job_titles = $user->workers[0]->job_titles->pluck('id')->toArray(); | 167 | $user->workers[0]->job_titles = $user->workers[0]->job_titles->pluck('id')->toArray(); |
168 | 168 | ||
169 | $job_titles = Job_title::query() | 169 | $job_titles = Job_title::query() |
170 | ->where('is_remove', '=', 0) | 170 | ->where('is_remove', '=', 0) |
171 | ->where('is_bd', '=', 1) | 171 | ->where('is_bd', '=', 1) |
172 | ->orderByDesc('sort') | 172 | ->orderByDesc('sort') |
173 | ->get() | 173 | ->get() |
174 | ; | 174 | ; |
175 | 175 | ||
176 | return view('workers.form_basic_information', compact('user', 'job_titles')); | 176 | return view('workers.form_basic_information', compact('user', 'job_titles')); |
177 | } | 177 | } |
178 | 178 | ||
179 | public function additional_documents(){ | 179 | public function additional_documents(){ |
180 | if (!isset(Auth()->user()->id)) { | 180 | if (!isset(Auth()->user()->id)) { |
181 | abort(404); | 181 | abort(404); |
182 | } | 182 | } |
183 | 183 | ||
184 | $user_id = Auth()->user()->id; | 184 | $user_id = Auth()->user()->id; |
185 | 185 | ||
186 | $info_blocks = infobloks::query()->OrderBy('name')->get(); | 186 | $info_blocks = infobloks::query()->OrderBy('name')->get(); |
187 | $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует']; | 187 | $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует']; |
188 | 188 | ||
189 | $worker = Worker::query() | 189 | $worker = Worker::query() |
190 | ->with('users') | 190 | ->with('users') |
191 | ->with('infobloks') | 191 | ->with('infobloks') |
192 | ->WhereHas('users', function (Builder $query) use ($user_id) { | 192 | ->WhereHas('users', function (Builder $query) use ($user_id) { |
193 | $query->Where('id', $user_id); | 193 | $query->Where('id', $user_id); |
194 | }) | 194 | }) |
195 | ->first(); | 195 | ->first(); |
196 | if ($worker->dop_info->count()){ | 196 | if ($worker->dop_info->count()){ |
197 | $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray(); | 197 | $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray(); |
198 | } | 198 | } |
199 | 199 | ||
200 | return view('workers.form_additional_documents', compact('worker', 'info_blocks', 'additional_document_statuses')); | 200 | return view('workers.form_additional_documents', compact('worker', 'info_blocks', 'additional_document_statuses')); |
201 | } | 201 | } |
202 | 202 | ||
203 | //Лайк резюме | 203 | //Лайк резюме |
204 | public function like_controller() { | 204 | public function like_controller() { |
205 | 205 | ||
206 | } | 206 | } |
207 | 207 | ||
208 | // анкета соискателя | 208 | // анкета соискателя |
209 | public function resume_profile(Worker $worker) | 209 | public function resume_profile(Worker $worker) |
210 | { | 210 | { |
211 | if (isset(Auth()->user()->id)) { | 211 | if (isset(Auth()->user()->id)) { |
212 | $idiot = Auth()->user()->id; | 212 | $idiot = Auth()->user()->id; |
213 | } else { | 213 | } else { |
214 | $idiot = 0; | 214 | $idiot = 0; |
215 | } | 215 | } |
216 | 216 | ||
217 | $status_work = WorkerStatuses::getWorkerStatuses(); | 217 | $status_work = WorkerStatuses::getWorkerStatuses(); |
218 | $Query = Worker::query()->with('users')->with('job_titles') | 218 | $Query = Worker::query()->with('users')->with('job_titles') |
219 | ->with('place_worker')->with('sertificate')->with('prev_company') | 219 | ->with('place_worker')->with('sertificate')->with('prev_company') |
220 | ->with('infobloks')->with('response'); | 220 | ->with('infobloks')->with('response'); |
221 | $Query = $Query->where('id', '=', $worker->id); | 221 | $Query = $Query->where('id', '=', $worker->id); |
222 | $Query = $Query->get(); | 222 | $Query = $Query->get(); |
223 | 223 | ||
224 | $get_date = date('Y.m'); | 224 | $get_date = date('Y.m'); |
225 | 225 | ||
226 | $infoblocks = infobloks::query()->get(); | 226 | $infoblocks = infobloks::query()->get(); |
227 | 227 | ||
228 | $c = Static_worker::query()->where('year_month', '=', $get_date) | 228 | $c = Static_worker::query()->where('year_month', '=', $get_date) |
229 | ->where('user_id', '=', $worker->user_id) | 229 | ->where('user_id', '=', $worker->user_id) |
230 | ->get(); | 230 | ->get(); |
231 | 231 | ||
232 | if ($c->count() > 0) { | 232 | if ($c->count() > 0) { |
233 | $upd = Static_worker::find($c[0]->id); | 233 | $upd = Static_worker::find($c[0]->id); |
234 | $upd->lookin = $upd->lookin + 1; | 234 | $upd->lookin = $upd->lookin + 1; |
235 | $upd->save(); | 235 | $upd->save(); |
236 | } else { | 236 | } else { |
237 | $crt = new Static_worker(); | 237 | $crt = new Static_worker(); |
238 | $crt->lookin = 1; | 238 | $crt->lookin = 1; |
239 | $crt->year_month = $get_date; | 239 | $crt->year_month = $get_date; |
240 | $crt->user_id = $worker->user_id; | 240 | $crt->user_id = $worker->user_id; |
241 | $status = $crt->save(); | 241 | $status = $crt->save(); |
242 | } | 242 | } |
243 | 243 | ||
244 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 244 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
245 | ->where('user_id', '=', $worker->user_id) | 245 | ->where('user_id', '=', $worker->user_id) |
246 | ->get(); | 246 | ->get(); |
247 | 247 | ||
248 | return view('worker', compact('Query', 'infoblocks', 'status_work', 'idiot', 'stat')); | 248 | return view('worker', compact('Query', 'infoblocks', 'status_work', 'idiot', 'stat')); |
249 | } | 249 | } |
250 | 250 | ||
251 | // скачать анкету соискателя | 251 | // скачать анкету соискателя |
252 | public function resume_download(Worker $worker) | 252 | public function resume_download(Worker $worker) |
253 | { | 253 | { |
254 | $status_work = WorkerStatuses::getWorkerStatuses(); | 254 | $status_work = WorkerStatuses::getWorkerStatuses(); |
255 | $Query = Worker::query()->with('users')->with('job_titles') | 255 | $Query = Worker::query()->with('users')->with('job_titles') |
256 | ->with('place_worker')->with('sertificate')->with('prev_company') | 256 | ->with('place_worker')->with('sertificate')->with('prev_company') |
257 | ->with('infobloks'); | 257 | ->with('infobloks'); |
258 | $Query = $Query->where('id', '=', $worker->id); | 258 | $Query = $Query->where('id', '=', $worker->id); |
259 | $Query = $Query->get(); | 259 | $Query = $Query->get(); |
260 | 260 | ||
261 | view()->share('Query',$Query); | 261 | view()->share('Query',$Query); |
262 | 262 | ||
263 | $status_work = WorkerStatuses::getWorkerStatuses(); | 263 | $status_work = WorkerStatuses::getWorkerStatuses(); |
264 | $infoblocks = infobloks::query()->get(); | 264 | $infoblocks = infobloks::query()->get(); |
265 | 265 | ||
266 | //return view('layout.pdf', compact('Query', 'status_work', 'infoblocks')); | 266 | //return view('layout.pdf', compact('Query', 'status_work', 'infoblocks')); |
267 | $pdf = PDF::loadView('layout.pdf', [ | 267 | $pdf = PDF::loadView('layout.pdf', [ |
268 | 'Query' => $Query, | 268 | 'Query' => $Query, |
269 | 'status_work' => $status_work, | 269 | 'status_work' => $status_work, |
270 | 'infoblocks' => $infoblocks | 270 | 'infoblocks' => $infoblocks |
271 | ])->setPaper('a4', 'landscape'); | 271 | ])->setPaper('a4', 'landscape'); |
272 | 272 | ||
273 | return $pdf->download(); | 273 | return $pdf->download(); |
274 | } | 274 | } |
275 | 275 | ||
276 | public function resume_download_all(Request $request) { | 276 | public function resume_download_all(Request $request) { |
277 | $spreadsheet = new Spreadsheet(); | 277 | $spreadsheet = new Spreadsheet(); |
278 | $sheet = $spreadsheet->getActiveSheet(); | 278 | $sheet = $spreadsheet->getActiveSheet(); |
279 | 279 | ||
280 | $columnMap = range('A', 'Z'); | 280 | $columnMap = range('A', 'Z'); |
281 | $columns = []; | 281 | $columns = []; |
282 | 282 | ||
283 | foreach (DbExportColumns::toArray() as $key => $value){ | 283 | foreach (DbExportColumns::toArray() as $key => $value){ |
284 | if ($request->input($key, 0)){ | 284 | if ($request->input($key, 0)){ |
285 | $sheet->setCellValue("{$columnMap[count($columns)]}1", ucfirst($value)); | 285 | $sheet->setCellValue("{$columnMap[count($columns)]}1", ucfirst($value)); |
286 | $columns[] = str_replace('__', '.', $key); | 286 | $columns[] = str_replace('__', '.', $key); |
287 | } | 287 | } |
288 | } | 288 | } |
289 | 289 | ||
290 | if (empty($columns)) { | 290 | if (empty($columns)) { |
291 | return redirect()->back()->with('error', 'Пожалуйста выберите хотя бы 1 колонку для экспорта.'); | 291 | return redirect()->back()->with('error', 'Пожалуйста выберите хотя бы 1 колонку для экспорта.'); |
292 | } | 292 | } |
293 | 293 | ||
294 | $jobIds = $request->input('job_title_list', []); | 294 | $jobIds = $request->input('job_title_list', []); |
295 | 295 | ||
296 | /* //query for mysql ver 8.0 or higher | 296 | /* //query for mysql ver 8.0 or higher |
297 | $users = DB::select( | 297 | $users = DB::select( |
298 | "select `job_titles`.`name`, `users`.`surname`, `users`.`name_man`, `users`.`surname2`, `users`.`email`, `users`.`telephone` | 298 | "select `job_titles`.`name`, `users`.`surname`, `users`.`name_man`, `users`.`surname2`, `users`.`email`, `users`.`telephone` |
299 | from users | 299 | from users |
300 | join workers on `users`.`id` = `workers`.`user_id` | 300 | join workers on `users`.`id` = `workers`.`user_id` |
301 | join `job_titles` | 301 | join `job_titles` |
302 | where `users`.`is_bd` = 1 | 302 | where `users`.`is_bd` = 1 |
303 | and (`workers`.`position_work` = `job_titles`.`id` | 303 | and (`workers`.`position_work` = `job_titles`.`id` |
304 | or exists (select 1 | 304 | or exists (select 1 |
305 | from JSON_TABLE( | 305 | from JSON_TABLE( |
306 | workers.positions_work, | 306 | workers.positions_work, |
307 | '$[*]' COLUMNS (id INT PATH '$')) pw | 307 | '$[*]' COLUMNS (id INT PATH '$')) pw |
308 | where pw.id = job_titles.id) | 308 | where pw.id = job_titles.id) |
309 | )". ((!empty($jobIds)) ? 'and job_titles.id in ('. implode(',', $jobIds).')' : '') | 309 | )". ((!empty($jobIds)) ? 'and job_titles.id in ('. implode(',', $jobIds).')' : '') |
310 | );*/ | 310 | );*/ |
311 | 311 | ||
312 | $selectFields = implode(',', $columns); | 312 | $selectFields = implode(',', $columns); |
313 | 313 | ||
314 | $users = DB::select("SELECT $selectFields FROM users | 314 | $users = DB::select("SELECT $selectFields FROM users |
315 | JOIN workers ON `users`.`id` = `workers`.`user_id` | 315 | JOIN workers ON `users`.`id` = `workers`.`user_id` |
316 | JOIN job_titles ON (`workers`.`position_work` = `job_titles`.`id` | 316 | JOIN job_titles ON (`workers`.`position_work` = `job_titles`.`id` |
317 | OR JSON_CONTAINS(`workers`.`positions_work`, JSON_QUOTE(CAST(`job_titles`.`id` AS CHAR)), '$')) | 317 | OR JSON_CONTAINS(`workers`.`positions_work`, JSON_QUOTE(CAST(`job_titles`.`id` AS CHAR)), '$')) |
318 | WHERE `users`.`is_bd` = 1 " . ((!empty($jobIds)) ? 'AND job_titles.id IN (' . implode(',', $jobIds) . ')' : '') . ""); | 318 | WHERE `users`.`is_bd` = 1 " . ((!empty($jobIds)) ? 'AND job_titles.id IN (' . implode(',', $jobIds) . ')' : '') . ""); |
319 | 319 | ||
320 | $users = collect($users); | 320 | $users = collect($users); |
321 | 321 | ||
322 | if ($users->count()) { | 322 | if ($users->count()) { |
323 | $i = 2; | 323 | $i = 2; |
324 | foreach ($users->toArray() as $user){ | 324 | foreach ($users->toArray() as $user){ |
325 | $j = 0; | 325 | $j = 0; |
326 | foreach ($user as $field){ | 326 | foreach ($user as $field){ |
327 | $sheet->setCellValue("{$columnMap[$j++]}$i", $field); | 327 | $sheet->setCellValue("{$columnMap[$j++]}$i", $field); |
328 | } | 328 | } |
329 | $i++; | 329 | $i++; |
330 | } | 330 | } |
331 | } | 331 | } |
332 | $writer = new Xlsx($spreadsheet); | 332 | $writer = new Xlsx($spreadsheet); |
333 | $fileName = 'DB.xlsx'; | 333 | $fileName = 'DB.xlsx'; |
334 | 334 | ||
335 | $response = new StreamedResponse(function() use ($writer) { | 335 | $response = new StreamedResponse(function() use ($writer) { |
336 | $writer->save('php://output'); | 336 | $writer->save('php://output'); |
337 | }); | 337 | }); |
338 | 338 | ||
339 | $response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); | 339 | $response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); |
340 | $response->headers->set('Content-Disposition', 'attachment;filename="' . $fileName . '"'); | 340 | $response->headers->set('Content-Disposition', 'attachment;filename="' . $fileName . '"'); |
341 | $response->headers->set('Cache-Control', 'max-age=0'); | 341 | $response->headers->set('Cache-Control', 'max-age=0'); |
342 | 342 | ||
343 | return $response; | 343 | return $response; |
344 | } | 344 | } |
345 | 345 | ||
346 | // Кабинет работника | 346 | // Кабинет работника |
347 | public function cabinet(Request $request) | 347 | public function cabinet(Request $request) |
348 | { | 348 | { |
349 | // дата год и месяц | 349 | // дата год и месяц |
350 | $get_date = date('Y.m'); | 350 | $get_date = date('Y.m'); |
351 | 351 | ||
352 | $id = Auth()->user()->id; | 352 | $id = Auth()->user()->id; |
353 | 353 | ||
354 | $Infobloks = infobloks::query()->get(); | 354 | $Infobloks = infobloks::query()->get(); |
355 | 355 | ||
356 | $Worker = Worker::query() | 356 | $Worker = Worker::query() |
357 | ->with(['users', 'sertificate', 'prev_company', 'infobloks', 'place_worker']) | 357 | ->with(['users', 'sertificate', 'prev_company', 'infobloks', 'place_worker']) |
358 | ->WhereHas('users', function (Builder $query) use ($id) { | 358 | ->WhereHas('users', function (Builder $query) use ($id) { |
359 | $query->Where('id', $id); | 359 | $query->Where('id', $id); |
360 | })->first(); | 360 | })->first(); |
361 | 361 | ||
362 | $Job_titles = Job_title::query()->where('is_remove', '=', '0') | 362 | $Job_titles = Job_title::query()->where('is_remove', '=', '0') |
363 | ->where('is_bd', '=' , '1') | 363 | ->where('is_bd', '=' , '1') |
364 | ->OrderByDesc('sort')->OrderBy('name') | 364 | ->OrderByDesc('sort')->OrderBy('name') |
365 | ->get(); | 365 | ->get(); |
366 | 366 | ||
367 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 367 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
368 | ->where('user_id', '=', $id) | 368 | ->where('user_id', '=', $id) |
369 | ->get(); | 369 | ->get(); |
370 | 370 | ||
371 | $persent = Tools::getWorkerProfilePercent($Worker); | 371 | $persent = Tools::getWorkerProfilePercent($Worker); |
372 | 372 | ||
373 | $status_work = WorkerStatuses::getWorkerStatuses(); | 373 | $status_work = WorkerStatuses::getWorkerStatuses(); |
374 | $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует']; | 374 | $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует']; |
375 | $info_blocks = infobloks::query()->OrderBy('name')->get(); | 375 | $info_blocks = infobloks::query()->OrderBy('name')->get(); |
376 | 376 | ||
377 | $worker = Worker::query() | 377 | $worker = Worker::query() |
378 | ->with('users') | 378 | ->with('users') |
379 | ->with('sertificate') | 379 | ->with('sertificate') |
380 | ->with('prev_company') | 380 | ->with('prev_company') |
381 | ->with('infobloks') | 381 | ->with('infobloks') |
382 | ->with('place_worker') | 382 | ->with('place_worker') |
383 | ->with('job_titles') | 383 | ->with('job_titles') |
384 | ->WhereHas('users', function (Builder $query) use ($id) { | 384 | ->WhereHas('users', function (Builder $query) use ($id) { |
385 | $query->Where('id', $id); | 385 | $query->Where('id', $id); |
386 | }) | 386 | }) |
387 | ->first(); | 387 | ->first(); |
388 | if ($worker->dop_info->count()){ | 388 | if ($worker->dop_info->count()){ |
389 | $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray(); | 389 | $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray(); |
390 | } | 390 | } |
391 | 391 | ||
392 | //dd($worker->dop_info); | 392 | //dd($worker->dop_info); |
393 | 393 | ||
394 | if ($request->has('print')) { | 394 | if ($request->has('print')) { |
395 | dd($Worker); | 395 | dd($Worker); |
396 | } else { | 396 | } else { |
397 | return view('workers.cabinet', compact( 'persent', 'Job_titles', 'stat', | 397 | return view('workers.cabinet', compact( 'persent', 'Job_titles', 'stat', |
398 | 'worker', 'info_blocks', 'status_work', 'additional_document_statuses' | 398 | 'worker', 'info_blocks', 'status_work', 'additional_document_statuses' |
399 | )); | 399 | )); |
400 | } | 400 | } |
401 | } | 401 | } |
402 | 402 | ||
403 | // Сохранение данных | 403 | // Сохранение данных |
404 | public function cabinet_save(Worker $worker, Request $request) | 404 | public function cabinet_save(Worker $worker, Request $request) |
405 | { | 405 | { |
406 | $id = $worker->id; | 406 | $id = $worker->id; |
407 | $params = $request->all(); | 407 | $params = $request->all(); |
408 | $job_title_id = $request->get('job_title_id'); | 408 | $job_title_id = $request->get('job_title_id'); |
409 | 409 | ||
410 | $rules = [ | 410 | $rules = [ |
411 | 'surname' => ['required', 'string', 'max:255'], | 411 | 'surname' => ['required', 'string', 'max:255'], |
412 | 'name_man' => ['required', 'string', 'max:255'], | 412 | 'name_man' => ['required', 'string', 'max:255'], |
413 | 'email' => ['required', 'string', 'email', 'max:255'], | 413 | 'email' => ['required', 'string', 'email', 'max:255'], |
414 | 414 | ||
415 | ]; | 415 | ]; |
416 | 416 | ||
417 | $messages = [ | 417 | $messages = [ |
418 | 'required' => 'Укажите обязательное поле', | 418 | 'required' => 'Укажите обязательное поле', |
419 | 'min' => [ | 419 | 'min' => [ |
420 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 420 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
421 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 421 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
422 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 422 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
423 | ], | 423 | ], |
424 | 'max' => [ | 424 | 'max' => [ |
425 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 425 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
426 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 426 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
427 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 427 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
428 | ] | 428 | ] |
429 | ]; | 429 | ]; |
430 | 430 | ||
431 | $validator = Validator::make($params, $rules, $messages); | 431 | $validator = Validator::make($params, $rules, $messages); |
432 | 432 | ||
433 | if ($validator->fails()) { | 433 | if ($validator->fails()) { |
434 | return redirect()->route('worker.cabinet')->withErrors($validator); | 434 | return redirect()->route('worker.cabinet')->withErrors($validator); |
435 | } else { | 435 | } else { |
436 | 436 | ||
437 | if ($request->has('photo')) { | 437 | if ($request->has('photo')) { |
438 | if (!empty($worker->photo)) { | 438 | if (!empty($worker->photo)) { |
439 | Storage::delete($worker->photo); | 439 | Storage::delete($worker->photo); |
440 | } | 440 | } |
441 | $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); | 441 | $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); |
442 | } | 442 | } |
443 | 443 | ||
444 | if ($request->has('file')) { | 444 | if ($request->has('file')) { |
445 | if (!empty($worker->file)) { | 445 | if (!empty($worker->file)) { |
446 | Storage::delete($worker->file); | 446 | Storage::delete($worker->file); |
447 | } | 447 | } |
448 | $params['file'] = $request->file('file')->store("worker/$id", 'public'); | 448 | $params['file'] = $request->file('file')->store("worker/$id", 'public'); |
449 | } | 449 | } |
450 | 450 | ||
451 | $worker->update($params); | 451 | $worker->update($params); |
452 | $use = User::find($worker->user_id); | 452 | $use = User::find($worker->user_id); |
453 | $use->surname = $request->get('surname'); | 453 | $use->surname = $request->get('surname'); |
454 | $use->name_man = $request->get('name_man'); | 454 | $use->name_man = $request->get('name_man'); |
455 | $use->surname2 = $request->get('surname2'); | 455 | $use->surname2 = $request->get('surname2'); |
456 | 456 | ||
457 | $use->save(); | 457 | $use->save(); |
458 | $worker->job_titles()->sync($job_title_id); | 458 | $worker->job_titles()->sync($job_title_id); |
459 | 459 | ||
460 | return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); | 460 | return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); |
461 | } | 461 | } |
462 | } | 462 | } |
463 | 463 | ||
464 | public function cabinet_save_foto(Worker $worker, Request $request){ | 464 | public function cabinet_save_foto(Worker $worker, Request $request){ |
465 | $params = ['photo' => null]; | 465 | $params = ['photo' => null]; |
466 | 466 | ||
467 | if ($request->has('photo')) { | 467 | if ($request->has('photo')) { |
468 | if (!empty($worker->photo)) { | 468 | if (!empty($worker->photo)) { |
469 | Storage::delete($worker->photo); | 469 | Storage::delete($worker->photo); |
470 | } | 470 | } |
471 | $params['photo'] = $request->file('photo')->store("worker/$worker->id", 'public'); | 471 | $params['photo'] = $request->file('photo')->store("worker/$worker->id", 'public'); |
472 | } | 472 | } |
473 | 473 | ||
474 | if ($request->has('file')) { | 474 | if ($request->has('file')) { |
475 | if (!empty($worker->file)) { | 475 | if (!empty($worker->file)) { |
476 | Storage::delete($worker->file); | 476 | Storage::delete($worker->file); |
477 | } | 477 | } |
478 | $params['file'] = $request->file('file')->store("worker/$worker->id", 'public'); | 478 | $params['file'] = $request->file('file')->store("worker/$worker->id", 'public'); |
479 | } | 479 | } |
480 | 480 | ||
481 | $worker->update($params); | 481 | $worker->update($params); |
482 | 482 | ||
483 | return redirect()->route('worker.cabinet'); | 483 | return redirect()->route('worker.cabinet'); |
484 | } | 484 | } |
485 | 485 | ||
486 | // Сообщения данные | 486 | // Сообщения данные |
487 | public function messages($type_message) | 487 | public function messages($type_message) |
488 | { | 488 | { |
489 | $user_id = Auth()->user()->id; | 489 | $user_id = Auth()->user()->id; |
490 | 490 | ||
491 | $chats = Chat::get_user_chats($user_id); | 491 | $chats = Chat::get_user_chats($user_id); |
492 | $admin_chat = Chat::get_user_admin_chat($user_id); | 492 | $admin_chat = Chat::get_user_admin_chat($user_id); |
493 | $user_type = 'worker'; | 493 | $user_type = 'worker'; |
494 | 494 | ||
495 | return view('workers.messages', compact('chats', 'admin_chat','user_id', 'user_type')); | 495 | return view('workers.messages', compact('chats', 'admin_chat','user_id', 'user_type')); |
496 | } | 496 | } |
497 | 497 | ||
498 | // Избранный | 498 | // Избранный |
499 | public function favorite() | 499 | public function favorite() |
500 | { | 500 | { |
501 | return view('workers.favorite'); | 501 | return view('workers.favorite'); |
502 | } | 502 | } |
503 | 503 | ||
504 | // Сменить пароль | 504 | // Сменить пароль |
505 | public function new_password() | 505 | public function new_password() |
506 | { | 506 | { |
507 | $email = Auth()->user()->email; | 507 | $email = Auth()->user()->email; |
508 | return view('workers.new_password', compact('email')); | 508 | return view('workers.new_password', compact('email')); |
509 | } | 509 | } |
510 | 510 | ||
511 | // Обновление пароля | 511 | // Обновление пароля |
512 | public function save_new_password(Request $request) { | 512 | public function save_new_password(Request $request) { |
513 | $use = Auth()->user(); | 513 | $use = Auth()->user(); |
514 | $request->validate([ | 514 | $request->validate([ |
515 | 'password' => 'required|string', | 515 | 'password' => 'required|string', |
516 | 'new_password' => 'required|string', | 516 | 'new_password' => 'required|string', |
517 | 'new_password2' => 'required|string' | 517 | 'new_password2' => 'required|string' |
518 | ]); | 518 | ]); |
519 | 519 | ||
520 | if ($request->get('new_password') == $request->get('new_password2')) | 520 | if ($request->get('new_password') == $request->get('new_password2')) |
521 | if ($request->get('password') !== $request->get('new_password')) { | 521 | if ($request->get('password') !== $request->get('new_password')) { |
522 | $credentials = $request->only('email', 'password'); | 522 | $credentials = $request->only('email', 'password'); |
523 | if (Auth::attempt($credentials, $request->has('save_me'))) { | 523 | if (Auth::attempt($credentials, $request->has('save_me'))) { |
524 | 524 | ||
525 | if (!is_null($use->email_verified_at)){ | 525 | if (!is_null($use->email_verified_at)){ |
526 | 526 | ||
527 | $user_data = User_Model::find($use->id); | 527 | $user_data = User_Model::find($use->id); |
528 | $user_data->update([ | 528 | $user_data->update([ |
529 | 'password' => Hash::make($request->get('new_password')), | 529 | 'password' => Hash::make($request->get('new_password')), |
530 | 'pubpassword' => base64_encode($request->get('new_password')), | 530 | 'pubpassword' => base64_encode($request->get('new_password')), |
531 | ]); | 531 | ]); |
532 | return redirect() | 532 | return redirect() |
533 | ->route('worker.new_password') | 533 | ->route('worker.new_password') |
534 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 534 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
535 | } | 535 | } |
536 | 536 | ||
537 | return redirect() | 537 | return redirect() |
538 | ->route('worker.new_password') | 538 | ->route('worker.new_password') |
539 | ->withError('Данная учетная запись не было верифицированна!'); | 539 | ->withError('Данная учетная запись не было верифицированна!'); |
540 | } | 540 | } |
541 | } | 541 | } |
542 | 542 | ||
543 | return redirect() | 543 | return redirect() |
544 | ->route('worker.new_password') | 544 | ->route('worker.new_password') |
545 | ->withErrors('Не совпадение данных, обновите пароли!'); | 545 | ->withErrors('Не совпадение данных, обновите пароли!'); |
546 | } | 546 | } |
547 | 547 | ||
548 | // Удаление профиля форма | 548 | // Удаление профиля форма |
549 | public function delete_profile() | 549 | public function delete_profile() |
550 | { | 550 | { |
551 | $login = Auth()->user()->email; | 551 | $login = Auth()->user()->email; |
552 | return view('workers.delete_profile', compact('login')); | 552 | return view('workers.delete_profile', compact('login')); |
553 | } | 553 | } |
554 | 554 | ||
555 | // Удаление профиля код | 555 | // Удаление профиля код |
556 | public function delete_profile_result(Request $request) { | 556 | public function delete_profile_result(Request $request) { |
557 | $Answer = $request->all(); | 557 | $Answer = $request->all(); |
558 | $user_id = Auth()->user()->id; | 558 | $user_id = Auth()->user()->id; |
559 | $request->validate([ | 559 | $request->validate([ |
560 | 'password' => 'required|string', | 560 | 'password' => 'required|string', |
561 | ]); | 561 | ]); |
562 | 562 | ||
563 | $credentials = $request->only('email', 'password'); | 563 | $credentials = $request->only('email', 'password'); |
564 | if (Auth::attempt($credentials)) { | 564 | if (Auth::attempt($credentials)) { |
565 | Auth::logout(); | 565 | Auth::logout(); |
566 | $it = User_Model::find($user_id); | 566 | $it = User_Model::find($user_id); |
567 | $it->delete(); | 567 | $it->delete(); |
568 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 568 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
569 | } else { | 569 | } else { |
570 | return redirect()->route('worker.delete_profile') | 570 | return redirect()->route('worker.delete_profile') |
571 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 571 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
572 | } | 572 | } |
573 | } | 573 | } |
574 | 574 | ||
575 | // Регистрация соискателя | 575 | // Регистрация соискателя |
576 | public function register_worker(Request $request) | 576 | public function register_worker(Request $request) |
577 | { | 577 | { |
578 | $params = $request->all(); | ||
579 | $params['is_worker'] = 1; | ||
580 | |||
581 | $rules = [ | 578 | $rules = [ |
582 | 'surname' => ['required', 'string', 'max:255'], | 579 | 'surname' => ['required', 'string', 'max:255'], |
583 | 'name_man' => ['required', 'string', 'max:255'], | 580 | 'name_man' => ['required', 'string', 'max:255'], |
584 | 'email' => ['required', 'email', 'max:255', 'unique:users'], | 581 | 'email' => ['required', 'email', 'max:255', 'unique:users'], |
585 | 'password' => ['required', 'string', 'min:6'] | 582 | 'password' => ['required', 'string', 'min:6'], |
583 | 'password_confirmation' => ['required', 'same:password'], | ||
584 | 'politik' => ['required', 'accepted'], | ||
585 | 'job_titles' => ['required', 'numeric'] | ||
586 | ]; | 586 | ]; |
587 | 587 | ||
588 | $messages = [ | 588 | $messages = [ |
589 | 'required' => 'Укажите обязательное поле', | 589 | 'required' => 'Укажите обязательное поле', |
590 | 'email' => 'Введите корректный email', | ||
591 | 'unique' => 'Email уже зарегистрирован', | ||
592 | 'same' => 'Пароль и подтверждение пароля не совпадают', | ||
590 | 'min' => [ | 593 | 'min' => [ |
591 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 594 | 'string' => 'Поле должно быть не менее :min символов', |
592 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | ||
593 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | ||
594 | ], | 595 | ], |
595 | 'max' => [ | 596 | 'accepted' => 'Необходимо согласиться с политикой конфиденциальности', |
596 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 597 | 'numeric' => 'Укажите обязательное поле', |
597 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | ||
598 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | ||
599 | ] | ||
600 | ]; | 598 | ]; |
601 | 599 | ||
602 | $email = $request->get('email'); | 600 | $validator = Validator::make($request->all(), $rules, $messages); |
603 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | ||
604 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | ||
605 | } | ||
606 | |||
607 | if ($request->get('password') !== $request->get('confirmed')){ | ||
608 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | ||
609 | } | ||
610 | 601 | ||
611 | if (strlen($request->get('password')) < 6) { | 602 | if ($validator->fails()) { |
612 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | 603 | return response()->json(['ERRORS' => $validator->errors()], 422); |
613 | } | 604 | } |
614 | 605 | ||
615 | if (($request->has('politik')) && ($request->get('politik') == 1)) { | 606 | $params = $request->all(); |
616 | $validator = Validator::make($params, $rules, $messages); | 607 | $params['is_worker'] = 1; |
617 | |||
618 | if ($validator->fails()) { | ||
619 | return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | ||
620 | } | ||
621 | |||
622 | if ($user = $this->create($params)) { | ||
623 | event(new Registered($user)); | ||
624 | return json_encode(Array("REDIRECT" => redirect()->to('/')->getTargetUrl())); | ||
625 | } else { | ||
626 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | ||
627 | } | ||
628 | 608 | ||
629 | } else { | 609 | if ($user = $this->create($params)) { |
630 | return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); | 610 | event(new Registered($user)); |
611 | return response()->json([ | ||
612 | 'REDIRECT' => url('/') | ||
613 | ]); | ||
631 | } | 614 | } |
615 | |||
616 | return response()->json([ | ||
617 | 'ERROR' => 'Произошла ошибка при регистрации. Попробуйте снова.' | ||
618 | ]); | ||
632 | } | 619 | } |
633 | 620 | ||
634 | // Звездная оценка и ответ | 621 | // Звездная оценка и ответ |
635 | public function stars_answer(Request $request) { | 622 | public function stars_answer(Request $request) { |
636 | $params = $request->all(); | 623 | $params = $request->all(); |
637 | $rules = [ | 624 | $rules = [ |
638 | 'message' => ['required', 'string', 'max:255'], | 625 | 'message' => ['required', 'string', 'max:255'], |
639 | ]; | 626 | ]; |
640 | 627 | ||
641 | $messages = [ | 628 | $messages = [ |
642 | 'required' => 'Укажите обязательное поле', | 629 | 'required' => 'Укажите обязательное поле', |
643 | 'min' => [ | 630 | 'min' => [ |
644 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 631 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
645 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 632 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
646 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 633 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
647 | ], | 634 | ], |
648 | 'max' => [ | 635 | 'max' => [ |
649 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 636 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
650 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 637 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
651 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 638 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
652 | ] | 639 | ] |
653 | ]; | 640 | ]; |
654 | $response_worker = ResponseWork::create($params); | 641 | $response_worker = ResponseWork::create($params); |
655 | return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); | 642 | return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); |
656 | } | 643 | } |
657 | 644 | ||
658 | public function TestWorker() | 645 | public function TestWorker() |
659 | { | 646 | { |
660 | $Use = new User(); | 647 | $Use = new User(); |
661 | 648 | ||
662 | $Code_user = $Use->create([ | 649 | $Code_user = $Use->create([ |
663 | 'name' => 'surname name_man', | 650 | 'name' => 'surname name_man', |
664 | 'name_man' => 'name_man', | 651 | 'name_man' => 'name_man', |
665 | 'surname' => 'surname', | 652 | 'surname' => 'surname', |
666 | 'surname2' => 'surname2', | 653 | 'surname2' => 'surname2', |
667 | 'subscribe_email' => '1', | 654 | 'subscribe_email' => '1', |
668 | 'email' => 'email@mail.com', | 655 | 'email' => 'email@mail.com', |
669 | 'telephone' => '1234567890', | 656 | 'telephone' => '1234567890', |
670 | 'password' => Hash::make('password'), | 657 | 'password' => Hash::make('password'), |
671 | 'pubpassword' => base64_encode('password'), | 658 | 'pubpassword' => base64_encode('password'), |
672 | // 'email_verified_at' => Carbon::now(), | 659 | // 'email_verified_at' => Carbon::now(), |
673 | 'is_worker' => 1, | 660 | 'is_worker' => 1, |
674 | ]); | 661 | ]); |
675 | 662 | ||
676 | if ($Code_user->id > 0) { | 663 | if ($Code_user->id > 0) { |
677 | $Worker = new Worker(); | 664 | $Worker = new Worker(); |
678 | $Worker->user_id = $Code_user->id; | 665 | $Worker->user_id = $Code_user->id; |
679 | $Worker->position_work = 1; //'job_titles'; | 666 | $Worker->position_work = 1; //'job_titles'; |
680 | $Worker->email = 'email@email.com'; | 667 | $Worker->email = 'email@email.com'; |
681 | $Worker->telephone = '1234567890'; | 668 | $Worker->telephone = '1234567890'; |
682 | $status = $Worker->save(); | 669 | $status = $Worker->save(); |
683 | 670 | ||
684 | $Title_Worker = new Title_worker(); | 671 | $Title_Worker = new Title_worker(); |
685 | $Title_Worker->worker_id = $Worker->id; | 672 | $Title_Worker->worker_id = $Worker->id; |
686 | $Title_Worker->job_title_id = 1; | 673 | $Title_Worker->job_title_id = 1; |
687 | $Title_Worker->save(); | 674 | $Title_Worker->save(); |
688 | } | 675 | } |
689 | } | 676 | } |
690 | 677 | ||
691 | // Создание пользователя | 678 | // Создание пользователя |
692 | protected function create(array $data) | 679 | protected function create(array $data) |
693 | { | 680 | { |
694 | $Use = new User(); | 681 | $Use = new User(); |
695 | 682 | ||
696 | $Code_user = $Use->create([ | 683 | $Code_user = $Use->create([ |
697 | 'name' => $data['surname']." ".$data['name_man'], | 684 | 'name' => $data['surname']." ".$data['name_man'], |
698 | 'name_man' => $data['name_man'], | 685 | 'name_man' => $data['name_man'], |
699 | 'surname' => $data['surname'], | 686 | 'surname' => $data['surname'], |
700 | 'surname2' => $data['surname2'], | 687 | 'surname2' => $data['surname2'], |
701 | 'subscribe_email' => $data['email'], | 688 | 'subscribe_email' => $data['email'], |
702 | 'email' => $data['email'], | 689 | 'email' => $data['email'], |
703 | 'telephone' => $data['telephone'], | 690 | 'telephone' => $data['telephone'], |
704 | 'password' => Hash::make($data['password']), | 691 | 'password' => Hash::make($data['password']), |
705 | 'pubpassword' => base64_encode($data['password']), | 692 | 'pubpassword' => base64_encode($data['password']), |
706 | 'is_worker' => $data['is_worker'], | 693 | 'is_worker' => $data['is_worker'], |
707 | ]); | 694 | ]); |
708 | 695 | ||
709 | if ($Code_user->id > 0) { | 696 | if ($Code_user->id > 0) { |
710 | $Worker = new Worker(); | 697 | $Worker = new Worker(); |
711 | $Worker->user_id = $Code_user->id; | 698 | $Worker->user_id = $Code_user->id; |
712 | $Worker->position_work = $data['job_titles'] ?? null; | 699 | $Worker->position_work = $data['job_titles'] ?? null; |
713 | $Worker->email = $data['email']; | 700 | $Worker->email = $data['email']; |
714 | $Worker->telephone = $data['telephone']; | 701 | $Worker->telephone = $data['telephone']; |
715 | $Worker->save(); | 702 | $Worker->save(); |
716 | 703 | ||
717 | if (isset($Worker->id) && !empty($data['job_titles'])) { | 704 | if (isset($Worker->id) && !empty($data['job_titles'])) { |
718 | $existJob = Job_title::query()->find($data['job_titles']); | 705 | $existJob = Job_title::query()->find($data['job_titles']); |
719 | if ($existJob) { | 706 | if ($existJob) { |
720 | $Title_Worker = new Title_worker(); | 707 | $Title_Worker = new Title_worker(); |
721 | $Title_Worker->worker_id = $Worker->id; | 708 | $Title_Worker->worker_id = $Worker->id; |
722 | $Title_Worker->job_title_id = $data['job_titles']; | 709 | $Title_Worker->job_title_id = $data['job_titles']; |
723 | $Title_Worker->save(); | 710 | $Title_Worker->save(); |
724 | } | 711 | } |
725 | 712 | ||
726 | } | 713 | } |
727 | 714 | ||
728 | return $Code_user; | 715 | return $Code_user; |
729 | } | 716 | } |
730 | } | 717 | } |
731 | 718 | ||
732 | // Вакансии избранные | 719 | // Вакансии избранные |
733 | public function colorado(Request $request) { | 720 | public function colorado(Request $request) { |
734 | $Arr = Like_vacancy::Query() | 721 | $Arr = Like_vacancy::Query() |
735 | ->select('code_record') | 722 | ->select('code_record') |
736 | ->where('user_id', Auth::user()->id) | 723 | ->where('user_id', Auth::user()->id) |
737 | ->get(); | 724 | ->get(); |
738 | 725 | ||
739 | if ($Arr->count()) { | 726 | if ($Arr->count()) { |
740 | $A = Array(); | 727 | $A = Array(); |
741 | foreach ($Arr as $it) { | 728 | foreach ($Arr as $it) { |
742 | $A[] = $it->code_record; | 729 | $A[] = $it->code_record; |
743 | } | 730 | } |
744 | 731 | ||
745 | $Query = Ad_employer::query()->whereIn('id', $A); | 732 | $Query = Ad_employer::query()->whereIn('id', $A); |
746 | } else { | 733 | } else { |
747 | $Query = Ad_employer::query()->where('id', '=', '0'); | 734 | $Query = Ad_employer::query()->where('id', '=', '0'); |
748 | } | 735 | } |
749 | 736 | ||
750 | $Query = $Query->with(['jobs', 'cat', 'employer']) | 737 | $Query = $Query->with(['jobs', 'cat', 'employer']) |
751 | ->whereHas('jobs_code', function ($query) use ($request) { | 738 | ->whereHas('jobs_code', function ($query) use ($request) { |
752 | if ($request->ajax()) { | 739 | if ($request->ajax()) { |
753 | if (null !== ($request->get('job'))) { | 740 | if (null !== ($request->get('job'))) { |
754 | $query->where('job_title_id', $request->get('job')); | 741 | $query->where('job_title_id', $request->get('job')); |
755 | } | 742 | } |
756 | } | 743 | } |
757 | }) | 744 | }) |
758 | ->select('ad_employers.*'); | 745 | ->select('ad_employers.*'); |
759 | 746 | ||
760 | if ($request->get('search') !== null) { | 747 | if ($request->get('search') !== null) { |
761 | $search = $request->get('search'); | 748 | $search = $request->get('search'); |
762 | $Query->where('name', 'LIKE', "%$search%"); | 749 | $Query->where('name', 'LIKE', "%$search%"); |
763 | } | 750 | } |
764 | 751 | ||
765 | //dd($Query->get()); | 752 | //dd($Query->get()); |
766 | 753 | ||
767 | $Job_title = Job_title::query()->OrderBy('name')->get(); | 754 | $Job_title = Job_title::query()->OrderBy('name')->get(); |
768 | 755 | ||
769 | $Query_count = $Query->count(); | 756 | $Query_count = $Query->count(); |
770 | 757 | ||
771 | $Query = $Query->OrderBy('updated_at')->paginate(3); | 758 | $Query = $Query->OrderBy('updated_at')->paginate(3); |
772 | 759 | ||
773 | return view('workers.favorite', compact('Query', | 760 | return view('workers.favorite', compact('Query', |
774 | 'Query_count', | 761 | 'Query_count', |
775 | 'Job_title')); | 762 | 'Job_title')); |
776 | 763 | ||
777 | } | 764 | } |
778 | public function pin_chat(Request $request){ | 765 | public function pin_chat(Request $request){ |
779 | $chat_id = $request->get('id'); | 766 | $chat_id = $request->get('id'); |
780 | $is_fixed = $request->get('is_fixed'); | 767 | $is_fixed = $request->get('is_fixed'); |
781 | Chat::pin_chat($chat_id, $is_fixed); | 768 | Chat::pin_chat($chat_id, $is_fixed); |
782 | } | 769 | } |
783 | //Переписка | 770 | //Переписка |
784 | public function dialog(Chat $chat, Request $request) { | 771 | public function dialog(Chat $chat, Request $request) { |
785 | // Получение параметров. | 772 | // Получение параметров. |
786 | if ($request->has('ad_employer')){ | 773 | if ($request->has('ad_employer')){ |
787 | $ad_employer = $request->get('ad_employer'); | 774 | $ad_employer = $request->get('ad_employer'); |
788 | } else { | 775 | } else { |
789 | $ad_employer = 0; | 776 | $ad_employer = 0; |
790 | } | 777 | } |
791 | $supeAdmin=User::superAdmin(); | 778 | $supeAdmin=User::superAdmin(); |
792 | $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first(); | 779 | $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first(); |
793 | $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first(); | 780 | $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first(); |
794 | 781 | ||
795 | $Messages = Chat::get_chat_messages($chat); | 782 | $Messages = Chat::get_chat_messages($chat); |
796 | 783 | ||
797 | Message::where('chat_id_to', '=', $chat->id)->update(['flag_new' => 0]); | 784 | Message::where('chat_id_to', '=', $chat->id)->update(['flag_new' => 0]); |
798 | 785 | ||
799 | return view('workers.dialog', compact('companion', 'sender', 'chat', 'Messages', 'ad_employer','supeAdmin')); | 786 | return view('workers.dialog', compact('companion', 'sender', 'chat', 'Messages', 'ad_employer','supeAdmin')); |
800 | } | 787 | } |
801 | 788 | ||
802 | // Даунылоады | 789 | // Даунылоады |
803 | public function download(Worker $worker) { | 790 | public function download(Worker $worker) { |
804 | $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; | 791 | $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; |
805 | view()->share('house',$arr_house); | 792 | view()->share('house',$arr_house); |
806 | $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); | 793 | $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); |
807 | return $pdf->stream(); | 794 | return $pdf->stream(); |
808 | } | 795 | } |
809 | 796 | ||
810 | // Поднятие анкеты | 797 | // Поднятие анкеты |
811 | public function up(Worker $worker) { | 798 | public function up(Worker $worker) { |
812 | $worker->updated_at = Carbon::now(); | 799 | $worker->updated_at = Carbon::now(); |
813 | $worker->save(); | 800 | $worker->save(); |
814 | // 0 | 801 | // 0 |
815 | return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); | 802 | return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); |
816 | } | 803 | } |
817 | 804 | ||
818 | // Форма сертификате | 805 | // Форма сертификате |
819 | public function new_sertificate(Worker $worker) { | 806 | public function new_sertificate(Worker $worker) { |
820 | return view('workers.sertificate_add', compact('worker')); | 807 | return view('workers.sertificate_add', compact('worker')); |
821 | } | 808 | } |
822 | 809 | ||
823 | // Добавление сертификата | 810 | // Добавление сертификата |
824 | public function add_serificate(SertificationRequest $request) { | 811 | public function add_serificate(SertificationRequest $request) { |
825 | $request->validate([ | 812 | $request->validate([ |
826 | 'name' => 'required|string|max:255', | 813 | 'name' => 'required|string|max:255', |
827 | 'end_begin' => 'required|date|date_format:d.m.Y' | 814 | 'end_begin' => 'required|date|date_format:d.m.Y' |
828 | ], | 815 | ], |
829 | [ | 816 | [ |
830 | 'name' => 'Навание сертификата обязательно для заполнения.', | 817 | 'name' => 'Навание сертификата обязательно для заполнения.', |
831 | 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' | 818 | 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' |
832 | ]); | 819 | ]); |
833 | 820 | ||
834 | $params = $request->all(); | 821 | $params = $request->all(); |
835 | 822 | ||
836 | $end_begin = DateTime::createFromFormat('d.m.Y', $params['end_begin']); | 823 | $end_begin = DateTime::createFromFormat('d.m.Y', $params['end_begin']); |
837 | $params['end_begin'] = $end_begin->format('Y-m-d'); | 824 | $params['end_begin'] = $end_begin->format('Y-m-d'); |
838 | 825 | ||
839 | $Sertificate = new sertification(); | 826 | $Sertificate = new sertification(); |
840 | $Sertificate->create($params); | 827 | $Sertificate->create($params); |
841 | 828 | ||
842 | return response()->json([ | 829 | return response()->json([ |
843 | 'success' => true | 830 | 'success' => true |
844 | ]); | 831 | ]); |
845 | } | 832 | } |
846 | 833 | ||
847 | // Удалить сертификат | 834 | // Удалить сертификат |
848 | public function delete_sertificate(sertification $doc) { | 835 | public function delete_sertificate(sertification $doc) { |
849 | $doc->delete(); | 836 | $doc->delete(); |
850 | 837 | ||
851 | return redirect()->route('worker.cabinet'); | 838 | return redirect()->route('worker.cabinet'); |
852 | } | 839 | } |
853 | 840 | ||
854 | // Редактирование сертификата | 841 | // Редактирование сертификата |
855 | public function edit_sertificate(Worker $worker, sertification $doc) { | 842 | public function edit_sertificate(Worker $worker, sertification $doc) { |
856 | return view('workers.sertificate_edit', compact('doc', 'worker')); | 843 | return view('workers.sertificate_edit', compact('doc', 'worker')); |
857 | } | 844 | } |
858 | 845 | ||
859 | // Редактирование обновление сертификата | 846 | // Редактирование обновление сертификата |
860 | public function update_serificate(SertificationRequest $request, sertification $doc) { | 847 | public function update_serificate(SertificationRequest $request, sertification $doc) { |
861 | $request->validate([ | 848 | $request->validate([ |
862 | 'name' => 'required|string|max:255', | 849 | 'name' => 'required|string|max:255', |
863 | 'end_begin' => 'required|date|date_format:d.m.Y' | 850 | 'end_begin' => 'required|date|date_format:d.m.Y' |
864 | ], | 851 | ], |
865 | [ | 852 | [ |
866 | 'name' => 'Навание сертификата обязательно для заполнения.', | 853 | 'name' => 'Навание сертификата обязательно для заполнения.', |
867 | 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' | 854 | 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' |
868 | ]); | 855 | ]); |
869 | 856 | ||
870 | $all = $request->all(); | 857 | $all = $request->all(); |
871 | 858 | ||
872 | $end_begin = DateTime::createFromFormat('d.m.Y', $all['end_begin']); | 859 | $end_begin = DateTime::createFromFormat('d.m.Y', $all['end_begin']); |
873 | $all['end_begin'] = $end_begin->format('Y-m-d'); | 860 | $all['end_begin'] = $end_begin->format('Y-m-d'); |
874 | 861 | ||
875 | $doc->worker_id = $all['worker_id']; | 862 | $doc->worker_id = $all['worker_id']; |
876 | $doc->name = $all['name']; | 863 | $doc->name = $all['name']; |
877 | $doc->end_begin = $all['end_begin']; | 864 | $doc->end_begin = $all['end_begin']; |
878 | $doc->save(); | 865 | $doc->save(); |
879 | 866 | ||
880 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); | 867 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); |
881 | } | 868 | } |
882 | 869 | ||
883 | public function edit_diploms(Request $request, Worker $worker) { | 870 | public function edit_diploms(Request $request, Worker $worker) { |
884 | $dop_info_data = $request->input('diploms'); | 871 | $dop_info_data = $request->input('diploms'); |
885 | 872 | ||
886 | if (empty($dop_info_data)) { | 873 | if (empty($dop_info_data)) { |
887 | return redirect()->route('worker.additional_documents')->with('error', 'Данные не предоставлены!'); | 874 | return redirect()->route('worker.additional_documents')->with('error', 'Данные не предоставлены!'); |
888 | } | 875 | } |
889 | 876 | ||
890 | foreach ($dop_info_data as $infoblok_id => $status) { | 877 | foreach ($dop_info_data as $infoblok_id => $status) { |
891 | Dop_info::updateOrCreate( | 878 | Dop_info::updateOrCreate( |
892 | ['worker_id' => $worker->id, 'infoblok_id' => $infoblok_id], | 879 | ['worker_id' => $worker->id, 'infoblok_id' => $infoblok_id], |
893 | ['status' => $status] | 880 | ['status' => $status] |
894 | ); | 881 | ); |
895 | } | 882 | } |
896 | 883 | ||
897 | return redirect()->route('worker.additional_documents')->with('success', 'Успешно сохранено!'); | 884 | return redirect()->route('worker.additional_documents')->with('success', 'Успешно сохранено!'); |
898 | } | 885 | } |
899 | public function subscribe() { | 886 | public function subscribe() { |
900 | 887 | ||
901 | $user= Auth::user(); | 888 | $user= Auth::user(); |
902 | return view('workers.subcribe',compact('user')); | 889 | return view('workers.subcribe',compact('user')); |
903 | } | 890 | } |
904 | 891 | ||
905 | //Установка уведомлений сохранение | 892 | //Установка уведомлений сохранение |
906 | public function save_subscribe(Request $request) { | 893 | public function save_subscribe(Request $request) { |
907 | 894 | ||
908 | $msg = $request->validate([ | 895 | $msg = $request->validate([ |
909 | 'email' => 'required|email|min:5|max:255', | 896 | 'email' => 'required|email|min:5|max:255', |
910 | ]); | 897 | ]); |
911 | 898 | ||
912 | $user= Auth::user(); | 899 | $user= Auth::user(); |
913 | 900 | ||
914 | User_Model::updateOrCreate( | 901 | User_Model::updateOrCreate( |
915 | ['id' => $user->id], | 902 | ['id' => $user->id], |
916 | ['subscribe_email' => $request->email, | 903 | ['subscribe_email' => $request->email, |
917 | 'subscribe' => request()->has('email_msg') && request('email_msg') === 'on' ? 1 : 0 | 904 | 'subscribe' => request()->has('email_msg') && request('email_msg') === 'on' ? 1 : 0 |
918 | ] | 905 | ] |
919 | ); | 906 | ); |
920 | return redirect()->route('worker.subscribe')->with('success', 'Ваши изменения успешно сохранены'); | 907 | return redirect()->route('worker.subscribe')->with('success', 'Ваши изменения успешно сохранены'); |
921 | 908 | ||
922 | } | 909 | } |
923 | public function delete_add_diplom(Request $request, Worker $worker) { | 910 | public function delete_add_diplom(Request $request, Worker $worker) { |
924 | $infoblok_id = $request->get('infoblok_id'); | 911 | $infoblok_id = $request->get('infoblok_id'); |
925 | 912 | ||
926 | if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) | 913 | if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) |
927 | $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); | 914 | $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); |
928 | else { | 915 | else { |
929 | $params['infoblok_id'] = $infoblok_id; | 916 | $params['infoblok_id'] = $infoblok_id; |
930 | $params['worker_id'] = $worker->id; | 917 | $params['worker_id'] = $worker->id; |
931 | $params['status'] = $request->get('val'); | 918 | $params['status'] = $request->get('val'); |
932 | $id = Dop_info::create($params); | 919 | $id = Dop_info::create($params); |
933 | //$id = $worker->infobloks()->sync([$infoblok_id]); | 920 | //$id = $worker->infobloks()->sync([$infoblok_id]); |
934 | } | 921 | } |
935 | 922 | ||
936 | //$Infoblocks = infobloks::query()->get(); | 923 | //$Infoblocks = infobloks::query()->get(); |
937 | return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); | 924 | return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); |
938 | } | 925 | } |
939 | 926 | ||
940 | 927 | ||
941 | 928 | ||
942 | // Добавление диплома | 929 | // Добавление диплома |
943 | public function add_diplom_ajax(Request $request) { | 930 | public function add_diplom_ajax(Request $request) { |
944 | // конец | 931 | // конец |
945 | $params = $request->all(); | 932 | $params = $request->all(); |
946 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); | 933 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); |
947 | 934 | ||
948 | if ($count == 0) $dop_info = Dop_info::create($params); | 935 | if ($count == 0) $dop_info = Dop_info::create($params); |
949 | $Infoblocks = infobloks::query()->get(); | 936 | $Infoblocks = infobloks::query()->get(); |
950 | $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); | 937 | $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); |
951 | $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); | 938 | $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); |
952 | return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); | 939 | return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); |
953 | } | 940 | } |
954 | 941 | ||
955 | // Добавление диплома без ajax | 942 | // Добавление диплома без ajax |
956 | public function add_diplom(Worker $worker) { | 943 | public function add_diplom(Worker $worker) { |
957 | $worker_id = $worker->id; | 944 | $worker_id = $worker->id; |
958 | $Infoblocks = infobloks::query()->get(); | 945 | $Infoblocks = infobloks::query()->get(); |
959 | return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); | 946 | return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); |
960 | } | 947 | } |
961 | // Сохранить | 948 | // Сохранить |
962 | // Сохраняю диплом | 949 | // Сохраняю диплом |
963 | public function add_diplom_save(Request $request) { | 950 | public function add_diplom_save(Request $request) { |
964 | $params = $request->all(); | 951 | $params = $request->all(); |
965 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); | 952 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); |
966 | if ($count == 0) $dop_info = Dop_info::create($params); | 953 | if ($count == 0) $dop_info = Dop_info::create($params); |
967 | return redirect()->route('worker.cabinet'); | 954 | return redirect()->route('worker.cabinet'); |
968 | } | 955 | } |
969 | 956 | ||
970 | // Добавление стандартного документа | 957 | // Добавление стандартного документа |
971 | public function add_document(Worker $worker) { | 958 | public function add_document(Worker $worker) { |
972 | return view('workers.docs', compact('worker')); | 959 | return view('workers.docs', compact('worker')); |
973 | } | 960 | } |
974 | 961 | ||
975 | //Сохранение стандартого документа | 962 | //Сохранение стандартого документа |
976 | public function add_document_save(DocumentsRequest $request) { | 963 | public function add_document_save(DocumentsRequest $request) { |
977 | $params = $request->all(); | 964 | $params = $request->all(); |
978 | place_works::create($params); | 965 | place_works::create($params); |
979 | return response()->json(['success' => true]); | 966 | return response()->json(['success' => true]); |
980 | } | 967 | } |
981 | 968 | ||
982 | // Редактирование документа | 969 | // Редактирование документа |
983 | public function edit_document(place_works $doc, Worker $worker) { | 970 | public function edit_document(place_works $doc, Worker $worker) { |
984 | 971 | ||
985 | return view('workers.docs-edit', compact('doc', 'worker')); | 972 | return view('workers.docs-edit', compact('doc', 'worker')); |
986 | } | 973 | } |
987 | 974 | ||
988 | //Сохранение отредактированного документа | 975 | //Сохранение отредактированного документа |
989 | public function edit_document_save(DocumentsRequest $request, place_works $doc) { | 976 | public function edit_document_save(DocumentsRequest $request, place_works $doc) { |
990 | $params = $request->all(); | 977 | $params = $request->all(); |
991 | $doc->update($params); | 978 | $doc->update($params); |
992 | 979 | ||
993 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); | 980 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); |
994 | } | 981 | } |
995 | 982 | ||
996 | // Удаление документа | 983 | // Удаление документа |
997 | public function delete_document(place_works $doc) { | 984 | public function delete_document(place_works $doc) { |
998 | $doc->delete(); | 985 | $doc->delete(); |
999 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); | 986 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); |
1000 | } | 987 | } |
1001 | 988 | ||
1002 | //Отправка нового сообщения | 989 | //Отправка нового сообщения |
1003 | public function new_message(Request $request) | 990 | public function new_message(Request $request) |
1004 | { | 991 | { |
1005 | $params = $request->all(); | 992 | $params = $request->all(); |
1006 | 993 | ||
1007 | $id = $params['user_from']; | 994 | $id = $params['user_from']; |
1008 | 995 | ||
1009 | Message::add_message( | 996 | Message::add_message( |
1010 | $request, | 997 | $request, |
1011 | $params['user_from'], | 998 | $params['user_from'], |
1012 | $params['user_to'], | 999 | $params['user_to'], |
1013 | [ | 1000 | [ |
1014 | 'text' => $params['comment'] ?? null, | 1001 | 'text' => $params['comment'] ?? null, |
1015 | 'ad_employer_id' => $params['vacancy'], | 1002 | 'ad_employer_id' => $params['vacancy'], |
1016 | 'flag_new' => 1 | 1003 | 'flag_new' => 1 |
1017 | ], | 1004 | ], |
1018 | file_store_path: "worker/$id" | 1005 | file_store_path: "worker/$id" |
1019 | ); | 1006 | ); |
1020 | 1007 | ||
1021 | if ($request->ajax()) { | 1008 | if ($request->ajax()) { |
1022 | return response([]); | 1009 | return response([]); |
1023 | } | 1010 | } |
1024 | return redirect()->back(); | 1011 | return redirect()->back(); |
1025 | } | 1012 | } |
1026 | 1013 | ||
1027 | 1014 | ||
1028 | public function test123(Request $request) { | 1015 | public function test123(Request $request) { |
1029 | $params = $request->all(); | 1016 | $params = $request->all(); |
1030 | $user1 = $params['user_id']; | 1017 | $user1 = $params['user_id']; |
1031 | $user2 = $params['to_user_id']; | 1018 | $user2 = $params['to_user_id']; |
1032 | 1019 | ||
1033 | $rules = [ | 1020 | $rules = [ |
1034 | 'text' => 'nullable|required_without:file|min:1|max:150000', | 1021 | 'text' => 'nullable|required_without:file|min:1|max:150000', |
1035 | 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' | 1022 | 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' |
1036 | ]; | 1023 | ]; |
1037 | $messages = [ | 1024 | $messages = [ |
1038 | 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', | 1025 | 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', |
1039 | 'min' => [ | 1026 | 'min' => [ |
1040 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 1027 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
1041 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 1028 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
1042 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 1029 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
1043 | ], | 1030 | ], |
1044 | 'max' => [ | 1031 | 'max' => [ |
1045 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 1032 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
1046 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 1033 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
1047 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 1034 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
1048 | ] | 1035 | ] |
1049 | ]; | 1036 | ]; |
1050 | 1037 | ||
1051 | $validator = Validator::make($request->all(), $rules, $messages); | 1038 | $validator = Validator::make($request->all(), $rules, $messages); |
1052 | 1039 | ||
1053 | if ($validator->fails()) { | 1040 | if ($validator->fails()) { |
1054 | $chat = Chat::where('user_id', $user1) | 1041 | $chat = Chat::where('user_id', $user1) |
1055 | ->where('to_user_id', $user2) | 1042 | ->where('to_user_id', $user2) |
1056 | ->where('is_removed', 0) | 1043 | ->where('is_removed', 0) |
1057 | ->first(); | 1044 | ->first(); |
1058 | 1045 | ||
1059 | if ($chat->id){ | 1046 | if ($chat->id){ |
1060 | return redirect()->route('worker.dialog', ['chat' => $chat->id])->withErrors($validator); | 1047 | return redirect()->route('worker.dialog', ['chat' => $chat->id])->withErrors($validator); |
1061 | } else { | 1048 | } else { |
1062 | return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); | 1049 | return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); |
1063 | } | 1050 | } |
1064 | } else { | 1051 | } else { |
1065 | $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); | 1052 | $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); |
1066 | 1053 | ||
1067 | //dd('new message', $new_message); | 1054 | //dd('new message', $new_message); |
1068 | return redirect()->route('worker.dialog', ['chat' => $new_message->chat_id_from]); | 1055 | return redirect()->route('worker.dialog', ['chat' => $new_message->chat_id_from]); |
1069 | } | 1056 | } |
1070 | } | 1057 | } |
1071 | 1058 | ||
1072 | // Информация о предыдущих компаниях | 1059 | // Информация о предыдущих компаниях |
1073 | public function new_prev_company(Worker $worker) { | 1060 | public function new_prev_company(Worker $worker) { |
1074 | return view('workers.prev_company_form', compact('worker')); | 1061 | return view('workers.prev_company_form', compact('worker')); |
1075 | } | 1062 | } |
1076 | 1063 | ||
1077 | // Добавление контакта компании | 1064 | // Добавление контакта компании |
1078 | public function add_prev_company(PrevCompanyRequest $request) { | 1065 | public function add_prev_company(PrevCompanyRequest $request) { |
1079 | // Возвращение параметров | 1066 | // Возвращение параметров |
1080 | $all = $request->all(); | 1067 | $all = $request->all(); |
1081 | PrevCompany::create($all); | 1068 | PrevCompany::create($all); |
1082 | 1069 | ||
1083 | return response()->json(['success' => true]); | 1070 | return response()->json(['success' => true]); |
1084 | } | 1071 | } |
1085 | 1072 | ||
1086 | // Редактирование контакта компании | 1073 | // Редактирование контакта компании |
1087 | public function edit_prev_company(PrevCompany $doc, Worker $worker) { | 1074 | public function edit_prev_company(PrevCompany $doc, Worker $worker) { |
1088 | return view('workers.prev_company_edit_form', compact('doc', 'worker')); | 1075 | return view('workers.prev_company_edit_form', compact('doc', 'worker')); |
1089 | } | 1076 | } |
1090 | 1077 | ||
1091 | //Сохранение редактирования контакта компании | 1078 | //Сохранение редактирования контакта компании |
1092 | public function update_prev_company(PrevCompany $doc, Request $request){ | 1079 | public function update_prev_company(PrevCompany $doc, Request $request){ |
1093 | $all = $request->all(); | 1080 | $all = $request->all(); |
1094 | $doc->update($all); | 1081 | $doc->update($all); |
1095 | 1082 | ||
1096 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); | 1083 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); |
1097 | } | 1084 | } |
1098 | 1085 | ||
1099 | // Удаление контакта предыдущей компании | 1086 | // Удаление контакта предыдущей компании |
1100 | public function delete_prev_company(PrevCompany $doc) { | 1087 | public function delete_prev_company(PrevCompany $doc) { |
1101 | $doc->delete(); | 1088 | $doc->delete(); |
1102 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); | 1089 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); |
1103 | } | 1090 | } |
1104 | 1091 | ||
1105 | public function autoresponder() | 1092 | public function autoresponder() |
1106 | { | 1093 | { |
1107 | $user = Auth::user(); | 1094 | $user = Auth::user(); |
1108 | return view('workers.autoresponder', compact('user')); | 1095 | return view('workers.autoresponder', compact('user')); |
1109 | } | 1096 | } |
1110 | 1097 | ||
1111 | public function autoresponderSave(Request $request): RedirectResponse | 1098 | public function autoresponderSave(Request $request): RedirectResponse |
1112 | { | 1099 | { |
1113 | /** @var Employer $employer */ | 1100 | /** @var Employer $employer */ |
1114 | $employer = Auth::user(); | 1101 | $employer = Auth::user(); |
1115 | $employer->autoresponder = $request->get('autoresponder', false) === 'on'; | 1102 | $employer->autoresponder = $request->get('autoresponder', false) === 'on'; |
1116 | $employer->autoresponder_message = $request->get('autoresponder_message'); | 1103 | $employer->autoresponder_message = $request->get('autoresponder_message'); |
1117 | $employer->save(); | 1104 | $employer->save(); |
1118 | 1105 | ||
1119 | return redirect(route('worker.autoresponder')); | 1106 | return redirect(route('worker.autoresponder')); |
1120 | } | 1107 | } |
1121 | /** | 1108 | /** |
1122 | * @throws JsonException | 1109 | * @throws JsonException |
1123 | */ | 1110 | */ |
1124 | public function resumeAutoLiftForm(): View | 1111 | public function resumeAutoLiftForm(): View |
1125 | { | 1112 | { |
1126 | $worker = Auth::user()->workers[0]; | 1113 | $worker = Auth::user()->workers[0]; |
1127 | 1114 | ||
1128 | $options = $worker->autoliftOptions ?? new WorkerAutoliftOption(); | 1115 | $options = $worker->autoliftOptions ?? new WorkerAutoliftOption(); |
1129 | 1116 | ||
1130 | return view('workers.resume_autolift', compact('worker', 'options')); | 1117 | return view('workers.resume_autolift', compact('worker', 'options')); |
1131 | } | 1118 | } |
1132 | 1119 | ||
1133 | /** | 1120 | /** |
1134 | * @throws JsonException | 1121 | * @throws JsonException |
1135 | */ | 1122 | */ |
1136 | public function resumeAutoLiftSave(Request $request) | 1123 | public function resumeAutoLiftSave(Request $request) |
1137 | { | 1124 | { |
1138 | $worker = Auth::user()->workers[0]; | 1125 | $worker = Auth::user()->workers[0]; |
1139 | 1126 | ||
1140 | $worker->autoliftOptions()->updateOrCreate( | 1127 | $worker->autoliftOptions()->updateOrCreate( |
1141 | [ | 1128 | [ |
1142 | 'worker_id' => $worker->id, | 1129 | 'worker_id' => $worker->id, |
1143 | ], | 1130 | ], |
1144 | [ | 1131 | [ |
1145 | 'is_enabled' => $request->get('is_enabled') === 'true', | 1132 | 'is_enabled' => $request->get('is_enabled') === 'true', |
1146 | 'times_per_day' => $request->get('times_per_day'), | 1133 | 'times_per_day' => $request->get('times_per_day'), |
1147 | 'days_repeat' => $request->get('days_repeat'), | 1134 | 'days_repeat' => $request->get('days_repeat'), |
public/css/general.css
1 | /* Диалог модал */ | 1 | /* Диалог модал */ |
2 | .modal-dialog{ | 2 | .modal-dialog{ |
3 | border-radius: 10px; | 3 | border-radius: 10px; |
4 | } | 4 | } |
5 | .modal-dialog .modal-dialog-footer{ | 5 | .modal-dialog .modal-dialog-footer{ |
6 | display: flex; | 6 | display: flex; |
7 | justify-content: space-between; | 7 | justify-content: space-between; |
8 | } | 8 | } |
9 | .modal-dialog .modal-dialog-footer.center{ | 9 | .modal-dialog .modal-dialog-footer.center{ |
10 | display: flex; | 10 | display: flex; |
11 | justify-content: center; | 11 | justify-content: center; |
12 | } | 12 | } |
13 | .modal-dialog .modal-dialog-title h2{ | 13 | .modal-dialog .modal-dialog-title h2{ |
14 | font-weight: bold; | 14 | font-weight: bold; |
15 | font-size: 24px; | 15 | font-size: 24px; |
16 | text-align: center; | 16 | text-align: center; |
17 | } | 17 | } |
18 | .modal-dialog .modal-dialog-body{ | 18 | .modal-dialog .modal-dialog-body{ |
19 | padding-top: 20px; | 19 | padding-top: 20px; |
20 | padding-bottom: 20px; | 20 | padding-bottom: 20px; |
21 | } | 21 | } |
22 | .modal-dialog .modal-dialog-footer .button-admin{ | 22 | .modal-dialog .modal-dialog-footer .button-admin{ |
23 | padding: 5px 10px; | 23 | padding: 5px 10px; |
24 | border: 1px #000 solid; | 24 | border: 1px #000 solid; |
25 | border-radius: 8px; | 25 | border-radius: 8px; |
26 | } | 26 | } |
27 | /* Конец Диалог модал */ | 27 | /* Конец Диалог модал */ |
28 | 28 | ||
29 | .button-loader { | 29 | .button-loader { |
30 | display: inline-block; | 30 | display: inline-block; |
31 | border: 2px solid #f3f3f3; | 31 | border: 2px solid #f3f3f3; |
32 | -webkit-animation: spin 1s linear infinite; | 32 | -webkit-animation: spin 1s linear infinite; |
33 | animation: spin 1s linear infinite; | 33 | animation: spin 1s linear infinite; |
34 | border-top: 2px solid #555; | 34 | border-top: 2px solid #555; |
35 | border-radius: 50%; | 35 | border-radius: 50%; |
36 | width: 20px; | 36 | width: 20px; |
37 | height: 20px; | 37 | height: 20px; |
38 | margin-right: 10px; | 38 | margin-right: 10px; |
39 | } | 39 | } |
40 | @keyframes spin { | 40 | @keyframes spin { |
41 | 0% { transform: rotate(0deg); } | 41 | 0% { transform: rotate(0deg); } |
42 | 100% { transform: rotate(360deg); } | 42 | 100% { transform: rotate(360deg); } |
43 | } | 43 | } |
44 | .error-block{ | 44 | .error-block{ |
45 | color:red; | 45 | color:red; |
46 | padding: 0; | 46 | padding: 0; |
47 | width: 100%; | 47 | width: 100%; |
48 | } | 48 | } |
49 | 49 | ||
50 | .review-image-modal{ | 50 | .review-image-modal{ |
51 | cursor: pointer; | 51 | cursor: pointer; |
52 | } | 52 | } |
53 | |||
54 | .error-message, .employer_error-message { | ||
55 | margin-top: 5px; | ||
56 | font-weight: bold; | ||
57 | } | ||
58 | |||
59 | #captcha_error, #captcha_employer_error { | ||
60 | margin-top: 0; | ||
61 | margin-bottom: 15px; | ||
62 | } | ||
53 | 63 |
resources/views/js/captha.blade.php
1 | <script> | 1 | <script> |
2 | var code; | 2 | var code; |
3 | var code2; | 3 | var code2; |
4 | 4 | ||
5 | function createCaptcha() { | 5 | function createCaptcha() { |
6 | //clear the contents of captcha div first | 6 | //clear the contents of captcha div first |
7 | var captha1 = $('#captcha1').html(); | 7 | var captha1 = $('#captcha1').html(); |
8 | var captha2 = $('#captcha2').html(); | 8 | var captha2 = $('#captcha2').html(); |
9 | 9 | ||
10 | document.getElementById('captcha1').innerHTML = ""; | 10 | document.getElementById('captcha1').innerHTML = ""; |
11 | document.getElementById('captcha2').innerHTML = ""; | 11 | document.getElementById('captcha2').innerHTML = ""; |
12 | var charsArray = | 12 | var charsArray = |
13 | "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*"; | 13 | "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*"; |
14 | var lengthOtp = 6; | 14 | var lengthOtp = 6; |
15 | var captcha = []; | 15 | var captcha = []; |
16 | for (var i = 0; i < lengthOtp; i++) { | 16 | for (var i = 0; i < lengthOtp; i++) { |
17 | //below code will not allow Repetition of Characters | 17 | //below code will not allow Repetition of Characters |
18 | var index = Math.floor(Math.random() * charsArray.length + 1); //get the next character from the array | 18 | var index = Math.floor(Math.random() * charsArray.length + 1); //get the next character from the array |
19 | if (captcha.indexOf(charsArray[index]) == -1) | 19 | if (captcha.indexOf(charsArray[index]) == -1) |
20 | captcha.push(charsArray[index]); | 20 | captcha.push(charsArray[index]); |
21 | else i--; | 21 | else i--; |
22 | } | 22 | } |
23 | var canv = document.createElement("canvas"); | 23 | var canv = document.createElement("canvas"); |
24 | canv.id = "captcha"; | 24 | canv.id = "captcha"; |
25 | canv.width = 100; | 25 | canv.width = 100; |
26 | canv.height = 50; | 26 | canv.height = 50; |
27 | var ctx = canv.getContext("2d"); | 27 | var ctx = canv.getContext("2d"); |
28 | ctx.font = "25px Georgia"; | 28 | ctx.font = "25px Georgia"; |
29 | ctx.strokeText(captcha.join(""), 0, 30); | 29 | ctx.strokeText(captcha.join(""), 0, 30); |
30 | //storing captcha so that can validate you can save it somewhere else according to your specific requirements | 30 | //storing captcha so that can validate you can save it somewhere else according to your specific requirements |
31 | code = captcha.join(""); | 31 | code = captcha.join(""); |
32 | 32 | ||
33 | document.getElementById("captcha1").appendChild(canv); | 33 | document.getElementById("captcha1").appendChild(canv); |
34 | // adds the canvas to the body element | 34 | // adds the canvas to the body element |
35 | 35 | ||
36 | createCaptcha2() | 36 | createCaptcha2() |
37 | } | 37 | } |
38 | 38 | ||
39 | function createCaptcha2() { | 39 | function createCaptcha2() { |
40 | //clear the contents of captcha div first | 40 | //clear the contents of captcha div first |
41 | document.getElementById('captcha2').innerHTML = ""; | 41 | document.getElementById('captcha2').innerHTML = ""; |
42 | var charsArray = | 42 | var charsArray = |
43 | "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*"; | 43 | "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*"; |
44 | var lengthOtp = 6; | 44 | var lengthOtp = 6; |
45 | var captcha = []; | 45 | var captcha = []; |
46 | for (var i = 0; i < lengthOtp; i++) { | 46 | for (var i = 0; i < lengthOtp; i++) { |
47 | //below code will not allow Repetition of Characters | 47 | //below code will not allow Repetition of Characters |
48 | var index = Math.floor(Math.random() * charsArray.length + 1); //get the next character from the array | 48 | var index = Math.floor(Math.random() * charsArray.length + 1); //get the next character from the array |
49 | if (captcha.indexOf(charsArray[index]) == -1) | 49 | if (captcha.indexOf(charsArray[index]) == -1) |
50 | captcha.push(charsArray[index]); | 50 | captcha.push(charsArray[index]); |
51 | else i--; | 51 | else i--; |
52 | } | 52 | } |
53 | var canv = document.createElement("canvas"); | 53 | var canv = document.createElement("canvas"); |
54 | canv.id = "captcha"; | 54 | canv.id = "captcha"; |
55 | canv.width = 100; | 55 | canv.width = 100; |
56 | canv.height = 50; | 56 | canv.height = 50; |
57 | var ctx = canv.getContext("2d"); | 57 | var ctx = canv.getContext("2d"); |
58 | ctx.font = "25px Georgia"; | 58 | ctx.font = "25px Georgia"; |
59 | ctx.strokeText(captcha.join(""), 0, 30); | 59 | ctx.strokeText(captcha.join(""), 0, 30); |
60 | //storing captcha so that can validate you can save it somewhere else according to your specific requirements | 60 | //storing captcha so that can validate you can save it somewhere else according to your specific requirements |
61 | code2 = captcha.join(""); | 61 | code2 = captcha.join(""); |
62 | 62 | ||
63 | document.getElementById("captcha2").appendChild(canv); | 63 | document.getElementById("captcha2").appendChild(canv); |
64 | // adds the canvas to the body element | 64 | // adds the canvas to the body element |
65 | } | 65 | } |
66 | 66 | ||
67 | function validateCaptcha() { | 67 | function validateCaptcha() { |
68 | if (document.getElementById("cpatchaTextBox").value == code) { | 68 | if (document.getElementById("cpatchaTextBox").value == code) { |
69 | console.log('Валидная капча 1!'); | 69 | console.log('Валидная капча 1!'); |
70 | }else{ | 70 | }else{ |
71 | alert("Неверная капча! Повторите вновь"); | 71 | // alert("Неверная капча! Повторите вновь"); |
72 | createCaptcha(); | 72 | createCaptcha(); |
73 | } | 73 | } |
74 | } | 74 | } |
75 | 75 | ||
76 | function validateCaptcha2() { | 76 | function validateCaptcha2() { |
77 | if (document.getElementById("cpatchaTextBox2").value == code2) { | 77 | if (document.getElementById("cpatchaTextBox2").value == code2) { |
78 | console.log('Валидная капча 2!'); | 78 | console.log('Валидная капча 2!'); |
79 | }else{ | 79 | }else{ |
80 | alert("Неверная капча! Повторите вновь"); | 80 | // alert("Неверная капча! Повторите вновь"); |
81 | createCaptcha(); | 81 | createCaptcha(); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | </script> | 84 | </script> |
85 | 85 | ||
86 | <script> | 86 | <script> |
87 | $(document).ready(function() { | 87 | $(document).ready(function() { |
88 | $('#Reloadcapcha1').on('click', function() { | 88 | $('#Reloadcapcha1').on('click', function() { |
89 | console.log('click button reload captha'); | 89 | console.log('click button reload captha'); |
90 | createCaptcha() | 90 | createCaptcha() |
91 | }); | 91 | }); |
92 | 92 | ||
93 | $('#Reloadcapcha2').on('click', function() { | 93 | $('#Reloadcapcha2').on('click', function() { |
94 | console.log('click button reload captha 2'); | 94 | console.log('click button reload captha 2'); |
95 | createCaptcha2() | 95 | createCaptcha2() |
96 | }); | 96 | }); |
97 | 97 | ||
98 | let form1 = document.getElementById('form1'); | 98 | let form1 = document.getElementById('form1'); |
99 | form1.addEventListener('submit', function (event) { | 99 | form1.addEventListener('submit', function (event) { |
100 | if (document.getElementById("cpatchaTextBox").value == code) { | 100 | if (document.getElementById("cpatchaTextBox").value == code) { |
101 | console.log('Валидный кот'); | 101 | console.log('Валидный кот'); |
102 | return true; | 102 | return true; |
103 | } else { | 103 | } else { |
104 | console.log('Ошибка1'); | 104 | console.log('Ошибка1'); |
105 | event.preventDefault(); | 105 | event.preventDefault(); |
106 | return false; | 106 | return false; |
107 | } | 107 | } |
108 | }); | 108 | }); |
109 | 109 | ||
110 | let form2 = document.getElementById('form2'); | 110 | let form2 = document.getElementById('form2'); |
111 | form2.addEventListener('submit', function (event) { | 111 | form2.addEventListener('submit', function (event) { |
112 | if (document.getElementById("cpatchaTextBox2").value == code2) { | 112 | if (document.getElementById("cpatchaTextBox2").value == code2) { |
113 | console.log('Валидный кот'); | 113 | console.log('Валидный кот'); |
114 | $('#captcha_employer_error').text(''); | ||
114 | return true; | 115 | return true; |
115 | } else { | 116 | } else { |
116 | console.log('Ошибка2'); | 117 | console.log('Ошибка2'); |
117 | event.preventDefault(); | 118 | event.preventDefault(); |
118 | return false; | 119 | return false; |
119 | } | 120 | } |
120 | }); | 121 | }); |
121 | }); | 122 | }); |
122 | </script> | 123 | </script> |
123 | 124 |
resources/views/js/modals.blade.php
1 | <script> | 1 | <script> |
2 | var code; | 2 | var code; |
3 | var code2; | 3 | var code2; |
4 | 4 | ||
5 | function createCaptcha() { | 5 | function createCaptcha() { |
6 | //clear the contents of captcha div first | 6 | //clear the contents of captcha div first |
7 | var captha1 = $('#captcha1').html(); | 7 | var captha1 = $('#captcha1').html(); |
8 | 8 | ||
9 | document.getElementById('captcha1').innerHTML = ""; | 9 | document.getElementById('captcha1').innerHTML = ""; |
10 | document.getElementById('captcha2').innerHTML = ""; | 10 | document.getElementById('captcha2').innerHTML = ""; |
11 | var charsArray = | 11 | var charsArray = |
12 | "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*"; | 12 | "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*"; |
13 | var lengthOtp = 6; | 13 | var lengthOtp = 6; |
14 | var captcha = []; | 14 | var captcha = []; |
15 | for (var i = 0; i < lengthOtp; i++) { | 15 | for (var i = 0; i < lengthOtp; i++) { |
16 | //below code will not allow Repetition of Characters | 16 | //below code will not allow Repetition of Characters |
17 | var index = Math.floor(Math.random() * charsArray.length + 1); //get the next character from the array | 17 | var index = Math.floor(Math.random() * charsArray.length + 1); //get the next character from the array |
18 | if (captcha.indexOf(charsArray[index]) == -1) | 18 | if (captcha.indexOf(charsArray[index]) == -1) |
19 | captcha.push(charsArray[index]); | 19 | captcha.push(charsArray[index]); |
20 | else i--; | 20 | else i--; |
21 | } | 21 | } |
22 | var canv = document.createElement("canvas"); | 22 | var canv = document.createElement("canvas"); |
23 | canv.id = "captcha"; | 23 | canv.id = "captcha"; |
24 | canv.width = 100; | 24 | canv.width = 100; |
25 | canv.height = 50; | 25 | canv.height = 50; |
26 | var ctx = canv.getContext("2d"); | 26 | var ctx = canv.getContext("2d"); |
27 | ctx.font = "25px Georgia"; | 27 | ctx.font = "25px Georgia"; |
28 | ctx.strokeText(captcha.join(""), 0, 30); | 28 | ctx.strokeText(captcha.join(""), 0, 30); |
29 | //storing captcha so that can validate you can save it somewhere else according to your specific requirements | 29 | //storing captcha so that can validate you can save it somewhere else according to your specific requirements |
30 | code = captcha.join(""); | 30 | code = captcha.join(""); |
31 | 31 | ||
32 | document.getElementById("captcha1").appendChild(canv); | 32 | document.getElementById("captcha1").appendChild(canv); |
33 | // adds the canvas to the body element | 33 | // adds the canvas to the body element |
34 | 34 | ||
35 | createCaptcha2() | 35 | createCaptcha2() |
36 | } | 36 | } |
37 | 37 | ||
38 | function createCaptcha2() { | 38 | function createCaptcha2() { |
39 | //clear the contents of captcha div first | 39 | //clear the contents of captcha div first |
40 | document.getElementById('captcha2').innerHTML = ""; | 40 | document.getElementById('captcha2').innerHTML = ""; |
41 | 41 | ||
42 | var captha2 = $('#captcha2').html(); | 42 | var captha2 = $('#captcha2').html(); |
43 | 43 | ||
44 | var charsArray = | 44 | var charsArray = |
45 | "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*"; | 45 | "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*"; |
46 | var lengthOtp = 6; | 46 | var lengthOtp = 6; |
47 | var captcha = []; | 47 | var captcha = []; |
48 | for (var i = 0; i < lengthOtp; i++) { | 48 | for (var i = 0; i < lengthOtp; i++) { |
49 | //below code will not allow Repetition of Characters | 49 | //below code will not allow Repetition of Characters |
50 | var index = Math.floor(Math.random() * charsArray.length + 1); //get the next character from the array | 50 | var index = Math.floor(Math.random() * charsArray.length + 1); //get the next character from the array |
51 | if (captcha.indexOf(charsArray[index]) == -1) | 51 | if (captcha.indexOf(charsArray[index]) == -1) |
52 | captcha.push(charsArray[index]); | 52 | captcha.push(charsArray[index]); |
53 | else i--; | 53 | else i--; |
54 | } | 54 | } |
55 | var canv = document.createElement("canvas"); | 55 | var canv = document.createElement("canvas"); |
56 | canv.id = "captcha"; | 56 | canv.id = "captcha"; |
57 | canv.width = 100; | 57 | canv.width = 100; |
58 | canv.height = 50; | 58 | canv.height = 50; |
59 | var ctx = canv.getContext("2d"); | 59 | var ctx = canv.getContext("2d"); |
60 | ctx.font = "25px Georgia"; | 60 | ctx.font = "25px Georgia"; |
61 | ctx.strokeText(captcha.join(""), 0, 30); | 61 | ctx.strokeText(captcha.join(""), 0, 30); |
62 | //storing captcha so that can validate you can save it somewhere else according to your specific requirements | 62 | //storing captcha so that can validate you can save it somewhere else according to your specific requirements |
63 | code2 = captcha.join(""); | 63 | code2 = captcha.join(""); |
64 | 64 | ||
65 | document.getElementById("captcha2").appendChild(canv); | 65 | document.getElementById("captcha2").appendChild(canv); |
66 | // adds the canvas to the body element | 66 | // adds the canvas to the body element |
67 | } | 67 | } |
68 | 68 | ||
69 | function validateCaptcha() { | 69 | function validateCaptcha() { |
70 | 70 | ||
71 | if (document.getElementById("cpatchaTextBox").value == code) { | 71 | if (document.getElementById("cpatchaTextBox").value == code) { |
72 | console.log('Валидная капча 1!'); | 72 | console.log('Валидная капча 1!'); |
73 | }else{ | 73 | }else{ |
74 | alert("Неверная капча! Повторите вновь"); | 74 | alert("Неверная капча! Повторите вновь"); |
75 | createCaptcha(); | 75 | createCaptcha(); |
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | function validateCaptcha2() { | 79 | function validateCaptcha2() { |
80 | if (document.getElementById("cpatchaTextBox2").value == code2) { | 80 | if (document.getElementById("cpatchaTextBox2").value == code2) { |
81 | console.log('Валидная капча 2!'); | 81 | console.log('Валидная капча 2!'); |
82 | }else{ | 82 | }else{ |
83 | alert("Неверная капча! Повторите вновь"); | 83 | alert("Неверная капча! Повторите вновь"); |
84 | createCaptcha(); | 84 | createCaptcha(); |
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | function successfulRegistrationWorker() { | 88 | function successfulRegistrationWorker() { |
89 | $.fancybox.close(); | 89 | $.fancybox.close(); |
90 | 90 | ||
91 | $('#email_worker').val(''); | 91 | $('#email_worker').val(''); |
92 | $('#password_worker').val(''); | 92 | $('#password_worker').val(''); |
93 | $('#password_confirmation_worker').val(''); | 93 | $('#password_confirmation_worker').val(''); |
94 | $('#politik').prop('checked', false); | 94 | $('#politik').prop('checked', false); |
95 | $('#telephone_worker').val(''); | 95 | $('#telephone_worker').val(''); |
96 | $('#job_titles_worker').val('').trigger('change'); | 96 | $('#job_titles_worker').val('').trigger('change'); |
97 | $('#surname_worker').val(''); | 97 | $('#surname_worker').val(''); |
98 | $('#name_man_worker').val(''); | 98 | $('#name_man_worker').val(''); |
99 | $('#surname2_worker').val(''); | 99 | $('#surname2_worker').val(''); |
100 | $('#cpatchaTextBox1').val(''); | 100 | $('#cpatchaTextBox1').val(''); |
101 | 101 | ||
102 | $('#block-info').hide(); | 102 | $('#block-info').hide(); |
103 | $('#messages_error_reg').html(''); | 103 | $('#messages_error_reg').html(''); |
104 | 104 | ||
105 | $.fancybox.open({ | 105 | $.fancybox.open({ |
106 | src: '#successful-registration-worker', | 106 | src: '#successful-registration-worker', |
107 | type: 'inline', | 107 | type: 'inline', |
108 | opts: {touch: false} | 108 | opts: {touch: false} |
109 | }); | 109 | }); |
110 | } | 110 | } |
111 | 111 | ||
112 | function successfulRegistrationEmployer() { | 112 | function successfulRegistrationEmployer() { |
113 | $.fancybox.close(); | 113 | $.fancybox.close(); |
114 | 114 | ||
115 | $('#email_employer').val(''); | 115 | $('#email_employer').val(''); |
116 | $('#password_employer').val(''); | 116 | $('#password_employer').val(''); |
117 | $('#password_confirmation_employer').val(''); | 117 | $('#password_confirmation_employer').val(''); |
118 | $('#politik').prop('checked', false); | 118 | $('#politik').prop('checked', false); |
119 | $('#telephone_employer').val(''); | 119 | $('#telephone_employer').val(''); |
120 | $('#surname_employer').val(''); | 120 | $('#surname_employer').val(''); |
121 | $('#name_man_employer').val(''); | 121 | $('#name_man_employer').val(''); |
122 | $('#surname2_employer').val(''); | 122 | $('#surname2_employer').val(''); |
123 | $('#company_employer').val(''); | 123 | $('#company_employer').val(''); |
124 | $('#cpatchaTextBox1').val(''); | 124 | $('#cpatchaTextBox1').val(''); |
125 | 125 | ||
126 | $('#block-info').hide(); | 126 | $('#block-info').hide(); |
127 | $('#messages_error_reg').html(''); | 127 | $('#messages_error_reg').html(''); |
128 | 128 | ||
129 | $.fancybox.open({ | 129 | $.fancybox.open({ |
130 | src: '#successful-registration-employer', | 130 | src: '#successful-registration-employer', |
131 | type: 'inline', | 131 | type: 'inline', |
132 | opts: {touch: false} | 132 | opts: {touch: false} |
133 | }); | 133 | }); |
134 | } | 134 | } |
135 | 135 | ||
136 | $(document).on('click', '#button_send', function() { | 136 | $(document).on('click', '#button_send', function() { |
137 | var field_login = $('#email_input'); | 137 | var field_login = $('#email_input'); |
138 | var field_pwd = $('#password'); | 138 | var field_pwd = $('#password'); |
139 | var login_val = field_login.val(); | 139 | var login_val = field_login.val(); |
140 | var pwd_val = field_pwd.val(); | 140 | var pwd_val = field_pwd.val(); |
141 | 141 | ||
142 | console.log('login: '+login_val+' password: '+pwd_val); | 142 | console.log('login: '+login_val+' password: '+pwd_val); |
143 | 143 | ||
144 | $.ajax({ | 144 | $.ajax({ |
145 | type: "GET", | 145 | type: "GET", |
146 | url: "{{ route('login') }}", | 146 | url: "{{ route('login') }}", |
147 | data: "email="+login_val+"&password="+pwd_val, | 147 | data: "email="+login_val+"&password="+pwd_val, |
148 | success: function (data) { | 148 | success: function (data) { |
149 | console.log('Вход в систему'); | 149 | console.log('Вход в систему'); |
150 | console.log(data); | 150 | console.log(data); |
151 | let d = JSON.parse(data); | 151 | let d = JSON.parse(data); |
152 | if(typeof d['REDIRECT'] !== "undefined") { | 152 | if(typeof d['REDIRECT'] !== "undefined") { |
153 | location.href = d['REDIRECT']; | 153 | location.href = d['REDIRECT']; |
154 | console.log(d['REDIRECT']); | 154 | console.log(d['REDIRECT']); |
155 | } | 155 | } |
156 | if (typeof d['ERROR'] !== "undefined") { | 156 | if (typeof d['ERROR'] !== "undefined") { |
157 | console.log(d['ERROR']); | 157 | console.log(d['ERROR']); |
158 | $('#message_error').html(d['ERROR']); | 158 | $('#message_error').html(d['ERROR']); |
159 | } | 159 | } |
160 | //console.log(d['REDIRECT']); | 160 | //console.log(d['REDIRECT']); |
161 | //$('#block_1').html(data); | 161 | //$('#block_1').html(data); |
162 | }, | 162 | }, |
163 | headers: { | 163 | headers: { |
164 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 164 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
165 | }, | 165 | }, |
166 | error: function (data) { | 166 | error: function (data) { |
167 | data = JSON.stringify(data); | 167 | data = JSON.stringify(data); |
168 | console.log('Error: ' + data); | 168 | console.log('Error: ' + data); |
169 | } | 169 | } |
170 | }); | 170 | }); |
171 | }); | 171 | }); |
172 | 172 | ||
173 | $(document).on('click', '#button_reg_worker', function() { | 173 | $('#form1').on('submit', function (e) { |
174 | $('#messages_error_reg').html(''); | 174 | e.preventDefault(); |
175 | |||
176 | var field_login = $('#email_worker'); | ||
177 | var field_pwd = $('#password_worker'); | ||
178 | var field_confirm_pwd = $('#password_confirmation_worker'); | ||
179 | var field_politik_worker = $('#politik'); | ||
180 | var field_telephone_worker = $('#telephone_worker'); | ||
181 | var field_job_titles_worker = $('#job_titles_worker'); | ||
182 | var field_surname_worker = $('#surname_worker'); | ||
183 | var field_name_man = $('#name_man_worker'); | ||
184 | var field_surname2_worker = $('#surname2_worker'); | ||
185 | |||
186 | var login = field_login.val(); | ||
187 | var pwd = field_pwd.val(); | ||
188 | var confirm_pwd = field_confirm_pwd.val(); | ||
189 | var politik = field_politik_worker.val(); | ||
190 | var telephone = field_telephone_worker.val(); | ||
191 | var job_titles = field_job_titles_worker.val(); | ||
192 | var surname = field_surname_worker.val(); | ||
193 | var name_man = field_name_man.val(); | ||
194 | var surname2 = field_surname2_worker.val(); | ||
195 | |||
196 | 175 | ||
197 | if (document.getElementById("cpatchaTextBox1").value == code) { | 176 | if (document.getElementById("cpatchaTextBox1").value == code) { |
198 | console.log('Валидный кот'); | 177 | console.log('Валидная капча'); |
199 | |||
200 | } else { | 178 | } else { |
201 | console.log('Ошибка1'); | 179 | $('#captcha_error').text('Капча неверная!'); |
202 | event.preventDefault(); | ||
203 | $('#block-info').css({'display': 'block'}); | ||
204 | $('#messages_error_reg').html('ERROR: Капча неверная!'); | ||
205 | |||
206 | return false; | 180 | return false; |
207 | } | 181 | } |
208 | 182 | ||
209 | if (!document.getElementById('politik').checked) { | 183 | $('.error-message').text(''); |
210 | event.preventDefault(); | 184 | |
211 | $('#block-info').css({'display': 'block'}); | 185 | let formData = $(this).serialize(); |
212 | $('#messages_error_reg').html('ERROR: Вы не согласились с политикой конфидициальности!'); | ||
213 | return false; | ||
214 | } | ||
215 | 186 | ||
216 | $.ajax({ | 187 | $.ajax({ |
217 | type: "GET", | 188 | url: $(this).attr('action'), |
218 | url: "{{ route('register_worker') }}", | 189 | method: $(this).attr('method'), |
219 | data: "email="+login+"&password="+pwd+"&confirmed="+confirm_pwd+"&politik="+politik+ | 190 | data: formData, |
220 | "&telephone="+telephone+"&job_titles="+job_titles+"&surname="+surname+"&name_man="+name_man+ | 191 | success: function (response) { |
221 | "&surname2="+surname2+"&subscribe_email="+login, | 192 | if (response.REDIRECT) { |
222 | success: function (data) { | ||
223 | let d = JSON.parse(data); | ||
224 | if (typeof d['REDIRECT'] !== "undefined") { | ||
225 | successfulRegistrationWorker() | 193 | successfulRegistrationWorker() |
226 | } | 194 | } |
227 | |||
228 | if (typeof d['ERROR'] !== "undefined") { | ||
229 | console.log(d['ERROR']); | ||
230 | $('#block-info').css({'display': 'block'}); | ||
231 | $('#messages_error_reg').html(d['ERROR']); | ||
232 | } | ||
233 | console.log(d['REDIRECT']); | ||
234 | |||
235 | }, | ||
236 | headers: { | ||
237 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | ||
238 | }, | 195 | }, |
239 | error: function (data) { | 196 | error: function (jqXHR) { |
240 | data = JSON.stringify(data); | 197 | if (jqXHR.status === 422) { |
241 | console.log('Error: ' + data); | 198 | let errors = jqXHR.responseJSON.ERRORS; |
199 | |||
200 | for (let field in errors) { | ||
201 | if (errors.hasOwnProperty(field)) { | ||
202 | $('#' + field + '_error').text(errors[field][0]); | ||
203 | } | ||
204 | } | ||
205 | } else { | ||
206 | alert('Произошла ошибка при регистрации. Попробуйте снова.'); | ||
207 | } | ||
242 | } | 208 | } |
243 | }); | 209 | }); |
244 | |||
245 | return false; | ||
246 | }); | 210 | }); |
247 | 211 | ||
248 | $(document).on('click', '.open-login-modal', function(e) { | 212 | $(document).on('click', '.open-login-modal', function(e) { |
249 | e.preventDefault(); | 213 | e.preventDefault(); |
250 | $.fancybox.close(); | 214 | $.fancybox.close(); |
251 | $.fancybox.open({ | 215 | $.fancybox.open({ |
252 | src: '#sign', | 216 | src: '#sign', |
253 | type: 'inline', | 217 | type: 'inline', |
254 | opts: {touch: false} | 218 | opts: {touch: false} |
255 | }); | 219 | }); |
256 | }); | 220 | }); |
257 | 221 | ||
258 | $(document).on('click', '#button_reg_employer', function() { | 222 | $('#form2').on('submit', function (e) { |
259 | 223 | e.preventDefault(); | |
260 | $('#messages_error_reg').html(''); | ||
261 | |||
262 | var field_login = $('#email_employer'); | ||
263 | var field_pwd = $('#password_employer'); | ||
264 | var field_confirm_pwd = $('#password_confirmation_employer'); | ||
265 | var field_politik_employer = $('#politik_employer'); | ||
266 | var field_telephone_employer = $('#telephone_employer'); | ||
267 | var field_company_employer = $('#company_employer'); | ||
268 | var field_surname_employer = $('#surname_employer'); | ||
269 | var field_name_man_employer = $('#name_man_employer'); | ||
270 | var field_surname2_employer = $('#surname2_employer'); | ||
271 | |||
272 | var login = field_login.val(); | ||
273 | var pwd = field_pwd.val(); | ||
274 | var confirm_pwd = field_confirm_pwd.val(); | ||
275 | var politik = field_politik_employer.val(); | ||
276 | var telephone = field_telephone_employer.val(); | ||
277 | var company_employer = field_company_employer.val(); | ||
278 | var surname = field_surname_employer.val(); | ||
279 | var name_man = field_name_man_employer.val(); | ||
280 | var surname2 = field_surname2_employer.val(); | ||
281 | 224 | ||
282 | if (document.getElementById("cpatchaTextBox2").value == code2) { | 225 | if (document.getElementById("cpatchaTextBox2").value == code2) { |
283 | console.log('Валидный кот'); | 226 | console.log('Валидная капча'); |
284 | |||
285 | } else { | 227 | } else { |
286 | console.log('Ошибка2'); | 228 | $('#captcha_employer_error').text('Капча неверная!'); |
287 | event.preventDefault(); | ||
288 | $('#block-info').css({'display': 'block'}); | ||
289 | $('#messages_error_reg').html('ERROR: Капча неверная!'); | ||
290 | return false; | 229 | return false; |
291 | } | 230 | } |
292 | 231 | ||
293 | console.log('login: '+login+' password: '+pwd); | 232 | $('.employer_error-message').text(''); |
294 | if (!document.getElementById('politik_employer').checked) { | 233 | |
295 | event.preventDefault(); | 234 | let formData = $(this).serialize(); |
296 | $('#block-info').css({'display': 'block'}); | ||
297 | $('#messages_error_reg').html('ERROR: Вы не согласились с политикой конфидициальности!'); | ||
298 | return false; | ||
299 | } | ||
300 | 235 | ||
301 | $.ajax({ | 236 | $.ajax({ |
302 | type: "GET", | 237 | url: $(this).attr('action'), |
303 | url: "{{ route('register_employer') }}", | 238 | method: $(this).attr('method'), |
304 | data: "email="+login+"&password="+pwd+"&confirmed="+confirm_pwd+"&politik="+politik+ | 239 | data: formData, |
305 | "&telephone="+telephone+"&name_company="+company_employer+"&surname="+surname+"&name_man="+name_man+ | 240 | success: function (response) { |
306 | "&surname2="+surname2+"&subscribe_email="+login, | 241 | if (response.REDIRECT) { |
307 | success: function (data) { | 242 | successfulRegistrationEmployer(); |
308 | console.log('Вход в систему'); | ||
309 | let d = JSON.parse(data); | ||
310 | if(typeof d['REDIRECT'] !== "undefined") { | ||
311 | successfulRegistrationEmployer() | ||
312 | } | ||
313 | if (typeof d['ERROR'] !== "undefined") { | ||
314 | console.log(d['ERROR']); | ||
315 | $('#block-info').css({'display': 'block'}); | ||
316 | $('#messages_error_reg').html(d['ERROR']); | ||
317 | } | 243 | } |
318 | console.log(d['REDIRECT']); | ||
319 | }, | ||
320 | headers: { | ||
321 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | ||
322 | }, | 244 | }, |
resources/views/modals/register.blade.php
1 | <style> | 1 | <style> |
2 | #captcha { | 2 | #captcha { |
3 | background-color: #d0d0d0; | 3 | background-color: #d0d0d0; |
4 | } | 4 | } |
5 | 5 | ||
6 | #captcha2 { | 6 | #captcha2 { |
7 | background-color: #d0d0d0; | 7 | background-color: #d0d0d0; |
8 | } | 8 | } |
9 | </style> | 9 | </style> |
10 | 10 | ||
11 | @include('modals.successful_registration_worker') | 11 | @include('modals.successful_registration_worker') |
12 | @include('modals.successful_registration_employer') | 12 | @include('modals.successful_registration_employer') |
13 | 13 | ||
14 | <div id="reg" class="modal"> | 14 | <div id="reg" class="modal"> |
15 | <div class="modal__body"> | 15 | <div class="modal__body"> |
16 | <div class="modal__title left">Регистрация</div> | 16 | <div class="modal__title left">Регистрация</div> |
17 | <div class="notify notify_red" style="display:none" id="block-info"> | 17 | <div class="notify notify_red" style="display:none" id="block-info"> |
18 | <svg> | 18 | <svg> |
19 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> | 19 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> |
20 | </svg><br> | 20 | </svg><br> |
21 | <span id="messages_error_reg" name="messages_error_reg"></span> | 21 | <span id="messages_error_reg" name="messages_error_reg"></span> |
22 | </div> | 22 | </div> |
23 | <div class="modal__tabs"> | 23 | <div class="modal__tabs"> |
24 | <button type="button" class="modal__tabs-item button button_light active" data-tab="1">Кандидат</button> | 24 | <button type="button" class="modal__tabs-item button button_light active" data-tab="1">Кандидат</button> |
25 | <button type="button" class="modal__tabs-item button button_light" data-tab="2">Работодатель</button> | 25 | <button type="button" class="modal__tabs-item button button_light" data-tab="2">Работодатель</button> |
26 | </div> | 26 | </div> |
27 | <div class="modal__reg showed" data-body="1" id="form1" name="form1" onsubmit="-validateCaptcha()"> | 27 | <form class="modal__reg showed" data-body="1" id="form1" name="form1" onsubmit="return validateCaptcha()" method="POST" action="{{ route('register_worker') }}"> |
28 | @csrf | ||
28 | <input type="hidden" name="is_worker" id="is_worker" value="1"/> | 29 | <input type="hidden" name="is_worker" id="is_worker" value="1"/> |
30 | |||
29 | <div class="modal__reg-item form-group"> | 31 | <div class="modal__reg-item form-group"> |
30 | <label class="form-group__label">Электронная почта *</label> | 32 | <label class="form-group__label">Электронная почта *</label> |
31 | <div class="form-group__item"> | 33 | <div class="form-group__item"> |
32 | <input type="email" id="email_worker" name="email_worker" class="input" placeholder="info@rekamore.su" required> | 34 | <input type="email" id="email_worker" name="email" class="input" placeholder="info@rekamore.su"> |
35 | <span id="email_error" class="error-message"></span> | ||
33 | </div> | 36 | </div> |
34 | </div> | 37 | </div> |
35 | 38 | ||
36 | <div class="modal__reg-item form-group"> | 39 | <div class="modal__reg-item form-group"> |
37 | <label class="form-group__label">Пароль *</label> | 40 | <label class="form-group__label">Пароль *</label> |
38 | <div class="form-group__item"> | 41 | <div class="form-group__item"> |
39 | <input type="password" id="password_worker" name="password_worker" class="input" placeholder="**********" required> | 42 | <input type="password" id="password_worker" name="password" class="input" placeholder="**********"> |
40 | <button type="button" class="eye"> | 43 | <button type="button" class="eye"> |
41 | <svg class="js-password-show"> | 44 | <svg class="js-password-show"> |
42 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> | 45 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> |
43 | </svg> | 46 | </svg> |
44 | <svg class="js-password-hide"> | 47 | <svg class="js-password-hide"> |
45 | <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use> | 48 | <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use> |
46 | </svg> | 49 | </svg> |
47 | </button> | 50 | </button> |
51 | <span id="password_error" class="error-message"></span> | ||
48 | </div> | 52 | </div> |
49 | </div> | 53 | </div> |
50 | 54 | ||
51 | <div class="modal__reg-item form-group"> | 55 | <div class="modal__reg-item form-group"> |
52 | <label class="form-group__label">Подтвердить пароль *</label> | 56 | <label class="form-group__label">Подтвердить пароль *</label> |
53 | <div class="form-group__item"> | 57 | <div class="form-group__item"> |
54 | <input type="password" name="password_confirmation_worker" id="password_confirmation_worker" class="input" placeholder="**********" required> | 58 | <input type="password" id="password_confirmation_worker" name="password_confirmation" class="input" placeholder="**********"> |
55 | <button type="button" class="eye"> | 59 | <button type="button" class="eye"> |
56 | <svg class="js-password-show"> | 60 | <svg class="js-password-show"> |
57 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> | 61 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> |
58 | </svg> | 62 | </svg> |
59 | <svg class="js-password-hide"> | 63 | <svg class="js-password-hide"> |
60 | <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use> | 64 | <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use> |
61 | </svg> | 65 | </svg> |
62 | </button> | 66 | </button> |
63 | </div> | 67 | </div> |
68 | <span id="password_confirmation_error" class="error-message"></span> | ||
64 | </div> | 69 | </div> |
65 | 70 | ||
66 | <div class="modal__reg-item form-group"> | 71 | <div class="modal__reg-item form-group"> |
67 | <label class="form-group__label">Фамилия *</label> | 72 | <label class="form-group__label">Фамилия *</label> |
68 | <div class="form-group__item"> | 73 | <div class="form-group__item"> |
69 | <input type="text" id="surname_worker" name="surname_worker" class="input" placeholder="Шестаков" required> | 74 | <input type="text" id="surname_worker" name="surname" class="input" placeholder="Шестаков"> |
75 | <span id="surname_error" class="error-message"></span> | ||
70 | </div> | 76 | </div> |
71 | </div> | 77 | </div> |
72 | 78 | ||
73 | <div class="modal__reg-item form-group"> | 79 | <div class="modal__reg-item form-group"> |
74 | <label class="form-group__label">Имя *</label> | 80 | <label class="form-group__label">Имя *</label> |
75 | <div class="form-group__item"> | 81 | <div class="form-group__item"> |
76 | <input type="text" id="name_man_worker" name="name_man_worker" class="input" placeholder="Андрей" required> | 82 | <input type="text" id="name_man_worker" name="name_man" class="input" placeholder="Андрей"> |
83 | <span id="name_man_error" class="error-message"></span> | ||
77 | </div> | 84 | </div> |
78 | </div> | 85 | </div> |
79 | 86 | ||
80 | <div class="modal__reg-item form-group"> | 87 | <div class="modal__reg-item form-group"> |
81 | <label class="form-group__label">Отчество</label> | 88 | <label class="form-group__label">Отчество</label> |
82 | <div class="form-group__item"> | 89 | <div class="form-group__item"> |
83 | <input type="text" id="surname2_worker" name="surname2_worker" class="input" placeholder="Васильевич"> | 90 | <input type="text" id="surname2_worker" name="surname2" class="input" placeholder="Васильевич"> |
84 | </div> | 91 | </div> |
85 | </div> | 92 | </div> |
86 | <!-- | 93 | <!-- |
87 | <div class="modal__reg-item form-group"> | 94 | <div class="modal__reg-item form-group"> |
88 | <label class="form-group__label">Должность</label> | 95 | <label class="form-group__label">Должность</label> |
89 | <div class="form-group__item"> | 96 | <div class="form-group__item"> |
90 | <input type="text" class="input" placeholder="Палуба" required> | 97 | <input type="text" class="input" placeholder="Палуба" required> |
91 | </div> | 98 | </div> |
92 | </div>--> | 99 | </div>--> |
93 | 100 | ||
94 | <div class="modal__reg-item form-group"> | 101 | <div class="modal__reg-item form-group"> |
95 | <label class="form-group__label">Должность</label> | 102 | <label class="form-group__label">Должность</label> |
96 | <div class="form-group__item"> | 103 | <div class="form-group__item"> |
97 | <div class="select"> | 104 | <div class="select"> |
98 | <select class="js-select2" name="job_titles_worker" id="job_titles_worker"> | 105 | <select class="js-select2" name="job_titles" id="job_titles_worker"> |
99 | <option selected>Не указано</option> | 106 | <option selected>Не указано</option> |
100 | @if ($Job_titles->count()) | 107 | @if ($Job_titles->count()) |
101 | @foreach($Job_titles as $it) | 108 | @foreach($Job_titles as $it) |
102 | <option value="{{ $it->id }}">{{ $it->name }}</option> | 109 | <option value="{{ $it->id }}">{{ $it->name }}</option> |
103 | @endforeach | 110 | @endforeach |
104 | @endif | 111 | @endif |
105 | </select> | 112 | </select> |
113 | <span id="job_titles_error" class="error-message"></span> | ||
106 | </div> | 114 | </div> |
107 | </div> | 115 | </div> |
108 | </div> | 116 | </div> |
109 | 117 | ||
110 | <div class="modal__reg-item form-group"> | 118 | <div class="modal__reg-item form-group"> |
111 | <label class="form-group__label">Номер телефона</label> | 119 | <label class="form-group__label">Номер телефона</label> |
112 | <div class="form-group__item"> | 120 | <div class="form-group__item"> |
113 | <input type="tel" name="telephone_worker" id="telephone_worker" class="input" placeholder="+7 (___) ___-__-__" required> | 121 | <input type="tel" name="telephone" id="telephone_worker" class="input" placeholder="+7 (___) ___-__-__"> |
122 | <span id="telephone_error" class="error-message"></span> | ||
114 | </div> | 123 | </div> |
115 | </div> | 124 | </div> |
116 | <!--<div class="modal__reg-item"> | 125 | <!--<div class="modal__reg-item"> |
117 | <img src="images/catpcha.jpg" alt="" class="captcha"> | 126 | <img src="images/catpcha.jpg" alt="" class="captcha"> |
118 | </div>--> | 127 | </div>--> |
119 | <div id="Reloadcapcha1" name="Reloadcapcha1" class="button">Обновить капчу</div> | 128 | <div id="Reloadcapcha1" name="Reloadcapcha1" class="button">Обновить капчу</div> |
120 | <div id="captcha1" style="width:190px" class="modal__reg-item form-group">321</div> | 129 | <div id="captcha1" style="width:190px" class="modal__reg-item form-group">321</div> |
121 | <input type="text" placeholder="Captcha" class="input registr-form__input" id="cpatchaTextBox1" style="width: 100%"/> | 130 | <input type="text" placeholder="Captcha" class="input registr-form__input" id="cpatchaTextBox1" style="width: 100%"/> |
122 | 131 | ||
123 | <div class="modal__reg-item"> | 132 | <div class="modal__reg-item"> |
133 | <span id="captcha_error" class="error-message"></span> | ||
124 | <label class="checkbox"> | 134 | <label class="checkbox"> |
125 | <input type="checkbox" name="politik" id="politik" value="1" class="checkbox__input"> | 135 | <input type="checkbox" name="politik" id="politik" value="1" class="checkbox__input"> |
126 | <span class="checkbox__icon"> | 136 | <span class="checkbox__icon"> |
127 | <svg> | 137 | <svg> |
128 | <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use> | 138 | <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use> |
129 | </svg> | 139 | </svg> |
130 | </span> | 140 | </span> |
131 | <span class="checkbox__text"> | 141 | <span class="checkbox__text"> |
132 | <span> | 142 | <span> |
133 | Я согласен(на) с <a href="{{ route('page', ['pages' => 'Politika-konfidencialnosti']) }}">Политикой конфиденциальности</a> | 143 | Я согласен(на) с <a href="{{ route('page', ['pages' => 'Politika-konfidencialnosti']) }}">Политикой конфиденциальности</a> |
134 | </span> | 144 | </span> |
135 | </span> | 145 | </span> |
136 | </label> | 146 | </label> |
147 | <span id="politik_error" class="error-message"></span> | ||
137 | </div> | 148 | </div> |
138 | <button type="submit" id="button_reg_worker" name="button_reg_worker" class="button">Зарегистрироваться</button> | 149 | <button type="submit" id="button_reg_worker" name="button_reg_worker" class="button">Зарегистрироваться</button> |
139 | </div> | 150 | </form> |
140 | 151 | ||
141 | <div class="modal__reg" data-body="2" id="form2" name="name2" onsubmit="_validateCaptcha2()"> | 152 | <form class="modal__reg" data-body="2" id="form2" name="name2" onsubmit="return validateCaptcha2()" method="POST" action="{{ route('register_employer') }}"> |
153 | @csrf | ||
142 | <div class="modal__reg-item form-group"> | 154 | <div class="modal__reg-item form-group"> |
143 | <label class="form-group__label">Электронная почта *</label> | 155 | <label class="form-group__label">Электронная почта *</label> |
144 | <div class="form-group__item"> | 156 | <div class="form-group__item"> |
145 | <input type="email" id="email_employer" name="email_employer" class="input" placeholder="info@rekamore.su" required> | 157 | <input type="email" id="email_employer" name="email" class="input" placeholder="info@rekamore.su"> |
158 | <span id="email_employer_error" class="employer_error-message"></span> | ||
146 | </div> | 159 | </div> |
147 | </div> | 160 | </div> |
148 | <div class="modal__reg-item form-group"> | 161 | <div class="modal__reg-item form-group"> |
149 | <label class="form-group__label">Пароль *</label> | 162 | <label class="form-group__label">Пароль *</label> |
150 | <div class="form-group__item"> | 163 | <div class="form-group__item"> |
151 | <input type="password" id="password_employer" name="password_employer" class="input" placeholder="**********" required> | 164 | <input type="password" id="password_employer" name="password" class="input" placeholder="**********"> |
152 | <button type="button" class="eye"> | 165 | <button type="button" class="eye"> |
153 | <svg class="js-password-show"> | 166 | <svg class="js-password-show"> |
154 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> | 167 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> |
155 | </svg> | 168 | </svg> |
156 | <svg class="js-password-hide"> | 169 | <svg class="js-password-hide"> |
157 | <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use> | 170 | <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use> |
158 | </svg> | 171 | </svg> |
159 | </button> | 172 | </button> |
173 | <span id="password_employer_error" class="employer_error-message"></span> | ||
160 | </div> | 174 | </div> |
161 | </div> | 175 | </div> |
162 | <div class="modal__reg-item form-group"> | 176 | <div class="modal__reg-item form-group"> |
163 | <label class="form-group__label">Подтвердить пароль *</label> | 177 | <label class="form-group__label">Подтвердить пароль *</label> |
164 | <div class="form-group__item"> | 178 | <div class="form-group__item"> |
165 | <input type="password" id="password_confirmation_employer" name="password_confirmation_employer" class="input" placeholder="**********" required> | 179 | <input type="password" id="password_confirmation_employer" name="password_confirmation" class="input" placeholder="**********"> |
166 | <button type="button" class="eye"> | 180 | <button type="button" class="eye"> |
167 | <svg class="js-password-show"> | 181 | <svg class="js-password-show"> |
168 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> | 182 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> |
169 | </svg> | 183 | </svg> |
170 | <svg class="js-password-hide"> | 184 | <svg class="js-password-hide"> |
171 | <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use> | 185 | <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use> |
172 | </svg> | 186 | </svg> |
173 | </button> | 187 | </button> |
174 | </div> | 188 | </div> |
189 | <span id="password_confirmation_employer_error" class="employer_error-message"></span> | ||
175 | </div> | 190 | </div> |
176 | 191 | ||
177 | 192 | ||
178 | <div class="modal__reg-item form-group"> | 193 | <div class="modal__reg-item form-group"> |
179 | <label class="form-group__label">Фамилия работодателя *</label> | 194 | <label class="form-group__label">Фамилия работодателя *</label> |
180 | <div class="form-group__item"> | 195 | <div class="form-group__item"> |
181 | <input type="text" id="surname_employer" name="surname_employer" class="input" placeholder="Шестаков" required> | 196 | <input type="text" id="surname_employer" name="surname" class="input" placeholder="Шестаков"> |
197 | <span id="surname_employer_error" class="employer_error-message"></span> | ||
182 | </div> | 198 | </div> |
183 | </div> | 199 | </div> |
184 | 200 | ||
185 | <div class="modal__reg-item form-group"> | 201 | <div class="modal__reg-item form-group"> |
186 | <label class="form-group__label">Имя работодателя *</label> | 202 | <label class="form-group__label">Имя работодателя *</label> |
187 | <div class="form-group__item"> | 203 | <div class="form-group__item"> |
188 | <input type="text" id="name_man_employer" name="name_man_employer" class="input" placeholder="Андрей" required> | 204 | <input type="text" id="name_man_employer" name="name_man" class="input" placeholder="Андрей"> |
189 | </div> | 205 | </div> |
190 | </div> | 206 | </div> |
191 | 207 | ||
192 | <div class="modal__reg-item form-group"> | 208 | <div class="modal__reg-item form-group"> |
193 | <label class="form-group__label">Отчество работодателя</label> | 209 | <label class="form-group__label">Отчество работодателя</label> |
194 | <div class="form-group__item"> | 210 | <div class="form-group__item"> |
195 | <input type="text" id="surname2_employer" name="surname2_employer" class="input" placeholder="Васильевич"> | 211 | <input type="text" id="surname2_employer" name="surname2" class="input" placeholder="Васильевич"> |
196 | </div> | 212 | </div> |
197 | </div> | 213 | </div> |
198 | 214 | ||
199 | <div class="modal__reg-item form-group"> | 215 | <div class="modal__reg-item form-group"> |
200 | <label class="form-group__label">Название судоходной компании *</label> | 216 | <label class="form-group__label">Название судоходной компании *</label> |
201 | <div class="form-group__item"> | 217 | <div class="form-group__item"> |
202 | <input type="text" name="company_employer" id="company_employer" class="input" placeholder="ООО Река Море" required> | 218 | <input type="text" name="name_company" id="name_company_employer" class="input" placeholder="ООО Река Море"> |
219 | <span id="name_company_employer_error" class="employer_error-message"></span> | ||
203 | </div> | 220 | </div> |
204 | </div> | 221 | </div> |
205 | 222 | ||
206 | <div class="modal__reg-item form-group"> | 223 | <div class="modal__reg-item form-group"> |
207 | <label class="form-group__label">Номер телефона</label> | 224 | <label class="form-group__label">Номер телефона</label> |
208 | <div class="form-group__item"> | 225 | <div class="form-group__item"> |
209 | <input type="tel" name="telephone_employer" id="telephone_employer" class="input" placeholder="+7 (___) ___-__-__" required> | 226 | <input type="tel" name="telephone" id="telephone_employer" class="input" placeholder="+7 (___) ___-__-__"> |
210 | </div> | 227 | </div> |
211 | </div> | 228 | </div> |
212 | <!--<div class="modal__reg-item"> | 229 | <!--<div class="modal__reg-item"> |
213 | <img src="images/catpcha.jpg" alt="" class="captcha"> | 230 | <img src="images/catpcha.jpg" alt="" class="captcha"> |
214 | </div>--> | 231 | </div>--> |
215 | 232 | ||
216 | <div id="Reloadcapcha2" name="Reloadcapcha2" class="button">Обновить капчу</div> | 233 | <div id="Reloadcapcha2" name="Reloadcapcha2" class="button">Обновить капчу</div> |
217 | <div id="captcha2" style="width:190px" class="modal__reg-item form-group">123</div> | 234 | <div id="captcha2" style="width:190px" class="modal__reg-item form-group">123</div> |
218 | <input type="text" placeholder="Captcha" class="input registr-form__input" id="cpatchaTextBox2" style="width: 100%"/> | 235 | <input type="text" placeholder="Captcha" class="input registr-form__input" id="cpatchaTextBox2" style="width: 100%"/> |
219 | 236 | ||
220 | <div class="modal__reg-item"> | 237 | <div class="modal__reg-item"> |
238 | <span id="captcha_employer_error" class="employer_error-message"></span> | ||
221 | <label class="checkbox"> | 239 | <label class="checkbox"> |
222 | <input type="checkbox" name="politik_employer" id="politik_employer" value="1" class="checkbox__input" required> | 240 | <input type="checkbox" name="politik" id="politik_employer" value="1" class="checkbox__input"> |
223 | <span class="checkbox__icon"> | 241 | <span class="checkbox__icon"> |
224 | <svg> | 242 | <svg> |
225 | <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use> | 243 | <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use> |
226 | </svg> | 244 | </svg> |
227 | </span> | 245 | </span> |
228 | <span class="checkbox__text"> | 246 | <span class="checkbox__text"> |
229 | <span> | 247 | <span> |
230 | Я согласен(на) с <a href="{{ route('page', ['pages' => 'Politika-konfidencialnosti']) }}">Политикой конфиденциальности</a> | 248 | Я согласен(на) с <a href="{{ route('page', ['pages' => 'Politika-konfidencialnosti']) }}">Политикой конфиденциальности</a> |
231 | </span> | 249 | </span> |
232 | </span> | 250 | </span> |
233 | </label> | 251 | </label> |
252 | <span id="politik_employer_error" class="employer_error-message"></span> | ||
234 | </div> | 253 | </div> |
235 | <button type="submit" id="button_reg_employer" name="button_reg_employer" class="button">Зарегистрироваться</button> | 254 | <button type="submit" id="button_reg_employer" name="button_reg_employer" class="button">Зарегистрироваться</button> |
236 | </div> | 255 | </form> |
237 | <div class="modal__text"> | 256 | <div class="modal__text"> |
238 | <span>Вспомнили пароль?</span> | 257 | <span>Вспомнили пароль?</span> |
239 | | 258 | |
240 | <a data-fancybox data-src="#sign" data-options='{"touch":false,"autoFocus":false}'>Войти</a> | 259 | <a data-fancybox data-src="#sign" data-options='{"touch":false,"autoFocus":false}'>Войти</a> |
241 | </div> | 260 | </div> |
242 | </div> | 261 | </div> |
243 | </div> | 262 | </div> |
244 | 263 |
routes/web.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | use App\Http\Controllers\Ad_jobsController; | 3 | use App\Http\Controllers\Ad_jobsController; |
4 | use App\Http\Controllers\AdEmployerController; | 4 | use App\Http\Controllers\AdEmployerController; |
5 | use App\Http\Controllers\Admin\AdminController; | 5 | use App\Http\Controllers\Admin\AdminController; |
6 | use App\Http\Controllers\Admin\CategoryController; | 6 | use App\Http\Controllers\Admin\CategoryController; |
7 | use App\Http\Controllers\Admin\CategoryEmpController; | 7 | use App\Http\Controllers\Admin\CategoryEmpController; |
8 | use App\Http\Controllers\Admin\EducationController; | 8 | use App\Http\Controllers\Admin\EducationController; |
9 | use App\Http\Controllers\EducationController as EducationFrontController; | 9 | use App\Http\Controllers\EducationController as EducationFrontController; |
10 | use App\Http\Controllers\Admin\EmployersController; | 10 | use App\Http\Controllers\Admin\EmployersController; |
11 | use App\Http\Controllers\EmployerController as FrontEmployersController; | 11 | use App\Http\Controllers\EmployerController as FrontEmployersController; |
12 | use App\Http\Controllers\Admin\InfoBloksController; | 12 | use App\Http\Controllers\Admin\InfoBloksController; |
13 | use App\Http\Controllers\Admin\JobTitlesController; | 13 | use App\Http\Controllers\Admin\JobTitlesController; |
14 | use App\Http\Controllers\Admin\UsersController; | 14 | use App\Http\Controllers\Admin\UsersController; |
15 | use App\Http\Controllers\Admin\WorkersController; | 15 | use App\Http\Controllers\Admin\WorkersController; |
16 | use App\Http\Controllers\Auth\ForgotPasswordController; | 16 | use App\Http\Controllers\Auth\ForgotPasswordController; |
17 | use App\Http\Controllers\Auth\LoginController; | 17 | use App\Http\Controllers\Auth\LoginController; |
18 | use App\Http\Controllers\Auth\RegisterController; | 18 | use App\Http\Controllers\Auth\RegisterController; |
19 | use App\Http\Controllers\CKEditorController; | 19 | use App\Http\Controllers\CKEditorController; |
20 | use App\Http\Controllers\FaqController; | 20 | use App\Http\Controllers\FaqController; |
21 | use App\Http\Controllers\MediaController; | 21 | use App\Http\Controllers\MediaController; |
22 | use App\Http\Controllers\WorkerController; | 22 | use App\Http\Controllers\WorkerController; |
23 | use App\Models\Ad_jobs; | 23 | use App\Models\Ad_jobs; |
24 | use App\Models\User; | 24 | use App\Models\User; |
25 | use App\Http\Controllers\MainController; | 25 | use App\Http\Controllers\MainController; |
26 | use App\Http\Controllers\HomeController; | 26 | use App\Http\Controllers\HomeController; |
27 | use Illuminate\Support\Facades\Route; | 27 | use Illuminate\Support\Facades\Route; |
28 | use App\Http\Controllers\Admin\CompanyController; | 28 | use App\Http\Controllers\Admin\CompanyController; |
29 | use App\Http\Controllers\Admin\Ad_EmployersController; | 29 | use App\Http\Controllers\Admin\Ad_EmployersController; |
30 | use App\Http\Controllers\Admin\MsgAnswersController; | 30 | use App\Http\Controllers\Admin\MsgAnswersController; |
31 | use App\Http\Controllers\Admin\GroupsController; | 31 | use App\Http\Controllers\Admin\GroupsController; |
32 | use App\Http\Controllers\PagesController; | 32 | use App\Http\Controllers\PagesController; |
33 | use Illuminate\Support\Facades\Storage; | 33 | use Illuminate\Support\Facades\Storage; |
34 | use App\Http\Controllers\EmployerController; | 34 | use App\Http\Controllers\EmployerController; |
35 | use App\Http\Controllers\CompanyController as FrontCompanyController; | 35 | use App\Http\Controllers\CompanyController as FrontCompanyController; |
36 | 36 | ||
37 | 37 | ||
38 | /* | 38 | /* |
39 | |-------------------------------------------------------------------------- | 39 | |-------------------------------------------------------------------------- |
40 | | Web Routes | 40 | | Web Routes |
41 | |-------------------------------------------------------------------------- | 41 | |-------------------------------------------------------------------------- |
42 | | | 42 | | |
43 | | Here is where you can register web routes for your application. These | 43 | | Here is where you can register web routes for your application. These |
44 | | routes are loaded by the RouteServiceProvider within a group which | 44 | | routes are loaded by the RouteServiceProvider within a group which |
45 | | contains the "web" middleware group. Now create something great! | 45 | | contains the "web" middleware group. Now create something great! |
46 | | | 46 | | |
47 | */ | 47 | */ |
48 | /* | 48 | /* |
49 | Route::get('/', function () { | 49 | Route::get('/', function () { |
50 | return view('welcome'); | 50 | return view('welcome'); |
51 | })->name('index'); | 51 | })->name('index'); |
52 | */ | 52 | */ |
53 | 53 | ||
54 | Route::get('/', [MainController::class, 'index'])->name('index'); | 54 | Route::get('/', [MainController::class, 'index'])->name('index'); |
55 | 55 | ||
56 | //Роуты авторизации, регистрации, восстановления, аутентификации | 56 | //Роуты авторизации, регистрации, восстановления, аутентификации |
57 | Auth::routes(['verify' => true]); | 57 | Auth::routes(['verify' => true]); |
58 | 58 | ||
59 | //Личный кабинет пользователя | 59 | //Личный кабинет пользователя |
60 | Route::get('/home', [HomeController::class, 'index'])->name('home'); | 60 | Route::get('/home', [HomeController::class, 'index'])->name('home'); |
61 | 61 | ||
62 | // Авторизация, регистрация в админку | 62 | // Авторизация, регистрация в админку |
63 | Route::group([ | 63 | Route::group([ |
64 | 'as' => 'admin.', // имя маршрута, например auth.index | 64 | 'as' => 'admin.', // имя маршрута, например auth.index |
65 | 'prefix' => 'admin', // префикс маршрута, например auth/index | 65 | 'prefix' => 'admin', // префикс маршрута, например auth/index |
66 | 'middleware' => ['guest'], | 66 | 'middleware' => ['guest'], |
67 | ], function () { | 67 | ], function () { |
68 | // Форма регистрации | 68 | // Форма регистрации |
69 | Route::get('register', [AdminController::class, 'register'])->name('register'); | 69 | Route::get('register', [AdminController::class, 'register'])->name('register'); |
70 | // Создание пользователя | 70 | // Создание пользователя |
71 | Route::post('register', [AdminController::class, 'create'])->name('create'); | 71 | Route::post('register', [AdminController::class, 'create'])->name('create'); |
72 | 72 | ||
73 | //Форма входа | 73 | //Форма входа |
74 | Route::get('login', [AdminController::class, 'login'])->name('login'); | 74 | Route::get('login', [AdminController::class, 'login'])->name('login'); |
75 | 75 | ||
76 | // аутентификация | 76 | // аутентификация |
77 | Route::post('login', [AdminController::class, 'autenticate'])->name('auth'); | 77 | Route::post('login', [AdminController::class, 'autenticate'])->name('auth'); |
78 | 78 | ||
79 | }); | 79 | }); |
80 | 80 | ||
81 | // Личный кабинет админки | 81 | // Личный кабинет админки |
82 | Route::group([ | 82 | Route::group([ |
83 | 'as' => 'admin.', // имя маршрута, например auth.index | 83 | 'as' => 'admin.', // имя маршрута, например auth.index |
84 | 'prefix' => 'admin', // префикс маршрута, например auth/index | 84 | 'prefix' => 'admin', // префикс маршрута, например auth/index |
85 | 'middleware' => ['auth', 'admin'], | 85 | 'middleware' => ['auth', 'admin'], |
86 | ], function() { | 86 | ], function() { |
87 | 87 | ||
88 | // выход | 88 | // выход |
89 | Route::get('logout', [AdminController::class, 'logout'])->name('logout'); | 89 | Route::get('logout', [AdminController::class, 'logout'])->name('logout'); |
90 | 90 | ||
91 | // кабинет главная страница | 91 | // кабинет главная страница |
92 | Route::get('cabinet', [AdminController::class, 'index'])->name('index'); | 92 | Route::get('cabinet', [AdminController::class, 'index'])->name('index'); |
93 | Route::get('/', function () { | 93 | Route::get('/', function () { |
94 | return redirect()->route('admin.index'); | 94 | return redirect()->route('admin.index'); |
95 | }); | 95 | }); |
96 | 96 | ||
97 | // кабинет профиль админа - форма | 97 | // кабинет профиль админа - форма |
98 | Route::get('profile', [AdminController::class, 'profile'])->name('profile'); | 98 | Route::get('profile', [AdminController::class, 'profile'])->name('profile'); |
99 | // кабинет профиль админа - сохранение формы | 99 | // кабинет профиль админа - сохранение формы |
100 | Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile'); | 100 | Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile'); |
101 | 101 | ||
102 | //кабинет сообщения админа | 102 | //кабинет сообщения админа |
103 | //Route::get('messages', [AdminController::class, 'profile'])->name('profile'); | 103 | //Route::get('messages', [AdminController::class, 'profile'])->name('profile'); |
104 | 104 | ||
105 | 105 | ||
106 | // кабинет профиль - форма пароли | 106 | // кабинет профиль - форма пароли |
107 | Route::get('password', [AdminController::class, 'profile_password'])->name('password'); | 107 | Route::get('password', [AdminController::class, 'profile_password'])->name('password'); |
108 | // кабинет профиль - сохранение формы пароля | 108 | // кабинет профиль - сохранение формы пароля |
109 | Route::post('password', [AdminController::class, 'profile_password_new'])->name('password'); | 109 | Route::post('password', [AdminController::class, 'profile_password_new'])->name('password'); |
110 | 110 | ||
111 | 111 | ||
112 | // кабинет профиль пользователя - форма | 112 | // кабинет профиль пользователя - форма |
113 | Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile'); | 113 | Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile'); |
114 | // кабинет профиль пользователя - сохранение формы | 114 | // кабинет профиль пользователя - сохранение формы |
115 | Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile'); | 115 | Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile'); |
116 | 116 | ||
117 | // кабинет профиль работодатель - форма | 117 | // кабинет профиль работодатель - форма |
118 | Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile'); | 118 | Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile'); |
119 | // кабинет профиль работодатель - сохранение формы | 119 | // кабинет профиль работодатель - сохранение формы |
120 | Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile'); | 120 | Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile'); |
121 | // кабинет удаление профиль работодателя и юзера | 121 | // кабинет удаление профиль работодателя и юзера |
122 | Route::delete('employers/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer'); | 122 | Route::delete('employers/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer'); |
123 | 123 | ||
124 | // кабинет профиль работник - форма | 124 | // кабинет профиль работник - форма |
125 | Route::get('worker-profile/add/{user}', [WorkersController::class, 'form_add_worker'])->name('worker-profile-add'); | 125 | Route::get('worker-profile/add/{user}', [WorkersController::class, 'form_add_worker'])->name('worker-profile-add'); |
126 | Route::post('worker-profile/add/{user}', [WorkersController::class, 'form_store_worker'])->name('worker-profile-store'); | 126 | Route::post('worker-profile/add/{user}', [WorkersController::class, 'form_store_worker'])->name('worker-profile-store'); |
127 | Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit'); | 127 | Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit'); |
128 | Route::get('worker-verify/{user}', [WorkersController::class, 'verify_worker'])->name('worker-verify'); | 128 | Route::get('worker-verify/{user}', [WorkersController::class, 'verify_worker'])->name('worker-verify'); |
129 | // кабинет профиль работник - сохранение формы | 129 | // кабинет профиль работник - сохранение формы |
130 | Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update'); | 130 | Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update'); |
131 | 131 | ||
132 | // Медиа | 132 | // Медиа |
133 | Route::get('media', [MediaController::class, 'index'])->name('media'); | 133 | Route::get('media', [MediaController::class, 'index'])->name('media'); |
134 | Route::delete('media/{media}', [MediaController::class, 'delete'])->name('delete-media'); | 134 | Route::delete('media/{media}', [MediaController::class, 'delete'])->name('delete-media'); |
135 | 135 | ||
136 | // кабинет настройки сайта - форма | 136 | // кабинет настройки сайта - форма |
137 | Route::get('config', [AdminController::class, 'config_form'])->name('config'); | 137 | Route::get('config', [AdminController::class, 'config_form'])->name('config'); |
138 | // кабинет настройки сайта сохранение формы | 138 | // кабинет настройки сайта сохранение формы |
139 | Route::post('config', [AdminController::class, 'store_config'])->name('store_config'); | 139 | Route::post('config', [AdminController::class, 'store_config'])->name('store_config'); |
140 | 140 | ||
141 | // кабинет - новости | 141 | // кабинет - новости |
142 | Route::get('news-list', [AdminController::class, 'news_admin'])->name('news_admin'); | 142 | Route::get('news-list', [AdminController::class, 'news_admin'])->name('news_admin'); |
143 | Route::get('news/add', [AdminController::class, 'new_admin_add'])->name('new_admin_add'); | 143 | Route::get('news/add', [AdminController::class, 'new_admin_add'])->name('new_admin_add'); |
144 | Route::post('news/add', [AdminController::class, 'new_admin_add_save'])->name('new_admin_save_add'); | 144 | Route::post('news/add', [AdminController::class, 'new_admin_add_save'])->name('new_admin_save_add'); |
145 | Route::get('news/edit/{new}', [AdminController::class, 'new_admin_edit'])->name('new_admin_edit'); | 145 | Route::get('news/edit/{new}', [AdminController::class, 'new_admin_edit'])->name('new_admin_edit'); |
146 | Route::post('news/edit/{new}', [AdminController::class, 'new_admin_update_save'])->name('new_admin_update'); | 146 | Route::post('news/edit/{new}', [AdminController::class, 'new_admin_update_save'])->name('new_admin_update'); |
147 | Route::get('news/delete/{new}', [AdminController::class, 'new_admin_delete'])->name('new_admin_delete'); | 147 | Route::get('news/delete/{new}', [AdminController::class, 'new_admin_delete'])->name('new_admin_delete'); |
148 | 148 | ||
149 | // кабинет - пользователи | 149 | // кабинет - пользователи |
150 | Route::get('users', [UsersController::class, 'index'])->name('users'); | 150 | Route::get('users', [UsersController::class, 'index'])->name('users'); |
151 | Route::get('user-delete/{user}', [UsersController::class, 'user_delete'])->name('user_delete'); | 151 | Route::get('user-delete/{user}', [UsersController::class, 'user_delete'])->name('user_delete'); |
152 | 152 | ||
153 | // кабинет - пользователи | 153 | // кабинет - пользователи |
154 | Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users'); | 154 | Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users'); |
155 | 155 | ||
156 | // кабинет - работодатели | 156 | // кабинет - работодатели |
157 | Route::get('employers', [EmployersController::class, 'index'])->name('employers'); | 157 | Route::get('employers', [EmployersController::class, 'index'])->name('employers'); |
158 | 158 | ||
159 | Route::get('employers/comment/{employer}', [EmployersController::class, 'comment_read'])->name('comment-employer'); | 159 | Route::get('employers/comment/{employer}', [EmployersController::class, 'comment_read'])->name('comment-employer'); |
160 | 160 | ||
161 | Route::get('flot/add/{employer}', [EmployersController::class, 'add_flot'])->name('flot_add'); | 161 | Route::get('flot/add/{employer}', [EmployersController::class, 'add_flot'])->name('flot_add'); |
162 | Route::post('flot/add', [EmployersController::class, 'save_add_flot'])->name('flot_add_save'); | 162 | Route::post('flot/add', [EmployersController::class, 'save_add_flot'])->name('flot_add_save'); |
163 | Route::get('flot/{flot}/{employer}', [EmployersController::class, 'edit_flot'])->name('flot'); | 163 | Route::get('flot/{flot}/{employer}', [EmployersController::class, 'edit_flot'])->name('flot'); |
164 | Route::put('flot/{flot}', [EmployersController::class, 'edit_save_flot'])->name('flot_edit'); | 164 | Route::put('flot/{flot}', [EmployersController::class, 'edit_save_flot'])->name('flot_edit'); |
165 | Route::get('flot/{flot}/{employer_id}/delete', [EmployersController::class, 'delete_flot'])->name('flot_delete'); | 165 | Route::get('flot/{flot}/{employer_id}/delete', [EmployersController::class, 'delete_flot'])->name('flot_delete'); |
166 | 166 | ||
167 | // кабинет - соискатели | 167 | // кабинет - соискатели |
168 | Route::get('workers', [WorkersController::class, 'index'])->name('workers'); | 168 | Route::get('workers', [WorkersController::class, 'index'])->name('workers'); |
169 | 169 | ||
170 | // кабинет - база данных | 170 | // кабинет - база данных |
171 | Route::get('basedata', [UsersController::class, 'index_bd'])->name('basedata'); | 171 | Route::get('basedata', [UsersController::class, 'index_bd'])->name('basedata'); |
172 | Route::get('basedata/add', [UsersController::class, 'add_bd'])->name('add-basedata'); | 172 | Route::get('basedata/add', [UsersController::class, 'add_bd'])->name('add-basedata'); |
173 | Route::post('basedata/add', [UsersController::class, 'add_store_bd'])->name('add-store-basedata'); | 173 | Route::post('basedata/add', [UsersController::class, 'add_store_bd'])->name('add-store-basedata'); |
174 | Route::get('basedata/edit/{user}', [UsersController::class, 'edit_bd'])->name('edit-basedata'); | 174 | Route::get('basedata/edit/{user}', [UsersController::class, 'edit_bd'])->name('edit-basedata'); |
175 | Route::put('basedata/edit/{user}', [UsersController::class, 'update_bd'])->name('update-basedata'); | 175 | Route::put('basedata/edit/{user}', [UsersController::class, 'update_bd'])->name('update-basedata'); |
176 | Route::delete('basedata/delete/{user}', [UsersController::class, 'destroy_bd'])->name('delete-basedata'); | 176 | Route::delete('basedata/delete/{user}', [UsersController::class, 'destroy_bd'])->name('delete-basedata'); |
177 | Route::get('basedata/doc/{user}', [UsersController::class, 'doc_bd'])->name('doc-basedata'); | 177 | Route::get('basedata/doc/{user}', [UsersController::class, 'doc_bd'])->name('doc-basedata'); |
178 | 178 | ||
179 | // кабинет - вакансии | 179 | // кабинет - вакансии |
180 | Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers'); | 180 | Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers'); |
181 | Route::get('ad-employers/add', [Ad_EmployersController::class, 'create'])->name('add-ad-employers'); | 181 | Route::get('ad-employers/add', [Ad_EmployersController::class, 'create'])->name('add-ad-employers'); |
182 | Route::post('ad-employers/add', [Ad_EmployersController::class, 'store'])->name('store-ad-employers'); | 182 | Route::post('ad-employers/add', [Ad_EmployersController::class, 'store'])->name('store-ad-employers'); |
183 | Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers'); | 183 | Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers'); |
184 | Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers'); | 184 | Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers'); |
185 | Route::delete('ad-employers/delete/{ad_employer}', [Ad_EmployersController::class, 'destroy'])->name('delete-ad-employer'); | 185 | Route::delete('ad-employers/delete/{ad_employer}', [Ad_EmployersController::class, 'destroy'])->name('delete-ad-employer'); |
186 | 186 | ||
187 | // Редактирование должности в вакансии | 187 | // Редактирование должности в вакансии |
188 | Route::put('update-jobs/{ad_jobs}', [Ad_EmployersController::class, 'update_ad_jobs'])->name('update_jobs'); | 188 | Route::put('update-jobs/{ad_jobs}', [Ad_EmployersController::class, 'update_ad_jobs'])->name('update_jobs'); |
189 | Route::get('edit-jobs/{ad_jobs}', [Ad_EmployersController::class, 'edit_jobs'])->name('edit_jobs'); | 189 | Route::get('edit-jobs/{ad_jobs}', [Ad_EmployersController::class, 'edit_jobs'])->name('edit_jobs'); |
190 | 190 | ||
191 | 191 | ||
192 | // кабинет - категории | 192 | // кабинет - категории |
193 | //Route::get('categories', [AdminController::class, 'index'])->name('categories'); | 193 | //Route::get('categories', [AdminController::class, 'index'])->name('categories'); |
194 | 194 | ||
195 | // СRUD-операции над Справочником Категории | 195 | // СRUD-операции над Справочником Категории |
196 | 196 | ||
197 | Route::resource('categories', CategoryController::class, ['except' => ['show']]); | 197 | Route::resource('categories', CategoryController::class, ['except' => ['show']]); |
198 | 198 | ||
199 | // CRUD-операции над справочником Категории для работодателей | 199 | // CRUD-операции над справочником Категории для работодателей |
200 | Route::resource('category-emp', CategoryEmpController::class, ['except' => ['show']]); | 200 | Route::resource('category-emp', CategoryEmpController::class, ['except' => ['show']]); |
201 | 201 | ||
202 | // CRUD-операции над справочником Образование | 202 | // CRUD-операции над справочником Образование |
203 | Route::resource('education', EducationController::class, ['except' => ['show']]); | 203 | Route::resource('education', EducationController::class, ['except' => ['show']]); |
204 | 204 | ||
205 | Route::get('rename-program-education', [EducationController::class, 'rename_program'])->name('rename-program-education'); | 205 | Route::get('rename-program-education', [EducationController::class, 'rename_program'])->name('rename-program-education'); |
206 | Route::get('program-education', [EducationController::class, 'add_program'])->name('add-program-education'); | 206 | Route::get('program-education', [EducationController::class, 'add_program'])->name('add-program-education'); |
207 | Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education'); | 207 | Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education'); |
208 | 208 | ||
209 | Route::get('program-education/edit/{program}/{education}', [EducationController::class, 'edit_program'])->name('edit-program-education'); | 209 | Route::get('program-education/edit/{program}/{education}', [EducationController::class, 'edit_program'])->name('edit-program-education'); |
210 | Route::post('program-education/edit/{program}/{education}', [EducationController::class, 'update_program'])->name('update-program-education'); | 210 | Route::post('program-education/edit/{program}/{education}', [EducationController::class, 'update_program'])->name('update-program-education'); |
211 | 211 | ||
212 | Route::get('program-education/delete/{program}/{education}', [EducationController::class, 'delete_program'])->name('delete-program-education'); | 212 | Route::get('program-education/delete/{program}/{education}', [EducationController::class, 'delete_program'])->name('delete-program-education'); |
213 | 213 | ||
214 | /* | 214 | /* |
215 | * кабинет - CRUD-операции по справочнику должности | 215 | * кабинет - CRUD-операции по справочнику должности |
216 | * | 216 | * |
217 | */ | 217 | */ |
218 | Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]); | 218 | Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]); |
219 | 219 | ||
220 | // кабинет - сообщения (чтение чужих) | 220 | // кабинет - сообщения (чтение чужих) |
221 | Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages'); | 221 | Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages'); |
222 | // кабинет - просмотр сообщения чужого (чтение) | 222 | // кабинет - просмотр сообщения чужого (чтение) |
223 | Route::get('messages/{message}', [MsgAnswersController::class, 'read_message'])->name('read-message'); | 223 | Route::get('messages/{message}', [MsgAnswersController::class, 'read_message'])->name('read-message'); |
224 | 224 | ||
225 | // кабинет - сообщения (админские) | 225 | // кабинет - сообщения (админские) |
226 | Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages'); | 226 | Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages'); |
227 | // кабинет - сообщения (админские) | 227 | // кабинет - сообщения (админские) |
228 | Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post'); | 228 | Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post'); |
229 | // кабинет - sql - конструкция запросов | 229 | // кабинет - sql - конструкция запросов |
230 | Route::get('messages-sql', [MsgAnswersController::class, 'messages_sql'])->name('messages-sql'); | 230 | Route::get('messages-sql', [MsgAnswersController::class, 'messages_sql'])->name('messages-sql'); |
231 | 231 | ||
232 | Route::post('admin-reject-message', [MsgAnswersController::class, 'reject_message'])->name('reject_message'); | 232 | Route::post('admin-reject-message', [MsgAnswersController::class, 'reject_message'])->name('reject_message'); |
233 | Route::post('admin-send-message', [MsgAnswersController::class, 'send_message'])->name('send_message'); | 233 | Route::post('admin-send-message', [MsgAnswersController::class, 'send_message'])->name('send_message'); |
234 | 234 | ||
235 | /* | 235 | /* |
236 | * Расписанный подход в описании каждой директорий групп пользователей. | 236 | * Расписанный подход в описании каждой директорий групп пользователей. |
237 | */ | 237 | */ |
238 | // кабинет - группы пользователей | 238 | // кабинет - группы пользователей |
239 | Route::get('groups', [GroupsController::class, 'index'])->name('groups'); | 239 | Route::get('groups', [GroupsController::class, 'index'])->name('groups'); |
240 | // кабинет - добавление форма группы пользователей | 240 | // кабинет - добавление форма группы пользователей |
241 | Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group'); | 241 | Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group'); |
242 | // кабинет - сохранение формы группы пользователей | 242 | // кабинет - сохранение формы группы пользователей |
243 | Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store'); | 243 | Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store'); |
244 | // кабинет - редактирование форма группы пользователей | 244 | // кабинет - редактирование форма группы пользователей |
245 | Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group'); | 245 | Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group'); |
246 | // кабинет - сохранение редактированной формы группы пользователей | 246 | // кабинет - сохранение редактированной формы группы пользователей |
247 | Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group'); | 247 | Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group'); |
248 | // кабинет - удаление группы пользователей | 248 | // кабинет - удаление группы пользователей |
249 | Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group'); | 249 | Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group'); |
250 | 250 | ||
251 | 251 | ||
252 | // кабинет - список админов | 252 | // кабинет - список админов |
253 | Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin'); | 253 | Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin'); |
254 | 254 | ||
255 | // справочник Позиции | 255 | // справочник Позиции |
256 | Route::get('positions', [AdminController::class, 'position'])->name('position'); | 256 | Route::get('positions', [AdminController::class, 'position'])->name('position'); |
257 | Route::get('positions/add', [AdminController::class, 'position_add'])->name('add-position'); | 257 | Route::get('positions/add', [AdminController::class, 'position_add'])->name('add-position'); |
258 | Route::post('positions/add', [AdminController::class, 'position_add_save'])->name('add-save-position'); | 258 | Route::post('positions/add', [AdminController::class, 'position_add_save'])->name('add-save-position'); |
259 | Route::get('positions/edit/{position}', [AdminController::class, 'position_edit'])->name('edit-position'); | 259 | Route::get('positions/edit/{position}', [AdminController::class, 'position_edit'])->name('edit-position'); |
260 | Route::post('position/edit/{position}', [AdminController::class, 'position_update'])->name('update-position'); | 260 | Route::post('position/edit/{position}', [AdminController::class, 'position_update'])->name('update-position'); |
261 | Route::get('position/delete/{position}', [AdminController::class, 'position_delete'])->name('delete-position'); | 261 | Route::get('position/delete/{position}', [AdminController::class, 'position_delete'])->name('delete-position'); |
262 | 262 | ||
263 | /////редактор////// кабинет - редактор сайта//////////////////////// | 263 | /////редактор////// кабинет - редактор сайта//////////////////////// |
264 | Route::get('editor-site', function() { | 264 | Route::get('editor-site', function() { |
265 | return view('admin.editor.index'); | 265 | return view('admin.editor.index'); |
266 | })->name('editor-site'); | 266 | })->name('editor-site'); |
267 | 267 | ||
268 | 268 | ||
269 | // кабинет - редактор шапки-футера сайта | 269 | // кабинет - редактор шапки-футера сайта |
270 | Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks'); | 270 | Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks'); |
271 | Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block'); | 271 | Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block'); |
272 | Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store'); | 272 | Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store'); |
273 | Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block'); | 273 | Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block'); |
274 | Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block'); | 274 | Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block'); |
275 | Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block'); | 275 | Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block'); |
276 | Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block'); | 276 | Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block'); |
277 | 277 | ||
278 | 278 | ||
279 | // кабинет - редактор должности на главной | 279 | // кабинет - редактор должности на главной |
280 | Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main'); | 280 | Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main'); |
281 | 281 | ||
282 | // кабинет - счетчики на главной | 282 | // кабинет - счетчики на главной |
283 | Route::get('counters-main', [CompanyController::class, 'counters_main'])->name('counters-main'); | 283 | Route::get('counters-main', [CompanyController::class, 'counters_main'])->name('counters-main'); |
284 | Route::post('counters-main/edit/{name}', [CompanyController::class, 'counters_main_update'])->name('counters-main-update'); | 284 | Route::post('counters-main/edit/{name}', [CompanyController::class, 'counters_main_update'])->name('counters-main-update'); |
285 | 285 | ||
286 | // кабинет - редактор работодатели на главной | 286 | // кабинет - редактор работодатели на главной |
287 | Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main'); | 287 | Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main'); |
288 | Route::post('employers-main-add', [CompanyController::class, 'employers_main_add'])->name('employers-main-add'); | 288 | Route::post('employers-main-add', [CompanyController::class, 'employers_main_add'])->name('employers-main-add'); |
289 | Route::post('employers-main-remove', [CompanyController::class, 'employers_main_remove'])->name('employers-main-remove'); | 289 | Route::post('employers-main-remove', [CompanyController::class, 'employers_main_remove'])->name('employers-main-remove'); |
290 | 290 | ||
291 | 291 | ||
292 | // кабинет - редактор seo-сайта | 292 | // кабинет - редактор seo-сайта |
293 | Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo'); | 293 | Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo'); |
294 | Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo'); | 294 | Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo'); |
295 | Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store'); | 295 | Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store'); |
296 | Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo'); | 296 | Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo'); |
297 | Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo'); | 297 | Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo'); |
298 | Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo'); | 298 | Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo'); |
299 | Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo'); | 299 | Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo'); |
300 | 300 | ||
301 | 301 | ||
302 | // кабинет - редактор страниц | 302 | // кабинет - редактор страниц |
303 | Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages'); | 303 | Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages'); |
304 | // кабинет - добавление страницы | 304 | // кабинет - добавление страницы |
305 | Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page'); | 305 | Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page'); |
306 | // кабинет - сохранение формы страницы | 306 | // кабинет - сохранение формы страницы |
307 | Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store'); | 307 | Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store'); |
308 | // кабинет - редактирование форма страницы | 308 | // кабинет - редактирование форма страницы |
309 | Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page'); | 309 | Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page'); |
310 | // кабинет - сохранение редактированной формы страницы | 310 | // кабинет - сохранение редактированной формы страницы |
311 | Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page'); | 311 | Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page'); |
312 | // кабинет - удаление страницы | 312 | // кабинет - удаление страницы |
313 | Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page'); | 313 | Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page'); |
314 | 314 | ||
315 | 315 | ||
316 | // кабинет - реклама сайта | 316 | // кабинет - реклама сайта |
317 | Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames'); | 317 | Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames'); |
318 | Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames'); | 318 | Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames'); |
319 | Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store'); | 319 | Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store'); |
320 | Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames'); | 320 | Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames'); |
321 | Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames'); | 321 | Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames'); |
322 | Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames'); | 322 | Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames'); |
323 | //////////////////////////////////////////////////////////////////////// | 323 | //////////////////////////////////////////////////////////////////////// |
324 | 324 | ||
325 | 325 | ||
326 | // кабинет - отзывы о работодателе для модерации | 326 | // кабинет - отзывы о работодателе для модерации |
327 | Route::get('answers', [EmployersController::class, 'answers'])->name('answers'); | 327 | Route::get('answers', [EmployersController::class, 'answers'])->name('answers'); |
328 | 328 | ||
329 | // Общая страница статистики | 329 | // Общая страница статистики |
330 | Route::get('statics', function () { | 330 | Route::get('statics', function () { |
331 | return view('admin.static.index'); | 331 | return view('admin.static.index'); |
332 | })->name('statics'); | 332 | })->name('statics'); |
333 | 333 | ||
334 | // кабинет - статистика работников | 334 | // кабинет - статистика работников |
335 | Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers'); | 335 | Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers'); |
336 | 336 | ||
337 | // кабинет - статистика вакансий работодателя | 337 | // кабинет - статистика вакансий работодателя |
338 | Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads'); | 338 | Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads'); |
339 | 339 | ||
340 | // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника | 340 | // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника |
341 | /* | 341 | /* |
342 | * CRUD-операции над справочником дипломы и документы | 342 | * CRUD-операции над справочником дипломы и документы |
343 | */ | 343 | */ |
344 | //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks'); | 344 | //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks'); |
345 | Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]); | 345 | Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]); |
346 | 346 | ||
347 | // кабинет - роли пользователя | 347 | // кабинет - роли пользователя |
348 | Route::get('roles', [UsersController::class, 'roles'])->name('roles'); | 348 | Route::get('roles', [UsersController::class, 'roles'])->name('roles'); |
349 | 349 | ||
350 | Route::get('admin_roles', [UsersController::class, 'admin_roles'])->name('admin_roles'); | 350 | Route::get('admin_roles', [UsersController::class, 'admin_roles'])->name('admin_roles'); |
351 | 351 | ||
352 | Route::get('logs', function() { | 352 | Route::get('logs', function() { |
353 | $files = Storage::files('logs/laravel.log'); | 353 | $files = Storage::files('logs/laravel.log'); |
354 | })->name('logs'); | 354 | })->name('logs'); |
355 | 355 | ||
356 | Route::prefix('faq')->as('faq.')->group(function () { | 356 | Route::prefix('faq')->as('faq.')->group(function () { |
357 | Route::middleware('admin')->group(function () { | 357 | Route::middleware('admin')->group(function () { |
358 | Route::get('/', [FaqController::class, 'showListForAdmin'])->name('list'); | 358 | Route::get('/', [FaqController::class, 'showListForAdmin'])->name('list'); |
359 | Route::get('/create', [FaqController::class, 'create'])->name('create'); | 359 | Route::get('/create', [FaqController::class, 'create'])->name('create'); |
360 | Route::post('/create', [FaqController::class, 'store'])->name('store'); | 360 | Route::post('/create', [FaqController::class, 'store'])->name('store'); |
361 | Route::get('/edit/{id}', [FaqController::class, 'edit'])->name('edit'); | 361 | Route::get('/edit/{id}', [FaqController::class, 'edit'])->name('edit'); |
362 | Route::put('/edit/{id}', [FaqController::class, 'update'])->name('update'); | 362 | Route::put('/edit/{id}', [FaqController::class, 'update'])->name('update'); |
363 | Route::get('/destroy/{id}', [FaqController::class, 'destroy'])->name('destroy'); | 363 | Route::get('/destroy/{id}', [FaqController::class, 'destroy'])->name('destroy'); |
364 | }); | 364 | }); |
365 | }); | 365 | }); |
366 | }); | 366 | }); |
367 | 367 | ||
368 | // Инструментальные страницы | 368 | // Инструментальные страницы |
369 | Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload'); | 369 | Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload'); |
370 | 370 | ||
371 | Route::get('redis/', [PagesController::class, 'redis'])->name('redis'); | 371 | Route::get('redis/', [PagesController::class, 'redis'])->name('redis'); |
372 | 372 | ||
373 | Route::get('excel/', [PagesController::class, 'excel'])->name('excel'); | 373 | Route::get('excel/', [PagesController::class, 'excel'])->name('excel'); |
374 | 374 | ||
375 | // Страницы с произвольным контентом | 375 | // Страницы с произвольным контентом |
376 | Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page'); | 376 | Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page'); |
377 | 377 | ||
378 | // Форма обратной связи | 378 | // Форма обратной связи |
379 | Route::post('form_feedback', [PagesController::class, 'form_feedback'])->name('form_feedback'); | 379 | Route::post('form_feedback', [PagesController::class, 'form_feedback'])->name('form_feedback'); |
380 | 380 | ||
381 | // Публичные страницы соискателя | 381 | // Публичные страницы соискателя |
382 | Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page'); | 382 | Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page'); |
383 | 383 | ||
384 | //Страница вакансии | 384 | //Страница вакансии |
385 | Route::get('employer/ad/{ad_employer}', [AdEmployerController::class, 'ad_employer'])->name('ad-employer'); | 385 | Route::get('employer/ad/{ad_employer}', [AdEmployerController::class, 'ad_employer'])->name('ad-employer'); |
386 | 386 | ||
387 | //Вакансии | 387 | //Вакансии |
388 | Route::get('vacancies', [MainController::class, 'vacancies'])->name('vacancies'); | 388 | Route::get('vacancies', [MainController::class, 'vacancies'])->name('vacancies'); |
389 | 389 | ||
390 | //Вакансии поиск на главной | 390 | //Вакансии поиск на главной |
391 | Route::get('search-vacancies', [MainController::class, 'search_vacancies'])->name('search_vacancies'); | 391 | Route::get('search-vacancies', [MainController::class, 'search_vacancies'])->name('search_vacancies'); |
392 | 392 | ||
393 | //Вакансии категория детальная | 393 | //Вакансии категория детальная |
394 | Route::get('list-vacancies/{categories?}', [MainController::class, 'list_vacancies'])->name('list-vacancies'); | 394 | Route::get('list-vacancies/{categories?}', [MainController::class, 'list_vacancies'])->name('list-vacancies'); |
395 | 395 | ||
396 | // Лайк вакансии | 396 | // Лайк вакансии |
397 | Route::get('like-vacancy', [MainController::class, 'like_vacancy'])->name('like-vacancy'); | 397 | Route::get('like-vacancy', [MainController::class, 'like_vacancy'])->name('like-vacancy'); |
398 | 398 | ||
399 | //Детальная страница вакансии - работодателя | 399 | //Детальная страница вакансии - работодателя |
400 | Route::get('vacancie/{vacancy}', [FrontEmployersController::class, 'vacancie'])->name('vacancie'); | 400 | Route::get('vacancie/{vacancy}', [FrontEmployersController::class, 'vacancie'])->name('vacancie'); |
401 | 401 | ||
402 | Route::get('vacancy/{vacancy}', [AdEmployerController::class, 'getById'])->name('get-vacancy-by-id'); | 402 | Route::get('vacancy/{vacancy}', [AdEmployerController::class, 'getById'])->name('get-vacancy-by-id'); |
403 | 403 | ||
404 | //Судоходные компании | 404 | //Судоходные компании |
405 | Route::get('shipping-companies', [FrontCompanyController::class, 'shipping_companies'])->name('shipping_companies'); | 405 | Route::get('shipping-companies', [FrontCompanyController::class, 'shipping_companies'])->name('shipping_companies'); |
406 | 406 | ||
407 | //Детальная инфа о компании | 407 | //Детальная инфа о компании |
408 | Route::get('info-company/{company}', [FrontCompanyController::class, 'info_company'])->name('info_company'); | 408 | Route::get('info-company/{company}', [FrontCompanyController::class, 'info_company'])->name('info_company'); |
409 | 409 | ||
410 | //Образование | 410 | //Образование |
411 | Route::get('education', [EducationFrontController::class, 'index'])->name('education'); | 411 | Route::get('education', [EducationFrontController::class, 'index'])->name('education'); |
412 | Route::get('education/{education}', [EducationFrontController::class, 'show'])->name('show_education')->where('education', '[0-9]+');; | 412 | Route::get('education/{education}', [EducationFrontController::class, 'show'])->name('show_education')->where('education', '[0-9]+');; |
413 | 413 | ||
414 | //Новости | 414 | //Новости |
415 | Route::get('news', [MainController::class, 'news'])->name('news'); | 415 | Route::get('news', [MainController::class, 'news'])->name('news'); |
416 | Route::get('detail-new/{new}', [MainController::class, 'detail_new'])->name('detail_new'); | 416 | Route::get('detail-new/{new}', [MainController::class, 'detail_new'])->name('detail_new'); |
417 | 417 | ||
418 | //Контакты | 418 | //Контакты |
419 | Route::get('contacts', [MainController::class, 'contacts'])->name('contacts'); | 419 | Route::get('contacts', [MainController::class, 'contacts'])->name('contacts'); |
420 | 420 | ||
421 | //База резюме | 421 | //База резюме |
422 | Route::get('bd-resume', [WorkerController::class, 'bd_resume'])->name('bd_resume'); | 422 | Route::get('bd-resume', [WorkerController::class, 'bd_resume'])->name('bd_resume'); |
423 | Route::get('bd_resume_danger', function(){ | 423 | Route::get('bd_resume_danger', function(){ |
424 | return view('employers.bd_resume_danger'); | 424 | return view('employers.bd_resume_danger'); |
425 | })->name('bd_resume_danger'); | 425 | })->name('bd_resume_danger'); |
426 | 426 | ||
427 | Route::get('like-resume', [MainController::class, 'like_worker'])->name('like_resume'); | 427 | Route::get('like-resume', [MainController::class, 'like_worker'])->name('like_resume'); |
428 | 428 | ||
429 | //Анкета соискателя | 429 | //Анкета соискателя |
430 | Route::get('resume-profile/{worker}', [WorkerController::class, 'resume_profile'])->name('resume_profile'); | 430 | Route::get('resume-profile/{worker}', [WorkerController::class, 'resume_profile'])->name('resume_profile'); |
431 | 431 | ||
432 | //Скачать резюме | 432 | //Скачать резюме |
433 | Route::get('resume-download/{worker}', [WorkerController::class, 'resume_download'])->name('resume_download'); | 433 | Route::get('resume-download/{worker}', [WorkerController::class, 'resume_download'])->name('resume_download'); |
434 | Route::get('resume-download/all', [WorkerController::class, 'resume_download_all'])->name('resume_download_all2'); | 434 | Route::get('resume-download/all', [WorkerController::class, 'resume_download_all'])->name('resume_download_all2'); |
435 | Route::get('resume-download', [WorkerController::class, 'resume_download_all'])->name('resume_download_all'); | 435 | Route::get('resume-download', [WorkerController::class, 'resume_download_all'])->name('resume_download_all'); |
436 | 436 | ||
437 | 437 | ||
438 | //Вход в кабинет | 438 | //Вход в кабинет |
439 | Route::get('login', [MainController::class, 'input_login'])->name('login'); | 439 | Route::get('login', [MainController::class, 'input_login'])->name('login'); |
440 | 440 | ||
441 | // Выход из кабинета | 441 | // Выход из кабинета |
442 | Route::get('logout', [EmployerController::class, 'logout'])->name('logout'); | 442 | Route::get('logout', [EmployerController::class, 'logout'])->name('logout'); |
443 | 443 | ||
444 | Route::get( 'register_worker', [WorkerController::class, 'register_worker'])->name('register_worker'); | 444 | Route::post( 'register_worker', [WorkerController::class, 'register_worker'])->name('register_worker'); |
445 | Route::get('register_employer', [EmployerController::class, 'register_employer'])->name('register_employer'); | 445 | Route::post('register_employer', [EmployerController::class, 'register_employer'])->name('register_employer'); |
446 | 446 | ||
447 | //восстановление пароля | 447 | //восстановление пароля |
448 | Route::get('repair-password', [MainController::class, 'repair_password'])->name('repair_password'); | 448 | Route::get('repair-password', [MainController::class, 'repair_password'])->name('repair_password'); |
449 | // Звезда сообщения | 449 | // Звезда сообщения |
450 | Route::post('stars-answer', [WorkerController::class, 'stars_answer'])->name('stars_answer'); | 450 | Route::post('stars-answer', [WorkerController::class, 'stars_answer'])->name('stars_answer'); |
451 | 451 | ||
452 | // Борьба | 452 | // Борьба |
453 | Route::get('clear_cookie', function() { | 453 | Route::get('clear_cookie', function() { |
454 | \App\Classes\Cookies_vacancy::clear_vacancy(); | 454 | \App\Classes\Cookies_vacancy::clear_vacancy(); |
455 | return redirect()->route('index'); | 455 | return redirect()->route('index'); |
456 | })->name('clear_cookie'); | 456 | })->name('clear_cookie'); |
457 | 457 | ||
458 | Route::get('cookies', function() { | 458 | Route::get('cookies', function() { |
459 | return view('cookies'); | 459 | return view('cookies'); |
460 | })->name('cookies'); | 460 | })->name('cookies'); |
461 | 461 | ||
462 | // Личный кабинет работник | 462 | // Личный кабинет работник |
463 | Route::group([ | 463 | Route::group([ |
464 | 'as' => 'worker.', // имя маршрута, например auth.index | 464 | 'as' => 'worker.', // имя маршрута, например auth.index |
465 | 'prefix' => 'worker', // префикс маршрута, например auth/index | 465 | 'prefix' => 'worker', // префикс маршрута, например auth/index |
466 | 'middleware' => ['auth', 'is_worker'], | 466 | 'middleware' => ['auth', 'is_worker'], |
467 | ], function() { | 467 | ], function() { |
468 | // Формы редактирования | 468 | // Формы редактирования |
469 | Route::get('cabinet/basic_information', [WorkerController::class, 'basic_information'])->name('basic_information'); | 469 | Route::get('cabinet/basic_information', [WorkerController::class, 'basic_information'])->name('basic_information'); |
470 | Route::get('cabinet/additional_documents', [WorkerController::class, 'additional_documents'])->name('additional_documents'); | 470 | Route::get('cabinet/additional_documents', [WorkerController::class, 'additional_documents'])->name('additional_documents'); |
471 | 471 | ||
472 | // 1 страница - Моя анкета | 472 | // 1 страница - Моя анкета |
473 | Route::get('cabinet', [WorkerController::class, 'cabinet'])->name('cabinet'); | 473 | Route::get('cabinet', [WorkerController::class, 'cabinet'])->name('cabinet'); |
474 | Route::post('cabinet/{worker}', [WorkerController::class, 'cabinet_save'])->name('cabinet_save'); | 474 | Route::post('cabinet/{worker}', [WorkerController::class, 'cabinet_save'])->name('cabinet_save'); |
475 | Route::post('cabinet/cabinet_save_foto/{worker}', [WorkerController::class, 'cabinet_save_foto'])->name('cabinet_save_foto'); | 475 | Route::post('cabinet/cabinet_save_foto/{worker}', [WorkerController::class, 'cabinet_save_foto'])->name('cabinet_save_foto'); |
476 | 476 | ||
477 | Route::get('cabinet/subscribe', [WorkerController::class, 'subscribe'])->name('subscribe'); | 477 | Route::get('cabinet/subscribe', [WorkerController::class, 'subscribe'])->name('subscribe'); |
478 | Route::post('cabinet/subscribe/save', [WorkerController::class, 'save_subscribe'])->name('save_subscribe'); | 478 | Route::post('cabinet/subscribe/save', [WorkerController::class, 'save_subscribe'])->name('save_subscribe'); |
479 | 479 | ||
480 | 480 | ||
481 | // 2 страница - Сообщения | 481 | // 2 страница - Сообщения |
482 | Route::get('cabinet/messages/{type_message}', [WorkerController::class, 'messages'])->name('messages'); | 482 | Route::get('cabinet/messages/{type_message}', [WorkerController::class, 'messages'])->name('messages'); |
483 | Route::get('cabinet/dialog/{chat}', [WorkerController::class, 'dialog'])->name('dialog'); | 483 | Route::get('cabinet/dialog/{chat}', [WorkerController::class, 'dialog'])->name('dialog'); |
484 | // 3 страница - Избранные вакансии | 484 | // 3 страница - Избранные вакансии |
485 | Route::get('cabinet/favorite', [WorkerController::class, 'favorite'])->name('favorite'); | 485 | Route::get('cabinet/favorite', [WorkerController::class, 'favorite'])->name('favorite'); |
486 | // Продолжение борьбы против колорадов - избранные вакансии | 486 | // Продолжение борьбы против колорадов - избранные вакансии |
487 | Route::get('кабинет/favorite', [WorkerController::class, 'colorado'])->name('colorado'); | 487 | Route::get('кабинет/favorite', [WorkerController::class, 'colorado'])->name('colorado'); |
488 | 488 | ||
489 | // 4 страница - Сменить пароль | 489 | // 4 страница - Сменить пароль |
490 | Route::get('кабинет/new_password', [WorkerController::class, 'new_password'])->name('new_password'); | 490 | Route::get('кабинет/new_password', [WorkerController::class, 'new_password'])->name('new_password'); |
491 | Route::post('кабинет/new_password/save', [WorkerController::class, 'save_new_password'])->name('save_new_password'); | 491 | Route::post('кабинет/new_password/save', [WorkerController::class, 'save_new_password'])->name('save_new_password'); |
492 | 492 | ||
493 | // 5 страница - Удалить профиль | 493 | // 5 страница - Удалить профиль |
494 | Route::get('кабинет/delete_profile', [WorkerController::class, 'delete_profile'])->name('delete_profile'); | 494 | Route::get('кабинет/delete_profile', [WorkerController::class, 'delete_profile'])->name('delete_profile'); |
495 | Route::post('кабинет/delete_profile/delete', [WorkerController::class, 'delete_profile_result'])->name('deleteprofile_result'); | 495 | Route::post('кабинет/delete_profile/delete', [WorkerController::class, 'delete_profile_result'])->name('deleteprofile_result'); |
496 | 496 | ||
497 | // Резюме -pdf | 497 | // Резюме -pdf |
498 | Route::get('кабинет/download/{worker}', [WorkerController::class, 'download'])->name('download'); | 498 | Route::get('кабинет/download/{worker}', [WorkerController::class, 'download'])->name('download'); |
499 | 499 | ||
500 | // Поднятие анкеты | 500 | // Поднятие анкеты |
501 | Route::get('кабинет/up/{worker}', [WorkerController::class, 'up'])->name('up'); | 501 | Route::get('кабинет/up/{worker}', [WorkerController::class, 'up'])->name('up'); |
502 | 502 | ||
503 | Route::post('test123', [WorkerController::class, 'test123'])->name('test123'); | 503 | Route::post('test123', [WorkerController::class, 'test123'])->name('test123'); |
504 | 504 | ||
505 | // Добавление сертификата | 505 | // Добавление сертификата |
506 | Route::get('кабинет/new_sertificate/{worker}', [WorkerController::class, 'new_sertificate'])->name('new_sertificate'); | 506 | Route::get('кабинет/new_sertificate/{worker}', [WorkerController::class, 'new_sertificate'])->name('new_sertificate'); |
507 | Route::post('кабинет/add_sertificate', [WorkerController::class, 'add_serificate'])->name('add_serificate'); | 507 | Route::post('кабинет/add_sertificate', [WorkerController::class, 'add_serificate'])->name('add_serificate'); |
508 | Route::get('кабинет/edit_sertificate/{worker}/{doc}', [WorkerController::class, 'edit_sertificate'])->name('edit_sertificate'); | 508 | Route::get('кабинет/edit_sertificate/{worker}/{doc}', [WorkerController::class, 'edit_sertificate'])->name('edit_sertificate'); |
509 | Route::get('кабинет/edit_sertificate/{doc}', [WorkerController::class, 'update_serificate'])->name('update_serificate'); | 509 | Route::get('кабинет/edit_sertificate/{doc}', [WorkerController::class, 'update_serificate'])->name('update_serificate'); |
510 | Route::get('кабинет/delete_sertificate/{doc}', [WorkerController::class, 'delete_sertificate'])->name('delete_sertificate'); | 510 | Route::get('кабинет/delete_sertificate/{doc}', [WorkerController::class, 'delete_sertificate'])->name('delete_sertificate'); |
511 | 511 | ||
512 | // Добавление предыдущих контактов компании | 512 | // Добавление предыдущих контактов компании |
513 | Route::get('кабинет/prev_company/{worker}', [WorkerController::class, 'new_prev_company'])->name('new_prev_company'); | 513 | Route::get('кабинет/prev_company/{worker}', [WorkerController::class, 'new_prev_company'])->name('new_prev_company'); |
514 | Route::post('кабинет/add_prev_company', [WorkerController::class, 'add_prev_company'])->name('add_prev_company'); | 514 | Route::post('кабинет/add_prev_company', [WorkerController::class, 'add_prev_company'])->name('add_prev_company'); |
515 | Route::get('кабинет/edit_prev_company/{doc}/{worker}', [WorkerController::class, 'edit_prev_company'])->name('edit_prev_company'); | 515 | Route::get('кабинет/edit_prev_company/{doc}/{worker}', [WorkerController::class, 'edit_prev_company'])->name('edit_prev_company'); |
516 | Route::post('кабинет/update_prev_company/{doc}', [WorkerController::class, 'update_prev_company'])->name('update_prev_company'); | 516 | Route::post('кабинет/update_prev_company/{doc}', [WorkerController::class, 'update_prev_company'])->name('update_prev_company'); |
517 | Route::get('кабинет/delete_prev_company/{doc}', [WorkerController::class, 'delete_prev_company'])->name('delete_prev_company'); | 517 | Route::get('кабинет/delete_prev_company/{doc}', [WorkerController::class, 'delete_prev_company'])->name('delete_prev_company'); |
518 | 518 | ||
519 | // Добавление документа-диплома | 519 | // Добавление документа-диплома |
520 | Route::get('кабинет/add_diplom/{worker}', [WorkerController::class, 'add_diplom'])->name('add_diplom'); | 520 | Route::get('кабинет/add_diplom/{worker}', [WorkerController::class, 'add_diplom'])->name('add_diplom'); |
521 | Route::post('кабинет/add_diplom', [WorkerController::class, 'add_diplom_save'])->name('dop_info_save'); | 521 | Route::post('кабинет/add_diplom', [WorkerController::class, 'add_diplom_save'])->name('dop_info_save'); |
522 | Route::put('кабинет/edit_diploms/{worker}', [WorkerController::class, 'edit_diploms'])->name('edit_diploms'); | 522 | Route::put('кабинет/edit_diploms/{worker}', [WorkerController::class, 'edit_diploms'])->name('edit_diploms'); |
523 | Route::get('кабинет/delete_ad_diplom/{worker}', [WorkerController::class, 'delete_add_diplom'])->name('delete_add_diplom'); | 523 | Route::get('кабинет/delete_ad_diplom/{worker}', [WorkerController::class, 'delete_add_diplom'])->name('delete_add_diplom'); |
524 | 524 | ||
525 | // Добавление стандартного диплома | 525 | // Добавление стандартного диплома |
526 | Route::get('кабинет/add_document/{worker}', [WorkerController::class, 'add_document'])->name('add_document'); | 526 | Route::get('кабинет/add_document/{worker}', [WorkerController::class, 'add_document'])->name('add_document'); |
527 | Route::post('кабинет/add_document/', [WorkerController::class, 'add_document_save'])->name('add_document_save'); | 527 | Route::post('кабинет/add_document/', [WorkerController::class, 'add_document_save'])->name('add_document_save'); |
528 | Route::get('кабинет/edit_document/{doc}/{worker}', [WorkerController::class, 'edit_document'])->name('edit_document'); | 528 | Route::get('кабинет/edit_document/{doc}/{worker}', [WorkerController::class, 'edit_document'])->name('edit_document'); |
529 | Route::post('кабинет/edit_document/{doc}', [WorkerController::class, 'edit_document_save'])->name('edit_document_save'); | 529 | Route::post('кабинет/edit_document/{doc}', [WorkerController::class, 'edit_document_save'])->name('edit_document_save'); |
530 | Route::get('кабинет/delete_document/{doc}', [WorkerController::class, 'delete_document'])->name('delete_document'); | 530 | Route::get('кабинет/delete_document/{doc}', [WorkerController::class, 'delete_document'])->name('delete_document'); |
531 | 531 | ||
532 | // Отправка сообщения работодателю от соискателя | 532 | // Отправка сообщения работодателю от соискателя |
533 | Route::post('сообщение/', [WorkerController::class, 'new_message']) | 533 | Route::post('сообщение/', [WorkerController::class, 'new_message']) |
534 | ->withoutMiddleware('is_worker') | 534 | ->withoutMiddleware('is_worker') |
535 | ->name('new_message'); | 535 | ->name('new_message'); |
536 | 536 | ||
537 | Route::get('cabinet/autoresponder', [WorkerController::class, 'autoresponder'])->name('autoresponder'); | 537 | Route::get('cabinet/autoresponder', [WorkerController::class, 'autoresponder'])->name('autoresponder'); |
538 | Route::get('cabinet/autoresponder_save', [WorkerController::class, 'autoresponderSave'])->name('autoresponder_save'); | 538 | Route::get('cabinet/autoresponder_save', [WorkerController::class, 'autoresponderSave'])->name('autoresponder_save'); |
539 | 539 | ||
540 | Route::get('cabinet/autolift', [WorkerController::class, 'resumeAutoLiftForm'])->name('autolift'); | 540 | Route::get('cabinet/autolift', [WorkerController::class, 'resumeAutoLiftForm'])->name('autolift'); |
541 | Route::post('cabinet/autolift/save', [WorkerController::class, 'resumeAutoLiftSave'])->name('autolift_save'); | 541 | Route::post('cabinet/autolift/save', [WorkerController::class, 'resumeAutoLiftSave'])->name('autolift_save'); |
542 | }); | 542 | }); |
543 | Route::post('/admin/chat/response', [WorkerController::class, 'adminChatResponse'])->name('admin.chat.response'); | 543 | Route::post('/admin/chat/response', [WorkerController::class, 'adminChatResponse'])->name('admin.chat.response'); |
544 | 544 | ||
545 | // Личный кабинет работодателя | 545 | // Личный кабинет работодателя |
546 | Route::group([ | 546 | Route::group([ |
547 | 'as' => 'employer.', // имя маршрута, например auth.index | 547 | 'as' => 'employer.', // имя маршрута, например auth.index |
548 | 'prefix' => 'employer', // префикс маршрута, например auth/index | 548 | 'prefix' => 'employer', // префикс маршрута, например auth/index |
549 | 'middleware' => ['auth', 'is_employer'], | 549 | 'middleware' => ['auth', 'is_employer'], |
550 | ], function() { | 550 | ], function() { |
551 | // 0 страница - Личные данные работодателя | 551 | // 0 страница - Личные данные работодателя |
552 | Route::get('cabinet/employer_info', [EmployerController::class, 'employer_info'])->name('employer_info'); | 552 | Route::get('cabinet/employer_info', [EmployerController::class, 'employer_info'])->name('employer_info'); |
553 | Route::post('cabinet/employer_info/{user}', [EmployerController::class, 'employer_info_save'])->name('employer_info_save'); | 553 | Route::post('cabinet/employer_info/{user}', [EmployerController::class, 'employer_info_save'])->name('employer_info_save'); |
554 | 554 | ||
555 | // 1 страница - Профиль | 555 | // 1 страница - Профиль |
556 | Route::get('cabinet', [EmployerController::class, 'cabinet'])->name('cabinet'); | 556 | Route::get('cabinet', [EmployerController::class, 'cabinet'])->name('cabinet'); |
557 | Route::post('cabinet/{Employer}', [EmployerController::class, 'cabinet_save'])->name('cabinet_save'); | 557 | Route::post('cabinet/{Employer}', [EmployerController::class, 'cabinet_save'])->name('cabinet_save'); |
558 | Route::post('flot_add_ajax', [EmployerController::class, 'save_add_flot'])->name('save_add_flot'); | 558 | Route::post('flot_add_ajax', [EmployerController::class, 'save_add_flot'])->name('save_add_flot'); |
559 | Route::get('flot_delete_ajax/{Flot}', [EmployerController::class, 'delete_flot'])->name('delete_flot'); | 559 | Route::get('flot_delete_ajax/{Flot}', [EmployerController::class, 'delete_flot'])->name('delete_flot'); |
560 | Route::get('cabinet/flot_edit/{Flot}/{Employer}', [EmployerController::class, 'edit_flot'])->name('edit_flot'); | 560 | Route::get('cabinet/flot_edit/{Flot}/{Employer}', [EmployerController::class, 'edit_flot'])->name('edit_flot'); |
561 | Route::post('cabinet/flot_edit/{Flot}', [EmployerController::class, 'update_flot'])->name('update_flot_save'); | 561 | Route::post('cabinet/flot_edit/{Flot}', [EmployerController::class, 'update_flot'])->name('update_flot_save'); |
562 | Route::get('cabinet/flot', [EmployerController::class, 'slider_flot'])->name('slider_flot'); | 562 | Route::get('cabinet/flot', [EmployerController::class, 'slider_flot'])->name('slider_flot'); |
563 | 563 | ||
564 | Route::get('social/{social}/{vacancy}', [Ad_jobsController::class, 'sendVacancyToSocial']) | 564 | Route::get('social/{social}/{vacancy}', [Ad_jobsController::class, 'sendVacancyToSocial']) |
565 | ->name('send-vacancy-to-social'); | 565 | ->name('send-vacancy-to-social'); |
566 | 566 | ||
567 | // 2 страница - Добавление вакансий | 567 | // 2 страница - Добавление вакансий |
568 | Route::get('cabinet/vacancie', [EmployerController::class, 'cabinet_vacancie'])->name('cabinet_vacancie'); | 568 | Route::get('cabinet/vacancie', [EmployerController::class, 'cabinet_vacancie'])->name('cabinet_vacancie'); |
569 | Route::post('vacancie', [EmployerController::class, 'cabinet_vacancy_save1'])->name('vac_save'); | 569 | Route::post('vacancie', [EmployerController::class, 'cabinet_vacancy_save1'])->name('vac_save'); |
570 | //Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); | 570 | //Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); |
571 | 571 | ||
572 | Route::get('cabinet/vacancie_danger', [EmployerController::class, 'cabinet_vacancie_danger'])->name('cabinet_vacancie_danger'); | 572 | Route::get('cabinet/vacancie_danger', [EmployerController::class, 'cabinet_vacancie_danger'])->name('cabinet_vacancie_danger'); |
573 | 573 | ||
574 | 574 | ||
575 | 575 | ||
576 | Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); | 576 | Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); |
577 | 577 | ||
578 | // 3 страница - Мои вакансии | 578 | // 3 страница - Мои вакансии |
579 | Route::get('cabinet/vacancy_list', [EmployerController::class, 'vacancy_list'])->name('vacancy_list'); | 579 | Route::get('cabinet/vacancy_list', [EmployerController::class, 'vacancy_list'])->name('vacancy_list'); |
580 | Route::get('cabinet/vacancy/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); | 580 | Route::get('cabinet/vacancy/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); |
581 | Route::get('cabinet/vacancy-delete/{ad_employer}', [EmployerController::class, 'vacancy_delete'])->name('vacancy_delete'); | 581 | Route::get('cabinet/vacancy-delete/{ad_employer}', [EmployerController::class, 'vacancy_delete'])->name('vacancy_delete'); |
582 | Route::get('cabinet/vacancy-up/{ad_employer}', [EmployerController::class, 'vacancy_up'])->name('vacancy_up'); | 582 | Route::get('cabinet/vacancy-up/{ad_employer}', [EmployerController::class, 'vacancy_up'])->name('vacancy_up'); |
583 | Route::get('cabinet/vacancy-eye/{ad_employer}/{status}', [EmployerController::class, 'vacancy_eye'])->name('vacancy_eye'); | 583 | Route::get('cabinet/vacancy-eye/{ad_employer}/{status}', [EmployerController::class, 'vacancy_eye'])->name('vacancy_eye'); |
584 | Route::get('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); | 584 | Route::get('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); |
585 | Route::post('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_save_me'])->name('vacancy_save_me'); | 585 | Route::post('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_save_me'])->name('vacancy_save_me'); |
586 | 586 | ||
587 | // 4.1Ю. | 587 | // 4.1Ю. |
588 | Route::get('cabinet/ad_jobs/create/{ad_employer}', [Ad_jobsController::class, 'add_job_in_vac'])->name('add_job_in_vac'); | 588 | Route::get('cabinet/ad_jobs/create/{ad_employer}', [Ad_jobsController::class, 'add_job_in_vac'])->name('add_job_in_vac'); |
589 | Route::post('cabinet/ad_jobs/create', [Ad_jobsController::class, 'add_job_in_vac_save'])->name('add_job_in_vac_save'); | 589 | Route::post('cabinet/ad_jobs/create', [Ad_jobsController::class, 'add_job_in_vac_save'])->name('add_job_in_vac_save'); |
590 | Route::get('cabinet/ad_jobs/edit/{ad_job}/{ad_employer}', [Ad_jobsController::class, 'edit_job_in_vac'])->name('edit_job_in_vac'); | 590 | Route::get('cabinet/ad_jobs/edit/{ad_job}/{ad_employer}', [Ad_jobsController::class, 'edit_job_in_vac'])->name('edit_job_in_vac'); |
591 | Route::post('cabinet/ad_jobs/edit/{ad_job}', [Ad_jobsController::class, 'edit_job_in_vac_save'])->name('edit_job_in_vac_save'); | 591 | Route::post('cabinet/ad_jobs/edit/{ad_job}', [Ad_jobsController::class, 'edit_job_in_vac_save'])->name('edit_job_in_vac_save'); |
592 | Route::get('cabinet/ad_jobs/delete/{ad_job}', [Ad_jobsController::class, 'delete_job_in_vac'])->name('delete_job_in_vac'); | 592 | Route::get('cabinet/ad_jobs/delete/{ad_job}', [Ad_jobsController::class, 'delete_job_in_vac'])->name('delete_job_in_vac'); |
593 | 593 | ||
594 | // 4 страница - Отклики на вакансии | 594 | // 4 страница - Отклики на вакансии |
595 | Route::get('cabinet/answers/{employer}', [EmployerController::class, 'answers'])->name('answers'); | 595 | Route::get('cabinet/answers/{employer}', [EmployerController::class, 'answers'])->name('answers'); |
596 | Route::get('cabinet/status/{employer}', [EmployerController::class, 'supple_status2'])->name('supple'); | 596 | Route::get('cabinet/status/{employer}', [EmployerController::class, 'supple_status2'])->name('supple'); |
597 | Route::get('status/{employer}/{ad_response}/{flag}', [EmployerController::class, 'supple_status'])->name('status_msg'); | 597 | Route::get('status/{employer}/{ad_response}/{flag}', [EmployerController::class, 'supple_status'])->name('status_msg'); |
598 | 598 | ||
599 | // 5 страница - Сообщения | 599 | // 5 страница - Сообщения |
600 | Route::get('cabinet/messages/{type_message}', [EmployerController::class, 'messages'])->name('messages'); | 600 | Route::get('cabinet/messages/{type_message}', [EmployerController::class, 'messages'])->name('messages'); |
601 | Route::get('cabinet/dialog/{chat}', [EmployerController::class, 'dialog'])->name('dialog'); | 601 | Route::get('cabinet/dialog/{chat}', [EmployerController::class, 'dialog'])->name('dialog'); |
602 | Route::post('cabinet/send-message', [EmployerController::class, 'send_message'])->name('send_message'); | 602 | Route::post('cabinet/send-message', [EmployerController::class, 'send_message'])->name('send_message'); |
603 | Route::post('test123', [EmployerController::class, 'test123'])->name('test123'); | 603 | Route::post('test123', [EmployerController::class, 'test123'])->name('test123'); |
604 | 604 | ||
605 | // 6 страница - Избранный | 605 | // 6 страница - Избранный |
606 | Route::get('cabinet/favorites', [EmployerController::class, 'favorites'])->name('favorites'); | 606 | Route::get('cabinet/favorites', [EmployerController::class, 'favorites'])->name('favorites'); |
607 | 607 | ||
608 | Route::get('cabinet/autolift', [EmployerController::class, 'vacancyAutoLiftForm'])->name('autolift'); | 608 | Route::get('cabinet/autolift', [EmployerController::class, 'vacancyAutoLiftForm'])->name('autolift'); |
609 | Route::post('cabinet/autolift/save', [EmployerController::class, 'vacancyAutoLiftSave'])->name('autolift_save'); | 609 | Route::post('cabinet/autolift/save', [EmployerController::class, 'vacancyAutoLiftSave'])->name('autolift_save'); |
610 | 610 | ||
611 | //7 страница - База данных | 611 | //7 страница - База данных |
612 | Route::get('cabinet/bd', [EmployerController::class, 'bd'])->name('bd'); | 612 | Route::get('cabinet/bd', [EmployerController::class, 'bd'])->name('bd'); |
613 | 613 | ||
614 | //8 страница - База резюме | 614 | //8 страница - База резюме |
615 | Route::get('cabinet/bd-tupe', [EmployerController::class, 'bd_tupe'])->name('bd-tupe'); | 615 | Route::get('cabinet/bd-tupe', [EmployerController::class, 'bd_tupe'])->name('bd-tupe'); |
616 | 616 | ||
617 | // 9 рассылка сообщений | 617 | // 9 рассылка сообщений |
618 | Route::get('cabinet/send-all-messages', [EmployerController::class, 'send_all_messages'])->name('send_all_messages'); | 618 | Route::get('cabinet/send-all-messages', [EmployerController::class, 'send_all_messages'])->name('send_all_messages'); |
619 | Route::post('cabinet/send-all-messages/send', [EmployerController::class, 'send_all_post'])->name('send_all_post'); | 619 | Route::post('cabinet/send-all-messages/send', [EmployerController::class, 'send_all_post'])->name('send_all_post'); |
620 | 620 | ||
621 | // 10 страница FAQ вопрос | 621 | // 10 страница FAQ вопрос |
622 | Route::get('cabinet/faq', [FaqController::class, 'showListForUser'])->name('faq'); | 622 | Route::get('cabinet/faq', [FaqController::class, 'showListForUser'])->name('faq'); |
623 | 623 | ||
624 | Route::get('cabinet/autoresponder', [EmployerController::class, 'autoresponder'])->name('autoresponder'); | 624 | Route::get('cabinet/autoresponder', [EmployerController::class, 'autoresponder'])->name('autoresponder'); |
625 | Route::get('cabinet/autoresponder_save', [EmployerController::class, 'autoresponderSave'])->name('autoresponder_save'); | 625 | Route::get('cabinet/autoresponder_save', [EmployerController::class, 'autoresponderSave'])->name('autoresponder_save'); |
626 | 626 | ||
627 | // 11 страница - Настройка уведомлений | 627 | // 11 страница - Настройка уведомлений |
628 | Route::get('cabinet/subscribe', [EmployerController::class, 'subscribe'])->name('subscribe'); | 628 | Route::get('cabinet/subscribe', [EmployerController::class, 'subscribe'])->name('subscribe'); |
629 | Route::post('cabinet/subscribe/save', [EmployerController::class, 'save_subscribe'])->name('save_subscribe'); | 629 | Route::post('cabinet/subscribe/save', [EmployerController::class, 'save_subscribe'])->name('save_subscribe'); |
630 | 630 | ||
631 | // 12 страница - Сменить пароль | 631 | // 12 страница - Сменить пароль |
632 | Route::get('cabinet/password-reset', [EmployerController::class, 'password_reset'])->name('password_reset'); | 632 | Route::get('cabinet/password-reset', [EmployerController::class, 'password_reset'])->name('password_reset'); |
633 | Route::get('cabinet/password-reset/new', [EmployerController::class, 'new_password'])->name('new_password'); | 633 | Route::get('cabinet/password-reset/new', [EmployerController::class, 'new_password'])->name('new_password'); |
634 | 634 | ||
635 | // 13 страница - Удаление профиля | 635 | // 13 страница - Удаление профиля |
636 | Route::get('cabinet/delete-people', [EmployerController::class, 'delete_people'])->name('delete_people'); | 636 | Route::get('cabinet/delete-people', [EmployerController::class, 'delete_people'])->name('delete_people'); |
637 | Route::get('cabinet/action-delete-people', [EmployerController::class, 'action_delete_user'])->name('action_delete_user'); | 637 | Route::get('cabinet/action-delete-people', [EmployerController::class, 'action_delete_user'])->name('action_delete_user'); |
638 | Route::get('cabinet/action-ajax-delete-people', [EmployerController::class, 'ajax_delete_user'])->name('ajax_delete_user'); | 638 | Route::get('cabinet/action-ajax-delete-people', [EmployerController::class, 'ajax_delete_user'])->name('ajax_delete_user'); |
639 | 639 | ||
640 | // Отправил сообщение | 640 | // Отправил сообщение |
641 | Route::post('сообщение/', [EmployerController::class, 'new_message']) | 641 | Route::post('сообщение/', [EmployerController::class, 'new_message']) |
642 | ->withoutMiddleware('is_employer') | 642 | ->withoutMiddleware('is_employer') |
643 | ->name('new_message'); | 643 | ->name('new_message'); |
644 | 644 | ||
645 | Route::post('pin_chat/', [EmployerController::class, 'pin_chat'])->name('pin_chat'); | 645 | Route::post('pin_chat/', [EmployerController::class, 'pin_chat'])->name('pin_chat'); |
646 | Route::post('remove_chat/', [EmployerController::class, 'remove_chat'])->name('remove_chat'); | 646 | Route::post('remove_chat/', [EmployerController::class, 'remove_chat'])->name('remove_chat'); |
647 | }); | 647 | }); |
648 | 648 | ||
649 | Route::get('TestWorker', [WorkerController::class, 'TestWorker'])->name('TestWorker'); | 649 | Route::get('TestWorker', [WorkerController::class, 'TestWorker'])->name('TestWorker'); |
650 | 650 | ||
651 | Route::post('send_message', [HomeController::class, 'send_message'])->name('send_message'); | 651 | Route::post('send_message', [HomeController::class, 'send_message'])->name('send_message'); |
652 | 652 | ||
653 | 653 |