Commit 93a3f79f0c537db651f2373941f0a9604e70a28f

Authored by Андрей Ларионов
1 parent e688e0d8a7

Поисковый движок в админке

Showing 9 changed files with 88 additions and 85 deletions Inline Diff

app/Http/Controllers/Admin/EmployersController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers\Admin; 3 namespace App\Http\Controllers\Admin;
4 4
5 use App\Http\Controllers\Controller; 5 use App\Http\Controllers\Controller;
6 use App\Models\Ad_employer; 6 use App\Models\Ad_employer;
7 use App\Models\Answer; 7 use App\Models\Answer;
8 use App\Models\Employer; 8 use App\Models\Employer;
9 use App\Models\Static_ad; 9 use App\Models\Static_ad;
10 use App\Models\User; 10 use App\Models\User;
11 use Illuminate\Http\Request; 11 use Illuminate\Http\Request;
12 use Illuminate\Support\Facades\Storage; 12 use Illuminate\Support\Facades\Storage;
13 use Illuminate\Support\Facades\Validator; 13 use Illuminate\Support\Facades\Validator;
14 14
15 class EmployersController extends Controller 15 class EmployersController extends Controller
16 { 16 {
17 public function index(Request $request) { 17 public function index(Request $request) {
18 if ($request->ajax()) { 18 if ($request->ajax()) {
19 $user = User::find($request->id); 19 $user = User::find($request->id);
20 $request->offsetUnset('id'); 20 $request->offsetUnset('id');
21 $user->update($request->all()); 21 $user->update($request->all());
22 } 22 }
23 23
24 $users = User::where('is_worker', '0')->paginate(15); 24 $users = User::where('is_worker', '0');
25 $find_key = "";
26 if (isset($request->find)) {
27 $find_key = $request->find;
28 $users = $users->where(function($query) use($find_key) {
29 $query->Where('name', 'LIKE', "%$find_key%")
30 ->orWhere('email', 'LIKE', "%$find_key%")
31 ->orWhere('telephone', 'LIKE', "%$find_key%");
32 });
33 }
34 $users = $users->paginate(15);
35
25 if ($request->ajax()) { 36 if ($request->ajax()) {
26 return view('admin.employer.index_ajax', compact('users')); 37 return view('admin.employer.index_ajax', compact('users'));
27 } else { 38 } else {
28 return view('admin.employer.index', compact('users')); 39 return view('admin.employer.index', compact('users', 'find_key'));
29 } 40 }
30 } 41 }
31 42
32 public function form_update_employer(Employer $employer) { 43 public function form_update_employer(Employer $employer) {
33 return view('admin.employer.edit', compact('employer')); 44 return view('admin.employer.edit', compact('employer'));
34 } 45 }
35 46
36 public function update_employer(Employer $employer, Request $request) 47 public function update_employer(Employer $employer, Request $request)
37 { 48 {
38 $params = $request->all(); 49 $params = $request->all();
39 unset($params['logo']); 50 unset($params['logo']);
40 unset($params['telephone']); 51 unset($params['telephone']);
41 unset($params['email']); 52 unset($params['email']);
42 unset($params['address']); 53 unset($params['address']);
43 unset($params['site']); 54 unset($params['site']);
44 55
45 $rules = [ 56 $rules = [
46 'name' => 'required|string|max:255', 57 'name' => 'required|string|max:255',
47 ]; 58 ];
48 59
49 $messages = [ 60 $messages = [
50 'required' => 'Укажите обязательное поле «:attribute»', 61 'required' => 'Укажите обязательное поле «:attribute»',
51 'confirmed' => 'Пароли не совпадают', 62 'confirmed' => 'Пароли не совпадают',
52 'email' => 'Введите корректный email', 63 'email' => 'Введите корректный email',
53 'min' => [ 64 'min' => [
54 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 65 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
55 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 66 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
56 ], 67 ],
57 'max' => [ 68 'max' => [
58 'string' => 'Поле «:attribute» должно быть не больше :max символов', 69 'string' => 'Поле «:attribute» должно быть не больше :max символов',
59 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 70 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
60 ], 71 ],
61 ]; 72 ];
62 73
63 $validator = Validator::make($params, $rules, $messages); 74 $validator = Validator::make($params, $rules, $messages);
64 75
65 if ($validator->fails()) { 76 if ($validator->fails()) {
66 return back()->withErrors($validator)->withInput(); //->route('admin.register') 77 return back()->withErrors($validator)->withInput(); //->route('admin.register')
67 78
68 } else { 79 } else {
69 80
70 //$user = User::find($employer->user_id); 81 //$user = User::find($employer->user_id);
71 $user_id = $employer->user_id; 82 $user_id = $employer->user_id;
72 $employer->telephone = $request->telephone; 83 $employer->telephone = $request->telephone;
73 $employer->email = $request->email; 84 $employer->email = $request->email;
74 $employer->address = $request->address; 85 $employer->address = $request->address;
75 $employer->site = $request->site; 86 $employer->site = $request->site;
76 $employer->text = $request->text; 87 $employer->text = $request->text;
77 88
78 if ($request->has('logo')) { 89 if ($request->has('logo')) {
79 if (!empty($employer->logo)) { 90 if (!empty($employer->logo)) {
80 Storage::delete($employer->logo); 91 Storage::delete($employer->logo);
81 } 92 }
82 $employer->logo = $request->file('logo')->store("employer/$user_id", 'public'); 93 $employer->logo = $request->file('logo')->store("employer/$user_id", 'public');
83 } 94 }
84 $employer->save(); 95 $employer->save();
85 96
86 $user = User::find($user_id); 97 $user = User::find($user_id);
87 $user->update($params); 98 $user->update($params);
88 99
89 return redirect()->route('admin.employer-profile', ['employer' => $employer->id]) 100 return redirect()->route('admin.employer-profile', ['employer' => $employer->id])
90 ->with('success', 'Данные были успешно сохранены'); 101 ->with('success', 'Данные были успешно сохранены');
91 } 102 }
92 } 103 }
93 104
94 // кабинет - отзывы о работодателе для модерации 105 // кабинет - отзывы о работодателе для модерации
95 public function answers(Request $request) { 106 public function answers(Request $request) {
96 if ($request->ajax()) { 107 if ($request->ajax()) {
97 $user = Answer::find($request->id); 108 $user = Answer::find($request->id);
98 $request->offsetUnset('id'); 109 $request->offsetUnset('id');
99 $user->update($request->all()); 110 $user->update($request->all());
100 } 111 }
101 112
102 $answers = Answer::query()->orderByDesc('id')->paginate(15); 113 $answers = Answer::query()->orderByDesc('id')->paginate(15);
103 114
104 if ($request->ajax()) { 115 if ($request->ajax()) {
105 return view('admin.answers.index_ajax', compact('answers')); 116 return view('admin.answers.index_ajax', compact('answers'));
106 } else { 117 } else {
107 return view('admin.answers.index', compact('answers')); 118 return view('admin.answers.index', compact('answers'));
108 } 119 }
109 } 120 }
110 121
111 // кабинет - статистика вакансий работодателя 122 // кабинет - статистика вакансий работодателя
112 public function static_ads(Request $request) { 123 public function static_ads(Request $request) {
113 $stat = Static_ad::with('ads'); 124 $stat = Static_ad::with('ads');
114 $ads = Ad_employer::query()->active()->OrderBy('id')->get(); 125 $ads = Ad_employer::query()->active()->OrderBy('id')->get();
115 $periods = Static_ad::query()->distinct('year_month')->select('year_month')->get(); 126 $periods = Static_ad::query()->distinct('year_month')->select('year_month')->get();
116 if ($request->ajax()) { 127 if ($request->ajax()) {
117 if (isset($request->ad_employer_id)) 128 if (isset($request->ad_employer_id))
118 if (!$request->ad_employer_id == "0") 129 if (!$request->ad_employer_id == "0")
119 $stat = $stat->Where('ad_employer_id', '=', $request->ad_employer_id); 130 $stat = $stat->Where('ad_employer_id', '=', $request->ad_employer_id);
120 if (isset($request->year_month)) { 131 if (isset($request->year_month)) {
121 if (!$request->year_month == "0") 132 if (!$request->year_month == "0")
122 $stat = $stat->Where('year_month', '=', $request->year_month); 133 $stat = $stat->Where('year_month', '=', $request->year_month);
123 } 134 }
124 } 135 }
125 136
126 $stat = $stat->OrderByDesc('year_month'); 137 $stat = $stat->OrderByDesc('year_month');
127 $stat = $stat->paginate(15); 138 $stat = $stat->paginate(15);
128 139
129 if ($request->ajax()) 140 if ($request->ajax())
130 return view('admin.static.index_ads_ajax', compact('stat')); 141 return view('admin.static.index_ads_ajax', compact('stat'));
131 else 142 else
132 return view('admin.static.index_ads', compact('stat', 'ads', 'periods')); 143 return view('admin.static.index_ads', compact('stat', 'ads', 'periods'));
133 144
134 } 145 }
135 146
136 147
137 } 148 }
138 149
app/Http/Controllers/Admin/MsgAnswersController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers\Admin; 3 namespace App\Http\Controllers\Admin;
4 4
5 use App\Http\Controllers\Controller; 5 use App\Http\Controllers\Controller;
6 use App\Models\Message; 6 use App\Models\Message;
7 use App\Models\User; 7 use App\Models\User;
8 use Illuminate\Http\Request; 8 use Illuminate\Http\Request;
9 use Illuminate\Support\Facades\Auth; 9 use Illuminate\Support\Facades\Auth;
10 use Illuminate\Support\Facades\DB;
10 use Illuminate\Support\Facades\Validator; 11 use Illuminate\Support\Facades\Validator;
11 12
12 class MsgAnswersController extends Controller 13 class MsgAnswersController extends Controller
13 { 14 {
14 public function messages() { 15 public function messages() {
15 $Msgs = Message::query()->orderByDesc('created_at')->paginate(25); 16 $Msgs = Message::query()->orderByDesc('created_at')->paginate(25);
16 17
17 return view('admin.messages', compact('Msgs')); 18 return view('admin.messages', compact('Msgs'));
18 } 19 }
19 20
20 public function admin_messages(Request $request) { 21 public function admin_messages(Request $request) {
21 $id_admin = Auth::user()->id; 22 $id_admin = Auth::user()->id;
22 $users = User::query()->OrderBy('name')->get(); 23 $users = User::query()->OrderBy('name')->get();
23 24
24 $Msgs = Message::query()->where('user_id', '=', $id_admin) 25 $Msgs = Message::query()->where('user_id', '=', $id_admin)
25 ->orWhere('to_user_id', '=', $id_admin) 26 ->orWhere('to_user_id', '=', $id_admin)
26 ->orderByDesc('created_at')->paginate(5); 27 ->orderByDesc('created_at')->paginate(5);
27 28
28 return view('admin.message.index', compact('Msgs', 'id_admin', 'users')); 29 return view('admin.message.index', compact('Msgs', 'id_admin', 'users'));
29 } 30 }
30 31
32 public function messages_sql(Request $request) {
33 $id = Auth::user()->id;
34 DB::enableQueryLog();
35 //$query = DB::select('select * from users where id = :id', ['id' => 1]);
36 $query = DB::select(DB::raw('SELECT u1.name as "To-user", u2.name as "From-user", m1.`text`, m1.created_at
37 FROM messages m1
38 JOIN (SELECT MAX(id) id FROM messages
39 GROUP BY LEAST(user_id, to_user_id),
40 GREATEST(user_id, to_user_id)
41 ) m2 USING (id)
42 JOIN users u1 ON u1.id = m1.user_id
43 JOIN users u2 ON u2.id = m1.to_user_id
44 Where ((m1.user_id = :uid) or (m1.to_user_id = :uid2))
45 '), ['uid' => $id, 'uid2' => $id]);
46 //dump(DB::getQueryLog());
47 dd($query);
48 return;
49 }
50
31 public function admin_messages_post(Request $request) { 51 public function admin_messages_post(Request $request) {
32 $rules = [ 52 $rules = [
33 'title' => 'required|min:3|max:255', 53 'title' => 'required|min:3|max:255',
34 'text' => 'required|min:1' 54 'text' => 'required|min:1'
35 ]; 55 ];
36 56
37 $messages = [ 57 $messages = [
38 'required' => 'Поле не может быть пустым!', 58 'required' => 'Поле не может быть пустым!',
39 ]; 59 ];
40 60
41 $validator = Validator::make($request->all(), $rules, $messages); 61 $validator = Validator::make($request->all(), $rules, $messages);
42 62
43 if ($validator->fails()) { 63 if ($validator->fails()) {
44 return redirect()->route('admin.admin-messages')->withErrors($validator); 64 return redirect()->route('admin.admin-messages')->withErrors($validator);
45 } else { 65 } else {
46 $params = $request->all(); 66 $params = $request->all();
47 $id_admin = Auth::user()->id; 67 $id_admin = Auth::user()->id;
48 if ($request->has('file')) { 68 if ($request->has('file')) {
49 $params['file'] = $request->file('file')->store("upload/".$id_admin, 'public'); 69 $params['file'] = $request->file('file')->store("upload/".$id_admin, 'public');
50 } 70 }
51 Message::create($params); 71 Message::create($params);
52 return redirect()->route('admin.admin-messages'); 72 return redirect()->route('admin.admin-messages');
53 } 73 }
54 } 74 }
55 } 75 }
56 76
app/Http/Controllers/Admin/UsersController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers\Admin; 3 namespace App\Http\Controllers\Admin;
4 4
5 use App\Http\Controllers\Controller; 5 use App\Http\Controllers\Controller;
6 use App\Models\User; 6 use App\Models\User;
7 use Illuminate\Http\Request; 7 use Illuminate\Http\Request;
8 use Illuminate\Support\Facades\Auth; 8 use Illuminate\Support\Facades\Auth;
9 9
10 class UsersController extends Controller 10 class UsersController extends Controller
11 { 11 {
12 public function index(Request $request) { 12 public function index(Request $request) {
13 $title = 'Админка - Пользователи системы'; 13 $title = 'Админка - Пользователи системы';
14 $id_admin = Auth::user()->id; 14 $id_admin = Auth::user()->id;
15 if ($request->ajax()) { 15 if ($request->ajax()) {
16 $user = User::find($request->id); 16 $user = User::find($request->id);
17 $request->offsetUnset('id'); 17 $request->offsetUnset('id');
18 $user->update($request->all()); 18 $user->update($request->all());
19 } 19 }
20 20 $find_key = "";
21 $users = User::query()->paginate(15); 21 $users = User::query();
22 if (isset($request->find)) {
23 $find_key = $request->find;
24 $users = $users->where('name', 'LIKE', "%$find_key%")
25 ->orWhere('email', 'LIKE', "%$find_key%");
26 }
27 $users = $users->paginate(15);
22 28
23 if ($request->ajax()) { 29 if ($request->ajax()) {
24 return view('admin.users.index_ajax', compact('users', 'id_admin')); 30 return view('admin.users.index_ajax', compact('users', 'id_admin'));
25 } else { 31 } else {
26 return view('admin.users.index', compact('users', 'title', 'id_admin')); 32 return view('admin.users.index', compact('users', 'title', 'id_admin', 'find_key'));
27 } 33 }
28 } 34 }
29 35
30 public function roles(Request $request) { 36 public function roles(Request $request) {
31 if ($request->ajax()) { 37 if ($request->ajax()) {
32 $user = User::find($request->id); 38 $user = User::find($request->id);
33 $request->offsetUnset('id'); 39 $request->offsetUnset('id');
34 $user->update($request->all()); 40 $user->update($request->all());
35 } 41 }
36 42
37 $users = User::query()->paginate(15); 43 $users = User::query()->paginate(15);
38 44
39 if ($request->ajax()) { 45 if ($request->ajax()) {
40 return view('admin.users.roles.index_ajax', compact('users')); 46 return view('admin.users.roles.index_ajax', compact('users'));
41 } else { 47 } else {
42 return view('admin.users.roles.index', compact('users')); 48 return view('admin.users.roles.index', compact('users'));
43 } 49 }
44 } 50 }
45 } 51 }
46 52
app/Http/Controllers/Admin/WorkersController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers\Admin; 3 namespace App\Http\Controllers\Admin;
4 4
5 use App\Http\Controllers\Controller; 5 use App\Http\Controllers\Controller;
6 use App\Models\Static_worker; 6 use App\Models\Static_worker;
7 use App\Models\User; 7 use App\Models\User;
8 use App\Models\Worker; 8 use App\Models\Worker;
9 use Illuminate\Http\Request; 9 use Illuminate\Http\Request;
10 10
11 class WorkersController extends Controller 11 class WorkersController extends Controller
12 { 12 {
13 public function index(Request $request) { 13 public function index(Request $request) {
14 if ($request->ajax()) { 14 if ($request->ajax()) {
15 $user = User::find($request->id); 15 $user = User::find($request->id);
16 $request->offsetUnset('id'); 16 $request->offsetUnset('id');
17 $user->update($request->all()); 17 $user->update($request->all());
18 } 18 }
19 19
20 $users = User::where('is_worker', '1')->paginate(15); 20 $users = User::where('is_worker', '1');
21 $find_key = "";
22 if (isset($request->find)) {
23 $find_key = $request->find;
24 $users = $users->where(function($query) use($find_key) {
25 $query->Where('name_man', 'LIKE', "%$find_key%")
26 ->orWhere('email', 'LIKE', "%$find_key%")
27 ->orWhere('telephone', 'LIKE', "%$find_key%");
28 });
29 }
30
31 $users = $users->paginate(15);
21 32
22 if ($request->ajax()) { 33 if ($request->ajax()) {
23 return view('admin.worker.index_ajax', compact('users')); 34 return view('admin.worker.index_ajax', compact('users'));
24 } else { 35 } else {
25 return view('admin.worker.index', compact('users')); 36 return view('admin.worker.index', compact('users', 'find_key'));
26 } 37 }
27 } 38 }
28 39
29 public function form_update_worker(Worker $worker) { 40 public function form_update_worker(Worker $worker) {
30 return view('admin.worker.edit'); 41 return view('admin.worker.edit');
31 } 42 }
32 43
33 // кабинет - статистика работников 44 // кабинет - статистика работников
34 public function static_workers(Request $request) { 45 public function static_workers(Request $request) {
35 $stat = Static_worker::with('users'); 46 $stat = Static_worker::with('users');
36 //->join('users', 'users.id', '=', 'static_workers.user_id'); 47 //->join('users', 'users.id', '=', 'static_workers.user_id');
37 $users = User::query()->active()->OrderBy('id')->get(); 48 $users = User::query()->active()->OrderBy('id')->get();
38 $periods = Static_worker::query()->distinct('year_month')->select('year_month')->get(); 49 $periods = Static_worker::query()->distinct('year_month')->select('year_month')->get();
39 if ($request->ajax()) { 50 if ($request->ajax()) {
40 if (isset($request->user_id)) 51 if (isset($request->user_id))
41 if (!$request->user_id == "0") 52 if (!$request->user_id == "0")
42 $stat = $stat->Where('user_id', '=', $request->user_id); 53 $stat = $stat->Where('user_id', '=', $request->user_id);
43 if (isset($request->year_month)) { 54 if (isset($request->year_month)) {
44 if (!$request->year_month == "0") 55 if (!$request->year_month == "0")
45 $stat = $stat->Where('year_month', '=', $request->year_month); 56 $stat = $stat->Where('year_month', '=', $request->year_month);
46 } 57 }
47 } 58 }
48 59
49 $stat = $stat->OrderByDesc('year_month'); 60 $stat = $stat->OrderByDesc('year_month');
50 //->OrderBy('users.name'); 61 //->OrderBy('users.name');
51 //OrderBy('users.name')-> 62 //OrderBy('users.name')->
52 /*$stat->implode() loadMissing(['users' => function (Builder $query) { 63 /*$stat->implode() loadMissing(['users' => function (Builder $query) {
53 $query->orderBy('name', 'asc'); 64 $query->orderBy('name', 'asc');
54 }]);*/ 65 }]);*/
55 66
56 $stat = $stat->paginate(15); 67 $stat = $stat->paginate(15);
57 68
58 if ($request->ajax()) 69 if ($request->ajax())
59 return view('admin.static.index_workers_ajax', compact('stat')); 70 return view('admin.static.index_workers_ajax', compact('stat'));
60 else 71 else
61 return view('admin.static.index_workers', compact('stat', 'users', 'periods')); 72 return view('admin.static.index_workers', compact('stat', 'users', 'periods'));
62 73
63 } 74 }
64 75
65 } 76 }
66 77
resources/views/admin/employer/index.blade.php
1 @extends('layout.admin', ['title' => 'Админка - Работодатели']) 1 @extends('layout.admin', ['title' => 'Админка - Работодатели'])
2 2
3 @section('script') 3 @section('script')
4 <script> 4 <script>
5 $(document).ready(function() { 5 $(document).ready(function() {
6 $(document).on('click', '.checkban', function () { 6 $(document).on('click', '.checkban', function () {
7 var this_ = $(this); 7 var this_ = $(this);
8 var value = this_.val(); 8 var value = this_.val();
9 var ajax_block = $('#ajax_block'); 9 var ajax_block = $('#ajax_block');
10 var bool = 0; 10 var bool = 0;
11 11
12 if(this.checked){ 12 if(this.checked){
13 bool = 1; 13 bool = 1;
14 } else { 14 } else {
15 bool = 0; 15 bool = 0;
16 } 16 }
17 17
18 $.ajax({ 18 $.ajax({
19 type: "GET", 19 type: "GET",
20 url: "{{ url()->full()}}", 20 url: "{{ url()->full()}}",
21 data: "id=" + value + "&is_ban=" + bool, 21 data: "id=" + value + "&is_ban=" + bool,
22 success: function (data) { 22 success: function (data) {
23 console.log('Обновление таблицы пользователей '); 23 console.log('Обновление таблицы пользователей ');
24 //data = JSON.parse(data); 24 //data = JSON.parse(data);
25 //console.log(data); 25 //console.log(data);
26 ajax_block.html(data); 26 ajax_block.html(data);
27 }, 27 },
28 headers: { 28 headers: {
29 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 29 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
30 }, 30 },
31 error: function (data) { 31 error: function (data) {
32 console.log('Error: ' + data); 32 console.log('Error: ' + data);
33 } 33 }
34 }); 34 });
35 }); 35 });
36 36
37 }); 37 });
38 </script> 38 </script>
39 @endsection 39 @endsection
40 40
41 @section('search') 41 @section('search')
42 <div class="absolute inset-y-0 flex items-center pl-2"> 42 @include('admin.find')
43 <svg
44 class="w-4 h-4"
45 aria-hidden="true"
46 fill="currentColor"
47 viewBox="0 0 20 20"
48 >
49 <path
50 fill-rule="evenodd"
51 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"
52 clip-rule="evenodd"
53 ></path>
54 </svg>
55 </div>
56 <form action="" method="POST">
57 <div style="float:left;"><input
58 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"
59 style="width: 400px"
60 type="text"
61 placeholder="Искать..."
62 aria-label="Search"
63 /></div>
64 <div style="float: left">
65 <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
66 </div>
67 </form>
68 @endsection 43 @endsection
69 44
70 @section('content') 45 @section('content')
71 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> 46 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
72 <div class="w-full overflow-x-auto"> 47 <div class="w-full overflow-x-auto">
73 <table class="w-full whitespace-no-wrap"> 48 <table class="w-full whitespace-no-wrap">
74 <thead> 49 <thead>
75 <tr 50 <tr
76 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" 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"
77 > 52 >
78 <th class="px-4 py-3">№</th> 53 <th class="px-4 py-3">№</th>
79 <th class="px-4 py-3">Название компании</th> 54 <th class="px-4 py-3">Название компании</th>
80 <th class="px-4 py-3">Email/Телефон</th> 55 <th class="px-4 py-3">Email/Телефон</th>
81 <th class="px-4 py-3">Имя</th> 56 <th class="px-4 py-3">Имя</th>
82 <th class="px-4 py-3">Дата регистрации</th> 57 <th class="px-4 py-3">Дата регистрации</th>
83 <th class="px-4 py-3">Изменить</th> 58 <th class="px-4 py-3">Изменить</th>
84 <th class="px-4 py-3">Бан</th> 59 <th class="px-4 py-3">Бан</th>
85 </tr> 60 </tr>
86 </thead> 61 </thead>
87 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> 62 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
88 @foreach($users as $user) 63 @foreach($users as $user)
89 <tr class="text-gray-700 dark:text-gray-400"> 64 <tr class="text-gray-700 dark:text-gray-400">
90 <td class="px-4 py-3"> 65 <td class="px-4 py-3">
91 {{$user->id}} 66 {{$user->id}}
92 </td> 67 </td>
93 <td class="px-4 py-3"> 68 <td class="px-4 py-3">
94 {{$user->name}} 69 {{$user->name}}
95 </td> 70 </td>
96 <td class="px-4 py-3"> 71 <td class="px-4 py-3">
97 <div class="flex items-center text-sm"> 72 <div class="flex items-center text-sm">
98 <!--<div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> 73 <!--<div class="relative hidden w-8 h-8 mr-3 rounded-full md:block">
99 <div 74 <div
100 class="absolute inset-0 rounded-full shadow-inner" 75 class="absolute inset-0 rounded-full shadow-inner"
101 aria-hidden="true" 76 aria-hidden="true"
102 ></div> 77 ></div>
103 </div>--> 78 </div>-->
104 <div> 79 <div>
105 <p class="font-semibold">{{ empty($user->employers->email) ? $user->email : $user->employers->email }}</p> 80 <p class="font-semibold">{{ empty($user->employers->email) ? $user->email : $user->employers->email }}</p>
106 <p class="text-xs text-gray-600 dark:text-gray-400"> 81 <p class="text-xs text-gray-600 dark:text-gray-400">
107 {{ empty($user->employers->telephone) ? $user->telephone : $user->employers->telephone }} 82 {{ empty($user->employers->telephone) ? $user->telephone : $user->employers->telephone }}
108 </p> 83 </p>
109 </div> 84 </div>
110 </div> 85 </div>
111 86
112 </td> 87 </td>
113 <td class="px-4 py-3 text-sm"> 88 <td class="px-4 py-3 text-sm">
114 {{ $user->name_man }} 89 {{ $user->name_man }}
115 </td> 90 </td>
116 <td class="px-4 py-3 text-sm"> 91 <td class="px-4 py-3 text-sm">
117 {{ $user->created_at }} 92 {{ $user->created_at }}
118 </td> 93 </td>
119 <td class="px-4 py-3 text-sm"> 94 <td class="px-4 py-3 text-sm">
120 @if ($user->id > 1) 95 @if ($user->id > 1)
121 <a href="{{ route('admin.user-profile', ['user' => $user->id]) }}">Изменить</a> 96 <a href="{{ route('admin.user-profile', ['user' => $user->id]) }}">Изменить</a>
122 @endif 97 @endif
123 </td> 98 </td>
124 <td class="px-4 py-3 text-sm"> 99 <td class="px-4 py-3 text-sm">
125 @if ($user->id > 1) 100 @if ($user->id > 1)
126 <input type="checkbox" class="checkban" value="{{$user->id}}" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/> 101 <input type="checkbox" class="checkban" value="{{$user->id}}" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/>
127 @endif 102 @endif
128 </td> 103 </td>
129 </tr> 104 </tr>
130 @endforeach 105 @endforeach
131 </tbody> 106 </tbody>
132 </table> 107 </table>
133 </div> 108 </div>
134 109
135 <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"> 110 <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">
136 <?=$users->appends($_GET)->links('admin.pagginate'); ?> 111 <?=$users->appends($_GET)->links('admin.pagginate'); ?>
137 </div> 112 </div>
138 </div> 113 </div>
139 @endsection 114 @endsection
140 115
resources/views/admin/find.blade.php
File was created 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;"><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: 400px"
20 type="text"
21 placeholder="Искать..."
22 aria-label="Search"
23 value="{{$find_key}}"
24 /></div>
25 <div style="float: left">
26 <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
27 </div>
28 </form>
29
resources/views/admin/users/index.blade.php
1 @extends('layout.admin', ['title' => $title]) 1 @extends('layout.admin', ['title' => $title])
2 2
3 @section('script') 3 @section('script')
4 <script> 4 <script>
5 $(document).ready(function() { 5 $(document).ready(function() {
6 $(document).on('click', '.check_click', function () { 6 $(document).on('click', '.check_click', function () {
7 var this_ = $(this); 7 var this_ = $(this);
8 var value = this_.val(); 8 var value = this_.val();
9 var field = this_.attr('data-field'); 9 var field = this_.attr('data-field');
10 var ajax_block = $('#ajax_block'); 10 var ajax_block = $('#ajax_block');
11 var bool = 0; 11 var bool = 0;
12 var str_get = ''; 12 var str_get = '';
13 13
14 if(this.checked){ 14 if(this.checked){
15 bool = 1; 15 bool = 1;
16 } else { 16 } else {
17 bool = 0; 17 bool = 0;
18 } 18 }
19 console.log(field); 19 console.log(field);
20 str_get = "id=" + value + "&" + field + "=" + bool; 20 str_get = "id=" + value + "&" + field + "=" + bool;
21 console.log(str_get); 21 console.log(str_get);
22 22
23 $.ajax({ 23 $.ajax({
24 type: "GET", 24 type: "GET",
25 url: "{{ url()->full()}}", 25 url: "{{ url()->full()}}",
26 data: str_get, 26 data: str_get,
27 success: function (data) { 27 success: function (data) {
28 console.log('Обновление таблицы пользователей '); 28 console.log('Обновление таблицы пользователей ');
29 //data = JSON.parse(data); 29 //data = JSON.parse(data);
30 //console.log(data); 30 //console.log(data);
31 ajax_block.html(data); 31 ajax_block.html(data);
32 }, 32 },
33 headers: { 33 headers: {
34 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 34 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
35 }, 35 },
36 error: function (data) { 36 error: function (data) {
37 console.log('Error: ' + data); 37 console.log('Error: ' + data);
38 } 38 }
39 }); 39 });
40 }); 40 });
41 }); 41 });
42 </script> 42 </script>
43 @endsection 43 @endsection
44 44
45 @section('search') 45 @section('search')
46 <div class="absolute inset-y-0 flex items-center pl-2"> 46 @include('admin.find')
47 <svg
48 class="w-4 h-4"
49 aria-hidden="true"
50 fill="currentColor"
51 viewBox="0 0 20 20"
52 >
53 <path
54 fill-rule="evenodd"
55 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"
56 clip-rule="evenodd"
57 ></path>
58 </svg>
59 </div>
60 <form action="" method="POST">
61 <div style="float:left;"><input
62 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"
63 style="width: 400px"
64 type="text"
65 placeholder="Искать..."
66 aria-label="Search"
67 /></div>
68 <div style="float: left">
69 <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
70 </div>
71 </form>
72 @endsection 47 @endsection
73 48
74 @section('content') 49 @section('content')
75 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> 50 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
76 <div class="w-full overflow-x-auto"> 51 <div class="w-full overflow-x-auto">
77 <table class="w-full whitespace-no-wrap"> 52 <table class="w-full whitespace-no-wrap">
78 <thead> 53 <thead>
79 <tr 54 <tr
80 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" 55 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"
81 > 56 >
82 <th class="px-4 py-3">№</th> 57 <th class="px-4 py-3">№</th>
83 <th class="px-4 py-3">Имя</th> 58 <th class="px-4 py-3">Имя</th>
84 <th class="px-4 py-3">Email/логин</th> 59 <th class="px-4 py-3">Email/логин</th>
85 <th class="px-4 py-3">Работодатель/работник/администратор</th> 60 <th class="px-4 py-3">Работодатель/работник/администратор</th>
86 <th class="px-4 py-3">Бан</th> 61 <th class="px-4 py-3">Бан</th>
87 <th class="px-4 py-3">Новый</th> 62 <th class="px-4 py-3">Новый</th>
88 @if ($id_admin == 1) 63 @if ($id_admin == 1)
89 <th class="px-4 py-3">Админ</th> 64 <th class="px-4 py-3">Админ</th>
90 @endif 65 @endif
91 <th class="px-4 py-3">Дата регистрации</th> 66 <th class="px-4 py-3">Дата регистрации</th>
92 </tr> 67 </tr>
93 </thead> 68 </thead>
94 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> 69 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
95 @foreach($users as $user) 70 @foreach($users as $user)
96 <tr class="text-gray-700 dark:text-gray-400"> 71 <tr class="text-gray-700 dark:text-gray-400">
97 <td class="px-4 py-3"> 72 <td class="px-4 py-3">
98 {{$user->id}} 73 {{$user->id}}
99 </td> 74 </td>
100 <td class="px-4 py-3"> 75 <td class="px-4 py-3">
101 <!--<div class="flex items-center text-sm"> 76 <!--<div class="flex items-center text-sm">
102 <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> 77 <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block">
103 <div 78 <div
104 class="absolute inset-0 rounded-full shadow-inner" 79 class="absolute inset-0 rounded-full shadow-inner"
105 aria-hidden="true" 80 aria-hidden="true"
106 ></div> 81 ></div>
107 </div> 82 </div>
108 <div> 83 <div>
109 <p class="font-semibold"><a href="{{ route('admin.users') }}">Пользователи</a></p> 84 <p class="font-semibold"><a href="{{ route('admin.users') }}">Пользователи</a></p>
110 <p class="text-xs text-gray-600 dark:text-gray-400"> 85 <p class="text-xs text-gray-600 dark:text-gray-400">
111 Все пользователи сайта 86 Все пользователи сайта
112 </p> 87 </p>
113 </div> 88 </div>
114 </div> 89 </div>
115 --> 90 -->
116 {{ $user->name }} 91 {{ $user->name }}
117 </td> 92 </td>
118 <td class="px-4 py-3 text-sm"> 93 <td class="px-4 py-3 text-sm">
119 {{ $user->email }} 94 {{ $user->email }}
120 </td> 95 </td>
121 <td class="px-4 py-3 text-xs"> 96 <td class="px-4 py-3 text-xs">
122 <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"> 97 <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">
123 @if ($user->is_worker) 98 @if ($user->is_worker)
124 Работник 99 Работник
125 @else 100 @else
126 Работодатель 101 Работодатель
127 @endif 102 @endif
128 </span> 103 </span>
129 @if ($user->admin) 104 @if ($user->admin)
130 <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"> 105 <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">
131 Администратор 106 Администратор
132 </span> 107 </span>
133 @endif 108 @endif
134 </td> 109 </td>
135 <td class="px-4 py-3 text-sm"> 110 <td class="px-4 py-3 text-sm">
136 @if ($user->id > 1) 111 @if ($user->id > 1)
137 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_ban" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/> 112 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_ban" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/>
138 @endif 113 @endif
139 </td> 114 </td>
140 115
141 <td class="px-4 py-3 text-sm"> 116 <td class="px-4 py-3 text-sm">
142 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_new" name="new_{{$user->id}}" {{ ($user->is_new) ? "checked" : "" }}/> 117 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_new" name="new_{{$user->id}}" {{ ($user->is_new) ? "checked" : "" }}/>
143 </td> 118 </td>
144 119
145 @if ($id_admin == 1) 120 @if ($id_admin == 1)
146 <td class="px-4 py-3 text-sm"> 121 <td class="px-4 py-3 text-sm">
147 @if ($user->id > 1) 122 @if ($user->id > 1)
148 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/> 123 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/>
149 @endif 124 @endif
150 </td> 125 </td>
151 @endif 126 @endif
152 127
153 <td class="px-4 py-3 text-sm"> 128 <td class="px-4 py-3 text-sm">
154 {{ $user->created_at }} 129 {{ $user->created_at }}
155 </td> 130 </td>
156 </tr> 131 </tr>
157 @endforeach 132 @endforeach
158 </tbody> 133 </tbody>
159 </table> 134 </table>
160 </div> 135 </div>
161 136
162 <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"> 137 <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">
163 <?//=$users->appends($_GET)->links('admin.pagginate'); ?> 138 <?//=$users->appends($_GET)->links('admin.pagginate'); ?>
164 <?=$users->links('admin.pagginate'); ?> 139 <?=$users->links('admin.pagginate'); ?>
165 </div> 140 </div>
166 141
167 142
168 <!--<div 143 <!--<div
169 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" 144 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"
170 > 145 >
171 <span class="flex items-center col-span-3"> 146 <span class="flex items-center col-span-3">
172 Showing 21-30 of 100 147 Showing 21-30 of 100
173 </span> 148 </span>
174 <span class="col-span-2"></span> 149 <span class="col-span-2"></span>
175 150
176 <span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end"> 151 <span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end">
177 <nav aria-label="Table navigation"> 152 <nav aria-label="Table navigation">
178 <ul class="inline-flex items-center"> 153 <ul class="inline-flex items-center">
179 <li> 154 <li>
180 <button 155 <button
181 class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple" 156 class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple"
182 aria-label="Previous" 157 aria-label="Previous"
183 > 158 >
184 <svg 159 <svg
185 aria-hidden="true" 160 aria-hidden="true"
186 class="w-4 h-4 fill-current" 161 class="w-4 h-4 fill-current"
187 viewBox="0 0 20 20" 162 viewBox="0 0 20 20"
188 > 163 >
189 <path 164 <path
190 d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" 165 d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z"
191 clip-rule="evenodd" 166 clip-rule="evenodd"
192 fill-rule="evenodd" 167 fill-rule="evenodd"
193 ></path> 168 ></path>
194 </svg> 169 </svg>
195 </button> 170 </button>
196 </li> 171 </li>
197 <li> 172 <li>
198 <button 173 <button
199 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 174 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
200 > 175 >
201 1 176 1
202 </button> 177 </button>
203 </li> 178 </li>
204 <li> 179 <li>
205 <button 180 <button
206 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 181 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
207 > 182 >
208 2 183 2
209 </button> 184 </button>
210 </li> 185 </li>
211 <li> 186 <li>
212 <button 187 <button
213 class="px-3 py-1 text-white transition-colors duration-150 bg-purple-600 border border-r-0 border-purple-600 rounded-md focus:outline-none focus:shadow-outline-purple" 188 class="px-3 py-1 text-white transition-colors duration-150 bg-purple-600 border border-r-0 border-purple-600 rounded-md focus:outline-none focus:shadow-outline-purple"
214 > 189 >
215 3 190 3
216 </button> 191 </button>
217 </li> 192 </li>
218 <li> 193 <li>
219 <button 194 <button
220 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 195 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
221 > 196 >
222 4 197 4
223 </button> 198 </button>
224 </li> 199 </li>
225 <li> 200 <li>
226 <span class="px-3 py-1">...</span> 201 <span class="px-3 py-1">...</span>
227 </li> 202 </li>
228 <li> 203 <li>
229 <button 204 <button
230 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 205 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
231 > 206 >
232 8 207 8
233 </button> 208 </button>
234 </li> 209 </li>
235 <li> 210 <li>
236 <button 211 <button
237 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 212 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
238 > 213 >
239 9 214 9
240 </button> 215 </button>
241 </li> 216 </li>
242 <li> 217 <li>
243 <button 218 <button
244 class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple" 219 class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple"
245 aria-label="Next" 220 aria-label="Next"
246 > 221 >
247 <svg 222 <svg
248 class="w-4 h-4 fill-current" 223 class="w-4 h-4 fill-current"
249 aria-hidden="true" 224 aria-hidden="true"
250 viewBox="0 0 20 20" 225 viewBox="0 0 20 20"
251 > 226 >
252 <path 227 <path
253 d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" 228 d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
254 clip-rule="evenodd" 229 clip-rule="evenodd"
255 fill-rule="evenodd" 230 fill-rule="evenodd"
256 ></path> 231 ></path>
257 </svg> 232 </svg>
258 </button> 233 </button>
259 </li> 234 </li>
260 </ul> 235 </ul>
261 </nav> 236 </nav>
262 </span> 237 </span>
263 </div>--> 238 </div>-->
264 </div> 239 </div>
265 240
266 <?//=$users->appends($_GET)->links('catalogs.paginate'); ?> 241 <?//=$users->appends($_GET)->links('catalogs.paginate'); ?>
267 242
268 243
269 @endsection 244 @endsection
270 245
resources/views/admin/worker/index.blade.php
1 @extends('layout.admin', ['title' => 'Админка - Работники']) 1 @extends('layout.admin', ['title' => 'Админка - Работники'])
2 2
3 @section('script') 3 @section('script')
4 <script> 4 <script>
5 $(document).ready(function() { 5 $(document).ready(function() {
6 $(document).on('click', '.checkban', function () { 6 $(document).on('click', '.checkban', function () {
7 var this_ = $(this); 7 var this_ = $(this);
8 var value = this_.val(); 8 var value = this_.val();
9 var ajax_block = $('#ajax_block'); 9 var ajax_block = $('#ajax_block');
10 var bool = 0; 10 var bool = 0;
11 11
12 if(this.checked){ 12 if(this.checked){
13 bool = 1; 13 bool = 1;
14 } else { 14 } else {
15 bool = 0; 15 bool = 0;
16 } 16 }
17 17
18 $.ajax({ 18 $.ajax({
19 type: "GET", 19 type: "GET",
20 url: "{{ url()->full()}}", 20 url: "{{ url()->full()}}",
21 data: "id=" + value + "&is_ban=" + bool, 21 data: "id=" + value + "&is_ban=" + bool,
22 success: function (data) { 22 success: function (data) {
23 console.log('Обновление таблицы работников '); 23 console.log('Обновление таблицы работников ');
24 //data = JSON.parse(data); 24 //data = JSON.parse(data);
25 console.log(data); 25 console.log(data);
26 ajax_block.html(data); 26 ajax_block.html(data);
27 }, 27 },
28 headers: { 28 headers: {
29 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 29 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
30 }, 30 },
31 error: function (data) { 31 error: function (data) {
32 console.log('Error: ' + data); 32 console.log('Error: ' + data);
33 } 33 }
34 }); 34 });
35 }); 35 });
36 36
37 }); 37 });
38 </script> 38 </script>
39 @endsection 39 @endsection
40 40
41 @section('search') 41 @section('search')
42 <div class="absolute inset-y-0 flex items-center pl-2"> 42 @include('admin.find')
43 <svg
44 class="w-4 h-4"
45 aria-hidden="true"
46 fill="currentColor"
47 viewBox="0 0 20 20"
48 >
49 <path
50 fill-rule="evenodd"
51 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"
52 clip-rule="evenodd"
53 ></path>
54 </svg>
55 </div>
56 <form action="" method="POST">
57 <div style="float:left;"><input
58 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"
59 style="width: 400px"
60 type="text"
61 placeholder="Искать..."
62 aria-label="Search"
63 /></div>
64 <div style="float: left">
65 <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
66 </div>
67 </form>
68 @endsection 43 @endsection
69 44
70 @section('content') 45 @section('content')
71 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> 46 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
72 <div class="w-full overflow-x-auto"> 47 <div class="w-full overflow-x-auto">
73 <table class="w-full whitespace-no-wrap"> 48 <table class="w-full whitespace-no-wrap">
74 <thead> 49 <thead>
75 <tr 50 <tr
76 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" 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"
77 > 52 >
78 <th class="px-4 py-3">№</th> 53 <th class="px-4 py-3">№</th>
79 <th class="px-4 py-3">Имя</th> 54 <th class="px-4 py-3">Имя</th>
80 <th class="px-4 py-3">Email/Телефон</th> 55 <th class="px-4 py-3">Email/Телефон</th>
81 <th class="px-4 py-3">% заполнения анкеты</th> 56 <th class="px-4 py-3">% заполнения анкеты</th>
82 <th class="px-4 py-3">Дата регистрации</th> 57 <th class="px-4 py-3">Дата регистрации</th>
83 <th class="px-4 py-3">Изменить</th> 58 <th class="px-4 py-3">Изменить</th>
84 <th class="px-4 py-3">Бан</th> 59 <th class="px-4 py-3">Бан</th>
85 </tr> 60 </tr>
86 </thead> 61 </thead>
87 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> 62 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
88 @foreach($users as $user) 63 @foreach($users as $user)
89 <tr class="text-gray-700 dark:text-gray-400"> 64 <tr class="text-gray-700 dark:text-gray-400">
90 <td class="px-4 py-3"> 65 <td class="px-4 py-3">
91 {{$user->id}} 66 {{$user->id}}
92 </td> 67 </td>
93 <td class="px-4 py-3"> 68 <td class="px-4 py-3">
94 {{ !empty($user->name_man) ? $user->name_man : $user->name }} 69 {{ !empty($user->name_man) ? $user->name_man : $user->name }}
95 </td> 70 </td>
96 <td class="px-4 py-3 text-sm"> 71 <td class="px-4 py-3 text-sm">
97 <div class="flex items-center text-sm"> 72 <div class="flex items-center text-sm">
98 <div> 73 <div>
99 <p class="font-semibold">{{ empty($user->workers->email) ? $user->email : $user->workers->email }}</p> 74 <p class="font-semibold">{{ empty($user->workers->email) ? $user->email : $user->workers->email }}</p>
100 <p class="text-xs text-gray-600 dark:text-gray-400"> 75 <p class="text-xs text-gray-600 dark:text-gray-400">
101 {{ empty($user->workers->telephone) ? $user->telephone : $user->workers->telephone }} 76 {{ empty($user->workers->telephone) ? $user->telephone : $user->workers->telephone }}
102 </p> 77 </p>
103 </div> 78 </div>
104 </div> 79 </div>
105 </td> 80 </td>
106 <td class="px-4 py-3 text-xs"> 81 <td class="px-4 py-3 text-xs">
107 @if (!empty($user->workers->persent_anketa)) 82 @if (!empty($user->workers->persent_anketa))
108 @if ($user->workers->persent_anketa > 40) 83 @if ($user->workers->persent_anketa > 40)
109 <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"> 84 <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">
110 {{$user->workers->persent_anketa}}% 85 {{$user->workers->persent_anketa}}%
111 </span> 86 </span>
112 @else 87 @else
113 <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"> 88 <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">
114 {{$user->workers->persent_anketa}}% 89 {{$user->workers->persent_anketa}}%
115 </span> 90 </span>
116 @endif 91 @endif
117 @else 92 @else
118 <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"> 93 <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">
119 10% 94 10%
120 </span> 95 </span>
121 @endif 96 @endif
122 </td> 97 </td>
123 <td class="px-4 py-3 text-sm"> 98 <td class="px-4 py-3 text-sm">
124 {{ $user->created_at }} 99 {{ $user->created_at }}
125 </td> 100 </td>
126 <td class="px-4 py-3 text-sm"> 101 <td class="px-4 py-3 text-sm">
127 @if ($user->id > 1) 102 @if ($user->id > 1)
128 <a href="{{ route('admin.user-profile', ['user' => $user->id]) }}">Изменить</a> 103 <a href="{{ route('admin.user-profile', ['user' => $user->id]) }}">Изменить</a>
129 @endif 104 @endif
130 </td> 105 </td>
131 <td class="px-4 py-3 text-sm"> 106 <td class="px-4 py-3 text-sm">
132 @if ($user->id > 1) 107 @if ($user->id > 1)
133 <input type="checkbox" class="checkban" value="{{$user->id}}" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/> 108 <input type="checkbox" class="checkban" value="{{$user->id}}" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/>
134 @endif 109 @endif
135 </td> 110 </td>
136 </tr> 111 </tr>
137 @endforeach 112 @endforeach
138 </tbody> 113 </tbody>
139 </table> 114 </table>
140 </div> 115 </div>
141 116
142 <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"> 117 <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">
143 <?=$users->appends($_GET)->links('admin.pagginate'); ?> 118 <?=$users->appends($_GET)->links('admin.pagginate'); ?>
144 </div> 119 </div>
145 120
146 121
147 <!--<div 122 <!--<div
148 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" 123 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"
149 > 124 >
150 <span class="flex items-center col-span-3"> 125 <span class="flex items-center col-span-3">
151 Showing 21-30 of 100 126 Showing 21-30 of 100
152 </span> 127 </span>
153 <span class="col-span-2"></span> 128 <span class="col-span-2"></span>
154 129
155 <span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end"> 130 <span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end">
156 <nav aria-label="Table navigation"> 131 <nav aria-label="Table navigation">
157 <ul class="inline-flex items-center"> 132 <ul class="inline-flex items-center">
158 <li> 133 <li>
159 <button 134 <button
160 class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple" 135 class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple"
161 aria-label="Previous" 136 aria-label="Previous"
162 > 137 >
163 <svg 138 <svg
164 aria-hidden="true" 139 aria-hidden="true"
165 class="w-4 h-4 fill-current" 140 class="w-4 h-4 fill-current"
166 viewBox="0 0 20 20" 141 viewBox="0 0 20 20"
167 > 142 >
168 <path 143 <path
169 d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" 144 d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z"
170 clip-rule="evenodd" 145 clip-rule="evenodd"
171 fill-rule="evenodd" 146 fill-rule="evenodd"
172 ></path> 147 ></path>
173 </svg> 148 </svg>
174 </button> 149 </button>
175 </li> 150 </li>
176 <li> 151 <li>
177 <button 152 <button
178 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 153 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
179 > 154 >
180 1 155 1
181 </button> 156 </button>
182 </li> 157 </li>
183 <li> 158 <li>
184 <button 159 <button
185 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 160 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
186 > 161 >
187 2 162 2
188 </button> 163 </button>
189 </li> 164 </li>
190 <li> 165 <li>
191 <button 166 <button
192 class="px-3 py-1 text-white transition-colors duration-150 bg-purple-600 border border-r-0 border-purple-600 rounded-md focus:outline-none focus:shadow-outline-purple" 167 class="px-3 py-1 text-white transition-colors duration-150 bg-purple-600 border border-r-0 border-purple-600 rounded-md focus:outline-none focus:shadow-outline-purple"
193 > 168 >
194 3 169 3
195 </button> 170 </button>
196 </li> 171 </li>
197 <li> 172 <li>
198 <button 173 <button
199 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 174 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
200 > 175 >
201 4 176 4
202 </button> 177 </button>
203 </li> 178 </li>
204 <li> 179 <li>
205 <span class="px-3 py-1">...</span> 180 <span class="px-3 py-1">...</span>
206 </li> 181 </li>
207 <li> 182 <li>
208 <button 183 <button
209 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 184 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
210 > 185 >
211 8 186 8
212 </button> 187 </button>
213 </li> 188 </li>
214 <li> 189 <li>
215 <button 190 <button
216 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 191 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
217 > 192 >
218 9 193 9
219 </button> 194 </button>
220 </li> 195 </li>
221 <li> 196 <li>
222 <button 197 <button
223 class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple" 198 class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple"
224 aria-label="Next" 199 aria-label="Next"
225 > 200 >
226 <svg 201 <svg
227 class="w-4 h-4 fill-current" 202 class="w-4 h-4 fill-current"
228 aria-hidden="true" 203 aria-hidden="true"
229 viewBox="0 0 20 20" 204 viewBox="0 0 20 20"
230 > 205 >
231 <path 206 <path
232 d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" 207 d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
233 clip-rule="evenodd" 208 clip-rule="evenodd"
234 fill-rule="evenodd" 209 fill-rule="evenodd"
235 ></path> 210 ></path>
236 </svg> 211 </svg>
237 </button> 212 </button>
238 </li> 213 </li>
239 </ul> 214 </ul>
240 </nav> 215 </nav>
241 </span> 216 </span>
242 </div>--> 217 </div>-->
243 </div> 218 </div>
244 219
245 <?//=$users->appends($_GET)->links('catalogs.paginate'); ?> 220 <?//=$users->appends($_GET)->links('catalogs.paginate'); ?>
246 221
247 222
248 @endsection 223 @endsection
249 224
1 <?php 1 <?php
2 2
3 use App\Http\Controllers\Admin\AdminController; 3 use App\Http\Controllers\Admin\AdminController;
4 use App\Http\Controllers\Admin\CategoryController; 4 use App\Http\Controllers\Admin\CategoryController;
5 use App\Http\Controllers\Admin\EmployersController; 5 use App\Http\Controllers\Admin\EmployersController;
6 use App\Http\Controllers\Admin\InfoBloksController; 6 use App\Http\Controllers\Admin\InfoBloksController;
7 use App\Http\Controllers\Admin\JobTitlesController; 7 use App\Http\Controllers\Admin\JobTitlesController;
8 use App\Http\Controllers\Admin\UsersController; 8 use App\Http\Controllers\Admin\UsersController;
9 use App\Http\Controllers\Admin\WorkersController; 9 use App\Http\Controllers\Admin\WorkersController;
10 use App\Http\Controllers\Auth\LoginController; 10 use App\Http\Controllers\Auth\LoginController;
11 use App\Http\Controllers\Auth\RegisterController; 11 use App\Http\Controllers\Auth\RegisterController;
12 use App\Http\Controllers\CKEditorController; 12 use App\Http\Controllers\CKEditorController;
13 use App\Models\User; 13 use App\Models\User;
14 use App\Http\Controllers\MainController; 14 use App\Http\Controllers\MainController;
15 use App\Http\Controllers\HomeController; 15 use App\Http\Controllers\HomeController;
16 use Illuminate\Support\Facades\Route; 16 use Illuminate\Support\Facades\Route;
17 use App\Http\Controllers\Admin\CompanyController; 17 use App\Http\Controllers\Admin\CompanyController;
18 use App\Http\Controllers\Admin\Ad_EmployersController; 18 use App\Http\Controllers\Admin\Ad_EmployersController;
19 use App\Http\Controllers\Admin\MsgAnswersController; 19 use App\Http\Controllers\Admin\MsgAnswersController;
20 use App\Http\Controllers\Admin\GroupsController; 20 use App\Http\Controllers\Admin\GroupsController;
21 use App\Http\Controllers\PagesController; 21 use App\Http\Controllers\PagesController;
22 use Illuminate\Support\Facades\Storage; 22 use Illuminate\Support\Facades\Storage;
23 23
24 24
25 /* 25 /*
26 |-------------------------------------------------------------------------- 26 |--------------------------------------------------------------------------
27 | Web Routes 27 | Web Routes
28 |-------------------------------------------------------------------------- 28 |--------------------------------------------------------------------------
29 | 29 |
30 | Here is where you can register web routes for your application. These 30 | Here is where you can register web routes for your application. These
31 | routes are loaded by the RouteServiceProvider within a group which 31 | routes are loaded by the RouteServiceProvider within a group which
32 | contains the "web" middleware group. Now create something great! 32 | contains the "web" middleware group. Now create something great!
33 | 33 |
34 */ 34 */
35 /* 35 /*
36 Route::get('/', function () { 36 Route::get('/', function () {
37 return view('welcome'); 37 return view('welcome');
38 })->name('index'); 38 })->name('index');
39 */ 39 */
40 Route::get('/', [MainController::class, 'index'])->name('index'); 40 Route::get('/', [MainController::class, 'index'])->name('index');
41 41
42 //Роуты авторизации, регистрации, восстановления, аутентификации 42 //Роуты авторизации, регистрации, восстановления, аутентификации
43 Auth::routes(['verify' => true]); 43 Auth::routes(['verify' => true]);
44 //Личный кабинет пользователя 44 //Личный кабинет пользователя
45 Route::get('/home', [HomeController::class, 'index'])->name('home'); 45 Route::get('/home', [HomeController::class, 'index'])->name('home');
46 46
47 /* 47 /*
48 Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) { 48 Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) {
49 $user = User::where('email',$request->input('email'))->first(); 49 $user = User::where('email',$request->input('email'))->first();
50 50
51 $user->sendEmailVerificationNotification(); 51 $user->sendEmailVerificationNotification();
52 52
53 return 'your response'; 53 return 'your response';
54 })->middleware('throttle:6,1')->name('verification.resend'); 54 })->middleware('throttle:6,1')->name('verification.resend');
55 */ 55 */
56 56
57 // Авторизация, регистрация в админку 57 // Авторизация, регистрация в админку
58 Route::group([ 58 Route::group([
59 'as' => 'admin.', // имя маршрута, например auth.index 59 'as' => 'admin.', // имя маршрута, например auth.index
60 'prefix' => 'admin', // префикс маршрута, например auth/index 60 'prefix' => 'admin', // префикс маршрута, например auth/index
61 'middleware' => ['guest'], 61 'middleware' => ['guest'],
62 ], function () { 62 ], function () {
63 // Форма регистрации 63 // Форма регистрации
64 Route::get('register', [AdminController::class, 'register'])->name('register'); 64 Route::get('register', [AdminController::class, 'register'])->name('register');
65 65
66 // Создание пользователя 66 // Создание пользователя
67 Route::post('register', [AdminController::class, 'create'])->name('create'); 67 Route::post('register', [AdminController::class, 'create'])->name('create');
68 //Форма входа 68 //Форма входа
69 Route::get('login', [AdminController::class, 'login'])->name('login'); 69 Route::get('login', [AdminController::class, 'login'])->name('login');
70 70
71 // аутентификация 71 // аутентификация
72 Route::post('login', [AdminController::class, 'autenticate'])->name('auth'); 72 Route::post('login', [AdminController::class, 'autenticate'])->name('auth');
73 73
74 }); 74 });
75 75
76 // Личный кабинет админки 76 // Личный кабинет админки
77 Route::group([ 77 Route::group([
78 'as' => 'admin.', // имя маршрута, например auth.index 78 'as' => 'admin.', // имя маршрута, например auth.index
79 'prefix' => 'admin', // префикс маршрута, например auth/index 79 'prefix' => 'admin', // префикс маршрута, например auth/index
80 'middleware' => ['auth'], ['admin'], 80 'middleware' => ['auth'], ['admin'],
81 ], function() { 81 ], function() {
82 82
83 // выход 83 // выход
84 Route::get('logout', [AdminController::class, 'logout'])->name('logout'); 84 Route::get('logout', [AdminController::class, 'logout'])->name('logout');
85 85
86 // кабинет главная страница 86 // кабинет главная страница
87 Route::get('cabinet', [AdminController::class, 'index'])->name('index'); 87 Route::get('cabinet', [AdminController::class, 'index'])->name('index');
88 88
89 // кабинет профиль админа - форма 89 // кабинет профиль админа - форма
90 Route::get('profile', [AdminController::class, 'profile'])->name('profile'); 90 Route::get('profile', [AdminController::class, 'profile'])->name('profile');
91 // кабинет профиль админа - сохранение формы 91 // кабинет профиль админа - сохранение формы
92 Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile'); 92 Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile');
93 93
94 //кабинет сообщения админа 94 //кабинет сообщения админа
95 //Route::get('messages', [AdminController::class, 'profile'])->name('profile'); 95 //Route::get('messages', [AdminController::class, 'profile'])->name('profile');
96 96
97 97
98 // кабинет профиль - форма пароли 98 // кабинет профиль - форма пароли
99 Route::get('password', [AdminController::class, 'profile_password'])->name('password'); 99 Route::get('password', [AdminController::class, 'profile_password'])->name('password');
100 // кабинет профиль - сохранение формы пароля 100 // кабинет профиль - сохранение формы пароля
101 Route::post('password', [AdminController::class, 'profile_password_new'])->name('password'); 101 Route::post('password', [AdminController::class, 'profile_password_new'])->name('password');
102 102
103 103
104 // кабинет профиль пользователя - форма 104 // кабинет профиль пользователя - форма
105 Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile'); 105 Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile');
106 // кабинет профиль пользователя - сохранение формы 106 // кабинет профиль пользователя - сохранение формы
107 Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile'); 107 Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile');
108 108
109 // кабинет профиль работодатель - форма 109 // кабинет профиль работодатель - форма
110 Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile'); 110 Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile');
111 // кабинет профиль работодатель - сохранение формы 111 // кабинет профиль работодатель - сохранение формы
112 Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile'); 112 Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile');
113 113
114 // кабинет профиль работник - форма 114 // кабинет профиль работник - форма
115 Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile'); 115 Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile');
116 116
117 // кабинет настройки сайта - форма 117 // кабинет настройки сайта - форма
118 Route::get('config', [AdminController::class, 'config_form'])->name('config'); 118 Route::get('config', [AdminController::class, 'config_form'])->name('config');
119 // кабинет настройки сайта сохранение формы 119 // кабинет настройки сайта сохранение формы
120 Route::post('config', [AdminController::class, 'store_config'])->name('store_config'); 120 Route::post('config', [AdminController::class, 'store_config'])->name('store_config');
121 121
122 // кабинет - пользователи 122 // кабинет - пользователи
123 Route::get('users', [UsersController::class, 'index'])->name('users'); 123 Route::get('users', [UsersController::class, 'index'])->name('users');
124 124
125 // кабинет - пользователи 125 // кабинет - пользователи
126 Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users'); 126 Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users');
127 127
128 // кабинет - работодатели 128 // кабинет - работодатели
129 Route::get('employers', [EmployersController::class, 'index'])->name('employers'); 129 Route::get('employers', [EmployersController::class, 'index'])->name('employers');
130 130
131 // кабинет - соискатели 131 // кабинет - соискатели
132 Route::get('workers', [WorkersController::class, 'index'])->name('workers'); 132 Route::get('workers', [WorkersController::class, 'index'])->name('workers');
133 133
134 // кабинет - вакансии 134 // кабинет - вакансии
135 Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers'); 135 Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers');
136 136
137 // кабинет - категории 137 // кабинет - категории
138 //Route::get('categories', [AdminController::class, 'index'])->name('categories'); 138 //Route::get('categories', [AdminController::class, 'index'])->name('categories');
139 /* 139 /*
140 * CRUD-операции над Справочником Категории 140 * CRUD-операции над Справочником Категории
141 */ 141 */
142 Route::resource('categories', CategoryController::class, ['except' => ['show']]); 142 Route::resource('categories', CategoryController::class, ['except' => ['show']]);
143 143
144 144
145 //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles'); 145 //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles');
146 /* 146 /*
147 * кабинет - CRUD-операции по справочнику должности 147 * кабинет - CRUD-операции по справочнику должности
148 * 148 *
149 */ 149 */
150 Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]); 150 Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]);
151 151
152 // кабинет - сообщения (чтение чужих) 152 // кабинет - сообщения (чтение чужих)
153 Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages'); 153 Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages');
154 // кабинет - сообщения (админские) 154 // кабинет - сообщения (админские)
155 Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages'); 155 Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages');
156 // кабинет - сообщения (админские) 156 // кабинет - сообщения (админские)
157 Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post'); 157 Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post');
158 // кабинет - sql - конструкция запросов
159 Route::get('messages-sql', [MsgAnswersController::class, 'messages_sql'])->name('messages-sql');
158 160
159 /* 161 /*
160 * Расписанный подход в описании каждой директорий групп пользователей. 162 * Расписанный подход в описании каждой директорий групп пользователей.
161 */ 163 */
162 // кабинет - группы пользователей 164 // кабинет - группы пользователей
163 Route::get('groups', [GroupsController::class, 'index'])->name('groups'); 165 Route::get('groups', [GroupsController::class, 'index'])->name('groups');
164 // кабинет - добавление форма группы пользователей 166 // кабинет - добавление форма группы пользователей
165 Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group'); 167 Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group');
166 // кабинет - сохранение формы группы пользователей 168 // кабинет - сохранение формы группы пользователей
167 Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store'); 169 Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store');
168 // кабинет - редактирование форма группы пользователей 170 // кабинет - редактирование форма группы пользователей
169 Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group'); 171 Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group');
170 // кабинет - сохранение редактированной формы группы пользователей 172 // кабинет - сохранение редактированной формы группы пользователей
171 Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group'); 173 Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group');
172 // кабинет - удаление группы пользователей 174 // кабинет - удаление группы пользователей
173 Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group'); 175 Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group');
174 176
175 177
176 // кабинет - список админов 178 // кабинет - список админов
177 Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin'); 179 Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin');
178 180
179 181
180 /////редактор////// кабинет - редактор сайта//////////////////////// 182 /////редактор////// кабинет - редактор сайта////////////////////////
181 Route::get('editor-site', function() { 183 Route::get('editor-site', function() {
182 return view('admin.editor.index'); 184 return view('admin.editor.index');
183 })->name('editor-site'); 185 })->name('editor-site');
184 186
185 187
186 // кабинет - редактор шапки-футера сайта 188 // кабинет - редактор шапки-футера сайта
187 Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks'); 189 Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks');
188 Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block'); 190 Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block');
189 Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store'); 191 Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store');
190 Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block'); 192 Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block');
191 Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block'); 193 Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block');
192 Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block'); 194 Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block');
193 Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block'); 195 Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block');
194 196
195 197
196 // кабинет - редактор должности на главной 198 // кабинет - редактор должности на главной
197 Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main'); 199 Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main');
198 200
199 // кабинет - редактор работодатели на главной 201 // кабинет - редактор работодатели на главной
200 Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main'); 202 Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main');
201 203
202 204
203 // кабинет - редактор seo-сайта 205 // кабинет - редактор seo-сайта
204 Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo'); 206 Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo');
205 Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo'); 207 Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo');
206 Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store'); 208 Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store');
207 Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo'); 209 Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo');
208 Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo'); 210 Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo');
209 Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo'); 211 Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo');
210 Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo'); 212 Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo');
211 213
212 214
213 // кабинет - редактор страниц 215 // кабинет - редактор страниц
214 Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages'); 216 Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages');
215 // кабинет - добавление страницы 217 // кабинет - добавление страницы
216 Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page'); 218 Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page');
217 // кабинет - сохранение формы страницы 219 // кабинет - сохранение формы страницы
218 Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store'); 220 Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store');
219 // кабинет - редактирование форма страницы 221 // кабинет - редактирование форма страницы
220 Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page'); 222 Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page');
221 // кабинет - сохранение редактированной формы страницы 223 // кабинет - сохранение редактированной формы страницы
222 Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page'); 224 Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page');
223 // кабинет - удаление страницы 225 // кабинет - удаление страницы
224 Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page'); 226 Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page');
225 227
226 228
227 // кабинет - реклама сайта 229 // кабинет - реклама сайта
228 Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames'); 230 Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames');
229 Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames'); 231 Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames');
230 Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store'); 232 Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store');
231 Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames'); 233 Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames');
232 Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames'); 234 Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames');
233 Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames'); 235 Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames');
234 //////////////////////////////////////////////////////////////////////// 236 ////////////////////////////////////////////////////////////////////////
235 237
236 238
237 // кабинет - отзывы о работодателе для модерации 239 // кабинет - отзывы о работодателе для модерации
238 Route::get('answers', [EmployersController::class, 'answers'])->name('answers'); 240 Route::get('answers', [EmployersController::class, 'answers'])->name('answers');
239 241
240 // Общая страница статистики 242 // Общая страница статистики
241 Route::get('statics', function () { 243 Route::get('statics', function () {
242 return view('admin.static.index'); 244 return view('admin.static.index');
243 })->name('statics'); 245 })->name('statics');
244 246
245 // кабинет - статистика работников 247 // кабинет - статистика работников
246 Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers'); 248 Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers');
247 249
248 // кабинет - статистика вакансий работодателя 250 // кабинет - статистика вакансий работодателя
249 Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads'); 251 Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads');
250 252
251 // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника 253 // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника
252 /* 254 /*
253 * CRUD-операции над справочником дипломы и документы 255 * CRUD-операции над справочником дипломы и документы
254 */ 256 */
255 //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks'); 257 //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks');
256 Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]); 258 Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]);
257 259
258 // кабинет - роли пользователя 260 // кабинет - роли пользователя
259 Route::get('roles', [UsersController::class, 'roles'])->name('roles'); 261 Route::get('roles', [UsersController::class, 'roles'])->name('roles');
260 262
261 Route::get('logs', function() { 263 Route::get('logs', function() {
262 $files = Storage::files('logs/laravel.log'); 264 $files = Storage::files('logs/laravel.log');
263 print_r($files); 265 print_r($files);
264 })->name('logs'); 266 })->name('logs');
265 267
266 }); 268 });
267 269
268 Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload'); 270 Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload');
269 271
270 Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page'); 272 Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page');
271 273