From 3256f8927e954e4d19c837fa87c67a5499a2e541 Mon Sep 17 00:00:00 2001 From: Fedor Date: Wed, 9 Oct 2024 19:57:51 +0700 Subject: [PATCH] task-132687 minor changes --- app/Classes/Tools.php | 55 +++++++------ app/Http/Controllers/Admin/UsersController.php | 8 +- app/Http/Controllers/EmployerController.php | 58 +++++++------- app/Http/Controllers/MainController.php | 4 +- resources/views/admin/users/form.blade.php | 10 +-- resources/views/admin/worker/index.blade.php | 35 +++------ resources/views/employers/add_vacancy.blade.php | 54 +------------ .../views/employers/ajax/list_vacancy.blade.php | 74 +++++++++--------- resources/views/employers/bd.blade.php | 2 +- resources/views/employers/favorite.blade.php | 58 ++++++-------- resources/views/index.blade.php | 1 - resources/views/js/vacancy-response.blade.php | 15 ++++ resources/views/list_vacancies.blade.php | 15 +--- resources/views/modals/send_employer.blade.php | 2 +- resources/views/modals/send_worker.blade.php | 2 +- .../views/modals/vacancy/add_comment.blade.php | 9 ++- .../vacancy/send_response_to_employer.blade.php | 2 +- resources/views/vacance-item.blade.php | 81 +++++++++----------- 18 files changed, 209 insertions(+), 276 deletions(-) create mode 100644 resources/views/js/vacancy-response.blade.php diff --git a/app/Classes/Tools.php b/app/Classes/Tools.php index b5e84f0..a21a5f5 100644 --- a/app/Classes/Tools.php +++ b/app/Classes/Tools.php @@ -28,31 +28,42 @@ class Tools public static function getWorkerProfilePercent(Worker $Worker): int { $persent = 0; + $workerFields = [ + 'telephone', + 'email', + 'old_year', + 'salary_expectations', + 'experience', + 'english_level', + 'ready_boart_date', + 'boart_type_preference', + 'visa_available', + 'confirmation_work_for_vvp', + 'military_id_available', + 'city', + 'telephone2', + ]; - if((!empty($Worker->users->surname)) && - (!empty($Worker->users->name_man)) && - (!empty($Worker->telephone)) && - (!empty($Worker->email)) - ) { - $persent += 10; + $workerUserFields = [ + 'surname', + 'name_man', + 'surname2', + ]; + + foreach ($workerFields as $fieldName) { + if (!empty($Worker->$fieldName)) { + $persent += 2.8; + } + } + + foreach ($workerUserFields as $fieldName) { + if (!empty($Worker->user->$fieldName)) { + $persent += 2.8; + } } - if ( - (!empty($Worker->users->surname2)) && - (!empty($Worker->old_year)) && - ($Worker->job_titles->count() > 0) && - (!empty($Worker->salary_expectations)) && - (!empty($Worker->experience)) && - (!empty($Worker->english_level)) && - (!empty($Worker->ready_boart_date)) && - (!empty($Worker->boart_type_preference)) && - (!empty($Worker->visa_available)) && - (!empty($Worker->confirmation_work_for_vvp)) && - (!empty($Worker->military_id_available)) && - (!empty($Worker->city)) && - (!empty($Worker->telephone2)) - ) { - $persent += 40; + if ($Worker->job_titles->count() > 0) { + $persent += 2.8; } if ($Worker->sertificate->count() > 0) { diff --git a/app/Http/Controllers/Admin/UsersController.php b/app/Http/Controllers/Admin/UsersController.php index ab7e361..88442cc 100644 --- a/app/Http/Controllers/Admin/UsersController.php +++ b/app/Http/Controllers/Admin/UsersController.php @@ -101,8 +101,12 @@ class UsersController extends Controller } public function edit_bd(User $user) { - $list_job_titles = Job_title::query()->active()->where('is_bd', '=' , '2')-> - orderByDesc('sort')->orderBy('name', 'asc')->get(); + $list_job_titles = Job_title::query() + ->active() + ->where('is_bd', '=' , '2') + ->orderByDesc('sort') + ->orderBy('name', 'asc') + ->get(); return view('admin.users.edit', compact('user', 'list_job_titles')); } diff --git a/app/Http/Controllers/EmployerController.php b/app/Http/Controllers/EmployerController.php index 10e5ac2..b8d80f2 100644 --- a/app/Http/Controllers/EmployerController.php +++ b/app/Http/Controllers/EmployerController.php @@ -158,23 +158,28 @@ class EmployerController extends Controller // Форма добавления вакансий public function cabinet_vacancie() { - $id = Auth()->user()->id; + /** @var User_Model $user */ + $user = Auth()->user(); - if (Auth()->user()->is_public) { + if ($user->is_public) { $categories = Category::query()->active()->get(); - $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> - where('is_remove', '=', '0')-> - where('is_bd', '=', '0')-> - get(); - $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> - WhereHas('users', - function (Builder $query) use ($id) { - $query->Where('id', $id); - })->get(); + + $jobs = Job_title::query() + ->orderByDesc('sort') + ->OrderBy('name') + ->where('is_remove', '=', '0') + ->where('is_bd', '=', '0') + ->get(); + + $Employer = Employer::query() + ->with(['users', 'ads', 'flots']) + ->whereHas('users', fn (Builder $query) => $query->where('id', $user->id)) + ->get(); + return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); - } else { - return redirect()->route('employer.cabinet_vacancie_danger'); } + + return redirect()->route('employer.cabinet_vacancie_danger'); } // Форма предупреждения об оплате @@ -187,18 +192,8 @@ class EmployerController extends Controller $params_emp = $request->all(); $params_job["job_title_id"] = $params_emp['job_title_id']; - //$params_job["min_salary"] = $params_emp['min_salary']; - //$params_job["max_salary"] = $params_emp['max_salary']; - //$params_job["region"] = $params_emp['region']; - //$params_job["power"] = $params_emp['power']; - //$params_job["sytki"] = $params_emp['sytki']; - //$params_job["start"] = $params_emp['start']; - //$params_job["flot"] = $params_emp['flot']; - //$params_job["description"] = $params_emp['description']; $ad_jobs = Ad_employer::create($params_emp); - //$params_job['ad_employer_id'] = $ad_jobs->id; - //Ad_jobs::create($params_job); $ad_jobs->jobs()->sync($request->get('job_title_id')); return redirect()->route('employer.vacancy_list'); @@ -208,7 +203,6 @@ class EmployerController extends Controller public function vacancy_list(Request $request) { $id = Auth()->user()->id; - //dd($request->all()); $Employer = Employer::query()->where('user_id', $id)->first(); $vacancy_list = Ad_employer::query() ->with('jobs') @@ -226,9 +220,14 @@ class EmployerController extends Controller if ($request->get('sort')) { $sort = $request->get('sort'); switch ($sort) { - case 'nopublic': $vacancy_list->where('active_is', '=', 0);break; - case 'public':$vacancy_list->where('active_is', '=', 1);break; - default: $vacancy_list = $vacancy_list->orderByDesc('id'); break; + case 'nopublic': $vacancy_list->orderByDesc('updated_at') + ->where('active_is', 0); + break; + case 'public': $vacancy_list->orderByDesc('updated_at') + ->where('active_is',1); + break; + default: $vacancy_list->orderByDesc('updated_at'); + break; } } else { $vacancy_list = $vacancy_list->orderByDesc('updated_at')->orderBy('id'); @@ -236,7 +235,6 @@ class EmployerController extends Controller $vacancy_list = $vacancy_list->paginate(10); - //ajax if ($request->ajax()) { return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); } else { @@ -570,7 +568,7 @@ class EmployerController extends Controller // Данные $users = $users->Baseuser()-> orderByDesc(Worker::select('created_at')->whereColumn('workers.user_id', 'users.id')); - $count_users = $users; + $count_users = $users->count(); $users = $users->paginate(10); $export_options = DbExportColumns::toArray(); @@ -759,7 +757,7 @@ class EmployerController extends Controller file_store_path: "worker/$id" ); - return redirect()->route('worker.dialog', ['chat' => $message->chat_id_to]); + return redirect()->route('employer.dialog', ['chat' => $message->chat_id_to]); } // Восстановление пароля diff --git a/app/Http/Controllers/MainController.php b/app/Http/Controllers/MainController.php index a3bcfea..9fed572 100644 --- a/app/Http/Controllers/MainController.php +++ b/app/Http/Controllers/MainController.php @@ -124,12 +124,12 @@ class MainController extends Controller ->where('user_id', Auth::user()->id) ->delete(); - return "Вот и результат удаления!"; - + return response()->json(['deleted' => true, 'id' => $request->get('code_record')]); } else { $params = $request->all(); $params['user_id'] = Auth::user()->id; Like_worker::create($params); + return response()->json(['deleted' => false, 'id' => $request->get('code_record')]); } } } diff --git a/resources/views/admin/users/form.blade.php b/resources/views/admin/users/form.blade.php index a79be1d..2d48ccc 100644 --- a/resources/views/admin/users/form.blade.php +++ b/resources/views/admin/users/form.blade.php @@ -104,12 +104,12 @@ Комментарий - @error('telephone') - - {{ $message }} - + @error('comment') + + {{ $message }} + @enderror
diff --git a/resources/views/admin/worker/index.blade.php b/resources/views/admin/worker/index.blade.php index 85b008f..9ba3105 100644 --- a/resources/views/admin/worker/index.blade.php +++ b/resources/views/admin/worker/index.blade.php @@ -82,6 +82,9 @@ @foreach($users as $user) + @if (!isset($user->workers[0])) + @continue(1) + @endif {{$user->id}} @@ -136,22 +139,11 @@ - @if (isset($user->workers[0]->persent_anketa)) - @if ($user->workers[0]->persent_anketa > 40) - - {{$user->workers[0]->persent_anketa}}% - - @else - - {{ \App\Classes\Tools::getWorkerProfilePercent($user->workers[0]) }}% - - @endif - @else - - 0% - - @endif + + {{ $persent }}% + + @if (isset($user->jobtitles[0]->name)) {{ $user->jobtitles[0]->name }} @@ -163,18 +155,11 @@ {{ date('d.m.Y h:i:s', strtotime($user->created_at)) }} - - @if (isset($user->workers[0]->id)) - Изменить + @if (isset($user->workers[0]->id)) + Изменить - @endif - - - + @endforeach diff --git a/resources/views/employers/add_vacancy.blade.php b/resources/views/employers/add_vacancy.blade.php index 1b868ee..6d3b409 100644 --- a/resources/views/employers/add_vacancy.blade.php +++ b/resources/views/employers/add_vacancy.blade.php @@ -1,35 +1,5 @@ @extends('layout.frontend', ['title' => 'Добавление вакансии РекаМоре']) -@section('scripts') - -@endsection @section('content')
@@ -93,7 +63,7 @@ @endforeach @endif @endif - + @endforeach @endif @@ -148,28 +118,6 @@ @enderror
-
diff --git a/resources/views/employers/ajax/list_vacancy.blade.php b/resources/views/employers/ajax/list_vacancy.blade.php index cd98f0e..91d6a10 100644 --- a/resources/views/employers/ajax/list_vacancy.blade.php +++ b/resources/views/employers/ajax/list_vacancy.blade.php @@ -40,43 +40,43 @@ @endif - - - - - - - - - - - - - - - - - @if ($it->active_is) - - - - - - @else - - - - - - @endif - - - + + + + + + + + + + + + + + + + + @if ($it->active_is) + + + + + + @else + + + + + + @endif + @if ($Employer->social_is == 1) + + + + + + @endif + @endforeach diff --git a/resources/views/employers/bd.blade.php b/resources/views/employers/bd.blade.php index 60ae87f..e26afed 100644 --- a/resources/views/employers/bd.blade.php +++ b/resources/views/employers/bd.blade.php @@ -136,7 +136,7 @@
Пользователей найдено: - {{ $count_users->count() }} + {{ $users->count() }}
diff --git a/resources/views/employers/favorite.blade.php b/resources/views/employers/favorite.blade.php index 57fe371..576c13a 100644 --- a/resources/views/employers/favorite.blade.php +++ b/resources/views/employers/favorite.blade.php @@ -62,10 +62,10 @@ 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, success: function (data) { - if ($(this).hasClass('active')){ - $(this).removeClass('active'); - } else{ - $(this).addClass('active'); + if (data.deleted){ + $('#elem_'+data.id).removeClass('active'); + } else { + $('#elem_'+data.id).addClass('active'); } }, error: function (data) { @@ -75,6 +75,13 @@ }); }); }); + $(document).on('click', '.chat', function() { + var this_ = $(this); + + $('#_user_id').val(this_.attr('data-uid')); + $('#_to_user_id').val(this_.attr('data-tuid')); + $('#_vacancy').val(this_.attr('data-vacancy')); + }); @endsection @@ -144,40 +151,23 @@ Убрать из избранного - @guest - - @else - @if (App\Classes\StatusUser::Status()==0) - @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_message)) - - @endif - @else - - @endif - @endif + Подробнее
- -
diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php index 6cd422e..29c3bc8 100644 --- a/resources/views/index.blade.php +++ b/resources/views/index.blade.php @@ -5,7 +5,6 @@ @endsection @section('content') - @include('messages_error')
diff --git a/resources/views/js/vacancy-response.blade.php b/resources/views/js/vacancy-response.blade.php new file mode 100644 index 0000000..77e801e --- /dev/null +++ b/resources/views/js/vacancy-response.blade.php @@ -0,0 +1,15 @@ + diff --git a/resources/views/list_vacancies.blade.php b/resources/views/list_vacancies.blade.php index 55f270c..79f1ec6 100644 --- a/resources/views/list_vacancies.blade.php +++ b/resources/views/list_vacancies.blade.php @@ -52,20 +52,6 @@ } }); - $(document).on('click', '.ask_comment', function() { - var this_ = $(this); - - $('#modal_user_id').val(this_.attr('data-uid')); - $('#modal_to_user_id').val(this_.attr('data-tuid')); - $('#modal_vacancy').val(this_.attr('data-vacancy')); - }); - - $(document).on('click', '.ask_percent', function() { - $('#modal_vacancy') - .val($(this).attr('data-vacancy')) - .trigger('change'); - }); - $(document).on('change', '#sort_ajax', function() { var this_ = $(this); var val_ = this_.val(); @@ -105,6 +91,7 @@ }); @include('js.favorite-vacancy-45') + @include('js.vacancy-response') @endsection @section('content')
diff --git a/resources/views/modals/send_employer.blade.php b/resources/views/modals/send_employer.blade.php index 0955067..6862318 100644 --- a/resources/views/modals/send_employer.blade.php +++ b/resources/views/modals/send_employer.blade.php @@ -22,7 +22,7 @@
- @include('js.favorite-vacancy-45') + @include('js.vacancy-response') @endsection @section('content') @@ -121,26 +92,44 @@
@guest - + @else - @if (App\Classes\StatusUser::Status()==1) - - @else - + @if (App\Classes\StatusUser::Status() == 1) + user()->workers[0]) >= 50) { + $buttonId = 'ask_comment'; + } else { + $buttonId = 'ask_percent'; + } + ?> + +
+
{{ date('d.m.Y', strtotime($Q->updated_at)) }}
+ +
@endif @endguest
-
-
{{ date('d.m.Y', strtotime($Q->updated_at)) }}
- -
+
@endforeach -- 1.7.10.4