diff --git a/app/Http/Controllers/CompanyController.php b/app/Http/Controllers/CompanyController.php index ebdd0a0..c917d4e 100644 --- a/app/Http/Controllers/CompanyController.php +++ b/app/Http/Controllers/CompanyController.php @@ -41,10 +41,16 @@ class CompanyController extends Controller } public function info_company(Employer $company) { - $user_id = Auth()->user()->id; + if (isset(Auth()->user()->id)) { + $user_id = Auth()->user()->id; + } else { + $user_id = 0; + } $company = Employer::with('ads')->with('flots')->with('users') ->where('id', '=', $company->id)->get(); + $title = $company[0]->name_company; - return view('info_company', compact('company', 'user_id', 'title')); + + return view('info_company_new', compact('company', 'user_id', 'title')); } } diff --git a/app/Http/Controllers/MainController.php b/app/Http/Controllers/MainController.php index 68e998f..fdd2984 100644 --- a/app/Http/Controllers/MainController.php +++ b/app/Http/Controllers/MainController.php @@ -179,6 +179,9 @@ class MainController extends Controller // Вход в личный кабинет public function input_login(Request $request) { + $params = $request->all(); + + $rules = [ 'email' => 'required|string|email', 'password' => 'required|string', @@ -199,6 +202,7 @@ class MainController extends Controller $validator = Validator::make($request->all(), $rules, $messages); + if ($validator->fails()) { return redirect()->route('index')->with('Error', "Email или пароль невалидный"); } else { @@ -260,6 +264,8 @@ class MainController extends Controller foreach ([$request->get('email')] as $recipient) { Mail::to($recipient)->send(new MailRepair($new_password)); } + return redirect()->route('index'); + } } diff --git a/app/Http/Controllers/WorkerController.php b/app/Http/Controllers/WorkerController.php index ad6ccee..35210f5 100644 --- a/app/Http/Controllers/WorkerController.php +++ b/app/Http/Controllers/WorkerController.php @@ -62,7 +62,7 @@ class WorkerController extends Controller } // лист база резюме - public function bd_resume() + public function bd_resume(Request $request) { if (isset(Auth()->user()->id)) { $idiot = Auth()->user()->id; @@ -71,17 +71,47 @@ class WorkerController extends Controller } $status_work = $this->status_work; - $resumes = Worker::query()->with('users')->with('job_titles')-> - WhereHas('users', + $resumes = Worker::query()->with('users')->with('job_titles') + ->WhereHas('users', function (Builder $query) { $query->Where('is_worker', '=', '1')-> Where('is_bd', '=', '0'); - }); + }); + + if ($request->get('sort')) { + $sort = $request->get('sort'); + switch ($sort) { + case 'name_up': + $resumes = $resumes->whereHas('users', function (Builder $query) { + $query = $query->orderBy('surname')->orderBy('id'); + }); + break; + case 'name_down': + $resumes = $resumes->whereHas('users', function (Builder $query) { + $query = $query->orderByDesc('surname')->orderby('id'); + }); + break; + case 'created_at_up': $resumes = $resumes->OrderBy('created_at')->orderBy('id'); break; + case 'created_at_down': $resumes = $resumes->orderByDesc('created_at')->orderBy('id'); break; + case 'default': $resumes = $resumes->orderBy('id')->orderby('updated_at'); break; + default: $resumes = $resumes->orderBy('id')->orderby('updated_at'); break; + } + } $res_count = $resumes->count(); - $resumes = $resumes->paginate(5); + $resumes = $resumes->paginate(6); + if ($request->ajax()) { + // Условия обставлены + if ($request->has('block') && ($request->get('block') == 1)) { + return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); + } - return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot')); + if ($request->has('block') && ($request->get('block') == 2)) { + return view('ajax.resume_2', compact('resumes', 'status_work', 'res_count', 'idiot')); + } + } else { + return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot')); + } } // анкета соискателя @@ -244,7 +274,7 @@ class WorkerController extends Controller if ($request->get('new_password') == $request->get('new_password2')) if ($request->get('password') !== $request->get('new_password')) { $credentials = $request->only('email', 'password'); - if (Auth::attempt($credentials)) { + if (Auth::attempt($credentials, $request->has('save_me'))) { if (!is_null($use->email_verified_at)){ @@ -322,9 +352,6 @@ class WorkerController extends Controller ] ]; - - - if ($request->get('password') !== $request->get('confirmed')){ return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); } diff --git a/resources/views/ajax/resume_1.blade.php b/resources/views/ajax/resume_1.blade.php new file mode 100644 index 0000000..4c6d481 --- /dev/null +++ b/resources/views/ajax/resume_1.blade.php @@ -0,0 +1,50 @@ +@if ($resumes->count()) + @foreach ($resumes as $res) +
+
+ + +
+
+ +
+
+ Статус + {{ $status_work[$res->status_work] }} +
+
+ Имя работника + @if (isset($res->users)){{ $res->users->surname." ".$res->users->name_man." ".$res->users->surname2 }} @endif +
+
+ Номер телефона + {{ $res->telephone }} +
+
+ Электронный адрес + {{ $res->email }} +
+
+ Город проживания + {{ $res->city }} +
+
+ Опыт работы + {{ $res->experience }} +
+
+
+ Перейти в резюме +
+ @endforeach + + {{ $resumes->appends($_GET)->links('paginate') }} +@endif diff --git a/resources/views/ajax/resume_2.blade.php b/resources/views/ajax/resume_2.blade.php new file mode 100644 index 0000000..8160b7f --- /dev/null +++ b/resources/views/ajax/resume_2.blade.php @@ -0,0 +1,51 @@ +@if ($resumes->count()) + @foreach ($resumes as $res) +
+
+ + +
+
+ +
+
+ Статус + {{ $status_work[$res->status_work] }} +
+
+ Имя работника + @if (isset($res->users)){{ $res->users->surname." ".$res->users->name_man." ".$res->users->surname2 }} @endif +
+
+ Номер телефона + {{ $res->telephone }} +
+
+ Электронный адрес + {{ $res->email }} +
+
+ Город проживания + {{ $res->city }} +
+
+ Опыт работы + {{ $res->experience }} +
+
+
+ Перейти в + резюме +
+ @endforeach + + {{ $resumes->appends($_GET)->links('paginate') }} +@endif diff --git a/resources/views/info_company.blade.php b/resources/views/info_company.blade.php index 622a695..0aec9c7 100644 --- a/resources/views/info_company.blade.php +++ b/resources/views/info_company.blade.php @@ -226,9 +226,15 @@ #{{ $item->job_title->name }}
+ @if ($user_id == 0) + + @else + отклик41-42-41 + @endif
diff --git a/resources/views/info_company_new.blade.php b/resources/views/info_company_new.blade.php new file mode 100644 index 0000000..6fdbe00 --- /dev/null +++ b/resources/views/info_company_new.blade.php @@ -0,0 +1,266 @@ +@extends('layout.frontend', ['title' => 'Описание компании '.$title.'- РекаМоре']) + +@section('scripts') + +@endsection + +@section('content') +
+
+
+ + @if ($company[0]->oficial_status == 1) +
+ + + + Компания проверена +
+ @endif + + {{ $company[0]->name_company }} +

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

