From f8a3cafe55ae6263c8aeb3479a7e7c940e306673 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: Tue, 16 Apr 2024 22:20:17 +0700 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=B8=D0=B0=D0=BB=D0=BE=D0=B3=D0=BE=D0=B2=D1?= =?UTF-8?q?=8B=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B1=D0=BB=D0=B5=D0=BC=D1=8B=20-=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=BC=D1=83=D0=BD=D0=B8=D0=BA=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/EmployerController.php | 27 +++---- app/Http/Controllers/MainController.php | 2 +- app/Http/Controllers/WorkerController.php | 2 +- app/Models/Message.php | 4 +- app/Providers/MyServiceProvider.php | 4 +- .../2024_04_16_141942_alter_table_messages.php | 34 +++++++++ resources/views/employers/edit_vacancy.blade.php | 4 +- resources/views/employers/messages.blade.php | 6 +- resources/views/list_vacancies.blade.php | 21 +++++- resources/views/modals/send_employer.blade.php | 8 +-- .../views/modals/send_message_noaut.blade.php | 2 +- .../views/modals/send_message_noaut2.blade.php | 2 +- resources/views/modals/send_worker.blade.php | 2 +- resources/views/modals/send_worker_new.blade.php | 75 ++++++++++++++++++-- resources/views/resume.blade.php | 27 +++++-- resources/views/vacance-item.blade.php | 22 +++++- resources/views/worker.blade.php | 2 +- resources/views/workers/messages.blade.php | 4 +- 18 files changed, 202 insertions(+), 46 deletions(-) create mode 100644 database/migrations/2024_04_16_141942_alter_table_messages.php diff --git a/app/Http/Controllers/EmployerController.php b/app/Http/Controllers/EmployerController.php index 782b8f3..6ea6e25 100644 --- a/app/Http/Controllers/EmployerController.php +++ b/app/Http/Controllers/EmployerController.php @@ -127,9 +127,9 @@ class EmployerController extends Controller $categories = Category::query()->active()->get(); $Positions = Category::query()->active()->get(); if ($Positions->count()) { - $jobs = Job_title::query()->OrderBy('name')->Notbdif()->where('position_id', $Positions[0]->id)->get(); + $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', $Positions[0]->id)->get(); } else { - $jobs = Job_title::query()->OrderBy('name')->Notbdif()->where('position_id', 0)->get(); + $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', 0)->get(); } $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> @@ -192,17 +192,17 @@ class EmployerController extends Controller public function vacancy_edit(Ad_employer $ad_employer) { $id = Auth()->user()->id; - $Positions = Category::query()->active()->get(); + $Positions = Category::query()->where('is_remove', '=', '0')->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_vacancy', compact('ad_employer', 'Positions', 'categories','Employer', 'jobs')); + return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); } // Сохранение-редактирование записи @@ -324,8 +324,8 @@ class EmployerController extends Controller $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); })->OrderBy('created_at')->get(); - $id_vac = null; - foreach ($Messages as $it) { + $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; + /*foreach ($Messages as $it) { if (isset($it->response)) { foreach ($it->response as $r) { if (isset($r->ad_employer_id)) { @@ -336,11 +336,11 @@ class EmployerController extends Controller } if (!is_null($id_vac)) break; } + */ $ad_employer = null; if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); $sender = $user1; - return view('employers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); } @@ -726,15 +726,16 @@ class EmployerController extends Controller if ($request->has('_file')) { $message->file = $request->file('_file')->store("worker/$id", 'public'); } + $message->ad_employer_id = $params['_vacancy']; $message->flag_new = 1; $id_message = $message->save(); - $data['message_id'] = $id_message; - $data['ad_employer_id'] = $params['_vacancy']; - $data['job_title_id'] = 0; + //$data['message_id'] = $id_message; + //$data['ad_employer_id'] = $params['_vacancy']; + //$data['job_title_id'] = 0; $data['flag'] = 1; - $ad_responce = ad_response::create($data); + //$ad_responce = ad_response::create($data); return redirect()->route('employer.messages', ['type_message' => 'output']); } @@ -746,7 +747,7 @@ class EmployerController extends Controller // Избранные люди на корабль public function selected_people(Request $request) { $id = $request->get('id'); - $favorite_people = Job_title::query()->Notbdif()->where('position_id', $id)->get(); + $favorite_people = Job_title::query()->Notbdif()->where('is_remove', '=', '0')->where('position_id', $id)->get(); return view('favorite_people', compact('favorite_people')); } } diff --git a/app/Http/Controllers/MainController.php b/app/Http/Controllers/MainController.php index f60a949..4ae9fb6 100644 --- a/app/Http/Controllers/MainController.php +++ b/app/Http/Controllers/MainController.php @@ -146,7 +146,7 @@ class MainController extends Controller public function vacancies(Request $request) { //должности - $Job_title = Job_title::query()->orderBy('name')->get(); + $Job_title = Job_title::query()->where('is_remove', '=', '0')->orderBy('name')->get(); $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') ->selectRaw('min(ad_employers.salary) as min_salary, max(ad_employers.salary) as max_salary') diff --git a/app/Http/Controllers/WorkerController.php b/app/Http/Controllers/WorkerController.php index f4fa85f..9d014f8 100644 --- a/app/Http/Controllers/WorkerController.php +++ b/app/Http/Controllers/WorkerController.php @@ -224,7 +224,7 @@ class WorkerController extends Controller function (Builder $query) use ($id) {$query->Where('id', $id); })->get(); - $Job_titles = Job_title::query()->OrderBy('name')->get(); + $Job_titles = Job_title::query()->where('is_remove', '=', '0')->OrderBy('name')->get(); $Infoblocks = infobloks::query()->OrderBy('name')->get(); $stat = Static_worker::query()->where('year_month', '=', $get_date) diff --git a/app/Models/Message.php b/app/Models/Message.php index a6012bd..295396b 100644 --- a/app/Models/Message.php +++ b/app/Models/Message.php @@ -14,7 +14,9 @@ class Message extends Model 'to_user_id', 'text', 'file', - 'flag_new' + 'flag_new', + 'ad_employer_id', + 'job_title_id' ]; diff --git a/app/Providers/MyServiceProvider.php b/app/Providers/MyServiceProvider.php index a8f1474..1752e35 100644 --- a/app/Providers/MyServiceProvider.php +++ b/app/Providers/MyServiceProvider.php @@ -82,7 +82,7 @@ class MyServiceProvider extends ServiceProvider function($view){ $id = Auth::user(); $companies = Company::query()->limit(1)->get(); - $jobs = Job_title::query()->get(); + $jobs = Job_title::query()->where('is_remove', '=', '0')->get(); $view->with(['UserId' => $id, 'companies' => $companies, 'jobs' => $jobs]); } ); @@ -112,7 +112,7 @@ class MyServiceProvider extends ServiceProvider $view_job_title = ['modals.register']; View::composer($view_job_title, function($view_job_title) { - $Job_titles = Job_title::query()->get(); + $Job_titles = Job_title::query()->where('is_remove', '=', '0')->get(); $view_job_title->with(['Job_titles' => $Job_titles]); } ); diff --git a/database/migrations/2024_04_16_141942_alter_table_messages.php b/database/migrations/2024_04_16_141942_alter_table_messages.php new file mode 100644 index 0000000..ffa8c1e --- /dev/null +++ b/database/migrations/2024_04_16_141942_alter_table_messages.php @@ -0,0 +1,34 @@ +bigInteger('ad_employer_id')->default(0); + $table->bigInteger('job_title_id')->default(0); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('messages', function (Blueprint $table) { + $table->dropColumn('ad_employer_id'); + $table->dropColumn('job_title_id'); + }); + } +}; diff --git a/resources/views/employers/edit_vacancy.blade.php b/resources/views/employers/edit_vacancy.blade.php index 1c431e3..9136f09 100644 --- a/resources/views/employers/edit_vacancy.blade.php +++ b/resources/views/employers/edit_vacancy.blade.php @@ -128,8 +128,8 @@