From d7c3522a7f20932e534231cc6e79ab06b4f9c50d 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 13:27:37 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D0=BC=D0=BC=D0=B8=D1=82=20=D0=B8=D0=B7?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D1=82=D1=80=D1?= =?UTF-8?q?=83=D0=BA=D1=82=D1=83=D1=80=D1=8B=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA?= =?UTF-8?q?=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Ad_jobsController.php | 98 ++++++++ app/Http/Controllers/EmployerController.php | 39 +--- app/Http/Controllers/MainController.php | 2 + resources/views/employers/add_ad_jobs.blade.php | 241 +++++++++++++++++++ resources/views/employers/add_vacancy.blade.php | 166 ++------------ resources/views/employers/edit_ad_jobs.blade.php | 216 +++++++++++++++++ resources/views/employers/edit_vacancy.blade.php | 268 ++++++---------------- resources/views/employers/list_vacancy.blade.php | 23 +- routes/web.php | 14 +- 9 files changed, 681 insertions(+), 386 deletions(-) create mode 100644 app/Http/Controllers/Ad_jobsController.php create mode 100644 resources/views/employers/add_ad_jobs.blade.php create mode 100644 resources/views/employers/edit_ad_jobs.blade.php diff --git a/app/Http/Controllers/Ad_jobsController.php b/app/Http/Controllers/Ad_jobsController.php new file mode 100644 index 0000000..fed9286 --- /dev/null +++ b/app/Http/Controllers/Ad_jobsController.php @@ -0,0 +1,98 @@ +user()->id; + + $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.add_ad_jobs', compact('ad_employer', + 'Positions', 'categories', 'jobs', + 'Employer')); + } + + public function add_job_in_vac_save(Request $request) { + $params = $request->all(); + + Ad_jobs::create($params); + return redirect()->route('employer.vacancy_list'); + } + + public function edit_job_in_vac(Ad_jobs $ad_job, Ad_employer $ad_employer) { + $id = Auth()->user()->id; + + $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_ad_jobs', compact('ad_job', + 'Positions', 'categories', + 'Employer','jobs', 'ad_employer')); + } + + public function edit_job_in_vac_save(Request $request, Ad_jobs $ad_job) { + $params = $request->all(); + + $ad_job->update($params); + + return redirect()->route('employer.vacancy_list'); + } + + public function delete_job_in_vac(Ad_jobs $ad_job) { + $ad_job->delete(); + return redirect()->route('employer.vacancy_list'); + } +} diff --git a/app/Http/Controllers/EmployerController.php b/app/Http/Controllers/EmployerController.php index c47c37f..2051a83 100644 --- a/app/Http/Controllers/EmployerController.php +++ b/app/Http/Controllers/EmployerController.php @@ -134,28 +134,8 @@ class EmployerController extends Controller // Сохранение вакансии public function cabinet_vacancy_save1(VacancyRequestEdit $request) { $params = $request->all(); - $jobs['min_salary'] = $params['min_salary']; - $jobs['max_salary'] = $params['max_salary']; - $jobs['flot'] = $params['flot']; - $jobs['power'] = $params['power']; - $jobs['sytki'] = $params['sytki']; - $jobs['start'] = $params['start']; - $jobs['job_title_id'] = $params['job_title_id']; - $jobs['description'] = $params['description']; - $jobs['region'] = $params['city']; - //$titles['position_id'] = $params['position_id']; - unset($params['min_salary']); - unset($params['max_salary']); - unset($params['flot']); - unset($params['sytki']); - unset($params['start']); - unset($params['job_title_id']); - unset($params['description']); - - $id = Ad_employer::create($params)->id; - $jobs['ad_employer_id'] = $id; - $ad_jobs = Ad_jobs::create($jobs); + $ad_jobs = Ad_employer::create($params); return redirect()->route('employer.vacancy_list'); } @@ -163,7 +143,8 @@ class EmployerController extends Controller public function vacancy_list(Request $request) { $id = Auth()->user()->id; $Employer = Employer::query()->where('user_id', $id)->first(); - $vacancy_list = Ad_employer::query()->where('employer_id', $Employer->id); + $vacancy_list = Ad_employer::query()->with('jobs')->with('jobs_code')->where('employer_id', $Employer->id); + if ($request->get('sort')) { $sort = $request->get('sort'); @@ -178,7 +159,6 @@ class EmployerController extends Controller } $vacancy_list = $vacancy_list->paginate(4); - //ajax if ($request->ajax()) { return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); @@ -197,7 +177,6 @@ class EmployerController extends Controller } 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(); @@ -210,16 +189,16 @@ class EmployerController extends Controller $params = $request->all(); //$jobs['flot'] = $params['flot']; - $jobs['job_title_id'] = $params['job_title_id']; + //$jobs['job_title_id'] = $params['job_title_id']; //$titles['position_id'] = $params['position_id']; - unset($params['job_title_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); + //$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'); } diff --git a/app/Http/Controllers/MainController.php b/app/Http/Controllers/MainController.php index 544c930..6af4ddd 100644 --- a/app/Http/Controllers/MainController.php +++ b/app/Http/Controllers/MainController.php @@ -74,6 +74,8 @@ class MainController extends Controller groupby('job_title_id')-> get(); } + dd($BigFlot); + $employers = employers_main::query()->with('employer')->orderBy('id')->limit(8)->get(); $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get(); diff --git a/resources/views/employers/add_ad_jobs.blade.php b/resources/views/employers/add_ad_jobs.blade.php new file mode 100644 index 0000000..7c280c0 --- /dev/null +++ b/resources/views/employers/add_ad_jobs.blade.php @@ -0,0 +1,241 @@ +@extends('layout.frontend', ['title' => 'Добавление вакансии РекаМоре']) + +@section('scripts') + +@endsection +@section('content') +
+
+ +
+
+
+ + @include('employers.emblema') + +
+ + @include('employers.menu', ['item' => 2]) + +
+ +
+ @csrf + +
+
+

