Commit 0ea9852237693bc176370331b95f3c1b5a51994c
1 parent
748f122fa7
Exists in
master
and in
1 other branch
Коммит по диалогам и переписке
Showing 10 changed files with 57 additions and 11 deletions Inline Diff
- app/Http/Controllers/EmployerController.php
- app/Http/Controllers/MainController.php
- app/Http/Controllers/WorkerController.php
- app/Models/ResponseWork.php
- app/Models/Worker.php
- resources/views/employers/dialog.blade.php
- resources/views/modals/send_worker_new.blade.php
- resources/views/worker.blade.php
- resources/views/workers/cabinet.blade.php
- resources/views/workers/messages.blade.php
app/Http/Controllers/EmployerController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Classes\Tools; | 6 | use App\Classes\Tools; |
7 | use App\Http\Requests\BaseUser_min_Request; | 7 | use App\Http\Requests\BaseUser_min_Request; |
8 | use App\Http\Requests\BaseUserRequest; | 8 | use App\Http\Requests\BaseUserRequest; |
9 | use App\Http\Requests\FlotRequest; | 9 | use App\Http\Requests\FlotRequest; |
10 | use App\Http\Requests\MessagesRequiest; | 10 | use App\Http\Requests\MessagesRequiest; |
11 | use App\Http\Requests\VacancyRequestEdit; | 11 | use App\Http\Requests\VacancyRequestEdit; |
12 | use App\Http\Requests\VacansiaRequiest; | 12 | use App\Http\Requests\VacansiaRequiest; |
13 | use App\Mail\MailSotrudnichestvo; | 13 | use App\Mail\MailSotrudnichestvo; |
14 | use App\Mail\SendAllMessages; | 14 | use App\Mail\SendAllMessages; |
15 | use App\Models\Ad_employer; | 15 | use App\Models\Ad_employer; |
16 | use App\Models\Ad_jobs; | 16 | use App\Models\Ad_jobs; |
17 | use App\Models\ad_response; | 17 | use App\Models\ad_response; |
18 | use App\Models\Category; | 18 | use App\Models\Category; |
19 | use App\Models\Education; | 19 | use App\Models\Education; |
20 | use App\Models\Employer; | 20 | use App\Models\Employer; |
21 | use App\Models\employers_main; | 21 | use App\Models\employers_main; |
22 | use App\Models\Flot; | 22 | use App\Models\Flot; |
23 | use App\Models\Job_title; | 23 | use App\Models\Job_title; |
24 | use App\Models\Like_vacancy; | 24 | use App\Models\Like_vacancy; |
25 | use App\Models\Like_worker; | 25 | use App\Models\Like_worker; |
26 | use App\Models\Message; | 26 | use App\Models\Message; |
27 | use App\Models\Positions; | 27 | use App\Models\Positions; |
28 | use App\Models\Worker; | 28 | use App\Models\Worker; |
29 | use Carbon\Carbon; | 29 | use Carbon\Carbon; |
30 | use Illuminate\Auth\Events\Registered; | 30 | use Illuminate\Auth\Events\Registered; |
31 | use Illuminate\Database\Eloquent\Builder; | 31 | use Illuminate\Database\Eloquent\Builder; |
32 | use Illuminate\Database\Eloquent\Model; | 32 | use Illuminate\Database\Eloquent\Model; |
33 | use Illuminate\Foundation\Auth\User; | 33 | use Illuminate\Foundation\Auth\User; |
34 | use Illuminate\Http\Request; | 34 | use Illuminate\Http\Request; |
35 | use Illuminate\Support\Facades\Auth; | 35 | use Illuminate\Support\Facades\Auth; |
36 | use Illuminate\Support\Facades\Hash; | 36 | use Illuminate\Support\Facades\Hash; |
37 | use Illuminate\Support\Facades\Mail; | 37 | use Illuminate\Support\Facades\Mail; |
38 | use Illuminate\Support\Facades\Storage; | 38 | use Illuminate\Support\Facades\Storage; |
39 | use App\Models\User as User_Model; | 39 | use App\Models\User as User_Model; |
40 | use Illuminate\Support\Facades\Validator; | 40 | use Illuminate\Support\Facades\Validator; |
41 | 41 | ||
42 | class EmployerController extends Controller | 42 | class EmployerController extends Controller |
43 | { | 43 | { |
44 | public function vacancie($vacancy, Request $request) { | 44 | public function vacancie($vacancy, Request $request) { |
45 | $title = 'Заголовок вакансии'; | 45 | $title = 'Заголовок вакансии'; |
46 | $Query = Ad_employer::with('jobs')-> | 46 | $Query = Ad_employer::with('jobs')-> |
47 | with('cat')-> | 47 | with('cat')-> |
48 | with('employer')-> | 48 | with('employer')-> |
49 | with('jobs_code')-> | 49 | with('jobs_code')-> |
50 | select('ad_employers.*')-> | 50 | select('ad_employers.*')-> |
51 | where('id', '=', $vacancy)->get(); | 51 | where('id', '=', $vacancy)->get(); |
52 | 52 | ||
53 | if (isset(Auth()->user()->id)) | 53 | if (isset(Auth()->user()->id)) |
54 | $uid = Auth()->user()->id; | 54 | $uid = Auth()->user()->id; |
55 | else | 55 | else |
56 | $uid = 0; | 56 | $uid = 0; |
57 | $title = $Query[0]->name; | 57 | $title = $Query[0]->name; |
58 | if ($request->ajax()) { | 58 | if ($request->ajax()) { |
59 | return view('ajax.vacance-item', compact('Query','uid')); | 59 | return view('ajax.vacance-item', compact('Query','uid')); |
60 | } else { | 60 | } else { |
61 | return view('vacance-item', compact('title', 'Query', 'uid')); | 61 | return view('vacance-item', compact('title', 'Query', 'uid')); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | public function logout() { | 65 | public function logout() { |
66 | Auth::logout(); | 66 | Auth::logout(); |
67 | return redirect()->route('index') | 67 | return redirect()->route('index') |
68 | ->with('success', 'Вы вышли из личного кабинета'); | 68 | ->with('success', 'Вы вышли из личного кабинета'); |
69 | } | 69 | } |
70 | 70 | ||
71 | public function employer_info() { | 71 | public function employer_info() { |
72 | // код юзера | 72 | // код юзера |
73 | $user_info = Auth()->user(); | 73 | $user_info = Auth()->user(); |
74 | // вьюшка для вывода данных | 74 | // вьюшка для вывода данных |
75 | return view('employers.info', compact('user_info')); | 75 | return view('employers.info', compact('user_info')); |
76 | } | 76 | } |
77 | 77 | ||
78 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { | 78 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { |
79 | // Все данные через реквест | 79 | // Все данные через реквест |
80 | $all = $request->all(); | 80 | $all = $request->all(); |
81 | unset($all['_token']); | 81 | unset($all['_token']); |
82 | // обновление | 82 | // обновление |
83 | $user->update($all); | 83 | $user->update($all); |
84 | return redirect()->route('employer.employer_info'); | 84 | return redirect()->route('employer.employer_info'); |
85 | } | 85 | } |
86 | 86 | ||
87 | public function cabinet() { | 87 | public function cabinet() { |
88 | $id = Auth()->user()->id; | 88 | $id = Auth()->user()->id; |
89 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 89 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
90 | WhereHas('users', | 90 | WhereHas('users', |
91 | function (Builder $query) use ($id) {$query->Where('id', $id); | 91 | function (Builder $query) use ($id) {$query->Where('id', $id); |
92 | })->get(); | 92 | })->get(); |
93 | return view('employers.cabinet45', compact('Employer')); | 93 | return view('employers.cabinet45', compact('Employer')); |
94 | } | 94 | } |
95 | 95 | ||
96 | public function slider_flot() { | 96 | public function slider_flot() { |
97 | $id = Auth()->user()->id; | 97 | $id = Auth()->user()->id; |
98 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 98 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
99 | WhereHas('users', | 99 | WhereHas('users', |
100 | function (Builder $query) use ($id) {$query->Where('id', $id); | 100 | function (Builder $query) use ($id) {$query->Where('id', $id); |
101 | })->get(); | 101 | })->get(); |
102 | return view('employers.fly-flot', compact('Employer')); | 102 | return view('employers.fly-flot', compact('Employer')); |
103 | } | 103 | } |
104 | 104 | ||
105 | public function cabinet_save(Employer $Employer, Request $request) { | 105 | public function cabinet_save(Employer $Employer, Request $request) { |
106 | $params = $request->all(); | 106 | $params = $request->all(); |
107 | $params['user_id'] = Auth()->user()->id; | 107 | $params['user_id'] = Auth()->user()->id; |
108 | $id = $Employer->id; | 108 | $id = $Employer->id; |
109 | 109 | ||
110 | if ($request->has('logo')) { | 110 | if ($request->has('logo')) { |
111 | if (!empty($Employer->logo)) { | 111 | if (!empty($Employer->logo)) { |
112 | Storage::delete($Employer->logo); | 112 | Storage::delete($Employer->logo); |
113 | } | 113 | } |
114 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); | 114 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); |
115 | } | 115 | } |
116 | 116 | ||
117 | $Employer->update($params); | 117 | $Employer->update($params); |
118 | 118 | ||
119 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); | 119 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); |
120 | } | 120 | } |
121 | 121 | ||
122 | public function save_add_flot(FlotRequest $request) { | 122 | public function save_add_flot(FlotRequest $request) { |
123 | // отмена | 123 | // отмена |
124 | $params = $request->all(); | 124 | $params = $request->all(); |
125 | 125 | ||
126 | if ($request->has('image')) { | 126 | if ($request->has('image')) { |
127 | $params['image'] = $request->file('image')->store("flot", 'public'); | 127 | $params['image'] = $request->file('image')->store("flot", 'public'); |
128 | } | 128 | } |
129 | Flot::create($params); | 129 | Flot::create($params); |
130 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); | 130 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); |
131 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 131 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
132 | } | 132 | } |
133 | 133 | ||
134 | public function edit_flot(Flot $Flot, Employer $Employer) { | 134 | public function edit_flot(Flot $Flot, Employer $Employer) { |
135 | return view('employers.edit-flot', compact('Flot', 'Employer')); | 135 | return view('employers.edit-flot', compact('Flot', 'Employer')); |
136 | } | 136 | } |
137 | 137 | ||
138 | public function update_flot(FlotRequest $request, Flot $Flot) { | 138 | public function update_flot(FlotRequest $request, Flot $Flot) { |
139 | $params = $request->all(); | 139 | $params = $request->all(); |
140 | 140 | ||
141 | if ($request->has('image')) { | 141 | if ($request->has('image')) { |
142 | if (!empty($flot->image)) { | 142 | if (!empty($flot->image)) { |
143 | Storage::delete($flot->image); | 143 | Storage::delete($flot->image); |
144 | } | 144 | } |
145 | $params['image'] = $request->file('image')->store("flot", 'public'); | 145 | $params['image'] = $request->file('image')->store("flot", 'public'); |
146 | } else { | 146 | } else { |
147 | if (!empty($flot->image)) $params['image'] = $flot->image; | 147 | if (!empty($flot->image)) $params['image'] = $flot->image; |
148 | } | 148 | } |
149 | 149 | ||
150 | $Flot->update($params); | 150 | $Flot->update($params); |
151 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 151 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
152 | } | 152 | } |
153 | 153 | ||
154 | public function delete_flot(Flot $Flot) { | 154 | public function delete_flot(Flot $Flot) { |
155 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); | 155 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); |
156 | 156 | ||
157 | if (isset($Flot->id)) $Flot->delete(); | 157 | if (isset($Flot->id)) $Flot->delete(); |
158 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); | 158 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); |
159 | } | 159 | } |
160 | 160 | ||
161 | // Форма добавления вакансий | 161 | // Форма добавления вакансий |
162 | public function cabinet_vacancie() { | 162 | public function cabinet_vacancie() { |
163 | $id = Auth()->user()->id; | 163 | $id = Auth()->user()->id; |
164 | 164 | ||
165 | if (Auth()->user()->is_public) { | 165 | if (Auth()->user()->is_public) { |
166 | $categories = Category::query()->active()->get(); | 166 | $categories = Category::query()->active()->get(); |
167 | 167 | ||
168 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | 168 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
169 | where('is_remove', '=', '0')-> | 169 | where('is_remove', '=', '0')-> |
170 | where('is_bd', '=', '0')-> | 170 | where('is_bd', '=', '0')-> |
171 | get(); | 171 | get(); |
172 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 172 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
173 | 173 | ||
174 | WhereHas('users', | 174 | WhereHas('users', |
175 | function (Builder $query) use ($id) { | 175 | function (Builder $query) use ($id) { |
176 | $query->Where('id', $id); | 176 | $query->Where('id', $id); |
177 | })->get(); | 177 | })->get(); |
178 | 178 | ||
179 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); | 179 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); |
180 | } else { | 180 | } else { |
181 | return redirect()->route('employer.cabinet_vacancie_danger'); | 181 | return redirect()->route('employer.cabinet_vacancie_danger'); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | // Форма предупреждения об оплате | 185 | // Форма предупреждения об оплате |
186 | public function cabinet_vacancie_danger() { | 186 | public function cabinet_vacancie_danger() { |
187 | return view('employers.add_vacancy_danger'); | 187 | return view('employers.add_vacancy_danger'); |
188 | } | 188 | } |
189 | 189 | ||
190 | // Сохранение вакансии | 190 | // Сохранение вакансии |
191 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { | 191 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { |
192 | $params_emp = $request->all(); | 192 | $params_emp = $request->all(); |
193 | 193 | ||
194 | $params_job["job_title_id"] = $params_emp['job_title_id']; | 194 | $params_job["job_title_id"] = $params_emp['job_title_id']; |
195 | //$params_job["min_salary"] = $params_emp['min_salary']; | 195 | //$params_job["min_salary"] = $params_emp['min_salary']; |
196 | //$params_job["max_salary"] = $params_emp['max_salary']; | 196 | //$params_job["max_salary"] = $params_emp['max_salary']; |
197 | //$params_job["region"] = $params_emp['region']; | 197 | //$params_job["region"] = $params_emp['region']; |
198 | //$params_job["power"] = $params_emp['power']; | 198 | //$params_job["power"] = $params_emp['power']; |
199 | //$params_job["sytki"] = $params_emp['sytki']; | 199 | //$params_job["sytki"] = $params_emp['sytki']; |
200 | //$params_job["start"] = $params_emp['start']; | 200 | //$params_job["start"] = $params_emp['start']; |
201 | //$params_job["flot"] = $params_emp['flot']; | 201 | //$params_job["flot"] = $params_emp['flot']; |
202 | //$params_job["description"] = $params_emp['description']; | 202 | //$params_job["description"] = $params_emp['description']; |
203 | 203 | ||
204 | $ad_jobs = Ad_employer::create($params_emp); | 204 | $ad_jobs = Ad_employer::create($params_emp); |
205 | //$params_job['ad_employer_id'] = $ad_jobs->id; | 205 | //$params_job['ad_employer_id'] = $ad_jobs->id; |
206 | //Ad_jobs::create($params_job); | 206 | //Ad_jobs::create($params_job); |
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'); | 209 | return redirect()->route('employer.vacancy_list'); |
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 | //dd($request->all()); | 216 | //dd($request->all()); |
217 | $Employer = Employer::query()->where('user_id', $id)->first(); | 217 | $Employer = Employer::query()->where('user_id', $id)->first(); |
218 | $vacancy_list = Ad_employer::query()->with('jobs')-> | 218 | $vacancy_list = Ad_employer::query()->with('jobs')-> |
219 | with('jobs_code')-> | 219 | with('jobs_code')-> |
220 | where('employer_id', $Employer->id); | 220 | where('employer_id', $Employer->id); |
221 | 221 | ||
222 | if (($request->has('search')) && (!empty($request->get('search')))) { | 222 | if (($request->has('search')) && (!empty($request->get('search')))) { |
223 | $search = $request->get('search'); | 223 | $search = $request->get('search'); |
224 | $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); | 224 | $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); |
225 | } | 225 | } |
226 | 226 | ||
227 | if ($request->get('sort')) { | 227 | if ($request->get('sort')) { |
228 | $sort = $request->get('sort'); | 228 | $sort = $request->get('sort'); |
229 | switch ($sort) { | 229 | switch ($sort) { |
230 | case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; | 230 | case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; |
231 | case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; | 231 | case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; |
232 | case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; | 232 | case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; |
233 | case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; | 233 | case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; |
234 | case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; | 234 | case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; |
235 | default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; | 235 | default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; |
236 | } | 236 | } |
237 | } | 237 | } |
238 | $vacancy_list = $vacancy_list->paginate(4); | 238 | $vacancy_list = $vacancy_list->paginate(4); |
239 | 239 | ||
240 | //ajax | 240 | //ajax |
241 | if ($request->ajax()) { | 241 | if ($request->ajax()) { |
242 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); | 242 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); |
243 | } else { | 243 | } else { |
244 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); | 244 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); |
245 | } | 245 | } |
246 | } | 246 | } |
247 | 247 | ||
248 | // Карточка вакансии | 248 | // Карточка вакансии |
249 | public function vacancy_edit(Ad_employer $ad_employer) { | 249 | public function vacancy_edit(Ad_employer $ad_employer) { |
250 | $id = Auth()->user()->id; | 250 | $id = Auth()->user()->id; |
251 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); | 251 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); |
252 | $jobs = Job_title::query()->OrderBy('name')-> | 252 | $jobs = Job_title::query()->OrderBy('name')-> |
253 | where('is_remove', 0)->where('is_bd', '=' , '0')->get(); | 253 | where('is_remove', 0)->where('is_bd', '=' , '0')->get(); |
254 | 254 | ||
255 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 255 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
256 | where('user_id', $id)->first(); | 256 | where('user_id', $id)->first(); |
257 | 257 | ||
258 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); | 258 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); |
259 | } | 259 | } |
260 | 260 | ||
261 | // Сохранение-редактирование записи | 261 | // Сохранение-редактирование записи |
262 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { | 262 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { |
263 | $params = $request->all(); | 263 | $params = $request->all(); |
264 | 264 | ||
265 | //$jobs['flot'] = $params['flot']; | 265 | //$jobs['flot'] = $params['flot']; |
266 | //$jobs['job_title_id'] = $params['job_title_id']; | 266 | //$jobs['job_title_id'] = $params['job_title_id']; |
267 | //$titles['position_id'] = $params['position_id']; | 267 | //$titles['position_id'] = $params['position_id']; |
268 | //unset($params['job_title_id']); | 268 | //unset($params['job_title_id']); |
269 | 269 | ||
270 | $ad_employer->update($params); | 270 | $ad_employer->update($params); |
271 | 271 | ||
272 | //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> | 272 | //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> |
273 | // where('ad_employer_id', $ad_employer->id)->first(); | 273 | // where('ad_employer_id', $ad_employer->id)->first(); |
274 | //$data = Ad_jobs::find($job_->id); | 274 | //$data = Ad_jobs::find($job_->id); |
275 | //$ad_jobs = $data->update($jobs); | 275 | //$ad_jobs = $data->update($jobs); |
276 | 276 | ||
277 | return redirect()->route('employer.vacancy_list'); | 277 | return redirect()->route('employer.vacancy_list'); |
278 | } | 278 | } |
279 | 279 | ||
280 | // Сохранение карточки вакансии | 280 | // Сохранение карточки вакансии |
281 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { | 281 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { |
282 | $all = $request->all(); | 282 | $all = $request->all(); |
283 | $ad_employer->update($all); | 283 | $ad_employer->update($all); |
284 | return redirect()->route('employer.cabinet_vacancie'); | 284 | return redirect()->route('employer.cabinet_vacancie'); |
285 | } | 285 | } |
286 | 286 | ||
287 | // Удаление карточки вакансии | 287 | // Удаление карточки вакансии |
288 | public function vacancy_delete(Ad_employer $ad_employer) { | 288 | public function vacancy_delete(Ad_employer $ad_employer) { |
289 | $ad_employer->delete(); | 289 | $ad_employer->delete(); |
290 | 290 | ||
291 | return redirect()->route('employer.vacancy_list') | 291 | return redirect()->route('employer.vacancy_list') |
292 | ->with('success', 'Данные были успешно сохранены'); | 292 | ->with('success', 'Данные были успешно сохранены'); |
293 | } | 293 | } |
294 | 294 | ||
295 | // Обновление даты | 295 | // Обновление даты |
296 | public function vacancy_up(Ad_employer $ad_employer) { | 296 | public function vacancy_up(Ad_employer $ad_employer) { |
297 | $up = date('m/d/Y h:i:s', time());; | 297 | $up = date('m/d/Y h:i:s', time());; |
298 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 298 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
299 | $vac_emp->updated_at = $up; | 299 | $vac_emp->updated_at = $up; |
300 | $vac_emp->save(); | 300 | $vac_emp->save(); |
301 | 301 | ||
302 | return redirect()->route('employer.vacancy_list'); | 302 | return redirect()->route('employer.vacancy_list'); |
303 | // начало конца | 303 | // начало конца |
304 | } | 304 | } |
305 | 305 | ||
306 | //Видимость вакансии | 306 | //Видимость вакансии |
307 | public function vacancy_eye(Ad_employer $ad_employer, $status) { | 307 | public function vacancy_eye(Ad_employer $ad_employer, $status) { |
308 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 308 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
309 | $vac_emp->active_is = $status; | 309 | $vac_emp->active_is = $status; |
310 | $vac_emp->save(); | 310 | $vac_emp->save(); |
311 | 311 | ||
312 | return redirect()->route('employer.vacancy_list'); | 312 | return redirect()->route('employer.vacancy_list'); |
313 | } | 313 | } |
314 | 314 | ||
315 | //Вакансия редактирования (шаблон) | 315 | //Вакансия редактирования (шаблон) |
316 | public function vacancy_update(Ad_employer $id) { | 316 | public function vacancy_update(Ad_employer $id) { |
317 | 317 | ||
318 | } | 318 | } |
319 | 319 | ||
320 | //Отклики на вакансию - лист | 320 | //Отклики на вакансию - лист |
321 | public function answers(Employer $employer, Request $request) { | 321 | public function answers(Employer $employer, Request $request) { |
322 | $user_id = Auth()->user()->id; | 322 | $user_id = Auth()->user()->id; |
323 | $answer = Ad_employer::query()->where('employer_id', $employer->id); | 323 | $answer = Ad_employer::query()->where('employer_id', $employer->id); |
324 | if ($request->has('search')) { | 324 | if ($request->has('search')) { |
325 | $search = trim($request->get('search')); | 325 | $search = trim($request->get('search')); |
326 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); | 326 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); |
327 | } | 327 | } |
328 | 328 | ||
329 | $answer = $answer->with('response')->OrderByDESC('id')->get(); | 329 | $answer = $answer->with('response')->OrderByDESC('id')->get(); |
330 | 330 | ||
331 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); | 331 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); |
332 | } | 332 | } |
333 | 333 | ||
334 | //Обновление статуса | 334 | //Обновление статуса |
335 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { | 335 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { |
336 | $ad_response->update(Array('flag' => $flag)); | 336 | $ad_response->update(Array('flag' => $flag)); |
337 | return redirect()->route('employer.answers', ['employer' => $employer->id]); | 337 | return redirect()->route('employer.answers', ['employer' => $employer->id]); |
338 | } | 338 | } |
339 | 339 | ||
340 | //Страницы сообщений список | 340 | //Страницы сообщений список |
341 | public function messages($type_message) { | 341 | public function messages($type_message) { |
342 | $user_id = Auth()->user()->id; | 342 | $user_id = Auth()->user()->id; |
343 | 343 | ||
344 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> | 344 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> |
345 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); | 345 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); |
346 | 346 | ||
347 | $messages_output = Message::query()->with('vacancies')-> | 347 | $messages_output = Message::query()->with('vacancies')-> |
348 | with('user_to')->where('user_id', $user_id)-> | 348 | with('user_to')->where('user_id', $user_id)-> |
349 | OrderByDesc('created_at'); | 349 | OrderByDesc('created_at'); |
350 | 350 | ||
351 | |||
352 | $count_input = $messages_input->count(); | 351 | $count_input = $messages_input->count(); |
353 | $count_output = $messages_output->count(); | 352 | $count_output = $messages_output->count(); |
354 | 353 | ||
355 | if ($type_message == 'input') { | 354 | if ($type_message == 'input') { |
356 | $messages = $messages_input->paginate(5); | 355 | $messages = $messages_input->paginate(5); |
357 | } | 356 | } |
358 | 357 | ||
359 | if ($type_message == 'output') { | 358 | if ($type_message == 'output') { |
360 | $messages = $messages_output->paginate(5); | 359 | $messages = $messages_output->paginate(5); |
361 | } | 360 | } |
362 | 361 | ||
363 | //dd($user_id, $messages[2]->vacancies); | 362 | //dd($user_id, $messages[2]->vacancies); |
364 | //jobs); | 363 | //jobs); |
365 | 364 | ||
366 | return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); | 365 | return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); |
367 | } | 366 | } |
368 | 367 | ||
369 | // Диалог между пользователями | 368 | // Диалог между пользователями |
370 | public function dialog(Request $request, User_Model $user1, User_Model $user2) { | 369 | public function dialog(Request $request, User_Model $user1, User_Model $user2) { |
371 | // Получение параметров. | 370 | // Получение параметров. |
372 | if ($request->has('ad_employer')){ | 371 | if ($request->has('ad_employer')){ |
373 | $ad_employer = $request->get('ad_employer'); | 372 | $ad_employer = $request->get('ad_employer'); |
374 | } else { | 373 | } else { |
375 | $ad_employer = 0; | 374 | $ad_employer = 0; |
376 | } | 375 | } |
377 | 376 | ||
378 | if (isset($user2->id)) { | 377 | if (isset($user2->id)) { |
379 | $companion = User_Model::query()->with('workers')-> | 378 | $companion = User_Model::query()->with('workers')-> |
380 | with('employers')-> | 379 | with('employers')-> |
381 | where('id', $user2->id)->first(); | 380 | where('id', $user2->id)->first(); |
382 | } | 381 | } |
383 | 382 | ||
384 | $Messages = Message::query()-> | 383 | $Messages = Message::query()-> |
385 | where('ad_employer_id', '=', $ad_employer)-> | 384 | where('ad_employer_id', '=', $ad_employer)-> |
386 | where(function($query) use ($user1, $user2) { | 385 | where(function($query) use ($user1, $user2) { |
387 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); | 386 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); |
388 | })->orWhere(function($query) use ($user1, $user2) { | 387 | })->orWhere(function($query) use ($user1, $user2) { |
389 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); | 388 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); |
390 | })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get(); | 389 | })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get(); |
391 | 390 | ||
392 | $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; | 391 | $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; |
393 | 392 | ||
394 | //$ad_employer = null; | 393 | //$ad_employer = null; |
395 | //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); | 394 | //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); |
396 | $sender = $user1; | 395 | $sender = $user1; |
397 | 396 | ||
398 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); | 397 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); |
399 | } | 398 | } |
400 | 399 | ||
401 | // Регистрация работодателя | 400 | // Регистрация работодателя |
402 | public function register_employer(Request $request) { | 401 | public function register_employer(Request $request) { |
403 | $params = $request->all(); | 402 | $params = $request->all(); |
404 | 403 | ||
405 | $rules = [ | 404 | $rules = [ |
406 | //'surname' => ['required', 'string', 'max:255'], | 405 | //'surname' => ['required', 'string', 'max:255'], |
407 | //'name_man' => ['required', 'string', 'max:255'], | 406 | //'name_man' => ['required', 'string', 'max:255'], |
408 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], | 407 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], |
409 | 'name_company' => ['required', 'string', 'max:255'], | 408 | 'name_company' => ['required', 'string', 'max:255'], |
410 | 'password' => ['required', 'string', 'min:6'], | 409 | 'password' => ['required', 'string', 'min:6'], |
411 | ]; | 410 | ]; |
412 | 411 | ||
413 | 412 | ||
414 | $messages = [ | 413 | $messages = [ |
415 | 'required' => 'Укажите обязательное поле', | 414 | 'required' => 'Укажите обязательное поле', |
416 | 'min' => [ | 415 | 'min' => [ |
417 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 416 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
418 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 417 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
419 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 418 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
420 | ], | 419 | ], |
421 | 'max' => [ | 420 | 'max' => [ |
422 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 421 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
423 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 422 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
424 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 423 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
425 | ] | 424 | ] |
426 | ]; | 425 | ]; |
427 | 426 | ||
428 | $email = $request->get('email'); | 427 | $email = $request->get('email'); |
429 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | 428 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { |
430 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | 429 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); |
431 | } | 430 | } |
432 | 431 | ||
433 | if ($request->get('password') !== $request->get('confirmed')){ | 432 | if ($request->get('password') !== $request->get('confirmed')){ |
434 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | 433 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); |
435 | } | 434 | } |
436 | 435 | ||
437 | if (strlen($request->get('password')) < 6) { | 436 | if (strlen($request->get('password')) < 6) { |
438 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | 437 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); |
439 | } | 438 | } |
440 | /* | 439 | /* |
441 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); | 440 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); |
442 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', | 441 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', |
443 | 'X', 'C', 'V', 'B', 'N', 'M'); | 442 | 'X', 'C', 'V', 'B', 'N', 'M'); |
444 | $spec_bool = false; | 443 | $spec_bool = false; |
445 | $alpha_bool = false; | 444 | $alpha_bool = false; |
446 | 445 | ||
447 | $haystack = $request->get('password'); | 446 | $haystack = $request->get('password'); |
448 | 447 | ||
449 | foreach ($specsumbol as $it) { | 448 | foreach ($specsumbol as $it) { |
450 | if (strpos($haystack, $it) !== false) { | 449 | if (strpos($haystack, $it) !== false) { |
451 | $spec_bool = true; | 450 | $spec_bool = true; |
452 | } | 451 | } |
453 | } | 452 | } |
454 | 453 | ||
455 | foreach ($alpha as $it) { | 454 | foreach ($alpha as $it) { |
456 | if (strpos($haystack, $it) !== false) { | 455 | if (strpos($haystack, $it) !== false) { |
457 | $alpha_bool = true; | 456 | $alpha_bool = true; |
458 | } | 457 | } |
459 | } | 458 | } |
460 | 459 | ||
461 | if ((!$spec_bool) || (!$alpha_bool)) { | 460 | if ((!$spec_bool) || (!$alpha_bool)) { |
462 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); | 461 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); |
463 | }*/ | 462 | }*/ |
464 | 463 | ||
465 | if (empty($request->get('surname'))) { | 464 | if (empty($request->get('surname'))) { |
466 | $params['surname'] = 'Неизвестно'; | 465 | $params['surname'] = 'Неизвестно'; |
467 | } | 466 | } |
468 | if (empty($request->get('name_man'))) { | 467 | if (empty($request->get('name_man'))) { |
469 | $params['name_man'] = 'Неизвестно'; | 468 | $params['name_man'] = 'Неизвестно'; |
470 | } | 469 | } |
471 | $validator = Validator::make($params, $rules, $messages); | 470 | $validator = Validator::make($params, $rules, $messages); |
472 | 471 | ||
473 | if ($validator->fails()) { | 472 | if ($validator->fails()) { |
474 | return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | 473 | return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); |
475 | } else { | 474 | } else { |
476 | $user = $this->create($params); | 475 | $user = $this->create($params); |
477 | event(new Registered($user)); | 476 | event(new Registered($user)); |
478 | Auth::guard()->login($user); | 477 | Auth::guard()->login($user); |
479 | } | 478 | } |
480 | 479 | ||
481 | if ($user) { | 480 | if ($user) { |
482 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; | 481 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; |
483 | } else { | 482 | } else { |
484 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | 483 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); |
485 | } | 484 | } |
486 | } | 485 | } |
487 | 486 | ||
488 | // Создание пользователя | 487 | // Создание пользователя |
489 | protected function create(array $data) | 488 | protected function create(array $data) |
490 | { | 489 | { |
491 | $Use = new User_Model(); | 490 | $Use = new User_Model(); |
492 | $Code_user = $Use->create([ | 491 | $Code_user = $Use->create([ |
493 | 'name' => $data['surname']." ".$data['name_man'], | 492 | 'name' => $data['surname']." ".$data['name_man'], |
494 | 'name_man' => $data['name_man'], | 493 | 'name_man' => $data['name_man'], |
495 | 'surname' => $data['surname'], | 494 | 'surname' => $data['surname'], |
496 | 'surname2' => $data['surname2'], | 495 | 'surname2' => $data['surname2'], |
497 | 'subscribe_email' => $data['email'], | 496 | 'subscribe_email' => $data['email'], |
498 | 'email' => $data['email'], | 497 | 'email' => $data['email'], |
499 | 'telephone' => $data['telephone'], | 498 | 'telephone' => $data['telephone'], |
500 | 'is_worker' => 0, | 499 | 'is_worker' => 0, |
501 | 'password' => Hash::make($data['password']), | 500 | 'password' => Hash::make($data['password']), |
502 | 'pubpassword' => base64_encode($data['password']), | 501 | 'pubpassword' => base64_encode($data['password']), |
503 | 'email_verified_at' => Carbon::now() | 502 | 'email_verified_at' => Carbon::now() |
504 | ]); | 503 | ]); |
505 | 504 | ||
506 | if ($Code_user->id > 0) { | 505 | if ($Code_user->id > 0) { |
507 | $Employer = new Employer(); | 506 | $Employer = new Employer(); |
508 | $Employer->user_id = $Code_user->id; | 507 | $Employer->user_id = $Code_user->id; |
509 | $Employer->name_company = $data['name_company']; | 508 | $Employer->name_company = $data['name_company']; |
510 | $Employer->email = $data['email']; | 509 | $Employer->email = $data['email']; |
511 | $Employer->telephone = $data['telephone']; | 510 | $Employer->telephone = $data['telephone']; |
512 | $Employer->code = Tools::generator_id(10); | 511 | $Employer->code = Tools::generator_id(10); |
513 | $Employer->save(); | 512 | $Employer->save(); |
514 | 513 | ||
515 | return $Code_user; | 514 | return $Code_user; |
516 | } | 515 | } |
517 | } | 516 | } |
518 | 517 | ||
519 | // Отправка сообщения от работодателя | 518 | // Отправка сообщения от работодателя |
520 | public function send_message(MessagesRequiest $request) { | 519 | public function send_message(MessagesRequiest $request) { |
521 | $params = $request->all(); | 520 | $params = $request->all(); |
522 | dd($params); | 521 | dd($params); |
523 | $user1 = $params['user_id']; | 522 | $user1 = $params['user_id']; |
524 | $user2 = $params['to_user_id']; | 523 | $user2 = $params['to_user_id']; |
525 | 524 | ||
526 | if ($request->has('file')) { | 525 | if ($request->has('file')) { |
527 | $params['file'] = $request->file('file')->store("messages", 'public'); | 526 | $params['file'] = $request->file('file')->store("messages", 'public'); |
528 | } | 527 | } |
529 | Message::create($params); | 528 | Message::create($params); |
530 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 529 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
531 | } | 530 | } |
532 | 531 | ||
533 | public function test123(Request $request) { | 532 | public function test123(Request $request) { |
534 | $params = $request->all(); | 533 | $params = $request->all(); |
535 | $user1 = $params['user_id']; | 534 | $user1 = $params['user_id']; |
536 | $user2 = $params['to_user_id']; | 535 | $user2 = $params['to_user_id']; |
536 | $id_vacancy = $params['ad_employer_id']; | ||
537 | $ad_name = $params['ad_name']; | ||
537 | 538 | ||
538 | $rules = [ | 539 | $rules = [ |
539 | 'text' => 'required|min:1|max:150000', | 540 | 'text' => 'required|min:1|max:150000', |
540 | 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' | 541 | 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' |
541 | ]; | 542 | ]; |
542 | $messages = [ | 543 | $messages = [ |
543 | 'required' => 'Укажите обязательное поле', | 544 | 'required' => 'Укажите обязательное поле', |
544 | 'min' => [ | 545 | 'min' => [ |
545 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 546 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
546 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 547 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
547 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 548 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
548 | ], | 549 | ], |
549 | 'max' => [ | 550 | 'max' => [ |
550 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 551 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
551 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 552 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
552 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 553 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
553 | ] | 554 | ] |
554 | ]; | 555 | ]; |
555 | 556 | ||
556 | $validator = Validator::make($request->all(), $rules, $messages); | 557 | $validator = Validator::make($request->all(), $rules, $messages); |
557 | 558 | ||
558 | if ($validator->fails()) { | 559 | if ($validator->fails()) { |
559 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) | 560 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) |
560 | ->withErrors($validator); | 561 | ->withErrors($validator); |
561 | } else { | 562 | } else { |
562 | if ($request->has('file')) { | 563 | if ($request->has('file')) { |
563 | $params['file'] = $request->file('file')->store("messages", 'public'); | 564 | $params['file'] = $request->file('file')->store("messages", 'public'); |
564 | } | 565 | } |
565 | Message::create($params); | 566 | Message::create($params); |
566 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 567 | //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
568 | return redirect()->route('employer.dialog', | ||
569 | ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]); | ||
567 | 570 | ||
568 | } | 571 | } |
569 | } | 572 | } |
570 | 573 | ||
571 | //Избранные люди | 574 | //Избранные люди |
572 | public function favorites(Request $request) { | 575 | public function favorites(Request $request) { |
573 | $IP_address = RusDate::ip_addr_client(); | 576 | $IP_address = RusDate::ip_addr_client(); |
574 | $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); | 577 | $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); |
575 | 578 | ||
576 | if ($Arr->count()) { | 579 | if ($Arr->count()) { |
577 | $A = Array(); | 580 | $A = Array(); |
578 | foreach ($Arr as $it) { | 581 | foreach ($Arr as $it) { |
579 | $A[] = $it->code_record; | 582 | $A[] = $it->code_record; |
580 | } | 583 | } |
581 | 584 | ||
582 | $Workers = Worker::query()->whereIn('id', $A); | 585 | $Workers = Worker::query()->whereIn('id', $A); |
583 | } else { | 586 | } else { |
584 | $Workers = Worker::query()->where('id', '=', '0'); | 587 | $Workers = Worker::query()->where('id', '=', '0'); |
585 | } | 588 | } |
586 | 589 | ||
587 | if (($request->has('search')) && (!empty($request->get('search')))) { | 590 | if (($request->has('search')) && (!empty($request->get('search')))) { |
588 | $search = $request->get('search'); | 591 | $search = $request->get('search'); |
589 | 592 | ||
590 | $Workers = $Workers->WhereHas('users', | 593 | $Workers = $Workers->WhereHas('users', |
591 | function (Builder $query) use ($search) { | 594 | function (Builder $query) use ($search) { |
592 | $query->Where('surname', 'LIKE', "%$search%") | 595 | $query->Where('surname', 'LIKE', "%$search%") |
593 | ->orWhere('name_man', 'LIKE', "%$search%") | 596 | ->orWhere('name_man', 'LIKE', "%$search%") |
594 | ->orWhere('surname2', 'LIKE', "%$search%"); | 597 | ->orWhere('surname2', 'LIKE', "%$search%"); |
595 | }); | 598 | }); |
596 | } else { | 599 | } else { |
597 | $Workers = $Workers->with('users'); | 600 | $Workers = $Workers->with('users'); |
598 | } | 601 | } |
599 | 602 | ||
600 | $Workers = $Workers->get(); | 603 | $Workers = $Workers->get(); |
601 | 604 | ||
602 | 605 | ||
603 | return view('employers.favorite', compact('Workers')); | 606 | return view('employers.favorite', compact('Workers')); |
604 | } | 607 | } |
605 | 608 | ||
606 | // База данных | 609 | // База данных |
607 | public function bd(Request $request) { | 610 | public function bd(Request $request) { |
608 | // для типа BelongsTo | 611 | // для типа BelongsTo |
609 | //$documents = Document::query()->orderBy(Location::select('name') | 612 | //$documents = Document::query()->orderBy(Location::select('name') |
610 | // ->whereColumn('locations.id', 'documents.location_id') | 613 | // ->whereColumn('locations.id', 'documents.location_id') |
611 | //); | 614 | //); |
612 | 615 | ||
613 | // для типа HasOne/Many | 616 | // для типа HasOne/Many |
614 | // $documents = Document::::query()->orderBy(Location::select('name') | 617 | // $documents = Document::::query()->orderBy(Location::select('name') |
615 | // ->whereColumn('locations.document_id', 'documents.id') | 618 | // ->whereColumn('locations.document_id', 'documents.id') |
616 | //); | 619 | //); |
617 | 620 | ||
618 | 621 | ||
619 | $users = User_Model::query()->with('workers'); | 622 | $users = User_Model::query()->with('workers'); |
620 | 623 | ||
621 | if ($request->has('search')) { | 624 | if ($request->has('search')) { |
622 | $find_key = $request->get('search'); | 625 | $find_key = $request->get('search'); |
623 | $users = $users->where('name', 'LIKE', "%$find_key%") | 626 | $users = $users->where('name', 'LIKE', "%$find_key%") |
624 | ->orWhere('surname', 'LIKE', "%$find_key%") | 627 | ->orWhere('surname', 'LIKE', "%$find_key%") |
625 | ->orWhere('name_man', 'LIKE', "%$find_key%") | 628 | ->orWhere('name_man', 'LIKE', "%$find_key%") |
626 | ->orWhere('email', 'LIKE', "%$find_key%") | 629 | ->orWhere('email', 'LIKE', "%$find_key%") |
627 | ->orWhere('telephone', 'LIKE', "%$find_key%"); | 630 | ->orWhere('telephone', 'LIKE', "%$find_key%"); |
628 | } | 631 | } |
629 | 632 | ||
630 | // Данные | 633 | // Данные |
631 | $users = $users->Baseuser()-> | 634 | $users = $users->Baseuser()-> |
632 | orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id')); | 635 | orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id')); |
633 | $count_users = $users; | 636 | $count_users = $users; |
634 | $users = $users->paginate(5); | 637 | $users = $users->paginate(5); |
635 | 638 | ||
636 | 639 | ||
637 | return view('employers.bd', compact('users', 'count_users')); | 640 | return view('employers.bd', compact('users', 'count_users')); |
638 | } | 641 | } |
639 | 642 | ||
640 | //Настройка уведомлений | 643 | //Настройка уведомлений |
641 | public function subscribe() { | 644 | public function subscribe() { |
642 | return view('employers.subcribe'); | 645 | return view('employers.subcribe'); |
643 | } | 646 | } |
644 | 647 | ||
645 | //Установка уведомлений сохранение | 648 | //Установка уведомлений сохранение |
646 | public function save_subscribe(Request $request) { | 649 | public function save_subscribe(Request $request) { |
647 | dd($request->all()); | 650 | dd($request->all()); |
648 | $msg = $request->validate([ | 651 | $msg = $request->validate([ |
649 | 'subscribe_email' => 'required|email|min:5|max:255', | 652 | 'subscribe_email' => 'required|email|min:5|max:255', |
650 | ]); | 653 | ]); |
651 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); | 654 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); |
652 | } | 655 | } |
653 | 656 | ||
654 | //Сбросить форму с паролем | 657 | //Сбросить форму с паролем |
655 | public function password_reset() { | 658 | public function password_reset() { |
656 | $email = Auth()->user()->email; | 659 | $email = Auth()->user()->email; |
657 | return view('employers.password-reset', compact('email')); | 660 | return view('employers.password-reset', compact('email')); |
658 | } | 661 | } |
659 | 662 | ||
660 | //Обновление пароля | 663 | //Обновление пароля |
661 | public function new_password(Request $request) { | 664 | public function new_password(Request $request) { |
662 | $use = Auth()->user(); | 665 | $use = Auth()->user(); |
663 | $request->validate([ | 666 | $request->validate([ |
664 | 'password' => 'required|string', | 667 | 'password' => 'required|string', |
665 | 'new_password' => 'required|string', | 668 | 'new_password' => 'required|string', |
666 | 'new_password2' => 'required|string' | 669 | 'new_password2' => 'required|string' |
667 | ]); | 670 | ]); |
668 | 671 | ||
669 | if ($request->get('new_password') == $request->get('new_password2')) | 672 | if ($request->get('new_password') == $request->get('new_password2')) |
670 | if ($request->get('password') !== $request->get('new_password')) { | 673 | if ($request->get('password') !== $request->get('new_password')) { |
671 | $credentials = $request->only('email', 'password'); | 674 | $credentials = $request->only('email', 'password'); |
672 | if (Auth::attempt($credentials)) { | 675 | if (Auth::attempt($credentials)) { |
673 | 676 | ||
674 | if (!is_null($use->email_verified_at)){ | 677 | if (!is_null($use->email_verified_at)){ |
675 | 678 | ||
676 | $user_data = User_Model::find($use->id); | 679 | $user_data = User_Model::find($use->id); |
677 | $user_data->update([ | 680 | $user_data->update([ |
678 | 'password' => Hash::make($request->get('new_password')), | 681 | 'password' => Hash::make($request->get('new_password')), |
679 | 'pubpassword' => base64_encode($request->get('new_password')), | 682 | 'pubpassword' => base64_encode($request->get('new_password')), |
680 | ]); | 683 | ]); |
681 | return redirect() | 684 | return redirect() |
682 | ->route('employer.password_reset') | 685 | ->route('employer.password_reset') |
683 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 686 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
684 | } | 687 | } |
685 | 688 | ||
686 | return redirect() | 689 | return redirect() |
687 | ->route('employer.password_reset') | 690 | ->route('employer.password_reset') |
688 | ->withError('Данная учетная запись не было верифицированна!'); | 691 | ->withError('Данная учетная запись не было верифицированна!'); |
689 | } | 692 | } |
690 | } | 693 | } |
691 | 694 | ||
692 | return redirect() | 695 | return redirect() |
693 | ->route('employer.password_reset') | 696 | ->route('employer.password_reset') |
694 | ->withErrors('Не совпадение данных, обновите пароли!'); | 697 | ->withErrors('Не совпадение данных, обновите пароли!'); |
695 | } | 698 | } |
696 | 699 | ||
697 | 700 | ||
698 | 701 | ||
699 | // Форма Удаление пипла | 702 | // Форма Удаление пипла |
700 | public function delete_people() { | 703 | public function delete_people() { |
701 | $login = Auth()->user()->email; | 704 | $login = Auth()->user()->email; |
702 | return view('employers.delete_people', compact('login')); | 705 | return view('employers.delete_people', compact('login')); |
703 | } | 706 | } |
704 | 707 | ||
705 | // Удаление аккаунта | 708 | // Удаление аккаунта |
706 | public function action_delete_user(Request $request) { | 709 | public function action_delete_user(Request $request) { |
707 | $Answer = $request->all(); | 710 | $Answer = $request->all(); |
708 | $user_id = Auth()->user()->id; | 711 | $user_id = Auth()->user()->id; |
709 | $request->validate([ | 712 | $request->validate([ |
710 | 'password' => 'required|string', | 713 | 'password' => 'required|string', |
711 | ]); | 714 | ]); |
712 | 715 | ||
713 | $credentials = $request->only('email', 'password'); | 716 | $credentials = $request->only('email', 'password'); |
714 | if (Auth::attempt($credentials)) { | 717 | if (Auth::attempt($credentials)) { |
715 | Auth::logout(); | 718 | Auth::logout(); |
716 | $it = User_Model::find($user_id); | 719 | $it = User_Model::find($user_id); |
717 | $it->delete(); | 720 | $it->delete(); |
718 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 721 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
719 | } else { | 722 | } else { |
720 | return redirect()->route('employer.delete_people') | 723 | return redirect()->route('employer.delete_people') |
721 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 724 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
722 | } | 725 | } |
723 | } | 726 | } |
724 | 727 | ||
725 | public function ajax_delete_user(Request $request) { | 728 | public function ajax_delete_user(Request $request) { |
726 | $Answer = $request->all(); | 729 | $Answer = $request->all(); |
727 | $user_id = Auth()->user()->id; | 730 | $user_id = Auth()->user()->id; |
728 | $request->validate([ | 731 | $request->validate([ |
729 | 'password' => 'required|string', | 732 | 'password' => 'required|string', |
730 | ]); | 733 | ]); |
731 | $credentials = $request->only('email', 'password'); | 734 | $credentials = $request->only('email', 'password'); |
732 | if (Auth::attempt($credentials)) { | 735 | if (Auth::attempt($credentials)) { |
733 | 736 | ||
734 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', | 737 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', |
735 | 'email' => $request->get('email'), | 738 | 'email' => $request->get('email'), |
736 | 'password' => $request->get('password'))); | 739 | 'password' => $request->get('password'))); |
737 | } else { | 740 | } else { |
738 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); | 741 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); |
739 | } | 742 | } |
740 | } | 743 | } |
741 | 744 | ||
742 | // FAQ - Вопросы/ответы для работодателей и соискателей | 745 | // FAQ - Вопросы/ответы для работодателей и соискателей |
743 | public function faq() { | 746 | public function faq() { |
744 | return view('employers.faq'); | 747 | return view('employers.faq'); |
745 | } | 748 | } |
746 | 749 | ||
747 | // Рассылка сообщений | 750 | // Рассылка сообщений |
748 | public function send_all_messages() { | 751 | public function send_all_messages() { |
749 | $id = Auth()->user()->id; | 752 | $id = Auth()->user()->id; |
750 | $sending = Employer::query()->where('user_id', '=', "$id")->first(); | 753 | $sending = Employer::query()->where('user_id', '=', "$id")->first(); |
751 | if ($sending->sending_is) | 754 | if ($sending->sending_is) |
752 | return view('employers.send_all'); | 755 | return view('employers.send_all'); |
753 | else | 756 | else |
754 | return view('employers.send_all_danger'); | 757 | return view('employers.send_all_danger'); |
755 | } | 758 | } |
756 | 759 | ||
757 | // Отправка сообщений для информации | 760 | // Отправка сообщений для информации |
758 | public function send_all_post(Request $request) { | 761 | public function send_all_post(Request $request) { |
759 | $data = $request->all(); | 762 | $data = $request->all(); |
760 | 763 | ||
761 | $emails = User_Model::query()->where('is_worker', '1')->get(); | 764 | $emails = User_Model::query()->where('is_worker', '1')->get(); |
762 | 765 | ||
763 | foreach ($emails as $e) { | 766 | foreach ($emails as $e) { |
764 | Mail::to($e->email)->send(new SendAllMessages($data)); | 767 | Mail::to($e->email)->send(new SendAllMessages($data)); |
765 | } | 768 | } |
766 | 769 | ||
767 | return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); | 770 | return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); |
768 | } | 771 | } |
769 | 772 | ||
770 | // База резюме | 773 | // База резюме |
771 | public function bd_tupe(Request $request) { | 774 | public function bd_tupe(Request $request) { |
772 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); | 775 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); |
773 | 776 | ||
774 | return view('employers.bd_tupe', compact('Resume')); | 777 | return view('employers.bd_tupe', compact('Resume')); |
775 | } | 778 | } |
776 | 779 | ||
777 | ////////////////////////////////////////////////////////////////// | 780 | ////////////////////////////////////////////////////////////////// |
778 | // Отправил сообщение | 781 | // Отправил сообщение |
779 | ////////////////////////////////////////////////////////////////// | 782 | ////////////////////////////////////////////////////////////////// |
780 | public function new_message(Request $request) { | 783 | public function new_message(Request $request) { |
781 | $params = $request->all(); | 784 | $params = $request->all(); |
782 | $id = $params['_user_id']; | 785 | $id = $params['_user_id']; |
783 | $message = new Message(); | 786 | $message = new Message(); |
784 | $message->user_id = $params['_user_id']; | 787 | $message->user_id = $params['_user_id']; |
785 | $message->to_user_id = $params['_to_user_id']; | 788 | $message->to_user_id = $params['_to_user_id']; |
786 | $message->title = $params['title']; | 789 | $message->title = $params['title']; |
787 | $message->text = $params['text']; | 790 | $message->text = $params['text']; |
788 | if ($request->has('_file')) { | 791 | if ($request->has('_file')) { |
789 | $message->file = $request->file('_file')->store("worker/$id", 'public'); | 792 | $message->file = $request->file('_file')->store("worker/$id", 'public'); |
790 | } | 793 | } |
791 | $message->ad_employer_id = $params['_vacancy']; | 794 | $message->ad_employer_id = $params['_vacancy']; |
792 | $message->flag_new = 1; | 795 | $message->flag_new = 1; |
793 | $id_message = $message->save(); | 796 | $id_message = $message->save(); |
794 | 797 | ||
795 | //$data['message_id'] = $id_message; | 798 | //$data['message_id'] = $id_message; |
796 | //$data['ad_employer_id'] = $params['_vacancy']; | 799 | //$data['ad_employer_id'] = $params['_vacancy']; |
797 | //$data['job_title_id'] = 0; | 800 | //$data['job_title_id'] = 0; |
798 | 801 | ||
799 | $data['flag'] = 1; | 802 | $data['flag'] = 1; |
800 | //$ad_responce = ad_response::create($data); | 803 | //$ad_responce = ad_response::create($data); |
801 | return redirect()->route('employer.messages', ['type_message' => 'output']); | 804 | return redirect()->route('employer.messages', ['type_message' => 'output']); |
802 | } | 805 | } |
803 | 806 | ||
804 | // Восстановление пароля | 807 | // Восстановление пароля |
805 | public function repair_password(Request $request) { | 808 | public function repair_password(Request $request) { |
806 | $params = $request->get('email'); | 809 | $params = $request->get('email'); |
807 | } | 810 | } |
808 | 811 | ||
809 | // Избранные люди на корабль | 812 | // Избранные люди на корабль |
810 | public function selected_people(Request $request) { | 813 | public function selected_people(Request $request) { |
811 | $id = $request->get('id'); | 814 | $id = $request->get('id'); |
812 | $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | 815 | $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
813 | where('is_remove', '=', '0')-> | 816 | where('is_remove', '=', '0')-> |
814 | where('is_bd', '=', '0')-> | 817 | where('is_bd', '=', '0')-> |
815 | where('position_id', $id)-> | 818 | where('position_id', $id)-> |
816 | get(); | 819 | get(); |
817 | return view('favorite_people', compact('favorite_people')); | 820 | return view('favorite_people', compact('favorite_people')); |
818 | } | 821 | } |
819 | } | 822 | } |
app/Http/Controllers/MainController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Classes\Tools; | 6 | use App\Classes\Tools; |
7 | use App\Mail\MailRegistration; | 7 | use App\Mail\MailRegistration; |
8 | use App\Mail\MailRepair; | 8 | use App\Mail\MailRepair; |
9 | use App\Models\Ad_employer; | 9 | use App\Models\Ad_employer; |
10 | use App\Models\Ad_jobs; | 10 | use App\Models\Ad_jobs; |
11 | use App\Models\Category; | 11 | use App\Models\Category; |
12 | use App\Models\Education; | 12 | use App\Models\Education; |
13 | use App\Models\Employer; | 13 | use App\Models\Employer; |
14 | use App\Models\employers_main; | 14 | use App\Models\employers_main; |
15 | use App\Models\Job_title; | 15 | use App\Models\Job_title; |
16 | use App\Models\Like_vacancy; | 16 | use App\Models\Like_vacancy; |
17 | use App\Models\Like_worker; | 17 | use App\Models\Like_worker; |
18 | use App\Models\News; | 18 | use App\Models\News; |
19 | use App\Models\Positions; | 19 | use App\Models\Positions; |
20 | use App\Models\reclame; | 20 | use App\Models\reclame; |
21 | use App\Models\User; | 21 | use App\Models\User; |
22 | use Illuminate\Http\Request; | 22 | use Illuminate\Http\Request; |
23 | use Illuminate\Support\Facades\Auth; | 23 | use Illuminate\Support\Facades\Auth; |
24 | use Illuminate\Support\Facades\DB; | 24 | use Illuminate\Support\Facades\DB; |
25 | use Illuminate\Support\Facades\Hash; | 25 | use Illuminate\Support\Facades\Hash; |
26 | use Illuminate\Support\Facades\Mail; | 26 | use Illuminate\Support\Facades\Mail; |
27 | use Illuminate\Support\Facades\Validator; | 27 | use Illuminate\Support\Facades\Validator; |
28 | use App\Classes\StatusUser; | 28 | use App\Classes\StatusUser; |
29 | 29 | ||
30 | class MainController extends Controller | 30 | class MainController extends Controller |
31 | { | 31 | { |
32 | // Главная страница публичной части | 32 | // Главная страница публичной части |
33 | public function index() { | 33 | public function index() { |
34 | $news = News::query()->orderByDesc('id')->limit(6)->get(); | 34 | $news = News::query()->orderByDesc('id')->limit(6)->get(); |
35 | 35 | ||
36 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') | 36 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') |
37 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') | 37 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') |
38 | ->OrderByDesc('created_at') | 38 | ->OrderByDesc('created_at') |
39 | ->GroupBy('categories.id') | 39 | ->GroupBy('categories.id') |
40 | ->get(); | 40 | ->get(); |
41 | 41 | ||
42 | //$Position = Category::query()->where('is_remove', '=', '0')->get(); | 42 | //$Position = Category::query()->where('is_remove', '=', '0')->get(); |
43 | $Job_title = Job_title::query()->where('is_remove', '=', '0')-> | 43 | $Job_title = Job_title::query()->where('is_remove', '=', '0')-> |
44 | where('is_bd', '=', '0')->orderBy('name')->get(); | 44 | where('is_bd', '=', '0')->orderBy('name')->get(); |
45 | 45 | ||
46 | /*$BigFlot = Array(); | 46 | /*$BigFlot = Array(); |
47 | foreach ($Position as $position) { | 47 | foreach ($Position as $position) { |
48 | $BigFlot[] = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> | 48 | $BigFlot[] = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> |
49 | orderBy('job_titles.sort')-> | 49 | orderBy('job_titles.sort')-> |
50 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 50 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
51 | where('position_ship', "$position->name")-> | 51 | where('position_ship', "$position->name")-> |
52 | groupby('job_title_id','position_ship')-> | 52 | groupby('job_title_id','position_ship')-> |
53 | get(); | 53 | get(); |
54 | } | 54 | } |
55 | $BigFlot = Array(); | 55 | $BigFlot = Array(); |
56 | foreach ($Position as $position) { | 56 | foreach ($Position as $position) { |
57 | $BigFlot[] = Ad_jobs::query()->with(['job_title' => function($query) { | 57 | $BigFlot[] = Ad_jobs::query()->with(['job_title' => function($query) { |
58 | $query->OrderBy('sort'); | 58 | $query->OrderBy('sort'); |
59 | }])->whereHas('job_title', function ($query) use ($position) { | 59 | }])->whereHas('job_title', function ($query) use ($position) { |
60 | $query->where('position_id', $position->id); | 60 | $query->where('position_id', $position->id); |
61 | })-> | 61 | })-> |
62 | distinct('job_title_id')-> | 62 | distinct('job_title_id')-> |
63 | get(); | 63 | get(); |
64 | }*/ | 64 | }*/ |
65 | /*$BigFlot = Array(); | 65 | /*$BigFlot = Array(); |
66 | foreach ($Position as $position) { | 66 | foreach ($Position as $position) { |
67 | $BigFlot[$position->id] = DB::table('ad_jobs')-> | 67 | $BigFlot[$position->id] = DB::table('ad_jobs')-> |
68 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name, job_titles.position_id')-> | 68 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name, job_titles.position_id')-> |
69 | orderByDesc('job_titles.sort')-> | 69 | orderByDesc('job_titles.sort')-> |
70 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 70 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
71 | where('job_titles.position_id', $position->id)-> | 71 | where('job_titles.position_id', $position->id)-> |
72 | groupby('job_title_id')-> | 72 | groupby('job_title_id')-> |
73 | get(); | 73 | get(); |
74 | }*/ | 74 | }*/ |
75 | $Data = DB::table('job_titles')-> | 75 | $Data = DB::table('job_titles')-> |
76 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> | 76 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> |
77 | where('categories.is_remove', '=', '0')-> | 77 | where('categories.is_remove', '=', '0')-> |
78 | where('job_titles.is_remove', '=', '0')-> | 78 | where('job_titles.is_remove', '=', '0')-> |
79 | where('job_titles.is_bd', '=' , '0')-> | 79 | where('job_titles.is_bd', '=' , '0')-> |
80 | leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> | 80 | leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> |
81 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> | 81 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> |
82 | groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')-> | 82 | groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')-> |
83 | orderByDesc('job_titles.sort')->get()->toArray(); | 83 | orderByDesc('job_titles.sort')->get()->toArray(); |
84 | 84 | ||
85 | $Main_Job = array(); | 85 | $Main_Job = array(); |
86 | $name_cat = ''; | 86 | $name_cat = ''; |
87 | foreach ($Data as $it) { | 87 | foreach ($Data as $it) { |
88 | $it_arr = (array)$it; | 88 | $it_arr = (array)$it; |
89 | if ($name_cat != $it_arr['catname']) $name_cat = $it_arr['catname']; | 89 | if ($name_cat != $it_arr['catname']) $name_cat = $it_arr['catname']; |
90 | $Main_Job[$name_cat][] = $it_arr; | 90 | $Main_Job[$name_cat][] = $it_arr; |
91 | } | 91 | } |
92 | 92 | ||
93 | $employers = employers_main::query()->with('employer')-> | 93 | $employers = employers_main::query()->with('employer')-> |
94 | whereHas('employer', function ($query) { | 94 | whereHas('employer', function ($query) { |
95 | $query->where('status_hidden', '=', '0'); | 95 | $query->where('status_hidden', '=', '0'); |
96 | })-> | 96 | })-> |
97 | orderBy('id')->limit(8)->get(); | 97 | orderBy('sort')->get(); |
98 | $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get(); | 98 | $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get(); |
99 | return view('index', compact('news', 'Job_title', 'categories', 'employers', 'vacancy', 'Main_Job')); | 99 | return view('index', compact('news', 'Job_title', 'categories', 'employers', 'vacancy', 'Main_Job')); |
100 | } | 100 | } |
101 | 101 | ||
102 | public function search_vacancies(Request $request) { | 102 | public function search_vacancies(Request $request) { |
103 | if ($request->has('search')) { | 103 | if ($request->has('search')) { |
104 | $search = $request->get('search'); | 104 | $search = $request->get('search'); |
105 | $job_titles = Job_title::query()->where('name', 'LIKE', "%$search%")->first(); | 105 | $job_titles = Job_title::query()->where('name', 'LIKE', "%$search%")->first(); |
106 | if (isset($job_titles->id)) | 106 | if (isset($job_titles->id)) |
107 | if ($job_titles->id > 0) | 107 | if ($job_titles->id > 0) |
108 | return redirect()->route('vacancies', ['job' => $job_titles->id]); | 108 | return redirect()->route('vacancies', ['job' => $job_titles->id]); |
109 | } | 109 | } |
110 | } | 110 | } |
111 | 111 | ||
112 | // Лайк вакансии | 112 | // Лайк вакансии |
113 | public function like_vacancy(Request $request) { | 113 | public function like_vacancy(Request $request) { |
114 | $IP_address = RusDate::ip_addr_client(); | 114 | $IP_address = RusDate::ip_addr_client(); |
115 | 115 | ||
116 | if ($request->has('code_record')) { | 116 | if ($request->has('code_record')) { |
117 | if ($request->has('delete')) { | 117 | if ($request->has('delete')) { |
118 | $code = $request->get('code_record'); | 118 | $code = $request->get('code_record'); |
119 | $atomic_era = Like_vacancy::select('id')-> | 119 | $atomic_era = Like_vacancy::select('id')-> |
120 | where('code_record', '=', $code)->toSql(); | 120 | where('code_record', '=', $code)->toSql(); |
121 | DB::table('like_vacancy')->where('code_record', $request->get('code_record'))->delete(); | 121 | DB::table('like_vacancy')->where('code_record', $request->get('code_record'))->delete(); |
122 | 122 | ||
123 | } else { | 123 | } else { |
124 | $params = $request->all(); | 124 | $params = $request->all(); |
125 | $params['ip_address'] = $IP_address; | 125 | $params['ip_address'] = $IP_address; |
126 | Like_vacancy::create($params); | 126 | Like_vacancy::create($params); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
131 | // Лайк соискателю. | 131 | // Лайк соискателю. |
132 | public function like_worker(Request $request) { | 132 | public function like_worker(Request $request) { |
133 | $IP_address = RusDate::ip_addr_client(); | 133 | $IP_address = RusDate::ip_addr_client(); |
134 | 134 | ||
135 | if ($request->has('code_record')) { | 135 | if ($request->has('code_record')) { |
136 | if ($request->has('delete')) { | 136 | if ($request->has('delete')) { |
137 | $atomic_era = Like_worker::select('id')-> | 137 | $atomic_era = Like_worker::select('id')-> |
138 | where('code_record', '=', $request-> | 138 | where('code_record', '=', $request-> |
139 | get('code_record'))->first(); | 139 | get('code_record'))->first(); |
140 | 140 | ||
141 | DB::table('like_worker')->where('code_record', $request->get('code_record'))->delete(); | 141 | DB::table('like_worker')->where('code_record', $request->get('code_record'))->delete(); |
142 | 142 | ||
143 | return "Вот и результат удаления!"; | 143 | return "Вот и результат удаления!"; |
144 | 144 | ||
145 | } else { | 145 | } else { |
146 | $params = $request->all(); | 146 | $params = $request->all(); |
147 | $params['ip_address'] = $IP_address; | 147 | $params['ip_address'] = $IP_address; |
148 | Like_worker::create($params); | 148 | Like_worker::create($params); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | } | 151 | } |
152 | 152 | ||
153 | public function vacancies(Request $request) { | 153 | public function vacancies(Request $request) { |
154 | //должности | 154 | //должности |
155 | $Job_title = Job_title::query()->where('is_remove', '=', '0')-> | 155 | $Job_title = Job_title::query()->where('is_remove', '=', '0')-> |
156 | where('is_bd', '=', '0')->orderBy('name')->get(); | 156 | where('is_bd', '=', '0')->orderBy('name')->get(); |
157 | 157 | ||
158 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') | 158 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') |
159 | ->selectRaw('min(ad_employers.salary) as min_salary, max(ad_employers.salary) as max_salary') | 159 | ->selectRaw('min(ad_employers.salary) as min_salary, max(ad_employers.salary) as max_salary') |
160 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') | 160 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') |
161 | ->join('ad_jobs', 'ad_jobs.ad_employer_id', '=', 'ad_employers.id'); | 161 | ->join('ad_jobs', 'ad_jobs.ad_employer_id', '=', 'ad_employers.id'); |
162 | 162 | ||
163 | //категории и вакансии | 163 | //категории и вакансии |
164 | if (($request->has('job')) && ($request->get('job') > 0)) { | 164 | if (($request->has('job')) && ($request->get('job') > 0)) { |
165 | $categories = $categories->Where('job_title_id', '=', $request->get('job')); | 165 | $categories = $categories->Where('job_title_id', '=', $request->get('job')); |
166 | } | 166 | } |
167 | 167 | ||
168 | $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get(); | 168 | $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get(); |
169 | 169 | ||
170 | //$Position = Category::query()->where('is_remove', '=', '0')->get(); | 170 | //$Position = Category::query()->where('is_remove', '=', '0')->get(); |
171 | 171 | ||
172 | /*$BigFlot = Array(); | 172 | /*$BigFlot = Array(); |
173 | foreach ($Position as $position) { | 173 | foreach ($Position as $position) { |
174 | $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> | 174 | $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> |
175 | orderBy('job_titles.sort')-> | 175 | orderBy('job_titles.sort')-> |
176 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 176 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
177 | where('position_ship', "$position->name"); | 177 | where('position_ship', "$position->name"); |
178 | if (($request->has('job')) && ($request->get('job') > 0)) { | 178 | if (($request->has('job')) && ($request->get('job') > 0)) { |
179 | $War_flot = $War_flot->where('job_title_id', $request->get('job')); | 179 | $War_flot = $War_flot->where('job_title_id', $request->get('job')); |
180 | } | 180 | } |
181 | $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); | 181 | $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); |
182 | $BigFlot[] = $War_flot; | 182 | $BigFlot[] = $War_flot; |
183 | }*/ | 183 | }*/ |
184 | /* | 184 | /* |
185 | $BigFlot = Array(); | 185 | $BigFlot = Array(); |
186 | foreach ($Position as $position) { | 186 | foreach ($Position as $position) { |
187 | $WarFlot = DB::table('ad_jobs')-> | 187 | $WarFlot = DB::table('ad_jobs')-> |
188 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> | 188 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> |
189 | orderByDesc('job_titles.sort')-> | 189 | orderByDesc('job_titles.sort')-> |
190 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 190 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
191 | where('job_titles.position_id', $position->id); | 191 | where('job_titles.position_id', $position->id); |
192 | if (($request->has('job')) && ($request->get('job') > 0)) { | 192 | if (($request->has('job')) && ($request->get('job') > 0)) { |
193 | $WarFlot = $WarFlot->where('job_title_id', $request->get('job')); | 193 | $WarFlot = $WarFlot->where('job_title_id', $request->get('job')); |
194 | } | 194 | } |
195 | $WarFlot = $WarFlot->groupby('job_title_id')->get(); | 195 | $WarFlot = $WarFlot->groupby('job_title_id')->get(); |
196 | $BigFlot[] = $WarFlot; | 196 | $BigFlot[] = $WarFlot; |
197 | } | 197 | } |
198 | */ | 198 | */ |
199 | 199 | ||
200 | $Data = DB::table('job_titles')-> | 200 | $Data = DB::table('job_titles')-> |
201 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> | 201 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> |
202 | where('categories.is_remove', '=', '0')-> | 202 | where('categories.is_remove', '=', '0')-> |
203 | where('job_titles.is_bd', '=' , '0')-> | 203 | where('job_titles.is_bd', '=' , '0')-> |
204 | where('job_titles.is_remove', '=', '0'); | 204 | where('job_titles.is_remove', '=', '0'); |
205 | if (($request->has('job')) && ($request->get('job') > 0)) { | 205 | if (($request->has('job')) && ($request->get('job') > 0)) { |
206 | $Data = $Data->where('job_title_id', $request->get('job')); | 206 | $Data = $Data->where('job_title_id', $request->get('job')); |
207 | } | 207 | } |
208 | $Data = $Data->leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> | 208 | $Data = $Data->leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> |
209 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> | 209 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> |
210 | groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')-> | 210 | groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')-> |
211 | orderByDesc('job_titles.sort')->get()->toArray(); | 211 | orderByDesc('job_titles.sort')->get()->toArray(); |
212 | 212 | ||
213 | $Main_Job = array(); | 213 | $Main_Job = array(); |
214 | $name_cat = ''; | 214 | $name_cat = ''; |
215 | foreach ($Data as $it) { | 215 | foreach ($Data as $it) { |
216 | $it_arr = (array)$it; | 216 | $it_arr = (array)$it; |
217 | if ($name_cat != $it_arr['catname']) | 217 | if ($name_cat != $it_arr['catname']) |
218 | $name_cat = $it_arr['catname']; | 218 | $name_cat = $it_arr['catname']; |
219 | $Main_Job[$name_cat][] = $it_arr; | 219 | $Main_Job[$name_cat][] = $it_arr; |
220 | } | 220 | } |
221 | 221 | ||
222 | if ($request->ajax()) { | 222 | if ($request->ajax()) { |
223 | return view('ajax.new_sky', compact('categories', 'Main_Job')); | 223 | return view('ajax.new_sky', compact('categories', 'Main_Job')); |
224 | } else { | 224 | } else { |
225 | return view('new_sky', compact('Job_title', 'categories', 'Main_Job')); | 225 | return view('new_sky', compact('Job_title', 'categories', 'Main_Job')); |
226 | } | 226 | } |
227 | } | 227 | } |
228 | 228 | ||
229 | //Вакансии категория детальная | 229 | //Вакансии категория детальная |
230 | public function list_vacancies(Category $categories, Request $request) { | 230 | public function list_vacancies(Category $categories, Request $request) { |
231 | if (isset(Auth()->user()->id)) | 231 | if (isset(Auth()->user()->id)) |
232 | $uid = Auth()->user()->id; | 232 | $uid = Auth()->user()->id; |
233 | else | 233 | else |
234 | $uid = 0; | 234 | $uid = 0; |
235 | 235 | ||
236 | if ($request->get('job') == 0) | 236 | if ($request->get('job') == 0) |
237 | $job_search = ''; | 237 | $job_search = ''; |
238 | else | 238 | else |
239 | $job_search = $request->get('job'); | 239 | $job_search = $request->get('job'); |
240 | 240 | ||
241 | $Query = Ad_employer::with('jobs')-> | 241 | $Query = Ad_employer::with('jobs')-> |
242 | with('cat')-> | 242 | with('cat')-> |
243 | with('employer')-> | 243 | with('employer')-> |
244 | 244 | ||
245 | whereHas('jobs_code', function ($query) use ($job_search) { | 245 | whereHas('jobs_code', function ($query) use ($job_search) { |
246 | if (!empty($job_search)) { | 246 | if (!empty($job_search)) { |
247 | $query->where('job_title_id', $job_search); | 247 | $query->where('job_title_id', $job_search); |
248 | } | 248 | } |
249 | })->select('ad_employers.*'); | 249 | })->select('ad_employers.*'); |
250 | 250 | ||
251 | if (isset($categories->id) && ($categories->id > 0)) { | 251 | if (isset($categories->id) && ($categories->id > 0)) { |
252 | $Query = $Query->where('category_id', '=', $categories->id); | 252 | $Query = $Query->where('category_id', '=', $categories->id); |
253 | $Name_categori = Category::query()->where('id', '=', $categories->id)->get(); | 253 | $Name_categori = Category::query()->where('id', '=', $categories->id)->get(); |
254 | } else { | 254 | } else { |
255 | $Name_categori = ''; | 255 | $Name_categori = ''; |
256 | } | 256 | } |
257 | 257 | ||
258 | if ($request->get('sort')) { | 258 | if ($request->get('sort')) { |
259 | $sort = $request->get('sort'); | 259 | $sort = $request->get('sort'); |
260 | switch ($sort) { | 260 | switch ($sort) { |
261 | case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break; | 261 | case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break; |
262 | case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break; | 262 | case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break; |
263 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; | 263 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; |
264 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; | 264 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; |
265 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 265 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
266 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 266 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
267 | } | 267 | } |
268 | } | 268 | } |
269 | 269 | ||
270 | $Job_title = Job_title::query()->where('is_bd', '=', '0')->OrderBy('name')->get(); | 270 | $Job_title = Job_title::query()->where('is_bd', '=', '0')->OrderBy('name')->get(); |
271 | 271 | ||
272 | $Query_count = $Query->count(); | 272 | $Query_count = $Query->count(); |
273 | 273 | ||
274 | $Query = $Query->OrderBy('updated_at')->paginate(3); | 274 | $Query = $Query->OrderBy('updated_at')->paginate(3); |
275 | 275 | ||
276 | $Reclama = reclame::query()->get(); | 276 | $Reclama = reclame::query()->get(); |
277 | 277 | ||
278 | if ($request->ajax()) { | 278 | if ($request->ajax()) { |
279 | if ($request->has('title')) { | 279 | if ($request->has('title')) { |
280 | return view('ajax.list_category', compact( | 280 | return view('ajax.list_category', compact( |
281 | 'Name_categori' | 281 | 'Name_categori' |
282 | )); | 282 | )); |
283 | } else { | 283 | } else { |
284 | return view('ajax.list_vacancies', compact('Query', | 284 | return view('ajax.list_vacancies', compact('Query', |
285 | 'Query_count', | 285 | 'Query_count', |
286 | 'Name_categori', | 286 | 'Name_categori', |
287 | 'Reclama', | 287 | 'Reclama', |
288 | 'categories', | 288 | 'categories', |
289 | 'Job_title', | 289 | 'Job_title', |
290 | 'uid')); | 290 | 'uid')); |
291 | } | 291 | } |
292 | } else { | 292 | } else { |
293 | //Вернуть все | 293 | //Вернуть все |
294 | return view('list_vacancies', compact('Query', | 294 | return view('list_vacancies', compact('Query', |
295 | 'Query_count', | 295 | 'Query_count', |
296 | 'Reclama', | 296 | 'Reclama', |
297 | 'Name_categori', | 297 | 'Name_categori', |
298 | 'categories', | 298 | 'categories', |
299 | 'Job_title', | 299 | 'Job_title', |
300 | 'uid')); | 300 | 'uid')); |
301 | } | 301 | } |
302 | } | 302 | } |
303 | 303 | ||
304 | // Образование | 304 | // Образование |
305 | public function education(Request $request) { | 305 | public function education(Request $request) { |
306 | $educations = Education::query(); | 306 | $educations = Education::query(); |
307 | if (($request->has('search')) && (!empty($request->get('search')))) { | 307 | if (($request->has('search')) && (!empty($request->get('search')))) { |
308 | $search = trim($request->get('search')); | 308 | $search = trim($request->get('search')); |
309 | $educations = $educations->where('name', 'LIKE', "%$search%"); | 309 | $educations = $educations->where('name', 'LIKE', "%$search%"); |
310 | } | 310 | } |
311 | 311 | ||
312 | if ($request->get('sort')) { | 312 | if ($request->get('sort')) { |
313 | $sort = $request->get('sort'); | 313 | $sort = $request->get('sort'); |
314 | switch ($sort) { | 314 | switch ($sort) { |
315 | case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break; | 315 | case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break; |
316 | case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break; | 316 | case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break; |
317 | case 'created_at_up': $educations = $educations->OrderBy('created_at')->orderBy('id'); break; | 317 | case 'created_at_up': $educations = $educations->OrderBy('created_at')->orderBy('id'); break; |
318 | case 'created_at_down': $educations = $educations->orderByDesc('created_at')->orderBy('id'); break; | 318 | case 'created_at_down': $educations = $educations->orderByDesc('created_at')->orderBy('id'); break; |
319 | case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break; | 319 | case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break; |
320 | default: $educations = $educations->orderBy('id')->orderby('updated_at'); break; | 320 | default: $educations = $educations->orderBy('id')->orderby('updated_at'); break; |
321 | } | 321 | } |
322 | } | 322 | } |
323 | 323 | ||
324 | $count_edu = $educations->count(); | 324 | $count_edu = $educations->count(); |
325 | $educations = $educations->paginate(6); | 325 | $educations = $educations->paginate(6); |
326 | if ($request->ajax()) { | 326 | if ($request->ajax()) { |
327 | return view('ajax.education', compact('educations')); | 327 | return view('ajax.education', compact('educations')); |
328 | } else { | 328 | } else { |
329 | return view('education', compact('educations', 'count_edu')); | 329 | return view('education', compact('educations', 'count_edu')); |
330 | } | 330 | } |
331 | } | 331 | } |
332 | 332 | ||
333 | // Контакты | 333 | // Контакты |
334 | public function contacts() { | 334 | public function contacts() { |
335 | return view('contacts'); | 335 | return view('contacts'); |
336 | } | 336 | } |
337 | 337 | ||
338 | // Вход в личный кабинет | 338 | // Вход в личный кабинет |
339 | public function input_login(Request $request) | 339 | public function input_login(Request $request) |
340 | { | 340 | { |
341 | $params = $request->all(); | 341 | $params = $request->all(); |
342 | 342 | ||
343 | 343 | ||
344 | $rules = [ | 344 | $rules = [ |
345 | 'email' => 'required|string|email', | 345 | 'email' => 'required|string|email', |
346 | 'password' => 'required|string|min:3|max:25', | 346 | 'password' => 'required|string|min:3|max:25', |
347 | ]; | 347 | ]; |
348 | 348 | ||
349 | $messages = [ | 349 | $messages = [ |
350 | 'required' => 'Укажите обязательное поле «:attribute»', | 350 | 'required' => 'Укажите обязательное поле «:attribute»', |
351 | 'email' => 'Введите корректный email', | 351 | 'email' => 'Введите корректный email', |
352 | 'min' => [ | 352 | 'min' => [ |
353 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 353 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
354 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 354 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
355 | ], | 355 | ], |
356 | 'max' => [ | 356 | 'max' => [ |
357 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 357 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
358 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 358 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
359 | ], | 359 | ], |
360 | ]; | 360 | ]; |
361 | $validator = Validator::make($request->all(), $rules, $messages); | 361 | $validator = Validator::make($request->all(), $rules, $messages); |
362 | if ($validator->fails()) { | 362 | if ($validator->fails()) { |
363 | if (Auth::check()) | 363 | if (Auth::check()) |
364 | $user_id = $request->user()->id; | 364 | $user_id = $request->user()->id; |
365 | else | 365 | else |
366 | $user_id = 0; | 366 | $user_id = 0; |
367 | 367 | ||
368 | if ($user_id > 0) | 368 | if ($user_id > 0) |
369 | return json_encode(Array("ERROR" => "Email или пароль невалидный!")); | 369 | return json_encode(Array("ERROR" => "Email или пароль невалидный!")); |
370 | else | 370 | else |
371 | return redirect()->route('index')->with('Error', "Email или пароль невалидный"); | 371 | return redirect()->route('index')->with('Error', "Email или пароль невалидный"); |
372 | } else { | 372 | } else { |
373 | $credentials = $request->only('email', 'password'); | 373 | $credentials = $request->only('email', 'password'); |
374 | 374 | ||
375 | if (Auth::attempt($credentials, $request->has('remember'))) { | 375 | if (Auth::attempt($credentials, $request->has('remember'))) { |
376 | 376 | ||
377 | if (is_null(Auth::user()->email_verified_at)) { | 377 | if (is_null(Auth::user()->email_verified_at)) { |
378 | Auth::logout(); | 378 | Auth::logout(); |
379 | return json_encode(Array("ERROR" => "Адрес почты не подтвержден")); | 379 | return json_encode(Array("ERROR" => "Адрес почты не подтвержден")); |
380 | } | 380 | } |
381 | 381 | ||
382 | if (Auth::user()->is_worker) { | 382 | if (Auth::user()->is_worker) { |
383 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl())); | 383 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl())); |
384 | } else { | 384 | } else { |
385 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl())); | 385 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl())); |
386 | } | 386 | } |
387 | 387 | ||
388 | return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет")); | 388 | return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет")); |
389 | //->route('index') | 389 | //->route('index') |
390 | //->with('success', 'Вы вошли в личный кабинет.'); | 390 | //->with('success', 'Вы вошли в личный кабинет.'); |
391 | } else { | 391 | } else { |
392 | return json_encode(Array("ERROR" => "Неверный логин или пароль!")); | 392 | return json_encode(Array("ERROR" => "Неверный логин или пароль!")); |
393 | } | 393 | } |
394 | } | 394 | } |
395 | } | 395 | } |
396 | 396 | ||
397 | // Восстановление пароля | 397 | // Восстановление пароля |
398 | public function repair_password(Request $request) { | 398 | public function repair_password(Request $request) { |
399 | $rules = [ | 399 | $rules = [ |
400 | 'email' => 'required|string|email', | 400 | 'email' => 'required|string|email', |
401 | ]; | 401 | ]; |
402 | 402 | ||
403 | $messages = [ | 403 | $messages = [ |
404 | 'required' => 'Укажите обязательное поле «:attribute»', | 404 | 'required' => 'Укажите обязательное поле «:attribute»', |
405 | 'email' => 'Введите корректный email', | 405 | 'email' => 'Введите корректный email', |
406 | 'min' => [ | 406 | 'min' => [ |
407 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 407 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
408 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 408 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
409 | ], | 409 | ], |
410 | 'max' => [ | 410 | 'max' => [ |
411 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 411 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
412 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 412 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
413 | ], | 413 | ], |
414 | ]; | 414 | ]; |
415 | 415 | ||
416 | $validator = Validator::make($request->all(), $rules, $messages); | 416 | $validator = Validator::make($request->all(), $rules, $messages); |
417 | 417 | ||
418 | if ($validator->fails()) { | 418 | if ($validator->fails()) { |
419 | return redirect()->back()->with('Error', "Email невалидный"); | 419 | return redirect()->back()->with('Error', "Email невалидный"); |
420 | } else { | 420 | } else { |
421 | $new_password = Tools::generator_id(10); | 421 | $new_password = Tools::generator_id(10); |
422 | $hash_password = Hash::make($new_password); | 422 | $hash_password = Hash::make($new_password); |
423 | $user = User::query()->where('email', $request->get('email'))->first(); | 423 | $user = User::query()->where('email', $request->get('email'))->first(); |
424 | $EditRec = User::find($user->id); | 424 | $EditRec = User::find($user->id); |
425 | $EditRec->password = $hash_password; | 425 | $EditRec->password = $hash_password; |
426 | $EditRec->save(); | 426 | $EditRec->save(); |
427 | 427 | ||
428 | foreach ([$request->get('email')] as $recipient) { | 428 | foreach ([$request->get('email')] as $recipient) { |
429 | Mail::to($recipient)->send(new MailRepair($new_password)); | 429 | Mail::to($recipient)->send(new MailRepair($new_password)); |
430 | } | 430 | } |
431 | return redirect()->route('index'); | 431 | return redirect()->route('index'); |
432 | 432 | ||
433 | } | 433 | } |
434 | 434 | ||
435 | } | 435 | } |
436 | 436 | ||
437 | // Вывод новостей | 437 | // Вывод новостей |
438 | public function news(Request $request) { | 438 | public function news(Request $request) { |
439 | $Query = News::query(); | 439 | $Query = News::query(); |
440 | if ($request->has('search')) { | 440 | if ($request->has('search')) { |
441 | $search = $request->get('search'); | 441 | $search = $request->get('search'); |
442 | $Query = $Query->where('title', 'LIKE', "%$search%")-> | 442 | $Query = $Query->where('title', 'LIKE', "%$search%")-> |
443 | orWhere('text', 'LIKE', "%$search%"); | 443 | orWhere('text', 'LIKE', "%$search%"); |
444 | } | 444 | } |
445 | 445 | ||
446 | if ($request->ajax()) { | 446 | if ($request->ajax()) { |
447 | if ($request->get('sort')) { | 447 | if ($request->get('sort')) { |
448 | $sort = $request->get('sort'); | 448 | $sort = $request->get('sort'); |
449 | switch ($sort) { | 449 | switch ($sort) { |
450 | case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break; | 450 | case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break; |
451 | case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break; | 451 | case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break; |
452 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; | 452 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; |
453 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; | 453 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; |
454 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 454 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
455 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 455 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
456 | } | 456 | } |
457 | } | 457 | } |
458 | } | 458 | } |
459 | $Query_count = $Query->count(); | 459 | $Query_count = $Query->count(); |
460 | $Query = $Query->paginate(6); | 460 | $Query = $Query->paginate(6); |
461 | 461 | ||
462 | if ($request->ajax()) { | 462 | if ($request->ajax()) { |
463 | return view('ajax.news-list', compact('Query', 'Query_count')); | 463 | return view('ajax.news-list', compact('Query', 'Query_count')); |
464 | } else { | 464 | } else { |
465 | return view('news-list', compact('Query', 'Query_count')); | 465 | return view('news-list', compact('Query', 'Query_count')); |
466 | } | 466 | } |
467 | } | 467 | } |
468 | 468 | ||
469 | //Детальная новость | 469 | //Детальная новость |
470 | public function detail_new(News $new) { | 470 | public function detail_new(News $new) { |
471 | // Наборка | 471 | // Наборка |
472 | $Query = News::query()->where('id', $new->id)->get(); | 472 | $Query = News::query()->where('id', $new->id)->get(); |
473 | $title = $Query[0]->title; | 473 | $title = $Query[0]->title; |
474 | $All_Query = News::query()->paginate(8); | 474 | $All_Query = News::query()->paginate(8); |
475 | return view('detail_new', compact('Query', 'All_Query', 'title')); | 475 | return view('detail_new', compact('Query', 'All_Query', 'title')); |
476 | } | 476 | } |
477 | } | 477 | } |
478 | 478 |
app/Http/Controllers/WorkerController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Http\Requests\DocumentsRequest; | 6 | use App\Http\Requests\DocumentsRequest; |
7 | use App\Http\Requests\PrevCompanyRequest; | 7 | use App\Http\Requests\PrevCompanyRequest; |
8 | use App\Http\Requests\SertificationRequest; | 8 | use App\Http\Requests\SertificationRequest; |
9 | use App\Models\Ad_employer; | 9 | use App\Models\Ad_employer; |
10 | use App\Models\ad_response; | 10 | use App\Models\ad_response; |
11 | use App\Models\Category; | 11 | use App\Models\Category; |
12 | use App\Models\Dop_info; | 12 | use App\Models\Dop_info; |
13 | use App\Models\Employer; | 13 | use App\Models\Employer; |
14 | use App\Models\infobloks; | 14 | use App\Models\infobloks; |
15 | use App\Models\Job_title; | 15 | use App\Models\Job_title; |
16 | use App\Models\Like_vacancy; | 16 | use App\Models\Like_vacancy; |
17 | use App\Models\Like_worker; | 17 | use App\Models\Like_worker; |
18 | use App\Models\Message; | 18 | use App\Models\Message; |
19 | use App\Models\place_works; | 19 | use App\Models\place_works; |
20 | use App\Models\PrevCompany; | 20 | use App\Models\PrevCompany; |
21 | use App\Models\reclame; | 21 | use App\Models\reclame; |
22 | use App\Models\ResponseWork; | 22 | use App\Models\ResponseWork; |
23 | use App\Models\sertification; | 23 | use App\Models\sertification; |
24 | use App\Models\Static_worker; | 24 | use App\Models\Static_worker; |
25 | use App\Models\Title_worker; | 25 | use App\Models\Title_worker; |
26 | use App\Models\User; | 26 | use App\Models\User; |
27 | use App\Models\User as User_Model; | 27 | use App\Models\User as User_Model; |
28 | use App\Models\Worker; | 28 | use App\Models\Worker; |
29 | use Barryvdh\DomPDF\Facade\Pdf; | 29 | use Barryvdh\DomPDF\Facade\Pdf; |
30 | use Carbon\Carbon; | 30 | use Carbon\Carbon; |
31 | use Illuminate\Auth\Events\Registered; | 31 | use Illuminate\Auth\Events\Registered; |
32 | use Illuminate\Database\Eloquent\Builder; | 32 | use Illuminate\Database\Eloquent\Builder; |
33 | use Illuminate\Database\Eloquent\Model; | 33 | use Illuminate\Database\Eloquent\Model; |
34 | use Illuminate\Http\JsonResponse; | 34 | use Illuminate\Http\JsonResponse; |
35 | use Illuminate\Http\Request; | 35 | use Illuminate\Http\Request; |
36 | use Illuminate\Support\Facades\Auth; | 36 | use Illuminate\Support\Facades\Auth; |
37 | use Illuminate\Support\Facades\Hash; | 37 | use Illuminate\Support\Facades\Hash; |
38 | use Illuminate\Support\Facades\Storage; | 38 | use Illuminate\Support\Facades\Storage; |
39 | use Illuminate\Support\Facades\Validator; | 39 | use Illuminate\Support\Facades\Validator; |
40 | 40 | ||
41 | class WorkerController extends Controller | 41 | class WorkerController extends Controller |
42 | { | 42 | { |
43 | public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу'); | 43 | public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу'); |
44 | 44 | ||
45 | //профиль | 45 | //профиль |
46 | public function profile(Worker $worker) | 46 | public function profile(Worker $worker) |
47 | { | 47 | { |
48 | $get_date = date('Y.m'); | 48 | $get_date = date('Y.m'); |
49 | 49 | ||
50 | $c = Static_worker::query()->where('year_month', '=', $get_date) | 50 | $c = Static_worker::query()->where('year_month', '=', $get_date) |
51 | ->where('user_id', '=', $worker->users->id) | 51 | ->where('user_id', '=', $worker->users->id) |
52 | ->get(); | 52 | ->get(); |
53 | 53 | ||
54 | if ($c->count() > 0) { | 54 | if ($c->count() > 0) { |
55 | $upd = Static_worker::find($c[0]->id); | 55 | $upd = Static_worker::find($c[0]->id); |
56 | $upd->lookin = $upd->lookin + 1; | 56 | $upd->lookin = $upd->lookin + 1; |
57 | $upd->save(); | 57 | $upd->save(); |
58 | } else { | 58 | } else { |
59 | $crt = new Static_worker(); | 59 | $crt = new Static_worker(); |
60 | $crt->lookin = 1; | 60 | $crt->lookin = 1; |
61 | $crt->year_month = $get_date; | 61 | $crt->year_month = $get_date; |
62 | $crt->user_id = $worker->user_id; | 62 | $crt->user_id = $worker->user_id; |
63 | $crt->save(); | 63 | $crt->save(); |
64 | } | 64 | } |
65 | 65 | ||
66 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 66 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
67 | ->where('user_id', '=', $worker->users->id) | 67 | ->where('user_id', '=', $worker->users->id) |
68 | ->get(); | 68 | ->get(); |
69 | 69 | ||
70 | return view('public.workers.profile', compact('worker', 'stat')); | 70 | return view('public.workers.profile', compact('worker', 'stat')); |
71 | } | 71 | } |
72 | 72 | ||
73 | // лист база резюме | 73 | // лист база резюме |
74 | public function bd_resume(Request $request) | 74 | public function bd_resume(Request $request) |
75 | { | 75 | { |
76 | $look = false; | 76 | $look = false; |
77 | $idiot = 0; | 77 | $idiot = 0; |
78 | if (isset(Auth()->user()->id)) { | 78 | if (isset(Auth()->user()->id)) { |
79 | $idiot = Auth()->user()->id; | 79 | $idiot = Auth()->user()->id; |
80 | if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin)) | 80 | if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin)) |
81 | $look = true; | 81 | $look = true; |
82 | } | 82 | } |
83 | 83 | ||
84 | if ($look) { | 84 | if ($look) { |
85 | $status_work = $this->status_work; | 85 | $status_work = $this->status_work; |
86 | $resumes = Worker::query()->with('users')->with('job_titles'); | 86 | $resumes = Worker::query()->with('users')->with('job_titles'); |
87 | $resumes = $resumes->whereHas('users', function (Builder $query) { | 87 | $resumes = $resumes->whereHas('users', function (Builder $query) { |
88 | $query->Where('is_worker', '=', '1') | 88 | $query->Where('is_worker', '=', '1') |
89 | ->Where('is_bd', '=', '0'); | 89 | ->Where('is_bd', '=', '0'); |
90 | }); | 90 | }); |
91 | 91 | ||
92 | //dd($request->get('job')); | 92 | //dd($request->get('job')); |
93 | if (($request->has('job')) && ($request->get('job') > 0)) { | 93 | if (($request->has('job')) && ($request->get('job') > 0)) { |
94 | $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { | 94 | $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { |
95 | $query->Where('job_titles.id', $request->get('job')); | 95 | $query->Where('job_titles.id', $request->get('job')); |
96 | }); | 96 | }); |
97 | } | 97 | } |
98 | 98 | ||
99 | $Job_title = Job_title::query()-> | 99 | $Job_title = Job_title::query()-> |
100 | where('is_remove', '=', '0')-> | 100 | where('is_remove', '=', '0')-> |
101 | where('is_bd', '=' , '1')-> | 101 | where('is_bd', '=' , '1')-> |
102 | get(); | 102 | get(); |
103 | 103 | ||
104 | if ($request->get('sort')) { | 104 | if ($request->get('sort')) { |
105 | $sort = $request->get('sort'); | 105 | $sort = $request->get('sort'); |
106 | switch ($sort) { | 106 | switch ($sort) { |
107 | case 'name_up': | 107 | case 'name_up': |
108 | $resumes = $resumes->orderBy(User::select('surname') | 108 | $resumes = $resumes->orderBy(User::select('surname') |
109 | ->whereColumn('Workers.user_id', 'users.id') | 109 | ->whereColumn('Workers.user_id', 'users.id') |
110 | ); | 110 | ); |
111 | break; | 111 | break; |
112 | case 'name_down': | 112 | case 'name_down': |
113 | $resumes = $resumes->orderByDesc(User::select('surname') | 113 | $resumes = $resumes->orderByDesc(User::select('surname') |
114 | ->whereColumn('Workers.user_id', 'users.id') | 114 | ->whereColumn('Workers.user_id', 'users.id') |
115 | ); | 115 | ); |
116 | break; | 116 | break; |
117 | case 'created_at_up': | 117 | case 'created_at_up': |
118 | $resumes = $resumes->OrderBy('created_at')->orderBy('id'); | 118 | $resumes = $resumes->OrderBy('created_at')->orderBy('id'); |
119 | break; | 119 | break; |
120 | case 'created_at_down': | 120 | case 'created_at_down': |
121 | $resumes = $resumes->orderByDesc('created_at')->orderBy('id'); | 121 | $resumes = $resumes->orderByDesc('created_at')->orderBy('id'); |
122 | break; | 122 | break; |
123 | case 'default': | 123 | case 'default': |
124 | $resumes = $resumes->orderBy('id')->orderby('updated_at'); | 124 | $resumes = $resumes->orderBy('id')->orderby('updated_at'); |
125 | break; | 125 | break; |
126 | default: | 126 | default: |
127 | $resumes = $resumes->orderBy('id')->orderby('updated_at'); | 127 | $resumes = $resumes->orderBy('id')->orderby('updated_at'); |
128 | break; | 128 | break; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
132 | $res_count = $resumes->count(); | 132 | $res_count = $resumes->count(); |
133 | //$resumes = $resumes->get(); | 133 | //$resumes = $resumes->get(); |
134 | $resumes = $resumes->paginate(4); | 134 | $resumes = $resumes->paginate(4); |
135 | if ($request->ajax()) { | 135 | if ($request->ajax()) { |
136 | // Условия обставлены | 136 | // Условия обставлены |
137 | if ($request->has('block') && ($request->get('block') == 1)) { | 137 | if ($request->has('block') && ($request->get('block') == 1)) { |
138 | return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); | 138 | return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); |
139 | } | 139 | } |
140 | 140 | ||
141 | if ($request->has('block') && ($request->get('block') == 2)) { | 141 | if ($request->has('block') && ($request->get('block') == 2)) { |
142 | return view('ajax.resume_2', compact('resumes', 'status_work', 'res_count', 'idiot')); | 142 | return view('ajax.resume_2', compact('resumes', 'status_work', 'res_count', 'idiot')); |
143 | } | 143 | } |
144 | } else { | 144 | } else { |
145 | return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title')); | 145 | return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title')); |
146 | } | 146 | } |
147 | } else { | 147 | } else { |
148 | return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); | 148 | return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | 151 | ||
152 | //Лайк резюме | 152 | //Лайк резюме |
153 | public function like_controller() { | 153 | public function like_controller() { |
154 | 154 | ||
155 | } | 155 | } |
156 | 156 | ||
157 | // анкета соискателя | 157 | // анкета соискателя |
158 | public function resume_profile(Worker $worker) | 158 | public function resume_profile(Worker $worker) |
159 | { | 159 | { |
160 | if (isset(Auth()->user()->id)) { | 160 | if (isset(Auth()->user()->id)) { |
161 | $idiot = Auth()->user()->id; | 161 | $idiot = Auth()->user()->id; |
162 | } else { | 162 | } else { |
163 | $idiot = 0; | 163 | $idiot = 0; |
164 | } | 164 | } |
165 | 165 | ||
166 | $status_work = $this->status_work; | 166 | $status_work = $this->status_work; |
167 | $Query = Worker::query()->with('users')->with('job_titles') | 167 | $Query = Worker::query()->with('users')->with('job_titles') |
168 | ->with('place_worker')->with('sertificate')->with('prev_company') | 168 | ->with('place_worker')->with('sertificate')->with('prev_company') |
169 | ->with('infobloks'); | 169 | ->with('infobloks')->with('response'); |
170 | $Query = $Query->where('id', '=', $worker->id); | 170 | $Query = $Query->where('id', '=', $worker->id); |
171 | $Query = $Query->get(); | 171 | $Query = $Query->get(); |
172 | 172 | ||
173 | $get_date = date('Y.m'); | 173 | $get_date = date('Y.m'); |
174 | $c = Static_worker::query()->where('year_month', '=', $get_date) | 174 | $c = Static_worker::query()->where('year_month', '=', $get_date) |
175 | ->where('user_id', '=', $worker->user_id) | 175 | ->where('user_id', '=', $worker->user_id) |
176 | ->get(); | 176 | ->get(); |
177 | 177 | ||
178 | if ($c->count() > 0) { | 178 | if ($c->count() > 0) { |
179 | $upd = Static_worker::find($c[0]->id); | 179 | $upd = Static_worker::find($c[0]->id); |
180 | $upd->lookin = $upd->lookin + 1; | 180 | $upd->lookin = $upd->lookin + 1; |
181 | $upd->save(); | 181 | $upd->save(); |
182 | } else { | 182 | } else { |
183 | $crt = new Static_worker(); | 183 | $crt = new Static_worker(); |
184 | $crt->lookin = 1; | 184 | $crt->lookin = 1; |
185 | $crt->year_month = $get_date; | 185 | $crt->year_month = $get_date; |
186 | $crt->user_id = $worker->user_id; | 186 | $crt->user_id = $worker->user_id; |
187 | $status = $crt->save(); | 187 | $status = $crt->save(); |
188 | } | 188 | } |
189 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 189 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
190 | ->where('user_id', '=', $worker->id) | 190 | ->where('user_id', '=', $worker->user_id) |
191 | ->get(); | 191 | ->get(); |
192 | return view('worker', compact('Query', 'status_work', 'idiot')); | 192 | |
193 | return view('worker', compact('Query', 'status_work', 'idiot', 'stat')); | ||
193 | } | 194 | } |
194 | 195 | ||
195 | // скачать анкету соискателя | 196 | // скачать анкету соискателя |
196 | public function resume_download(Worker $worker) | 197 | public function resume_download(Worker $worker) |
197 | { | 198 | { |
198 | $status_work = $this->status_work; | 199 | $status_work = $this->status_work; |
199 | $Query = Worker::query()->with('users')->with('job_titles') | 200 | $Query = Worker::query()->with('users')->with('job_titles') |
200 | ->with('place_worker')->with('sertificate')->with('prev_company') | 201 | ->with('place_worker')->with('sertificate')->with('prev_company') |
201 | ->with('infobloks'); | 202 | ->with('infobloks'); |
202 | $Query = $Query->where('id', '=', $worker->id); | 203 | $Query = $Query->where('id', '=', $worker->id); |
203 | $Query = $Query->get()->toArray(); | 204 | $Query = $Query->get()->toArray(); |
204 | 205 | ||
205 | view()->share('Query',$Query); | 206 | view()->share('Query',$Query); |
206 | 207 | ||
207 | 208 | ||
208 | $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape'); | 209 | $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape'); |
209 | 210 | ||
210 | return $pdf->stream(); | 211 | return $pdf->stream(); |
211 | } | 212 | } |
212 | 213 | ||
213 | public function resume_download_all() { | 214 | public function resume_download_all() { |
214 | $status_work = $this->status_work; | 215 | $status_work = $this->status_work; |
215 | $Query = Worker::query()->with('users')->with('job_titles') | 216 | $Query = Worker::query()->with('users')->with('job_titles') |
216 | ->with('place_worker')->with('sertificate')->with('prev_company') | 217 | ->with('place_worker')->with('sertificate')->with('prev_company') |
217 | ->with('infobloks')-> | 218 | ->with('infobloks')-> |
218 | whereHas('users', function (Builder $query) { | 219 | whereHas('users', function (Builder $query) { |
219 | $query->Where('is_worker', '=', '1') | 220 | $query->Where('is_worker', '=', '1') |
220 | ->Where('is_bd', '=', '1'); | 221 | ->Where('is_bd', '=', '1'); |
221 | }); | 222 | }); |
222 | //$Query = $Query->where('id', '=', $worker->id); | 223 | //$Query = $Query->where('id', '=', $worker->id); |
223 | $Query = $Query->get()->toArray(); | 224 | $Query = $Query->get()->toArray(); |
224 | 225 | ||
225 | view()->share('Query',$Query); | 226 | view()->share('Query',$Query); |
226 | 227 | ||
227 | $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape'); | 228 | $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape'); |
228 | 229 | ||
229 | return $pdf->stream(); | 230 | return $pdf->stream(); |
230 | } | 231 | } |
231 | 232 | ||
232 | // Кабинет работника | 233 | // Кабинет работника |
233 | public function cabinet(Request $request) | 234 | public function cabinet(Request $request) |
234 | { | 235 | { |
235 | // дата год и месяц | 236 | // дата год и месяц |
236 | $get_date = date('Y.m'); | 237 | $get_date = date('Y.m'); |
237 | 238 | ||
238 | $id = Auth()->user()->id; | 239 | $id = Auth()->user()->id; |
239 | 240 | ||
240 | $Infobloks = infobloks::query()->get(); | 241 | $Infobloks = infobloks::query()->get(); |
241 | 242 | ||
242 | $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')-> | 243 | $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')-> |
243 | with('infobloks')->with('place_worker')-> | 244 | with('infobloks')->with('place_worker')-> |
244 | WhereHas('users', | 245 | WhereHas('users', |
245 | function (Builder $query) use ($id) {$query->Where('id', $id); | 246 | function (Builder $query) use ($id) {$query->Where('id', $id); |
246 | })->get(); | 247 | })->get(); |
247 | 248 | ||
248 | $Job_titles = Job_title::query()->where('is_remove', '=', '0')-> | 249 | $Job_titles = Job_title::query()->where('is_remove', '=', '0')-> |
249 | where('is_bd', '=' , '1')-> | 250 | where('is_bd', '=' , '1')-> |
250 | OrderByDesc('sort')->OrderBy('name')->get(); | 251 | OrderByDesc('sort')->OrderBy('name')->get(); |
251 | $Infoblocks = infobloks::query()->OrderBy('name')->get(); | 252 | $Infoblocks = infobloks::query()->OrderBy('name')->get(); |
252 | 253 | ||
253 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 254 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
254 | ->where('user_id', '=', $Worker[0]->id) | 255 | ->where('user_id', '=', $Worker[0]->id) |
255 | ->get(); | 256 | ->get(); |
256 | 257 | ||
257 | // 10% | 258 | // 10% |
258 | 259 | ||
259 | $persent = 10; | 260 | $persent = 10; |
260 | $persent1 = 0; | 261 | $persent1 = 0; |
261 | $persent2 = 0; | 262 | $persent2 = 0; |
262 | $persent3 = 0; | 263 | $persent3 = 0; |
263 | $persent4 = 0; | 264 | $persent4 = 0; |
264 | $persent5 = 0; | 265 | $persent5 = 0; |
265 | 266 | ||
266 | if ((!empty($Worker[0]->telephone)) && | 267 | if ((!empty($Worker[0]->telephone)) && |
267 | (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) && | 268 | (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) && |
268 | (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) { | 269 | (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) { |
269 | // 40% | 270 | // 40% |
270 | $persent = $persent + 40; | 271 | $persent = $persent + 40; |
271 | $persent1 = 40; | 272 | $persent1 = 40; |
272 | } | 273 | } |
273 | 274 | ||
274 | //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year); | 275 | //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year); |
275 | 276 | ||
276 | if ($Worker[0]->sertificate->count() > 0) { | 277 | if ($Worker[0]->sertificate->count() > 0) { |
277 | // 15% | 278 | // 15% |
278 | $persent = $persent + 15; | 279 | $persent = $persent + 15; |
279 | $persent2 = 15; | 280 | $persent2 = 15; |
280 | } | 281 | } |
281 | 282 | ||
282 | if ($Worker[0]->infobloks->count() > 0) { | 283 | if ($Worker[0]->infobloks->count() > 0) { |
283 | // 20% | 284 | // 20% |
284 | $persent = $persent + 20; | 285 | $persent = $persent + 20; |
285 | $persent3 = 20; | 286 | $persent3 = 20; |
286 | } | 287 | } |
287 | 288 | ||
288 | if ($Worker[0]->prev_company->count() > 0) { | 289 | if ($Worker[0]->prev_company->count() > 0) { |
289 | // 10% | 290 | // 10% |
290 | $persent = $persent + 10; | 291 | $persent = $persent + 10; |
291 | $persent4 = 10; | 292 | $persent4 = 10; |
292 | } | 293 | } |
293 | 294 | ||
294 | if (!empty($Worker[0]->photo)) { | 295 | if (!empty($Worker[0]->photo)) { |
295 | // 5% | 296 | // 5% |
296 | $persent = $persent + 5; | 297 | $persent = $persent + 5; |
297 | $persent5 = 5; | 298 | $persent5 = 5; |
298 | } | 299 | } |
299 | if ($request->has('print')) { | 300 | if ($request->has('print')) { |
300 | dd($Worker); | 301 | dd($Worker); |
301 | } else { | 302 | } else { |
302 | return view('workers.cabinet', compact('Worker', 'Infobloks', 'persent', 'Job_titles', 'Infoblocks', 'stat')); | 303 | return view('workers.cabinet', compact('Worker', 'Infobloks', 'persent', 'Job_titles', 'Infoblocks', 'stat')); |
303 | } | 304 | } |
304 | } | 305 | } |
305 | 306 | ||
306 | // Сохранение данных | 307 | // Сохранение данных |
307 | public function cabinet_save(Worker $worker, Request $request) | 308 | public function cabinet_save(Worker $worker, Request $request) |
308 | { | 309 | { |
309 | $id = $worker->id; | 310 | $id = $worker->id; |
310 | $params = $request->all(); | 311 | $params = $request->all(); |
311 | 312 | ||
312 | $job_title_id = $request->get('job_title_id'); | 313 | $job_title_id = $request->get('job_title_id'); |
313 | 314 | ||
314 | unset($params['new_diplom']); | 315 | unset($params['new_diplom']); |
315 | unset($params['new_data_begin']); | 316 | unset($params['new_data_begin']); |
316 | unset($params['new_data_end']); | 317 | unset($params['new_data_end']); |
317 | unset($params['new_job_title']); | 318 | unset($params['new_job_title']); |
318 | unset($params['new_teplohod']); | 319 | unset($params['new_teplohod']); |
319 | unset($params['new_GWT']); | 320 | unset($params['new_GWT']); |
320 | unset($params['new_KBT']); | 321 | unset($params['new_KBT']); |
321 | unset($params['new_Begin_work']); | 322 | unset($params['new_Begin_work']); |
322 | unset($params['new_End_work']); | 323 | unset($params['new_End_work']); |
323 | unset($params['new_name_company']); | 324 | unset($params['new_name_company']); |
324 | 325 | ||
325 | $rules = [ | 326 | $rules = [ |
326 | 'surname' => ['required', 'string', 'max:255'], | 327 | 'surname' => ['required', 'string', 'max:255'], |
327 | 'name_man' => ['required', 'string', 'max:255'], | 328 | 'name_man' => ['required', 'string', 'max:255'], |
328 | 'email' => ['required', 'string', 'email', 'max:255'], | 329 | 'email' => ['required', 'string', 'email', 'max:255'], |
329 | 330 | ||
330 | ]; | 331 | ]; |
331 | 332 | ||
332 | $messages = [ | 333 | $messages = [ |
333 | 'required' => 'Укажите обязательное поле', | 334 | 'required' => 'Укажите обязательное поле', |
334 | 'min' => [ | 335 | 'min' => [ |
335 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 336 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
336 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 337 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
337 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 338 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
338 | ], | 339 | ], |
339 | 'max' => [ | 340 | 'max' => [ |
340 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 341 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
341 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 342 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
342 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 343 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
343 | ] | 344 | ] |
344 | ]; | 345 | ]; |
345 | 346 | ||
346 | $validator = Validator::make($params, $rules, $messages); | 347 | $validator = Validator::make($params, $rules, $messages); |
347 | 348 | ||
348 | if ($validator->fails()) { | 349 | if ($validator->fails()) { |
349 | return redirect()->route('worker.cabinet')->withErrors($validator); | 350 | return redirect()->route('worker.cabinet')->withErrors($validator); |
350 | } else { | 351 | } else { |
351 | 352 | ||
352 | if ($request->has('photo')) { | 353 | if ($request->has('photo')) { |
353 | if (!empty($Worker->photo)) { | 354 | if (!empty($Worker->photo)) { |
354 | Storage::delete($Worker->photo); | 355 | Storage::delete($Worker->photo); |
355 | } | 356 | } |
356 | $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); | 357 | $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); |
357 | } | 358 | } |
358 | 359 | ||
359 | if ($request->has('file')) { | 360 | if ($request->has('file')) { |
360 | if (!empty($Worker->file)) { | 361 | if (!empty($Worker->file)) { |
361 | Storage::delete($Worker->file); | 362 | Storage::delete($Worker->file); |
362 | } | 363 | } |
363 | $params['file'] = $request->file('file')->store("worker/$id", 'public'); | 364 | $params['file'] = $request->file('file')->store("worker/$id", 'public'); |
364 | } | 365 | } |
365 | 366 | ||
366 | $id_wor = $worker->update($params); | 367 | $id_wor = $worker->update($params); |
367 | $use = User::find($worker->user_id); | 368 | $use = User::find($worker->user_id); |
368 | $use->surname = $request->get('surname'); | 369 | $use->surname = $request->get('surname'); |
369 | $use->name_man = $request->get('name_man'); | 370 | $use->name_man = $request->get('name_man'); |
370 | $use->surname2 = $request->get('surname2'); | 371 | $use->surname2 = $request->get('surname2'); |
371 | 372 | ||
372 | $use->save(); | 373 | $use->save(); |
373 | $worker->job_titles()->sync($job_title_id); | 374 | $worker->job_titles()->sync($job_title_id); |
374 | 375 | ||
375 | return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); | 376 | return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); |
376 | } | 377 | } |
377 | } | 378 | } |
378 | 379 | ||
379 | // Сообщения данные | 380 | // Сообщения данные |
380 | public function messages($type_message) | 381 | public function messages($type_message) |
381 | { | 382 | { |
382 | $user_id = Auth()->user()->id; | 383 | $user_id = Auth()->user()->id; |
383 | 384 | ||
384 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> | 385 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> |
385 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); | 386 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); |
386 | 387 | ||
387 | $messages_output = Message::query()->with('vacancies')-> | 388 | $messages_output = Message::query()->with('vacancies')-> |
388 | with('user_to')->where('user_id', $user_id)-> | 389 | with('user_to')->where('user_id', $user_id)-> |
389 | OrderByDesc('created_at'); | 390 | OrderByDesc('created_at'); |
390 | 391 | ||
391 | 392 | ||
392 | $count_input = $messages_input->count(); | 393 | $count_input = $messages_input->count(); |
393 | $count_output = $messages_output->count(); | 394 | $count_output = $messages_output->count(); |
394 | 395 | ||
395 | if ($type_message == 'input') { | 396 | if ($type_message == 'input') { |
396 | $messages = $messages_input->paginate(5); | 397 | $messages = $messages_input->paginate(5); |
397 | } | 398 | } |
398 | 399 | ||
399 | if ($type_message == 'output') { | 400 | if ($type_message == 'output') { |
400 | $messages = $messages_output->paginate(5); | 401 | $messages = $messages_output->paginate(5); |
401 | } | 402 | } |
402 | 403 | ||
403 | // Вернуть все 100% | 404 | // Вернуть все 100% |
404 | return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); | 405 | return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); |
405 | } | 406 | } |
406 | 407 | ||
407 | // Избранный | 408 | // Избранный |
408 | public function favorite() | 409 | public function favorite() |
409 | { | 410 | { |
410 | return view('workers.favorite'); | 411 | return view('workers.favorite'); |
411 | } | 412 | } |
412 | 413 | ||
413 | // Сменить пароль | 414 | // Сменить пароль |
414 | public function new_password() | 415 | public function new_password() |
415 | { | 416 | { |
416 | $email = Auth()->user()->email; | 417 | $email = Auth()->user()->email; |
417 | return view('workers.new_password', compact('email')); | 418 | return view('workers.new_password', compact('email')); |
418 | } | 419 | } |
419 | 420 | ||
420 | // Обновление пароля | 421 | // Обновление пароля |
421 | public function save_new_password(Request $request) { | 422 | public function save_new_password(Request $request) { |
422 | $use = Auth()->user(); | 423 | $use = Auth()->user(); |
423 | $request->validate([ | 424 | $request->validate([ |
424 | 'password' => 'required|string', | 425 | 'password' => 'required|string', |
425 | 'new_password' => 'required|string', | 426 | 'new_password' => 'required|string', |
426 | 'new_password2' => 'required|string' | 427 | 'new_password2' => 'required|string' |
427 | ]); | 428 | ]); |
428 | 429 | ||
429 | if ($request->get('new_password') == $request->get('new_password2')) | 430 | if ($request->get('new_password') == $request->get('new_password2')) |
430 | if ($request->get('password') !== $request->get('new_password')) { | 431 | if ($request->get('password') !== $request->get('new_password')) { |
431 | $credentials = $request->only('email', 'password'); | 432 | $credentials = $request->only('email', 'password'); |
432 | if (Auth::attempt($credentials, $request->has('save_me'))) { | 433 | if (Auth::attempt($credentials, $request->has('save_me'))) { |
433 | 434 | ||
434 | if (!is_null($use->email_verified_at)){ | 435 | if (!is_null($use->email_verified_at)){ |
435 | 436 | ||
436 | $user_data = User_Model::find($use->id); | 437 | $user_data = User_Model::find($use->id); |
437 | $user_data->update([ | 438 | $user_data->update([ |
438 | 'password' => Hash::make($request->get('new_password')), | 439 | 'password' => Hash::make($request->get('new_password')), |
439 | 'pubpassword' => base64_encode($request->get('new_password')), | 440 | 'pubpassword' => base64_encode($request->get('new_password')), |
440 | ]); | 441 | ]); |
441 | return redirect() | 442 | return redirect() |
442 | ->route('worker.new_password') | 443 | ->route('worker.new_password') |
443 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 444 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
444 | } | 445 | } |
445 | 446 | ||
446 | return redirect() | 447 | return redirect() |
447 | ->route('worker.new_password') | 448 | ->route('worker.new_password') |
448 | ->withError('Данная учетная запись не было верифицированна!'); | 449 | ->withError('Данная учетная запись не было верифицированна!'); |
449 | } | 450 | } |
450 | } | 451 | } |
451 | 452 | ||
452 | return redirect() | 453 | return redirect() |
453 | ->route('worker.new_password') | 454 | ->route('worker.new_password') |
454 | ->withErrors('Не совпадение данных, обновите пароли!'); | 455 | ->withErrors('Не совпадение данных, обновите пароли!'); |
455 | } | 456 | } |
456 | 457 | ||
457 | // Удаление профиля форма | 458 | // Удаление профиля форма |
458 | public function delete_profile() | 459 | public function delete_profile() |
459 | { | 460 | { |
460 | $login = Auth()->user()->email; | 461 | $login = Auth()->user()->email; |
461 | return view('workers.delete_profile', compact('login')); | 462 | return view('workers.delete_profile', compact('login')); |
462 | } | 463 | } |
463 | 464 | ||
464 | // Удаление профиля код | 465 | // Удаление профиля код |
465 | public function delete_profile_result(Request $request) { | 466 | public function delete_profile_result(Request $request) { |
466 | $Answer = $request->all(); | 467 | $Answer = $request->all(); |
467 | $user_id = Auth()->user()->id; | 468 | $user_id = Auth()->user()->id; |
468 | $request->validate([ | 469 | $request->validate([ |
469 | 'password' => 'required|string', | 470 | 'password' => 'required|string', |
470 | ]); | 471 | ]); |
471 | 472 | ||
472 | $credentials = $request->only('email', 'password'); | 473 | $credentials = $request->only('email', 'password'); |
473 | if (Auth::attempt($credentials)) { | 474 | if (Auth::attempt($credentials)) { |
474 | Auth::logout(); | 475 | Auth::logout(); |
475 | $it = User_Model::find($user_id); | 476 | $it = User_Model::find($user_id); |
476 | $it->delete(); | 477 | $it->delete(); |
477 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 478 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
478 | } else { | 479 | } else { |
479 | return redirect()->route('worker.delete_profile') | 480 | return redirect()->route('worker.delete_profile') |
480 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 481 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
481 | } | 482 | } |
482 | } | 483 | } |
483 | 484 | ||
484 | // Регистрация соискателя | 485 | // Регистрация соискателя |
485 | public function register_worker(Request $request) | 486 | public function register_worker(Request $request) |
486 | { | 487 | { |
487 | $params = $request->all(); | 488 | $params = $request->all(); |
488 | $params['is_worker'] = 1; | 489 | $params['is_worker'] = 1; |
489 | 490 | ||
490 | $rules = [ | 491 | $rules = [ |
491 | 'surname' => ['required', 'string', 'max:255'], | 492 | 'surname' => ['required', 'string', 'max:255'], |
492 | 'name_man' => ['required', 'string', 'max:255'], | 493 | 'name_man' => ['required', 'string', 'max:255'], |
493 | 'email' => ['required', 'email', 'max:255', 'unique:users'], | 494 | 'email' => ['required', 'email', 'max:255', 'unique:users'], |
494 | 'password' => ['required', 'string', 'min:6'] | 495 | 'password' => ['required', 'string', 'min:6'] |
495 | ]; | 496 | ]; |
496 | 497 | ||
497 | $messages = [ | 498 | $messages = [ |
498 | 'required' => 'Укажите обязательное поле', | 499 | 'required' => 'Укажите обязательное поле', |
499 | 'min' => [ | 500 | 'min' => [ |
500 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 501 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
501 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 502 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
502 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 503 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
503 | ], | 504 | ], |
504 | 'max' => [ | 505 | 'max' => [ |
505 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 506 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
506 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 507 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
507 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 508 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
508 | ] | 509 | ] |
509 | ]; | 510 | ]; |
510 | 511 | ||
511 | $email = $request->get('email'); | 512 | $email = $request->get('email'); |
512 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | 513 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { |
513 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | 514 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); |
514 | } | 515 | } |
515 | 516 | ||
516 | if ($request->get('password') !== $request->get('confirmed')){ | 517 | if ($request->get('password') !== $request->get('confirmed')){ |
517 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | 518 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); |
518 | } | 519 | } |
519 | 520 | ||
520 | if (strlen($request->get('password')) < 6) { | 521 | if (strlen($request->get('password')) < 6) { |
521 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | 522 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); |
522 | } | 523 | } |
523 | 524 | ||
524 | /*$haystack = $request->get('password'); | 525 | /*$haystack = $request->get('password'); |
525 | 526 | ||
526 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); | 527 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); |
527 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', | 528 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', |
528 | 'X', 'C', 'V', 'B', 'N', 'M'); | 529 | 'X', 'C', 'V', 'B', 'N', 'M'); |
529 | $lenpwd_bool = true; | 530 | $lenpwd_bool = true; |
530 | $spec_bool = false; | 531 | $spec_bool = false; |
531 | $alpha_bool = false; | 532 | $alpha_bool = false; |
532 | 533 | ||
533 | if (strlen($haystack) < 8) $lenpwd_bool = false; | 534 | if (strlen($haystack) < 8) $lenpwd_bool = false; |
534 | 535 | ||
535 | foreach ($specsumbol as $it) { | 536 | foreach ($specsumbol as $it) { |
536 | if (strpos($haystack, $it) !== false) { | 537 | if (strpos($haystack, $it) !== false) { |
537 | $spec_bool = true; | 538 | $spec_bool = true; |
538 | } | 539 | } |
539 | } | 540 | } |
540 | 541 | ||
541 | foreach ($alpha as $it) { | 542 | foreach ($alpha as $it) { |
542 | if (strpos($haystack, $it) !== false) { | 543 | if (strpos($haystack, $it) !== false) { |
543 | $alpha_bool = true; | 544 | $alpha_bool = true; |
544 | } | 545 | } |
545 | } | 546 | } |
546 | 547 | ||
547 | if ((!$spec_bool) || (!$alpha_bool)) { | 548 | if ((!$spec_bool) || (!$alpha_bool)) { |
548 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); | 549 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); |
549 | }*/ | 550 | }*/ |
550 | 551 | ||
551 | if (($request->has('politik')) && ($request->get('politik') == 1)) { | 552 | if (($request->has('politik')) && ($request->get('politik') == 1)) { |
552 | $validator = Validator::make($params, $rules, $messages); | 553 | $validator = Validator::make($params, $rules, $messages); |
553 | 554 | ||
554 | if ($validator->fails()) { | 555 | if ($validator->fails()) { |
555 | return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | 556 | return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); |
556 | } else { | 557 | } else { |
557 | //dd($params); | 558 | //dd($params); |
558 | $user = $this->create($params); | 559 | $user = $this->create($params); |
559 | event(new Registered($user)); | 560 | event(new Registered($user)); |
560 | Auth::guard()->login($user); | 561 | Auth::guard()->login($user); |
561 | } | 562 | } |
562 | if ($user) { | 563 | if ($user) { |
563 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; | 564 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; |
564 | } else { | 565 | } else { |
565 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | 566 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); |
566 | } | 567 | } |
567 | 568 | ||
568 | } else { | 569 | } else { |
569 | return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); | 570 | return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); |
570 | } | 571 | } |
571 | } | 572 | } |
572 | 573 | ||
573 | // Звездная оценка и ответ | 574 | // Звездная оценка и ответ |
574 | public function stars_answer(Request $request) { | 575 | public function stars_answer(Request $request) { |
575 | $params = $request->all(); | 576 | $params = $request->all(); |
576 | $rules = [ | 577 | $rules = [ |
577 | 'message' => ['required', 'string', 'max:255'], | 578 | 'message' => ['required', 'string', 'max:255'], |
578 | ]; | 579 | ]; |
579 | 580 | ||
580 | $messages = [ | 581 | $messages = [ |
581 | 'required' => 'Укажите обязательное поле', | 582 | 'required' => 'Укажите обязательное поле', |
582 | 'min' => [ | 583 | 'min' => [ |
583 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 584 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
584 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 585 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
585 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 586 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
586 | ], | 587 | ], |
587 | 'max' => [ | 588 | 'max' => [ |
588 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 589 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
589 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 590 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
590 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 591 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
591 | ] | 592 | ] |
592 | ]; | 593 | ]; |
593 | $response_worker = ResponseWork::create($params); | 594 | $response_worker = ResponseWork::create($params); |
594 | return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); | 595 | return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); |
595 | } | 596 | } |
596 | 597 | ||
597 | public function TestWorker() | 598 | public function TestWorker() |
598 | { | 599 | { |
599 | $Use = new User(); | 600 | $Use = new User(); |
600 | 601 | ||
601 | $Code_user = $Use->create([ | 602 | $Code_user = $Use->create([ |
602 | 'name' => 'surname name_man', | 603 | 'name' => 'surname name_man', |
603 | 'name_man' => 'name_man', | 604 | 'name_man' => 'name_man', |
604 | 'surname' => 'surname', | 605 | 'surname' => 'surname', |
605 | 'surname2' => 'surname2', | 606 | 'surname2' => 'surname2', |
606 | 'subscribe_email' => '1', | 607 | 'subscribe_email' => '1', |
607 | 'email' => 'email@mail.com', | 608 | 'email' => 'email@mail.com', |
608 | 'telephone' => '1234567890', | 609 | 'telephone' => '1234567890', |
609 | 'password' => Hash::make('password'), | 610 | 'password' => Hash::make('password'), |
610 | 'pubpassword' => base64_encode('password'), | 611 | 'pubpassword' => base64_encode('password'), |
611 | 'email_verified_at' => Carbon::now(), | 612 | 'email_verified_at' => Carbon::now(), |
612 | 'is_worker' => 1, | 613 | 'is_worker' => 1, |
613 | ]); | 614 | ]); |
614 | 615 | ||
615 | if ($Code_user->id > 0) { | 616 | if ($Code_user->id > 0) { |
616 | $Worker = new Worker(); | 617 | $Worker = new Worker(); |
617 | $Worker->user_id = $Code_user->id; | 618 | $Worker->user_id = $Code_user->id; |
618 | $Worker->position_work = 1; //'job_titles'; | 619 | $Worker->position_work = 1; //'job_titles'; |
619 | $Worker->email = 'email@email.com'; | 620 | $Worker->email = 'email@email.com'; |
620 | $Worker->telephone = '1234567890'; | 621 | $Worker->telephone = '1234567890'; |
621 | $status = $Worker->save(); | 622 | $status = $Worker->save(); |
622 | 623 | ||
623 | $Title_Worker = new Title_worker(); | 624 | $Title_Worker = new Title_worker(); |
624 | $Title_Worker->worker_id = $Worker->id; | 625 | $Title_Worker->worker_id = $Worker->id; |
625 | $Title_Worker->job_title_id = 1; | 626 | $Title_Worker->job_title_id = 1; |
626 | $Title_Worker->save(); | 627 | $Title_Worker->save(); |
627 | } | 628 | } |
628 | } | 629 | } |
629 | 630 | ||
630 | // Создание пользователя | 631 | // Создание пользователя |
631 | protected function create(array $data) | 632 | protected function create(array $data) |
632 | { | 633 | { |
633 | $Use = new User(); | 634 | $Use = new User(); |
634 | 635 | ||
635 | $Code_user = $Use->create([ | 636 | $Code_user = $Use->create([ |
636 | 'name' => $data['surname']." ".$data['name_man'], | 637 | 'name' => $data['surname']." ".$data['name_man'], |
637 | 'name_man' => $data['name_man'], | 638 | 'name_man' => $data['name_man'], |
638 | 'surname' => $data['surname'], | 639 | 'surname' => $data['surname'], |
639 | 'surname2' => $data['surname2'], | 640 | 'surname2' => $data['surname2'], |
640 | 'subscribe_email' => $data['email'], | 641 | 'subscribe_email' => $data['email'], |
641 | 'email' => $data['email'], | 642 | 'email' => $data['email'], |
642 | 'telephone' => $data['telephone'], | 643 | 'telephone' => $data['telephone'], |
643 | 'password' => Hash::make($data['password']), | 644 | 'password' => Hash::make($data['password']), |
644 | 'pubpassword' => base64_encode($data['password']), | 645 | 'pubpassword' => base64_encode($data['password']), |
645 | 'email_verified_at' => Carbon::now(), | 646 | 'email_verified_at' => Carbon::now(), |
646 | 'is_worker' => $data['is_worker'], | 647 | 'is_worker' => $data['is_worker'], |
647 | ]); | 648 | ]); |
648 | 649 | ||
649 | if ($Code_user->id > 0) { | 650 | if ($Code_user->id > 0) { |
650 | $Worker = new Worker(); | 651 | $Worker = new Worker(); |
651 | $Worker->user_id = $Code_user->id; | 652 | $Worker->user_id = $Code_user->id; |
652 | $Worker->position_work = $data['job_titles']; | 653 | $Worker->position_work = $data['job_titles']; |
653 | $Worker->email = $data['email']; | 654 | $Worker->email = $data['email']; |
654 | $Worker->telephone = $data['telephone']; | 655 | $Worker->telephone = $data['telephone']; |
655 | $Worker->save(); | 656 | $Worker->save(); |
656 | 657 | ||
657 | if (isset($Worker->id)) { | 658 | if (isset($Worker->id)) { |
658 | $Title_Worker = new Title_worker(); | 659 | $Title_Worker = new Title_worker(); |
659 | $Title_Worker->worker_id = $Worker->id; | 660 | $Title_Worker->worker_id = $Worker->id; |
660 | $Title_Worker->job_title_id = $data['job_titles']; | 661 | $Title_Worker->job_title_id = $data['job_titles']; |
661 | $Title_Worker->save(); | 662 | $Title_Worker->save(); |
662 | } | 663 | } |
663 | 664 | ||
664 | return $Code_user; | 665 | return $Code_user; |
665 | } | 666 | } |
666 | } | 667 | } |
667 | 668 | ||
668 | // Вакансии избранные | 669 | // Вакансии избранные |
669 | public function colorado(Request $request) { | 670 | public function colorado(Request $request) { |
670 | $IP_address = RusDate::ip_addr_client(); | 671 | $IP_address = RusDate::ip_addr_client(); |
671 | $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); | 672 | $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); |
672 | 673 | ||
673 | if ($Arr->count()) { | 674 | if ($Arr->count()) { |
674 | $A = Array(); | 675 | $A = Array(); |
675 | foreach ($Arr as $it) { | 676 | foreach ($Arr as $it) { |
676 | $A[] = $it->code_record; | 677 | $A[] = $it->code_record; |
677 | } | 678 | } |
678 | 679 | ||
679 | $Query = Ad_employer::query()->whereIn('id', $A); | 680 | $Query = Ad_employer::query()->whereIn('id', $A); |
680 | } else { | 681 | } else { |
681 | $Query = Ad_employer::query()->where('id', '=', '0'); | 682 | $Query = Ad_employer::query()->where('id', '=', '0'); |
682 | } | 683 | } |
683 | 684 | ||
684 | $Query = $Query->with('jobs')-> | 685 | $Query = $Query->with('jobs')-> |
685 | with('cat')-> | 686 | with('cat')-> |
686 | with('employer')-> | 687 | with('employer')-> |
687 | whereHas('jobs_code', function ($query) use ($request) { | 688 | whereHas('jobs_code', function ($query) use ($request) { |
688 | if ($request->ajax()) { | 689 | if ($request->ajax()) { |
689 | if (null !== ($request->get('job'))) { | 690 | if (null !== ($request->get('job'))) { |
690 | $query->where('job_title_id', $request->get('job')); | 691 | $query->where('job_title_id', $request->get('job')); |
691 | } | 692 | } |
692 | } | 693 | } |
693 | })->select('ad_employers.*'); | 694 | })->select('ad_employers.*'); |
694 | 695 | ||
695 | $Job_title = Job_title::query()->OrderBy('name')->get(); | 696 | $Job_title = Job_title::query()->OrderBy('name')->get(); |
696 | 697 | ||
697 | $Query_count = $Query->count(); | 698 | $Query_count = $Query->count(); |
698 | 699 | ||
699 | $Query = $Query->OrderBy('updated_at')->paginate(3); | 700 | $Query = $Query->OrderBy('updated_at')->paginate(3); |
700 | 701 | ||
701 | return view('workers.favorite', compact('Query', | 702 | return view('workers.favorite', compact('Query', |
702 | 'Query_count', | 703 | 'Query_count', |
703 | 'Job_title')); | 704 | 'Job_title')); |
704 | 705 | ||
705 | } | 706 | } |
706 | 707 | ||
707 | //Переписка | 708 | //Переписка |
708 | public function dialog(User_Model $user1, User_Model $user2) { | 709 | public function dialog(User_Model $user1, User_Model $user2) { |
709 | if (isset($user2->id)) { | 710 | if (isset($user2->id)) { |
710 | $companion = User_Model::query()->with('workers')-> | 711 | $companion = User_Model::query()->with('workers')-> |
711 | with('employers')-> | 712 | with('employers')-> |
712 | where('id', $user2->id)->first(); | 713 | where('id', $user2->id)->first(); |
713 | } | 714 | } |
714 | 715 | ||
715 | $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) { | 716 | $Messages = Message::query()-> |
717 | //with('response')-> | ||
718 | where(function($query) use ($user1, $user2) { | ||
716 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); | 719 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); |
717 | })->orWhere(function($query) use ($user1, $user2) { | 720 | })->orWhere(function($query) use ($user1, $user2) { |
718 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); | 721 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); |
719 | })->OrderBy('created_at')->get(); | 722 | })->OrderBy('created_at')->get(); |
720 | 723 | ||
721 | $id_vac = null; | 724 | $id_vac = null; |
722 | foreach ($Messages as $it) { | 725 | /*foreach ($Messages as $it) { |
723 | if (isset($it->response)) { | 726 | if (isset($it->response)) { |
724 | foreach ($it->response as $r) { | 727 | foreach ($it->response as $r) { |
725 | if (isset($r->ad_employer_id)) { | 728 | if (isset($r->ad_employer_id)) { |
726 | $id_vac = $r->ad_employer_id; | 729 | $id_vac = $r->ad_employer_id; |
727 | break; | 730 | break; |
728 | } | 731 | } |
729 | } | 732 | } |
730 | } | 733 | } |
731 | if (!is_null($id_vac)) break; | 734 | if (!is_null($id_vac)) break; |
732 | } | 735 | }*/ |
733 | 736 | ||
734 | $ad_employer = null; | 737 | $ad_employer = null; |
735 | if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); | 738 | if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); |
736 | $sender = $user1; | 739 | $sender = $user1; |
737 | 740 | ||
738 | return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); | 741 | return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); |
739 | } | 742 | } |
740 | 743 | ||
741 | // Даунылоады | 744 | // Даунылоады |
742 | public function download(Worker $worker) { | 745 | public function download(Worker $worker) { |
743 | $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; | 746 | $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; |
744 | view()->share('house',$arr_house); | 747 | view()->share('house',$arr_house); |
745 | $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); | 748 | $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); |
746 | return $pdf->stream(); | 749 | return $pdf->stream(); |
747 | } | 750 | } |
748 | 751 | ||
749 | // Поднятие анкеты | 752 | // Поднятие анкеты |
750 | public function up(Worker $worker) { | 753 | public function up(Worker $worker) { |
751 | $worker->updated_at = Carbon::now(); | 754 | $worker->updated_at = Carbon::now(); |
752 | $worker->save(); | 755 | $worker->save(); |
753 | // 0 | 756 | // 0 |
754 | return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); | 757 | return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); |
755 | } | 758 | } |
756 | 759 | ||
757 | // Форма сертификате | 760 | // Форма сертификате |
758 | public function new_sertificate(Worker $worker) { | 761 | public function new_sertificate(Worker $worker) { |
759 | return view('workers.sertificate_add', compact('worker')); | 762 | return view('workers.sertificate_add', compact('worker')); |
760 | } | 763 | } |
761 | 764 | ||
762 | // Добавление сертификата | 765 | // Добавление сертификата |
763 | public function add_serificate(SertificationRequest $request) { | 766 | public function add_serificate(SertificationRequest $request) { |
764 | $params = $request->all(); | 767 | $params = $request->all(); |
765 | 768 | ||
766 | $Sertificate = new sertification(); | 769 | $Sertificate = new sertification(); |
767 | $Sertificate->create($params); | 770 | $Sertificate->create($params); |
768 | $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get(); | 771 | $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get(); |
769 | return redirect()->route('worker.cabinet'); | 772 | return redirect()->route('worker.cabinet'); |
770 | //return view('ajax.documents', compact('Docs')); | 773 | //return view('ajax.documents', compact('Docs')); |
771 | } | 774 | } |
772 | 775 | ||
773 | // Удалить сертификат | 776 | // Удалить сертификат |
774 | public function delete_sertificate(sertification $doc) { | 777 | public function delete_sertificate(sertification $doc) { |
775 | $doc->delete(); | 778 | $doc->delete(); |
776 | 779 | ||
777 | return redirect()->route('worker.cabinet'); | 780 | return redirect()->route('worker.cabinet'); |
778 | } | 781 | } |
779 | 782 | ||
780 | // Редактирование сертификата | 783 | // Редактирование сертификата |
781 | public function edit_sertificate(Worker $worker, sertification $doc) { | 784 | public function edit_sertificate(Worker $worker, sertification $doc) { |
782 | return view('workers.sertificate_edit', compact('doc', 'worker')); | 785 | return view('workers.sertificate_edit', compact('doc', 'worker')); |
783 | } | 786 | } |
784 | 787 | ||
785 | // Редактирование обновление сертификата | 788 | // Редактирование обновление сертификата |
786 | public function update_serificate(SertificationRequest $request, sertification $doc) { | 789 | public function update_serificate(SertificationRequest $request, sertification $doc) { |
787 | $all = $request->all(); | 790 | $all = $request->all(); |
788 | $doc->worker_id = $all['worker_id']; | 791 | $doc->worker_id = $all['worker_id']; |
789 | $doc->name = $all['name']; | 792 | $doc->name = $all['name']; |
790 | $doc->end_begin = $all['end_begin']; | 793 | $doc->end_begin = $all['end_begin']; |
791 | $doc->save(); | 794 | $doc->save(); |
792 | 795 | ||
793 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); | 796 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); |
794 | } | 797 | } |
795 | 798 | ||
796 | public function delete_add_diplom(Request $request, Worker $worker) { | 799 | public function delete_add_diplom(Request $request, Worker $worker) { |
797 | $infoblok_id = $request->get('infoblok_id'); | 800 | $infoblok_id = $request->get('infoblok_id'); |
798 | 801 | ||
799 | if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) | 802 | if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) |
800 | $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); | 803 | $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); |
801 | else { | 804 | else { |
802 | $params['infoblok_id'] = $infoblok_id; | 805 | $params['infoblok_id'] = $infoblok_id; |
803 | $params['worker_id'] = $worker->id; | 806 | $params['worker_id'] = $worker->id; |
804 | $params['status'] = $request->get('val'); | 807 | $params['status'] = $request->get('val'); |
805 | $id = Dop_info::create($params); | 808 | $id = Dop_info::create($params); |
806 | //$id = $worker->infobloks()->sync([$infoblok_id]); | 809 | //$id = $worker->infobloks()->sync([$infoblok_id]); |
807 | } | 810 | } |
808 | 811 | ||
809 | //$Infoblocks = infobloks::query()->get(); | 812 | //$Infoblocks = infobloks::query()->get(); |
810 | return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); | 813 | return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); |
811 | } | 814 | } |
812 | 815 | ||
813 | 816 | ||
814 | 817 | ||
815 | // Добавление диплома | 818 | // Добавление диплома |
816 | public function add_diplom_ajax(Request $request) { | 819 | public function add_diplom_ajax(Request $request) { |
817 | // конец | 820 | // конец |
818 | $params = $request->all(); | 821 | $params = $request->all(); |
819 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); | 822 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); |
820 | 823 | ||
821 | if ($count == 0) $dop_info = Dop_info::create($params); | 824 | if ($count == 0) $dop_info = Dop_info::create($params); |
822 | $Infoblocks = infobloks::query()->get(); | 825 | $Infoblocks = infobloks::query()->get(); |
823 | $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); | 826 | $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); |
824 | $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); | 827 | $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); |
825 | return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); | 828 | return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); |
826 | } | 829 | } |
827 | 830 | ||
828 | // Добавление диплома без ajax | 831 | // Добавление диплома без ajax |
829 | public function add_diplom(Worker $worker) { | 832 | public function add_diplom(Worker $worker) { |
830 | $worker_id = $worker->id; | 833 | $worker_id = $worker->id; |
831 | $Infoblocks = infobloks::query()->get(); | 834 | $Infoblocks = infobloks::query()->get(); |
832 | return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); | 835 | return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); |
833 | } | 836 | } |
834 | // Сохранить | 837 | // Сохранить |
835 | // Сохраняю диплом | 838 | // Сохраняю диплом |
836 | public function add_diplom_save(Request $request) { | 839 | public function add_diplom_save(Request $request) { |
837 | $params = $request->all(); | 840 | $params = $request->all(); |
838 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); | 841 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); |
839 | if ($count == 0) $dop_info = Dop_info::create($params); | 842 | if ($count == 0) $dop_info = Dop_info::create($params); |
840 | return redirect()->route('worker.cabinet'); | 843 | return redirect()->route('worker.cabinet'); |
841 | } | 844 | } |
842 | 845 | ||
843 | // Добавление стандартного документа | 846 | // Добавление стандартного документа |
844 | public function add_document(Worker $worker) { | 847 | public function add_document(Worker $worker) { |
845 | return view('workers.docs', compact('worker')); | 848 | return view('workers.docs', compact('worker')); |
846 | } | 849 | } |
847 | 850 | ||
848 | //Сохранение стандартого документа | 851 | //Сохранение стандартого документа |
849 | public function add_document_save(DocumentsRequest $request) { | 852 | public function add_document_save(DocumentsRequest $request) { |
850 | $params = $request->all(); | 853 | $params = $request->all(); |
851 | $place_work = place_works::create($params); | 854 | $place_work = place_works::create($params); |
852 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!'); | 855 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!'); |
853 | } | 856 | } |
854 | 857 | ||
855 | // Редактирование документа | 858 | // Редактирование документа |
856 | public function edit_document(place_works $doc, Worker $worker) { | 859 | public function edit_document(place_works $doc, Worker $worker) { |
857 | return view('workers.docs-edit', compact('doc', 'worker')); | 860 | return view('workers.docs-edit', compact('doc', 'worker')); |
858 | } | 861 | } |
859 | 862 | ||
860 | //Сохранение отредактированного документа | 863 | //Сохранение отредактированного документа |
861 | public function edit_document_save(DocumentsRequest $request, place_works $doc) { | 864 | public function edit_document_save(DocumentsRequest $request, place_works $doc) { |
862 | $params = $request->all(); | 865 | $params = $request->all(); |
863 | $doc->update($params); | 866 | $doc->update($params); |
864 | 867 | ||
865 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); | 868 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); |
866 | } | 869 | } |
867 | 870 | ||
868 | // Удаление документа | 871 | // Удаление документа |
869 | public function delete_document(place_works $doc) { | 872 | public function delete_document(place_works $doc) { |
870 | $doc->delete(); | 873 | $doc->delete(); |
871 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); | 874 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); |
872 | } | 875 | } |
873 | 876 | ||
874 | //Отправка нового сообщения | 877 | //Отправка нового сообщения |
875 | public function new_message(Request $request) { | 878 | public function new_message(Request $request) { |
876 | $params = $request->all(); | 879 | $params = $request->all(); |
877 | 880 | ||
878 | $id = $params['send_user_id']; | 881 | $id = $params['send_user_id']; |
879 | $message = new Message(); | 882 | $message = new Message(); |
880 | $message->user_id = $params['send_user_id']; | 883 | $message->user_id = $params['send_user_id']; |
881 | $message->to_user_id = $params['send_to_user_id']; | 884 | $message->to_user_id = $params['send_to_user_id']; |
882 | $message->title = $params['send_title']; | 885 | $message->title = $params['send_title']; |
883 | $message->text = $params['send_text']; | 886 | $message->text = $params['send_text']; |
884 | $message->ad_employer_id = $params['send_vacancy']; | 887 | $message->ad_employer_id = $params['send_vacancy']; |
885 | if ($request->has('send_file')) { | 888 | if ($request->has('send_file')) { |
886 | $message->file = $request->file('send_file')->store("worker/$id", 'public'); | 889 | $message->file = $request->file('send_file')->store("worker/$id", 'public'); |
887 | } | 890 | } |
888 | $message->flag_new = 1; | 891 | $message->flag_new = 1; |
889 | $id_message = $message->save(); | 892 | $id_message = $message->save(); |
890 | 893 | ||
891 | $data['message_id'] = $id_message; | 894 | $data['message_id'] = $id_message; |
892 | $data['ad_employer_id'] = $params['send_vacancy']; | 895 | $data['ad_employer_id'] = $params['send_vacancy']; |
893 | $data['job_title_id'] = $params['send_job_title_id']; | 896 | $data['job_title_id'] = $params['send_job_title_id']; |
894 | $data['flag'] = 1; | 897 | $data['flag'] = 1; |
895 | $ad_responce = ad_response::create($data); | 898 | $ad_responce = ad_response::create($data); |
896 | return redirect()->route('worker.messages', ['type_message' => 'output']); | 899 | return redirect()->route('worker.messages', ['type_message' => 'output']); |
897 | } | 900 | } |
898 | 901 | ||
899 | // Информация о предыдущих компаниях | 902 | // Информация о предыдущих компаниях |
900 | public function new_prev_company(Worker $worker) { | 903 | public function new_prev_company(Worker $worker) { |
901 | return view('workers.prev_company_form', compact('worker')); | 904 | return view('workers.prev_company_form', compact('worker')); |
902 | } | 905 | } |
903 | 906 | ||
904 | // Добавление контакта компании | 907 | // Добавление контакта компании |
905 | public function add_prev_company(PrevCompanyRequest $request) { | 908 | public function add_prev_company(PrevCompanyRequest $request) { |
906 | // Возвращение параметров | 909 | // Возвращение параметров |
907 | $all = $request->all(); | 910 | $all = $request->all(); |
908 | $PrevCompany = PrevCompany::create($all); | 911 | $PrevCompany = PrevCompany::create($all); |
909 | 912 | ||
910 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); | 913 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); |
911 | } | 914 | } |
912 | 915 | ||
913 | // Редактирование контакта компании | 916 | // Редактирование контакта компании |
914 | public function edit_prev_company(PrevCompany $doc, Worker $worker) { | 917 | public function edit_prev_company(PrevCompany $doc, Worker $worker) { |
915 | return view('workers.prev_company_edit_form', compact('doc', 'worker')); | 918 | return view('workers.prev_company_edit_form', compact('doc', 'worker')); |
916 | } | 919 | } |
917 | 920 | ||
918 | //Сохранение редактирования контакта компании | 921 | //Сохранение редактирования контакта компании |
919 | public function update_prev_company(PrevCompany $doc, Request $request){ | 922 | public function update_prev_company(PrevCompany $doc, Request $request){ |
920 | $all = $request->all(); | 923 | $all = $request->all(); |
921 | $doc->update($all); | 924 | $doc->update($all); |
922 | 925 | ||
923 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); | 926 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); |
924 | } | 927 | } |
925 | 928 | ||
926 | // Удаление контакта предыдущей компании | 929 | // Удаление контакта предыдущей компании |
927 | public function delete_prev_company(PrevCompany $doc) { | 930 | public function delete_prev_company(PrevCompany $doc) { |
928 | $doc->delete(); | 931 | $doc->delete(); |
929 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); | 932 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); |
930 | } | 933 | } |
931 | } | 934 | } |
932 | 935 | ||
933 | 936 |
app/Models/ResponseWork.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Models; | 3 | namespace App\Models; |
4 | 4 | ||
5 | use Illuminate\Database\Eloquent\Factories\HasFactory; | 5 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
6 | use Illuminate\Database\Eloquent\Model; | 6 | use Illuminate\Database\Eloquent\Model; |
7 | use Illuminate\Database\Eloquent\Relations\BelongsTo; | ||
7 | 8 | ||
8 | class ResponseWork extends Model | 9 | class ResponseWork extends Model |
9 | { | 10 | { |
10 | use HasFactory; | 11 | use HasFactory; |
11 | 12 | ||
12 | public $fillable = [ | 13 | public $fillable = [ |
13 | 'worker_id', | 14 | 'worker_id', |
14 | 'stars', | 15 | 'stars', |
15 | 'message' | 16 | 'message' |
16 | ]; | 17 | ]; |
18 | |||
17 | } | 19 | } |
18 | 20 |
app/Models/Worker.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Models; | 3 | namespace App\Models; |
4 | 4 | ||
5 | use Illuminate\Database\Eloquent\Factories\HasFactory; | 5 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
6 | use Illuminate\Database\Eloquent\Model; | 6 | use Illuminate\Database\Eloquent\Model; |
7 | 7 | ||
8 | class Worker extends Model | 8 | class Worker extends Model |
9 | { | 9 | { |
10 | use HasFactory; | 10 | use HasFactory; |
11 | 11 | ||
12 | protected $table = 'Workers'; | 12 | protected $table = 'Workers'; |
13 | 13 | ||
14 | protected $fillable = [ | 14 | protected $fillable = [ |
15 | 'user_id', | 15 | 'user_id', |
16 | 'status_work', | 16 | 'status_work', |
17 | 'position_work', | 17 | 'position_work', |
18 | 'telephone', | 18 | 'telephone', |
19 | 'telephone2', | 19 | 'telephone2', |
20 | 'persent_anketa', | 20 | 'persent_anketa', |
21 | 'photo', | 21 | 'photo', |
22 | 'email_data', | 22 | 'email_data', |
23 | 'status_profile', | 23 | 'status_profile', |
24 | 'old_year', | 24 | 'old_year', |
25 | 'experience', | 25 | 'experience', |
26 | 'en_is', | 26 | 'en_is', |
27 | 'education', | 27 | 'education', |
28 | 'email', | 28 | 'email', |
29 | 'interpassport', | 29 | 'interpassport', |
30 | 'mk', | 30 | 'mk', |
31 | 'vvp', | 31 | 'vvp', |
32 | 'vlm', | 32 | 'vlm', |
33 | 'reka_diplom', | 33 | 'reka_diplom', |
34 | 'more_diplom', | 34 | 'more_diplom', |
35 | 'mpss', | 35 | 'mpss', |
36 | 'tanker', | 36 | 'tanker', |
37 | 'gmssb', | 37 | 'gmssb', |
38 | 'resume', | 38 | 'resume', |
39 | 'sort', | 39 | 'sort', |
40 | 'updated_at', | 40 | 'updated_at', |
41 | 'text', | 41 | 'text', |
42 | 'address', | 42 | 'address', |
43 | 'city', | 43 | 'city', |
44 | 'coord', | 44 | 'coord', |
45 | 'file', | 45 | 'file', |
46 | 'is_remove', | 46 | 'is_remove', |
47 | 'favorite_user', | 47 | 'favorite_user', |
48 | 'sroch_user' | 48 | 'sroch_user' |
49 | ]; | 49 | ]; |
50 | 50 | ||
51 | /* | 51 | /* |
52 | * Связь таблицы users с таблицей workers | 52 | * Связь таблицы users с таблицей workers |
53 | */ | 53 | */ |
54 | public function users() { | 54 | public function users() { |
55 | return $this->belongsTo(User::class, 'user_id'); | 55 | return $this->belongsTo(User::class, 'user_id'); |
56 | } | 56 | } |
57 | 57 | ||
58 | // Связь Работника с сертификами (0-0 - 1) | 58 | // Связь Работника с сертификами (0-0 - 1) |
59 | public function sertificate() { | 59 | public function sertificate() { |
60 | return $this->hasMany(sertification::class); | 60 | return $this->hasMany(sertification::class); |
61 | } | 61 | } |
62 | 62 | ||
63 | // Связь Работника с должностями (0-0 - 1) | 63 | // Связь Работника с должностями (0-0 - 1) |
64 | public function job_titles() { | 64 | public function job_titles() { |
65 | return $this->belongsToMany(Job_title::class, 'title_workers'); | 65 | return $this->belongsToMany(Job_title::class, 'title_workers'); |
66 | } | 66 | } |
67 | 67 | ||
68 | //Связь Работника с опытом работы (1 - 0-0) | 68 | //Связь Работника с опытом работы (1 - 0-0) |
69 | public function place_worker() { | 69 | public function place_worker() { |
70 | return $this->hasMany(place_works::class); | 70 | return $this->hasMany(place_works::class); |
71 | } | 71 | } |
72 | 72 | ||
73 | public function scopeActive($query) { | 73 | public function scopeActive($query) { |
74 | return $query->where('is_remove', '=', '0'); | 74 | return $query->where('is_remove', '=', '0'); |
75 | } | 75 | } |
76 | 76 | ||
77 | //Связь Работника с предыдущими компаниями | 77 | //Связь Работника с предыдущими компаниями |
78 | public function prev_company() { | 78 | public function prev_company() { |
79 | return $this->hasMany(PrevCompany::class); | 79 | return $this->hasMany(PrevCompany::class); |
80 | } | 80 | } |
81 | 81 | ||
82 | //Связь Работника с инфоблоками (0-0 - 0-0) | 82 | //Связь Работника с инфоблоками (0-0 - 0-0) |
83 | public function infobloks() { | 83 | public function infobloks() { |
84 | return $this->belongsToMany(infobloks::class,'dop_info', 'worker_id', 'infoblok_id'); | 84 | return $this->belongsToMany(infobloks::class,'dop_info', 'worker_id', 'infoblok_id'); |
85 | } | 85 | } |
86 | 86 | ||
87 | //Связи Работника с дополнительными | 87 | //Связи Работника с дополнительными |
88 | public function dop_info() { | 88 | public function dop_info() { |
89 | return $this->hasMany(Dop_info::class, 'worker_id'); | 89 | return $this->hasMany(Dop_info::class, 'worker_id'); |
90 | } | 90 | } |
91 | 91 | ||
92 | public function response() { | ||
93 | return $this->hasMany(ResponseWork::class); | ||
94 | } | ||
95 | |||
92 | } | 96 | } |
93 | 97 |
resources/views/employers/dialog.blade.php
1 | @extends('layout.frontend', ['title' => 'Диалог-переписка - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Диалог-переписка - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script> | 4 | <script> |
5 | console.log('Test system'); | 5 | console.log('Test system'); |
6 | $(document).on('change', '#send_btn', function() { | 6 | $(document).on('change', '#send_btn', function() { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var val_ = this_.val(); | 8 | var val_ = this_.val(); |
9 | console.log('sort items '+val_); | 9 | console.log('sort items '+val_); |
10 | 10 | ||
11 | $.ajax({ | 11 | $.ajax({ |
12 | type: "GET", | 12 | type: "GET", |
13 | url: "{{ route('shipping_companies') }}", | 13 | url: "{{ route('shipping_companies') }}", |
14 | data: "sort="+val_+"&block=1", | 14 | data: "sort="+val_+"&block=1", |
15 | success: function (data) { | 15 | success: function (data) { |
16 | console.log('Выбор сортировки'); | 16 | console.log('Выбор сортировки'); |
17 | console.log(data); | 17 | console.log(data); |
18 | $('#block_1').html(data); | 18 | $('#block_1').html(data); |
19 | }, | 19 | }, |
20 | headers: { | 20 | headers: { |
21 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 21 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
22 | }, | 22 | }, |
23 | error: function (data) { | 23 | error: function (data) { |
24 | data = JSON.stringify(data); | 24 | data = JSON.stringify(data); |
25 | console.log('Error: ' + data); | 25 | console.log('Error: ' + data); |
26 | } | 26 | } |
27 | }); | 27 | }); |
28 | 28 | ||
29 | $.ajax({ | 29 | $.ajax({ |
30 | type: "GET", | 30 | type: "GET", |
31 | url: "{{ route('shipping_companies') }}", | 31 | url: "{{ route('shipping_companies') }}", |
32 | data: "sort="+val_+"&block=2", | 32 | data: "sort="+val_+"&block=2", |
33 | success: function (data) { | 33 | success: function (data) { |
34 | console.log('Выбор сортировки2'); | 34 | console.log('Выбор сортировки2'); |
35 | console.log(data); | 35 | console.log(data); |
36 | history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | 36 | history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); |
37 | $('#block_2').html(data); | 37 | $('#block_2').html(data); |
38 | }, | 38 | }, |
39 | headers: { | 39 | headers: { |
40 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 40 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
41 | }, | 41 | }, |
42 | error: function (data) { | 42 | error: function (data) { |
43 | data = JSON.stringify(data); | 43 | data = JSON.stringify(data); |
44 | console.log('Error: ' + data); | 44 | console.log('Error: ' + data); |
45 | } | 45 | } |
46 | }); | 46 | }); |
47 | }); | 47 | }); |
48 | </script> | 48 | </script> |
49 | @endsection | 49 | @endsection |
50 | 50 | ||
51 | @section('content') | 51 | @section('content') |
52 | <section class="cabinet"> | 52 | <section class="cabinet"> |
53 | <div class="container"> | 53 | <div class="container"> |
54 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 54 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
55 | <li><a href="{{ route('index') }}">Главная</a></li> | 55 | <li><a href="{{ route('index') }}">Главная</a></li> |
56 | <li><b>Личный кабинет</b></li> | 56 | <li><b>Личный кабинет</b></li> |
57 | </ul> | 57 | </ul> |
58 | <div class="cabinet__wrapper"> | 58 | <div class="cabinet__wrapper"> |
59 | <div class="cabinet__side"> | 59 | <div class="cabinet__side"> |
60 | <div class="cabinet__side-toper"> | 60 | <div class="cabinet__side-toper"> |
61 | @include('employers.emblema') | 61 | @include('employers.emblema') |
62 | </div> | 62 | </div> |
63 | @include('employers.menu', ['item' => 5]) | 63 | @include('employers.menu', ['item' => 5]) |
64 | </div> | 64 | </div> |
65 | <div class="cabinet__body"> | 65 | <div class="cabinet__body"> |
66 | <div class="cabinet__body-item"> | 66 | <div class="cabinet__body-item"> |
67 | <h2 class="title cabinet__title">Сообщения</h2> | 67 | <h2 class="title cabinet__title">Сообщения</h2> |
68 | </div> | 68 | </div> |
69 | <div class="cabinet__body-item"> | 69 | <div class="cabinet__body-item"> |
70 | <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="back"> | 70 | <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="back"> |
71 | <svg> | 71 | <svg> |
72 | <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> | 72 | <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> |
73 | </svg> | 73 | </svg> |
74 | <span> | 74 | <span> |
75 | К списку чатов | 75 | К списку чатов |
76 | </span> | 76 | </span> |
77 | </a> | 77 | </a> |
78 | <div class="chatbox"> | 78 | <div class="chatbox"> |
79 | <div class="chatbox__toper"> | 79 | <div class="chatbox__toper"> |
80 | @if ($companion->is_worker) | 80 | @if ($companion->is_worker) |
81 | <div class="chatbox__toper-info messages__item-info"> | 81 | <div class="chatbox__toper-info messages__item-info"> |
82 | <div class="messages__item-photo"> | 82 | <div class="messages__item-photo"> |
83 | <svg> | 83 | <svg> |
84 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 84 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
85 | </svg> | 85 | </svg> |
86 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 86 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
87 | </div> | 87 | </div> |
88 | <div class="messages__item-text"> | 88 | <div class="messages__item-text"> |
89 | <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> | 89 | <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> |
90 | <div><span>Вакансия:</span> | 90 | <div><span>Вакансия:</span> |
91 | @if ($ad_employer == 0) | 91 | @if ($ad_employer == 0) |
92 | @if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }}@else Не указано @endif | 92 | @if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }}@else Не указано @endif |
93 | @else | 93 | @else |
94 | <a href="{{ route('vacancie', ['vacancy' => $ad_employer]) }}"> | 94 | <a href="{{ route('vacancie', ['vacancy' => $ad_employer]) }}"> |
95 | @if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} ({{ $ad_employer }}) @else Не указано @endif | 95 | @if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} ({{ $ad_employer }}) @else Не указано @endif |
96 | </a> | 96 | </a> |
97 | @endif | 97 | @endif |
98 | </div> | 98 | </div> |
99 | </div> | 99 | </div> |
100 | </div> | 100 | </div> |
101 | @if (isset($companion->worker->id)) | 101 | @if (isset($companion->worker->id)) |
102 | <a href="{{ route('resume_profile', ['worker' => $companion->worker->id]) }}" class="button chatbox__toper-button"> | 102 | <a href="{{ route('resume_profile', ['worker' => $companion->worker->id]) }}" class="button chatbox__toper-button"> |
103 | <svg> | 103 | <svg> |
104 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> | 104 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> |
105 | </svg> | 105 | </svg> |
106 | Перейти в резюме | 106 | Перейти в резюме |
107 | </a> | 107 | </a> |
108 | @endif | 108 | @endif |
109 | @else | 109 | @else |
110 | <div class="chatbox__toper-info messages__item-info"> | 110 | <div class="chatbox__toper-info messages__item-info"> |
111 | <div class="messages__item-photo"> | 111 | <div class="messages__item-photo"> |
112 | <svg> | 112 | <svg> |
113 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 113 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
114 | </svg> | 114 | </svg> |
115 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 115 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
116 | </div> | 116 | </div> |
117 | <div class="messages__item-text"> | 117 | <div class="messages__item-text"> |
118 | <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> | 118 | <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> |
119 | <div><span>Статус:</span> Работодатель или Администратор</div> | 119 | <div><span>Статус:</span> Работодатель или Администратор</div> |
120 | </div> | 120 | </div> |
121 | </div> | 121 | </div> |
122 | @if (isset($companion->employer->id)) | 122 | @if (isset($companion->employer->id)) |
123 | <a href="" class="button chatbox__toper-button"> | 123 | <a href="" class="button chatbox__toper-button"> |
124 | <svg> | 124 | <svg> |
125 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> | 125 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> |
126 | </svg> | 126 | </svg> |
127 | Перейти в резюме | 127 | Перейти в резюме |
128 | </a> | 128 | </a> |
129 | @endif | 129 | @endif |
130 | @endif | 130 | @endif |
131 | </div> | 131 | </div> |
132 | 132 | ||
133 | <div class="chatbox__list" id="dialogs" name="dialogs"> | 133 | <div class="chatbox__list" id="dialogs" name="dialogs"> |
134 | @if ($Messages->count()) | 134 | @if ($Messages->count()) |
135 | @foreach ($Messages as $it) | 135 | @foreach ($Messages as $it) |
136 | @if ($it->user_id == $companion->id) | 136 | @if ($it->user_id == $companion->id) |
137 | <div class="chatbox__item"> | 137 | <div class="chatbox__item"> |
138 | <div class="chatbox__item-photo"> | 138 | <div class="chatbox__item-photo"> |
139 | <svg> | 139 | <svg> |
140 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 140 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
141 | </svg> | 141 | </svg> |
142 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 142 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
143 | </div> | 143 | </div> |
144 | <div class="chatbox__item-body"> | 144 | <div class="chatbox__item-body"> |
145 | <div class="chatbox__item-text">{{ $it->text }}</div> | 145 | <div class="chatbox__item-text">{{ $it->text }}</div> |
146 | </div> | 146 | </div> |
147 | <div class="chatbox__item-time">{{ $it->created_at }}</div> | 147 | <div class="chatbox__item-time">{{ $it->created_at }}</div> |
148 | </div> | 148 | </div> |
149 | @else | 149 | @else |
150 | <div class="chatbox__item chatbox__item_reverse"> | 150 | <div class="chatbox__item chatbox__item_reverse"> |
151 | <div class="chatbox__item-photo"> | 151 | <div class="chatbox__item-photo"> |
152 | <svg> | 152 | <svg> |
153 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 153 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
154 | </svg> | 154 | </svg> |
155 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 155 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
156 | </div> | 156 | </div> |
157 | <div class="chatbox__item-body"> | 157 | <div class="chatbox__item-body"> |
158 | <div class="chatbox__item-text">{{ $it->text }}</div> | 158 | <div class="chatbox__item-text">{{ $it->text }}</div> |
159 | @if ((isset($it->file)) && (!empty($it->file))) | 159 | @if ((isset($it->file)) && (!empty($it->file))) |
160 | <a href="{{ asset(Storage::url($it->file)) }}" class="chatbox__item-text"> | 160 | <a href="{{ asset(Storage::url($it->file)) }}" class="chatbox__item-text"> |
161 | <svg> | 161 | <svg> |
162 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | 162 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> |
163 | </svg> | 163 | </svg> |
164 | </a> | 164 | </a> |
165 | @endif | 165 | @endif |
166 | </div> | 166 | </div> |
167 | <div class="chatbox__item-time">{{ $it->created_at }}</div> | 167 | <div class="chatbox__item-time">{{ $it->created_at }}</div> |
168 | </div> | 168 | </div> |
169 | @endif | 169 | @endif |
170 | 170 | ||
171 | @endforeach | 171 | @endforeach |
172 | @endif | 172 | @endif |
173 | </div> | 173 | </div> |
174 | <form action="{{ route('employer.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" > | 174 | <form action="{{ route('employer.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" > |
175 | @csrf | 175 | @csrf |
176 | <label class="chatbox__bottom-file"> | 176 | <label class="chatbox__bottom-file"> |
177 | <input id="file" name="file" type="file"> | 177 | <input id="file" name="file" type="file"> |
178 | <svg> | 178 | <svg> |
179 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | 179 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> |
180 | </svg> | 180 | </svg> |
181 | </label> | 181 | </label> |
182 | <input type="hidden" name="_token" value="{{ csrf_token() }}"/> | 182 | <input type="hidden" name="_token" value="{{ csrf_token() }}"/> |
183 | <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/> | 183 | <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/> |
184 | <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/> | 184 | <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/> |
185 | <input type="hidden" id="ad_employer_id" name="ad_employer_id" value="{{ $ad_employer }}"/> | ||
186 | <input type="hidden" id="ad_name" name="ad_name" value="@if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} @endif"/> | ||
185 | <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить"> | 187 | <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить"> |
186 | <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send"> | 188 | <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send"> |
187 | <svg> | 189 | <svg> |
188 | <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> | 190 | <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> |
189 | </svg> | 191 | </svg> |
190 | </button> | 192 | </button> |
191 | </form> | 193 | </form> |
192 | </div> | 194 | </div> |
193 | </div> | 195 | </div> |
194 | </div> | 196 | </div> |
195 | </div> | 197 | </div> |
196 | </div> | 198 | </div> |
197 | </section> | 199 | </section> |
198 | </div> | 200 | </div> |
199 | @endsection | 201 | @endsection |
200 | 202 |
resources/views/modals/send_worker_new.blade.php
1 | <script> | 1 | <script> |
2 | console.log('Сообщение работнику'); | 2 | console.log('Сообщение работнику'); |
3 | $("#form_worker" ).submit(function(event) { | 3 | $("#form_worker" ).submit(function(event) { |
4 | var val = $(this).val(); | 4 | var val = $(this).val(); |
5 | var send_title = $('#send_title'); | 5 | var send_title = $('#send_title'); |
6 | var send_title_val = send_title.val(); | 6 | var send_title_val = send_title.val(); |
7 | 7 | ||
8 | console.log('Click form.'); | 8 | console.log('Click form.'); |
9 | }); | 9 | }); |
10 | 10 | ||
11 | $(document).on('change', '#btn_send_file', function() { | 11 | $(document).on('change', '#btn_send_file', function() { |
12 | 12 | ||
13 | var send_name = $('#send_name'); | 13 | var send_name = $('#send_name'); |
14 | var send_name_val = send_name.val(); | 14 | var send_name_val = send_name.val(); |
15 | var send_name_file = $('#send_name_file'); | 15 | var send_name_file = $('#send_name_file'); |
16 | 16 | ||
17 | console.log(send_name_val); | 17 | console.log(send_name_val); |
18 | send_name_file.html(send_name_val); | 18 | send_name_file.html(send_name_val); |
19 | 19 | ||
20 | }); | 20 | }); |
21 | </script> | 21 | </script> |
22 | <div id="send" class="modal"> | 22 | <div id="send" class="modal"> |
23 | <div class="modal__body"> | 23 | <div class="modal__body"> |
24 | <div class="modal__title">Отправить сообщение работодателю</div> | 24 | <div class="modal__title">Отправить сообщение работодателю</div> |
25 | <div class="modal__text">Если вы готовы владеете компитентыми навыками, напишите данному работодателю письмо</div> | 25 | <div class="modal__text">Если вы готовы владеете компитентыми навыками, напишите данному работодателю письмо</div> |
26 | <form class="modal__form" id="form_worker" name="form_worker" enctype="multipart/form-data" action="{{ route('worker.new_message') }}" method="POST"> | 26 | <form class="modal__form" id="form_worker" name="form_worker" enctype="multipart/form-data" action="{{ route('worker.new_message') }}" method="POST"> |
27 | @csrf | 27 | @csrf |
28 | <div class="modal__form-item"> | 28 | <div class="modal__form-item"> |
29 | Отправитель сообщения: | 29 | Отправитель сообщения: |
30 | <input type="text" id="send_user_id" name="send_user_id" class="input" placeholder="user_id" value=""> | 30 | <input type="text" id="send_user_id" name="send_user_id" class="input" placeholder="user_id" value=""> |
31 | Получатель сообщения: | 31 | Получатель сообщения: |
32 | <input type="text" id="send_to_user_id" name="send_to_user_id" class="input" placeholder="to_user_id" value=""> | 32 | <input type="text" id="send_to_user_id" name="send_to_user_id" class="input" placeholder="to_user_id" value=""> |
33 | Вакансия: | 33 | Вакансия: |
34 | <input type="text" id="send_vacancy" name="send_vacancy" class="input" placeholder="vacancy" value=""> | 34 | <input type="text" id="send_vacancy" name="send_vacancy" class="input" placeholder="vacancy" value=""> |
35 | Должность: | ||
36 | <input type="text" id="send_job_title_id" name="send_job_title_id" class="input" placeholder="vacancy" value="0"> | ||
37 | |||
35 | </div> | 38 | </div> |
36 | <div class="modal__form-item send_title_div error_"> | 39 | <div class="modal__form-item send_title_div error_"> |
37 | <input id="send_title" name="send_title" type="text" class="input" placeholder="Тема" required> | 40 | <input id="send_title" name="send_title" type="text" class="input" placeholder="Тема" required> |
38 | <label for="title">Не заполнено поле</label> | 41 | <label for="title">Не заполнено поле</label> |
39 | </div> | 42 | </div> |
40 | <!--<div class="modal__form-item send_title_div error_"> | 43 | <!--<div class="modal__form-item send_title_div error_"> |
41 | <select class="js-select2" name="send_job_title_id" id="send_job_title_id"> | 44 | <select class="js-select2" name="send_job_title_id" id="send_job_title_id"> |
42 | if ($jobs->count()) | 45 | if ($jobs->count()) |
43 | foreach($jobs as $j) | 46 | foreach($jobs as $j) |
44 | <option value=" $j->id }}"> $j->name }} ( $j->id }})</option> | 47 | <option value=" $j->id }}"> $j->name }} ( $j->id }})</option> |
45 | endforeach | 48 | endforeach |
46 | endif | 49 | endif |
47 | </select> | 50 | </select> |
48 | <label for="title">Не заполнено поле</label> | 51 | <label for="title">Не заполнено поле</label> |
49 | </div>--> | 52 | </div>--> |
50 | <div class="modal__form-item send_text_div"> | 53 | <div class="modal__form-item send_text_div"> |
51 | <textarea id="i2" class="textarea" id="send_text" name="send_text" placeholder="Напишите текст с предложением о работе" required></textarea> | 54 | <textarea id="i2" class="textarea" id="send_text" name="send_text" placeholder="Напишите текст с предложением о работе" required></textarea> |
52 | <label for="i2">Не заполнено поле</label> | 55 | <label for="i2">Не заполнено поле</label> |
53 | </div> | 56 | </div> |
54 | <div class="modal__form-item"> | 57 | <div class="modal__form-item"> |
55 | <div class="file"> | 58 | <div class="file"> |
56 | <label class="file__input" id="btn_send_file" name="btn_send_file"> | 59 | <label class="file__input" id="btn_send_file" name="btn_send_file"> |
57 | <input type="file" name="send_file" id="send_name"> | 60 | <input type="file" name="send_file" id="send_name"> |
58 | <span class="button button_light"> | 61 | <span class="button button_light"> |
59 | <svg> | 62 | <svg> |
60 | <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use> | 63 | <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use> |
61 | </svg> | 64 | </svg> |
62 | Прикрепить файл-документ | 65 | Прикрепить файл-документ |
63 | </span> | 66 | </span> |
64 | </label> | 67 | </label> |
65 | 68 | ||
66 | <div class="file__list" id="div_file" name="div_file"> | 69 | <div class="file__list" id="div_file" name="div_file"> |
67 | <div class="file__list-item"> | 70 | <div class="file__list-item"> |
68 | <div class="file__list-item-left"> | 71 | <div class="file__list-item-left"> |
69 | <svg> | 72 | <svg> |
70 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | 73 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> |
71 | </svg> | 74 | </svg> |
72 | <span id="send_name_file" name="send_name_file"></span> | 75 | <span id="send_name_file" name="send_name_file"></span> |
73 | </div> | 76 | </div> |
74 | <button type="button" class="file__list-item-right js-parent-remove"> | 77 | <button type="button" class="file__list-item-right js-parent-remove"> |
75 | <svg> | 78 | <svg> |
76 | <use xlink:href="{{ asset('images/sprite.svg#cross-bold') }}"></use> | 79 | <use xlink:href="{{ asset('images/sprite.svg#cross-bold') }}"></use> |
77 | </svg> | 80 | </svg> |
78 | </button> | 81 | </button> |
79 | </div> | 82 | </div> |
80 | </div> | 83 | </div> |
81 | </div> | 84 | </div> |
82 | </div> | 85 | </div> |
83 | <div class="modal__form-item"> | 86 | <div class="modal__form-item"> |
84 | <button type="submit" id="submit_form_worker" name="submit_form_worker" class="button">Отправить</button> | 87 | <button type="submit" id="submit_form_worker" name="submit_form_worker" class="button">Отправить</button> |
85 | </div> | 88 | </div> |
86 | </form> | 89 | </form> |
87 | </div> | 90 | </div> |
88 | </div> | 91 | </div> |
89 | 92 | ||
90 | 93 |
resources/views/worker.blade.php
1 | @extends('layout.frontend', ['title' => 'Карточка соискателя - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Карточка соискателя - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script> | 4 | <script> |
5 | console.log('Test system'); | 5 | console.log('Test system'); |
6 | $(document).on('change', '#jobs', function() { | 6 | $(document).on('change', '#jobs', function() { |
7 | var val = $(this).val(); | 7 | var val = $(this).val(); |
8 | var main_oskar = $('#main_ockar'); | 8 | var main_oskar = $('#main_ockar'); |
9 | 9 | ||
10 | console.log('Code='+val); | 10 | console.log('Code='+val); |
11 | console.log('Click change...'); | 11 | console.log('Click change...'); |
12 | $.ajax({ | 12 | $.ajax({ |
13 | type: "GET", | 13 | type: "GET", |
14 | url: "", | 14 | url: "", |
15 | data: "job="+val, | 15 | data: "job="+val, |
16 | success: function (data) { | 16 | success: function (data) { |
17 | console.log('Выбор сделан!'); | 17 | console.log('Выбор сделан!'); |
18 | console.log(data); | 18 | console.log(data); |
19 | main_oskar.html(data); | 19 | main_oskar.html(data); |
20 | }, | 20 | }, |
21 | headers: { | 21 | headers: { |
22 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 22 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
23 | }, | 23 | }, |
24 | error: function (data) { | 24 | error: function (data) { |
25 | data = JSON.stringify(data); | 25 | data = JSON.stringify(data); |
26 | console.log('Error: ' + data); | 26 | console.log('Error: ' + data); |
27 | } | 27 | } |
28 | }); | 28 | }); |
29 | }); | 29 | }); |
30 | </script> | 30 | </script> |
31 | 31 | ||
32 | <script> | 32 | <script> |
33 | $(document).on('click', '.js_it_button', function() { | 33 | $(document).on('click', '.js_it_button', function() { |
34 | var this_ = $(this); | 34 | var this_ = $(this); |
35 | var code_user_id = this_.attr('data-uid'); | 35 | var code_user_id = this_.attr('data-uid'); |
36 | var code_to_user_id = this_.attr('data-tuid'); | 36 | var code_to_user_id = this_.attr('data-tuid'); |
37 | var code_vacancy = this_.attr('data-vacancy'); | 37 | var code_vacancy = this_.attr('data-vacancy'); |
38 | var user_id = $('#_user_id'); | 38 | var user_id = $('#_user_id'); |
39 | var to_user_id = $('#_to_user_id'); | 39 | var to_user_id = $('#_to_user_id'); |
40 | var vacancy = $('#_vacancy'); | 40 | var vacancy = $('#_vacancy'); |
41 | 41 | ||
42 | console.log('code_to_user_id='+code_to_user_id); | 42 | console.log('code_to_user_id='+code_to_user_id); |
43 | console.log('code_user_id='+code_user_id); | 43 | console.log('code_user_id='+code_user_id); |
44 | console.log('code_vacancy='+code_vacancy); | 44 | console.log('code_vacancy='+code_vacancy); |
45 | console.log('Клик на кнопке...'); | 45 | console.log('Клик на кнопке...'); |
46 | 46 | ||
47 | user_id.val(code_user_id); | 47 | user_id.val(code_user_id); |
48 | to_user_id.val(code_to_user_id); | 48 | to_user_id.val(code_to_user_id); |
49 | vacancy.val(code_vacancy); | 49 | vacancy.val(code_vacancy); |
50 | }); | 50 | }); |
51 | </script> | 51 | </script> |
52 | @include('js.favorite-worker') | 52 | @include('js.favorite-worker') |
53 | @endsection | 53 | @endsection |
54 | 54 | ||
55 | @section('content') | 55 | @section('content') |
56 | <section class="thing"> | 56 | <section class="thing"> |
57 | <div class="container"> | 57 | <div class="container"> |
58 | <ul class="breadcrumbs thing__breadcrumbs"> | 58 | <ul class="breadcrumbs thing__breadcrumbs"> |
59 | <li><a href="{{ route('index') }}">Главная</a></li> | 59 | <li><a href="{{ route('index') }}">Главная</a></li> |
60 | <li><a href="{{ route('bd_resume') }}">База резюме</a></li> | 60 | <li><a href="{{ route('bd_resume') }}">База резюме</a></li> |
61 | <li><b>@if (isset($Query[0]->users)) {{ $Query[0]->users->surname." ".$Query[0]->users->name_man." ".$Query[0]->users->surname2 }} @else Неизвестно @endif</b></li> | 61 | <li><b>@if (isset($Query[0]->users)) {{ $Query[0]->users->surname." ".$Query[0]->users->name_man." ".$Query[0]->users->surname2 }} @else Неизвестно @endif</b></li> |
62 | </ul> | 62 | </ul> |
63 | <div class="thing__profile"> | 63 | <div class="thing__profile"> |
64 | <img src="@if (isset($Query[0]->photo)) {{ asset(Storage::url($Query[0]->photo)) }} @else {{ asset('images/default_man.jpg') }} @endif" alt="" class="main__resume-base-body-item-photo"> | 64 | <img src="@if (isset($Query[0]->photo)) {{ asset(Storage::url($Query[0]->photo)) }} @else {{ asset('images/default_man.jpg') }} @endif" alt="" class="main__resume-base-body-item-photo"> |
65 | <div class="thing__profile-body"> | 65 | <div class="thing__profile-body"> |
66 | <h1 class="thing__title">@if (isset($Query[0]->users)) {{ $Query[0]->users->surname." ".$Query[0]->users->name_man." ".$Query[0]->users->surname2 }} @else Неизвестно @endif</h1> | 66 | <h1 class="thing__title">@if (isset($Query[0]->users)) {{ $Query[0]->users->surname." ".$Query[0]->users->name_man." ".$Query[0]->users->surname2 }} @else Неизвестно @endif</h1> |
67 | <p class="thing__text">Сложно сказать, почему ключевые особенности структуры проекта рассмотрены | 67 | <p class="thing__text">Сложно сказать, почему ключевые особенности структуры проекта рассмотрены |
68 | исключительно в разрезе маркетинговых и финансовых предпосылок.</p> | 68 | исключительно в разрезе маркетинговых и финансовых предпосылок.</p> |
69 | <div class="thing__bottom"> | 69 | <div class="thing__bottom"> |
70 | <a class="button" href="{{ route('resume_download', ['worker' => $Query[0]->id]) }}"> | 70 | <a class="button" href="{{ route('resume_download', ['worker' => $Query[0]->id]) }}"> |
71 | Скачать резюме | 71 | Скачать резюме |
72 | <svg> | 72 | <svg> |
73 | <use xlink:href="{{ asset('images/sprite.svg#download') }}"></use> | 73 | <use xlink:href="{{ asset('images/sprite.svg#download') }}"></use> |
74 | </svg> | 74 | </svg> |
75 | </a> | 75 | </a> |
76 | <button type="button" class="like js-toggle js_box_favorit {{ \App\Classes\LikesClass::get_status_worker($Query[0]) }}" data-val="{{ $Query[0]->id }}" id="elem{{ $Query[0]->id }}"> | 76 | <button type="button" class="like js-toggle js_box_favorit {{ \App\Classes\LikesClass::get_status_worker($Query[0]) }}" data-val="{{ $Query[0]->id }}" id="elem{{ $Query[0]->id }}"> |
77 | <svg> | 77 | <svg> |
78 | <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> | 78 | <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> |
79 | </svg> | 79 | </svg> |
80 | </button> | 80 | </button> |
81 | </div> | 81 | </div> |
82 | </div> | 82 | </div> |
83 | </div> | 83 | </div> |
84 | </div> | 84 | </div> |
85 | </section> | 85 | </section> |
86 | <main class="main"> | 86 | <main class="main"> |
87 | <div class="container"> | 87 | <div class="container"> |
88 | <div class="main__resume-profile"> | 88 | <div class="main__resume-profile"> |
89 | <div class="main__content"> | 89 | <div class="main__content"> |
90 | <div class="main__spoiler"> | 90 | <div class="main__spoiler"> |
91 | <button type="button" class="main__spoiler-toper js-toggle active"> | 91 | <button type="button" class="main__spoiler-toper js-toggle active"> |
92 | Основная информация</button> | 92 | Основная информация</button> |
93 | 93 | ||
94 | <div class="main__spoiler-body"> | 94 | <div class="main__spoiler-body"> |
95 | <table class="main__table"> | 95 | <table class="main__table"> |
96 | <tbody> | 96 | <tbody> |
97 | <tr> | 97 | <tr> |
98 | <td>Имя:</td> | 98 | <td>Имя:</td> |
99 | <td><b>{{ $Query[0]->users->name_man }}</b></td> | 99 | <td><b>{{ $Query[0]->users->name_man }}</b></td> |
100 | </tr> | 100 | </tr> |
101 | <tr> | 101 | <tr> |
102 | <td>Должность:</td> | 102 | <td>Должность:</td> |
103 | <td> | 103 | <td> |
104 | @if ($Query[0]->job_titles->count()) | 104 | @if ($Query[0]->job_titles->count()) |
105 | @foreach ($Query[0]->job_titles as $it) | 105 | @foreach ($Query[0]->job_titles as $it) |
106 | @if ($it->is_remove == 0) | 106 | @if ($it->is_remove == 0) |
107 | <b>{{ $it->name }}</b> | 107 | <b>{{ $it->name }}</b> |
108 | @endif | 108 | @endif |
109 | @endforeach | 109 | @endforeach |
110 | @endif | 110 | @endif |
111 | </td> | 111 | </td> |
112 | </tr> | 112 | </tr> |
113 | <tr> | 113 | <tr> |
114 | <td>Телефон:</td> | 114 | <td>Телефон:</td> |
115 | <td><b><a href="tel:{{ $Query[0]->telephone }}">{{ $Query[0]->telephone }}</a></b></td> | 115 | <td><b><a href="tel:{{ $Query[0]->telephone }}">{{ $Query[0]->telephone }}</a></b></td> |
116 | </tr> | 116 | </tr> |
117 | <tr> | 117 | <tr> |
118 | <td>E-mail:</td> | 118 | <td>E-mail:</td> |
119 | <td><b><a href="mailto:{{ $Query[0]->email }}">{{ $Query[0]->email }}</a></b></td> | 119 | <td><b><a href="mailto:{{ $Query[0]->email }}">{{ $Query[0]->email }}</a></b></td> |
120 | </tr> | 120 | </tr> |
121 | <tr> | 121 | <tr> |
122 | <td>Возраст:</td> | 122 | <td>Возраст:</td> |
123 | <td><b>{{ $Query[0]->old_year }}</b></td> | 123 | <td><b>{{ $Query[0]->old_year }}</b></td> |
124 | </tr> | 124 | </tr> |
125 | <tr> | 125 | <tr> |
126 | <td>Статус:</td> | 126 | <td>Статус:</td> |
127 | <td><b>{{ $status_work[$Query[0]->status_work] }}</b></td> | 127 | <td><b>{{ $status_work[$Query[0]->status_work] }}</b></td> |
128 | </tr> | 128 | </tr> |
129 | <tr> | 129 | <tr> |
130 | <td>Город проживания:</td> | 130 | <td>Город проживания:</td> |
131 | <td><b>{{ $Query[0]->city }}</b></td> | 131 | <td><b>{{ $Query[0]->city }}</b></td> |
132 | </tr> | 132 | </tr> |
133 | <tr> | 133 | <tr> |
134 | <td>Уровень английского:</td> | 134 | <td>Уровень английского:</td> |
135 | <td><b>{{ $Query[0]->en_is }}</b></td> | 135 | <td><b>{{ $Query[0]->en_is }}</b></td> |
136 | </tr> | 136 | </tr> |
137 | <tr> | 137 | <tr> |
138 | <td>Опыт работы:</td> | 138 | <td>Опыт работы:</td> |
139 | <td><b>{{ $Query[0]->experience }}</b></td> | 139 | <td><b>{{ $Query[0]->experience }}</b></td> |
140 | </tr> | 140 | </tr> |
141 | </tbody> | 141 | </tbody> |
142 | </table> | 142 | </table> |
143 | </div> | 143 | </div> |
144 | </div> | 144 | </div> |
145 | <div class="main__spoiler"> | 145 | <div class="main__spoiler"> |
146 | <button type="button" class="main__spoiler-toper js-toggle">Сертификаты / документы</button> | 146 | <button type="button" class="main__spoiler-toper js-toggle">Сертификаты / документы</button> |
147 | <div class="main__spoiler-body"> | 147 | <div class="main__spoiler-body"> |
148 | 148 | ||
149 | @if (isset($Query[0]->sertificate)) | 149 | @if (isset($Query[0]->sertificate)) |
150 | @if ($Query[0]->sertificate->count()) | 150 | @if ($Query[0]->sertificate->count()) |
151 | @foreach($Query[0]->sertificate as $it) | 151 | @foreach($Query[0]->sertificate as $it) |
152 | <table class="main__table"> | 152 | <table class="main__table"> |
153 | <tbody> | 153 | <tbody> |
154 | <tr> | 154 | <tr> |
155 | <td>Название сертификата:</td> | 155 | <td>Название сертификата:</td> |
156 | <td><b>{{ $it->name }}</b></td> | 156 | <td><b>{{ $it->name }}</b></td> |
157 | </tr> | 157 | </tr> |
158 | <tr> | 158 | <tr> |
159 | <td>Организация выдавшая документ:</td> | 159 | <td>Организация выдавшая документ:</td> |
160 | <td><b>{{ $it->education }}</b></td> | 160 | <td><b>{{ $it->education }}</b></td> |
161 | </tr> | 161 | </tr> |
162 | <tr> | 162 | <tr> |
163 | <td>Дата начала обучения:</td> | 163 | <td>Дата начала обучения:</td> |
164 | <td><b>{{ $it->date_begin }}</b></td> | 164 | <td><b>{{ $it->date_begin }}</b></td> |
165 | </tr> | 165 | </tr> |
166 | <tr> | 166 | <tr> |
167 | <td>Дата конца обучения:</td> | 167 | <td>Дата конца обучения:</td> |
168 | <td><b>{{ $it->end_begin }}</b></td> | 168 | <td><b>{{ $it->end_begin }}</b></td> |
169 | </tr> | 169 | </tr> |
170 | </tbody> | 170 | </tbody> |
171 | </table> | 171 | </table> |
172 | <br> | 172 | <br> |
173 | @endforeach | 173 | @endforeach |
174 | @endif | 174 | @endif |
175 | @endif | 175 | @endif |
176 | </div> | 176 | </div> |
177 | </div> | 177 | </div> |
178 | 178 | ||
179 | <div class="main__spoiler"> | 179 | <div class="main__spoiler"> |
180 | <button type="button" class="main__spoiler-toper js-toggle">Опыт работы</button> | 180 | <button type="button" class="main__spoiler-toper js-toggle">Опыт работы</button> |
181 | <div class="main__spoiler-body"> | 181 | <div class="main__spoiler-body"> |
182 | 182 | ||
183 | @if (isset($Query[0]->place_worker)) | 183 | @if (isset($Query[0]->place_worker)) |
184 | @if ($Query[0]->place_worker->count()) | 184 | @if ($Query[0]->place_worker->count()) |
185 | @foreach($Query[0]->place_worker as $it) | 185 | @foreach($Query[0]->place_worker as $it) |
186 | 186 | ||
187 | <table class="main__table"> | 187 | <table class="main__table"> |
188 | <tbody> | 188 | <tbody> |
189 | <tr> | 189 | <tr> |
190 | <td>Должность:</td> | 190 | <td>Должность:</td> |
191 | <td><b>{{ $it->job_title }}</b></td> | 191 | <td><b>{{ $it->job_title }}</b></td> |
192 | </tr> | 192 | </tr> |
193 | <tr> | 193 | <tr> |
194 | <td>Опыт работы в танкерном флоте:</td> | 194 | <td>Опыт работы в танкерном флоте:</td> |
195 | <td><b>@if($it->tanker==1) Есть @else Нет @endif</b></td> | 195 | <td><b>@if($it->tanker==1) Есть @else Нет @endif</b></td> |
196 | </tr> | 196 | </tr> |
197 | <tr> | 197 | <tr> |
198 | <td>Дата начала работы:</td> | 198 | <td>Дата начала работы:</td> |
199 | <td><b>{{ $it->begin_work }}</b></td> | 199 | <td><b>{{ $it->begin_work }}</b></td> |
200 | </tr> | 200 | </tr> |
201 | <tr> | 201 | <tr> |
202 | <td>Дата конца работы:</td> | 202 | <td>Дата конца работы:</td> |
203 | <td><b>{{ $it->end_work }}</b></td> | 203 | <td><b>{{ $it->end_work }}</b></td> |
204 | </tr> | 204 | </tr> |
205 | <tr> | 205 | <tr> |
206 | <td>Название компании:</td> | 206 | <td>Название компании:</td> |
207 | <td><b>{{ $it->name_company }}</b></td> | 207 | <td><b>{{ $it->name_company }}</b></td> |
208 | </tr> | 208 | </tr> |
209 | <tr> | 209 | <tr> |
210 | <td>GWT тип</td> | 210 | <td>GWT тип</td> |
211 | <td><b>{{ $it->GWT }}</b></td> | 211 | <td><b>{{ $it->GWT }}</b></td> |
212 | </tr> | 212 | </tr> |
213 | <tr> | 213 | <tr> |
214 | <td>ГД:</td> | 214 | <td>ГД:</td> |
215 | <td><b>{{ $it->KBT }}</b></td> | 215 | <td><b>{{ $it->KBT }}</b></td> |
216 | </tr> | 216 | </tr> |
217 | </tbody> | 217 | </tbody> |
218 | </table> | 218 | </table> |
219 | <br> | 219 | <br> |
220 | @endforeach | 220 | @endforeach |
221 | @endif | 221 | @endif |
222 | @endif | 222 | @endif |
223 | </div> | 223 | </div> |
224 | </div> | 224 | </div> |
225 | 225 | ||
226 | <div class="main__spoiler"> | 226 | <div class="main__spoiler"> |
227 | <button type="button" class="main__spoiler-toper js-toggle">Дополнительные документы</button> | 227 | <button type="button" class="main__spoiler-toper js-toggle">Дополнительные документы</button> |
228 | <div class="main__spoiler-body"> | 228 | <div class="main__spoiler-body"> |
229 | 229 | ||
230 | @if (isset($Query[0]->infobloks)) | 230 | @if (isset($Query[0]->infobloks)) |
231 | @if ($Query[0]->infobloks->count()) | 231 | @if ($Query[0]->infobloks->count()) |
232 | <table class="main__table"> | 232 | <table class="main__table"> |
233 | <tbody> | 233 | <tbody> |
234 | @foreach($Query[0]->infobloks as $it) | 234 | @foreach($Query[0]->infobloks as $it) |
235 | <tr> | 235 | <tr> |
236 | <td>Документ:</td> | 236 | <td>Документ:</td> |
237 | <td><b>{{ $it->name }}</b></td> | 237 | <td><b>{{ $it->name }}</b></td> |
238 | <td> | 238 | <td> |
239 | @if ($it->model_dop_info[0]->status == 0) Не указано | 239 | @if ($it->model_dop_info[0]->status == 0) Не указано |
240 | @elseif($it->model_dop_info[0]->status==1) В наличии | 240 | @elseif($it->model_dop_info[0]->status==1) В наличии |
241 | @else Отсутствует | 241 | @else Отсутствует |
242 | @endif | 242 | @endif |
243 | </td> | 243 | </td> |
244 | </tr> | 244 | </tr> |
245 | @endforeach | 245 | @endforeach |
246 | </tbody> | 246 | </tbody> |
247 | </table> | 247 | </table> |
248 | @endif | 248 | @endif |
249 | @endif | 249 | @endif |
250 | </div> | 250 | </div> |
251 | </div> | 251 | </div> |
252 | </div> | 252 | </div> |
253 | 253 | ||
254 | <div class="main__resume-profile-about"> | 254 | <div class="main__resume-profile-about"> |
255 | <h2 class="main__resume-profile-about-title">О себе</h2> | 255 | <h2 class="main__resume-profile-about-title">О себе</h2> |
256 | <p class="main__resume-profile-about-text">{{ $Query[0]->text }}</p> | 256 | <p class="main__resume-profile-about-text">{{ $Query[0]->text }}</p> |
257 | @if (App\Classes\StatusUser::Status()==0) | 257 | @if (App\Classes\StatusUser::Status()==0) |
258 | @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_message)) | 258 | @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_message)) |
259 | <div class="button main__resume-profile-about-button js_it_button" data-fancybox data-src="#send2" data-vacancy="0" data-uid="{{ $idiot }}" data-tuid="{{ $Query[0]->users->id }}" data-options='{"touch":false,"autoFocus":false}'>Написать сообщение</div> | 259 | <div class="button main__resume-profile-about-button js_it_button" data-fancybox data-src="#send2" data-vacancy="0" data-uid="{{ $idiot }}" data-tuid="{{ $Query[0]->users->id }}" data-options='{"touch":false,"autoFocus":false}'>Написать сообщение</div> |
260 | @endif | 260 | @endif |
261 | @endif | 261 | @endif |
262 | </div> | 262 | </div> |
263 | <div class="main__resume-profile-info"> | 263 | <div class="main__resume-profile-info"> |
264 | <h2 class="main__resume-profile-info-title">Данные о прошлых компаниях</h2> | 264 | <h2 class="main__resume-profile-info-title">Данные о прошлых компаниях</h2> |
265 | <div class="main__resume-profile-info-body"> | 265 | <div class="main__resume-profile-info-body"> |
266 | @if ((isset($Query[0]->prev_company)) && ($Query[0]->prev_company->count())) | 266 | @if ((isset($Query[0]->prev_company)) && ($Query[0]->prev_company->count())) |
267 | @foreach ($Query[0]->prev_company as $it) | 267 | @foreach ($Query[0]->prev_company as $it) |
268 | <div class="main__resume-profile-info-body-item"> | 268 | <div class="main__resume-profile-info-body-item"> |
269 | <h3 class="main__resume-profile-info-body-subtitle">{{ $it->name_company }}</h3> | 269 | <h3 class="main__resume-profile-info-body-subtitle">{{ $it->name_company }}</h3> |
270 | <ul class="main__resume-profile-info-body-inner"> | 270 | <ul class="main__resume-profile-info-body-inner"> |
271 | <li> | 271 | <li> |
272 | <b>Руководитель</b> | 272 | <b>Руководитель</b> |
273 | <span>{{ $it->direct }}</span> | 273 | <span>{{ $it->direct }}</span> |
274 | </li> | 274 | </li> |
275 | <li> | 275 | <li> |
276 | <b>Телефон того, кто может дать рекомендацию</b> | 276 | <b>Телефон того, кто может дать рекомендацию</b> |
277 | <span> | 277 | <span> |
278 | @if (!empty($it->telephone)) | 278 | @if (!empty($it->telephone)) |
279 | <a href="tel:{{$it->telephone }}">{{ $it->telephone }}</a> | 279 | <a href="tel:{{$it->telephone }}">{{ $it->telephone }}</a> |
280 | @endif | 280 | @endif |
281 | @if (!empty($it->telephone2)) | 281 | @if (!empty($it->telephone2)) |
282 | <a href="tel:{{$it->telephone2 }}">{{ $it->telephone2 }}</a> | 282 | <a href="tel:{{$it->telephone2 }}">{{ $it->telephone2 }}</a> |
283 | @endif | 283 | @endif |
284 | </span> | 284 | </span> |
285 | </li> | 285 | </li> |
286 | </ul> | 286 | </ul> |
287 | </div> | 287 | </div> |
288 | @endforeach | 288 | @endforeach |
289 | @else | 289 | @else |
290 | <div class="main__resume-profile-info-body-item"> | 290 | <div class="main__resume-profile-info-body-item"> |
291 | <h3 class="main__resume-profile-info-body-subtitle">Нету данных о компании</h3> | 291 | <h3 class="main__resume-profile-info-body-subtitle">Нету данных о компании</h3> |
292 | </div> | 292 | </div> |
293 | @endif | 293 | @endif |
294 | </div> | 294 | </div> |
295 | </div> | 295 | </div> |
296 | 296 | ||
297 | <div class="main__resume-profile-info"> | ||
298 | <h2 class="main__resume-profile-info-title">Количество просмотров страницы: ({{ $stat[0]->lookin }})</h2> | ||
299 | </div> | ||
300 | |||
301 | <div class="main__resume-profile-info"> | ||
302 | <h2 class="main__resume-profile-info-title">Отзывы о работнике ({{ $Query[0]->response->count() }})</h2> | ||
303 | <div class="main__resume-profile-info-body"> | ||
304 | @if ((isset($Query[0]->response)) && ($Query[0]->response->count())) | ||
305 | <div class="main__resume-profile-info-body-item"> | ||
306 | <ul class="main__resume-profile-info-body-inner"> | ||
307 | @php $i = 1; @endphp | ||
308 | @foreach($Query[0]->response as $it) | ||
309 | <li> | ||
310 | <span><h3>Комментарий №{{$i}}</h3></span> | ||
311 | <span><b>Оценка человека: {{ $it->stars }}</b></span> | ||
312 | <span><b>Сообщение: </b>{{ $it->message }}</span> | ||
313 | </li> | ||
314 | @php $i++; @endphp | ||
315 | @endforeach | ||
316 | </ul> | ||
317 | </div> | ||
318 | @else | ||
319 | <div class="main__resume-profile-info-body-item"> | ||
320 | <h3 class="main__resume-profile-info-body-subtitle">Нету комментариев</h3> | ||
321 | </div> | ||
322 | @endif | ||
323 | </div> | ||
324 | </div> | ||
325 | |||
297 | <div class="main__resume-profile-review"> | 326 | <div class="main__resume-profile-review"> |
298 | <form action="{{ route('stars_answer') }}" method="POST"> | 327 | <form action="{{ route('stars_answer') }}" method="POST"> |
299 | @csrf | 328 | @csrf |
300 | <h2 class="main__resume-profile-review-title">Оставить отзыв о работнике</h2> | 329 | <h2 class="main__resume-profile-review-title">Оставить отзыв о работнике</h2> |
301 | <div class="rate"> | 330 | <div class="rate"> |
302 | <div class="rate__label">Ваша оценка:</div> | 331 | <div class="rate__label">Ваша оценка:</div> |
303 | <div class="rate__stars"> | 332 | <div class="rate__stars"> |
304 | <select name="stars" id="stars" class="star-rating js-stars"> | 333 | <select name="stars" id="stars" class="star-rating js-stars"> |
305 | <option value="5">5</option> | 334 | <option value="5">5</option> |
306 | <option value="4">4</option> | 335 | <option value="4">4</option> |
307 | <option value="3">3</option> | 336 | <option value="3">3</option> |
308 | <option value="2">2</option> | 337 | <option value="2">2</option> |
309 | <option value="1" selected>1</option> | 338 | <option value="1" selected>1</option> |
310 | </select> | 339 | </select> |
311 | </div> | 340 | </div> |
312 | </div> | 341 | </div> |
313 | <input type="hidden" name="worker_id" id="worker_id" value="{{ $Query[0]->id }}"/> | 342 | <input type="hidden" name="worker_id" id="worker_id" value="{{ $Query[0]->id }}"/> |
314 | <div class="main__resume-profile-review-body"> | 343 | <div class="main__resume-profile-review-body"> |
315 | <h3>Ваш отзыв</h3> | 344 | <h3>Ваш отзыв</h3> |
316 | <textarea class="textarea" name="message" id="message" placeholder="Текст отзыва…" required></textarea> | 345 | <textarea class="textarea" name="message" id="message" placeholder="Текст отзыва…" required></textarea> |
317 | <button type="submit" class="button">Оставить отзыв</button> | 346 | <button type="submit" class="button">Оставить отзыв</button> |
318 | </div> | 347 | </div> |
319 | </form> | 348 | </form> |
320 | </div> | 349 | </div> |
321 | </div> | 350 | </div> |
322 | </div> | 351 | </div> |
323 | </main> | 352 | </main> |
324 | </div> | 353 | </div> |
325 | @endsection | 354 | @endsection |
326 | 355 |
resources/views/workers/cabinet.blade.php
1 | @extends('layout.frontend', ['title' => 'Моя анкета - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Моя анкета - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script> | 4 | <script> |
5 | console.log('Test system'); | 5 | console.log('Test system'); |
6 | $(document).on('click', '#button_new_doc123', function() { | 6 | $(document).on('click', '#button_new_doc123', function() { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var val_ = this_.attr('data-val'); | 8 | var val_ = this_.attr('data-val'); |
9 | var new_diplom = $('#new_diplom'); | 9 | var new_diplom = $('#new_diplom'); |
10 | var new_diplom_val = new_diplom.val(); | 10 | var new_diplom_val = new_diplom.val(); |
11 | var new_data_begin = $('#new_data_begin'); | 11 | var new_data_begin = $('#new_data_begin'); |
12 | var new_data_begin_val = new_data_begin.val(); | 12 | var new_data_begin_val = new_data_begin.val(); |
13 | var new_data_end = $('#new_data_end'); | 13 | var new_data_end = $('#new_data_end'); |
14 | var new_data_end_val = new_data_end.val(); | 14 | var new_data_end_val = new_data_end.val(); |
15 | var education = $('#education'); | 15 | var education = $('#education'); |
16 | var education_val = education.val(); | 16 | var education_val = education.val(); |
17 | var worker_id = $('#new_id'); | 17 | var worker_id = $('#new_id'); |
18 | var worker_val = worker_id.val(); | 18 | var worker_val = worker_id.val(); |
19 | 19 | ||
20 | console.log('sort items ' + val_); | 20 | console.log('sort items ' + val_); |
21 | 21 | ||
22 | if (new_diplom_val == '') { | 22 | if (new_diplom_val == '') { |
23 | new_diplom.addClass('err_red'); | 23 | new_diplom.addClass('err_red'); |
24 | console.log('Border Up'); | 24 | console.log('Border Up'); |
25 | } else { | 25 | } else { |
26 | $.ajax({ | 26 | $.ajax({ |
27 | type: "GET", | 27 | type: "GET", |
28 | url: "{{ route('worker.add_serificate') }}", | 28 | url: "{{ route('worker.add_serificate') }}", |
29 | data: "worker_id="+worker_val+"&date_begin="+new_data_begin_val + "&end_begin=" + new_data_end_val + "&name=" + new_diplom_val + "&education="+education_val, | 29 | data: "worker_id="+worker_val+"&date_begin="+new_data_begin_val + "&end_begin=" + new_data_end_val + "&name=" + new_diplom_val + "&education="+education_val, |
30 | success: function (data) { | 30 | success: function (data) { |
31 | console.log('Блокировка...'); | 31 | console.log('Блокировка...'); |
32 | console.log(data); | 32 | console.log(data); |
33 | $('#sertificate').html(data); | 33 | $('#sertificate').html(data); |
34 | if (new_diplom.hasClass('err_red')) new_diplom.removeClass('err_red'); | 34 | if (new_diplom.hasClass('err_red')) new_diplom.removeClass('err_red'); |
35 | }, | 35 | }, |
36 | headers: { | 36 | headers: { |
37 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 37 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
38 | }, | 38 | }, |
39 | error: function (data) { | 39 | error: function (data) { |
40 | data = JSON.stringify(data); | 40 | data = JSON.stringify(data); |
41 | console.log('Error: ' + data); | 41 | console.log('Error: ' + data); |
42 | } | 42 | } |
43 | }); | 43 | }); |
44 | } | 44 | } |
45 | }); | 45 | }); |
46 | 46 | ||
47 | $(document).on('click', '#btn_new_diplom123', function() { | 47 | $(document).on('click', '#btn_new_diplom123', function() { |
48 | var this_ = $(this); | 48 | var this_ = $(this); |
49 | var val_ = this_.attr('data-val'); | 49 | var val_ = this_.attr('data-val'); |
50 | var documents = $('#documents'); | 50 | var documents = $('#documents'); |
51 | var doc_val = documents.val(); | 51 | var doc_val = documents.val(); |
52 | var block = $('#ajax_dop_diplomi'); | 52 | var block = $('#ajax_dop_diplomi'); |
53 | 53 | ||
54 | console.log('worker_id='+val_+'it_infoblock='+ doc_val); | 54 | console.log('worker_id='+val_+'it_infoblock='+ doc_val); |
55 | 55 | ||
56 | $.ajax({ | 56 | $.ajax({ |
57 | type: "GET", | 57 | type: "GET", |
58 | url: "", | 58 | url: "", |
59 | data: "worker_id="+val_+"&infoblok_id="+doc_val, | 59 | data: "worker_id="+val_+"&infoblok_id="+doc_val, |
60 | success: function (data) { | 60 | success: function (data) { |
61 | location.url = data; | 61 | location.url = data; |
62 | console.log('Добавление документа-диплома'); | 62 | console.log('Добавление документа-диплома'); |
63 | console.log(data); | 63 | console.log(data); |
64 | block.html(data); | 64 | block.html(data); |
65 | }, | 65 | }, |
66 | headers: { | 66 | headers: { |
67 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 67 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
68 | }, | 68 | }, |
69 | error: function (data) { | 69 | error: function (data) { |
70 | data = JSON.stringify(data); | 70 | data = JSON.stringify(data); |
71 | console.log('Error: ' + data); | 71 | console.log('Error: ' + data); |
72 | } | 72 | } |
73 | }); | 73 | }); |
74 | }); | 74 | }); |
75 | 75 | ||
76 | $(document).on('click', '#new_work', function() { | 76 | $(document).on('click', '#new_work', function() { |
77 | var this_ = $(this); | 77 | var this_ = $(this); |
78 | var val_ = this_.attr('data-val'); | 78 | var val_ = this_.attr('data-val'); |
79 | var new_diplom = $('#new_diplom').val(); | 79 | var new_diplom = $('#new_diplom').val(); |
80 | var new_data_begin = $('#new_data_begin').val(); | 80 | var new_data_begin = $('#new_data_begin').val(); |
81 | var new_data_end = $('#new_data_end').val(); | 81 | var new_data_end = $('#new_data_end').val(); |
82 | var new_job_title = $('#new_job_title').val(); | 82 | var new_job_title = $('#new_job_title').val(); |
83 | var new_teplohod = $('#new_teplohod').val(); | 83 | var new_teplohod = $('#new_teplohod').val(); |
84 | var new_GWT = $('#new_GWT').val(); | 84 | var new_GWT = $('#new_GWT').val(); |
85 | var new_KBT = $('#new_KBT').val(); | 85 | var new_KBT = $('#new_KBT').val(); |
86 | var new_Begin_work = $('#new_Begin_work').val(); | 86 | var new_Begin_work = $('#new_Begin_work').val(); |
87 | var new_End_work = $('#new_End_work').val(); | 87 | var new_End_work = $('#new_End_work').val(); |
88 | var new_name_company = $('#new_name_company').val(); | 88 | var new_name_company = $('#new_name_company').val(); |
89 | 89 | ||
90 | console.log('worker_id='+val_+'it_infoblock='+ doc_val); | 90 | console.log('worker_id='+val_+'it_infoblock='+ doc_val); |
91 | 91 | ||
92 | $.ajax({ | 92 | $.ajax({ |
93 | type: "GET", | 93 | type: "GET", |
94 | url: "", | 94 | url: "", |
95 | data: "worker_id="+val_+"&infoblok_id="+doc_val, | 95 | data: "worker_id="+val_+"&infoblok_id="+doc_val, |
96 | success: function (data) { | 96 | success: function (data) { |
97 | location.url = data; | 97 | location.url = data; |
98 | console.log('Добавление документа-диплома'); | 98 | console.log('Добавление документа-диплома'); |
99 | console.log(data); | 99 | console.log(data); |
100 | block.html(data); | 100 | block.html(data); |
101 | }, | 101 | }, |
102 | headers: { | 102 | headers: { |
103 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 103 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
104 | }, | 104 | }, |
105 | error: function (data) { | 105 | error: function (data) { |
106 | data = JSON.stringify(data); | 106 | data = JSON.stringify(data); |
107 | console.log('Error: ' + data); | 107 | console.log('Error: ' + data); |
108 | } | 108 | } |
109 | }); | 109 | }); |
110 | }); | 110 | }); |
111 | 111 | ||
112 | $(document).on('click', '#old_year', function() { | 112 | $(document).on('click', '#old_year', function() { |
113 | var this_ = $(this); | 113 | var this_ = $(this); |
114 | var val = this_.val(); | 114 | var val = this_.val(); |
115 | 115 | ||
116 | if (val < 0) | 116 | if (val < 0) |
117 | $('#old_year').val(0); | 117 | $('#old_year').val(0); |
118 | 118 | ||
119 | console.log('Возраст не может выполнить такую операцию'); | 119 | console.log('Возраст не может выполнить такую операцию'); |
120 | }); | 120 | }); |
121 | 121 | ||
122 | $(document).on('change', '.sertificates_js', function() { | 122 | $(document).on('change', '.sertificates_js', function() { |
123 | var this_ = $(this); | 123 | var this_ = $(this); |
124 | var infoblock_id = this_.attr('data-info'); | 124 | var infoblock_id = this_.attr('data-info'); |
125 | var val = this_.val(); | 125 | var val = this_.val(); |
126 | var block = $('#block_sertificate'); | 126 | var block = $('#block_sertificate'); |
127 | 127 | ||
128 | console.log('infoblok='+infoblock_id); | 128 | console.log('infoblok='+infoblock_id); |
129 | console.log('val='+val); | 129 | console.log('val='+val); |
130 | 130 | ||
131 | $.ajax({ | 131 | $.ajax({ |
132 | type: "GET", | 132 | type: "GET", |
133 | url: "{{ route('worker.delete_add_diplom', ['worker' => $Worker[0]->id]) }}", | 133 | url: "{{ route('worker.delete_add_diplom', ['worker' => $Worker[0]->id]) }}", |
134 | data: "&infoblok_id=" + infoblock_id+"&val="+val, | 134 | data: "&infoblok_id=" + infoblock_id+"&val="+val, |
135 | success: function (data) { | 135 | success: function (data) { |
136 | location.url = data; | 136 | location.url = data; |
137 | console.log('Удаление левых документов + добавление реальных документов'); | 137 | console.log('Удаление левых документов + добавление реальных документов'); |
138 | 138 | ||
139 | console.log('Info 100% +'+ data); | 139 | console.log('Info 100% +'+ data); |
140 | //window.location.href = data; | 140 | //window.location.href = data; |
141 | //block.html(data); | 141 | //block.html(data); |
142 | }, | 142 | }, |
143 | headers: { | 143 | headers: { |
144 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 144 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
145 | }, | 145 | }, |
146 | error: function (data) { | 146 | error: function (data) { |
147 | data = JSON.stringify(data); | 147 | data = JSON.stringify(data); |
148 | console.log('Error: ' + data); | 148 | console.log('Error: ' + data); |
149 | } | 149 | } |
150 | }); | 150 | }); |
151 | 151 | ||
152 | }); | 152 | }); |
153 | 153 | ||
154 | </script> | 154 | </script> |
155 | @endsection | 155 | @endsection |
156 | 156 | ||
157 | @section('content') | 157 | @section('content') |
158 | <section class="cabinet"> | 158 | <section class="cabinet"> |
159 | <div class="container"> | 159 | <div class="container"> |
160 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 160 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
161 | <li><a href="{{ route('index') }}">Главная</a></li> | 161 | <li><a href="{{ route('index') }}">Главная</a></li> |
162 | <li><b>Личный кабинет</b></li> | 162 | <li><b>Личный кабинет</b></li> |
163 | </ul> | 163 | </ul> |
164 | <div class="cabinet__wrapper"> | 164 | <div class="cabinet__wrapper"> |
165 | <div class="cabinet__side"> | 165 | <div class="cabinet__side"> |
166 | <div class="cabinet__side-toper"> | 166 | <div class="cabinet__side-toper"> |
167 | @include('workers.emblema') | 167 | @include('workers.emblema') |
168 | 168 | ||
169 | </div> | 169 | </div> |
170 | 170 | ||
171 | @include('workers.menu', ['item' => 1]) | 171 | @include('workers.menu', ['item' => 1]) |
172 | </div> | 172 | </div> |
173 | <form class="cabinet__body" action="{{ route('worker.cabinet_save', ['worker' => $Worker[0]->id]) }}" enctype="multipart/form-data" method="POST"> | 173 | <form class="cabinet__body" action="{{ route('worker.cabinet_save', ['worker' => $Worker[0]->id]) }}" enctype="multipart/form-data" method="POST"> |
174 | @csrf | 174 | @csrf |
175 | @include('messages_error') | 175 | @include('messages_error') |
176 | <div class="cabinet__body-item"> | 176 | <div class="cabinet__body-item"> |
177 | <div class="cabinet__anketa"> | 177 | <div class="cabinet__anketa"> |
178 | <h2 class="title cabinet__title">Моя анкета</h2> | 178 | <h2 class="title cabinet__title">Моя анкета</h2> |
179 | <div class="cabinet__anketa-buttons"> | 179 | <div class="cabinet__anketa-buttons"> |
180 | <a href="{{ route('worker.up', ['worker' => $Worker[0]->id]) }}" class="button">Поднять резюме</a> | 180 | <a href="{{ route('worker.up', ['worker' => $Worker[0]->id]) }}" class="button">Поднять резюме</a> |
181 | <a href="{{ route('resume_download', ['worker' => $Worker[0]->id]) }}" target="_blank" class="button"> | 181 | <a href="{{ route('resume_download', ['worker' => $Worker[0]->id]) }}" target="_blank" class="button"> |
182 | <svg> | 182 | <svg> |
183 | <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use> | 183 | <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use> |
184 | </svg> | 184 | </svg> |
185 | Скачать резюме | 185 | Скачать резюме |
186 | </a> | 186 | </a> |
187 | </div> | 187 | </div> |
188 | </div> | 188 | </div> |
189 | </div> | 189 | </div> |
190 | <div class="cabinet__body-item"> | 190 | <div class="cabinet__body-item"> |
191 | <div class="cabinet__stats"> | 191 | <div class="cabinet__stats"> |
192 | <h3 class="cabinet__subtitle cabinet__stats-title">Статистика</h3> | 192 | <h3 class="cabinet__subtitle cabinet__stats-title">Статистика</h3> |
193 | <div class="cabinet__stats-body"> | 193 | <div class="cabinet__stats-body"> |
194 | <div class="cabinet__stats-item"> | 194 | <div class="cabinet__stats-item"> |
195 | <svg> | 195 | <svg> |
196 | <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> | 196 | <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> |
197 | </svg> | 197 | </svg> |
198 | <span>Просмотров:</span> | 198 | <span>Просмотров:</span> |
199 | <b>@if (isset($stat[0]->lookin)) {{ $stat[0]->lookin }} @else 0 @endif</b> | 199 | <b>@if (isset($stat[0]->lookin)) {{ $stat[0]->lookin }} @else 0 @endif</b> |
200 | </div> | 200 | </div> |
201 | <div class="cabinet__stats-item"> | 201 | <div class="cabinet__stats-item"> |
202 | <svg> | 202 | <svg> |
203 | <use xlink:href="{{ asset('images/sprite.svg#warning') }}"></use> | 203 | <use xlink:href="{{ asset('images/sprite.svg#warning') }}"></use> |
204 | </svg> | 204 | </svg> |
205 | <span>Отзывов:</span> | 205 | <span>Отзывов:</span> |
206 | <b>@if (isset($stat[0]->message)) {{ $stat[0]->message }} @else 0 @endif</b> | 206 | <b>@if(isset($Worker[0]->response)) {{ $Worker[0]->response->count() }} @else 0 @endif</b> |
207 | </div> | 207 | </div> |
208 | </div> | 208 | </div> |
209 | <div class="cabinet__stats-subtitle">Анкета заполнена на {{ $persent }}%</div> | 209 | <div class="cabinet__stats-subtitle">Анкета заполнена на {{ $persent }}%</div> |
210 | <div class="cabinet__stats-line"> | 210 | <div class="cabinet__stats-line"> |
211 | <span style="width:{{ $persent }}%"></span> | 211 | <span style="width:{{ $persent }}%"></span> |
212 | </div> | 212 | </div> |
213 | <div class="cabinet__stats-bottom">Заполните профиль, чтобы повысить процент анкеты на 80%</div> | 213 | <div class="cabinet__stats-bottom">Заполните профиль, чтобы повысить процент анкеты на 80%</div> |
214 | </div> | 214 | </div> |
215 | </div> | 215 | </div> |
216 | <div class="cabinet__body-item"> | 216 | <div class="cabinet__body-item"> |
217 | <h3 class="cabinet__subtitle">Профиль</h3> | 217 | <h3 class="cabinet__subtitle">Профиль</h3> |
218 | <div class="cabinet__avatar"> | 218 | <div class="cabinet__avatar"> |
219 | <div class="cabinet__avatar-pic"> | 219 | <div class="cabinet__avatar-pic"> |
220 | 220 | ||
221 | @if (!empty($Worker[0]->photo)) | 221 | @if (!empty($Worker[0]->photo)) |
222 | <img src="{{ asset(Storage::url($Worker[0]->photo)) }}"/> | 222 | <img src="{{ asset(Storage::url($Worker[0]->photo)) }}"/> |
223 | @else | 223 | @else |
224 | <svg> | 224 | <svg> |
225 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 225 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
226 | </svg> | 226 | </svg> |
227 | @endif | 227 | @endif |
228 | </div> | 228 | </div> |
229 | <div class="cabinet__avatar-form"> | 229 | <div class="cabinet__avatar-form"> |
230 | <label class="file"> | 230 | <label class="file"> |
231 | <span class="file__input"> | 231 | <span class="file__input"> |
232 | <input type="file" name="photo" id="photo"> | 232 | <input type="file" name="photo" id="photo"> |
233 | 233 | ||
234 | <span class="button"> | 234 | <span class="button"> |
235 | <svg> | 235 | <svg> |
236 | <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use> | 236 | <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use> |
237 | </svg> | 237 | </svg> |
238 | Загрузить | 238 | Загрузить |
239 | </span> | 239 | </span> |
240 | </span> | 240 | </span> |
241 | </label> | 241 | </label> |
242 | <p class="cabinet__text">Загрузите фотографию в формате svg., jpg., jpeg., png.</p> | 242 | <p class="cabinet__text">Загрузите фотографию в формате svg., jpg., jpeg., png.</p> |
243 | </div> | 243 | </div> |
244 | </div> | 244 | </div> |
245 | </div> | 245 | </div> |
246 | <div class="cabinet__body-item"> | 246 | <div class="cabinet__body-item"> |
247 | <div class="cabinet__inputs"> | 247 | <div class="cabinet__inputs"> |
248 | <div class="cabinet__inputs-item form-group"> | 248 | <div class="cabinet__inputs-item form-group"> |
249 | <label class="form-group__label">Электронная почта *</label> | 249 | <label class="form-group__label">Электронная почта *</label> |
250 | <div class="form-group__item"> | 250 | <div class="form-group__item"> |
251 | <input type="email" name="email" id="email" value="{{ $Worker[0]->email }}" class="input" placeholder="info@rekamore.su" required> | 251 | <input type="email" name="email" id="email" value="{{ $Worker[0]->email }}" class="input" placeholder="info@rekamore.su" required> |
252 | </div> | 252 | </div> |
253 | </div> | 253 | </div> |
254 | <div class="cabinet__inputs-item form-group"> | 254 | <div class="cabinet__inputs-item form-group"> |
255 | <label class="form-group__label">Статус</label> | 255 | <label class="form-group__label">Статус</label> |
256 | <div class="form-group__item"> | 256 | <div class="form-group__item"> |
257 | <div class="select"> | 257 | <div class="select"> |
258 | <select class="js-select2" name="status_work" id="status_work"> | 258 | <select class="js-select2" name="status_work" id="status_work"> |
259 | <option value="1" @if ($Worker[0]->status_work == 1) selected @endif>Не указано</option> | 259 | <option value="1" @if ($Worker[0]->status_work == 1) selected @endif>Не указано</option> |
260 | <option value="2" @if ($Worker[0]->status_work == 2) selected @endif>Не ищу работу</option> | 260 | <option value="2" @if ($Worker[0]->status_work == 2) selected @endif>Не ищу работу</option> |
261 | <option value="0" @if ($Worker[0]->status_work == 0) selected @endif>Ищу работу</option> | 261 | <option value="0" @if ($Worker[0]->status_work == 0) selected @endif>Ищу работу</option> |
262 | </select> | 262 | </select> |
263 | </div> | 263 | </div> |
264 | </div> | 264 | </div> |
265 | </div> | 265 | </div> |
266 | <!--<div class="cabinet__inputs-item form-group"> | 266 | <!--<div class="cabinet__inputs-item form-group"> |
267 | <label class="form-group__label">Статус *</label> | 267 | <label class="form-group__label">Статус *</label> |
268 | <div class="form-group__item"> | 268 | <div class="form-group__item"> |
269 | <input type="text" class="input" required> | 269 | <input type="text" class="input" required> |
270 | </div> | 270 | </div> |
271 | </div>--> | 271 | </div>--> |
272 | @if (isset($Worker[0]->users)) | 272 | @if (isset($Worker[0]->users)) |
273 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 273 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
274 | <label class="form-group__label">Фамилия *</label> | 274 | <label class="form-group__label">Фамилия *</label> |
275 | <div class="form-group__item"> | 275 | <div class="form-group__item"> |
276 | <input type="text" name="surname" id="surmane" class="input" value="{{ $Worker[0]->users->surname }}" placeholder="Филиппов" required> | 276 | <input type="text" name="surname" id="surmane" class="input" value="{{ $Worker[0]->users->surname }}" placeholder="Филиппов" required> |
277 | </div> | 277 | </div> |
278 | </div> | 278 | </div> |
279 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 279 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
280 | <label class="form-group__label">Имя *</label> | 280 | <label class="form-group__label">Имя *</label> |
281 | <div class="form-group__item"> | 281 | <div class="form-group__item"> |
282 | <input type="text" name="name_man" id="name_man" class="input" value="{{ $Worker[0]->users->name_man }}" placeholder="Егор" required> | 282 | <input type="text" name="name_man" id="name_man" class="input" value="{{ $Worker[0]->users->name_man }}" placeholder="Егор" required> |
283 | </div> | 283 | </div> |
284 | </div> | 284 | </div> |
285 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 285 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
286 | <label class="form-group__label">Отчество *</label> | 286 | <label class="form-group__label">Отчество *</label> |
287 | <div class="form-group__item"> | 287 | <div class="form-group__item"> |
288 | <input type="text" class="input" name="surname2" id="surmane2" value="{{ $Worker[0]->users->surname2 }}" placeholder="Алексеевич"> | 288 | <input type="text" class="input" name="surname2" id="surmane2" value="{{ $Worker[0]->users->surname2 }}" placeholder="Алексеевич"> |
289 | </div> | 289 | </div> |
290 | </div> | 290 | </div> |
291 | @endif | 291 | @endif |
292 | </div> | 292 | </div> |
293 | </div> | 293 | </div> |
294 | <div class="cabinet__body-item"> | 294 | <div class="cabinet__body-item"> |
295 | <h3 class="cabinet__subtitle">Основная информация</h3> | 295 | <h3 class="cabinet__subtitle">Основная информация</h3> |
296 | <div class="cabinet__inputs"> | 296 | <div class="cabinet__inputs"> |
297 | <div class="cabinet__inputs-item cabinet__inputs-item_min form-group"> | 297 | <div class="cabinet__inputs-item cabinet__inputs-item_min form-group"> |
298 | <label class="form-group__label">Возраст</label> | 298 | <label class="form-group__label">Возраст</label> |
299 | <div class="form-group__item"> | 299 | <div class="form-group__item"> |
300 | <input type="number" name="old_year" id="old_year" value="{{ $Worker[0]->old_year }}" class="input" placeholder="0" required> | 300 | <input type="number" name="old_year" id="old_year" value="{{ $Worker[0]->old_year }}" class="input" placeholder="0" required> |
301 | </div> | 301 | </div> |
302 | </div> | 302 | </div> |
303 | <div class="cabinet__inputs-item cabinet__inputs-item_max form-group"> | 303 | <div class="cabinet__inputs-item cabinet__inputs-item_max form-group"> |
304 | <label class="form-group__label">Желаемые вакансии</label> | 304 | <label class="form-group__label">Желаемые вакансии</label> |
305 | <div class="form-group__item"> | 305 | <div class="form-group__item"> |
306 | <div class="select"> | 306 | <div class="select"> |
307 | <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple"> | 307 | <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple"> |
308 | @if ($Job_titles->count()) | 308 | @if ($Job_titles->count()) |
309 | @foreach($Job_titles as $it) | 309 | @foreach($Job_titles as $it) |
310 | @php $selected = false; @endphp | 310 | @php $selected = false; @endphp |
311 | @if (isset($Worker[0]->job_titles)) | 311 | @if (isset($Worker[0]->job_titles)) |
312 | @if ($Worker[0]->job_titles->count()) | 312 | @if ($Worker[0]->job_titles->count()) |
313 | @foreach($Worker[0]->job_titles as $select) | 313 | @foreach($Worker[0]->job_titles as $select) |
314 | @if ($it->id == $select->id) | 314 | @if ($it->id == $select->id) |
315 | @php $selected = true; @endphp | 315 | @php $selected = true; @endphp |
316 | @endif | 316 | @endif |
317 | @endforeach | 317 | @endforeach |
318 | @endif | 318 | @endif |
319 | @endif | 319 | @endif |
320 | <option value="{{ $it->id }}" @if ($selected) selected @endif>{{ $it->name }}</option> | 320 | <option value="{{ $it->id }}" @if ($selected) selected @endif>{{ $it->name }}</option> |
321 | @endforeach | 321 | @endforeach |
322 | @endif | 322 | @endif |
323 | </select> | 323 | </select> |
324 | </div> | 324 | </div> |
325 | </div> | 325 | </div> |
326 | </div> | 326 | </div> |
327 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 327 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
328 | <label class="form-group__label">Город</label> | 328 | <label class="form-group__label">Город</label> |
329 | <div class="form-group__item"> | 329 | <div class="form-group__item"> |
330 | <input type="text" name="city" id="city" value="{{ $Worker[0]->city }}" class="input" placeholder="Челябинск" required> | 330 | <input type="text" name="city" id="city" value="{{ $Worker[0]->city }}" class="input" placeholder="Челябинск" required> |
331 | </div> | 331 | </div> |
332 | </div> | 332 | </div> |
333 | <div class="cabinet__inputs-item form-group"> | 333 | <div class="cabinet__inputs-item form-group"> |
334 | <label class="form-group__label">Опыт работы</label> | 334 | <label class="form-group__label">Опыт работы</label> |
335 | <div class="form-group__item"> | 335 | <div class="form-group__item"> |
336 | <div class="select"> | 336 | <div class="select"> |
337 | <select class="js-select2" id="experience" name="experience"> | 337 | <select class="js-select2" id="experience" name="experience"> |
338 | <option value="Не указано" @if (empty($Worker[0]->experience)) selected @endif>Не указано</option> | 338 | <option value="Не указано" @if (empty($Worker[0]->experience)) selected @endif>Не указано</option> |
339 | <option value="меньше 1 года" @if ($Worker[0]->experience == 'меньше 1 года') selected @endif>меньше 1 года</option> | 339 | <option value="меньше 1 года" @if ($Worker[0]->experience == 'меньше 1 года') selected @endif>меньше 1 года</option> |
340 | <option value="от 1 года до 3 лет" @if ($Worker[0]->experience == 'от 1 года до 3 лет') selected @endif>от 1 года до 3 лет</option> | 340 | <option value="от 1 года до 3 лет" @if ($Worker[0]->experience == 'от 1 года до 3 лет') selected @endif>от 1 года до 3 лет</option> |
341 | <option value="от 3 до 5 лет" @if ($Worker[0]->experience == 'от 3 до 5 лет') selected @endif>от 3 до 5 лет</option> | 341 | <option value="от 3 до 5 лет" @if ($Worker[0]->experience == 'от 3 до 5 лет') selected @endif>от 3 до 5 лет</option> |
342 | <option value="от 5 до 10 лет" @if ($Worker[0]->experience == 'от 5 до 10 лет') selected @endif>от 5 до 10 лет</option> | 342 | <option value="от 5 до 10 лет" @if ($Worker[0]->experience == 'от 5 до 10 лет') selected @endif>от 5 до 10 лет</option> |
343 | <option value="Больше 10 лет" @if ($Worker[0]->experience == 'Больше 10 лет') selected @endif>Больше 10 лет</option> | 343 | <option value="Больше 10 лет" @if ($Worker[0]->experience == 'Больше 10 лет') selected @endif>Больше 10 лет</option> |
344 | </select> | 344 | </select> |
345 | </div> | 345 | </div> |
346 | </div> | 346 | </div> |
347 | </div> | 347 | </div> |
348 | 348 | ||
349 | <div class="cabinet__inputs-item form-group"> | 349 | <div class="cabinet__inputs-item form-group"> |
350 | <label class="form-group__label">Номер телефона 1</label> | 350 | <label class="form-group__label">Номер телефона 1</label> |
351 | <div class="form-group__item"> | 351 | <div class="form-group__item"> |
352 | <input type="tel" name="telephone" id="telephone" value="{{ old('telephone') ?? $Worker[0]->telephone ?? '' }}" class="input" placeholder="+7 (___) ___-__-__" required> | 352 | <input type="tel" name="telephone" id="telephone" value="{{ old('telephone') ?? $Worker[0]->telephone ?? '' }}" class="input" placeholder="+7 (___) ___-__-__" required> |
353 | </div> | 353 | </div> |
354 | </div> | 354 | </div> |
355 | <div class="cabinet__inputs-item form-group"> | 355 | <div class="cabinet__inputs-item form-group"> |
356 | <label class="form-group__label">Номер телефона 2</label> | 356 | <label class="form-group__label">Номер телефона 2</label> |
357 | <div class="form-group__item"> | 357 | <div class="form-group__item"> |
358 | <input type="tel" name="telephone2" id="telephon2" value="{{ old('telephone2') ?? $Worker[0]->telephone2 ?? '' }}" class="input" placeholder="+7 (___) ___-__-__"> | 358 | <input type="tel" name="telephone2" id="telephon2" value="{{ old('telephone2') ?? $Worker[0]->telephone2 ?? '' }}" class="input" placeholder="+7 (___) ___-__-__"> |
359 | </div> | 359 | </div> |
360 | </div> | 360 | </div> |
361 | </div> | 361 | </div> |
362 | </div> | 362 | </div> |
363 | 363 | ||
364 | <div class="cabinet__body-item"> | 364 | <div class="cabinet__body-item"> |
365 | <h4 class="cabinet__h4">О себе</h4> | 365 | <h4 class="cabinet__h4">О себе</h4> |
366 | <textarea class="textarea" name="text" id="text" placeholder="Не указано">{{ $Worker[0]->text }}</textarea> | 366 | <textarea class="textarea" name="text" id="text" placeholder="Не указано">{{ $Worker[0]->text }}</textarea> |
367 | <div class="cabinet__buttons"> | 367 | <div class="cabinet__buttons"> |
368 | <button type="submit" class="button">Сохранить</button> | 368 | <button type="submit" class="button">Сохранить</button> |
369 | <label class="file"> | 369 | <label class="file"> |
370 | <span class="file__input"> | 370 | <span class="file__input"> |
371 | <input type="file" name="file" id="file"> | 371 | <input type="file" name="file" id="file"> |
372 | <span class="button button_light">@if (empty($Worker[0]->file)) Прикрепить резюме @else Обновить резюме @endif</span> | 372 | <span class="button button_light">@if (empty($Worker[0]->file)) Прикрепить резюме @else Обновить резюме @endif</span> |
373 | </span> | 373 | </span> |
374 | </label> | 374 | </label> |
375 | </div> | 375 | </div> |
376 | </div> | 376 | </div> |
377 | 377 | ||
378 | 378 | ||
379 | <div id="sertificate" name="sertificate"> | 379 | <div id="sertificate" name="sertificate"> |
380 | @if ((isset($Worker[0]->sertificate)) && ($Worker[0]->sertificate->count() > 0)) | 380 | @if ((isset($Worker[0]->sertificate)) && ($Worker[0]->sertificate->count() > 0)) |
381 | @php $i = 0; @endphp | 381 | @php $i = 0; @endphp |
382 | @foreach($Worker[0]->sertificate as $it) | 382 | @foreach($Worker[0]->sertificate as $it) |
383 | <div style="margin-bottom: 20px" class="cabinet__body-item"> | 383 | <div style="margin-bottom: 20px" class="cabinet__body-item"> |
384 | @if ($i == 0) | 384 | @if ($i == 0) |
385 | <h3 class="cabinet__subtitle">Сертификаты / документы</h3> | 385 | <h3 class="cabinet__subtitle">Сертификаты / документы</h3> |
386 | @endif | 386 | @endif |
387 | <h4 class="cabinet__h4">Сертификат {{ $i+1 }}</h4> | 387 | <h4 class="cabinet__h4">Сертификат {{ $i+1 }}</h4> |
388 | <div class="cabinet__inputs"> | 388 | <div class="cabinet__inputs"> |
389 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 389 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
390 | <label class="form-group__label">Название сертификата:</label> | 390 | <label class="form-group__label">Название сертификата:</label> |
391 | <div class="form-group__item"> | 391 | <div class="form-group__item"> |
392 | <input type="text" class="input" value="{{ $it->name }}" disabled> | 392 | <input type="text" class="input" value="{{ $it->name }}" disabled> |
393 | </div> | 393 | </div> |
394 | </div> | 394 | </div> |
395 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 395 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
396 | <label class="form-group__label">Учебное заведение</label> | 396 | <label class="form-group__label">Учебное заведение</label> |
397 | <div class="form-group__item"> | 397 | <div class="form-group__item"> |
398 | <input type="text" class="input" value=" $it->education }}" disabled> | 398 | <input type="text" class="input" value=" $it->education }}" disabled> |
399 | </div> | 399 | </div> |
400 | </div>--> | 400 | </div>--> |
401 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 401 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
402 | <label class="form-group__label">Действителен до:</label> | 402 | <label class="form-group__label">Действителен до:</label> |
403 | <div class="form-group__item"> | 403 | <div class="form-group__item"> |
404 | <input type="text" class="input" value="{{ $it->end_begin }}" disabled> | 404 | <input type="text" class="input" value="{{ $it->end_begin }}" disabled> |
405 | </div> | 405 | </div> |
406 | </div> | 406 | </div> |
407 | <a href="{{ route('worker.delete_sertificate', ['doc' => $it->id]) }}" class="button button_light"> | 407 | <a href="{{ route('worker.delete_sertificate', ['doc' => $it->id]) }}" class="button button_light"> |
408 | <svg> | 408 | <svg> |
409 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> | 409 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> |
410 | </svg> | 410 | </svg> |
411 | Удалить | 411 | Удалить |
412 | </a> | 412 | </a> |
413 | <a href="{{ route('worker.edit_sertificate', ['worker' => $Worker[0]->id, 'doc' => $it->id ]) }}" class="button">Редактирование</a> | 413 | <a href="{{ route('worker.edit_sertificate', ['worker' => $Worker[0]->id, 'doc' => $it->id ]) }}" class="button">Редактирование</a> |
414 | </div> | 414 | </div> |
415 | </div> | 415 | </div> |
416 | @php $i++ @endphp | 416 | @php $i++ @endphp |
417 | @endforeach | 417 | @endforeach |
418 | @else | 418 | @else |
419 | <div style="margin-bottom: 20px" class="cabinet__body-item"> | 419 | <div style="margin-bottom: 20px" class="cabinet__body-item"> |
420 | <h3 class="cabinet__subtitle">Сертификаты / документы</h3> | 420 | <h3 class="cabinet__subtitle">Сертификаты / документы</h3> |
421 | Нет сертификатов | 421 | Нет сертификатов |
422 | </div> | 422 | </div> |
423 | @endif | 423 | @endif |
424 | </div> | 424 | </div> |
425 | 425 | ||
426 | <div class="cabinet__body-item"> | 426 | <div class="cabinet__body-item"> |
427 | <a class="button button_light" href="{{ route('worker.new_sertificate',['worker' => $Worker[0]->id]) }}" id="button_new_doc" name="button_new_doc"> | 427 | <a class="button button_light" href="{{ route('worker.new_sertificate',['worker' => $Worker[0]->id]) }}" id="button_new_doc" name="button_new_doc"> |
428 | Добавить сертификат | 428 | Добавить сертификат |
429 | </a> | 429 | </a> |
430 | </div> | 430 | </div> |
431 | 431 | ||
432 | <div class="cabinet__body-item" name="ajax_dop_diplomi" id="ajax_dop_diplomi"> | 432 | <div class="cabinet__body-item" name="ajax_dop_diplomi" id="ajax_dop_diplomi"> |
433 | <h4 class="cabinet__h4">Дополнительная информация</h4> | 433 | <h4 class="cabinet__h4">Дополнительная информация</h4> |
434 | <div class="cabinet__inputs" id="block_sertificate"> | 434 | <div class="cabinet__inputs" id="block_sertificate"> |
435 | @if ($Infobloks->count()) | 435 | @if ($Infobloks->count()) |
436 | @foreach ($Infobloks as $doc) | 436 | @foreach ($Infobloks as $doc) |
437 | <div class="cabinet__inputs-item form-group"> | 437 | <div class="cabinet__inputs-item form-group"> |
438 | <label class="form-group__label">{{ $doc->name }}</label> | 438 | <label class="form-group__label">{{ $doc->name }}</label> |
439 | <div class="form-group__item"> | 439 | <div class="form-group__item"> |
440 | <div class="select"> | 440 | <div class="select"> |
441 | @php $Selected = 0; @endphp | 441 | @php $Selected = 0; @endphp |
442 | @if ($Worker[0]->infobloks->count()) | 442 | @if ($Worker[0]->infobloks->count()) |
443 | @foreach ($Worker[0]->dop_info as $info) | 443 | @foreach ($Worker[0]->dop_info as $info) |
444 | @if ($info->infoblok_id == $doc->id) | 444 | @if ($info->infoblok_id == $doc->id) |
445 | @php $Selected = $info->status; @endphp | 445 | @php $Selected = $info->status; @endphp |
446 | @endif | 446 | @endif |
447 | @endforeach | 447 | @endforeach |
448 | @endif | 448 | @endif |
449 | <select data-info="{{ $doc->id }}" class="js-select2 sertificates_js"> | 449 | <select data-info="{{ $doc->id }}" class="js-select2 sertificates_js"> |
450 | <option value="0" @if ($Selected == 0) selected @endif>Не указано</option> | 450 | <option value="0" @if ($Selected == 0) selected @endif>Не указано</option> |
451 | <option value="1" @if ($Selected == 1) selected @endif>В наличии</option> | 451 | <option value="1" @if ($Selected == 1) selected @endif>В наличии</option> |
452 | <option value="2" @if ($Selected == 2) selected @endif>Отсутствует</option> | 452 | <option value="2" @if ($Selected == 2) selected @endif>Отсутствует</option> |
453 | </select> | 453 | </select> |
454 | </div> | 454 | </div> |
455 | </div> | 455 | </div> |
456 | </div> | 456 | </div> |
457 | @endforeach | 457 | @endforeach |
458 | @endif | 458 | @endif |
459 | <!--_if (isset($Worker[0]->infobloks)) | 459 | <!--_if (isset($Worker[0]->infobloks)) |
460 | _php dd($Worker[0]->infobloks) _endphp | 460 | _php dd($Worker[0]->infobloks) _endphp |
461 | _if ($Worker[0]->infobloks->count()) | 461 | _if ($Worker[0]->infobloks->count()) |
462 | _php $i = 1; _endphp | 462 | _php $i = 1; _endphp |
463 | _foreach ($Worker[0]->infobloks as $info) | 463 | _foreach ($Worker[0]->infobloks as $info) |
464 | <div class="cabinet__inputs-item form-group"> | 464 | <div class="cabinet__inputs-item form-group"> |
465 | <label class="form-group__label"> $info->name }}</label> | 465 | <label class="form-group__label"> $info->name }}</label> |
466 | <div class="form-group__item"> | 466 | <div class="form-group__item"> |
467 | <div class="select"> | 467 | <div class="select"> |
468 | <select data-info=" $info->id }}" class="js-select2 sertificates_js"> | 468 | <select data-info=" $info->id }}" class="js-select2 sertificates_js"> |
469 | <option value="0">Нет</option> | 469 | <option value="0">Нет</option> |
470 | <option value="1" selected>Да</option> | 470 | <option value="1" selected>Да</option> |
471 | </select> | 471 | </select> |
472 | </div> | 472 | </div> |
473 | </div> | 473 | </div> |
474 | </div> | 474 | </div> |
475 | _php $i++; _endphp | 475 | _php $i++; _endphp |
476 | _endforeach | 476 | _endforeach |
477 | _endif | 477 | _endif |
478 | _endif | 478 | _endif |
479 | --> | 479 | --> |
480 | 480 | ||
481 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 481 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
482 | <label class="form-group__label">Образцы дипломов и документов</label> | 482 | <label class="form-group__label">Образцы дипломов и документов</label> |
483 | <div class="form-group__item"> | 483 | <div class="form-group__item"> |
484 | <div class="select"> | 484 | <div class="select"> |
485 | <select class="js-select2" id="documents" name="documents"> | 485 | <select class="js-select2" id="documents" name="documents"> |
486 | _if ($Infoblocks->count()) | 486 | _if ($Infoblocks->count()) |
487 | _foreach ($Infoblocks as $it) | 487 | _foreach ($Infoblocks as $it) |
488 | <option value="_$it->id }}">_$it->name }}</option> | 488 | <option value="_$it->id }}">_$it->name }}</option> |
489 | _endforeach | 489 | _endforeach |
490 | _endif | 490 | _endif |
491 | </select> | 491 | </select> |
492 | </div> | 492 | </div> |
493 | </div> | 493 | </div> |
494 | </div>--> | 494 | </div>--> |
495 | </div> | 495 | </div> |
496 | <!--<a href=" route('worker.add_diplom', ['worker' => $Worker[0]->id]) }}" name="btn_new_diplom" data-val="{{ $Worker[0]->id }}" id="btn_new_diplom" class="button button_light"> | 496 | <!--<a href=" route('worker.add_diplom', ['worker' => $Worker[0]->id]) }}" name="btn_new_diplom" data-val="{{ $Worker[0]->id }}" id="btn_new_diplom" class="button button_light"> |
497 | Добавить документ | 497 | Добавить документ |
498 | </a>--> | 498 | </a>--> |
499 | </div> | 499 | </div> |
500 | <div class="cabinet__body-item"> | 500 | <div class="cabinet__body-item"> |
501 | <div class="cabinet__works"> | 501 | <div class="cabinet__works"> |
502 | @if (isset($Worker[0]->place_worker)) | 502 | @if (isset($Worker[0]->place_worker)) |
503 | @php $i = 1; @endphp | 503 | @php $i = 1; @endphp |
504 | @foreach($Worker[0]->place_worker as $company) | 504 | @foreach($Worker[0]->place_worker as $company) |
505 | <div class="cabinet__works-item"> | 505 | <div class="cabinet__works-item"> |
506 | <div class="cabinet__works-spoiler active"> | 506 | <div class="cabinet__works-spoiler active"> |
507 | <div class="cabinet__works-spoiler-left"> | 507 | <div class="cabinet__works-spoiler-left"> |
508 | <div class="cabinet__works-spoiler-buttons"> | 508 | <div class="cabinet__works-spoiler-buttons"> |
509 | <a href="{{ route('worker.delete_document', ['doc' => $company->id]) }}" class="button button_light js-works-remove"> | 509 | <a href="{{ route('worker.delete_document', ['doc' => $company->id]) }}" class="button button_light js-works-remove"> |
510 | <svg> | 510 | <svg> |
511 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> | 511 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> |
512 | </svg> | 512 | </svg> |
513 | </a> | 513 | </a> |
514 | <a href="{{ route('worker.edit_document', ['doc' => $company->id, 'worker' => $Worker[0]->id]) }}" type="button" class="button button_light js-works-edit"> | 514 | <a href="{{ route('worker.edit_document', ['doc' => $company->id, 'worker' => $Worker[0]->id]) }}" type="button" class="button button_light js-works-edit"> |
515 | <svg> | 515 | <svg> |
516 | <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> | 516 | <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> |
517 | </svg> | 517 | </svg> |
518 | </a> | 518 | </a> |
519 | </div> | 519 | </div> |
520 | <div class="cabinet__works-spoiler-text">Место работы {{ $i }}</div> | 520 | <div class="cabinet__works-spoiler-text">Место работы {{ $i }}</div> |
521 | </div> | 521 | </div> |
522 | <button type="button" class="cabinet__works-spoiler-right js-parent-toggle"> | 522 | <button type="button" class="cabinet__works-spoiler-right js-parent-toggle"> |
523 | <svg> | 523 | <svg> |
524 | <use xlink:href="{{ asset('images/sprite.svg#arrow-bold') }}"></use> | 524 | <use xlink:href="{{ asset('images/sprite.svg#arrow-bold') }}"></use> |
525 | </svg> | 525 | </svg> |
526 | </button> | 526 | </button> |
527 | </div> | 527 | </div> |
528 | <div class="cabinet__works-body"> | 528 | <div class="cabinet__works-body"> |
529 | <div class="cabinet__inputs"> | 529 | <div class="cabinet__inputs"> |
530 | <div class="cabinet__inputs-item form-group"> | 530 | <div class="cabinet__inputs-item form-group"> |
531 | <label class="form-group__label">Должность</label> | 531 | <label class="form-group__label">Должность</label> |
532 | <div class="form-group__item"> | 532 | <div class="form-group__item"> |
533 | <input type="text" class="input" value="{{ $company->job_title }}" disabled> | 533 | <input type="text" class="input" value="{{ $company->job_title }}" disabled> |
534 | </div> | 534 | </div> |
535 | </div> | 535 | </div> |
536 | <!--<div class="cabinet__inputs-item form-group"> | 536 | <!--<div class="cabinet__inputs-item form-group"> |
537 | <label class="form-group__label">Опыт работы в танкерном флоте</label> | 537 | <label class="form-group__label">Опыт работы в танкерном флоте</label> |
538 | <div class="form-group__item"> | 538 | <div class="form-group__item"> |
539 | <input type="text" class="input" value="@if ($company->tanker) Есть @else Нет @endif"> | 539 | <input type="text" class="input" value="@if ($company->tanker) Есть @else Нет @endif"> |
540 | </div> | 540 | </div> |
541 | </div>--> | 541 | </div>--> |
542 | <div class="cabinet__inputs-item form-group"> | 542 | <div class="cabinet__inputs-item form-group"> |
543 | <label class="form-group__label">Название т/х</label> | 543 | <label class="form-group__label">Название т/х</label> |
544 | <div class="form-group__item"> | 544 | <div class="form-group__item"> |
545 | <input type="text" class="input" value="{{ $company->teplohod }}" disabled> | 545 | <input type="text" class="input" value="{{ $company->teplohod }}" disabled> |
546 | </div> | 546 | </div> |
547 | </div> | 547 | </div> |
548 | <div class="cabinet__inputs-item form-group"> | 548 | <div class="cabinet__inputs-item form-group"> |
549 | <label class="form-group__label">Тип суда (GWT)</label> | 549 | <label class="form-group__label">Тип суда (GWT)</label> |
550 | <div class="form-group__item"> | 550 | <div class="form-group__item"> |
551 | <input type="text" class="input" value="{{ $company->GWT }}" disabled> | 551 | <input type="text" class="input" value="{{ $company->GWT }}" disabled> |
552 | </div> | 552 | </div> |
553 | </div> | 553 | </div> |
554 | <div class="cabinet__inputs-item form-group"> | 554 | <div class="cabinet__inputs-item form-group"> |
555 | <label class="form-group__label">Марка ГД</label> | 555 | <label class="form-group__label">Марка ГД</label> |
556 | <div class="form-group__item"> | 556 | <div class="form-group__item"> |
557 | <input type="text" class="input" value="{{ $company->Marka_GD }}" disabled> | 557 | <input type="text" class="input" value="{{ $company->Marka_GD }}" disabled> |
558 | </div> | 558 | </div> |
559 | </div> | 559 | </div> |
560 | <div class="cabinet__inputs-item form-group"> | 560 | <div class="cabinet__inputs-item form-group"> |
561 | <label class="form-group__label">Мощность ГД (кВТ)</label> | 561 | <label class="form-group__label">Мощность ГД (кВТ)</label> |
562 | <div class="form-group__item"> | 562 | <div class="form-group__item"> |
563 | <input type="text" class="input" value="{{ $company->KBT }}" disabled> | 563 | <input type="text" class="input" value="{{ $company->KBT }}" disabled> |
564 | </div> | 564 | </div> |
565 | </div> | 565 | </div> |
566 | <div class="cabinet__inputs-item form-group"> | 566 | <div class="cabinet__inputs-item form-group"> |
567 | <label class="form-group__label">Водоизмещение (GRT)</label> | 567 | <label class="form-group__label">Водоизмещение (GRT)</label> |
568 | <div class="form-group__item"> | 568 | <div class="form-group__item"> |
569 | <input type="text" class="input" value="{{ $company->GRT }}" disabled> | 569 | <input type="text" class="input" value="{{ $company->GRT }}" disabled> |
570 | </div> | 570 | </div> |
571 | </div> | 571 | </div> |
572 | <div class="cabinet__inputs-item form-group"> | 572 | <div class="cabinet__inputs-item form-group"> |
573 | <label class="form-group__label">Название компании</label> | 573 | <label class="form-group__label">Название компании</label> |
574 | <div class="form-group__item"> | 574 | <div class="form-group__item"> |
575 | <input type="text" class="input" value="{{ $company->name_company }}" disabled> | 575 | <input type="text" class="input" value="{{ $company->name_company }}" disabled> |
576 | </div> | 576 | </div> |
577 | </div> | 577 | </div> |
578 | <div class="cabinet__inputs-item form-group"> | 578 | <div class="cabinet__inputs-item form-group"> |
579 | <label class="form-group__label">Начало контракта</label> | 579 | <label class="form-group__label">Начало контракта</label> |
580 | <div class="form-group__item"> | 580 | <div class="form-group__item"> |
581 | <input type="text" class="input" value="{{ $company->begin_work }}" disabled> | 581 | <input type="text" class="input" value="{{ $company->begin_work }}" disabled> |
582 | </div> | 582 | </div> |
583 | </div> | 583 | </div> |
584 | <div class="cabinet__inputs-item form-group"> | 584 | <div class="cabinet__inputs-item form-group"> |
585 | <label class="form-group__label">Окончание контракта</label> | 585 | <label class="form-group__label">Окончание контракта</label> |
586 | <div class="form-group__item"> | 586 | <div class="form-group__item"> |
587 | <input type="text" class="input" value="{{ $company->end_work }}" disabled> | 587 | <input type="text" class="input" value="{{ $company->end_work }}" disabled> |
588 | </div> | 588 | </div> |
589 | </div> | 589 | </div> |
590 | 590 | ||
591 | </div> | 591 | </div> |
592 | </div> | 592 | </div> |
593 | </div> | 593 | </div> |
594 | @php $i++ @endphp | 594 | @php $i++ @endphp |
595 | @endforeach | 595 | @endforeach |
596 | @endif | 596 | @endif |
597 | </div> | 597 | </div> |
598 | 598 | ||
599 | </div> | 599 | </div> |
600 | 600 | ||
601 | <a href="{{ route('worker.add_document', ['worker' => $Worker[0]->id]) }}" id="new_work" name="new_work" class="button button_light cabinet__works-add" style="width:100%; max-width:none;">Новое место работы</a> | 601 | <a href="{{ route('worker.add_document', ['worker' => $Worker[0]->id]) }}" id="new_work" name="new_work" class="button button_light cabinet__works-add" style="width:100%; max-width:none;">Новое место работы</a> |
602 | 602 | ||
603 | <div id="prev_worker" name="prev_worker"> | 603 | <div id="prev_worker" name="prev_worker"> |
604 | @if ((isset($Worker[0]->prev_company)) && ($Worker[0]->prev_company->count() > 0)) | 604 | @if ((isset($Worker[0]->prev_company)) && ($Worker[0]->prev_company->count() > 0)) |
605 | @php $i = 0; @endphp | 605 | @php $i = 0; @endphp |
606 | @foreach($Worker[0]->prev_company as $it) | 606 | @foreach($Worker[0]->prev_company as $it) |
607 | <div style="margin-bottom: 20px" class="cabinet__body-item"> | 607 | <div style="margin-bottom: 20px" class="cabinet__body-item"> |
608 | @if ($i == 0) | 608 | @if ($i == 0) |
609 | <h3 class="cabinet__subtitle">Контакты предыдущих компаний</h3> | 609 | <h3 class="cabinet__subtitle">Контакты предыдущих компаний</h3> |
610 | @endif | 610 | @endif |
611 | <h4 class="cabinet__h4">Компания {{ $i+1 }}</h4> | 611 | <h4 class="cabinet__h4">Компания {{ $i+1 }}</h4> |
612 | <div class="cabinet__inputs"> | 612 | <div class="cabinet__inputs"> |
613 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 613 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
614 | <label class="form-group__label">Название компании</label> | 614 | <label class="form-group__label">Название компании</label> |
615 | <div class="form-group__item"> | 615 | <div class="form-group__item"> |
616 | <input type="text" class="input" value="{{ $it->name_company }}" disabled> | 616 | <input type="text" class="input" value="{{ $it->name_company }}" disabled> |
617 | </div> | 617 | </div> |
618 | </div> | 618 | </div> |
619 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 619 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
620 | <label class="form-group__label">ФИО сотрудника</label> | 620 | <label class="form-group__label">ФИО сотрудника</label> |
621 | <div class="form-group__item"> | 621 | <div class="form-group__item"> |
622 | <input type="text" class="input" value="{{ $it->direct }}" disabled> | 622 | <input type="text" class="input" value="{{ $it->direct }}" disabled> |
623 | </div> | 623 | </div> |
624 | </div> | 624 | </div> |
625 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 625 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
626 | <label class="form-group__label">Должность сотрудника</label> | 626 | <label class="form-group__label">Должность сотрудника</label> |
627 | <div class="form-group__item"> | 627 | <div class="form-group__item"> |
628 | <input type="text" class="input" value="{{ $it->telephone }}" disabled> | 628 | <input type="text" class="input" value="{{ $it->telephone }}" disabled> |
629 | </div> | 629 | </div> |
630 | </div> | 630 | </div> |
631 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 631 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
632 | <label class="form-group__label">Телефон сотрудника</label> | 632 | <label class="form-group__label">Телефон сотрудника</label> |
633 | <div class="form-group__item"> | 633 | <div class="form-group__item"> |
634 | <input type="text" class="input" value="{{ $it->telephone2 }}" disabled> | 634 | <input type="text" class="input" value="{{ $it->telephone2 }}" disabled> |
635 | </div> | 635 | </div> |
636 | </div> | 636 | </div> |
637 | <a href="{{ route('worker.delete_prev_company', ['doc' => $it->id]) }}" class="button button_light"> | 637 | <a href="{{ route('worker.delete_prev_company', ['doc' => $it->id]) }}" class="button button_light"> |
638 | <svg> | 638 | <svg> |
639 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> | 639 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> |
640 | </svg> | 640 | </svg> |
641 | Удалить | 641 | Удалить |
642 | </a> | 642 | </a> |
643 | <a href="{{ route('worker.edit_prev_company', ['worker' => $Worker[0]->id, 'doc' => $it->id ]) }}" class="button">Редактирование</a> | 643 | <a href="{{ route('worker.edit_prev_company', ['worker' => $Worker[0]->id, 'doc' => $it->id ]) }}" class="button">Редактирование</a> |
644 | </div> | 644 | </div> |
645 | </div> | 645 | </div> |
646 | @php $i++ @endphp | 646 | @php $i++ @endphp |
647 | @endforeach | 647 | @endforeach |
648 | @else | 648 | @else |
649 | <div style="margin-bottom: 20px" class="cabinet__body-item"> | 649 | <div style="margin-bottom: 20px" class="cabinet__body-item"> |
650 | <h3 class="cabinet__subtitle">Предыдущие компании</h3> | 650 | <h3 class="cabinet__subtitle">Предыдущие компании</h3> |
651 | Нет предыдущих компаний | 651 | Нет предыдущих компаний |
652 | </div> | 652 | </div> |
653 | @endif | 653 | @endif |
654 | </div> | 654 | </div> |
655 | 655 | ||
656 | <div class="cabinet__body-item"> | 656 | <div class="cabinet__body-item"> |
657 | <a class="button button_light" href="{{ route('worker.new_prev_company',['worker' => $Worker[0]->id]) }}" id="button_new_doc" name="button_new_doc"> | 657 | <a class="button button_light" href="{{ route('worker.new_prev_company',['worker' => $Worker[0]->id]) }}" id="button_new_doc" name="button_new_doc"> |
658 | Добавить официльную контактную информацию | 658 | Добавить официльную контактную информацию |
659 | </a> | 659 | </a> |
660 | </div> | 660 | </div> |
661 | 661 | ||
662 | </form> | 662 | </form> |
663 | </div> | 663 | </div> |
664 | </div> | 664 | </div> |
665 | </section> | 665 | </section> |
666 | </div> | 666 | </div> |
667 | <div> | 667 | <div> |
668 | @endsection | 668 | @endsection |
669 | 669 |
resources/views/workers/messages.blade.php
1 | @extends('layout.frontend', ['title' => 'Мои сообщения - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Мои сообщения - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | 4 | ||
5 | @endsection | 5 | @endsection |
6 | 6 | ||
7 | @section('content') | 7 | @section('content') |
8 | <section class="cabinet"> | 8 | <section class="cabinet"> |
9 | <div class="container"> | 9 | <div class="container"> |
10 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 10 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
11 | <li><a href="{{ route('index') }}">Главная</a></li> | 11 | <li><a href="{{ route('index') }}">Главная</a></li> |
12 | <li><b>Личный кабинет</b></li> | 12 | <li><b>Личный кабинет</b></li> |
13 | </ul> | 13 | </ul> |
14 | <div class="cabinet__wrapper"> | 14 | <div class="cabinet__wrapper"> |
15 | <div class="cabinet__side"> | 15 | <div class="cabinet__side"> |
16 | <div class="cabinet__side-toper"> | 16 | <div class="cabinet__side-toper"> |
17 | @include('workers.emblema') | 17 | @include('workers.emblema') |
18 | 18 | ||
19 | </div> | 19 | </div> |
20 | 20 | ||
21 | @include('workers.menu', ['item' => 2]) | 21 | @include('workers.menu', ['item' => 2]) |
22 | </div> | 22 | </div> |
23 | <div class="cabinet__body"> | 23 | <div class="cabinet__body"> |
24 | <div class="cabinet__body-item"> | 24 | <div class="cabinet__body-item"> |
25 | <h2 class="title cabinet__title">Сообщения</h2> | 25 | <h2 class="title cabinet__title">Сообщения</h2> |
26 | </div> | 26 | </div> |
27 | <div class="cabinet__body-item"> | 27 | <div class="cabinet__body-item"> |
28 | <div class="cabinet__filters"> | 28 | <div class="cabinet__filters"> |
29 | <div class="cabinet__filters-item"> | 29 | <div class="cabinet__filters-item"> |
30 | <div class="cabinet__filters-buttons"> | 30 | <div class="cabinet__filters-buttons"> |
31 | <a href="{{ route('worker.messages', ['type_message' => 'input']) }}" class="button button_light @if ($type_message == 'input') active @endif">Входящие ({{ $count_input }})</a> | 31 | <a href="{{ route('worker.messages', ['type_message' => 'input']) }}" class="button button_light @if ($type_message == 'input') active @endif">Входящие ({{ $count_input }})</a> |
32 | <a href="{{ route('worker.messages', ['type_message' => 'output']) }}" class="button button_light @if ($type_message == 'output') active @endif">Исходящие ({{ $count_output }})</a> | 32 | <a href="{{ route('worker.messages', ['type_message' => 'output']) }}" class="button button_light @if ($type_message == 'output') active @endif">Исходящие ({{ $count_output }})</a> |
33 | </div> | 33 | </div> |
34 | </div> | 34 | </div> |
35 | <!--<div class="cabinet__filters-item"> | 35 | <!--<div class="cabinet__filters-item"> |
36 | <div class="select"> | 36 | <div class="select"> |
37 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> | 37 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> |
38 | <option value="default">Сортировка (по умолчанию)</option> | 38 | <option value="default">Сортировка (по умолчанию)</option> |
39 | <option value="name (asc)">По имени (возрастание)</option> | 39 | <option value="name (asc)">По имени (возрастание)</option> |
40 | <option value="name (desc)">По имени (убывание)</option> | 40 | <option value="name (desc)">По имени (убывание)</option> |
41 | <option value="created_at (asc)">По дате (возрастание)</option> | 41 | <option value="created_at (asc)">По дате (возрастание)</option> |
42 | <option value="created_at (desc)">По дате (убывание)</option> | 42 | <option value="created_at (desc)">По дате (убывание)</option> |
43 | </select> | 43 | </select> |
44 | </div> | 44 | </div> |
45 | </div>--> | 45 | </div>--> |
46 | </div> | 46 | </div> |
47 | 47 | ||
48 | @if ($messages->count()) | 48 | @if ($messages->count()) |
49 | @foreach($messages as $it) | 49 | @foreach($messages as $it) |
50 | <div class="messages__item"> | 50 | <div class="messages__item"> |
51 | <div class="messages__item-info"> | 51 | <div class="messages__item-info"> |
52 | <div class="messages__item-photo"> | 52 | <div class="messages__item-photo"> |
53 | <svg> | 53 | <svg> |
54 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 54 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
55 | </svg> | 55 | </svg> |
56 | 56 | ||
57 | @if ($type_message == 'input') | 57 | @if ($type_message == 'input') |
58 | @if ($it->user_to->is_worker) | 58 | @if ($it->user_to->is_worker) |
59 | @if (isset($it->user_to->workers->phote)) | 59 | @if (isset($it->user_to->workers->phote)) |
60 | <img src="{{ asset(Storage::url($it->user_to->workers->phote)) }}" alt=""> | 60 | <img src="{{ asset(Storage::url($it->user_to->workers->phote)) }}" alt=""> |
61 | @else | 61 | @else |
62 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 62 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
63 | @endif | 63 | @endif |
64 | @else | 64 | @else |
65 | @if (isset($it->user_to->employers->logo)) | 65 | @if (isset($it->user_to->employers->logo)) |
66 | <img src="{{ asset(Storage::url($it->user_to->employers->logo)) }}" alt=""> | 66 | <img src="{{ asset(Storage::url($it->user_to->employers->logo)) }}" alt=""> |
67 | @else | 67 | @else |
68 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 68 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
69 | @endif | 69 | @endif |
70 | @endif | 70 | @endif |
71 | @endif | 71 | @endif |
72 | 72 | ||
73 | @if ($type_message == 'output') | 73 | @if ($type_message == 'output') |
74 | @if ($it->user_from->is_worker) | 74 | @if ($it->user_from->is_worker) |
75 | @if (isset($it->user_from->workers->phote)) | 75 | @if (isset($it->user_from->workers->phote)) |
76 | <img src="{{ asset(Storage::url($it->user_from->workers->phote)) }}" alt=""> | 76 | <img src="{{ asset(Storage::url($it->user_from->workers->phote)) }}" alt=""> |
77 | @else | 77 | @else |
78 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 78 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
79 | @endif | 79 | @endif |
80 | @else | 80 | @else |
81 | @if (isset($it->user_from->employers->logo)) | 81 | @if (isset($it->user_from->employers->logo)) |
82 | <img src="{{ asset(Storage::url($it->user_from->employers->logo)) }}" alt=""> | 82 | <img src="{{ asset(Storage::url($it->user_from->employers->logo)) }}" alt=""> |
83 | @else | 83 | @else |
84 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 84 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
85 | @endif | 85 | @endif |
86 | @endif | 86 | @endif |
87 | @endif | 87 | @endif |
88 | </div> | 88 | </div> |
89 | <div class="messages__item-text"> | 89 | <div class="messages__item-text"> |
90 | <div> | 90 | <div> |
91 | От: @if (isset($it->user_from)) | 91 | От: @if (isset($it->user_from)) |
92 | @if ($it->user_from->id !== $user_id) | 92 | @if ($it->user_from->id !== $user_id) |
93 | <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id]) }}" style="text-decoration: underline"> | 93 | <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id]) }}" style="text-decoration: underline"> |
94 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} | 94 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} |
95 | </a> | 95 | </a> |
96 | @else | 96 | @else |
97 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} | 97 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} |
98 | @endif | 98 | @endif |
99 | @else | 99 | @else |
100 | Удаленный пользователь | 100 | Удаленный пользователь |
101 | @endif | 101 | @endif |
102 | <br> | 102 | <br> |
103 | К: @if (isset($it->user_to)) | 103 | К: @if (isset($it->user_to)) |
104 | @if ($it->user_to->id !== $user_id) | 104 | @if ($it->user_to->id !== $user_id) |
105 | <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id]) }}" style="text-decoration: underline"> | 105 | <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id]) }}" style="text-decoration: underline"> |
106 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} | 106 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} |
107 | </a> | 107 | </a> |
108 | @else | 108 | @else |
109 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} | 109 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} |
110 | @endif | 110 | @endif |
111 | @else | 111 | @else |
112 | Удаленный пользователь | 112 | Удаленный пользователь |
113 | @endif | 113 | @endif |
114 | </div> | 114 | </div> |
115 | <div><span>Вакансия:</span>@if (isset($it->vacancies[0])) {{ $it->vacancies[0]->name." (".($it->vacancies[0]->id).")" }} @else Удалена @endif</div> | 115 | <div><span>Вакансия:</span>@if (isset($it->vacancies)) {{ $it->vacancies->name." (".($it->vacancies->id).")" }} @else Удалена @endif</div> |
116 | <div><span>Текст:</span>{{ $it->text }}</div> | 116 | <div><span>Текст:</span>{{ $it->text }}</div> |
117 | </div> | 117 | </div> |
118 | </div> | 118 | </div> |
119 | <div class="messages__item-date">{{ $it->created_at }}</div> | 119 | <div class="messages__item-date">{{ $it->created_at }}</div> |
120 | </div> | 120 | </div> |
121 | @endforeach | 121 | @endforeach |
122 | 122 | ||
123 | <div style="margin-top: 20px"> | 123 | <div style="margin-top: 20px"> |
124 | {{ $messages->onEachSide(0)->appends($_GET)->links('paginate') }} | 124 | {{ $messages->onEachSide(0)->appends($_GET)->links('paginate') }} |
125 | </div><!-- конец --> | 125 | </div><!-- конец --> |
126 | 126 | ||
127 | @else | 127 | @else |
128 | <div class="notify"> | 128 | <div class="notify"> |
129 | <svg> | 129 | <svg> |
130 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> | 130 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> |
131 | </svg> | 131 | </svg> |
132 | <span>Сообщений не найдено</span> | 132 | <span>Сообщений не найдено</span> |
133 | </div> | 133 | </div> |
134 | @endif | 134 | @endif |
135 | </div> | 135 | </div> |
136 | </div> | 136 | </div> |
137 | </div> | 137 | </div> |
138 | </div> | 138 | </div> |
139 | </section> | 139 | </section> |
140 | </div> | 140 | </div> |
141 | <div> | 141 | <div> |
142 | @endsection | 142 | @endsection |
143 | 143 |