From 8f150320c53f8642643f7e9c6dc47a611fab5239 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: Thu, 28 Mar 2024 19:21:43 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20=D1=80=D0=B5?= =?UTF-8?q?=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Ad_jobsController.php | 21 ++++++++------- app/Http/Controllers/Admin/JobTitlesController.php | 9 ++++--- app/Models/Ad_jobs.php | 7 ++++- resources/views/admin/job_titles/form.blade.php | 8 +++--- resources/views/employers/add_ad_jobs.blade.php | 27 +------------------- resources/views/employers/edit_ad_jobs.blade.php | 19 ++++++-------- resources/views/employers/list_vacancy.blade.php | 10 ++++---- resources/views/layout/admin.blade.php | 12 ++++----- 8 files changed, 47 insertions(+), 66 deletions(-) diff --git a/app/Http/Controllers/Ad_jobsController.php b/app/Http/Controllers/Ad_jobsController.php index fed9286..b912c26 100644 --- a/app/Http/Controllers/Ad_jobsController.php +++ b/app/Http/Controllers/Ad_jobsController.php @@ -43,7 +43,7 @@ class Ad_jobsController extends Controller public function add_job_in_vac(Request $request, Ad_employer $ad_employer) { $id = Auth()->user()->id; - $Positions = Positions::query()->get(); + $Positions = Category::query()->get(); if ($Positions->count()) { $jobs = Job_title::query()->OrderBy('name')->where('position_id', $Positions[0]->id)->get(); } else { @@ -65,22 +65,25 @@ class Ad_jobsController extends Controller return redirect()->route('employer.vacancy_list'); } - public function edit_job_in_vac(Ad_jobs $ad_job, Ad_employer $ad_employer) { + public function edit_job_in_vac(Ad_jobs $ad_job, Ad_employer $ad_employer, Request $request) { $id = Auth()->user()->id; + if ($request->has('job_title_id')) + $job_title_id= $request->get('job_title_id'); + else + $job_title_id = ''; - $Positions = Positions::query()->get(); + $Positions = Category::query()->get(); if ($Positions->count()) { - $jobs = Job_title::query()->OrderBy('name')->where('position_id', $Positions[0]->id)->get(); + $jobs123 = Job_title::query()->OrderBy('name')->where('position_id', $ad_job->job_title->position_id )->get(); } else { - $jobs = Job_title::query()->OrderBy('name')->where('position_id', 0)->get(); + $jobs123 = 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_ad_jobs', compact('ad_job', - 'Positions', 'categories', - 'Employer','jobs', 'ad_employer')); + 'Positions', + 'Employer','jobs123', 'ad_employer', 'job_title_id')); } public function edit_job_in_vac_save(Request $request, Ad_jobs $ad_job) { diff --git a/app/Http/Controllers/Admin/JobTitlesController.php b/app/Http/Controllers/Admin/JobTitlesController.php index d258ee7..d2aa91c 100644 --- a/app/Http/Controllers/Admin/JobTitlesController.php +++ b/app/Http/Controllers/Admin/JobTitlesController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use App\Http\Requests\JobTitlesRequest; +use App\Models\Category; use App\Models\Job_title; use App\Models\Positions; use Illuminate\Http\Request; @@ -33,9 +34,9 @@ class JobTitlesController extends Controller orderBy('name')-> active()-> get();*/ - $position = Positions::query()->get(); + $category = Category::query()->get(); - return view('admin.job_titles.add', compact('position')); + return view('admin.job_titles.add', compact('category')); } /** @@ -69,8 +70,8 @@ class JobTitlesController extends Controller */ public function edit(Job_title $job_title) { - $position = Positions::query()->get(); - return view('admin.job_titles.edit', compact('job_title', 'position')); + $category = Category::query()->get(); + return view('admin.job_titles.edit', compact('job_title', 'category')); } /** diff --git a/app/Models/Ad_jobs.php b/app/Models/Ad_jobs.php index d8c6ec0..1bb3a9f 100644 --- a/app/Models/Ad_jobs.php +++ b/app/Models/Ad_jobs.php @@ -22,7 +22,8 @@ class Ad_jobs extends Model 'sytki', 'start', 'description', - 'position_ship' + 'position_ship', + 'power' ]; public function job_title() { @@ -32,4 +33,8 @@ class Ad_jobs extends Model public function positions() { return $this->belongsToMany(Positions::class, 'job_titles'); } + + public function categoria() { + return $this->belongsToMany(Category::class, 'job_titles', 'id', 'position_id'); + } } diff --git a/resources/views/admin/job_titles/form.blade.php b/resources/views/admin/job_titles/form.blade.php index 04bf71e..18c065e 100644 --- a/resources/views/admin/job_titles/form.blade.php +++ b/resources/views/admin/job_titles/form.blade.php @@ -26,16 +26,16 @@

diff --git a/resources/views/employers/add_ad_jobs.blade.php b/resources/views/employers/add_ad_jobs.blade.php index 7c280c0..445e242 100644 --- a/resources/views/employers/add_ad_jobs.blade.php +++ b/resources/views/employers/add_ad_jobs.blade.php @@ -60,7 +60,7 @@
- +
- @php $i = 1 @endphp - @if ($categories->count()) - @foreach($categories as $j) - @if ($i == 1) - @else - - @endif - @php $i++ @endphp - @endforeach - @endif - - @error('category_id') - - {{ $message }} - - @enderror -
-
-
- -
diff --git a/resources/views/employers/edit_ad_jobs.blade.php b/resources/views/employers/edit_ad_jobs.blade.php index 319e2ef..fb54768 100644 --- a/resources/views/employers/edit_ad_jobs.blade.php +++ b/resources/views/employers/edit_ad_jobs.blade.php @@ -60,12 +60,12 @@
- +
@error('postion_id') @@ -82,16 +82,13 @@
@error('job_title_id') diff --git a/resources/views/employers/list_vacancy.blade.php b/resources/views/employers/list_vacancy.blade.php index 0cc6a74..3aba2d5 100644 --- a/resources/views/employers/list_vacancy.blade.php +++ b/resources/views/employers/list_vacancy.blade.php @@ -99,13 +99,13 @@ {{ $it->name }} {{ date('d.m.Y H:i:s', strtotime($it->created_at)) }}
/ {{ date('d.m.Y H:i:s', strtotime($it->updated_at)) }} Добавить - @if ($it->jobs->count()) + @if ($it->jobs->count()) @foreach ($it->jobs as $key => $it_um) -

{{$it_um->name}} - @if (isset($it->jobs_code[$key])) - (Del) - @endif +

@if (isset($it->jobs_code[$key])) + {{$it_um->name}} + (Del) + @endif

@endforeach @else diff --git a/resources/views/layout/admin.blade.php b/resources/views/layout/admin.blade.php index ea3ed8e..c9f2c1f 100644 --- a/resources/views/layout/admin.blade.php +++ b/resources/views/layout/admin.blade.php @@ -571,9 +571,9 @@ @endif @endif @endforeach -
  • - Позиция -
  • + @@ -1234,9 +1234,9 @@ @if ($cont->url_page == "admin/position") @if ((($cont->is_admin == 1) && ($admin == 1)) || (($cont->is_manager == 1) && ($is_manager == 1))) -
  • - Позиция -
  • + @endif @endif -- 1.7.10.4