Commit a873cda1eb12742954e844a5c60f77a1328de37b

Authored by Андрей Ларионов
1 parent 2726f0123a

Коммит обновление патча

Showing 3 changed files with 14 additions and 2 deletions Inline Diff

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')->orderBy('id')->limit(8)->get(); 93 $employers = employers_main::query()->with('employer')->
94 whereHas('employer', function ($query) {
95 $query->where('status_hidden', '=', '0');
96 })->
97 orderBy('id')->limit(8)->get();
94 $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get(); 98 $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get();
95 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'));
96 } 100 }
97 101
98 public function search_vacancies(Request $request) { 102 public function search_vacancies(Request $request) {
99 if ($request->has('search')) { 103 if ($request->has('search')) {
100 $search = $request->get('search'); 104 $search = $request->get('search');
101 $job_titles = Job_title::query()->where('name', 'LIKE', "%$search%")->first(); 105 $job_titles = Job_title::query()->where('name', 'LIKE', "%$search%")->first();
102 if (isset($job_titles->id)) 106 if (isset($job_titles->id))
103 if ($job_titles->id > 0) 107 if ($job_titles->id > 0)
104 return redirect()->route('vacancies', ['job' => $job_titles->id]); 108 return redirect()->route('vacancies', ['job' => $job_titles->id]);
105 } 109 }
106 } 110 }
107 111
108 // Лайк вакансии 112 // Лайк вакансии
109 public function like_vacancy(Request $request) { 113 public function like_vacancy(Request $request) {
110 $IP_address = RusDate::ip_addr_client(); 114 $IP_address = RusDate::ip_addr_client();
111 115
112 if ($request->has('code_record')) { 116 if ($request->has('code_record')) {
113 if ($request->has('delete')) { 117 if ($request->has('delete')) {
114 $code = $request->get('code_record'); 118 $code = $request->get('code_record');
115 $atomic_era = Like_vacancy::select('id')-> 119 $atomic_era = Like_vacancy::select('id')->
116 where('code_record', '=', $code)->toSql(); 120 where('code_record', '=', $code)->toSql();
117 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();
118 122
119 } else { 123 } else {
120 $params = $request->all(); 124 $params = $request->all();
121 $params['ip_address'] = $IP_address; 125 $params['ip_address'] = $IP_address;
122 Like_vacancy::create($params); 126 Like_vacancy::create($params);
123 } 127 }
124 } 128 }
125 } 129 }
126 130
127 // Лайк соискателю. 131 // Лайк соискателю.
128 public function like_worker(Request $request) { 132 public function like_worker(Request $request) {
129 $IP_address = RusDate::ip_addr_client(); 133 $IP_address = RusDate::ip_addr_client();
130 134
131 if ($request->has('code_record')) { 135 if ($request->has('code_record')) {
132 if ($request->has('delete')) { 136 if ($request->has('delete')) {
133 $atomic_era = Like_worker::select('id')-> 137 $atomic_era = Like_worker::select('id')->
134 where('code_record', '=', $request-> 138 where('code_record', '=', $request->
135 get('code_record'))->first(); 139 get('code_record'))->first();
136 140
137 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();
138 142
139 return "Вот и результат удаления!"; 143 return "Вот и результат удаления!";
140 144
141 } else { 145 } else {
142 $params = $request->all(); 146 $params = $request->all();
143 $params['ip_address'] = $IP_address; 147 $params['ip_address'] = $IP_address;
144 Like_worker::create($params); 148 Like_worker::create($params);
145 } 149 }
146 } 150 }
147 } 151 }
148 152
149 public function vacancies(Request $request) { 153 public function vacancies(Request $request) {
150 //должности 154 //должности
151 $Job_title = Job_title::query()->where('is_remove', '=', '0')-> 155 $Job_title = Job_title::query()->where('is_remove', '=', '0')->
152 where('is_bd', '=', '0')->orderBy('name')->get(); 156 where('is_bd', '=', '0')->orderBy('name')->get();
153 157
154 $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') 158 $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*')
155 ->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')
156 ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') 160 ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id')
157 ->join('ad_jobs', 'ad_jobs.ad_employer_id', '=', 'ad_employers.id'); 161 ->join('ad_jobs', 'ad_jobs.ad_employer_id', '=', 'ad_employers.id');
158 162
159 //категории и вакансии 163 //категории и вакансии
160 if (($request->has('job')) && ($request->get('job') > 0)) { 164 if (($request->has('job')) && ($request->get('job') > 0)) {
161 $categories = $categories->Where('job_title_id', '=', $request->get('job')); 165 $categories = $categories->Where('job_title_id', '=', $request->get('job'));
162 } 166 }
163 167
164 $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get(); 168 $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get();
165 169
166 //$Position = Category::query()->where('is_remove', '=', '0')->get(); 170 //$Position = Category::query()->where('is_remove', '=', '0')->get();
167 171
168 /*$BigFlot = Array(); 172 /*$BigFlot = Array();
169 foreach ($Position as $position) { 173 foreach ($Position as $position) {
170 $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> 174 $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')->
171 orderBy('job_titles.sort')-> 175 orderBy('job_titles.sort')->
172 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> 176 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')->
173 where('position_ship', "$position->name"); 177 where('position_ship', "$position->name");
174 if (($request->has('job')) && ($request->get('job') > 0)) { 178 if (($request->has('job')) && ($request->get('job') > 0)) {
175 $War_flot = $War_flot->where('job_title_id', $request->get('job')); 179 $War_flot = $War_flot->where('job_title_id', $request->get('job'));
176 } 180 }
177 $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); 181 $War_flot = $War_flot->groupby('job_title_id','position_ship')->get();
178 $BigFlot[] = $War_flot; 182 $BigFlot[] = $War_flot;
179 }*/ 183 }*/
180 /* 184 /*
181 $BigFlot = Array(); 185 $BigFlot = Array();
182 foreach ($Position as $position) { 186 foreach ($Position as $position) {
183 $WarFlot = DB::table('ad_jobs')-> 187 $WarFlot = DB::table('ad_jobs')->
184 selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> 188 selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')->
185 orderByDesc('job_titles.sort')-> 189 orderByDesc('job_titles.sort')->
186 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> 190 join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')->
187 where('job_titles.position_id', $position->id); 191 where('job_titles.position_id', $position->id);
188 if (($request->has('job')) && ($request->get('job') > 0)) { 192 if (($request->has('job')) && ($request->get('job') > 0)) {
189 $WarFlot = $WarFlot->where('job_title_id', $request->get('job')); 193 $WarFlot = $WarFlot->where('job_title_id', $request->get('job'));
190 } 194 }
191 $WarFlot = $WarFlot->groupby('job_title_id')->get(); 195 $WarFlot = $WarFlot->groupby('job_title_id')->get();
192 $BigFlot[] = $WarFlot; 196 $BigFlot[] = $WarFlot;
193 } 197 }
194 */ 198 */
195 199
196 $Data = DB::table('job_titles')-> 200 $Data = DB::table('job_titles')->
197 selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> 201 selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')->
198 where('categories.is_remove', '=', '0')-> 202 where('categories.is_remove', '=', '0')->
199 where('job_titles.is_bd', '=' , '0')-> 203 where('job_titles.is_bd', '=' , '0')->
200 where('job_titles.is_remove', '=', '0'); 204 where('job_titles.is_remove', '=', '0');
201 if (($request->has('job')) && ($request->get('job') > 0)) { 205 if (($request->has('job')) && ($request->get('job') > 0)) {
202 $Data = $Data->where('job_title_id', $request->get('job')); 206 $Data = $Data->where('job_title_id', $request->get('job'));
203 } 207 }
204 $Data = $Data->leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> 208 $Data = $Data->leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')->
205 join('categories', 'categories.id', '=', 'job_titles.position_id')-> 209 join('categories', 'categories.id', '=', 'job_titles.position_id')->
206 groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')-> 210 groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')->
207 orderByDesc('job_titles.sort')->get()->toArray(); 211 orderByDesc('job_titles.sort')->get()->toArray();
208 212
209 $Main_Job = array(); 213 $Main_Job = array();
210 $name_cat = ''; 214 $name_cat = '';
211 foreach ($Data as $it) { 215 foreach ($Data as $it) {
212 $it_arr = (array)$it; 216 $it_arr = (array)$it;
213 if ($name_cat != $it_arr['catname']) 217 if ($name_cat != $it_arr['catname'])
214 $name_cat = $it_arr['catname']; 218 $name_cat = $it_arr['catname'];
215 $Main_Job[$name_cat][] = $it_arr; 219 $Main_Job[$name_cat][] = $it_arr;
216 } 220 }
217 221
218 if ($request->ajax()) { 222 if ($request->ajax()) {
219 return view('ajax.new_sky', compact('categories', 'Main_Job')); 223 return view('ajax.new_sky', compact('categories', 'Main_Job'));
220 } else { 224 } else {
221 return view('new_sky', compact('Job_title', 'categories', 'Main_Job')); 225 return view('new_sky', compact('Job_title', 'categories', 'Main_Job'));
222 } 226 }
223 } 227 }
224 228
225 //Вакансии категория детальная 229 //Вакансии категория детальная
226 public function list_vacancies(Category $categories, Request $request) { 230 public function list_vacancies(Category $categories, Request $request) {
227 if (isset(Auth()->user()->id)) 231 if (isset(Auth()->user()->id))
228 $uid = Auth()->user()->id; 232 $uid = Auth()->user()->id;
229 else 233 else
230 $uid = 0; 234 $uid = 0;
231 235
232 if ($request->get('job') == 0) 236 if ($request->get('job') == 0)
233 $job_search = ''; 237 $job_search = '';
234 else 238 else
235 $job_search = $request->get('job'); 239 $job_search = $request->get('job');
236 240
237 $Query = Ad_employer::with('jobs')-> 241 $Query = Ad_employer::with('jobs')->
238 with('cat')-> 242 with('cat')->
239 with('employer')-> 243 with('employer')->
240 244
241 whereHas('jobs_code', function ($query) use ($job_search) { 245 whereHas('jobs_code', function ($query) use ($job_search) {
242 if (!empty($job_search)) { 246 if (!empty($job_search)) {
243 $query->where('job_title_id', $job_search); 247 $query->where('job_title_id', $job_search);
244 } 248 }
245 })->select('ad_employers.*'); 249 })->select('ad_employers.*');
246 250
247 if (isset($categories->id) && ($categories->id > 0)) { 251 if (isset($categories->id) && ($categories->id > 0)) {
248 $Query = $Query->where('category_id', '=', $categories->id); 252 $Query = $Query->where('category_id', '=', $categories->id);
249 $Name_categori = Category::query()->where('id', '=', $categories->id)->get(); 253 $Name_categori = Category::query()->where('id', '=', $categories->id)->get();
250 } else { 254 } else {
251 $Name_categori = ''; 255 $Name_categori = '';
252 } 256 }
253 257
254 if ($request->get('sort')) { 258 if ($request->get('sort')) {
255 $sort = $request->get('sort'); 259 $sort = $request->get('sort');
256 switch ($sort) { 260 switch ($sort) {
257 case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break; 261 case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break;
258 case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break; 262 case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break;
259 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;
260 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;
261 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; 265 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break;
262 default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; 266 default: $Query = $Query->orderBy('id')->orderby('updated_at'); break;
263 } 267 }
264 } 268 }
265 269
266 $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();
267 271
268 $Query_count = $Query->count(); 272 $Query_count = $Query->count();
269 273
270 $Query = $Query->OrderBy('updated_at')->paginate(3); 274 $Query = $Query->OrderBy('updated_at')->paginate(3);
271 275
272 $Reclama = reclame::query()->get(); 276 $Reclama = reclame::query()->get();
273 277
274 if ($request->ajax()) { 278 if ($request->ajax()) {
275 if ($request->has('title')) { 279 if ($request->has('title')) {
276 return view('ajax.list_category', compact( 280 return view('ajax.list_category', compact(
277 'Name_categori' 281 'Name_categori'
278 )); 282 ));
279 } else { 283 } else {
280 return view('ajax.list_vacancies', compact('Query', 284 return view('ajax.list_vacancies', compact('Query',
281 'Query_count', 285 'Query_count',
282 'Name_categori', 286 'Name_categori',
283 'Reclama', 287 'Reclama',
284 'categories', 288 'categories',
285 'Job_title', 289 'Job_title',
286 'uid')); 290 'uid'));
287 } 291 }
288 } else { 292 } else {
289 //Вернуть все 293 //Вернуть все
290 return view('list_vacancies', compact('Query', 294 return view('list_vacancies', compact('Query',
291 'Query_count', 295 'Query_count',
292 'Reclama', 296 'Reclama',
293 'Name_categori', 297 'Name_categori',
294 'categories', 298 'categories',
295 'Job_title', 299 'Job_title',
296 'uid')); 300 'uid'));
297 } 301 }
298 } 302 }
299 303
300 // Образование 304 // Образование
301 public function education(Request $request) { 305 public function education(Request $request) {
302 $educations = Education::query(); 306 $educations = Education::query();
303 if (($request->has('search')) && (!empty($request->get('search')))) { 307 if (($request->has('search')) && (!empty($request->get('search')))) {
304 $search = trim($request->get('search')); 308 $search = trim($request->get('search'));
305 $educations = $educations->where('name', 'LIKE', "%$search%"); 309 $educations = $educations->where('name', 'LIKE', "%$search%");
306 } 310 }
307 311
308 if ($request->get('sort')) { 312 if ($request->get('sort')) {
309 $sort = $request->get('sort'); 313 $sort = $request->get('sort');
310 switch ($sort) { 314 switch ($sort) {
311 case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break; 315 case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break;
312 case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break; 316 case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break;
313 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;
314 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;
315 case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break; 319 case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break;
316 default: $educations = $educations->orderBy('id')->orderby('updated_at'); break; 320 default: $educations = $educations->orderBy('id')->orderby('updated_at'); break;
317 } 321 }
318 } 322 }
319 323
320 $count_edu = $educations->count(); 324 $count_edu = $educations->count();
321 $educations = $educations->paginate(6); 325 $educations = $educations->paginate(6);
322 if ($request->ajax()) { 326 if ($request->ajax()) {
323 return view('ajax.education', compact('educations')); 327 return view('ajax.education', compact('educations'));
324 } else { 328 } else {
325 return view('education', compact('educations', 'count_edu')); 329 return view('education', compact('educations', 'count_edu'));
326 } 330 }
327 } 331 }
328 332
329 // Контакты 333 // Контакты
330 public function contacts() { 334 public function contacts() {
331 return view('contacts'); 335 return view('contacts');
332 } 336 }
333 337
334 // Вход в личный кабинет 338 // Вход в личный кабинет
335 public function input_login(Request $request) 339 public function input_login(Request $request)
336 { 340 {
337 $params = $request->all(); 341 $params = $request->all();
338 342
339 343
340 $rules = [ 344 $rules = [
341 'email' => 'required|string|email', 345 'email' => 'required|string|email',
342 'password' => 'required|string|min:3|max:25', 346 'password' => 'required|string|min:3|max:25',
343 ]; 347 ];
344 348
345 $messages = [ 349 $messages = [
346 'required' => 'Укажите обязательное поле «:attribute»', 350 'required' => 'Укажите обязательное поле «:attribute»',
347 'email' => 'Введите корректный email', 351 'email' => 'Введите корректный email',
348 'min' => [ 352 'min' => [
349 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 353 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
350 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 354 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
351 ], 355 ],
352 'max' => [ 356 'max' => [
353 'string' => 'Поле «:attribute» должно быть не больше :max символов', 357 'string' => 'Поле «:attribute» должно быть не больше :max символов',
354 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 358 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
355 ], 359 ],
356 ]; 360 ];
357 $validator = Validator::make($request->all(), $rules, $messages); 361 $validator = Validator::make($request->all(), $rules, $messages);
358 if ($validator->fails()) { 362 if ($validator->fails()) {
359 if (Auth::check()) 363 if (Auth::check())
360 $user_id = $request->user()->id; 364 $user_id = $request->user()->id;
361 else 365 else
362 $user_id = 0; 366 $user_id = 0;
363 367
364 if ($user_id > 0) 368 if ($user_id > 0)
365 return json_encode(Array("ERROR" => "Email или пароль невалидный!")); 369 return json_encode(Array("ERROR" => "Email или пароль невалидный!"));
366 else 370 else
367 return redirect()->route('index')->with('Error', "Email или пароль невалидный"); 371 return redirect()->route('index')->with('Error', "Email или пароль невалидный");
368 } else { 372 } else {
369 $credentials = $request->only('email', 'password'); 373 $credentials = $request->only('email', 'password');
370 374
371 if (Auth::attempt($credentials, $request->has('remember'))) { 375 if (Auth::attempt($credentials, $request->has('remember'))) {
372 376
373 if (is_null(Auth::user()->email_verified_at)) { 377 if (is_null(Auth::user()->email_verified_at)) {
374 Auth::logout(); 378 Auth::logout();
375 return json_encode(Array("ERROR" => "Адрес почты не подтвержден")); 379 return json_encode(Array("ERROR" => "Адрес почты не подтвержден"));
376 } 380 }
377 381
378 if (Auth::user()->is_worker) { 382 if (Auth::user()->is_worker) {
379 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl())); 383 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));
380 } else { 384 } else {
381 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl())); 385 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));
382 } 386 }
383 387
384 return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет")); 388 return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет"));
385 //->route('index') 389 //->route('index')
386 //->with('success', 'Вы вошли в личный кабинет.'); 390 //->with('success', 'Вы вошли в личный кабинет.');
387 } else { 391 } else {
388 return json_encode(Array("ERROR" => "Неверный логин или пароль!")); 392 return json_encode(Array("ERROR" => "Неверный логин или пароль!"));
389 } 393 }
390 } 394 }
391 } 395 }
392 396
393 // Восстановление пароля 397 // Восстановление пароля
394 public function repair_password(Request $request) { 398 public function repair_password(Request $request) {
395 $rules = [ 399 $rules = [
396 'email' => 'required|string|email', 400 'email' => 'required|string|email',
397 ]; 401 ];
398 402
399 $messages = [ 403 $messages = [
400 'required' => 'Укажите обязательное поле «:attribute»', 404 'required' => 'Укажите обязательное поле «:attribute»',
401 'email' => 'Введите корректный email', 405 'email' => 'Введите корректный email',
402 'min' => [ 406 'min' => [
403 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 407 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
404 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 408 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
405 ], 409 ],
406 'max' => [ 410 'max' => [
407 'string' => 'Поле «:attribute» должно быть не больше :max символов', 411 'string' => 'Поле «:attribute» должно быть не больше :max символов',
408 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 412 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
409 ], 413 ],
410 ]; 414 ];
411 415
412 $validator = Validator::make($request->all(), $rules, $messages); 416 $validator = Validator::make($request->all(), $rules, $messages);
413 417
414 if ($validator->fails()) { 418 if ($validator->fails()) {
415 return redirect()->back()->with('Error', "Email невалидный"); 419 return redirect()->back()->with('Error', "Email невалидный");
416 } else { 420 } else {
417 $new_password = Tools::generator_id(10); 421 $new_password = Tools::generator_id(10);
418 $hash_password = Hash::make($new_password); 422 $hash_password = Hash::make($new_password);
419 $user = User::query()->where('email', $request->get('email'))->first(); 423 $user = User::query()->where('email', $request->get('email'))->first();
420 $EditRec = User::find($user->id); 424 $EditRec = User::find($user->id);
421 $EditRec->password = $hash_password; 425 $EditRec->password = $hash_password;
422 $EditRec->save(); 426 $EditRec->save();
423 427
424 foreach ([$request->get('email')] as $recipient) { 428 foreach ([$request->get('email')] as $recipient) {
425 Mail::to($recipient)->send(new MailRepair($new_password)); 429 Mail::to($recipient)->send(new MailRepair($new_password));
426 } 430 }
427 return redirect()->route('index'); 431 return redirect()->route('index');
428 432
429 } 433 }
430 434
431 } 435 }
432 436
433 // Вывод новостей 437 // Вывод новостей
434 public function news(Request $request) { 438 public function news(Request $request) {
435 $Query = News::query(); 439 $Query = News::query();
436 if ($request->has('search')) { 440 if ($request->has('search')) {
437 $search = $request->get('search'); 441 $search = $request->get('search');
438 $Query = $Query->where('title', 'LIKE', "%$search%")-> 442 $Query = $Query->where('title', 'LIKE', "%$search%")->
439 orWhere('text', 'LIKE', "%$search%"); 443 orWhere('text', 'LIKE', "%$search%");
440 } 444 }
441 445
442 if ($request->ajax()) { 446 if ($request->ajax()) {
443 if ($request->get('sort')) { 447 if ($request->get('sort')) {
444 $sort = $request->get('sort'); 448 $sort = $request->get('sort');
445 switch ($sort) { 449 switch ($sort) {
446 case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break; 450 case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break;
447 case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break; 451 case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break;
448 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;
449 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;
450 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; 454 case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break;
451 default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; 455 default: $Query = $Query->orderBy('id')->orderby('updated_at'); break;
452 } 456 }
453 } 457 }
454 } 458 }
455 $Query_count = $Query->count(); 459 $Query_count = $Query->count();
456 $Query = $Query->paginate(6); 460 $Query = $Query->paginate(6);
457 461
458 if ($request->ajax()) { 462 if ($request->ajax()) {
459 return view('ajax.news-list', compact('Query', 'Query_count')); 463 return view('ajax.news-list', compact('Query', 'Query_count'));
460 } else { 464 } else {
461 return view('news-list', compact('Query', 'Query_count')); 465 return view('news-list', compact('Query', 'Query_count'));
462 } 466 }
463 } 467 }
464 468
465 //Детальная новость 469 //Детальная новость
466 public function detail_new(News $new) { 470 public function detail_new(News $new) {
467 // Наборка 471 // Наборка
468 $Query = News::query()->where('id', $new->id)->get(); 472 $Query = News::query()->where('id', $new->id)->get();
469 $title = $Query[0]->title; 473 $title = $Query[0]->title;
470 $All_Query = News::query()->paginate(8); 474 $All_Query = News::query()->paginate(8);
471 return view('detail_new', compact('Query', 'All_Query', 'title')); 475 return view('detail_new', compact('Query', 'All_Query', 'title'));
472 } 476 }
473 } 477 }
474 478
resources/views/employers/list_vacancy.blade.php
1 @extends('layout.frontend', ['title' => 'Список вакансий - РекаМоре']) 1 @extends('layout.frontend', ['title' => 'Список вакансий - РекаМоре'])
2 2
3 @section('scripts') 3 @section('scripts')
4 <script> 4 <script>
5 console.log('Test system'); 5 console.log('Test system');
6 $(document).on('change', '#sort_ajax', function() { 6 $(document).on('change', '#sort_ajax', function() {
7 var this_ = $(this); 7 var this_ = $(this);
8 var val_ = this_.val(); 8 var val_ = this_.val();
9 console.log('sort items '+val_); 9 console.log('sort items '+val_);
10 10
11 $.ajax({ 11 $.ajax({
12 type: "GET", 12 type: "GET",
13 url: "{{ route('employer.vacancy_list') }}", 13 url: "{{ route('employer.vacancy_list') }}",
14 data: "sort="+val_, 14 data: "sort="+val_,
15 success: function (data) { 15 success: function (data) {
16 console.log('Выбор сортировки'); 16 console.log('Выбор сортировки');
17 console.log(data); 17 console.log(data);
18 history.pushState({}, '', "{{ route('employer.vacancy_list') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); 18 history.pushState({}, '', "{{ route('employer.vacancy_list') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif");
19 $('#main_ockar').html(data); 19 $('#main_ockar').html(data);
20 }, 20 },
21 headers: { 21 headers: {
22 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 22 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
23 }, 23 },
24 error: function (data) { 24 error: function (data) {
25 data = JSON.stringify(data); 25 data = JSON.stringify(data);
26 console.log('Error: ' + data); 26 console.log('Error: ' + data);
27 } 27 }
28 }); 28 });
29 }); 29 });
30 </script> 30 </script>
31 @endsection 31 @endsection
32 32
33 @section('content') 33 @section('content')
34 <section class="cabinet"> 34 <section class="cabinet">
35 <div class="container"> 35 <div class="container">
36 <ul class="breadcrumbs cabinet__breadcrumbs"> 36 <ul class="breadcrumbs cabinet__breadcrumbs">
37 <li><a href="{{ route('index') }}">Главная</a></li> 37 <li><a href="{{ route('index') }}">Главная</a></li>
38 <li><b>Личный кабинет</b></li> 38 <li><b>Личный кабинет</b></li>
39 </ul> 39 </ul>
40 <div class="cabinet__wrapper"> 40 <div class="cabinet__wrapper">
41 <div class="cabinet__side"> 41 <div class="cabinet__side">
42 <div class="cabinet__side-toper"> 42 <div class="cabinet__side-toper">
43 43
44 @include('employers.emblema') 44 @include('employers.emblema')
45 45
46 </div> 46 </div>
47 47
48 @include('employers.menu', ['item' => 3]) 48 @include('employers.menu', ['item' => 3])
49 </div> 49 </div>
50 <div class="cabinet__body"> 50 <div class="cabinet__body">
51 <div class="cabinet__body-item"> 51 <div class="cabinet__body-item">
52 <h2 class="title cabinet__title">Мои вакансии</h2> 52 <h2 class="title cabinet__title">Мои вакансии</h2>
53 </div> 53 </div>
54 <div class="cabinet__body-item"> 54 <div class="cabinet__body-item">
55 <div class="cabinet__filters"> 55 <div class="cabinet__filters">
56 <div class="cabinet__filters-item"> 56 <div class="cabinet__filters-item">
57 <form class="search"> 57 <form class="search">
58 <input type="search" class="input" placeholder="Поиск&hellip;" required> 58 <input type="search" class="input" placeholder="Поиск&hellip;" required>
59 <button type="submit" class="button">Найти</button> 59 <button type="submit" class="button">Найти</button>
60 <span> 60 <span>
61 <svg> 61 <svg>
62 <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> 62 <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use>
63 </svg> 63 </svg>
64 </span> 64 </span>
65 </form> 65 </form>
66 </div> 66 </div>
67 <div class="cabinet__filters-item"> 67 <div class="cabinet__filters-item">
68 <div class="select"> 68 <div class="select">
69 <select class="js-select2" id="sort_ajax" name="sort_ajax"> 69 <select class="js-select2" id="sort_ajax" name="sort_ajax">
70 <option value="default">Сортировка (по умолчанию)</option> 70 <option value="default">Сортировка (по умолчанию)</option>
71 <option value="name_up">По имени (возрастание)</option> 71 <option value="name_up">По имени (возрастание)</option>
72 <option value="name_down">По имени (убывание)</option> 72 <option value="name_down">По имени (убывание)</option>
73 <option value="created_at_up">По дате (возрастание)</option> 73 <option value="created_at_up">По дате (возрастание)</option>
74 <option value="created_at_down">По дате (убывание)</option> 74 <option value="created_at_down">По дате (убывание)</option>
75 </select> 75 </select>
76 </div> 76 </div>
77 </div> 77 </div>
78 </div> 78 </div>
79 79
80 <div class="table table_spoiler" id="main_ockar" name="main_oskar"> 80 <div class="table table_spoiler" id="main_ockar" name="main_oskar">
81 @if ($vacancy_list->count()) 81 @if ($vacancy_list->count())
82 <div class="table__scroll"> 82 <div class="table__scroll">
83 <div class="table__body table__body_min-width"> 83 <div class="table__body table__body_min-width">
84 <table> 84 <table>
85 <thead> 85 <thead>
86 <tr> 86 <tr>
87 <th>№</th> 87 <th>№</th>
88 <th>Название</th> 88 <th>Название</th>
89 <th>Дата добавления<br>/&nbsp;обновления</th> 89 <th>Дата добавления<br>/&nbsp;обновления</th>
90 <th style="display:none">Должности</th> 90 <th style="display:none">Должности</th>
91 <th>Статус</th> 91 <th>Статус</th>
92 <th>Действия</th> 92 <th>Действия</th>
93 </tr> 93 </tr>
94 </thead> 94 </thead>
95 <tbody> 95 <tbody>
96 @foreach($vacancy_list as $it) 96 @foreach($vacancy_list as $it)
97 <tr> 97 <tr>
98 <td>{{ $it->id }}</td> 98 <td>{{ $it->id }}</td>
99 <td>{{ $it->name }}</td> 99 <td>{{ $it->name }}</td>
100 <td>{{ date('d.m.Y H:i:s', strtotime($it->created_at)) }} <br>/ {{ date('d.m.Y H:i:s', strtotime($it->updated_at)) }}</td> 100 <td>{{ date('d.m.Y H:i:s', strtotime($it->created_at)) }} <br>/ {{ date('d.m.Y H:i:s', strtotime($it->updated_at)) }}</td>
101 <td style="display:none"> <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $it->id]) }}" class="button">Добавить</a> 101 <td style="display:none"> <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $it->id]) }}" class="button">Добавить</a>
102 102
103 @if ($it->jobs->count()) 103 @if ($it->jobs->count())
104 @foreach ($it->jobs as $key => $it_um) 104 @foreach ($it->jobs as $key => $it_um)
105 <p>@if (isset($it->jobs_code[$key])) 105 <p>@if (isset($it->jobs_code[$key]))
106 <a href="{{ route('employer.edit_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id, 'ad_employer' => $it->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">{{$it_um->name}}</a> 106 <a href="{{ route('employer.edit_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id, 'ad_employer' => $it->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">{{$it_um->name}}</a>
107 <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a> 107 <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a>
108 @endif 108 @endif
109 </p> 109 </p>
110 @endforeach 110 @endforeach
111 @else 111 @else
112 Нет связанных <br> с вакансией должностей 112 Нет связанных <br> с вакансией должностей
113 @endif 113 @endif
114 </td> 114 </td>
115 <td> 115 <td>
116 @if ($it->active_is) 116 @if ($it->active_is)
117 <span class="table__status green"><i></i>Опубликовано</span> 117 <span class="table__status green"><i></i>Опубликовано</span>
118 @else 118 @else
119 <span class="table__status"><i></i>Не опубликовано</span> 119 <span class="table__status"><i></i>Не опубликовано</span>
120 @endif 120 @endif
121 </td> 121 </td>
122 <td> 122 <td>
123 <span class="table__controls"> 123 <span class="table__controls">
124 <a class="table__controls-item up-it" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}"> 124 <a class="table__controls-item up-it" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}">
125 <svg> 125 <svg>
126 <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use> 126 <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use>
127 </svg> 127 </svg>
128 </a> 128 </a>
129 <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" class="table__controls-item"> 129 <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" class="table__controls-item">
130 <svg> 130 <svg>
131 <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> 131 <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use>
132 </svg> 132 </svg>
133 </a> 133 </a>
134 <a class="table__controls-item" href="{{ route('employer.vacancy_delete', ['ad_employer' => $it->id]) }}"> 134 <a class="table__controls-item" href="{{ route('employer.vacancy_delete', ['ad_employer' => $it->id]) }}">
135 <svg> 135 <svg>
136 <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> 136 <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use>
137 </svg> 137 </svg>
138 </a> 138 </a>
139 @if ($it->active_is) 139 @if ($it->active_is)
140 <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" class="table__controls-item"> 140 <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" class="table__controls-item">
141 <svg> 141 <svg>
142 <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> 142 <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use>
143 </svg> 143 </svg>
144 </a> 144 </a>
145 @else 145 @else
146 <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" class="table__controls-item"> 146 <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" class="table__controls-item">
147 <svg> 147 <svg>
148 <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> 148 <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use>
149 </svg> 149 </svg>
150 </a> 150 </a>
151 @endif 151 @endif
152 @if ($Employer->social_is == 1)
153 <a href="https://telegram.me/share/url?url={{ route('vacancie', ['vacancy' => $it->id]) }}&text={{ $it->text }}" class="table__controls-item">
154 <svg>
155 <use xlink:href="{{ asset('images/sprite.svg#tg') }}"></use>
156 </svg>
157 </a>
158 @endif
152 <!--<a class="btn_telegram_share table__controls-item" href="https://telegram.me/share/url?url=ВАШ_URL&text={{ $it->name }}"> 159 <!--<a class="btn_telegram_share table__controls-item" href="https://telegram.me/share/url?url=ВАШ_URL&text={{ $it->name }}">
153 <svg> 160 <svg>
154 <use xlink:href=" asset('images/sprite.svg#arrow-radius') }}"></use> 161 <use xlink:href=" asset('images/sprite.svg#arrow-radius') }}"></use>
155 </svg> 162 </svg>
156 </a>--> 163 </a>-->
157 164
158 <!--<button type="button" class="table__controls-item"> 165 <!--<button type="button" class="table__controls-item">
159 <svg> 166 <svg>
160 <use xlink:href=" asset('images/sprite.svg#tg') }}"></use> 167 <use xlink:href=" asset('images/sprite.svg#tg') }}"></use>
161 </svg> 168 </svg>
162 </button> 169 </button>
163 --> 170 -->
164 </span> 171 </span>
165 </td> 172 </td>
166 </tr> 173 </tr>
167 @endforeach 174 @endforeach
168 </tbody> 175 </tbody>
169 </table> 176 </table>
170 </div><br> 177 </div><br>
171 {{ $vacancy_list->appends($_GET)->links('paginate') }} 178 {{ $vacancy_list->appends($_GET)->links('paginate') }}
172 </div> 179 </div>
173 180
174 181
175 @else 182 @else
176 183
177 <div class="notify"> 184 <div class="notify">
178 <svg> 185 <svg>
179 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> 186 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use>
180 </svg> 187 </svg>
181 <span>Вы ещё не разместили ни одной вакансии</span> 188 <span>Вы ещё не разместили ни одной вакансии</span>
182 </div> 189 </div>
183 @endif 190 @endif
184 </div> 191 </div>
185 </div> 192 </div>
186 </div> 193 </div>
187 </div> 194 </div>
188 </div> 195 </div>
189 </section> 196 </section>
190 </div> 197 </div>
191 @endsection 198 @endsection
192 199
resources/views/vacance-item.blade.php
1 @php 1 @php
2 use App\Classes\StatusUser; 2 use App\Classes\StatusUser;
3 @endphp 3 @endphp
4 4
5 @extends('layout.frontend', ['title' => $title]) 5 @extends('layout.frontend', ['title' => $title])
6 6
7 @section('scripts') 7 @section('scripts')
8 @include('js.favorite-vacancy') 8 @include('js.favorite-vacancy')
9 <script> 9 <script>
10 $(document).on('click', '.js_send_it_button', function() { 10 $(document).on('click', '.js_send_it_button', function() {
11 var this_ = $(this); 11 var this_ = $(this);
12 var code_user_id = this_.attr('data-uid'); 12 var code_user_id = this_.attr('data-uid');
13 var code_to_user_id = this_.attr('data-tuid'); 13 var code_to_user_id = this_.attr('data-tuid');
14 var code_vacancy = this_.attr('data-vacancy'); 14 var code_vacancy = this_.attr('data-vacancy');
15 var user_id = $('#_user_id'); 15 var user_id = $('#_user_id');
16 var to_user_id = $('#_to_user_id'); 16 var to_user_id = $('#_to_user_id');
17 var vacancy = $('#_vacancy'); 17 var vacancy = $('#_vacancy');
18 18
19 console.log('Клик на кнопки...'); 19 console.log('Клик на кнопки...');
20 20
21 user_id.val(code_user_id); 21 user_id.val(code_user_id);
22 to_user_id.val(code_to_user_id); 22 to_user_id.val(code_to_user_id);
23 vacancy.val(code_vacancy); 23 vacancy.val(code_vacancy);
24 }); 24 });
25 </script> 25 </script>
26 <script> 26 <script>
27 $(document).on('click', '.js_send_for_emp', function() { 27 $(document).on('click', '.js_send_for_emp', function() {
28 var this_ = $(this); 28 var this_ = $(this);
29 var code_user_id = this_.attr('data-uid'); 29 var code_user_id = this_.attr('data-uid');
30 var code_to_user_id = this_.attr('data-tuid'); 30 var code_to_user_id = this_.attr('data-tuid');
31 var code_vacancy = this_.attr('data-vacancy'); 31 var code_vacancy = this_.attr('data-vacancy');
32 var user_id = $('#send_user_id'); 32 var user_id = $('#send_user_id');
33 var to_user_id = $('#send_to_user_id'); 33 var to_user_id = $('#send_to_user_id');
34 var vacancy = $('#send_vacancy'); 34 var vacancy = $('#send_vacancy');
35 35
36 console.log('code_to_user_id='+code_to_user_id); 36 console.log('code_to_user_id='+code_to_user_id);
37 console.log('code_user_id='+code_user_id); 37 console.log('code_user_id='+code_user_id);
38 console.log('code_vacancy='+code_vacancy); 38 console.log('code_vacancy='+code_vacancy);
39 console.log('Клик на кнопке...'); 39 console.log('Клик на кнопке...');
40 40
41 user_id.val(code_user_id); 41 user_id.val(code_user_id);
42 to_user_id.val(code_to_user_id); 42 to_user_id.val(code_to_user_id);
43 vacancy.val(code_vacancy); 43 vacancy.val(code_vacancy);
44 }); 44 });
45 </script> 45 </script>
46 @include('js.favorite-vacancy-45') 46 @include('js.favorite-vacancy-45')
47 @endsection 47 @endsection
48 48
49 @section('content') 49 @section('content')
50 <main class="main"> 50 <main class="main">
51 <div class="container"> 51 <div class="container">
52 <ul class="breadcrumbs main__breadcrumbs"> 52 <ul class="breadcrumbs main__breadcrumbs">
53 <li><a href="{{ route('index') }}">Главная</a></li> 53 <li><a href="{{ route('index') }}">Главная</a></li>
54 <li><a href="{{ route('vacancies') }}">Вакансии</a></li> 54 <li><a href="{{ route('vacancies') }}">Вакансии</a></li>
55 <li><b>{{ $title }}</b></li> 55 <li><b>{{ $title }}</b></li>
56 </ul> 56 </ul>
57 <div class="main__employer-page"> 57 <div class="main__employer-page">
58 58
59 @if (isset($Query[0]->employer)) 59 @if (isset($Query[0]->employer))
60 <h2 class="main__employer-page-title">О компании</h2> 60 <h2 class="main__employer-page-title">О компании</h2>
61 <div class="main__employer-page-two-item-toper"> 61 <div class="main__employer-page-two-item-toper">
62 @if (!empty($Query[0]->employer->logo)) 62 @if (!empty($Query[0]->employer->logo))
63 <img src="{{ asset(Storage::url($Query[0]->employer->logo)) }}" alt="{{ $Query[0]->employer->name }}"> 63 <img src="{{ asset(Storage::url($Query[0]->employer->logo)) }}" alt="{{ $Query[0]->employer->name }}">
64 @else 64 @else
65 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $Query[0]->employer->name }}"> 65 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $Query[0]->employer->name }}">
66 @endif 66 @endif
67 <span>{{ $Query[0]->employer->name_company }}</span> 67 <span>{{ $Query[0]->employer->name_company }}</span>
68 </div> 68 </div>
69 69
70 <div class="main__employer-page-info"> 70 <div class="main__employer-page-info">
71 <div class="main__employer-page-item"> 71 <div class="main__employer-page-item">
72 <b> Адрес компании</b> 72 <b> Адрес компании</b>
73 <span> 73 <span>
74 {{ $Query[0]->employer->address }} 74 {{ $Query[0]->employer->address }}
75 </span> 75 </span>
76 </div> 76 </div>
77 <div class="main__employer-page-item"> 77 <div class="main__employer-page-item">
78 <b>Сайт</b> 78 <b>Сайт</b>
79 <span> 79 <span>
80 <a href="{{ $Query[0]->employer->site }}">{{ $Query[0]->employer->site }}</a> 80 <a href="{{ $Query[0]->employer->site }}">{{ $Query[0]->employer->site }}</a>
81 </span> 81 </span>
82 </div> 82 </div>
83 <div class="main__employer-page-item"> 83 <div class="main__employer-page-item">
84 <b>Почта</b> 84 <b>Почта</b>
85 <span> 85 <span>
86 <a href="{{ $Query[0]->employer->email }}">{{ $Query[0]->employer->email }}</a> 86 <a href="{{ $Query[0]->employer->email }}">{{ $Query[0]->employer->email }}</a>
87 </span> 87 </span>
88 </div> 88 </div>
89 <div class="main__employer-page-item"> 89 <div class="main__employer-page-item">
90 <b>Телефон</b> 90 <b>Телефон</b>
91 <span> 91 <span>
92 <a href="tel:{{ $Query[0]->employer->telephone }}">{{ $Query[0]->employer->telephone }}</a> 92 <a href="tel:{{ $Query[0]->employer->telephone }}">{{ $Query[0]->employer->telephone }}</a>
93 </span> 93 </span>
94 </div> 94 </div>
95 </div> 95 </div>
96 @else 96 @else
97 <div class="main__employer-page-info"> 97 <div class="main__employer-page-info">
98 <div class="main__employer-page-item"> 98 <div class="main__employer-page-item">
99 <b>Ничего не найдено</b> 99 <b>Ничего не найдено</b>
100 <span> 100 <span>
101 Нет данных о компании 101 Нет данных о компании
102 </span> 102 </span>
103 </div> 103 </div>
104 </div> 104 </div>
105 @endif 105 @endif
106 <h2 class="main__employer-page-title">Описание вакансии</h2> 106 <h2 class="main__employer-page-title">{{ $Query[0]->name }}</h2>
107 <h3 class="main__employer-page-title_">Описание вакансии</h3>
107 108
108 </div> 109 </div>
109 110
110 @foreach ($Query as $Q) 111 @foreach ($Query as $Q)
111 <div class="main__vacancies-item-page main__employer-page-two-item"> 112 <div class="main__vacancies-item-page main__employer-page-two-item">
112 <div class="main__employer-page-two-item-text"> 113 <div class="main__employer-page-two-item-text">
113 <div class="main__employer-page-two-item-text-name">Судоходная компания ведет набор 114 <div class="main__employer-page-two-item-text-name">Судоходная компания ведет набор
114 специалистов на следующие должности:</div> 115 специалистов на следующие должности:</div>
115 <div class="main__employer-page-two-item-text-links"> 116 <div class="main__employer-page-two-item-text-links">
116 @if (isset($Q->jobs)) 117 @if (isset($Q->jobs))
117 @foreach ($Q->jobs as $key => $j) 118 @foreach ($Q->jobs as $key => $j)
118 <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> 119 <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>
119 @endforeach 120 @endforeach
120 @endif 121 @endif
121 </div> 122 </div>
122 </div> 123 </div>
123 <div class="main__employer-page-two-item-text"> 124 <div class="main__employer-page-two-item-text">
124 <div class="main__employer-page-two-item-text-name">Мы предлагаем:</div> 125 <div class="main__employer-page-two-item-text-name">Мы предлагаем:</div>
125 <div class="main__employer-page-two-item-text-body"> 126 <div class="main__employer-page-two-item-text-body">
126 {!! $Q->text !!} 127 {!! $Q->text !!}
127 </div> 128 </div>
128 </div> 129 </div>
129 <div class="main__employer-page-two-item-text"> 130 <div class="main__employer-page-two-item-text">
130 <div class="main__employer-page-two-item-text-name">Наши ожидания:</div> 131 <div class="main__employer-page-two-item-text-name">Наши ожидания:</div>
131 <div class="main__employer-page-two-item-text-body"> 132 <div class="main__employer-page-two-item-text-body">
132 {!! $Q->description !!} 133 {!! $Q->description !!}
133 </div> 134 </div>
134 </div> 135 </div>
135 <div class="main__employer-page-two-item-text"> 136 <div class="main__employer-page-two-item-text">
136 <div class="main__employer-page-two-item-text-name">Резюме направляйте на почту:</div> 137 <div class="main__employer-page-two-item-text-name">Резюме направляйте на почту:</div>
137 <div class="main__employer-page-two-item-text-body"> 138 <div class="main__employer-page-two-item-text-body">
138 {!! $Q->contacts_emails !!} 139 {!! $Q->contacts_emails !!}
139 </div> 140 </div>
140 <div class="main__employer-page-two-item-text"> 141 <div class="main__employer-page-two-item-text">
141 <div class="main__employer-page-two-item-text-name">Или звоните:</div> 142 <div class="main__employer-page-two-item-text-name">Или звоните:</div>
142 <div class="main__employer-page-two-item-text-body"> 143 <div class="main__employer-page-two-item-text-body">
143 {!! $Q->contacts_telephones !!} 144 {!! $Q->contacts_telephones !!}
144 </div> 145 </div>
145 </div> 146 </div>
146 147
147 <div class="main__employer-page-two-item-tags"> 148 <div class="main__employer-page-two-item-tags">
148 @if (!empty($Q->jobs_code[0]->position_ship)) 149 @if (!empty($Q->jobs_code[0]->position_ship))
149 <span class="main__employer-page-two-item-tag">#{{ $Q->jobs_code[0]->position_ship }}</span> 150 <span class="main__employer-page-two-item-tag">#{{ $Q->jobs_code[0]->position_ship }}</span>
150 @else 151 @else
151 @if (isset($Q->jobs)) 152 @if (isset($Q->jobs))
152 @foreach ($Q->jobs as $key => $j) 153 @foreach ($Q->jobs as $key => $j)
153 <span class="main__employer-page-two-item-tag">#{{ $j->name }}</span> 154 <span class="main__employer-page-two-item-tag">#{{ $j->name }}</span>
154 @endforeach 155 @endforeach
155 @endif 156 @endif
156 @endif 157 @endif
157 </div> 158 </div>
158 <br> 159 <br>
159 <div class="main__employer-page-two-item-buttons"> 160 <div class="main__employer-page-two-item-buttons">
160 @guest 161 @guest
161 <button type="button" data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' 162 <button type="button" data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}'
162 class="button main__employer-page-two-item-button">Откликнуться</button> 163 class="button main__employer-page-two-item-button">Откликнуться</button>
163 @else 164 @else
164 @if (App\Classes\StatusUser::Status()==1) 165 @if (App\Classes\StatusUser::Status()==1)
165 <button type="button" data-fancybox data-src="#send" data-vacancy="{{ $Q->id }}" data-uid="{{ $uid }}" data-tuid="{{ $Q->employer->user_id }}" data-options='{"touch":false,"autoFocus":false}' 166 <button type="button" data-fancybox data-src="#send" data-vacancy="{{ $Q->id }}" data-uid="{{ $uid }}" data-tuid="{{ $Q->employer->user_id }}" data-options='{"touch":false,"autoFocus":false}'
166 class="button main__employer-page-two-item-button js_send_for_emp">Откликнуться</button> 167 class="button main__employer-page-two-item-button js_send_for_emp">Откликнуться</button>
167 @else 168 @else
168 <button type="button" data-fancybox data-src="#send2" data-vacancy="{{ $Q->id }}" data-uid="{{ $uid }}" data-tuid="{{ $Q->employer->user_id }}" data-options='{"touch":false,"autoFocus":false}' 169 <button type="button" data-fancybox data-src="#send2" data-vacancy="{{ $Q->id }}" data-uid="{{ $uid }}" data-tuid="{{ $Q->employer->user_id }}" data-options='{"touch":false,"autoFocus":false}'
169 class="button main__employer-page-two-item-button js_send_it_button">Откликнуться</button> 170 class="button main__employer-page-two-item-button js_send_it_button">Откликнуться</button>
170 @endif 171 @endif
171 @endguest 172 @endguest
172 </div> 173 </div>
173 <div class="main__employer-page-two-item-bottom"> 174 <div class="main__employer-page-two-item-bottom">
174 <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($Q->created_at)) }}</div> 175 <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($Q->created_at)) }}</div>
175 <button type="button" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js_vac_favorite js-toggle {{ \App\Classes\LikesClass::get_status_vacancy($Q) }}"> 176 <button type="button" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js_vac_favorite js-toggle {{ \App\Classes\LikesClass::get_status_vacancy($Q) }}">
176 <svg> 177 <svg>
177 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> 178 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use>
178 </svg> 179 </svg>
179 </button> 180 </button>
180 </div> 181 </div>
181 182
182 </div> 183 </div>
183 184
184 @endforeach 185 @endforeach
185 186
186 </div> <a href="{{ redirect()->back()->getTargetUrl() }}" class="back"> 187 </div> <a href="{{ redirect()->back()->getTargetUrl() }}" class="back">
187 <svg> 188 <svg>
188 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> 189 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use>
189 </svg> 190 </svg>
190 <span> 191 <span>
191 Вернуться к списку вакансий 192 Вернуться к списку вакансий
192 </span> 193 </span>
193 </a> 194 </a>
194 </main> 195 </main>
195 </div> 196 </div>
196 @endsection 197 @endsection
197 198