Commit b947a4cd59a0e4d92fb7fdc34f0095aaea9437bc
1 parent
af64021da0
Exists in
master
Коммит суббота 2
Showing 11 changed files with 105 additions and 47 deletions Inline Diff
- app/Http/Controllers/EmployerController.php
- app/Http/Controllers/MainController.php
- app/Http/Controllers/WorkerController.php
- resources/views/employers/add_vacancy.blade.php
- resources/views/employers/ajax/list_vacancy.blade.php
- resources/views/employers/cabinet45.blade.php
- resources/views/employers/edit_vacancy.blade.php
- resources/views/employers/list_answer.blade.php
- resources/views/employers/list_vacancy.blade.php
- resources/views/index.blade.php
- resources/views/modals/send_worker_new.blade.php
app/Http/Controllers/EmployerController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Classes\Tools; | 6 | use App\Classes\Tools; |
7 | use App\Http\Requests\BaseUser_min_Request; | 7 | use App\Http\Requests\BaseUser_min_Request; |
8 | use App\Http\Requests\BaseUserRequest; | 8 | use App\Http\Requests\BaseUserRequest; |
9 | use App\Http\Requests\FlotRequest; | 9 | use App\Http\Requests\FlotRequest; |
10 | use App\Http\Requests\MessagesRequiest; | 10 | use App\Http\Requests\MessagesRequiest; |
11 | use App\Http\Requests\VacancyRequestEdit; | 11 | use App\Http\Requests\VacancyRequestEdit; |
12 | use App\Http\Requests\VacansiaRequiest; | 12 | use App\Http\Requests\VacansiaRequiest; |
13 | use App\Mail\MailSotrudnichestvo; | 13 | use App\Mail\MailSotrudnichestvo; |
14 | use App\Mail\SendAllMessages; | 14 | use App\Mail\SendAllMessages; |
15 | use App\Models\Ad_employer; | 15 | use App\Models\Ad_employer; |
16 | use App\Models\Ad_jobs; | 16 | use App\Models\Ad_jobs; |
17 | use App\Models\ad_response; | 17 | use App\Models\ad_response; |
18 | use App\Models\Category; | 18 | use App\Models\Category; |
19 | use App\Models\Education; | 19 | use App\Models\Education; |
20 | use App\Models\Employer; | 20 | use App\Models\Employer; |
21 | use App\Models\employers_main; | 21 | use App\Models\employers_main; |
22 | use App\Models\Flot; | 22 | use App\Models\Flot; |
23 | use App\Models\Job_title; | 23 | use App\Models\Job_title; |
24 | use App\Models\Like_vacancy; | 24 | use App\Models\Like_vacancy; |
25 | use App\Models\Like_worker; | 25 | use App\Models\Like_worker; |
26 | use App\Models\Message; | 26 | use App\Models\Message; |
27 | use App\Models\Positions; | 27 | use App\Models\Positions; |
28 | use App\Models\Worker; | 28 | use App\Models\Worker; |
29 | use Carbon\Carbon; | 29 | use Carbon\Carbon; |
30 | use Illuminate\Auth\Events\Registered; | 30 | use Illuminate\Auth\Events\Registered; |
31 | use Illuminate\Database\Eloquent\Builder; | 31 | use Illuminate\Database\Eloquent\Builder; |
32 | use Illuminate\Database\Eloquent\Model; | 32 | use Illuminate\Database\Eloquent\Model; |
33 | use Illuminate\Foundation\Auth\User; | 33 | use Illuminate\Foundation\Auth\User; |
34 | use Illuminate\Http\Request; | 34 | use Illuminate\Http\Request; |
35 | use Illuminate\Support\Facades\Auth; | 35 | use Illuminate\Support\Facades\Auth; |
36 | use Illuminate\Support\Facades\Hash; | 36 | use Illuminate\Support\Facades\Hash; |
37 | use Illuminate\Support\Facades\Mail; | 37 | use Illuminate\Support\Facades\Mail; |
38 | use Illuminate\Support\Facades\Storage; | 38 | use Illuminate\Support\Facades\Storage; |
39 | use App\Models\User as User_Model; | 39 | use App\Models\User as User_Model; |
40 | use Illuminate\Support\Facades\Validator; | 40 | use Illuminate\Support\Facades\Validator; |
41 | 41 | ||
42 | class EmployerController extends Controller | 42 | class EmployerController extends Controller |
43 | { | 43 | { |
44 | public function vacancie($vacancy, Request $request) { | 44 | public function vacancie($vacancy, Request $request) { |
45 | $title = 'Заголовок вакансии'; | 45 | $title = 'Заголовок вакансии'; |
46 | $Query = Ad_employer::with('jobs')-> | 46 | $Query = Ad_employer::with('jobs')-> |
47 | with('cat')-> | 47 | with('cat')-> |
48 | with('employer')-> | 48 | with('employer')-> |
49 | with('jobs_code')-> | 49 | with('jobs_code')-> |
50 | select('ad_employers.*')-> | 50 | select('ad_employers.*')-> |
51 | where('id', '=', $vacancy)->get(); | 51 | where('id', '=', $vacancy)->get(); |
52 | 52 | ||
53 | if (isset(Auth()->user()->id)) | 53 | if (isset(Auth()->user()->id)) |
54 | $uid = Auth()->user()->id; | 54 | $uid = Auth()->user()->id; |
55 | else | 55 | else |
56 | $uid = 0; | 56 | $uid = 0; |
57 | $title = $Query[0]->name; | 57 | $title = $Query[0]->name; |
58 | if ($request->ajax()) { | 58 | if ($request->ajax()) { |
59 | return view('ajax.vacance-item', compact('Query','uid')); | 59 | return view('ajax.vacance-item', compact('Query','uid')); |
60 | } else { | 60 | } else { |
61 | return view('vacance-item', compact('title', 'Query', 'uid')); | 61 | return view('vacance-item', compact('title', 'Query', 'uid')); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | public function logout() { | 65 | public function logout() { |
66 | Auth::logout(); | 66 | Auth::logout(); |
67 | return redirect()->route('index') | 67 | return redirect()->route('index') |
68 | ->with('success', 'Вы вышли из личного кабинета'); | 68 | ->with('success', 'Вы вышли из личного кабинета'); |
69 | } | 69 | } |
70 | 70 | ||
71 | public function employer_info() { | 71 | public function employer_info() { |
72 | // код юзера | 72 | // код юзера |
73 | $user_info = Auth()->user(); | 73 | $user_info = Auth()->user(); |
74 | // вьюшка для вывода данных | 74 | // вьюшка для вывода данных |
75 | return view('employers.info', compact('user_info')); | 75 | return view('employers.info', compact('user_info')); |
76 | } | 76 | } |
77 | 77 | ||
78 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { | 78 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { |
79 | // Все данные через реквест | 79 | // Все данные через реквест |
80 | $all = $request->all(); | 80 | $all = $request->all(); |
81 | unset($all['_token']); | 81 | unset($all['_token']); |
82 | // обновление | 82 | // обновление |
83 | $user->update($all); | 83 | $user->update($all); |
84 | return redirect()->route('employer.employer_info'); | 84 | return redirect()->route('employer.employer_info'); |
85 | } | 85 | } |
86 | 86 | ||
87 | public function cabinet() { | 87 | public function cabinet() { |
88 | $id = Auth()->user()->id; | 88 | $id = Auth()->user()->id; |
89 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 89 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
90 | WhereHas('users', | 90 | WhereHas('users', |
91 | function (Builder $query) use ($id) {$query->Where('id', $id); | 91 | function (Builder $query) use ($id) {$query->Where('id', $id); |
92 | })->get(); | 92 | })->get(); |
93 | return view('employers.cabinet45', compact('Employer')); | 93 | return view('employers.cabinet45', compact('Employer')); |
94 | } | 94 | } |
95 | 95 | ||
96 | public function slider_flot() { | 96 | public function slider_flot() { |
97 | $id = Auth()->user()->id; | 97 | $id = Auth()->user()->id; |
98 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 98 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
99 | WhereHas('users', | 99 | WhereHas('users', |
100 | function (Builder $query) use ($id) {$query->Where('id', $id); | 100 | function (Builder $query) use ($id) {$query->Where('id', $id); |
101 | })->get(); | 101 | })->get(); |
102 | return view('employers.fly-flot', compact('Employer')); | 102 | return view('employers.fly-flot', compact('Employer')); |
103 | } | 103 | } |
104 | 104 | ||
105 | public function cabinet_save(Employer $Employer, Request $request) { | 105 | public function cabinet_save(Employer $Employer, Request $request) { |
106 | $params = $request->all(); | 106 | $params = $request->all(); |
107 | $params['user_id'] = Auth()->user()->id; | 107 | $params['user_id'] = Auth()->user()->id; |
108 | $id = $Employer->id; | 108 | $id = $Employer->id; |
109 | 109 | ||
110 | if ($request->has('logo')) { | 110 | if ($request->has('logo')) { |
111 | if (!empty($Employer->logo)) { | 111 | if (!empty($Employer->logo)) { |
112 | Storage::delete($Employer->logo); | 112 | Storage::delete($Employer->logo); |
113 | } | 113 | } |
114 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); | 114 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); |
115 | } | 115 | } |
116 | 116 | ||
117 | $Employer->update($params); | 117 | $Employer->update($params); |
118 | 118 | ||
119 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); | 119 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); |
120 | } | 120 | } |
121 | 121 | ||
122 | public function save_add_flot(FlotRequest $request) { | 122 | public function save_add_flot(FlotRequest $request) { |
123 | // отмена | 123 | // отмена |
124 | $params = $request->all(); | 124 | $params = $request->all(); |
125 | 125 | ||
126 | if ($request->has('image')) { | 126 | if ($request->has('image')) { |
127 | $params['image'] = $request->file('image')->store("flot", 'public'); | 127 | $params['image'] = $request->file('image')->store("flot", 'public'); |
128 | } | 128 | } |
129 | Flot::create($params); | 129 | Flot::create($params); |
130 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); | 130 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); |
131 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 131 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
132 | } | 132 | } |
133 | 133 | ||
134 | public function edit_flot(Flot $Flot, Employer $Employer) { | 134 | public function edit_flot(Flot $Flot, Employer $Employer) { |
135 | return view('employers.edit-flot', compact('Flot', 'Employer')); | 135 | return view('employers.edit-flot', compact('Flot', 'Employer')); |
136 | } | 136 | } |
137 | 137 | ||
138 | public function update_flot(FlotRequest $request, Flot $Flot) { | 138 | public function update_flot(FlotRequest $request, Flot $Flot) { |
139 | $params = $request->all(); | 139 | $params = $request->all(); |
140 | 140 | ||
141 | if ($request->has('image')) { | 141 | if ($request->has('image')) { |
142 | if (!empty($flot->image)) { | 142 | if (!empty($flot->image)) { |
143 | Storage::delete($flot->image); | 143 | Storage::delete($flot->image); |
144 | } | 144 | } |
145 | $params['image'] = $request->file('image')->store("flot", 'public'); | 145 | $params['image'] = $request->file('image')->store("flot", 'public'); |
146 | } else { | 146 | } else { |
147 | if (!empty($flot->image)) $params['image'] = $flot->image; | 147 | if (!empty($flot->image)) $params['image'] = $flot->image; |
148 | } | 148 | } |
149 | 149 | ||
150 | $Flot->update($params); | 150 | $Flot->update($params); |
151 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 151 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
152 | } | 152 | } |
153 | 153 | ||
154 | public function delete_flot(Flot $Flot) { | 154 | public function delete_flot(Flot $Flot) { |
155 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); | 155 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); |
156 | 156 | ||
157 | if (isset($Flot->id)) $Flot->delete(); | 157 | if (isset($Flot->id)) $Flot->delete(); |
158 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); | 158 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); |
159 | } | 159 | } |
160 | 160 | ||
161 | // Форма добавления вакансий | 161 | // Форма добавления вакансий |
162 | public function cabinet_vacancie() { | 162 | public function cabinet_vacancie() { |
163 | $id = Auth()->user()->id; | 163 | $id = Auth()->user()->id; |
164 | 164 | ||
165 | if (Auth()->user()->is_public) { | 165 | if (Auth()->user()->is_public) { |
166 | $categories = Category::query()->active()->get(); | 166 | $categories = Category::query()->active()->get(); |
167 | 167 | ||
168 | $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->where('is_bd', '=', '0')->get(); | 168 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
169 | where('is_remove', '=', '0')-> | ||
170 | where('is_bd', '=', '0')-> | ||
171 | get(); | ||
169 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 172 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
170 | 173 | ||
171 | WhereHas('users', | 174 | WhereHas('users', |
172 | function (Builder $query) use ($id) { | 175 | function (Builder $query) use ($id) { |
173 | $query->Where('id', $id); | 176 | $query->Where('id', $id); |
174 | })->get(); | 177 | })->get(); |
175 | 178 | ||
176 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); | 179 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); |
177 | } else { | 180 | } else { |
178 | return redirect()->route('employer.cabinet_vacancie_danger'); | 181 | return redirect()->route('employer.cabinet_vacancie_danger'); |
179 | } | 182 | } |
180 | } | 183 | } |
181 | 184 | ||
182 | // Форма предупреждения об оплате | 185 | // Форма предупреждения об оплате |
183 | public function cabinet_vacancie_danger() { | 186 | public function cabinet_vacancie_danger() { |
184 | return view('employers.add_vacancy_danger'); | 187 | return view('employers.add_vacancy_danger'); |
185 | } | 188 | } |
186 | 189 | ||
187 | // Сохранение вакансии | 190 | // Сохранение вакансии |
188 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { | 191 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { |
189 | $params_emp = $request->all(); | 192 | $params_emp = $request->all(); |
190 | 193 | ||
191 | $params_job["job_title_id"] = $params_emp['job_title_id']; | 194 | $params_job["job_title_id"] = $params_emp['job_title_id']; |
192 | //$params_job["min_salary"] = $params_emp['min_salary']; | 195 | //$params_job["min_salary"] = $params_emp['min_salary']; |
193 | //$params_job["max_salary"] = $params_emp['max_salary']; | 196 | //$params_job["max_salary"] = $params_emp['max_salary']; |
194 | //$params_job["region"] = $params_emp['region']; | 197 | //$params_job["region"] = $params_emp['region']; |
195 | //$params_job["power"] = $params_emp['power']; | 198 | //$params_job["power"] = $params_emp['power']; |
196 | //$params_job["sytki"] = $params_emp['sytki']; | 199 | //$params_job["sytki"] = $params_emp['sytki']; |
197 | //$params_job["start"] = $params_emp['start']; | 200 | //$params_job["start"] = $params_emp['start']; |
198 | //$params_job["flot"] = $params_emp['flot']; | 201 | //$params_job["flot"] = $params_emp['flot']; |
199 | //$params_job["description"] = $params_emp['description']; | 202 | //$params_job["description"] = $params_emp['description']; |
200 | 203 | ||
201 | $ad_jobs = Ad_employer::create($params_emp); | 204 | $ad_jobs = Ad_employer::create($params_emp); |
202 | //$params_job['ad_employer_id'] = $ad_jobs->id; | 205 | //$params_job['ad_employer_id'] = $ad_jobs->id; |
203 | //Ad_jobs::create($params_job); | 206 | //Ad_jobs::create($params_job); |
204 | $ad_jobs->jobs()->sync($request->get('job_title_id')); | 207 | $ad_jobs->jobs()->sync($request->get('job_title_id')); |
205 | 208 | ||
206 | return redirect()->route('employer.vacancy_list'); | 209 | return redirect()->route('employer.vacancy_list'); |
207 | } | 210 | } |
208 | 211 | ||
209 | // Список вакансий | 212 | // Список вакансий |
210 | public function vacancy_list(Request $request) { | 213 | public function vacancy_list(Request $request) { |
211 | $id = Auth()->user()->id; | 214 | $id = Auth()->user()->id; |
212 | $Employer = Employer::query()->where('user_id', $id)->first(); | 215 | $Employer = Employer::query()->where('user_id', $id)->first(); |
213 | $vacancy_list = Ad_employer::query()->with('jobs')-> | 216 | $vacancy_list = Ad_employer::query()->with('jobs')-> |
214 | with('jobs_code')-> | 217 | with('jobs_code')-> |
215 | where('employer_id', $Employer->id); | 218 | where('employer_id', $Employer->id); |
216 | 219 | ||
217 | if ($request->get('sort')) { | 220 | if ($request->get('sort')) { |
218 | $sort = $request->get('sort'); | 221 | $sort = $request->get('sort'); |
219 | switch ($sort) { | 222 | switch ($sort) { |
220 | case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; | 223 | case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; |
221 | case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; | 224 | case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; |
222 | case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; | 225 | case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; |
223 | case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; | 226 | case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; |
224 | case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; | 227 | case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; |
225 | default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; | 228 | default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; |
226 | } | 229 | } |
227 | } | 230 | } |
228 | $vacancy_list = $vacancy_list->paginate(4); | 231 | $vacancy_list = $vacancy_list->paginate(4); |
229 | 232 | ||
230 | //ajax | 233 | //ajax |
231 | if ($request->ajax()) { | 234 | if ($request->ajax()) { |
232 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); | 235 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); |
233 | } else { | 236 | } else { |
234 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); | 237 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); |
235 | } | 238 | } |
236 | } | 239 | } |
237 | 240 | ||
238 | // Карточка вакансии | 241 | // Карточка вакансии |
239 | public function vacancy_edit(Ad_employer $ad_employer) { | 242 | public function vacancy_edit(Ad_employer $ad_employer) { |
240 | $id = Auth()->user()->id; | 243 | $id = Auth()->user()->id; |
241 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); | 244 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); |
242 | 245 | ||
243 | $jobs = Job_title::query()->OrderBy('name')-> | 246 | $jobs = Job_title::query()->OrderBy('name')-> |
244 | where('is_remove', 0)->where('is_bd', '=' , '0')->get(); | 247 | where('is_remove', 0)->where('is_bd', '=' , '0')->get(); |
245 | 248 | ||
246 | 249 | ||
247 | $jobs = Job_title::query()->OrderBy('name')->where('is_remove', 0)->get(); | 250 | $jobs = Job_title::query()->OrderBy('name')->where('is_remove', 0)->get(); |
248 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 251 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
249 | where('user_id', $id)->first(); | 252 | where('user_id', $id)->first(); |
250 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); | 253 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); |
251 | } | 254 | } |
252 | 255 | ||
253 | // Сохранение-редактирование записи | 256 | // Сохранение-редактирование записи |
254 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { | 257 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { |
255 | $params = $request->all(); | 258 | $params = $request->all(); |
256 | 259 | ||
257 | //$jobs['flot'] = $params['flot']; | 260 | //$jobs['flot'] = $params['flot']; |
258 | //$jobs['job_title_id'] = $params['job_title_id']; | 261 | //$jobs['job_title_id'] = $params['job_title_id']; |
259 | //$titles['position_id'] = $params['position_id']; | 262 | //$titles['position_id'] = $params['position_id']; |
260 | //unset($params['job_title_id']); | 263 | //unset($params['job_title_id']); |
261 | 264 | ||
262 | $ad_employer->update($params); | 265 | $ad_employer->update($params); |
263 | 266 | ||
264 | //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> | 267 | //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> |
265 | // where('ad_employer_id', $ad_employer->id)->first(); | 268 | // where('ad_employer_id', $ad_employer->id)->first(); |
266 | //$data = Ad_jobs::find($job_->id); | 269 | //$data = Ad_jobs::find($job_->id); |
267 | //$ad_jobs = $data->update($jobs); | 270 | //$ad_jobs = $data->update($jobs); |
268 | return redirect()->route('employer.vacancy_list'); | 271 | return redirect()->route('employer.vacancy_list'); |
269 | } | 272 | } |
270 | 273 | ||
271 | // Сохранение карточки вакансии | 274 | // Сохранение карточки вакансии |
272 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { | 275 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { |
273 | $all = $request->all(); | 276 | $all = $request->all(); |
274 | $ad_employer->update($all); | 277 | $ad_employer->update($all); |
275 | return redirect()->route('employer.cabinet_vacancie'); | 278 | return redirect()->route('employer.cabinet_vacancie'); |
276 | } | 279 | } |
277 | 280 | ||
278 | // Удаление карточки вакансии | 281 | // Удаление карточки вакансии |
279 | public function vacancy_delete(Ad_employer $ad_employer) { | 282 | public function vacancy_delete(Ad_employer $ad_employer) { |
280 | $ad_employer->delete(); | 283 | $ad_employer->delete(); |
281 | 284 | ||
282 | return redirect()->route('employer.vacancy_list') | 285 | return redirect()->route('employer.vacancy_list') |
283 | ->with('success', 'Данные были успешно сохранены'); | 286 | ->with('success', 'Данные были успешно сохранены'); |
284 | } | 287 | } |
285 | 288 | ||
286 | // Обновление даты | 289 | // Обновление даты |
287 | public function vacancy_up(Ad_employer $ad_employer) { | 290 | public function vacancy_up(Ad_employer $ad_employer) { |
288 | $up = date('m/d/Y h:i:s', time());; | 291 | $up = date('m/d/Y h:i:s', time());; |
289 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 292 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
290 | $vac_emp->updated_at = $up; | 293 | $vac_emp->updated_at = $up; |
291 | $vac_emp->save(); | 294 | $vac_emp->save(); |
292 | 295 | ||
293 | return redirect()->route('employer.vacancy_list'); | 296 | return redirect()->route('employer.vacancy_list'); |
294 | // начало конца | 297 | // начало конца |
295 | } | 298 | } |
296 | 299 | ||
297 | //Видимость вакансии | 300 | //Видимость вакансии |
298 | public function vacancy_eye(Ad_employer $ad_employer, $status) { | 301 | public function vacancy_eye(Ad_employer $ad_employer, $status) { |
299 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 302 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
300 | $vac_emp->active_is = $status; | 303 | $vac_emp->active_is = $status; |
301 | $vac_emp->save(); | 304 | $vac_emp->save(); |
302 | 305 | ||
303 | return redirect()->route('employer.vacancy_list'); | 306 | return redirect()->route('employer.vacancy_list'); |
304 | } | 307 | } |
305 | 308 | ||
306 | //Вакансия редактирования (шаблон) | 309 | //Вакансия редактирования (шаблон) |
307 | public function vacancy_update(Ad_employer $id) { | 310 | public function vacancy_update(Ad_employer $id) { |
308 | 311 | ||
309 | } | 312 | } |
310 | 313 | ||
311 | //Отклики на вакансию - лист | 314 | //Отклики на вакансию - лист |
312 | public function answers(Employer $employer, Request $request) { | 315 | public function answers(Employer $employer, Request $request) { |
313 | $user_id = Auth()->user()->id; | 316 | $user_id = Auth()->user()->id; |
314 | $answer = Ad_employer::query()->where('employer_id', $employer->id); | 317 | $answer = Ad_employer::query()->where('employer_id', $employer->id); |
315 | if ($request->has('search')) { | 318 | if ($request->has('search')) { |
316 | $search = trim($request->get('search')); | 319 | $search = trim($request->get('search')); |
317 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); | 320 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); |
318 | } | 321 | } |
319 | 322 | ||
320 | $answer = $answer->with('response')->get(); | 323 | $answer = $answer->with('response')->OrderByDESC('id')->get(); |
321 | 324 | ||
322 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); | 325 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); |
323 | } | 326 | } |
324 | 327 | ||
325 | //Обновление статуса | 328 | //Обновление статуса |
326 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { | 329 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { |
327 | $ad_response->update(Array('flag' => $flag)); | 330 | $ad_response->update(Array('flag' => $flag)); |
328 | return redirect()->route('employer.answers', ['employer' => $employer->id]); | 331 | return redirect()->route('employer.answers', ['employer' => $employer->id]); |
329 | } | 332 | } |
330 | 333 | ||
331 | //Страницы сообщений список | 334 | //Страницы сообщений список |
332 | public function messages($type_message) { | 335 | public function messages($type_message) { |
333 | $user_id = Auth()->user()->id; | 336 | $user_id = Auth()->user()->id; |
334 | 337 | ||
335 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> | 338 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> |
336 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); | 339 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); |
337 | 340 | ||
338 | $messages_output = Message::query()->with('vacancies')-> | 341 | $messages_output = Message::query()->with('vacancies')-> |
339 | with('user_to')->where('user_id', $user_id)-> | 342 | with('user_to')->where('user_id', $user_id)-> |
340 | OrderByDesc('created_at'); | 343 | OrderByDesc('created_at'); |
341 | 344 | ||
342 | 345 | ||
343 | $count_input = $messages_input->count(); | 346 | $count_input = $messages_input->count(); |
344 | $count_output = $messages_output->count(); | 347 | $count_output = $messages_output->count(); |
345 | 348 | ||
346 | if ($type_message == 'input') { | 349 | if ($type_message == 'input') { |
347 | $messages = $messages_input->paginate(5); | 350 | $messages = $messages_input->paginate(5); |
348 | } | 351 | } |
349 | 352 | ||
350 | if ($type_message == 'output') { | 353 | if ($type_message == 'output') { |
351 | $messages = $messages_output->paginate(5); | 354 | $messages = $messages_output->paginate(5); |
352 | } | 355 | } |
353 | 356 | ||
354 | //dd($user_id, $messages[2]->vacancies); | 357 | //dd($user_id, $messages[2]->vacancies); |
355 | //jobs); | 358 | //jobs); |
356 | 359 | ||
357 | return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); | 360 | return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); |
358 | } | 361 | } |
359 | 362 | ||
360 | // Диалог между пользователями | 363 | // Диалог между пользователями |
361 | public function dialog(Request $request, User_Model $user1, User_Model $user2) { | 364 | public function dialog(Request $request, User_Model $user1, User_Model $user2) { |
362 | // Получение параметров. | 365 | // Получение параметров. |
363 | if ($request->has('ad_employer')){ | 366 | if ($request->has('ad_employer')){ |
364 | $ad_employer = $request->get('ad_employer'); | 367 | $ad_employer = $request->get('ad_employer'); |
365 | } else { | 368 | } else { |
366 | $ad_employer = 0; | 369 | $ad_employer = 0; |
367 | } | 370 | } |
368 | 371 | ||
369 | if (isset($user2->id)) { | 372 | if (isset($user2->id)) { |
370 | $companion = User_Model::query()->with('workers')-> | 373 | $companion = User_Model::query()->with('workers')-> |
371 | with('employers')-> | 374 | with('employers')-> |
372 | where('id', $user2->id)->first(); | 375 | where('id', $user2->id)->first(); |
373 | } | 376 | } |
374 | 377 | ||
375 | $Messages = Message::query()-> | 378 | $Messages = Message::query()-> |
376 | where('ad_employer_id', '=', $ad_employer)-> | 379 | where('ad_employer_id', '=', $ad_employer)-> |
377 | where(function($query) use ($user1, $user2) { | 380 | where(function($query) use ($user1, $user2) { |
378 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); | 381 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); |
379 | })->orWhere(function($query) use ($user1, $user2) { | 382 | })->orWhere(function($query) use ($user1, $user2) { |
380 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); | 383 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); |
381 | })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get(); | 384 | })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get(); |
382 | 385 | ||
383 | $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; | 386 | $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; |
384 | 387 | ||
385 | //$ad_employer = null; | 388 | //$ad_employer = null; |
386 | //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); | 389 | //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); |
387 | $sender = $user1; | 390 | $sender = $user1; |
388 | 391 | ||
389 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); | 392 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); |
390 | } | 393 | } |
391 | 394 | ||
392 | // Регистрация работодателя | 395 | // Регистрация работодателя |
393 | public function register_employer(Request $request) { | 396 | public function register_employer(Request $request) { |
394 | $params = $request->all(); | 397 | $params = $request->all(); |
395 | 398 | ||
396 | $rules = [ | 399 | $rules = [ |
397 | //'surname' => ['required', 'string', 'max:255'], | 400 | //'surname' => ['required', 'string', 'max:255'], |
398 | //'name_man' => ['required', 'string', 'max:255'], | 401 | //'name_man' => ['required', 'string', 'max:255'], |
399 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], | 402 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], |
400 | 'name_company' => ['required', 'string', 'max:255'], | 403 | 'name_company' => ['required', 'string', 'max:255'], |
401 | 'password' => ['required', 'string', 'min:6'], | 404 | 'password' => ['required', 'string', 'min:6'], |
402 | ]; | 405 | ]; |
403 | 406 | ||
404 | 407 | ||
405 | $messages = [ | 408 | $messages = [ |
406 | 'required' => 'Укажите обязательное поле', | 409 | 'required' => 'Укажите обязательное поле', |
407 | 'min' => [ | 410 | 'min' => [ |
408 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 411 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
409 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 412 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
410 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 413 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
411 | ], | 414 | ], |
412 | 'max' => [ | 415 | 'max' => [ |
413 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 416 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
414 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 417 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
415 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 418 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
416 | ] | 419 | ] |
417 | ]; | 420 | ]; |
418 | 421 | ||
419 | $email = $request->get('email'); | 422 | $email = $request->get('email'); |
420 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | 423 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { |
421 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | 424 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); |
422 | } | 425 | } |
423 | 426 | ||
424 | if ($request->get('password') !== $request->get('confirmed')){ | 427 | if ($request->get('password') !== $request->get('confirmed')){ |
425 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | 428 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); |
426 | } | 429 | } |
427 | 430 | ||
428 | if (strlen($request->get('password')) < 6) { | 431 | if (strlen($request->get('password')) < 6) { |
429 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | 432 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); |
430 | } | 433 | } |
431 | /* | 434 | /* |
432 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); | 435 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); |
433 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', | 436 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', |
434 | 'X', 'C', 'V', 'B', 'N', 'M'); | 437 | 'X', 'C', 'V', 'B', 'N', 'M'); |
435 | $spec_bool = false; | 438 | $spec_bool = false; |
436 | $alpha_bool = false; | 439 | $alpha_bool = false; |
437 | 440 | ||
438 | $haystack = $request->get('password'); | 441 | $haystack = $request->get('password'); |
439 | 442 | ||
440 | foreach ($specsumbol as $it) { | 443 | foreach ($specsumbol as $it) { |
441 | if (strpos($haystack, $it) !== false) { | 444 | if (strpos($haystack, $it) !== false) { |
442 | $spec_bool = true; | 445 | $spec_bool = true; |
443 | } | 446 | } |
444 | } | 447 | } |
445 | 448 | ||
446 | foreach ($alpha as $it) { | 449 | foreach ($alpha as $it) { |
447 | if (strpos($haystack, $it) !== false) { | 450 | if (strpos($haystack, $it) !== false) { |
448 | $alpha_bool = true; | 451 | $alpha_bool = true; |
449 | } | 452 | } |
450 | } | 453 | } |
451 | 454 | ||
452 | if ((!$spec_bool) || (!$alpha_bool)) { | 455 | if ((!$spec_bool) || (!$alpha_bool)) { |
453 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); | 456 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); |
454 | }*/ | 457 | }*/ |
455 | 458 | ||
456 | if (empty($request->get('surname'))) { | 459 | if (empty($request->get('surname'))) { |
457 | $params['surname'] = 'Неизвестно'; | 460 | $params['surname'] = 'Неизвестно'; |
458 | } | 461 | } |
459 | if (empty($request->get('name_man'))) { | 462 | if (empty($request->get('name_man'))) { |
460 | $params['name_man'] = 'Неизвестно'; | 463 | $params['name_man'] = 'Неизвестно'; |
461 | } | 464 | } |
462 | $validator = Validator::make($params, $rules, $messages); | 465 | $validator = Validator::make($params, $rules, $messages); |
463 | 466 | ||
464 | if ($validator->fails()) { | 467 | if ($validator->fails()) { |
465 | return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | 468 | return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); |
466 | } else { | 469 | } else { |
467 | $user = $this->create($params); | 470 | $user = $this->create($params); |
468 | event(new Registered($user)); | 471 | event(new Registered($user)); |
469 | Auth::guard()->login($user); | 472 | Auth::guard()->login($user); |
470 | } | 473 | } |
471 | 474 | ||
472 | if ($user) { | 475 | if ($user) { |
473 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; | 476 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; |
474 | } else { | 477 | } else { |
475 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | 478 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); |
476 | } | 479 | } |
477 | } | 480 | } |
478 | 481 | ||
479 | // Создание пользователя | 482 | // Создание пользователя |
480 | protected function create(array $data) | 483 | protected function create(array $data) |
481 | { | 484 | { |
482 | $Use = new User_Model(); | 485 | $Use = new User_Model(); |
483 | $Code_user = $Use->create([ | 486 | $Code_user = $Use->create([ |
484 | 'name' => $data['surname']." ".$data['name_man'], | 487 | 'name' => $data['surname']." ".$data['name_man'], |
485 | 'name_man' => $data['name_man'], | 488 | 'name_man' => $data['name_man'], |
486 | 'surname' => $data['surname'], | 489 | 'surname' => $data['surname'], |
487 | 'surname2' => $data['surname2'], | 490 | 'surname2' => $data['surname2'], |
488 | 'subscribe_email' => $data['email'], | 491 | 'subscribe_email' => $data['email'], |
489 | 'email' => $data['email'], | 492 | 'email' => $data['email'], |
490 | 'telephone' => $data['telephone'], | 493 | 'telephone' => $data['telephone'], |
491 | 'is_worker' => 0, | 494 | 'is_worker' => 0, |
492 | 'password' => Hash::make($data['password']), | 495 | 'password' => Hash::make($data['password']), |
493 | 'pubpassword' => base64_encode($data['password']), | 496 | 'pubpassword' => base64_encode($data['password']), |
494 | 'email_verified_at' => Carbon::now() | 497 | 'email_verified_at' => Carbon::now() |
495 | ]); | 498 | ]); |
496 | 499 | ||
497 | if ($Code_user->id > 0) { | 500 | if ($Code_user->id > 0) { |
498 | $Employer = new Employer(); | 501 | $Employer = new Employer(); |
499 | $Employer->user_id = $Code_user->id; | 502 | $Employer->user_id = $Code_user->id; |
500 | $Employer->name_company = $data['name_company']; | 503 | $Employer->name_company = $data['name_company']; |
501 | $Employer->email = $data['email']; | 504 | $Employer->email = $data['email']; |
502 | $Employer->telephone = $data['telephone']; | 505 | $Employer->telephone = $data['telephone']; |
503 | $Employer->code = Tools::generator_id(10); | 506 | $Employer->code = Tools::generator_id(10); |
504 | $Employer->save(); | 507 | $Employer->save(); |
505 | 508 | ||
506 | return $Code_user; | 509 | return $Code_user; |
507 | } | 510 | } |
508 | } | 511 | } |
509 | 512 | ||
510 | // Отправка сообщения от работодателя | 513 | // Отправка сообщения от работодателя |
511 | public function send_message(MessagesRequiest $request) { | 514 | public function send_message(MessagesRequiest $request) { |
512 | $params = $request->all(); | 515 | $params = $request->all(); |
513 | dd($params); | 516 | dd($params); |
514 | $user1 = $params['user_id']; | 517 | $user1 = $params['user_id']; |
515 | $user2 = $params['to_user_id']; | 518 | $user2 = $params['to_user_id']; |
516 | 519 | ||
517 | if ($request->has('file')) { | 520 | if ($request->has('file')) { |
518 | $params['file'] = $request->file('file')->store("messages", 'public'); | 521 | $params['file'] = $request->file('file')->store("messages", 'public'); |
519 | } | 522 | } |
520 | Message::create($params); | 523 | Message::create($params); |
521 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 524 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
522 | } | 525 | } |
523 | 526 | ||
524 | public function test123(Request $request) { | 527 | public function test123(Request $request) { |
525 | $params = $request->all(); | 528 | $params = $request->all(); |
526 | $user1 = $params['user_id']; | 529 | $user1 = $params['user_id']; |
527 | $user2 = $params['to_user_id']; | 530 | $user2 = $params['to_user_id']; |
528 | 531 | ||
529 | $rules = [ | 532 | $rules = [ |
530 | 'text' => 'required|min:1|max:150000', | 533 | 'text' => 'required|min:1|max:150000', |
531 | 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' | 534 | 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' |
532 | ]; | 535 | ]; |
533 | $messages = [ | 536 | $messages = [ |
534 | 'required' => 'Укажите обязательное поле', | 537 | 'required' => 'Укажите обязательное поле', |
535 | 'min' => [ | 538 | 'min' => [ |
536 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 539 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
537 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 540 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
538 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 541 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
539 | ], | 542 | ], |
540 | 'max' => [ | 543 | 'max' => [ |
541 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 544 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
542 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 545 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
543 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 546 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
544 | ] | 547 | ] |
545 | ]; | 548 | ]; |
546 | 549 | ||
547 | $validator = Validator::make($request->all(), $rules, $messages); | 550 | $validator = Validator::make($request->all(), $rules, $messages); |
548 | 551 | ||
549 | if ($validator->fails()) { | 552 | if ($validator->fails()) { |
550 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) | 553 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) |
551 | ->withErrors($validator); | 554 | ->withErrors($validator); |
552 | } else { | 555 | } else { |
553 | if ($request->has('file')) { | 556 | if ($request->has('file')) { |
554 | $params['file'] = $request->file('file')->store("messages", 'public'); | 557 | $params['file'] = $request->file('file')->store("messages", 'public'); |
555 | } | 558 | } |
556 | Message::create($params); | 559 | Message::create($params); |
557 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 560 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
558 | 561 | ||
559 | } | 562 | } |
560 | } | 563 | } |
561 | 564 | ||
562 | //Избранные люди | 565 | //Избранные люди |
563 | public function favorites(Request $request) { | 566 | public function favorites(Request $request) { |
564 | $IP_address = RusDate::ip_addr_client(); | 567 | $IP_address = RusDate::ip_addr_client(); |
565 | $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); | 568 | $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); |
566 | 569 | ||
567 | if ($Arr->count()) { | 570 | if ($Arr->count()) { |
568 | $A = Array(); | 571 | $A = Array(); |
569 | foreach ($Arr as $it) { | 572 | foreach ($Arr as $it) { |
570 | $A[] = $it->code_record; | 573 | $A[] = $it->code_record; |
571 | } | 574 | } |
572 | 575 | ||
573 | $Workers = Worker::query()->whereIn('id', $A); | 576 | $Workers = Worker::query()->whereIn('id', $A); |
574 | } else { | 577 | } else { |
575 | $Workers = Worker::query()->where('id', '=', '0'); | 578 | $Workers = Worker::query()->where('id', '=', '0'); |
576 | } | 579 | } |
577 | 580 | ||
578 | if (($request->has('search')) && (!empty($request->get('search')))) { | 581 | if (($request->has('search')) && (!empty($request->get('search')))) { |
579 | $search = $request->get('search'); | 582 | $search = $request->get('search'); |
580 | 583 | ||
581 | $Workers = $Workers->WhereHas('users', | 584 | $Workers = $Workers->WhereHas('users', |
582 | function (Builder $query) use ($search) { | 585 | function (Builder $query) use ($search) { |
583 | $query->Where('surname', 'LIKE', "%$search%") | 586 | $query->Where('surname', 'LIKE', "%$search%") |
584 | ->orWhere('name_man', 'LIKE', "%$search%") | 587 | ->orWhere('name_man', 'LIKE', "%$search%") |
585 | ->orWhere('surname2', 'LIKE', "%$search%"); | 588 | ->orWhere('surname2', 'LIKE', "%$search%"); |
586 | }); | 589 | }); |
587 | } else { | 590 | } else { |
588 | $Workers = $Workers->with('users'); | 591 | $Workers = $Workers->with('users'); |
589 | } | 592 | } |
590 | 593 | ||
591 | $Workers = $Workers->get(); | 594 | $Workers = $Workers->get(); |
592 | 595 | ||
593 | 596 | ||
594 | return view('employers.favorite', compact('Workers')); | 597 | return view('employers.favorite', compact('Workers')); |
595 | } | 598 | } |
596 | 599 | ||
597 | // База данных | 600 | // База данных |
598 | public function bd(Request $request) { | 601 | public function bd(Request $request) { |
599 | // для типа BelongsTo | 602 | // для типа BelongsTo |
600 | //$documents = Document::query()->orderBy(Location::select('name') | 603 | //$documents = Document::query()->orderBy(Location::select('name') |
601 | // ->whereColumn('locations.id', 'documents.location_id') | 604 | // ->whereColumn('locations.id', 'documents.location_id') |
602 | //); | 605 | //); |
603 | 606 | ||
604 | // для типа HasOne/Many | 607 | // для типа HasOne/Many |
605 | // $documents = Document::::query()->orderBy(Location::select('name') | 608 | // $documents = Document::::query()->orderBy(Location::select('name') |
606 | // ->whereColumn('locations.document_id', 'documents.id') | 609 | // ->whereColumn('locations.document_id', 'documents.id') |
607 | //); | 610 | //); |
608 | 611 | ||
609 | 612 | ||
610 | $users = User_Model::query()->with('workers'); | 613 | $users = User_Model::query()->with('workers'); |
611 | 614 | ||
612 | if ($request->has('search')) { | 615 | if ($request->has('search')) { |
613 | $find_key = $request->get('search'); | 616 | $find_key = $request->get('search'); |
614 | $users = $users->where('name', 'LIKE', "%$find_key%") | 617 | $users = $users->where('name', 'LIKE', "%$find_key%") |
615 | ->orWhere('surname', 'LIKE', "%$find_key%") | 618 | ->orWhere('surname', 'LIKE', "%$find_key%") |
616 | ->orWhere('name_man', 'LIKE', "%$find_key%") | 619 | ->orWhere('name_man', 'LIKE', "%$find_key%") |
617 | ->orWhere('email', 'LIKE', "%$find_key%") | 620 | ->orWhere('email', 'LIKE', "%$find_key%") |
618 | ->orWhere('telephone', 'LIKE', "%$find_key%"); | 621 | ->orWhere('telephone', 'LIKE', "%$find_key%"); |
619 | } | 622 | } |
620 | 623 | ||
621 | // Данные | 624 | // Данные |
622 | $users = $users->Baseuser()-> | 625 | $users = $users->Baseuser()-> |
623 | orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id')); | 626 | orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id')); |
624 | $count_users = $users; | 627 | $count_users = $users; |
625 | $users = $users->paginate(5); | 628 | $users = $users->paginate(5); |
626 | 629 | ||
627 | 630 | ||
628 | return view('employers.bd', compact('users', 'count_users')); | 631 | return view('employers.bd', compact('users', 'count_users')); |
629 | } | 632 | } |
630 | 633 | ||
631 | //Настройка уведомлений | 634 | //Настройка уведомлений |
632 | public function subscribe() { | 635 | public function subscribe() { |
633 | return view('employers.subcribe'); | 636 | return view('employers.subcribe'); |
634 | } | 637 | } |
635 | 638 | ||
636 | //Установка уведомлений сохранение | 639 | //Установка уведомлений сохранение |
637 | public function save_subscribe(Request $request) { | 640 | public function save_subscribe(Request $request) { |
638 | dd($request->all()); | 641 | dd($request->all()); |
639 | $msg = $request->validate([ | 642 | $msg = $request->validate([ |
640 | 'subscribe_email' => 'required|email|min:5|max:255', | 643 | 'subscribe_email' => 'required|email|min:5|max:255', |
641 | ]); | 644 | ]); |
642 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); | 645 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); |
643 | } | 646 | } |
644 | 647 | ||
645 | //Сбросить форму с паролем | 648 | //Сбросить форму с паролем |
646 | public function password_reset() { | 649 | public function password_reset() { |
647 | $email = Auth()->user()->email; | 650 | $email = Auth()->user()->email; |
648 | return view('employers.password-reset', compact('email')); | 651 | return view('employers.password-reset', compact('email')); |
649 | } | 652 | } |
650 | 653 | ||
651 | //Обновление пароля | 654 | //Обновление пароля |
652 | public function new_password(Request $request) { | 655 | public function new_password(Request $request) { |
653 | $use = Auth()->user(); | 656 | $use = Auth()->user(); |
654 | $request->validate([ | 657 | $request->validate([ |
655 | 'password' => 'required|string', | 658 | 'password' => 'required|string', |
656 | 'new_password' => 'required|string', | 659 | 'new_password' => 'required|string', |
657 | 'new_password2' => 'required|string' | 660 | 'new_password2' => 'required|string' |
658 | ]); | 661 | ]); |
659 | 662 | ||
660 | if ($request->get('new_password') == $request->get('new_password2')) | 663 | if ($request->get('new_password') == $request->get('new_password2')) |
661 | if ($request->get('password') !== $request->get('new_password')) { | 664 | if ($request->get('password') !== $request->get('new_password')) { |
662 | $credentials = $request->only('email', 'password'); | 665 | $credentials = $request->only('email', 'password'); |
663 | if (Auth::attempt($credentials)) { | 666 | if (Auth::attempt($credentials)) { |
664 | 667 | ||
665 | if (!is_null($use->email_verified_at)){ | 668 | if (!is_null($use->email_verified_at)){ |
666 | 669 | ||
667 | $user_data = User_Model::find($use->id); | 670 | $user_data = User_Model::find($use->id); |
668 | $user_data->update([ | 671 | $user_data->update([ |
669 | 'password' => Hash::make($request->get('new_password')), | 672 | 'password' => Hash::make($request->get('new_password')), |
670 | 'pubpassword' => base64_encode($request->get('new_password')), | 673 | 'pubpassword' => base64_encode($request->get('new_password')), |
671 | ]); | 674 | ]); |
672 | return redirect() | 675 | return redirect() |
673 | ->route('employer.password_reset') | 676 | ->route('employer.password_reset') |
674 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 677 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
675 | } | 678 | } |
676 | 679 | ||
677 | return redirect() | 680 | return redirect() |
678 | ->route('employer.password_reset') | 681 | ->route('employer.password_reset') |
679 | ->withError('Данная учетная запись не было верифицированна!'); | 682 | ->withError('Данная учетная запись не было верифицированна!'); |
680 | } | 683 | } |
681 | } | 684 | } |
682 | 685 | ||
683 | return redirect() | 686 | return redirect() |
684 | ->route('employer.password_reset') | 687 | ->route('employer.password_reset') |
685 | ->withErrors('Не совпадение данных, обновите пароли!'); | 688 | ->withErrors('Не совпадение данных, обновите пароли!'); |
686 | } | 689 | } |
687 | 690 | ||
688 | 691 | ||
689 | 692 | ||
690 | // Форма Удаление пипла | 693 | // Форма Удаление пипла |
691 | public function delete_people() { | 694 | public function delete_people() { |
692 | $login = Auth()->user()->email; | 695 | $login = Auth()->user()->email; |
693 | return view('employers.delete_people', compact('login')); | 696 | return view('employers.delete_people', compact('login')); |
694 | } | 697 | } |
695 | 698 | ||
696 | // Удаление аккаунта | 699 | // Удаление аккаунта |
697 | public function action_delete_user(Request $request) { | 700 | public function action_delete_user(Request $request) { |
698 | $Answer = $request->all(); | 701 | $Answer = $request->all(); |
699 | $user_id = Auth()->user()->id; | 702 | $user_id = Auth()->user()->id; |
700 | $request->validate([ | 703 | $request->validate([ |
701 | 'password' => 'required|string', | 704 | 'password' => 'required|string', |
702 | ]); | 705 | ]); |
703 | 706 | ||
704 | $credentials = $request->only('email', 'password'); | 707 | $credentials = $request->only('email', 'password'); |
705 | if (Auth::attempt($credentials)) { | 708 | if (Auth::attempt($credentials)) { |
706 | Auth::logout(); | 709 | Auth::logout(); |
707 | $it = User_Model::find($user_id); | 710 | $it = User_Model::find($user_id); |
708 | $it->delete(); | 711 | $it->delete(); |
709 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 712 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
710 | } else { | 713 | } else { |
711 | return redirect()->route('employer.delete_people') | 714 | return redirect()->route('employer.delete_people') |
712 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 715 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
713 | } | 716 | } |
714 | } | 717 | } |
715 | 718 | ||
716 | public function ajax_delete_user(Request $request) { | 719 | public function ajax_delete_user(Request $request) { |
717 | $Answer = $request->all(); | 720 | $Answer = $request->all(); |
718 | $user_id = Auth()->user()->id; | 721 | $user_id = Auth()->user()->id; |
719 | $request->validate([ | 722 | $request->validate([ |
720 | 'password' => 'required|string', | 723 | 'password' => 'required|string', |
721 | ]); | 724 | ]); |
722 | $credentials = $request->only('email', 'password'); | 725 | $credentials = $request->only('email', 'password'); |
723 | if (Auth::attempt($credentials)) { | 726 | if (Auth::attempt($credentials)) { |
724 | 727 | ||
725 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', | 728 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', |
726 | 'email' => $request->get('email'), | 729 | 'email' => $request->get('email'), |
727 | 'password' => $request->get('password'))); | 730 | 'password' => $request->get('password'))); |
728 | } else { | 731 | } else { |
729 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); | 732 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); |
730 | } | 733 | } |
731 | } | 734 | } |
732 | 735 | ||
733 | // FAQ - Вопросы/ответы для работодателей и соискателей | 736 | // FAQ - Вопросы/ответы для работодателей и соискателей |
734 | public function faq() { | 737 | public function faq() { |
735 | return view('employers.faq'); | 738 | return view('employers.faq'); |
736 | } | 739 | } |
737 | 740 | ||
738 | // Рассылка сообщений | 741 | // Рассылка сообщений |
739 | public function send_all_messages() { | 742 | public function send_all_messages() { |
740 | $id = Auth()->user()->id; | 743 | $id = Auth()->user()->id; |
741 | $sending = Employer::query()->where('id', '=', "$id")->first(); | 744 | $sending = Employer::query()->where('id', '=', "$id")->first(); |
742 | if ($sending->sending_is) | 745 | if ($sending->sending_is) |
743 | return view('employers.send_all'); | 746 | return view('employers.send_all'); |
744 | else | 747 | else |
745 | return view('employers.send_all_danger'); | 748 | return view('employers.send_all_danger'); |
746 | } | 749 | } |
747 | 750 | ||
748 | // Отправка сообщений для информации | 751 | // Отправка сообщений для информации |
749 | public function send_all_post(Request $request) { | 752 | public function send_all_post(Request $request) { |
750 | $data = $request->all(); | 753 | $data = $request->all(); |
751 | 754 | ||
752 | $emails = User_Model::query()->where('is_worker', '1')->get(); | 755 | $emails = User_Model::query()->where('is_worker', '1')->get(); |
753 | 756 | ||
754 | foreach ($emails as $e) { | 757 | foreach ($emails as $e) { |
755 | Mail::to($e->email)->send(new SendAllMessages($data)); | 758 | Mail::to($e->email)->send(new SendAllMessages($data)); |
756 | } | 759 | } |
757 | 760 | ||
758 | return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); | 761 | return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); |
759 | } | 762 | } |
760 | 763 | ||
761 | // База резюме | 764 | // База резюме |
762 | public function bd_tupe(Request $request) { | 765 | public function bd_tupe(Request $request) { |
763 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); | 766 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); |
764 | 767 | ||
765 | return view('employers.bd_tupe', compact('Resume')); | 768 | return view('employers.bd_tupe', compact('Resume')); |
766 | } | 769 | } |
767 | 770 | ||
768 | ////////////////////////////////////////////////////////////////// | 771 | ////////////////////////////////////////////////////////////////// |
769 | // Отправил сообщение | 772 | // Отправил сообщение |
770 | ////////////////////////////////////////////////////////////////// | 773 | ////////////////////////////////////////////////////////////////// |
771 | public function new_message(Request $request) { | 774 | public function new_message(Request $request) { |
772 | $params = $request->all(); | 775 | $params = $request->all(); |
773 | $id = $params['_user_id']; | 776 | $id = $params['_user_id']; |
774 | $message = new Message(); | 777 | $message = new Message(); |
775 | $message->user_id = $params['_user_id']; | 778 | $message->user_id = $params['_user_id']; |
776 | $message->to_user_id = $params['_to_user_id']; | 779 | $message->to_user_id = $params['_to_user_id']; |
777 | $message->title = $params['title']; | 780 | $message->title = $params['title']; |
778 | $message->text = $params['text']; | 781 | $message->text = $params['text']; |
779 | if ($request->has('_file')) { | 782 | if ($request->has('_file')) { |
780 | $message->file = $request->file('_file')->store("worker/$id", 'public'); | 783 | $message->file = $request->file('_file')->store("worker/$id", 'public'); |
781 | } | 784 | } |
782 | $message->ad_employer_id = $params['_vacancy']; | 785 | $message->ad_employer_id = $params['_vacancy']; |
783 | $message->flag_new = 1; | 786 | $message->flag_new = 1; |
784 | $id_message = $message->save(); | 787 | $id_message = $message->save(); |
785 | 788 | ||
786 | //$data['message_id'] = $id_message; | 789 | //$data['message_id'] = $id_message; |
787 | //$data['ad_employer_id'] = $params['_vacancy']; | 790 | //$data['ad_employer_id'] = $params['_vacancy']; |
788 | //$data['job_title_id'] = 0; | 791 | //$data['job_title_id'] = 0; |
789 | 792 | ||
790 | $data['flag'] = 1; | 793 | $data['flag'] = 1; |
791 | //$ad_responce = ad_response::create($data); | 794 | //$ad_responce = ad_response::create($data); |
792 | return redirect()->route('employer.messages', ['type_message' => 'output']); | 795 | return redirect()->route('employer.messages', ['type_message' => 'output']); |
793 | } | 796 | } |
794 | 797 | ||
795 | // Восстановление пароля | 798 | // Восстановление пароля |
796 | public function repair_password(Request $request) { | 799 | public function repair_password(Request $request) { |
797 | $params = $request->get('email'); | 800 | $params = $request->get('email'); |
798 | } | 801 | } |
799 | 802 | ||
800 | // Избранные люди на корабль | 803 | // Избранные люди на корабль |
801 | public function selected_people(Request $request) { | 804 | public function selected_people(Request $request) { |
802 | $id = $request->get('id'); | 805 | $id = $request->get('id'); |
803 | $favorite_people = Job_title::query()->Notbdif()->where('is_remove', '=', '0')->where('position_id', $id)->get(); | 806 | $favorite_people = Job_title::query()->Notbdif()->where('is_remove', '=', '0')->where('position_id', $id)->get(); |
804 | return view('favorite_people', compact('favorite_people')); | 807 | return view('favorite_people', compact('favorite_people')); |
805 | } | 808 | } |
806 | } | 809 | } |
807 | 810 |
app/Http/Controllers/MainController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Classes\Tools; | 6 | use App\Classes\Tools; |
7 | use App\Mail\MailRegistration; | 7 | use App\Mail\MailRegistration; |
8 | use App\Mail\MailRepair; | 8 | use App\Mail\MailRepair; |
9 | use App\Models\Ad_employer; | 9 | use App\Models\Ad_employer; |
10 | use App\Models\Ad_jobs; | 10 | use App\Models\Ad_jobs; |
11 | use App\Models\Category; | 11 | use App\Models\Category; |
12 | use App\Models\Education; | 12 | use App\Models\Education; |
13 | use App\Models\Employer; | 13 | use App\Models\Employer; |
14 | use App\Models\employers_main; | 14 | use App\Models\employers_main; |
15 | use App\Models\Job_title; | 15 | use App\Models\Job_title; |
16 | use App\Models\Like_vacancy; | 16 | use App\Models\Like_vacancy; |
17 | use App\Models\Like_worker; | 17 | use App\Models\Like_worker; |
18 | use App\Models\News; | 18 | use App\Models\News; |
19 | use App\Models\Positions; | 19 | use App\Models\Positions; |
20 | use App\Models\reclame; | 20 | use App\Models\reclame; |
21 | use App\Models\User; | 21 | use App\Models\User; |
22 | use Illuminate\Http\Request; | 22 | use Illuminate\Http\Request; |
23 | use Illuminate\Support\Facades\Auth; | 23 | use Illuminate\Support\Facades\Auth; |
24 | use Illuminate\Support\Facades\DB; | 24 | use Illuminate\Support\Facades\DB; |
25 | use Illuminate\Support\Facades\Hash; | 25 | use Illuminate\Support\Facades\Hash; |
26 | use Illuminate\Support\Facades\Mail; | 26 | use Illuminate\Support\Facades\Mail; |
27 | use Illuminate\Support\Facades\Validator; | 27 | use Illuminate\Support\Facades\Validator; |
28 | use App\Classes\StatusUser; | 28 | use App\Classes\StatusUser; |
29 | 29 | ||
30 | class MainController extends Controller | 30 | class MainController extends Controller |
31 | { | 31 | { |
32 | // Главная страница публичной части | 32 | // Главная страница публичной части |
33 | public function index() { | 33 | public function index() { |
34 | $news = News::query()->orderByDesc('id')->limit(6)->get(); | 34 | $news = News::query()->orderByDesc('id')->limit(6)->get(); |
35 | 35 | ||
36 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') | 36 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') |
37 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') | 37 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') |
38 | ->OrderByDesc('created_at') | 38 | ->OrderByDesc('created_at') |
39 | ->GroupBy('categories.id') | 39 | ->GroupBy('categories.id') |
40 | ->get(); | 40 | ->get(); |
41 | 41 | ||
42 | $Position = Category::query()->where('is_remove', '=', '0')->get(); | 42 | //$Position = Category::query()->where('is_remove', '=', '0')->get(); |
43 | $job_titles = Job_title::query()->where('is_remove', '=', 0)->get(); | 43 | $Job_title = Job_title::query()->where('is_remove', '=', '0')-> |
44 | where('is_bd', '=', '0')->orderBy('name')->get(); | ||
44 | 45 | ||
45 | /*$BigFlot = Array(); | 46 | /*$BigFlot = Array(); |
46 | foreach ($Position as $position) { | 47 | foreach ($Position as $position) { |
47 | $BigFlot[] = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> | 48 | $BigFlot[] = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> |
48 | orderBy('job_titles.sort')-> | 49 | orderBy('job_titles.sort')-> |
49 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 50 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
50 | where('position_ship', "$position->name")-> | 51 | where('position_ship', "$position->name")-> |
51 | groupby('job_title_id','position_ship')-> | 52 | groupby('job_title_id','position_ship')-> |
52 | get(); | 53 | get(); |
53 | } | 54 | } |
54 | $BigFlot = Array(); | 55 | $BigFlot = Array(); |
55 | foreach ($Position as $position) { | 56 | foreach ($Position as $position) { |
56 | $BigFlot[] = Ad_jobs::query()->with(['job_title' => function($query) { | 57 | $BigFlot[] = Ad_jobs::query()->with(['job_title' => function($query) { |
57 | $query->OrderBy('sort'); | 58 | $query->OrderBy('sort'); |
58 | }])->whereHas('job_title', function ($query) use ($position) { | 59 | }])->whereHas('job_title', function ($query) use ($position) { |
59 | $query->where('position_id', $position->id); | 60 | $query->where('position_id', $position->id); |
60 | })-> | 61 | })-> |
61 | distinct('job_title_id')-> | 62 | distinct('job_title_id')-> |
62 | get(); | 63 | get(); |
63 | }*/ | 64 | }*/ |
64 | /*$BigFlot = Array(); | 65 | /*$BigFlot = Array(); |
65 | foreach ($Position as $position) { | 66 | foreach ($Position as $position) { |
66 | $BigFlot[$position->id] = DB::table('ad_jobs')-> | 67 | $BigFlot[$position->id] = DB::table('ad_jobs')-> |
67 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name, job_titles.position_id')-> | 68 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name, job_titles.position_id')-> |
68 | orderByDesc('job_titles.sort')-> | 69 | orderByDesc('job_titles.sort')-> |
69 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 70 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
70 | where('job_titles.position_id', $position->id)-> | 71 | where('job_titles.position_id', $position->id)-> |
71 | groupby('job_title_id')-> | 72 | groupby('job_title_id')-> |
72 | get(); | 73 | get(); |
73 | }*/ | 74 | }*/ |
74 | $Data = DB::table('job_titles')-> | 75 | $Data = DB::table('job_titles')-> |
75 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> | 76 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> |
76 | where('categories.is_remove', '=', '0')-> | 77 | where('categories.is_remove', '=', '0')-> |
77 | where('job_titles.is_remove', '=', '0')-> | 78 | where('job_titles.is_remove', '=', '0')-> |
78 | where('job_titles.is_bd', '=' , '0')-> | 79 | where('job_titles.is_bd', '=' , '0')-> |
79 | leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> | 80 | leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> |
80 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> | 81 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> |
81 | groupBy('job_titles.id')->orderByDesc('job_titles.position_id')-> | 82 | groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')-> |
82 | orderByDesc('job_titles.sort')->get()->toArray(); | 83 | orderByDesc('job_titles.sort')->get()->toArray(); |
83 | 84 | ||
84 | $Main_Job = array(); | 85 | $Main_Job = array(); |
85 | $name_cat = ''; | 86 | $name_cat = ''; |
86 | foreach ($Data as $it) { | 87 | foreach ($Data as $it) { |
87 | $it_arr = (array)$it; | 88 | $it_arr = (array)$it; |
88 | if ($name_cat != $it_arr['catname']) $name_cat = $it_arr['catname']; | 89 | if ($name_cat != $it_arr['catname']) $name_cat = $it_arr['catname']; |
89 | $Main_Job[$name_cat][] = $it_arr; | 90 | $Main_Job[$name_cat][] = $it_arr; |
90 | } | 91 | } |
91 | 92 | ||
92 | $employers = employers_main::query()->with('employer')->orderBy('id')->limit(8)->get(); | 93 | $employers = employers_main::query()->with('employer')->orderBy('id')->limit(8)->get(); |
93 | $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get(); | 94 | $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get(); |
94 | return view('index', compact('news', 'job_titles', 'categories', 'employers', 'vacancy', 'Main_Job')); | 95 | return view('index', compact('news', 'Job_title', 'categories', 'employers', 'vacancy', 'Main_Job')); |
95 | } | 96 | } |
96 | 97 | ||
97 | public function search_vacancies(Request $request) { | 98 | public function search_vacancies(Request $request) { |
98 | if ($request->has('search')) { | 99 | if ($request->has('search')) { |
99 | $search = $request->get('search'); | 100 | $search = $request->get('search'); |
100 | $job_titles = Job_title::query()->where('name', 'LIKE', "%$search%")->first(); | 101 | $job_titles = Job_title::query()->where('name', 'LIKE', "%$search%")->first(); |
101 | if (isset($job_titles->id)) | 102 | if (isset($job_titles->id)) |
102 | if ($job_titles->id > 0) | 103 | if ($job_titles->id > 0) |
103 | return redirect()->route('vacancies', ['job' => $job_titles->id]); | 104 | return redirect()->route('vacancies', ['job' => $job_titles->id]); |
104 | } | 105 | } |
105 | } | 106 | } |
106 | 107 | ||
107 | // Лайк вакансии | 108 | // Лайк вакансии |
108 | public function like_vacancy(Request $request) { | 109 | public function like_vacancy(Request $request) { |
109 | $IP_address = RusDate::ip_addr_client(); | 110 | $IP_address = RusDate::ip_addr_client(); |
110 | 111 | ||
111 | if ($request->has('code_record')) { | 112 | if ($request->has('code_record')) { |
112 | if ($request->has('delete')) { | 113 | if ($request->has('delete')) { |
113 | $code = $request->get('code_record'); | 114 | $code = $request->get('code_record'); |
114 | $atomic_era = Like_vacancy::select('id')-> | 115 | $atomic_era = Like_vacancy::select('id')-> |
115 | where('code_record', '=', $code)->toSql(); | 116 | where('code_record', '=', $code)->toSql(); |
116 | DB::table('like_vacancy')->where('code_record', $request->get('code_record'))->delete(); | 117 | DB::table('like_vacancy')->where('code_record', $request->get('code_record'))->delete(); |
117 | 118 | ||
118 | } else { | 119 | } else { |
119 | $params = $request->all(); | 120 | $params = $request->all(); |
120 | $params['ip_address'] = $IP_address; | 121 | $params['ip_address'] = $IP_address; |
121 | Like_vacancy::create($params); | 122 | Like_vacancy::create($params); |
122 | } | 123 | } |
123 | } | 124 | } |
124 | } | 125 | } |
125 | 126 | ||
126 | // Лайк соискателю. | 127 | // Лайк соискателю. |
127 | public function like_worker(Request $request) { | 128 | public function like_worker(Request $request) { |
128 | $IP_address = RusDate::ip_addr_client(); | 129 | $IP_address = RusDate::ip_addr_client(); |
129 | 130 | ||
130 | if ($request->has('code_record')) { | 131 | if ($request->has('code_record')) { |
131 | if ($request->has('delete')) { | 132 | if ($request->has('delete')) { |
132 | $atomic_era = Like_worker::select('id')-> | 133 | $atomic_era = Like_worker::select('id')-> |
133 | where('code_record', '=', $request-> | 134 | where('code_record', '=', $request-> |
134 | get('code_record'))->first(); | 135 | get('code_record'))->first(); |
135 | 136 | ||
136 | DB::table('like_worker')->where('code_record', $request->get('code_record'))->delete(); | 137 | DB::table('like_worker')->where('code_record', $request->get('code_record'))->delete(); |
137 | 138 | ||
138 | return "Вот и результат удаления!"; | 139 | return "Вот и результат удаления!"; |
139 | 140 | ||
140 | } else { | 141 | } else { |
141 | $params = $request->all(); | 142 | $params = $request->all(); |
142 | $params['ip_address'] = $IP_address; | 143 | $params['ip_address'] = $IP_address; |
143 | Like_worker::create($params); | 144 | Like_worker::create($params); |
144 | } | 145 | } |
145 | } | 146 | } |
146 | } | 147 | } |
147 | 148 | ||
148 | public function vacancies(Request $request) { | 149 | public function vacancies(Request $request) { |
149 | //должности | 150 | //должности |
150 | $Job_title = Job_title::query()->where('is_remove', '=', '0')->orderBy('name')->get(); | 151 | $Job_title = Job_title::query()->where('is_remove', '=', '0')-> |
152 | where('is_bd', '=', '0')->orderBy('name')->get(); | ||
151 | 153 | ||
152 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') | 154 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') |
153 | ->selectRaw('min(ad_employers.salary) as min_salary, max(ad_employers.salary) as max_salary') | 155 | ->selectRaw('min(ad_employers.salary) as min_salary, max(ad_employers.salary) as max_salary') |
154 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') | 156 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') |
155 | ->join('ad_jobs', 'ad_jobs.ad_employer_id', '=', 'ad_employers.id'); | 157 | ->join('ad_jobs', 'ad_jobs.ad_employer_id', '=', 'ad_employers.id'); |
156 | 158 | ||
157 | //категории и вакансии | 159 | //категории и вакансии |
158 | if (($request->has('job')) && ($request->get('job') > 0)) { | 160 | if (($request->has('job')) && ($request->get('job') > 0)) { |
159 | $categories = $categories->Where('job_title_id', '=', $request->get('job')); | 161 | $categories = $categories->Where('job_title_id', '=', $request->get('job')); |
160 | } | 162 | } |
161 | 163 | ||
162 | $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get(); | 164 | $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get(); |
163 | 165 | ||
164 | //$Position = Category::query()->where('is_remove', '=', '0')->get(); | 166 | //$Position = Category::query()->where('is_remove', '=', '0')->get(); |
165 | 167 | ||
166 | 168 | ||
167 | /*$BigFlot = Array(); | 169 | /*$BigFlot = Array(); |
168 | foreach ($Position as $position) { | 170 | foreach ($Position as $position) { |
169 | $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> | 171 | $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> |
170 | orderBy('job_titles.sort')-> | 172 | orderBy('job_titles.sort')-> |
171 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 173 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
172 | where('position_ship', "$position->name"); | 174 | where('position_ship', "$position->name"); |
173 | if (($request->has('job')) && ($request->get('job') > 0)) { | 175 | if (($request->has('job')) && ($request->get('job') > 0)) { |
174 | $War_flot = $War_flot->where('job_title_id', $request->get('job')); | 176 | $War_flot = $War_flot->where('job_title_id', $request->get('job')); |
175 | } | 177 | } |
176 | $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); | 178 | $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); |
177 | $BigFlot[] = $War_flot; | 179 | $BigFlot[] = $War_flot; |
178 | }*/ | 180 | }*/ |
179 | /* | 181 | /* |
180 | $BigFlot = Array(); | 182 | $BigFlot = Array(); |
181 | foreach ($Position as $position) { | 183 | foreach ($Position as $position) { |
182 | $WarFlot = DB::table('ad_jobs')-> | 184 | $WarFlot = DB::table('ad_jobs')-> |
183 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> | 185 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> |
184 | orderByDesc('job_titles.sort')-> | 186 | orderByDesc('job_titles.sort')-> |
185 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 187 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
186 | where('job_titles.position_id', $position->id); | 188 | where('job_titles.position_id', $position->id); |
187 | if (($request->has('job')) && ($request->get('job') > 0)) { | 189 | if (($request->has('job')) && ($request->get('job') > 0)) { |
188 | $WarFlot = $WarFlot->where('job_title_id', $request->get('job')); | 190 | $WarFlot = $WarFlot->where('job_title_id', $request->get('job')); |
189 | } | 191 | } |
190 | $WarFlot = $WarFlot->groupby('job_title_id')->get(); | 192 | $WarFlot = $WarFlot->groupby('job_title_id')->get(); |
191 | $BigFlot[] = $WarFlot; | 193 | $BigFlot[] = $WarFlot; |
192 | } | 194 | } |
193 | */ | 195 | */ |
194 | 196 | ||
195 | $Data = DB::table('job_titles')-> | 197 | $Data = DB::table('job_titles')-> |
196 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> | 198 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> |
197 | where('categories.is_remove', '=', '0')-> | 199 | where('categories.is_remove', '=', '0')-> |
198 | where('job_titles.is_bd', '=' , '0')-> | 200 | where('job_titles.is_bd', '=' , '0')-> |
199 | where('job_titles.is_remove', '=', '0'); | 201 | where('job_titles.is_remove', '=', '0'); |
200 | if (($request->has('job')) && ($request->get('job') > 0)) { | 202 | if (($request->has('job')) && ($request->get('job') > 0)) { |
201 | $Data = $Data->where('job_title_id', $request->get('job')); | 203 | $Data = $Data->where('job_title_id', $request->get('job')); |
202 | } | 204 | } |
203 | $Data = $Data->leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> | 205 | $Data = $Data->leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> |
204 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> | 206 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> |
205 | groupBy('job_titles.id')->orderByDesc('job_titles.position_id')-> | 207 | groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')-> |
206 | orderByDesc('job_titles.sort')->get()->toArray(); | 208 | orderByDesc('job_titles.sort')->get()->toArray(); |
207 | 209 | ||
208 | $Main_Job = array(); | 210 | $Main_Job = array(); |
209 | $name_cat = ''; | 211 | $name_cat = ''; |
210 | foreach ($Data as $it) { | 212 | foreach ($Data as $it) { |
211 | $it_arr = (array)$it; | 213 | $it_arr = (array)$it; |
212 | if ($name_cat != $it_arr['catname']) | 214 | if ($name_cat != $it_arr['catname']) |
213 | $name_cat = $it_arr['catname']; | 215 | $name_cat = $it_arr['catname']; |
214 | $Main_Job[$name_cat][] = $it_arr; | 216 | $Main_Job[$name_cat][] = $it_arr; |
215 | } | 217 | } |
216 | 218 | ||
217 | if ($request->ajax()) { | 219 | if ($request->ajax()) { |
218 | return view('ajax.new_sky', compact('categories', 'Main_Job')); | 220 | return view('ajax.new_sky', compact('categories', 'Main_Job')); |
219 | } else { | 221 | } else { |
220 | return view('new_sky', compact('Job_title', 'categories', 'Main_Job')); | 222 | return view('new_sky', compact('Job_title', 'categories', 'Main_Job')); |
221 | } | 223 | } |
222 | } | 224 | } |
223 | 225 | ||
224 | //Вакансии категория детальная | 226 | //Вакансии категория детальная |
225 | public function list_vacancies(Category $categories, Request $request) { | 227 | public function list_vacancies(Category $categories, Request $request) { |
226 | if (isset(Auth()->user()->id)) | 228 | if (isset(Auth()->user()->id)) |
227 | $uid = Auth()->user()->id; | 229 | $uid = Auth()->user()->id; |
228 | else | 230 | else |
229 | $uid = 0; | 231 | $uid = 0; |
230 | 232 | ||
231 | if ($request->get('job') == 0) | 233 | if ($request->get('job') == 0) |
232 | $job_search = ''; | 234 | $job_search = ''; |
233 | else | 235 | else |
234 | $job_search = $request->get('job'); | 236 | $job_search = $request->get('job'); |
235 | 237 | ||
236 | $Query = Ad_employer::with('jobs')-> | 238 | $Query = Ad_employer::with('jobs')-> |
237 | with('cat')-> | 239 | with('cat')-> |
238 | with('employer')-> | 240 | with('employer')-> |
239 | 241 | ||
240 | whereHas('jobs_code', function ($query) use ($job_search) { | 242 | whereHas('jobs_code', function ($query) use ($job_search) { |
241 | if (!empty($job_search)) { | 243 | if (!empty($job_search)) { |
242 | $query->where('job_title_id', $job_search); | 244 | $query->where('job_title_id', $job_search); |
243 | } | 245 | } |
244 | })->select('ad_employers.*'); | 246 | })->select('ad_employers.*'); |
245 | 247 | ||
246 | if (isset($categories->id) && ($categories->id > 0)) { | 248 | if (isset($categories->id) && ($categories->id > 0)) { |
247 | $Query = $Query->where('category_id', '=', $categories->id); | 249 | $Query = $Query->where('category_id', '=', $categories->id); |
248 | $Name_categori = Category::query()->where('id', '=', $categories->id)->get(); | 250 | $Name_categori = Category::query()->where('id', '=', $categories->id)->get(); |
249 | } else { | 251 | } else { |
250 | $Name_categori = ''; | 252 | $Name_categori = ''; |
251 | } | 253 | } |
252 | 254 | ||
253 | if ($request->get('sort')) { | 255 | if ($request->get('sort')) { |
254 | $sort = $request->get('sort'); | 256 | $sort = $request->get('sort'); |
255 | switch ($sort) { | 257 | switch ($sort) { |
256 | case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break; | 258 | case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break; |
257 | case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break; | 259 | case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break; |
258 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; | 260 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; |
259 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; | 261 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; |
260 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 262 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
261 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 263 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
262 | } | 264 | } |
263 | } | 265 | } |
264 | 266 | ||
265 | $Job_title = Job_title::query()->OrderBy('name')->get(); | 267 | $Job_title = Job_title::query()->where('is_bd', '=', '0')->OrderBy('name')->get(); |
266 | 268 | ||
267 | $Query_count = $Query->count(); | 269 | $Query_count = $Query->count(); |
268 | 270 | ||
269 | $Query = $Query->OrderBy('updated_at')->paginate(3); | 271 | $Query = $Query->OrderBy('updated_at')->paginate(3); |
270 | 272 | ||
271 | $Reclama = reclame::query()->get(); | 273 | $Reclama = reclame::query()->get(); |
272 | 274 | ||
273 | if ($request->ajax()) { | 275 | if ($request->ajax()) { |
274 | if ($request->has('title')) { | 276 | if ($request->has('title')) { |
275 | return view('ajax.list_category', compact( | 277 | return view('ajax.list_category', compact( |
276 | 'Name_categori' | 278 | 'Name_categori' |
277 | )); | 279 | )); |
278 | } else { | 280 | } else { |
279 | return view('ajax.list_vacancies', compact('Query', | 281 | return view('ajax.list_vacancies', compact('Query', |
280 | 'Query_count', | 282 | 'Query_count', |
281 | 'Name_categori', | 283 | 'Name_categori', |
282 | 'Reclama', | 284 | 'Reclama', |
283 | 'categories', | 285 | 'categories', |
284 | 'Job_title', | 286 | 'Job_title', |
285 | 'uid')); | 287 | 'uid')); |
286 | } | 288 | } |
287 | } else { | 289 | } else { |
288 | //Вернуть все | 290 | //Вернуть все |
289 | return view('list_vacancies', compact('Query', | 291 | return view('list_vacancies', compact('Query', |
290 | 'Query_count', | 292 | 'Query_count', |
291 | 'Reclama', | 293 | 'Reclama', |
292 | 'Name_categori', | 294 | 'Name_categori', |
293 | 'categories', | 295 | 'categories', |
294 | 'Job_title', | 296 | 'Job_title', |
295 | 'uid')); | 297 | 'uid')); |
296 | } | 298 | } |
297 | } | 299 | } |
298 | 300 | ||
299 | // Образование | 301 | // Образование |
300 | public function education(Request $request) { | 302 | public function education(Request $request) { |
301 | $educations = Education::query(); | 303 | $educations = Education::query(); |
302 | if (($request->has('search')) && (!empty($request->get('search')))) { | 304 | if (($request->has('search')) && (!empty($request->get('search')))) { |
303 | $search = trim($request->get('search')); | 305 | $search = trim($request->get('search')); |
304 | $educations = $educations->where('name', 'LIKE', "%$search%"); | 306 | $educations = $educations->where('name', 'LIKE', "%$search%"); |
305 | } | 307 | } |
306 | 308 | ||
307 | if ($request->get('sort')) { | 309 | if ($request->get('sort')) { |
308 | $sort = $request->get('sort'); | 310 | $sort = $request->get('sort'); |
309 | switch ($sort) { | 311 | switch ($sort) { |
310 | case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break; | 312 | case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break; |
311 | case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break; | 313 | case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break; |
312 | case 'created_at_up': $educations = $educations->OrderBy('created_at')->orderBy('id'); break; | 314 | case 'created_at_up': $educations = $educations->OrderBy('created_at')->orderBy('id'); break; |
313 | case 'created_at_down': $educations = $educations->orderByDesc('created_at')->orderBy('id'); break; | 315 | case 'created_at_down': $educations = $educations->orderByDesc('created_at')->orderBy('id'); break; |
314 | case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break; | 316 | case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break; |
315 | default: $educations = $educations->orderBy('id')->orderby('updated_at'); break; | 317 | default: $educations = $educations->orderBy('id')->orderby('updated_at'); break; |
316 | } | 318 | } |
317 | } | 319 | } |
318 | 320 | ||
319 | $count_edu = $educations->count(); | 321 | $count_edu = $educations->count(); |
320 | $educations = $educations->paginate(6); | 322 | $educations = $educations->paginate(6); |
321 | if ($request->ajax()) { | 323 | if ($request->ajax()) { |
322 | return view('ajax.education', compact('educations')); | 324 | return view('ajax.education', compact('educations')); |
323 | } else { | 325 | } else { |
324 | return view('education', compact('educations', 'count_edu')); | 326 | return view('education', compact('educations', 'count_edu')); |
325 | } | 327 | } |
326 | } | 328 | } |
327 | 329 | ||
328 | // Контакты | 330 | // Контакты |
329 | public function contacts() { | 331 | public function contacts() { |
330 | return view('contacts'); | 332 | return view('contacts'); |
331 | } | 333 | } |
332 | 334 | ||
333 | // Вход в личный кабинет | 335 | // Вход в личный кабинет |
334 | public function input_login(Request $request) | 336 | public function input_login(Request $request) |
335 | { | 337 | { |
336 | $params = $request->all(); | 338 | $params = $request->all(); |
337 | 339 | ||
338 | 340 | ||
339 | $rules = [ | 341 | $rules = [ |
340 | 'email' => 'required|string|email', | 342 | 'email' => 'required|string|email', |
341 | 'password' => 'required|string|min:3|max:25', | 343 | 'password' => 'required|string|min:3|max:25', |
342 | ]; | 344 | ]; |
343 | 345 | ||
344 | $messages = [ | 346 | $messages = [ |
345 | 'required' => 'Укажите обязательное поле «:attribute»', | 347 | 'required' => 'Укажите обязательное поле «:attribute»', |
346 | 'email' => 'Введите корректный email', | 348 | 'email' => 'Введите корректный email', |
347 | 'min' => [ | 349 | 'min' => [ |
348 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 350 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
349 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 351 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
350 | ], | 352 | ], |
351 | 'max' => [ | 353 | 'max' => [ |
352 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 354 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
353 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 355 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
354 | ], | 356 | ], |
355 | ]; | 357 | ]; |
356 | $validator = Validator::make($request->all(), $rules, $messages); | 358 | $validator = Validator::make($request->all(), $rules, $messages); |
357 | if ($validator->fails()) { | 359 | if ($validator->fails()) { |
358 | if (Auth::check()) | 360 | if (Auth::check()) |
359 | $user_id = $request->user()->id; | 361 | $user_id = $request->user()->id; |
360 | else | 362 | else |
361 | $user_id = 0; | 363 | $user_id = 0; |
362 | 364 | ||
363 | if ($user_id > 0) | 365 | if ($user_id > 0) |
364 | return json_encode(Array("ERROR" => "Email или пароль невалидный!")); | 366 | return json_encode(Array("ERROR" => "Email или пароль невалидный!")); |
365 | else | 367 | else |
366 | return redirect()->route('index')->with('Error', "Email или пароль невалидный"); | 368 | return redirect()->route('index')->with('Error', "Email или пароль невалидный"); |
367 | } else { | 369 | } else { |
368 | $credentials = $request->only('email', 'password'); | 370 | $credentials = $request->only('email', 'password'); |
369 | 371 | ||
370 | if (Auth::attempt($credentials, $request->has('remember'))) { | 372 | if (Auth::attempt($credentials, $request->has('remember'))) { |
371 | 373 | ||
372 | if (is_null(Auth::user()->email_verified_at)) { | 374 | if (is_null(Auth::user()->email_verified_at)) { |
373 | Auth::logout(); | 375 | Auth::logout(); |
374 | return json_encode(Array("ERROR" => "Адрес почты не подтвержден")); | 376 | return json_encode(Array("ERROR" => "Адрес почты не подтвержден")); |
375 | } | 377 | } |
376 | 378 | ||
377 | if (Auth::user()->is_worker) { | 379 | if (Auth::user()->is_worker) { |
378 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl())); | 380 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl())); |
379 | } else { | 381 | } else { |
380 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl())); | 382 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl())); |
381 | } | 383 | } |
382 | 384 | ||
383 | return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет")); | 385 | return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет")); |
384 | //->route('index') | 386 | //->route('index') |
385 | //->with('success', 'Вы вошли в личный кабинет.'); | 387 | //->with('success', 'Вы вошли в личный кабинет.'); |
386 | } else { | 388 | } else { |
387 | return json_encode(Array("ERROR" => "Неверный логин или пароль!")); | 389 | return json_encode(Array("ERROR" => "Неверный логин или пароль!")); |
388 | } | 390 | } |
389 | } | 391 | } |
390 | } | 392 | } |
391 | 393 | ||
392 | // Восстановление пароля | 394 | // Восстановление пароля |
393 | public function repair_password(Request $request) { | 395 | public function repair_password(Request $request) { |
394 | $rules = [ | 396 | $rules = [ |
395 | 'email' => 'required|string|email', | 397 | 'email' => 'required|string|email', |
396 | ]; | 398 | ]; |
397 | 399 | ||
398 | $messages = [ | 400 | $messages = [ |
399 | 'required' => 'Укажите обязательное поле «:attribute»', | 401 | 'required' => 'Укажите обязательное поле «:attribute»', |
400 | 'email' => 'Введите корректный email', | 402 | 'email' => 'Введите корректный email', |
401 | 'min' => [ | 403 | 'min' => [ |
402 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 404 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
403 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 405 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
404 | ], | 406 | ], |
405 | 'max' => [ | 407 | 'max' => [ |
406 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 408 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
407 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 409 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
408 | ], | 410 | ], |
409 | ]; | 411 | ]; |
410 | 412 | ||
411 | $validator = Validator::make($request->all(), $rules, $messages); | 413 | $validator = Validator::make($request->all(), $rules, $messages); |
412 | 414 | ||
413 | if ($validator->fails()) { | 415 | if ($validator->fails()) { |
414 | return redirect()->back()->with('Error', "Email невалидный"); | 416 | return redirect()->back()->with('Error', "Email невалидный"); |
415 | } else { | 417 | } else { |
416 | $new_password = Tools::generator_id(10); | 418 | $new_password = Tools::generator_id(10); |
417 | $hash_password = Hash::make($new_password); | 419 | $hash_password = Hash::make($new_password); |
418 | $user = User::query()->where('email', $request->get('email'))->first(); | 420 | $user = User::query()->where('email', $request->get('email'))->first(); |
419 | $EditRec = User::find($user->id); | 421 | $EditRec = User::find($user->id); |
420 | $EditRec->password = $hash_password; | 422 | $EditRec->password = $hash_password; |
421 | $EditRec->save(); | 423 | $EditRec->save(); |
422 | 424 | ||
423 | foreach ([$request->get('email')] as $recipient) { | 425 | foreach ([$request->get('email')] as $recipient) { |
424 | Mail::to($recipient)->send(new MailRepair($new_password)); | 426 | Mail::to($recipient)->send(new MailRepair($new_password)); |
425 | } | 427 | } |
426 | return redirect()->route('index'); | 428 | return redirect()->route('index'); |
427 | 429 | ||
428 | } | 430 | } |
429 | 431 | ||
430 | } | 432 | } |
431 | 433 | ||
432 | // Вывод новостей | 434 | // Вывод новостей |
433 | public function news(Request $request) { | 435 | public function news(Request $request) { |
434 | $Query = News::query(); | 436 | $Query = News::query(); |
435 | if ($request->has('search')) { | 437 | if ($request->has('search')) { |
436 | $search = $request->get('search'); | 438 | $search = $request->get('search'); |
437 | $Query = $Query->where('title', 'LIKE', "%$search%")-> | 439 | $Query = $Query->where('title', 'LIKE', "%$search%")-> |
438 | orWhere('text', 'LIKE', "%$search%"); | 440 | orWhere('text', 'LIKE', "%$search%"); |
439 | } | 441 | } |
440 | 442 | ||
441 | if ($request->ajax()) { | 443 | if ($request->ajax()) { |
442 | if ($request->get('sort')) { | 444 | if ($request->get('sort')) { |
443 | $sort = $request->get('sort'); | 445 | $sort = $request->get('sort'); |
444 | switch ($sort) { | 446 | switch ($sort) { |
445 | case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break; | 447 | case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break; |
446 | case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break; | 448 | case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break; |
447 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; | 449 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; |
448 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; | 450 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; |
449 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 451 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
450 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 452 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
451 | } | 453 | } |
452 | } | 454 | } |
453 | } | 455 | } |
454 | $Query_count = $Query->count(); | 456 | $Query_count = $Query->count(); |
455 | $Query = $Query->paginate(6); | 457 | $Query = $Query->paginate(6); |
456 | 458 | ||
457 | if ($request->ajax()) { | 459 | if ($request->ajax()) { |
458 | return view('ajax.news-list', compact('Query', 'Query_count')); | 460 | return view('ajax.news-list', compact('Query', 'Query_count')); |
459 | } else { | 461 | } else { |
460 | return view('news-list', compact('Query', 'Query_count')); | 462 | return view('news-list', compact('Query', 'Query_count')); |
461 | } | 463 | } |
462 | } | 464 | } |
463 | 465 | ||
464 | //Детальная новость | 466 | //Детальная новость |
465 | public function detail_new(News $new) { | 467 | public function detail_new(News $new) { |
466 | // Наборка | 468 | // Наборка |
467 | $Query = News::query()->where('id', $new->id)->get(); | 469 | $Query = News::query()->where('id', $new->id)->get(); |
468 | $title = $Query[0]->title; | 470 | $title = $Query[0]->title; |
469 | $All_Query = News::query()->paginate(8); | 471 | $All_Query = News::query()->paginate(8); |
470 | return view('detail_new', compact('Query', 'All_Query', 'title')); | 472 | return view('detail_new', compact('Query', 'All_Query', 'title')); |
471 | } | 473 | } |
472 | } | 474 | } |
473 | 475 |
app/Http/Controllers/WorkerController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Http\Requests\DocumentsRequest; | 6 | use App\Http\Requests\DocumentsRequest; |
7 | use App\Http\Requests\PrevCompanyRequest; | 7 | use App\Http\Requests\PrevCompanyRequest; |
8 | use App\Http\Requests\SertificationRequest; | 8 | use App\Http\Requests\SertificationRequest; |
9 | use App\Models\Ad_employer; | 9 | use App\Models\Ad_employer; |
10 | use App\Models\ad_response; | 10 | use App\Models\ad_response; |
11 | use App\Models\Category; | 11 | use App\Models\Category; |
12 | use App\Models\Dop_info; | 12 | use App\Models\Dop_info; |
13 | use App\Models\Employer; | 13 | use App\Models\Employer; |
14 | use App\Models\infobloks; | 14 | use App\Models\infobloks; |
15 | use App\Models\Job_title; | 15 | use App\Models\Job_title; |
16 | use App\Models\Like_vacancy; | 16 | use App\Models\Like_vacancy; |
17 | use App\Models\Like_worker; | 17 | use App\Models\Like_worker; |
18 | use App\Models\Message; | 18 | use App\Models\Message; |
19 | use App\Models\place_works; | 19 | use App\Models\place_works; |
20 | use App\Models\PrevCompany; | 20 | use App\Models\PrevCompany; |
21 | use App\Models\reclame; | 21 | use App\Models\reclame; |
22 | use App\Models\ResponseWork; | 22 | use App\Models\ResponseWork; |
23 | use App\Models\sertification; | 23 | use App\Models\sertification; |
24 | use App\Models\Static_worker; | 24 | use App\Models\Static_worker; |
25 | use App\Models\Title_worker; | 25 | use App\Models\Title_worker; |
26 | use App\Models\User; | 26 | use App\Models\User; |
27 | use App\Models\User as User_Model; | 27 | use App\Models\User as User_Model; |
28 | use App\Models\Worker; | 28 | use App\Models\Worker; |
29 | use Barryvdh\DomPDF\Facade\Pdf; | 29 | use Barryvdh\DomPDF\Facade\Pdf; |
30 | use Carbon\Carbon; | 30 | use Carbon\Carbon; |
31 | use Illuminate\Auth\Events\Registered; | 31 | use Illuminate\Auth\Events\Registered; |
32 | use Illuminate\Database\Eloquent\Builder; | 32 | use Illuminate\Database\Eloquent\Builder; |
33 | use Illuminate\Database\Eloquent\Model; | 33 | use Illuminate\Database\Eloquent\Model; |
34 | use Illuminate\Http\JsonResponse; | 34 | use Illuminate\Http\JsonResponse; |
35 | use Illuminate\Http\Request; | 35 | use Illuminate\Http\Request; |
36 | use Illuminate\Support\Facades\Auth; | 36 | use Illuminate\Support\Facades\Auth; |
37 | use Illuminate\Support\Facades\Hash; | 37 | use Illuminate\Support\Facades\Hash; |
38 | use Illuminate\Support\Facades\Storage; | 38 | use Illuminate\Support\Facades\Storage; |
39 | use Illuminate\Support\Facades\Validator; | 39 | use Illuminate\Support\Facades\Validator; |
40 | 40 | ||
41 | class WorkerController extends Controller | 41 | class WorkerController extends Controller |
42 | { | 42 | { |
43 | public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу'); | 43 | public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу'); |
44 | 44 | ||
45 | //профиль | 45 | //профиль |
46 | public function profile(Worker $worker) | 46 | public function profile(Worker $worker) |
47 | { | 47 | { |
48 | $get_date = date('Y.m'); | 48 | $get_date = date('Y.m'); |
49 | 49 | ||
50 | $c = Static_worker::query()->where('year_month', '=', $get_date) | 50 | $c = Static_worker::query()->where('year_month', '=', $get_date) |
51 | ->where('user_id', '=', $worker->users->id) | 51 | ->where('user_id', '=', $worker->users->id) |
52 | ->get(); | 52 | ->get(); |
53 | 53 | ||
54 | if ($c->count() > 0) { | 54 | if ($c->count() > 0) { |
55 | $upd = Static_worker::find($c[0]->id); | 55 | $upd = Static_worker::find($c[0]->id); |
56 | $upd->lookin = $upd->lookin + 1; | 56 | $upd->lookin = $upd->lookin + 1; |
57 | $upd->save(); | 57 | $upd->save(); |
58 | } else { | 58 | } else { |
59 | $crt = new Static_worker(); | 59 | $crt = new Static_worker(); |
60 | $crt->lookin = 1; | 60 | $crt->lookin = 1; |
61 | $crt->year_month = $get_date; | 61 | $crt->year_month = $get_date; |
62 | $crt->user_id = $worker->user_id; | 62 | $crt->user_id = $worker->user_id; |
63 | $crt->save(); | 63 | $crt->save(); |
64 | } | 64 | } |
65 | 65 | ||
66 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 66 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
67 | ->where('user_id', '=', $worker->users->id) | 67 | ->where('user_id', '=', $worker->users->id) |
68 | ->get(); | 68 | ->get(); |
69 | 69 | ||
70 | return view('public.workers.profile', compact('worker', 'stat')); | 70 | return view('public.workers.profile', compact('worker', 'stat')); |
71 | } | 71 | } |
72 | 72 | ||
73 | // лист база резюме | 73 | // лист база резюме |
74 | public function bd_resume(Request $request) | 74 | public function bd_resume(Request $request) |
75 | { | 75 | { |
76 | $look = false; | 76 | $look = false; |
77 | $idiot = 0; | 77 | $idiot = 0; |
78 | if (isset(Auth()->user()->id)) { | 78 | if (isset(Auth()->user()->id)) { |
79 | $idiot = Auth()->user()->id; | 79 | $idiot = Auth()->user()->id; |
80 | if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin)) | 80 | if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin)) |
81 | $look = true; | 81 | $look = true; |
82 | } | 82 | } |
83 | 83 | ||
84 | if ($look) { | 84 | if ($look) { |
85 | $status_work = $this->status_work; | 85 | $status_work = $this->status_work; |
86 | $resumes = Worker::query()->with('users')->with('job_titles'); | 86 | $resumes = Worker::query()->with('users')->with('job_titles'); |
87 | $resumes = $resumes->whereHas('users', function (Builder $query) { | 87 | $resumes = $resumes->whereHas('users', function (Builder $query) { |
88 | $query->Where('is_worker', '=', '1') | 88 | $query->Where('is_worker', '=', '1') |
89 | ->Where('is_bd', '=', '0'); | 89 | ->Where('is_bd', '=', '0'); |
90 | }); | 90 | }); |
91 | 91 | ||
92 | //dd($request->get('job')); | 92 | //dd($request->get('job')); |
93 | if (($request->has('job')) && ($request->get('job') > 0)) { | 93 | if (($request->has('job')) && ($request->get('job') > 0)) { |
94 | $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { | 94 | $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { |
95 | $query->Where('job_titles.id', $request->get('job')); | 95 | $query->Where('job_titles.id', $request->get('job')); |
96 | }); | 96 | }); |
97 | } | 97 | } |
98 | 98 | ||
99 | $Job_title = Job_title::query()->get(); | 99 | $Job_title = Job_title::query()->get(); |
100 | 100 | ||
101 | if ($request->get('sort')) { | 101 | if ($request->get('sort')) { |
102 | $sort = $request->get('sort'); | 102 | $sort = $request->get('sort'); |
103 | switch ($sort) { | 103 | switch ($sort) { |
104 | case 'name_up': | 104 | case 'name_up': |
105 | $resumes = $resumes->orderBy(User::select('surname') | 105 | $resumes = $resumes->orderBy(User::select('surname') |
106 | ->whereColumn('Workers.user_id', 'users.id') | 106 | ->whereColumn('Workers.user_id', 'users.id') |
107 | ); | 107 | ); |
108 | break; | 108 | break; |
109 | case 'name_down': | 109 | case 'name_down': |
110 | $resumes = $resumes->orderByDesc(User::select('surname') | 110 | $resumes = $resumes->orderByDesc(User::select('surname') |
111 | ->whereColumn('Workers.user_id', 'users.id') | 111 | ->whereColumn('Workers.user_id', 'users.id') |
112 | ); | 112 | ); |
113 | break; | 113 | break; |
114 | case 'created_at_up': | 114 | case 'created_at_up': |
115 | $resumes = $resumes->OrderBy('created_at')->orderBy('id'); | 115 | $resumes = $resumes->OrderBy('created_at')->orderBy('id'); |
116 | break; | 116 | break; |
117 | case 'created_at_down': | 117 | case 'created_at_down': |
118 | $resumes = $resumes->orderByDesc('created_at')->orderBy('id'); | 118 | $resumes = $resumes->orderByDesc('created_at')->orderBy('id'); |
119 | break; | 119 | break; |
120 | case 'default': | 120 | case 'default': |
121 | $resumes = $resumes->orderBy('id')->orderby('updated_at'); | 121 | $resumes = $resumes->orderBy('id')->orderby('updated_at'); |
122 | break; | 122 | break; |
123 | default: | 123 | default: |
124 | $resumes = $resumes->orderBy('id')->orderby('updated_at'); | 124 | $resumes = $resumes->orderBy('id')->orderby('updated_at'); |
125 | break; | 125 | break; |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | $res_count = $resumes->count(); | 129 | $res_count = $resumes->count(); |
130 | //$resumes = $resumes->get(); | 130 | //$resumes = $resumes->get(); |
131 | $resumes = $resumes->paginate(4); | 131 | $resumes = $resumes->paginate(4); |
132 | if ($request->ajax()) { | 132 | if ($request->ajax()) { |
133 | // Условия обставлены | 133 | // Условия обставлены |
134 | if ($request->has('block') && ($request->get('block') == 1)) { | 134 | if ($request->has('block') && ($request->get('block') == 1)) { |
135 | return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); | 135 | return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); |
136 | } | 136 | } |
137 | 137 | ||
138 | if ($request->has('block') && ($request->get('block') == 2)) { | 138 | if ($request->has('block') && ($request->get('block') == 2)) { |
139 | return view('ajax.resume_2', compact('resumes', 'status_work', 'res_count', 'idiot')); | 139 | return view('ajax.resume_2', compact('resumes', 'status_work', 'res_count', 'idiot')); |
140 | } | 140 | } |
141 | } else { | 141 | } else { |
142 | return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title')); | 142 | return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title')); |
143 | } | 143 | } |
144 | } else { | 144 | } else { |
145 | return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); | 145 | return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); |
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | //Лайк резюме | 149 | //Лайк резюме |
150 | public function like_controller() { | 150 | public function like_controller() { |
151 | 151 | ||
152 | } | 152 | } |
153 | 153 | ||
154 | // анкета соискателя | 154 | // анкета соискателя |
155 | public function resume_profile(Worker $worker) | 155 | public function resume_profile(Worker $worker) |
156 | { | 156 | { |
157 | if (isset(Auth()->user()->id)) { | 157 | if (isset(Auth()->user()->id)) { |
158 | $idiot = Auth()->user()->id; | 158 | $idiot = Auth()->user()->id; |
159 | } else { | 159 | } else { |
160 | $idiot = 0; | 160 | $idiot = 0; |
161 | } | 161 | } |
162 | 162 | ||
163 | $status_work = $this->status_work; | 163 | $status_work = $this->status_work; |
164 | $Query = Worker::query()->with('users')->with('job_titles') | 164 | $Query = Worker::query()->with('users')->with('job_titles') |
165 | ->with('place_worker')->with('sertificate')->with('prev_company') | 165 | ->with('place_worker')->with('sertificate')->with('prev_company') |
166 | ->with('infobloks'); | 166 | ->with('infobloks'); |
167 | $Query = $Query->where('id', '=', $worker->id); | 167 | $Query = $Query->where('id', '=', $worker->id); |
168 | $Query = $Query->get(); | 168 | $Query = $Query->get(); |
169 | 169 | ||
170 | $get_date = date('Y.m'); | 170 | $get_date = date('Y.m'); |
171 | $c = Static_worker::query()->where('year_month', '=', $get_date) | 171 | $c = Static_worker::query()->where('year_month', '=', $get_date) |
172 | ->where('user_id', '=', $worker->id) | 172 | ->where('user_id', '=', $worker->id) |
173 | ->get(); | 173 | ->get(); |
174 | 174 | ||
175 | if ($c->count() > 0) { | 175 | if ($c->count() > 0) { |
176 | $upd = Static_worker::find($c[0]->id); | 176 | $upd = Static_worker::find($c[0]->id); |
177 | $upd->lookin = $upd->lookin + 1; | 177 | $upd->lookin = $upd->lookin + 1; |
178 | $upd->save(); | 178 | $upd->save(); |
179 | } else { | 179 | } else { |
180 | $crt = new Static_worker(); | 180 | $crt = new Static_worker(); |
181 | $crt->lookin = 1; | 181 | $crt->lookin = 1; |
182 | $crt->year_month = $get_date; | 182 | $crt->year_month = $get_date; |
183 | $crt->user_id = $worker->user_id; | 183 | $crt->user_id = $worker->user_id; |
184 | $crt->save(); | 184 | $crt->save(); |
185 | } | 185 | } |
186 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 186 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
187 | ->where('user_id', '=', $worker->id) | 187 | ->where('user_id', '=', $worker->id) |
188 | ->get(); | 188 | ->get(); |
189 | return view('worker', compact('Query', 'status_work', 'idiot')); | 189 | return view('worker', compact('Query', 'status_work', 'idiot')); |
190 | } | 190 | } |
191 | 191 | ||
192 | // скачать анкету соискателя | 192 | // скачать анкету соискателя |
193 | public function resume_download(Worker $worker) | 193 | public function resume_download(Worker $worker) |
194 | { | 194 | { |
195 | $status_work = $this->status_work; | 195 | $status_work = $this->status_work; |
196 | $Query = Worker::query()->with('users')->with('job_titles') | 196 | $Query = Worker::query()->with('users')->with('job_titles') |
197 | ->with('place_worker')->with('sertificate')->with('prev_company') | 197 | ->with('place_worker')->with('sertificate')->with('prev_company') |
198 | ->with('infobloks'); | 198 | ->with('infobloks'); |
199 | $Query = $Query->where('id', '=', $worker->id); | 199 | $Query = $Query->where('id', '=', $worker->id); |
200 | $Query = $Query->get()->toArray(); | 200 | $Query = $Query->get()->toArray(); |
201 | 201 | ||
202 | view()->share('Query',$Query); | 202 | view()->share('Query',$Query); |
203 | 203 | ||
204 | 204 | ||
205 | $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape'); | 205 | $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape'); |
206 | 206 | ||
207 | return $pdf->stream(); | 207 | return $pdf->stream(); |
208 | } | 208 | } |
209 | 209 | ||
210 | public function resume_download_all() { | 210 | public function resume_download_all() { |
211 | $status_work = $this->status_work; | 211 | $status_work = $this->status_work; |
212 | $Query = Worker::query()->with('users')->with('job_titles') | 212 | $Query = Worker::query()->with('users')->with('job_titles') |
213 | ->with('place_worker')->with('sertificate')->with('prev_company') | 213 | ->with('place_worker')->with('sertificate')->with('prev_company') |
214 | ->with('infobloks')-> | 214 | ->with('infobloks')-> |
215 | whereHas('users', function (Builder $query) { | 215 | whereHas('users', function (Builder $query) { |
216 | $query->Where('is_worker', '=', '1') | 216 | $query->Where('is_worker', '=', '1') |
217 | ->Where('is_bd', '=', '1'); | 217 | ->Where('is_bd', '=', '1'); |
218 | }); | 218 | }); |
219 | //$Query = $Query->where('id', '=', $worker->id); | 219 | //$Query = $Query->where('id', '=', $worker->id); |
220 | $Query = $Query->get()->toArray(); | 220 | $Query = $Query->get()->toArray(); |
221 | 221 | ||
222 | view()->share('Query',$Query); | 222 | view()->share('Query',$Query); |
223 | 223 | ||
224 | $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape'); | 224 | $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape'); |
225 | 225 | ||
226 | return $pdf->stream(); | 226 | return $pdf->stream(); |
227 | } | 227 | } |
228 | 228 | ||
229 | // Кабинет работника | 229 | // Кабинет работника |
230 | public function cabinet(Request $request) | 230 | public function cabinet(Request $request) |
231 | { | 231 | { |
232 | // дата год и месяц | 232 | // дата год и месяц |
233 | $get_date = date('Y.m'); | 233 | $get_date = date('Y.m'); |
234 | 234 | ||
235 | $id = Auth()->user()->id; | 235 | $id = Auth()->user()->id; |
236 | 236 | ||
237 | $Infobloks = infobloks::query()->get(); | 237 | $Infobloks = infobloks::query()->get(); |
238 | 238 | ||
239 | $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')-> | 239 | $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')-> |
240 | with('infobloks')->with('place_worker')-> | 240 | with('infobloks')->with('place_worker')-> |
241 | WhereHas('users', | 241 | WhereHas('users', |
242 | function (Builder $query) use ($id) {$query->Where('id', $id); | 242 | function (Builder $query) use ($id) {$query->Where('id', $id); |
243 | })->get(); | 243 | })->get(); |
244 | 244 | ||
245 | $Job_titles = Job_title::query()->where('is_remove', '=', '0')-> | 245 | $Job_titles = Job_title::query()->where('is_remove', '=', '0')-> |
246 | where('is_bd', '=' , '1')-> | 246 | where('is_bd', '=' , '1')-> |
247 | OrderBy('name')->get(); | 247 | OrderByDesc('sort')->OrderBy('name')->get(); |
248 | $Infoblocks = infobloks::query()->OrderBy('name')->get(); | 248 | $Infoblocks = infobloks::query()->OrderBy('name')->get(); |
249 | 249 | ||
250 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 250 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
251 | ->where('user_id', '=', $Worker[0]->id) | 251 | ->where('user_id', '=', $Worker[0]->id) |
252 | ->get(); | 252 | ->get(); |
253 | 253 | ||
254 | // 10% | 254 | // 10% |
255 | 255 | ||
256 | $persent = 10; | 256 | $persent = 10; |
257 | $persent1 = 0; | 257 | $persent1 = 0; |
258 | $persent2 = 0; | 258 | $persent2 = 0; |
259 | $persent3 = 0; | 259 | $persent3 = 0; |
260 | $persent4 = 0; | 260 | $persent4 = 0; |
261 | $persent5 = 0; | 261 | $persent5 = 0; |
262 | 262 | ||
263 | if ((!empty($Worker[0]->telephone)) && | 263 | if ((!empty($Worker[0]->telephone)) && |
264 | (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) && | 264 | (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) && |
265 | (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) { | 265 | (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) { |
266 | // 40% | 266 | // 40% |
267 | $persent = $persent + 40; | 267 | $persent = $persent + 40; |
268 | $persent1 = 40; | 268 | $persent1 = 40; |
269 | } | 269 | } |
270 | 270 | ||
271 | //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year); | 271 | //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year); |
272 | 272 | ||
273 | if ($Worker[0]->sertificate->count() > 0) { | 273 | if ($Worker[0]->sertificate->count() > 0) { |
274 | // 15% | 274 | // 15% |
275 | $persent = $persent + 15; | 275 | $persent = $persent + 15; |
276 | $persent2 = 15; | 276 | $persent2 = 15; |
277 | } | 277 | } |
278 | 278 | ||
279 | if ($Worker[0]->infobloks->count() > 0) { | 279 | if ($Worker[0]->infobloks->count() > 0) { |
280 | // 20% | 280 | // 20% |
281 | $persent = $persent + 20; | 281 | $persent = $persent + 20; |
282 | $persent3 = 20; | 282 | $persent3 = 20; |
283 | } | 283 | } |
284 | 284 | ||
285 | if ($Worker[0]->prev_company->count() > 0) { | 285 | if ($Worker[0]->prev_company->count() > 0) { |
286 | // 10% | 286 | // 10% |
287 | $persent = $persent + 10; | 287 | $persent = $persent + 10; |
288 | $persent4 = 10; | 288 | $persent4 = 10; |
289 | } | 289 | } |
290 | 290 | ||
291 | if (!empty($Worker[0]->photo)) { | 291 | if (!empty($Worker[0]->photo)) { |
292 | // 5% | 292 | // 5% |
293 | $persent = $persent + 5; | 293 | $persent = $persent + 5; |
294 | $persent5 = 5; | 294 | $persent5 = 5; |
295 | } | 295 | } |
296 | if ($request->has('print')) { | 296 | if ($request->has('print')) { |
297 | dd($Worker); | 297 | dd($Worker); |
298 | } else { | 298 | } else { |
299 | return view('workers.cabinet', compact('Worker', 'Infobloks', 'persent', 'Job_titles', 'Infoblocks', 'stat')); | 299 | return view('workers.cabinet', compact('Worker', 'Infobloks', 'persent', 'Job_titles', 'Infoblocks', 'stat')); |
300 | } | 300 | } |
301 | } | 301 | } |
302 | 302 | ||
303 | // Сохранение данных | 303 | // Сохранение данных |
304 | public function cabinet_save(Worker $worker, Request $request) | 304 | public function cabinet_save(Worker $worker, Request $request) |
305 | { | 305 | { |
306 | $id = $worker->id; | 306 | $id = $worker->id; |
307 | $params = $request->all(); | 307 | $params = $request->all(); |
308 | 308 | ||
309 | $job_title_id = $request->get('job_title_id'); | 309 | $job_title_id = $request->get('job_title_id'); |
310 | 310 | ||
311 | unset($params['new_diplom']); | 311 | unset($params['new_diplom']); |
312 | unset($params['new_data_begin']); | 312 | unset($params['new_data_begin']); |
313 | unset($params['new_data_end']); | 313 | unset($params['new_data_end']); |
314 | unset($params['new_job_title']); | 314 | unset($params['new_job_title']); |
315 | unset($params['new_teplohod']); | 315 | unset($params['new_teplohod']); |
316 | unset($params['new_GWT']); | 316 | unset($params['new_GWT']); |
317 | unset($params['new_KBT']); | 317 | unset($params['new_KBT']); |
318 | unset($params['new_Begin_work']); | 318 | unset($params['new_Begin_work']); |
319 | unset($params['new_End_work']); | 319 | unset($params['new_End_work']); |
320 | unset($params['new_name_company']); | 320 | unset($params['new_name_company']); |
321 | 321 | ||
322 | $rules = [ | 322 | $rules = [ |
323 | 'surname' => ['required', 'string', 'max:255'], | 323 | 'surname' => ['required', 'string', 'max:255'], |
324 | 'name_man' => ['required', 'string', 'max:255'], | 324 | 'name_man' => ['required', 'string', 'max:255'], |
325 | 'email' => ['required', 'string', 'email', 'max:255'], | 325 | 'email' => ['required', 'string', 'email', 'max:255'], |
326 | 326 | ||
327 | ]; | 327 | ]; |
328 | 328 | ||
329 | $messages = [ | 329 | $messages = [ |
330 | 'required' => 'Укажите обязательное поле', | 330 | 'required' => 'Укажите обязательное поле', |
331 | 'min' => [ | 331 | 'min' => [ |
332 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 332 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
333 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 333 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
334 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 334 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
335 | ], | 335 | ], |
336 | 'max' => [ | 336 | 'max' => [ |
337 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 337 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
338 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 338 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
339 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 339 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
340 | ] | 340 | ] |
341 | ]; | 341 | ]; |
342 | 342 | ||
343 | $validator = Validator::make($params, $rules, $messages); | 343 | $validator = Validator::make($params, $rules, $messages); |
344 | 344 | ||
345 | if ($validator->fails()) { | 345 | if ($validator->fails()) { |
346 | return redirect()->route('worker.cabinet')->withErrors($validator); | 346 | return redirect()->route('worker.cabinet')->withErrors($validator); |
347 | } else { | 347 | } else { |
348 | 348 | ||
349 | if ($request->has('photo')) { | 349 | if ($request->has('photo')) { |
350 | if (!empty($Worker->photo)) { | 350 | if (!empty($Worker->photo)) { |
351 | Storage::delete($Worker->photo); | 351 | Storage::delete($Worker->photo); |
352 | } | 352 | } |
353 | $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); | 353 | $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); |
354 | } | 354 | } |
355 | 355 | ||
356 | if ($request->has('file')) { | 356 | if ($request->has('file')) { |
357 | if (!empty($Worker->file)) { | 357 | if (!empty($Worker->file)) { |
358 | Storage::delete($Worker->file); | 358 | Storage::delete($Worker->file); |
359 | } | 359 | } |
360 | $params['file'] = $request->file('file')->store("worker/$id", 'public'); | 360 | $params['file'] = $request->file('file')->store("worker/$id", 'public'); |
361 | } | 361 | } |
362 | 362 | ||
363 | $id_wor = $worker->update($params); | 363 | $id_wor = $worker->update($params); |
364 | $use = User::find($worker->user_id); | 364 | $use = User::find($worker->user_id); |
365 | $use->surname = $request->get('surname'); | 365 | $use->surname = $request->get('surname'); |
366 | $use->name_man = $request->get('name_man'); | 366 | $use->name_man = $request->get('name_man'); |
367 | $use->surname2 = $request->get('surname2'); | 367 | $use->surname2 = $request->get('surname2'); |
368 | 368 | ||
369 | $use->save(); | 369 | $use->save(); |
370 | $worker->job_titles()->sync($job_title_id); | 370 | $worker->job_titles()->sync($job_title_id); |
371 | 371 | ||
372 | return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); | 372 | return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); |
373 | } | 373 | } |
374 | } | 374 | } |
375 | 375 | ||
376 | // Сообщения данные | 376 | // Сообщения данные |
377 | public function messages($type_message) | 377 | public function messages($type_message) |
378 | { | 378 | { |
379 | $user_id = Auth()->user()->id; | 379 | $user_id = Auth()->user()->id; |
380 | 380 | ||
381 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> | 381 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> |
382 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); | 382 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); |
383 | 383 | ||
384 | $messages_output = Message::query()->with('vacancies')-> | 384 | $messages_output = Message::query()->with('vacancies')-> |
385 | with('user_to')->where('user_id', $user_id)-> | 385 | with('user_to')->where('user_id', $user_id)-> |
386 | OrderByDesc('created_at'); | 386 | OrderByDesc('created_at'); |
387 | 387 | ||
388 | 388 | ||
389 | $count_input = $messages_input->count(); | 389 | $count_input = $messages_input->count(); |
390 | $count_output = $messages_output->count(); | 390 | $count_output = $messages_output->count(); |
391 | 391 | ||
392 | if ($type_message == 'input') { | 392 | if ($type_message == 'input') { |
393 | $messages = $messages_input->paginate(5); | 393 | $messages = $messages_input->paginate(5); |
394 | } | 394 | } |
395 | 395 | ||
396 | if ($type_message == 'output') { | 396 | if ($type_message == 'output') { |
397 | $messages = $messages_output->paginate(5); | 397 | $messages = $messages_output->paginate(5); |
398 | } | 398 | } |
399 | 399 | ||
400 | // Вернуть все 100% | 400 | // Вернуть все 100% |
401 | return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); | 401 | return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); |
402 | } | 402 | } |
403 | 403 | ||
404 | // Избранный | 404 | // Избранный |
405 | public function favorite() | 405 | public function favorite() |
406 | { | 406 | { |
407 | return view('workers.favorite'); | 407 | return view('workers.favorite'); |
408 | } | 408 | } |
409 | 409 | ||
410 | // Сменить пароль | 410 | // Сменить пароль |
411 | public function new_password() | 411 | public function new_password() |
412 | { | 412 | { |
413 | $email = Auth()->user()->email; | 413 | $email = Auth()->user()->email; |
414 | return view('workers.new_password', compact('email')); | 414 | return view('workers.new_password', compact('email')); |
415 | } | 415 | } |
416 | 416 | ||
417 | // Обновление пароля | 417 | // Обновление пароля |
418 | public function save_new_password(Request $request) { | 418 | public function save_new_password(Request $request) { |
419 | $use = Auth()->user(); | 419 | $use = Auth()->user(); |
420 | $request->validate([ | 420 | $request->validate([ |
421 | 'password' => 'required|string', | 421 | 'password' => 'required|string', |
422 | 'new_password' => 'required|string', | 422 | 'new_password' => 'required|string', |
423 | 'new_password2' => 'required|string' | 423 | 'new_password2' => 'required|string' |
424 | ]); | 424 | ]); |
425 | 425 | ||
426 | if ($request->get('new_password') == $request->get('new_password2')) | 426 | if ($request->get('new_password') == $request->get('new_password2')) |
427 | if ($request->get('password') !== $request->get('new_password')) { | 427 | if ($request->get('password') !== $request->get('new_password')) { |
428 | $credentials = $request->only('email', 'password'); | 428 | $credentials = $request->only('email', 'password'); |
429 | if (Auth::attempt($credentials, $request->has('save_me'))) { | 429 | if (Auth::attempt($credentials, $request->has('save_me'))) { |
430 | 430 | ||
431 | if (!is_null($use->email_verified_at)){ | 431 | if (!is_null($use->email_verified_at)){ |
432 | 432 | ||
433 | $user_data = User_Model::find($use->id); | 433 | $user_data = User_Model::find($use->id); |
434 | $user_data->update([ | 434 | $user_data->update([ |
435 | 'password' => Hash::make($request->get('new_password')), | 435 | 'password' => Hash::make($request->get('new_password')), |
436 | 'pubpassword' => base64_encode($request->get('new_password')), | 436 | 'pubpassword' => base64_encode($request->get('new_password')), |
437 | ]); | 437 | ]); |
438 | return redirect() | 438 | return redirect() |
439 | ->route('worker.new_password') | 439 | ->route('worker.new_password') |
440 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 440 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
441 | } | 441 | } |
442 | 442 | ||
443 | return redirect() | 443 | return redirect() |
444 | ->route('worker.new_password') | 444 | ->route('worker.new_password') |
445 | ->withError('Данная учетная запись не было верифицированна!'); | 445 | ->withError('Данная учетная запись не было верифицированна!'); |
446 | } | 446 | } |
447 | } | 447 | } |
448 | 448 | ||
449 | return redirect() | 449 | return redirect() |
450 | ->route('worker.new_password') | 450 | ->route('worker.new_password') |
451 | ->withErrors('Не совпадение данных, обновите пароли!'); | 451 | ->withErrors('Не совпадение данных, обновите пароли!'); |
452 | } | 452 | } |
453 | 453 | ||
454 | // Удаление профиля форма | 454 | // Удаление профиля форма |
455 | public function delete_profile() | 455 | public function delete_profile() |
456 | { | 456 | { |
457 | $login = Auth()->user()->email; | 457 | $login = Auth()->user()->email; |
458 | return view('workers.delete_profile', compact('login')); | 458 | return view('workers.delete_profile', compact('login')); |
459 | } | 459 | } |
460 | 460 | ||
461 | // Удаление профиля код | 461 | // Удаление профиля код |
462 | public function delete_profile_result(Request $request) { | 462 | public function delete_profile_result(Request $request) { |
463 | $Answer = $request->all(); | 463 | $Answer = $request->all(); |
464 | $user_id = Auth()->user()->id; | 464 | $user_id = Auth()->user()->id; |
465 | $request->validate([ | 465 | $request->validate([ |
466 | 'password' => 'required|string', | 466 | 'password' => 'required|string', |
467 | ]); | 467 | ]); |
468 | 468 | ||
469 | $credentials = $request->only('email', 'password'); | 469 | $credentials = $request->only('email', 'password'); |
470 | if (Auth::attempt($credentials)) { | 470 | if (Auth::attempt($credentials)) { |
471 | Auth::logout(); | 471 | Auth::logout(); |
472 | $it = User_Model::find($user_id); | 472 | $it = User_Model::find($user_id); |
473 | $it->delete(); | 473 | $it->delete(); |
474 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 474 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
475 | } else { | 475 | } else { |
476 | return redirect()->route('worker.delete_profile') | 476 | return redirect()->route('worker.delete_profile') |
477 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 477 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
478 | } | 478 | } |
479 | } | 479 | } |
480 | 480 | ||
481 | // Регистрация соискателя | 481 | // Регистрация соискателя |
482 | public function register_worker(Request $request) | 482 | public function register_worker(Request $request) |
483 | { | 483 | { |
484 | $params = $request->all(); | 484 | $params = $request->all(); |
485 | $params['is_worker'] = 1; | 485 | $params['is_worker'] = 1; |
486 | 486 | ||
487 | $rules = [ | 487 | $rules = [ |
488 | 'surname' => ['required', 'string', 'max:255'], | 488 | 'surname' => ['required', 'string', 'max:255'], |
489 | 'name_man' => ['required', 'string', 'max:255'], | 489 | 'name_man' => ['required', 'string', 'max:255'], |
490 | 'email' => ['required', 'email', 'max:255', 'unique:users'], | 490 | 'email' => ['required', 'email', 'max:255', 'unique:users'], |
491 | 'password' => ['required', 'string', 'min:6'] | 491 | 'password' => ['required', 'string', 'min:6'] |
492 | ]; | 492 | ]; |
493 | 493 | ||
494 | $messages = [ | 494 | $messages = [ |
495 | 'required' => 'Укажите обязательное поле', | 495 | 'required' => 'Укажите обязательное поле', |
496 | 'min' => [ | 496 | 'min' => [ |
497 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 497 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
498 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 498 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
499 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 499 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
500 | ], | 500 | ], |
501 | 'max' => [ | 501 | 'max' => [ |
502 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 502 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
503 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 503 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
504 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 504 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
505 | ] | 505 | ] |
506 | ]; | 506 | ]; |
507 | 507 | ||
508 | $email = $request->get('email'); | 508 | $email = $request->get('email'); |
509 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | 509 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { |
510 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | 510 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); |
511 | } | 511 | } |
512 | 512 | ||
513 | if ($request->get('password') !== $request->get('confirmed')){ | 513 | if ($request->get('password') !== $request->get('confirmed')){ |
514 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | 514 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); |
515 | } | 515 | } |
516 | 516 | ||
517 | if (strlen($request->get('password')) < 6) { | 517 | if (strlen($request->get('password')) < 6) { |
518 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | 518 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); |
519 | } | 519 | } |
520 | 520 | ||
521 | /*$haystack = $request->get('password'); | 521 | /*$haystack = $request->get('password'); |
522 | 522 | ||
523 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); | 523 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); |
524 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', | 524 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', |
525 | 'X', 'C', 'V', 'B', 'N', 'M'); | 525 | 'X', 'C', 'V', 'B', 'N', 'M'); |
526 | $lenpwd_bool = true; | 526 | $lenpwd_bool = true; |
527 | $spec_bool = false; | 527 | $spec_bool = false; |
528 | $alpha_bool = false; | 528 | $alpha_bool = false; |
529 | 529 | ||
530 | if (strlen($haystack) < 8) $lenpwd_bool = false; | 530 | if (strlen($haystack) < 8) $lenpwd_bool = false; |
531 | 531 | ||
532 | foreach ($specsumbol as $it) { | 532 | foreach ($specsumbol as $it) { |
533 | if (strpos($haystack, $it) !== false) { | 533 | if (strpos($haystack, $it) !== false) { |
534 | $spec_bool = true; | 534 | $spec_bool = true; |
535 | } | 535 | } |
536 | } | 536 | } |
537 | 537 | ||
538 | foreach ($alpha as $it) { | 538 | foreach ($alpha as $it) { |
539 | if (strpos($haystack, $it) !== false) { | 539 | if (strpos($haystack, $it) !== false) { |
540 | $alpha_bool = true; | 540 | $alpha_bool = true; |
541 | } | 541 | } |
542 | } | 542 | } |
543 | 543 | ||
544 | if ((!$spec_bool) || (!$alpha_bool)) { | 544 | if ((!$spec_bool) || (!$alpha_bool)) { |
545 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); | 545 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); |
546 | }*/ | 546 | }*/ |
547 | 547 | ||
548 | if (($request->has('politik')) && ($request->get('politik') == 1)) { | 548 | if (($request->has('politik')) && ($request->get('politik') == 1)) { |
549 | $validator = Validator::make($params, $rules, $messages); | 549 | $validator = Validator::make($params, $rules, $messages); |
550 | 550 | ||
551 | if ($validator->fails()) { | 551 | if ($validator->fails()) { |
552 | return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | 552 | return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); |
553 | } else { | 553 | } else { |
554 | //dd($params); | 554 | //dd($params); |
555 | $user = $this->create($params); | 555 | $user = $this->create($params); |
556 | event(new Registered($user)); | 556 | event(new Registered($user)); |
557 | Auth::guard()->login($user); | 557 | Auth::guard()->login($user); |
558 | } | 558 | } |
559 | if ($user) { | 559 | if ($user) { |
560 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; | 560 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; |
561 | } else { | 561 | } else { |
562 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | 562 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); |
563 | } | 563 | } |
564 | 564 | ||
565 | } else { | 565 | } else { |
566 | return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); | 566 | return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); |
567 | } | 567 | } |
568 | } | 568 | } |
569 | 569 | ||
570 | // Звездная оценка и ответ | 570 | // Звездная оценка и ответ |
571 | public function stars_answer(Request $request) { | 571 | public function stars_answer(Request $request) { |
572 | $params = $request->all(); | 572 | $params = $request->all(); |
573 | $rules = [ | 573 | $rules = [ |
574 | 'message' => ['required', 'string', 'max:255'], | 574 | 'message' => ['required', 'string', 'max:255'], |
575 | ]; | 575 | ]; |
576 | 576 | ||
577 | $messages = [ | 577 | $messages = [ |
578 | 'required' => 'Укажите обязательное поле', | 578 | 'required' => 'Укажите обязательное поле', |
579 | 'min' => [ | 579 | 'min' => [ |
580 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 580 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
581 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 581 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
582 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 582 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
583 | ], | 583 | ], |
584 | 'max' => [ | 584 | 'max' => [ |
585 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 585 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
586 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 586 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
587 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 587 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
588 | ] | 588 | ] |
589 | ]; | 589 | ]; |
590 | $response_worker = ResponseWork::create($params); | 590 | $response_worker = ResponseWork::create($params); |
591 | return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); | 591 | return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); |
592 | } | 592 | } |
593 | 593 | ||
594 | public function TestWorker() | 594 | public function TestWorker() |
595 | { | 595 | { |
596 | $Use = new User(); | 596 | $Use = new User(); |
597 | 597 | ||
598 | $Code_user = $Use->create([ | 598 | $Code_user = $Use->create([ |
599 | 'name' => 'surname name_man', | 599 | 'name' => 'surname name_man', |
600 | 'name_man' => 'name_man', | 600 | 'name_man' => 'name_man', |
601 | 'surname' => 'surname', | 601 | 'surname' => 'surname', |
602 | 'surname2' => 'surname2', | 602 | 'surname2' => 'surname2', |
603 | 'subscribe_email' => '1', | 603 | 'subscribe_email' => '1', |
604 | 'email' => 'email@mail.com', | 604 | 'email' => 'email@mail.com', |
605 | 'telephone' => '1234567890', | 605 | 'telephone' => '1234567890', |
606 | 'password' => Hash::make('password'), | 606 | 'password' => Hash::make('password'), |
607 | 'pubpassword' => base64_encode('password'), | 607 | 'pubpassword' => base64_encode('password'), |
608 | 'email_verified_at' => Carbon::now(), | 608 | 'email_verified_at' => Carbon::now(), |
609 | 'is_worker' => 1, | 609 | 'is_worker' => 1, |
610 | ]); | 610 | ]); |
611 | 611 | ||
612 | if ($Code_user->id > 0) { | 612 | if ($Code_user->id > 0) { |
613 | $Worker = new Worker(); | 613 | $Worker = new Worker(); |
614 | $Worker->user_id = $Code_user->id; | 614 | $Worker->user_id = $Code_user->id; |
615 | $Worker->position_work = 1; //'job_titles'; | 615 | $Worker->position_work = 1; //'job_titles'; |
616 | $Worker->email = 'email@email.com'; | 616 | $Worker->email = 'email@email.com'; |
617 | $Worker->telephone = '1234567890'; | 617 | $Worker->telephone = '1234567890'; |
618 | $status = $Worker->save(); | 618 | $status = $Worker->save(); |
619 | 619 | ||
620 | $Title_Worker = new Title_worker(); | 620 | $Title_Worker = new Title_worker(); |
621 | $Title_Worker->worker_id = $Worker->id; | 621 | $Title_Worker->worker_id = $Worker->id; |
622 | $Title_Worker->job_title_id = 1; | 622 | $Title_Worker->job_title_id = 1; |
623 | $Title_Worker->save(); | 623 | $Title_Worker->save(); |
624 | } | 624 | } |
625 | } | 625 | } |
626 | 626 | ||
627 | // Создание пользователя | 627 | // Создание пользователя |
628 | protected function create(array $data) | 628 | protected function create(array $data) |
629 | { | 629 | { |
630 | $Use = new User(); | 630 | $Use = new User(); |
631 | 631 | ||
632 | $Code_user = $Use->create([ | 632 | $Code_user = $Use->create([ |
633 | 'name' => $data['surname']." ".$data['name_man'], | 633 | 'name' => $data['surname']." ".$data['name_man'], |
634 | 'name_man' => $data['name_man'], | 634 | 'name_man' => $data['name_man'], |
635 | 'surname' => $data['surname'], | 635 | 'surname' => $data['surname'], |
636 | 'surname2' => $data['surname2'], | 636 | 'surname2' => $data['surname2'], |
637 | 'subscribe_email' => $data['email'], | 637 | 'subscribe_email' => $data['email'], |
638 | 'email' => $data['email'], | 638 | 'email' => $data['email'], |
639 | 'telephone' => $data['telephone'], | 639 | 'telephone' => $data['telephone'], |
640 | 'password' => Hash::make($data['password']), | 640 | 'password' => Hash::make($data['password']), |
641 | 'pubpassword' => base64_encode($data['password']), | 641 | 'pubpassword' => base64_encode($data['password']), |
642 | 'email_verified_at' => Carbon::now(), | 642 | 'email_verified_at' => Carbon::now(), |
643 | 'is_worker' => $data['is_worker'], | 643 | 'is_worker' => $data['is_worker'], |
644 | ]); | 644 | ]); |
645 | 645 | ||
646 | if ($Code_user->id > 0) { | 646 | if ($Code_user->id > 0) { |
647 | $Worker = new Worker(); | 647 | $Worker = new Worker(); |
648 | $Worker->user_id = $Code_user->id; | 648 | $Worker->user_id = $Code_user->id; |
649 | $Worker->position_work = $data['job_titles']; | 649 | $Worker->position_work = $data['job_titles']; |
650 | $Worker->email = $data['email']; | 650 | $Worker->email = $data['email']; |
651 | $Worker->telephone = $data['telephone']; | 651 | $Worker->telephone = $data['telephone']; |
652 | $Worker->save(); | 652 | $Worker->save(); |
653 | 653 | ||
654 | if (isset($Worker->id)) { | 654 | if (isset($Worker->id)) { |
655 | $Title_Worker = new Title_worker(); | 655 | $Title_Worker = new Title_worker(); |
656 | $Title_Worker->worker_id = $Worker->id; | 656 | $Title_Worker->worker_id = $Worker->id; |
657 | $Title_Worker->job_title_id = $data['job_titles']; | 657 | $Title_Worker->job_title_id = $data['job_titles']; |
658 | $Title_Worker->save(); | 658 | $Title_Worker->save(); |
659 | } | 659 | } |
660 | 660 | ||
661 | return $Code_user; | 661 | return $Code_user; |
662 | } | 662 | } |
663 | } | 663 | } |
664 | 664 | ||
665 | // Вакансии избранные | 665 | // Вакансии избранные |
666 | public function colorado(Request $request) { | 666 | public function colorado(Request $request) { |
667 | $IP_address = RusDate::ip_addr_client(); | 667 | $IP_address = RusDate::ip_addr_client(); |
668 | $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); | 668 | $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); |
669 | 669 | ||
670 | if ($Arr->count()) { | 670 | if ($Arr->count()) { |
671 | $A = Array(); | 671 | $A = Array(); |
672 | foreach ($Arr as $it) { | 672 | foreach ($Arr as $it) { |
673 | $A[] = $it->code_record; | 673 | $A[] = $it->code_record; |
674 | } | 674 | } |
675 | 675 | ||
676 | $Query = Ad_employer::query()->whereIn('id', $A); | 676 | $Query = Ad_employer::query()->whereIn('id', $A); |
677 | } else { | 677 | } else { |
678 | $Query = Ad_employer::query()->where('id', '=', '0'); | 678 | $Query = Ad_employer::query()->where('id', '=', '0'); |
679 | } | 679 | } |
680 | 680 | ||
681 | $Query = $Query->with('jobs')-> | 681 | $Query = $Query->with('jobs')-> |
682 | with('cat')-> | 682 | with('cat')-> |
683 | with('employer')-> | 683 | with('employer')-> |
684 | whereHas('jobs_code', function ($query) use ($request) { | 684 | whereHas('jobs_code', function ($query) use ($request) { |
685 | if ($request->ajax()) { | 685 | if ($request->ajax()) { |
686 | if (null !== ($request->get('job'))) { | 686 | if (null !== ($request->get('job'))) { |
687 | $query->where('job_title_id', $request->get('job')); | 687 | $query->where('job_title_id', $request->get('job')); |
688 | } | 688 | } |
689 | } | 689 | } |
690 | })->select('ad_employers.*'); | 690 | })->select('ad_employers.*'); |
691 | 691 | ||
692 | $Job_title = Job_title::query()->OrderBy('name')->get(); | 692 | $Job_title = Job_title::query()->OrderBy('name')->get(); |
693 | 693 | ||
694 | $Query_count = $Query->count(); | 694 | $Query_count = $Query->count(); |
695 | 695 | ||
696 | $Query = $Query->OrderBy('updated_at')->paginate(3); | 696 | $Query = $Query->OrderBy('updated_at')->paginate(3); |
697 | 697 | ||
698 | 698 | ||
699 | return view('workers.favorite', compact('Query', | 699 | return view('workers.favorite', compact('Query', |
700 | 'Query_count', | 700 | 'Query_count', |
701 | 'Job_title')); | 701 | 'Job_title')); |
702 | 702 | ||
703 | } | 703 | } |
704 | 704 | ||
705 | //Переписка | 705 | //Переписка |
706 | public function dialog(User_Model $user1, User_Model $user2) { | 706 | public function dialog(User_Model $user1, User_Model $user2) { |
707 | if (isset($user2->id)) { | 707 | if (isset($user2->id)) { |
708 | $companion = User_Model::query()->with('workers')-> | 708 | $companion = User_Model::query()->with('workers')-> |
709 | with('employers')-> | 709 | with('employers')-> |
710 | where('id', $user2->id)->first(); | 710 | where('id', $user2->id)->first(); |
711 | } | 711 | } |
712 | 712 | ||
713 | $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) { | 713 | $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) { |
714 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); | 714 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); |
715 | })->orWhere(function($query) use ($user1, $user2) { | 715 | })->orWhere(function($query) use ($user1, $user2) { |
716 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); | 716 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); |
717 | })->OrderBy('created_at')->get(); | 717 | })->OrderBy('created_at')->get(); |
718 | 718 | ||
719 | $id_vac = null; | 719 | $id_vac = null; |
720 | foreach ($Messages as $it) { | 720 | foreach ($Messages as $it) { |
721 | if (isset($it->response)) { | 721 | if (isset($it->response)) { |
722 | foreach ($it->response as $r) { | 722 | foreach ($it->response as $r) { |
723 | if (isset($r->ad_employer_id)) { | 723 | if (isset($r->ad_employer_id)) { |
724 | $id_vac = $r->ad_employer_id; | 724 | $id_vac = $r->ad_employer_id; |
725 | break; | 725 | break; |
726 | } | 726 | } |
727 | } | 727 | } |
728 | } | 728 | } |
729 | if (!is_null($id_vac)) break; | 729 | if (!is_null($id_vac)) break; |
730 | } | 730 | } |
731 | 731 | ||
732 | $ad_employer = null; | 732 | $ad_employer = null; |
733 | if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); | 733 | if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); |
734 | $sender = $user1; | 734 | $sender = $user1; |
735 | 735 | ||
736 | return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); | 736 | return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); |
737 | } | 737 | } |
738 | 738 | ||
739 | // Даунылоады | 739 | // Даунылоады |
740 | public function download(Worker $worker) { | 740 | public function download(Worker $worker) { |
741 | $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; | 741 | $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; |
742 | view()->share('house',$arr_house); | 742 | view()->share('house',$arr_house); |
743 | $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); | 743 | $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); |
744 | return $pdf->stream(); | 744 | return $pdf->stream(); |
745 | } | 745 | } |
746 | 746 | ||
747 | // Поднятие анкеты | 747 | // Поднятие анкеты |
748 | public function up(Worker $worker) { | 748 | public function up(Worker $worker) { |
749 | $worker->updated_at = Carbon::now(); | 749 | $worker->updated_at = Carbon::now(); |
750 | $worker->save(); | 750 | $worker->save(); |
751 | // 0 | 751 | // 0 |
752 | return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); | 752 | return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); |
753 | } | 753 | } |
754 | 754 | ||
755 | // Форма сертификате | 755 | // Форма сертификате |
756 | public function new_sertificate(Worker $worker) { | 756 | public function new_sertificate(Worker $worker) { |
757 | return view('workers.sertificate_add', compact('worker')); | 757 | return view('workers.sertificate_add', compact('worker')); |
758 | } | 758 | } |
759 | 759 | ||
760 | // Добавление сертификата | 760 | // Добавление сертификата |
761 | public function add_serificate(SertificationRequest $request) { | 761 | public function add_serificate(SertificationRequest $request) { |
762 | $params = $request->all(); | 762 | $params = $request->all(); |
763 | 763 | ||
764 | $Sertificate = new sertification(); | 764 | $Sertificate = new sertification(); |
765 | $Sertificate->create($params); | 765 | $Sertificate->create($params); |
766 | $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get(); | 766 | $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get(); |
767 | return redirect()->route('worker.cabinet'); | 767 | return redirect()->route('worker.cabinet'); |
768 | //return view('ajax.documents', compact('Docs')); | 768 | //return view('ajax.documents', compact('Docs')); |
769 | } | 769 | } |
770 | 770 | ||
771 | // Удалить сертификат | 771 | // Удалить сертификат |
772 | public function delete_sertificate(sertification $doc) { | 772 | public function delete_sertificate(sertification $doc) { |
773 | $doc->delete(); | 773 | $doc->delete(); |
774 | 774 | ||
775 | return redirect()->route('worker.cabinet'); | 775 | return redirect()->route('worker.cabinet'); |
776 | } | 776 | } |
777 | 777 | ||
778 | // Редактирование сертификата | 778 | // Редактирование сертификата |
779 | public function edit_sertificate(Worker $worker, sertification $doc) { | 779 | public function edit_sertificate(Worker $worker, sertification $doc) { |
780 | return view('workers.sertificate_edit', compact('doc', 'worker')); | 780 | return view('workers.sertificate_edit', compact('doc', 'worker')); |
781 | } | 781 | } |
782 | 782 | ||
783 | // Редактирование обновление сертификата | 783 | // Редактирование обновление сертификата |
784 | public function update_serificate(SertificationRequest $request, sertification $doc) { | 784 | public function update_serificate(SertificationRequest $request, sertification $doc) { |
785 | $all = $request->all(); | 785 | $all = $request->all(); |
786 | $doc->worker_id = $all['worker_id']; | 786 | $doc->worker_id = $all['worker_id']; |
787 | $doc->name = $all['name']; | 787 | $doc->name = $all['name']; |
788 | $doc->end_begin = $all['end_begin']; | 788 | $doc->end_begin = $all['end_begin']; |
789 | $doc->save(); | 789 | $doc->save(); |
790 | 790 | ||
791 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); | 791 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); |
792 | } | 792 | } |
793 | 793 | ||
794 | public function delete_add_diplom(Request $request, Worker $worker) { | 794 | public function delete_add_diplom(Request $request, Worker $worker) { |
795 | $infoblok_id = $request->get('infoblok_id'); | 795 | $infoblok_id = $request->get('infoblok_id'); |
796 | 796 | ||
797 | if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) | 797 | if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) |
798 | $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); | 798 | $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); |
799 | else { | 799 | else { |
800 | $params['infoblok_id'] = $infoblok_id; | 800 | $params['infoblok_id'] = $infoblok_id; |
801 | $params['worker_id'] = $worker->id; | 801 | $params['worker_id'] = $worker->id; |
802 | $params['status'] = $request->get('val'); | 802 | $params['status'] = $request->get('val'); |
803 | $id = Dop_info::create($params); | 803 | $id = Dop_info::create($params); |
804 | //$id = $worker->infobloks()->sync([$infoblok_id]); | 804 | //$id = $worker->infobloks()->sync([$infoblok_id]); |
805 | } | 805 | } |
806 | 806 | ||
807 | //$Infoblocks = infobloks::query()->get(); | 807 | //$Infoblocks = infobloks::query()->get(); |
808 | return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); | 808 | return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); |
809 | } | 809 | } |
810 | 810 | ||
811 | 811 | ||
812 | 812 | ||
813 | // Добавление диплома | 813 | // Добавление диплома |
814 | public function add_diplom_ajax(Request $request) { | 814 | public function add_diplom_ajax(Request $request) { |
815 | // конец | 815 | // конец |
816 | $params = $request->all(); | 816 | $params = $request->all(); |
817 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); | 817 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); |
818 | 818 | ||
819 | if ($count == 0) $dop_info = Dop_info::create($params); | 819 | if ($count == 0) $dop_info = Dop_info::create($params); |
820 | $Infoblocks = infobloks::query()->get(); | 820 | $Infoblocks = infobloks::query()->get(); |
821 | $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); | 821 | $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); |
822 | $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); | 822 | $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); |
823 | return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); | 823 | return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); |
824 | } | 824 | } |
825 | 825 | ||
826 | // Добавление диплома без ajax | 826 | // Добавление диплома без ajax |
827 | public function add_diplom(Worker $worker) { | 827 | public function add_diplom(Worker $worker) { |
828 | $worker_id = $worker->id; | 828 | $worker_id = $worker->id; |
829 | $Infoblocks = infobloks::query()->get(); | 829 | $Infoblocks = infobloks::query()->get(); |
830 | return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); | 830 | return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); |
831 | } | 831 | } |
832 | // Сохранить | 832 | // Сохранить |
833 | // Сохраняю диплом | 833 | // Сохраняю диплом |
834 | public function add_diplom_save(Request $request) { | 834 | public function add_diplom_save(Request $request) { |
835 | $params = $request->all(); | 835 | $params = $request->all(); |
836 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); | 836 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); |
837 | if ($count == 0) $dop_info = Dop_info::create($params); | 837 | if ($count == 0) $dop_info = Dop_info::create($params); |
838 | return redirect()->route('worker.cabinet'); | 838 | return redirect()->route('worker.cabinet'); |
839 | } | 839 | } |
840 | 840 | ||
841 | // Добавление стандартного документа | 841 | // Добавление стандартного документа |
842 | public function add_document(Worker $worker) { | 842 | public function add_document(Worker $worker) { |
843 | return view('workers.docs', compact('worker')); | 843 | return view('workers.docs', compact('worker')); |
844 | } | 844 | } |
845 | 845 | ||
846 | //Сохранение стандартого документа | 846 | //Сохранение стандартого документа |
847 | public function add_document_save(DocumentsRequest $request) { | 847 | public function add_document_save(DocumentsRequest $request) { |
848 | $params = $request->all(); | 848 | $params = $request->all(); |
849 | $place_work = place_works::create($params); | 849 | $place_work = place_works::create($params); |
850 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!'); | 850 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!'); |
851 | } | 851 | } |
852 | 852 | ||
853 | // Редактирование документа | 853 | // Редактирование документа |
854 | public function edit_document(place_works $doc, Worker $worker) { | 854 | public function edit_document(place_works $doc, Worker $worker) { |
855 | return view('workers.docs-edit', compact('doc', 'worker')); | 855 | return view('workers.docs-edit', compact('doc', 'worker')); |
856 | } | 856 | } |
857 | 857 | ||
858 | //Сохранение отредактированного документа | 858 | //Сохранение отредактированного документа |
859 | public function edit_document_save(DocumentsRequest $request, place_works $doc) { | 859 | public function edit_document_save(DocumentsRequest $request, place_works $doc) { |
860 | $params = $request->all(); | 860 | $params = $request->all(); |
861 | $doc->update($params); | 861 | $doc->update($params); |
862 | 862 | ||
863 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); | 863 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); |
864 | } | 864 | } |
865 | 865 | ||
866 | // Удаление документа | 866 | // Удаление документа |
867 | public function delete_document(place_works $doc) { | 867 | public function delete_document(place_works $doc) { |
868 | $doc->delete(); | 868 | $doc->delete(); |
869 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); | 869 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); |
870 | } | 870 | } |
871 | 871 | ||
872 | //Отправка нового сообщения | 872 | //Отправка нового сообщения |
873 | public function new_message(Request $request) { | 873 | public function new_message(Request $request) { |
874 | $params = $request->all(); | 874 | $params = $request->all(); |
875 | 875 | ||
876 | $id = $params['send_user_id']; | 876 | $id = $params['send_user_id']; |
877 | $message = new Message(); | 877 | $message = new Message(); |
878 | $message->user_id = $params['send_user_id']; | 878 | $message->user_id = $params['send_user_id']; |
879 | $message->to_user_id = $params['send_to_user_id']; | 879 | $message->to_user_id = $params['send_to_user_id']; |
880 | $message->title = $params['send_title']; | 880 | $message->title = $params['send_title']; |
881 | $message->text = $params['send_text']; | 881 | $message->text = $params['send_text']; |
882 | $message->ad_employer_id = $params['send_vacancy']; | ||
882 | if ($request->has('send_file')) { | 883 | if ($request->has('send_file')) { |
883 | $message->file = $request->file('send_file')->store("worker/$id", 'public'); | 884 | $message->file = $request->file('send_file')->store("worker/$id", 'public'); |
884 | } | 885 | } |
885 | $message->flag_new = 1; | 886 | $message->flag_new = 1; |
886 | $id_message = $message->save(); | 887 | $id_message = $message->save(); |
887 | 888 | ||
888 | $data['message_id'] = $id_message; | 889 | $data['message_id'] = $id_message; |
889 | $data['ad_employer_id'] = $params['send_vacancy']; | 890 | $data['ad_employer_id'] = $params['send_vacancy']; |
890 | $data['job_title_id'] = $params['send_job_title_id']; | 891 | $data['job_title_id'] = $params['send_job_title_id']; |
891 | $data['flag'] = 1; | 892 | $data['flag'] = 1; |
892 | $ad_responce = ad_response::create($data); | 893 | $ad_responce = ad_response::create($data); |
893 | return redirect()->route('worker.messages', ['type_message' => 'output']); | 894 | return redirect()->route('worker.messages', ['type_message' => 'output']); |
894 | } | 895 | } |
895 | 896 | ||
896 | // Информация о предыдущих компаниях | 897 | // Информация о предыдущих компаниях |
897 | public function new_prev_company(Worker $worker) { | 898 | public function new_prev_company(Worker $worker) { |
898 | return view('workers.prev_company_form', compact('worker')); | 899 | return view('workers.prev_company_form', compact('worker')); |
899 | } | 900 | } |
900 | 901 | ||
901 | // Добавление контакта компании | 902 | // Добавление контакта компании |
902 | public function add_prev_company(PrevCompanyRequest $request) { | 903 | public function add_prev_company(PrevCompanyRequest $request) { |
903 | // Возвращение параметров | 904 | // Возвращение параметров |
904 | $all = $request->all(); | 905 | $all = $request->all(); |
905 | $PrevCompany = PrevCompany::create($all); | 906 | $PrevCompany = PrevCompany::create($all); |
906 | 907 | ||
907 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); | 908 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); |
908 | } | 909 | } |
909 | 910 | ||
910 | // Редактирование контакта компании | 911 | // Редактирование контакта компании |
911 | public function edit_prev_company(PrevCompany $doc, Worker $worker) { | 912 | public function edit_prev_company(PrevCompany $doc, Worker $worker) { |
912 | return view('workers.prev_company_edit_form', compact('doc', 'worker')); | 913 | return view('workers.prev_company_edit_form', compact('doc', 'worker')); |
913 | } | 914 | } |
914 | 915 | ||
915 | //Сохранение редактирования контакта компании | 916 | //Сохранение редактирования контакта компании |
916 | public function update_prev_company(PrevCompany $doc, Request $request){ | 917 | public function update_prev_company(PrevCompany $doc, Request $request){ |
917 | $all = $request->all(); | 918 | $all = $request->all(); |
918 | $doc->update($all); | 919 | $doc->update($all); |
919 | 920 | ||
920 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); | 921 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); |
921 | } | 922 | } |
922 | 923 | ||
923 | // Удаление контакта предыдущей компании | 924 | // Удаление контакта предыдущей компании |
924 | public function delete_prev_company(PrevCompany $doc) { | 925 | public function delete_prev_company(PrevCompany $doc) { |
925 | $doc->delete(); | 926 | $doc->delete(); |
926 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); | 927 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); |
927 | } | 928 | } |
928 | } | 929 | } |
929 | 930 | ||
930 | 931 |
resources/views/employers/add_vacancy.blade.php
1 | @extends('layout.frontend', ['title' => 'Добавление вакансии РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Добавление вакансии РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script> | 4 | <script> |
5 | console.log('Приближаемся к системе, нас рой тут...'); | 5 | console.log('Приближаемся к системе, нас рой тут...'); |
6 | $(document).on('change', '#category_id', function() { | 6 | $(document).on('change', '#category_id', function() { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var val_ = this_.val(); | 8 | var val_ = this_.val(); |
9 | var ajax_ = $('#job_title_id'); | 9 | var ajax_ = $('#job_title_id'); |
10 | 10 | ||
11 | console.log('Создания списка людей, которые поднимутся на корабль...'); | 11 | console.log('Создания списка людей, которые поднимутся на корабль...'); |
12 | 12 | ||
13 | $.ajax({ | 13 | $.ajax({ |
14 | type: "GET", | 14 | type: "GET", |
15 | url: "{{ route('employer.selected_people') }}", | 15 | url: "{{ route('employer.selected_people') }}", |
16 | data: "id="+val_, | 16 | data: "id="+val_, |
17 | success: function (data) { | 17 | success: function (data) { |
18 | console.log('Ответка пришла'); | 18 | console.log('Ответка пришла'); |
19 | console.log('Список избранных людей создан'); | 19 | console.log('Список избранных людей создан'); |
20 | ajax_.html(data); | 20 | ajax_.html(data); |
21 | }, | 21 | }, |
22 | headers: { | 22 | headers: { |
23 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 23 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
24 | }, | 24 | }, |
25 | error: function (data) { | 25 | error: function (data) { |
26 | console.log('Обрыв связи'); | 26 | console.log('Обрыв связи'); |
27 | console.log('Error: ' + data); | 27 | console.log('Error: ' + data); |
28 | } | 28 | } |
29 | }); | 29 | }); |
30 | }); | 30 | }); |
31 | </script> | 31 | </script> |
32 | @endsection | 32 | @endsection |
33 | @section('content') | 33 | @section('content') |
34 | <section class="cabinet"> | 34 | <section class="cabinet"> |
35 | <div class="container"> | 35 | <div class="container"> |
36 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 36 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
37 | <li><a href="{{ route('index') }}">Главная</a></li> | 37 | <li><a href="{{ route('index') }}">Главная</a></li> |
38 | <li><b>Личный кабинет</b></li> | 38 | <li><b>Личный кабинет</b></li> |
39 | </ul> | 39 | </ul> |
40 | <div class="cabinet__wrapper"> | 40 | <div class="cabinet__wrapper"> |
41 | <div class="cabinet__side"> | 41 | <div class="cabinet__side"> |
42 | <div class="cabinet__side-toper"> | 42 | <div class="cabinet__side-toper"> |
43 | 43 | ||
44 | @include('employers.emblema') | 44 | @include('employers.emblema') |
45 | 45 | ||
46 | </div> | 46 | </div> |
47 | 47 | ||
48 | @include('employers.menu', ['item' => 2]) | 48 | @include('employers.menu', ['item' => 2]) |
49 | 49 | ||
50 | </div> | 50 | </div> |
51 | 51 | ||
52 | <form class="cabinet__body" action="{{ route('employer.vac_save') }}" method="POST"> | 52 | <form class="cabinet__body" action="{{ route('employer.vac_save') }}" method="POST"> |
53 | @csrf | 53 | @csrf |
54 | <input type="hidden" name="employer_id" value="{{ $Employer[0]->id }}"/> | 54 | <input type="hidden" name="employer_id" value="{{ $Employer[0]->id }}"/> |
55 | <div class="cabinet__body-item"> | 55 | <div class="cabinet__body-item"> |
56 | <div class="cabinet__descr"> | 56 | <div class="cabinet__descr"> |
57 | <h2 class="title cabinet__title">Разместить вакансию</h2> | 57 | <h2 class="title cabinet__title">Разместить вакансию</h2> |
58 | <p class="cabinet__text"><b>Данные по вакансии</b></p> | 58 | <p class="cabinet__text"><b>Данные по вакансии</b></p> |
59 | <p class="cabinet__text">Все поля обязательны для заполнения *</p> | 59 | <p class="cabinet__text">Все поля обязательны для заполнения *</p> |
60 | </div> | 60 | </div> |
61 | </div> | 61 | </div> |
62 | 62 | ||
63 | <div class="cabinet__body-item"> | 63 | <div class="cabinet__body-item"> |
64 | <h4>Поля для вакансии</h4> | 64 | <h4>Поля для вакансии</h4> |
65 | <div class="cabinet__inputs"> | 65 | <div class="cabinet__inputs"> |
66 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 66 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
67 | <label class="form-group__label">Название вакансии</label> | 67 | <label class="form-group__label">Название вакансии</label> |
68 | <div class="form-group__item"> | 68 | <div class="form-group__item"> |
69 | <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $Employer[0]->name ?? '' }}" required> | 69 | <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $Employer[0]->name ?? '' }}" required> |
70 | @error('name') | 70 | @error('name') |
71 | <span class="text-xs text-red-600 dark:text-red-400"> | 71 | <span class="text-xs text-red-600 dark:text-red-400"> |
72 | {{ $message }} | 72 | {{ $message }} |
73 | </span> | 73 | </span> |
74 | @enderror | 74 | @enderror |
75 | </div> | 75 | </div> |
76 | </div> | 76 | </div> |
77 | 77 | ||
78 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | ||
79 | <label class="form-group__label">Добавление должностей</label> | ||
80 | <div class="form-group__item"> | ||
81 | <div class="select"> | ||
82 | <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple"> | ||
83 | @php $i = 1 @endphp | ||
84 | @if ($jobs->count()) | ||
85 | @foreach($jobs as $it) | ||
86 | @php $selected = false; @endphp | ||
87 | @if (isset($Worker[0]->job_titles)) | ||
88 | @if ($Worker[0]->job_titles->count()) | ||
89 | @foreach($Worker[0]->job_titles as $select) | ||
90 | @if ($it->id == $select->id) | ||
91 | @php $selected = true; @endphp | ||
92 | @endif | ||
93 | @endforeach | ||
94 | @endif | ||
95 | @endif | ||
96 | <option value="{{ $it->id }}" @if ($selected) selected @endif>{{ $it->name }}</option> | ||
97 | @endforeach | ||
98 | @endif | ||
99 | </select> | ||
100 | </div> | ||
101 | </div> | ||
102 | </div> | ||
103 | |||
78 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | 104 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> |
79 | <label class="form-group__label">Телефон</label> | 105 | <label class="form-group__label">Телефон</label> |
80 | <div class="form-group__item"> | 106 | <div class="form-group__item"> |
81 | <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $Employer[0]->telephone ?? '' }}" placeholder="Свой телефон"> | 107 | <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $Employer[0]->telephone ?? '' }}" placeholder="Свой телефон"> |
82 | @error('telephone') | 108 | @error('telephone') |
83 | <span class="text-xs text-red-600 dark:text-red-400"> | 109 | <span class="text-xs text-red-600 dark:text-red-400"> |
84 | {{ $message }} | 110 | {{ $message }} |
85 | </span> | 111 | </span> |
86 | @enderror | 112 | @enderror |
87 | </div> | 113 | </div> |
88 | </div> | 114 | </div> |
89 | 115 | ||
90 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | 116 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> |
91 | <label class="form-group__label">Емайл</label> | 117 | <label class="form-group__label">Емайл</label> |
92 | <div class="form-group__item"> | 118 | <div class="form-group__item"> |
93 | <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $Employer[0]->email ?? '' }}" placeholder="Своя почту"> | 119 | <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $Employer[0]->email ?? '' }}" placeholder="Своя почту"> |
94 | @error('email') | 120 | @error('email') |
95 | <span class="text-xs text-red-600 dark:text-red-400"> | 121 | <span class="text-xs text-red-600 dark:text-red-400"> |
96 | {{ $message }} | 122 | {{ $message }} |
97 | </span> | 123 | </span> |
98 | @enderror | 124 | @enderror |
99 | </div> | 125 | </div> |
100 | </div> | 126 | </div> |
101 | 127 | ||
102 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | 128 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> |
103 | <label class="form-group__label">Зарплата среднестатистическая для вакансии</label> | 129 | <label class="form-group__label">Зарплата среднестатистическая для вакансии</label> |
104 | <div class="form-group__item"> | 130 | <div class="form-group__item"> |
105 | <input type="text" class="input" name="salary" id="salary" value="0" placeholder="Среднестатистическая зарплата"> | 131 | <input type="text" class="input" name="salary" id="salary" value="0" placeholder="Среднестатистическая зарплата"> |
106 | @error('salary') | 132 | @error('salary') |
107 | <span class="text-xs text-red-600 dark:text-red-400"> | 133 | <span class="text-xs text-red-600 dark:text-red-400"> |
108 | {{ $message }} | 134 | {{ $message }} |
109 | </span> | 135 | </span> |
110 | @enderror | 136 | @enderror |
111 | </div> | 137 | </div> |
112 | </div> | 138 | </div> |
113 | 139 | ||
114 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | 140 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> |
115 | <label class="form-group__label">Город посадки</label> | 141 | <label class="form-group__label">Город посадки</label> |
116 | <div class="form-group__item"> | 142 | <div class="form-group__item"> |
117 | <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $Employer[0]->city ?? '' }}" placeholder="Севастополь"> | 143 | <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $Employer[0]->city ?? '' }}" placeholder="Севастополь"> |
118 | @error('city') | 144 | @error('city') |
119 | <span class="text-xs text-red-600"> | 145 | <span class="text-xs text-red-600"> |
120 | {{ $message }} | 146 | {{ $message }} |
121 | </span> | 147 | </span> |
122 | @enderror | 148 | @enderror |
123 | </div> | 149 | </div> |
124 | </div> | 150 | </div> |
125 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 151 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
126 | <label class="form-group__label">Категория (локация)</label> | 152 | <label class="form-group__label">Категория (локация)</label> |
127 | <div class="form-group__item"> | 153 | <div class="form-group__item"> |
128 | <div class="select"> | 154 | <div class="select"> |
129 | <select class="js-select2" name="category_id" id="category_id"> | 155 | <select class="js-select2" name="category_id" id="category_id"> |
130 | <option selected> Выберите категорию из списка</option> | 156 | <option selected> Выберите категорию из списка</option> |
131 | _php $i = 1 _endphp | 157 | _php $i = 1 _endphp |
132 | _if ($categories->count()) | 158 | _if ($categories->count()) |
133 | _foreach($categories as $j) | 159 | _foreach($categories as $j) |
134 | <option value=" $j->id }}"> $j->name }}</option> | 160 | <option value=" $j->id }}"> $j->name }}</option> |
135 | _php $i++ _endphp | 161 | _php $i++ _endphp |
136 | _endforeach | 162 | _endforeach |
137 | _endif | 163 | _endif |
138 | </select> | 164 | </select> |
139 | _error('category_id') | 165 | _error('category_id') |
140 | <span class="text-xs text-red-600 dark:text-red-400"> | 166 | <span class="text-xs text-red-600 dark:text-red-400"> |
141 | $message }} | 167 | $message }} |
142 | </span> | 168 | </span> |
143 | _enderror | 169 | _enderror |
144 | </div> | 170 | </div> |
145 | </div> | 171 | </div> |
146 | </div>--> | 172 | </div>--> |
147 | 173 | ||
148 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 174 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
149 | <label class="form-group__label">Описание вакансии</label> | 175 | <label class="form-group__label">Описание вакансии</label> |
150 | <div class="form-group__item"> | 176 | <div class="form-group__item"> |
151 | <textarea class="textarea" name="text" id="text">{{ old('text') ?? '' }}</textarea> | 177 | <textarea class="textarea ckeditor" name="text" id="text">{{ old('text') ?? '' }}</textarea> |
152 | @error('text') | 178 | @error('text') |
153 | <span class="text-xs text-red-600"> | 179 | <span class="text-xs text-red-600"> |
154 | {{ $message }} | 180 | {{ $message }} |
155 | </span> | 181 | </span> |
156 | @enderror | 182 | @enderror |
157 | </div> | 183 | </div> |
158 | </div> | 184 | </div> |
159 | </div> | 185 | </div> |
160 | </div> | 186 | </div> |
161 | 187 | ||
162 | <div class="cabinet__body-item"> | 188 | <div class="cabinet__body-item"> |
163 | <div class="cabinet__body-item"> | 189 | <!-- <div class="cabinet__body-item"> |
164 | <div class="cabinet__descr"> | 190 | <div class="cabinet__descr"> |
165 | <p class="cabinet__text"><b>Добавление должности</b></p> | 191 | <p class="cabinet__text"><b>Добавление должности</b></p> |
166 | </div> | 192 | </div> |
167 | </div> | 193 | </div> |
168 | 194 | ||
169 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 195 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
170 | <label class="form-group__label">Должность соискателя</label> | 196 | <label class="form-group__label">Должность соискателя</label> |
171 | <div class="form-group__item"> | 197 | <div class="form-group__item"> |
172 | <div class="select"> | 198 | <div class="select"> |
173 | <select class="js-select2" name="job_title_id" id="job_title_id"> | 199 | <select class="js-select2" name="job_title_id" id="job_title_id"> |
174 | php $i = 1 endphp | 200 | php $i = 1 endphp |
175 | if ($jobs->count()) | 201 | if ($jobs->count()) |
176 | foreach($jobs as $j) | 202 | foreach($jobs as $j) |
177 | if ($i == 1) <option selected> Выберите должность из списка</option> | 203 | if ($i == 1) <option selected> Выберите должность из списка</option> |
178 | else | 204 | else |
179 | <option value=" $j->id }}"> $j->name }}</option> | 205 | <option value=" $j->id }}"> $j->name }}</option> |
180 | endif | 206 | endif |
181 | php $i++ endphp | 207 | php $i++ endphp |
182 | endforeach | 208 | endforeach |
183 | endif | 209 | endif |
184 | </select> | 210 | </select> |
185 | error('job_title_id') | 211 | error('job_title_id') |
186 | <span class="text-xs text-red-600 dark:text-red-400"> | 212 | <span class="text-xs text-red-600 dark:text-red-400"> |
187 | $message }} | 213 | $message }} |
188 | </span> | 214 | </span> |
189 | enderror | 215 | enderror |
190 | </div> | 216 | </div> |
191 | </div> | 217 | </div> |
192 | </div>--> | 218 | </div>--> |
193 | 219 | ||
194 | <div class="cabinet__inputs-item cabinet__inputs-item_max form-group"> | 220 | <div class="cabinet__inputs-item cabinet__inputs-item_max form-group"> |
195 | <label class="form-group__label">Добавление должностей</label> | 221 | |
196 | <div class="form-group__item"> | ||
197 | <div class="select"> | ||
198 | <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple"> | ||
199 | @php $i = 1 @endphp | ||
200 | @if ($jobs->count()) | ||
201 | @foreach($jobs as $it) | ||
202 | @php $selected = false; @endphp | ||
203 | @if (isset($Worker[0]->job_titles)) | ||
204 | @if ($Worker[0]->job_titles->count()) | ||
205 | @foreach($Worker[0]->job_titles as $select) | ||
206 | @if ($it->id == $select->id) | ||
207 | @php $selected = true; @endphp | ||
208 | @endif | ||
209 | @endforeach | ||
210 | @endif | ||
211 | @endif | ||
212 | <option value="{{ $it->id }}" @if ($selected) selected @endif>{{ $it->name }}</option> | ||
213 | @endforeach | ||
214 | @endif | ||
215 | </select> | ||
216 | </div> | ||
217 | </div> | ||
218 | </div> | 222 | </div> |
219 | 223 | ||
220 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 224 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
221 | <label class="form-group__label">Минимальная зарплата</label> | 225 | <label class="form-group__label">Минимальная зарплата</label> |
222 | <div class="form-group__item"> | 226 | <div class="form-group__item"> |
223 | <input type="text" class="input" name="min_salary" id="min_salary" value=" old('min_salary') ?? '' }}" placeholder="Минимальная зарплата"> | 227 | <input type="text" class="input" name="min_salary" id="min_salary" value=" old('min_salary') ?? '' }}" placeholder="Минимальная зарплата"> |
224 | error('min_salary') | 228 | error('min_salary') |
225 | <span class="text-xs text-red-600"> | 229 | <span class="text-xs text-red-600"> |
226 | $message }} | 230 | $message }} |
227 | </span> | 231 | </span> |
228 | enderror | 232 | enderror |
229 | </div> | 233 | </div> |
230 | </div> | 234 | </div> |
231 | 235 | ||
232 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 236 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
233 | <label class="form-group__label">Максимальная зарплата</label> | 237 | <label class="form-group__label">Максимальная зарплата</label> |
234 | <div class="form-group__item"> | 238 | <div class="form-group__item"> |
235 | <input type="text" class="input" name="max_salary" id="max_salary" value=" old('max_salary') ?? '' }}" placeholder="Максимальная зарплата"> | 239 | <input type="text" class="input" name="max_salary" id="max_salary" value=" old('max_salary') ?? '' }}" placeholder="Максимальная зарплата"> |
236 | error('salary') | 240 | error('salary') |
237 | <span class="text-xs text-red-600 dark:text-red-400"> | 241 | <span class="text-xs text-red-600 dark:text-red-400"> |
238 | $message }} | 242 | $message }} |
239 | </span> | 243 | </span> |
240 | enderror | 244 | enderror |
241 | </div> | 245 | </div> |
242 | </div> | 246 | </div> |
243 | 247 | ||
244 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 248 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
245 | <label class="form-group__label">Регион отплытия</label> | 249 | <label class="form-group__label">Регион отплытия</label> |
246 | <div class="form-group__item"> | 250 | <div class="form-group__item"> |
247 | <input type="text" class="input" name="region" id="region" value=" old('region') ?? $Employer[0]->city ?? '' }}" placeholder="Севастополь"> | 251 | <input type="text" class="input" name="region" id="region" value=" old('region') ?? $Employer[0]->city ?? '' }}" placeholder="Севастополь"> |
248 | error('region') | 252 | error('region') |
249 | <span class="text-xs text-red-600"> | 253 | <span class="text-xs text-red-600"> |
250 | $message }} | 254 | $message }} |
251 | </span> | 255 | </span> |
252 | enderror | 256 | enderror |
253 | </div> | 257 | </div> |
254 | </div> | 258 | </div> |
255 | 259 | ||
256 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 260 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
257 | <label class="form-group__label">Мощность</label> | 261 | <label class="form-group__label">Мощность</label> |
258 | <div class="form-group__item"> | 262 | <div class="form-group__item"> |
259 | <input type="text" class="input" name="power" id="power" value=" old('power') ?? '' }}" placeholder="POWER-45"> | 263 | <input type="text" class="input" name="power" id="power" value=" old('power') ?? '' }}" placeholder="POWER-45"> |
260 | error('power') | 264 | error('power') |
261 | <span class="text-xs text-red-600"> | 265 | <span class="text-xs text-red-600"> |
262 | $message }} | 266 | $message }} |
263 | </span> | 267 | </span> |
264 | enderror | 268 | enderror |
265 | </div> | 269 | </div> |
266 | </div> | 270 | </div> |
267 | 271 | ||
268 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 272 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
269 | <label class="form-group__label">Суточные выплаты</label> | 273 | <label class="form-group__label">Суточные выплаты</label> |
270 | <div class="form-group__item"> | 274 | <div class="form-group__item"> |
271 | <input type="text" class="input" name="sytki" id="sytki" value=" old('sytki') ?? '' }}" placeholder="2000"> | 275 | <input type="text" class="input" name="sytki" id="sytki" value=" old('sytki') ?? '' }}" placeholder="2000"> |
272 | error('power') | 276 | error('power') |
273 | <span class="text-xs text-red-600"> | 277 | <span class="text-xs text-red-600"> |
274 | $message }} | 278 | $message }} |
275 | </span> | 279 | </span> |
276 | enderror | 280 | enderror |
277 | </div> | 281 | </div> |
278 | </div> | 282 | </div> |
279 | 283 | ||
280 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 284 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
281 | <label class="form-group__label">Начало отплытия</label> | 285 | <label class="form-group__label">Начало отплытия</label> |
282 | <div class="form-group__item"> | 286 | <div class="form-group__item"> |
283 | <input type="text" class="input" name="start" id="start" value=" old('start') ?? '' }}" placeholder="20 сентября 2024"> | 287 | <input type="text" class="input" name="start" id="start" value=" old('start') ?? '' }}" placeholder="20 сентября 2024"> |
284 | error('power') | 288 | error('power') |
285 | <span class="text-xs text-red-600"> | 289 | <span class="text-xs text-red-600"> |
286 | $message }} | 290 | $message }} |
287 | </span> | 291 | </span> |
288 | enderror | 292 | enderror |
289 | </div> | 293 | </div> |
290 | </div> | 294 | </div> |
291 | 295 | ||
292 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 296 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
293 | <label class="form-group__label">Корабль для посадки</label> | 297 | <label class="form-group__label">Корабль для посадки</label> |
294 | <div class="form-group__item"> | 298 | <div class="form-group__item"> |
295 | <div class="select"> | 299 | <div class="select"> |
296 | <select class="js-select2" name="flot" id="flot"> | 300 | <select class="js-select2" name="flot" id="flot"> |
297 | <option value="" selected> Не указан корабль</option> | 301 | <option value="" selected> Не указан корабль</option> |
298 | if ($Employer[0]->flots->count()) | 302 | if ($Employer[0]->flots->count()) |
299 | foreach($Employer[0]->flots as $j) | 303 | foreach($Employer[0]->flots as $j) |
300 | <option value=" $j->name }}"> $j->name }} ( $j->id }})</option> | 304 | <option value=" $j->name }}"> $j->name }} ( $j->id }})</option> |
301 | endforeach | 305 | endforeach |
302 | endif | 306 | endif |
303 | </select> | 307 | </select> |
304 | error('flot') | 308 | error('flot') |
305 | <span class="text-xs text-red-600"> | 309 | <span class="text-xs text-red-600"> |
306 | $message }} | 310 | $message }} |
307 | </span> | 311 | </span> |
308 | enderror | 312 | enderror |
309 | </div> | 313 | </div> |
310 | </div> | 314 | </div> |
311 | </div>--> | 315 | </div>--> |
312 | 316 | ||
313 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 317 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
314 | <label class="form-group__label">Дополнительная информация</label> | 318 | <label class="form-group__label">Дополнительная информация</label> |
315 | <div class="form-group__item"> | 319 | <div class="form-group__item"> |
316 | <textarea class="textarea" name="description" id="description"> old('description') ?? '' }}</textarea> | 320 | <textarea class="textarea" name="description" id="description"> old('description') ?? '' }}</textarea> |
317 | error('description') | 321 | error('description') |
318 | <span class="text-xs text-red-600"> | 322 | <span class="text-xs text-red-600"> |
319 | $message }} | 323 | $message }} |
320 | </span> | 324 | </span> |
321 | enderror | 325 | enderror |
322 | </div> | 326 | </div> |
resources/views/employers/ajax/list_vacancy.blade.php
1 | @if ($vacancy_list->count()) | 1 | @if ($vacancy_list->count()) |
2 | <div class="table__scroll"> | 2 | <div class="table__scroll"> |
3 | <div class="table__body table__body_min-width"> | 3 | <div class="table__body table__body_min-width"> |
4 | <table> | 4 | <table> |
5 | <thead> | 5 | <thead> |
6 | <tr> | 6 | <tr> |
7 | <th>№</th> | 7 | <th>№</th> |
8 | <th>Название</th> | 8 | <th>Название</th> |
9 | <th>Дата добавления<br>/ обновления</th> | 9 | <th>Дата добавления<br>/ обновления</th> |
10 | <th>Должности</th> | 10 | <th style="display:none">Должности</th> |
11 | <th>Статус</th> | 11 | <th>Статус</th> |
12 | <th>Действия</th> | 12 | <th>Действия</th> |
13 | </tr> | 13 | </tr> |
14 | </thead> | 14 | </thead> |
15 | <tbody> | 15 | <tbody> |
16 | @foreach($vacancy_list as $it) | 16 | @foreach($vacancy_list as $it) |
17 | <tr> | 17 | <tr> |
18 | <td>{{ $it->id }}</td> | 18 | <td>{{ $it->id }}</td> |
19 | <td>{{ $it->name }}</td> | 19 | <td>{{ $it->name }}</td> |
20 | <td>{{ date('d.m.Y H:i:s', strtotime($it->created_at)) }} <br>/ {{ date('d.m.Y H:i:s', strtotime($it->updated_at)) }}</td> | 20 | <td>{{ date('d.m.Y H:i:s', strtotime($it->created_at)) }} <br>/ {{ date('d.m.Y H:i:s', strtotime($it->updated_at)) }}</td> |
21 | <td> <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $it->id]) }}" class="button">Добавить</a> | 21 | <td style="display:none"> <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $it->id]) }}" class="button">Добавить</a> |
22 | 22 | ||
23 | @if ($it->jobs->count()) | 23 | @if ($it->jobs->count()) |
24 | @foreach ($it->jobs as $key => $it_um) | 24 | @foreach ($it->jobs as $key => $it_um) |
25 | <p>@if (isset($it->jobs_code[$key])) | 25 | <p>@if (isset($it->jobs_code[$key])) |
26 | <a href="{{ route('employer.edit_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id, 'ad_employer' => $it->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">{{$it_um->name}}</a> | 26 | <a href="{{ route('employer.edit_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id, 'ad_employer' => $it->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">{{$it_um->name}}</a> |
27 | <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a> | 27 | <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a> |
28 | @endif | 28 | @endif |
29 | </p> | 29 | </p> |
30 | @endforeach | 30 | @endforeach |
31 | @else | 31 | @else |
32 | Нет связанных <br> с вакансией должностей | 32 | Нет связанных <br> с вакансией должностей |
33 | @endif | 33 | @endif |
34 | </td> | 34 | </td> |
35 | <td> | 35 | <td> |
36 | @if ($it->active_is) | 36 | @if ($it->active_is) |
37 | <span class="table__status green"><i></i>Опубликовано</span> | 37 | <span class="table__status green"><i></i>Опубликовано</span> |
38 | @else | 38 | @else |
39 | <span class="table__status"><i></i>Не опубликовано</span> | 39 | <span class="table__status"><i></i>Не опубликовано</span> |
40 | @endif | 40 | @endif |
41 | </td> | 41 | </td> |
42 | <td> | 42 | <td> |
43 | <span class="table__controls"> | 43 | <span class="table__controls"> |
44 | <a class="table__controls-item up-it" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}"> | 44 | <a class="table__controls-item up-it" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}"> |
45 | <svg> | 45 | <svg> |
46 | <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use> | 46 | <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use> |
47 | </svg> | 47 | </svg> |
48 | </a> | 48 | </a> |
49 | <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" class="table__controls-item"> | 49 | <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" class="table__controls-item"> |
50 | <svg> | 50 | <svg> |
51 | <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> | 51 | <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> |
52 | </svg> | 52 | </svg> |
53 | </a> | 53 | </a> |
54 | <a class="table__controls-item" href="{{ route('employer.vacancy_delete', ['ad_employer' => $it->id]) }}"> | 54 | <a class="table__controls-item" href="{{ route('employer.vacancy_delete', ['ad_employer' => $it->id]) }}"> |
55 | <svg> | 55 | <svg> |
56 | <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> | 56 | <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> |
57 | </svg> | 57 | </svg> |
58 | </a> | 58 | </a> |
59 | @if ($it->active_is) | 59 | @if ($it->active_is) |
60 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" class="table__controls-item"> | 60 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" class="table__controls-item"> |
61 | <svg> | 61 | <svg> |
62 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> | 62 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> |
63 | </svg> | 63 | </svg> |
64 | </a> | 64 | </a> |
65 | @else | 65 | @else |
66 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" class="table__controls-item"> | 66 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" class="table__controls-item"> |
67 | <svg> | 67 | <svg> |
68 | <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> | 68 | <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> |
69 | </svg> | 69 | </svg> |
70 | </a> | 70 | </a> |
71 | @endif | 71 | @endif |
72 | 72 | ||
73 | <!--<button type="button" class="table__controls-item"> | 73 | <!--<button type="button" class="table__controls-item"> |
74 | <svg> | 74 | <svg> |
75 | <use xlink:href=" asset('images/sprite.svg#tg') }}"></use> | 75 | <use xlink:href=" asset('images/sprite.svg#tg') }}"></use> |
76 | </svg> | 76 | </svg> |
77 | </button> | 77 | </button> |
78 | --> | 78 | --> |
79 | </span> | 79 | </span> |
80 | </td> | 80 | </td> |
81 | </tr> | 81 | </tr> |
82 | @endforeach | 82 | @endforeach |
83 | </tbody> | 83 | </tbody> |
84 | </table> | 84 | </table> |
85 | </div><br> | 85 | </div><br> |
86 | {{ $vacancy_list->appends($_GET)->links('paginate') }} | 86 | {{ $vacancy_list->appends($_GET)->links('paginate') }} |
87 | </div> | 87 | </div> |
88 | @else | 88 | @else |
89 | 89 | ||
90 | <div class="notify"> | 90 | <div class="notify"> |
91 | <svg> | 91 | <svg> |
92 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> | 92 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> |
93 | </svg> | 93 | </svg> |
94 | <span>Вы ещё не разместили ни одной вакансии</span> | 94 | <span>Вы ещё не разместили ни одной вакансии</span> |
95 | </div> | 95 | </div> |
96 | @endif | 96 | @endif |
97 | 97 |
resources/views/employers/cabinet45.blade.php
1 | @extends('layout.frontend', ['title' => 'Кабинет работодателя - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Кабинет работодателя - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script src="https://cdn.ckeditor.com/ckeditor5/23.0.0/classic/ckeditor.js"></script> | 4 | <script src="https://cdn.ckeditor.com/ckeditor5/23.0.0/classic/ckeditor.js"></script> |
5 | <script> | 5 | <script> |
6 | ClassicEditor | 6 | ClassicEditor |
7 | .create( document.querySelector( '#text' ) ) | 7 | .create( document.querySelector( '#text' ) ) |
8 | .catch( error => { | 8 | .catch( error => { |
9 | console.error( error ); | 9 | console.error( error ); |
10 | } ); | 10 | } ); |
11 | </script> | 11 | </script> |
12 | @endsection | 12 | @endsection |
13 | @section('content') | 13 | @section('content') |
14 | <section class="cabinet"> | 14 | <section class="cabinet"> |
15 | <div class="container"> | 15 | <div class="container"> |
16 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 16 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
17 | <li><a href="{{ route('index') }}">Главная</a></li> | 17 | <li><a href="{{ route('index') }}">Главная</a></li> |
18 | <li><b>Личный кабинет</b></li> | 18 | <li><b>Личный кабинет</b></li> |
19 | </ul> | 19 | </ul> |
20 | <div class="cabinet__wrapper"> | 20 | <div class="cabinet__wrapper"> |
21 | <div class="cabinet__side"> | 21 | <div class="cabinet__side"> |
22 | <div class="cabinet__side-toper"> | 22 | <div class="cabinet__side-toper"> |
23 | @include('employers.emblema') | 23 | @include('employers.emblema') |
24 | </div> | 24 | </div> |
25 | 25 | ||
26 | @include('employers.menu', ['item' => 1]) | 26 | @include('employers.menu', ['item' => 1]) |
27 | 27 | ||
28 | </div> | 28 | </div> |
29 | <div class="cabinet__body"> | 29 | <div class="cabinet__body"> |
30 | @include('messages_error') | 30 | @include('messages_error') |
31 | 31 | ||
32 | <form action="{{ route('employer.cabinet_save', ['Employer' => $Employer[0]->id]) }}" method="POST" enctype="multipart/form-data"> | 32 | <form action="{{ route('employer.cabinet_save', ['Employer' => $Employer[0]->id]) }}" method="POST" enctype="multipart/form-data"> |
33 | @csrf | 33 | @csrf |
34 | <div class="cabinet__body-item"> | 34 | <div class="cabinet__body-item"> |
35 | <div class="cabinet__descr"> | 35 | <div class="cabinet__descr"> |
36 | <h2 class="title cabinet__title">Мой профиль</h2> | 36 | <h2 class="title cabinet__title">Мой профиль</h2> |
37 | <p class="cabinet__text">Все поля обязательны для заполнения *</p> | 37 | <p class="cabinet__text">Все поля обязательны для заполнения *</p> |
38 | </div> | 38 | </div> |
39 | <div class="cabinet__avatar"> | 39 | <div class="cabinet__avatar"> |
40 | <div class="cabinet__avatar-pic"> | 40 | <div class="cabinet__avatar-pic"> |
41 | @if (!empty($Employer[0]->logo)) | 41 | @if (!empty($Employer[0]->logo)) |
42 | <img src="{{ asset(Storage::url($Employer[0]->logo)) }}" width="150" alt="{{ $Employer[0]->name_company }}"> | 42 | <img src="{{ asset(Storage::url($Employer[0]->logo)) }}" width="150" alt="{{ $Employer[0]->name_company }}"> |
43 | @else | 43 | @else |
44 | <img src="{{ asset('images/logo_emp.png') }}" width="150" alt="{{ $Employer[0]->name_company }}"/> | 44 | <img src="{{ asset('images/logo_emp.png') }}" width="150" alt="{{ $Employer[0]->name_company }}"/> |
45 | @endif | 45 | @endif |
46 | </div> | 46 | </div> |
47 | <div class="cabinet__avatar-form"> | 47 | <div class="cabinet__avatar-form"> |
48 | <label class="file"> | 48 | <label class="file"> |
49 | <span class="file__input"> | 49 | <span class="file__input"> |
50 | <input type="file" name="logo"> | 50 | <input type="file" name="logo"> |
51 | <span class="button"> | 51 | <span class="button"> |
52 | <svg> | 52 | <svg> |
53 | <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use> | 53 | <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use> |
54 | </svg> | 54 | </svg> |
55 | Загрузить | 55 | Загрузить |
56 | </span> | 56 | </span> |
57 | </span> | 57 | </span> |
58 | </label> | 58 | </label> |
59 | <p class="cabinet__text">Загрузите логотип в формате .svg, .jpg, .png или .jpeg</p> | 59 | <p class="cabinet__text">Загрузите логотип в формате .svg, .jpg, .png или .jpeg</p> |
60 | </div> | 60 | </div> |
61 | </div> | 61 | </div> |
62 | <div class="cabinet__inputs"> | 62 | <div class="cabinet__inputs"> |
63 | <div class="cabinet__inputs-item form-group"> | 63 | <div class="cabinet__inputs-item form-group"> |
64 | <label class="form-group__label">Название судоходной компании</label> | 64 | <label class="form-group__label">Название судоходной компании</label> |
65 | <div class="form-group__item"> | 65 | <div class="form-group__item"> |
66 | <input type="text" class="input" name="name_company" id="name_company" placeholder="ООО Река Море" value="{{ old('name_company') ?? $Employer[0]->name_company ?? '' }}" required> | 66 | <input type="text" class="input" name="name_company" id="name_company" placeholder="ООО Река Море" value="{{ old('name_company') ?? $Employer[0]->name_company ?? '' }}" required> |
67 | @error('name_company') | 67 | @error('name_company') |
68 | <span class="text-xs text-red-600"> | 68 | <span class="text-xs text-red-600"> |
69 | {{ $message }} | 69 | {{ $message }} |
70 | </span> | 70 | </span> |
71 | @enderror | 71 | @enderror |
72 | </div> | 72 | </div> |
73 | </div> | 73 | </div> |
74 | <div class="cabinet__inputs-item form-group"> | 74 | <div class="cabinet__inputs-item form-group"> |
75 | <label class="form-group__label">Электронная почта</label> | 75 | <label class="form-group__label">Электронная почта</label> |
76 | <div class="form-group__item"> | 76 | <div class="form-group__item"> |
77 | <input type="email" name="email" class="input" placeholder="info@rekamore.su" value="{{ old('email') ?? $Employer[0]->email ?? '' }}" required> | 77 | <input type="email" name="email" class="input" placeholder="info@rekamore.su" value="{{ old('email') ?? $Employer[0]->email ?? '' }}" required> |
78 | @error('email') | 78 | @error('email') |
79 | <span class="text-xs text-red-600"> | 79 | <span class="text-xs text-red-600"> |
80 | {{ $message }} | 80 | {{ $message }} |
81 | </span> | 81 | </span> |
82 | @enderror | 82 | @enderror |
83 | </div> | 83 | </div> |
84 | </div> | 84 | </div> |
85 | 85 | ||
86 | <div class="cabinet__inputs-item form-group"> | 86 | <div class="cabinet__inputs-item form-group"> |
87 | <label class="form-group__label">Электронная почта (alt)</label> | 87 | <label class="form-group__label">Электронная почта (alt)</label> |
88 | <div class="form-group__item"> | 88 | <div class="form-group__item"> |
89 | <input type="email" name="email_2" class="input" placeholder="info@rekamore.su" value="{{ old('email_2') ?? $Employer[0]->email_2 ?? '' }}"> | 89 | <input type="email" name="email_2" class="input" placeholder="info@rekamore.su" value="{{ old('email_2') ?? $Employer[0]->email_2 ?? '' }}"> |
90 | @error('email') | 90 | @error('email') |
91 | <span class="text-xs text-red-600"> | 91 | <span class="text-xs text-red-600"> |
92 | {{ $message }} | 92 | {{ $message }} |
93 | </span> | 93 | </span> |
94 | @enderror | 94 | @enderror |
95 | </div> | 95 | </div> |
96 | </div> | 96 | </div> |
97 | 97 | ||
98 | <div class="cabinet__inputs-item form-group"> | 98 | <div class="cabinet__inputs-item form-group"> |
99 | <label class="form-group__label">Номер телефона</label> | 99 | <label class="form-group__label">Номер телефона</label> |
100 | <div class="form-group__item"> | 100 | <div class="form-group__item"> |
101 | <input type="tel" name="telephone" class="input" placeholder="+7 (___) ___-__-__" value="{{ old('telephone') ?? $Employer[0]->telephone ?? '' }}" required> | 101 | <input type="tel" name="telephone" class="input" placeholder="+7 (___) ___-__-__" value="{{ old('telephone') ?? $Employer[0]->telephone ?? '' }}" required> |
102 | @error('telephone') | 102 | @error('telephone') |
103 | <span class="text-xs text-red-600"> | 103 | <span class="text-xs text-red-600"> |
104 | {{ $message }} | 104 | {{ $message }} |
105 | </span> | 105 | </span> |
106 | @enderror | 106 | @enderror |
107 | </div> | 107 | </div> |
108 | </div> | 108 | </div> |
109 | 109 | ||
110 | <div class="cabinet__inputs-item form-group"> | 110 | <div class="cabinet__inputs-item form-group"> |
111 | <label class="form-group__label">Номер телефона (alt)</label> | 111 | <label class="form-group__label">Номер телефона (alt)</label> |
112 | <div class="form-group__item"> | 112 | <div class="form-group__item"> |
113 | <input type="tel" name="telephone_2" class="input" placeholder="+7 (___) ___-__-__" value="{{ old('telephone_2') ?? $Employer[0]->telephone_2 ?? '' }}"> | 113 | <input type="tel" name="telephone_2" class="input" placeholder="+7 (___) ___-__-__" value="{{ old('telephone_2') ?? $Employer[0]->telephone_2 ?? '' }}"> |
114 | @error('telephone') | 114 | @error('telephone') |
115 | <span class="text-xs text-red-600"> | 115 | <span class="text-xs text-red-600"> |
116 | {{ $message }} | 116 | {{ $message }} |
117 | </span> | 117 | </span> |
118 | @enderror | 118 | @enderror |
119 | </div> | 119 | </div> |
120 | </div> | 120 | </div> |
121 | 121 | ||
122 | <div class="cabinet__inputs-item form-group"> | 122 | <div class="cabinet__inputs-item form-group"> |
123 | <label class="form-group__label">Адрес компании</label> | 123 | <label class="form-group__label">Адрес компании</label> |
124 | <div class="form-group__item"> | 124 | <div class="form-group__item"> |
125 | <input type="text" name="address" class="input" value="{{ old('address') ?? $Employer[0]->address ?? '' }}" placeholder="692904, Приморский край, г. Находка, ул. Портовая 3А, 5 этаж"> | 125 | <input type="text" name="address" class="input" value="{{ old('address') ?? $Employer[0]->address ?? '' }}" placeholder="692904, Приморский край, г. Находка, ул. Портовая 3А, 5 этаж"> |
126 | @error('address') | 126 | @error('address') |
127 | <span class="text-xs text-red-600"> | 127 | <span class="text-xs text-red-600"> |
128 | {{ $message }} | 128 | {{ $message }} |
129 | </span> | 129 | </span> |
130 | @enderror | 130 | @enderror |
131 | </div> | 131 | </div> |
132 | </div> | 132 | </div> |
133 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 133 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
134 | <label class="form-group__label">Ссылка на сайт</label> | 134 | <label class="form-group__label">Ссылка на сайт</label> |
135 | <div class="form-group__item"> | 135 | <div class="form-group__item"> |
136 | <input type="url" name="site" class="input" value="{{ old('site') ?? $Employer[0]->site ?? '' }}" placeholder="https://rekamore.su"> | 136 | <input type="url" name="site" class="input" value="{{ old('site') ?? $Employer[0]->site ?? '' }}" placeholder="https://rekamore.su"> |
137 | @error('site') | 137 | @error('site') |
138 | <span class="text-xs text-red-600"> | 138 | <span class="text-xs text-red-600"> |
139 | {{ $message }} | 139 | {{ $message }} |
140 | </span> | 140 | </span> |
141 | @enderror | 141 | @enderror |
142 | </div> | 142 | </div> |
143 | </div> | 143 | </div> |
144 | 144 | ||
145 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 145 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
146 | <label class="form-group__label">О компании</label> | 146 | <label class="form-group__label">О компании</label> |
147 | <div class="form-group__item"> | 147 | <div class="form-group__item"> |
148 | 148 | ||
149 | <textarea name="text" id="txtarea" class="textarea ckeditor">{{ old('text') ?? $Employer[0]->text ?? '' }}</textarea> | 149 | <textarea name="text" id="txtarea" class="textarea ckeditor">{{ old('text') ?? $Employer[0]->text ?? '' }}</textarea> |
150 | @error('text') | 150 | @error('text') |
151 | <span class="text-xs text-red-600"> | 151 | <span class="text-xs text-red-600"> |
152 | {{ $message }} | 152 | {{ $message }} |
153 | </span> | 153 | </span> |
154 | @enderror | 154 | @enderror |
155 | </div> | 155 | </div> |
156 | </div> | 156 | </div> |
157 | </div> | 157 | </div> |
158 | </div><br> | 158 | </div><br> |
159 | <button type="submit" class="button cabinet__submit">Сохранить изменения</button> | 159 | <button type="submit" class="button cabinet__submit">Сохранить изменения</button> |
160 | </form> | 160 | </form> |
161 | 161 | ||
162 | </div> | 162 | </div> |
163 | </div> | 163 | </div> |
164 | </div> | 164 | </div> |
165 | 165 | ||
166 | </section> | 166 | </section> |
167 | </div> | 167 | </div> |
168 | <!-- END TOP WRAPPER --> | 168 | <!-- END TOP WRAPPER --> |
169 | <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> | ||
170 | <script> | ||
171 | CKEDITOR.replace('txtarea'); | ||
172 | //CKEDITOR.replace( 'text', { | ||
173 | // filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", | ||
174 | // filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", | ||
175 | // filebrowserUploadMethod: 'form' | ||
176 | // }); | ||
177 | </script> | ||
178 | |||
169 | @endsection | 179 | @endsection |
170 | 180 |
resources/views/employers/edit_vacancy.blade.php
1 | @extends('layout.frontend', ['title' => 'Редактирование вакансии РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Редактирование вакансии РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script> | 4 | <script> |
5 | console.log('Приближаемся к системе, нас рой тут...'); | 5 | console.log('Приближаемся к системе, нас рой тут...'); |
6 | $(document).on('change', '#position_id', function() { | 6 | $(document).on('change', '#position_id', function() { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var val_ = this_.val(); | 8 | var val_ = this_.val(); |
9 | var ajax_ = $('#job_title_id'); | 9 | var ajax_ = $('#job_title_id'); |
10 | 10 | ||
11 | console.log('Создания списка людей, которые поднимутся на корабль...'); | 11 | console.log('Создания списка людей, которые поднимутся на корабль...'); |
12 | 12 | ||
13 | $.ajax({ | 13 | $.ajax({ |
14 | type: "GET", | 14 | type: "GET", |
15 | url: "{{ route('employer.selected_people') }}", | 15 | url: "{{ route('employer.selected_people') }}", |
16 | data: "id="+val_, | 16 | data: "id="+val_, |
17 | success: function (data) { | 17 | success: function (data) { |
18 | console.log('Ответка пришла'); | 18 | console.log('Ответка пришла'); |
19 | console.log('Список избранных людей создан'); | 19 | console.log('Список избранных людей создан'); |
20 | ajax_.html(data); | 20 | ajax_.html(data); |
21 | }, | 21 | }, |
22 | headers: { | 22 | headers: { |
23 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 23 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
24 | }, | 24 | }, |
25 | error: function (data) { | 25 | error: function (data) { |
26 | console.log('Обрыв связи'); | 26 | console.log('Обрыв связи'); |
27 | console.log('Error: ' + data); | 27 | console.log('Error: ' + data); |
28 | } | 28 | } |
29 | }); | 29 | }); |
30 | }); | 30 | }); |
31 | </script> | 31 | </script> |
32 | @endsection | 32 | @endsection |
33 | @section('content') | 33 | @section('content') |
34 | <section class="cabinet"> | 34 | <section class="cabinet"> |
35 | <div class="container"> | 35 | <div class="container"> |
36 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 36 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
37 | <li><a href="{{ route('index') }}">Главная</a></li> | 37 | <li><a href="{{ route('index') }}">Главная</a></li> |
38 | <li><b>Личный кабинет</b></li> | 38 | <li><b>Личный кабинет</b></li> |
39 | </ul> | 39 | </ul> |
40 | <div class="cabinet__wrapper"> | 40 | <div class="cabinet__wrapper"> |
41 | <div class="cabinet__side"> | 41 | <div class="cabinet__side"> |
42 | <div class="cabinet__side-toper"> | 42 | <div class="cabinet__side-toper"> |
43 | 43 | ||
44 | @include('employers.emblema') | 44 | @include('employers.emblema') |
45 | 45 | ||
46 | </div> | 46 | </div> |
47 | 47 | ||
48 | @include('employers.menu', ['item' => 3]) | 48 | @include('employers.menu', ['item' => 3]) |
49 | 49 | ||
50 | </div> | 50 | </div> |
51 | 51 | ||
52 | <form class="cabinet__body" action="{{ route('employer.vacancy_save_me', ['ad_employer' => $Employer->id]) }}" method="POST"> | 52 | <form class="cabinet__body" action="{{ route('employer.vacancy_save_me', ['ad_employer' => $Employer->id]) }}" method="POST"> |
53 | @csrf | 53 | @csrf |
54 | <input type="hidden" name="employer_id" value="{{ $Employer->id }}"/> | 54 | <input type="hidden" name="employer_id" value="{{ $Employer->id }}"/> |
55 | <div class="cabinet__body-item"> | 55 | <div class="cabinet__body-item"> |
56 | <div class="cabinet__descr"> | 56 | <div class="cabinet__descr"> |
57 | <h2 class="title cabinet__title">Редактировать вакансию</h2> | 57 | <h2 class="title cabinet__title">Редактировать вакансию</h2> |
58 | <p class="cabinet__text"><b>Данные по вакансии</b></p> | 58 | <p class="cabinet__text"><b>Данные по вакансии</b></p> |
59 | <p class="cabinet__text">Все поля обязательны для заполнения *</p> | 59 | <p class="cabinet__text">Все поля обязательны для заполнения *</p> |
60 | </div> | 60 | </div> |
61 | </div> | 61 | </div> |
62 | <div class="cabinet__body-item"> | 62 | <div class="cabinet__body-item"> |
63 | <h4>Поля для вакансии</h4> | 63 | <h4>Поля для вакансии</h4> |
64 | <div class="cabinet__inputs"> | 64 | <div class="cabinet__inputs"> |
65 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 65 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
66 | <label class="form-group__label">Название вакансии</label> | 66 | <label class="form-group__label">Название вакансии</label> |
67 | <div class="form-group__item"> | 67 | <div class="form-group__item"> |
68 | <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $ad_employer->name ?? '' }}" required> | 68 | <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $ad_employer->name ?? '' }}" required> |
69 | @error('name') | 69 | @error('name') |
70 | <span class="text-xs text-red-600 dark:text-red-400"> | 70 | <span class="text-xs text-red-600 dark:text-red-400"> |
71 | {{ $message }} | 71 | {{ $message }} |
72 | </span> | 72 | </span> |
73 | @enderror | 73 | @enderror |
74 | </div> | 74 | </div> |
75 | </div> | 75 | </div> |
76 | 76 | ||
77 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | 77 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> |
78 | <label class="form-group__label">Телефон</label> | 78 | <label class="form-group__label">Телефон</label> |
79 | <div class="form-group__item"> | 79 | <div class="form-group__item"> |
80 | <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $ad_employer->telephone ?? '' }}" placeholder="Свой телефон"> | 80 | <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $ad_employer->telephone ?? '' }}" placeholder="Свой телефон"> |
81 | @error('telephone') | 81 | @error('telephone') |
82 | <span class="text-xs text-red-600 dark:text-red-400"> | 82 | <span class="text-xs text-red-600 dark:text-red-400"> |
83 | {{ $message }} | 83 | {{ $message }} |
84 | </span> | 84 | </span> |
85 | @enderror | 85 | @enderror |
86 | </div> | 86 | </div> |
87 | </div> | 87 | </div> |
88 | 88 | ||
89 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | 89 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> |
90 | <label class="form-group__label">Емайл</label> | 90 | <label class="form-group__label">Емайл</label> |
91 | <div class="form-group__item"> | 91 | <div class="form-group__item"> |
92 | <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $ad_employer->email ?? '' }}" placeholder="Своя почту"> | 92 | <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $ad_employer->email ?? '' }}" placeholder="Своя почту"> |
93 | @error('email') | 93 | @error('email') |
94 | <span class="text-xs text-red-600 dark:text-red-400"> | 94 | <span class="text-xs text-red-600 dark:text-red-400"> |
95 | {{ $message }} | 95 | {{ $message }} |
96 | </span> | 96 | </span> |
97 | @enderror | 97 | @enderror |
98 | </div> | 98 | </div> |
99 | </div> | 99 | </div> |
100 | 100 | ||
101 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | 101 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> |
102 | <label class="form-group__label">Зарплата среднестатистическая для вакансии</label> | 102 | <label class="form-group__label">Зарплата среднестатистическая для вакансии</label> |
103 | <div class="form-group__item"> | 103 | <div class="form-group__item"> |
104 | <input type="text" class="input" name="salary" id="salary" value="{{ old('salary') ?? $ad_employer->salary ??'' }}" placeholder="Среднестатистическая зарплата"> | 104 | <input type="text" class="input" name="salary" id="salary" value="{{ old('salary') ?? $ad_employer->salary ??'' }}" placeholder="Среднестатистическая зарплата"> |
105 | @error('salary') | 105 | @error('salary') |
106 | <span class="text-xs text-red-600 dark:text-red-400"> | 106 | <span class="text-xs text-red-600 dark:text-red-400"> |
107 | {{ $message }} | 107 | {{ $message }} |
108 | </span> | 108 | </span> |
109 | @enderror | 109 | @enderror |
110 | </div> | 110 | </div> |
111 | </div> | 111 | </div> |
112 | 112 | ||
113 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 113 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
114 | <label class="form-group__label">Город посадки</label> | 114 | <label class="form-group__label">Город посадки</label> |
115 | <div class="form-group__item"> | 115 | <div class="form-group__item"> |
116 | <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $ad_employer->city ?? '' }}" placeholder="Севастополь"> | 116 | <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $ad_employer->city ?? '' }}" placeholder="Севастополь"> |
117 | @error('city') | 117 | @error('city') |
118 | <span class="text-xs text-red-600"> | 118 | <span class="text-xs text-red-600"> |
119 | {{ $message }} | 119 | {{ $message }} |
120 | </span> | 120 | </span> |
121 | @enderror | 121 | @enderror |
122 | </div> | 122 | </div> |
123 | </div> | 123 | </div> |
124 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style=""> | 124 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style=""> |
125 | <label class="form-group__label">Категория (локация)</label> | 125 | <label class="form-group__label">Категория (локация)</label> |
126 | <div class="form-group__item"> | 126 | <div class="form-group__item"> |
127 | <div class="select"> | 127 | <div class="select"> |
128 | <select class="js-select2" name="category_id" id="category_id"> | 128 | <select class="js-select2" name="category_id" id="category_id"> |
129 | php $i = 1 endphp | 129 | php $i = 1 endphp |
130 | if ($Positions->count()) | 130 | if ($Positions->count()) |
131 | foreach($Positions as $j) | 131 | foreach($Positions as $j) |
132 | if ($i == 1) <option> Выберите категорию из списка</option> | 132 | if ($i == 1) <option> Выберите категорию из списка</option> |
133 | else | 133 | else |
134 | <option value=" $j->id }}" if ($ad_employer->category_id == $j->id) selected endif>$j->name }}</option> | 134 | <option value=" $j->id }}" if ($ad_employer->category_id == $j->id) selected endif>$j->name }}</option> |
135 | endif | 135 | endif |
136 | php $i++ endphp | 136 | php $i++ endphp |
137 | endforeach | 137 | endforeach |
138 | endif | 138 | endif |
139 | </select> | 139 | </select> |
140 | error('category_id') | 140 | error('category_id') |
141 | <span class="text-xs text-red-600 dark:text-red-400"> | 141 | <span class="text-xs text-red-600 dark:text-red-400"> |
142 | $message }} | 142 | $message }} |
143 | </span> | 143 | </span> |
144 | enderror | 144 | enderror |
145 | </div> | 145 | </div> |
146 | </div> | 146 | </div> |
147 | </div>--> | 147 | </div>--> |
148 | 148 | ||
149 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 149 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
150 | <label class="form-group__label">Описание вакансии</label> | 150 | <label class="form-group__label">Описание вакансии</label> |
151 | <div class="form-group__item"> | 151 | <div class="form-group__item"> |
152 | <textarea class="textarea" name="text" id="text">{{ old('text') ?? $ad_employer->text ?? '' }}</textarea> | 152 | <textarea class="textarea ckeditor" name="text" id="text">{{ old('text') ?? $ad_employer->text ?? '' }}</textarea> |
153 | @error('text') | 153 | @error('text') |
154 | <span class="text-xs text-red-600"> | 154 | <span class="text-xs text-red-600"> |
155 | {{ $message }} | 155 | {{ $message }} |
156 | </span> | 156 | </span> |
157 | @enderror | 157 | @enderror |
158 | </div> | 158 | </div> |
159 | </div> | 159 | </div> |
160 | 160 | ||
161 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 161 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
162 | <h4 class="form-group__label">Редактирование должностей</h4> | 162 | <h4 class="form-group__label">Редактирование должностей</h4> |
163 | <div class="form-group__item"> | 163 | <div class="form-group__item"> |
164 | <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $ad_employer->id]) }}" class="button">Добавить</a> | 164 | <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $ad_employer->id]) }}" class="button">Добавить</a> |
165 | 165 | ||
166 | @if ($ad_employer->jobs->count()) | 166 | @if ($ad_employer->jobs->count()) |
167 | @foreach ($ad_employer->jobs as $key => $it_um) | 167 | @foreach ($ad_employer->jobs as $key => $it_um) |
168 | <p>@if (isset($ad_employer->jobs_code[$key])) | 168 | <p>@if (isset($ad_employer->jobs_code[$key])) |
169 | <a href="{{ route('employer.edit_job_in_vac', ['ad_job' => $ad_employer->jobs_code[$key]->id, 'ad_employer' => $ad_employer->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">{{$it_um->name}}</a> | 169 | <a href="{{ route('employer.edit_job_in_vac', ['ad_job' => $ad_employer->jobs_code[$key]->id, 'ad_employer' => $ad_employer->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">{{$it_um->name}}</a> |
170 | <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $ad_employer->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a> | 170 | <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $ad_employer->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a> |
171 | @endif | 171 | @endif |
172 | </p> | 172 | </p> |
173 | @endforeach | 173 | @endforeach |
174 | @else | 174 | @else |
175 | Нет связанных <br> с вакансией должностей | 175 | Нет связанных <br> с вакансией должностей |
176 | @endif | 176 | @endif |
177 | </div> | 177 | </div> |
178 | </div> | 178 | </div> |
179 | </div> | 179 | </div> |
180 | 180 | ||
181 | <a class="button cabinet__submit" href="{{ route('employer.vacancy_list') }}">Назад</a> | 181 | <a class="button cabinet__submit" href="{{ route('employer.vacancy_list') }}">Назад</a> |
182 | <button type="submit" class="button cabinet__submit">Опубликовать</button> | 182 | <button type="submit" class="button cabinet__submit">Опубликовать</button> |
183 | </div> | 183 | </div> |
184 | </form> | 184 | </form> |
185 | </div> | 185 | </div> |
186 | </div> | 186 | </div> |
187 | </section> | 187 | </section> |
188 | </div> | 188 | </div> |
189 | <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> | ||
190 | <script> | ||
191 | CKEDITOR.replace('text'); | ||
192 | //CKEDITOR.replace( 'text', { | ||
193 | // filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", | ||
194 | // filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", | ||
195 | // filebrowserUploadMethod: 'form' | ||
196 | // }); | ||
197 | </script> | ||
189 | @endsection | 198 | @endsection |
190 | 199 |
resources/views/employers/list_answer.blade.php
1 | @extends('layout.frontend', ['title' => 'Список откликов на вакансии - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Список откликов на вакансии - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script> | 4 | <script> |
5 | console.log('Test system'); | 5 | console.log('Test system'); |
6 | $(document).on('change', '#sort_ajax', function() { | 6 | $(document).on('change', '#sort_ajax', function() { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var val_ = this_.val(); | 8 | var val_ = this_.val(); |
9 | console.log('sort items '+val_); | 9 | console.log('sort items '+val_); |
10 | 10 | ||
11 | $.ajax({ | 11 | $.ajax({ |
12 | type: "GET", | 12 | type: "GET", |
13 | url: "{{ route('shipping_companies') }}", | 13 | url: "{{ route('shipping_companies') }}", |
14 | data: "sort="+val_+"&block=1", | 14 | data: "sort="+val_+"&block=1", |
15 | success: function (data) { | 15 | success: function (data) { |
16 | console.log('Выбор сортировки'); | 16 | console.log('Выбор сортировки'); |
17 | console.log(data); | 17 | console.log(data); |
18 | $('#block_1').html(data); | 18 | $('#block_1').html(data); |
19 | }, | 19 | }, |
20 | headers: { | 20 | headers: { |
21 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 21 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
22 | }, | 22 | }, |
23 | error: function (data) { | 23 | error: function (data) { |
24 | data = JSON.stringify(data); | 24 | data = JSON.stringify(data); |
25 | console.log('Error: ' + data); | 25 | console.log('Error: ' + data); |
26 | } | 26 | } |
27 | }); | 27 | }); |
28 | 28 | ||
29 | $.ajax({ | 29 | $.ajax({ |
30 | type: "GET", | 30 | type: "GET", |
31 | url: "{{ route('shipping_companies') }}", | 31 | url: "{{ route('shipping_companies') }}", |
32 | data: "sort="+val_+"&block=2", | 32 | data: "sort="+val_+"&block=2", |
33 | success: function (data) { | 33 | success: function (data) { |
34 | console.log('Выбор сортировки2'); | 34 | console.log('Выбор сортировки2'); |
35 | console.log(data); | 35 | console.log(data); |
36 | history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | 36 | history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); |
37 | $('#block_2').html(data); | 37 | $('#block_2').html(data); |
38 | }, | 38 | }, |
39 | headers: { | 39 | headers: { |
40 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 40 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
41 | }, | 41 | }, |
42 | error: function (data) { | 42 | error: function (data) { |
43 | data = JSON.stringify(data); | 43 | data = JSON.stringify(data); |
44 | console.log('Error: ' + data); | 44 | console.log('Error: ' + data); |
45 | } | 45 | } |
46 | }); | 46 | }); |
47 | }); | 47 | }); |
48 | </script> | 48 | </script> |
49 | @endsection | 49 | @endsection |
50 | 50 | ||
51 | @section('content') | 51 | @section('content') |
52 | <section class="cabinet"> | 52 | <section class="cabinet"> |
53 | <div class="container"> | 53 | <div class="container"> |
54 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 54 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
55 | <li><a href="{{ route('index') }}">Главная</a></li> | 55 | <li><a href="{{ route('index') }}">Главная</a></li> |
56 | <li><b>Личный кабинет</b></li> | 56 | <li><b>Личный кабинет</b></li> |
57 | </ul> | 57 | </ul> |
58 | <div class="cabinet__wrapper"> | 58 | <div class="cabinet__wrapper"> |
59 | <div class="cabinet__side"> | 59 | <div class="cabinet__side"> |
60 | <div class="cabinet__side-toper"> | 60 | <div class="cabinet__side-toper"> |
61 | 61 | ||
62 | @include('employers.emblema') | 62 | @include('employers.emblema') |
63 | 63 | ||
64 | </div> | 64 | </div> |
65 | 65 | ||
66 | @include('employers.menu', ['item' => 4]) | 66 | @include('employers.menu', ['item' => 4]) |
67 | </div> | 67 | </div> |
68 | <div class="cabinet__body"> | 68 | <div class="cabinet__body"> |
69 | <div class="cabinet__body-item"> | 69 | <div class="cabinet__body-item"> |
70 | <h2 class="title cabinet__title">Отклики на вакансию</h2> | 70 | <h2 class="title cabinet__title">Отклики на вакансию</h2> |
71 | </div> | 71 | </div> |
72 | <div class="cabinet__body-item"> | 72 | <div class="cabinet__body-item"> |
73 | <div class="cabinet__filters"> | 73 | <div class="cabinet__filters"> |
74 | <div class="cabinet__filters-item"> | 74 | <div class="cabinet__filters-item"> |
75 | <form class="search" action="{{ route('employer.answers', ['employer' => $employer->id]) }}" method="GET"> | 75 | <form class="search" action="{{ route('employer.answers', ['employer' => $employer->id]) }}" method="GET"> |
76 | <input type="search" class="input" name="search" id="search" placeholder="Поиск…" value="@isset($_GET['search']) {{ $_GET['search'] }} @endisset"> | 76 | <input type="search" class="input" name="search" id="search" placeholder="Поиск…" value="@isset($_GET['search']) {{ $_GET['search'] }} @endisset"> |
77 | <button type="submit" class="button">Найти</button> | 77 | <button type="submit" class="button">Найти</button> |
78 | <span> | 78 | <span> |
79 | <svg> | 79 | <svg> |
80 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> | 80 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> |
81 | </svg> | 81 | </svg> |
82 | </span> | 82 | </span> |
83 | </form> | 83 | </form> |
84 | </div> | 84 | </div> |
85 | <div class="cabinet__filters-item"> | 85 | <div class="cabinet__filters-item"> |
86 | <div class="select"> | 86 | <div class="select"> |
87 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> | 87 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> |
88 | <option value="default">Сортировка (по умолчанию)</option> | 88 | <option value="default">Сортировка (по умолчанию)</option> |
89 | <option value="name (asc)">По имени (возрастание)</option> | 89 | <option value="name (asc)">По имени (возрастание)</option> |
90 | <option value="name (desc)">По имени (убывание)</option> | 90 | <option value="name (desc)">По имени (убывание)</option> |
91 | <option value="created_at (asc)">По дате (возрастание)</option> | 91 | <option value="created_at (asc)">По дате (возрастание)</option> |
92 | <option value="created_at (desc)">По дате (убывание)</option> | 92 | <option value="created_at (desc)">По дате (убывание)</option> |
93 | </select> | 93 | </select> |
94 | </div> | 94 | </div> |
95 | <!--<div class="select"> | 95 | <!--<div class="select"> |
96 | <select class="js-select2"> | 96 | <select class="js-select2"> |
97 | <option>Фильтр по вакансиям</option> | 97 | <option>Фильтр по вакансиям</option> |
98 | <option>Вариант 1</option> | 98 | <option>Вариант 1</option> |
99 | <option>Вариант 2</option> | 99 | <option>Вариант 2</option> |
100 | <option>Вариант 3</option> | 100 | <option>Вариант 3</option> |
101 | </select> | 101 | </select> |
102 | </div>--> | 102 | </div>--> |
103 | </div> | 103 | </div> |
104 | </div> | 104 | </div> |
105 | <div class="responses"> | 105 | <div class="responses"> |
106 | <!--<button type="button" class="messages__button js-toggle js-parent-toggle button button_light button_more"> | 106 | <!--<button type="button" class="messages__button js-toggle js-parent-toggle button button_light button_more"> |
107 | <span>Показать ещё</span> | 107 | <span>Показать ещё</span> |
108 | <span>Скрыть</span> | 108 | <span>Скрыть</span> |
109 | </button>--> | 109 | </button>--> |
110 | <div class="responses__body"> | 110 | <div class="responses__body"> |
111 | @if ($answer->count()) | 111 | @if ($answer->count()) |
112 | @foreach ($answer as $it) | 112 | @foreach ($answer as $it) |
113 | @if ($it->response->count()) | 113 | @if ($it->response->count()) |
114 | @foreach($it->response as $el) | 114 | @foreach($it->response as $el) |
115 | <div class="responses__item"> | 115 | <div class="responses__item"> |
116 | <div class="responses__item-date">{{ $el->created_at }}</div> | 116 | <div class="responses__item-date">{{ $el->created_at }}</div> |
117 | <div class="responses__item-wrapper"> | 117 | <div class="responses__item-wrapper"> |
118 | <div class="responses__item-inner"> | 118 | <div class="responses__item-inner"> |
119 | <div class="responses__item-row"> | 119 | <div class="responses__item-row"> |
120 | <span>Название вакансии</span> | 120 | <span>Название вакансии</span> |
121 | {{ $it->name }} | 121 | {{ $it->name }} |
122 | </div> | 122 | </div> |
123 | <div class="responses__item-row"> | 123 | <div class="responses__item-row"> |
124 | <span>Имя кандидата</span> | 124 | <span>Имя кандидата</span> |
125 | @if (isset($el->message->user_from->name)) | 125 | @if (isset($el->message->user_from->name)) |
126 | {{ $el->message->user_from->name }} | 126 | {{ $el->message->user_from->name }} |
127 | @else | 127 | @else |
128 | Удален пользователь | 128 | Удален пользователь |
129 | @endif | 129 | @endif |
130 | </div> | 130 | </div> |
131 | <div class="responses__item-row"> | 131 | <div class="responses__item-row"> |
132 | <span>Статус</span> | 132 | <span>Статус</span> |
133 | @if ($el->flag == 1) | 133 | @if ($el->flag == 1) |
134 | Новое | 134 | Новое |
135 | @elseif ($el->flag == 2) | 135 | @elseif ($el->flag == 2) |
136 | Отклонить | 136 | Отклонить |
137 | @elseif ($el->flag == 3) | 137 | @elseif ($el->flag == 3) |
138 | Удержать | 138 | Удержать |
139 | @elseif ($el->flag ==4) | 139 | @elseif ($el->flag ==4) |
140 | Удалено | 140 | Удалено |
141 | @endif | 141 | @endif |
142 | </div> | 142 | </div> |
143 | </div> | 143 | </div> |
144 | <div class="responses__item-buttons"> | 144 | <div class="responses__item-buttons"> |
145 | <a href="{{ route('employer.status_msg', ['employer' => $employer->id,'ad_response' => $el->id, 'flag' => 1]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle supple-btn @if ($el->flag == 1) active @endif"> | 145 | <a href="{{ route('employer.status_msg', ['employer' => $employer->id,'ad_response' => $el->id, 'flag' => 1]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle supple-btn @if ($el->flag == 1) active @endif"> |
146 | <svg> | 146 | <svg> |
147 | <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use> | 147 | <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use> |
148 | </svg> | 148 | </svg> |
149 | Принят | 149 | Принят |
150 | </a> | 150 | </a> |
151 | <a href="{{ route('employer.status_msg', ['employer' => $employer->id, 'ad_response' => $el->id, 'flag' => 2]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle cancel-btn @if ($el->flag == 2) active @endif"> | 151 | <a href="{{ route('employer.status_msg', ['employer' => $employer->id, 'ad_response' => $el->id, 'flag' => 2]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle cancel-btn @if ($el->flag == 2) active @endif"> |
152 | <svg> | 152 | <svg> |
153 | <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> | 153 | <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> |
154 | </svg> | 154 | </svg> |
155 | Отклонить | 155 | Отклонить |
156 | </a> | 156 | </a> |
157 | <a href="{{ route('employer.status_msg', ['employer' => $employer->id, 'ad_response' => $el->id, 'flag' => 3]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle time-btn @if ($el->flag == 3) active @endif"> | 157 | <a href="{{ route('employer.status_msg', ['employer' => $employer->id, 'ad_response' => $el->id, 'flag' => 3]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle time-btn @if ($el->flag == 3) active @endif"> |
158 | <svg> | 158 | <svg> |
159 | <use xlink:href="{{ asset('images/sprite.svg#time') }}"></use> | 159 | <use xlink:href="{{ asset('images/sprite.svg#time') }}"></use> |
160 | </svg> | 160 | </svg> |
161 | Удержать | 161 | Удержать |
162 | </a> | 162 | </a> |
163 | <a href="{{ route('employer.status_msg', ['employer' => $employer->id, 'ad_response' => $el->id, 'flag' => 4]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle delete-btn @if ($el->flag == 4) active @endif"> | 163 | <a href="{{ route('employer.status_msg', ['employer' => $employer->id, 'ad_response' => $el->id, 'flag' => 4]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle delete-btn @if ($el->flag == 4) active @endif"> |
164 | <svg> | 164 | <svg> |
165 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> | 165 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> |
166 | </svg> | 166 | </svg> |
167 | Удалить | 167 | Удалить |
168 | </a> | 168 | </a> |
169 | </div> | 169 | </div> |
170 | </div> | 170 | </div> |
171 | </div> | 171 | </div> |
172 | @endforeach | 172 | @endforeach |
173 | |||
174 | <!-- $it->response->appends($_GET)->links('paginate') --> | ||
173 | @endif | 175 | @endif |
174 | @endforeach | 176 | @endforeach |
177 | |||
178 | |||
175 | @else | 179 | @else |
176 | <div class="notify"> | 180 | <div class="notify"> |
177 | <svg> | 181 | <svg> |
178 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> | 182 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> |
179 | </svg> | 183 | </svg> |
180 | <span>Вам еще никто не написал сообщений</span> | 184 | <span>Вам еще никто не написал сообщений</span> |
181 | </div> | 185 | </div> |
182 | @endif | 186 | @endif |
183 | </div> | 187 | </div> |
184 | </div> | 188 | </div> |
185 | </div> | 189 | </div> |
186 | </div> | 190 | </div> |
187 | 191 | ||
188 | </div> | 192 | </div> |
189 | </div> | 193 | </div> |
190 | </section> | 194 | </section> |
191 | </div> | 195 | </div> |
192 | @endsection | 196 | @endsection |
193 | 197 |
resources/views/employers/list_vacancy.blade.php
1 | @extends('layout.frontend', ['title' => 'Список вакансий - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Список вакансий - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script> | 4 | <script> |
5 | console.log('Test system'); | 5 | console.log('Test system'); |
6 | $(document).on('change', '#sort_ajax', function() { | 6 | $(document).on('change', '#sort_ajax', function() { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var val_ = this_.val(); | 8 | var val_ = this_.val(); |
9 | console.log('sort items '+val_); | 9 | console.log('sort items '+val_); |
10 | 10 | ||
11 | $.ajax({ | 11 | $.ajax({ |
12 | type: "GET", | 12 | type: "GET", |
13 | url: "{{ route('employer.vacancy_list') }}", | 13 | url: "{{ route('employer.vacancy_list') }}", |
14 | data: "sort="+val_, | 14 | data: "sort="+val_, |
15 | success: function (data) { | 15 | success: function (data) { |
16 | console.log('Выбор сортировки'); | 16 | console.log('Выбор сортировки'); |
17 | console.log(data); | 17 | console.log(data); |
18 | history.pushState({}, '', "{{ route('employer.vacancy_list') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | 18 | history.pushState({}, '', "{{ route('employer.vacancy_list') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); |
19 | $('#main_ockar').html(data); | 19 | $('#main_ockar').html(data); |
20 | }, | 20 | }, |
21 | headers: { | 21 | headers: { |
22 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 22 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
23 | }, | 23 | }, |
24 | error: function (data) { | 24 | error: function (data) { |
25 | data = JSON.stringify(data); | 25 | data = JSON.stringify(data); |
26 | console.log('Error: ' + data); | 26 | console.log('Error: ' + data); |
27 | } | 27 | } |
28 | }); | 28 | }); |
29 | }); | 29 | }); |
30 | </script> | 30 | </script> |
31 | @endsection | 31 | @endsection |
32 | 32 | ||
33 | @section('content') | 33 | @section('content') |
34 | <section class="cabinet"> | 34 | <section class="cabinet"> |
35 | <div class="container"> | 35 | <div class="container"> |
36 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 36 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
37 | <li><a href="{{ route('index') }}">Главная</a></li> | 37 | <li><a href="{{ route('index') }}">Главная</a></li> |
38 | <li><b>Личный кабинет</b></li> | 38 | <li><b>Личный кабинет</b></li> |
39 | </ul> | 39 | </ul> |
40 | <div class="cabinet__wrapper"> | 40 | <div class="cabinet__wrapper"> |
41 | <div class="cabinet__side"> | 41 | <div class="cabinet__side"> |
42 | <div class="cabinet__side-toper"> | 42 | <div class="cabinet__side-toper"> |
43 | 43 | ||
44 | @include('employers.emblema') | 44 | @include('employers.emblema') |
45 | 45 | ||
46 | </div> | 46 | </div> |
47 | 47 | ||
48 | @include('employers.menu', ['item' => 3]) | 48 | @include('employers.menu', ['item' => 3]) |
49 | </div> | 49 | </div> |
50 | <div class="cabinet__body"> | 50 | <div class="cabinet__body"> |
51 | <div class="cabinet__body-item"> | 51 | <div class="cabinet__body-item"> |
52 | <h2 class="title cabinet__title">Мои вакансии</h2> | 52 | <h2 class="title cabinet__title">Мои вакансии</h2> |
53 | </div> | 53 | </div> |
54 | <div class="cabinet__body-item"> | 54 | <div class="cabinet__body-item"> |
55 | <div class="cabinet__filters"> | 55 | <div class="cabinet__filters"> |
56 | <div class="cabinet__filters-item"> | 56 | <div class="cabinet__filters-item"> |
57 | <form class="search"> | 57 | <form class="search"> |
58 | <input type="search" class="input" placeholder="Поиск…" required> | 58 | <input type="search" class="input" placeholder="Поиск…" required> |
59 | <button type="submit" class="button">Найти</button> | 59 | <button type="submit" class="button">Найти</button> |
60 | <span> | 60 | <span> |
61 | <svg> | 61 | <svg> |
62 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> | 62 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> |
63 | </svg> | 63 | </svg> |
64 | </span> | 64 | </span> |
65 | </form> | 65 | </form> |
66 | </div> | 66 | </div> |
67 | <div class="cabinet__filters-item"> | 67 | <div class="cabinet__filters-item"> |
68 | <div class="select"> | 68 | <div class="select"> |
69 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> | 69 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> |
70 | <option value="default">Сортировка (по умолчанию)</option> | 70 | <option value="default">Сортировка (по умолчанию)</option> |
71 | <option value="name_up">По имени (возрастание)</option> | 71 | <option value="name_up">По имени (возрастание)</option> |
72 | <option value="name_down">По имени (убывание)</option> | 72 | <option value="name_down">По имени (убывание)</option> |
73 | <option value="created_at_up">По дате (возрастание)</option> | 73 | <option value="created_at_up">По дате (возрастание)</option> |
74 | <option value="created_at_down">По дате (убывание)</option> | 74 | <option value="created_at_down">По дате (убывание)</option> |
75 | </select> | 75 | </select> |
76 | </div> | 76 | </div> |
77 | </div> | 77 | </div> |
78 | </div> | 78 | </div> |
79 | 79 | ||
80 | <div class="table table_spoiler" id="main_ockar" name="main_oskar"> | 80 | <div class="table table_spoiler" id="main_ockar" name="main_oskar"> |
81 | @if ($vacancy_list->count()) | 81 | @if ($vacancy_list->count()) |
82 | <div class="table__scroll"> | 82 | <div class="table__scroll"> |
83 | <div class="table__body table__body_min-width"> | 83 | <div class="table__body table__body_min-width"> |
84 | <table> | 84 | <table> |
85 | <thead> | 85 | <thead> |
86 | <tr> | 86 | <tr> |
87 | <th>№</th> | 87 | <th>№</th> |
88 | <th>Название</th> | 88 | <th>Название</th> |
89 | <th>Дата добавления<br>/ обновления</th> | 89 | <th>Дата добавления<br>/ обновления</th> |
90 | <th>Должности</th> | 90 | <th style="display:none">Должности</th> |
91 | <th>Статус</th> | 91 | <th>Статус</th> |
92 | <th>Действия</th> | 92 | <th>Действия</th> |
93 | </tr> | 93 | </tr> |
94 | </thead> | 94 | </thead> |
95 | <tbody> | 95 | <tbody> |
96 | @foreach($vacancy_list as $it) | 96 | @foreach($vacancy_list as $it) |
97 | <tr> | 97 | <tr> |
98 | <td>{{ $it->id }}</td> | 98 | <td>{{ $it->id }}</td> |
99 | <td>{{ $it->name }}</td> | 99 | <td>{{ $it->name }}</td> |
100 | <td>{{ date('d.m.Y H:i:s', strtotime($it->created_at)) }} <br>/ {{ date('d.m.Y H:i:s', strtotime($it->updated_at)) }}</td> | 100 | <td>{{ date('d.m.Y H:i:s', strtotime($it->created_at)) }} <br>/ {{ date('d.m.Y H:i:s', strtotime($it->updated_at)) }}</td> |
101 | <td> <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $it->id]) }}" class="button">Добавить</a> | 101 | <td style="display:none"> <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $it->id]) }}" class="button">Добавить</a> |
102 | 102 | ||
103 | @if ($it->jobs->count()) | 103 | @if ($it->jobs->count()) |
104 | @foreach ($it->jobs as $key => $it_um) | 104 | @foreach ($it->jobs as $key => $it_um) |
105 | <p>@if (isset($it->jobs_code[$key])) | 105 | <p>@if (isset($it->jobs_code[$key])) |
106 | <a href="{{ route('employer.edit_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id, 'ad_employer' => $it->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">{{$it_um->name}}</a> | 106 | <a href="{{ route('employer.edit_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id, 'ad_employer' => $it->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">{{$it_um->name}}</a> |
107 | <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a> | 107 | <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a> |
108 | @endif | 108 | @endif |
109 | </p> | 109 | </p> |
110 | @endforeach | 110 | @endforeach |
111 | @else | 111 | @else |
112 | Нет связанных <br> с вакансией должностей | 112 | Нет связанных <br> с вакансией должностей |
113 | @endif | 113 | @endif |
114 | </td> | 114 | </td> |
115 | <td> | 115 | <td> |
116 | @if ($it->active_is) | 116 | @if ($it->active_is) |
117 | <span class="table__status green"><i></i>Опубликовано</span> | 117 | <span class="table__status green"><i></i>Опубликовано</span> |
118 | @else | 118 | @else |
119 | <span class="table__status"><i></i>Не опубликовано</span> | 119 | <span class="table__status"><i></i>Не опубликовано</span> |
120 | @endif | 120 | @endif |
121 | </td> | 121 | </td> |
122 | <td> | 122 | <td> |
123 | <span class="table__controls"> | 123 | <span class="table__controls"> |
124 | <a class="table__controls-item up-it" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}"> | 124 | <a class="table__controls-item up-it" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}"> |
125 | <svg> | 125 | <svg> |
126 | <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use> | 126 | <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use> |
127 | </svg> | 127 | </svg> |
128 | </a> | 128 | </a> |
129 | <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" class="table__controls-item"> | 129 | <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" class="table__controls-item"> |
130 | <svg> | 130 | <svg> |
131 | <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> | 131 | <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> |
132 | </svg> | 132 | </svg> |
133 | </a> | 133 | </a> |
134 | <a class="table__controls-item" href="{{ route('employer.vacancy_delete', ['ad_employer' => $it->id]) }}"> | 134 | <a class="table__controls-item" href="{{ route('employer.vacancy_delete', ['ad_employer' => $it->id]) }}"> |
135 | <svg> | 135 | <svg> |
136 | <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> | 136 | <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> |
137 | </svg> | 137 | </svg> |
138 | </a> | 138 | </a> |
139 | @if ($it->active_is) | 139 | @if ($it->active_is) |
140 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" class="table__controls-item"> | 140 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" class="table__controls-item"> |
141 | <svg> | 141 | <svg> |
142 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> | 142 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> |
143 | </svg> | 143 | </svg> |
144 | </a> | 144 | </a> |
145 | @else | 145 | @else |
146 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" class="table__controls-item"> | 146 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" class="table__controls-item"> |
147 | <svg> | 147 | <svg> |
148 | <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> | 148 | <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> |
149 | </svg> | 149 | </svg> |
150 | </a> | 150 | </a> |
151 | @endif | 151 | @endif |
152 | <!--<a class="btn_telegram_share table__controls-item" href="https://telegram.me/share/url?url=ВАШ_URL&text={{ $it->name }}"> | 152 | <!--<a class="btn_telegram_share table__controls-item" href="https://telegram.me/share/url?url=ВАШ_URL&text={{ $it->name }}"> |
153 | <svg> | 153 | <svg> |
154 | <use xlink:href=" asset('images/sprite.svg#arrow-radius') }}"></use> | 154 | <use xlink:href=" asset('images/sprite.svg#arrow-radius') }}"></use> |
155 | </svg> | 155 | </svg> |
156 | </a>--> | 156 | </a>--> |
157 | 157 | ||
158 | <!--<button type="button" class="table__controls-item"> | 158 | <!--<button type="button" class="table__controls-item"> |
159 | <svg> | 159 | <svg> |
160 | <use xlink:href=" asset('images/sprite.svg#tg') }}"></use> | 160 | <use xlink:href=" asset('images/sprite.svg#tg') }}"></use> |
161 | </svg> | 161 | </svg> |
162 | </button> | 162 | </button> |
163 | --> | 163 | --> |
164 | </span> | 164 | </span> |
165 | </td> | 165 | </td> |
166 | </tr> | 166 | </tr> |
167 | @endforeach | 167 | @endforeach |
168 | </tbody> | 168 | </tbody> |
169 | </table> | 169 | </table> |
170 | </div><br> | 170 | </div><br> |
171 | {{ $vacancy_list->appends($_GET)->links('paginate') }} | 171 | {{ $vacancy_list->appends($_GET)->links('paginate') }} |
172 | </div> | 172 | </div> |
173 | 173 | ||
174 | 174 | ||
175 | @else | 175 | @else |
176 | 176 | ||
177 | <div class="notify"> | 177 | <div class="notify"> |
178 | <svg> | 178 | <svg> |
179 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> | 179 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> |
180 | </svg> | 180 | </svg> |
181 | <span>Вы ещё не разместили ни одной вакансии</span> | 181 | <span>Вы ещё не разместили ни одной вакансии</span> |
182 | </div> | 182 | </div> |
183 | @endif | 183 | @endif |
184 | </div> | 184 | </div> |
185 | </div> | 185 | </div> |
186 | </div> | 186 | </div> |
187 | </div> | 187 | </div> |
188 | </div> | 188 | </div> |
189 | </section> | 189 | </section> |
190 | </div> | 190 | </div> |
191 | @endsection | 191 | @endsection |
192 | 192 |
resources/views/index.blade.php
1 | @extends('layout.frontend', ['title' => 'Главная страница РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Главная страница РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | 4 | ||
5 | @endsection | 5 | @endsection |
6 | 6 | ||
7 | @section('content') | 7 | @section('content') |
8 | @include('messages_error') | 8 | @include('messages_error') |
9 | <section class="work"> | 9 | <section class="work"> |
10 | <div class="container"> | 10 | <div class="container"> |
11 | <img src="{{ asset('images/1.png') }}" alt="" class="work__pic"> | 11 | <img src="{{ asset('images/1.png') }}" alt="" class="work__pic"> |
12 | <div class="work__body"> | 12 | <div class="work__body"> |
13 | <div class="work__title"> | 13 | <div class="work__title"> |
14 | <h4>Работа в море / | 14 | <h4>Работа в море / |
15 | <span class="br">Работа на реке</span></h4> | 15 | <span class="br">Работа на реке</span></h4> |
16 | </div> | 16 | </div> |
17 | <div class="work__text">Профессиональная сеть морского сообщества «RekaMore.su» приветствует вас — | 17 | <div class="work__text">Профессиональная сеть морского сообщества «RekaMore.su» приветствует вас — |
18 | тех, кто не представляет себе жизнь без моря, тех, кто готов связать свою жизнь с работой в | 18 | тех, кто не представляет себе жизнь без моря, тех, кто готов связать свою жизнь с работой в |
19 | сложных, но очень интересных условиях. </div> | 19 | сложных, но очень интересных условиях. </div> |
20 | <div class="work__list"> | 20 | <div class="work__list"> |
21 | <div>Тысячи соискателей увидят Ваше объявление</div> | 21 | <div>Тысячи соискателей увидят Ваше объявление</div> |
22 | <div>Десятки компаний выкладывают объявления каждый день</div> | 22 | <div>Десятки компаний выкладывают объявления каждый день</div> |
23 | </div> | 23 | </div> |
24 | <form class="search work__form" action="{{ route('search_vacancies') }}" method="GET"> | 24 | <form class="search work__form" action="{{ route('search_vacancies') }}" method="GET"> |
25 | <input type="search" id="search" name="search" class="input" placeholder="Желаемая должность" required> | 25 | <input type="search" id="search" name="search" class="input" placeholder="Желаемая должность" required> |
26 | <!--<div class="select select_search thing__select"> | ||
27 | <div class="select__icon"> | ||
28 | <svg> | ||
29 | <use xlink:href=" asset('images/sprite.svg#search') }}"></use> | ||
30 | </svg> | ||
31 | </div> | ||
32 | <select class="js-select2 jobs" id="search" name="search"> | ||
33 | <option value="0">Выберите должность</option> | ||
34 | if ($Job_title->count()) | ||
35 | foreach($Job_title as $JT) | ||
36 | <option value=" $JT->id }}" if ((isset($_GET['job'])) && ($_GET['job'] == $JT->id)) selected endif> $JT->name }}</option> | ||
37 | endforeach | ||
38 | endif | ||
39 | </select> | ||
40 | </div>--> | ||
26 | <button type="submit" class="button button_light">Посмотреть вакансии</button> | 41 | <button type="submit" class="button button_light">Посмотреть вакансии</button> |
27 | <span> | 42 | <span> |
28 | <svg> | 43 | <svg> |
29 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> | 44 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> |
30 | </svg> | 45 | </svg> |
31 | </span> | 46 | </span> |
32 | </form> | 47 | </form> |
33 | @guest | 48 | @guest |
34 | <a data-fancybox data-src="#question2" data-options='{"touch":false,"autoFocus":false}' class="button work__search">Я ищу сотрудника</a> | 49 | <a data-fancybox data-src="#question2" data-options='{"touch":false,"autoFocus":false}' class="button work__search">Я ищу сотрудника</a> |
35 | @else | 50 | @else |
36 | <a href="{{ route('bd_resume') }}" class="button work__search">Я ищу сотрудника</a> | 51 | <a href="{{ route('bd_resume') }}" class="button work__search">Я ищу сотрудника</a> |
37 | @endguest | 52 | @endguest |
38 | <div class="work__get"> | 53 | <div class="work__get"> |
39 | <b>Скачать приложение</b> | 54 | <b>Скачать приложение</b> |
40 | <a href=""> | 55 | <a href=""> |
41 | <img src="{{ asset('images/google.svg') }}" alt=""> | 56 | <img src="{{ asset('images/google.svg') }}" alt=""> |
42 | </a> | 57 | </a> |
43 | <a href=""> | 58 | <a href=""> |
44 | <img src="{{ asset('images/apple.svg') }}" alt=""> | 59 | <img src="{{ asset('images/apple.svg') }}" alt=""> |
45 | </a> | 60 | </a> |
46 | </div> | 61 | </div> |
47 | </div> | 62 | </div> |
48 | </div> | 63 | </div> |
49 | </section> | 64 | </section> |
50 | <section class="numbers"> | 65 | <section class="numbers"> |
51 | <div class="container"> | 66 | <div class="container"> |
52 | <div class="numbers__body"> | 67 | <div class="numbers__body"> |
53 | <div class="numbers__item"> | 68 | <div class="numbers__item"> |
54 | <b>500+</b> | 69 | <b>500+</b> |
55 | <span>Резюме</span> | 70 | <span>Резюме</span> |
56 | Банальные, но неопровержимые выводы, а также элементы политического процесса лишь добавляют | 71 | Банальные, но неопровержимые выводы, а также элементы политического процесса лишь добавляют |
57 | фракционных разногласий и призваны к ответу. | 72 | фракционных разногласий и призваны к ответу. |
58 | </div> | 73 | </div> |
59 | <div class="numbers__item"> | 74 | <div class="numbers__item"> |
60 | <b>1 000+</b> | 75 | <b>1 000+</b> |
61 | <span>Вакансий</span> | 76 | <span>Вакансий</span> |
62 | В рамках спецификации современных стандартов, диаграммы связей заблокированы в рамках своих | 77 | В рамках спецификации современных стандартов, диаграммы связей заблокированы в рамках своих |
63 | собственных рациональных ограничений. | 78 | собственных рациональных ограничений. |
64 | </div> | 79 | </div> |
65 | <div class="numbers__item"> | 80 | <div class="numbers__item"> |
66 | <b>265</b> | 81 | <b>265</b> |
67 | <span>Компаний</span> | 82 | <span>Компаний</span> |
68 | Но сторонники тоталитаризма в науке заблокированы в рамках своих собственных рациональных | 83 | Но сторонники тоталитаризма в науке заблокированы в рамках своих собственных рациональных |
69 | ограничений. | 84 | ограничений. |
70 | </div> | 85 | </div> |
71 | </div> | 86 | </div> |
72 | </div> | 87 | </div> |
73 | </section> | 88 | </section> |
74 | <!--<section class="vacancies"> | 89 | <!--<section class="vacancies"> |
75 | <div class="container"> | 90 | <div class="container"> |
76 | <div class="title"><h4>Новые вакансии</h4></div> | 91 | <div class="title"><h4>Новые вакансии</h4></div> |
77 | <div class="vacancies__body"> | 92 | <div class="vacancies__body"> |
78 | <a class="vacancies__more button button_light js-parent-toggle" href="{{ route('vacancies') }}">Все должности</a> | 93 | <a class="vacancies__more button button_light js-parent-toggle" href="{{ route('vacancies') }}">Все должности</a> |
79 | <div class="vacancies__list"> | 94 | <div class="vacancies__list"> |
80 | _if ($categories->count()) | 95 | _if ($categories->count()) |
81 | _foreach ($categories as $cat) | 96 | _foreach ($categories as $cat) |
82 | <a href=" route('list-vacancies', ['categories' => $cat->id]) }}" class="vacancies__item"> | 97 | <a href=" route('list-vacancies', ['categories' => $cat->id]) }}" class="vacancies__item"> |
83 | <span style="border-color:#F4C4C2"> | 98 | <span style="border-color:#F4C4C2"> |
84 | <b> $cat->name }}</b> | 99 | <b> $cat->name }}</b> |
85 | <i>Вакансий: <span> $cat->cnt }}</span></i> | 100 | <i>Вакансий: <span> $cat->cnt }}</span></i> |
86 | </span> | 101 | </span> |
87 | </a> | 102 | </a> |
88 | _endforeach | 103 | _endforeach |
89 | _else | 104 | _else |
90 | Тут пока нет никаких вакансий | 105 | Тут пока нет никаких вакансий |
91 | _endif | 106 | _endif |
92 | </div> | 107 | </div> |
93 | </div> | 108 | </div> |
94 | </div> | 109 | </div> |
95 | </section>--> | 110 | </section>--> |
96 | 111 | ||
97 | <main class="main"> | 112 | <main class="main"> |
98 | <div class="container"> | 113 | <div class="container"> |
99 | <div class="main__vacancies"> | 114 | <div class="main__vacancies"> |
100 | <h2 class="main__vacancies-title">Категории вакансий</h2> | 115 | <h2 class="main__vacancies-title">Категории вакансий</h2> |
101 | <div class="vacancies__body"> | 116 | <div class="vacancies__body"> |
102 | <div class="vacancies__list" id="block_ajax" name="block_ajax"> | 117 | <div class="vacancies__list" id="block_ajax" name="block_ajax"> |
103 | @foreach($Main_Job as $key => $it_main) | 118 | @foreach($Main_Job as $key => $it_main) |
104 | <div class="vacancies__list-col"> | 119 | <div class="vacancies__list-col"> |
105 | @include('block_real_new', ['it_main' => $it_main, 'category' => $key]) | 120 | @include('block_real_new', ['it_main' => $it_main, 'category' => $key]) |
106 | </div> | 121 | </div> |
107 | @endforeach | 122 | @endforeach |
108 | <!--_include('block_real', ['flot' => $flot, 'position' => $Position[$flot->position_id]])--> | 123 | <!--_include('block_real', ['flot' => $flot, 'position' => $Position[$flot->position_id]])--> |
109 | </div> | 124 | </div> |
110 | </div> | 125 | </div> |
111 | </div> | 126 | </div> |
112 | </div> | 127 | </div> |
113 | </main> | 128 | </main> |
114 | 129 | ||
115 | <section class="employer"> | 130 | <section class="employer"> |
116 | <div class="container"> | 131 | <div class="container"> |
117 | <div class="title"><h4>Работодатели</h4></div> | 132 | <div class="title"><h4>Работодатели</h4></div> |
118 | <div class="swiper js-employer-swiper"> | 133 | <div class="swiper js-employer-swiper"> |
119 | <div class="swiper-wrapper"> | 134 | <div class="swiper-wrapper"> |
120 | 135 | ||
121 | @if ($employers->count()) | 136 | @if ($employers->count()) |
122 | @php | 137 | @php |
123 | $rec = 0; | 138 | $rec = 0; |
124 | $count = $employers->count(); | 139 | $count = $employers->count(); |
125 | 140 | ||
126 | @endphp | 141 | @endphp |
127 | 142 | ||
128 | @foreach($employers as $emp) | 143 | @foreach($employers as $emp) |
129 | @php $rec++ @endphp | 144 | @php $rec++ @endphp |
130 | @if (($rec==1) || ($rec==5) || ($rec==9) || ($rec==13) || ($rec==17)) | 145 | @if (($rec==1) || ($rec==5) || ($rec==9) || ($rec==13) || ($rec==17)) |
131 | <div class="swiper-slide"> | 146 | <div class="swiper-slide"> |
132 | <div class="employer__item"> | 147 | <div class="employer__item"> |
133 | @endif | 148 | @endif |
134 | @if (!empty($emp->employer->logo)) | 149 | @if (!empty($emp->employer->logo)) |
135 | <a href="{{ route('ad-employer', ['ad_employer' => $emp->employer->id]) }}"> | 150 | <a href="{{ route('ad-employer', ['ad_employer' => $emp->employer->id]) }}"> |
136 | <img src="{{ asset(Storage::url($emp->employer->logo)) }}" alt="{{ $emp->employer->name_company }}"> | 151 | <img src="{{ asset(Storage::url($emp->employer->logo)) }}" alt="{{ $emp->employer->name_company }}"> |
137 | </a> | 152 | </a> |
138 | @else | 153 | @else |
139 | <a href="{{ route('ad-employer', ['ad_employer' => $emp->employer->id]) }}"> | 154 | <a href="{{ route('ad-employer', ['ad_employer' => $emp->employer->id]) }}"> |
140 | <img src="{{ asset('images/logo_emp.png') }}" alt="{{ $emp->employer->name_company }}"> | 155 | <img src="{{ asset('images/logo_emp.png') }}" alt="{{ $emp->employer->name_company }}"> |
141 | </a> | 156 | </a> |
142 | @endif | 157 | @endif |
143 | @if (($rec==4) || ($rec==8) || ($rec==12) || ($rec==16) || ($rec==20) || ($rec == $count)) | 158 | @if (($rec==4) || ($rec==8) || ($rec==12) || ($rec==16) || ($rec==20) || ($rec == $count)) |
144 | </div> | 159 | </div> |
145 | </div> | 160 | </div> |
146 | @endif | 161 | @endif |
147 | @endforeach | 162 | @endforeach |
148 | @else | 163 | @else |
149 | <h5>Тут нет никаких записей</h5> | 164 | <h5>Тут нет никаких записей</h5> |
150 | @endif | 165 | @endif |
151 | </div> | 166 | </div> |
152 | <div class="swiper-pagination"></div> | 167 | <div class="swiper-pagination"></div> |
153 | </div> | 168 | </div> |
154 | <a href="{{ route('shipping_companies') }}" class="employer__more button button_light">Все работодатели</a> | 169 | <a href="{{ route('shipping_companies') }}" class="employer__more button button_light">Все работодатели</a> |
155 | </div> | 170 | </div> |
156 | </section> | 171 | </section> |
157 | <section class="about"> | 172 | <section class="about"> |
158 | <div class="container"> | 173 | <div class="container"> |
159 | <div class="about__wrapper"> | 174 | <div class="about__wrapper"> |
160 | <div class="title about__title"><h4>О нас</h4></div> | 175 | <div class="title about__title"><h4>О нас</h4></div> |
161 | <div class="about__body"> | 176 | <div class="about__body"> |
162 | <div class="about__line"></div> | 177 | <div class="about__line"></div> |
163 | <div class="about__item"> | 178 | <div class="about__item"> |
164 | <b>Для работодателей</b> | 179 | <b>Для работодателей</b> |
165 | <span>Наш ресурс позволит Вам за демократичную цену найти нужных специалистов в кратчайшие | 180 | <span>Наш ресурс позволит Вам за демократичную цену найти нужных специалистов в кратчайшие |
166 | сроки, подробнее об условиях можно узнать <a href="{{ route('page', ['pages' => 'Stoimost-razmescheniya']) }}">здесь</a>.</span> | 181 | сроки, подробнее об условиях можно узнать <a href="{{ route('page', ['pages' => 'Stoimost-razmescheniya']) }}">здесь</a>.</span> |
167 | <a class="about__button button button_whited" style="text-decoration: none" href="{{ route('bd_resume') }}">Поиск сотрудников</a> | 182 | <a class="about__button button button_whited" style="text-decoration: none" href="{{ route('bd_resume') }}">Поиск сотрудников</a> |
168 | </div> | 183 | </div> |
169 | <div class="about__item"> | 184 | <div class="about__item"> |
170 | <b>Для сотрудников</b> | 185 | <b>Для сотрудников</b> |
171 | <span>Наше преимущество — это большой объем вакансий, более 70 судоходных компаний России и | 186 | <span>Наше преимущество — это большой объем вакансий, более 70 судоходных компаний России и |
172 | СНГ ищут сотрудников через наши ресурсы</span> | 187 | СНГ ищут сотрудников через наши ресурсы</span> |
173 | <a class="about__button button button_whited" style="text-decoration: none" href="{{ route('vacancies') }}">Ищу работу</a> | 188 | <a class="about__button button button_whited" style="text-decoration: none" href="{{ route('vacancies') }}">Ищу работу</a> |
174 | </div> | 189 | </div> |
175 | </div> | 190 | </div> |
176 | </div> | 191 | </div> |
177 | </div> | 192 | </div> |
178 | </section> | 193 | </section> |
179 | 194 | ||
180 | @if ($news->count()) | 195 | @if ($news->count()) |
181 | <section class="news"> | 196 | <section class="news"> |
182 | <div class="container"> | 197 | <div class="container"> |
183 | <div class="news__toper"> | 198 | <div class="news__toper"> |
184 | <div class="title"><h4>Новости и статьи</h4></div> | 199 | <div class="title"><h4>Новости и статьи</h4></div> |
185 | <div class="navs"> | 200 | <div class="navs"> |
186 | <button class="js-news-swiper-button-prev"> | 201 | <button class="js-news-swiper-button-prev"> |
187 | <svg class="rotate180"> | 202 | <svg class="rotate180"> |
188 | <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> | 203 | <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> |
189 | </svg> | 204 | </svg> |
190 | </button> | 205 | </button> |
191 | <button class="js-news-swiper-button-next"> | 206 | <button class="js-news-swiper-button-next"> |
192 | <svg> | 207 | <svg> |
193 | <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> | 208 | <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> |
194 | </svg> | 209 | </svg> |
195 | </button> | 210 | </button> |
196 | </div> | 211 | </div> |
197 | </div> | 212 | </div> |
198 | 213 | ||
199 | <div class="swiper js-news-swiper"> | 214 | <div class="swiper js-news-swiper"> |
200 | <div class="swiper-wrapper"> | 215 | <div class="swiper-wrapper"> |
201 | 216 | ||
202 | @foreach ($news as $new) | 217 | @foreach ($news as $new) |
203 | <div class="swiper-slide"> | 218 | <div class="swiper-slide"> |
204 | <div class="news__item"> | 219 | <div class="news__item"> |
205 | @if (empty($new->image)) | 220 | @if (empty($new->image)) |
206 | <img src="{{ asset('/images/default_ship.jpg') }}" alt="" class="news__item-pic"> | 221 | <img src="{{ asset('/images/default_ship.jpg') }}" alt="" class="news__item-pic"> |
207 | @else | 222 | @else |
208 | <img src="{{ asset(Storage::url($new->image)) }}" alt="" class="news__item-pic"> | 223 | <img src="{{ asset(Storage::url($new->image)) }}" alt="" class="news__item-pic"> |
209 | @endif | 224 | @endif |
210 | <div class="news__item-body"> | 225 | <div class="news__item-body"> |
211 | <time datetime="{{ date('d.m.Y H:i:s', strtotime($new->created_at)) }}" class="news__item-date">{{ date('d.m.Y H:i:s', strtotime($new->created_at)) }}</time> | 226 | <time datetime="{{ date('d.m.Y H:i:s', strtotime($new->created_at)) }}" class="news__item-date">{{ date('d.m.Y H:i:s', strtotime($new->created_at)) }}</time> |
212 | <span class="news__item-title">{{ $new->title }}</span> | 227 | <span class="news__item-title">{{ $new->title }}</span> |
213 | <span class="news__item-text">{!! mb_strimwidth($new->text, 0, 100) !!}</span> | 228 | <span class="news__item-text">{!! mb_strimwidth($new->text, 0, 100) !!}</span> |
214 | <a href="{{ route('detail_new', ['new' => $new->id]) }}" class="news__item-more button button_light">Читать далее</a> | 229 | <a href="{{ route('detail_new', ['new' => $new->id]) }}" class="news__item-more button button_light">Читать далее</a> |
215 | </div> | 230 | </div> |
216 | </div> | 231 | </div> |
217 | </div> | 232 | </div> |
218 | @endforeach | 233 | @endforeach |
219 | 234 | ||
220 | </div> | 235 | </div> |
221 | <div class="swiper-pagination"></div> | 236 | <div class="swiper-pagination"></div> |
222 | </div> | 237 | </div> |
223 | <a href="{{ route('news') }}" class="news__all button button_light">Все новости</a> | 238 | <a href="{{ route('news') }}" class="news__all button button_light">Все новости</a> |
224 | 239 | ||
225 | </div> | 240 | </div> |
226 | </section> | 241 | </section> |
227 | @endif | 242 | @endif |
228 | 243 | ||
229 | <section class="info"> | 244 | <section class="info"> |
230 | <div class="container"> | 245 | <div class="container"> |
231 | <img src="images/5.png" alt="" class="info__pic"> | 246 | <img src="images/5.png" alt="" class="info__pic"> |
232 | <div class="info__body"> | 247 | <div class="info__body"> |
233 | <div class="title info__title"><h4>Мы в социальных сетях</h4></div> | 248 | <div class="title info__title"><h4>Мы в социальных сетях</h4></div> |
234 | <div class="info__item"> | 249 | <div class="info__item"> |
235 | <div class="info__text">Телеграм — Подпишитесь на наш телеграм канал и получайте уведомления о | 250 | <div class="info__text">Телеграм — Подпишитесь на наш телеграм канал и получайте уведомления о |
236 | новых вакансиях прямо на свой смартфон</div> | 251 | новых вакансиях прямо на свой смартфон</div> |
237 | <a href="{{ $companies[0]->telegram }}" class="info__link" style="background:#20A0E1"> | 252 | <a href="{{ $companies[0]->telegram }}" class="info__link" style="background:#20A0E1"> |
238 | <svg> | 253 | <svg> |
239 | <use xlink:href="{{ asset('images/sprite.svg#tg') }}"></use> | 254 | <use xlink:href="{{ asset('images/sprite.svg#tg') }}"></use> |
240 | </svg> | 255 | </svg> |
241 | Телеграм | 256 | Телеграм |
242 | </a> | 257 | </a> |
243 | </div> | 258 | </div> |
244 | <div class="info__item"> | 259 | <div class="info__item"> |
245 | <div class="info__text">ВКонтакте — Лучшие вакансии за неделю выкладываем именно тут, информация | 260 | <div class="info__text">ВКонтакте — Лучшие вакансии за неделю выкладываем именно тут, информация |
246 | о судоходных компаниях, инструкции по работе с сайтом, конкурсы и многое другое</div> | 261 | о судоходных компаниях, инструкции по работе с сайтом, конкурсы и многое другое</div> |
247 | <a href="{{ $companies[0]->vkontact }}" class="info__link" style="background:#2787F5"> | 262 | <a href="{{ $companies[0]->vkontact }}" class="info__link" style="background:#2787F5"> |
248 | <svg> | 263 | <svg> |
249 | <use xlink:href="{{ asset('images/sprite.svg#vk') }}"></use> | 264 | <use xlink:href="{{ asset('images/sprite.svg#vk') }}"></use> |
250 | </svg> | 265 | </svg> |
251 | ВКонтакте | 266 | ВКонтакте |
252 | </a> | 267 | </a> |
253 | </div> | 268 | </div> |
254 | </div> | 269 | </div> |
255 | </div> | 270 | </div> |
256 | </section> | 271 | </section> |
257 | @endsection | 272 | @endsection |
258 | 273 |
resources/views/modals/send_worker_new.blade.php
1 | <script> | 1 | <script> |
2 | console.log('Сообщение работнику'); | 2 | console.log('Сообщение работнику'); |
3 | $("#form_worker" ).submit(function(event) { | 3 | $("#form_worker" ).submit(function(event) { |
4 | var val = $(this).val(); | 4 | var val = $(this).val(); |
5 | var send_title = $('#send_title'); | 5 | var send_title = $('#send_title'); |
6 | var send_title_val = send_title.val(); | 6 | var send_title_val = send_title.val(); |
7 | 7 | ||
8 | console.log('Click form.'); | 8 | console.log('Click form.'); |
9 | }); | 9 | }); |
10 | 10 | ||
11 | $(document).on('change', '#btn_send_file', function() { | 11 | $(document).on('change', '#btn_send_file', function() { |
12 | 12 | ||
13 | var send_name = $('#send_name'); | 13 | var send_name = $('#send_name'); |
14 | var send_name_val = send_name.val(); | 14 | var send_name_val = send_name.val(); |
15 | var send_name_file = $('#send_name_file'); | 15 | var send_name_file = $('#send_name_file'); |
16 | 16 | ||
17 | console.log(send_name_val); | 17 | console.log(send_name_val); |
18 | send_name_file.html(send_name_val); | 18 | send_name_file.html(send_name_val); |
19 | 19 | ||
20 | }); | 20 | }); |
21 | </script> | 21 | </script> |
22 | <div id="send" class="modal"> | 22 | <div id="send" class="modal"> |
23 | <div class="modal__body"> | 23 | <div class="modal__body"> |
24 | <div class="modal__title">Отправить сообщение работодателю</div> | 24 | <div class="modal__title">Отправить сообщение работодателю</div> |
25 | <div class="modal__text">Если вы готовы владеете компитентыми навыками, напишите данному работодателю письмо</div> | 25 | <div class="modal__text">Если вы готовы владеете компитентыми навыками, напишите данному работодателю письмо</div> |
26 | <form class="modal__form" id="form_worker" name="form_worker" enctype="multipart/form-data" action="{{ route('worker.new_message') }}" method="POST"> | 26 | <form class="modal__form" id="form_worker" name="form_worker" enctype="multipart/form-data" action="{{ route('worker.new_message') }}" method="POST"> |
27 | @csrf | 27 | @csrf |
28 | <div class="modal__form-item"> | 28 | <div class="modal__form-item"> |
29 | Отправитель сообщения: | 29 | Отправитель сообщения: |
30 | <input type="text" id="send_user_id" name="send_user_id" class="input" placeholder="user_id" value=""> | 30 | <input type="text" id="send_user_id" name="send_user_id" class="input" placeholder="user_id" value=""> |
31 | Получатель сообщения: | 31 | Получатель сообщения: |
32 | <input type="text" id="send_to_user_id" name="send_to_user_id" class="input" placeholder="to_user_id" value=""> | 32 | <input type="text" id="send_to_user_id" name="send_to_user_id" class="input" placeholder="to_user_id" value=""> |
33 | Вакансия: | 33 | Вакансия: |
34 | <input type="text" id="send_vacancy" name="send_vacancy" class="input" placeholder="vacancy" value=""> | 34 | <input type="text" id="send_vacancy" name="send_vacancy" class="input" placeholder="vacancy" value=""> |
35 | </div> | 35 | </div> |
36 | <div class="modal__form-item send_title_div error_"> | 36 | <div class="modal__form-item send_title_div error_"> |
37 | <input id="send_title" name="send_title" type="text" class="input" placeholder="Тема" required> | 37 | <input id="send_title" name="send_title" type="text" class="input" placeholder="Тема" required> |
38 | <label for="title">Не заполнено поле</label> | 38 | <label for="title">Не заполнено поле</label> |
39 | </div> | 39 | </div> |
40 | <div class="modal__form-item send_title_div error_"> | 40 | <!--<div class="modal__form-item send_title_div error_"> |
41 | <select class="js-select2" name="send_job_title_id" id="send_job_title_id"> | 41 | <select class="js-select2" name="send_job_title_id" id="send_job_title_id"> |
42 | @if ($jobs->count()) | 42 | if ($jobs->count()) |
43 | @foreach($jobs as $j) | 43 | foreach($jobs as $j) |
44 | <option value="{{ $j->id }}">{{ $j->name }} ({{ $j->id }})</option> | 44 | <option value=" $j->id }}"> $j->name }} ( $j->id }})</option> |
45 | @endforeach | 45 | endforeach |
46 | @endif | 46 | endif |
47 | </select> | 47 | </select> |
48 | <label for="title">Не заполнено поле</label> | 48 | <label for="title">Не заполнено поле</label> |
49 | </div> | 49 | </div>--> |
50 | <div class="modal__form-item send_text_div"> | 50 | <div class="modal__form-item send_text_div"> |
51 | <textarea id="i2" class="textarea" id="send_text" name="send_text" placeholder="Напишите текст с предложением о работе" required></textarea> | 51 | <textarea id="i2" class="textarea" id="send_text" name="send_text" placeholder="Напишите текст с предложением о работе" required></textarea> |
52 | <label for="i2">Не заполнено поле</label> | 52 | <label for="i2">Не заполнено поле</label> |
53 | </div> | 53 | </div> |
54 | <div class="modal__form-item"> | 54 | <div class="modal__form-item"> |
55 | <div class="file"> | 55 | <div class="file"> |
56 | <label class="file__input" id="btn_send_file" name="btn_send_file"> | 56 | <label class="file__input" id="btn_send_file" name="btn_send_file"> |
57 | <input type="file" name="send_file" id="send_name"> | 57 | <input type="file" name="send_file" id="send_name"> |
58 | <span class="button button_light"> | 58 | <span class="button button_light"> |
59 | <svg> | 59 | <svg> |
60 | <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use> | 60 | <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use> |
61 | </svg> | 61 | </svg> |
62 | Прикрепить файл-документ | 62 | Прикрепить файл-документ |
63 | </span> | 63 | </span> |
64 | </label> | 64 | </label> |
65 | 65 | ||
66 | <div class="file__list" id="div_file" name="div_file"> | 66 | <div class="file__list" id="div_file" name="div_file"> |
67 | <div class="file__list-item"> | 67 | <div class="file__list-item"> |
68 | <div class="file__list-item-left"> | 68 | <div class="file__list-item-left"> |
69 | <svg> | 69 | <svg> |
70 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | 70 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> |
71 | </svg> | 71 | </svg> |
72 | <span id="send_name_file" name="send_name_file"></span> | 72 | <span id="send_name_file" name="send_name_file"></span> |
73 | </div> | 73 | </div> |
74 | <button type="button" class="file__list-item-right js-parent-remove"> | 74 | <button type="button" class="file__list-item-right js-parent-remove"> |
75 | <svg> | 75 | <svg> |
76 | <use xlink:href="{{ asset('images/sprite.svg#cross-bold') }}"></use> | 76 | <use xlink:href="{{ asset('images/sprite.svg#cross-bold') }}"></use> |
77 | </svg> | 77 | </svg> |
78 | </button> | 78 | </button> |
79 | </div> | 79 | </div> |
80 | </div> | 80 | </div> |
81 | </div> | 81 | </div> |
82 | </div> | 82 | </div> |
83 | <div class="modal__form-item"> | 83 | <div class="modal__form-item"> |
84 | <button type="submit" id="submit_form_worker" name="submit_form_worker" class="button">Отправить</button> | 84 | <button type="submit" id="submit_form_worker" name="submit_form_worker" class="button">Отправить</button> |
85 | </div> | 85 | </div> |
86 | </form> | 86 | </form> |
87 | </div> | 87 | </div> |
88 | </div> | 88 | </div> |
89 | 89 | ||
90 | 90 |