diff --git a/app/Classes/Tools.php b/app/Classes/Tools.php index a21a5f5..e1fa65a 100644 --- a/app/Classes/Tools.php +++ b/app/Classes/Tools.php @@ -51,13 +51,13 @@ class Tools ]; foreach ($workerFields as $fieldName) { - if (!empty($Worker->$fieldName)) { + if (!empty($Worker->$fieldName) && $Worker->$fieldName !== 'Не указано') { $persent += 2.8; } } foreach ($workerUserFields as $fieldName) { - if (!empty($Worker->user->$fieldName)) { + if (!empty($Worker->users->$fieldName)) { $persent += 2.8; } } diff --git a/app/Http/Controllers/EmployerController.php b/app/Http/Controllers/EmployerController.php index b8d80f2..3db42d8 100644 --- a/app/Http/Controllers/EmployerController.php +++ b/app/Http/Controllers/EmployerController.php @@ -566,8 +566,10 @@ class EmployerController extends Controller } // Данные - $users = $users->Baseuser()-> - orderByDesc(Worker::select('created_at')->whereColumn('workers.user_id', 'users.id')); + $users = $users + ->Baseuser() + ->orderByDesc(Worker::select('created_at') + ->whereColumn('workers.user_id', 'users.id')); $count_users = $users->count(); $users = $users->paginate(10); diff --git a/app/Http/Controllers/WorkerController.php b/app/Http/Controllers/WorkerController.php index c3f244d..67903c8 100644 --- a/app/Http/Controllers/WorkerController.php +++ b/app/Http/Controllers/WorkerController.php @@ -30,6 +30,7 @@ use Illuminate\Auth\Events\Registered; use Illuminate\Database\Eloquent\Builder; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Validator; @@ -247,15 +248,14 @@ class WorkerController extends Controller $status_work = WorkerStatuses::getWorkerStatuses(); $infoblocks = infobloks::query()->get(); - //dd($Query[0]); - return view('layout.pdf', compact('Query', 'status_work', 'infoblocks')); + //return view('layout.pdf', compact('Query', 'status_work', 'infoblocks')); $pdf = PDF::loadView('layout.pdf', [ 'Query' => $Query, 'status_work' => $status_work, 'infoblocks' => $infoblocks ])->setPaper('a4', 'landscape'); - return $pdf->stream(); + return $pdf->download(); } public function resume_download_all(Request $request) { @@ -276,18 +276,26 @@ class WorkerController extends Controller return redirect()->back()->with('error', 'Пожалуйста выберите хотя бы 1 колонку для экспорта.'); } - $query = User::select($columns) - ->leftJoin('workers', 'users.id', '=', 'workers.user_id') - ->leftJoin('job_titles', 'workers.position_work', '=', 'job_titles.id') - ->where('users.is_bd', '=', 1); + $jobIds = $request->input('job_title_list', []); + + $users = DB::select( + "select `job_titles`.`name`, `users`.`surname`, `users`.`name_man`, `users`.`surname2`, `users`.`email`, `users`.`telephone` + from users + join workers on `users`.`id` = `workers`.`user_id` + join `job_titles` + where `users`.`is_bd` = 1 + and (`workers`.`position_work` = `job_titles`.`id` + or exists (select 1 + from JSON_TABLE( + workers.positions_work, + '$[*]' COLUMNS (id INT PATH '$')) pw + where pw.id = job_titles.id) + )". ((!empty($jobIds)) ? 'and job_titles.id in ('. implode(',', $jobIds).')' : '') + ); - $job_title_list = $request->input('job_title_list', []); - if (!empty($job_title_list)){ - $query->whereIn('job_titles.id', $job_title_list); - } + $users = collect($users); - $users = $query->get(); - if ($users->count()){ + if ($users->count()) { $i = 2; foreach ($users->toArray() as $user){ $j = 0; @@ -580,40 +588,12 @@ class WorkerController extends Controller return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); } - /*$haystack = $request->get('password'); - - $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); - $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', - 'X', 'C', 'V', 'B', 'N', 'M'); - $lenpwd_bool = true; - $spec_bool = false; - $alpha_bool = false; - - if (strlen($haystack) < 8) $lenpwd_bool = false; - - foreach ($specsumbol as $it) { - if (strpos($haystack, $it) !== false) { - $spec_bool = true; - } - } - - foreach ($alpha as $it) { - if (strpos($haystack, $it) !== false) { - $alpha_bool = true; - } - } - - if ((!$spec_bool) || (!$alpha_bool)) { - return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); - }*/ - if (($request->has('politik')) && ($request->get('politik') == 1)) { $validator = Validator::make($params, $rules, $messages); if ($validator->fails()) { return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); } else { - //dd($params); $user = $this->create($params); event(new Registered($user)); Auth::guard()->login($user); diff --git a/app/Models/User.php b/app/Models/User.php index 358efde..07baaf0 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -6,6 +6,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; +use JsonException; use Laravel\Sanctum\HasApiTokens; class User extends Authenticatable @@ -87,7 +88,8 @@ class User extends Authenticatable * users - workers */ public function work() { - return $this->hasMany(Worker::class, 'user_id')->select('telephone', 'email', 'position_work', 'persent_anketa'); + return $this->hasMany(Worker::class, 'user_id') + ->select('telephone', 'email', 'position_work', 'persent_anketa'); } /* @@ -156,4 +158,22 @@ class User extends Authenticatable return $query->where('admin', '=', '0'); } + /** + * @throws JsonException + */ + public function getJobAttribute(): ?string + { + $positions = $this->workers[0]?->positions_work; + if (is_string($positions)) { + $jobIds = json_decode($positions, true, 512, JSON_THROW_ON_ERROR); + } else { + $jobIds = $positions; + } + + if ($jobIds !== null && count($jobIds) > 0) { + return Job_title::whereIn('id', $jobIds)->first()->name; + } + return null; + } + } diff --git a/resources/views/admin/worker/edit.blade.php b/resources/views/admin/worker/edit.blade.php index 49b16b4..32985ba 100644 --- a/resources/views/admin/worker/edit.blade.php +++ b/resources/views/admin/worker/edit.blade.php @@ -15,48 +15,59 @@ use Illuminate\Support\Facades\Storage; -
+
- + +
- +

+ +
-
- -
-
- + +
- - - - - - - - - @endsection diff --git a/resources/views/admin/worker/index.blade.php b/resources/views/admin/worker/index.blade.php index 9ba3105..ccdfd85 100644 --- a/resources/views/admin/worker/index.blade.php +++ b/resources/views/admin/worker/index.blade.php @@ -145,8 +145,8 @@ - @if (isset($user->jobtitles[0]->name)) - {{ $user->jobtitles[0]->name }} + @if ($user->job !== null) + {{ $user->job }} @else Не задана @endif @@ -169,107 +169,5 @@
appends($_GET)->links('admin.pagginate'); ?>
- - - - - appends($_GET)->links('catalogs.paginate'); ?> - - @endsection diff --git a/resources/views/employers/bd.blade.php b/resources/views/employers/bd.blade.php index e26afed..6c2431b 100644 --- a/resources/views/employers/bd.blade.php +++ b/resources/views/employers/bd.blade.php @@ -136,7 +136,7 @@ Пользователей найдено: - {{ $users->count() }} + {{ $count_users }}
@@ -167,12 +167,7 @@ @if($it->workers[0]->positions_work) - @foreach($it->workers[0]->jobs as $job) - {{ $job->name }} - @if(!$loop->last) -
- @endif - @endforeach + {{ $it->workers[0]->jobs->first()->name }} @endif diff --git a/resources/views/info_company_new.blade.php b/resources/views/info_company_new.blade.php index 5c9719a..8179b4a 100644 --- a/resources/views/info_company_new.blade.php +++ b/resources/views/info_company_new.blade.php @@ -5,7 +5,6 @@ $(document).on('change', '#sort_ajax', function() { var this_ = $(this); var val_ = this_.val(); - console.log('sort items '+val_); $.ajax({ type: "GET", @@ -30,8 +29,6 @@ url: "{{ route('shipping_companies') }}", data: "sort="+val_+"&block=2", success: function (data) { - console.log('Выбор сортировки2'); - console.log(data); history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); $('#block_2').html(data); }, @@ -49,7 +46,6 @@ var sel = $('#select2-sort_ajax-container'); var key = getUrlParameter('sort'); if (key !=='') { - console.log(key); switch (key) { case "default": sel.html('Сортировка (по умолчанию)'); break; case "name_up": sel.html('По имени (возрастание)'); break; @@ -61,23 +57,6 @@ } }); - //end - $(document).on('click', '.js_send_it_button', function() { - var this_ = $(this); - var code_user_id = this_.attr('data-uid'); - var code_to_user_id = this_.attr('data-tuid'); - var code_vacancy = this_.attr('data-vacancy'); - var user_id = $('#send_user_id'); - var to_user_id = $('#send_to_user_id'); - var vacancy = $('#send_vacancy'); - - console.log('Клик на кнопки...'); - - user_id.val(code_user_id); - to_user_id.val(code_to_user_id); - vacancy.val(code_vacancy); - }); - $("#list_button").on('click', function () { $('#flot').removeClass('active'); $('#flot_list').removeClass('showed'); @@ -86,6 +65,7 @@ }) @include('js.favorite-vacancy-45') + @include('js.vacancy-response') @endsection @section('content') @@ -113,7 +93,6 @@ @endif

{{ $company[0]->name_company }}

-
- @if ($user_id == 0) - + @guest + Написать сообщение @else - - @endif + @if (App\Classes\StatusUser::Status() == 1) + + Написать сообщение + + @endif + @endguest
@@ -250,13 +241,17 @@ @endif
- - - - +
{{ date('d.m.Y H:i:s', strtotime($job->updated_at)) }}
diff --git a/resources/views/modals/send_worker.blade.php b/resources/views/modals/send_worker.blade.php index ca91736..a22a992 100644 --- a/resources/views/modals/send_worker.blade.php +++ b/resources/views/modals/send_worker.blade.php @@ -3,8 +3,6 @@ var val = $(this).val(); var send_title = $('#send_title'); var send_title_val = send_title.val(); - - console.log('Click form.'); }); $(document).on('change', '#btn_send_file', function() { @@ -13,7 +11,6 @@ var send_name_val = send_name.val(); var send_name_file = $('#send_name_file'); - console.log(send_name_val); send_name_file.html(send_name_val); }); @@ -31,20 +28,6 @@ Вакансия:
- -