Разместить должность в вакансии

+

Вакансия {{ $ad_employer->name }}

+
+
+ +
+ +
+
+ + @error('postion_id') + + {{ $message }} + + @enderror +
+
+
+ +
+ +
+
+ + @error('job_title_id') + + {{ $message }} + + @enderror +
+
+
+ +
+ +
+
+ + @error('category_id') + + {{ $message }} + + @enderror +
+
+
+ +
+ +
+ + @error('min_salary') + + {{ $message }} + + @enderror +
+
+ +
+ +
+ + @error('salary') + + {{ $message }} + + @enderror +
+
+ +
+ +
+ + @error('region') + + {{ $message }} + + @enderror +
+
+ +
+ +
+ + @error('power') + + {{ $message }} + + @enderror +
+
+ +
+ +
+ + @error('power') + + {{ $message }} + + @enderror +
+
+ +
+ +
+ + @error('power') + + {{ $message }} + + @enderror +
+
+ +
+ +
+
+ + @error('flot') + + {{ $message }} + + @enderror +
+
+
+ +
+ +
+ + @error('description') + + {{ $message }} + + @enderror +
+
+ + +
+
+
+
+ +@endsection diff --git a/resources/views/employers/add_vacancy.blade.php b/resources/views/employers/add_vacancy.blade.php index 03d74c3..ea96ce4 100644 --- a/resources/views/employers/add_vacancy.blade.php +++ b/resources/views/employers/add_vacancy.blade.php @@ -59,7 +59,9 @@

Все поля обязательны для заполнения *

+
+

Поля для вакансии

@@ -74,74 +76,6 @@
- -
-
- - @error('postion_id') - - {{ $message }} - - @enderror -
-
-
- -
- -
-
- - @error('job_title_id') - - {{ $message }} - - @enderror -
-
-
- -
- -
-
- - @error('category_id') - - {{ $message }} - - @enderror -
-
-
- -
@@ -166,7 +100,7 @@
- +
@error('salary') @@ -178,31 +112,7 @@
- -
- - @error('min_salary') - - {{ $message }} - - @enderror -
-
- -
- -
- - @error('salary') - - {{ $message }} - - @enderror -
-
- -
- +
@error('city') @@ -214,55 +124,23 @@
- -
- - @error('power') - - {{ $message }} - - @enderror -
-
- -
- -
- - @error('power') - - {{ $message }} - - @enderror -
-
- -
- -
- - @error('power') - - {{ $message }} - - @enderror -
-
- -
- +
- + @php $i = 1 @endphp + @if ($categories->count()) + @foreach($categories as $j) + @if ($i == 1) + @else + + @endif + @php $i++ @endphp @endforeach @endif - @error('flot') - + @error('category_id') + {{ $message }} @enderror @@ -281,18 +159,6 @@ @enderror
- -
- -
- - @error('description') - - {{ $message }} - - @enderror -
-
diff --git a/resources/views/employers/edit_ad_jobs.blade.php b/resources/views/employers/edit_ad_jobs.blade.php new file mode 100644 index 0000000..319e2ef --- /dev/null +++ b/resources/views/employers/edit_ad_jobs.blade.php @@ -0,0 +1,216 @@ +@extends('layout.frontend', ['title' => 'Добавление вакансии РекаМоре']) + +@section('scripts') + +@endsection +@section('content') +
+
+ +
+
+
+ + @include('employers.emblema') + +
+ + @include('employers.menu', ['item' => 2]) + +
+ +
+ @csrf + +
+
+

Редактировать должность в вакансии

+

Вакансия {{ $ad_employer->name }}

