From ad2cc280b71d90130ea0c2f886b138fedab27285 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: Fri, 22 Mar 2024 22:31:36 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D1=84=D0=B8?= =?UTF-8?q?=D0=BD=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20=D0=BF=D0=BE=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Classes/Cookies_vacancy.php | 12 +- app/Classes/RusDate.php | 12 +- app/Http/Controllers/EmployerController.php | 10 +- app/Http/Controllers/MainController.php | 11 +- app/Http/Controllers/WorkerController.php | 6 +- resources/views/ajax/list_vacancies.blade.php | 176 ++++++++++++-------- resources/views/block_real.blade.php | 2 +- resources/views/js/favorite-vacancy-1.blade.php | 120 +++++++++++++ resources/views/js/favorite-vacancy.blade.php | 19 ++- resources/views/layout/frontend.blade.php | 5 +- resources/views/list_vacancies.blade.php | 9 +- resources/views/modals/send_employer.blade.php | 8 +- resources/views/modals/send_employer_new.blade.php | 16 -- resources/views/resume.blade.php | 1 + resources/views/vacance-item.blade.php | 34 +++- resources/views/workers/favorite.blade.php | 14 +- routes/web.php | 2 +- 17 files changed, 324 insertions(+), 133 deletions(-) create mode 100644 resources/views/js/favorite-vacancy-1.blade.php diff --git a/app/Classes/Cookies_vacancy.php b/app/Classes/Cookies_vacancy.php index 1cc4e24..d5194fb 100644 --- a/app/Classes/Cookies_vacancy.php +++ b/app/Classes/Cookies_vacancy.php @@ -9,10 +9,10 @@ use DateTime; class Cookies_vacancy { public static function selected_vacancy($item) { - if (empty($_COOKIE['favorite_vacancy'])) + if (empty($_COOKIE['favorit_vacancy'])) return ""; else { - $Str = json_decode($_COOKIE['favorite_vacancy'], true); + $Str = json_decode($_COOKIE['favorit_vacancy'], true); //$Arr = explode(",", $Str); if (in_array($item, $Str)) return " active "; @@ -23,11 +23,11 @@ class Cookies_vacancy // Вывод избранных вакансий public static function count_vacancy_fav() { - if (empty($_COOKIE['favorite_vacancy'])) + if (empty($_COOKIE['favorit_vacancy'])) return 0; else { - $Arr = json_decode($_COOKIE['favorite_vacancy'], true); + $Arr = json_decode($_COOKIE['favorit_vacancy'], true); return count($Arr); @@ -36,8 +36,8 @@ class Cookies_vacancy // Удаление избранных вакансий public static function clear_vacancy() { - if (!empty($_COOKIE['favorite_vacancy'])) - unset($_COOKIE['favorite_vacancy']); + if (!empty($_COOKIE['favorit_vacancy'])) + unset($_COOKIE['favorit_vacancy']); } } diff --git a/app/Classes/RusDate.php b/app/Classes/RusDate.php index 2090dfe..f787114 100644 --- a/app/Classes/RusDate.php +++ b/app/Classes/RusDate.php @@ -61,10 +61,10 @@ class RusDate } // Избранные вакансии public static function selected_vacancy($item) { - if (empty($_COOKIE['favorite_vac'])) + if (empty($_COOKIE['favorit_vacancy'])) return ""; else { - $Str = json_decode($_COOKIE['favorite_vac'], true); + $Str = json_decode($_COOKIE['favorit_vacancy'], true); //$Arr = explode(",", $Str); if (in_array($item, $Str)) return " active "; @@ -135,11 +135,11 @@ class RusDate // Вывод избранных вакансий public static function count_vacancy_fav() { - if (empty($_COOKIE['favorite_vac'])) + if (empty($_COOKIE['favorit_vacancy'])) return 0; else { - $Arr = json_decode($_COOKIE['favorite_vac'], true); + $Arr = json_decode($_COOKIE['favorit_vacancy'], true); return count($Arr); @@ -148,8 +148,8 @@ class RusDate // Удаление избранных вакансий public static function clear_vacancy() { - if (!empty($_COOKIE['favorite_vac'])) - unset($_COOKIE['favorite_vac']); + if (!empty($_COOKIE['favorit_vacancy'])) + unset($_COOKIE['favorit_vacancy']); } } diff --git a/app/Http/Controllers/EmployerController.php b/app/Http/Controllers/EmployerController.php index 97fcd92..d702c58 100644 --- a/app/Http/Controllers/EmployerController.php +++ b/app/Http/Controllers/EmployerController.php @@ -38,7 +38,6 @@ class EmployerController extends Controller { public function vacancie($vacancy, Request $request) { $title = 'Заголовок вакансии'; - $Query = Ad_employer::with('jobs')-> with('cat')-> with('employer')-> @@ -46,12 +45,15 @@ class EmployerController extends Controller select('ad_employers.*')-> where('id', '=', $vacancy)->get(); + if (isset(Auth()->user()->id)) + $uid = Auth()->user()->id; + else + $uid = 0; $title = $Query[0]->name; - if ($request->ajax()) { - return view('ajax.vacance-item', compact('Query')); + return view('ajax.vacance-item', compact('Query','uid')); } else { - return view('vacance-item', compact('title', 'Query')); + return view('vacance-item', compact('title', 'Query', 'uid')); } } diff --git a/app/Http/Controllers/MainController.php b/app/Http/Controllers/MainController.php index 8906a12..06285da 100644 --- a/app/Http/Controllers/MainController.php +++ b/app/Http/Controllers/MainController.php @@ -118,23 +118,26 @@ class MainController extends Controller with('cat')-> with('employer')-> whereHas('jobs_code', function ($query) use ($request) { - if ($request->ajax()) { if (null !== ($request->get('job')) && ($request->get('job') !== 0)) { $query->where('job_title_id', $request->get('job')); } - } }) ->select('ad_employers.*'); - - if ($categories->id > 0) { + if (isset($categories->id) && ($categories->id > 0)) { $Query = $Query->where('category_id', '=', $categories->id); $Name_categori = Category::query()->where('id', '=', $categories->id)->get(); + } else { + $Name_categori = ''; } + + if ($request->get('sort')) { $sort = $request->get('sort'); + + switch ($sort) { case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break; case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break; diff --git a/app/Http/Controllers/WorkerController.php b/app/Http/Controllers/WorkerController.php index b856109..c0bf1ba 100644 --- a/app/Http/Controllers/WorkerController.php +++ b/app/Http/Controllers/WorkerController.php @@ -497,15 +497,15 @@ class WorkerController extends Controller // Борьба против колорадских жуков, хотя жуков победил все таки 45. public function colorado(Request $request) { - if (isset($_COOKIE['favorite_vac'])) { + if (isset($_COOKIE['favorit_vacancy'])) { $items = RusDate::count_vacancy_fav(); - $it = $_COOKIE['favorite_vac']; + $it = $_COOKIE['favorit_vacancy']; $it = str_replace('"', "", $it); $it = str_replace('[', "", $it); $it = str_replace(']', "", $it); $Arr = explode(",", $it); } else { - $Arr = Array(); + $Arr = Array('$0'); } $Query = Ad_employer::Query(); diff --git a/resources/views/ajax/list_vacancies.blade.php b/resources/views/ajax/list_vacancies.blade.php index 6cbb7ce..ca92508 100644 --- a/resources/views/ajax/list_vacancies.blade.php +++ b/resources/views/ajax/list_vacancies.blade.php @@ -1,82 +1,118 @@ -@if ($Query->count()) +@php $i = ($Query->currentPage() * $Query->perPage() - $Query->count() - 1) @endphp + @foreach ($Query as $Q) -
- - - - - - Вернуться к списку вакансий - - -
- @if (isset($Q->employer)) - {{ $Q->employer->name }} + @foreach ($Reclama as $Rec) + @if ($Rec->position == $i) +
+ @if (!empty($Rec->image)) + {{ $Rec->title }} + @else + {{ $Rec->title }} + @endif +
+

{{ $Rec->title }}

+
+ {!! $Rec->text !!} +
+ Узнать больше +
+
@endif - @if (!empty($Q->name)) {{ $Q->name }} @endif -
-
-
Судоходная компания ведет набор - специалистов на следующие должности:
-