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 @@
{{$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 -