Commit dc2a9a8762aecb9ce71b2e41ff05642a325014ab
1 parent
3add22d73c
Exists in
master
and in
1 other branch
Коммит на понедельник 25 марта
Showing 21 changed files with 583 additions and 44 deletions Side-by-side Diff
- app/Classes/LikesClass.php
- app/Http/Controllers/EmployerController.php
- app/Http/Controllers/MainController.php
- app/Http/Controllers/WorkerController.php
- app/Models/Like_vacancy.php
- app/Models/Like_worker.php
- database/migrations/2024_03_24_082538_create_table_like_worker.php
- database/migrations/2024_03_24_082648_create_table_like_vacancy.php
- public/js/script145.js
- public/js/script45.js
- resources/views/employers/favorite.blade.php
- resources/views/js/favorite-vacancy-3.blade.php
- resources/views/js/favorite-vacancy-45.blade.php
- resources/views/js/favorite-worker.blade.php
- resources/views/layout/frontend.blade.php
- resources/views/list_vacancies.blade.php
- resources/views/resume.blade.php
- resources/views/vacance-item.blade.php
- resources/views/workers/cabinet.blade.php
- resources/views/workers/favorite.blade.php
- routes/web.php
app/Classes/LikesClass.php
... | ... | @@ -0,0 +1,41 @@ |
1 | +<?php | |
2 | + | |
3 | + | |
4 | +namespace App\Classes; | |
5 | + | |
6 | + | |
7 | +use App\Models\Ad_employer; | |
8 | +use App\Models\Like_vacancy; | |
9 | +use App\Models\Like_worker; | |
10 | +use App\Models\Worker; | |
11 | + | |
12 | +class LikesClass | |
13 | +{ | |
14 | + // Вывод всех избранных вакансий у пользователя | |
15 | + public static function ListVacancy(Ad_employer $ad_employer) { | |
16 | + $ListVacancy = Like_vacancy::query()->where('code_record', '=', $ad_employer->id)->get(); | |
17 | + return $ListVacancy; | |
18 | + } | |
19 | + | |
20 | + // Вывод всех избранных работников у пользователя | |
21 | + public static function ListWorkers(Worker $worker) { | |
22 | + $ListWorker = Like_worker::query()->where('code_record', '=', $worker->id)->get(); | |
23 | + } | |
24 | + | |
25 | + // Возвращение кода вакансии | |
26 | + public static function get_status_vacancy(Ad_employer $ad_employer) { | |
27 | + if (Like_vacancy::query()->where('code_record', '=', $ad_employer->id)->count() > 0) | |
28 | + $IdVacancy = " active "; | |
29 | + else | |
30 | + $IdVacancy = ""; | |
31 | + | |
32 | + return $IdVacancy; | |
33 | + } | |
34 | + | |
35 | + public static function get_status_worker(Worker $worker) { | |
36 | + if (Like_worker::query()->where('code_record', '=', $worker->id)->count() > 0) | |
37 | + { $IdWorker = " active"; } else { $IdWorker = "123"; } | |
38 | + | |
39 | + return $IdWorker; | |
40 | + } | |
41 | +} |
app/Http/Controllers/EmployerController.php
... | ... | @@ -19,6 +19,8 @@ use App\Models\Employer; |
19 | 19 | use App\Models\employers_main; |
20 | 20 | use App\Models\Flot; |
21 | 21 | use App\Models\Job_title; |
22 | +use App\Models\Like_vacancy; | |
23 | +use App\Models\Like_worker; | |
22 | 24 | use App\Models\Message; |
23 | 25 | use App\Models\Worker; |
24 | 26 | use Carbon\Carbon; |
... | ... | @@ -448,20 +450,20 @@ class EmployerController extends Controller |
448 | 450 | |
449 | 451 | //Избранные люди |
450 | 452 | public function favorites(Request $request) { |
451 | - if (isset($_COOKIE['favorite_worker'])) { | |
452 | - $items = RusDate::count_item_fav(); | |
453 | - $it = $_COOKIE['favorite_worker']; | |
454 | - $it = str_replace('"', "", $it); | |
455 | - $it = str_replace('[', "", $it); | |
456 | - $it = str_replace(']', "", $it); | |
457 | - $Arr = explode(",", $it); | |
453 | + $IP_address = RusDate::ip_addr_client(); | |
454 | + $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); | |
455 | + | |
456 | + if ($Arr->count()) { | |
457 | + $A = Array(); | |
458 | + foreach ($Arr as $it) { | |
459 | + $A[] = $it->code_record; | |
460 | + } | |
461 | + | |
462 | + $Workers = Worker::query()->whereIn('id', $A); | |
458 | 463 | } else { |
459 | - $Arr = Array(); | |
464 | + $Workers = Worker::query(); | |
460 | 465 | } |
461 | 466 | |
462 | - $Workers = Worker::query(); | |
463 | - $Workers = $Workers->whereIn('id', $Arr); | |
464 | - | |
465 | 467 | if (($request->has('search')) && (!empty($request->get('search')))) { |
466 | 468 | $search = $request->get('search'); |
467 | 469 | |
... | ... | @@ -584,7 +586,7 @@ class EmployerController extends Controller |
584 | 586 | if (Auth::attempt($credentials)) { |
585 | 587 | Auth::logout(); |
586 | 588 | $it = User_Model::find($user_id); |
587 | - //$it->delete(); | |
589 | + $it->delete(); | |
588 | 590 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
589 | 591 | } else { |
590 | 592 | return redirect()->route('employer.delete_people') |
app/Http/Controllers/MainController.php
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | |
3 | 3 | namespace App\Http\Controllers; |
4 | 4 | |
5 | +use App\Classes\RusDate; | |
5 | 6 | use App\Classes\Tools; |
6 | 7 | use App\Mail\MailRegistration; |
7 | 8 | use App\Mail\MailRepair; |
... | ... | @@ -12,6 +13,8 @@ use App\Models\Education; |
12 | 13 | use App\Models\Employer; |
13 | 14 | use App\Models\employers_main; |
14 | 15 | use App\Models\Job_title; |
16 | +use App\Models\Like_vacancy; | |
17 | +use App\Models\Like_worker; | |
15 | 18 | use App\Models\News; |
16 | 19 | use App\Models\reclame; |
17 | 20 | use App\Models\User; |
... | ... | @@ -75,6 +78,49 @@ class MainController extends Controller |
75 | 78 | } |
76 | 79 | } |
77 | 80 | |
81 | + // Лайк вакансии | |
82 | + public function like_vacancy(Request $request) { | |
83 | + $IP_address = RusDate::ip_addr_client(); | |
84 | + | |
85 | + if ($request->has('code_record')) { | |
86 | + if ($request->has('delete')) { | |
87 | + $atomic_era = Like_vacancy::select('id')-> | |
88 | + where('code_record', '=', $request-> | |
89 | + get('code_record'))->first(); | |
90 | + | |
91 | + DB::table('like_vacancy')->where('code_record', $request->get('code_record'))->delete(); | |
92 | + | |
93 | + } else { | |
94 | + $params = $request->all(); | |
95 | + $params['ip_address'] = $IP_address; | |
96 | + Like_vacancy::create($params); | |
97 | + } | |
98 | + } | |
99 | + } | |
100 | + | |
101 | + // Лайк соискателю. | |
102 | + public function like_worker(Request $request) { | |
103 | + $IP_address = RusDate::ip_addr_client(); | |
104 | + | |
105 | + if ($request->has('code_record')) { | |
106 | + if ($request->has('delete')) { | |
107 | + $atomic_era = Like_worker::select('id')-> | |
108 | + where('code_record', '=', $request-> | |
109 | + get('code_record'))->first(); | |
110 | + | |
111 | + DB::table('like_worker')->where('code_record', $request->get('code_record'))->delete(); | |
112 | + | |
113 | + return "Вот и результат удаления!"; | |
114 | + | |
115 | + } else { | |
116 | + $params = $request->all(); | |
117 | + $params['ip_address'] = $IP_address; | |
118 | + Like_worker::create($params); | |
119 | + } | |
120 | + } | |
121 | + } | |
122 | + | |
123 | + | |
78 | 124 | public function vacancies(Request $request) { |
79 | 125 | //должности |
80 | 126 | $Job_title = Job_title::query()->orderBy('name')->get(); |
... | ... | @@ -124,6 +170,7 @@ class MainController extends Controller |
124 | 170 | } |
125 | 171 | $flot_prochee = $flot_prochee->groupby('ad_jobs.id')->get(); |
126 | 172 | |
173 | + | |
127 | 174 | if ($request->ajax()) { |
128 | 175 | return view('ajax.new_sky', compact('categories', 'flot_paluba', 'flot_MO', 'flot_radovie', 'flot_prochee')); |
129 | 176 | } else { |
... | ... | @@ -157,9 +204,7 @@ class MainController extends Controller |
157 | 204 | $Name_categori = ''; |
158 | 205 | } |
159 | 206 | |
160 | - | |
161 | - | |
162 | - if ($request->get('sort')) { | |
207 | + if ($request->get('sort')) { | |
163 | 208 | $sort = $request->get('sort'); |
164 | 209 | |
165 | 210 | |
... | ... | @@ -171,7 +216,7 @@ class MainController extends Controller |
171 | 216 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
172 | 217 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
173 | 218 | } |
174 | - } | |
219 | + } | |
175 | 220 | |
176 | 221 | $Job_title = Job_title::query()->OrderBy('name')->get(); |
177 | 222 |
app/Http/Controllers/WorkerController.php
... | ... | @@ -11,6 +11,8 @@ use App\Models\Dop_info; |
11 | 11 | use App\Models\Employer; |
12 | 12 | use App\Models\infobloks; |
13 | 13 | use App\Models\Job_title; |
14 | +use App\Models\Like_vacancy; | |
15 | +use App\Models\Like_worker; | |
14 | 16 | use App\Models\Message; |
15 | 17 | use App\Models\place_works; |
16 | 18 | use App\Models\reclame; |
... | ... | @@ -116,6 +118,11 @@ class WorkerController extends Controller |
116 | 118 | } |
117 | 119 | } |
118 | 120 | |
121 | + //Лайк резюме | |
122 | + public function like_controller() { | |
123 | + | |
124 | + } | |
125 | + | |
119 | 126 | // анкета соискателя |
120 | 127 | public function resume_profile(Worker $worker) |
121 | 128 | { |
... | ... | @@ -387,7 +394,7 @@ class WorkerController extends Controller |
387 | 394 | if (Auth::attempt($credentials)) { |
388 | 395 | Auth::logout(); |
389 | 396 | $it = User_Model::find($user_id); |
390 | - //$it->delete(); | |
397 | + $it->delete(); | |
391 | 398 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
392 | 399 | } else { |
393 | 400 | return redirect()->route('worker.delete_profile') |
... | ... | @@ -506,23 +513,22 @@ class WorkerController extends Controller |
506 | 513 | } |
507 | 514 | } |
508 | 515 | |
509 | - // Борьба против колорадских жуков, хотя жуков победил все таки 45. | |
516 | + // Вакансии избранные | |
510 | 517 | public function colorado(Request $request) { |
511 | - if (isset($_COOKIE['favorit_vacancy'])) { | |
512 | - $items = RusDate::count_vacancy_fav(); | |
513 | - $it = $_COOKIE['favorit_vacancy']; | |
514 | - $it = str_replace('"', "", $it); | |
515 | - $it = str_replace('[', "", $it); | |
516 | - $it = str_replace(']', "", $it); | |
517 | - $Arr = explode(",", $it); | |
518 | + $IP_address = RusDate::ip_addr_client(); | |
519 | + $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); | |
520 | + | |
521 | + if ($Arr->count()) { | |
522 | + $A = Array(); | |
523 | + foreach ($Arr as $it) { | |
524 | + $A[] = $it->code_record; | |
525 | + } | |
526 | + | |
527 | + $Query = Ad_employer::query()->whereIn('id', $A); | |
518 | 528 | } else { |
519 | - $Arr = Array('$0'); | |
529 | + $Query = Ad_employer::query(); | |
520 | 530 | } |
521 | 531 | |
522 | - $Query = Ad_employer::Query(); | |
523 | - if (count($Arr) > 0) { | |
524 | - $Query = $Query->whereIn('id', $Arr); | |
525 | - } | |
526 | 532 | $Query = $Query->with('jobs')-> |
527 | 533 | with('cat')-> |
528 | 534 | with('employer')-> |
app/Models/Like_vacancy.php
... | ... | @@ -0,0 +1,18 @@ |
1 | +<?php | |
2 | + | |
3 | +namespace App\Models; | |
4 | + | |
5 | +use Illuminate\Database\Eloquent\Factories\HasFactory; | |
6 | +use Illuminate\Database\Eloquent\Model; | |
7 | + | |
8 | +class Like_vacancy extends Model | |
9 | +{ | |
10 | + use HasFactory; | |
11 | + | |
12 | + public $table = 'like_vacancy'; | |
13 | + | |
14 | + public $fillable = [ | |
15 | + 'code_record', | |
16 | + 'ip_address' | |
17 | + ]; | |
18 | +} |
app/Models/Like_worker.php
... | ... | @@ -0,0 +1,25 @@ |
1 | +<?php | |
2 | + | |
3 | +namespace App\Models; | |
4 | + | |
5 | +use Illuminate\Database\Eloquent\Factories\HasFactory; | |
6 | +use Illuminate\Database\Eloquent\Model; | |
7 | + | |
8 | +class Like_worker extends Model | |
9 | +{ | |
10 | + use HasFactory; | |
11 | + | |
12 | + public $table = 'like_worker'; | |
13 | + | |
14 | + public $fillable = [ | |
15 | + 'code_record', | |
16 | + 'ip_address' | |
17 | + ]; | |
18 | + | |
19 | + /* | |
20 | + один-ко-многим | |
21 | + */ | |
22 | + public function worker() { | |
23 | + return $this->hasMany(Worker::class); | |
24 | + } | |
25 | +} |
database/migrations/2024_03_24_082538_create_table_like_worker.php
... | ... | @@ -0,0 +1,33 @@ |
1 | +<?php | |
2 | + | |
3 | +use Illuminate\Database\Migrations\Migration; | |
4 | +use Illuminate\Database\Schema\Blueprint; | |
5 | +use Illuminate\Support\Facades\Schema; | |
6 | + | |
7 | +return new class extends Migration | |
8 | +{ | |
9 | + /** | |
10 | + * Run the migrations. | |
11 | + * | |
12 | + * @return void | |
13 | + */ | |
14 | + public function up() | |
15 | + { | |
16 | + Schema::create('like_worker', function (Blueprint $table) { | |
17 | + $table->id(); | |
18 | + $table->string('ip_address', 255)->nullable(false); | |
19 | + $table->string('code_record')->nullable(false); | |
20 | + $table->timestamps(); | |
21 | + }); | |
22 | + } | |
23 | + | |
24 | + /** | |
25 | + * Reverse the migrations. | |
26 | + * | |
27 | + * @return void | |
28 | + */ | |
29 | + public function down() | |
30 | + { | |
31 | + Schema::dropIfExists('like_worker'); | |
32 | + } | |
33 | +}; |
database/migrations/2024_03_24_082648_create_table_like_vacancy.php
... | ... | @@ -0,0 +1,33 @@ |
1 | +<?php | |
2 | + | |
3 | +use Illuminate\Database\Migrations\Migration; | |
4 | +use Illuminate\Database\Schema\Blueprint; | |
5 | +use Illuminate\Support\Facades\Schema; | |
6 | + | |
7 | +return new class extends Migration | |
8 | +{ | |
9 | + /** | |
10 | + * Run the migrations. | |
11 | + * | |
12 | + * @return void | |
13 | + */ | |
14 | + public function up() | |
15 | + { | |
16 | + Schema::create('like_vacancy', function (Blueprint $table) { | |
17 | + $table->id(); | |
18 | + $table->string('ip_address', 255)->nullable(false); | |
19 | + $table->string('code_record')->nullable(false); | |
20 | + $table->timestamps(); | |
21 | + }); | |
22 | + } | |
23 | + | |
24 | + /** | |
25 | + * Reverse the migrations. | |
26 | + * | |
27 | + * @return void | |
28 | + */ | |
29 | + public function down() | |
30 | + { | |
31 | + Schema::dropIfExists('table_like_vacancy'); | |
32 | + } | |
33 | +}; |
public/js/script145.js
... | ... | @@ -0,0 +1,180 @@ |
1 | +let scripts = function () { | |
2 | + | |
3 | + $('.js-toggle').on('click', function () { | |
4 | + $(this).toggleClass('active'); | |
5 | + }); | |
6 | + $('.js-parent-toggle').on('click', function () { | |
7 | + $(this).parent().toggleClass('active'); | |
8 | + }); | |
9 | + $('.js-parent-remove').on('click', function () { | |
10 | + $(this).parent().remove(); | |
11 | + }); | |
12 | + $('.js-menu-toggle').on('click', function () { | |
13 | + window.scrollTo(0, 0); | |
14 | + $('#body').toggleClass('menu-is-actived'); | |
15 | + }); | |
16 | + $('.js-cookies-close').on('click', function () { | |
17 | + $('#body').removeClass('cookies-is-actived'); | |
18 | + }); | |
19 | + $('.js-works-edit').on('click', function () { | |
20 | + $(this).parent().parent().parent().addClass('active'); | |
21 | + }); | |
22 | + $('.js-works-remove').on('click', function () { | |
23 | + $(this).parent().parent().parent().parent().remove(); | |
24 | + }); | |
25 | + | |
26 | + $('[data-tab]').on('click', function () { | |
27 | + $('[data-tab]').removeClass('active'); | |
28 | + $('[data-body]').removeClass('showed'); | |
29 | + $(this).addClass('active'); | |
30 | + var id = $(this).data('tab'); | |
31 | + $('[data-body=' + id + ']').addClass('showed'); | |
32 | + }); | |
33 | + | |
34 | + $('.js-password-show').on('click', function () { | |
35 | + $(this).parent().addClass('active'); | |
36 | + $(this).parent().parent().find('input').attr('type', 'text'); | |
37 | + }); | |
38 | + | |
39 | + $('.js-password-hide').on('click', function () { | |
40 | + $(this).parent().removeClass('active'); | |
41 | + $(this).parent().parent().find('input').attr('type', 'password'); | |
42 | + }); | |
43 | + | |
44 | + let checkScrollTop = function () { | |
45 | + if ($(document).scrollTop() == 0) { | |
46 | + $('#body').removeClass('begin'); | |
47 | + } else { | |
48 | + $('#body').addClass('begin'); | |
49 | + } | |
50 | + } | |
51 | + checkScrollTop(); | |
52 | + $(document).on('scroll', function () { | |
53 | + checkScrollTop(); | |
54 | + }); | |
55 | + | |
56 | + let closeAll = function () { | |
57 | + $('.js-toggle').removeClass('active'); | |
58 | + $('.js-parent-toggle').parent().removeClass('active'); | |
59 | + $('#body').removeClass('menu-is-actived'); | |
60 | + $('#body').removeClass('cookies-is-actived'); | |
61 | + } | |
62 | + | |
63 | + $(document).keyup(function (e) { | |
64 | + if (e.key === "Escape") { | |
65 | + closeAll(); | |
66 | + } | |
67 | + }); | |
68 | + | |
69 | + $('.js-scroll-to').bind('click', function (e) { | |
70 | + let anchor = $(this); | |
71 | + $('html,body').stop().animate({ | |
72 | + scrollTop: $(anchor.attr('href')).offset().top | |
73 | + }, 300); | |
74 | + e.preventDefault(); | |
75 | + }); | |
76 | + | |
77 | + if ($('[type=tel]').is('[type=tel]')) { | |
78 | + $('[type=tel]').mask('+7 (999) 999-99-99'); | |
79 | + } | |
80 | + | |
81 | + if ($('.js-select2').is('.js-select2')) { | |
82 | + $('.js-select2').select2(); | |
83 | + } | |
84 | + | |
85 | + const starRating = document.querySelectorAll(".js-stars"); | |
86 | + if (starRating.length) { | |
87 | + starRating.forEach(item => { | |
88 | + new StarRating(item); | |
89 | + }); | |
90 | + } | |
91 | +}; | |
92 | + | |
93 | +document.addEventListener("DOMContentLoaded", () => { | |
94 | + scripts(); | |
95 | + swipers(); | |
96 | +}); | |
97 | + | |
98 | +$(window).resize(function () { | |
99 | + swipers(); | |
100 | +}); | |
101 | + | |
102 | +let swipers = function () { | |
103 | + | |
104 | + if ($('.js-employer-swiper').is('.js-employer-swiper')) { | |
105 | + let slider = new Swiper('.js-employer-swiper', { | |
106 | + autoplay: { | |
107 | + delay: 5000, | |
108 | + }, | |
109 | + pagination: { | |
110 | + el: '.swiper-pagination', | |
111 | + clickable: true | |
112 | + }, | |
113 | + breakpoints: { | |
114 | + 768: { | |
115 | + slidesPerView: 2, | |
116 | + }, | |
117 | + 992: { | |
118 | + slidesPerView: 3, | |
119 | + }, | |
120 | + 1280: { | |
121 | + slidesPerView: 4, | |
122 | + }, | |
123 | + } | |
124 | + }); | |
125 | + } | |
126 | + | |
127 | + if ($('.js-news-swiper').is('.js-news-swiper')) { | |
128 | + let slider = new Swiper('.js-news-swiper', { | |
129 | + spaceBetween: 20, | |
130 | + pagination: { | |
131 | + el: '.swiper-pagination', | |
132 | + clickable: true | |
133 | + }, | |
134 | + navigation: { | |
135 | + prevEl: '.js-news-swiper-button-prev', | |
136 | + nextEl: '.js-news-swiper-button-next', | |
137 | + }, | |
138 | + breakpoints: { | |
139 | + 768: { | |
140 | + slidesPerView: 2, | |
141 | + }, | |
142 | + 992: { | |
143 | + slidesPerView: 3, | |
144 | + }, | |
145 | + } | |
146 | + }); | |
147 | + } | |
148 | + | |
149 | + // cookies | |
150 | + /*const cookieItems = document.querySelectorAll(".js-ck"); | |
151 | + if (cookieItems.length) { | |
152 | + cookieItems.forEach(item => { | |
153 | + const id = item.dataset.id; | |
154 | + const like = item.querySelector(".like"); | |
155 | + const checkLike = function () { | |
156 | + if (like.classList.contains("active")) { | |
157 | + Cookies.set('favor_vacan-'+id, id); | |
158 | + } else { | |
159 | + Cookies.remove(id); | |
160 | + } | |
161 | + } | |
162 | + | |
163 | + like.addEventListener("click", () => { | |
164 | + checkLike(); | |
165 | + }); | |
166 | + | |
167 | + if (Cookies.get('favor_vacan-'+id) == id) { | |
168 | + like.classList.add("active"); | |
169 | + } | |
170 | + }); | |
171 | + } | |
172 | + console.log(Cookies.get()); | |
173 | + | |
174 | + | |
175 | + */ | |
176 | +}; | |
177 | + | |
178 | + | |
179 | + | |
180 | + |
public/js/script45.js
... | ... | @@ -147,7 +147,7 @@ let swipers = function () { |
147 | 147 | } |
148 | 148 | |
149 | 149 | // cookies |
150 | - const cookieItems = document.querySelectorAll(".js-ck"); | |
150 | + /*const cookieItems = document.querySelectorAll(".js-ck"); | |
151 | 151 | if (cookieItems.length) { |
152 | 152 | cookieItems.forEach(item => { |
153 | 153 | const id = item.dataset.id; |
... | ... | @@ -171,6 +171,8 @@ let swipers = function () { |
171 | 171 | } |
172 | 172 | console.log(Cookies.get()); |
173 | 173 | |
174 | + | |
175 | + */ | |
174 | 176 | }; |
175 | 177 | |
176 | 178 |
resources/views/employers/favorite.blade.php
... | ... | @@ -46,6 +46,7 @@ |
46 | 46 | }); |
47 | 47 | }); |
48 | 48 | </script> |
49 | + @include('js.favorite-vacancy-45') | |
49 | 50 | @endsection |
50 | 51 | |
51 | 52 | @section('content') |
... | ... | @@ -82,7 +83,7 @@ |
82 | 83 | </span> |
83 | 84 | </form> |
84 | 85 | </div> |
85 | - <div class="cabinet__filters-item"> | |
86 | + <!--<div class="cabinet__filters-item"> | |
86 | 87 | <div class="select"> |
87 | 88 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> |
88 | 89 | <option value="default">Сортировка (по умолчанию)</option> |
... | ... | @@ -92,7 +93,7 @@ |
92 | 93 | <option value="created_at (desc)">По дате (убывание)</option> |
93 | 94 | </select> |
94 | 95 | </div> |
95 | - </div> | |
96 | + </div>--> | |
96 | 97 | </div> |
97 | 98 | <div class="cvs"> |
98 | 99 | <!--<button type="button" class="cvs__button js-toggle js-parent-toggle button button_light button_more"> |
... | ... | @@ -103,7 +104,7 @@ |
103 | 104 | @foreach ($Workers as $it) |
104 | 105 | <div class="cvs__body"> |
105 | 106 | <div class="cvs__item"> |
106 | - <button type="button" class="like cvs__item-like js-toggle active"> | |
107 | + <button type="button" data-val="{{ $it->id }}" class="like cvs__item-like js_vac_favorite js-toggle {{ \App\Classes\LikesClass::get_status_worker($it) }}"> | |
107 | 108 | <svg> |
108 | 109 | <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> |
109 | 110 | </svg> |
resources/views/js/favorite-vacancy-3.blade.php
... | ... | @@ -0,0 +1,33 @@ |
1 | + | |
2 | +<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script> | |
3 | +<script> | |
4 | + console.log('js выполняется...'); | |
5 | + console.log(read_array()); | |
6 | + $(document).ready(function() { | |
7 | + $(document).on('click', '.js_vac_favorite', function () { | |
8 | + var _this = $(this); | |
9 | + var id_vacancy = _this.attr('data-val'); | |
10 | + | |
11 | + console.log('Download... final'); | |
12 | + $.ajax({ | |
13 | + type: "GET", | |
14 | + url: "{{ route('like-vacancy') }}", | |
15 | + data: "code_record="+id_vacancy, | |
16 | + success: function (data) { | |
17 | + console.log('Выбор сортировки'); | |
18 | + console.log(data); | |
19 | + $('#main_ockar').html(data); | |
20 | + }, | |
21 | + headers: { | |
22 | + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | |
23 | + }, | |
24 | + error: function (data) { | |
25 | + data = JSON.stringify(data); | |
26 | + console.log('Error: ' + data); | |
27 | + } | |
28 | + }); | |
29 | + console.log("Вывод куков "+str); | |
30 | + | |
31 | + }); | |
32 | + }); | |
33 | +</script> |
resources/views/js/favorite-vacancy-45.blade.php
... | ... | @@ -0,0 +1,51 @@ |
1 | +<script> | |
2 | + console.log('js выполняется...123'); | |
3 | + | |
4 | + $(document).ready(function() { | |
5 | + $(document).on('click', '.js_vac_favorite', function () { | |
6 | + var _this = $(this); | |
7 | + var id = _this.attr('id'); | |
8 | + var id_vacancy = _this.attr('data-val'); | |
9 | + console.log('active='+id); | |
10 | + | |
11 | + if ($( "#"+id ).hasClass( "active" )) { | |
12 | + console.log('Download 41... final'); | |
13 | + $.ajax({ | |
14 | + type: "GET", | |
15 | + url: "{{ route('like-vacancy') }}", | |
16 | + data: "code_record=" + id_vacancy, | |
17 | + success: function (data) { | |
18 | + console.log('Выбор сортировки'); | |
19 | + console.log(data); | |
20 | + | |
21 | + }, | |
22 | + headers: { | |
23 | + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | |
24 | + }, | |
25 | + error: function (data) { | |
26 | + data = JSON.stringify(data); | |
27 | + console.log('Error: ' + data); | |
28 | + } | |
29 | + }); | |
30 | + } else { | |
31 | + console.log('Не выполнить условие никогда'); | |
32 | + $.ajax({ | |
33 | + type: "GET", | |
34 | + url: "{{ route('like-vacancy') }}", | |
35 | + data: "code_record=" + id_vacancy + "&delete=1", | |
36 | + success: function (data) { | |
37 | + console.log('Выбор сортировки'); | |
38 | + console.log(data); | |
39 | + }, | |
40 | + headers: { | |
41 | + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | |
42 | + }, | |
43 | + error: function (data) { | |
44 | + data = JSON.stringify(data); | |
45 | + console.log('Error: ' + data); | |
46 | + } | |
47 | + }); | |
48 | + } | |
49 | + }); | |
50 | + }); | |
51 | +</script> |
resources/views/js/favorite-worker.blade.php
... | ... | @@ -0,0 +1,51 @@ |
1 | +<script> | |
2 | + console.log('js выполняется...123'); | |
3 | + | |
4 | + $(document).ready(function() { | |
5 | + $(document).on('click', '.js_box_favorit', function () { | |
6 | + var _this = $(this); | |
7 | + var id = _this.attr('id'); | |
8 | + var id_worker = _this.attr('data-val'); | |
9 | + console.log('active='+id); | |
10 | + | |
11 | + if ($( "#"+id ).hasClass( "active" )) { | |
12 | + console.log('Download 41... final'); | |
13 | + $.ajax({ | |
14 | + type: "GET", | |
15 | + url: "{{ route('like_resume') }}", | |
16 | + data: "code_record=" + id_worker, | |
17 | + success: function (data) { | |
18 | + console.log('Выбор сортировки'); | |
19 | + console.log(data); | |
20 | + | |
21 | + }, | |
22 | + headers: { | |
23 | + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | |
24 | + }, | |
25 | + error: function (data) { | |
26 | + data = JSON.stringify(data); | |
27 | + console.log('Error: ' + data); | |
28 | + } | |
29 | + }); | |
30 | + } else { | |
31 | + console.log('Не выполнить условие никогда'); | |
32 | + $.ajax({ | |
33 | + type: "GET", | |
34 | + url: "{{ route('like_resume') }}", | |
35 | + data: "code_record=" + id_worker + "&delete=1", | |
36 | + success: function (data) { | |
37 | + console.log('Выбор сортировки'); | |
38 | + console.log(data); | |
39 | + }, | |
40 | + headers: { | |
41 | + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | |
42 | + }, | |
43 | + error: function (data) { | |
44 | + data = JSON.stringify(data); | |
45 | + console.log('Error: ' + data); | |
46 | + } | |
47 | + }); | |
48 | + } | |
49 | + }); | |
50 | + }); | |
51 | +</script> |
resources/views/layout/frontend.blade.php
... | ... | @@ -277,7 +277,7 @@ |
277 | 277 | <script src="{{ asset('js/jquery.fancybox.js') }}"></script> |
278 | 278 | <script src="{{ asset('js/jquery.select2.js') }}"></script> |
279 | 279 | <script src="{{ asset('js/swiper.js') }}"></script> |
280 | -<script src="{{ asset('js/script45.js') }}"></script> | |
280 | +<script src="{{ asset('js/script145.js') }}"></script> | |
281 | 281 | <script src="{{ asset('js/star-rating.min.js') }}"></script> |
282 | 282 | <script> |
283 | 283 | var getUrlParameter = function getUrlParameter(sParam) { |
resources/views/list_vacancies.blade.php
... | ... | @@ -120,7 +120,7 @@ |
120 | 120 | } |
121 | 121 | }); |
122 | 122 | </script> |
123 | - @include('js.favorite-vacancy') | |
123 | + @include('js.favorite-vacancy-45') | |
124 | 124 | @endsection |
125 | 125 | @section('content') |
126 | 126 | <section class="thing"> |
... | ... | @@ -282,7 +282,7 @@ |
282 | 282 | </div> |
283 | 283 | <div class="main__employer-page-two-item-bottom"> |
284 | 284 | <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($Q->created_at)) }}</div> |
285 | - <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);?>"> | |
285 | + <button type="button" id="like{{ $Q->id }}" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js-toggle js_vac_favorite {{ \App\Classes\LikesClass::get_status_vacancy($Q) }}"> | |
286 | 286 | <svg> |
287 | 287 | <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> |
288 | 288 | </svg> |
resources/views/resume.blade.php
... | ... | @@ -190,6 +190,7 @@ |
190 | 190 | } |
191 | 191 | }); |
192 | 192 | </script> |
193 | + @include('js.favorite-worker') | |
193 | 194 | @endsection |
194 | 195 | |
195 | 196 | |
... | ... | @@ -263,7 +264,7 @@ |
263 | 264 | @foreach ($resumes as $res) |
264 | 265 | <div class="main__resume-base-body-item"> |
265 | 266 | <div class="main__resume-base-body-item-buttons"> |
266 | - <button type="button" class="like js-toggle js_box_favorites <?=\App\Classes\RusDate::selected_item($res->id);?>" data-val="{{ $res->id }}"> | |
267 | + <button type="button" data-id="{{ $res->id }}" id="elem{{ $res->id }}" class="like js-toggle js_box_favorit {{ \App\Classes\LikesClass::get_status_worker($res) }}" data-val="{{ $res->id }}"> | |
267 | 268 | <svg> |
268 | 269 | <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> |
269 | 270 | </svg> |
... | ... | @@ -317,7 +318,7 @@ |
317 | 318 | @foreach ($resumes as $res) |
318 | 319 | <div class="main__resume-base-body-item"> |
319 | 320 | <div class="main__resume-base-body-item-buttons"> |
320 | - <button type="button" class="like js-toggle js_box_favorites <?=\App\Classes\RusDate::selected_item($res->id);?>" data-val="{{ $res->id }}"> | |
321 | + <button type="button" id="elem_{{ $res->id }}" class="like js-toggle js_box_favorit {{ \App\Classes\LikesClass::get_status_worker($res) }}" data-val="{{ $res->id }}"> | |
321 | 322 | <svg> |
322 | 323 | <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> |
323 | 324 | </svg> |
resources/views/vacance-item.blade.php
... | ... | @@ -23,6 +23,7 @@ |
23 | 23 | vacancy.val(code_vacancy); |
24 | 24 | }); |
25 | 25 | </script> |
26 | + @include('js.favorite-vacancy-45') | |
26 | 27 | @endsection |
27 | 28 | |
28 | 29 | @section('content') |
... | ... | @@ -151,7 +152,7 @@ |
151 | 152 | </div> |
152 | 153 | <div class="main__employer-page-two-item-bottom"> |
153 | 154 | <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($Q->created_at)) }}</div> |
154 | - <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);?>"> | |
155 | + <button type="button" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js_vac_favorite js-toggle {{ \App\Classes\LikesClass::get_status_vacancy($Q) }}"> | |
155 | 156 | <svg> |
156 | 157 | <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> |
157 | 158 | </svg> |
resources/views/workers/cabinet.blade.php
... | ... | @@ -108,6 +108,17 @@ |
108 | 108 | } |
109 | 109 | }); |
110 | 110 | }); |
111 | + | |
112 | + $(document).on('click', '#old_year', function() { | |
113 | + var this_ = $(this); | |
114 | + var val = this_.val(); | |
115 | + | |
116 | + if (val < 0) | |
117 | + $('#old_year').val(0); | |
118 | + | |
119 | + console.log('Возраст не может выполнить такую операцию'); | |
120 | + }); | |
121 | + | |
111 | 122 | </script> |
112 | 123 | @endsection |
113 | 124 |
resources/views/workers/favorite.blade.php
1 | 1 | @extends('layout.frontend', ['title' => 'Избранные - РекаМоре']) |
2 | 2 | |
3 | 3 | @section('scripts') |
4 | - @include('js.favorite-vacancy') | |
4 | + @include('js.favorite-vacancy-45') | |
5 | 5 | @endsection |
6 | 6 | |
7 | 7 | @section('content') |
... | ... | @@ -37,7 +37,7 @@ |
37 | 37 | </span> |
38 | 38 | </form> |
39 | 39 | </div> |
40 | - <div class="cabinet__filters-item"> | |
40 | + <!--<div class="cabinet__filters-item"> | |
41 | 41 | <div class="select"> |
42 | 42 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> |
43 | 43 | <option value="default">Сортировка (по умолчанию)</option> |
... | ... | @@ -47,7 +47,7 @@ |
47 | 47 | <option value="created_at (desc)">По дате (убывание)</option> |
48 | 48 | </select> |
49 | 49 | </div> |
50 | - </div> | |
50 | + </div>--> | |
51 | 51 | </div> |
52 | 52 | @if ($Query->count()) |
53 | 53 | <div class="cabinet__vacs"> |
... | ... | @@ -119,7 +119,7 @@ |
119 | 119 | </div> |
120 | 120 | <div class="main__employer-page-two-item-bottom"> |
121 | 121 | <div class="main__employer-page-two-item-bottom-date">{{ $Q->created_at }}</div> |
122 | - <button type="button" class="like main__employer-page-two-item-bottom-like js-toggle js_vacancy_favorites <?=App\Classes\Cookies_vacancy::selected_vacancy($Q->id);?>"> | |
122 | + <button type="button" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js-toggle js_vac_favorite {{ \App\Classes\LikesClass::get_status_vacancy($Q) }}?>"> | |
123 | 123 | <svg> |
124 | 124 | <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> |
125 | 125 | </svg> |
routes/web.php
... | ... | @@ -403,6 +403,9 @@ Route::get('search-vacancies', [MainController::class, 'search_vacancies'])->nam |
403 | 403 | //Вакансии категория детальная |
404 | 404 | Route::get('list-vacancies/{categories?}', [MainController::class, 'list_vacancies'])->name('list-vacancies'); |
405 | 405 | |
406 | +// Лайк вакансии | |
407 | +Route::get('like-vacancy', [MainController::class, 'like_vacancy'])->name('like-vacancy'); | |
408 | + | |
406 | 409 | //Детальная страница вакансии - работодателя |
407 | 410 | Route::get('vacancie/{vacancy}', [FrontEmployersController::class, 'vacancie'])->name('vacancie'); |
408 | 411 | |
... | ... | @@ -425,6 +428,8 @@ Route::get('contacts', [MainController::class, 'contacts'])->name('contacts'); |
425 | 428 | //База резюме |
426 | 429 | Route::get('bd-resume', [WorkerController::class, 'bd_resume'])->name('bd_resume'); |
427 | 430 | |
431 | +Route::get('like-resume', [MainController::class, 'like_worker'])->name('like_resume'); | |
432 | + | |
428 | 433 | //Анкета соискателя |
429 | 434 | Route::get('resume-profile/{worker}', [WorkerController::class, 'resume_profile'])->name('resume_profile'); |
430 | 435 |