Commit f3766c7c1b524fdf452dbae22bbfce1fbe325679

Authored by Андрей Ларионов
1 parent 1862e7a3a6

Коммит по регистрации работодателя и соискателя

Showing 20 changed files with 866 additions and 80 deletions Side-by-side Diff

app/Classes/Cookies_vacancy.php
... ... @@ -0,0 +1,43 @@
  1 +<?php
  2 +
  3 +
  4 +namespace App\Classes;
  5 +
  6 +
  7 +use DateTime;
  8 +
  9 +class Cookies_vacancy
  10 +{
  11 + public static function selected_vacancy($item) {
  12 + if (empty($_COOKIE['favorite_vacancy']))
  13 + return "";
  14 + else {
  15 + $Str = json_decode($_COOKIE['favorite_vacancy'], true);
  16 + //$Arr = explode(",", $Str);
  17 + if (in_array($item, $Str))
  18 + return " active ";
  19 + else
  20 + return "";
  21 + }
  22 + }
  23 +
  24 + // Вывод избранных вакансий
  25 + public static function count_vacancy_fav() {
  26 + if (empty($_COOKIE['favorite_vacancy']))
  27 + return 0;
  28 + else {
  29 +
  30 + $Arr = json_decode($_COOKIE['favorite_vacancy'], true);
  31 +
  32 +
  33 + return count($Arr);
  34 + }
  35 + }
  36 +
  37 + // Удаление избранных вакансий
  38 + public static function clear_vacancy() {
  39 + if (!empty($_COOKIE['favorite_vacancy']))
  40 + unset($_COOKIE['favorite_vacancy']);
  41 + }
  42 +
  43 +}
app/Classes/RusDate.php
... ... @@ -7,7 +7,7 @@ namespace App\Classes;
7 7 use DateTime;
8 8  
9 9 class RusDate
10   -{
  10 +{ // Русские даты
11 11 public static function russian_date($date = null){
12 12 $date=explode(".", date("d.m.Y"));
13 13 $m = "";
... ... @@ -28,7 +28,7 @@ class RusDate
28 28 }
29 29 return $date[0].' '.$m.' '.$date[2];
30 30 }
31   -
  31 + // Русские названия
32 32 public static function russian_month($month) {
33 33 switch ($month){
34 34 case 1: $m = 'января'; break;
... ... @@ -46,7 +46,7 @@ class RusDate
46 46 }
47 47 return $m;
48 48 }
49   -
  49 + // Избранные работники
50 50 public static function selected_item($item) {
51 51 if (empty($_COOKIE['favorite_worker']))
52 52 return "";
... ... @@ -59,20 +59,36 @@ class RusDate
59 59 return "";
60 60 }
61 61 }
  62 + // Избранные вакансии
  63 + public static function selected_vacancy($item) {
  64 + if (empty($_COOKIE['favorite_vac']))
  65 + return "";
  66 + else {
  67 + $Str = json_decode($_COOKIE['favorite_vac'], true);
  68 + //$Arr = explode(",", $Str);
  69 + if (in_array($item, $Str))
  70 + return " active ";
  71 + else
  72 + return "";
  73 + }
  74 + }
62 75  
  76 + // Вывод избранных работников
63 77 public static function count_item_fav() {
64 78 if (empty($_COOKIE['favorite_worker']))
65 79 return 0;
66 80 else {
  81 +
67 82 $Arr = json_decode($_COOKIE['favorite_worker'], true);
  83 +
68 84 return count($Arr);
69 85 }
70 86 }
71 87  
  88 + // Удаление избранных работников
72 89 public static function clear_items() {
73 90 if (!empty($_COOKIE['favorite_worker']))
74 91 unset($_COOKIE['favorite_worker']);
75   - //print_r($_COOKIE['arr']);
76 92 }
77 93  
78 94 public static function interval_month($date) {
... ... @@ -116,4 +132,24 @@ class RusDate
116 132  
117 133 return $ip;
118 134 }
  135 +
  136 + // Вывод избранных вакансий
  137 + public static function count_vacancy_fav() {
  138 + if (empty($_COOKIE['favorite_vac']))
  139 + return 0;
  140 + else {
  141 +
  142 + $Arr = json_decode($_COOKIE['favorite_vac'], true);
  143 +
  144 +
  145 + return count($Arr);
  146 + }
  147 + }
  148 +
  149 + // Удаление избранных вакансий
  150 + public static function clear_vacancy() {
  151 + if (!empty($_COOKIE['favorite_vac']))
  152 + unset($_COOKIE['favorite_vac']);
  153 + }
  154 +
119 155 }
app/Http/Controllers/EmployerController.php
... ... @@ -20,7 +20,10 @@ use App\Models\Flot;
20 20 use App\Models\Job_title;
21 21 use App\Models\Message;
22 22 use App\Models\Worker;
  23 +use Carbon\Carbon;
  24 +use Illuminate\Auth\Events\Registered;
23 25 use Illuminate\Database\Eloquent\Builder;
  26 +use Illuminate\Database\Eloquent\Model;
24 27 use Illuminate\Foundation\Auth\User;
25 28 use Illuminate\Http\Request;
26 29 use Illuminate\Support\Facades\Auth;
... ... @@ -279,6 +282,85 @@ class EmployerController extends Controller
279 282 return view('employers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer'));
280 283 }
281 284  
  285 + // Регистрация работодателя
  286 + public function register_employer(Request $request) {
  287 + $params = $request->all();
  288 +
  289 + $rules = [
  290 + 'surname' => ['required', 'string', 'max:255'],
  291 + 'name_man' => ['required', 'string', 'max:255'],
  292 + 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
  293 + 'name_company' => ['required', 'string', 'max:255'],
  294 + 'password' => ['required', 'string', 'min:8'],
  295 + ];
  296 +
  297 +
  298 + $messages = [
  299 + 'required' => 'Укажите обязательное поле',
  300 + 'min' => [
  301 + 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
  302 + 'integer' => 'Поле «:attribute» должно быть :min или больше',
  303 + 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
  304 + ],
  305 + 'max' => [
  306 + 'string' => 'Поле «:attribute» должно быть не больше :max символов',
  307 + 'integer' => 'Поле «:attribute» должно быть :max или меньше',
  308 + 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
  309 + ]
  310 + ];
  311 +
  312 + if ($request->get('password') !== $request->get('confirmed')){
  313 + return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля"));
  314 + }
  315 +
  316 + $validator = Validator::make($request->all(), $rules, $messages);
  317 +
  318 + if ($validator->fails()) {
  319 + return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе."));
  320 + } else {
  321 + $user = $this->create($params);
  322 + event(new Registered($user));
  323 +
  324 + Auth::guard()->login($user);
  325 + }
  326 + if ($user) {
  327 + return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));;
  328 + } else {
  329 + return json_encode(Array("ERROR" => "Error2: Данные были утеряны!"));
  330 + }
  331 + }
  332 +
  333 + // Создание пользователя
  334 + protected function create(array $data)
  335 + {
  336 + $Use = new User_Model();
  337 + $Code_user = $Use->create([
  338 + 'name' => $data['surname']." ".$data['name_man'],
  339 + 'name_man' => $data['name_man'],
  340 + 'surname' => $data['surname'],
  341 + 'surname2' => $data['surname2'],
  342 + 'subscribe_email' => $data['email'],
  343 + 'email' => $data['email'],
  344 + 'telephone' => $data['telephone'],
  345 + 'is_worker' => 0,
  346 + 'password' => Hash::make($data['password']),
  347 + 'pubpassword' => base64_encode($data['password']),
  348 + 'email_verified_at' => Carbon::now()
  349 + ]);
  350 +
  351 + if ($Code_user->id > 0) {
  352 + $Employer = new Employer();
  353 + $Employer->user_id = $Code_user->id;
  354 + $Employer->name_company = $data['name_company'];
  355 + $Employer->email = $data['email'];
  356 + $Employer->telephone = $data['telephone'];
  357 + $Employer->code = Tools::generator_id(10);
  358 + $Employer->save();
  359 +
  360 + return $Code_user;
  361 + }
  362 + }
  363 +