+

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

+
+ + @if ($user_id == 0) + + Написать сообщение + + @else + + Написать сообщение + + @endif +
+
+
+
+
+
+
+

О компании

+
+
+ Адрес компании + + {{ $company[0]->address }} + +
+
+ Сайт + + {{ $company[0]->site }} + +
+
+ Почта + + {{ $company[0]->email }} + +
+
+ Телефон + + {{ $company[0]->telephone }} + +
+
+
+ Описание + + {{ $company[0]->text }} + +
+
+
+ + +
+
+
+
+ @if ($company[0]->flots->count()) + @foreach ($company[0]->flots as $flot) + + {{ $flot->name }} + {{ $flot->region }} + {{ $flot->power }} + + @endforeach + @endif +
+
+ +
+
+ @foreach ($company[0]->ads as $job) + @foreach ($job->ad_job as $item) +
+
+ + {{ $job->name }} + {{ $job->name }} +
+
{{ $item->flot }}
+
+
+ {{ $item->job_title->name }} +
+
+

Зарплата:{{ $item->min_salary }} - {{ $item->max_salary }}р + {{ $item->sytki }} суточные.

+

Контракт: {{ $item->period }} мес.

+
+
+
+
Район работы
+
+

{{ $item->region }}

+
+
+
+
Посадка
+
+

{{ $item->start }}

+ {!! $item->description !!} +
+
+
+
Звонить по вопросам на: +
+ +
+
+
Анкеты присылать на + почту: +
+ +
+
+ #{{ $item->job_title->name }} +
+
+ + + + +
+
+
{{ $job->updated_at }}
+ +
+
+ @endforeach + @endforeach + +
+
+
+
+
+
+
+@endsection diff --git a/resources/views/js/modals.blade.php b/resources/views/js/modals.blade.php index 9bffa1b..27bf5bc 100644 --- a/resources/views/js/modals.blade.php +++ b/resources/views/js/modals.blade.php @@ -1,7 +1,7 @@ + @endsection @@ -173,10 +238,10 @@
+ + +
+ +
+
+ Статус + {{ $status_work[$res->status_work] }} +
+
+ Имя работника + @if (isset($res->users)){{ $res->users->surname." ".$res->users->name_man." ".$res->users->surname2 }} @endif +
+
+ Номер телефона + {{ $res->telephone }} +
+
+ Электронный адрес + {{ $res->email }} +
+
+ Город проживания + {{ $res->city }} +
+
+ Опыт работы + {{ $res->experience }} +
+
+
+ Перейти в + резюме + + @endforeach + {{ $resumes->appends($_GET)->links('paginate') }} + @endif + +