diff --git a/app/Classes/Capcha.php b/app/Classes/Capcha.php new file mode 100644 index 0000000..000085a --- /dev/null +++ b/app/Classes/Capcha.php @@ -0,0 +1,63 @@ +USE_SESSION = true; + // 1. Генерируем код капчи + // 1.1. Устанавливаем символы, из которых будет составляться код капчи + $this->chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz'; + // 1.2. Количество символов в капче + $this->length = 6; + } + + public function Release() { + // 1.3. Генерируем код + $code = substr(str_shuffle($this->chars), 0, $this->length); + + if ($this->USE_SESSION) { + // 2a. Используем сессию + session_start(); + $_SESSION['captcha'] = crypt($code, '$1$itchief$7'); + session_write_close(); + } else { + // 2a. Используем куки (время действия 600 секунд) + $value = crypt($code, '$1$itchief$7'); + $expires = time() + 600; + setcookie('captcha', $value, $expires, '/', 'test.ru', false, true); + } + + // 3. Генерируем изображение + // 3.1. Создаем новое изображение из файла + $image = imagecreatefrompng(__DIR__ . '/files/bg.png'); + // 3.2 Устанавливаем размер шрифта в пунктах + $size = 36; + // 3.3. Создаём цвет, который будет использоваться в изображении + $color = imagecolorallocate($image, 66, 182, 66); + // 3.4. Устанавливаем путь к шрифту + $font = __DIR__ . '/files//oswald.ttf'; + // 3.5 Задаём угол в градусах + $angle = rand(-10, 10); + // 3.6. Устанавливаем координаты точки для первого символа текста + $x = 56; + $y = 64; + // 3.7. Наносим текст на изображение + imagefttext($image, $size, $angle, $x, $y, $color, $font, $code); + // 3.8 Устанавливаем заголовки + header('Cache-Control: no-store, must-revalidate'); + header('Expires: 0'); + header('Content-Type: image/png'); + // 3.9. Выводим изображение + imagepng($image); + // 3.10. Удаляем изображение + imagedestroy($image); + } +} diff --git a/app/Http/Controllers/EmployerController.php b/app/Http/Controllers/EmployerController.php index dcd3f06..1531484 100644 --- a/app/Http/Controllers/EmployerController.php +++ b/app/Http/Controllers/EmployerController.php @@ -337,8 +337,8 @@ class EmployerController extends Controller $params = $request->all(); $rules = [ - 'surname' => ['required', 'string', 'max:255'], - 'name_man' => ['required', 'string', 'max:255'], + //'surname' => ['required', 'string', 'max:255'], + //'name_man' => ['required', 'string', 'max:255'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 'name_company' => ['required', 'string', 'max:255'], 'password' => ['required', 'string', 'min:8'], @@ -363,7 +363,15 @@ class EmployerController extends Controller return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); } - $validator = Validator::make($request->all(), $rules, $messages); + if (empty($request->get('surname'))) { + $params['surname'] = 'Неизвестно'; + } + + if (empty($request->get('name_man'))) { + $params['name_man'] = 'Неизвестно'; + } + + $validator = Validator::make($params, $rules, $messages); if ($validator->fails()) { return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); @@ -508,10 +516,14 @@ class EmployerController extends Controller // ->whereColumn('locations.document_id', 'documents.id') //); + $users = User_Model::query()->with('workers'); - if (isset($request->find)) { - $find_key = $request->find; + + if ($request->has('search')) { + $find_key = $request->get('search'); $users = $users->where('name', 'LIKE', "%$find_key%") + ->orWhere('surname', 'LIKE', "%$find_key%") + ->orWhere('name_man', 'LIKE', "%$find_key%") ->orWhere('email', 'LIKE', "%$find_key%") ->orWhere('telephone', 'LIKE', "%$find_key%"); } @@ -521,6 +533,7 @@ class EmployerController extends Controller orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id'))-> paginate(5); + return view('employers.bd', compact('users')); } diff --git a/app/Http/Controllers/MainController.php b/app/Http/Controllers/MainController.php index 89b5b04..34c5250 100644 --- a/app/Http/Controllers/MainController.php +++ b/app/Http/Controllers/MainController.php @@ -192,16 +192,20 @@ class MainController extends Controller else $uid = 0; + if ($request->get('job') == 0) + $job_search = ''; + else + $job_search = $request->get('job'); + $Query = Ad_employer::with('jobs')-> with('cat')-> with('employer')-> - whereHas('jobs_code', function ($query) use ($request) { - if (null !== ($request->get('job')) && ($request->get('job') !== 0)) { - $query->where('job_title_id', $request->get('job')); - } - }) - ->select('ad_employers.*'); + whereHas('jobs_code', function ($query) use ($job_search) { + if (!empty($job_search)) { + $query->where('job_title_id', $job_search); + } + })->select('ad_employers.*'); if (isset($categories->id) && ($categories->id > 0)) { $Query = $Query->where('category_id', '=', $categories->id); @@ -212,8 +216,6 @@ class MainController extends Controller if ($request->get('sort')) { $sort = $request->get('sort'); - - switch ($sort) { case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break; case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break; @@ -232,8 +234,6 @@ class MainController extends Controller $Reclama = reclame::query()->get(); - - if ($request->ajax()) { if ($request->has('title')) { return view('ajax.list_category', compact( diff --git a/app/Http/Controllers/WorkerController.php b/app/Http/Controllers/WorkerController.php index 0d7fa51..2d751b3 100644 --- a/app/Http/Controllers/WorkerController.php +++ b/app/Http/Controllers/WorkerController.php @@ -75,6 +75,8 @@ class WorkerController extends Controller $idiot = 0; } + + $status_work = $this->status_work; $resumes = Worker::query()->with('users')->with('job_titles'); $resumes = $resumes->whereHas('users', function (Builder $query) { @@ -82,6 +84,15 @@ class WorkerController extends Controller ->Where('is_bd', '=', '0'); }); + //dd($request->get('job')); + if (($request->has('job')) && ($request->get('job') > 0)) { + $resumes = $resumes->whereHas('job_titles', function(Builder $query) use ($request) { + $query->Where('job_titles.id', $request->get('job')); + }); + } + + $Job_title = Job_title::query()->get(); + if ($request->get('sort')) { $sort = $request->get('sort'); switch ($sort) { @@ -103,6 +114,8 @@ class WorkerController extends Controller } $res_count = $resumes->count(); + //$resumes = $resumes->get(); + $resumes = $resumes->paginate(4); if ($request->ajax()) { // Условия обставлены @@ -114,7 +127,7 @@ class WorkerController extends Controller return view('ajax.resume_2', compact('resumes', 'status_work', 'res_count', 'idiot')); } } else { - return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot')); + return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title')); } } @@ -180,6 +193,21 @@ class WorkerController extends Controller return $pdf->stream(); } + public function resume_download_all() { + $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('Query',$Query); + + $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape'); + + return $pdf->stream(); + } + // Кабинет работника public function cabinet(Request $request) { @@ -464,11 +492,12 @@ class WorkerController extends Controller } if (($request->has('politik')) && ($request->get('politik') == 1)) { - $validator = Validator::make($request->all(), $rules, $messages); + $validator = Validator::make($params, $rules, $messages); if ($validator->fails()) { return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); } else { + $user = $this->create($params); event(new Registered($user)); Auth::guard()->login($user); @@ -522,7 +551,8 @@ class WorkerController extends Controller 'telephone' => $data['telephone'], 'password' => Hash::make($data['password']), 'pubpassword' => base64_encode($data['password']), - 'email_verified_at' => Carbon::now() + 'email_verified_at' => Carbon::now(), + 'is_worker' => $data['is_worker'], ]); if ($Code_user->id > 0) { $Worker = new Worker(); diff --git a/app/Models/User.php b/app/Models/User.php index 949eb51..3705ebb 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -31,6 +31,7 @@ class User extends Authenticatable 'is_lookin', 'is_message', 'is_public', + 'is_worker', 'is_remove', 'is_ban', 'is_new', diff --git a/resources/views/ajax/resume_1.blade.php b/resources/views/ajax/resume_1.blade.php index 4c6d481..5e21cda 100644 --- a/resources/views/ajax/resume_1.blade.php +++ b/resources/views/ajax/resume_1.blade.php @@ -1,3 +1,4 @@ + @if ($resumes->count()) @foreach ($resumes as $res)
@@ -42,9 +43,20 @@
+
+ @if ($res->job_titles->count()) + @if (isset($res->job_titles)) + @foreach ($res->job_titles as $key => $j) + #{{ $j->name }} + @endforeach + @endif + @endif +
Перейти в резюме @endforeach {{ $resumes->appends($_GET)->links('paginate') }} +@else +

