From f364ad5b7af17b54dcee6c27a56de8629dd2aabc 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, 8 May 2024 22:58:41 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D0=BC=D0=BC=D0=B8=D1=82=20=D0=BF=D0=BE?= =?UTF-8?q?=20=D0=B2=D0=B0=D0=BA=D0=B0=D0=BD=D1=81=D0=B8=D1=8F=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Ad_jobsController.php | 42 ++++++++++++++++---- app/Http/Controllers/Admin/JobTitlesController.php | 3 +- app/Http/Controllers/Admin/UsersController.php | 3 +- app/Http/Controllers/EmployerController.php | 13 +++++- app/Providers/MyServiceProvider.php | 12 +++++- resources/views/employers/add_ad_jobs.blade.php | 20 +++++----- resources/views/employers/edit_ad_jobs.blade.php | 4 +- resources/views/employers/list_vacancy.blade.php | 10 ++--- 8 files changed, 78 insertions(+), 29 deletions(-) diff --git a/app/Http/Controllers/Ad_jobsController.php b/app/Http/Controllers/Ad_jobsController.php index 73d3808..beb10cf 100644 --- a/app/Http/Controllers/Ad_jobsController.php +++ b/app/Http/Controllers/Ad_jobsController.php @@ -44,11 +44,25 @@ class Ad_jobsController extends Controller $id = Auth()->user()->id; $Positions = Category::query()->active()->get(); - if ($Positions->count()) { - $jobs = Job_title::query()->OrderBy('name')->Notbdif()->where('position_id', $Positions[0]->id)->get(); + /*if ($Positions->count()) { + $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> + where('is_remove', '=', '0')-> + where('is_bd', '=', '0')-> + where('position_id', $Positions[0]->id)-> + get(); } else { - $jobs = Job_title::query()->OrderBy('name')->Notbdif()->where('position_id', 0)->get(); + $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> + where('is_remove', '=', '0')-> + where('is_bd', '=', '0')-> + where('position_id', 0)-> + get(); } + */ + $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> + where('is_remove', '=', '0')-> + where('is_bd', '=', '0')-> + get(); + $categories = Category::query()->get(); $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> where('user_id', $id)->first(); @@ -73,11 +87,25 @@ class Ad_jobsController extends Controller $job_title_id = ''; $Positions = Category::query()->active()->get(); - if ($Positions->count()) { - $jobs123 = Job_title::query()->OrderBy('name')->where('position_id', $ad_job->job_title->position_id )->get(); + /*if ($Positions->count()) { + $jobs123 = Job_title::query()-> + orderByDesc('sort')->OrderBy('name')-> + where('is_remove', '=', '0')-> + where('is_bd', '=', '0')-> + where('position_id', $ad_job->job_title->position_id )->get(); } else { - $jobs123 = Job_title::query()->OrderBy('name')->where('position_id', 0)->get(); - } + $jobs123 = Job_title::query()-> + orderByDesc('sort')->OrderBy('name')-> + where('is_remove', '=', '0')-> + where('is_bd', '=', '0')-> + where('position_id', 0)->get(); + }*/ + + $jobs123 = Job_title::query()-> + orderByDesc('sort')->OrderBy('name')-> + where('is_remove', '=', '0')-> + where('is_bd', '=', '0')-> + get(); $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> where('user_id', $id)->first(); diff --git a/app/Http/Controllers/Admin/JobTitlesController.php b/app/Http/Controllers/Admin/JobTitlesController.php index a8cc714..232875e 100644 --- a/app/Http/Controllers/Admin/JobTitlesController.php +++ b/app/Http/Controllers/Admin/JobTitlesController.php @@ -18,7 +18,8 @@ class JobTitlesController extends Controller */ public function index() { - $Jobs = Job_title::query()->where('is_remove', '=', '0')->orderBy('name')->paginate(15); + $Jobs = Job_title::query()->where('is_remove', '=', '0')-> + orderByDesc('sort')->orderBy('name')->paginate(15); return view('admin.job_titles.index', compact('Jobs')); } diff --git a/app/Http/Controllers/Admin/UsersController.php b/app/Http/Controllers/Admin/UsersController.php index 86c319e..db24174 100644 --- a/app/Http/Controllers/Admin/UsersController.php +++ b/app/Http/Controllers/Admin/UsersController.php @@ -94,7 +94,8 @@ class UsersController extends Controller } public function edit_bd(User $user) { - $list_job_titles = Job_title::query()->active()->where('is_bd', '=' , '2')->orderBy('name', 'asc')->get(); + $list_job_titles = Job_title::query()->active()->where('is_bd', '=' , '2')-> + orderByDesc('sort')->orderBy('name', 'asc')->get(); return view('admin.users.edit', compact('user', 'list_job_titles')); } diff --git a/app/Http/Controllers/EmployerController.php b/app/Http/Controllers/EmployerController.php index 6f10384..8dec272 100644 --- a/app/Http/Controllers/EmployerController.php +++ b/app/Http/Controllers/EmployerController.php @@ -212,11 +212,18 @@ class EmployerController extends Controller // Список вакансий public function vacancy_list(Request $request) { $id = Auth()->user()->id; + + //dd($request->all()); $Employer = Employer::query()->where('user_id', $id)->first(); $vacancy_list = Ad_employer::query()->with('jobs')-> with('jobs_code')-> where('employer_id', $Employer->id); + if (($request->has('search')) && (!empty($request->get('search')))) { + $search = $request->get('search'); + $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); + } + if ($request->get('sort')) { $sort = $request->get('sort'); switch ($sort) { @@ -802,7 +809,11 @@ class EmployerController extends Controller // Избранные люди на корабль public function selected_people(Request $request) { $id = $request->get('id'); - $favorite_people = Job_title::query()->Notbdif()->where('is_remove', '=', '0')->where('position_id', $id)->get(); + $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> + where('is_remove', '=', '0')-> + where('is_bd', '=', '0')-> + where('position_id', $id)-> + get(); return view('favorite_people', compact('favorite_people')); } } diff --git a/app/Providers/MyServiceProvider.php b/app/Providers/MyServiceProvider.php index 8265cfa..bbfcab1 100644 --- a/app/Providers/MyServiceProvider.php +++ b/app/Providers/MyServiceProvider.php @@ -82,7 +82,11 @@ class MyServiceProvider extends ServiceProvider function($view){ $id = Auth::user(); $companies = Company::query()->limit(1)->get(); - $jobs = Job_title::query()->where('is_remove', '=', '0')->get(); + //$jobs = Job_title::query()->where('is_remove', '=', '0')->get(); + $jobs = Job_title::query()->where('is_remove', '=', '0')-> + where('is_bd', '=' , '0')-> + OrderByDesc('sort')->OrderBy('name')->get(); + $view->with(['UserId' => $id, 'companies' => $companies, 'jobs' => $jobs]); } ); @@ -112,8 +116,12 @@ class MyServiceProvider extends ServiceProvider $view_job_title = ['modals.register']; View::composer($view_job_title, function($view_job_title) { + //$Job_titles = Job_title::query()->where('is_remove', '=', '0')-> + // where('is_bd', '=' , '1')->get(); $Job_titles = Job_title::query()->where('is_remove', '=', '0')-> - where('is_bd', '=' , '1')->get(); + where('is_bd', '=' , '1')-> + OrderByDesc('sort')->OrderBy('name')->get(); + $view_job_title->with(['Job_titles' => $Job_titles]); } ); diff --git a/resources/views/employers/add_ad_jobs.blade.php b/resources/views/employers/add_ad_jobs.blade.php index 445e242..e238605 100644 --- a/resources/views/employers/add_ad_jobs.blade.php +++ b/resources/views/employers/add_ad_jobs.blade.php @@ -59,7 +59,7 @@ -
+