From b52b1df0d9cc9a5d7c4417de46254fec9a47c781 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: Mon, 23 Oct 2023 18:26:19 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=BF=D1=86=D0=B8=D1=8F=20=D0=BF=D0=BE=D0=B4?= =?UTF-8?q?=D0=BD=D1=8F=D1=82=D0=B8=D1=8F=20=D0=B2=D0=B0=D0=BA=D0=B0=D0=BD=D1?= =?UTF-8?q?=81=D0=B8=D0=B9,=20=D0=B8=20=D1=81=D1=87=D0=B5=D1=82=D1=87=D0=B8=D0?= =?UTF-8?q?=BA=20=D1=81=D1=82=D0=B0=D1=82=D0=B8=D1=81=D1=82=D0=B8=D0=BA=D0=B0?= =?UTF-8?q?=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Admin/Ad_EmployersController.php | 20 +++- app/Http/Controllers/WorkerController.php | 40 ++++++++ resources/views/admin/ad_employers/index.blade.php | 84 ++++++++++++---- .../views/admin/ad_employers/index_ajax.blade.php | 105 ++++++++++++++++++++ resources/views/public/workers/profile.blade.php | 27 +++++ routes/web.php | 10 +- 6 files changed, 261 insertions(+), 25 deletions(-) create mode 100644 app/Http/Controllers/WorkerController.php create mode 100644 resources/views/admin/ad_employers/index_ajax.blade.php create mode 100644 resources/views/public/workers/profile.blade.php diff --git a/app/Http/Controllers/Admin/Ad_EmployersController.php b/app/Http/Controllers/Admin/Ad_EmployersController.php index 1675f31..c5c1158 100644 --- a/app/Http/Controllers/Admin/Ad_EmployersController.php +++ b/app/Http/Controllers/Admin/Ad_EmployersController.php @@ -4,8 +4,10 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use App\Models\Ad_employer; +use App\Models\Employer; use App\Models\Job_title; use App\Models\User; +use Carbon\Carbon; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Validator; @@ -20,11 +22,23 @@ class Ad_EmployersController extends Controller public function index(Request $request) { $title = 'Админка - Вакансии работодателей'; - $ad_employers = Ad_employer::with('employer')->with('jobs') - ->where('is_remove', '0')->paginate(15); + if ($request->ajax()) { + $params = $request->all(); + foreach ($params['data'] as $item) { + $emp = Ad_employer::find($item); + $emp->updated_at = Carbon::now(); + $emp->save(); + } + } - return view('admin.ad_employers.index', compact('ad_employers', 'title')); + $ad_employers = Ad_employer::with('employer')->with('jobs') + ->where('is_remove', '0')->OrderBy('updated_at', 'desc')->paginate(15); + if ($request->ajax()) { + return view('admin.ad_employers.index_ajax', compact('ad_employers', 'params')); + } else { + return view('admin.ad_employers.index', compact('ad_employers', 'title')); + } } /** diff --git a/app/Http/Controllers/WorkerController.php b/app/Http/Controllers/WorkerController.php new file mode 100644 index 0000000..6a5dead --- /dev/null +++ b/app/Http/Controllers/WorkerController.php @@ -0,0 +1,40 @@ +where('year_month', '=', $get_date) + ->where('user_id', '=', $worker->users->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->users->id) + ->get(); + + return view('public.workers.profile', compact('worker', 'stat')); + } +} diff --git a/resources/views/admin/ad_employers/index.blade.php b/resources/views/admin/ad_employers/index.blade.php index a2158fe..bdf6fe4 100644 --- a/resources/views/admin/ad_employers/index.blade.php +++ b/resources/views/admin/ad_employers/index.blade.php @@ -1,6 +1,40 @@ @extends('layout.admin', ['title' => 'Админка - Вакансии']) @section('script') + @endsection @section('search') @@ -8,6 +42,9 @@ @endsection @section('content') +
@@ -15,31 +52,35 @@ - - - - - - - - - - + + + + + + + + + + + @foreach($ad_employers as $ad) - + - - - - - - - - -
Название объявленияНазвание компанииДолжностиИзбранныеСрочныеСтатусДата создан.Дата изменен.ИзменитьНазвание объявленияНазвание компанииДолжностиИзбранныеСрочныеСтатусДата создан.Дата изменен.Изменить
+ + + {{$ad->id}} + {{$ad->name}} + {{$ad->employer->name_company}} +
@if ($ad->jobs->count())
@@ -59,7 +100,7 @@
+ @if ($ad->favorite_vacancy==1) Да @@ -71,7 +112,7 @@ @endif + @if ($ad->sroch_vacancy==1) Да @@ -83,16 +124,19 @@ @endif + {{ $ad->status }} + + {{ date('d.m.Y', strtotime($ad->created_at)) }} + + {{ date('d.m.Y', strtotime($ad->updated_at)) }} + + Изменить diff --git a/resources/views/admin/ad_employers/index_ajax.blade.php b/resources/views/admin/ad_employers/index_ajax.blade.php new file mode 100644 index 0000000..70140ef --- /dev/null +++ b/resources/views/admin/ad_employers/index_ajax.blade.php @@ -0,0 +1,105 @@ +
+ + + + + + + + + + + + + + + + + + @foreach($ad_employers as $ad) + + + + + + + + + + + + + + + + + + + + @endforeach + +
Название объявленияНазвание компанииДолжностиИзбранныеСрочныеСтатусДата создан.Дата изменен.Изменить
+ + + {{$ad->id}} + + {{$ad->name}} + + {{$ad->employer->name_company}} + +
+ @if ($ad->jobs->count()) +
+ + @foreach ($ad->jobs as $title) + +

{{$title->name}}

+ +

/ {{$title->name}}

+ + @endforeach +
+ @endif +
+ +
+ @if ($ad->favorite_vacancy==1) + + Да + + @else + + Нет + + @endif + + @if ($ad->sroch_vacancy==1) + + Да + + @else + + Нет + + @endif + + {{ $ad->status }} + + {{ date('d.m.Y', strtotime($ad->created_at)) }} + + {{ date('d.m.Y', strtotime($ad->updated_at)) }} + + + Изменить + +
+
+ +
+ appends($_GET)->links('admin.pagginate'); ?> +
+ diff --git a/resources/views/public/workers/profile.blade.php b/resources/views/public/workers/profile.blade.php new file mode 100644 index 0000000..0e56db4 --- /dev/null +++ b/resources/views/public/workers/profile.blade.php @@ -0,0 +1,27 @@ +@extends('layouts.app', ['title' => 'Профиль пользователя - '.$worker->users->name_man.'('.$worker->users->id.')']) + +@section('content') +
+
+
+
+
Профиль пользователя - {{$worker->users->name_man}}({{$worker->users->id}})
+
+

Имя: {{ $worker->users->name_man }}

+

Фамилия: {{ $worker->users->surname }}

+

Отчество: {{ $worker->users->surname2 }}

+
+ + @if (isset($stat[0])) + +

Количество просмотров: {{ $stat[0]->lookin}}

+

Количество сообщений: {{ $stat[0]->message}}

+ + @endif + +
+
+
+
+
+@endsection diff --git a/routes/web.php b/routes/web.php index d05677f..745b3af 100644 --- a/routes/web.php +++ b/routes/web.php @@ -13,6 +13,7 @@ use App\Http\Controllers\Auth\ForgotPasswordController; use App\Http\Controllers\Auth\LoginController; use App\Http\Controllers\Auth\RegisterController; use App\Http\Controllers\CKEditorController; +use App\Http\Controllers\WorkerController; use App\Models\User; use App\Http\Controllers\MainController; use App\Http\Controllers\HomeController; @@ -348,10 +349,15 @@ Route::group([ }); +// Инструментальные страницы Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload'); -Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page'); - Route::get('redis/', [PagesController::class, 'redis'])->name('redis'); Route::get('excel/', [PagesController::class, 'excel'])->name('excel'); + +// Страницы с произвольным контентом +Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page'); + +// Публичные страницы соискателя +Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page'); -- 1.7.10.4