Commit 333b515354fba57e171f942a2dcfb6f0212053ee

Authored by Сергей П
1 parent 01ae8538d8
Exists in master

правки

Showing 2 changed files with 21 additions and 16 deletions Inline Diff

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