Commit f4f73f6c1a21dc0c112c288ebb4811f97c75d027

Authored by Андрей Ларионов
1 parent a30fa93a81
Exists in master

Обновление критическое

Showing 10 changed files with 78 additions and 43 deletions Inline Diff

app/Http/Controllers/CompanyController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers; 3 namespace App\Http\Controllers;
4 4
5 use App\Models\Ad_employer; 5 use App\Models\Ad_employer;
6 use App\Models\Employer; 6 use App\Models\Employer;
7 use Illuminate\Http\Request; 7 use Illuminate\Http\Request;
8 8
9 class CompanyController extends Controller 9 class CompanyController extends Controller
10 { 10 {
11 public function shipping_companies(Request $request) { 11 public function shipping_companies(Request $request) {
12 $emps = Employer::query()->with('ads')->where('status_hidden', '=', '0'); 12 $emps = Employer::query()->with('ads')->where('status_hidden', '=', '0');
13 if (($request->has('search')) && (!empty($request->get('search')))) { 13 if (($request->has('search')) && (!empty($request->get('search')))) {
14 $search = $request->get('search'); 14 $search = $request->get('search');
15 $emps = $emps->where('name_company', 'LIKE', "%$search%"); 15 $emps = $emps->where('name_company', 'LIKE', "%$search%");
16 } 16 }
17 17
18 $count_emps = $emps->count(); 18 $count_emps = $emps->count();
19 19
20 if ($request->get('sort')) { 20 if ($request->get('sort')) {
21 $sort = $request->get('sort'); 21 $sort = $request->get('sort');
22 switch ($sort) { 22 switch ($sort) {
23 case 'name_up': $emps = $emps->orderBy('name_company')->orderBy('id'); break; 23 case 'name_up': $emps = $emps->orderBy('name_company')->orderBy('id'); break;
24 case 'name_down': $emps = $emps->orderByDesc('name_company')->orderby('id'); break; 24 case 'name_down': $emps = $emps->orderByDesc('name_company')->orderby('id'); break;
25 case 'created_at_up': $emps = $emps->OrderBy('created_at')->orderBy('id'); break; 25 case 'created_at_up': $emps = $emps->OrderBy('created_at')->orderBy('id'); break;
26 case 'created_at_down': $emps = $emps->orderByDesc('created_at')->orderBy('id'); break; 26 case 'created_at_down': $emps = $emps->orderByDesc('created_at')->orderBy('id'); break;
27 case 'default': $emps = $emps->orderBy('id')->orderby('updated_at'); break; 27 case 'default': $emps = $emps->orderBy('id')->orderby('updated_at'); break;
28 default: $emps = $emps->orderBy('id')->orderby('updated_at'); break; 28 default: $emps = $emps->orderBy('id')->orderby('updated_at'); break;
29 } 29 }
30 } 30 }
31 31
32 $emps = $emps->paginate(4); 32 $emps = $emps->paginate(4);
33 33
34 34
35 if ($request->ajax()) { 35 if ($request->ajax()) {
36 if ($request->get('block') == '1') 36 if ($request->get('block') == '1')
37 return view('ajax.companies', compact('emps', 'count_emps')); 37 return view('ajax.companies', compact('emps', 'count_emps'));
38 else 38 else
39 return view('ajax.companies2', compact('emps', 'count_emps')); 39 return view('ajax.companies2', compact('emps', 'count_emps'));
40 } else { 40 } else {
41 return view('companies', compact('emps', 'count_emps')); 41 return view('companies', compact('emps', 'count_emps'));
42 } 42 }
43 } 43 }
44 44
45 public function info_company(Employer $company) { 45 public function info_company(Employer $company) {
46 if (isset(Auth()->user()->id)) { 46 if (isset(Auth()->user()->id)) {
47 $user_id = Auth()->user()->id; 47 $user_id = Auth()->user()->id;
48 } else { 48 } else {
49 $user_id = 0; 49 $user_id = 0;
50 } 50 }
51
51 $company = Employer::with('ads')->with('flots')->with('users') 52 $company = Employer::with('ads')->with('flots')->with('users')
52 ->where('id', '=', $company->id)->get(); 53 ->where('id', '=', $company->id)->get();
53 54
54 $title = $company[0]->name_company; 55 $title = $company[0]->name_company;
55 56
56 $ads = Ad_employer::query()->with('jobs')->with('jobs_code')-> 57 $ads = Ad_employer::query()->with('jobs')->with('jobs_code')->
57 OrderByDesc('id')-> 58 OrderByDesc('id')->
58 where('employer_id', '=', $company[0]->id)->paginate(2); 59 where('employer_id', '=', $company[0]->id)->paginate(2);
59 60
60 return view('info_company_new', compact('company', 'user_id', 'title', 'ads')); 61 return view('info_company_new', compact('company', 'user_id', 'title', 'ads'));
61 } 62 }
62 } 63 }
63 64
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 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> 167 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')->
168 where('is_remove', '=', '0')-> 168 where('is_remove', '=', '0')->
169 where('is_bd', '=', '0')-> 169 where('is_bd', '=', '0')->
170 get(); 170 get();
171 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 171 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
172 WhereHas('users', 172 WhereHas('users',
173 function (Builder $query) use ($id) { 173 function (Builder $query) use ($id) {
174 $query->Where('id', $id); 174 $query->Where('id', $id);
175 })->get(); 175 })->get();
176 return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); 176 return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories'));
177 } else { 177 } else {
178 return redirect()->route('employer.cabinet_vacancie_danger'); 178 return redirect()->route('employer.cabinet_vacancie_danger');
179 } 179 }
180 } 180 }
181 181
182 // Форма предупреждения об оплате 182 // Форма предупреждения об оплате
183 public function cabinet_vacancie_danger() { 183 public function cabinet_vacancie_danger() {
184 return view('employers.add_vacancy_danger'); 184 return view('employers.add_vacancy_danger');
185 } 185 }
186 186
187 // Сохранение вакансии 187 // Сохранение вакансии
188 public function cabinet_vacancy_save1(VacancyRequestEdit $request) { 188 public function cabinet_vacancy_save1(VacancyRequestEdit $request) {
189 $params_emp = $request->all(); 189 $params_emp = $request->all();
190 190
191 $params_job["job_title_id"] = $params_emp['job_title_id']; 191 $params_job["job_title_id"] = $params_emp['job_title_id'];
192 //$params_job["min_salary"] = $params_emp['min_salary']; 192 //$params_job["min_salary"] = $params_emp['min_salary'];
193 //$params_job["max_salary"] = $params_emp['max_salary']; 193 //$params_job["max_salary"] = $params_emp['max_salary'];
194 //$params_job["region"] = $params_emp['region']; 194 //$params_job["region"] = $params_emp['region'];
195 //$params_job["power"] = $params_emp['power']; 195 //$params_job["power"] = $params_emp['power'];
196 //$params_job["sytki"] = $params_emp['sytki']; 196 //$params_job["sytki"] = $params_emp['sytki'];
197 //$params_job["start"] = $params_emp['start']; 197 //$params_job["start"] = $params_emp['start'];
198 //$params_job["flot"] = $params_emp['flot']; 198 //$params_job["flot"] = $params_emp['flot'];
199 //$params_job["description"] = $params_emp['description']; 199 //$params_job["description"] = $params_emp['description'];
200 200
201 $ad_jobs = Ad_employer::create($params_emp); 201 $ad_jobs = Ad_employer::create($params_emp);
202 //$params_job['ad_employer_id'] = $ad_jobs->id; 202 //$params_job['ad_employer_id'] = $ad_jobs->id;
203 //Ad_jobs::create($params_job); 203 //Ad_jobs::create($params_job);
204 $ad_jobs->jobs()->sync($request->get('job_title_id')); 204 $ad_jobs->jobs()->sync($request->get('job_title_id'));
205 205
206 return redirect()->route('employer.vacancy_list'); 206 return redirect()->route('employer.vacancy_list');
207 } 207 }
208 208
209 // Список вакансий 209 // Список вакансий
210 public function vacancy_list(Request $request) { 210 public function vacancy_list(Request $request) {
211 $id = Auth()->user()->id; 211 $id = Auth()->user()->id;
212 212
213 //dd($request->all()); 213 //dd($request->all());
214 $Employer = Employer::query()->where('user_id', $id)->first(); 214 $Employer = Employer::query()->where('user_id', $id)->first();
215 $vacancy_list = Ad_employer::query()->with('jobs')-> 215 $vacancy_list = Ad_employer::query()->with('jobs')->
216 with('jobs_code')-> 216 with('jobs_code')->
217 where('employer_id', $Employer->id); 217 where('employer_id', $Employer->id);
218 218
219 if (($request->has('search')) && (!empty($request->get('search')))) { 219 if (($request->has('search')) && (!empty($request->get('search')))) {
220 $search = $request->get('search'); 220 $search = $request->get('search');
221 $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); 221 $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%");
222 } 222 }
223 223
224 if ($request->get('sort')) { 224 if ($request->get('sort')) {
225 $sort = $request->get('sort'); 225 $sort = $request->get('sort');
226 switch ($sort) { 226 switch ($sort) {
227 case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; 227 case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break;
228 case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; 228 case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break;
229 case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; 229 case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break;
230 case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; 230 case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break;
231 case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; 231 case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break;
232 default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; 232 default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break;
233 } 233 }
234 } 234 }
235 $vacancy_list = $vacancy_list->paginate(4); 235 $vacancy_list = $vacancy_list->paginate(4);
236 236
237 //ajax 237 //ajax
238 if ($request->ajax()) { 238 if ($request->ajax()) {
239 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); 239 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer'));
240 } else { 240 } else {
241 return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); 241 return view('employers.list_vacancy', compact('vacancy_list', 'Employer'));
242 } 242 }
243 } 243 }
244 244
245 // Карточка вакансии 245 // Карточка вакансии
246 public function vacancy_edit(Ad_employer $ad_employer) { 246 public function vacancy_edit(Ad_employer $ad_employer) {
247 $id = Auth()->user()->id; 247 $id = Auth()->user()->id;
248 $Positions = Category::query()->where('is_remove', '=', '0')->get(); 248 $Positions = Category::query()->where('is_remove', '=', '0')->get();
249 249
250 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> 250 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')->
251 where('is_remove', '=', '0')-> 251 where('is_remove', '=', '0')->
252 where('is_bd', '=', '0')->get(); 252 where('is_bd', '=', '0')->get();
253 253
254 $Employer = Employer::query()->with('users')->with('ads')-> 254 $Employer = Employer::query()->with('users')->with('ads')->
255 with('flots')->where('user_id', $id)->first(); 255 with('flots')->where('user_id', $id)->first();
256 256
257 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); 257 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs'));
258 } 258 }
259 259
260 // Сохранение-редактирование записи 260 // Сохранение-редактирование записи
261 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { 261 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) {
262 $params = $request->all(); 262 $params = $request->all();
263 $params_job["job_title_id"] = $params['job_title_id']; 263 $params_job["job_title_id"] = $params['job_title_id'];
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 //dd($params);
270 $ad_employer->update($params); 270 $ad_employer->update($params);
271 $ad_employer->jobs()->sync($request->get('job_title_id')); 271 $ad_employer->jobs()->sync($request->get('job_title_id'));
272 272
273 //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> 273 //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])->
274 // where('ad_employer_id', $ad_employer->id)->first(); 274 // where('ad_employer_id', $ad_employer->id)->first();
275 //$data = Ad_jobs::find($job_->id); 275 //$data = Ad_jobs::find($job_->id);
276 //$ad_jobs = $data->update($jobs); 276 //$ad_jobs = $data->update($jobs);
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 $count_input = $messages_input->count(); 351 $count_input = $messages_input->count();
352 $count_output = $messages_output->count(); 352 $count_output = $messages_output->count();
353 353
354 if ($type_message == 'input') { 354 if ($type_message == 'input') {
355 $messages = $messages_input->paginate(5); 355 $messages = $messages_input->paginate(5);
356 } 356 }
357 357
358 if ($type_message == 'output') { 358 if ($type_message == 'output') {
359 $messages = $messages_output->paginate(5); 359 $messages = $messages_output->paginate(5);
360 } 360 }
361 361
362 //dd($user_id, $messages[2]->vacancies); 362 //dd($user_id, $messages[2]->vacancies);
363 //jobs); 363 //jobs);
364 364
365 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'));
366 } 366 }
367 367
368 // Диалог между пользователями 368 // Диалог между пользователями
369 public function dialog(Request $request, User_Model $user1, User_Model $user2) { 369 public function dialog(Request $request, User_Model $user1, User_Model $user2) {
370 // Получение параметров. 370 // Получение параметров.
371 if ($request->has('ad_employer')){ 371 if ($request->has('ad_employer')){
372 $ad_employer = $request->get('ad_employer'); 372 $ad_employer = $request->get('ad_employer');
373 } else { 373 } else {
374 $ad_employer = 0; 374 $ad_employer = 0;
375 } 375 }
376 376
377 if (isset($user2->id)) { 377 if (isset($user2->id)) {
378 $companion = User_Model::query()->with('workers')-> 378 $companion = User_Model::query()->with('workers')->
379 with('employers')-> 379 with('employers')->
380 where('id', $user2->id)->first(); 380 where('id', $user2->id)->first();
381 } 381 }
382 382
383 $Messages = Message::query()-> 383 $Messages = Message::query()->
384 where('ad_employer_id', '=', $ad_employer)-> 384 where('ad_employer_id', '=', $ad_employer)->
385 where(function($query) use ($user1, $user2) { 385 where(function($query) use ($user1, $user2) {
386 $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);
387 })->orWhere(function($query) use ($user1, $user2) { 387 })->orWhere(function($query) use ($user1, $user2) {
388 $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);
389 })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get(); 389 })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get();
390 390
391 $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; 391 $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id;
392 392
393 //$ad_employer = null; 393 //$ad_employer = null;
394 //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();
395 $sender = $user1; 395 $sender = $user1;
396 396
397 return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); 397 return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages'));
398 } 398 }
399 399
400 // Регистрация работодателя 400 // Регистрация работодателя
401 public function register_employer(Request $request) { 401 public function register_employer(Request $request) {
402 $params = $request->all(); 402 $params = $request->all();
403 403
404 $rules = [ 404 $rules = [
405 //'surname' => ['required', 'string', 'max:255'], 405 //'surname' => ['required', 'string', 'max:255'],
406 //'name_man' => ['required', 'string', 'max:255'], 406 //'name_man' => ['required', 'string', 'max:255'],
407 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 407 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
408 'name_company' => ['required', 'string', 'max:255'], 408 'name_company' => ['required', 'string', 'max:255'],
409 'password' => ['required', 'string', 'min:6'], 409 'password' => ['required', 'string', 'min:6'],
410 ]; 410 ];
411 411
412 412
413 $messages = [ 413 $messages = [
414 'required' => 'Укажите обязательное поле', 414 'required' => 'Укажите обязательное поле',
415 'min' => [ 415 'min' => [
416 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 416 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
417 'integer' => 'Поле «:attribute» должно быть :min или больше', 417 'integer' => 'Поле «:attribute» должно быть :min или больше',
418 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 418 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
419 ], 419 ],
420 'max' => [ 420 'max' => [
421 'string' => 'Поле «:attribute» должно быть не больше :max символов', 421 'string' => 'Поле «:attribute» должно быть не больше :max символов',
422 'integer' => 'Поле «:attribute» должно быть :max или меньше', 422 'integer' => 'Поле «:attribute» должно быть :max или меньше',
423 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 423 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
424 ] 424 ]
425 ]; 425 ];
426 426
427 $email = $request->get('email'); 427 $email = $request->get('email');
428 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)) {
429 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); 429 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл"));
430 } 430 }
431 431
432 if ($request->get('password') !== $request->get('confirmed')){ 432 if ($request->get('password') !== $request->get('confirmed')){
433 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); 433 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля"));
434 } 434 }
435 435
436 if (strlen($request->get('password')) < 6) { 436 if (strlen($request->get('password')) < 6) {
437 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); 437 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!"));
438 } 438 }
439 /* 439 /*
440 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); 440 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?');
441 $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',
442 'X', 'C', 'V', 'B', 'N', 'M'); 442 'X', 'C', 'V', 'B', 'N', 'M');
443 $spec_bool = false; 443 $spec_bool = false;
444 $alpha_bool = false; 444 $alpha_bool = false;
445 445
446 $haystack = $request->get('password'); 446 $haystack = $request->get('password');
447 447
448 foreach ($specsumbol as $it) { 448 foreach ($specsumbol as $it) {
449 if (strpos($haystack, $it) !== false) { 449 if (strpos($haystack, $it) !== false) {
450 $spec_bool = true; 450 $spec_bool = true;
451 } 451 }
452 } 452 }
453 453
454 foreach ($alpha as $it) { 454 foreach ($alpha as $it) {
455 if (strpos($haystack, $it) !== false) { 455 if (strpos($haystack, $it) !== false) {
456 $alpha_bool = true; 456 $alpha_bool = true;
457 } 457 }
458 } 458 }
459 459
460 if ((!$spec_bool) || (!$alpha_bool)) { 460 if ((!$spec_bool) || (!$alpha_bool)) {
461 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); 461 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?"));
462 }*/ 462 }*/
463 463
464 if (empty($request->get('surname'))) { 464 if (empty($request->get('surname'))) {
465 $params['surname'] = 'Неизвестно'; 465 $params['surname'] = 'Неизвестно';
466 } 466 }
467 if (empty($request->get('name_man'))) { 467 if (empty($request->get('name_man'))) {
468 $params['name_man'] = 'Неизвестно'; 468 $params['name_man'] = 'Неизвестно';
469 } 469 }
470 $validator = Validator::make($params, $rules, $messages); 470 $validator = Validator::make($params, $rules, $messages);
471 471
472 if ($validator->fails()) { 472 if ($validator->fails()) {
473 return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); 473 return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе."));
474 } else { 474 } else {
475 $user = $this->create($params); 475 $user = $this->create($params);
476 event(new Registered($user)); 476 event(new Registered($user));
477 Auth::guard()->login($user); 477 Auth::guard()->login($user);
478 } 478 }
479 479
480 if ($user) { 480 if ($user) {
481 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; 481 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));;
482 } else { 482 } else {
483 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); 483 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!"));
484 } 484 }
485 } 485 }
486 486
487 // Создание пользователя 487 // Создание пользователя
488 protected function create(array $data) 488 protected function create(array $data)
489 { 489 {
490 $Use = new User_Model(); 490 $Use = new User_Model();
491 $Code_user = $Use->create([ 491 $Code_user = $Use->create([
492 'name' => $data['surname']." ".$data['name_man'], 492 'name' => $data['surname']." ".$data['name_man'],
493 'name_man' => $data['name_man'], 493 'name_man' => $data['name_man'],
494 'surname' => $data['surname'], 494 'surname' => $data['surname'],
495 'surname2' => $data['surname2'], 495 'surname2' => $data['surname2'],
496 'subscribe_email' => $data['email'], 496 'subscribe_email' => $data['email'],
497 'email' => $data['email'], 497 'email' => $data['email'],
498 'telephone' => $data['telephone'], 498 'telephone' => $data['telephone'],
499 'is_worker' => 0, 499 'is_worker' => 0,
500 'password' => Hash::make($data['password']), 500 'password' => Hash::make($data['password']),
501 'pubpassword' => base64_encode($data['password']), 501 'pubpassword' => base64_encode($data['password']),
502 'email_verified_at' => Carbon::now() 502 'email_verified_at' => Carbon::now()
503 ]); 503 ]);
504 504
505 if ($Code_user->id > 0) { 505 if ($Code_user->id > 0) {
506 $Employer = new Employer(); 506 $Employer = new Employer();
507 $Employer->user_id = $Code_user->id; 507 $Employer->user_id = $Code_user->id;
508 $Employer->name_company = $data['name_company']; 508 $Employer->name_company = $data['name_company'];
509 $Employer->email = $data['email']; 509 $Employer->email = $data['email'];
510 $Employer->telephone = $data['telephone']; 510 $Employer->telephone = $data['telephone'];
511 $Employer->code = Tools::generator_id(10); 511 $Employer->code = Tools::generator_id(10);
512 $Employer->save(); 512 $Employer->save();
513 513
514 return $Code_user; 514 return $Code_user;
515 } 515 }
516 } 516 }
517 517
518 // Отправка сообщения от работодателя 518 // Отправка сообщения от работодателя
519 public function send_message(MessagesRequiest $request) { 519 public function send_message(MessagesRequiest $request) {
520 $params = $request->all(); 520 $params = $request->all();
521 dd($params); 521 dd($params);
522 $user1 = $params['user_id']; 522 $user1 = $params['user_id'];
523 $user2 = $params['to_user_id']; 523 $user2 = $params['to_user_id'];
524 524
525 if ($request->has('file')) { 525 if ($request->has('file')) {
526 $params['file'] = $request->file('file')->store("messages", 'public'); 526 $params['file'] = $request->file('file')->store("messages", 'public');
527 } 527 }
528 Message::create($params); 528 Message::create($params);
529 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); 529 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
530 } 530 }
531 531
532 public function test123(Request $request) { 532 public function test123(Request $request) {
533 $params = $request->all(); 533 $params = $request->all();
534 $user1 = $params['user_id']; 534 $user1 = $params['user_id'];
535 $user2 = $params['to_user_id']; 535 $user2 = $params['to_user_id'];
536 $id_vacancy = $params['ad_employer_id']; 536 $id_vacancy = $params['ad_employer_id'];
537 $ad_name = $params['ad_name']; 537 $ad_name = $params['ad_name'];
538 538
539 $rules = [ 539 $rules = [
540 'text' => 'required|min:1|max:150000', 540 'text' => 'required|min:1|max:150000',
541 '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'
542 ]; 542 ];
543 $messages = [ 543 $messages = [
544 'required' => 'Укажите обязательное поле', 544 'required' => 'Укажите обязательное поле',
545 'min' => [ 545 'min' => [
546 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 546 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
547 'integer' => 'Поле «:attribute» должно быть :min или больше', 547 'integer' => 'Поле «:attribute» должно быть :min или больше',
548 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 548 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
549 ], 549 ],
550 'max' => [ 550 'max' => [
551 'string' => 'Поле «:attribute» должно быть не больше :max символов', 551 'string' => 'Поле «:attribute» должно быть не больше :max символов',
552 'integer' => 'Поле «:attribute» должно быть :max или меньше', 552 'integer' => 'Поле «:attribute» должно быть :max или меньше',
553 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 553 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
554 ] 554 ]
555 ]; 555 ];
556 556
557 $validator = Validator::make($request->all(), $rules, $messages); 557 $validator = Validator::make($request->all(), $rules, $messages);
558 558
559 if ($validator->fails()) { 559 if ($validator->fails()) {
560 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) 560 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2])
561 ->withErrors($validator); 561 ->withErrors($validator);
562 } else { 562 } else {
563 if ($request->has('file')) { 563 if ($request->has('file')) {
564 $params['file'] = $request->file('file')->store("messages", 'public'); 564 $params['file'] = $request->file('file')->store("messages", 'public');
565 } 565 }
566 Message::create($params); 566 Message::create($params);
567 //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', 568 return redirect()->route('employer.dialog',
569 ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]); 569 ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]);
570 570
571 } 571 }
572 } 572 }
573 573
574 //Избранные люди 574 //Избранные люди
575 public function favorites(Request $request) { 575 public function favorites(Request $request) {
576 $IP_address = RusDate::ip_addr_client(); 576 $IP_address = RusDate::ip_addr_client();
577 $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();
578 578
579 if ($Arr->count()) { 579 if ($Arr->count()) {
580 $A = Array(); 580 $A = Array();
581 foreach ($Arr as $it) { 581 foreach ($Arr as $it) {
582 $A[] = $it->code_record; 582 $A[] = $it->code_record;
583 } 583 }
584 584
585 $Workers = Worker::query()->whereIn('id', $A); 585 $Workers = Worker::query()->whereIn('id', $A);
586 } else { 586 } else {
587 $Workers = Worker::query()->where('id', '=', '0'); 587 $Workers = Worker::query()->where('id', '=', '0');
588 } 588 }
589 589
590 if (($request->has('search')) && (!empty($request->get('search')))) { 590 if (($request->has('search')) && (!empty($request->get('search')))) {
591 $search = $request->get('search'); 591 $search = $request->get('search');
592 592
593 $Workers = $Workers->WhereHas('users', 593 $Workers = $Workers->WhereHas('users',
594 function (Builder $query) use ($search) { 594 function (Builder $query) use ($search) {
595 $query->Where('surname', 'LIKE', "%$search%") 595 $query->Where('surname', 'LIKE', "%$search%")
596 ->orWhere('name_man', 'LIKE', "%$search%") 596 ->orWhere('name_man', 'LIKE', "%$search%")
597 ->orWhere('surname2', 'LIKE', "%$search%"); 597 ->orWhere('surname2', 'LIKE', "%$search%");
598 }); 598 });
599 } else { 599 } else {
600 $Workers = $Workers->with('users'); 600 $Workers = $Workers->with('users');
601 } 601 }
602 602
603 $Workers = $Workers->get(); 603 $Workers = $Workers->get();
604 604
605 605
606 return view('employers.favorite', compact('Workers')); 606 return view('employers.favorite', compact('Workers'));
607 } 607 }
608 608
609 // База данных 609 // База данных
610 public function bd(Request $request) { 610 public function bd(Request $request) {
611 // для типа BelongsTo 611 // для типа BelongsTo
612 //$documents = Document::query()->orderBy(Location::select('name') 612 //$documents = Document::query()->orderBy(Location::select('name')
613 // ->whereColumn('locations.id', 'documents.location_id') 613 // ->whereColumn('locations.id', 'documents.location_id')
614 //); 614 //);
615 615
616 // для типа HasOne/Many 616 // для типа HasOne/Many
617 // $documents = Document::::query()->orderBy(Location::select('name') 617 // $documents = Document::::query()->orderBy(Location::select('name')
618 // ->whereColumn('locations.document_id', 'documents.id') 618 // ->whereColumn('locations.document_id', 'documents.id')
619 //); 619 //);
620 620
621 621
622 $users = User_Model::query()->with('workers'); 622 $users = User_Model::query()->with('workers');
623 623
624 if ($request->has('search')) { 624 if ($request->has('search')) {
625 $find_key = $request->get('search'); 625 $find_key = $request->get('search');
626 $users = $users->where('name', 'LIKE', "%$find_key%") 626 $users = $users->where('name', 'LIKE', "%$find_key%")
627 ->orWhere('surname', 'LIKE', "%$find_key%") 627 ->orWhere('surname', 'LIKE', "%$find_key%")
628 ->orWhere('name_man', 'LIKE', "%$find_key%") 628 ->orWhere('name_man', 'LIKE', "%$find_key%")
629 ->orWhere('email', 'LIKE', "%$find_key%") 629 ->orWhere('email', 'LIKE', "%$find_key%")
630 ->orWhere('telephone', 'LIKE', "%$find_key%"); 630 ->orWhere('telephone', 'LIKE', "%$find_key%");
631 } 631 }
632 632
633 // Данные 633 // Данные
634 $users = $users->Baseuser()-> 634 $users = $users->Baseuser()->
635 orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id')); 635 orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id'));
636 $count_users = $users; 636 $count_users = $users;
637 $users = $users->paginate(5); 637 $users = $users->paginate(5);
638 638
639 639
640 return view('employers.bd', compact('users', 'count_users')); 640 return view('employers.bd', compact('users', 'count_users'));
641 } 641 }
642 642
643 //Настройка уведомлений 643 //Настройка уведомлений
644 public function subscribe() { 644 public function subscribe() {
645 return view('employers.subcribe'); 645 return view('employers.subcribe');
646 } 646 }
647 647
648 //Установка уведомлений сохранение 648 //Установка уведомлений сохранение
649 public function save_subscribe(Request $request) { 649 public function save_subscribe(Request $request) {
650 dd($request->all()); 650 dd($request->all());
651 $msg = $request->validate([ 651 $msg = $request->validate([
652 'subscribe_email' => 'required|email|min:5|max:255', 652 'subscribe_email' => 'required|email|min:5|max:255',
653 ]); 653 ]);
654 return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); 654 return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку');
655 } 655 }
656 656
657 //Сбросить форму с паролем 657 //Сбросить форму с паролем
658 public function password_reset() { 658 public function password_reset() {
659 $email = Auth()->user()->email; 659 $email = Auth()->user()->email;
660 return view('employers.password-reset', compact('email')); 660 return view('employers.password-reset', compact('email'));
661 } 661 }
662 662
663 //Обновление пароля 663 //Обновление пароля
664 public function new_password(Request $request) { 664 public function new_password(Request $request) {
665 $use = Auth()->user(); 665 $use = Auth()->user();
666 $request->validate([ 666 $request->validate([
667 'password' => 'required|string', 667 'password' => 'required|string',
668 'new_password' => 'required|string', 668 'new_password' => 'required|string',
669 'new_password2' => 'required|string' 669 'new_password2' => 'required|string'
670 ]); 670 ]);
671 671
672 if ($request->get('new_password') == $request->get('new_password2')) 672 if ($request->get('new_password') == $request->get('new_password2'))
673 if ($request->get('password') !== $request->get('new_password')) { 673 if ($request->get('password') !== $request->get('new_password')) {
674 $credentials = $request->only('email', 'password'); 674 $credentials = $request->only('email', 'password');
675 if (Auth::attempt($credentials)) { 675 if (Auth::attempt($credentials)) {
676 676
677 if (!is_null($use->email_verified_at)){ 677 if (!is_null($use->email_verified_at)){
678 678
679 $user_data = User_Model::find($use->id); 679 $user_data = User_Model::find($use->id);
680 $user_data->update([ 680 $user_data->update([
681 'password' => Hash::make($request->get('new_password')), 681 'password' => Hash::make($request->get('new_password')),
682 'pubpassword' => base64_encode($request->get('new_password')), 682 'pubpassword' => base64_encode($request->get('new_password')),
683 ]); 683 ]);
684 return redirect() 684 return redirect()
685 ->route('employer.password_reset') 685 ->route('employer.password_reset')
686 ->with('success', 'Поздравляю! Вы обновили свой пароль!'); 686 ->with('success', 'Поздравляю! Вы обновили свой пароль!');
687 } 687 }
688 688
689 return redirect() 689 return redirect()
690 ->route('employer.password_reset') 690 ->route('employer.password_reset')
691 ->withError('Данная учетная запись не было верифицированна!'); 691 ->withError('Данная учетная запись не было верифицированна!');
692 } 692 }
693 } 693 }
694 694
695 return redirect() 695 return redirect()
696 ->route('employer.password_reset') 696 ->route('employer.password_reset')
697 ->withErrors('Не совпадение данных, обновите пароли!'); 697 ->withErrors('Не совпадение данных, обновите пароли!');
698 } 698 }
699 699
700 700
701 701
702 // Форма Удаление пипла 702 // Форма Удаление пипла
703 public function delete_people() { 703 public function delete_people() {
704 $login = Auth()->user()->email; 704 $login = Auth()->user()->email;
705 return view('employers.delete_people', compact('login')); 705 return view('employers.delete_people', compact('login'));
706 } 706 }
707 707
708 // Удаление аккаунта 708 // Удаление аккаунта
709 public function action_delete_user(Request $request) { 709 public function action_delete_user(Request $request) {
710 $Answer = $request->all(); 710 $Answer = $request->all();
711 $user_id = Auth()->user()->id; 711 $user_id = Auth()->user()->id;
712 $request->validate([ 712 $request->validate([
713 'password' => 'required|string', 713 'password' => 'required|string',
714 ]); 714 ]);
715 715
716 $credentials = $request->only('email', 'password'); 716 $credentials = $request->only('email', 'password');
717 if (Auth::attempt($credentials)) { 717 if (Auth::attempt($credentials)) {
718 Auth::logout(); 718 Auth::logout();
719 $it = User_Model::find($user_id); 719 $it = User_Model::find($user_id);
720 $it->delete(); 720 $it->delete();
721 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); 721 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт');
722 } else { 722 } else {
723 return redirect()->route('employer.delete_people') 723 return redirect()->route('employer.delete_people')
724 ->withErrors( 'Неверный пароль! Нужен корректный пароль'); 724 ->withErrors( 'Неверный пароль! Нужен корректный пароль');
725 } 725 }
726 } 726 }
727 727
728 public function ajax_delete_user(Request $request) { 728 public function ajax_delete_user(Request $request) {
729 $Answer = $request->all(); 729 $Answer = $request->all();
730 $user_id = Auth()->user()->id; 730 $user_id = Auth()->user()->id;
731 $request->validate([ 731 $request->validate([
732 'password' => 'required|string', 732 'password' => 'required|string',
733 ]); 733 ]);
734 $credentials = $request->only('email', 'password'); 734 $credentials = $request->only('email', 'password');
735 if (Auth::attempt($credentials)) { 735 if (Auth::attempt($credentials)) {
736 736
737 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', 737 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт',
738 'email' => $request->get('email'), 738 'email' => $request->get('email'),
739 'password' => $request->get('password'))); 739 'password' => $request->get('password')));
740 } else { 740 } else {
741 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); 741 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль'));
742 } 742 }
743 } 743 }
744 744
745 // FAQ - Вопросы/ответы для работодателей и соискателей 745 // FAQ - Вопросы/ответы для работодателей и соискателей
746 public function faq() { 746 public function faq() {
747 return view('employers.faq'); 747 return view('employers.faq');
748 } 748 }
749 749
750 // Рассылка сообщений 750 // Рассылка сообщений
751 public function send_all_messages() { 751 public function send_all_messages() {
752 $id = Auth()->user()->id; 752 $id = Auth()->user()->id;
753 $sending = Employer::query()->where('user_id', '=', "$id")->first(); 753 $sending = Employer::query()->where('user_id', '=', "$id")->first();
754 754
755 if ($sending->sending_is) 755 if ($sending->sending_is)
756 return view('employers.send_all'); 756 return view('employers.send_all');
757 else 757 else
758 return view('employers.send_all_danger'); 758 return view('employers.send_all_danger');
759 } 759 }
760 760
761 // Отправка сообщений для информации 761 // Отправка сообщений для информации
762 public function send_all_post(Request $request) { 762 public function send_all_post(Request $request) {
763 $data = $request->all(); 763 $data = $request->all();
764 764
765 $emails = User_Model::query()->where('is_worker', '1')->get(); 765 $emails = User_Model::query()->where('is_worker', '1')->get();
766 766
767 foreach ($emails as $e) { 767 foreach ($emails as $e) {
768 Mail::to($e->email)->send(new SendAllMessages($data)); 768 Mail::to($e->email)->send(new SendAllMessages($data));
769 } 769 }
770 770
771 return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); 771 return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены');
772 } 772 }
773 773
774 // База резюме 774 // База резюме
775 public function bd_tupe(Request $request) { 775 public function bd_tupe(Request $request) {
776 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); 776 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get();
777 777
778 return view('employers.bd_tupe', compact('Resume')); 778 return view('employers.bd_tupe', compact('Resume'));
779 } 779 }
780 780
781 ////////////////////////////////////////////////////////////////// 781 //////////////////////////////////////////////////////////////////
782 // Отправил сообщение 782 // Отправил сообщение
783 ////////////////////////////////////////////////////////////////// 783 //////////////////////////////////////////////////////////////////
784 public function new_message(Request $request) { 784 public function new_message(Request $request) {
785 $params = $request->all(); 785 $params = $request->all();
786 $id = $params['_user_id']; 786 $id = $params['_user_id'];
787 $message = new Message(); 787 $message = new Message();
788 $message->user_id = $params['_user_id']; 788 $message->user_id = $params['_user_id'];
789 $message->to_user_id = $params['_to_user_id']; 789 $message->to_user_id = $params['_to_user_id'];
790 $message->title = $params['title']; 790 $message->title = $params['title'];
791 $message->text = $params['text']; 791 $message->text = $params['text'];
792 if ($request->has('_file')) { 792 if ($request->has('_file')) {
793 $message->file = $request->file('_file')->store("worker/$id", 'public'); 793 $message->file = $request->file('_file')->store("worker/$id", 'public');
794 } 794 }
795 $message->ad_employer_id = $params['_vacancy']; 795 $message->ad_employer_id = $params['_vacancy'];
796 $message->flag_new = 1; 796 $message->flag_new = 1;
797 $id_message = $message->save(); 797 $id_message = $message->save();
798 798
799 //$data['message_id'] = $id_message; 799 //$data['message_id'] = $id_message;
800 //$data['ad_employer_id'] = $params['_vacancy']; 800 //$data['ad_employer_id'] = $params['_vacancy'];
801 //$data['job_title_id'] = 0; 801 //$data['job_title_id'] = 0;
802 802
803 $data['flag'] = 1; 803 $data['flag'] = 1;
804 //$ad_responce = ad_response::create($data); 804 //$ad_responce = ad_response::create($data);
805 return redirect()->route('employer.messages', ['type_message' => 'output']); 805 return redirect()->route('employer.messages', ['type_message' => 'output']);
806 } 806 }
807 807
808 // Восстановление пароля 808 // Восстановление пароля
809 public function repair_password(Request $request) { 809 public function repair_password(Request $request) {
810 $params = $request->get('email'); 810 $params = $request->get('email');
811 } 811 }
812 812
813 // Избранные люди на корабль 813 // Избранные люди на корабль
814 public function selected_people(Request $request) { 814 public function selected_people(Request $request) {
815 $id = $request->get('id'); 815 $id = $request->get('id');
816 $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> 816 $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')->
817 where('is_remove', '=', '0')-> 817 where('is_remove', '=', '0')->
818 where('is_bd', '=', '0')-> 818 where('is_bd', '=', '0')->
819 where('position_id', $id)-> 819 where('position_id', $id)->
820 get(); 820 get();
821 return view('favorite_people', compact('favorite_people')); 821 return view('favorite_people', compact('favorite_people'));
822 } 822 }
823 } 823 }
824 824
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('sort')->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')->orderByDesc('sort')->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 172
173 /*$BigFlot = Array(); 173 /*$BigFlot = Array();
174 foreach ($Position as $position) { 174 foreach ($Position as $position) {
175 $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 $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')->
176 orderBy('job_titles.sort')-> 176 orderBy('job_titles.sort')->
177 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> 177 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')->
178 where('position_ship', "$position->name"); 178 where('position_ship', "$position->name");
179 if (($request->has('job')) && ($request->get('job') > 0)) { 179 if (($request->has('job')) && ($request->get('job') > 0)) {
180 $War_flot = $War_flot->where('job_title_id', $request->get('job')); 180 $War_flot = $War_flot->where('job_title_id', $request->get('job'));
181 } 181 }
182 $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); 182 $War_flot = $War_flot->groupby('job_title_id','position_ship')->get();
183 $BigFlot[] = $War_flot; 183 $BigFlot[] = $War_flot;
184 }*/ 184 }*/
185 /* 185 /*
186 $BigFlot = Array(); 186 $BigFlot = Array();
187 foreach ($Position as $position) { 187 foreach ($Position as $position) {
188 $WarFlot = DB::table('ad_jobs')-> 188 $WarFlot = DB::table('ad_jobs')->
189 selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> 189 selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')->
190 orderByDesc('job_titles.sort')-> 190 orderByDesc('job_titles.sort')->
191 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> 191 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')->
192 where('job_titles.position_id', $position->id); 192 where('job_titles.position_id', $position->id);
193 if (($request->has('job')) && ($request->get('job') > 0)) { 193 if (($request->has('job')) && ($request->get('job') > 0)) {
194 $WarFlot = $WarFlot->where('job_title_id', $request->get('job')); 194 $WarFlot = $WarFlot->where('job_title_id', $request->get('job'));
195 } 195 }
196 $WarFlot = $WarFlot->groupby('job_title_id')->get(); 196 $WarFlot = $WarFlot->groupby('job_title_id')->get();
197 $BigFlot[] = $WarFlot; 197 $BigFlot[] = $WarFlot;
198 } 198 }
199 */ 199 */
200 200
201 $Data = DB::table('job_titles')-> 201 $Data = DB::table('job_titles')->
202 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 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')->
203 where('categories.is_remove', '=', '0')-> 203 where('categories.is_remove', '=', '0')->
204 where('job_titles.is_bd', '=' , '0')-> 204 where('job_titles.is_bd', '=' , '0')->
205 where('job_titles.is_remove', '=', '0'); 205 where('job_titles.is_remove', '=', '0');
206 if (($request->has('job')) && ($request->get('job') > 0)) { 206 if (($request->has('job')) && ($request->get('job') > 0)) {
207 $Data = $Data->where('job_title_id', $request->get('job')); 207 $Data = $Data->where('job_title_id', $request->get('job'));
208 } 208 }
209 $Data = $Data->leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> 209 $Data = $Data->leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')->
210 join('categories', 'categories.id', '=', 'job_titles.position_id')-> 210 join('categories', 'categories.id', '=', 'job_titles.position_id')->
211 groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')-> 211 groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')->
212 orderByDesc('job_titles.sort')->get()->toArray(); 212 orderByDesc('job_titles.sort')->get()->toArray();
213 213
214 $Main_Job = array(); 214 $Main_Job = array();
215 $name_cat = ''; 215 $name_cat = '';
216 foreach ($Data as $it) { 216 foreach ($Data as $it) {
217 $it_arr = (array)$it; 217 $it_arr = (array)$it;
218 if ($name_cat != $it_arr['catname']) 218 if ($name_cat != $it_arr['catname'])
219 $name_cat = $it_arr['catname']; 219 $name_cat = $it_arr['catname'];
220 $Main_Job[$name_cat][] = $it_arr; 220 $Main_Job[$name_cat][] = $it_arr;
221 } 221 }
222 222
223 if ($request->ajax()) { 223 if ($request->ajax()) {
224 return view('ajax.new_sky', compact('categories', 'Main_Job')); 224 return view('ajax.new_sky', compact('categories', 'Main_Job'));
225 } else { 225 } else {
226 return view('new_sky', compact('Job_title', 'categories', 'Main_Job')); 226 return view('new_sky', compact('Job_title', 'categories', 'Main_Job'));
227 } 227 }
228 } 228 }
229 229
230 //Вакансии категория детальная 230 //Вакансии категория детальная
231 public function list_vacancies(Category $categories, Request $request) { 231 public function list_vacancies(Category $categories, Request $request) {
232 if (isset(Auth()->user()->id)) 232 if (isset(Auth()->user()->id))
233 $uid = Auth()->user()->id; 233 $uid = Auth()->user()->id;
234 else 234 else
235 $uid = 0; 235 $uid = 0;
236 236
237 if ($request->get('job') == 0) 237 if ($request->get('job') == 0)
238 $job_search = ''; 238 $job_search = '';
239 else 239 else
240 $job_search = $request->get('job'); 240 $job_search = $request->get('job');
241 241
242 $Query = Ad_employer::with('jobs')-> 242 $Query = Ad_employer::with('jobs')->
243 with('cat')-> 243 with('cat')->
244 with('employer')-> 244 with('employer')->
245
246 whereHas('jobs_code', function ($query) use ($job_search) { 245 whereHas('jobs_code', function ($query) use ($job_search) {
247 if (!empty($job_search)) { 246 if (!empty($job_search)) {
248 $query->where('job_title_id', $job_search); 247 $query->where('job_title_id', $job_search);
249 } 248 }
250 })->select('ad_employers.*'); 249 })->select('ad_employers.*');
251 250
252 if (isset($categories->id) && ($categories->id > 0)) { 251 if (isset($categories->id) && ($categories->id > 0)) {
253 $Query = $Query->where('category_id', '=', $categories->id); 252 $Query = $Query->where('category_id', '=', $categories->id);
254 $Name_categori = Category::query()->where('id', '=', $categories->id)->get(); 253 $Name_categori = Category::query()->where('id', '=', $categories->id)->get();
255 } else { 254 } else {
256 $Name_categori = ''; 255 $Name_categori = '';
257 } 256 }
258 257
259 if ($request->get('sort')) { 258 if ($request->get('sort')) {
260 $sort = $request->get('sort'); 259 $sort = $request->get('sort');
261 switch ($sort) { 260 switch ($sort) {
262 case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break; 261 case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break;
263 case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break; 262 case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break;
264 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;
265 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;
266 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; 265 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break;
267 default: $Query = $Query->orderbyDesc('updated_at')->orderBy('id'); break; 266 default: $Query = $Query->orderbyDesc('updated_at')->orderBy('id'); break;
268 } 267 }
269 } 268 }
270 269
271 $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();
272 271
273 $Query_count = $Query->count(); 272 $Query_count = $Query->count();
274 273
275 $Query = $Query->OrderByDesc('updated_at')->paginate(3); 274 $Query = $Query->OrderByDesc('updated_at')->paginate(3);
276 275
277 $Reclama = reclame::query()->get(); 276 $Reclama = reclame::query()->get();
278 277
279 if ($request->ajax()) { 278 if ($request->ajax()) {
280 if ($request->has('title')) { 279 if ($request->has('title')) {
281 return view('ajax.list_category', compact( 280 return view('ajax.list_category', compact(
282 'Name_categori' 281 'Name_categori'
283 )); 282 ));
284 } else { 283 } else {
285 return view('ajax.list_vacancies', compact('Query', 284 return view('ajax.list_vacancies', compact('Query',
286 'Query_count', 285 'Query_count',
287 'Name_categori', 286 'Name_categori',
288 'Reclama', 287 'Reclama',
289 'categories', 288 'categories',
290 'Job_title', 289 'Job_title',
291 'uid')); 290 'uid'));
292 } 291 }
293 } else { 292 } else {
294 //Вернуть все 293 //Вернуть все
295 return view('list_vacancies', compact('Query', 294 return view('list_vacancies', compact('Query',
296 'Query_count', 295 'Query_count',
297 'Reclama', 296 'Reclama',
298 'Name_categori', 297 'Name_categori',
299 'categories', 298 'categories',
300 'Job_title', 299 'Job_title',
301 'uid')); 300 'uid'));
302 } 301 }
303 } 302 }
304 303
305 // Образование 304 // Образование
306 public function education(Request $request) { 305 public function education(Request $request) {
307 $educations = Education::query(); 306 $educations = Education::query();
308 if (($request->has('search')) && (!empty($request->get('search')))) { 307 if (($request->has('search')) && (!empty($request->get('search')))) {
309 $search = trim($request->get('search')); 308 $search = trim($request->get('search'));
310 $educations = $educations->where('name', 'LIKE', "%$search%"); 309 $educations = $educations->where('name', 'LIKE', "%$search%");
311 } 310 }
312 311
313 if ($request->get('sort')) { 312 if ($request->get('sort')) {
314 $sort = $request->get('sort'); 313 $sort = $request->get('sort');
315 switch ($sort) { 314 switch ($sort) {
316 case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break; 315 case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break;
317 case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break; 316 case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break;
318 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;
319 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;
320 case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break; 319 case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break;
321 default: $educations = $educations->orderBy('id')->orderby('updated_at'); break; 320 default: $educations = $educations->orderBy('id')->orderby('updated_at'); break;
322 } 321 }
323 } 322 }
324 323
325 $count_edu = $educations->count(); 324 $count_edu = $educations->count();
326 $educations = $educations->paginate(6); 325 $educations = $educations->paginate(6);
327 if ($request->ajax()) { 326 if ($request->ajax()) {
328 return view('ajax.education', compact('educations')); 327 return view('ajax.education', compact('educations'));
329 } else { 328 } else {
330 return view('education', compact('educations', 'count_edu')); 329 return view('education', compact('educations', 'count_edu'));
331 } 330 }
332 } 331 }
333 332
334 // Контакты 333 // Контакты
335 public function contacts() { 334 public function contacts() {
336 return view('contacts'); 335 return view('contacts');
337 } 336 }
338 337
339 // Вход в личный кабинет 338 // Вход в личный кабинет
340 public function input_login(Request $request) 339 public function input_login(Request $request)
341 { 340 {
342 $params = $request->all(); 341 $params = $request->all();
343 342
344 343
345 $rules = [ 344 $rules = [
346 'email' => 'required|string|email', 345 'email' => 'required|string|email',
347 'password' => 'required|string|min:3|max:25', 346 'password' => 'required|string|min:3|max:25',
348 ]; 347 ];
349 348
350 $messages = [ 349 $messages = [
351 'required' => 'Укажите обязательное поле «:attribute»', 350 'required' => 'Укажите обязательное поле «:attribute»',
352 'email' => 'Введите корректный email', 351 'email' => 'Введите корректный email',
353 'min' => [ 352 'min' => [
354 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 353 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
355 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 354 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
356 ], 355 ],
357 'max' => [ 356 'max' => [
358 'string' => 'Поле «:attribute» должно быть не больше :max символов', 357 'string' => 'Поле «:attribute» должно быть не больше :max символов',
359 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 358 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
360 ], 359 ],
361 ]; 360 ];
362 $validator = Validator::make($request->all(), $rules, $messages); 361 $validator = Validator::make($request->all(), $rules, $messages);
363 if ($validator->fails()) { 362 if ($validator->fails()) {
364 if (Auth::check()) 363 if (Auth::check())
365 $user_id = $request->user()->id; 364 $user_id = $request->user()->id;
366 else 365 else
367 $user_id = 0; 366 $user_id = 0;
368 367
369 if ($user_id > 0) 368 if ($user_id > 0)
370 return json_encode(Array("ERROR" => "Email или пароль невалидный!")); 369 return json_encode(Array("ERROR" => "Email или пароль невалидный!"));
371 else 370 else
372 return redirect()->route('index')->with('Error', "Email или пароль невалидный"); 371 return redirect()->route('index')->with('Error', "Email или пароль невалидный");
373 } else { 372 } else {
374 $credentials = $request->only('email', 'password'); 373 $credentials = $request->only('email', 'password');
375 374
376 if (Auth::attempt($credentials, $request->has('remember'))) { 375 if (Auth::attempt($credentials, $request->has('remember'))) {
377 376
378 if (is_null(Auth::user()->email_verified_at)) { 377 if (is_null(Auth::user()->email_verified_at)) {
379 Auth::logout(); 378 Auth::logout();
380 return json_encode(Array("ERROR" => "Адрес почты не подтвержден")); 379 return json_encode(Array("ERROR" => "Адрес почты не подтвержден"));
381 } 380 }
382 381
383 if (Auth::user()->is_worker) { 382 if (Auth::user()->is_worker) {
384 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl())); 383 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));
385 } else { 384 } else {
386 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl())); 385 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));
387 } 386 }
388 387
389 return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет")); 388 return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет"));
390 //->route('index') 389 //->route('index')
391 //->with('success', 'Вы вошли в личный кабинет.'); 390 //->with('success', 'Вы вошли в личный кабинет.');
392 } else { 391 } else {
393 return json_encode(Array("ERROR" => "Неверный логин или пароль!")); 392 return json_encode(Array("ERROR" => "Неверный логин или пароль!"));
394 } 393 }
395 } 394 }
396 } 395 }
397 396
398 // Восстановление пароля 397 // Восстановление пароля
399 public function repair_password(Request $request) { 398 public function repair_password(Request $request) {
400 $rules = [ 399 $rules = [
401 'email' => 'required|string|email', 400 'email' => 'required|string|email',
402 ]; 401 ];
403 402
404 $messages = [ 403 $messages = [
405 'required' => 'Укажите обязательное поле «:attribute»', 404 'required' => 'Укажите обязательное поле «:attribute»',
406 'email' => 'Введите корректный email', 405 'email' => 'Введите корректный email',
407 'min' => [ 406 'min' => [
408 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 407 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
409 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 408 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
410 ], 409 ],
411 'max' => [ 410 'max' => [
412 'string' => 'Поле «:attribute» должно быть не больше :max символов', 411 'string' => 'Поле «:attribute» должно быть не больше :max символов',
413 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 412 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
414 ], 413 ],
415 ]; 414 ];
416 415
417 $validator = Validator::make($request->all(), $rules, $messages); 416 $validator = Validator::make($request->all(), $rules, $messages);
418 417
419 if ($validator->fails()) { 418 if ($validator->fails()) {
420 return redirect()->back()->with('Error', "Email невалидный"); 419 return redirect()->back()->with('Error', "Email невалидный");
421 } else { 420 } else {
422 $new_password = Tools::generator_id(10); 421 $new_password = Tools::generator_id(10);
423 $hash_password = Hash::make($new_password); 422 $hash_password = Hash::make($new_password);
424 $user = User::query()->where('email', $request->get('email'))->first(); 423 $user = User::query()->where('email', $request->get('email'))->first();
425 $EditRec = User::find($user->id); 424 $EditRec = User::find($user->id);
426 $EditRec->password = $hash_password; 425 $EditRec->password = $hash_password;
427 $EditRec->save(); 426 $EditRec->save();
428 427
429 foreach ([$request->get('email')] as $recipient) { 428 foreach ([$request->get('email')] as $recipient) {
430 Mail::to($recipient)->send(new MailRepair($new_password)); 429 Mail::to($recipient)->send(new MailRepair($new_password));
431 } 430 }
432 return redirect()->route('index'); 431 return redirect()->route('index');
433 432
434 } 433 }
435 434
436 } 435 }
437 436
438 // Вывод новостей 437 // Вывод новостей
439 public function news(Request $request) { 438 public function news(Request $request) {
440 $Query = News::query(); 439 $Query = News::query();
441 if ($request->has('search')) { 440 if ($request->has('search')) {
442 $search = $request->get('search'); 441 $search = $request->get('search');
443 $Query = $Query->where('title', 'LIKE', "%$search%")-> 442 $Query = $Query->where('title', 'LIKE', "%$search%")->
444 orWhere('text', 'LIKE', "%$search%"); 443 orWhere('text', 'LIKE', "%$search%");
445 } 444 }
446 445
447 if ($request->ajax()) { 446 if ($request->ajax()) {
448 if ($request->get('sort')) { 447 if ($request->get('sort')) {
449 $sort = $request->get('sort'); 448 $sort = $request->get('sort');
450 switch ($sort) { 449 switch ($sort) {
451 case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break; 450 case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break;
452 case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break; 451 case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break;
453 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;
454 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;
455 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; 454 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break;
456 default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; 455 default: $Query = $Query->orderBy('id')->orderby('updated_at'); break;
457 } 456 }
458 } 457 }
459 } 458 }
460 $Query_count = $Query->count(); 459 $Query_count = $Query->count();
461 $Query = $Query->paginate(6); 460 $Query = $Query->paginate(6);
462 461
463 if ($request->ajax()) { 462 if ($request->ajax()) {
464 return view('ajax.news-list', compact('Query', 'Query_count')); 463 return view('ajax.news-list', compact('Query', 'Query_count'));
465 } else { 464 } else {
466 return view('news-list', compact('Query', 'Query_count')); 465 return view('news-list', compact('Query', 'Query_count'));
467 } 466 }
468 } 467 }
469 468
470 //Детальная новость 469 //Детальная новость
471 public function detail_new(News $new) { 470 public function detail_new(News $new) {
472 // Наборка 471 // Наборка
473 $Query = News::query()->where('id', $new->id)->get(); 472 $Query = News::query()->where('id', $new->id)->get();
474 $title = $Query[0]->title; 473 $title = $Query[0]->title;
475 $All_Query = News::query()->paginate(8); 474 $All_Query = News::query()->paginate(8);
476 return view('detail_new', compact('Query', 'All_Query', 'title')); 475 return view('detail_new', compact('Query', 'All_Query', 'title'));
477 } 476 }
478 } 477 }
479 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')->with('response'); 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 174
175 $infoblocks = infobloks::query()->get();
176
175 $c = Static_worker::query()->where('year_month', '=', $get_date) 177 $c = Static_worker::query()->where('year_month', '=', $get_date)
176 ->where('user_id', '=', $worker->user_id) 178 ->where('user_id', '=', $worker->user_id)
177 ->get(); 179 ->get();
178 180
179 if ($c->count() > 0) { 181 if ($c->count() > 0) {
180 $upd = Static_worker::find($c[0]->id); 182 $upd = Static_worker::find($c[0]->id);
181 $upd->lookin = $upd->lookin + 1; 183 $upd->lookin = $upd->lookin + 1;
182 $upd->save(); 184 $upd->save();
183 } else { 185 } else {
184 $crt = new Static_worker(); 186 $crt = new Static_worker();
185 $crt->lookin = 1; 187 $crt->lookin = 1;
186 $crt->year_month = $get_date; 188 $crt->year_month = $get_date;
187 $crt->user_id = $worker->user_id; 189 $crt->user_id = $worker->user_id;
188 $status = $crt->save(); 190 $status = $crt->save();
189 } 191 }
192
190 $stat = Static_worker::query()->where('year_month', '=', $get_date) 193 $stat = Static_worker::query()->where('year_month', '=', $get_date)
191 ->where('user_id', '=', $worker->user_id) 194 ->where('user_id', '=', $worker->user_id)
192 ->get(); 195 ->get();
193 196
194 return view('worker', compact('Query', 'status_work', 'idiot', 'stat')); 197 return view('worker', compact('Query', 'infoblocks', 'status_work', 'idiot', 'stat'));
195 } 198 }
196 199
197 // скачать анкету соискателя 200 // скачать анкету соискателя
198 public function resume_download(Worker $worker) 201 public function resume_download(Worker $worker)
199 { 202 {
200 $status_work = $this->status_work; 203 $status_work = $this->status_work;
201 $Query = Worker::query()->with('users')->with('job_titles') 204 $Query = Worker::query()->with('users')->with('job_titles')
202 ->with('place_worker')->with('sertificate')->with('prev_company') 205 ->with('place_worker')->with('sertificate')->with('prev_company')
203 ->with('infobloks'); 206 ->with('infobloks');
204 $Query = $Query->where('id', '=', $worker->id); 207 $Query = $Query->where('id', '=', $worker->id);
205 $Query = $Query->get()->toArray(); 208 $Query = $Query->get()->toArray();
206 209
207 view()->share('Query',$Query); 210 view()->share('Query',$Query);
208 211
209 212
210 $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape'); 213 $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape');
211 214
212 return $pdf->stream(); 215 return $pdf->stream();
213 } 216 }
214 217
215 public function resume_download_all() { 218 public function resume_download_all() {
216 $status_work = $this->status_work; 219 $status_work = $this->status_work;
217 $Query = Worker::query()->with('users')->with('job_titles') 220 $Query = Worker::query()->with('users')->with('job_titles')
218 ->with('place_worker')->with('sertificate')->with('prev_company') 221 ->with('place_worker')->with('sertificate')->with('prev_company')
219 ->with('infobloks')-> 222 ->with('infobloks')->
220 whereHas('users', function (Builder $query) { 223 whereHas('users', function (Builder $query) {
221 $query->Where('is_worker', '=', '1') 224 $query->Where('is_worker', '=', '1')
222 ->Where('is_bd', '=', '1'); 225 ->Where('is_bd', '=', '1');
223 }); 226 });
224 //$Query = $Query->where('id', '=', $worker->id); 227 //$Query = $Query->where('id', '=', $worker->id);
225 $Query = $Query->get()->toArray(); 228 $Query = $Query->get()->toArray();
226 229
227 view()->share('Query',$Query); 230 view()->share('Query',$Query);
228 231
229 $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape'); 232 $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape');
230 233
231 return $pdf->stream(); 234 return $pdf->stream();
232 } 235 }
233 236
234 // Кабинет работника 237 // Кабинет работника
235 public function cabinet(Request $request) 238 public function cabinet(Request $request)
236 { 239 {
237 // дата год и месяц 240 // дата год и месяц
238 $get_date = date('Y.m'); 241 $get_date = date('Y.m');
239 242
240 $id = Auth()->user()->id; 243 $id = Auth()->user()->id;
241 244
242 $Infobloks = infobloks::query()->get(); 245 $Infobloks = infobloks::query()->get();
243 246
244 $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')-> 247 $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')->
245 with('infobloks')->with('place_worker')-> 248 with('infobloks')->with('place_worker')->
246 WhereHas('users', 249 WhereHas('users',
247 function (Builder $query) use ($id) {$query->Where('id', $id); 250 function (Builder $query) use ($id) {$query->Where('id', $id);
248 })->get(); 251 })->get();
249 252
250 $Job_titles = Job_title::query()->where('is_remove', '=', '0')-> 253 $Job_titles = Job_title::query()->where('is_remove', '=', '0')->
251 where('is_bd', '=' , '1')-> 254 where('is_bd', '=' , '1')->
252 OrderByDesc('sort')->OrderBy('name')->get(); 255 OrderByDesc('sort')->OrderBy('name')->get();
253 $Infoblocks = infobloks::query()->OrderBy('name')->get(); 256 $Infoblocks = infobloks::query()->OrderBy('name')->get();
254 257
255 $stat = Static_worker::query()->where('year_month', '=', $get_date) 258 $stat = Static_worker::query()->where('year_month', '=', $get_date)
256 ->where('user_id', '=', $id) 259 ->where('user_id', '=', $id)
257 ->get(); 260 ->get();
258 261
259 262
260 // 10% 263 // 10%
261 264
262 $persent = 10; 265 $persent = 10;
263 $persent1 = 0; 266 $persent1 = 0;
264 $persent2 = 0; 267 $persent2 = 0;
265 $persent3 = 0; 268 $persent3 = 0;
266 $persent4 = 0; 269 $persent4 = 0;
267 $persent5 = 0; 270 $persent5 = 0;
268 271
269 if ((!empty($Worker[0]->telephone)) && 272 if ((!empty($Worker[0]->telephone)) &&
270 (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) && 273 (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) &&
271 (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) { 274 (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) {
272 // 40% 275 // 40%
273 $persent = $persent + 40; 276 $persent = $persent + 40;
274 $persent1 = 40; 277 $persent1 = 40;
275 } 278 }
276 279
277 //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year); 280 //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year);
278 281
279 if ($Worker[0]->sertificate->count() > 0) { 282 if ($Worker[0]->sertificate->count() > 0) {
280 // 15% 283 // 15%
281 $persent = $persent + 15; 284 $persent = $persent + 15;
282 $persent2 = 15; 285 $persent2 = 15;
283 } 286 }
284 287
285 if ($Worker[0]->infobloks->count() > 0) { 288 if ($Worker[0]->infobloks->count() > 0) {
286 // 20% 289 // 20%
287 $persent = $persent + 20; 290 $persent = $persent + 20;
288 $persent3 = 20; 291 $persent3 = 20;
289 } 292 }
290 293
291 if ($Worker[0]->prev_company->count() > 0) { 294 if ($Worker[0]->prev_company->count() > 0) {
292 // 10% 295 // 10%
293 $persent = $persent + 10; 296 $persent = $persent + 10;
294 $persent4 = 10; 297 $persent4 = 10;
295 } 298 }
296 299
297 if (!empty($Worker[0]->photo)) { 300 if (!empty($Worker[0]->photo)) {
298 // 5% 301 // 5%
299 $persent = $persent + 5; 302 $persent = $persent + 5;
300 $persent5 = 5; 303 $persent5 = 5;
301 } 304 }
302 if ($request->has('print')) { 305 if ($request->has('print')) {
303 dd($Worker); 306 dd($Worker);
304 } else { 307 } else {
305 return view('workers.cabinet', compact('Worker', 'Infobloks', 'persent', 'Job_titles', 'Infoblocks', 'stat')); 308 return view('workers.cabinet', compact('Worker', 'Infobloks', 'persent', 'Job_titles', 'Infoblocks', 'stat'));
306 } 309 }
307 } 310 }
308 311
309 // Сохранение данных 312 // Сохранение данных
310 public function cabinet_save(Worker $worker, Request $request) 313 public function cabinet_save(Worker $worker, Request $request)
311 { 314 {
312 $id = $worker->id; 315 $id = $worker->id;
313 $params = $request->all(); 316 $params = $request->all();
314 317
315 $job_title_id = $request->get('job_title_id'); 318 $job_title_id = $request->get('job_title_id');
316 319
317 unset($params['new_diplom']); 320 unset($params['new_diplom']);
318 unset($params['new_data_begin']); 321 unset($params['new_data_begin']);
319 unset($params['new_data_end']); 322 unset($params['new_data_end']);
320 unset($params['new_job_title']); 323 unset($params['new_job_title']);
321 unset($params['new_teplohod']); 324 unset($params['new_teplohod']);
322 unset($params['new_GWT']); 325 unset($params['new_GWT']);
323 unset($params['new_KBT']); 326 unset($params['new_KBT']);
324 unset($params['new_Begin_work']); 327 unset($params['new_Begin_work']);
325 unset($params['new_End_work']); 328 unset($params['new_End_work']);
326 unset($params['new_name_company']); 329 unset($params['new_name_company']);
327 330
328 $rules = [ 331 $rules = [
329 'surname' => ['required', 'string', 'max:255'], 332 'surname' => ['required', 'string', 'max:255'],
330 'name_man' => ['required', 'string', 'max:255'], 333 'name_man' => ['required', 'string', 'max:255'],
331 'email' => ['required', 'string', 'email', 'max:255'], 334 'email' => ['required', 'string', 'email', 'max:255'],
332 335
333 ]; 336 ];
334 337
335 $messages = [ 338 $messages = [
336 'required' => 'Укажите обязательное поле', 339 'required' => 'Укажите обязательное поле',
337 'min' => [ 340 'min' => [
338 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 341 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
339 'integer' => 'Поле «:attribute» должно быть :min или больше', 342 'integer' => 'Поле «:attribute» должно быть :min или больше',
340 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 343 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
341 ], 344 ],
342 'max' => [ 345 'max' => [
343 'string' => 'Поле «:attribute» должно быть не больше :max символов', 346 'string' => 'Поле «:attribute» должно быть не больше :max символов',
344 'integer' => 'Поле «:attribute» должно быть :max или меньше', 347 'integer' => 'Поле «:attribute» должно быть :max или меньше',
345 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 348 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
346 ] 349 ]
347 ]; 350 ];
348 351
349 $validator = Validator::make($params, $rules, $messages); 352 $validator = Validator::make($params, $rules, $messages);
350 353
351 if ($validator->fails()) { 354 if ($validator->fails()) {
352 return redirect()->route('worker.cabinet')->withErrors($validator); 355 return redirect()->route('worker.cabinet')->withErrors($validator);
353 } else { 356 } else {
354 357
355 if ($request->has('photo')) { 358 if ($request->has('photo')) {
356 if (!empty($Worker->photo)) { 359 if (!empty($Worker->photo)) {
357 Storage::delete($Worker->photo); 360 Storage::delete($Worker->photo);
358 } 361 }
359 $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); 362 $params['photo'] = $request->file('photo')->store("worker/$id", 'public');
360 } 363 }
361 364
362 if ($request->has('file')) { 365 if ($request->has('file')) {
363 if (!empty($Worker->file)) { 366 if (!empty($Worker->file)) {
364 Storage::delete($Worker->file); 367 Storage::delete($Worker->file);
365 } 368 }
366 $params['file'] = $request->file('file')->store("worker/$id", 'public'); 369 $params['file'] = $request->file('file')->store("worker/$id", 'public');
367 } 370 }
368 371
369 $id_wor = $worker->update($params); 372 $id_wor = $worker->update($params);
370 $use = User::find($worker->user_id); 373 $use = User::find($worker->user_id);
371 $use->surname = $request->get('surname'); 374 $use->surname = $request->get('surname');
372 $use->name_man = $request->get('name_man'); 375 $use->name_man = $request->get('name_man');
373 $use->surname2 = $request->get('surname2'); 376 $use->surname2 = $request->get('surname2');
374 377
375 $use->save(); 378 $use->save();
376 $worker->job_titles()->sync($job_title_id); 379 $worker->job_titles()->sync($job_title_id);
377 380
378 return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); 381 return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены');
379 } 382 }
380 } 383 }
381 384
382 // Сообщения данные 385 // Сообщения данные
383 public function messages($type_message) 386 public function messages($type_message)
384 { 387 {
385 $user_id = Auth()->user()->id; 388 $user_id = Auth()->user()->id;
386 389
387 $messages_input = Message::query()->with('vacancies')->with('user_from')-> 390 $messages_input = Message::query()->with('vacancies')->with('user_from')->
388 Where('to_user_id', $user_id)->OrderByDesc('created_at'); 391 Where('to_user_id', $user_id)->OrderByDesc('created_at');
389 392
390 $messages_output = Message::query()->with('vacancies')-> 393 $messages_output = Message::query()->with('vacancies')->
391 with('user_to')->where('user_id', $user_id)-> 394 with('user_to')->where('user_id', $user_id)->
392 OrderByDesc('created_at'); 395 OrderByDesc('created_at');
393 396
394 $count_input = $messages_input->count(); 397 $count_input = $messages_input->count();
395 $count_output = $messages_output->count(); 398 $count_output = $messages_output->count();
396 399
397 if ($type_message == 'input') { 400 if ($type_message == 'input') {
398 $messages = $messages_input->paginate(5); 401 $messages = $messages_input->paginate(5);
399 } 402 }
400 403
401 if ($type_message == 'output') { 404 if ($type_message == 'output') {
402 $messages = $messages_output->paginate(5); 405 $messages = $messages_output->paginate(5);
403 } 406 }
404 407
405 //dd($messages); 408 //dd($messages);
406 // Вернуть все 100% 409 // Вернуть все 100%
407 return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); 410 return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id'));
408 } 411 }
409 412
410 // Избранный 413 // Избранный
411 public function favorite() 414 public function favorite()
412 { 415 {
413 return view('workers.favorite'); 416 return view('workers.favorite');
414 } 417 }
415 418
416 // Сменить пароль 419 // Сменить пароль
417 public function new_password() 420 public function new_password()
418 { 421 {
419 $email = Auth()->user()->email; 422 $email = Auth()->user()->email;
420 return view('workers.new_password', compact('email')); 423 return view('workers.new_password', compact('email'));
421 } 424 }
422 425
423 // Обновление пароля 426 // Обновление пароля
424 public function save_new_password(Request $request) { 427 public function save_new_password(Request $request) {
425 $use = Auth()->user(); 428 $use = Auth()->user();
426 $request->validate([ 429 $request->validate([
427 'password' => 'required|string', 430 'password' => 'required|string',
428 'new_password' => 'required|string', 431 'new_password' => 'required|string',
429 'new_password2' => 'required|string' 432 'new_password2' => 'required|string'
430 ]); 433 ]);
431 434
432 if ($request->get('new_password') == $request->get('new_password2')) 435 if ($request->get('new_password') == $request->get('new_password2'))
433 if ($request->get('password') !== $request->get('new_password')) { 436 if ($request->get('password') !== $request->get('new_password')) {
434 $credentials = $request->only('email', 'password'); 437 $credentials = $request->only('email', 'password');
435 if (Auth::attempt($credentials, $request->has('save_me'))) { 438 if (Auth::attempt($credentials, $request->has('save_me'))) {
436 439
437 if (!is_null($use->email_verified_at)){ 440 if (!is_null($use->email_verified_at)){
438 441
439 $user_data = User_Model::find($use->id); 442 $user_data = User_Model::find($use->id);
440 $user_data->update([ 443 $user_data->update([
441 'password' => Hash::make($request->get('new_password')), 444 'password' => Hash::make($request->get('new_password')),
442 'pubpassword' => base64_encode($request->get('new_password')), 445 'pubpassword' => base64_encode($request->get('new_password')),
443 ]); 446 ]);
444 return redirect() 447 return redirect()
445 ->route('worker.new_password') 448 ->route('worker.new_password')
446 ->with('success', 'Поздравляю! Вы обновили свой пароль!'); 449 ->with('success', 'Поздравляю! Вы обновили свой пароль!');
447 } 450 }
448 451
449 return redirect() 452 return redirect()
450 ->route('worker.new_password') 453 ->route('worker.new_password')
451 ->withError('Данная учетная запись не было верифицированна!'); 454 ->withError('Данная учетная запись не было верифицированна!');
452 } 455 }
453 } 456 }
454 457
455 return redirect() 458 return redirect()
456 ->route('worker.new_password') 459 ->route('worker.new_password')
457 ->withErrors('Не совпадение данных, обновите пароли!'); 460 ->withErrors('Не совпадение данных, обновите пароли!');
458 } 461 }
459 462
460 // Удаление профиля форма 463 // Удаление профиля форма
461 public function delete_profile() 464 public function delete_profile()
462 { 465 {
463 $login = Auth()->user()->email; 466 $login = Auth()->user()->email;
464 return view('workers.delete_profile', compact('login')); 467 return view('workers.delete_profile', compact('login'));
465 } 468 }
466 469
467 // Удаление профиля код 470 // Удаление профиля код
468 public function delete_profile_result(Request $request) { 471 public function delete_profile_result(Request $request) {
469 $Answer = $request->all(); 472 $Answer = $request->all();
470 $user_id = Auth()->user()->id; 473 $user_id = Auth()->user()->id;
471 $request->validate([ 474 $request->validate([
472 'password' => 'required|string', 475 'password' => 'required|string',
473 ]); 476 ]);
474 477
475 $credentials = $request->only('email', 'password'); 478 $credentials = $request->only('email', 'password');
476 if (Auth::attempt($credentials)) { 479 if (Auth::attempt($credentials)) {
477 Auth::logout(); 480 Auth::logout();
478 $it = User_Model::find($user_id); 481 $it = User_Model::find($user_id);
479 $it->delete(); 482 $it->delete();
480 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); 483 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт');
481 } else { 484 } else {
482 return redirect()->route('worker.delete_profile') 485 return redirect()->route('worker.delete_profile')
483 ->withErrors( 'Неверный пароль! Нужен корректный пароль'); 486 ->withErrors( 'Неверный пароль! Нужен корректный пароль');
484 } 487 }
485 } 488 }
486 489
487 // Регистрация соискателя 490 // Регистрация соискателя
488 public function register_worker(Request $request) 491 public function register_worker(Request $request)
489 { 492 {
490 $params = $request->all(); 493 $params = $request->all();
491 $params['is_worker'] = 1; 494 $params['is_worker'] = 1;
492 495
493 $rules = [ 496 $rules = [
494 'surname' => ['required', 'string', 'max:255'], 497 'surname' => ['required', 'string', 'max:255'],
495 'name_man' => ['required', 'string', 'max:255'], 498 'name_man' => ['required', 'string', 'max:255'],
496 'email' => ['required', 'email', 'max:255', 'unique:users'], 499 'email' => ['required', 'email', 'max:255', 'unique:users'],
497 'password' => ['required', 'string', 'min:6'] 500 'password' => ['required', 'string', 'min:6']
498 ]; 501 ];
499 502
500 $messages = [ 503 $messages = [
501 'required' => 'Укажите обязательное поле', 504 'required' => 'Укажите обязательное поле',
502 'min' => [ 505 'min' => [
503 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 506 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
504 'integer' => 'Поле «:attribute» должно быть :min или больше', 507 'integer' => 'Поле «:attribute» должно быть :min или больше',
505 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 508 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
506 ], 509 ],
507 'max' => [ 510 'max' => [
508 'string' => 'Поле «:attribute» должно быть не больше :max символов', 511 'string' => 'Поле «:attribute» должно быть не больше :max символов',
509 'integer' => 'Поле «:attribute» должно быть :max или меньше', 512 'integer' => 'Поле «:attribute» должно быть :max или меньше',
510 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 513 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
511 ] 514 ]
512 ]; 515 ];
513 516
514 $email = $request->get('email'); 517 $email = $request->get('email');
515 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { 518 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) {
516 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); 519 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл"));
517 } 520 }
518 521
519 if ($request->get('password') !== $request->get('confirmed')){ 522 if ($request->get('password') !== $request->get('confirmed')){
520 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); 523 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля"));
521 } 524 }
522 525
523 if (strlen($request->get('password')) < 6) { 526 if (strlen($request->get('password')) < 6) {
524 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); 527 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!"));
525 } 528 }
526 529
527 /*$haystack = $request->get('password'); 530 /*$haystack = $request->get('password');
528 531
529 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); 532 $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?');
530 $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 533 $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z',
531 'X', 'C', 'V', 'B', 'N', 'M'); 534 'X', 'C', 'V', 'B', 'N', 'M');
532 $lenpwd_bool = true; 535 $lenpwd_bool = true;
533 $spec_bool = false; 536 $spec_bool = false;
534 $alpha_bool = false; 537 $alpha_bool = false;
535 538
536 if (strlen($haystack) < 8) $lenpwd_bool = false; 539 if (strlen($haystack) < 8) $lenpwd_bool = false;
537 540
538 foreach ($specsumbol as $it) { 541 foreach ($specsumbol as $it) {
539 if (strpos($haystack, $it) !== false) { 542 if (strpos($haystack, $it) !== false) {
540 $spec_bool = true; 543 $spec_bool = true;
541 } 544 }
542 } 545 }
543 546
544 foreach ($alpha as $it) { 547 foreach ($alpha as $it) {
545 if (strpos($haystack, $it) !== false) { 548 if (strpos($haystack, $it) !== false) {
546 $alpha_bool = true; 549 $alpha_bool = true;
547 } 550 }
548 } 551 }
549 552
550 if ((!$spec_bool) || (!$alpha_bool)) { 553 if ((!$spec_bool) || (!$alpha_bool)) {
551 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); 554 return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?"));
552 }*/ 555 }*/
553 556
554 if (($request->has('politik')) && ($request->get('politik') == 1)) { 557 if (($request->has('politik')) && ($request->get('politik') == 1)) {
555 $validator = Validator::make($params, $rules, $messages); 558 $validator = Validator::make($params, $rules, $messages);
556 559
557 if ($validator->fails()) { 560 if ($validator->fails()) {
558 return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); 561 return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе."));
559 } else { 562 } else {
560 //dd($params); 563 //dd($params);
561 $user = $this->create($params); 564 $user = $this->create($params);
562 event(new Registered($user)); 565 event(new Registered($user));
563 Auth::guard()->login($user); 566 Auth::guard()->login($user);
564 } 567 }
565 if ($user) { 568 if ($user) {
566 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; 569 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));;
567 } else { 570 } else {
568 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); 571 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!"));
569 } 572 }
570 573
571 } else { 574 } else {
572 return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); 575 return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!"));
573 } 576 }
574 } 577 }
575 578
576 // Звездная оценка и ответ 579 // Звездная оценка и ответ
577 public function stars_answer(Request $request) { 580 public function stars_answer(Request $request) {
578 $params = $request->all(); 581 $params = $request->all();
579 $rules = [ 582 $rules = [
580 'message' => ['required', 'string', 'max:255'], 583 'message' => ['required', 'string', 'max:255'],
581 ]; 584 ];
582 585
583 $messages = [ 586 $messages = [
584 'required' => 'Укажите обязательное поле', 587 'required' => 'Укажите обязательное поле',
585 'min' => [ 588 'min' => [
586 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 589 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
587 'integer' => 'Поле «:attribute» должно быть :min или больше', 590 'integer' => 'Поле «:attribute» должно быть :min или больше',
588 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 591 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
589 ], 592 ],
590 'max' => [ 593 'max' => [
591 'string' => 'Поле «:attribute» должно быть не больше :max символов', 594 'string' => 'Поле «:attribute» должно быть не больше :max символов',
592 'integer' => 'Поле «:attribute» должно быть :max или меньше', 595 'integer' => 'Поле «:attribute» должно быть :max или меньше',
593 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 596 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
594 ] 597 ]
595 ]; 598 ];
596 $response_worker = ResponseWork::create($params); 599 $response_worker = ResponseWork::create($params);
597 return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); 600 return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!');
598 } 601 }
599 602
600 public function TestWorker() 603 public function TestWorker()
601 { 604 {
602 $Use = new User(); 605 $Use = new User();
603 606
604 $Code_user = $Use->create([ 607 $Code_user = $Use->create([
605 'name' => 'surname name_man', 608 'name' => 'surname name_man',
606 'name_man' => 'name_man', 609 'name_man' => 'name_man',
607 'surname' => 'surname', 610 'surname' => 'surname',
608 'surname2' => 'surname2', 611 'surname2' => 'surname2',
609 'subscribe_email' => '1', 612 'subscribe_email' => '1',
610 'email' => 'email@mail.com', 613 'email' => 'email@mail.com',
611 'telephone' => '1234567890', 614 'telephone' => '1234567890',
612 'password' => Hash::make('password'), 615 'password' => Hash::make('password'),
613 'pubpassword' => base64_encode('password'), 616 'pubpassword' => base64_encode('password'),
614 'email_verified_at' => Carbon::now(), 617 'email_verified_at' => Carbon::now(),
615 'is_worker' => 1, 618 'is_worker' => 1,
616 ]); 619 ]);
617 620
618 if ($Code_user->id > 0) { 621 if ($Code_user->id > 0) {
619 $Worker = new Worker(); 622 $Worker = new Worker();
620 $Worker->user_id = $Code_user->id; 623 $Worker->user_id = $Code_user->id;
621 $Worker->position_work = 1; //'job_titles'; 624 $Worker->position_work = 1; //'job_titles';
622 $Worker->email = 'email@email.com'; 625 $Worker->email = 'email@email.com';
623 $Worker->telephone = '1234567890'; 626 $Worker->telephone = '1234567890';
624 $status = $Worker->save(); 627 $status = $Worker->save();
625 628
626 $Title_Worker = new Title_worker(); 629 $Title_Worker = new Title_worker();
627 $Title_Worker->worker_id = $Worker->id; 630 $Title_Worker->worker_id = $Worker->id;
628 $Title_Worker->job_title_id = 1; 631 $Title_Worker->job_title_id = 1;
629 $Title_Worker->save(); 632 $Title_Worker->save();
630 } 633 }
631 } 634 }
632 635
633 // Создание пользователя 636 // Создание пользователя
634 protected function create(array $data) 637 protected function create(array $data)
635 { 638 {
636 $Use = new User(); 639 $Use = new User();
637 640
638 $Code_user = $Use->create([ 641 $Code_user = $Use->create([
639 'name' => $data['surname']." ".$data['name_man'], 642 'name' => $data['surname']." ".$data['name_man'],
640 'name_man' => $data['name_man'], 643 'name_man' => $data['name_man'],
641 'surname' => $data['surname'], 644 'surname' => $data['surname'],
642 'surname2' => $data['surname2'], 645 'surname2' => $data['surname2'],
643 'subscribe_email' => $data['email'], 646 'subscribe_email' => $data['email'],
644 'email' => $data['email'], 647 'email' => $data['email'],
645 'telephone' => $data['telephone'], 648 'telephone' => $data['telephone'],
646 'password' => Hash::make($data['password']), 649 'password' => Hash::make($data['password']),
647 'pubpassword' => base64_encode($data['password']), 650 'pubpassword' => base64_encode($data['password']),
648 'email_verified_at' => Carbon::now(), 651 'email_verified_at' => Carbon::now(),
649 'is_worker' => $data['is_worker'], 652 'is_worker' => $data['is_worker'],
650 ]); 653 ]);
651 654
652 if ($Code_user->id > 0) { 655 if ($Code_user->id > 0) {
653 $Worker = new Worker(); 656 $Worker = new Worker();
654 $Worker->user_id = $Code_user->id; 657 $Worker->user_id = $Code_user->id;
655 $Worker->position_work = $data['job_titles']; 658 $Worker->position_work = $data['job_titles'];
656 $Worker->email = $data['email']; 659 $Worker->email = $data['email'];
657 $Worker->telephone = $data['telephone']; 660 $Worker->telephone = $data['telephone'];
658 $Worker->save(); 661 $Worker->save();
659 662
660 if (isset($Worker->id)) { 663 if (isset($Worker->id)) {
661 $Title_Worker = new Title_worker(); 664 $Title_Worker = new Title_worker();
662 $Title_Worker->worker_id = $Worker->id; 665 $Title_Worker->worker_id = $Worker->id;
663 $Title_Worker->job_title_id = $data['job_titles']; 666 $Title_Worker->job_title_id = $data['job_titles'];
664 $Title_Worker->save(); 667 $Title_Worker->save();
665 } 668 }
666 669
667 return $Code_user; 670 return $Code_user;
668 } 671 }
669 } 672 }
670 673
671 // Вакансии избранные 674 // Вакансии избранные
672 public function colorado(Request $request) { 675 public function colorado(Request $request) {
673 $IP_address = RusDate::ip_addr_client(); 676 $IP_address = RusDate::ip_addr_client();
674 $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); 677 $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get();
675 678
676 if ($Arr->count()) { 679 if ($Arr->count()) {
677 $A = Array(); 680 $A = Array();
678 foreach ($Arr as $it) { 681 foreach ($Arr as $it) {
679 $A[] = $it->code_record; 682 $A[] = $it->code_record;
680 } 683 }
681 684
682 $Query = Ad_employer::query()->whereIn('id', $A); 685 $Query = Ad_employer::query()->whereIn('id', $A);
683 } else { 686 } else {
684 $Query = Ad_employer::query()->where('id', '=', '0'); 687 $Query = Ad_employer::query()->where('id', '=', '0');
685 } 688 }
686 689
687 $Query = $Query->with('jobs')-> 690 $Query = $Query->with('jobs')->
688 with('cat')-> 691 with('cat')->
689 with('employer')-> 692 with('employer')->
690 whereHas('jobs_code', function ($query) use ($request) { 693 whereHas('jobs_code', function ($query) use ($request) {
691 if ($request->ajax()) { 694 if ($request->ajax()) {
692 if (null !== ($request->get('job'))) { 695 if (null !== ($request->get('job'))) {
693 $query->where('job_title_id', $request->get('job')); 696 $query->where('job_title_id', $request->get('job'));
694 } 697 }
695 } 698 }
696 })->select('ad_employers.*'); 699 })->select('ad_employers.*');
697 700
698 $Job_title = Job_title::query()->OrderBy('name')->get(); 701 $Job_title = Job_title::query()->OrderBy('name')->get();
699 702
700 $Query_count = $Query->count(); 703 $Query_count = $Query->count();
701 704
702 $Query = $Query->OrderBy('updated_at')->paginate(3); 705 $Query = $Query->OrderBy('updated_at')->paginate(3);
703 706
704 707
705 return view('workers.favorite', compact('Query', 708 return view('workers.favorite', compact('Query',
706 'Query_count', 709 'Query_count',
707 'Job_title')); 710 'Job_title'));
708 711
709 } 712 }
710 713
711 //Переписка 714 //Переписка
712 public function dialog(User_Model $user1, User_Model $user2, Request $request) { 715 public function dialog(User_Model $user1, User_Model $user2, Request $request) {
713 // Получение параметров. 716 // Получение параметров.
714 if ($request->has('ad_employer')){ 717 if ($request->has('ad_employer')){
715 $ad_employer = $request->get('ad_employer'); 718 $ad_employer = $request->get('ad_employer');
716 } else { 719 } else {
717 $ad_employer = 0; 720 $ad_employer = 0;
718 } 721 }
719 722
720 if (isset($user1->id)) { 723 if (isset($user1->id)) {
721 $sender = User_Model::query()->with('workers')-> 724 $sender = User_Model::query()->with('workers')->
722 with('employers')-> 725 with('employers')->
723 where('id', $user1->id)->first(); 726 where('id', $user1->id)->first();
724 } 727 }
725 728
726 if (isset($user2->id)) { 729 if (isset($user2->id)) {
727 $companion = User_Model::query()->with('workers')-> 730 $companion = User_Model::query()->with('workers')->
728 with('employers')-> 731 with('employers')->
729 where('id', $user2->id)->first(); 732 where('id', $user2->id)->first();
730 } 733 }
731 734
732 $Messages = Message::query()-> 735 $Messages = Message::query()->
733 //with('response')-> 736 //with('response')->
734 where(function($query) use ($user1, $user2) { 737 where(function($query) use ($user1, $user2) {
735 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); 738 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id);
736 })->orWhere(function($query) use ($user1, $user2) { 739 })->orWhere(function($query) use ($user1, $user2) {
737 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); 740 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id);
738 })->OrderBy('created_at')->get(); 741 })->OrderBy('created_at')->get();
739 742
740 $id_vac = null; 743 $id_vac = null;
741 /*foreach ($Messages as $it) { 744 /*foreach ($Messages as $it) {
742 if (isset($it->response)) { 745 if (isset($it->response)) {
743 foreach ($it->response as $r) { 746 foreach ($it->response as $r) {
744 if (isset($r->ad_employer_id)) { 747 if (isset($r->ad_employer_id)) {
745 $id_vac = $r->ad_employer_id; 748 $id_vac = $r->ad_employer_id;
746 break; 749 break;
747 } 750 }
748 } 751 }
749 } 752 }
750 if (!is_null($id_vac)) break; 753 if (!is_null($id_vac)) break;
751 }*/ 754 }*/
752 755
753 //$ad_employer = null; 756 //$ad_employer = null;
754 //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); 757 //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first();
755 758
756 return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); 759 return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer'));
757 } 760 }
758 761
759 // Даунылоады 762 // Даунылоады
760 public function download(Worker $worker) { 763 public function download(Worker $worker) {
761 $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; 764 $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...'];
762 view()->share('house',$arr_house); 765 view()->share('house',$arr_house);
763 $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); 766 $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape');
764 return $pdf->stream(); 767 return $pdf->stream();
765 } 768 }
766 769
767 // Поднятие анкеты 770 // Поднятие анкеты
768 public function up(Worker $worker) { 771 public function up(Worker $worker) {
769 $worker->updated_at = Carbon::now(); 772 $worker->updated_at = Carbon::now();
770 $worker->save(); 773 $worker->save();
771 // 0 774 // 0
772 return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); 775 return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных');
773 } 776 }
774 777
775 // Форма сертификате 778 // Форма сертификате
776 public function new_sertificate(Worker $worker) { 779 public function new_sertificate(Worker $worker) {
777 return view('workers.sertificate_add', compact('worker')); 780 return view('workers.sertificate_add', compact('worker'));
778 } 781 }
779 782
780 // Добавление сертификата 783 // Добавление сертификата
781 public function add_serificate(SertificationRequest $request) { 784 public function add_serificate(SertificationRequest $request) {
782 $params = $request->all(); 785 $params = $request->all();
783 786
784 $Sertificate = new sertification(); 787 $Sertificate = new sertification();
785 $Sertificate->create($params); 788 $Sertificate->create($params);
786 $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get(); 789 $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get();
787 return redirect()->route('worker.cabinet'); 790 return redirect()->route('worker.cabinet');
788 //return view('ajax.documents', compact('Docs')); 791 //return view('ajax.documents', compact('Docs'));
789 } 792 }
790 793
791 // Удалить сертификат 794 // Удалить сертификат
792 public function delete_sertificate(sertification $doc) { 795 public function delete_sertificate(sertification $doc) {
793 $doc->delete(); 796 $doc->delete();
794 797
795 return redirect()->route('worker.cabinet'); 798 return redirect()->route('worker.cabinet');
796 } 799 }
797 800
798 // Редактирование сертификата 801 // Редактирование сертификата
799 public function edit_sertificate(Worker $worker, sertification $doc) { 802 public function edit_sertificate(Worker $worker, sertification $doc) {
800 return view('workers.sertificate_edit', compact('doc', 'worker')); 803 return view('workers.sertificate_edit', compact('doc', 'worker'));
801 } 804 }
802 805
803 // Редактирование обновление сертификата 806 // Редактирование обновление сертификата
804 public function update_serificate(SertificationRequest $request, sertification $doc) { 807 public function update_serificate(SertificationRequest $request, sertification $doc) {
805 $all = $request->all(); 808 $all = $request->all();
806 $doc->worker_id = $all['worker_id']; 809 $doc->worker_id = $all['worker_id'];
807 $doc->name = $all['name']; 810 $doc->name = $all['name'];
808 $doc->end_begin = $all['end_begin']; 811 $doc->end_begin = $all['end_begin'];
809 $doc->save(); 812 $doc->save();
810 813
811 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); 814 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!');
812 } 815 }
813 816
814 public function delete_add_diplom(Request $request, Worker $worker) { 817 public function delete_add_diplom(Request $request, Worker $worker) {
815 $infoblok_id = $request->get('infoblok_id'); 818 $infoblok_id = $request->get('infoblok_id');
816 819
817 if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) 820 if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0)
818 $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); 821 $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete();
819 else { 822 else {
820 $params['infoblok_id'] = $infoblok_id; 823 $params['infoblok_id'] = $infoblok_id;
821 $params['worker_id'] = $worker->id; 824 $params['worker_id'] = $worker->id;
822 $params['status'] = $request->get('val'); 825 $params['status'] = $request->get('val');
823 $id = Dop_info::create($params); 826 $id = Dop_info::create($params);
824 //$id = $worker->infobloks()->sync([$infoblok_id]); 827 //$id = $worker->infobloks()->sync([$infoblok_id]);
825 } 828 }
826 829
827 //$Infoblocks = infobloks::query()->get(); 830 //$Infoblocks = infobloks::query()->get();
828 return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); 831 return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks'));
829 } 832 }
830 833
831 834
832 835
833 // Добавление диплома 836 // Добавление диплома
834 public function add_diplom_ajax(Request $request) { 837 public function add_diplom_ajax(Request $request) {
835 // конец 838 // конец
836 $params = $request->all(); 839 $params = $request->all();
837 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); 840 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count();
838 841
839 if ($count == 0) $dop_info = Dop_info::create($params); 842 if ($count == 0) $dop_info = Dop_info::create($params);
840 $Infoblocks = infobloks::query()->get(); 843 $Infoblocks = infobloks::query()->get();
841 $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); 844 $Worker = Worker::query()->where('id', $request->get('worker_id'))->get();
842 $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); 845 $data = Dop_info::query()->where('worker_id', $request->has('worker_id'));
843 return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); 846 return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker'));
844 } 847 }
845 848
846 // Добавление диплома без ajax 849 // Добавление диплома без ajax
847 public function add_diplom(Worker $worker) { 850 public function add_diplom(Worker $worker) {
848 $worker_id = $worker->id; 851 $worker_id = $worker->id;
849 $Infoblocks = infobloks::query()->get(); 852 $Infoblocks = infobloks::query()->get();
850 return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); 853 return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks'));
851 } 854 }
852 // Сохранить 855 // Сохранить
853 // Сохраняю диплом 856 // Сохраняю диплом
854 public function add_diplom_save(Request $request) { 857 public function add_diplom_save(Request $request) {
855 $params = $request->all(); 858 $params = $request->all();
856 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); 859 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count();
857 if ($count == 0) $dop_info = Dop_info::create($params); 860 if ($count == 0) $dop_info = Dop_info::create($params);
858 return redirect()->route('worker.cabinet'); 861 return redirect()->route('worker.cabinet');
859 } 862 }
860 863
861 // Добавление стандартного документа 864 // Добавление стандартного документа
862 public function add_document(Worker $worker) { 865 public function add_document(Worker $worker) {
863 return view('workers.docs', compact('worker')); 866 return view('workers.docs', compact('worker'));
864 } 867 }
865 868
866 //Сохранение стандартого документа 869 //Сохранение стандартого документа
867 public function add_document_save(DocumentsRequest $request) { 870 public function add_document_save(DocumentsRequest $request) {
868 $params = $request->all(); 871 $params = $request->all();
869 $place_work = place_works::create($params); 872 $place_work = place_works::create($params);
870 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!'); 873 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!');
871 } 874 }
872 875
873 // Редактирование документа 876 // Редактирование документа
874 public function edit_document(place_works $doc, Worker $worker) { 877 public function edit_document(place_works $doc, Worker $worker) {
875 return view('workers.docs-edit', compact('doc', 'worker')); 878 return view('workers.docs-edit', compact('doc', 'worker'));
876 } 879 }
877 880
878 //Сохранение отредактированного документа 881 //Сохранение отредактированного документа
879 public function edit_document_save(DocumentsRequest $request, place_works $doc) { 882 public function edit_document_save(DocumentsRequest $request, place_works $doc) {
880 $params = $request->all(); 883 $params = $request->all();
881 $doc->update($params); 884 $doc->update($params);
882 885
883 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); 886 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!');
884 } 887 }
885 888
886 // Удаление документа 889 // Удаление документа
887 public function delete_document(place_works $doc) { 890 public function delete_document(place_works $doc) {
888 $doc->delete(); 891 $doc->delete();
889 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); 892 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!');
890 } 893 }
891 894
892 //Отправка нового сообщения 895 //Отправка нового сообщения
893 public function new_message(Request $request) { 896 public function new_message(Request $request) {
894 $params = $request->all(); 897 $params = $request->all();
895 898
896 $id = $params['send_user_id']; 899 $id = $params['send_user_id'];
897 $message = new Message(); 900 $message = new Message();
898 $message->user_id = $params['send_user_id']; 901 $message->user_id = $params['send_user_id'];
899 $message->to_user_id = $params['send_to_user_id']; 902 $message->to_user_id = $params['send_to_user_id'];
900 $message->title = $params['send_title']; 903 $message->title = $params['send_title'];
901 $message->text = $params['send_text']; 904 $message->text = $params['send_text'];
902 $message->ad_employer_id = $params['send_vacancy']; 905 $message->ad_employer_id = $params['send_vacancy'];
903 if ($request->has('send_file')) { 906 if ($request->has('send_file')) {
904 $message->file = $request->file('send_file')->store("worker/$id", 'public'); 907 $message->file = $request->file('send_file')->store("worker/$id", 'public');
905 } 908 }
906 $message->flag_new = 1; 909 $message->flag_new = 1;
907 $id_message = $message->save(); 910 $id_message = $message->save();
908 911
909 $data['message_id'] = $id_message; 912 $data['message_id'] = $id_message;
910 $data['ad_employer_id'] = $params['send_vacancy']; 913 $data['ad_employer_id'] = $params['send_vacancy'];
911 $data['job_title_id'] = $params['send_job_title_id']; 914 $data['job_title_id'] = $params['send_job_title_id'];
912 $data['flag'] = 1; 915 $data['flag'] = 1;
913 $ad_responce = ad_response::create($data); 916 $ad_responce = ad_response::create($data);
914 return redirect()->route('worker.messages', ['type_message' => 'output']); 917 return redirect()->route('worker.messages', ['type_message' => 'output']);
915 } 918 }
916 919
917 920
918 public function test123(Request $request) { 921 public function test123(Request $request) {
919 $params = $request->all(); 922 $params = $request->all();
920 $user1 = $params['user_id']; 923 $user1 = $params['user_id'];
921 $user2 = $params['to_user_id']; 924 $user2 = $params['to_user_id'];
922 $id_vacancy = $params['ad_employer_id']; 925 $id_vacancy = $params['ad_employer_id'];
923 $ad_name = $params['ad_name']; 926 $ad_name = $params['ad_name'];
924 927
925 $rules = [ 928 $rules = [
926 'text' => 'required|min:1|max:150000', 929 'text' => 'required|min:1|max:150000',
927 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' 930 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000'
928 ]; 931 ];
929 $messages = [ 932 $messages = [
930 'required' => 'Укажите обязательное поле', 933 'required' => 'Укажите обязательное поле',
931 'min' => [ 934 'min' => [
932 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 935 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
933 'integer' => 'Поле «:attribute» должно быть :min или больше', 936 'integer' => 'Поле «:attribute» должно быть :min или больше',
934 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 937 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
935 ], 938 ],
936 'max' => [ 939 'max' => [
937 'string' => 'Поле «:attribute» должно быть не больше :max символов', 940 'string' => 'Поле «:attribute» должно быть не больше :max символов',
938 'integer' => 'Поле «:attribute» должно быть :max или меньше', 941 'integer' => 'Поле «:attribute» должно быть :max или меньше',
939 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 942 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
940 ] 943 ]
941 ]; 944 ];
942 945
943 $validator = Validator::make($request->all(), $rules, $messages); 946 $validator = Validator::make($request->all(), $rules, $messages);
944 947
945 if ($validator->fails()) { 948 if ($validator->fails()) {
946 return redirect()->route('worker.dialog', ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]) 949 return redirect()->route('worker.dialog', ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name])
947 ->withErrors($validator); 950 ->withErrors($validator);
948 } else { 951 } else {
949 if ($request->has('file')) { 952 if ($request->has('file')) {
950 $params['file'] = $request->file('file')->store("messages", 'public'); 953 $params['file'] = $request->file('file')->store("messages", 'public');
951 } 954 }
952 Message::create($params); 955 Message::create($params);
953 //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); 956 //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
954 return redirect()->route('worker.dialog', 957 return redirect()->route('worker.dialog',
955 ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]); 958 ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]);
956 959
957 } 960 }
958 } 961 }
959 962
960 // Информация о предыдущих компаниях 963 // Информация о предыдущих компаниях
961 public function new_prev_company(Worker $worker) { 964 public function new_prev_company(Worker $worker) {
962 return view('workers.prev_company_form', compact('worker')); 965 return view('workers.prev_company_form', compact('worker'));
963 } 966 }
964 967
965 // Добавление контакта компании 968 // Добавление контакта компании
966 public function add_prev_company(PrevCompanyRequest $request) { 969 public function add_prev_company(PrevCompanyRequest $request) {
967 // Возвращение параметров 970 // Возвращение параметров
968 $all = $request->all(); 971 $all = $request->all();
969 $PrevCompany = PrevCompany::create($all); 972 $PrevCompany = PrevCompany::create($all);
970 973
971 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); 974 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись');
972 } 975 }
973 976
974 // Редактирование контакта компании 977 // Редактирование контакта компании
975 public function edit_prev_company(PrevCompany $doc, Worker $worker) { 978 public function edit_prev_company(PrevCompany $doc, Worker $worker) {
976 return view('workers.prev_company_edit_form', compact('doc', 'worker')); 979 return view('workers.prev_company_edit_form', compact('doc', 'worker'));
977 } 980 }
978 981
979 //Сохранение редактирования контакта компании 982 //Сохранение редактирования контакта компании
980 public function update_prev_company(PrevCompany $doc, Request $request){ 983 public function update_prev_company(PrevCompany $doc, Request $request){
981 $all = $request->all(); 984 $all = $request->all();
982 $doc->update($all); 985 $doc->update($all);
983 986
984 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); 987 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись');
985 } 988 }
986 989
987 // Удаление контакта предыдущей компании 990 // Удаление контакта предыдущей компании
988 public function delete_prev_company(PrevCompany $doc) { 991 public function delete_prev_company(PrevCompany $doc) {
989 $doc->delete(); 992 $doc->delete();
990 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); 993 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!');
991 } 994 }
992 } 995 }
993 996
994 997
app/Http/Requests/VacancyRequestEdit.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Requests; 3 namespace App\Http\Requests;
4 4
5 use Illuminate\Foundation\Http\FormRequest; 5 use Illuminate\Foundation\Http\FormRequest;
6 6
7 class VacancyRequestEdit extends FormRequest 7 class VacancyRequestEdit extends FormRequest
8 { 8 {
9 public function authorize() 9 public function authorize()
10 { 10 {
11 return true; 11 return true;
12 } 12 }
13 13
14 /** 14 /**
15 * Get the validation rules that apply to the request. 15 * Get the validation rules that apply to the request.
16 * 16 *
17 * @return array<string, mixed> 17 * @return array<string, mixed>
18 */ 18 */
19 19
20 public function rules() 20 public function rules()
21 { 21 {
22 $Arr = [ 22 $Arr = [
23 'name' => [ 23 'name' => [
24 'required', 24 'required',
25 'min:3', 25 'min:3',
26 'max:255', 26 'max:255',
27 ], 27 ],
28 28
29 'category_id' => [ 29 /* 'category_id' => [
30 'numeric', 30 'numeric',
31 'min:0', 31 'min:0',
32 'max:9999999', 32 'max:9999999',
33 ], 33 ],
34 34
35 'telephone' => [ 35 'telephone' => [
36 'min:3', 36 'min:3',
37 'max:255', 37 'max:255',
38 ], 38 ],
39 39
40 'email' => [ 40 'email' => [
41 'min:3', 41 'min:3',
42 'max:255', 42 'max:255',
43 ], 43 ],
44 44
45 'salary' => [ 45 'salary' => [
46 'numeric', 46 'numeric',
47 'min:3', 47 'min:3',
48 'max:255', 48 'max:255',
49 ], 49 ],
50 50
51 'min_salary' => [ 51 'min_salary' => [
52 'numeric', 52 'numeric',
53 'min:0', 53 'min:0',
54 'max:9999999', 54 'max:9999999',
55 ], 55 ],
56 56
57 'max_salary' => [ 57 'max_salary' => [
58 'numeric', 58 'numeric',
59 'min:0', 59 'min:0',
60 'max:9999999', 60 'max:9999999',
61 ], 61 ],
62 62
63 'city' => [ 63 'city' => [
64 'min:3', 64 'min:3',
65 'max:255', 65 'max:255',
66 ], 66 ],*/
67 67
68 'job_title_id' => [ 68 'job_title_id[]' => [
69 'numeric', 69 'numeric',
70 'min:1', 70 'min:1',
71 'max:9999999' 71 'max:9999999'
72 ] 72 ]
73 ]; 73 ];
74 74
75 return [ 75 return [
76 'name' => [ 76 'name' => [
77 'required', 77 'required',
78 'min:3', 78 'min:3',
79 'max:255', 79 'max:255',
80 ], 80 ],
81 81 /*
82 'category_id' => [ 82 'category_id' => [
83 'numeric', 83 'numeric',
84 'min:0', 84 'min:0',
85 'max:9999999', 85 'max:9999999',
86 ], 86 ],
87 87
88 'telephone' => [ 88 'telephone' => [
89 'min:3', 89 'min:3',
90 'max:255', 90 'max:255',
91 ], 91 ],
92 92
93 'email' => [ 93 'email' => [
94 'min:3', 94 'min:3',
95 'max:255', 95 'max:255',
96 ],]; 96 ],*/
97 ];
97 } 98 }
98 99
99 public function messages() { 100 public function messages() {
100 return [ 101 return [
101 'required' => 'Поле «:attribute» обязательно для заполнения', 102 'required' => 'Поле «:attribute» обязательно для заполнения',
102 'unique' => 'Такое значение поля «:attribute» уже используется', 103 'unique' => 'Такое значение поля «:attribute» уже используется',
103 'min' => [ 104 'min' => [
104 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 105 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
105 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 106 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
106 ], 107 ],
107 'max' => [ 108 'max' => [
108 'string' => 'Поле «:attribute» должно быть не больше :max символов', 109 'string' => 'Поле «:attribute» должно быть не больше :max символов',
109 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 110 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
110 ], 111 ],
111 'mimes' => 'Файл «:attribute» должен иметь формат :values', 112 'mimes' => 'Файл «:attribute» должен иметь формат :values',
112 'numeric' => 'В поле «:attribute» должно быть указано целое число от 0 до 9999999', 113 'numeric' => 'В поле «:attribute» должно быть указано целое число от 0 до 9999999',
113 ]; 114 ];
114 115
115 } 116 }
116 } 117 }
117 118
resources/views/employers/edit_vacancy.blade.php
1 @extends('layout.frontend', ['title' => 'Редактирование вакансии РекаМоре']) 1 @extends('layout.frontend', ['title' => 'Редактирование вакансии РекаМоре'])
2 2
3 @section('scripts') 3 @section('scripts')
4 <script> 4 <script>
5 console.log('Приближаемся к системе, нас рой тут...'); 5 console.log('Приближаемся к системе, нас рой тут...');
6 $(document).on('change', '#position_id', function() { 6 $(document).on('change', '#position_id', function() {
7 var this_ = $(this); 7 var this_ = $(this);
8 var val_ = this_.val(); 8 var val_ = this_.val();
9 var ajax_ = $('#job_title_id'); 9 var ajax_ = $('#job_title_id');
10 10
11 console.log('Создания списка людей, которые поднимутся на корабль...'); 11 console.log('Создания списка людей, которые поднимутся на корабль...');
12 12
13 $.ajax({ 13 $.ajax({
14 type: "GET", 14 type: "GET",
15 url: "{{ route('employer.selected_people') }}", 15 url: "{{ route('employer.selected_people') }}",
16 data: "id="+val_, 16 data: "id="+val_,
17 success: function (data) { 17 success: function (data) {
18 console.log('Ответка пришла'); 18 console.log('Ответка пришла');
19 console.log('Список избранных людей создан'); 19 console.log('Список избранных людей создан');
20 ajax_.html(data); 20 ajax_.html(data);
21 }, 21 },
22 headers: { 22 headers: {
23 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 23 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
24 }, 24 },
25 error: function (data) { 25 error: function (data) {
26 console.log('Обрыв связи'); 26 console.log('Обрыв связи');
27 console.log('Error: ' + data); 27 console.log('Error: ' + data);
28 } 28 }
29 }); 29 });
30 }); 30 });
31 </script> 31 </script>
32 @endsection 32 @endsection
33 @section('content') 33 @section('content')
34 <section class="cabinet"> 34 <section class="cabinet">
35 <div class="container"> 35 <div class="container">
36 <ul class="breadcrumbs cabinet__breadcrumbs"> 36 <ul class="breadcrumbs cabinet__breadcrumbs">
37 <li><a href="{{ route('index') }}">Главная</a></li> 37 <li><a href="{{ route('index') }}">Главная</a></li>
38 <li><b>Личный кабинет</b></li> 38 <li><b>Личный кабинет</b></li>
39 </ul> 39 </ul>
40 <div class="cabinet__wrapper"> 40 <div class="cabinet__wrapper">
41 <div class="cabinet__side"> 41 <div class="cabinet__side">
42 <div class="cabinet__side-toper"> 42 <div class="cabinet__side-toper">
43 43
44 @include('employers.emblema') 44 @include('employers.emblema')
45 45
46 </div> 46 </div>
47 47
48 @include('employers.menu', ['item' => 3]) 48 @include('employers.menu', ['item' => 3])
49 49
50 </div> 50 </div>
51 51
52 <form class="cabinet__body" action="{{ route('employer.vacancy_save_me', ['ad_employer' => $Employer->id]) }}" method="POST"> 52 <form class="cabinet__body" action="{{ route('employer.vacancy_save_me', ['ad_employer' => $ad_employer->id]) }}" method="POST">
53 @csrf 53 @csrf
54 <input type="hidden" name="employer_id" value="{{ $Employer->id }}"/> 54 <input type="hidden" name="employer_id" value="{{ $Employer->id }}"/>
55 <div class="cabinet__body-item"> 55 <div class="cabinet__body-item">
56 <div class="cabinet__descr"> 56 <div class="cabinet__descr">
57 <h2 class="title cabinet__title">Редактировать вакансию</h2> 57 <h2 class="title cabinet__title">Редактировать вакансию</h2>
58 <p class="cabinet__text"><b>Данные по вакансии</b></p> 58 <p class="cabinet__text"><b>Данные по вакансии</b></p>
59 <p class="cabinet__text">Все поля обязательны для заполнения *</p> 59 <p class="cabinet__text">Все поля обязательны для заполнения *</p>
60 </div> 60 </div>
61 </div> 61 </div>
62 <div class="cabinet__body-item"> 62 <div class="cabinet__body-item">
63 <h4>Поля для вакансии</h4> 63 <h4>Поля для вакансии</h4>
64 <div class="cabinet__inputs"> 64 <div class="cabinet__inputs">
65 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 65 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
66 <label class="form-group__label">Название вакансии</label> 66 <label class="form-group__label">Название вакансии</label>
67 <div class="form-group__item"> 67 <div class="form-group__item">
68 <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $ad_employer->name ?? '' }}" required> 68 <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $ad_employer->name ?? '' }}" required>
69 @error('name') 69 @error('name')
70 <span class="text-xs text-red-600 dark:text-red-400"> 70 <span class="text-xs text-red-600 dark:text-red-400">
71 {{ $message }} 71 {{ $message }}
72 </span> 72 </span>
73 @enderror 73 @enderror
74 </div> 74 </div>
75 </div> 75 </div>
76 76
77 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> 77 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
78 <label class="form-group__label">Телефон</label> 78 <label class="form-group__label">Телефон</label>
79 <div class="form-group__item"> 79 <div class="form-group__item">
80 <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $ad_employer->telephone ?? '' }}" placeholder="Свой телефон"> 80 <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $ad_employer->telephone ?? '' }}" placeholder="Свой телефон">
81 @error('telephone') 81 @error('telephone')
82 <span class="text-xs text-red-600 dark:text-red-400"> 82 <span class="text-xs text-red-600 dark:text-red-400">
83 {{ $message }} 83 {{ $message }}
84 </span> 84 </span>
85 @enderror 85 @enderror
86 </div> 86 </div>
87 </div> 87 </div>
88 88
89 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> 89 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
90 <label class="form-group__label">Емайл</label> 90 <label class="form-group__label">Емайл</label>
91 <div class="form-group__item"> 91 <div class="form-group__item">
92 <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $ad_employer->email ?? '' }}" placeholder="Своя почту"> 92 <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $ad_employer->email ?? '' }}" placeholder="Своя почту">
93 @error('email') 93 @error('email')
94 <span class="text-xs text-red-600 dark:text-red-400"> 94 <span class="text-xs text-red-600 dark:text-red-400">
95 {{ $message }} 95 {{ $message }}
96 </span> 96 </span>
97 @enderror 97 @enderror
98 </div> 98 </div>
99 </div> 99 </div>
100 100
101 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> 101 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
102 <label class="form-group__label">Зарплата среднестатистическая для вакансии</label> 102 <label class="form-group__label">Зарплата среднестатистическая для вакансии</label>
103 <div class="form-group__item"> 103 <div class="form-group__item">
104 <input type="text" class="input" name="salary" id="salary" value="{{ old('salary') ?? $ad_employer->salary ??'' }}" placeholder="Среднестатистическая зарплата"> 104 <input type="text" class="input" name="salary" id="salary" value="{{ old('salary') ?? $ad_employer->salary ??'' }}" placeholder="Среднестатистическая зарплата">
105 @error('salary') 105 @error('salary')
106 <span class="text-xs text-red-600 dark:text-red-400"> 106 <span class="text-xs text-red-600 dark:text-red-400">
107 {{ $message }} 107 {{ $message }}
108 </span> 108 </span>
109 @enderror 109 @enderror
110 </div> 110 </div>
111 </div> 111 </div>
112 112
113 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display: none"> 113 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display: none">
114 <label class="form-group__label">Город посадки</label> 114 <label class="form-group__label">Город посадки</label>
115 <div class="form-group__item"> 115 <div class="form-group__item">
116 <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $ad_employer->city ?? 'Не указан' }}" placeholder="Севастополь"> 116 <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $ad_employer->city ?? 'Не указан' }}" placeholder="Севастополь">
117 @error('city') 117 @error('city')
118 <span class="text-xs text-red-600"> 118 <span class="text-xs text-red-600">
119 {{ $message }} 119 {{ $message }}
120 </span> 120 </span>
121 @enderror 121 @enderror
122 </div> 122 </div>
123 </div> 123 </div>
124 <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style=""> 124 <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="">
125 <label class="form-group__label">Категория (локация)</label> 125 <label class="form-group__label">Категория (локация)</label>
126 <div class="form-group__item"> 126 <div class="form-group__item">
127 <div class="select"> 127 <div class="select">
128 <select class="js-select2" name="category_id" id="category_id"> 128 <select class="js-select2" name="category_id" id="category_id">
129 php $i = 1 endphp 129 php $i = 1 endphp
130 if ($Positions->count()) 130 if ($Positions->count())
131 foreach($Positions as $j) 131 foreach($Positions as $j)
132 if ($i == 1) <option> Выберите категорию из списка</option> 132 if ($i == 1) <option> Выберите категорию из списка</option>
133 else 133 else
134 <option value=" $j->id }}" if ($ad_employer->category_id == $j->id) selected endif>$j->name }}</option> 134 <option value=" $j->id }}" if ($ad_employer->category_id == $j->id) selected endif>$j->name }}</option>
135 endif 135 endif
136 php $i++ endphp 136 php $i++ endphp
137 endforeach 137 endforeach
138 endif 138 endif
139 </select> 139 </select>
140 error('category_id') 140 error('category_id')
141 <span class="text-xs text-red-600 dark:text-red-400"> 141 <span class="text-xs text-red-600 dark:text-red-400">
142 $message }} 142 $message }}
143 </span> 143 </span>
144 enderror 144 enderror
145 </div> 145 </div>
146 </div> 146 </div>
147 </div>--> 147 </div>-->
148 148
149 <!--foreach ($ad_employer->jobs_code as $it_um) 149 <!--foreach ($ad_employer->jobs_code as $it_um)
150 <pre> print_r($it_um) }}</pre> 150 <pre> print_r($it_um) }}</pre>
151 endforeach--> 151 endforeach-->
152 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 152 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
153 <label class="form-group__label">Редактирование должностей</label> 153 <label class="form-group__label">Редактирование должностей</label>
154 <div class="form-group__item"> 154 <div class="form-group__item">
155 <div class="select"> 155 <div class="select">
156 <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple"> 156 <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple">
157 @php $i = 1 @endphp 157 @php $i = 1 @endphp
158 @if ($jobs->count()) 158 @if ($jobs->count())
159 @foreach($jobs as $it) 159 @foreach($jobs as $it)
160 @php $selected = false; @endphp 160 @php $selected = false; @endphp
161 @foreach ($ad_employer->jobs_code as $it_um) 161 @foreach ($ad_employer->jobs_code as $it_um)
162 @if (isset($it_um->job_title_id)) 162 @if (isset($it_um->job_title_id))
163 @if ($it_um->job_title_id == $it->id)) 163 @if ($it_um->job_title_id == $it->id))
164 @php $selected = true; @endphp 164 @php $selected = true; @endphp
165 @endif 165 @endif
166 @endif 166 @endif
167 @endforeach 167 @endforeach
168 <option value="{{ $it->id }}" @if ($selected) selected @endif>{{ $it->name }}</option> 168 <option value="{{ $it->id }}" @if ($selected) selected @endif>{{ $it->name }}</option>
169 @endforeach 169 @endforeach
170 @endif 170 @endif
171 </select> 171 </select>
172 </div> 172 </div>
173 </div> 173 </div>
174 </div> 174 </div>
175 175
176 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 176 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
177 <label class="form-group__label">Описание вакансии</label> 177 <label class="form-group__label">Описание вакансии</label>
178 <div class="form-group__item"> 178 <div class="form-group__item">
179 <textarea class="textarea ckeditor" name="text" id="text">{{ old('text') ?? $ad_employer->text ?? '' }}</textarea> 179 <textarea class="textarea ckeditor" name="text" id="text">{{ old('text') ?? $ad_employer->text ?? '' }}</textarea>
180 @error('text') 180 @error('text')
181 <span class="text-xs text-red-600"> 181 <span class="text-xs text-red-600">
182 {{ $message }} 182 {{ $message }}
183 </span> 183 </span>
184 @enderror 184 @enderror
185 </div> 185 </div>
186 </div> 186 </div>
187 187
188 <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 188 <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
189 <h4 class="form-group__label">Редактирование должностей</h4> 189 <h4 class="form-group__label">Редактирование должностей</h4>
190 <div class="form-group__item"> 190 <div class="form-group__item">
191 <a href=" route('employer.add_job_in_vac', ['ad_employer' => $ad_employer->id]) }}" class="button">Добавить</a> 191 <a href=" route('employer.add_job_in_vac', ['ad_employer' => $ad_employer->id]) }}" class="button">Добавить</a>
192 192
193 if ($ad_employer->jobs->count()) 193 if ($ad_employer->jobs->count())
194 foreach ($ad_employer->jobs as $key => $it_um) 194 foreach ($ad_employer->jobs as $key => $it_um)
195 <p>if (isset($ad_employer->jobs_code[$key])) 195 <p>if (isset($ad_employer->jobs_code[$key]))
196 <a href=" route('employer.edit_job_in_vac', ['ad_job' => $ad_employer->jobs_code[$key]->id, 'ad_employer' => $ad_employer->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">$it_um->name}}</a> 196 <a href=" route('employer.edit_job_in_vac', ['ad_job' => $ad_employer->jobs_code[$key]->id, 'ad_employer' => $ad_employer->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">$it_um->name}}</a>
197 <a href=" route('employer.delete_job_in_vac', ['ad_job' => $ad_employer->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a> 197 <a href=" route('employer.delete_job_in_vac', ['ad_job' => $ad_employer->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a>
198 endif 198 endif
199 </p> 199 </p>
200 endforeach 200 endforeach
201 else 201 else
202 Нет связанных <br> с вакансией должностей 202 Нет связанных <br> с вакансией должностей
203 endif 203 endif
204 </div> 204 </div>
205 </div>--> 205 </div>-->
206 </div> 206 </div>
207 207
208 <a class="button cabinet__submit" href="{{ route('employer.vacancy_list') }}">Назад</a> 208 <a class="button cabinet__submit" href="{{ route('employer.vacancy_list') }}">Назад</a>
209 <button type="submit" class="button cabinet__submit">Опубликовать</button> 209 <button type="submit" class="button cabinet__submit">Опубликовать</button>
210 </div> 210 </div>
211 </form> 211 </form>
212 </div> 212 </div>
213 </div> 213 </div>
214 </section> 214 </section>
215 </div> 215 </div>
216 <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> 216 <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script>
217 <script> 217 <script>
218 CKEDITOR.replace('text'); 218 CKEDITOR.replace('text');
219 //CKEDITOR.replace( 'text', { 219 //CKEDITOR.replace( 'text', {
220 // filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", 220 // filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}",
221 // filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", 221 // filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}",
222 // filebrowserUploadMethod: 'form' 222 // filebrowserUploadMethod: 'form'
223 // }); 223 // });
224 </script> 224 </script>
225 @endsection 225 @endsection
226 226
resources/views/info_company_new.blade.php
1 @extends('layout.frontend', ['title' => 'Описание компании '.$title.'- РекаМоре']) 1 @extends('layout.frontend', ['title' => 'Описание компании '.$title.'- РекаМоре'])
2 2
3 @section('scripts') 3 @section('scripts')
4 <script> 4 <script>
5 console.log('Test system'); 5 console.log('Test system');
6 $(document).on('change', '#sort_ajax', function() { 6 $(document).on('change', '#sort_ajax', function() {
7 var this_ = $(this); 7 var this_ = $(this);
8 var val_ = this_.val(); 8 var val_ = this_.val();
9 console.log('sort items '+val_); 9 console.log('sort items '+val_);
10 10
11 $.ajax({ 11 $.ajax({
12 type: "GET", 12 type: "GET",
13 url: "{{ route('shipping_companies') }}", 13 url: "{{ route('shipping_companies') }}",
14 data: "sort="+val_+"&block=1", 14 data: "sort="+val_+"&block=1",
15 success: function (data) { 15 success: function (data) {
16 console.log('Выбор сортировки'); 16 console.log('Выбор сортировки');
17 console.log(data); 17 console.log(data);
18 $('#block_1').html(data); 18 $('#block_1').html(data);
19 }, 19 },
20 headers: { 20 headers: {
21 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 21 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
22 }, 22 },
23 error: function (data) { 23 error: function (data) {
24 data = JSON.stringify(data); 24 data = JSON.stringify(data);
25 console.log('Error: ' + data); 25 console.log('Error: ' + data);
26 } 26 }
27 }); 27 });
28 28
29 $.ajax({ 29 $.ajax({
30 type: "GET", 30 type: "GET",
31 url: "{{ route('shipping_companies') }}", 31 url: "{{ route('shipping_companies') }}",
32 data: "sort="+val_+"&block=2", 32 data: "sort="+val_+"&block=2",
33 success: function (data) { 33 success: function (data) {
34 console.log('Выбор сортировки2'); 34 console.log('Выбор сортировки2');
35 console.log(data); 35 console.log(data);
36 history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); 36 history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif");
37 $('#block_2').html(data); 37 $('#block_2').html(data);
38 }, 38 },
39 headers: { 39 headers: {
40 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 40 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
41 }, 41 },
42 error: function (data) { 42 error: function (data) {
43 data = JSON.stringify(data); 43 data = JSON.stringify(data);
44 console.log('Error: ' + data); 44 console.log('Error: ' + data);
45 } 45 }
46 }); 46 });
47 }); 47 });
48 48
49 $(document).ready(function(){ 49 $(document).ready(function(){
50 var sel = $('#select2-sort_ajax-container'); 50 var sel = $('#select2-sort_ajax-container');
51 var key = getUrlParameter('sort'); 51 var key = getUrlParameter('sort');
52 if (key !=='') { 52 if (key !=='') {
53 console.log(key); 53 console.log(key);
54 switch (key) { 54 switch (key) {
55 case "default": sel.html('Сортировка (по умолчанию)'); break; 55 case "default": sel.html('Сортировка (по умолчанию)'); break;
56 case "name_up": sel.html('По имени (возрастание)'); break; 56 case "name_up": sel.html('По имени (возрастание)'); break;
57 case "name_down": sel.html('По дате (убывание)'); break; 57 case "name_down": sel.html('По дате (убывание)'); break;
58 case "created_at_up": sel.html('По дате (возрастание)'); break; 58 case "created_at_up": sel.html('По дате (возрастание)'); break;
59 case "created_at_down": sel.html('По дате (убывание)'); break; 59 case "created_at_down": sel.html('По дате (убывание)'); break;
60 } 60 }
61 61
62 } 62 }
63 }); 63 });
64 64
65 //end 65 //end
66 $(document).on('click', '.js_send_it_button', function() { 66 $(document).on('click', '.js_send_it_button', function() {
67 var this_ = $(this); 67 var this_ = $(this);
68 var code_user_id = this_.attr('data-uid'); 68 var code_user_id = this_.attr('data-uid');
69 var code_to_user_id = this_.attr('data-tuid'); 69 var code_to_user_id = this_.attr('data-tuid');
70 var code_vacancy = this_.attr('data-vacancy'); 70 var code_vacancy = this_.attr('data-vacancy');
71 var user_id = $('#send_user_id'); 71 var user_id = $('#send_user_id');
72 var to_user_id = $('#send_to_user_id'); 72 var to_user_id = $('#send_to_user_id');
73 var vacancy = $('#send_vacancy'); 73 var vacancy = $('#send_vacancy');
74 74
75 console.log('Клик на кнопки...'); 75 console.log('Клик на кнопки...');
76 76
77 user_id.val(code_user_id); 77 user_id.val(code_user_id);
78 to_user_id.val(code_to_user_id); 78 to_user_id.val(code_to_user_id);
79 vacancy.val(code_vacancy); 79 vacancy.val(code_vacancy);
80 }); 80 });
81 </script> 81 </script>
82 @include('js.favorite-vacancy-45')
82 @endsection 83 @endsection
83 84
84 @section('content') 85 @section('content')
85 <section class="thing"> 86 <section class="thing">
86 <div class="container"> 87 <div class="container">
87 <div class="thing__body"> 88 <div class="thing__body">
88 <ul class="breadcrumbs thing__breadcrumbs"> 89 <ul class="breadcrumbs thing__breadcrumbs">
89 <li><a href="{{ route('index') }}">Главная</a></li> 90 <li><a href="{{ route('index') }}">Главная</a></li>
90 <li><a href="{{ route('shipping_companies') }}">Работодатели</a></li> 91 <li><a href="{{ route('shipping_companies') }}">Работодатели</a></li>
91 <li><b>@isset($title) {{ $title }} @else Не указано @endif</b></li> 92 <li><b>@isset($title) {{ $title }} @else Не указано @endif</b></li>
92 </ul> 93 </ul>
93 @if ($company[0]->oficial_status == 1) 94 @if ($company[0]->oficial_status == 1)
94 <div class="thing__badge"> 95 <div class="thing__badge">
95 <svg> 96 <svg>
96 <use xlink:href="{{ asset('images/sprite.svg#badge') }}"></use> 97 <use xlink:href="{{ asset('images/sprite.svg#badge') }}"></use>
97 </svg> 98 </svg>
98 Компания проверена 99 Компания проверена
99 </div> 100 </div>
100 @endif 101 @endif
101 102
102 @if (!empty($company[0]->logo)) 103 @if (!empty($company[0]->logo))
103 <img src="{{ asset(Storage::url($company[0]->logo)) }}" alt="{{ $company[0]->name_company }}" class="thing__pic"> 104 <img src="{{ asset(Storage::url($company[0]->logo)) }}" alt="{{ $company[0]->name_company }}" class="thing__pic">
104 @else 105 @else
105 <img src="{{ asset('images/logo_emp.png') }}" alt="{{ $company[0]->name_company }}" class="thing__pic"> 106 <img src="{{ asset('images/logo_emp.png') }}" alt="{{ $company[0]->name_company }}" class="thing__pic">
106 @endif 107 @endif
107 108
108 <h1 class="thing__title">{{ $company[0]->name_company }}</h1> 109 <h1 class="thing__title">{{ $company[0]->name_company }}</h1>
109 <!--<p class="thing__text"> $company[0]->text !!}</p>--> 110 <!--<p class="thing__text"> $company[0]->text !!}</p>-->
110 <div class="thing__buttons"> 111 <div class="thing__buttons">
111 <button type="button" class="button"> 112 <button type="button" class="button">
112 <svg> 113 <svg>
113 <use xlink:href="{{ asset('images/sprite.svg#grid-1') }}"></use> 114 <use xlink:href="{{ asset('images/sprite.svg#grid-1') }}"></use>
114 </svg> 115 </svg>
115 {{ $company[0]->ads->count() }} вакансии 116 {{ $company[0]->ads->count() }} вакансии
116 </button> 117 </button>
117 @if ($user_id == 0) 118 @if ($user_id == 0)
118 <a data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' class="js_send_it_button button"> 119 <a data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' class="js_send_it_button button">
119 Написать сообщение 120 Написать сообщение
120 </a> 121 </a>
121 @else 122 @else
122 <a data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' class="js_send_it_button button"> 123 <a data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' class="js_send_it_button button">
123 Написать сообщение 124 Написать сообщение
124 </a> 125 </a>
125 @endif 126 @endif
126 </div> 127 </div>
127 </div> 128 </div>
128 </div> 129 </div>
129 </section> 130 </section>
130 <main class="main"> 131 <main class="main">
131 <div class="container"> 132 <div class="container">
132 <div class="main__employer-page"> 133 <div class="main__employer-page">
133 <h2 class="main__employer-page-title">О компании</h2> 134 <h2 class="main__employer-page-title">О компании</h2>
134 <div class="main__employer-page-info"> 135 <div class="main__employer-page-info">
135 <div class="main__employer-page-item"> 136 <div class="main__employer-page-item">
136 <b>Адрес компании</b> 137 <b>Адрес компании</b>
137 <span> 138 <span>
138 {{ $company[0]->address }} 139 {{ $company[0]->address }}
139 </span> 140 </span>
140 </div> 141 </div>
141 <div class="main__employer-page-item"> 142 <div class="main__employer-page-item">
142 <b>Сайт</b> 143 <b>Сайт</b>
143 <span> 144 <span>
144 <a href="{{ $company[0]->site }}">{{ $company[0]->site }}</a> 145 <a href="{{ $company[0]->site }}">{{ $company[0]->site }}</a>
145 </span> 146 </span>
146 </div> 147 </div>
147 <div class="main__employer-page-item"> 148 <div class="main__employer-page-item">
148 <b>Почта</b> 149 <b>Почта</b>
149 <span> 150 <span>
150 <a href="mailto:">{{ $company[0]->email }}</a> 151 <a href="mailto:">{{ $company[0]->email }}</a>
151 </span> 152 </span>
152 </div> 153 </div>
153 <div class="main__employer-page-item"> 154 <div class="main__employer-page-item">
154 <b>Телефон</b> 155 <b>Телефон</b>
155 <span> 156 <span>
156 <a href="tel:{{ $company[0]->telephone }}">{{ $company[0]->telephone }}</a> 157 <a href="tel:{{ $company[0]->telephone }}">{{ $company[0]->telephone }}</a>
157 </span> 158 </span>
158 </div> 159 </div>
159 </div> 160 </div>
160 161
161 <div class="main__employer-page-item"> 162 <div class="main__employer-page-item">
162 <b>Описание</b> 163 <b>Описание</b>
163 <span> 164 <span>
164 {!! $company[0]->text !!} 165 {!! $company[0]->text !!}
165 </span> 166 </span>
166 </div> 167 </div>
167 168
168 <div> 169 <div>
169 170
170 <div class="main__employer-page-tabs"> 171 <div class="main__employer-page-tabs">
171 <button type="button" class="main__employer-page-tabs-item active" 172 <button type="button" class="main__employer-page-tabs-item active"
172 data-tab="1">Флот</button> 173 data-tab="1">Флот</button>
173 <button type="button" class="main__employer-page-tabs-item" data-tab="2">Вакансии</button> 174 <button type="button" class="main__employer-page-tabs-item" data-tab="2">Вакансии</button>
174 </div> 175 </div>
175 176
176 <div class="main__employer-page-body"> 177 <div class="main__employer-page-body">
177 <div class="main__employer-page-body-item showed" data-body="1"> 178 <div class="main__employer-page-body-item showed" data-body="1">
178 <div class="main__employer-page-one"> 179 <div class="main__employer-page-one">
179 @if ($company[0]->flots->count()) 180 @if ($company[0]->flots->count())
180 @foreach ($company[0]->flots as $flot) 181 @foreach ($company[0]->flots as $flot)
181 <a href="" class="main__employer-page-one-item"> 182 <a href="" class="main__employer-page-one-item">
182 @if (!empty($flot->image)) 183 @if (!empty($flot->image))
183 <img src="{{ asset(Storage::url($flot->image)) }}" alt="{{ $flot->name }}"> 184 <img src="{{ asset(Storage::url($flot->image)) }}" alt="{{ $flot->name }}">
184 @else 185 @else
185 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $flot->name }}"> 186 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $flot->name }}">
186 @endif 187 @endif
187 <b>{{ $flot->name }}</b> 188 <b>{{ $flot->name }}</b>
188 <b>{{ $flot->region }}</b> 189 <b>{{ $flot->region }}</b>
189 <span><i>DWT</i> {{ $flot->DWT }}</span> 190 <span><i>DWT</i> {{ $flot->DWT }}</span>
190 <span><i>Мощность ГД</i> {{ $flot->POWER_GD }}</span> 191 <span><i>Мощность ГД</i> {{ $flot->POWER_GD }}</span>
191 <span><i>IMO</i> {{ $flot->IMO }}</span> 192 <span><i>IMO</i> {{ $flot->IMO }}</span>
192 <span>{{ $flot->power }}</span> 193 <span>{{ $flot->power }}</span>
193 </a> 194 </a>
194 @endforeach 195 @endforeach
195 @endif 196 @endif
196 </div> 197 </div>
197 </div> 198 </div>
198 199
199 <div class="main__employer-page-body-item" data-body="2"> 200 <div class="main__employer-page-body-item" data-body="2">
200 <div class="main__employer-page-two"> 201 <div class="main__employer-page-two">
201 @foreach ($ads as $job) 202 @foreach ($ads as $job)
202 <div class="main__employer-page-two-item"> 203 <div class="main__employer-page-two-item">
203 <div class="main__employer-page-two-item-toper"> 204 <div class="main__employer-page-two-item-toper">
204 @if (!empty($company[0]->logo)) 205 @if (!empty($company[0]->logo))
205 <img src="{{ asset(Storage::url($company[0]->logo)) }}" alt="{{ $job->name }}"> 206 <img src="{{ asset(Storage::url($company[0]->logo)) }}" alt="{{ $job->name }}">
206 @else 207 @else
207 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $job->name }}"> 208 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $job->name }}">
208 @endif 209 @endif
209 <span>{{ $job->name }}</span> 210 <span>{{ $job->name }}</span>
210 <!--<span>Описание: 211 <!--<span>Описание:
211 $job->text !!} 212 $job->text !!}
212 </span>--> 213 </span>-->
213 </div> 214 </div>
214 <!--<div class="main__employer-page-two-item-title"> $item->flot }}</div>--> 215 <!--<div class="main__employer-page-two-item-title"> $item->flot }}</div>-->
215 <div class="main__employer-page-two-item-text"> 216 <div class="main__employer-page-two-item-text">
216 @if ((isset($job->jobs)) && ($job->jobs->count())) 217 @if ((isset($job->jobs)) && ($job->jobs->count()))
217 @foreach($job->jobs as $item) 218 @foreach($job->jobs as $item)
218 <a class="main__employer-page-two-item-text-name"> 219 <a class="main__employer-page-two-item-text-name">
219 {{ $item->name }} 220 {{ $item->name }}
220 </a> 221 </a>
221 @endforeach 222 @endforeach
222 @endif 223 @endif
223 <!--<div class="main__employer-page-two-item-text-body"> 224 <!--<div class="main__employer-page-two-item-text-body">
224 <p>Зарплата: $item->min_salary }} - $item->max_salary }}р + $item->sytki }} суточные.</p> 225 <p>Зарплата: $item->min_salary }} - $item->max_salary }}р + $item->sytki }} суточные.</p>
225 <p>Контракт: $item->period }} мес.</p> 226 <p>Контракт: $item->period }} мес.</p>
226 </div>--> 227 </div>-->
227 </div> 228 </div>
228 <!--<div class="main__employer-page-two-item-text"> 229 <!--<div class="main__employer-page-two-item-text">
229 <div class="main__employer-page-two-item-text-name">Район работы</div> 230 <div class="main__employer-page-two-item-text-name">Район работы</div>
230 <div class="main__employer-page-two-item-text-body"> 231 <div class="main__employer-page-two-item-text-body">
231 <p> $item->region }}</p> 232 <p> $item->region }}</p>
232 </div> 233 </div>
233 </div> 234 </div>
234 <div class="main__employer-page-two-item-text"> 235 <div class="main__employer-page-two-item-text">
235 <div class="main__employer-page-two-item-text-name">Посадка</div> 236 <div class="main__employer-page-two-item-text-name">Посадка</div>
236 <div class="main__employer-page-two-item-text-body"> 237 <div class="main__employer-page-two-item-text-body">
237 <p> $item->start }}</p> 238 <p> $item->start }}</p>
238 !! $item->description !!} 239 !! $item->description !!}
239 </div> 240 </div>
240 </div>--> 241 </div>-->
241 <div class="main__employer-page-two-item-text"> 242 <div class="main__employer-page-two-item-text">
242 <div class="main__employer-page-two-item-text-name">Звонить по вопросам на: 243 <div class="main__employer-page-two-item-text-name">Звонить по вопросам на:
243 </div> 244 </div>
244 <div class="main__employer-page-two-item-text-body"> 245 <div class="main__employer-page-two-item-text-body">
245 <a href="tel:{{ $job->telephone }}">{{ $job->telephone }}</a> 246 <a href="tel:{{ $job->telephone }}">{{ $job->telephone }}</a>
246 </div> 247 </div>
247 </div> 248 </div>
248 <div class="main__employer-page-two-item-text"> 249 <div class="main__employer-page-two-item-text">
249 <div class="main__employer-page-two-item-text-name">Анкеты присылать на 250 <div class="main__employer-page-two-item-text-name">Анкеты присылать на
250 почту: 251 почту:
251 </div> 252 </div>
252 <div class="main__employer-page-two-item-text-body"> 253 <div class="main__employer-page-two-item-text-body">
253 <a href="mailto: {{ $job->email }}">{{ $job->email }}</a> 254 <a href="mailto: {{ $job->email }}">{{ $job->email }}</a>
254 </div> 255 </div>
255 </div> 256 </div>
256 @if ((isset($job->jobs)) && ($job->jobs->count())) 257 @if ((isset($job->jobs)) && ($job->jobs->count()))
257 <div class="main__employer-page-two-item-tags"> 258 <div class="main__employer-page-two-item-tags">
258 @foreach ($job->jobs as $item) 259 @foreach ($job->jobs as $item)
259 <span class="main__employer-page-two-item-tag">#{{ $item->name }}</span> 260 <span class="main__employer-page-two-item-tag">#{{ $item->name }}</span>
260 @endforeach 261 @endforeach
261 </div> 262 </div>
262 @endif 263 @endif
263 <div class="main__employer-page-two-item-buttons"> 264 <div class="main__employer-page-two-item-buttons">
264 265
265 <button type="button" data-fancybox data-src="#send" data-vacancy="{{ $job->id }}" data-uid="{{ $user_id }}" data-tuid="{{ $company[0]->users->id }}" data-options='{"touch":false,"autoFocus":false}' 266 <button type="button" data-fancybox data-src="#send" data-vacancy="{{ $job->id }}" data-uid="{{ $user_id }}" data-tuid="{{ $company[0]->users->id }}" data-options='{"touch":false,"autoFocus":false}'
266 class="button main__employer-page-two-item-button js_send_it_button">Оставить 267 class="button main__employer-page-two-item-button js_send_it_button">Оставить
267 отклик...</button> 268 отклик...</button>
268 269
269 <!--<a href="#" 270 <!--<a href="#"
270 class="button button_light main__employer-page-two-item-button">Подробнее</a>--> 271 class="button button_light main__employer-page-two-item-button">Подробнее</a>-->
271 </div> 272 </div>
272 <div class="main__employer-page-two-item-bottom"> 273 <div class="main__employer-page-two-item-bottom">
273 <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($job->updated_at)) }}</div> 274 <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($job->updated_at)) }}</div>
274 <button type="button" 275 <button type="button" id="like{{ $job->id }}" data-val="{{ $job->id }}"
275 class="like main__employer-page-two-item-bottom-like js-toggle"> 276 class="like main__employer-page-two-item-bottom-like js-toggle js_vac_favorite {{ \App\Classes\LikesClass::get_status_vacancy($job) }}">
276 <svg> 277 <svg>
277 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> 278 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use>
278 </svg> 279 </svg>
279 </button> 280 </button>
280 </div> 281 </div>
281 </div> 282 </div>
282 @endforeach 283 @endforeach
283 284
284 <div style="margin-top: 20px"> 285 <div style="margin-top: 20px">
285 {{ $ads->onEachSide(0)->appends($_GET)->links('paginate') }} 286 {{ $ads->onEachSide(0)->appends($_GET)->links('paginate') }}
286 </div> 287 </div>
287 <!--<button type="button" class="button button_light button_more main__employer-page-two-more js-toggle js-parent-toggle"> 288 <!--<button type="button" class="button button_light button_more main__employer-page-two-more js-toggle js-parent-toggle">
288 <span>Показать ещё</span> 289 <span>Показать ещё</span>
289 <span>Скрыть</span> 290 <span>Скрыть</span>
290 </button>--> 291 </button>-->
291 </div> 292 </div>
292 </div> 293 </div>
293 </div> 294 </div>
294 </div> 295 </div>
295 </div> 296 </div>
296 </div> 297 </div>
297 </main> 298 </main>
298 @endsection 299 @endsection
299 300
resources/views/layout/frontend.blade.php
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> 2 <html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
3 3
4 <head> 4 <head>
5 <meta charset="utf-8"> 5 <meta charset="utf-8">
6 <title>{{ $title }}</title> 6 <title>{{ $title }}</title>
7 <meta name="viewport" content="width=device-width,initial-scale=1"> 7 <meta name="viewport" content="width=device-width,initial-scale=1">
8 <meta name="theme-color" content="#377D87"> 8 <meta name="theme-color" content="#377D87">
9 <script src="{{ asset('js/jquery.js') }}"></script> 9 <script src="{{ asset('js/jquery.js') }}"></script>
10 <!--<script type="text/javascript" src=" asset('js/jquery.cookie.js') }}"></script>--> 10 <!--<script type="text/javascript" src=" asset('js/jquery.cookie.js') }}"></script>-->
11 11
12 <link rel="stylesheet" href="{{ asset('css/telegram.css') }}"> 12 <link rel="stylesheet" href="{{ asset('css/telegram.css') }}">
13 13
14 <link rel="stylesheet" href="{{ asset('css/star-rating.min.css') }}"> 14 <link rel="stylesheet" href="{{ asset('css/star-rating.min.css') }}">
15 <link rel="stylesheet" href="{{ asset('css/style_may2024.css') }}"> 15 <link rel="stylesheet" href="{{ asset('css/style_may2024.css') }}">
16 <style> 16 <style>
17 .err_red { 17 .err_red {
18 border: red 2px solid; 18 border: red 2px solid;
19 } 19 }
20 20
21 .input[disabled] { 21 .input[disabled] {
22 /* color: #9c9d9d; */ 22 /* color: #9c9d9d; */
23 background: #FFFFFF; 23 background: #FFFFFF;
24 } 24 }
25 </style> 25 </style>
26 </head> 26 </head>
27 27
28 <body id="body" onload="createCaptcha()"> 28 <body id="body" onload="createCaptcha()">
29 <a href="#body" class="to-top js-scroll-to"> 29 <a href="#body" class="to-top js-scroll-to">
30 <svg> 30 <svg>
31 <use xlink:href="{{ asset('images/sprite.svg#arrow-top') }}"></use> 31 <use xlink:href="{{ asset('images/sprite.svg#arrow-top') }}"></use>
32 </svg> 32 </svg>
33 </a> 33 </a>
34 34
35 <div> <!-- BEGIN TOP WRAPPER --> 35 <div> <!-- BEGIN TOP WRAPPER -->
36 <header class="header"> 36 <header class="header">
37 <div class="container"> 37 <div class="container">
38 <div class="header__body"> 38 <div class="header__body">
39 <div class="header__left"> 39 <div class="header__left">
40 <a href="{{ route('index') }}" class="header__logo"> 40 <a href="{{ route('index') }}" class="header__logo">
41 <svg> 41 <svg>
42 <use xlink:href="{{ asset('images/sprite.svg#logo') }}"></use> 42 <use xlink:href="{{ asset('images/sprite.svg#logo') }}"></use>
43 </svg> 43 </svg>
44 </a> 44 </a>
45 <nav class="header__menu"> 45 <nav class="header__menu">
46 <a href="{{ route('vacancies') }}" class="header__menu-item">Вакансии</a> 46 <a href="{{ route('vacancies') }}" class="header__menu-item">Вакансии</a>
47 <a href="{{ route('shipping_companies') }}" class="header__menu-item">Судоходные компании</a> 47 <a href="{{ route('shipping_companies') }}" class="header__menu-item">Судоходные компании</a>
48 <a href="{{ route('education') }}" class="header__menu-item">Образование</a> 48 <a href="{{ route('education') }}" class="header__menu-item">Образование</a>
49 </nav> 49 </nav>
50 </div> 50 </div>
51 <div class="header__right"> 51 <div class="header__right">
52 @guest 52 @guest
53 53
54 @else 54 @else
55 <a href="@if ($UserId->is_worker) {{ route('worker.cabinet') }} @else {{ route('employer.cabinet') }} @endif" class="header__notifs header__notifs_actived"> 55 <a href="@if ($UserId->is_worker) {{ route('worker.cabinet') }} @else {{ route('employer.cabinet') }} @endif" class="header__notifs header__notifs_actived">
56 <svg> 56 <svg>
57 <use xlink:href="{{ asset('images/sprite.svg#ring') }}"></use> 57 <use xlink:href="{{ asset('images/sprite.svg#ring') }}"></use>
58 </svg> 58 </svg>
59 <span>Уведомления</span> 59 <span>Уведомления</span>
60 </a> 60 </a>
61 61
62 @endguest 62 @endguest
63 <div class="header__right-line"></div> 63 <div class="header__right-line"></div>
64 <button class="header__burger"> 64 <button class="header__burger">
65 <svg> 65 <svg>
66 <use xlink:href="{{ asset('images/sprite.svg#burger') }}"></use> 66 <use xlink:href="{{ asset('images/sprite.svg#burger') }}"></use>
67 </svg> 67 </svg>
68 </button> 68 </button>
69 @guest 69 @guest
70 <a class="button header__sign" data-fancybox data-src="#sign" data-options='{"touch":false,"autoFocus":false}'>Войти</a> 70 <a class="button header__sign" data-fancybox data-src="#sign" data-options='{"touch":false,"autoFocus":false}'>Войти</a>
71 @else 71 @else
72 <a class="button header__sign" href="{{ route('logout') }}">Выйти</a> 72 <a class="button header__sign" href="{{ route('logout') }}">Выйти</a>
73 @endguest 73 @endguest
74 </div> 74 </div>
75 </div> 75 </div>
76 </div> 76 </div>
77 </header> 77 </header>
78 78
79 @yield('content') 79 @yield('content')
80 </div> <!-- END TOP WRAPPER --> 80 </div> <!-- END TOP WRAPPER -->
81 81
82 <div> <!-- BEGIN BOTTOM WRAPPER --> 82 <div> <!-- BEGIN BOTTOM WRAPPER -->
83 <footer class="footer"> 83 <footer class="footer">
84 <div class="container"> 84 <div class="container">
85 <div class="footer__mobile"> 85 <div class="footer__mobile">
86 86
87 <button class="footer__mobile-toper js-toggle active"> 87 <button class="footer__mobile-toper js-toggle active">
88 <a href="{{ route('index') }}"> 88 <a href="{{ route('index') }}">
89 <svg> 89 <svg>
90 <use xlink:href="{{ asset('images/sprite.svg#logo') }}"></use> 90 <use xlink:href="{{ asset('images/sprite.svg#logo') }}"></use>
91 </svg> 91 </svg>
92 </a> 92 </a>
93 <span> 93 <span>
94 <svg> 94 <svg>
95 <use xlink:href="{{ asset('images/sprite.svg#arrow-top') }}"></use> 95 <use xlink:href="{{ asset('images/sprite.svg#arrow-top') }}"></use>
96 </svg> 96 </svg>
97 </span> 97 </span>
98 </button> 98 </button>
99 <div class="footer__mobile-menu"> 99 <div class="footer__mobile-menu">
100 <div class="footer__mobile-menu-item"> 100 <div class="footer__mobile-menu-item">
101 <button class="js-toggle"> 101 <button class="js-toggle">
102 <b>Соискателям</b> 102 <b>Соискателям</b>
103 <span><svg> 103 <span><svg>
104 <use xlink:href="{{ asset('images/sprite.svg#arrow-top') }}"></use> 104 <use xlink:href="{{ asset('images/sprite.svg#arrow-top') }}"></use>
105 </svg></span> 105 </svg></span>
106 </button> 106 </button>
107 <div> 107 <div>
108 <a data-fancybox data-src="#reg" data-options='{"touch":false,"autoFocus":false}'>Регистрация</a>
108 <a href="{{ route('vacancies') }}">Вакансии</a> 109 <a href="{{ route('vacancies') }}">Вакансии</a>
109 <a href="{{ route('page', ['pages' => "Usloviya-razmescheniya"]) }}">Условия размещения</a> 110 <!--<a href=" route('page', ['pages' => "Usloviya-razmescheniya"]) }}">Условия размещения</a>-->
110 <a href="{{ route('education') }}">Образование</a> 111 <a href="{{ route('education') }}">Образование</a>
111 <a href="{{ route('news') }}">Новости</a> 112 <a href="{{ route('news') }}">Новости</a>
112 <a href="{{ route('contacts') }}">Контакты</a> 113 <a href="{{ $companies[0]->telegram }}">Телеграм</a>
114 <a href="{{ $companies[0]->vkontact }}">ВКонтакте</a>
115 <!--<a href=" route('contacts') }}">Контакты</a>-->
113 <a href="{{ route('page', ['pages' => "Publichnaya-oferta-soiskatelyam"]) }}">Публичная оферта</a> 116 <a href="{{ route('page', ['pages' => "Publichnaya-oferta-soiskatelyam"]) }}">Публичная оферта</a>
114 </div> 117 </div>
115 </div> 118 </div>
116 <div class="footer__mobile-menu-item"> 119 <div class="footer__mobile-menu-item">
117 <button class="js-toggle"> 120 <button class="js-toggle">
118 <b>Работодателям</b> 121 <b>Работодателям</b>
119 <span><svg> 122 <span><svg>
120 <use xlink:href="{{asset('images/sprite.svg#arrow-top') }}"></use> 123 <use xlink:href="{{asset('images/sprite.svg#arrow-top') }}"></use>
121 </svg></span> 124 </svg></span>
122 </button> 125 </button>
123 <div> 126 <div>
124 <a href="{{ route('register') }}">Регистрация</a> 127 <a data-fancybox data-src="#reg" data-options='{"touch":false,"autoFocus":false}'>Регистрация</a>
128 <!--<a href=" route('register') }}">Регистрация</a>-->
125 <a href="{{ route('bd_resume') }}">База резюме</a> 129 <a href="{{ route('bd_resume') }}">База резюме</a>
126 <a href="{{ route('page', ['pages' => "Stoimost-razmescheniya"]) }}">Стоимость размещения</a> 130 <a href="{{ route('page', ['pages' => "Usloviya-razmescheniya"]) }}">Условия размещения</a>
127 <a href="{{ route('page', ['pages' => "Instrukcii"]) }}">Инструкции</a> 131 <!--<a href=" route('page', ['pages' => "Stoimost-razmescheniya"]) }}">Стоимость размещения</a>-->
128 <a href="{{ route('page', ['pages' => "Effektivnost-obyavleniya"]) }}">Эффективность объявления</a> 132 <!--<a href=" route('page', ['pages' => "Instrukcii"]) }}">Инструкции</a>-->
133 <!--<a href=" route('page', ['pages' => "Effektivnost-obyavleniya"]) }}">Эффективность объявления</a>-->
134 <a href="{{ $companies[0]->telegram }}">Телеграм</a>
135 <a href="{{ $companies[0]->vkontact }}">ВКонтакте</a>
129 <a href="{{ route('page', ['pages' => "Publichnaya-oferta-rabotodatelyam"]) }}">Публичная оферта</a> 136 <a href="{{ route('page', ['pages' => "Publichnaya-oferta-rabotodatelyam"]) }}">Публичная оферта</a>
130 </div> 137 </div>
131 </div> 138 </div>
132 </div> 139 </div>
133 <div class="footer__mobile-contacts"> 140 <div class="footer__mobile-contacts">
134 <b>Контакты</b> 141 <b>Контакты</b>
135 <a href="tel:{{ $companies[0]->telephone }}">{{ $companies[0]->telephone }}</a> 142 <a href="tel:{{ $companies[0]->telephone }}">{{ $companies[0]->telephone }}</a>
136 <a href="mailto:{{ $companies[0]->email }}">{{ $companies[0]->email }}</a> 143 <a href="mailto:{{ $companies[0]->email }}">{{ $companies[0]->email }}</a>
137 </div> 144 </div>
138 <div class="footer__mobile-bottom"> 145 <div class="footer__mobile-bottom">
139 <div class="socials"> 146 <div class="socials">
140 <a href="{{ $companies[0]->vkontact }}" target="_blank"> 147 <a href="{{ $companies[0]->vkontact }}" target="_blank">
141 <svg> 148 <svg>
142 <use xlink:href="{{ asset('images/sprite.svg#vk') }}"></use> 149 <use xlink:href="{{ asset('images/sprite.svg#vk') }}"></use>
143 </svg> 150 </svg>
144 </a> 151 </a>
145 <a href="{{ $companies[0]->telegram }}" target="_blank"> 152 <a href="{{ $companies[0]->telegram }}" target="_blank">
146 <svg> 153 <svg>
147 <use xlink:href="{{ asset('images/sprite.svg#tg') }}"></use> 154 <use xlink:href="{{ asset('images/sprite.svg#tg') }}"></use>
148 </svg> 155 </svg>
149 </a> 156 </a>
150 </div> 157 </div>
151 <nav class="footer__mobile-links"> 158 <nav class="footer__mobile-links">
152 <a href="{{ route('page', ['pages' => "Politika-konfidencialnosti"]) }}">Политика конфиденциальности</a> 159 <a href="{{ route('page', ['pages' => "Politika-konfidencialnosti"]) }}">Политика конфиденциальности</a>
153 <span></span> 160 <span></span>
154 <a href="{{ route('page', ['pages' => "Polzovatelskoe-soglashenie"]) }}">Пользовательское соглашение</a> 161 <a href="{{ route('page', ['pages' => "Polzovatelskoe-soglashenie"]) }}">Пользовательское соглашение</a>
155 </nav> 162 </nav>
156 &copy; 2023 &mdash; RekaMore.su 163 &copy; 2023 &mdash; RekaMore.su
157 <a href="{{ route('index') }}" class="nls" target="_blank"> 164 <a href="{{ route('index') }}" class="nls" target="_blank">
158 <svg> 165 <svg>
159 <use xlink:href="{{ asset('images/sprite.svg#nls') }}"></use> 166 <use xlink:href="{{ asset('images/sprite.svg#nls') }}"></use>
160 </svg> 167 </svg>
161 <span> 168 <span>
162 Дизайн и разработка: 169 Дизайн и разработка:
163 <b>NoLogoStudio.ru</b> 170 <b>NoLogoStudio.ru</b>
164 </span> 171 </span>
165 </a> 172 </a>
166 </div> 173 </div>
167 </div> 174 </div>
168 <div class="footer__main"> 175 <div class="footer__main">
169 <div class="footer__main-body"> 176 <div class="footer__main-body">
170 177
171 <a href="" class="footer__main-logo"> 178 <a href="" class="footer__main-logo">
172 <svg> 179 <svg>
173 <use xlink:href="{{ asset('images/sprite.svg#logo') }}"></use> 180 <use xlink:href="{{ asset('images/sprite.svg#logo') }}"></use>
174 </svg> 181 </svg>
175 </a> 182 </a>
176 <div class="footer__main-col"> 183 <div class="footer__main-col">
177 <div class="footer__main-title">Соискателям</div> 184 <div class="footer__main-title">Соискателям</div>
178 <nav> 185 <nav>
186 <a data-fancybox data-src="#reg" data-options='{"touch":false,"autoFocus":false}'>Регистрация</a>
179 <a href="{{ route('vacancies') }}">Вакансии</a> 187 <a href="{{ route('vacancies') }}">Вакансии</a>
180 <a href="{{ route('page', ['pages' => "Usloviya-razmescheniya"]) }}">Условия размещения</a> 188 <!--<a href=" route('page', ['pages' => "Usloviya-razmescheniya"]) }}">Условия размещения</a>-->
181 <a href="{{ route('education') }}">Образование</a> 189 <a href="{{ route('education') }}">Образование</a>
182 <a href="{{ route('news') }}">Новости</a> 190 <a href="{{ route('news') }}">Новости</a>
183 <a href="{{ route('contacts') }}">Контакты</a> 191 <!--<a href=" route('contacts') }}">Контакты</a>-->
192 <a href="{{ $companies[0]->telegram }}">Телеграм</a>
193 <a href="{{ $companies[0]->vkontact }}">ВКонтакте</a>
184 <a href="{{ route('page', ['pages' => "Publichnaya-oferta-soiskatelyam"]) }}">Публичная оферта</a> 194 <a href="{{ route('page', ['pages' => "Publichnaya-oferta-soiskatelyam"]) }}">Публичная оферта</a>
185 </nav> 195 </nav>
186 </div> 196 </div>
187 <div class="footer__main-col"> 197 <div class="footer__main-col">
188 <div class="footer__main-title">Работодателям</div> 198 <div class="footer__main-title">Работодателям</div>
189 <nav> 199 <nav>
190 <a href="{{ route('register') }}">Регистрация</a> 200 <a data-fancybox data-src="#reg" data-options='{"touch":false,"autoFocus":false}'>Регистрация</a>
201 <!--<a href=" route('register') }}">Регистрация</a>-->
191 <a href="{{ route('bd_resume') }}">База резюме</a> 202 <a href="{{ route('bd_resume') }}">База резюме</a>
192 <a href="{{ route('page', ['pages' => "Stoimost-razmescheniya"]) }}">Стоимость размещения</a> 203 <a href="{{ route('page', ['pages' => "Usloviya-razmescheniya"]) }}">Условия размещения</a>
193 <a href="{{ route('page', ['pages' => "Instrukcii"]) }}">Инструкции</a> 204 <!--<a href=" route('page', ['pages' => "Stoimost-razmescheniya"]) }}">Стоимость размещения</a>-->
194 <a href="{{ route('page', ['pages' => "Effektivnost-obyavleniya"]) }}">Эффективность объявления</a> 205 <!--<a href=" route('page', ['pages' => "Instrukcii"]) }}">Инструкции</a>-->
206 <!--<a href=" route('page', ['pages' => "Effektivnost-obyavleniya"]) }}">Эффективность объявления</a>-->
207 <a href="{{ $companies[0]->telegram }}">Телеграм</a>
208 <a href="{{ $companies[0]->vkontact }}">ВКонтакте</a>
195 <a href="{{ route('page', ['pages' => "Publichnaya-oferta-rabotodatelyam"]) }}">Публичная оферта</a> 209 <a href="{{ route('page', ['pages' => "Publichnaya-oferta-rabotodatelyam"]) }}">Публичная оферта</a>
196 </nav> 210 </nav>
197 </div> 211 </div>
198 212
199 <div class="footer__main-col"> 213 <div class="footer__main-col">
200 <div class="footer__main-title">Контакты</div> 214 <div class="footer__main-title">Контакты</div>
201 <div class="footer__main-contacts"> 215 <div class="footer__main-contacts">
202 <a href="tel:{{ $companies[0]->telephone }}">{{ $companies[0]->telephone }}</a> 216 <a href="tel:{{ $companies[0]->telephone }}">{{ $companies[0]->telephone }}</a>
203 <a href="mailto:{{ $companies[0]->email }}">{{ $companies[0]->email }}</a> 217 <a href="mailto:{{ $companies[0]->email }}">{{ $companies[0]->email }}</a>
204 </div> 218 </div>
205 <div class="socials"> 219 <div class="socials">
206 <a href="{{ $companies[0]->vkontact }}" target="_blank"> 220 <a href="{{ $companies[0]->vkontact }}" target="_blank">
207 <svg> 221 <svg>
208 <use xlink:href="{{ asset('images/sprite.svg#vk') }}"></use> 222 <use xlink:href="{{ asset('images/sprite.svg#vk') }}"></use>
209 </svg> 223 </svg>
210 </a> 224 </a>
211 <a href="{{ $companies[0]->telegram }}" target="_blank"> 225 <a href="{{ $companies[0]->telegram }}" target="_blank">
212 <svg> 226 <svg>
213 <use xlink:href="{{ asset('images/sprite.svg#tg') }}"></use> 227 <use xlink:href="{{ asset('images/sprite.svg#tg') }}"></use>
214 </svg> 228 </svg>
215 </a> 229 </a>
216 </div> 230 </div>
217 </div> 231 </div>
218 </div> 232 </div>
219 233
220 <div class="footer__main-copy"> 234 <div class="footer__main-copy">
221 <div>&copy; 2023 &mdash; RekaMore.su</div> 235 <div>&copy; 2023 &mdash; RekaMore.su</div>
222 <nav> 236 <nav>
223 <a href="{{ route('page', ['pages' => "Politika-konfidencialnosti"]) }}">Политика конфиденциальности</a> 237 <a href="{{ route('page', ['pages' => "Politika-konfidencialnosti"]) }}">Политика конфиденциальности</a>
224 <span></span> 238 <span></span>
225 <a href="{{ route('page', ['pages' => "Polzovatelskoe-soglashenie"]) }}">Пользовательское соглашение</a> 239 <a href="{{ route('page', ['pages' => "Polzovatelskoe-soglashenie"]) }}">Пользовательское соглашение</a>
226 </nav> 240 </nav>
227 <div> @if (isset($_COOKIE['favorite_vacancy'])) Куки вакансий: {{ print_r($_COOKIE['favorite_vacancy']) }} @endif</div> 241 <div> @if (isset($_COOKIE['favorite_vacancy'])) Куки вакансий: {{ print_r($_COOKIE['favorite_vacancy']) }} @endif</div>
228 <a href="{{ route('index') }}" class="nls" target="_blank"> 242 <a href="{{ route('index') }}" class="nls" target="_blank">
229 <svg> 243 <svg>
230 <use xlink:href="{{ asset('images/sprite.svg#nls') }}"></use> 244 <use xlink:href="{{ asset('images/sprite.svg#nls') }}"></use>
231 </svg> 245 </svg>
232 <span> 246 <span>
233 Дизайн и разработка: 247 Дизайн и разработка:
234 <b>NoLogoStudio.ru</b> 248 <b>NoLogoStudio.ru</b>
235 </span> 249 </span>
236 </a> 250 </a>
237 </div> 251 </div>
238 </div> 252 </div>
239 </div> 253 </div>
240 </footer> 254 </footer>
241 </div> <!-- END BOTTOM WRAPPER --> 255 </div> <!-- END BOTTOM WRAPPER -->
242 256
243 <div hidden> <!-- BEGIN MODALS WRAPPER --> 257 <div hidden> <!-- BEGIN MODALS WRAPPER -->
244 <!-- Соискатель отправляет сообщение работодателю --> 258 <!-- Соискатель отправляет сообщение работодателю -->
245 @include('modals.send_worker_new') 259 @include('modals.send_worker_new')
246 260
247 <!-- Работодатель отправляет сообщение соискателю --> 261 <!-- Работодатель отправляет сообщение соискателю -->
248 @include('modals.send_employer') 262 @include('modals.send_employer')
249 263
250 <!-- Сообщение-предупреждение о том, что сообщения только можно отправить авторизованным пользователям --> 264 <!-- Сообщение-предупреждение о том, что сообщения только можно отправить авторизованным пользователям -->
251 @include('modals.send_message_noaut') 265 @include('modals.send_message_noaut')
252 266
253 @include('modals.send_message_noaut2') 267 @include('modals.send_message_noaut2')
254 268
255 <!-- Форма авторизации --> 269 <!-- Форма авторизации -->
256 @include('modals.send_login') 270 @include('modals.send_login')
257 271
258 <!-- Сбросить пароль --> 272 <!-- Сбросить пароль -->
259 @include('modals.reset_password') 273 @include('modals.reset_password')
260 274
261 <!-- Регистрация --> 275 <!-- Регистрация -->
262 @include('modals.register') 276 @include('modals.register')
263 277
264 <!-- Благодарность по отправке сообщения работодателю --> 278 <!-- Благодарность по отправке сообщения работодателю -->
265 @include('modals.thank_you_send_employer') 279 @include('modals.thank_you_send_employer')
266 280
267 <!-- Благодарность по отправке сообщения менеджеру --> 281 <!-- Благодарность по отправке сообщения менеджеру -->
268 @include('modals.thank_you_send_manager') 282 @include('modals.thank_you_send_manager')
269 283
270 <!-- Благодарность после регистрации --> 284 <!-- Благодарность после регистрации -->
271 @include('modals.thank_you_send_for_employer') 285 @include('modals.thank_you_send_for_employer')
272 286
273 <!-- Благодарность после регистрации для работника --> 287 <!-- Благодарность после регистрации для работника -->
274 @include('modals.thank_you_send_for_worker') 288 @include('modals.thank_you_send_for_worker')
275 289
276 <!-- Подтверждение удаления профиля --> 290 <!-- Подтверждение удаления профиля -->
277 @include('modals.delete_profile') 291 @include('modals.delete_profile')
278 292
279 <!-- Подверждение об удалении профиля --> 293 <!-- Подверждение об удалении профиля -->
280 @include('modals.success_delete_profile') 294 @include('modals.success_delete_profile')
281 295
282 </div> <!-- END MODALS WRAPPER --> 296 </div> <!-- END MODALS WRAPPER -->
283 297
284 298
285 <script src="{{ asset('js/jquery.maskedinput.js') }}"></script> 299 <script src="{{ asset('js/jquery.maskedinput.js') }}"></script>
286 <script src="{{ asset('js/jquery.fancybox.js') }}"></script> 300 <script src="{{ asset('js/jquery.fancybox.js') }}"></script>
287 <script src="{{ asset('js/jquery.select2.js') }}"></script> 301 <script src="{{ asset('js/jquery.select2.js') }}"></script>
288 <script src="{{ asset('js/swiper.js') }}"></script> 302 <script src="{{ asset('js/swiper.js') }}"></script>
289 <script src="{{ asset('js/script-vc.js') }}"></script> 303 <script src="{{ asset('js/script-vc.js') }}"></script>
290 <script src="{{ asset('js/star-rating.min.js') }}"></script> 304 <script src="{{ asset('js/star-rating.min.js') }}"></script>
291 <script> 305 <script>
292 var getUrlParameter = function getUrlParameter(sParam) { 306 var getUrlParameter = function getUrlParameter(sParam) {
293 var sPageURL = decodeURIComponent(window.location.search.substring(1)), 307 var sPageURL = decodeURIComponent(window.location.search.substring(1)),
294 sURLVariables = sPageURL.split('&'), 308 sURLVariables = sPageURL.split('&'),
295 sParameterName, 309 sParameterName,
296 i; 310 i;
297 for (i = 0; i < sURLVariables.length; i++) { 311 for (i = 0; i < sURLVariables.length; i++) {
298 sParameterName = sURLVariables[i].split('='); 312 sParameterName = sURLVariables[i].split('=');
299 if (sParameterName[0] === sParam) { 313 if (sParameterName[0] === sParam) {
300 return sParameterName[1] === undefined ? true : sParameterName[1]; 314 return sParameterName[1] === undefined ? true : sParameterName[1];
301 } 315 }
302 } 316 }
303 }; 317 };
304 </script> 318 </script>
305 @include('js.modals') 319 @include('js.modals')
306 @include('js.captha') 320 @include('js.captha')
307 @yield('scripts') 321 @yield('scripts')
308 </body> 322 </body>
309 </html> 323 </html>
310 324
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 @if ($infoblocks->count())
230 <table class="main__table">
231 <tbody>
232 @foreach ($infoblocks as $info)
233 @php $finder = false; @endphp
234 @if (isset($Query[0]->infobloks))
235 @if ($Query[0]->infobloks->count())
229 236
230 @if (isset($Query[0]->infobloks)) 237 @foreach($Query[0]->infobloks as $it)
231 @if ($Query[0]->infobloks->count()) 238 @if ($info->id == $it->id)
232 <table class="main__table"> 239 <tr>
233 <tbody> 240 <td><b>{{ $it->name }}</b></td>
234 @foreach($Query[0]->infobloks as $it) 241 <td>
235 <tr> 242 @if ($it->model_dop_info[0]->status == 0) Не указано
236 <td><b>{{ $it->name }}</b></td> 243 @elseif($it->model_dop_info[0]->status==1) В наличии
237 <td> 244 @else Отсутствует
238 @if ($it->model_dop_info[0]->status == 0) Не указано 245 @endif
239 @elseif($it->model_dop_info[0]->status==1) В наличии 246 </td>
240 @else Отсутствует 247 </tr>
241 @endif 248 @php $finder = true; @endphp
242 </td> 249 @endif
243 </tr> 250 @endforeach
244 @endforeach 251 @endif
245 </tbody> 252 @endif
246 </table> 253 @if (!$finder)
247 @endif 254 <tr>
255 <td><b>{{ $info->name }}</b></td>
256 <td>
257 Не указано
258 </td>
259 </tr>
260 @endif
261 @endforeach
262 </tbody>
263 </table>
248 @endif 264 @endif
249 </div> 265 </div>
250 </div> 266 </div>
251 </div> 267 </div>
252 268
253 <div class="main__resume-profile-about"> 269 <div class="main__resume-profile-about">
254 <h2 class="main__resume-profile-about-title">О себе</h2> 270 <h2 class="main__resume-profile-about-title">О себе</h2>
255 <p class="main__resume-profile-about-text">{{ $Query[0]->text }}</p> 271 <p class="main__resume-profile-about-text">{{ $Query[0]->text }}</p>
256 @if (App\Classes\StatusUser::Status()==0) 272 @if (App\Classes\StatusUser::Status()==0)
257 @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_message)) 273 @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_message))
258 <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> 274 <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 @endif 275 @endif
260 @endif 276 @endif
261 </div> 277 </div>
262 <div class="main__resume-profile-info"> 278 <div class="main__resume-profile-info">
263 <h2 class="main__resume-profile-info-title">Данные о прошлых компаниях</h2> 279 <h2 class="main__resume-profile-info-title">Данные о прошлых компаниях</h2>
264 <div class="main__resume-profile-info-body"> 280 <div class="main__resume-profile-info-body">
265 @if ((isset($Query[0]->prev_company)) && ($Query[0]->prev_company->count())) 281 @if ((isset($Query[0]->prev_company)) && ($Query[0]->prev_company->count()))
266 @foreach ($Query[0]->prev_company as $it) 282 @foreach ($Query[0]->prev_company as $it)
267 <div class="main__resume-profile-info-body-item"> 283 <div class="main__resume-profile-info-body-item">
268 <h3 class="main__resume-profile-info-body-subtitle">{{ $it->name_company }}</h3> 284 <h3 class="main__resume-profile-info-body-subtitle">{{ $it->name_company }}</h3>
269 <ul class="main__resume-profile-info-body-inner"> 285 <ul class="main__resume-profile-info-body-inner">
270 <li> 286 <li>
271 <b>Руководитель</b> 287 <b>Руководитель</b>
272 <span>{{ $it->direct }}</span> 288 <span>{{ $it->direct }}</span>
273 </li> 289 </li>
274 <li> 290 <li>
275 <b>Телефон того, кто может дать рекомендацию</b> 291 <b>Телефон того, кто может дать рекомендацию</b>
276 <span> 292 <span>
277 @if (!empty($it->telephone)) 293 @if (!empty($it->telephone))
278 <a href="tel:{{$it->telephone }}">{{ $it->telephone }}</a> 294 <a href="tel:{{$it->telephone }}">{{ $it->telephone }}</a>
279 @endif 295 @endif
280 @if (!empty($it->telephone2)) 296 @if (!empty($it->telephone2))
281 <a href="tel:{{$it->telephone2 }}">{{ $it->telephone2 }}</a> 297 <a href="tel:{{$it->telephone2 }}">{{ $it->telephone2 }}</a>
282 @endif 298 @endif
283 </span> 299 </span>
284 </li> 300 </li>
285 </ul> 301 </ul>
286 </div> 302 </div>
287 @endforeach 303 @endforeach
288 @else 304 @else
289 <div class="main__resume-profile-info-body-item"> 305 <div class="main__resume-profile-info-body-item">
290 <h3 class="main__resume-profile-info-body-subtitle">Нету данных о компании</h3> 306 <h3 class="main__resume-profile-info-body-subtitle">Нету данных о компании</h3>
291 </div> 307 </div>
292 @endif 308 @endif
293 </div> 309 </div>
294 </div> 310 </div>
295 311
296 <div class="main__resume-profile-info"> 312 <div class="main__resume-profile-info">
297 <h2 class="main__resume-profile-info-title">Количество просмотров страницы: ({{ $stat[0]->lookin }})</h2> 313 <h2 class="main__resume-profile-info-title">Количество просмотров страницы: ({{ $stat[0]->lookin }})</h2>
298 </div> 314 </div>
299 315
300 <div class="main__resume-profile-info"> 316 <div class="main__resume-profile-info">
301 <h2 class="main__resume-profile-info-title">Отзывы о работнике ({{ $Query[0]->response->count() }})</h2> 317 <h2 class="main__resume-profile-info-title">Отзывы о работнике ({{ $Query[0]->response->count() }})</h2>
302 <div class="main__resume-profile-info-body"> 318 <div class="main__resume-profile-info-body">
303 @if ((isset($Query[0]->response)) && ($Query[0]->response->count())) 319 @if ((isset($Query[0]->response)) && ($Query[0]->response->count()))
304 <div class="main__resume-profile-info-body-item"> 320 <div class="main__resume-profile-info-body-item">
305 <ul class="main__resume-profile-info-body-inner"> 321 <ul class="main__resume-profile-info-body-inner">
306 @php $i = 1; @endphp 322 @php $i = 1; @endphp
307 @foreach($Query[0]->response as $it) 323 @foreach($Query[0]->response as $it)
308 <li> 324 <li>
309 <span><h3>Комментарий №{{$i}}</h3></span> 325 <span><h3>Комментарий №{{$i}}</h3></span>
310 <span><b>Оценка человека: {{ $it->stars }}</b></span> 326 <span><b>Оценка человека: {{ $it->stars }}</b></span>
311 <span><b>Сообщение: </b>{{ $it->message }}</span> 327 <span><b>Сообщение: </b>{{ $it->message }}</span>
312 </li> 328 </li>
313 @php $i++; @endphp 329 @php $i++; @endphp
314 @endforeach 330 @endforeach
315 </ul> 331 </ul>
316 </div> 332 </div>
317 @else 333 @else
318 <div class="main__resume-profile-info-body-item"> 334 <div class="main__resume-profile-info-body-item">
319 <h3 class="main__resume-profile-info-body-subtitle">Нету комментариев</h3> 335 <h3 class="main__resume-profile-info-body-subtitle">Нету комментариев</h3>
320 </div> 336 </div>
321 @endif 337 @endif
322 </div> 338 </div>
323 </div> 339 </div>
324 340
325 <div class="main__resume-profile-review"> 341 <div class="main__resume-profile-review">
326 <form action="{{ route('stars_answer') }}" method="POST"> 342 <form action="{{ route('stars_answer') }}" method="POST">
327 @csrf 343 @csrf
328 <h2 class="main__resume-profile-review-title">Оставить отзыв о работнике</h2> 344 <h2 class="main__resume-profile-review-title">Оставить отзыв о работнике</h2>
329 <div class="rate"> 345 <div class="rate">
330 <div class="rate__label">Ваша оценка:</div> 346 <div class="rate__label">Ваша оценка:</div>
331 <div class="rate__stars"> 347 <div class="rate__stars">
332 <select name="stars" id="stars" class="star-rating js-stars"> 348 <select name="stars" id="stars" class="star-rating js-stars">
333 <option value="5">5</option> 349 <option value="5">5</option>
334 <option value="4">4</option> 350 <option value="4">4</option>
335 <option value="3">3</option> 351 <option value="3">3</option>
336 <option value="2">2</option> 352 <option value="2">2</option>
337 <option value="1" selected>1</option> 353 <option value="1" selected>1</option>
338 </select> 354 </select>
339 </div> 355 </div>
340 </div> 356 </div>
341 <input type="hidden" name="worker_id" id="worker_id" value="{{ $Query[0]->id }}"/> 357 <input type="hidden" name="worker_id" id="worker_id" value="{{ $Query[0]->id }}"/>
342 <div class="main__resume-profile-review-body"> 358 <div class="main__resume-profile-review-body">
343 <h3>Ваш отзыв</h3> 359 <h3>Ваш отзыв</h3>
344 <textarea class="textarea" name="message" id="message" placeholder="Текст отзыва&hellip;" required></textarea> 360 <textarea class="textarea" name="message" id="message" placeholder="Текст отзыва&hellip;" required></textarea>
345 <button type="submit" class="button">Оставить отзыв</button> 361 <button type="submit" class="button">Оставить отзыв</button>
346 </div> 362 </div>
347 </form> 363 </form>
348 </div> 364 </div>
349 </div> 365 </div>
350 </div> 366 </div>
351 </main> 367 </main>
352 </div> 368 </div>
353 @endsection 369 @endsection
354 370
resources/views/workers/favorite.blade.php
1 @extends('layout.frontend', ['title' => 'Избранные - РекаМоре']) 1 @extends('layout.frontend', ['title' => 'Избранные - РекаМоре'])
2 2
3 @section('scripts') 3 @section('scripts')
4 @include('js.favorite-vacancy-45') 4 @include('js.favorite-vacancy-45')
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 @include('workers.menu', ['item' => 3]) 20 @include('workers.menu', ['item' => 3])
21 </div> 21 </div>
22 22
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 <form class="search" action="{{ route('worker.colorado') }}" method="GET"> 30 <form class="search" action="{{ route('worker.colorado') }}" method="GET">
31 <input type="search" name="search" id="search" class="input" placeholder="Поиск&hellip;"> 31 <input type="search" name="search" id="search" class="input" placeholder="Поиск&hellip;">
32 <button type="submit" class="button">Найти</button> 32 <button type="submit" class="button">Найти</button>
33 <span> 33 <span>
34 <svg> 34 <svg>
35 <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> 35 <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use>
36 </svg> 36 </svg>
37 </span> 37 </span>
38 </form> 38 </form>
39 </div> 39 </div>
40 <!--<div class="cabinet__filters-item"> 40 <!--<div class="cabinet__filters-item">
41 <div class="select"> 41 <div class="select">
42 <select class="js-select2" id="sort_ajax" name="sort_ajax"> 42 <select class="js-select2" id="sort_ajax" name="sort_ajax">
43 <option value="default">Сортировка (по умолчанию)</option> 43 <option value="default">Сортировка (по умолчанию)</option>
44 <option value="name (asc)">По имени (возрастание)</option> 44 <option value="name (asc)">По имени (возрастание)</option>
45 <option value="name (desc)">По имени (убывание)</option> 45 <option value="name (desc)">По имени (убывание)</option>
46 <option value="created_at (asc)">По дате (возрастание)</option> 46 <option value="created_at (asc)">По дате (возрастание)</option>
47 <option value="created_at (desc)">По дате (убывание)</option> 47 <option value="created_at (desc)">По дате (убывание)</option>
48 </select> 48 </select>
49 </div> 49 </div>
50 </div>--> 50 </div>-->
51 </div> 51 </div>
52 @if ($Query->count()) 52 @if ($Query->count())
53 <div class="cabinet__vacs"> 53 <div class="cabinet__vacs">
54 <div id="main_ockar" name="main_ockar" class="cabinet__vacs-body" style="width:100%;"> 54 <div id="main_ockar" name="main_ockar" class="cabinet__vacs-body" style="width:100%;">
55 @foreach ($Query as $Q) 55 @foreach ($Query as $Q)
56 <div class="main__vacancies-item main__employer-page-two-item"> 56 <div class="main__vacancies-item main__employer-page-two-item">
57 <a href="{{ route('list-vacancies') }}" class="back main__employer-page-two-item-back"> 57 <a href="{{ route('list-vacancies') }}" class="back main__employer-page-two-item-back">
58 <svg> 58 <svg>
59 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> 59 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use>
60 </svg> 60 </svg>
61 <span> 61 <span>
62 Вернуться к списку вакансий 62 Вернуться к списку вакансий
63 </span> 63 </span>
64 </a> 64 </a>
65 <div class="main__employer-page-two-item-toper"> 65 <div class="main__employer-page-two-item-toper">
66 @if (!empty($Q->employer->logo)) 66 @if (!empty($Q->employer->logo))
67 <img src="{{ asset(Storage::url($Q->employer->logo)) }}" alt="{{ $Q->employer->name }}"> 67 <img src="{{ asset(Storage::url($Q->employer->logo)) }}" alt="{{ $Q->employer->name }}">
68 @else 68 @else
69 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $Q->employer->name }}" class="main__vacancies-thing-pic"> 69 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $Q->employer->name }}" class="main__vacancies-thing-pic">
70 @endif 70 @endif
71 <span>@if (!empty($Q->name)) {{ $Q->name }} @endif</span> 71 <span>@if (!empty($Q->name)) {{ $Q->name }} @endif</span>
72 </div> 72 </div>
73 <div class="main__employer-page-two-item-text"> 73 <div class="main__employer-page-two-item-text">
74 <div class="main__employer-page-two-item-text-name">Судоходная компания ведет набор 74 <div class="main__employer-page-two-item-text-name">Судоходная компания ведет набор
75 специалистов на следующие должности:</div> 75 специалистов на следующие должности:</div>
76 <div class="main__employer-page-two-item-text-links"> 76 <div class="main__employer-page-two-item-text-links">
77 @if (isset($Q->jobs)) 77 @if (isset($Q->jobs))
78 @foreach ($Q->jobs as $key => $j) 78 @foreach ($Q->jobs as $key => $j)
79 <a>“{{ $j->name }}” – з/п от @if (isset($Q->jobs_code[$key]->min_salary)) {{ $Q->jobs_code[$key]->min_salary }} @endif - @if (isset($Q->jobs_code[$key]->max_salary)) {{ $Q->jobs_code[$key]->max_salary }} @endif рублей (на руки)</a> 79 <a>“{{ $j->name }}” – з/п от @if (isset($Q->jobs_code[$key]->min_salary)) {{ $Q->jobs_code[$key]->min_salary }} @endif - @if (isset($Q->jobs_code[$key]->max_salary)) {{ $Q->jobs_code[$key]->max_salary }} @endif рублей (на руки)</a>
80 @endforeach 80 @endforeach
81 @endif 81 @endif
82 </div> 82 </div>
83 </div> 83 </div>
84 <div class="main__employer-page-two-item-text"> 84 <div class="main__employer-page-two-item-text">
85 <div class="main__employer-page-two-item-text-name">Мы предлагаем:</div> 85 <div class="main__employer-page-two-item-text-name">Мы предлагаем:</div>
86 <div class="main__employer-page-two-item-text-body"> 86 <div class="main__employer-page-two-item-text-body">
87 {!! $Q->text !!} 87 {!! $Q->text !!}
88 </div> 88 </div>
89 </div> 89 </div>
90 <div class="main__employer-page-two-item-text"> 90 <div class="main__employer-page-two-item-text">
91 <div class="main__employer-page-two-item-text-name">Наши ожидания:</div> 91 <div class="main__employer-page-two-item-text-name">Наши ожидания:</div>
92 <div class="main__employer-page-two-item-text-body"> 92 <div class="main__employer-page-two-item-text-body">
93 {!! $Q->description !!} 93 {!! $Q->description !!}
94 </div> 94 </div>
95 </div> 95 </div>
96 <div class="main__employer-page-two-item-text"> 96 <div class="main__employer-page-two-item-text">
97 <div class="main__employer-page-two-item-text-name">Резюме направляйте на почту:</div> 97 <div class="main__employer-page-two-item-text-name">Резюме направляйте на почту:</div>
98 <div class="main__employer-page-two-item-text-body"> 98 <div class="main__employer-page-two-item-text-body">
99 {!! $Q->contacts_emails !!} 99 {!! $Q->contacts_emails !!}
100 </div> 100 </div>
101 </div> 101 </div>
102 <div class="main__employer-page-two-item-text"> 102 <div class="main__employer-page-two-item-text">
103 <div class="main__employer-page-two-item-text-name">Или звоните:</div> 103 <div class="main__employer-page-two-item-text-name">Или звоните:</div>
104 <div class="main__employer-page-two-item-text-body"> 104 <div class="main__employer-page-two-item-text-body">
105 {!! $Q->contacts_telephones !!} 105 {!! $Q->contacts_telephones !!}
106 </div> 106 </div>
107 </div> 107 </div>
108 <div class="main__employer-page-two-item-tags"> 108 <div class="main__employer-page-two-item-tags">
109 @if (isset($Q->jobs)) 109 @if (isset($Q->jobs))
110 @foreach ($Q->jobs as $key => $j) 110 @foreach ($Q->jobs as $key => $j)
111 <span class="main__employer-page-two-item-tag">#{{ $j->name }}</span> 111 <span class="main__employer-page-two-item-tag">#{{ $j->name }}</span>
112 @endforeach 112 @endforeach
113 @endif 113 @endif
114 </div> 114 </div>
115 <div class="main__employer-page-two-item-buttons"> 115 <div class="main__employer-page-two-item-buttons">
116 <!--<button type="button" 116 <!--<button type="button"
117 class="button main__employer-page-two-item-button">Откликнуться</button>--> 117 class="button main__employer-page-two-item-button">Откликнуться</button>-->
118 <a href="{{ route('vacancie', ['vacancy' => $Q->id]) }}" class="button button_light main__employer-page-two-item-button">Подробнее</a> 118 <a href="{{ route('vacancie', ['vacancy' => $Q->id]) }}" class="button button_light main__employer-page-two-item-button">Подробнее</a>
119 </div> 119 </div>
120 <div class="main__employer-page-two-item-bottom"> 120 <div class="main__employer-page-two-item-bottom">
121 <div class="main__employer-page-two-item-bottom-date">{{ $Q->created_at }}</div> 121 <div class="main__employer-page-two-item-bottom-date">{{ $Q->created_at }}</div>
122 <button type="button" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js-toggle js_vac_favorite {{ \App\Classes\LikesClass::get_status_vacancy($Q) }}?>"> 122 <button type="button" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js-toggle js_vac_favorite {{ \App\Classes\LikesClass::get_status_vacancy($Q) }}?>">
123 <svg> 123 <svg>
124 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> 124 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use>
125 </svg> 125 </svg>
126 </button> 126 </button>
127 </div> 127 </div>
128 </div> 128 </div>
129 @endforeach 129 @endforeach
130 <div style="margin-top: 20px"> 130 <div style="margin-top: 20px">
131 {{ $Query->appends($_GET)->links('paginate') }} 131 {{ $Query->appends($_GET)->links('paginate') }}
132 </div> 132 </div>
133 </div> 133 </div>
134 @else 134 @else
135 <div class="notify"> 135 <div class="notify">
136 <svg> 136 <svg>
137 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> 137 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use>
138 </svg> 138 </svg>
139 <span>Нет избранных должностей!</span> 139 <span>Нет избранных вакансий</span>
140 </div> 140 </div>
141 @endif 141 @endif
142 </div> 142 </div>
143 </div> 143 </div>
144 </div> 144 </div>
145 </div> 145 </div>
146 </section> 146 </section>
147 </div> 147 </div>
148 148
149 @endsection 149 @endsection
150 150