Commit b52b1df0d9cc9a5d7c4417de46254fec9a47c781
1 parent
eae6b80f5e
Exists in
master
and in
1 other branch
Опция поднятия вакансий, и счетчик статистика работников
Showing 6 changed files with 261 additions and 25 deletions Side-by-side Diff
app/Http/Controllers/Admin/Ad_EmployersController.php
... | ... | @@ -4,8 +4,10 @@ namespace App\Http\Controllers\Admin; |
4 | 4 | |
5 | 5 | use App\Http\Controllers\Controller; |
6 | 6 | use App\Models\Ad_employer; |
7 | +use App\Models\Employer; | |
7 | 8 | use App\Models\Job_title; |
8 | 9 | use App\Models\User; |
10 | +use Carbon\Carbon; | |
9 | 11 | use Illuminate\Http\Request; |
10 | 12 | use Illuminate\Support\Facades\Auth; |
11 | 13 | use Illuminate\Support\Facades\Validator; |
... | ... | @@ -20,11 +22,23 @@ class Ad_EmployersController extends Controller |
20 | 22 | public function index(Request $request) |
21 | 23 | { |
22 | 24 | $title = 'Админка - Вакансии работодателей'; |
23 | - $ad_employers = Ad_employer::with('employer')->with('jobs') | |
24 | - ->where('is_remove', '0')->paginate(15); | |
25 | + if ($request->ajax()) { | |
26 | + $params = $request->all(); | |
27 | + foreach ($params['data'] as $item) { | |
28 | + $emp = Ad_employer::find($item); | |
29 | + $emp->updated_at = Carbon::now(); | |
30 | + $emp->save(); | |
31 | + } | |
32 | + } | |
25 | 33 | |
26 | - return view('admin.ad_employers.index', compact('ad_employers', 'title')); | |
34 | + $ad_employers = Ad_employer::with('employer')->with('jobs') | |
35 | + ->where('is_remove', '0')->OrderBy('updated_at', 'desc')->paginate(15); | |
27 | 36 | |
37 | + if ($request->ajax()) { | |
38 | + return view('admin.ad_employers.index_ajax', compact('ad_employers', 'params')); | |
39 | + } else { | |
40 | + return view('admin.ad_employers.index', compact('ad_employers', 'title')); | |
41 | + } | |
28 | 42 | } |
29 | 43 | |
30 | 44 | /** |
app/Http/Controllers/WorkerController.php
... | ... | @@ -0,0 +1,40 @@ |
1 | +<?php | |
2 | + | |
3 | +namespace App\Http\Controllers; | |
4 | + | |
5 | +use App\Models\Static_worker; | |
6 | +use App\Models\Worker; | |
7 | +use Illuminate\Http\Request; | |
8 | + | |
9 | +class WorkerController extends Controller | |
10 | +{ | |
11 | + public function index() { | |
12 | + | |
13 | + } | |
14 | + | |
15 | + public function profile(Worker $worker) { | |
16 | + $get_date = '2023.12'; //date('Y.m'); | |
17 | + | |
18 | + $c = Static_worker::query()->where('year_month', '=', $get_date) | |
19 | + ->where('user_id', '=', $worker->users->id) | |
20 | + ->get(); | |
21 | + | |
22 | + if ($c->count() > 0) { | |
23 | + $upd = Static_worker::find($c[0]->id); | |
24 | + $upd->lookin = $upd->lookin + 1; | |
25 | + $upd->save(); | |
26 | + } else { | |
27 | + $crt = new Static_worker(); | |
28 | + $crt->lookin = 1; | |
29 | + $crt->year_month = $get_date; | |
30 | + $crt->user_id = $worker->user_id; | |
31 | + $crt->save(); | |
32 | + } | |
33 | + | |
34 | + $stat = Static_worker::query()->where('year_month', '=', $get_date) | |
35 | + ->where('user_id', '=', $worker->users->id) | |
36 | + ->get(); | |
37 | + | |
38 | + return view('public.workers.profile', compact('worker', 'stat')); | |
39 | + } | |
40 | +} |
resources/views/admin/ad_employers/index.blade.php
1 | 1 | @extends('layout.admin', ['title' => 'Админка - Вакансии']) |
2 | 2 | |
3 | 3 | @section('script') |
4 | + <script> | |
5 | + $(document).ready(function() { | |
6 | + $(document).on('click', '#refresh_btn', function () { | |
7 | + var this_ = $(this); | |
8 | + var ajax_block = $('#ajax_block'); | |
9 | + var mas = []; | |
10 | + var str_get = ''; | |
11 | + | |
12 | + $('input:checkbox:checked').each(function(){ | |
13 | + mas.push($(this).val()); | |
14 | + console.log($(this).val()); | |
15 | + }); | |
16 | + | |
17 | + $.ajax({ | |
18 | + type: "GET", | |
19 | + dataType: 'html', | |
20 | + url: "{{ url()->full()}}", | |
21 | + data: ({data:mas}), | |
22 | + success: function (data) { | |
23 | + console.log('Обновление таблицы пользователей '); | |
24 | + //data = JSON.parse(data); | |
25 | + //console.log(data); | |
26 | + ajax_block.html(data); | |
27 | + }, | |
28 | + headers: { | |
29 | + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | |
30 | + }, | |
31 | + error: function (data) { | |
32 | + console.log('Error: ' + data); | |
33 | + } | |
34 | + }); | |
35 | + }); | |
36 | + }); | |
37 | + </script> | |
4 | 38 | @endsection |
5 | 39 | |
6 | 40 | @section('search') |
... | ... | @@ -8,6 +42,9 @@ |
8 | 42 | @endsection |
9 | 43 | |
10 | 44 | @section('content') |
45 | + <button style="margin-bottom: 10px; width:165px" id="refresh_btn" name="refresh_btn" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"> | |
46 | + Обновить вакансии | |
47 | + </button> | |
11 | 48 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> |
12 | 49 | <div class="w-full overflow-x-auto"> |
13 | 50 | <table class="w-full whitespace-no-wrap"> |
... | ... | @@ -15,31 +52,35 @@ |
15 | 52 | <tr |
16 | 53 | class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800" |
17 | 54 | > |
18 | - <th class="px-4 py-3">№</th> | |
19 | - <th class="px-4 py-3">Название объявления</th> | |
20 | - <th class="px-4 py-3">Название компании</th> | |
21 | - <th class="px-4 py-3">Должности</th> | |
22 | - <th class="px-4 py-3">Избранные</th> | |
23 | - <th class="px-4 py-3">Срочные</th> | |
24 | - <th class="px-4 py-3">Статус</th> | |
25 | - <th class="px-4 py-3">Дата создан.</th> | |
26 | - <th class="px-4 py-3">Дата изменен.</th> | |
27 | - <th class="px-4 py-3">Изменить</th> | |
55 | + <th class="px-4 py-3"></th> | |
56 | + <th class="px-4 py-3 class1">№</th> | |
57 | + <th class="px-4 py-3 class2">Название объявления</th> | |
58 | + <th class="px-4 py-3 class3">Название компании</th> | |
59 | + <th class="px-4 py-3 class4">Должности</th> | |
60 | + <th class="px-4 py-3 class5">Избранные</th> | |
61 | + <th class="px-4 py-3 class6">Срочные</th> | |
62 | + <th class="px-4 py-3 class7">Статус</th> | |
63 | + <th class="px-4 py-3 class8">Дата создан.</th> | |
64 | + <th class="px-4 py-3 class9">Дата изменен.</th> | |
65 | + <th class="px-4 py-3 class10">Изменить</th> | |
28 | 66 | </tr> |
29 | 67 | </thead> |
30 | 68 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> |
31 | 69 | @foreach($ad_employers as $ad) |
32 | 70 | <tr class="text-gray-700 dark:text-gray-400"> |
33 | - <td class="px-4 py-3"> | |
71 | + <td class="px-4 py-3 class1"> | |
72 | + <input type="checkbox" class="box" name="vacan_{{$ad->id}}" id="vacan_{{$ad->id}}" value="{{$ad->id}}"/> | |
73 | + </td> | |
74 | + <td class="px-4 py-3 class1"> | |
34 | 75 | {{$ad->id}} |
35 | 76 | </td> |
36 | - <td class="px-4 py-3"> | |
77 | + <td class="px-4 py-3 class2"> | |
37 | 78 | {{$ad->name}} |
38 | 79 | </td> |
39 | - <td class="px-4 py-3"> | |
80 | + <td class="px-4 py-3 class3"> | |
40 | 81 | {{$ad->employer->name_company}} |
41 | 82 | </td> |
42 | - <td class="px-4 py-3"> | |
83 | + <td class="px-4 py-3 class4"> | |
43 | 84 | <div class="flex items-center text-sm"> |
44 | 85 | @if ($ad->jobs->count()) |
45 | 86 | <div> |
... | ... | @@ -59,7 +100,7 @@ |
59 | 100 | |
60 | 101 | </td> |
61 | 102 | |
62 | - <td class="px-4 py-3 text-sm"> | |
103 | + <td class="px-4 py-3 text-sm class5"> | |
63 | 104 | @if ($ad->favorite_vacancy==1) |
64 | 105 | <span class="px-2 py-1 font-semibold leading-tight text-green-700 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100"> |
65 | 106 | Да |
... | ... | @@ -71,7 +112,7 @@ |
71 | 112 | @endif |
72 | 113 | </td> |
73 | 114 | |
74 | - <td class="px-4 py-3 text-sm"> | |
115 | + <td class="px-4 py-3 text-sm class6"> | |
75 | 116 | @if ($ad->sroch_vacancy==1) |
76 | 117 | <span class="px-2 py-1 font-semibold leading-tight text-green-700 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100"> |
77 | 118 | Да |
... | ... | @@ -83,16 +124,19 @@ |
83 | 124 | @endif |
84 | 125 | </td> |
85 | 126 | |
86 | - <td class="px-4 py-3 text-sm"> | |
127 | + <td class="px-4 py-3 text-sm class7"> | |
87 | 128 | {{ $ad->status }} |
88 | 129 | </td> |
89 | - <td class="px-4 py-3 text-sm"> | |
130 | + | |
131 | + <td class="px-4 py-3 text-sm class8"> | |
90 | 132 | {{ date('d.m.Y', strtotime($ad->created_at)) }} |
91 | 133 | </td> |
92 | - <td class="px-4 py-3 text-sm"> | |
134 | + | |
135 | + <td class="px-4 py-3 text-sm class9"> | |
93 | 136 | {{ date('d.m.Y', strtotime($ad->updated_at)) }} |
94 | 137 | </td> |
95 | - <td class="px-4 py-3 text-sm"> | |
138 | + | |
139 | + <td class="px-4 py-3 text-sm class10"> | |
96 | 140 | <a href="{{ route('admin.edit-ad-employers', ['ad_employer' => $ad->id]) }}"> |
97 | 141 | Изменить |
98 | 142 | </a> |
resources/views/admin/ad_employers/index_ajax.blade.php
... | ... | @@ -0,0 +1,105 @@ |
1 | + <div class="w-full overflow-x-auto"> | |
2 | + <table class="w-full whitespace-no-wrap"> | |
3 | + <thead> | |
4 | + <tr | |
5 | + class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800" | |
6 | + > | |
7 | + <th class="px-4 py-3"></th> | |
8 | + <th class="px-4 py-3 class1">№</th> | |
9 | + <th class="px-4 py-3 class2">Название объявления</th> | |
10 | + <th class="px-4 py-3 class3">Название компании</th> | |
11 | + <th class="px-4 py-3 class4">Должности</th> | |
12 | + <th class="px-4 py-3 class5">Избранные</th> | |
13 | + <th class="px-4 py-3 class6">Срочные</th> | |
14 | + <th class="px-4 py-3 class7">Статус</th> | |
15 | + <th class="px-4 py-3 class8">Дата создан.</th> | |
16 | + <th class="px-4 py-3 class9">Дата изменен.</th> | |
17 | + <th class="px-4 py-3 class10">Изменить</th> | |
18 | + </tr> | |
19 | + </thead> | |
20 | + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | |
21 | + @foreach($ad_employers as $ad) | |
22 | + <tr class="text-gray-700 dark:text-gray-400"> | |
23 | + <td class="px-4 py-3 class1"> | |
24 | + <input type="checkbox" class="box" name="vacan_{{$ad->id}}" id="vacan_{{$ad->id}}" value="{{$ad->id}}"/> | |
25 | + </td> | |
26 | + <td class="px-4 py-3 class1"> | |
27 | + {{$ad->id}} | |
28 | + </td> | |
29 | + <td class="px-4 py-3 class2"> | |
30 | + {{$ad->name}} | |
31 | + </td> | |
32 | + <td class="px-4 py-3 class3"> | |
33 | + {{$ad->employer->name_company}} | |
34 | + </td> | |
35 | + <td class="px-4 py-3 class4"> | |
36 | + <div class="flex items-center text-sm"> | |
37 | + @if ($ad->jobs->count()) | |
38 | + <div> | |
39 | + <?php $i = 0;?> | |
40 | + @foreach ($ad->jobs as $title) | |
41 | + <?php if ($i==0) {?> | |
42 | + <p class="font-semibold">{{$title->name}}</p> | |
43 | + <?php } else {?> | |
44 | + <p class="font-semibold">/ {{$title->name}}</p> | |
45 | + <?php } | |
46 | + $i++; | |
47 | + ?> | |
48 | + @endforeach | |
49 | + </div> | |
50 | + @endif | |
51 | + </div> | |
52 | + | |
53 | + </td> | |
54 | + | |
55 | + <td class="px-4 py-3 text-sm class5"> | |
56 | + @if ($ad->favorite_vacancy==1) | |
57 | + <span class="px-2 py-1 font-semibold leading-tight text-green-700 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100"> | |
58 | + Да | |
59 | + </span> | |
60 | + @else | |
61 | + <span class="px-2 py-1 font-semibold leading-tight text-orange-700 bg-orange-100 rounded-full dark:text-white dark:bg-orange-600"> | |
62 | + Нет | |
63 | + </span> | |
64 | + @endif | |
65 | + </td> | |
66 | + | |
67 | + <td class="px-4 py-3 text-sm class6"> | |
68 | + @if ($ad->sroch_vacancy==1) | |
69 | + <span class="px-2 py-1 font-semibold leading-tight text-green-700 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100"> | |
70 | + Да | |
71 | + </span> | |
72 | + @else | |
73 | + <span class="px-2 py-1 font-semibold leading-tight text-orange-700 bg-orange-100 rounded-full dark:text-white dark:bg-orange-600"> | |
74 | + Нет | |
75 | + </span> | |
76 | + @endif | |
77 | + </td> | |
78 | + | |
79 | + <td class="px-4 py-3 text-sm class7"> | |
80 | + {{ $ad->status }} | |
81 | + </td> | |
82 | + | |
83 | + <td class="px-4 py-3 text-sm class8"> | |
84 | + {{ date('d.m.Y', strtotime($ad->created_at)) }} | |
85 | + </td> | |
86 | + | |
87 | + <td class="px-4 py-3 text-sm class9"> | |
88 | + {{ date('d.m.Y', strtotime($ad->updated_at)) }} | |
89 | + </td> | |
90 | + | |
91 | + <td class="px-4 py-3 text-sm class10"> | |
92 | + <a href="{{ route('admin.edit-ad-employers', ['ad_employer' => $ad->id]) }}"> | |
93 | + Изменить | |
94 | + </a> | |
95 | + </td> | |
96 | + </tr> | |
97 | + @endforeach | |
98 | + </tbody> | |
99 | + </table> | |
100 | + </div> | |
101 | + | |
102 | + <div class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800"> | |
103 | + <?=$ad_employers->appends($_GET)->links('admin.pagginate'); ?> | |
104 | + </div> | |
105 | + |
resources/views/public/workers/profile.blade.php
... | ... | @@ -0,0 +1,27 @@ |
1 | +@extends('layouts.app', ['title' => 'Профиль пользователя - '.$worker->users->name_man.'('.$worker->users->id.')']) | |
2 | + | |
3 | +@section('content') | |
4 | + <div class="container"> | |
5 | + <div class="row justify-content-center"> | |
6 | + <div class="col-md-8"> | |
7 | + <div class="card"> | |
8 | + <div class="card-header">Профиль пользователя - {{$worker->users->name_man}}({{$worker->users->id}})</div> | |
9 | + <div class="card-body"> | |
10 | + <p>Имя: {{ $worker->users->name_man }}</p> | |
11 | + <p>Фамилия: {{ $worker->users->surname }}</p> | |
12 | + <p>Отчество: {{ $worker->users->surname2 }}</p> | |
13 | + <br> | |
14 | + | |
15 | + @if (isset($stat[0])) | |
16 | + | |
17 | + <p>Количество просмотров: {{ $stat[0]->lookin}}</p> | |
18 | + <p>Количество сообщений: {{ $stat[0]->message}}</p> | |
19 | + | |
20 | + @endif | |
21 | + | |
22 | + </div> | |
23 | + </div> | |
24 | + </div> | |
25 | + </div> | |
26 | + </div> | |
27 | +@endsection |
routes/web.php
... | ... | @@ -13,6 +13,7 @@ use App\Http\Controllers\Auth\ForgotPasswordController; |
13 | 13 | use App\Http\Controllers\Auth\LoginController; |
14 | 14 | use App\Http\Controllers\Auth\RegisterController; |
15 | 15 | use App\Http\Controllers\CKEditorController; |
16 | +use App\Http\Controllers\WorkerController; | |
16 | 17 | use App\Models\User; |
17 | 18 | use App\Http\Controllers\MainController; |
18 | 19 | use App\Http\Controllers\HomeController; |
... | ... | @@ -348,10 +349,15 @@ Route::group([ |
348 | 349 | |
349 | 350 | }); |
350 | 351 | |
352 | +// Инструментальные страницы | |
351 | 353 | Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload'); |
352 | 354 | |
353 | -Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page'); | |
354 | - | |
355 | 355 | Route::get('redis/', [PagesController::class, 'redis'])->name('redis'); |
356 | 356 | |
357 | 357 | Route::get('excel/', [PagesController::class, 'excel'])->name('excel'); |
358 | + | |
359 | +// Страницы с произвольным контентом | |
360 | +Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page'); | |
361 | + | |
362 | +// Публичные страницы соискателя | |
363 | +Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page'); |