From 7571b20fd5c13ed6f79784db64504d6f9f64f2de 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, 13 Mar 2024 20:27:11 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D0=BC=D0=BC=D0=B8=D1=82=2013=20=D0=BC?= =?UTF-8?q?=D0=B0=D1=80=D1=82=D0=B0=202024?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Admin/Ad_EmployersController.php | 12 +- app/Http/Controllers/EmployerController.php | 22 +- app/Http/Controllers/MainController.php | 23 +- app/Http/Controllers/WorkerController.php | 72 ++++- app/Http/Requests/VacancyRequestEdit.php | 116 +++++++ app/Http/Requests/VacansiaRequiest.php | 25 +- resources/views/admin/ad_employers/add.blade.php | 18 +- resources/views/admin/ad_employers/edit.blade.php | 16 + resources/views/admin/reclames/index.blade.php | 7 +- resources/views/ajax/list_category.blade.php | 1 + resources/views/employers/add_vacancy.blade.php | 30 +- resources/views/employers/edit_vacancy.blade.php | 55 +++- resources/views/employers/list_vacancy.blade.php | 4 +- resources/views/employers/menu.blade.php | 2 +- resources/views/index.blade.php | 6 +- resources/views/info_company_new.blade.php | 8 +- resources/views/layout/frontend.blade.php | 12 +- resources/views/layout/pdf.blade.php | 339 ++++++++++++++------ resources/views/list_vacancies.blade.php | 64 +++- resources/views/modals/send_admin.blade.php | 2 +- resources/views/modals/send_employer_new.blade.php | 17 + resources/views/modals/send_login.blade.php | 2 +- .../views/modals/send_message_noaut.blade.php | 2 +- .../views/modals/send_message_noaut2.blade.php | 10 + resources/views/modals/send_worker_new.blade.php | 26 ++ resources/views/vacancies.blade.php | 3 +- resources/views/worker.blade.php | 7 - resources/views/workers/cabinet.blade.php | 10 +- routes/web.php | 1 + 29 files changed, 737 insertions(+), 175 deletions(-) create mode 100644 app/Http/Requests/VacancyRequestEdit.php create mode 100644 resources/views/ajax/list_category.blade.php create mode 100644 resources/views/modals/send_employer_new.blade.php create mode 100644 resources/views/modals/send_message_noaut2.blade.php create mode 100644 resources/views/modals/send_worker_new.blade.php diff --git a/app/Http/Controllers/Admin/Ad_EmployersController.php b/app/Http/Controllers/Admin/Ad_EmployersController.php index 6c6d2e9..38d968f 100644 --- a/app/Http/Controllers/Admin/Ad_EmployersController.php +++ b/app/Http/Controllers/Admin/Ad_EmployersController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use App\Models\Ad_employer; use App\Models\Ad_jobs; +use App\Models\Category; use App\Models\Employer; use App\Models\Job_title; use App\Models\User; @@ -77,14 +78,11 @@ class Ad_EmployersController extends Controller } } - /** - * Show the form for creating a new resource - * @return \Illuminate\Http\Response - */ public function create() { $job_titles = Job_title::query()->active()->get(); - return view('admin.ad_employers.add', compact('job_titles')); + $categories = Category::query()->get(); + return view('admin.ad_employers.add', compact('job_titles', 'categories')); } /** @@ -143,12 +141,12 @@ class Ad_EmployersController extends Controller { $sel = Array(); $job_titles = Job_title::active()->get(); - + $categories = Category::query()->get(); foreach ($ad_employer->jobs as $j) { $sel[] = $j->id; } - return view('admin.ad_employers.edit', compact('ad_employer', 'job_titles', 'sel')); + return view('admin.ad_employers.edit', compact('ad_employer', 'categories', 'job_titles', 'sel')); } /** diff --git a/app/Http/Controllers/EmployerController.php b/app/Http/Controllers/EmployerController.php index d8b0de4..41b3469 100644 --- a/app/Http/Controllers/EmployerController.php +++ b/app/Http/Controllers/EmployerController.php @@ -6,6 +6,7 @@ use App\Classes\RusDate; use App\Classes\Tools; use App\Http\Requests\FlotRequest; use App\Http\Requests\MessagesRequiest; +use App\Http\Requests\VacancyRequestEdit; use App\Http\Requests\VacansiaRequiest; use App\Mail\MailSotrudnichestvo; use App\Mail\SendAllMessages; @@ -108,17 +109,17 @@ class EmployerController extends Controller public function cabinet_vacancie() { $id = Auth()->user()->id; $jobs = Job_title::query()->OrderBy('name')->get(); - + $categories = Category::query()->get(); $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> WhereHas('users', function (Builder $query) use ($id) {$query->Where('id', $id); })->get(); - return view('employers.add_vacancy', compact('Employer', 'jobs')); + return view('employers.add_vacancy', compact('Employer', 'jobs' , 'categories')); } // Сохранение вакансии - public function cabinet_vacancy_save1(VacansiaRequiest $request) { + public function cabinet_vacancy_save1(VacancyRequestEdit $request) { $params = $request->all(); $jobs['min_salary'] = $params['min_salary']; $jobs['max_salary'] = $params['max_salary']; @@ -157,9 +158,20 @@ class EmployerController extends Controller public function vacancy_edit(Ad_employer $ad_employer) { $id = Auth()->user()->id; $jobs = Job_title::query()->OrderBy('name')->get(); - $Employer = Employer::query()->where('user_id', $id)->first(); + $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', 'categories','Employer', 'jobs')); + } - return view('employers.edit_vacancy', compact('ad_employer', 'Employer', 'jobs')); + // Сохранение-редактирование записи + public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { + $all = $request->all(); + + $ad_employer->update($all); + + return redirect()->route('employer.vacancy_list'); } // Сохранение карточки вакансии diff --git a/app/Http/Controllers/MainController.php b/app/Http/Controllers/MainController.php index ecbde34..8b2cd33 100644 --- a/app/Http/Controllers/MainController.php +++ b/app/Http/Controllers/MainController.php @@ -114,17 +114,24 @@ class MainController extends Controller $Query = $Query->OrderBy('updated_at')->paginate(3); - $Reclama = reclame::query()->limit(3)->get(); + $Reclama = reclame::query()->get(); if ($request->ajax()) { - return view('ajax.list_vacancies', compact('Query', - 'Query_count', - 'Name_categori', - 'Reclama', - 'categories', - 'uid')); + if ($request->has('title')) { + return view('ajax.list_category', compact( + 'Name_categori' + )); + } else { + return view('ajax.list_vacancies', compact('Query', + 'Query_count', + 'Name_categori', + 'Reclama', + 'categories', + 'Job_title', + 'uid')); + } } else { //Вернуть все return view('list_vacancies', compact('Query', @@ -179,7 +186,7 @@ class MainController extends Controller $rules = [ 'email' => 'required|string|email', - 'password' => 'required|string', + 'password' => 'required|string|min:3|max:25', ]; $messages = [ diff --git a/app/Http/Controllers/WorkerController.php b/app/Http/Controllers/WorkerController.php index 129c0ed..b856109 100644 --- a/app/Http/Controllers/WorkerController.php +++ b/app/Http/Controllers/WorkerController.php @@ -24,6 +24,7 @@ use Barryvdh\DomPDF\Facade\Pdf; use Carbon\Carbon; use Illuminate\Auth\Events\Registered; use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Model; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; @@ -124,24 +125,53 @@ class WorkerController extends Controller ->with('infobloks'); $Query = $Query->where('id', '=', $worker->id); $Query = $Query->get(); + + $get_date = date('Y.m'); + $c = Static_worker::query()->where('year_month', '=', $get_date) + ->where('user_id', '=', $worker->id) + ->get(); + + if ($c->count() > 0) { + $upd = Static_worker::find($c[0]->id); + $upd->lookin = $upd->lookin + 1; + $upd->save(); + } else { + $crt = new Static_worker(); + $crt->lookin = 1; + $crt->year_month = $get_date; + $crt->user_id = $worker->user_id; + $crt->save(); + } + + $stat = Static_worker::query()->where('year_month', '=', $get_date) + ->where('user_id', '=', $worker->id) + ->get(); + return view('worker', compact('Query', 'status_work')); } // скачать анкету соискателя public function resume_download(Worker $worker) { - $arr_house = ['0' => '$1000000000000000000']; + $status_work = $this->status_work; + $Query = Worker::query()->with('users')->with('job_titles') + ->with('place_worker')->with('sertificate')->with('prev_company') + ->with('infobloks'); + $Query = $Query->where('id', '=', $worker->id); + $Query = $Query->get()->toArray(); - view()->share('house',$arr_house); + view()->share('Query',$Query); - $pdf = PDF::loadView('layout.pdf', $arr_house); //->setPaper('a4', 'landscape'); + $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape'); return $pdf->stream(); } // Кабинет работника - public function cabinet() + public function cabinet(Request $request) { + $get_date = date('Y.m'); + $id = Auth()->user()->id; $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')-> with('infobloks')->with('place_worker')-> @@ -152,7 +182,39 @@ class WorkerController extends Controller $Job_titles = Job_title::query()->OrderBy('name')->get(); $Infoblocks = infobloks::query()->OrderBy('name')->get(); - return view('workers.cabinet', compact('Worker', 'Job_titles', 'Infoblocks')); + $stat = Static_worker::query()->where('year_month', '=', $get_date) + ->where('user_id', '=', $Worker[0]->id) + ->get(); + + $persent = 10; + if ((!empty($Worker[0]->status_work)) && (!empty($Worker[0]->telephone)) && + (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) && + (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) { + $persent = $persent + 40; + } + + if ($Worker[0]->sertificate->count() > 0) { + $persent = $persent + 15; + } + + if ($Worker[0]->infobloks->count() > 0) { + $persent = $persent + 20; + } + + if ($Worker[0]->prev_company->count() > 0) { + $persent = $persent + 10; + } + + if (!empty($Worker[0]->photo)) { + // 5% + $persent = $persent + 5; + } + + if ($request->has('print')) { + dd($Worker); + } else { + return view('workers.cabinet', compact('Worker', 'persent', 'Job_titles', 'Infoblocks', 'stat')); + } } // Сохранение данных diff --git a/app/Http/Requests/VacancyRequestEdit.php b/app/Http/Requests/VacancyRequestEdit.php new file mode 100644 index 0000000..6cb4e21 --- /dev/null +++ b/app/Http/Requests/VacancyRequestEdit.php @@ -0,0 +1,116 @@ + + */ + + public function rules() + { + $Arr = [ + 'name' => [ + 'required', + 'min:3', + 'max:255', + ], + + 'category_id' => [ + 'numeric', + 'min:0', + 'max:9999999', + ], + + 'telephone' => [ + 'min:3', + 'max:255', + ], + + 'email' => [ + 'min:3', + 'max:255', + ], + + 'salary' => [ + 'numeric', + 'min:3', + 'max:255', + ], + + 'min_salary' => [ + 'numeric', + 'min:0', + 'max:9999999', + ], + + 'max_salary' => [ + 'numeric', + 'min:0', + 'max:9999999', + ], + + 'city' => [ + 'min:3', + 'max:255', + ], + + 'job_title_id' => [ + 'numeric', + 'min:1', + 'max:9999999' + ] + ]; + + return [ + 'name' => [ + 'required', + 'min:3', + 'max:255', + ], + + 'category_id' => [ + 'numeric', + 'min:0', + 'max:9999999', + ], + + 'telephone' => [ + 'min:3', + 'max:255', + ], + + 'email' => [ + 'min:3', + 'max:255', + ],]; + } + + public function messages() { + return [ + 'required' => 'Поле «:attribute» обязательно для заполнения', + 'unique' => 'Такое значение поля «:attribute» уже используется', + 'min' => [ + 'string' => 'Поле «:attribute» должно быть не меньше :min символов', + 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' + ], + 'max' => [ + 'string' => 'Поле «:attribute» должно быть не больше :max символов', + 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' + ], + 'mimes' => 'Файл «:attribute» должен иметь формат :values', + 'numeric' => 'В поле «:attribute» должно быть указано целое число от 0 до 9999999', + ]; + + } +} diff --git a/app/Http/Requests/VacansiaRequiest.php b/app/Http/Requests/VacansiaRequiest.php index fe18124..b37f592 100644 --- a/app/Http/Requests/VacansiaRequiest.php +++ b/app/Http/Requests/VacansiaRequiest.php @@ -24,7 +24,7 @@ class VacansiaRequiest extends FormRequest public function rules() { - return [ + $Arr = [ 'name' => [ 'required', 'min:3', @@ -76,6 +76,29 @@ class VacansiaRequiest extends FormRequest 'max:9999999' ] ]; + + return [ + 'name' => [ + 'required', + 'min:3', + 'max:255', + ], + + 'category_id' => [ + 'numeric', + 'min:0', + 'max:9999999', + ], + + 'telephone' => [ + 'min:3', + 'max:255', + ], + + 'email' => [ + 'min:3', + 'max:255', + ],]; } public function messages() { diff --git a/resources/views/admin/ad_employers/add.blade.php b/resources/views/admin/ad_employers/add.blade.php index 3b4441d..11ac81d 100644 --- a/resources/views/admin/ad_employers/add.blade.php +++ b/resources/views/admin/ad_employers/add.blade.php @@ -18,7 +18,7 @@ placeholder="Название вакансии" value="{{ old('name') ?? '' }}" /> @error('name') - + {{ $message }} @enderror @@ -41,6 +41,22 @@
+
+