282 364 // Отправка сообщения от работодателя
283 365 public function send_message(MessagesRequiest $request) {
284 366 $params = $request->all();
... ... @@ -449,6 +531,8 @@ class EmployerController extends Controller
449 531 ->withErrors('Не совпадение данных, обновите пароли!');
450 532 }
451 533  
  534 +
  535 +
452 536 // Форма Удаление пипла
453 537 public function delete_people() {
454 538 $login = Auth()->user()->email;
app/Http/Controllers/WorkerController.php
... ... @@ -2,11 +2,20 @@
2 2  
3 3 namespace App\Http\Controllers;
4 4  
  5 +use App\Classes\RusDate;
  6 +use App\Models\Ad_employer;
  7 +use App\Models\Category;
  8 +use App\Models\Employer;
  9 +use App\Models\Job_title;
5 10 use App\Models\Message;
  11 +use App\Models\reclame;
6 12 use App\Models\Static_worker;
7 13 use App\Models\User;
  14 +use App\Models\User as User_Model;
8 15 use App\Models\Worker;
  16 +use Carbon\Carbon;
9 17 use Illuminate\Auth\Events\Registered;
  18 +use Illuminate\Database\Eloquent\Builder;
10 19 use Illuminate\Http\JsonResponse;
11 20 use Illuminate\Http\Request;
12 21 use Illuminate\Support\Facades\Auth;
... ... @@ -76,9 +85,16 @@ class WorkerController extends Controller
76 85 }
77 86  
78 87 // Кабинет работника
79   - public function cabinet(Worker $worker)
  88 + public function cabinet()
80 89 {
81   - return view('workers.cabinet', compact('worker'));
  90 + $id = Auth()->user()->id;
  91 + $Worker = Worker::query()->with('sertificate')->
  92 + with('infobloks')->with('place_worker')->
  93 + WhereHas('users',
  94 + function (Builder $query) use ($id) {$query->Where('id', $id);
  95 + })->get();
  96 + dd($Worker);
  97 + return view('workers.cabinet', compact('Worker'));
82 98 }
83 99  
84 100 // Сохранение данных
... ... @@ -125,14 +141,72 @@ class WorkerController extends Controller
125 141 // Сменить пароль
126 142 public function new_password()
127 143 {
128   - return view('workers.new_password');
  144 + $email = Auth()->user()->email;
  145 + return view('workers.new_password', compact('email'));
129 146 }
130 147  
131   - // Удаление профиля
  148 + // Обновление пароля
  149 + public function save_new_password(Request $request) {
  150 + $use = Auth()->user();
  151 + $request->validate([
  152 + 'password' => 'required|string',
  153 + 'new_password' => 'required|string',
  154 + 'new_password2' => 'required|string'
  155 + ]);
  156 +
  157 + if ($request->get('new_password') == $request->get('new_password2'))
  158 + if ($request->get('password') !== $request->get('new_password')) {
  159 + $credentials = $request->only('email', 'password');
  160 + if (Auth::attempt($credentials)) {
  161 +
  162 + if (!is_null($use->email_verified_at)){
  163 +
  164 + $user_data = User_Model::find($use->id);
  165 + $user_data->update([
  166 + 'password' => Hash::make($request->get('new_password')),
  167 + 'pubpassword' => base64_encode($request->get('new_password')),
  168 + ]);
  169 + return redirect()
  170 + ->route('worker.new_password')
  171 + ->with('success', 'Поздравляю! Вы обновили свой пароль!');
  172 + }
  173 +
  174 + return redirect()
  175 + ->route('worker.new_password')
  176 + ->withError('Данная учетная запись не было верифицированна!');
  177 + }
  178 + }
  179 +
  180 + return redirect()
  181 + ->route('worker.new_password')
  182 + ->withErrors('Не совпадение данных, обновите пароли!');
  183 + }
  184 +
  185 + // Удаление профиля форма
132 186 public function delete_profile()
133 187 {
  188 + $login = Auth()->user()->email;
  189 + return view('workers.delete_profile', compact('login'));
  190 + }
134 191  
135   - return view('workers.delete_profile');
  192 + // Удаление профиля код
  193 + public function delete_profile_result(Request $request) {
  194 + $Answer = $request->all();
  195 + $user_id = Auth()->user()->id;
  196 + $request->validate([
  197 + 'password' => 'required|string',
  198 + ]);
  199 +
  200 + $credentials = $request->only('email', 'password');
  201 + if (Auth::attempt($credentials)) {
  202 + Auth::logout();
  203 + $it = User_Model::find($user_id);
  204 + //$it->delete();
  205 + return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт');
  206 + } else {
  207 + return redirect()->route('worker.delete_profile')
  208 + ->withErrors( 'Неверный пароль! Нужен корректный пароль');
  209 + }
136 210 }
137 211  
138 212 // Регистрация соискателя
... ... @@ -145,7 +219,6 @@ class WorkerController extends Controller
145 219 'name_man' => ['required', 'string', 'max:255'],
146 220 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
147 221 'password' => ['required', 'string', 'min:8'],
148   - 'confirmed' => ['required', 'string', 'min:8'],
149 222 ];
150 223  
151 224 $messages = [
... ... @@ -164,6 +237,7 @@ class WorkerController extends Controller
164 237  
165 238  
166 239  
  240 +
167 241 if ($request->get('password') !== $request->get('confirmed')){
168 242 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля"));
169 243 }
... ... @@ -171,7 +245,7 @@ class WorkerController extends Controller
171 245 $validator = Validator::make($request->all(), $rules, $messages);
172 246  
173 247 if ($validator->fails()) {
174   - return json_encode(Array("ERROR" => "Error: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены"));
  248 + return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе."));
175 249 } else {
176 250 $user = $this->create($params);
177 251 event(new Registered($user));
... ... @@ -181,7 +255,7 @@ class WorkerController extends Controller
181 255 if ($user) {
182 256 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));;
183 257 } else {
184   - return json_encode(Array("ERROR" => "Данные были утеряны!"));
  258 + return json_encode(Array("ERROR" => "Error2: Данные были утеряны!"));
185 259 }
186 260 }
187 261  
... ... @@ -191,18 +265,100 @@ class WorkerController extends Controller
191 265 $Use = new User();
192 266 $Code_user = $Use->create([
193 267 'name' => $data['surname']." ".$data['name_man'],
  268 + 'name_man' => $data['name_man'],
  269 + 'surname' => $data['surname'],
  270 + 'surname2' => $data['surname2'],
194 271 'subscribe_email' => $data['email'],
195 272 'email' => $data['email'],
196 273 'telephone' => $data['telephone'],
197 274 'password' => Hash::make($data['password']),
198 275 'pubpassword' => base64_encode($data['password']),
  276 + 'email_verified_at' => Carbon::now()
199 277 ]);
200   - dd($Code_user);
  278 + if ($Code_user->id > 0) {
  279 + $Worker = new Worker();
  280 + $Worker->user_id = $Code_user->id;
  281 + $Worker->position_work = $data['job_titles'];
  282 + $Worker->email = $data['email'];
  283 + $Worker->telephone = $data['telephone'];
  284 + $Worker->save();
  285 +
  286 + return $Code_user;
  287 + }
