Commit 2e3ed5c890ffc845df524f5f4d65005d6ee90a9e

Authored by Андрей Ларионов
Exists in master

Merge branch 'master' of http://gitlab.nologostudio.ru/alarionov/rekamore-su

Showing 42 changed files Side-by-side Diff

app/Http/Controllers/Admin/Ad_EmployersController.php
... ... @@ -4,9 +4,11 @@ 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\Job_title;
7 8 use App\Models\User;
8 9 use Illuminate\Http\Request;
9 10 use Illuminate\Support\Facades\Auth;
  11 +use Illuminate\Support\Facades\Validator;
10 12  
11 13 class Ad_EmployersController extends Controller
12 14 {
... ... @@ -18,7 +20,8 @@ class Ad_EmployersController extends Controller
18 20 public function index(Request $request)
19 21 {
20 22 $title = 'Админка - Вакансии работодателей';
21   - $ad_employers = Ad_employer::where('is_remove', '0')->paginate(15);
  23 + $ad_employers = Ad_employer::with('employer')->with('jobs')
  24 + ->where('is_remove', '0')->paginate(15);
22 25  
23 26 return view('admin.ad_employers.index', compact('ad_employers', 'title'));
24 27  
... ... @@ -64,7 +67,14 @@ class Ad_EmployersController extends Controller
64 67 */
65 68 public function edit(Ad_employer $ad_employer)
66 69 {
67   - //
  70 + $sel = Array();
  71 + $job_titles = Job_title::active()->get();
  72 +
  73 + foreach ($ad_employer->jobs as $j) {
  74 + $sel[] = $j->id;
  75 + }
  76 +
  77 + return view('admin.ad_employers.edit', compact('ad_employer', 'job_titles', 'sel'));
68 78 }
69 79  
70 80 /**
... ... @@ -76,7 +86,27 @@ class Ad_EmployersController extends Controller
76 86 */
77 87 public function update(Request $request, Ad_employer $ad_employer)
78 88 {
79   - //
  89 + $params = $request->all();
  90 + unset($params->position_work);
  91 + $rules = [
  92 + 'name' => 'required|min:3',
  93 + ];
  94 + $messages = [
  95 + 'required' => 'Укажите обязательное поле',
  96 + ];
  97 + $validator = Validator::make($params, $rules, $messages);
  98 +
  99 + if ($validator->fails()) {
  100 + return redirect()->route('admin.edit-ad-employers', ['ad_employer' => $ad_employer->id])
  101 + ->withErrors($validator);
  102 + } else {
  103 + $ad_employer->update($params);
  104 + $ad_employer->jobs()->sync($request->position_work);
  105 +
  106 + return redirect()->route('admin.ad-employers')
  107 + ->with('success', 'Данные были успешно сохранены');
  108 + }
  109 + return redirect()->route('admin.ad-employers');
80 110 }
81 111  
82 112 /**
app/Http/Controllers/Admin/CategoryEmpController.php
... ... @@ -0,0 +1,95 @@
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Admin;
  4 +
  5 +use App\Http\Controllers\Controller;
  6 +use App\Http\Requests\CategoryEmpRequest;
  7 +use App\Models\CategoryEmp;
  8 +use Illuminate\Http\Request;
  9 +
  10 +class CategoryEmpController extends Controller
  11 +{
  12 + /**
  13 + * Display a listing of the resource.
  14 + *
  15 + * @return \Illuminate\Http\Response
  16 + */
  17 + public function index()
  18 + {
  19 + $category = CategoryEmp::query()->active()->paginate(15);
  20 + return view('admin.category-emp.index', compact('category'));
  21 + }
  22 +
  23 + /**
  24 + * Show the form for creating a new resource.
  25 + *
  26 + * @return \Illuminate\Http\Response
  27 + */
  28 + public function create()
  29 + {
  30 + return view('admin.category-emp.add');
  31 + }
  32 +
  33 + /**
  34 + * Store a newly created resource in storage.
  35 + *
  36 + * @param \Illuminate\Http\Request $request
  37 + * @return \Illuminate\Http\Response
  38 + */
  39 + public function store(CategoryEmpRequest $request)
  40 + {
  41 + CategoryEmp::create($request->all());
  42 + return redirect()->route('admin.category-emp.index');
  43 + }
  44 +
  45 + /**
  46 + * Display the specified resource.
  47 + *
  48 + * @param \App\Models\CategoryEmp $categoryEmp
  49 + * @return \Illuminate\Http\Response
  50 + */
  51 + public function show(CategoryEmp $category_emp)
  52 + {
  53 + //
  54 + }
  55 +
  56 + /**
  57 + * Show the form for editing the specified resource.
  58 + *
  59 + * @param \App\Models\CategoryEmp $categoryEmp
  60 + * @return \Illuminate\Http\Response
  61 + */
  62 + public function edit(CategoryEmp $category_emp)
  63 + {
  64 + return view('admin.category-emp.edit', compact('category_emp'));
  65 + }
  66 +
  67 + /**
  68 + * Update the specified resource in storage.
  69 + *
  70 + * @param \Illuminate\Http\Request $request
  71 + * @param \App\Models\CategoryEmp $categoryEmp
  72 + * @return \Illuminate\Http\Response
  73 + */
  74 + public function update(CategoryEmpRequest $request, CategoryEmp $category_emp)
  75 + {
  76 + $category_emp->update($request->all());
  77 + return redirect()->route('admin.category-emp.index');
  78 + }
  79 +
  80 + /**
  81 + * Remove the specified resource from storage.
  82 + *
  83 + * @param \App\Models\CategoryEmp $categoryEmp
  84 + * @return \Illuminate\Http\Response
  85 + */
  86 + public function destroy(CategoryEmp $category_emp)
  87 + {
  88 + /*if (Auth::user()->id == 1) {
  89 + $category->delete();
  90 + } else {*/
  91 + $category_emp->update(['is_remove' => 1]);
  92 + //}
  93 + return redirect()->route('admin.category-emp.index');
  94 + }
  95 +}
app/Http/Controllers/Admin/EducationController.php
... ... @@ -0,0 +1,91 @@
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Admin;
  4 +
  5 +use App\Http\Controllers\Controller;
  6 +use App\Http\Requests\EducationRequest;
  7 +use App\Models\Education;
  8 +use Illuminate\Http\Request;
  9 +
  10 +class EducationController extends Controller
  11 +{
  12 + /**
  13 + * Display a listing of the resource.
  14 + *
  15 + * @return \Illuminate\Http\Response
  16 + */
  17 + public function index()
  18 + {
  19 + $education = Education::query()->active()->paginate(15);
  20 + return view('admin.education.index', compact('education'));
  21 + }
  22 +
  23 + /**
  24 + * Show the form for creating a new resource.
  25 + *
  26 + * @return \Illuminate\Http\Response
  27 + */
  28 + public function create()
  29 + {
  30 + return view('admin.education.add');
  31 + }
  32 +
  33 + /**
  34 + * Store a newly created resource in storage.
  35 + *
  36 + * @param \Illuminate\Http\Request $request
  37 + * @return \Illuminate\Http\Response
  38 + */
  39 + public function store(EducationRequest $request)
  40 + {
  41 + Education::create($request->all());
  42 + return redirect()->route('admin.education.index');
  43 + }
  44 +
  45 + /**
  46 + * Display the specified resource.
  47 + *
  48 + * @param \App\Models\Education $education
  49 + * @return \Illuminate\Http\Response
  50 + */
  51 + public function show(Education $education)
  52 + {
  53 + //
  54 + }
  55 +
  56 + /**
  57 + * Show the form for editing the specified resource.
  58 + *
  59 + * @param \App\Models\Education $education
  60 + * @return \Illuminate\Http\Response
  61 + */
  62 + public function edit(Education $education)
  63 + {
  64 + return view('admin.education.edit', compact('education'));
  65 + }
  66 +
  67 + /**
  68 + * Update the specified resource in storage.
  69 + *
  70 + * @param \Illuminate\Http\Request $request
  71 + * @param \App\Models\Education $education
  72 + * @return \Illuminate\Http\Response
  73 + */
  74 + public function update(EducationRequest $request, Education $education)
  75 + {
  76 + $education->update($request->all());
  77 + return redirect()->route('admin.education.index');
  78 + }
  79 +
  80 + /**
  81 + * Remove the specified resource from storage.
  82 + *
  83 + * @param \App\Models\Education $education
  84 + * @return \Illuminate\Http\Response
  85 + */
  86 + public function destroy(Education $education)
  87 + {
  88 + $education->update(['is_remove' => 1]);
  89 + return redirect()->route('admin.education.index');
  90 + }
  91 +}
app/Http/Controllers/Admin/EmployersController.php
... ... @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Admin;
5 5 use App\Http\Controllers\Controller;
6 6 use App\Models\Ad_employer;
7 7 use App\Models\Answer;
  8 +use App\Models\CategoryEmp;
8 9 use App\Models\Employer;
9 10 use App\Models\Static_ad;
10 11 use App\Models\User;
... ... @@ -16,26 +17,27 @@ use Illuminate\Support\Facades\Validator;
16 17 class EmployersController extends Controller
17 18 {
18 19 public function index(Request $request) {
  20 + //$all_employer = User::where('is_worker', '0')->count();
  21 +
19 22 if ($request->ajax()) {
20 23 $user = User::find($request->id);
21 24 $request->offsetUnset('id');
22 25 $user->update($request->all());
23 26 }
24 27  
25   - /*$users = User::with('employers')->where('is_worker', '0');
26   - $find_key = "";
27   - if (isset($request->find)) {
28   - $find_key = $request->find;
29   - $users = $users->where(function($query) use($find_key) {
30   - $query->Where('name', 'LIKE', "%$find_key%")
31   - ->orWhere('email', 'LIKE', "%$find_key%")
32   - ->orWhere('telephone', 'LIKE', "%$find_key%");
33   - });
34   - }*/
35   -
36   - $users = User::select(['users.*','users.id as usr_id', 'emp.id as emp_id', 'emp.*'])->join('employers as emp','emp.user_id','users.id')
  28 + $users = User::with('employers')->select(['users.*','users.id as usr_id', 'emp.id as emp_id', 'emp.*'])->join('employers as emp','emp.user_id','users.id')
37 29 ->where('users.is_worker', '0');
  30 + $all_employer = $users->count();
  31 +
  32 + $find_cat = "";
  33 + if (isset($request->category)) {
  34 + if ($request->category != 'Все категории') {
  35 + $users = $users->where('category', '=', $request->category);
  36 + $find_cat = $request->category;
  37 + }
  38 + }
38 39 $find_key = "";
  40 +
39 41 if (isset($request->find)) {
40 42 $find_key = $request->find;
41 43 $users = $users->where(function($query) use($find_key) {
... ... @@ -49,15 +51,18 @@ class EmployersController extends Controller
49 51 $users = $users->paginate(15);
50 52 //dd(DB::getQueryLog());
51 53  
  54 + $select_category = CategoryEmp::query()->active()->get();
  55 +
52 56 if ($request->ajax()) {
53 57 return view('admin.employer.index_ajax', compact('users'));
54 58 } else {
55   - return view('admin.employer.index', compact('users', 'find_key'));
  59 + return view('admin.employer.index', compact('users', 'find_key', 'find_cat', 'all_employer', 'select_category'));
56 60 }
57 61 }
58 62  
59 63 public function form_update_employer(Employer $employer) {
60   - return view('admin.employer.edit', compact('employer'));
  64 + $select_category = CategoryEmp::query()->active()->get();
  65 + return view('admin.employer.edit', compact('employer', 'select_category'));
61 66 }
62 67  
63 68 public function update_employer(Employer $employer, Request $request)
... ... @@ -72,6 +77,8 @@ class EmployersController extends Controller
72 77 unset($params['oficial_status']);
73 78 unset($params['social_is']);
74 79 unset($params['sending_is']);
  80 + unset($params['category']);
  81 + unset($params['comment_admin']);
75 82  
76 83 $rules = [
77 84 'name' => 'required|string|max:255',
... ... @@ -109,6 +116,8 @@ class EmployersController extends Controller
109 116 $employer->oficial_status = $request->oficial_status;
110 117 $employer->social_is = $request->social_is;
111 118 $employer->sending_is = $request->sending_is;
  119 + $employer->category = $request->category;
  120 + $employer->comment_admin = $request->comment_admin;
112 121  
113 122 if ($request->has('logo')) {
114 123 if (!empty($employer->logo)) {
... ... @@ -126,6 +135,23 @@ class EmployersController extends Controller
126 135 }
127 136 }
128 137  
  138 + // Удаление работодателя, вакансий и профиля юзера
  139 + public function delete_employer(Employer $employer, User $user) {
  140 + try {
  141 + if (!empty($employer)) {
  142 + $employer->ads()->delete();
  143 + if (!empty($employer->logo)) {
  144 + Storage::delete($employer->logo);
  145 + }
  146 + $employer->delete();
  147 + }
  148 + } finally {
  149 + $user->delete();
  150 + }
  151 +
  152 + return redirect()->route('admin.employers')->with('success', 'Данные были удалены о работодателе');
  153 + }
  154 +
129 155 // кабинет - отзывы о работодателе для модерации
130 156 public function answers(Request $request) {
131 157 if ($request->ajax()) {
app/Http/Controllers/Admin/GroupsController.php
... ... @@ -17,7 +17,7 @@ class GroupsController extends Controller
17 17  
18 18 // индексная страница
19 19 public function index() {
20   - $groups = Group_user::query()->active()->paginate(15);
  20 + $groups = Group_user::with('user')->with('ingroup')->active()->paginate(15);
21 21 return view('admin.groups.index', compact('groups'));
22 22 }
23 23  
app/Http/Controllers/Admin/MsgAnswersController.php
... ... @@ -13,7 +13,7 @@ use Illuminate\Support\Facades\Validator;
13 13 class MsgAnswersController extends Controller
14 14 {
15 15 public function messages() {
16   - $Msgs = Message::query()->orderByDesc('created_at')->paginate(25);
  16 + $Msgs = Message::with('user_from')->with('user_to')->with('response')->orderByDesc('created_at')->paginate(25);
17 17  
18 18 return view('admin.messages', compact('Msgs'));
19 19 }
... ... @@ -28,7 +28,8 @@ class MsgAnswersController extends Controller
28 28 $id_admin = Auth::user()->id;
29 29 $users = User::query()->OrderBy('name')->get();
30 30  
31   - $Msgs = Message::query()->where('user_id', '=', $id_admin)
  31 + $Msgs = Message::with('user_from')->with('user_to')->with('response')
  32 + ->where('user_id', '=', $id_admin)
32 33 ->orWhere('to_user_id', '=', $id_admin)
33 34 ->orderByDesc('created_at')->paginate(5);
34 35  
app/Http/Controllers/Admin/WorkersController.php
... ... @@ -8,7 +8,9 @@ use App\Models\Job_title;
8 8 use App\Models\Static_worker;
9 9 use App\Models\User;
10 10 use App\Models\Worker;
  11 +use Illuminate\Database\Eloquent\Builder;
11 12 use Illuminate\Http\Request;
  13 +use Illuminate\Support\Facades\DB;
12 14 use Illuminate\Support\Facades\Storage;
13 15 use Illuminate\Support\Facades\Validator;
14 16  
... ... @@ -21,7 +23,41 @@ class WorkersController extends Controller
21 23 $user->update($request->all());
22 24 }
23 25  
24   - $users = User::where('is_worker', '1');
  26 + $status_work = Job_title::query()->active()->orderBy('name')->get();
  27 + $users = User::with('jobtitles')->where('is_worker', '1');
  28 +
  29 + $find_status_work = "";
  30 + if (isset($request->status_work)) {
  31 + $find_status_work = $request->status_work;
  32 + //$users = $users->where('position_work', '=', $find_status_work);
  33 +
  34 + /*if ($request->status_work > 0)
  35 + $users = $users->with(['workers' => function($query) use ($find_status_work){
  36 + $query->where('position_work', $find_status_work);
  37 + }]);
  38 + else
  39 + $users = $users->with('workers');*/
  40 +
  41 + /*$users = $users->where(function($query) use($find_status_work) {
  42 + $query->with(['workers' => function($query1) use ($find_status_work){
  43 + $query1->where('position_work', $find_status_work);
  44 + }]);
  45 + });*/
  46 + if ($request->status_work > 0) {
  47 + $users = $users->with('workers')->
  48 + whereHas('workers',
  49 + function (Builder $query) use ($find_status_work) {
  50 + $query->where('position_work', $find_status_work);
  51 + }
  52 + );
  53 + } else {
  54 + $users = $users->with('workers');
  55 + }
  56 +
  57 + } else {
  58 + $users = $users->with('workers');
  59 + }
  60 +
25 61 $find_key = "";
26 62 if (isset($request->find)) {
27 63 $find_key = $request->find;
... ... @@ -34,10 +70,46 @@ class WorkersController extends Controller
34 70  
35 71 $users = $users->paginate(15);
36 72  
  73 + /*
  74 + $Arr = array();
  75 + $where = '';
  76 + $find_status_work = "";
  77 + if (isset($request->status_work)) {
  78 + $find_status_work = $request->status_work;
  79 + //$users = $users->where('position_work', '=', $find_status_work);
  80 + $where.= ' and (w.position_work = :uid1)';
  81 + $Arr['uid1'] = $find_status_work;
  82 + }
  83 +
  84 + $find_key = "";
  85 + if (isset($request->find)) {
  86 + $find_key = $request->find;
  87 + /*$users = $users->where(function($query) use($find_key) {
  88 + $query->Where('name_man', 'LIKE', "%$find_key%")
  89 + ->orWhere('email', 'LIKE', "%$find_key%")
  90 + ->orWhere('telephone', 'LIKE', "%$find_key%");
  91 + });*/
  92 + /*$where.= " and ((u.name_man LIKE %:uid2%) or (w.email LIKE %:uid2%) or (w.telephone LIKE %:uid2%))";
  93 + $Arr['uid2'] = $find_key;
  94 + }
  95 +
  96 + //$users = $users->paginate(15);
  97 +
  98 + //DB::enableQueryLog();
  99 + $users = DB::select('SELECT u.*, w.*, j.*
  100 + FROM workers w
  101 + JOIN users u ON u.id = w.user_id
  102 + JOIN job_titles j ON j.id = w.position_work
  103 + Where (u.is_worker = 1)
  104 + '.$where, $Arr);
  105 + //dump(DB::getQueryLog());
  106 + dd($users);
  107 + */
  108 +
37 109 if ($request->ajax()) {
38 110 return view('admin.worker.index_ajax', compact('users'));
39 111 } else {
40   - return view('admin.worker.index', compact('users', 'find_key'));
  112 + return view('admin.worker.index', compact('users', 'find_key', 'find_status_work', 'status_work'));
41 113 }
42 114 }
43 115  
app/Http/Requests/CategoryEmpRequest.php
... ... @@ -0,0 +1,45 @@
  1 +<?php
  2 +
  3 +namespace App\Http\Requests;
  4 +
  5 +use Illuminate\Foundation\Http\FormRequest;
  6 +
  7 +class CategoryEmpRequest extends FormRequest
  8 +{
  9 + /**
  10 + * Determine if the user is authorized to make this request.
  11 + *
  12 + * @return bool
  13 + */
  14 + public function authorize()
  15 + {
  16 + return true;
  17 + }
  18 +
  19 + /**
  20 + * Get the validation rules that apply to the request.
  21 + *
  22 + * @return array<string, mixed>
  23 + */
  24 + public function rules()
  25 + {
  26 + return [
  27 + 'name' => 'required|min:3|max:255',
  28 + ];
  29 + }
  30 +
  31 + public function messages() {
  32 + return [
  33 + 'required' => 'Поле :attribute обязательно для ввода',
  34 + 'min' => [
  35 + 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
  36 + 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
  37 + ],
  38 + 'max' => [
  39 + 'string' => 'Поле «:attribute» должно быть не больше :max символов',
  40 + 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
  41 + ],
  42 +
  43 + ];
  44 + }
  45 +}
app/Http/Requests/EducationRequest.php
... ... @@ -0,0 +1,45 @@
  1 +<?php
  2 +
  3 +namespace App\Http\Requests;
  4 +
  5 +use Illuminate\Foundation\Http\FormRequest;
  6 +
  7 +class EducationRequest extends FormRequest
  8 +{
  9 + /**
  10 + * Determine if the user is authorized to make this request.
  11 + *
  12 + * @return bool
  13 + */
  14 + public function authorize()
  15 + {
  16 + return true;
  17 + }
  18 +
  19 + /**
  20 + * Get the validation rules that apply to the request.
  21 + *
  22 + * @return array<string, mixed>
  23 + */
  24 + public function rules()
  25 + {
  26 + return [
  27 + 'name' => 'required|min:3|max:255',
  28 + ];
  29 + }
  30 +
  31 + public function messages() {
  32 + return [
  33 + 'required' => 'Поле :attribute обязательно для ввода',
  34 + 'min' => [
  35 + 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
  36 + 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
  37 + ],
  38 + 'max' => [
  39 + 'string' => 'Поле «:attribute» должно быть не больше :max символов',
  40 + 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
  41 + ],
  42 +
  43 + ];
  44 + }
  45 +}
app/Models/Ad_employer.php
... ... @@ -21,6 +21,9 @@ class Ad_employer extends Model
21 21 'sort',
22 22 'is_remove',
23 23 'active_is',
  24 + 'status',
  25 + 'sroch_vacancy',
  26 + 'favorite_vacancy'
24 27 ];
25 28 /*
26 29 * Связь таблицы employers с таблицей ad_employers
app/Models/CategoryEmp.php
... ... @@ -0,0 +1,20 @@
  1 +<?php
  2 +
  3 +namespace App\Models;
  4 +
  5 +use Illuminate\Database\Eloquent\Factories\HasFactory;
  6 +use Illuminate\Database\Eloquent\Model;
  7 +
  8 +class CategoryEmp extends Model
  9 +{
  10 + use HasFactory;
  11 +
  12 + protected $fillable = [
  13 + 'name',
  14 + 'is_remove'
  15 + ];
  16 +
  17 + public function scopeActive($query) {
  18 + return $query->where('is_remove', '=', '0');
  19 + }
  20 +}
app/Models/Education.php
... ... @@ -0,0 +1,20 @@
  1 +<?php
  2 +
  3 +namespace App\Models;
  4 +
  5 +use Illuminate\Database\Eloquent\Factories\HasFactory;
  6 +use Illuminate\Database\Eloquent\Model;
  7 +
  8 +class Education extends Model
  9 +{
  10 + use HasFactory;
  11 +
  12 + protected $fillable = [
  13 + 'name',
  14 + 'is_remove'
  15 + ];
  16 +
  17 + public function scopeActive($query) {
  18 + return $query->where('is_remove', '=', '0');
  19 + }
  20 +}
... ... @@ -74,6 +74,14 @@ class User extends Authenticatable
74 74 }
75 75  
76 76 /*
  77 + * Связь Пользователей системы с работниками
  78 + * users - workers
  79 + */
  80 + public function work() {
  81 + return $this->hasMany(Worker::class, 'user_id')->select('telephone', 'email', 'position_work', 'persent_anketa');
  82 + }
  83 +
  84 + /*
77 85 * Связь Модели Пользователей(Users) с Группами (Group_users)
78 86 * users - group_users
79 87 многие-ко-многим
... ... @@ -106,6 +114,15 @@ class User extends Authenticatable
106 114 return $this->hasMany(Group_works::class);
107 115 }
108 116  
  117 + /*
  118 + * Связь Модели Пользователей(Users) с Группами (Group_users)
  119 + * users - group_users
  120 + многие-ко-многим
  121 + */
  122 + public function jobtitles() {
  123 + return $this->belongsToMany(Job_title::class, 'Workers', 'user_id', 'position_work');
  124 + }
  125 +
109 126 public function scopeActive($query) {
110 127 return $query->where('is_remove', '=', '0');
111 128 }
app/Providers/MyServiceProvider.php
... ... @@ -48,7 +48,7 @@ class MyServiceProvider extends ServiceProvider
48 48 }
49 49 );
50 50  
51   - $views2 = ['layout.admin'];
  51 + $views2 = ['layout.admin', 'admin.index'];
52 52  
53 53 View::composer($views2,
54 54 function($view){
... ... @@ -59,7 +59,7 @@ class MyServiceProvider extends ServiceProvider
59 59 '), ['uid' => $id]
60 60 );
61 61  
62   - $view->with(['MsgCount' => $query[0]->MsgCount]);
  62 + $view->with(['MsgCount' => $query[0]->MsgCount, 'UserId' => $id]);
63 63 }
64 64 );
65 65 }
database/migrations/2023_10_02_130611_alter_table_employers.php
... ... @@ -0,0 +1,34 @@
  1 +<?php
  2 +
  3 +use Illuminate\Database\Migrations\Migration;
  4 +use Illuminate\Database\Schema\Blueprint;
  5 +use Illuminate\Support\Facades\Schema;
  6 +
  7 +return new class extends Migration
  8 +{
  9 + /**
  10 + * Run the migrations.
  11 + *
  12 + * @return void
  13 + */
  14 + public function up()
  15 + {
  16 + Schema::table('employers', function (Blueprint $table) {
  17 + $table->text('comment_admin')->nullable();
  18 + $table->string('category', 255)->default('Не определен');
  19 + });
  20 + }
  21 +
  22 + /**
  23 + * Reverse the migrations.
  24 + *
  25 + * @return void
  26 + */
  27 + public function down()
  28 + {
  29 + Schema::table('employers', function (Blueprint $table) {
  30 + $table->dropColumn('comment_admin');
  31 + $table->dropColumn('category');
  32 + });
  33 + }
  34 +};
database/migrations/2023_10_02_130747_create_category_emps_table.php
... ... @@ -0,0 +1,33 @@
  1 +<?php
  2 +
  3 +use Illuminate\Database\Migrations\Migration;
  4 +use Illuminate\Database\Schema\Blueprint;
  5 +use Illuminate\Support\Facades\Schema;
  6 +
  7 +return new class extends Migration
  8 +{
  9 + /**
  10 + * Run the migrations.
  11 + *
  12 + * @return void
  13 + */
  14 + public function up()
  15 + {
  16 + Schema::create('category_emps', function (Blueprint $table) {
  17 + $table->id();
  18 + $table->string('name', 255)->nullable(false);
  19 + $table->boolean('is_remove')->default(false);
  20 + $table->timestamps();
  21 + });
  22 + }
  23 +
  24 + /**
  25 + * Reverse the migrations.
  26 + *
  27 + * @return void
  28 + */
  29 + public function down()
  30 + {
  31 + Schema::dropIfExists('category_emps');
  32 + }
  33 +};
database/migrations/2023_10_02_132059_alter_table_ad_employers.php
... ... @@ -0,0 +1,36 @@
  1 +<?php
  2 +
  3 +use Illuminate\Database\Migrations\Migration;
  4 +use Illuminate\Database\Schema\Blueprint;
  5 +use Illuminate\Support\Facades\Schema;
  6 +
  7 +return new class extends Migration
  8 +{
  9 + /**
  10 + * Run the migrations.
  11 + *
  12 + * @return void
  13 + */
  14 + public function up()
  15 + {
  16 + Schema::table('ad_employers', function (Blueprint $table) {
  17 + $table->boolean('sroch_vacancy')->default(0);
  18 + $table->boolean('favorite_vacancy')->default(0);
  19 + $table->string('status', 255)->default('Не задан');
  20 + });
  21 + }
  22 +
  23 + /**
  24 + * Reverse the migrations.
  25 + *
  26 + * @return void
  27 + */
  28 + public function down()
  29 + {
  30 + Schema::table('ad_employers', function (Blueprint $table) {
  31 + $table->dropColumn('sroch_vacancy');
  32 + $table->dropColumn('favorite_vacancy');
  33 + $table->dropColumn('status');
  34 + });
  35 + }
  36 +};
database/migrations/2023_10_03_114608_create_education_table.php
... ... @@ -0,0 +1,33 @@
  1 +<?php
  2 +
  3 +use Illuminate\Database\Migrations\Migration;
  4 +use Illuminate\Database\Schema\Blueprint;
  5 +use Illuminate\Support\Facades\Schema;
  6 +
  7 +return new class extends Migration
  8 +{
  9 + /**
  10 + * Run the migrations.
  11 + *
  12 + * @return void
  13 + */
  14 + public function up()
  15 + {
  16 + Schema::create('education', function (Blueprint $table) {
  17 + $table->id();
  18 + $table->string('name', 255)->nullable(false);
  19 + $table->boolean('is_remove')->default(false);
  20 + $table->timestamps();
  21 + });
  22 + }
  23 +
  24 + /**
  25 + * Reverse the migrations.
  26 + *
  27 + * @return void
  28 + */
  29 + public function down()
  30 + {
  31 + Schema::dropIfExists('education');
  32 + }
  33 +};
database/migrations/2023_10_03_114801_alter_table_workers.php
... ... @@ -0,0 +1,32 @@
  1 +<?php
  2 +
  3 +use Illuminate\Database\Migrations\Migration;
  4 +use Illuminate\Database\Schema\Blueprint;
  5 +use Illuminate\Support\Facades\Schema;
  6 +
  7 +return new class extends Migration
  8 +{
  9 + /**
  10 + * Run the migrations.
  11 + *
  12 + * @return void
  13 + */
  14 + public function up()
  15 + {
  16 + Schema::table('workers', function (Blueprint $table) {
  17 + $table->string('education', 255)->default('Не указано');
  18 + });
  19 + }
  20 +
  21 + /**
  22 + * Reverse the migrations.
  23 + *
  24 + * @return void
  25 + */
  26 + public function down()
  27 + {
  28 + Schema::table('workers', function (Blueprint $table) {
  29 + $table->dropColumn('education');
  30 + });
  31 + }
  32 +};
resources/views/admin/ad_employers/edit.blade.php
... ... @@ -0,0 +1,93 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Редактирование вакансии'])
  2 +
  3 +@section('script')
  4 +
  5 +@endsection
  6 +
  7 +@section('content')
  8 + <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">
  9 + Редактирование вакансии
  10 + </h4>
  11 + <form method="POST" action="{{ route('admin.update-ad-employers', ['ad_employer' => $ad_employer->id]) }}">
  12 + @csrf
  13 + <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
  14 + <label class="block text-sm">
  15 + <span class="text-gray-700 dark:text-gray-400">Название вакансии</span>
  16 + <input name="name" id="name"
  17 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  18 + placeholder="Название вакансии" value="{{ old('name') ?? $ad_employer->name ?? '' }}"
  19 + />
  20 + @error('name')
  21 + <span class="text-xs text-red-600 dark:text-red-400">
  22 + {{ $message }}
  23 + </span>
  24 + @enderror
  25 + </label>
  26 +
  27 + <label class="block mt-4 text-sm">
  28 + <span class="text-gray-700 dark:text-gray-400">
  29 + Категории должности
  30 + </span>
  31 + <select
  32 + class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-multiselect focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
  33 + multiple
  34 + name="position_work[]" id="position_work"
  35 + >
  36 + @foreach($job_titles as $job)
  37 + <option value="{{$job->id}}" @if (in_array($job->id, $sel)) selected @endif >
  38 + {{ $job->name }} ({{$job->id}})
  39 + </option>
  40 + @endforeach
  41 + </select>
  42 + </label>
  43 +
  44 + <label class="block mt-4 text-sm">
  45 + <span class="text-gray-700 dark:text-gray-400">
  46 + Статус вакансии
  47 + </span>
  48 + <select
  49 + class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-multiselect focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
  50 + name="status" id="status"
  51 + >
  52 + <option value="Не задан" @if ($ad_employer->status == "Не задан") selected @endif >
  53 + Не задан
  54 + </option>
  55 + <option value="Открыта" @if ($ad_employer->status == "Открыта") selected @endif >
  56 + Открыта
  57 + </option>
  58 + <option value="Закрыта" @if ($ad_employer->status == "Закрыта") selected @endif >
  59 + Закрыта
  60 + </option>
  61 + </select>
  62 + </label><br>
  63 +
  64 + <label class="block text-sm">
  65 + <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Срочная вакансия</p>
  66 + <input type="hidden" name="sroch_vacancy" value="0" />
  67 + <input name="sroch_vacancy" @if ($ad_employer->sroch_vacancy) checked @endif
  68 + class="block mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray "
  69 + placeholder="" type="checkbox" value="1"
  70 + /><br>
  71 +
  72 + <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Избранная вакансия</p>
  73 + <input type="hidden" name="favorite_vacancy" value="0" />
  74 + <input name="favorite_vacancy" id="favorite_vacancy" @if ($ad_employer->favorite_vacancy)checked @endif
  75 + class="block mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray "
  76 + placeholder="" type="checkbox" value="1"
  77 + /><br>
  78 + </label>
  79 +
  80 + <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
  81 + <div>
  82 + <button type="submit" 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">
  83 + Сохранить
  84 + </button>
  85 + <a href="{{ route('admin.ad-employers') }}"
  86 + 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"
  87 + style="display: -webkit-inline-box; height: 30px!important;"
  88 + >Назад</a>
  89 + </div>
  90 + </div>
  91 + </div>
  92 + </form>
  93 +@endsection
resources/views/admin/ad_employers/index.blade.php
... ... @@ -4,32 +4,7 @@
4 4 @endsection
5 5  
6 6 @section('search')
7   - <!--<div class="absolute inset-y-0 flex items-center pl-2">
8   - <svg
9   - class="w-4 h-4"
10   - aria-hidden="true"
11   - fill="currentColor"
12   - viewBox="0 0 20 20"
13   - >
14   - <path
15   - fill-rule="evenodd"
16   - d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z"
17   - clip-rule="evenodd"
18   - ></path>
19   - </svg>
20   - </div>
21   - <form action="" method="POST">
22   - <div style="float:left;"><input
23   - class="w-full pl-8 pr-2 text-sm text-gray-700 placeholder-gray-600 bg-gray-100 border-0 rounded-md dark:placeholder-gray-500 dark:focus:shadow-outline-gray dark:focus:placeholder-gray-600 dark:bg-gray-700 dark:text-gray-200 focus:placeholder-gray-500 focus:bg-white focus:border-purple-300 focus:outline-none focus:shadow-outline-purple form-input"
24   - style="width: 400px"
25   - type="text"
26   - placeholder="Искать компанию или вакансию"
27   - aria-label="Search"
28   - /></div>
29   - <div style="float: left">
30   - <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Поиск</button>
31   - </div>
32   - </form>-->
  7 +
33 8 @endsection
34 9  
35 10 @section('content')
... ... @@ -43,10 +18,13 @@
43 18 <th class="px-4 py-3">№</th>
44 19 <th class="px-4 py-3">Название объявления</th>
45 20 <th class="px-4 py-3">Название компании</th>
46   - <th class="px-4 py-3">Вакансии</th>
47   - <th class="px-4 py-3">Город</th>
48   - <th class="px-4 py-3">З/п</th>
49   - <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>
50 28 </tr>
51 29 </thead>
52 30 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
... ... @@ -80,15 +58,45 @@
80 58 </div>
81 59  
82 60 </td>
  61 +
  62 + <td class="px-4 py-3 text-sm">
  63 + @if ($ad->favorite_vacancy==1)
  64 + <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 + Да
  66 + </span>
  67 + @else
  68 + <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">
  69 + Нет
  70 + </span>
  71 + @endif
  72 + </td>
  73 +
83 74 <td class="px-4 py-3 text-sm">
84   - {{ $ad->city }}
  75 + @if ($ad->sroch_vacancy==1)
  76 + <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 + Да
  78 + </span>
  79 + @else
  80 + <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">
  81 + Нет
  82 + </span>
  83 + @endif
85 84 </td>
  85 +
86 86 <td class="px-4 py-3 text-sm">
87   - {{ $ad->salary }}
  87 + {{ $ad->status }}
88 88 </td>
89 89 <td class="px-4 py-3 text-sm">
90 90 {{ $ad->created_at }}
91 91 </td>
  92 + <td class="px-4 py-3 text-sm">
  93 + {{ $ad->updated_at }}
  94 + </td>
  95 + <td class="px-4 py-3 text-sm">
  96 + <a href="{{ route('admin.edit-ad-employers', ['ad_employer' => $ad->id]) }}">
  97 + Изменить
  98 + </a>
  99 + </td>
92 100 </tr>
93 101 @endforeach
94 102 </tbody>
resources/views/admin/category-emp/add.blade.php
... ... @@ -0,0 +1,7 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Добавление категории работодателей'])
  2 +
  3 +@section('content')
  4 + <form method="POST" action="{{ route('admin.category-emp.store') }}">
  5 + @include('admin.category-emp.form')
  6 + </form>
  7 +@endsection
resources/views/admin/category-emp/edit.blade.php
... ... @@ -0,0 +1,7 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Редактирование категории работодателей'])
  2 +
  3 +@section('content')
  4 + <form method="POST" action="{{ route('admin.category-emp.update', ['category_emp' => $category_emp->id]) }}">
  5 + @include('admin.category-emp.form')
  6 + </form>
  7 +@endsection
resources/views/admin/category-emp/form.blade.php
... ... @@ -0,0 +1,32 @@
  1 +@csrf
  2 +
  3 +@isset($category_emp)
  4 + @method('PUT')
  5 +@endisset
  6 +
  7 +<div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
  8 + <label class="block text-sm">
  9 + <span class="text-gray-700 dark:text-gray-400">Имя категории</span>
  10 + <input name="name" id="name"
  11 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  12 + placeholder="Имя категории" value="{{ old('name') ?? $category_emp->name ?? '' }}"
  13 + />
  14 + @error('name')
  15 + <span class="text-xs text-red-600 dark:text-red-400">
  16 + {{ $message }}
  17 + </span>
  18 + @enderror
  19 + </label><br>
  20 +
  21 + <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
  22 + <div>
  23 + <button type="submit" 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">
  24 + Сохранить
  25 + </button>
  26 + <a href="{{ route('admin.category-emp.index') }}"
  27 + 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"
  28 + style="display: -webkit-inline-box; height: 30px!important;"
  29 + >Назад</a>
  30 + </div>
  31 + </div>
  32 +</div>
resources/views/admin/category-emp/index.blade.php
... ... @@ -0,0 +1,61 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Категории работодателей'])
  2 +
  3 +@section('script')
  4 +
  5 +@endsection
  6 +
  7 +@section('search')
  8 +
  9 +@endsection
  10 +
  11 +@section('content')
  12 +
  13 + <a href="{{ route('admin.category-emp.create') }}" style="width: 175px" 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">
  14 + Добавить категорию
  15 + </a>
  16 + <br>
  17 + <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
  18 +
  19 + <div class="w-full overflow-x-auto">
  20 + <table class="w-full whitespace-no-wrap">
  21 + <thead>
  22 + <tr
  23 + 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"
  24 + >
  25 + <th class="px-4 py-3">№</th>
  26 + <th class="px-4 py-3">Название категории</th>
  27 + <th class="px-4 py-3">Дата создания</th>
  28 + <th class="px-4 py-3">Редактировать</th>
  29 + </tr>
  30 + </thead>
  31 + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
  32 + @foreach($category as $cat)
  33 + <tr class="text-gray-700 dark:text-gray-400">
  34 + <td class="px-4 py-3">
  35 + {{$cat->id}}
  36 + </td>
  37 + <td class="px-4 py-3">
  38 + {{$cat->name}}
  39 + </td>
  40 + <td class="px-4 py-3">
  41 + {{$cat->created_at}}
  42 + </td>
  43 + <td class="px-4 py-3 text-sm_">
  44 + <form action="{{ route('admin.category-emp.destroy', ['category_emp' => $cat->id]) }}" method="POST">
  45 + <a href="{{ route('admin.category-emp.edit', ['category_emp' => $cat->id]) }}">Изменить</a> |
  46 + @csrf
  47 + @method('DELETE')
  48 + <input class="btn btn-danger" type="submit" value="Удалить"/>
  49 + </form>
  50 + </td>
  51 + </tr>
  52 + @endforeach
  53 + </tbody>
  54 + </table>
  55 + </div>
  56 +
  57 + <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">
  58 + <?=$category->appends($_GET)->links('admin.pagginate'); ?>
  59 + </div>
  60 + </div>
  61 +@endsection
resources/views/admin/education/add.blade.php
... ... @@ -0,0 +1,7 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Добавление образования'])
  2 +
  3 +@section('content')
  4 + <form method="POST" action="{{ route('admin.education.store') }}">
  5 + @include('admin.education.form')
  6 + </form>
  7 +@endsection
resources/views/admin/education/edit.blade.php
... ... @@ -0,0 +1,7 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Редактирование образования'])
  2 +
  3 +@section('content')
  4 + <form method="POST" action="{{ route('admin.education.update', ['education' => $education->id]) }}">
  5 + @include('admin.education.form')
  6 + </form>
  7 +@endsection
resources/views/admin/education/form.blade.php
... ... @@ -0,0 +1,32 @@
  1 +@csrf
  2 +
  3 +@isset($education)
  4 + @method('PUT')
  5 +@endisset
  6 +
  7 +<div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
  8 + <label class="block text-sm">
  9 + <span class="text-gray-700 dark:text-gray-400">Имя категории</span>
  10 + <input name="name" id="name"
  11 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  12 + placeholder="Имя категории" value="{{ old('name') ?? $education->name ?? '' }}"
  13 + />
  14 + @error('name')
  15 + <span class="text-xs text-red-600 dark:text-red-400">
  16 + {{ $message }}
  17 + </span>
  18 + @enderror
  19 + </label><br>
  20 +
  21 + <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
  22 + <div>
  23 + <button type="submit" 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">
  24 + Сохранить
  25 + </button>
  26 + <a href="{{ route('admin.education.index') }}"
  27 + 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"
  28 + style="display: -webkit-inline-box; height: 30px!important;"
  29 + >Назад</a>
  30 + </div>
  31 + </div>
  32 +</div>
resources/views/admin/education/index.blade.php
... ... @@ -0,0 +1,61 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Справочник образование'])
  2 +
  3 +@section('script')
  4 +
  5 +@endsection
  6 +
  7 +@section('search')
  8 +
  9 +@endsection
  10 +
  11 +@section('content')
  12 +
  13 + <a href="{{ route('admin.education.create') }}" style="width: 195px" 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">
  14 + Добавить образование
  15 + </a>
  16 + <br>
  17 + <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
  18 +
  19 + <div class="w-full overflow-x-auto">
  20 + <table class="w-full whitespace-no-wrap">
  21 + <thead>
  22 + <tr
  23 + 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"
  24 + >
  25 + <th class="px-4 py-3">№</th>
  26 + <th class="px-4 py-3">Название образования</th>
  27 + <th class="px-4 py-3">Дата создания</th>
  28 + <th class="px-4 py-3">Редактировать</th>
  29 + </tr>
  30 + </thead>
  31 + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
  32 + @foreach($education as $cat)
  33 + <tr class="text-gray-700 dark:text-gray-400">
  34 + <td class="px-4 py-3">
  35 + {{$cat->id}}
  36 + </td>
  37 + <td class="px-4 py-3">
  38 + {{$cat->name}}
  39 + </td>
  40 + <td class="px-4 py-3">
  41 + {{$cat->created_at}}
  42 + </td>
  43 + <td class="px-4 py-3 text-sm_">
  44 + <form action="{{ route('admin.education.destroy', ['education' => $cat->id]) }}" method="POST">
  45 + <a href="{{ route('admin.education.edit', ['education' => $cat->id]) }}">Изменить</a> |
  46 + @csrf
  47 + @method('DELETE')
  48 + <input class="btn btn-danger" type="submit" value="Удалить"/>
  49 + </form>
  50 + </td>
  51 + </tr>
  52 + @endforeach
  53 + </tbody>
  54 + </table>
  55 + </div>
  56 +
  57 + <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">
  58 + <?=$education->appends($_GET)->links('admin.pagginate'); ?>
  59 + </div>
  60 + </div>
  61 +@endsection
resources/views/admin/employer/edit.blade.php
... ... @@ -31,7 +31,7 @@
31 31  
32 32 <label class="block text-sm">
33 33 <span class="text-gray-700 dark:text-gray-400">Email</span>
34   - <input name="email" id="email"
  34 + <input name="email" id="email" disabled
35 35 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
36 36 placeholder="Почта" value="{{ old('email') ?? $employer->email ?? '' }}"
37 37 />
... ... @@ -107,6 +107,37 @@
107 107 >{{ old('text') ?? $employer->text ?? '' }}</textarea>
108 108 </label>
109 109  
  110 + <hr>
  111 +
  112 + <label class="block mt-4 text-sm">
  113 + <span class="text-gray-700 dark:text-gray-400">Категории</span>
  114 +
  115 + <select name="category" id="category" class="form-control">
  116 + @foreach($select_category as $cat)
  117 + <option value="{{ $cat->name }}"
  118 + @isset($employer)
  119 + @if($cat->name == $employer->category)
  120 + selected
  121 + @endif
  122 + @endisset
  123 + >{{ $cat->name }}</option>
  124 + @endforeach
  125 + </select>
  126 +
  127 + @error('category')
  128 + <div class="alert alert-danger">{{ $message }}</div>
  129 + @enderror
  130 + </label>
  131 +
  132 + <label class="block mt-4 text-sm">
  133 + <span class="text-gray-700 dark:text-gray-400">Комментарий админа</span>
  134 + <textarea name="comment_admin" id="comment_admin"
  135 + class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
  136 + rows="3"
  137 + placeholder="Комментарий админа"
  138 + >{{ old('comment_admin') ?? $employer->comment_admin ?? '' }}</textarea>
  139 + </label>
  140 +
110 141 </div>
111 142 <div id="content-2">
112 143 <label class="block text-sm">
resources/views/admin/employer/index.blade.php
... ... @@ -39,10 +39,31 @@
39 39 @endsection
40 40  
41 41 @section('search')
42   - @include('admin.find')
  42 + @include('admin.find_employer', ['select_category' => $select_category])
43 43 @endsection
44 44  
45 45 @section('content')
  46 + <div class="grid gap-6 mb-8 md:grid-cols-2 xl:grid-cols-4">
  47 +
  48 + <div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800">
  49 + <div class="p-3 mr-4 text-orange-500 bg-orange-100 rounded-full dark:text-orange-100 dark:bg-orange-500">
  50 + <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
  51 + <path
  52 + d="M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3zM6 8a2 2 0 11-4 0 2 2 0 014 0zM16 18v-3a5.972 5.972 0 00-.75-2.906A3.005 3.005 0 0119 15v3h-3zM4.75 12.094A5.973 5.973 0 004 15v3H1v-3a3 3 0 013.75-2.906z"></path>
  53 + </svg>
  54 + </div>
  55 + <div>
  56 + <p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">
  57 + Всего работодателей
  58 + </p>
  59 + <p class="text-lg font-semibold text-gray-700 dark:text-gray-200">
  60 + {{ $all_employer }}
  61 + </p>
  62 + </div>
  63 + </div>
  64 + </div>
  65 +
  66 +
46 67 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
47 68 <div class="w-full overflow-x-auto">
48 69 <table class="w-full whitespace-no-wrap">
... ... @@ -53,10 +74,10 @@
53 74 <th class="px-4 py-3">№</th>
54 75 <th class="px-4 py-3">Название компании</th>
55 76 <th class="px-4 py-3">Email/Телефон</th>
56   - <th class="px-4 py-3">Имя</th>
  77 + <th class="px-4 py-3">Категория</th>
  78 + <th class="px-4 py-3">Комментарий</th>
57 79 <th class="px-4 py-3">Дата регистрации</th>
58   - <th class="px-4 py-3">Изменить</th>
59   - <th class="px-4 py-3">Бан</th>
  80 + <th class="px-4 py-3">Редакт.</th>
60 81 </tr>
61 82 </thead>
62 83 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
... ... @@ -86,21 +107,29 @@
86 107  
87 108 </td>
88 109 <td class="px-4 py-3 text-sm">
89   - {{ $user->name_man }} ({{ $user->usr_id }})
  110 + {{ $user->category }}
  111 + </td>
  112 + <td class="px-4 py-3 text-sm">
  113 + {{ $user->comment_admin }}
90 114 </td>
91 115 <td class="px-4 py-3 text-sm">
92 116 {{ $user->created_at }}
93 117 </td>
94 118 <td class="px-4 py-3 text-sm">
95 119 @if (!empty($user->emp_id))
96   - <a href="{{ route('admin.employer-profile', ['employer' => $user->emp_id]) }}">Изменить</a>
  120 + <form action="{{ route('admin.delete-employer', ['employer' => $user->emp_id, 'user' => $user->user_id]) }}" method="POST">
  121 + <a href="{{ route('admin.employer-profile', ['employer' => $user->emp_id]) }}">Изменить</a> |
  122 + @csrf
  123 + @method('DELETE')
  124 + <input class="btn btn-danger" type="submit" value="Удалить"/>
  125 + </form>
97 126 @endif
98 127 </td>
99   - <td class="px-4 py-3 text-sm">
  128 + <!--<td class="px-4 py-3 text-sm">
100 129 @if ($user->usr_id > 1)
101 130 <input type="checkbox" class="checkban" value="{{$user->usr_id}}" name="ban_{{$user->usr_id}}" {{ ($user->is_ban) ? "checked" : "" }}/>
102 131 @endif
103   - </td>
  132 + </td>-->
104 133 </tr>
105 134 @endforeach
106 135 </tbody>
resources/views/admin/find_employer.blade.php
... ... @@ -0,0 +1,41 @@
  1 +<div class="absolute inset-y-0 flex items-center pl-2">
  2 + <svg
  3 + class="w-4 h-4"
  4 + aria-hidden="true"
  5 + fill="currentColor"
  6 + viewBox="0 0 20 20"
  7 + >
  8 + <path
  9 + fill-rule="evenodd"
  10 + d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z"
  11 + clip-rule="evenodd"
  12 + ></path>
  13 + </svg>
  14 +</div>
  15 +<form action="" method="GET">
  16 + <div style="float:left; margin-right:10px"><input
  17 + name="find" id="find"
  18 + class="w-full pl-8 pr-2 text-sm text-gray-700 placeholder-gray-600 bg-gray-100 border-0 rounded-md dark:placeholder-gray-500 dark:focus:shadow-outline-gray dark:focus:placeholder-gray-600 dark:bg-gray-700 dark:text-gray-200 focus:placeholder-gray-500 focus:bg-white focus:border-purple-300 focus:outline-none focus:shadow-outline-purple form-input"
  19 + style="width: 300px"
  20 + type="text"
  21 + placeholder="Искать..."
  22 + aria-label="Search"
  23 + value="{{$find_key}}"
  24 + />
  25 + </div>
  26 + <div style="float:left; margin-top: -5px;">
  27 + <select
  28 + name="category" id="category"
  29 + placeholder="Категории"
  30 + class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-select focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
  31 + >
  32 + <option value="Все категории">Все категории</option>
  33 + @foreach ($select_category as $cat)
  34 + <option value="{{$cat->name}}" @if ($find_cat ==$cat->name) selected @endif>{{$cat->name}}</option>
  35 + @endforeach
  36 + </select>
  37 + </div>
  38 + <div style="float: left">
  39 + <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
  40 + </div>
  41 +</form>
resources/views/admin/find_worker.blade.php
... ... @@ -0,0 +1,41 @@
  1 +<div class="absolute inset-y-0 flex items-center pl-2">
  2 + <svg
  3 + class="w-4 h-4"
  4 + aria-hidden="true"
  5 + fill="currentColor"
  6 + viewBox="0 0 20 20"
  7 + >
  8 + <path
  9 + fill-rule="evenodd"
  10 + d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z"
  11 + clip-rule="evenodd"
  12 + ></path>
  13 + </svg>
  14 +</div>
  15 +<form action="" method="GET">
  16 + <div style="float:left; margin-right:10px"><input
  17 + name="find" id="find"
  18 + class="w-full pl-8 pr-2 text-sm text-gray-700 placeholder-gray-600 bg-gray-100 border-0 rounded-md dark:placeholder-gray-500 dark:focus:shadow-outline-gray dark:focus:placeholder-gray-600 dark:bg-gray-700 dark:text-gray-200 focus:placeholder-gray-500 focus:bg-white focus:border-purple-300 focus:outline-none focus:shadow-outline-purple form-input"
  19 + style="width: 250px"
  20 + type="text"
  21 + placeholder="Искать..."
  22 + aria-label="Search"
  23 + value="{{$find_key}}"
  24 + />
  25 + </div>
  26 + <div style="float:left; margin-top: -5px;">
  27 + <select
  28 + name="status_work" id="status_worker"
  29 + placeholder="Должности"
  30 + class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-select focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
  31 + >
  32 + <option value="0">Все должности</option>
  33 + @foreach ($status_work as $cat)
  34 + <option value="{{$cat->id}}" @if ($find_status_work ==$cat->id) selected @endif>{{$cat->name}}</option>
  35 + @endforeach
  36 + </select>
  37 + </div>
  38 + <div style="float: left">
  39 + <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
  40 + </div>
  41 +</form>
resources/views/admin/index.blade.php
... ... @@ -103,9 +103,15 @@
103 103 ></div>
104 104 </div>
105 105 <div>
106   - <p class="font-semibold"><a href="{{ route('admin.users') }}">Пользователи</a></p>
  106 + <p class="font-semibold">
  107 + @if ($UserId == 1)
  108 + <a href="{{ route('admin.users') }}">Пользователи</a>
  109 + @else
  110 + Пользователи
  111 + @endif
  112 + </p>
107 113 <p class="text-xs text-gray-600 dark:text-gray-400">
108   - Все пользователи сайта
  114 + Все пользователи сайта. Управление ими. Только для разработчика!
109 115 </p>
110 116 </div>
111 117 </div>
... ... @@ -114,8 +120,8 @@
114 120 users
115 121 </td>
116 122 <td class="px-4 py-3 text-xs">
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">
118   - Доступно
  123 + <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">
  124 + Недоступно
119 125 </span>
120 126 <!--<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">
121 127 Недоступно
... ... @@ -214,9 +220,36 @@
214 220 <div class="absolute inset-0 rounded-full shadow-inner" aria-hidden="true"></div>
215 221 </div>
216 222 <div>
217   - <p class="font-semibold"><a href="{{ route('admin.categories.index') }}">Категории</a></p>
  223 + <p class="font-semibold"><a href="{{ route('admin.education.index') }}">Справочник образования</a></p>
  224 + <p class="text-xs text-gray-600 dark:text-gray-400">
  225 + Справочник образование
  226 + </p>
  227 + </div>
  228 + </div>
  229 + </td>
  230 + <td class="px-4 py-3 text-sm">
  231 + education
  232 + </td>
  233 + <td class="px-4 py-3 text-xs">
  234 + <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">
  235 + Доступно
  236 + </span>
  237 + </td>
  238 + <td class="px-4 py-3 text-sm">
  239 + октябрь 2023
  240 + </td>
  241 + </tr>
  242 +
  243 + <tr class="text-gray-700 dark:text-gray-400">
  244 + <td class="px-4 py-3">
  245 + <div class="flex items-center text-sm">
  246 + <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block">
  247 + <div class="absolute inset-0 rounded-full shadow-inner" aria-hidden="true"></div>
  248 + </div>
  249 + <div>
  250 + <p class="font-semibold"><a href="{{ route('admin.categories.index') }}">Категории вакансий</a></p>
218 251 <p class="text-xs text-gray-600 dark:text-gray-400">
219   - Справочник категории (по умолчанию: река, море, река-море)
  252 + Справочник категории вакансий (по умолчанию: река, море, река-море)
220 253 </p>
221 254 </div>
222 255 </div>
... ... @@ -241,6 +274,33 @@
241 274 <div class="absolute inset-0 rounded-full shadow-inner" aria-hidden="true"></div>
242 275 </div>
243 276 <div>
  277 + <p class="font-semibold"><a href="{{ route('admin.category-emp.index') }}">Категории работодателей</a></p>
  278 + <p class="text-xs text-gray-600 dark:text-gray-400">
  279 + Справочник категории работодателей <br>(по умолчанию: не определен, оплатили, согласование, не оплачен)
  280 + </p>
  281 + </div>
  282 + </div>
  283 + </td>
  284 + <td class="px-4 py-3 text-sm">
  285 + category_emps
  286 + </td>
  287 + <td class="px-4 py-3 text-xs">
  288 + <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">
  289 + Доступно
  290 + </span>
  291 + </td>
  292 + <td class="px-4 py-3 text-sm">
  293 + октябрь 2023
  294 + </td>
  295 + </tr>
  296 +
  297 + <tr class="text-gray-700 dark:text-gray-400">
  298 + <td class="px-4 py-3">
  299 + <div class="flex items-center text-sm">
  300 + <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block">
  301 + <div class="absolute inset-0 rounded-full shadow-inner" aria-hidden="true"></div>
  302 + </div>
  303 + <div>
244 304 <p class="font-semibold"><a href="{{ route('admin.job-titles.index') }}">Должности</a></p>
245 305 <p class="text-xs text-gray-600 dark:text-gray-400">
246 306 Справочник должности (все должности проекта)
... ... @@ -349,9 +409,15 @@
349 409 <div class="absolute inset-0 rounded-full shadow-inner" aria-hidden="true"></div>
350 410 </div>
351 411 <div>
352   - <p class="font-semibold"><a href="{{ route('admin.roles') }}">Роли пользователей</a></p>
  412 + <p class="font-semibold">
  413 + @if ($UserId == 1)
  414 + <a href="{{ route('admin.roles') }}">Роли пользователей</a>
  415 + @else
  416 + Роли пользователей
  417 + @endif
  418 + </p>
353 419 <p class="text-xs text-gray-600 dark:text-gray-400">
354   - Роли людей (запреты и доступы) в системе
  420 + Роли людей (запреты и доступы) в системе. Только для разработчика!
355 421 </p>
356 422 </div>
357 423 </div>
... ... @@ -360,8 +426,8 @@
360 426 users
361 427 </td>
362 428 <td class="px-4 py-3 text-xs">
363   - <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">
364   - Доступно
  429 + <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">
  430 + Недоступно
365 431 </span>
366 432 </td>
367 433 <td class="px-4 py-3 text-sm">
resources/views/admin/message/index.blade.php
... ... @@ -61,15 +61,27 @@
61 61 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
62 62 @foreach($Msgs as $msg)
63 63 <tr class="text-gray-700 dark:text-gray-400"
64   - @if (($msg->user_to->id == $id_admin) && ($msg->flag_new == 1)) style="background-color: #403998;" @endif>
  64 + @if (isset($msg->user_to->id))
  65 + @if (($msg->user_to->id == $id_admin) && ($msg->flag_new == 1))
  66 + style="background-color: #403998;"
  67 + @endif
  68 + @endif>
65 69 <td class="px-4 py-3">
66 70 {{$msg->id}}
67 71 </td>
68 72 <td class="px-4 py-3">
  73 + @if (isset($msg->user_from->name))
69 74 {{$msg->user_from->name}} ({{$msg->user_from->id}})
  75 + @else
  76 + Пользователь удален
  77 + @endif
70 78 </td>
71 79 <td class="px-4 py-3">
  80 + @if (isset($msg->user_to->name))
72 81 {{$msg->user_to->name}} ({{$msg->user_to->id}})
  82 + @else
  83 + Пользователь удален
  84 + @endif
73 85 </td>
74 86 <td class="px-4 py-3">
75 87 {{$msg->title}}
... ... @@ -81,9 +93,11 @@
81 93 {{ $msg->created_at }}
82 94 </td>
83 95 <td class="px-4 py-3 text-sm">
84   - @if (($msg->user_to->id == $id_admin) && ($msg->flag_new == 1))
  96 + @if (isset($msg->user_to->id))
  97 + @if (($msg->user_to->id == $id_admin) && ($msg->flag_new == 1))
85 98 <input type="checkbox" class="checkread" value="{{$msg->id}}" name="read_{{$msg->id}}"/>
86 99 @endif
  100 + @endif
87 101 </td>
88 102 </tr>
89 103 @endforeach
resources/views/admin/message/index2.blade.php
... ... @@ -0,0 +1,174 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Сообщения адмистратора'])
  2 +
  3 +@section('script')
  4 + <script>
  5 + $(document).ready(function() {
  6 + $(document).on('change', '.checkread', function () {
  7 + var this_ = $(this);
  8 + var value = this_.val();
  9 + var ajax_block = $('#ajax_block');
  10 + var bool = 0;
  11 +
  12 + if(this.checked){
  13 + bool = 1;
  14 + } else {
  15 + bool = 0;
  16 + }
  17 +
  18 + $.ajax({
  19 + type: "GET",
  20 + url: "{{ url()->full()}}",
  21 + data: "id=" + value + "&flag_new=" + bool,
  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 + });
  38 + </script>
  39 +@endsection
  40 +
  41 +@section('search')
  42 +
  43 +@endsection
  44 +
  45 +@section('content')
  46 + <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
  47 + <div class="w-full overflow-x-auto">
  48 + <table class="w-full whitespace-no-wrap">
  49 + <thead>
  50 + <tr
  51 + 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"
  52 + >
  53 + <th class="px-4 py-3">№</th>
  54 + <th class="px-4 py-3">От юзера</th>
  55 + <th class="px-4 py-3">К юзеру</th>
  56 + <th class="px-4 py-3">Текст</th>
  57 + <th class="px-4 py-3">Дата</th>
  58 + <th class="px-4 py-3">Прочтено</th>
  59 + </tr>
  60 + </thead>
  61 + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
  62 + @foreach($Msgs as $msg)
  63 + <tr class="text-gray-700 dark:text-gray-400"
  64 + @if (($msg->user_to->id == $id_admin) && ($msg->flag_new == 1)) style="background-color: #403998;" @endif>
  65 + <td class="px-4 py-3">
  66 + {{$msg->id}}
  67 + </td>
  68 + <td class="px-4 py-3">
  69 + <!--if (isset($msg->user_from->name))
  70 + $msg->user_from->name ($msg->user_from->id)
  71 + else
  72 + Пользователь удален
  73 + endif-->
  74 + </td>
  75 + <td class="px-4 py-3">
  76 + <!--if (isset($msg->user_to->name))
  77 + $msg->user_to->name ($msg->user_to->id)
  78 + else
  79 + Пользователь удален
  80 + @endif-->
  81 + </td>
  82 + <td class="px-4 py-3">
  83 + {{$msg->title}}
  84 + <div class="flex items-center text-sm">
  85 + <textarea cols="7" style="width:250px;">{{ $msg->text }}</textarea>
  86 + </div>
  87 + </td>
  88 + <td class="px-4 py-3 text-sm">
  89 + {{ $msg->created_at }}
  90 + </td>
  91 + <td class="px-4 py-3 text-sm">
  92 + @if (($msg->user_to->id == $id_admin) && ($msg->flag_new == 1))
  93 + <input type="checkbox" class="checkread" value="{{$msg->id}}" name="read_{{$msg->id}}"/>
  94 + @endif
  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 + <?=$Msgs->appends($_GET)->links('admin.pagginate'); ?>
  104 + </div>
  105 + </div><br>
  106 +
  107 + <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block2">
  108 +
  109 + <form method="POST" action="{{ route('admin.admin-messages-post') }}" enctype="multipart/form-data">
  110 + @csrf
  111 + <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
  112 + <h3 class="text-gray-700 dark:text-gray-400">Отправка сообщения</h3>
  113 + <hr>
  114 + <label for="ad_employer_id" class="block text-sm">
  115 + <input type="hidden" name="user_id" id="user_id" value="{{ $id_admin }}"/>
  116 +
  117 + <span class="text-gray-700 dark:text-gray-400">Кому:</span>
  118 +
  119 + <select name="to_user_id" id="to_user_id" class="block change_js mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-select focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray">
  120 + @foreach($users as $user)
  121 + <option value="{{ $user->id }}">{{ $user->name }} ({{ $user->id }})</option>
  122 + @endforeach
  123 + </select>
  124 + </label><br>
  125 +
  126 + <label class="block text-sm">
  127 + <span class="text-gray-700 dark:text-gray-400">Заголовок</span>
  128 + <input name="title" id="title"
  129 + class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  130 + placeholder="Заголовок" value="{{ old('title') ?? '' }}"
  131 + />
  132 + @error('title')
  133 + <span class="text-xs text-red-600 dark:text-red-400">
  134 + {{ $message }}
  135 + </span>
  136 + @enderror
  137 + </label><br>
  138 +
  139 + <label class="block text-sm">
  140 + <span class="text-gray-700 dark:text-gray-400">Текст</span>
  141 + <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray" name="text" placeholder="Текст" required
  142 + rows="4">{{ old('text') ?? '' }}</textarea>
  143 + @error('text')
  144 + <span class="text-xs text-red-600 dark:text-red-400">
  145 + {{ $message }}
  146 + </span>
  147 + @enderror
  148 + </label><br>
  149 +
  150 +
  151 + <label class="block text-sm">
  152 + <span class="text-gray-700 dark:text-gray-400">Файл</span>
  153 + <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700
  154 + focus:border-purple-400 focus:outline-none focus:shadow-outline-purple
  155 + dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  156 + id="file" name="file">
  157 + @error('file')
  158 + <span class="text-xs text-red-600 dark:text-red-400">
  159 + {{ $message }}
  160 + </span>
  161 + @enderror
  162 + </label><br>
  163 +
  164 + <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
  165 + <div>
  166 + <button type="submit" 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">
  167 + Отправить
  168 + </button>
  169 + </div>
  170 + </div>
  171 + </div>
  172 + </form>
  173 + </div>
  174 +@endsection
resources/views/admin/message/index_ajax.blade.php
... ... @@ -15,15 +15,26 @@
15 15 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
16 16 @foreach($Msgs as $msg)
17 17 <tr class="text-gray-700 dark:text-gray-400"
18   - @if (($msg->user_to->id == $id_admin) && ($msg->flag_new == 1)) style="background-color: #403998;" @endif>
  18 + @if (isset($msg->user_to->id))
  19 + @if (($msg->user_to->id == $id_admin) && ($msg->flag_new == 1)) style="background-color: #403998;"
  20 + @endif
  21 + @endif>
19 22 <td class="px-4 py-3">
20 23 {{$msg->id}}
21 24 </td>
22 25 <td class="px-4 py-3">
  26 + @if ((isset($msg->user_from->name)) && (!empty($msg->user_from->name)))
23 27 {{$msg->user_from->name}} ({{$msg->user_from->id}})
  28 + @else
  29 + Пользователь удален
  30 + @endif
24 31 </td>
25 32 <td class="px-4 py-3">
  33 + @if ((isset($msg->user_to->name)) && (!empty($msg->user_to->name)))
26 34 {{$msg->user_to->name}} ({{$msg->user_to->id}})
  35 + @else
  36 + Пользователь удален
  37 + @endif
27 38 </td>
28 39 <td class="px-4 py-3">
29 40 {{$msg->title}}
... ... @@ -35,9 +46,11 @@
35 46 {{ $msg->created_at }}
36 47 </td>
37 48 <td class="px-4 py-3 text-sm">
  49 + @if (isset($msg->user_to->id))
38 50 @if (($msg->user_to->id == $id_admin) && ($msg->flag_new == 1))
39 51 <input type="checkbox" class="checkread" value="{{$msg->id}}" name="read_{{$msg->id}}"/>
40 52 @endif
  53 + @endif
41 54 </td>
42 55 </tr>
43 56 @endforeach
resources/views/admin/messages.blade.php
... ... @@ -55,10 +55,18 @@
55 55 {{$msg->id}}
56 56 </td>
57 57 <td class="px-4 py-3">
  58 + @if (isset($msg->user_from->id))
58 59 {{$msg->user_from->name}} ({{$msg->user_from->id}})
  60 + @else
  61 + Пользователь удален
  62 + @endif
59 63 </td>
60 64 <td class="px-4 py-3">
  65 + @if (isset($msg->user_to->id))
61 66 {{$msg->user_to->name}} ({{$msg->user_to->id}})
  67 + @else
  68 + Пользователь удален
  69 + @endif
62 70 </td>
63 71 <td class="px-4 py-3">
64 72 {{$msg->title}}
resources/views/admin/worker/index.blade.php
... ... @@ -39,7 +39,7 @@
39 39 @endsection
40 40  
41 41 @section('search')
42   - @include('admin.find')
  42 + @include('admin.find_worker', ['find_status_work' => $find_status_work])
43 43 @endsection
44 44  
45 45 @section('content')
... ... @@ -54,9 +54,10 @@
54 54 <th class="px-4 py-3">Имя</th>
55 55 <th class="px-4 py-3">Email/Телефон</th>
56 56 <th class="px-4 py-3">% заполнения анкеты</th>
  57 + <th class="px-4 py-3">Должность</th>
57 58 <th class="px-4 py-3">Дата регистрации</th>
58 59 <th class="px-4 py-3">Изменить</th>
59   - <th class="px-4 py-3">Бан</th>
  60 + <!--<th class="px-4 py-3">Бан</th>-->
60 61 </tr>
61 62 </thead>
62 63 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
... ... @@ -79,23 +80,30 @@
79 80 </div>
80 81 </td>
81 82 <td class="px-4 py-3 text-xs">
82   - @if (!empty($user->workers->persent_anketa))
83   - @if ($user->workers->persent_anketa > 40)
  83 + @if (isset($user->workers[0]->persent_anketa))
  84 + @if ($user->workers[0]->persent_anketa > 40)
84 85 <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">
85   - {{$user->workers->persent_anketa}}%
  86 + {{$user->workers[0]->persent_anketa}}%
86 87 </span>
87 88 @else
88 89 <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">
89   - {{$user->workers->persent_anketa}}%
  90 + {{$user->workers[0]->persent_anketa}}%
90 91 </span>
91 92 @endif
92 93 @else
93 94 <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">
94   - 10%
  95 + 0%
95 96 </span>
96 97 @endif
97 98 </td>
98 99 <td class="px-4 py-3 text-sm">
  100 + @if (isset($user->jobtitles[0]->name))
  101 + {{ $user->jobtitles[0]->name }}
  102 + @else
  103 + Не задана
  104 + @endif
  105 + </td>
  106 + <td class="px-4 py-3 text-sm">
99 107 {{ $user->created_at }}
100 108 </td>
101 109 <td class="px-4 py-3 text-sm">
resources/views/admin/worker/index_ajax.blade.php
... ... @@ -8,6 +8,7 @@
8 8 <th class="px-4 py-3">Имя</th>
9 9 <th class="px-4 py-3">Email/Телефон</th>
10 10 <th class="px-4 py-3">% заполнения анкеты</th>
  11 + <th class="px-4 py-3">Должность</th>
11 12 <th class="px-4 py-3">Дата регистрации</th>
12 13 <th class="px-4 py-3">Изменить</th>
13 14 <th class="px-4 py-3">Бан</th>
... ... @@ -33,28 +34,38 @@
33 34 </div>
34 35 </td>
35 36 <td class="px-4 py-3 text-xs">
36   - @if (!empty($user->workers->persent_anketa))
37   - @if ($user->workers->persent_anketa > 40)
  37 + @if (isset($user->workers[0]->persent_anketa))
  38 + @if ($user->workers[0]->persent_anketa > 40)
38 39 <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">
39   - {{$user->workers->persent_anketa}}%
  40 + {{$user->workers[0]->persent_anketa}}%
40 41 </span>
41 42 @else
42 43 <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">
43   - {{$user->workers->persent_anketa}}%
  44 + {{$user->workers[0]->persent_anketa}}%
44 45 </span>
45 46 @endif
46 47 @else
47 48 <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">
48   - 10%
  49 + 0%
49 50 </span>
50 51 @endif
51 52 </td>
52 53 <td class="px-4 py-3 text-sm">
  54 + @if (isset($user->jobtitles[0]->name))
  55 + {{ $user->jobtitles[0]->name }}
  56 + @else
  57 + Не задана
  58 + @endif
  59 + </td>
  60 + <td class="px-4 py-3 text-sm">
53 61 {{ $user->created_at }}
54 62 </td>
55 63 <td class="px-4 py-3 text-sm">
56 64 @if ($user->id > 1)
57   - <a href="{{ route('admin.worker-profile-edit', ['worker' => $user->workers[0]->id]) }}">Изменить</a>
  65 + @if (isset($user->workers[0]->id))
  66 + <a href="{{ route('admin.worker-profile-edit', ['worker' => $user->workers[0]->id]) }}">Изменить</a>
  67 +
  68 + @endif
58 69 @endif
59 70 </td>
60 71 <td class="px-4 py-3 text-sm">
resources/views/layout/admin.blade.php
... ... @@ -61,6 +61,7 @@
61 61 </li>
62 62 </ul>
63 63 <ul>
  64 + @if ($UserId == 1)
64 65 <li class="relative px-6 py-3">
65 66 <a
66 67 class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200"
... ... @@ -83,6 +84,7 @@
83 84 <span class="ml-4">Пользователи</span>
84 85 </a>
85 86 </li>
  87 + @endif
86 88 <li class="relative px-6 py-3">
87 89 <a
88 90 class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200"
... ... @@ -168,7 +170,7 @@
168 170 >
169 171 <path d="M4 6h16M4 10h16M4 14h16M4 18h16"></path>
170 172 </svg>
171   - <span class="ml-4">Сообщения</span>
  173 + <span class="ml-4">Сообщения все</span>
172 174 </a>
173 175 </li>
174 176 <li class="relative px-6 py-3">
... ... @@ -193,6 +195,7 @@
193 195 <span class="ml-4">Группы пользователей</span>
194 196 </a>
195 197 </li>
  198 + @if ($UserId == 1)
196 199 <li class="relative px-6 py-3">
197 200 <a class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200"
198 201 href="{{ route('admin.roles') }}">
... ... @@ -213,6 +216,7 @@
213 216 <span class="ml-4">Роли пользователей</span>
214 217 </a>
215 218 </li>
  219 + @endif
216 220 <li class="relative px-6 py-3">
217 221 <a
218 222 class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200"
... ... @@ -306,7 +310,13 @@
306 310 <a class="w-full" href="{{ route('admin.job-titles.index') }}">Должности</a>
307 311 </li>
308 312 <li class="px-2 py-1 transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200">
309   - <a class="w-full" href="{{ route('admin.categories.index') }}">Категории</a>
  313 + <a class="w-full" href="{{ route('admin.categories.index') }}">Категории вакансий</a>
  314 + </li>
  315 + <li class="px-2 py-1 transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200">
  316 + <a class="w-full" href="{{ route('admin.category-emp.index') }}">Категории работодателей</a>
  317 + </li>
  318 + <li class="px-2 py-1 transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200">
  319 + <a class="w-full" href="{{ route('admin.education.index') }}">Образование</a>
310 320 </li>
311 321 <li class="px-2 py-1 transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200">
312 322 <a class="w-full" href="{{ route('admin.infobloks.index') }}">Блоки-Дипломы</a>
... ... @@ -459,6 +469,7 @@
459 469 </li>
460 470 </ul>
461 471 <ul>
  472 + @if ($UserId == 1)
462 473 <li class="relative px-6 py-3">
463 474 <a class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200"
464 475 href="{{ route('admin.users') }}">
... ... @@ -479,6 +490,7 @@
479 490 <span class="ml-4">Пользователи</span>
480 491 </a>
481 492 </li>
  493 + @endif
482 494 <li class="relative px-6 py-3">
483 495 <a
484 496 class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200"
... ... @@ -563,7 +575,7 @@
563 575 >
564 576 <path d="M4 6h16M4 10h16M4 14h16M4 18h16"></path>
565 577 </svg>
566   - <span class="ml-4">Сообщения</span>
  578 + <span class="ml-4">Сообщения все</span>
567 579 </a>
568 580 </li>
569 581 <li class="relative px-6 py-3">
... ... @@ -586,6 +598,7 @@
586 598 <span class="ml-4">Группы пользователей</span>
587 599 </a>
588 600 </li>
  601 + @if ($UserId == 1)
589 602 <li class="relative px-6 py-3">
590 603 <a class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200"
591 604 href="{{ route('admin.roles') }}">
... ... @@ -606,6 +619,7 @@
606 619 <span class="ml-4">Роли пользователей</span>
607 620 </a>
608 621 </li>
  622 + @endif
609 623 <li class="relative px-6 py-3">
610 624 <a
611 625 class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200"
... ... @@ -699,7 +713,13 @@
699 713 <a class="w-full" href="{{ route('admin.job-titles.index') }}">Должности</a>
700 714 </li>
701 715 <li class="px-2 py-1 transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200">
702   - <a class="w-full" href="{{ route('admin.categories.index') }}">Категории</a>
  716 + <a class="w-full" href="{{ route('admin.categories.index') }}">Категории вакансий</a>
  717 + </li>
  718 + <li class="px-2 py-1 transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200">
  719 + <a class="w-full" href="{{ route('admin.category-emp.index') }}">Категории работодателей</a>
  720 + </li>
  721 + <li class="px-2 py-1 transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200">
  722 + <a class="w-full" href="{{ route('admin.education.index') }}">Образование</a>
703 723 </li>
704 724 <li class="px-2 py-1 transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200">
705 725 <a class="w-full" href="{{ route('admin.infobloks.index') }}">Блоки-Дипломы</a>
... ... @@ -2,6 +2,8 @@
2 2  
3 3 use App\Http\Controllers\Admin\AdminController;
4 4 use App\Http\Controllers\Admin\CategoryController;
  5 +use App\Http\Controllers\Admin\CategoryEmpController;
  6 +use App\Http\Controllers\Admin\EducationController;
5 7 use App\Http\Controllers\Admin\EmployersController;
6 8 use App\Http\Controllers\Admin\InfoBloksController;
7 9 use App\Http\Controllers\Admin\JobTitlesController;
... ... @@ -136,7 +138,7 @@ Route::group([
136 138  
137 139 // кабинет профиль админа - форма
138 140 Route::get('profile', [AdminController::class, 'profile'])->name('profile');
139   - // кабинет профиль админа - сохранение формы
  141 + // кабинет профиль админа - сохранение формы
140 142 Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile');
141 143  
142 144 //кабинет сообщения админа
... ... @@ -158,6 +160,8 @@ Route::group([
158 160 Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile');
159 161 // кабинет профиль работодатель - сохранение формы
160 162 Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile');
  163 + // кабинет удаление профиль работодателя и юзера
  164 + Route::delete('employer-profile/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer');
161 165  
162 166 // кабинет профиль работник - форма
163 167 Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit');
... ... @@ -184,6 +188,8 @@ Route::group([
184 188  
185 189 // кабинет - вакансии
186 190 Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers');
  191 + Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers');
  192 + Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers');
187 193  
188 194 // кабинет - категории
189 195 //Route::get('categories', [AdminController::class, 'index'])->name('categories');
... ... @@ -192,6 +198,11 @@ Route::group([
192 198 */
193 199 Route::resource('categories', CategoryController::class, ['except' => ['show']]);
194 200  
  201 + // CRUD-операции над справочником Категории для работодателей
  202 + Route::resource('category-emp', CategoryEmpController::class, ['except' => ['show']]);
  203 +
  204 + // CRUD-операции над справочником Образование
  205 + Route::resource('education', EducationController::class, ['except' => ['show']]);
195 206  
196 207 //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles');
197 208 /*