Commit 23eadb7ed83dc857595ea54816db90ba7b8964e3

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

Коммит пятницы

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