201 288 }
202 289  
203   - public function colorado() {
204   - return view('workers.favorite');
  290 + // Борьба против колорадских жуков, хотя жуков победил все таки 45.
  291 + public function colorado(Request $request) {
  292 + if (isset($_COOKIE['favorite_vac'])) {
  293 + $items = RusDate::count_vacancy_fav();
  294 + $it = $_COOKIE['favorite_vac'];
  295 + $it = str_replace('"', "", $it);
  296 + $it = str_replace('[', "", $it);
  297 + $it = str_replace(']', "", $it);
  298 + $Arr = explode(",", $it);
  299 + } else {
  300 + $Arr = Array();
  301 + }
  302 +
  303 + $Query = Ad_employer::Query();
  304 + if (count($Arr) > 0) {
  305 + $Query = $Query->whereIn('id', $Arr);
  306 + }
  307 + $Query = $Query->with('jobs')->
  308 + with('cat')->
  309 + with('employer')->
  310 + whereHas('jobs_code', function ($query) use ($request) {
  311 + if ($request->ajax()) {
  312 + if (null !== ($request->get('job'))) {
  313 + $query->where('job_title_id', $request->get('job'));
  314 + }
  315 + }
  316 + })->select('ad_employers.*');
  317 +
  318 + $Job_title = Job_title::query()->OrderBy('name')->get();
  319 +
  320 + $Query_count = $Query->count();
  321 +
  322 + $Query = $Query->OrderBy('updated_at')->paginate(3);
  323 +
  324 + return view('workers.favorite', compact('Query',
  325 + 'Query_count',
  326 + 'Job_title'));
  327 +
  328 + }
  329 +
  330 + //Переписка пись-пись-пись
  331 + public function dialog(User_Model $user1, User_Model $user2) {
  332 + if (isset($user2->id)) {
  333 + $companion = User_Model::query()->with('workers')->
  334 + with('employers')->
  335 + where('id', $user2->id)->first();
  336 + }
  337 +
  338 + $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) {
  339 + $query->where('user_id', $user1->id)->where('to_user_id', $user2->id);
  340 + })->orWhere(function($query) use ($user1, $user2) {
  341 + $query->where('user_id', $user2->id)->where('to_user_id', $user1->id);
  342 + })->OrderBy('created_at')->get();
  343 +
  344 + $id_vac = null;
  345 + foreach ($Messages as $it) {
  346 + if (isset($it->response)) {
  347 + foreach ($it->response as $r) {
  348 + if (isset($r->ad_employer_id)) {
  349 + $id_vac = $r->ad_employer_id;
  350 + break;
  351 + }
  352 + }
  353 + }
  354 + if (!is_null($id_vac)) break;
  355 + }
  356 +
  357 + $ad_employer = null;
  358 + if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first();
  359 + $sender = $user1;
205 360  
  361 + return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer'));
206 362 }
207 363 }
208 364  
... ... @@ -42,6 +42,8 @@ class User extends Authenticatable
42 42 'file',
43 43 'pubpassword',
44 44 'is_manager',
  45 + 'subscribe_email',
  46 + 'subscribe',
