From 31fe4e458f11e29b92941359f4cd44a8f37c58a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=20=D0=9B=D0=B0=D1=80?= =?UTF-8?q?=D0=B8=D0=BE=D0=BD=D0=BE=D0=B2?= Date: Wed, 27 Mar 2024 21:29:51 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BA=D0=B0=D0=B7=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B5=D0=BA=D1=82=D0=B0=20=D0=B7=D0=B0=D0=BA=D0=B0=D0=B7=D1=87=D0?= =?UTF-8?q?=B8=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Admin/JobTitlesController.php | 7 +- app/Http/Controllers/CompanyController.php | 1 + app/Http/Controllers/EmployerController.php | 47 +++++- app/Http/Controllers/MainController.php | 42 ++++- app/Http/Controllers/WorkerController.php | 36 +++- app/Models/Ad_jobs.php | 5 + app/Models/Job_title.php | 3 +- .../2023_09_08_084707_alter_job_titles3_table.php | 2 + public/js/script-vc.js | 164 +++++++++++++++++++ public/js/script.js | 173 -------------------- public/js/script0.js | 173 ++++++++++++++++++++ resources/views/admin/job_titles/form.blade.php | 15 ++ resources/views/admin/positions/position.blade.php | 2 +- resources/views/block_real.blade.php | 15 +- resources/views/companies.blade.php | 4 +- resources/views/education.blade.php | 3 +- resources/views/employers/add_vacancy.blade.php | 65 ++++++-- .../views/employers/ajax/list_vacancy.blade.php | 3 +- resources/views/employers/edit_vacancy.blade.php | 45 +++++ resources/views/employers/list_vacancy.blade.php | 5 +- resources/views/favorite_people.blade.php | 3 + resources/views/index.blade.php | 2 - resources/views/js/modals.blade.php | 19 ++- resources/views/layout/frontend.blade.php | 2 +- resources/views/list_vacancies.blade.php | 2 +- resources/views/news-list.blade.php | 15 +- resources/views/resume.blade.php | 2 +- routes/web.php | 2 + 28 files changed, 615 insertions(+), 242 deletions(-) create mode 100644 public/js/script-vc.js delete mode 100644 public/js/script.js create mode 100644 public/js/script0.js create mode 100644 resources/views/favorite_people.blade.php diff --git a/app/Http/Controllers/Admin/JobTitlesController.php b/app/Http/Controllers/Admin/JobTitlesController.php index 83897ed..d258ee7 100644 --- a/app/Http/Controllers/Admin/JobTitlesController.php +++ b/app/Http/Controllers/Admin/JobTitlesController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use App\Http\Requests\JobTitlesRequest; use App\Models\Job_title; +use App\Models\Positions; use Illuminate\Http\Request; class JobTitlesController extends Controller @@ -32,8 +33,9 @@ class JobTitlesController extends Controller orderBy('name')-> active()-> get();*/ + $position = Positions::query()->get(); - return view('admin.job_titles.add'); + return view('admin.job_titles.add', compact('position')); } /** @@ -67,7 +69,8 @@ class JobTitlesController extends Controller */ public function edit(Job_title $job_title) { - return view('admin.job_titles.edit', compact('job_title')); + $position = Positions::query()->get(); + return view('admin.job_titles.edit', compact('job_title', 'position')); } /** diff --git a/app/Http/Controllers/CompanyController.php b/app/Http/Controllers/CompanyController.php index c917d4e..e158da6 100644 --- a/app/Http/Controllers/CompanyController.php +++ b/app/Http/Controllers/CompanyController.php @@ -30,6 +30,7 @@ class CompanyController extends Controller $emps = $emps->paginate(4); + if ($request->ajax()) { if ($request->get('block') == '1') return view('ajax.companies', compact('emps', 'count_emps')); diff --git a/app/Http/Controllers/EmployerController.php b/app/Http/Controllers/EmployerController.php index cbe362c..c47c37f 100644 --- a/app/Http/Controllers/EmployerController.php +++ b/app/Http/Controllers/EmployerController.php @@ -114,9 +114,15 @@ class EmployerController extends Controller // Форма добавления вакансий public function cabinet_vacancie() { $id = Auth()->user()->id; - $jobs = Job_title::query()->OrderBy('name')->get(); + $categories = Category::query()->get(); $Positions = Positions::query()->get(); + if ($Positions->count()) { + $jobs = Job_title::query()->OrderBy('name')->where('position_id', $Positions[0]->id)->get(); + } else { + $jobs = Job_title::query()->OrderBy('name')->where('position_id', 0)->get(); + } + $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> WhereHas('users', function (Builder $query) use ($id) {$query->Where('id', $id); @@ -137,7 +143,7 @@ class EmployerController extends Controller $jobs['job_title_id'] = $params['job_title_id']; $jobs['description'] = $params['description']; $jobs['region'] = $params['city']; - $jobs['position_ship'] = $params['position_ship']; + //$titles['position_id'] = $params['position_id']; unset($params['min_salary']); unset($params['max_salary']); unset($params['flot']); @@ -148,7 +154,8 @@ class EmployerController extends Controller $id = Ad_employer::create($params)->id; $jobs['ad_employer_id'] = $id; - Ad_jobs::create($jobs); + $ad_jobs = Ad_jobs::create($jobs); + return redirect()->route('employer.vacancy_list'); } @@ -169,7 +176,8 @@ class EmployerController extends Controller default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; } } - $vacancy_list = $vacancy_list->get(); + $vacancy_list = $vacancy_list->paginate(4); + //ajax if ($request->ajax()) { @@ -182,19 +190,36 @@ class EmployerController extends Controller // Карточка вакансии public function vacancy_edit(Ad_employer $ad_employer) { $id = Auth()->user()->id; - $jobs = Job_title::query()->OrderBy('name')->get(); + + $Positions = Positions::query()->get(); + if ($Positions->count()) { + $jobs = Job_title::query()->OrderBy('name')->where('position_id', $Positions[0]->id)->get(); + } else { + $jobs = Job_title::query()->OrderBy('name')->where('position_id', 0)->get(); + } + $categories = Category::query()->get(); $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> where('user_id', $id)->first(); - return view('employers.edit_vacancy', compact('ad_employer', 'categories','Employer', 'jobs')); + return view('employers.edit_vacancy', compact('ad_employer', 'Positions', 'categories','Employer', 'jobs')); } // Сохранение-редактирование записи public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { - $all = $request->all(); + $params = $request->all(); - $ad_employer->update($all); + //$jobs['flot'] = $params['flot']; + $jobs['job_title_id'] = $params['job_title_id']; + //$titles['position_id'] = $params['position_id']; + unset($params['job_title_id']); + + $ad_employer->update($params); + + $job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> + where('ad_employer_id', $ad_employer->id)->first(); + $data = Ad_jobs::find($job_->id); + $ad_jobs = $data->update($jobs); return redirect()->route('employer.vacancy_list'); } @@ -680,7 +705,13 @@ class EmployerController extends Controller // Восстановление пароля public function repair_password(Request $request) { $params = $request->get('email'); + } + // Избранные люди на корабль + public function selected_people(Request $request) { + $id = $request->get('id'); + $favorite_people = Job_title::query()->where('position_id', $id)->get(); + return view('favorite_people', compact('favorite_people')); } } diff --git a/app/Http/Controllers/MainController.php b/app/Http/Controllers/MainController.php index f5dcb49..544c930 100644 --- a/app/Http/Controllers/MainController.php +++ b/app/Http/Controllers/MainController.php @@ -41,7 +41,7 @@ class MainController extends Controller $Position = Positions::query()->get(); - $BigFlot = Array(); + /*$BigFlot = Array(); foreach ($Position as $position) { $BigFlot[] = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> orderBy('job_titles.sort')-> @@ -51,6 +51,30 @@ class MainController extends Controller get(); } + $BigFlot = Array(); + + foreach ($Position as $position) { + + $BigFlot[] = Ad_jobs::query()->with(['job_title' => function($query) { + $query->OrderBy('sort'); + }])->whereHas('job_title', function ($query) use ($position) { + $query->where('position_id', $position->id); + })-> + distinct('job_title_id')-> + get(); + }*/ + + $BigFlot = Array(); + foreach ($Position as $position) { + $BigFlot[] = DB::table('ad_jobs')-> + selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> + orderByDesc('job_titles.sort')-> + join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> + where('job_titles.position_id', $position->id)-> + groupby('job_title_id')-> + get(); + } + $employers = employers_main::query()->with('employer')->orderBy('id')->limit(8)->get(); $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get(); return view('index', compact('news', 'categories', 'employers', 'vacancy', 'BigFlot', 'Position')); @@ -127,7 +151,7 @@ class MainController extends Controller $Position = Positions::query()->get(); - $BigFlot = Array(); + /*$BigFlot = Array(); foreach ($Position as $position) { $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> orderBy('job_titles.sort')-> @@ -138,6 +162,20 @@ class MainController extends Controller } $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); $BigFlot[] = $War_flot; + }*/ + + $BigFlot = Array(); + foreach ($Position as $position) { + $WarFlot = DB::table('ad_jobs')-> + selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> + orderByDesc('job_titles.sort')-> + join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> + where('job_titles.position_id', $position->id); + if (($request->has('job')) && ($request->get('job') > 0)) { + $WarFlot = $WarFlot->where('job_title_id', $request->get('job')); + } + $WarFlot = $WarFlot->groupby('job_title_id')->get(); + $BigFlot[] = $WarFlot; } if ($request->ajax()) { diff --git a/app/Http/Controllers/WorkerController.php b/app/Http/Controllers/WorkerController.php index a959665..c7eb8d5 100644 --- a/app/Http/Controllers/WorkerController.php +++ b/app/Http/Controllers/WorkerController.php @@ -103,7 +103,7 @@ class WorkerController extends Controller } $res_count = $resumes->count(); - $resumes = $resumes->paginate(6); + $resumes = $resumes->paginate(4); if ($request->ajax()) { // Условия обставлены if ($request->has('block') && ($request->get('block') == 1)) { @@ -412,9 +412,7 @@ class WorkerController extends Controller public function register_worker(Request $request) { $params = $request->all(); - - - dd($params); + $params['is_worker'] = 1; $rules = [ 'surname' => ['required', 'string', 'max:255'], @@ -441,6 +439,30 @@ class WorkerController extends Controller return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); } + $haystack = $request->get('password'); + + $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); + $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', + 'X', 'C', 'V', 'B', 'N', 'M'); + $spec_bool = false; + $alpha_bool = false; + + foreach ($specsumbol as $it) { + if (strpos($haystack, $it) !== false) { + $spec_bool = true; + } + } + + foreach ($alpha as $it) { + if (strpos($haystack, $it) !== false) { + $alpha_bool = true; + } + } + + if ((!$spec_bool) || (!$alpha_bool)) { + return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); + } + if (($request->has('politik')) && ($request->get('politik') == 1)) { $validator = Validator::make($request->all(), $rules, $messages); @@ -449,10 +471,8 @@ class WorkerController extends Controller } else { $user = $this->create($params); event(new Registered($user)); - Auth::guard()->login($user); } - if ($user) { return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; } else { @@ -462,11 +482,8 @@ class WorkerController extends Controller } else { return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); } - - } - // Звездная оценка и ответ public function stars_answer(Request $request) { $params = $request->all(); @@ -604,6 +621,7 @@ class WorkerController extends Controller public function up(Worker $worker) { $worker->updated_at = Carbon::now(); $worker->save(); + // 0 return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); } diff --git a/app/Models/Ad_jobs.php b/app/Models/Ad_jobs.php index a35b144..d8c6ec0 100644 --- a/app/Models/Ad_jobs.php +++ b/app/Models/Ad_jobs.php @@ -2,6 +2,7 @@ namespace App\Models; +use Filament\Tables\Actions\Position; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -27,4 +28,8 @@ class Ad_jobs extends Model public function job_title() { return $this->belongsTo(Job_title::class, 'job_title_id'); } + + public function positions() { + return $this->belongsToMany(Positions::class, 'job_titles'); + } } diff --git a/app/Models/Job_title.php b/app/Models/Job_title.php index b585bd5..ef4abd6 100644 --- a/app/Models/Job_title.php +++ b/app/Models/Job_title.php @@ -13,7 +13,8 @@ class Job_title extends Model 'name', 'is_remove', 'parent_id', - 'sort' + 'sort', + 'position_id' ]; /* * Связь модели Вакансии (Ad_employer) с моделью Должности (Job_title) diff --git a/database/migrations/2023_09_08_084707_alter_job_titles3_table.php b/database/migrations/2023_09_08_084707_alter_job_titles3_table.php index cbc8677..9995ffd 100644 --- a/database/migrations/2023_09_08_084707_alter_job_titles3_table.php +++ b/database/migrations/2023_09_08_084707_alter_job_titles3_table.php @@ -15,6 +15,7 @@ return new class extends Migration { Schema::table('job_titles', function (Blueprint $table) { $table->integer('sort')->default(100); + $table->integer('position_id')->nullable(false); }); } @@ -27,6 +28,7 @@ return new class extends Migration { Schema::table('job_titles', function (Blueprint $table) { $table->dropColumn('sort'); + $table->dropColumn('position_id'); }); } }; diff --git a/public/js/script-vc.js b/public/js/script-vc.js new file mode 100644 index 0000000..03c40a4 --- /dev/null +++ b/public/js/script-vc.js @@ -0,0 +1,164 @@ +let scripts = function () { + + $('.js-toggle').on('click', function () { + $(this).toggleClass('active'); + }); + $('.js-parent-toggle').on('click', function () { + $(this).parent().toggleClass('active'); + }); + $('.js-parent-remove').on('click', function () { + $(this).parent().remove(); + }); + $('.js-menu-toggle').on('click', function () { + window.scrollTo(0, 0); + $('#body').toggleClass('menu-is-actived'); + }); + $('.js-cookies-close').on('click', function () { + $('#body').removeClass('cookies-is-actived'); + }); + $('.js-works-edit').on('click', function () { + $(this).parent().parent().parent().addClass('active'); + }); + $('.js-works-remove').on('click', function () { + $(this).parent().parent().parent().parent().remove(); + }); + + $('[data-tab]').on('click', function () { + $('[data-tab]').removeClass('active'); + $('[data-body]').removeClass('showed'); + $(this).addClass('active'); + var id = $(this).data('tab'); + $('[data-body=' + id + ']').addClass('showed'); + }); + + $('.js-password-show').on('click', function () { + $(this).parent().addClass('active'); + $(this).parent().parent().find('input').attr('type', 'text'); + }); + + $('.js-password-hide').on('click', function () { + $(this).parent().removeClass('active'); + $(this).parent().parent().find('input').attr('type', 'password'); + }); + + let checkScrollTop = function () { + if ($(document).scrollTop() == 0) { + $('#body').removeClass('begin'); + } else { + $('#body').addClass('begin'); + } + } + checkScrollTop(); + $(document).on('scroll', function () { + checkScrollTop(); + }); + + let closeAll = function () { + $('.js-toggle').removeClass('active'); + $('.js-parent-toggle').parent().removeClass('active'); + $('#body').removeClass('menu-is-actived'); + $('#body').removeClass('cookies-is-actived'); + } + + $(document).keyup(function (e) { + if (e.key === "Escape") { + closeAll(); + } + }); + + $('.js-scroll-to').bind('click', function (e) { + let anchor = $(this); + $('html,body').stop().animate({ + scrollTop: $(anchor.attr('href')).offset().top + }, 300); + e.preventDefault(); + }); + + if ($('[type=tel]').is('[type=tel]')) { + $('[type=tel]').mask('+7 (999) 999-99-99'); + } + + if ($('.js-select2').is('.js-select2')) { + $('.js-select2').select2(); + } + + const starRating = document.querySelectorAll(".js-stars"); + if (starRating.length) { + starRating.forEach(item => { + new StarRating(item); + }); + } + + const checkboxes = document.querySelectorAll(".checkbox"); + if (checkboxes.length) { + checkboxes.forEach(checkbox => { + const input = checkbox.querySelector("input"); + checkbox.addEventListener("input", () => { + if (input.checked) { + input.setAttribute("checked", ""); + } else { + input.removeAttribute("checked"); + } + }); + }); + } + +}; + +let swipers = function () { + + if ($('.js-employer-swiper').is('.js-employer-swiper')) { + let slider = new Swiper('.js-employer-swiper', { + autoplay: { + delay: 5000, + }, + pagination: { + el: '.swiper-pagination', + clickable: true + }, + breakpoints: { + 768: { + slidesPerView: 2, + }, + 992: { + slidesPerView: 3, + }, + 1280: { + slidesPerView: 4, + }, + } + }); + } + + if ($('.js-news-swiper').is('.js-news-swiper')) { + let slider = new Swiper('.js-news-swiper', { + spaceBetween: 20, + pagination: { + el: '.swiper-pagination', + clickable: true + }, + navigation: { + prevEl: '.js-news-swiper-button-prev', + nextEl: '.js-news-swiper-button-next', + }, + breakpoints: { + 768: { + slidesPerView: 2, + }, + 992: { + slidesPerView: 3, + }, + } + }); + } + +}; + +document.addEventListener("DOMContentLoaded", () => { + scripts(); + swipers(); +}); + +$(window).resize(function () { + swipers(); +}); diff --git a/public/js/script.js b/public/js/script.js deleted file mode 100644 index 741575c..0000000 --- a/public/js/script.js +++ /dev/null @@ -1,173 +0,0 @@ -let scripts = function () { - - $('.js-toggle').on('click', function () { - $(this).toggleClass('active'); - }); - $('.js-parent-toggle').on('click', function () { - $(this).parent().toggleClass('active'); - }); - $('.js-parent-remove').on('click', function () { - $(this).parent().remove(); - }); - $('.js-menu-toggle').on('click', function () { - window.scrollTo(0, 0); - $('#body').toggleClass('menu-is-actived'); - }); - $('.js-cookies-close').on('click', function () { - $('#body').removeClass('cookies-is-actived'); - }); - $('.js-works-edit').on('click', function () { - $(this).parent().parent().parent().addClass('active'); - }); - $('.js-works-remove').on('click', function () { - $(this).parent().parent().parent().parent().remove(); - }); - - $('[data-tab]').on('click', function () { - $('[data-tab]').removeClass('active'); - $('[data-body]').removeClass('showed'); - $(this).addClass('active'); - var id = $(this).data('tab'); - $('[data-body=' + id + ']').addClass('showed'); - }); - - $('.js-password-show').on('click', function () { - $(this).parent().addClass('active'); - $(this).parent().parent().find('input').attr('type', 'text'); - }); - - $('.js-password-hide').on('click', function () { - $(this).parent().removeClass('active'); - $(this).parent().parent().find('input').attr('type', 'password'); - }); - - let checkScrollTop = function () { - if ($(document).scrollTop() == 0) { - $('#body').removeClass('begin'); - } else { - $('#body').addClass('begin'); - } - } - checkScrollTop(); - $(document).on('scroll', function () { - checkScrollTop(); - }); - - let closeAll = function () { - $('.js-toggle').removeClass('active'); - $('.js-parent-toggle').parent().removeClass('active'); - $('#body').removeClass('menu-is-actived'); - $('#body').removeClass('cookies-is-actived'); - } - - $(document).keyup(function (e) { - if (e.key === "Escape") { - closeAll(); - } - }); - - $('.js-scroll-to').bind('click', function (e) { - let anchor = $(this); - $('html,body').stop().animate({ - scrollTop: $(anchor.attr('href')).offset().top - }, 300); - e.preventDefault(); - }); - - if ($('[type=tel]').is('[type=tel]')) { - $('[type=tel]').mask('+7 (999) 999-99-99'); - } - - if ($('.js-select2').is('.js-select2')) { - $('.js-select2').select2(); - } - - const starRating = document.querySelectorAll(".js-stars"); - if (starRating.length) { - starRating.forEach(item => { - new StarRating(item); - }); - } - - // cookies - const cookieItems = document.querySelectorAll(".js-ck"); - if (cookieItems.length) { - cookieItems.forEach(item => { - const id = item.dataset.id; - const like = item.querySelector(".like"); - const checkLike = function () { - if (like.classList.contains("active")) { - Cookies.set('favor_vacan-'+id, id); - } else { - Cookies.remove(id); - } - } - like.addEventListener("click", () => { - checkLike(); - }); - if (Cookies.get('favor_vacan-'+id) == id) { - like.classList.add("active"); - } - }); - } - console.log(Cookies.get()); - -}; - -let swipers = function () { - - if ($('.js-employer-swiper').is('.js-employer-swiper')) { - let slider = new Swiper('.js-employer-swiper', { - autoplay: { - delay: 5000, - }, - pagination: { - el: '.swiper-pagination', - clickable: true - }, - breakpoints: { - 768: { - slidesPerView: 2, - }, - 992: { - slidesPerView: 3, - }, - 1280: { - slidesPerView: 4, - }, - } - }); - } - - if ($('.js-news-swiper').is('.js-news-swiper')) { - let slider = new Swiper('.js-news-swiper', { - spaceBetween: 20, - pagination: { - el: '.swiper-pagination', - clickable: true - }, - navigation: { - prevEl: '.js-news-swiper-button-prev', - nextEl: '.js-news-swiper-button-next', - }, - breakpoints: { - 768: { - slidesPerView: 2, - }, - 992: { - slidesPerView: 3, - }, - } - }); - } - -}; - -document.addEventListener("DOMContentLoaded", () => { - scripts(); - swipers(); -}); - -$(window).resize(function () { - swipers(); -}); diff --git a/public/js/script0.js b/public/js/script0.js new file mode 100644 index 0000000..741575c --- /dev/null +++ b/public/js/script0.js @@ -0,0 +1,173 @@ +let scripts = function () { + + $('.js-toggle').on('click', function () { + $(this).toggleClass('active'); + }); + $('.js-parent-toggle').on('click', function () { + $(this).parent().toggleClass('active'); + }); + $('.js-parent-remove').on('click', function () { + $(this).parent().remove(); + }); + $('.js-menu-toggle').on('click', function () { + window.scrollTo(0, 0); + $('#body').toggleClass('menu-is-actived'); + }); + $('.js-cookies-close').on('click', function () { + $('#body').removeClass('cookies-is-actived'); + }); + $('.js-works-edit').on('click', function () { + $(this).parent().parent().parent().addClass('active'); + }); + $('.js-works-remove').on('click', function () { + $(this).parent().parent().parent().parent().remove(); + }); + + $('[data-tab]').on('click', function () { + $('[data-tab]').removeClass('active'); + $('[data-body]').removeClass('showed'); + $(this).addClass('active'); + var id = $(this).data('tab'); + $('[data-body=' + id + ']').addClass('showed'); + }); + + $('.js-password-show').on('click', function () { + $(this).parent().addClass('active'); + $(this).parent().parent().find('input').attr('type', 'text'); + }); + + $('.js-password-hide').on('click', function () { + $(this).parent().removeClass('active'); + $(this).parent().parent().find('input').attr('type', 'password'); + }); + + let checkScrollTop = function () { + if ($(document).scrollTop() == 0) { + $('#body').removeClass('begin'); + } else { + $('#body').addClass('begin'); + } + } + checkScrollTop(); + $(document).on('scroll', function () { + checkScrollTop(); + }); + + let closeAll = function () { + $('.js-toggle').removeClass('active'); + $('.js-parent-toggle').parent().removeClass('active'); + $('#body').removeClass('menu-is-actived'); + $('#body').removeClass('cookies-is-actived'); + } + + $(document).keyup(function (e) { + if (e.key === "Escape") { + closeAll(); + } + }); + + $('.js-scroll-to').bind('click', function (e) { + let anchor = $(this); + $('html,body').stop().animate({ + scrollTop: $(anchor.attr('href')).offset().top + }, 300); + e.preventDefault(); + }); + + if ($('[type=tel]').is('[type=tel]')) { + $('[type=tel]').mask('+7 (999) 999-99-99'); + } + + if ($('.js-select2').is('.js-select2')) { + $('.js-select2').select2(); + } + + const starRating = document.querySelectorAll(".js-stars"); + if (starRating.length) { + starRating.forEach(item => { + new StarRating(item); + }); + } + + // cookies + const cookieItems = document.querySelectorAll(".js-ck"); + if (cookieItems.length) { + cookieItems.forEach(item => { + const id = item.dataset.id; + const like = item.querySelector(".like"); + const checkLike = function () { + if (like.classList.contains("active")) { + Cookies.set('favor_vacan-'+id, id); + } else { + Cookies.remove(id); + } + } + like.addEventListener("click", () => { + checkLike(); + }); + if (Cookies.get('favor_vacan-'+id) == id) { + like.classList.add("active"); + } + }); + } + console.log(Cookies.get()); + +}; + +let swipers = function () { + + if ($('.js-employer-swiper').is('.js-employer-swiper')) { + let slider = new Swiper('.js-employer-swiper', { + autoplay: { + delay: 5000, + }, + pagination: { + el: '.swiper-pagination', + clickable: true + }, + breakpoints: { + 768: { + slidesPerView: 2, + }, + 992: { + slidesPerView: 3, + }, + 1280: { + slidesPerView: 4, + }, + } + }); + } + + if ($('.js-news-swiper').is('.js-news-swiper')) { + let slider = new Swiper('.js-news-swiper', { + spaceBetween: 20, + pagination: { + el: '.swiper-pagination', + clickable: true + }, + navigation: { + prevEl: '.js-news-swiper-button-prev', + nextEl: '.js-news-swiper-button-next', + }, + breakpoints: { + 768: { + slidesPerView: 2, + }, + 992: { + slidesPerView: 3, + }, + } + }); + } + +}; + +document.addEventListener("DOMContentLoaded", () => { + scripts(); + swipers(); +}); + +$(window).resize(function () { + swipers(); +}); diff --git a/resources/views/admin/job_titles/form.blade.php b/resources/views/admin/job_titles/form.blade.php index 3ca5bd1..04bf71e 100644 --- a/resources/views/admin/job_titles/form.blade.php +++ b/resources/views/admin/job_titles/form.blade.php @@ -26,6 +26,21 @@

+ +