+
+
+ +
+ +
+
+ + @error('postion_id') + + {{ $message }} + + @enderror +
+
+
+ +
+ +
+
+ + @error('job_title_id') + + {{ $message }} + + @enderror +
+
+
+ +
+ +
+ + @error('min_salary') + + {{ $message }} + + @enderror +
+
+ +
+ +
+ + @error('salary') + + {{ $message }} + + @enderror +
+
+ +
+ +
+ + @error('region') + + {{ $message }} + + @enderror +
+
+ +
+ +
+ + @error('power') + + {{ $message }} + + @enderror +
+
+ +
+ +
+ + @error('power') + + {{ $message }} + + @enderror +
+
+ +
+ +
+ + @error('power') + + {{ $message }} + + @enderror +
+
+ +
+ +
+
+ + @error('flot') + + {{ $message }} + + @enderror +
+
+
+ +
+ +
+ + @error('description') + + {{ $message }} + + @enderror +
+
+ + +
+
+
+
+
+@endsection diff --git a/resources/views/employers/edit_vacancy.blade.php b/resources/views/employers/edit_vacancy.blade.php index 04a14bd..1c431e3 100644 --- a/resources/views/employers/edit_vacancy.blade.php +++ b/resources/views/employers/edit_vacancy.blade.php @@ -49,7 +49,7 @@
-
+ @csrf
@@ -60,237 +60,107 @@
-
-
- -
- - @error('name') - +

Поля для вакансии

+
+
+ +
+ + @error('name') + {{ $message }} - @enderror -
-
- -
- -
-
- - @error('postion_id') - - {{ $message }} - @enderror
-
-
- -
-
- - @error('job_title_id') - - {{ $message }} - - @enderror -
-
-
- -
- -
-
- - @error('category_id') +
+ +
+ + @error('telephone') - {{ $message }} - - @enderror -
-
-
- -
- -
- - @error('telephone') - - {{ $message }} - - @enderror -
-
- -
- -
- - @error('email') - {{ $message }} - @enderror -
-
- - - -
- -
-
- - @error('flot') - +
+ +
+
+ + @error('category_id') + {{ $message }} - @enderror + @enderror +
-
-
- -
- - @error('text') - + +
+ +
+ + @error('text') + {{ $message }} - @enderror + @enderror +
- -
Назад
diff --git a/resources/views/employers/list_vacancy.blade.php b/resources/views/employers/list_vacancy.blade.php index 9b08792..0cc6a74 100644 --- a/resources/views/employers/list_vacancy.blade.php +++ b/resources/views/employers/list_vacancy.blade.php @@ -79,17 +79,15 @@
@if ($vacancy_list->count()) -
+ + @@ -97,8 +95,23 @@ @foreach($vacancy_list as $it) + - + +
Название Дата добавления
/ обновления
Должности Статус Действия
{{ $it->id }} {{ $it->name }}{{ date('d.m.Y H:i:s', strtotime($it->created_at)) }} / {{ date('d.m.Y H:i:s', strtotime($it->updated_at)) }}{{ 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()) + + @foreach ($it->jobs as $key => $it_um) +

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

+ @endforeach + @else + Нет связанных
с вакансией должностей + @endif +
@if ($it->active_is) Опубликовано diff --git a/routes/web.php b/routes/web.php index adfcb2b..3112e51 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,5 +1,6 @@ name('cabinet_vacancie'); - Route::post('cabinet/vacancie', [EmployerController::class, 'cabinet_vacancy_save'])->name('vacancy_save'); Route::post('vacancie', [EmployerController::class, 'cabinet_vacancy_save1'])->name('vac_save'); + + Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); @@ -547,7 +550,14 @@ Route::group([ Route::get('cabinet/vacancy-up/{ad_employer}', [EmployerController::class, 'vacancy_up'])->name('vacancy_up'); Route::get('cabinet/vacancy-eye/{ad_employer}/{status}', [EmployerController::class, 'vacancy_eye'])->name('vacancy_eye'); Route::get('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); - Route::post('cabinet/vacancy-edit/{ad_employer}/', [EmployerController::class, 'vacancy_save_me'])->name('vacancy_save_me'); + Route::post('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_save_me'])->name('vacancy_save_me'); + + // 4.1Ю. + Route::get('cabinet/ad_jobs/create/{ad_employer}', [Ad_jobsController::class, 'add_job_in_vac'])->name('add_job_in_vac'); + Route::post('cabinet/ad_jobs/create', [Ad_jobsController::class, 'add_job_in_vac_save'])->name('add_job_in_vac_save'); + Route::get('cabinet/ad_jobs/edit/{ad_job}/{ad_employer}', [Ad_jobsController::class, 'edit_job_in_vac'])->name('edit_job_in_vac'); + Route::post('cabinet/ad_jobs/edit/{ad_job}', [Ad_jobsController::class, 'edit_job_in_vac_save'])->name('edit_job_in_vac_save'); + Route::get('cabinet/ad_jobs/delete/{ad_job}', [Ad_jobsController::class, 'delete_job_in_vac'])->name('delete_job_in_vac'); // 4 страница - Отклики на вакансии Route::get('cabinet/answers/{employer}', [EmployerController::class, 'answers'])->name('answers'); -- 1.7.10.4