По данному запросу ничего не найдено

@endif diff --git a/resources/views/ajax/resume_2.blade.php b/resources/views/ajax/resume_2.blade.php index 8160b7f..4f8074d 100644 --- a/resources/views/ajax/resume_2.blade.php +++ b/resources/views/ajax/resume_2.blade.php @@ -42,10 +42,21 @@ +
+ @if ($res->job_titles->count()) + @if (isset($res->job_titles)) + @foreach ($res->job_titles as $key => $j) + #{{ $j->name }} + @endforeach + @endif + @endif +
Перейти в резюме @endforeach {{ $resumes->appends($_GET)->links('paginate') }} +@else +

По данному запросу ничего не найдено

@endif diff --git a/resources/views/employers/add_vacancy.blade.php b/resources/views/employers/add_vacancy.blade.php index ea96ce4..b9f2e44 100644 --- a/resources/views/employers/add_vacancy.blade.php +++ b/resources/views/employers/add_vacancy.blade.php @@ -99,10 +99,10 @@ -
+ -
+ + +
+
+ {{ $users->onEachSide(0)->appends($_GET)->links('paginate') }} + diff --git a/resources/views/employers/cabinet45.blade.php b/resources/views/employers/cabinet45.blade.php index d652e29..0c57d9c 100644 --- a/resources/views/employers/cabinet45.blade.php +++ b/resources/views/employers/cabinet45.blade.php @@ -4,7 +4,7 @@ + + diff --git a/resources/views/js/modals.blade.php b/resources/views/js/modals.blade.php index 0bf313e..d2622b4 100644 --- a/resources/views/js/modals.blade.php +++ b/resources/views/js/modals.blade.php @@ -1,4 +1,92 @@ diff --git a/resources/views/layout/frontend.blade.php b/resources/views/layout/frontend.blade.php index 7045ca1..bf8186d 100644 --- a/resources/views/layout/frontend.blade.php +++ b/resources/views/layout/frontend.blade.php @@ -17,7 +17,7 @@ - + @@ -293,10 +293,8 @@ } }; -@yield('scripts') - @include('js.modals') -@include('js.cookies') - +@include('js.captha') +@yield('scripts') diff --git a/resources/views/layout/pdf-list-people.blade.php b/resources/views/layout/pdf-list-people.blade.php new file mode 100644 index 0000000..9c9e182 --- /dev/null +++ b/resources/views/layout/pdf-list-people.blade.php @@ -0,0 +1,350 @@ + + + + + + Резюме соискателя + + + + + + + +@if (count($Query) > 0) + @foreach ($Query as $Q) +
+
+
+ +
+

