Commit bbaa986c097d9b383906fa21fde033db3e0c1554
1 parent
6408200e47
Exists in
master
vacancy update and create popups
Showing 5 changed files with 34 additions and 29 deletions Inline Diff
app/Http/Controllers/EmployerController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Classes\Tools; | 6 | use App\Classes\Tools; |
7 | use App\Http\Requests\BaseUser_min_Request; | 7 | use App\Http\Requests\BaseUser_min_Request; |
8 | use App\Http\Requests\FlotRequest; | 8 | use App\Http\Requests\FlotRequest; |
9 | use App\Http\Requests\MessagesRequiest; | 9 | use App\Http\Requests\MessagesRequiest; |
10 | use App\Http\Requests\VacancyRequestEdit; | 10 | use App\Http\Requests\VacancyRequestEdit; |
11 | use App\Mail\MailCreateEmployer; | 11 | use App\Mail\MailCreateEmployer; |
12 | use App\Mail\MailSotrudnichestvo; | 12 | use App\Mail\MailSotrudnichestvo; |
13 | use App\Mail\MassSendingMessages; | 13 | use App\Mail\MassSendingMessages; |
14 | use App\Mail\SendAllMessages; | 14 | use App\Mail\SendAllMessages; |
15 | use App\Models\Ad_employer; | 15 | use App\Models\Ad_employer; |
16 | use App\Models\ad_response; | 16 | use App\Models\ad_response; |
17 | use App\Models\Category; | 17 | use App\Models\Category; |
18 | use App\Models\Chat; | 18 | use App\Models\Chat; |
19 | use App\Models\Employer; | 19 | use App\Models\Employer; |
20 | use App\Models\EmployerAutoliftOption; | 20 | use App\Models\EmployerAutoliftOption; |
21 | use App\Models\Flot; | 21 | use App\Models\Flot; |
22 | use App\Models\Job_title; | 22 | use App\Models\Job_title; |
23 | use App\Models\Like_worker; | 23 | use App\Models\Like_worker; |
24 | use App\Models\Message; | 24 | use App\Models\Message; |
25 | use App\Models\Worker; | 25 | use App\Models\Worker; |
26 | use App\Models\MessagesRequests; | 26 | use App\Models\MessagesRequests; |
27 | use Carbon\Carbon; | 27 | use Carbon\Carbon; |
28 | use Illuminate\Auth\Events\Registered; | 28 | use Illuminate\Auth\Events\Registered; |
29 | use Illuminate\Database\Eloquent\Builder; | 29 | use Illuminate\Database\Eloquent\Builder; |
30 | use Illuminate\Http\RedirectResponse; | 30 | use Illuminate\Http\RedirectResponse; |
31 | use Illuminate\Http\Request; | 31 | use Illuminate\Http\Request; |
32 | use Illuminate\Support\Facades\Auth; | 32 | use Illuminate\Support\Facades\Auth; |
33 | use Illuminate\Support\Facades\Hash; | 33 | use Illuminate\Support\Facades\Hash; |
34 | use Illuminate\Support\Facades\Log; | 34 | use Illuminate\Support\Facades\Log; |
35 | use Illuminate\Support\Facades\Mail; | 35 | use Illuminate\Support\Facades\Mail; |
36 | use Illuminate\Support\Facades\Storage; | 36 | use Illuminate\Support\Facades\Storage; |
37 | use App\Models\User as User_Model; | 37 | use App\Models\User as User_Model; |
38 | use Illuminate\Support\Facades\Validator; | 38 | use Illuminate\Support\Facades\Validator; |
39 | use App\Enums\DbExportColumns; | 39 | use App\Enums\DbExportColumns; |
40 | use Illuminate\View\View; | 40 | use Illuminate\View\View; |
41 | use JsonException; | 41 | use JsonException; |
42 | use Throwable; | 42 | use Throwable; |
43 | 43 | ||
44 | class EmployerController extends Controller | 44 | class EmployerController extends Controller |
45 | { | 45 | { |
46 | public function vacancie($vacancy, Request $request) { | 46 | public function vacancie($vacancy, Request $request) { |
47 | $title = 'Заголовок вакансии'; | 47 | $title = 'Заголовок вакансии'; |
48 | $Query = Ad_employer::with('jobs')-> | 48 | $Query = Ad_employer::with('jobs')-> |
49 | with('cat')-> | 49 | with('cat')-> |
50 | with('employer')-> | 50 | with('employer')-> |
51 | with('jobs_code')-> | 51 | with('jobs_code')-> |
52 | select('ad_employers.*')-> | 52 | select('ad_employers.*')-> |
53 | where('id', '=', $vacancy)->get(); | 53 | where('id', '=', $vacancy)->get(); |
54 | 54 | ||
55 | if ($Query[0]->active_is===0 || $Query[0]->is_remove!=0){ | 55 | if ($Query[0]->active_is===0 || $Query[0]->is_remove!=0){ |
56 | 56 | ||
57 | abort(404); | 57 | abort(404); |
58 | 58 | ||
59 | } | 59 | } |
60 | 60 | ||
61 | if (isset(Auth()->user()->id)) | 61 | if (isset(Auth()->user()->id)) |
62 | $uid = Auth()->user()->id; | 62 | $uid = Auth()->user()->id; |
63 | else | 63 | else |
64 | $uid = 0; | 64 | $uid = 0; |
65 | $title = $Query[0]->name; | 65 | $title = $Query[0]->name; |
66 | if ($request->ajax()) { | 66 | if ($request->ajax()) { |
67 | return view('ajax.vacance-item', compact('Query','uid')); | 67 | return view('ajax.vacance-item', compact('Query','uid')); |
68 | } else { | 68 | } else { |
69 | return view('vacance-item', compact('title', 'Query', 'uid')); | 69 | return view('vacance-item', compact('title', 'Query', 'uid')); |
70 | } | 70 | } |
71 | } | 71 | } |
72 | 72 | ||
73 | public function logout() { | 73 | public function logout() { |
74 | Auth::logout(); | 74 | Auth::logout(); |
75 | return redirect()->route('index') | 75 | return redirect()->route('index') |
76 | ->with('success', 'Вы вышли из личного кабинета'); | 76 | ->with('success', 'Вы вышли из личного кабинета'); |
77 | } | 77 | } |
78 | 78 | ||
79 | public function employer_info() { | 79 | public function employer_info() { |
80 | // код юзера | 80 | // код юзера |
81 | $user_info = Auth()->user(); | 81 | $user_info = Auth()->user(); |
82 | // вьюшка для вывода данных | 82 | // вьюшка для вывода данных |
83 | return view('employers.info', compact('user_info')); | 83 | return view('employers.info', compact('user_info')); |
84 | } | 84 | } |
85 | 85 | ||
86 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { | 86 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { |
87 | // Все данные через реквест | 87 | // Все данные через реквест |
88 | $all = $request->all(); | 88 | $all = $request->all(); |
89 | unset($all['_token']); | 89 | unset($all['_token']); |
90 | // обновление | 90 | // обновление |
91 | $user->update($all); | 91 | $user->update($all); |
92 | return redirect()->route('employer.employer_info'); | 92 | return redirect()->route('employer.employer_info'); |
93 | } | 93 | } |
94 | 94 | ||
95 | public function cabinet() { | 95 | public function cabinet() { |
96 | $id = Auth()->user()->id; | 96 | $id = Auth()->user()->id; |
97 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 97 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
98 | WhereHas('users', | 98 | WhereHas('users', |
99 | function (Builder $query) use ($id) {$query->Where('id', $id); | 99 | function (Builder $query) use ($id) {$query->Where('id', $id); |
100 | })->get(); | 100 | })->get(); |
101 | return view('employers.cabinet45', compact('Employer')); | 101 | return view('employers.cabinet45', compact('Employer')); |
102 | } | 102 | } |
103 | 103 | ||
104 | public function slider_flot() { | 104 | public function slider_flot() { |
105 | $id = Auth()->user()->id; | 105 | $id = Auth()->user()->id; |
106 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 106 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
107 | WhereHas('users', | 107 | WhereHas('users', |
108 | function (Builder $query) use ($id) {$query->Where('id', $id); | 108 | function (Builder $query) use ($id) {$query->Where('id', $id); |
109 | })->get(); | 109 | })->get(); |
110 | return view('employers.fly-flot', compact('Employer')); | 110 | return view('employers.fly-flot', compact('Employer')); |
111 | } | 111 | } |
112 | 112 | ||
113 | public function cabinet_save(Employer $Employer, Request $request) { | 113 | public function cabinet_save(Employer $Employer, Request $request) { |
114 | $params = $request->all(); | 114 | $params = $request->all(); |
115 | $params['user_id'] = Auth()->user()->id; | 115 | $params['user_id'] = Auth()->user()->id; |
116 | $id = $Employer->id; | 116 | $id = $Employer->id; |
117 | 117 | ||
118 | if ($request->has('logo')) { | 118 | if ($request->has('logo')) { |
119 | if (!empty($Employer->logo)) { | 119 | if (!empty($Employer->logo)) { |
120 | Storage::delete($Employer->logo); | 120 | Storage::delete($Employer->logo); |
121 | } | 121 | } |
122 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); | 122 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); |
123 | } | 123 | } |
124 | 124 | ||
125 | $Employer->update($params); | 125 | $Employer->update($params); |
126 | 126 | ||
127 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); | 127 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); |
128 | } | 128 | } |
129 | 129 | ||
130 | public function save_add_flot(FlotRequest $request) { | 130 | public function save_add_flot(FlotRequest $request) { |
131 | // отмена | 131 | // отмена |
132 | $params = $request->all(); | 132 | $params = $request->all(); |
133 | 133 | ||
134 | if ($request->has('image')) { | 134 | if ($request->has('image')) { |
135 | $params['image'] = $request->file('image')->store("flot", 'public'); | 135 | $params['image'] = $request->file('image')->store("flot", 'public'); |
136 | } | 136 | } |
137 | Flot::create($params); | 137 | Flot::create($params); |
138 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); | 138 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); |
139 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 139 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
140 | } | 140 | } |
141 | 141 | ||
142 | public function edit_flot(Flot $Flot, Employer $Employer) { | 142 | public function edit_flot(Flot $Flot, Employer $Employer) { |
143 | return view('employers.edit-flot', compact('Flot', 'Employer')); | 143 | return view('employers.edit-flot', compact('Flot', 'Employer')); |
144 | } | 144 | } |
145 | 145 | ||
146 | public function update_flot(FlotRequest $request, Flot $Flot) { | 146 | public function update_flot(FlotRequest $request, Flot $Flot) { |
147 | $params = $request->all(); | 147 | $params = $request->all(); |
148 | 148 | ||
149 | if ($request->has('image')) { | 149 | if ($request->has('image')) { |
150 | if (!empty($flot->image)) { | 150 | if (!empty($flot->image)) { |
151 | Storage::delete($flot->image); | 151 | Storage::delete($flot->image); |
152 | } | 152 | } |
153 | $params['image'] = $request->file('image')->store("flot", 'public'); | 153 | $params['image'] = $request->file('image')->store("flot", 'public'); |
154 | } else { | 154 | } else { |
155 | if (!empty($flot->image)) $params['image'] = $flot->image; | 155 | if (!empty($flot->image)) $params['image'] = $flot->image; |
156 | } | 156 | } |
157 | 157 | ||
158 | $Flot->update($params); | 158 | $Flot->update($params); |
159 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 159 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
160 | } | 160 | } |
161 | 161 | ||
162 | public function delete_flot(Flot $Flot) { | 162 | public function delete_flot(Flot $Flot) { |
163 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); | 163 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); |
164 | 164 | ||
165 | if (isset($Flot->id)) $Flot->delete(); | 165 | if (isset($Flot->id)) $Flot->delete(); |
166 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); | 166 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); |
167 | } | 167 | } |
168 | 168 | ||
169 | // Форма добавления вакансий | 169 | // Форма добавления вакансий |
170 | public function cabinet_vacancie() { | 170 | public function cabinet_vacancie() { |
171 | /** @var User_Model $user */ | 171 | /** @var User_Model $user */ |
172 | $user = Auth()->user(); | 172 | $user = Auth()->user(); |
173 | 173 | ||
174 | if ($user->is_public) { | 174 | if ($user->is_public) { |
175 | $categories = Category::query()->active()->get(); | 175 | $categories = Category::query()->active()->get(); |
176 | 176 | ||
177 | $jobs = Job_title::query() | 177 | $jobs = Job_title::query() |
178 | ->orderByDesc('sort') | 178 | ->orderByDesc('sort') |
179 | ->OrderBy('name') | 179 | ->OrderBy('name') |
180 | ->where('is_remove', '=', '0') | 180 | ->where('is_remove', '=', '0') |
181 | ->where('is_bd', '=', '0') | 181 | ->where('is_bd', '=', '0') |
182 | ->get(); | 182 | ->get(); |
183 | 183 | ||
184 | $Employer = Employer::query() | 184 | $Employer = Employer::query() |
185 | ->with(['users', 'ads', 'flots']) | 185 | ->with(['users', 'ads', 'flots']) |
186 | ->whereHas('users', fn (Builder $query) => $query->where('id', $user->id)) | 186 | ->whereHas('users', fn (Builder $query) => $query->where('id', $user->id)) |
187 | ->get(); | 187 | ->get(); |
188 | 188 | ||
189 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); | 189 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); |
190 | } | 190 | } |
191 | 191 | ||
192 | return redirect()->route('employer.cabinet_vacancie_danger'); | 192 | return redirect()->route('employer.cabinet_vacancie_danger'); |
193 | } | 193 | } |
194 | 194 | ||
195 | // Форма предупреждения об оплате | 195 | // Форма предупреждения об оплате |
196 | public function cabinet_vacancie_danger() { | 196 | public function cabinet_vacancie_danger() { |
197 | return view('employers.add_vacancy_danger'); | 197 | return view('employers.add_vacancy_danger'); |
198 | } | 198 | } |
199 | 199 | ||
200 | // Сохранение вакансии | 200 | // Сохранение вакансии |
201 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { | 201 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { |
202 | $params_emp = $request->all(); | 202 | $params_emp = $request->all(); |
203 | 203 | ||
204 | $params_job["job_title_id"] = $params_emp['job_title_id']; | 204 | $params_job["job_title_id"] = $params_emp['job_title_id']; |
205 | 205 | ||
206 | $ad_jobs = Ad_employer::create($params_emp); | 206 | $ad_jobs = Ad_employer::create($params_emp); |
207 | $ad_jobs->jobs()->sync($request->get('job_title_id')); | 207 | $ad_jobs->jobs()->sync($request->get('job_title_id')); |
208 | 208 | ||
209 | return redirect()->route('employer.vacancy_list')->with('success', 'Вакансия успешно опубликована'); | 209 | return redirect()->route('employer.vacancy_list')->with('success', 'Вакансия успешно опубликована'); |
210 | } | 210 | } |
211 | 211 | ||
212 | // Список вакансий | 212 | // Список вакансий |
213 | public function vacancy_list(Request $request) { | 213 | public function vacancy_list(Request $request) { |
214 | $id = Auth()->user()->id; | 214 | $id = Auth()->user()->id; |
215 | 215 | ||
216 | $Employer = Employer::query()->where('user_id', $id)->first(); | 216 | $Employer = Employer::query()->where('user_id', $id)->first(); |
217 | $vacancy_list = Ad_employer::query() | 217 | $vacancy_list = Ad_employer::query() |
218 | ->with('jobs') | 218 | ->with('jobs') |
219 | ->with('jobs_code') | 219 | ->with('jobs_code') |
220 | ->where('employer_id', $Employer->id) | 220 | ->where('employer_id', $Employer->id) |
221 | ->where('is_remove', 0) | 221 | ->where('is_remove', 0) |
222 | ->orderbyDesc('updated_at') | 222 | ->orderbyDesc('updated_at') |
223 | ; | 223 | ; |
224 | 224 | ||
225 | if (($request->has('search')) && (!empty($request->get('search')))) { | 225 | if (($request->has('search')) && (!empty($request->get('search')))) { |
226 | $search = $request->get('search'); | 226 | $search = $request->get('search'); |
227 | $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); | 227 | $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); |
228 | } | 228 | } |
229 | 229 | ||
230 | if ($request->get('sort')) { | 230 | if ($request->get('sort')) { |
231 | $sort = $request->get('sort'); | 231 | $sort = $request->get('sort'); |
232 | switch ($sort) { | 232 | switch ($sort) { |
233 | case 'nopublic': $vacancy_list->orderByDesc('updated_at') | 233 | case 'nopublic': $vacancy_list->orderByDesc('updated_at') |
234 | ->where('active_is', 0); | 234 | ->where('active_is', 0); |
235 | break; | 235 | break; |
236 | case 'public': $vacancy_list->orderByDesc('updated_at') | 236 | case 'public': $vacancy_list->orderByDesc('updated_at') |
237 | ->where('active_is',1); | 237 | ->where('active_is',1); |
238 | break; | 238 | break; |
239 | default: $vacancy_list->orderByDesc('updated_at'); | 239 | default: $vacancy_list->orderByDesc('updated_at'); |
240 | break; | 240 | break; |
241 | } | 241 | } |
242 | } else { | 242 | } else { |
243 | $vacancy_list = $vacancy_list->orderByDesc('updated_at')->orderBy('id'); | 243 | $vacancy_list = $vacancy_list->orderByDesc('updated_at')->orderBy('id'); |
244 | } | 244 | } |
245 | 245 | ||
246 | $vacancy_list = $vacancy_list->paginate(10); | 246 | $vacancy_list = $vacancy_list->paginate(10); |
247 | 247 | ||
248 | if ($request->ajax()) { | 248 | if ($request->ajax()) { |
249 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); | 249 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); |
250 | } else { | 250 | } else { |
251 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); | 251 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); |
252 | } | 252 | } |
253 | } | 253 | } |
254 | 254 | ||
255 | // Карточка вакансии | 255 | // Карточка вакансии |
256 | public function vacancy_edit(Ad_employer $ad_employer) { | 256 | public function vacancy_edit(Ad_employer $ad_employer) { |
257 | $id = Auth()->user()->id; | 257 | $id = Auth()->user()->id; |
258 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); | 258 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); |
259 | 259 | ||
260 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | 260 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
261 | where('is_remove', '=', '0')-> | 261 | where('is_remove', '=', '0')-> |
262 | where('is_bd', '=', '0')->get(); | 262 | where('is_bd', '=', '0')->get(); |
263 | 263 | ||
264 | $Employer = Employer::query()->with('users')->with('ads')-> | 264 | $Employer = Employer::query()->with('users')->with('ads')-> |
265 | with('flots')->where('user_id', $id)->first(); | 265 | with('flots')->where('user_id', $id)->first(); |
266 | 266 | ||
267 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); | 267 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); |
268 | } | 268 | } |
269 | 269 | ||
270 | // Сохранение-редактирование записи | 270 | // Сохранение-редактирование записи |
271 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { | 271 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { |
272 | $params = $request->all(); | 272 | $params = $request->all(); |
273 | 273 | ||
274 | $ad_employer->update($params); | 274 | $ad_employer->update($params); |
275 | $ad_employer->active_is = 1; | 275 | $ad_employer->active_is = 1; |
276 | $ad_employer->save(); | 276 | $ad_employer->save(); |
277 | $ad_employer->jobs()->sync($request->get('job_title_id')); | 277 | $ad_employer->jobs()->sync($request->get('job_title_id')); |
278 | 278 | ||
279 | $id = Auth()->user()->id; | 279 | $id = Auth()->user()->id; |
280 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); | 280 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); |
281 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name') | 281 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name') |
282 | ->where('is_remove', '=', '0') | 282 | ->where('is_remove', '=', '0') |
283 | ->where('is_bd', '=', '0') | 283 | ->where('is_bd', '=', '0') |
284 | ->get(); | 284 | ->get(); |
285 | 285 | ||
286 | $Employer = Employer::query() | 286 | $Employer = Employer::query() |
287 | ->with('users')->with('ads')->with('flots')->where('user_id', $id)->first(); | 287 | ->with('users')->with('ads')->with('flots')->where('user_id', $id)->first(); |
288 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); | 288 | |
289 | return redirect()->back()->with('success', 'Вакансия успешно сохранена и опубликована'); | ||
289 | } | 290 | } |
290 | 291 | ||
291 | // Сохранение карточки вакансии | 292 | // Сохранение карточки вакансии |
292 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { | 293 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { |
293 | $all = $request->all(); | 294 | $all = $request->all(); |
294 | $ad_employer->update($all); | 295 | $ad_employer->update($all); |
295 | return redirect()->route('employer.cabinet_vacancie'); | 296 | return redirect()->route('employer.cabinet_vacancie'); |
296 | } | 297 | } |
297 | 298 | ||
298 | // Удаление карточки вакансии | 299 | // Удаление карточки вакансии |
299 | public function vacancy_delete(Ad_employer $ad_employer) { | 300 | public function vacancy_delete(Ad_employer $ad_employer) { |
300 | $ad_employer->delete(); | 301 | $ad_employer->delete(); |
301 | 302 | ||
302 | return redirect()->route('employer.vacancy_list') | 303 | return redirect()->route('employer.vacancy_list') |
303 | ->with('success', 'Данные были успешно сохранены'); | 304 | ->with('success', 'Данные были успешно сохранены'); |
304 | } | 305 | } |
305 | 306 | ||
306 | // Обновление даты | 307 | // Обновление даты |
307 | public function vacancy_up(Ad_employer $ad_employer) { | 308 | public function vacancy_up(Ad_employer $ad_employer) { |
308 | $up = date('m/d/Y h:i:s', time()); | 309 | $up = date('m/d/Y h:i:s', time()); |
309 | $ad_employer->updated_at = $up; | 310 | $ad_employer->updated_at = $up; |
310 | $ad_employer->save(); | 311 | $ad_employer->save(); |
311 | 312 | ||
312 | return redirect()->back(); | 313 | return redirect()->back(); |
313 | } | 314 | } |
314 | 315 | ||
315 | //Видимость вакансии | 316 | //Видимость вакансии |
316 | public function vacancy_eye(Ad_employer $ad_employer, $status) { | 317 | public function vacancy_eye(Ad_employer $ad_employer, $status) { |
317 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 318 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
318 | $vac_emp->active_is = $status; | 319 | $vac_emp->active_is = $status; |
319 | $vac_emp->save(); | 320 | $vac_emp->save(); |
320 | 321 | ||
321 | return redirect()->route('employer.vacancy_list'); | 322 | return redirect()->route('employer.vacancy_list'); |
322 | } | 323 | } |
323 | 324 | ||
324 | //Вакансия редактирования (шаблон) | 325 | //Вакансия редактирования (шаблон) |
325 | public function vacancy_update(Ad_employer $id) { | 326 | public function vacancy_update(Ad_employer $id) { |
326 | 327 | ||
327 | } | 328 | } |
328 | 329 | ||
329 | //Отклики на вакансию - лист | 330 | //Отклики на вакансию - лист |
330 | public function answers(Employer $employer, Request $request) { | 331 | public function answers(Employer $employer, Request $request) { |
331 | $user_id = Auth()->user()->id; | 332 | $user_id = Auth()->user()->id; |
332 | $answer = Ad_employer::query()->where('employer_id', $employer->id); | 333 | $answer = Ad_employer::query()->where('employer_id', $employer->id); |
333 | if ($request->has('search')) { | 334 | if ($request->has('search')) { |
334 | $search = trim($request->get('search')); | 335 | $search = trim($request->get('search')); |
335 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); | 336 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); |
336 | } | 337 | } |
337 | 338 | ||
338 | $answer = $answer->with('response')->OrderByDESC('id')->get(); | 339 | $answer = $answer->with('response')->OrderByDESC('id')->get(); |
339 | 340 | ||
340 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); | 341 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); |
341 | } | 342 | } |
342 | 343 | ||
343 | //Обновление статуса | 344 | //Обновление статуса |
344 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { | 345 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { |
345 | $ad_response->update(Array('flag' => $flag)); | 346 | $ad_response->update(Array('flag' => $flag)); |
346 | return redirect()->route('employer.answers', ['employer' => $employer->id]); | 347 | return redirect()->route('employer.answers', ['employer' => $employer->id]); |
347 | } | 348 | } |
348 | 349 | ||
349 | //Страницы сообщений список | 350 | //Страницы сообщений список |
350 | public function messages($type_message) { | 351 | public function messages($type_message) { |
351 | $user_id = Auth()->user()->id; | 352 | $user_id = Auth()->user()->id; |
352 | 353 | ||
353 | $chats = Chat::get_user_chats($user_id); | 354 | $chats = Chat::get_user_chats($user_id); |
354 | $user_type = 'employer'; | 355 | $user_type = 'employer'; |
355 | $admin_chat = false; | 356 | $admin_chat = false; |
356 | 357 | ||
357 | return view('employers.messages', compact('chats', 'admin_chat', 'user_id', 'user_type')); | 358 | return view('employers.messages', compact('chats', 'admin_chat', 'user_id', 'user_type')); |
358 | } | 359 | } |
359 | 360 | ||
360 | // Диалог между пользователями | 361 | // Диалог между пользователями |
361 | public function dialog(Chat $chat, Request $request) { | 362 | public function dialog(Chat $chat, Request $request) { |
362 | // Получение параметров. | 363 | // Получение параметров. |
363 | if ($request->has('ad_employer')){ | 364 | if ($request->has('ad_employer')){ |
364 | $ad_employer = $request->get('ad_employer'); | 365 | $ad_employer = $request->get('ad_employer'); |
365 | } else { | 366 | } else { |
366 | $ad_employer = 0; | 367 | $ad_employer = 0; |
367 | } | 368 | } |
368 | 369 | ||
369 | $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first(); | 370 | $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first(); |
370 | $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first(); | 371 | $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first(); |
371 | 372 | ||
372 | $Messages = Chat::get_chat_messages($chat); | 373 | $Messages = Chat::get_chat_messages($chat); |
373 | 374 | ||
374 | Message::where('user_id', '=', $chat->to_user_id)->where('to_user_id', '=', $chat->user_id)->update(['flag_new' => 0]); | 375 | Message::where('user_id', '=', $chat->to_user_id)->where('to_user_id', '=', $chat->user_id)->update(['flag_new' => 0]); |
375 | 376 | ||
376 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); | 377 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); |
377 | } | 378 | } |
378 | 379 | ||
379 | public function pin_chat(Request $request){ | 380 | public function pin_chat(Request $request){ |
380 | $chat_id = $request->get('id'); | 381 | $chat_id = $request->get('id'); |
381 | $is_fixed = $request->get('is_fixed'); | 382 | $is_fixed = $request->get('is_fixed'); |
382 | 383 | ||
383 | Chat::pin_chat($chat_id, $is_fixed); | 384 | Chat::pin_chat($chat_id, $is_fixed); |
384 | } | 385 | } |
385 | 386 | ||
386 | public function remove_chat(Request $request){ | 387 | public function remove_chat(Request $request){ |
387 | $chat_id = $request->get('id'); | 388 | $chat_id = $request->get('id'); |
388 | Chat::remove_chat($chat_id); | 389 | Chat::remove_chat($chat_id); |
389 | } | 390 | } |
390 | 391 | ||
391 | // Регистрация работодателя | 392 | // Регистрация работодателя |
392 | public function register_employer(Request $request) { | 393 | public function register_employer(Request $request) { |
393 | $params = $request->all(); | 394 | $params = $request->all(); |
394 | 395 | ||
395 | $rules = [ | 396 | $rules = [ |
396 | //'surname' => ['required', 'string', 'max:255'], | 397 | //'surname' => ['required', 'string', 'max:255'], |
397 | //'name_man' => ['required', 'string', 'max:255'], | 398 | //'name_man' => ['required', 'string', 'max:255'], |
398 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], | 399 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], |
399 | 'name_company' => ['required', 'string', 'max:255'], | 400 | 'name_company' => ['required', 'string', 'max:255'], |
400 | 'password' => ['required', 'string', 'min:6'], | 401 | 'password' => ['required', 'string', 'min:6'], |
401 | ]; | 402 | ]; |
402 | 403 | ||
403 | $messages = [ | 404 | $messages = [ |
404 | 'required' => 'Укажите обязательное поле', | 405 | 'required' => 'Укажите обязательное поле', |
405 | 'min' => [ | 406 | 'min' => [ |
406 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 407 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
407 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 408 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
408 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 409 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
409 | ], | 410 | ], |
410 | 'max' => [ | 411 | 'max' => [ |
411 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 412 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
412 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 413 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
413 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 414 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
414 | ] | 415 | ] |
415 | ]; | 416 | ]; |
416 | 417 | ||
417 | $email = $request->get('email'); | 418 | $email = $request->get('email'); |
418 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | 419 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { |
419 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | 420 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); |
420 | } | 421 | } |
421 | 422 | ||
422 | if ($request->get('password') !== $request->get('confirmed')){ | 423 | if ($request->get('password') !== $request->get('confirmed')){ |
423 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | 424 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); |
424 | } | 425 | } |
425 | 426 | ||
426 | if (strlen($request->get('password')) < 6) { | 427 | if (strlen($request->get('password')) < 6) { |
427 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | 428 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); |
428 | } | 429 | } |
429 | 430 | ||
430 | if (empty($request->get('surname'))) { | 431 | if (empty($request->get('surname'))) { |
431 | $params['surname'] = 'Неизвестно'; | 432 | $params['surname'] = 'Неизвестно'; |
432 | } | 433 | } |
433 | if (empty($request->get('name_man'))) { | 434 | if (empty($request->get('name_man'))) { |
434 | $params['name_man'] = 'Неизвестно'; | 435 | $params['name_man'] = 'Неизвестно'; |
435 | } | 436 | } |
436 | $validator = Validator::make($params, $rules, $messages); | 437 | $validator = Validator::make($params, $rules, $messages); |
437 | 438 | ||
438 | if ($validator->fails()) { | 439 | if ($validator->fails()) { |
439 | return json_encode(Array("ERROR" => "Error: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | 440 | return json_encode(Array("ERROR" => "Error: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); |
440 | } else { | 441 | } else { |
441 | $user = $this->create($params); | 442 | $user = $this->create($params); |
442 | event(new Registered($user)); | 443 | event(new Registered($user)); |
443 | 444 | ||
444 | try { | 445 | try { |
445 | Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params)); | 446 | Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params)); |
446 | } catch (Throwable $e) { | 447 | } catch (Throwable $e) { |
447 | Log::error($e); | 448 | Log::error($e); |
448 | } | 449 | } |
449 | 450 | ||
450 | Auth::guard()->login($user); | 451 | Auth::guard()->login($user); |
451 | } | 452 | } |
452 | 453 | ||
453 | if ($user) { | 454 | if ($user) { |
454 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; | 455 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; |
455 | } else { | 456 | } else { |
456 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | 457 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); |
457 | } | 458 | } |
458 | } | 459 | } |
459 | 460 | ||
460 | // Создание пользователя | 461 | // Создание пользователя |
461 | protected function create(array $data) | 462 | protected function create(array $data) |
462 | { | 463 | { |
463 | $Use = new User_Model(); | 464 | $Use = new User_Model(); |
464 | $Code_user = $Use->create([ | 465 | $Code_user = $Use->create([ |
465 | 'name' => $data['surname']." ".$data['name_man'], | 466 | 'name' => $data['surname']." ".$data['name_man'], |
466 | 'name_man' => $data['name_man'], | 467 | 'name_man' => $data['name_man'], |
467 | 'surname' => $data['surname'], | 468 | 'surname' => $data['surname'], |
468 | 'surname2' => $data['surname2'], | 469 | 'surname2' => $data['surname2'], |
469 | 'subscribe_email' => $data['email'], | 470 | 'subscribe_email' => $data['email'], |
470 | 'email' => $data['email'], | 471 | 'email' => $data['email'], |
471 | 'telephone' => $data['telephone'], | 472 | 'telephone' => $data['telephone'], |
472 | 'is_worker' => 0, | 473 | 'is_worker' => 0, |
473 | 'password' => Hash::make($data['password']), | 474 | 'password' => Hash::make($data['password']), |
474 | 'pubpassword' => base64_encode($data['password']), | 475 | 'pubpassword' => base64_encode($data['password']), |
475 | 'email_verified_at' => Carbon::now() | 476 | 'email_verified_at' => Carbon::now() |
476 | ]); | 477 | ]); |
477 | 478 | ||
478 | if ($Code_user->id > 0) { | 479 | if ($Code_user->id > 0) { |
479 | $Employer = new Employer(); | 480 | $Employer = new Employer(); |
480 | $Employer->user_id = $Code_user->id; | 481 | $Employer->user_id = $Code_user->id; |
481 | $Employer->name_company = $data['name_company']; | 482 | $Employer->name_company = $data['name_company']; |
482 | $Employer->email = $data['email']; | 483 | $Employer->email = $data['email']; |
483 | $Employer->telephone = $data['telephone']; | 484 | $Employer->telephone = $data['telephone']; |
484 | $Employer->code = Tools::generator_id(10); | 485 | $Employer->code = Tools::generator_id(10); |
485 | $Employer->save(); | 486 | $Employer->save(); |
486 | 487 | ||
487 | return $Code_user; | 488 | return $Code_user; |
488 | } | 489 | } |
489 | } | 490 | } |
490 | 491 | ||
491 | // Отправка сообщения от работодателя | 492 | // Отправка сообщения от работодателя |
492 | public function send_message(MessagesRequiest $request) { | 493 | public function send_message(MessagesRequiest $request) { |
493 | $params = $request->all(); | 494 | $params = $request->all(); |
494 | dd($params); | 495 | dd($params); |
495 | $user1 = $params['user_id']; | 496 | $user1 = $params['user_id']; |
496 | $user2 = $params['to_user_id']; | 497 | $user2 = $params['to_user_id']; |
497 | 498 | ||
498 | if ($request->has('file')) { | 499 | if ($request->has('file')) { |
499 | $params['file'] = $request->file('file')->store("messages", 'public'); | 500 | $params['file'] = $request->file('file')->store("messages", 'public'); |
500 | } | 501 | } |
501 | Message::create($params); | 502 | Message::create($params); |
502 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 503 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
503 | } | 504 | } |
504 | 505 | ||
505 | public function test123(Request $request) { | 506 | public function test123(Request $request) { |
506 | $params = $request->all(); | 507 | $params = $request->all(); |
507 | $user1 = $params['user_id']; | 508 | $user1 = $params['user_id']; |
508 | $user2 = $params['to_user_id']; | 509 | $user2 = $params['to_user_id']; |
509 | 510 | ||
510 | $rules = [ | 511 | $rules = [ |
511 | 'text' => 'nullable|required_without:file|min:1|max:150000', | 512 | 'text' => 'nullable|required_without:file|min:1|max:150000', |
512 | 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' | 513 | 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' |
513 | ]; | 514 | ]; |
514 | $messages = [ | 515 | $messages = [ |
515 | 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', | 516 | 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', |
516 | 'min' => [ | 517 | 'min' => [ |
517 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 518 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
518 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 519 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
519 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 520 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
520 | ], | 521 | ], |
521 | 'max' => [ | 522 | 'max' => [ |
522 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 523 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
523 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 524 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
524 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 525 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
525 | ] | 526 | ] |
526 | ]; | 527 | ]; |
527 | 528 | ||
528 | $validator = Validator::make($request->all(), $rules, $messages); | 529 | $validator = Validator::make($request->all(), $rules, $messages); |
529 | 530 | ||
530 | if ($validator->fails()) { | 531 | if ($validator->fails()) { |
531 | return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); | 532 | return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); |
532 | } | 533 | } |
533 | 534 | ||
534 | $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); | 535 | $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); |
535 | return redirect()->route('employer.dialog', ['chat' => $new_message->chat_id_from]); | 536 | return redirect()->route('employer.dialog', ['chat' => $new_message->chat_id_from]); |
536 | 537 | ||
537 | } | 538 | } |
538 | 539 | ||
539 | //Избранные люди | 540 | //Избранные люди |
540 | public function favorites(Request $request) | 541 | public function favorites(Request $request) |
541 | { | 542 | { |
542 | $likedWorkersIds = Like_worker::query() | 543 | $likedWorkersIds = Like_worker::query() |
543 | ->where('user_id', Auth::user()->id) | 544 | ->where('user_id', Auth::user()->id) |
544 | ->get() | 545 | ->get() |
545 | ->pluck('code_record') | 546 | ->pluck('code_record') |
546 | ->toArray(); | 547 | ->toArray(); |
547 | 548 | ||
548 | $workerBuilder = Worker::query() | 549 | $workerBuilder = Worker::query() |
549 | ->whereIn('id', $likedWorkersIds); | 550 | ->whereIn('id', $likedWorkersIds); |
550 | 551 | ||
551 | if (($request->has('search')) && (!empty($request->get('search')))) { | 552 | if (($request->has('search')) && (!empty($request->get('search')))) { |
552 | $search = $request->get('search'); | 553 | $search = $request->get('search'); |
553 | 554 | ||
554 | $workerBuilder->whereHas('users', function (Builder $query) use ($search) { | 555 | $workerBuilder->whereHas('users', function (Builder $query) use ($search) { |
555 | $query->where('surname', 'LIKE', "%$search%") | 556 | $query->where('surname', 'LIKE', "%$search%") |
556 | ->orWhere('name_man', 'LIKE', "%$search%") | 557 | ->orWhere('name_man', 'LIKE', "%$search%") |
557 | ->orWhere('surname2', 'LIKE', "%$search%"); | 558 | ->orWhere('surname2', 'LIKE', "%$search%"); |
558 | }); | 559 | }); |
559 | } | 560 | } |
560 | 561 | ||
561 | $Workers = $workerBuilder->get(); | 562 | $Workers = $workerBuilder->get(); |
562 | 563 | ||
563 | return view('employers.favorite', compact('Workers')); | 564 | return view('employers.favorite', compact('Workers')); |
564 | } | 565 | } |
565 | 566 | ||
566 | // База данных | 567 | // База данных |
567 | public function bd(Request $request) { | 568 | public function bd(Request $request) { |
568 | $users = User_Model::query()->with('workers')->with('jobtitles'); | 569 | $users = User_Model::query()->with('workers')->with('jobtitles'); |
569 | 570 | ||
570 | if ($request->has('search')) { | 571 | if ($request->has('search')) { |
571 | $find_key = $request->get('search'); | 572 | $find_key = $request->get('search'); |
572 | $users = $users->where('name', 'LIKE', "%$find_key%") | 573 | $users = $users->where('name', 'LIKE', "%$find_key%") |
573 | ->orWhere('surname', 'LIKE', "%$find_key%") | 574 | ->orWhere('surname', 'LIKE', "%$find_key%") |
574 | ->orWhere('name_man', 'LIKE', "%$find_key%") | 575 | ->orWhere('name_man', 'LIKE', "%$find_key%") |
575 | ->orWhere('email', 'LIKE', "%$find_key%") | 576 | ->orWhere('email', 'LIKE', "%$find_key%") |
576 | ->orWhere('telephone', 'LIKE', "%$find_key%"); | 577 | ->orWhere('telephone', 'LIKE', "%$find_key%"); |
577 | } | 578 | } |
578 | 579 | ||
579 | // Данные | 580 | // Данные |
580 | $users = $users | 581 | $users = $users |
581 | ->Baseuser() | 582 | ->Baseuser() |
582 | ->orderByDesc(Worker::select('created_at') | 583 | ->orderByDesc(Worker::select('created_at') |
583 | ->whereColumn('workers.user_id', 'users.id')); | 584 | ->whereColumn('workers.user_id', 'users.id')); |
584 | $count_users = $users->count(); | 585 | $count_users = $users->count(); |
585 | $users = $users->paginate(10); | 586 | $users = $users->paginate(10); |
586 | 587 | ||
587 | $export_options = DbExportColumns::toArray(); | 588 | $export_options = DbExportColumns::toArray(); |
588 | 589 | ||
589 | $jobs_titles = Job_title::select('id', 'name') | 590 | $jobs_titles = Job_title::select('id', 'name') |
590 | ->where('is_remove', '=', 0) | 591 | ->where('is_remove', '=', 0) |
591 | ->where('is_bd', '=', 2) | 592 | ->where('is_bd', '=', 2) |
592 | ->orderByDesc('sort') | 593 | ->orderByDesc('sort') |
593 | ->orderBy('name', 'asc') | 594 | ->orderBy('name', 'asc') |
594 | ->get() | 595 | ->get() |
595 | ->toArray() | 596 | ->toArray() |
596 | ; | 597 | ; |
597 | 598 | ||
598 | return view('employers.bd', compact('users', 'count_users', 'export_options', 'jobs_titles')); | 599 | return view('employers.bd', compact('users', 'count_users', 'export_options', 'jobs_titles')); |
599 | } | 600 | } |
600 | 601 | ||
601 | //Настройка уведомлений | 602 | //Настройка уведомлений |
602 | public function subscribe() { | 603 | public function subscribe() { |
603 | return view('employers.subcribe'); | 604 | return view('employers.subcribe'); |
604 | } | 605 | } |
605 | 606 | ||
606 | //Установка уведомлений сохранение | 607 | //Установка уведомлений сохранение |
607 | public function save_subscribe(Request $request) { | 608 | public function save_subscribe(Request $request) { |
608 | dd($request->all()); | 609 | dd($request->all()); |
609 | $msg = $request->validate([ | 610 | $msg = $request->validate([ |
610 | 'subscribe_email' => 'required|email|min:5|max:255', | 611 | 'subscribe_email' => 'required|email|min:5|max:255', |
611 | ]); | 612 | ]); |
612 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); | 613 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); |
613 | } | 614 | } |
614 | 615 | ||
615 | //Сбросить форму с паролем | 616 | //Сбросить форму с паролем |
616 | public function password_reset() { | 617 | public function password_reset() { |
617 | $email = Auth()->user()->email; | 618 | $email = Auth()->user()->email; |
618 | return view('employers.password-reset', compact('email')); | 619 | return view('employers.password-reset', compact('email')); |
619 | } | 620 | } |
620 | 621 | ||
621 | //Обновление пароля | 622 | //Обновление пароля |
622 | public function new_password(Request $request) { | 623 | public function new_password(Request $request) { |
623 | $use = Auth()->user(); | 624 | $use = Auth()->user(); |
624 | $request->validate([ | 625 | $request->validate([ |
625 | 'password' => 'required|string', | 626 | 'password' => 'required|string', |
626 | 'new_password' => 'required|string', | 627 | 'new_password' => 'required|string', |
627 | 'new_password2' => 'required|string' | 628 | 'new_password2' => 'required|string' |
628 | ]); | 629 | ]); |
629 | 630 | ||
630 | if ($request->get('new_password') == $request->get('new_password2')) | 631 | if ($request->get('new_password') == $request->get('new_password2')) |
631 | if ($request->get('password') !== $request->get('new_password')) { | 632 | if ($request->get('password') !== $request->get('new_password')) { |
632 | $credentials = $request->only('email', 'password'); | 633 | $credentials = $request->only('email', 'password'); |
633 | if (Auth::attempt($credentials)) { | 634 | if (Auth::attempt($credentials)) { |
634 | 635 | ||
635 | if (!is_null($use->email_verified_at)){ | 636 | if (!is_null($use->email_verified_at)){ |
636 | 637 | ||
637 | $user_data = User_Model::find($use->id); | 638 | $user_data = User_Model::find($use->id); |
638 | $user_data->update([ | 639 | $user_data->update([ |
639 | 'password' => Hash::make($request->get('new_password')), | 640 | 'password' => Hash::make($request->get('new_password')), |
640 | 'pubpassword' => base64_encode($request->get('new_password')), | 641 | 'pubpassword' => base64_encode($request->get('new_password')), |
641 | ]); | 642 | ]); |
642 | return redirect() | 643 | return redirect() |
643 | ->route('employer.password_reset') | 644 | ->route('employer.password_reset') |
644 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 645 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
645 | } | 646 | } |
646 | 647 | ||
647 | return redirect() | 648 | return redirect() |
648 | ->route('employer.password_reset') | 649 | ->route('employer.password_reset') |
649 | ->withError('Данная учетная запись не было верифицированна!'); | 650 | ->withError('Данная учетная запись не было верифицированна!'); |
650 | } | 651 | } |
651 | } | 652 | } |
652 | 653 | ||
653 | return redirect() | 654 | return redirect() |
654 | ->route('employer.password_reset') | 655 | ->route('employer.password_reset') |
655 | ->withErrors('Не совпадение данных, обновите пароли!'); | 656 | ->withErrors('Не совпадение данных, обновите пароли!'); |
656 | } | 657 | } |
657 | 658 | ||
658 | 659 | ||
659 | 660 | ||
660 | // Форма Удаление пипла | 661 | // Форма Удаление пипла |
661 | public function delete_people() { | 662 | public function delete_people() { |
662 | $login = Auth()->user()->email; | 663 | $login = Auth()->user()->email; |
663 | return view('employers.delete_people', compact('login')); | 664 | return view('employers.delete_people', compact('login')); |
664 | } | 665 | } |
665 | 666 | ||
666 | // Удаление аккаунта | 667 | // Удаление аккаунта |
667 | public function action_delete_user(Request $request) { | 668 | public function action_delete_user(Request $request) { |
668 | $Answer = $request->all(); | 669 | $Answer = $request->all(); |
669 | $user_id = Auth()->user()->id; | 670 | $user_id = Auth()->user()->id; |
670 | $request->validate([ | 671 | $request->validate([ |
671 | 'password' => 'required|string', | 672 | 'password' => 'required|string', |
672 | ]); | 673 | ]); |
673 | 674 | ||
674 | $credentials = $request->only('email', 'password'); | 675 | $credentials = $request->only('email', 'password'); |
675 | if (Auth::attempt($credentials)) { | 676 | if (Auth::attempt($credentials)) { |
676 | Auth::logout(); | 677 | Auth::logout(); |
677 | $it = User_Model::find($user_id); | 678 | $it = User_Model::find($user_id); |
678 | $it->delete(); | 679 | $it->delete(); |
679 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 680 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
680 | } else { | 681 | } else { |
681 | return redirect()->route('employer.delete_people') | 682 | return redirect()->route('employer.delete_people') |
682 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 683 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
683 | } | 684 | } |
684 | } | 685 | } |
685 | 686 | ||
686 | public function ajax_delete_user(Request $request) { | 687 | public function ajax_delete_user(Request $request) { |
687 | $Answer = $request->all(); | 688 | $Answer = $request->all(); |
688 | $user_id = Auth()->user()->id; | 689 | $user_id = Auth()->user()->id; |
689 | $request->validate([ | 690 | $request->validate([ |
690 | 'password' => 'required|string', | 691 | 'password' => 'required|string', |
691 | ]); | 692 | ]); |
692 | $credentials = $request->only('email', 'password'); | 693 | $credentials = $request->only('email', 'password'); |
693 | if (Auth::attempt($credentials)) { | 694 | if (Auth::attempt($credentials)) { |
694 | 695 | ||
695 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', | 696 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', |
696 | 'email' => $request->get('email'), | 697 | 'email' => $request->get('email'), |
697 | 'password' => $request->get('password'))); | 698 | 'password' => $request->get('password'))); |
698 | } else { | 699 | } else { |
699 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); | 700 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); |
700 | } | 701 | } |
701 | } | 702 | } |
702 | 703 | ||
703 | // Рассылка сообщений | 704 | // Рассылка сообщений |
704 | public function send_all_messages() { | 705 | public function send_all_messages() { |
705 | $id = Auth()->user()->id; | 706 | $id = Auth()->user()->id; |
706 | $sending = Employer::query()->where('user_id', '=', "$id")->first(); | 707 | $sending = Employer::query()->where('user_id', '=', "$id")->first(); |
707 | 708 | ||
708 | $job_titles = Job_title::query() | 709 | $job_titles = Job_title::query() |
709 | ->where('is_remove', '=', 0) | 710 | ->where('is_remove', '=', 0) |
710 | ->where('is_bd', '=', 1) | 711 | ->where('is_bd', '=', 1) |
711 | ->orderByDesc('sort') | 712 | ->orderByDesc('sort') |
712 | ->get(); | 713 | ->get(); |
713 | 714 | ||
714 | if ($sending->sending_is) | 715 | if ($sending->sending_is) |
715 | return view('employers.send_all', compact('job_titles')); | 716 | return view('employers.send_all', compact('job_titles')); |
716 | else | 717 | else |
717 | return view('employers.send_all_danger'); | 718 | return view('employers.send_all_danger'); |
718 | } | 719 | } |
719 | 720 | ||
720 | // Отправка сообщений для информации | 721 | // Отправка сообщений для информации |
721 | public function send_all_post(Request $request) { | 722 | public function send_all_post(Request $request) { |
722 | $data = $request->all(); | 723 | $data = $request->all(); |
723 | $data['user'] = Auth()->user(); | 724 | $data['user'] = Auth()->user(); |
724 | 725 | ||
725 | $id = MessagesRequests::create([ | 726 | $id = MessagesRequests::create([ |
726 | 'user_id' => $data['user']->id, | 727 | 'user_id' => $data['user']->id, |
727 | 'job_titles' => isset($data['job_title_ids']) ? json_encode($data['job_title_ids']) : null, | 728 | 'job_titles' => isset($data['job_title_ids']) ? json_encode($data['job_title_ids']) : null, |
728 | 'text' => $data['message_text'], | 729 | 'text' => $data['message_text'], |
729 | ]); | 730 | ]); |
730 | 731 | ||
731 | try { | 732 | try { |
732 | if (!empty($id)) { | 733 | if (!empty($id)) { |
733 | Mail::to(env('EMAIL_ADMIN'))->send(new MassSendingMessages($data)); | 734 | Mail::to(env('EMAIL_ADMIN'))->send(new MassSendingMessages($data)); |
734 | } | 735 | } |
735 | } catch (Throwable $e) { | 736 | } catch (Throwable $e) { |
736 | Log::error($e); | 737 | Log::error($e); |
737 | return redirect()->route('employer.send_all_messages')->with('error', 'Ошибка почтового сервера, пожалуйста, повторите рассылку позднее'); | 738 | return redirect()->route('employer.send_all_messages')->with('error', 'Ошибка почтового сервера, пожалуйста, повторите рассылку позднее'); |
738 | } | 739 | } |
739 | 740 | ||
740 | return redirect()->route('employer.send_all_messages')->with('success', 'Запрос на рассылку был успешно отправлен.'); | 741 | return redirect()->route('employer.send_all_messages')->with('success', 'Запрос на рассылку был успешно отправлен.'); |
741 | } | 742 | } |
742 | 743 | ||
743 | // База резюме | 744 | // База резюме |
744 | public function bd_tupe(Request $request) { | 745 | public function bd_tupe(Request $request) { |
745 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); | 746 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); |
746 | 747 | ||
747 | return view('employers.bd_tupe', compact('Resume')); | 748 | return view('employers.bd_tupe', compact('Resume')); |
748 | } | 749 | } |
749 | 750 | ||
750 | ////////////////////////////////////////////////////////////////// | 751 | ////////////////////////////////////////////////////////////////// |
751 | // Отправил сообщение | 752 | // Отправил сообщение |
752 | ////////////////////////////////////////////////////////////////// | 753 | ////////////////////////////////////////////////////////////////// |
753 | public function new_message(Request $request) | 754 | public function new_message(Request $request) |
754 | { | 755 | { |
755 | $params = $request->all(); | 756 | $params = $request->all(); |
756 | 757 | ||
757 | $id = $params['_user_id']; | 758 | $id = $params['_user_id']; |
758 | $message_params = [ | 759 | $message_params = [ |
759 | 'title' => $params['title'], | 760 | 'title' => $params['title'], |
760 | 'text' => $params['text'], | 761 | 'text' => $params['text'], |
761 | 'ad_employer_id' => $params['_vacancy'], | 762 | 'ad_employer_id' => $params['_vacancy'], |
762 | 'flag_new' => 1 | 763 | 'flag_new' => 1 |
763 | ]; | 764 | ]; |
764 | 765 | ||
765 | $message = Message::add_message( | 766 | $message = Message::add_message( |
766 | $request, | 767 | $request, |
767 | $params['_user_id'], | 768 | $params['_user_id'], |
768 | $params['_to_user_id'], | 769 | $params['_to_user_id'], |
769 | $message_params, | 770 | $message_params, |
770 | file_store_path: "worker/$id" | 771 | file_store_path: "worker/$id" |
771 | ); | 772 | ); |
772 | 773 | ||
773 | return redirect()->route('employer.dialog', ['chat' => $message->chat_id_to]); | 774 | return redirect()->route('employer.dialog', ['chat' => $message->chat_id_to]); |
774 | } | 775 | } |
775 | 776 | ||
776 | // Восстановление пароля | 777 | // Восстановление пароля |
777 | public function repair_password(Request $request) { | 778 | public function repair_password(Request $request) { |
778 | $params = $request->get('email'); | 779 | $params = $request->get('email'); |
779 | } | 780 | } |
780 | 781 | ||
781 | // Избранные люди на корабль | 782 | // Избранные люди на корабль |
782 | public function selected_people(Request $request) { | 783 | public function selected_people(Request $request) { |
783 | $id = $request->get('id'); | 784 | $id = $request->get('id'); |
784 | $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | 785 | $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
785 | where('is_remove', '=', '0')-> | 786 | where('is_remove', '=', '0')-> |
786 | where('is_bd', '=', '0')-> | 787 | where('is_bd', '=', '0')-> |
787 | where('position_id', $id)-> | 788 | where('position_id', $id)-> |
788 | get(); | 789 | get(); |
789 | return view('favorite_people', compact('favorite_people')); | 790 | return view('favorite_people', compact('favorite_people')); |
790 | } | 791 | } |
791 | 792 | ||
792 | /** | 793 | /** |
793 | * @throws JsonException | 794 | * @throws JsonException |
794 | */ | 795 | */ |
795 | public function vacancyAutoLiftForm(): View | 796 | public function vacancyAutoLiftForm(): View |
796 | { | 797 | { |
797 | $employer = Auth::user()->employers[0]; | 798 | $employer = Auth::user()->employers[0]; |
798 | $vacancies = $employer | 799 | $vacancies = $employer |
799 | ->ads() | 800 | ->ads() |
800 | ->where('is_remove', 0) | 801 | ->where('is_remove', 0) |
801 | ->where('active_is', 1) | 802 | ->where('active_is', 1) |
802 | ->get(); | 803 | ->get(); |
803 | 804 | ||
804 | $options = $employer->autoliftOptions ?? new EmployerAutoliftOption(); | 805 | $options = $employer->autoliftOptions ?? new EmployerAutoliftOption(); |
805 | 806 | ||
806 | $leftDays = 0; | 807 | $leftDays = 0; |
807 | 808 | ||
808 | if ($options->days_repeat) { | 809 | if ($options->days_repeat) { |
809 | $leftDays = $options->days_repeat - now()->diffInDays(Carbon::parse($options->created_at)); | 810 | $leftDays = $options->days_repeat - now()->diffInDays(Carbon::parse($options->created_at)); |
810 | } | 811 | } |
811 | 812 | ||
812 | 813 | ||
813 | return view('employers.vacancy_autolift', compact('vacancies', 'options', 'leftDays')); | 814 | return view('employers.vacancy_autolift', compact('vacancies', 'options', 'leftDays')); |
814 | } | 815 | } |
815 | 816 | ||
816 | /** | 817 | /** |
817 | * @throws JsonException | 818 | * @throws JsonException |
818 | */ | 819 | */ |
819 | public function vacancyAutoLiftSave(Request $request) | 820 | public function vacancyAutoLiftSave(Request $request) |
820 | { | 821 | { |
821 | $employer = Auth::user()->employers[0]; | 822 | $employer = Auth::user()->employers[0]; |
822 | 823 | ||
823 | $employer->autoliftOptions()->updateOrCreate( | 824 | $employer->autoliftOptions()->updateOrCreate( |
824 | [ | 825 | [ |
825 | 'employer_id' => $employer->id, | 826 | 'employer_id' => $employer->id, |
826 | ], | 827 | ], |
827 | [ | 828 | [ |
828 | 'is_enabled' => $request->get('is_enabled') === 'true', | 829 | 'is_enabled' => $request->get('is_enabled') === 'true', |
829 | 'times_per_day' => $request->get('times_per_day'), | 830 | 'times_per_day' => $request->get('times_per_day'), |
830 | 'days_repeat' => $request->get('days_repeat'), | 831 | 'days_repeat' => $request->get('days_repeat'), |
831 | 'time_send_first' => $request->get('time_send_first'), | 832 | 'time_send_first' => $request->get('time_send_first'), |
832 | 'time_send_second' => $request->get('time_send_second'), | 833 | 'time_send_second' => $request->get('time_send_second'), |
833 | 'time_send_third' => $request->get('time_send_third'), | 834 | 'time_send_third' => $request->get('time_send_third'), |
834 | 'time_send_tg' => $request->get('time_send_tg'), | 835 | 'time_send_tg' => $request->get('time_send_tg'), |
835 | ] | 836 | ] |
836 | ); | 837 | ); |
837 | 838 | ||
838 | foreach ($request->get('vacancies') as $vacancy) { | 839 | foreach ($request->get('vacancies') as $vacancy) { |
839 | Ad_employer::query() | 840 | Ad_employer::query() |
840 | ->where('id', $vacancy['id']) | 841 | ->where('id', $vacancy['id']) |
841 | ->update([ | 842 | ->update([ |
842 | 'autolift_site' => $vacancy['autolift_site'] === 'true', //they're arriving as strings | 843 | 'autolift_site' => $vacancy['autolift_site'] === 'true', //they're arriving as strings |
843 | 'autosend_tg' => $vacancy['autosend_tg'] === 'true', | 844 | 'autosend_tg' => $vacancy['autosend_tg'] === 'true', |
844 | ]); | 845 | ]); |
845 | } | 846 | } |
846 | 847 | ||
847 | return response(['success' => true]); | 848 | return response(['success' => true]); |
848 | } | 849 | } |
849 | 850 | ||
850 | public function autoresponder() | 851 | public function autoresponder() |
851 | { | 852 | { |
852 | $user = Auth::user(); | 853 | $user = Auth::user(); |
853 | return view('employers.autoresponder', compact('user')); | 854 | return view('employers.autoresponder', compact('user')); |
854 | } | 855 | } |
855 | 856 | ||
856 | public function autoresponderSave(Request $request): RedirectResponse | 857 | public function autoresponderSave(Request $request): RedirectResponse |
857 | { | 858 | { |
858 | $user = Auth::user(); | 859 | $user = Auth::user(); |
859 | $user->autoresponder = $request->get('autoresponder', false) === 'on'; | 860 | $user->autoresponder = $request->get('autoresponder', false) === 'on'; |
860 | $user->autoresponder_message = $request->get('autoresponder_message'); | 861 | $user->autoresponder_message = $request->get('autoresponder_message'); |
861 | $user->save(); | 862 | $user->save(); |
862 | 863 | ||
863 | return redirect(route('employer.autoresponder')); | 864 | return redirect(route('employer.autoresponder')); |
864 | } | 865 | } |
865 | } | 866 | } |
866 | 867 |
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 | @include('modals.flash-message', [ | ||
36 | 'title' => 'Спасибо!', | ||
37 | 'message' => session('success') | ||
38 | ]) | ||
35 | <div class="container"> | 39 | <div class="container"> |
36 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 40 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
37 | <li><a href="{{ route('index') }}">Главная</a></li> | 41 | <li><a href="{{ route('index') }}">Главная</a></li> |
38 | <li><b>Личный кабинет</b></li> | 42 | <li><b>Личный кабинет</b></li> |
39 | </ul> | 43 | </ul> |
40 | <div class="cabinet__wrapper"> | 44 | <div class="cabinet__wrapper"> |
41 | <div class="cabinet__side"> | 45 | <div class="cabinet__side"> |
42 | <div class="cabinet__side-toper"> | 46 | <div class="cabinet__side-toper"> |
43 | 47 | ||
44 | @include('employers.emblema') | 48 | @include('employers.emblema') |
45 | 49 | ||
46 | </div> | 50 | </div> |
47 | 51 | ||
48 | @include('employers.menu', ['item' => 3]) | 52 | @include('employers.menu', ['item' => 3]) |
49 | 53 | ||
50 | </div> | 54 | </div> |
51 | 55 | ||
52 | <form class="cabinet__body" action="{{ route('employer.vacancy_save_me', ['ad_employer' => $ad_employer->id]) }}" method="POST"> | 56 | <form class="cabinet__body" action="{{ route('employer.vacancy_save_me', ['ad_employer' => $ad_employer->id]) }}" method="POST"> |
53 | @csrf | 57 | @csrf |
54 | <input type="hidden" name="employer_id" value="{{ $Employer->id }}"/> | 58 | <input type="hidden" name="employer_id" value="{{ $Employer->id }}"/> |
55 | <div class="cabinet__body-item"> | 59 | <div class="cabinet__body-item"> |
56 | <div class="cabinet__descr"> | 60 | <div class="cabinet__descr"> |
57 | <h2 class="title cabinet__title">Редактировать вакансию</h2> | 61 | <h2 class="title cabinet__title">Редактировать вакансию</h2> |
58 | <p class="cabinet__text"><b>Данные по вакансии</b></p> | 62 | <p class="cabinet__text"><b>Данные по вакансии</b></p> |
59 | <p class="cabinet__text">Все поля обязательны для заполнения *</p> | 63 | <p class="cabinet__text">Все поля обязательны для заполнения *</p> |
60 | </div> | 64 | </div> |
61 | </div> | 65 | </div> |
62 | <div class="cabinet__body-item"> | 66 | <div class="cabinet__body-item"> |
63 | <h4>Поля для вакансии</h4> | 67 | <h4>Поля для вакансии</h4> |
64 | <div class="cabinet__inputs"> | 68 | <div class="cabinet__inputs"> |
65 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 69 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
66 | <label class="form-group__label">Название вакансии</label> | 70 | <label class="form-group__label">Название вакансии</label> |
67 | <div class="form-group__item"> | 71 | <div class="form-group__item"> |
68 | <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $ad_employer->name ?? '' }}" required> | 72 | <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $ad_employer->name ?? '' }}" required> |
69 | @error('name') | 73 | @error('name') |
70 | <span class="text-xs text-red-600 dark:text-red-400"> | 74 | <span class="text-xs text-red-600 dark:text-red-400"> |
71 | {{ $message }} | 75 | {{ $message }} |
72 | </span> | 76 | </span> |
73 | @enderror | 77 | @enderror |
74 | </div> | 78 | </div> |
75 | </div> | 79 | </div> |
76 | 80 | ||
77 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | 81 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> |
78 | <label class="form-group__label">Телефон</label> | 82 | <label class="form-group__label">Телефон</label> |
79 | <div class="form-group__item"> | 83 | <div class="form-group__item"> |
80 | <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $ad_employer->telephone ?? '' }}" placeholder="Свой телефон"> | 84 | <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $ad_employer->telephone ?? '' }}" placeholder="Свой телефон"> |
81 | @error('telephone') | 85 | @error('telephone') |
82 | <span class="text-xs text-red-600 dark:text-red-400"> | 86 | <span class="text-xs text-red-600 dark:text-red-400"> |
83 | {{ $message }} | 87 | {{ $message }} |
84 | </span> | 88 | </span> |
85 | @enderror | 89 | @enderror |
86 | </div> | 90 | </div> |
87 | </div> | 91 | </div> |
88 | 92 | ||
89 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | 93 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> |
90 | <label class="form-group__label">Емайл</label> | 94 | <label class="form-group__label">Емайл</label> |
91 | <div class="form-group__item"> | 95 | <div class="form-group__item"> |
92 | <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $ad_employer->email ?? '' }}" placeholder="Своя почту"> | 96 | <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $ad_employer->email ?? '' }}" placeholder="Своя почту"> |
93 | @error('email') | 97 | @error('email') |
94 | <span class="text-xs text-red-600 dark:text-red-400"> | 98 | <span class="text-xs text-red-600 dark:text-red-400"> |
95 | {{ $message }} | 99 | {{ $message }} |
96 | </span> | 100 | </span> |
97 | @enderror | 101 | @enderror |
98 | </div> | 102 | </div> |
99 | </div> | 103 | </div> |
100 | 104 | ||
101 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | 105 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> |
102 | <label class="form-group__label">Зарплата среднестатистическая для вакансии</label> | 106 | <label class="form-group__label">Зарплата среднестатистическая для вакансии</label> |
103 | <div class="form-group__item"> | 107 | <div class="form-group__item"> |
104 | <input type="text" class="input" name="salary" id="salary" value="{{ old('salary') ?? $ad_employer->salary ??'' }}" placeholder="Среднестатистическая зарплата"> | 108 | <input type="text" class="input" name="salary" id="salary" value="{{ old('salary') ?? $ad_employer->salary ??'' }}" placeholder="Среднестатистическая зарплата"> |
105 | @error('salary') | 109 | @error('salary') |
106 | <span class="text-xs text-red-600 dark:text-red-400"> | 110 | <span class="text-xs text-red-600 dark:text-red-400"> |
107 | {{ $message }} | 111 | {{ $message }} |
108 | </span> | 112 | </span> |
109 | @enderror | 113 | @enderror |
110 | </div> | 114 | </div> |
111 | </div> | 115 | </div> |
112 | 116 | ||
113 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display: none"> | 117 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display: none"> |
114 | <label class="form-group__label">Город посадки</label> | 118 | <label class="form-group__label">Город посадки</label> |
115 | <div class="form-group__item"> | 119 | <div class="form-group__item"> |
116 | <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $ad_employer->city ?? 'Не указан' }}" placeholder="Севастополь"> | 120 | <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $ad_employer->city ?? 'Не указан' }}" placeholder="Севастополь"> |
117 | @error('city') | 121 | @error('city') |
118 | <span class="text-xs text-red-600"> | 122 | <span class="text-xs text-red-600"> |
119 | {{ $message }} | 123 | {{ $message }} |
120 | </span> | 124 | </span> |
121 | @enderror | 125 | @enderror |
122 | </div> | 126 | </div> |
123 | </div> | 127 | </div> |
124 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 128 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
125 | <label class="form-group__label">Редактирование должностей</label> | 129 | <label class="form-group__label">Редактирование должностей</label> |
126 | <div class="form-group__item"> | 130 | <div class="form-group__item"> |
127 | <div class="select"> | 131 | <div class="select"> |
128 | <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple"> | 132 | <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple"> |
129 | @php $i = 1 @endphp | 133 | @php $i = 1 @endphp |
130 | @if ($jobs->count()) | 134 | @if ($jobs->count()) |
131 | @foreach($jobs as $it) | 135 | @foreach($jobs as $it) |
132 | @php $selected = false; @endphp | 136 | @php $selected = false; @endphp |
133 | @foreach ($ad_employer->jobs_code as $it_um) | 137 | @foreach ($ad_employer->jobs_code as $it_um) |
134 | @if (isset($it_um->job_title_id)) | 138 | @if (isset($it_um->job_title_id)) |
135 | @if ($it_um->job_title_id == $it->id)) | 139 | @if ($it_um->job_title_id == $it->id)) |
136 | @php $selected = true; @endphp | 140 | @php $selected = true; @endphp |
137 | @endif | 141 | @endif |
138 | @endif | 142 | @endif |
139 | @endforeach | 143 | @endforeach |
140 | <option value="{{ $it->id }}" @if ($selected) selected @endif>{{ $it->name }}</option> | 144 | <option value="{{ $it->id }}" @if ($selected) selected @endif>{{ $it->name }}</option> |
141 | @endforeach | 145 | @endforeach |
142 | @endif | 146 | @endif |
143 | </select> | 147 | </select> |
144 | </div> | 148 | </div> |
145 | </div> | 149 | </div> |
146 | </div> | 150 | </div> |
147 | 151 | ||
148 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 152 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
149 | <label class="form-group__label">Описание вакансии</label> | 153 | <label class="form-group__label">Описание вакансии</label> |
150 | <div class="form-group__item"> | 154 | <div class="form-group__item"> |
151 | <textarea class="textarea ckeditor" name="text" id="text">{{ old('text') ?? $ad_employer->text ?? '' }}</textarea> | 155 | <textarea class="textarea ckeditor" name="text" id="text">{{ old('text') ?? $ad_employer->text ?? '' }}</textarea> |
152 | @error('text') | 156 | @error('text') |
153 | <span class="text-xs text-red-600"> | 157 | <span class="text-xs text-red-600"> |
154 | {{ $message }} | 158 | {{ $message }} |
155 | </span> | 159 | </span> |
156 | @enderror | 160 | @enderror |
157 | </div> | 161 | </div> |
158 | </div> | 162 | </div> |
159 | </div> | 163 | </div> |
160 | 164 | ||
161 | <a class="button cabinet__submit" href="{{ route('employer.vacancy_list') }}">Назад</a> | 165 | <a class="button cabinet__submit" href="{{ route('employer.vacancy_list') }}">Назад</a> |
162 | <button type="submit" class="button cabinet__submit">Сохранить и опубликовать</button> | 166 | <button type="submit" class="button cabinet__submit">Сохранить и опубликовать</button> |
163 | </div> | 167 | </div> |
164 | </form> | 168 | </form> |
165 | </div> | 169 | </div> |
166 | </div> | 170 | </div> |
167 | </section> | 171 | </section> |
168 | </div> | 172 | </div> |
169 | <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> | 173 | <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> |
170 | <script> | 174 | <script> |
171 | CKEDITOR.replace('text'); | 175 | CKEDITOR.replace('text'); |
172 | //CKEDITOR.replace( 'text', { | 176 | //CKEDITOR.replace( 'text', { |
173 | // filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", | 177 | // filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", |
174 | // filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", | 178 | // filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", |
175 | // filebrowserUploadMethod: 'form' | 179 | // filebrowserUploadMethod: 'form' |
176 | // }); | 180 | // }); |
177 | </script> | 181 | </script> |
178 | @endsection | 182 | @endsection |
179 | 183 |
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 | $(document).on('change', '#sort_ajax', function() { | 5 | $(document).on('change', '#sort_ajax', function() { |
6 | var this_ = $(this); | 6 | var this_ = $(this); |
7 | var val_ = this_.val(); | 7 | var val_ = this_.val(); |
8 | console.log('sort items '+val_); | 8 | console.log('sort items '+val_); |
9 | 9 | ||
10 | $.ajax({ | 10 | $.ajax({ |
11 | type: "GET", | 11 | type: "GET", |
12 | url: "{{ url()->current() }}", | 12 | url: "{{ url()->current() }}", |
13 | data: "sort="+val_+"&search=@if ((isset($_GET['search']))&&(!empty($_GET['search']))){{$_GET['search']}}@endif", | 13 | data: "sort="+val_+"&search=@if ((isset($_GET['search']))&&(!empty($_GET['search']))){{$_GET['search']}}@endif", |
14 | success: function (data) { | 14 | success: function (data) { |
15 | console.log('Выбор сортировки'); | 15 | console.log('Выбор сортировки'); |
16 | console.log(data); | 16 | console.log(data); |
17 | history.pushState({}, '', "{{ route('employer.vacancy_list') }}?search=@if ((isset($_GET['search']))&&(!empty($_GET['search']))){{$_GET['search']}}@endif"+"&sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | 17 | history.pushState({}, '', "{{ route('employer.vacancy_list') }}?search=@if ((isset($_GET['search']))&&(!empty($_GET['search']))){{$_GET['search']}}@endif"+"&sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); |
18 | $('#main_ockar').html(data); | 18 | $('#main_ockar').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 | </script> | 29 | </script> |
30 | @endsection | 30 | @endsection |
31 | 31 | ||
32 | @section('content') | 32 | @section('content') |
33 | <section class="cabinet"> | 33 | <section class="cabinet"> |
34 | @if (session('success')) | 34 | @include('modals.flash-message', [ |
35 | @include('modals.message', [ | 35 | 'title' => 'Спасибо!', |
36 | 'title' => 'Спасибо!', | 36 | 'message' => session('success') |
37 | 'message' => session('success') | 37 | ]) |
38 | ]) | ||
39 | |||
40 | <script> | ||
41 | $(document).ready(function () { | ||
42 | $.fancybox.open({ | ||
43 | src: '#vacancy-created', | ||
44 | type: 'inline', | ||
45 | opts: { | ||
46 | touch: false, | ||
47 | afterShow: function() { | ||
48 | |||
49 | } | ||
50 | } | ||
51 | }); | ||
52 | }) | ||
53 | </script> | ||
54 | @endif | ||
55 | <div class="container"> | 38 | <div class="container"> |
56 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 39 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
57 | <li><a href="{{ route('index') }}">Главная</a></li> | 40 | <li><a href="{{ route('index') }}">Главная</a></li> |
58 | <li><b>Личный кабинет</b></li> | 41 | <li><b>Личный кабинет</b></li> |
59 | </ul> | 42 | </ul> |
60 | <div class="cabinet__wrapper"> | 43 | <div class="cabinet__wrapper"> |
61 | <div class="cabinet__side"> | 44 | <div class="cabinet__side"> |
62 | <div class="cabinet__side-toper"> | 45 | <div class="cabinet__side-toper"> |
63 | 46 | ||
64 | @include('employers.emblema') | 47 | @include('employers.emblema') |
65 | 48 | ||
66 | </div> | 49 | </div> |
67 | 50 | ||
68 | @include('employers.menu', ['item' => 3]) | 51 | @include('employers.menu', ['item' => 3]) |
69 | </div> | 52 | </div> |
70 | <div class="cabinet__body"> | 53 | <div class="cabinet__body"> |
71 | <div class="cabinet__body-item"> | 54 | <div class="cabinet__body-item"> |
72 | <h2 class="title cabinet__title">Мои вакансии</h2> | 55 | <h2 class="title cabinet__title">Мои вакансии</h2> |
73 | </div> | 56 | </div> |
74 | <div class="cabinet__body-item"> | 57 | <div class="cabinet__body-item"> |
75 | <div class="cabinet__filters"> | 58 | <div class="cabinet__filters"> |
76 | <div class="cabinet__filters-item"> | 59 | <div class="cabinet__filters-item"> |
77 | <form class="search" action="{{ url()->current() }}" method="GET"> | 60 | <form class="search" action="{{ url()->current() }}" method="GET"> |
78 | <input type="search" name="search" class="input" placeholder="Поиск…" value="@if ((isset($_GET['search'])) && (!empty($_GET['search']))) {{ $_GET['search'] }}@endif"> | 61 | <input type="search" name="search" class="input" placeholder="Поиск…" value="@if ((isset($_GET['search'])) && (!empty($_GET['search']))) {{ $_GET['search'] }}@endif"> |
79 | <button type="submit" class="button">Найти</button> | 62 | <button type="submit" class="button">Найти</button> |
80 | <span> | 63 | <span> |
81 | <svg> | 64 | <svg> |
82 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> | 65 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> |
83 | </svg> | 66 | </svg> |
84 | </span> | 67 | </span> |
85 | </form> | 68 | </form> |
86 | </div> | 69 | </div> |
87 | <div class="cabinet__filters-item"> | 70 | <div class="cabinet__filters-item"> |
88 | <div class="select"> | 71 | <div class="select"> |
89 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> | 72 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> |
90 | <option value="default" @if (isset($_GET['sort']) && ($_GET['sort'] == 'default')) selected @endif>От новых к старым (по умолчанию)</option> | 73 | <option value="default" @if (isset($_GET['sort']) && ($_GET['sort'] == 'default')) selected @endif>От новых к старым (по умолчанию)</option> |
91 | <option value="public" @if (isset($_GET['sort']) && ($_GET['sort'] == 'public')) selected @endif>Опубликовано</option> | 74 | <option value="public" @if (isset($_GET['sort']) && ($_GET['sort'] == 'public')) selected @endif>Опубликовано</option> |
92 | <option value="nopublic" @if (isset($_GET['sort']) && ($_GET['sort'] == 'nopublic')) selected @endif>Не опубликовано</option> | 75 | <option value="nopublic" @if (isset($_GET['sort']) && ($_GET['sort'] == 'nopublic')) selected @endif>Не опубликовано</option> |
93 | <!--<option value="name_up">По имени (возрастание)</option> | 76 | <!--<option value="name_up">По имени (возрастание)</option> |
94 | <option value="name_down">По имени (убывание)</option> | 77 | <option value="name_down">По имени (убывание)</option> |
95 | <option value="created_at_up">По дате (возрастание)</option> | 78 | <option value="created_at_up">По дате (возрастание)</option> |
96 | <option value="created_at_down">По дате (убывание)</option>--> | 79 | <option value="created_at_down">По дате (убывание)</option>--> |
97 | </select> | 80 | </select> |
98 | </div> | 81 | </div> |
99 | </div> | 82 | </div> |
100 | </div> | 83 | </div> |
101 | 84 | ||
102 | <div class="table table_spoiler" id="main_ockar" name="main_oskar"> | 85 | <div class="table table_spoiler" id="main_ockar" name="main_oskar"> |
103 | @if ($vacancy_list->count()) | 86 | @if ($vacancy_list->count()) |
104 | <div class="table__scroll"> | 87 | <div class="table__scroll"> |
105 | <div class="table__body table__body_min-width"> | 88 | <div class="table__body table__body_min-width"> |
106 | <table> | 89 | <table> |
107 | <thead> | 90 | <thead> |
108 | <tr> | 91 | <tr> |
109 | <th>№</th> | 92 | <th>№</th> |
110 | <th>Название</th> | 93 | <th>Название</th> |
111 | <th>Дата добавления<br>/ обновления</th> | 94 | <th>Дата добавления<br>/ обновления</th> |
112 | <th style="display:none">Должности</th> | 95 | <th style="display:none">Должности</th> |
113 | <th>Статус</th> | 96 | <th>Статус</th> |
114 | <th>Действия</th> | 97 | <th>Действия</th> |
115 | </tr> | 98 | </tr> |
116 | </thead> | 99 | </thead> |
117 | <tbody> | 100 | <tbody> |
118 | @foreach($vacancy_list as $it) | 101 | @foreach($vacancy_list as $it) |
119 | <tr> | 102 | <tr> |
120 | <td>{{ $it->id }}</td> | 103 | <td>{{ $it->id }}</td> |
121 | <td>{{ $it->name }}</td> | 104 | <td>{{ $it->name }}</td> |
122 | <td>{{ date('d.m.Y', strtotime($it->created_at)) }} <br>/ {{ date('d.m.Y', strtotime($it->updated_at)) }}</td> | 105 | <td>{{ date('d.m.Y', strtotime($it->created_at)) }} <br>/ {{ date('d.m.Y', strtotime($it->updated_at)) }}</td> |
123 | <td style="display:none"> <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $it->id]) }}" class="button">Добавить</a> | 106 | <td style="display:none"> <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $it->id]) }}" class="button">Добавить</a> |
124 | 107 | ||
125 | @if ($it->jobs->count()) | 108 | @if ($it->jobs->count()) |
126 | @foreach ($it->jobs as $key => $it_um) | 109 | @foreach ($it->jobs as $key => $it_um) |
127 | <p>@if (isset($it->jobs_code[$key])) | 110 | <p>@if (isset($it->jobs_code[$key])) |
128 | <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> | 111 | <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> |
129 | <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a> | 112 | <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a> |
130 | @endif | 113 | @endif |
131 | </p> | 114 | </p> |
132 | @endforeach | 115 | @endforeach |
133 | @else | 116 | @else |
134 | Нет связанных <br> с вакансией должностей | 117 | Нет связанных <br> с вакансией должностей |
135 | @endif | 118 | @endif |
136 | </td> | 119 | </td> |
137 | <td> | 120 | <td> |
138 | @if ($it->active_is) | 121 | @if ($it->active_is) |
139 | <span class="table__status green"><i></i>Опубликовано</span> | 122 | <span class="table__status green"><i></i>Опубликовано</span> |
140 | @else | 123 | @else |
141 | <span class="table__status"><i></i>Не опубликовано</span> | 124 | <span class="table__status"><i></i>Не опубликовано</span> |
142 | @endif | 125 | @endif |
143 | </td> | 126 | </td> |
144 | <td> | 127 | <td> |
145 | <span class="table__controls"> | 128 | <span class="table__controls"> |
146 | <a class="table__controls-item up-it" title="Поднять вакансию" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}"> | 129 | <a class="table__controls-item up-it" title="Поднять вакансию" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}"> |
147 | <svg> | 130 | <svg> |
148 | <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use> | 131 | <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use> |
149 | </svg> | 132 | </svg> |
150 | </a> | 133 | </a> |
151 | <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" title="Редактировать вакансию" class="table__controls-item"> | 134 | <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" title="Редактировать вакансию" class="table__controls-item"> |
152 | <svg> | 135 | <svg> |
153 | <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> | 136 | <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> |
154 | </svg> | 137 | </svg> |
155 | </a> | 138 | </a> |
156 | <a class="table__controls-item" title="Удалить вакансию" href="{{ route('employer.vacancy_delete', ['ad_employer' => $it->id]) }}"> | 139 | <a class="table__controls-item" title="Удалить вакансию" href="{{ route('employer.vacancy_delete', ['ad_employer' => $it->id]) }}"> |
157 | <svg> | 140 | <svg> |
158 | <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> | 141 | <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> |
159 | </svg> | 142 | </svg> |
160 | </a> | 143 | </a> |
161 | @if ($it->active_is) | 144 | @if ($it->active_is) |
162 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" title="Скрыть вакансию" class="table__controls-item"> | 145 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" title="Скрыть вакансию" class="table__controls-item"> |
163 | <svg> | 146 | <svg> |
164 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> | 147 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> |
165 | </svg> | 148 | </svg> |
166 | </a> | 149 | </a> |
167 | @else | 150 | @else |
168 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" title="Показать вакансию" class="table__controls-item"> | 151 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" title="Показать вакансию" class="table__controls-item"> |
169 | <svg> | 152 | <svg> |
170 | <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> | 153 | <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> |
171 | </svg> | 154 | </svg> |
172 | </a> | 155 | </a> |
173 | @endif | 156 | @endif |
174 | @if ($Employer->social_is == 1) | 157 | @if ($Employer->social_is == 1) |
175 | <a href="{{ route('employer.send-vacancy-to-social', ['social' => 'tg', 'vacancy' => $it->id]) }}" title="Отправить вакансию в телеграм" class="table__controls-item"> | 158 | <a href="{{ route('employer.send-vacancy-to-social', ['social' => 'tg', 'vacancy' => $it->id]) }}" title="Отправить вакансию в телеграм" class="table__controls-item"> |
176 | <svg> | 159 | <svg> |
177 | <use xlink:href="{{ asset('images/sprite.svg#tg') }}"></use> | 160 | <use xlink:href="{{ asset('images/sprite.svg#tg') }}"></use> |
178 | </svg> | 161 | </svg> |
179 | </a> | 162 | </a> |
180 | @endif | 163 | @endif |
181 | </span> | 164 | </span> |
182 | </td> | 165 | </td> |
183 | </tr> | 166 | </tr> |
184 | @endforeach | 167 | @endforeach |
185 | </tbody> | 168 | </tbody> |
186 | </table> | 169 | </table> |
187 | </div><br> | 170 | </div><br> |
188 | {{ $vacancy_list->appends($_GET)->links('paginate') }} | 171 | {{ $vacancy_list->appends($_GET)->links('paginate') }} |
189 | </div> | 172 | </div> |
190 | 173 | ||
191 | 174 | ||
192 | @else | 175 | @else |
193 | 176 | ||
194 | <div class="notify"> | 177 | <div class="notify"> |
195 | <svg> | 178 | <svg> |
196 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> | 179 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> |
197 | </svg> | 180 | </svg> |
198 | <span>Вы ещё не разместили ни одной вакансии</span> | 181 | <span>Вы ещё не разместили ни одной вакансии</span> |
199 | </div> | 182 | </div> |
200 | @endif | 183 | @endif |
201 | </div> | 184 | </div> |
202 | </div> | 185 | </div> |
203 | </div> | 186 | </div> |
204 | </div> | 187 | </div> |
205 | </div> | 188 | </div> |
206 | </section> | 189 | </section> |
207 | </div> | 190 | </div> |
208 | @endsection | 191 | @endsection |
209 | 192 |
resources/views/modals/flash-message.blade.php
File was created | 1 | @if (session('success')) | |
2 | <div id="flash-message" class="modal modal_bg"> | ||
3 | <div class="modal__body"> | ||
4 | <div class="modal__title">{{$title}}</div> | ||
5 | <div class="modal__text">{{$message}}</div> | ||
6 | <a href="javascript:void(0)" onclick="$.fancybox.close();" class="button button_light modal__button">Закрыть</a> | ||
7 | </div> | ||
8 | </div> | ||
9 | |||
10 | <script> | ||
11 | $(document).ready(function () { | ||
12 | $.fancybox.open({ | ||
13 | src: '#flash-message', | ||
14 | type: 'inline', | ||
15 | opts: { | ||
16 | touch: false, | ||
17 | afterShow: function() { | ||
18 | |||
19 | } | ||
20 | } | ||
21 | }); | ||
22 | }) | ||
23 | </script> | ||
24 | @endif | ||
25 |
resources/views/modals/message.blade.php
1 | <div id="vacancy-created" class="modal modal_bg"> | File was deleted | |
2 | <div class="modal__body"> | ||
3 | <div class="modal__title">{{$title}}</div> | ||
4 | <div class="modal__text">{{$message}}</div> | ||
5 | <a href="javascript:void(0)" onclick="$.fancybox.close();" class="button button_light modal__button">Закрыть</a> | ||
6 | </div> | ||
7 | </div> | ||
8 | 1 | <div id="vacancy-created" class="modal modal_bg"> |