45 47 ];
46 48  
47 49 /**
app/Models/Worker.php
... ... @@ -83,4 +83,5 @@ class Worker extends Model
83 83 public function infobloks() {
84 84 return $this->belongsToMany(infobloks::class,'dop_info', 'worker_id', 'infoblok_id');
85 85 }
  86 +
86 87 }
resources/views/ajax/list_vacancies.blade.php
... ... @@ -64,7 +64,7 @@
64 64 </div>
65 65 <div class="main__employer-page-two-item-bottom">
66 66 <div class="main__employer-page-two-item-bottom-date">{{ $Q->created_at }}</div>
67   - <button type="button" class="like main__employer-page-two-item-bottom-like js-toggle">
  67 + <button type="button" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js-toggle <?=App\Classes\Cookies_vacancy::selected_vacancy($Q->id);?>">
68 68 <svg>
69 69 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use>
70 70 </svg>
resources/views/index.blade.php
... ... @@ -72,14 +72,73 @@
72 72 let d = JSON.parse(data);
73 73 if(typeof d['REDIRECT'] !== "undefined") {
74 74 console.log(d['REDIRECT']);
75   - //location.href = d['REDIRECT'];
  75 + location.href = d['REDIRECT'];
76 76 }
77 77 if (typeof d['ERROR'] !== "undefined") {
78 78 console.log(d['ERROR']);
79   - //$('#message_error').html(d['ERROR']);
  79 + $('#block-info').css({'display': 'block'});
  80 + $('#messages_error_reg').html(d['ERROR']);
80 81 }
81 82 console.log(d['REDIRECT']);
82   - //$('#block_1').html(data);
  83 +
  84 + },
  85 + headers: {
  86 + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  87 + },
  88 + error: function (data) {
  89 + data = JSON.stringify(data);
  90 + console.log('Error: ' + data);
  91 + }
  92 + });
  93 +
  94 + return false;
  95 + });
  96 +
  97 + $(document).on('click', '#button_reg_employer', function() {
  98 + var field_login = $('#email_employer');
  99 + var field_pwd = $('#password_employer');
  100 + var field_confirm_pwd = $('#password_confirmation_employer');
  101 + var field_politik_employer = $('#politik_employer');
  102 + var field_telephone_employer = $('#telephone_employer');
  103 + var field_company_employer = $('#company_employer');
  104 + var field_surname_employer = $('#surname_employer');
  105 + var field_name_man_employer = $('#name_man_employer');
  106 + var field_surname2_employer = $('#surname2_employer');
  107 +
  108 + var login = field_login.val();
  109 + var pwd = field_pwd.val();
  110 + var confirm_pwd = field_confirm_pwd.val();
  111 + var politik = field_politik_employer.val();
  112 + var telephone = field_telephone_employer.val();
  113 + var company_employer = field_company_employer.val();
  114 + var surname = field_surname_employer.val();
  115 + var name_man = field_name_man_employer.val();
  116 + var surname2 = field_surname2_employer.val();
  117 +
  118 +
  119 + console.log('login: '+login+' password: '+pwd);
  120 +
  121 +
  122 + $.ajax({
  123 + type: "GET",
  124 + url: "{{ route('register_employer') }}",
  125 + data: "email="+login+"&password="+pwd+"&confirmed="+confirm_pwd+"&politik="+politik+
  126 + "&telephone="+telephone+"&name_company="+company_employer+"&surname="+surname+"&name_man="+name_man+
  127 + "&surname2="+surname2+"&subscribe_email="+login,
  128 + success: function (data) {
  129 + console.log('Вход в систему');
  130 + let d = JSON.parse(data);
  131 + if(typeof d['REDIRECT'] !== "undefined") {
  132 + console.log(d['REDIRECT']);
  133 + location.href = d['REDIRECT'];
  134 + }
  135 + if (typeof d['ERROR'] !== "undefined") {
  136 + console.log(d['ERROR']);
  137 + $('#block-info').css({'display': 'block'});
  138 + $('#messages_error_reg').html(d['ERROR']);
  139 + }
  140 + console.log(d['REDIRECT']);
  141 +
83 142 },
84 143 headers: {
85 144 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
resources/views/js/favorite-vacancy.blade.php
... ... @@ -0,0 +1,78 @@
  1 +<script>
  2 + console.log(read_array());
  3 + $(document).ready(function() {
  4 + $(document).on('click', '.js_vacancy_favorites', function () {
  5 + var _this = $(this);
  6 + var id_worker = _this.attr('data-val');
  7 +
  8 + if (_this.hasClass('active')) {
  9 + add_in_array(id_worker);
  10 + console.log('Добавлено в избранное id=' + id_worker);
  11 + } else {
  12 + delete_in_array(id_worker);
  13 + console.log('Удалено из избранных id='+id_worker)
  14 + }
  15 + var str = $.cookie('favorite_vacancy');
  16 + console.log("Вывод куков "+str);
  17 +
  18 + });
  19 + });
  20 +
  21 + //помеченный элемент
  22 + function selected_item(obj) {
  23 + var arr = read_array();
  24 + var index = arr.indexOf(obj);
  25 +
  26 + if (index > 0)
  27 + return "active";
  28 + else
  29 + return "";
  30 + }
  31 +
  32 + // запись элемента массива в cookie
  33 + function add_in_array(obj){
  34 + var arr = read_array();//получаем текущее состояние массива
  35 + arr[arr.length]=obj; //добавляем элемент в конец
  36 + //var str = JSON.stringify(arr);//конвертируем в строку
  37 + //$.cookie('arr',str);//записываем массив в куки
  38 + //$.cookie('favorite_vac', JSON.stringify(arr));
  39 + SetCookie("favorite_vacancy", JSON.stringify(arr), time()+60*60*24*1, '/');
  40 +
  41 + }
  42 +
  43 + // удаление элемента из массива в cookie
  44 + function delete_in_array(obj) {
  45 + var arr = read_array();
  46 + var unique = [...new Set(arr)]
  47 + var index = unique.indexOf(obj);
  48 +
  49 + unique.splice(index, 1);
  50 +
  51 + //var str = JSON.stringify(arr);//конвертируем в строку
  52 + //$.cookie('arr',str);//записываем массив в куки
  53 + //$.cookie('favorite_vac', JSON.stringify(unique));
  54 + SetCookie("favorite_vacancy", JSON.stringify(unique), time()+60*60*24*1, '/');
  55 +
  56 + }
  57 +
  58 + function read_array(){
  59 + var dataArr=$.cookie('favorite_vacancy');//считываем данные из куков
  60 +
  61 + //если массив не был обнаружен, иницилизируем его
  62 + if(dataArr===null){
  63 + dataArr = init_array(); //возвращаем инициализированный пустой маасив
  64 + }
  65 + //возвращаем полученный массив
  66 + //return JSON.parse(dataArr);
  67 + return JSON.parse(dataArr);
  68 + }
  69 +
  70 + //другими словами создаем пустой массив
  71 + function init_array(){
  72 + //var str = JSON.stringify(new Array());//конвертируем в строку
  73 + var str = JSON.stringify(new Array());
  74 + //$.cookie('favorite_vac',str);//записываем массив в куки
  75 + SetCookie("favorite_vacancy", str, time()+60*60*24*1, '/');
  76 + return str;
  77 + }
  78 +</script>
resources/views/layout/frontend.blade.php
... ... @@ -70,6 +70,7 @@
70 70 <footer class="footer">
71 71 <div class="container">
72 72 <div class="footer__mobile">
  73 +
73 74 <button class="footer__mobile-toper js-toggle active">
74 75 <a href="{{ route('index') }}">
75 76 <svg>
... ... @@ -153,6 +154,7 @@
153 154 </div>
154 155 <div class="footer__main">
155 156 <div class="footer__main-body">
  157 +
156 158 <a href="" class="footer__main-logo">
157 159 <svg>
158 160 <use xlink:href="{{ asset('images/sprite.svg#logo') }}"></use>
... ... @@ -201,6 +203,7 @@
201 203 </div>
202 204 </div>
203 205 </div>
  206 + <pre>{{ print_r($_COOKIE) }}</pre>
204 207 <div class="footer__main-copy">
205 208 <div>&copy; 2023 &mdash; RekaMore.su</div>
206 209 <nav>
resources/views/list_vacancies.blade.php
... ... @@ -28,6 +28,7 @@
28 28 });
29 29 });
30 30 </script>
  31 + @include('js.favorite-vacancy')
31 32 @endsection
32 33 @section('content')
33 34 <section class="thing">
... ... @@ -81,7 +82,7 @@
81 82 </div>
82 83 </div>
83 84 </div>
84   - <div id="main_ockar" name="main_ockar" style="width:100%;">
  85 + <div id="main_ockar" class="main__vacancies" name="main_ockar" style="width:100%;">
85 86 @foreach ($Query as $Q)
86 87 <div class="main__vacancies-item main__employer-page-two-item">
87 88 <a href="{{ route('list-vacancies', ['categories' => $categories->id]) }}" class="back main__employer-page-two-item-back">
... ... @@ -147,7 +148,7 @@
147 148 </div>
148 149 <div class="main__employer-page-two-item-bottom">
149 150 <div class="main__employer-page-two-item-bottom-date">{{ $Q->created_at }}</div>
150   - <button type="button" class="like main__employer-page-two-item-bottom-like js-toggle">
  151 + <button type="button" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js-toggle js_vacancy_favorites <?=App\Classes\Cookies_vacancy::selected_vacancy($Q->id);?>">
151 152 <svg>
152 153 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use>
153 154 </svg>
... ... @@ -158,6 +159,7 @@
158 159 <div style="margin-top: 20px">
159 160 {{ $Query->appends($_GET)->links('paginate') }}
160 161 </div>
  162 +
161 163 </div><!-- конец -->
162 164 </div>
163 165 </div>
resources/views/modals/register.blade.php
1 1 <div id="reg" class="modal">
2 2 <div class="modal__body">
3 3 <div class="modal__title left">Регистрация</div>
  4 + <div class="notify notify_red" style="display:none" id="block-info">
  5 + <svg>
  6 + <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use>
  7 + </svg><br>
  8 + <span id="messages_error_reg" name="messages_error_reg"></span>
  9 + </div>
4 10 <div class="modal__tabs">
5 11 <button type="button" class="modal__tabs-item button button_light active" data-tab="1">Кандидат</button>
6 12 <button type="button" class="modal__tabs-item button button_light" data-tab="2">Работодатель</button>
... ... @@ -93,9 +99,9 @@
93 99 <input type="tel" name="telephone_worker" id="telephone_worker" class="input" placeholder="+7 (___) ___-__-__" required>
94 100 </div>
95 101 </div>
96   - <div class="modal__reg-item">
  102 + <!--<div class="modal__reg-item">
97 103 <img src="images/catpcha.jpg" alt="" class="captcha">
98   - </div>
  104 + </div>-->
99 105  
100 106 <div class="modal__reg-item">
101 107 <label class="checkbox">
... ... @@ -119,19 +125,19 @@
119 125 <div class="modal__reg-item form-group">
120 126 <label class="form-group__label">Электронная почта</label>
121 127 <div class="form-group__item">
122   - <input type="email" class="input" placeholder="info@rekamore.su" required>
  128 + <input type="email" id="email_employer" name="email_employer" class="input" placeholder="info@rekamore.su" required>
123 129 </div>
124 130 </div>
125 131 <div class="modal__reg-item form-group">
126 132 <label class="form-group__label">Пароль</label>
127 133 <div class="form-group__item">
128   - <input type="password" class="input" placeholder="**********" required>
  134 + <input type="password" id="password_employer" name="password_employer" class="input" placeholder="**********" required>
129 135 <button type="button" class="eye">
130 136 <svg class="js-password-show">
131   - <use xlink:href="images/sprite.svg#eye"></use>
  137 + <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use>
132 138 </svg>
133 139 <svg class="js-password-hide">
134   - <use xlink:href="images/sprite.svg#eye-2"></use>
  140 + <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use>
135 141 </svg>
136 142 </button>
137 143 </div>
... ... @@ -139,45 +145,70 @@
139 145 <div class="modal__reg-item form-group">
140 146 <label class="form-group__label">Подтвердить пароль</label>
141 147 <div class="form-group__item">
142   - <input type="password" class="input" placeholder="**********" required>
  148 + <input type="password" id="password_confirmation_employer" name="password_confirmation_employer" class="input" placeholder="**********" required>
143 149 <button type="button" class="eye">
144 150 <svg class="js-password-show">
145   - <use xlink:href="images/sprite.svg#eye"></use>
  151 + <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use>
146 152 </svg>
147 153 <svg class="js-password-hide">
148   - <use xlink:href="images/sprite.svg#eye-2"></use>
  154 + <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use>
149 155 </svg>
150 156 </button>
151 157 </div>
152 158 </div>
  159 +
  160 +
153 161 <div class="modal__reg-item form-group">
154   - <label class="form-group__label">Номер телефона</label>
  162 + <label class="form-group__label">Фамилия работодателя</label>
  163 + <div class="form-group__item">
  164 + <input type="text" id="surname_employer" name="surname_employer" class="input" placeholder="Шестаков" required>
  165 + </div>
  166 + </div>
  167 +
  168 + <div class="modal__reg-item form-group">
  169 + <label class="form-group__label">Имя работодателя</label>
  170 + <div class="form-group__item">
  171 + <input type="text" id="name_man_employer" name="name_man_employer" class="input" placeholder="Андрей" required>
  172 + </div>
  173 + </div>
  174 +
  175 + <div class="modal__reg-item form-group">
  176 + <label class="form-group__label">Отчество работодателя</label>
155 177 <div class="form-group__item">
156   - <input type="tel" class="input" placeholder="+7 (___) ___-__-__" required>
  178 + <input type="text" id="surname2_employer" name="surname2_employer" class="input" placeholder="Васильевич">
157 179 </div>
158 180 </div>
  181 +
159 182 <div class="modal__reg-item form-group">
160 183 <label class="form-group__label">Название судоходной компании</label>
161 184 <div class="form-group__item">
162   - <input type="text" class="input" placeholder="ООО Река Море" required>
  185 + <input type="text" name="company_employer" id="company_employer" class="input" placeholder="ООО Река Море" required>
163 186 </div>
164 187 </div>
165   - <div class="modal__reg-item">
166   - <img src="images/catpcha.jpg" alt="" class="captcha">
  188 +
  189 + <div class="modal__reg-item form-group">
  190 + <label class="form-group__label">Номер телефона</label>
  191 + <div class="form-group__item">
  192 + <input type="tel" name="telephone_employer" id="telephone_employer" class="input" placeholder="+7 (___) ___-__-__" required>
  193 + </div>
167 194 </div>
  195 + <!--<div class="modal__reg-item">
  196 + <img src="images/catpcha.jpg" alt="" class="captcha">
  197 + </div>-->
  198 +
168 199 <div class="modal__reg-item">
169 200 <label class="checkbox">
170   - <input type="checkbox" class="checkbox__input" required>
  201 + <input type="checkbox" name="politik_employer" id="politik_employer" class="checkbox__input" required>
171 202 <span class="checkbox__icon">
172 203 <svg>
173   - <use xlink:href="images/sprite.svg#v"></use>
  204 + <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use>
174 205 </svg>
175 206 </span>
176 207 <span class="checkbox__text">
177   - <span>
178   - Я согласен(на) с <a href="#">Политикой конфиденциальности</a>
179   - </span>
180   - </span>
  208 + <span>
  209 + Я согласен(на) с <a href="{{ route('page', ['pages' => 'Politika-konfidencialnosti']) }}">Политикой конфиденциальности</a>
  210 + </span>
  211 + </span>
181 212 </label>
182 213 </div>
183 214 <button type="submit" id="button_reg_employer" name="button_reg_employer" class="button">Зарегистрироваться</button>
resources/views/resume.blade.php
... ... @@ -99,7 +99,7 @@
99 99 function init_array(){
100 100 //var str = JSON.stringify(new Array());//конвертируем в строку
101 101 var str = JSON.stringify(new Array());
102   - $.cookie('favorite_house',str);//записываем массив в куки
  102 + $.cookie('favorite_worker',str);//записываем массив в куки
103 103  
104 104 return str;
105 105 }
... ... @@ -178,7 +178,7 @@
178 178 @foreach ($resumes as $res)
179 179 <div class="main__resume-base-body-item">
180 180 <div class="main__resume-base-body-item-buttons">
181   - <button type="button" class="like js-toggle js_box_favorites <?=\App\Classes\RusDate::selected_item($res->id);?>"" data-val="{{ $res->id }}">
  181 + <button type="button" class="like js-toggle js_box_favorites <?=\App\Classes\RusDate::selected_item($res->id);?>" data-val="{{ $res->id }}">
182 182 <svg>
183 183 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use>
184 184 </svg>
resources/views/vacance-item.blade.php
1 1 @extends('layout.frontend', ['title' => $title])
2 2  
3 3 @section('scripts')
4   -
  4 + @include('js.favorite-vacancy')
5 5 @endsection
6 6  
7 7 @section('content')
... ... @@ -58,6 +58,7 @@
58 58 </div>
59 59 @endif
60 60 <h2 class="main__employer-page-title">Описание вакансии</h2>
  61 +
61 62 </div>
62 63  
63 64 @foreach ($Query as $Q)
... ... @@ -103,17 +104,19 @@
103 104 @endforeach
104 105 @endif
105 106 </div>
  107 + <br>
106 108 <div class="main__employer-page-two-item-buttons">
107 109 <button type="button" class="button main__employer-page-two-item-button">Откликнуться</button>
108 110 </div>
109 111 <div class="main__employer-page-two-item-bottom">
110 112 <div class="main__employer-page-two-item-bottom-date">{{ $Q->created_at }}</div>
111   - <button type="button" class="like main__employer-page-two-item-bottom-like js-toggle">
  113 + <button type="button" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js_vacancy_favorites js-toggle <?=\App\Classes\RusDate::selected_vacancy($Q->id);?>">
112 114 <svg>
113 115 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use>
114 116 </svg>
115 117 </button>
116 118 </div>
  119 +
117 120 </div>
118 121  
119 122 @endforeach
resources/views/workers/delete_profile.blade.php
... ... @@ -26,29 +26,32 @@
26 26 <p class="cabinet__text"><b>Вы уверены, что хотите удалить свой профиль?</b></p>
27 27 <div class="notify notify_red">
28 28 <svg>
29   - <use xlink:href="images/sprite.svg#i"></use>
  29 + <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use>
30 30 </svg>
31 31 <span>Это действие не может быть отменено!</span>
32 32 </div>
33   - <form class="cabinet__inputs">
  33 + @include('messages_error')
  34 + <form class="cabinet__inputs" action="{{ route('worker.deleteprofile_result') }}" method="POST">
  35 + @csrf
  36 + <input type="hidden" name="email" id="email" value="{{ $login }}"/>
34 37 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
35 38 <label class="form-group__label">Пожалуйста, введите пароль от учётной записи для подтверждения:</label>
36 39 <div class="form-group__item">
37   - <input type="password" class="input" placeholder="**********" required>
  40 + <input type="password" class="input" name="password" id="password" placeholder="**********" required>
38 41 <button type="button" class="eye">
39 42 <svg class="js-password-show">
40   - <use xlink:href="images/sprite.svg#eye"></use>
  43 + <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use>
41 44 </svg>
42 45 <svg class="js-password-hide">
43   - <use xlink:href="images/sprite.svg#eye-2"></use>
  46 + <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use>
44 47 </svg>
45 48 </button>
46 49 </div>
47 50 </div>
48 51 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
49 52 <div class="buttons">
50   - <button type="submit" class="button">Отменить</button>
51   - <a href="#" class="button button_light">Удалить профиль</a>
  53 + <a href="{{ route('worker.cabinet') }}" class="button">Отменить</a>
  54 + <button type="submit" class="button button_light">Удалить профиль</button>
52 55 </div>
53 56 </div>
54 57 </form>
resources/views/workers/dialog.blade.php
... ... @@ -0,0 +1,191 @@
  1 +@extends('layout.frontend', ['title' => 'Диалог-переписка - РекаМоре'])
  2 +
  3 +@section('scripts')
  4 + <script>
  5 + console.log('Test system');
  6 + $(document).on('change', '#send_btn', function() {
  7 + var this_ = $(this);
  8 + var val_ = this_.val();
  9 + console.log('sort items '+val_);
  10 +
  11 + $.ajax({
  12 + type: "GET",
  13 + url: "{{ route('shipping_companies') }}",
  14 + data: "sort="+val_+"&block=1",
  15 + success: function (data) {
  16 + console.log('Выбор сортировки');
  17 + console.log(data);
  18 + $('#block_1').html(data);
  19 + },
  20 + headers: {
  21 + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  22 + },
  23 + error: function (data) {
  24 + data = JSON.stringify(data);
  25 + console.log('Error: ' + data);
  26 + }
  27 + });
  28 +
  29 + $.ajax({
  30 + type: "GET",
  31 + url: "{{ route('shipping_companies') }}",
  32 + data: "sort="+val_+"&block=2",
  33 + success: function (data) {
  34 + console.log('Выбор сортировки2');
  35 + console.log(data);
  36 + history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif");
  37 + $('#block_2').html(data);
  38 + },
  39 + headers: {
  40 + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  41 + },
  42 + error: function (data) {
  43 + data = JSON.stringify(data);
  44 + console.log('Error: ' + data);
  45 + }
  46 + });
  47 + });
  48 + </script>
  49 +@endsection
  50 +
  51 +@section('content')
  52 + <section class="cabinet">
  53 + <div class="container">
  54 + <ul class="breadcrumbs cabinet__breadcrumbs">
  55 + <li><a href="{{ route('index') }}">Главная</a></li>
  56 + <li><b>Личный кабинет</b></li>
  57 + </ul>
  58 + <div class="cabinet__wrapper">
  59 + <div class="cabinet__side">
  60 + <div class="cabinet__side-toper">
  61 + @include('workers.emblema')
  62 + </div>
  63 + @include('workers.menu', ['item' => 2])
  64 + </div>
  65 + <div class="cabinet__body">
  66 + <div class="cabinet__body-item">
  67 + <h2 class="title cabinet__title">Сообщения</h2>
  68 + </div>
  69 + <div class="cabinet__body-item">
  70 + <a href="{{ route('worker.messages', ['type_message' => 'input']) }}" class="back">
  71 + <svg>
  72 + <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use>
  73 + </svg>
  74 + <span>
  75 + К списку чатов
  76 + </span>
  77 + </a>
  78 + <div class="chatbox">
  79 + <div class="chatbox__toper">
  80 + @if ($companion->is_worker)
  81 + <div class="chatbox__toper-info messages__item-info">
  82 + <div class="messages__item-photo">
  83 + <svg>
  84 + <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
  85 + </svg>
  86 + <img src="{{ asset('images/default_man.jpg') }}" alt="">
  87 + </div>
  88 + <div class="messages__item-text">
  89 + <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>
  91 + </div>
  92 + </div>
  93 + @if (isset($companion->worker->id))
  94 + <a href="{{ route('resume_profile', ['worker' => $companion->worker->id]) }}" class="button chatbox__toper-button">
  95 + <svg>
  96 + <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
  97 + </svg>
  98 + Перейти в резюме
  99 + </a>
  100 + @endif
  101 + @else
  102 + <div class="chatbox__toper-info messages__item-info">
  103 + <div class="messages__item-photo">
  104 + <svg>
  105 + <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
  106 + </svg>
  107 + <img src="{{ asset('images/default_man.jpg') }}" alt="">
  108 + </div>
  109 + <div class="messages__item-text">
  110 + <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div>
  111 + <div><span>Статус:</span> Работодатель или Администратор</div>
  112 + </div>
  113 + </div>
  114 + @if (isset($companion->employer->id))
  115 + <a href="" class="button chatbox__toper-button">
  116 + <svg>
  117 + <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
  118 + </svg>
  119 + Перейти в резюме
  120 + </a>
  121 + @endif
  122 + @endif
  123 + </div>
  124 +
  125 + <div class="chatbox__list" id="dialogs" name="dialogs">
  126 + @if ($Messages->count())
  127 + @foreach ($Messages as $it)
  128 + @if ($it->user_id == $companion->id)
  129 + <div class="chatbox__item">
  130 + <div class="chatbox__item-photo">
  131 + <svg>
  132 + <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
  133 + </svg>
  134 + <img src="{{ asset('images/default_man.jpg') }}" alt="">
  135 + </div>
  136 + <div class="chatbox__item-body">
  137 + <div class="chatbox__item-text">{{ $it->text }}</div>
  138 + </div>
  139 + <div class="chatbox__item-time">{{ $it->created_at }}</div>
  140 + </div>
  141 + @else
  142 + <div class="chatbox__item chatbox__item_reverse">
  143 + <div class="chatbox__item-photo">
  144 + <svg>
  145 + <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
  146 + </svg>
  147 + <img src="{{ asset('images/default_man.jpg') }}" alt="">
  148 + </div>
  149 + <div class="chatbox__item-body">
  150 + <div class="chatbox__item-text">{{ $it->text }}</div>
  151 + @if ((isset($it->file)) && (!empty($it->file)))
  152 + <a href="{{ asset(Storage::url($it->file)) }}" class="chatbox__item-text">
  153 + <svg>
  154 + <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use>
  155 + </svg>
  156 + </a>
  157 + @endif
  158 + </div>
  159 + <div class="chatbox__item-time">{{ $it->created_at }}</div>
  160 + </div>
  161 + @endif
  162 +
  163 + @endforeach
  164 + @endif
  165 + </div>
  166 + <form action="{{ route('employer.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" >
  167 + @csrf
  168 + <label class="chatbox__bottom-file">
  169 + <input id="file" name="file" type="file">
  170 + <svg>
  171 + <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use>
  172 + </svg>
  173 + </label>
  174 + <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
  175 + <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 }}"/>
  177 + <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить">
  178 + <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send">
  179 + <svg>
  180 + <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use>
  181 + </svg>
  182 + </button>
  183 + </form>
  184 + </div>
  185 + </div>
  186 + </div>
  187 + </div>
  188 + </div>
  189 + </section>
  190 + </div>
  191 +@endsection
resources/views/workers/favorite.blade.php
... ... @@ -17,7 +17,6 @@
17 17 @include('workers.emblema')
18 18  
19 19 </div>
20   -
21 20 @include('workers.menu', ['item' => 3])
22 21 </div>
23 22  
... ... @@ -28,39 +27,121 @@
28 27 <div class="cabinet__body-item">
29 28 <div class="cabinet__filters">
30 29 <div class="cabinet__filters-item">
31   - <form class="search">
32   - <input type="search" class="input" placeholder="Поиск&hellip;" required>
  30 + <form class="search" action="{{ route('worker.colorado') }}" method="GET">
  31 + <input type="search" name="search" id="search" class="input" placeholder="Поиск&hellip;">
33 32 <button type="submit" class="button">Найти</button>
34 33 <span>
35   - <svg>
36   - <use xlink:href="images/sprite.svg#search"></use>
37   - </svg>
38   - </span>
  34 + <svg>
  35 + <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use>
  36 + </svg>
  37 + </span>
39 38 </form>
40 39 </div>
41 40 <div class="cabinet__filters-item">
42 41 <div class="select">
43   - <select class="js-select2">
44   - <option>Сортировка (по умолчанию)</option>
45   - <option>Вариант 1</option>
46   - <option>Вариант 2</option>
47   - <option>Вариант 3</option>
  42 + <select class="js-select2" id="sort_ajax" name="sort_ajax">
  43 + <option value="default">Сортировка (по умолчанию)</option>
  44 + <option value="name (asc)">По имени (возрастание)</option>
  45 + <option value="name (desc)">По имени (убывание)</option>
  46 + <option value="created_at (asc)">По дате (возрастание)</option>
  47 + <option value="created_at (desc)">По дате (убывание)</option>
48 48 </select>
49 49 </div>
50 50 </div>
51 51 </div>
  52 + @if ($Query->count())
  53 + <div class="cabinet__vacs">
  54 + <div id="main_ockar" name="main_ockar" class="cabinet__vacs-body" style="width:100%;">
  55 + @foreach ($Query as $Q)
  56 + <div class="main__vacancies-item main__employer-page-two-item">
  57 + <a href="" class="back main__employer-page-two-item-back">
  58 + <svg>
  59 + <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use>
  60 + </svg>
  61 + <span>
  62 + Вернуться к списку вакансий
  63 + </span>
  64 + </a>
  65 + <div class="main__employer-page-two-item-toper">
  66 + @if (isset($Q->employer))
  67 + <img src="{{ asset(Storage::url($Q->employer->logo)) }}" alt="{{ $Q->employer->name }}">
  68 + @endif
  69 + <span>@if (!empty($Q->name)) {{ $Q->name }} @endif</span>
  70 + </div>
  71 + <div class="main__employer-page-two-item-text">
  72 + <div class="main__employer-page-two-item-text-name">Судоходная компания ведет набор
  73 + специалистов на следующие должности:</div>
  74 + <div class="main__employer-page-two-item-text-links">
  75 + @if (isset($Q->jobs))
  76 + @foreach ($Q->jobs as $key => $j)
  77 + <a>“{{ $j->name }}” – з/п от @if (isset($Q->jobs_code[$key]->min_salary)) {{ $Q->jobs_code[$key]->min_salary }} @endif - @if (isset($Q->jobs_code[$key]->max_salary)) {{ $Q->jobs_code[$key]->max_salary }} @endif рублей (на руки)</a>
  78 + @endforeach
  79 + @endif
  80 + </div>
  81 + </div>
  82 + <div class="main__employer-page-two-item-text">
  83 + <div class="main__employer-page-two-item-text-name">Мы предлагаем:</div>
  84 + <div class="main__employer-page-two-item-text-body">
  85 + {!! $Q->text !!}
  86 + </div>
  87 + </div>
  88 + <div class="main__employer-page-two-item-text">
  89 + <div class="main__employer-page-two-item-text-name">Наши ожидания:</div>
  90 + <div class="main__employer-page-two-item-text-body">
  91 + {!! $Q->description !!}
  92 + </div>
  93 + </div>
  94 + <div class="main__employer-page-two-item-text">
  95 + <div class="main__employer-page-two-item-text-name">Резюме направляйте на почту:</div>
  96 + <div class="main__employer-page-two-item-text-body">
  97 + {!! $Q->contacts_emails !!}
  98 + </div>
  99 + </div>
  100 + <div class="main__employer-page-two-item-text">
  101 + <div class="main__employer-page-two-item-text-name">Или звоните:</div>
  102 + <div class="main__employer-page-two-item-text-body">
  103 + {!! $Q->contacts_telephones !!}
  104 + </div>
  105 + </div>
  106 + <div class="main__employer-page-two-item-tags">
  107 + @if (isset($Q->jobs))
  108 + @foreach ($Q->jobs as $key => $j)
  109 + <span class="main__employer-page-two-item-tag">#{{ $j->name }}</span>
  110 + @endforeach
  111 + @endif
  112 + </div>
  113 + <div class="main__employer-page-two-item-buttons">
  114 + <button type="button"
  115 + class="button main__employer-page-two-item-button">Откликнуться</button>
  116 + <a href="{{ route('vacancie', ['vacancy' => $Q->id]) }}" class="button button_light main__employer-page-two-item-button">Подробнее</a>
  117 + </div>
  118 + <div class="main__employer-page-two-item-bottom">
  119 + <div class="main__employer-page-two-item-bottom-date">{{ $Q->created_at }}</div>
  120 + <button type="button" class="like main__employer-page-two-item-bottom-like js-toggle">
  121 + <svg>
  122 + <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use>
  123 + </svg>
  124 + </button>
  125 + </div>
  126 + </div>
  127 + @endforeach
  128 + <div style="margin-top: 20px">
  129 + {{ $Query->appends($_GET)->links('paginate') }}
  130 + </div>
  131 + </div>
  132 + @else
52 133 <div class="notify">
53 134 <svg>
54   - <use xlink:href="images/sprite.svg#i"></use>
  135 + <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use>
55 136 </svg>
56 137 <span>Нет избранных работодателей</span>
57 138 </div>
  139 + @endif
58 140 </div>
59 141 </div>
60 142 </div>
61 143 </div>
62 144 </section>
63   -
64   - </div> <!-- END TOP WRAPPER -->
  145 + </div>
65 146  
66 147 @endsection
resources/views/workers/messages.blade.php
... ... @@ -90,7 +90,7 @@
90 90 <div>
91 91 От: @if (isset($it->user_from))
92 92 @if ($it->user_from->id !== $user_id)
93   - <a href="{{ route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id]) }}" style="text-decoration: underline">
  93 + <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id]) }}" style="text-decoration: underline">
94 94 {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }}
95 95 </a>
96 96 @else
... ... @@ -102,7 +102,7 @@
102 102 <br>
103 103 К: @if (isset($it->user_to))
104 104 @if ($it->user_to->id !== $user_id)
105   - <a href="{{ route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id]) }}" style="text-decoration: underline">
  105 + <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id]) }}" style="text-decoration: underline">
106 106 {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }}
107 107 </a>
108 108 @else
resources/views/workers/new_password.blade.php
... ... @@ -25,17 +25,20 @@
25 25 <h2 class="title cabinet__title">Сменить пароль</h2>
26 26 </div>
27 27 <div class="cabinet__body-item">
28   - <form class="cabinet__inputs">
  28 + @include('messages_error')
  29 + <form class="cabinet__inputs" action="{{ route('worker.save_new_password') }}" method="POST">
  30 + @csrf
  31 + <input type="hidden" name="email" id="email" value="{{ $email }}"/>
29 32 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
30 33 <label class="form-group__label">Старый пароль</label>
31 34 <div class="form-group__item">
32   - <input type="password" class="input" placeholder="**********" required>
  35 + <input type="password" name="password" id="password" class="input" placeholder="**********" required>
33 36 <button type="button" class="eye">
34 37 <svg class="js-password-show">
35   - <use xlink:href="images/sprite.svg#eye"></use>
  38 + <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use>
36 39 </svg>
37 40 <svg class="js-password-hide">
38   - <use xlink:href="images/sprite.svg#eye-2"></use>
  41 + <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use>
39 42 </svg>
40 43 </button>
41 44 </div>
... ... @@ -43,13 +46,13 @@
43 46 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
44 47 <label class="form-group__label">Новый пароль</label>
45 48 <div class="form-group__item">
46   - <input type="password" class="input" placeholder="**********" required>
  49 + <input type="password" name="new_password" id="new_password" class="input" placeholder="**********" required>
47 50 <button type="button" class="eye">
48 51 <svg class="js-password-show">
49   - <use xlink:href="images/sprite.svg#eye"></use>
  52 + <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use>
50 53 </svg>
51 54 <svg class="js-password-hide">
52   - <use xlink:href="images/sprite.svg#eye-2"></use>
  55 + <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use>
53 56 </svg>
54 57 </button>
55 58 </div>
... ... @@ -57,13 +60,13 @@
57 60 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
58 61 <label class="form-group__label">Повторите новый пароль</label>
59 62 <div class="form-group__item">
60   - <input type="password" class="input" placeholder="**********" required>
  63 + <input type="password" name="new_password2" id="new_password2" class="input" placeholder="**********" required>
61 64 <button type="button" class="eye">
62 65 <svg class="js-password-show">
63   - <use xlink:href="images/sprite.svg#eye"></use>
  66 + <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use>
64 67 </svg>
65 68 <svg class="js-password-hide">
66   - <use xlink:href="images/sprite.svg#eye-2"></use>
  69 + <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use>
67 70 </svg>
68 71 </button>
69 72 </div>
... ... @@ -436,6 +436,13 @@ Route::get(&#39;login&#39;, [MainController::class, &#39;input_login&#39;])-&gt;name(&#39;login&#39;);
436 436 Route::get('logout', [EmployerController::class, 'logout'])->name('logout');
437 437  
438 438 Route::get( 'register_worker', [WorkerController::class, 'register_worker'])->name('register_worker');
  439 +Route::get('register_employer', [EmployerController::class, 'register_employer'])->name('register_employer');
  440 +
  441 +// Борьба против колорадских жуков и их геориевской ленточки
  442 +Route::get('clear_cookie', function() {
  443 + \App\Classes\Cookies_vacancy::clear_vacancy();
  444 + return redirect()->route('index');
  445 +})->name('clear_cookie');
439 446  
440 447 // Личный кабинет работника
441 448 Route::group([
... ... @@ -449,16 +456,19 @@ Route::group([
449 456  
450 457 // 2 страница - Сообщения
451 458 Route::get('cabinet/messages/{type_message}', [WorkerController::class, 'messages'])->name('messages');
452   -
  459 + Route::get('cabinet/dialog/{user1}/{user2}', [WorkerController::class, 'dialog'])->name('dialog');
453 460 // 3 страница - Избранные вакансии
454 461 Route::get('cabinet/favorite', [WorkerController::class, 'favorite'])->name('favorite');
  462 + // Продолжение борьбы против колорадов - избранные вакансии
455 463 Route::get('кабинет/favorite', [WorkerController::class, 'colorado'])->name('colorado');
456 464  
457 465 // 4 страница - Сменить пароль
458 466 Route::get('кабинет/new_password', [WorkerController::class, 'new_password'])->name('new_password');
  467 + Route::post('кабинет/new_password/save', [WorkerController::class, 'save_new_password'])->name('save_new_password');
459 468  
460 469 // 5 страница - Удалить профиль
461 470 Route::get('кабинет/delete_profile', [WorkerController::class, 'delete_profile'])->name('delete_profile');
  471 + Route::post('кабинет/delete_profile/delete', [WorkerController::class, 'delete_profile_result'])->name('deleteprofile_result');
462 472  
463 473 // 6 страница - Выход
464 474