@if (isset($Q['users']['surname'])) {{ $Q['users']['surname']." ".$Q['users']['name_man']." ".$Q['users']['surname2'] }} @endif

+
+

{{ $Q['text'] }}

+
+
+
+
+
+
+ + + +
+
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Основная информация
Имя:@if (isset($Q['users']['name_man'])) {{ $Q['users']['name_man'] }} @endif
Должность: + @foreach ($Q['job_titles'] as $it) + {{ $it['name'] }}
+ @endforeach +
Телефон:{{ $Q['telephone'] }} + {{ $Q['telephone2'] }} +
E-mail:{{ $Q['email'] }}
Возраст:{{ $Q['old_year'] }}
Статус: + @php $code = $Q['status_work']; @endphp + @if ($code == 0) Ищу работу @elseif($code == 1) Не указано @else Не ищу работу @endif
Город проживания:{{ $Q['city'] }}
Уровень английского:{{ $Q['en_is'] }}
Опыт работы:{{ $Q['old_year'] }}
+
+
+
+
+ + + + + + + + @if (count($Q['sertificate'])) + @foreach($Q['sertificate'] as $it) + + + + + @endforeach + @else + + + + + @endif + +
Сертификаты / документы
{{ $it['name']." ".$it['education'] }}{{ date('d.m.Y H:i:s', strtotime($it['date_begin']))."-".date('d.m.Y H:i:s', strtotime($it['end_begin'])) }}
- -
+
+
+
+
+ + + + + + + + @if (count($Q['place_worker']) > 0) + @foreach($Q['place_worker'] as $it) + + + + + + @endforeach + @endif + +
Опыт работы
{{ $it['begin_work']." - ".$it['end_work'] }} + {{ $it['name_company'] }} + {{ $it['job_title'] }} + Судно: {{ $it['teplohod'] }} +
+
+
+
+
+

О себе

+

{{ $Q['text'] }}

+ +
+
+
+ +
+
+ @endforeach +@endif + + diff --git a/resources/views/list_vacancies.blade.php b/resources/views/list_vacancies.blade.php index 82730ea..e5b823e 100644 --- a/resources/views/list_vacancies.blade.php +++ b/resources/views/list_vacancies.blade.php @@ -292,7 +292,7 @@ @php $i++ @endphp @endforeach
- {{ $Query->appends($_GET)->links('paginate') }} + {{ $Query->onEachSide(0)->appends($_GET)->links('paginate') }}
diff --git a/resources/views/modals/register.blade.php b/resources/views/modals/register.blade.php index 1b95222..b0422f2 100644 --- a/resources/views/modals/register.blade.php +++ b/resources/views/modals/register.blade.php @@ -1,3 +1,12 @@ + diff --git a/resources/views/worker.blade.php b/resources/views/worker.blade.php index c56edad..82cb11b 100644 --- a/resources/views/worker.blade.php +++ b/resources/views/worker.blade.php @@ -79,7 +79,13 @@ Должность: - @if (isset($Query[0]->job_titles[0]->name)) {{ $Query[0]->job_titles[0]->name }} @else Не указано @endif + + @if ($Query[0]->job_titles->count()) + @foreach ($Query[0]->job_titles as $it) + {{ $it->name }} + @endforeach + @endif + Телефон: diff --git a/routes/web.php b/routes/web.php index 918d3ff..f8b0873 100644 --- a/routes/web.php +++ b/routes/web.php @@ -452,6 +452,9 @@ Route::get('resume-profile/{worker}', [WorkerController::class, 'resume_profile' //Скачать резюме Route::get('resume-download/{worker}', [WorkerController::class, 'resume_download'])->name('resume_download'); +Route::get('resume-download/all', [WorkerController::class, 'resume_download_all'])->name('resume_download_all2'); +Route::get('resume-download', [WorkerController::class, 'resume_download_all'])->name('resume_download_all'); + //Вход в кабинет Route::get('login', [MainController::class, 'input_login'])->name('login');