Commit 8de0354752f13a42cee695de578d97b9140e6585
1 parent
02a1ed535c
Exists in
master
and in
1 other branch
Создание: Структура БД и админки
Showing 23 changed files with 1456 additions and 47 deletions Side-by-side Diff
- app/Http/Controllers/Admin/AdminController.php
- app/Http/Controllers/Admin/EmployersController.php
- app/Http/Controllers/Admin/UsersController.php
- app/Http/Controllers/Admin/WorkersController.php
- app/Models/Employer.php
- app/Models/User.php
- app/Models/Worker.php
- database/migrations/2023_05_17_090650_alter_group_users_table.php
- database/migrations/2023_05_17_090749_alter_messages_table.php
- database/migrations/2023_05_17_090923_alter_employers_table.php
- database/migrations/2023_05_17_090944_alter_workers_table.php
- database/migrations/2023_05_17_095512_alter_users_table.php
- resources/views/admin/employer/index.blade.php
- resources/views/admin/employer/index_ajax.blade.php
- resources/views/admin/login.blade.php
- resources/views/admin/pagginate.blade.php
- resources/views/admin/register.blade.php
- resources/views/admin/users/index.blade.php
- resources/views/admin/users/index_ajax.blade.php
- resources/views/admin/worker/index.blade.php
- resources/views/admin/worker/index_ajax.blade.php
- resources/views/layout/admin.blade.php
- routes/web.php
app/Http/Controllers/Admin/AdminController.php
... | ... | @@ -8,6 +8,7 @@ use App\Models\User; |
8 | 8 | use Illuminate\Http\Request; |
9 | 9 | use Illuminate\Support\Facades\Auth; |
10 | 10 | use Illuminate\Support\Facades\Hash; |
11 | +use Illuminate\Support\Facades\Validator; | |
11 | 12 | |
12 | 13 | class AdminController extends Controller |
13 | 14 | { |
... | ... | @@ -27,21 +28,44 @@ class AdminController extends Controller |
27 | 28 | } |
28 | 29 | |
29 | 30 | public function create(Request $request) { |
30 | - $request->validate([ | |
31 | + | |
32 | + $rules = [ | |
31 | 33 | 'name' => 'required|string|max:255', |
32 | 34 | 'email' => 'required|string|email|max:255|unique:users', |
33 | 35 | 'password' => 'required|string|min:8|confirmed', |
34 | - ]); | |
35 | - | |
36 | - User::create([ | |
37 | - 'name' => $request->name, | |
38 | - 'email' => $request->email, | |
39 | - 'password' => Hash::make($request->password), | |
40 | - ]); | |
41 | - | |
42 | - return redirect() | |
43 | - ->route('admin.login') | |
44 | - ->with('success', 'Вы успешно зарегистрировались'); | |
36 | + ]; | |
37 | + | |
38 | + $messages = [ | |
39 | + 'required' => 'Укажите обязательное поле «:attribute»', | |
40 | + 'confirmed' => 'Пароли не совпадают', | |
41 | + 'email' => 'Введите корректный email', | |
42 | + 'min' => [ | |
43 | + 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | |
44 | + 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | |
45 | + ], | |
46 | + 'max' => [ | |
47 | + 'string' => 'Поле «:attribute» должно быть не больше :max символов', | |
48 | + 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | |
49 | + ], | |
50 | + ]; | |
51 | + | |
52 | + $validator = Validator::make($request->all(), $rules, $messages); | |
53 | + | |
54 | + if ($validator->fails()) { | |
55 | + return back()->withErrors($validator)->withInput(); //->route('admin.register') | |
56 | + | |
57 | + } else { | |
58 | + $params = $request->all(); | |
59 | + | |
60 | + User::create([ | |
61 | + 'name' => $request->name, | |
62 | + 'email' => $request->email, | |
63 | + 'password' => Hash::make($request->password), | |
64 | + ]); | |
65 | + return redirect() | |
66 | + ->route('admin.login') | |
67 | + ->with('success', 'Вы успешно зарегистрировались'); | |
68 | + } | |
45 | 69 | } |
46 | 70 | |
47 | 71 | public function login() { |
... | ... | @@ -50,39 +74,59 @@ class AdminController extends Controller |
50 | 74 | |
51 | 75 | // Аутентификация |
52 | 76 | public function autenticate(Request $request) { |
53 | - $request->validate([ | |
77 | + //$request->validate( | |
78 | + $rules = [ | |
54 | 79 | 'email' => 'required|string|email', |
55 | 80 | 'password' => 'required|string', |
56 | - ]); | |
81 | + ]; | |
57 | 82 | |
58 | - $credentials = $request->only('email', 'password'); | |
83 | + $messages = [ | |
84 | + 'required' => 'Укажите обязательное поле «:attribute»', | |
85 | + 'email' => 'Введите корректный email', | |
86 | + 'min' => [ | |
87 | + 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | |
88 | + 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | |
89 | + ], | |
90 | + 'max' => [ | |
91 | + 'string' => 'Поле «:attribute» должно быть не больше :max символов', | |
92 | + 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | |
93 | + ], | |
94 | + ]; | |
59 | 95 | |
60 | - if (Auth::attempt($credentials, $request->has('remember'))) { | |
61 | 96 | |
62 | - if (is_null(Auth::user()->email_verified_at)) | |
63 | - { | |
64 | - Auth::logout(); | |
65 | - return redirect() | |
66 | - ->route('admin.login') | |
67 | - ->withErrors('Адрес почты не подтвержден'); | |
68 | - } | |
97 | + $validator = Validator::make($request->all(), $rules, $messages); | |
69 | 98 | |
70 | - if (!Auth::user()->admin) { | |
71 | - Auth::logout(); | |
72 | - return redirect() | |
73 | - ->route('admin.login') | |
74 | - ->withErrors('Вы не являетесь админом!'); | |
99 | + if ($validator->fails()) { | |
100 | + return back()->withErrors($validator)->withInput(); | |
75 | 101 | |
76 | - } | |
102 | + } else { | |
77 | 103 | |
78 | - return redirect() | |
79 | - ->route('admin.index') | |
80 | - ->with('success', 'Вы вошли в личный кабинет.'); | |
104 | + $credentials = $request->only('email', 'password'); | |
105 | + | |
106 | + if (Auth::attempt($credentials, $request->has('remember'))) { | |
107 | + | |
108 | + if (is_null(Auth::user()->email_verified_at)) { | |
109 | + Auth::logout(); | |
110 | + return back()->withErrors('Адрес почты не подтвержден')->withInput(); | |
111 | + } | |
112 | + | |
113 | + if (!Auth::user()->admin) { | |
114 | + Auth::logout(); | |
115 | + return //redirect()->route('admin.login') | |
116 | + back()->withErrors('Вы не являетесь админом!')->withInput();; | |
117 | + | |
118 | + } | |
119 | + | |
120 | + return redirect() | |
121 | + ->route('admin.index') | |
122 | + ->with('success', 'Вы вошли в личный кабинет.'); | |
123 | + } | |
81 | 124 | } |
82 | 125 | |
83 | 126 | return redirect() |
84 | 127 | ->route('admin.login') |
85 | - ->withErrors('Неверный логин или пароль!'); | |
128 | + ->withErrors('Неверный логин или пароль!')->withInput(); | |
129 | + | |
86 | 130 | } |
87 | 131 | |
88 | 132 | public function logout() { |
... | ... | @@ -99,6 +143,20 @@ class AdminController extends Controller |
99 | 143 | return view('admin.index', compact('all_employer', 'all_user', 'all_worker', 'all_admin')); |
100 | 144 | } |
101 | 145 | |
146 | + public function index_admin(Request $request) { | |
147 | + if ($request->ajax()) { | |
148 | + $user = User::find($request->id); | |
149 | + $request->offsetUnset('id'); | |
150 | + $user->update($request->all()); | |
151 | + } | |
152 | + | |
153 | + $users = User::where('admin', '1')->paginate(15); | |
102 | 154 | |
155 | + if ($request->ajax()) { | |
156 | + return view('admin.users.index_ajax', compact('users')); | |
157 | + } else { | |
158 | + return view('admin.users.index', compact('users')); | |
159 | + } | |
160 | + } | |
103 | 161 | |
104 | 162 | } |
app/Http/Controllers/Admin/EmployersController.php
... | ... | @@ -0,0 +1,25 @@ |
1 | +<?php | |
2 | + | |
3 | +namespace App\Http\Controllers\Admin; | |
4 | + | |
5 | +use App\Http\Controllers\Controller; | |
6 | +use App\Models\User; | |
7 | +use Illuminate\Http\Request; | |
8 | + | |
9 | +class EmployersController extends Controller | |
10 | +{ | |
11 | + public function index(Request $request) { | |
12 | + if ($request->ajax()) { | |
13 | + $user = User::find($request->id); | |
14 | + $request->offsetUnset('id'); | |
15 | + $user->update($request->all()); | |
16 | + } | |
17 | + | |
18 | + $users = User::where('is_worker', '0')->paginate(15); | |
19 | + if ($request->ajax()) { | |
20 | + return view('admin.employer.index_ajax', compact('users')); | |
21 | + } else { | |
22 | + return view('admin.employer.index', compact('users')); | |
23 | + } | |
24 | + } | |
25 | +} |
app/Http/Controllers/Admin/UsersController.php
... | ... | @@ -0,0 +1,27 @@ |
1 | +<?php | |
2 | + | |
3 | +namespace App\Http\Controllers\Admin; | |
4 | + | |
5 | +use App\Http\Controllers\Controller; | |
6 | +use App\Models\User; | |
7 | +use Illuminate\Http\Request; | |
8 | + | |
9 | +class UsersController extends Controller | |
10 | +{ | |
11 | + public function index(Request $request) { | |
12 | + if ($request->ajax()) { | |
13 | + $user = User::find($request->id); | |
14 | + $request->offsetUnset('id'); | |
15 | + $user->update($request->all()); | |
16 | + } | |
17 | + | |
18 | + $users = User::query()->paginate(15); | |
19 | + | |
20 | + if ($request->ajax()) { | |
21 | + return view('admin.users.index_ajax', compact('users')); | |
22 | + } else { | |
23 | + return view('admin.users.index', compact('users')); | |
24 | + } | |
25 | + } | |
26 | + | |
27 | +} |
app/Http/Controllers/Admin/WorkersController.php
... | ... | @@ -0,0 +1,26 @@ |
1 | +<?php | |
2 | + | |
3 | +namespace App\Http\Controllers\Admin; | |
4 | + | |
5 | +use App\Http\Controllers\Controller; | |
6 | +use App\Models\User; | |
7 | +use Illuminate\Http\Request; | |
8 | + | |
9 | +class WorkersController extends Controller | |
10 | +{ | |
11 | + public function index(Request $request) { | |
12 | + if ($request->ajax()) { | |
13 | + $user = User::find($request->id); | |
14 | + $request->offsetUnset('id'); | |
15 | + $user->update($request->all()); | |
16 | + } | |
17 | + | |
18 | + $users = User::where('is_worker', '1')->paginate(15); | |
19 | + | |
20 | + if ($request->ajax()) { | |
21 | + return view('admin.worker.index_ajax', compact('users')); | |
22 | + } else { | |
23 | + return view('admin.worker.index', compact('users')); | |
24 | + } | |
25 | + } | |
26 | +} |
app/Models/Employer.php
... | ... | @@ -8,4 +8,26 @@ use Illuminate\Database\Eloquent\Model; |
8 | 8 | class Employer extends Model |
9 | 9 | { |
10 | 10 | use HasFactory; |
11 | + | |
12 | + protected $fillable = [ | |
13 | + 'name_company', | |
14 | + 'email', | |
15 | + 'telephone', | |
16 | + 'logo', | |
17 | + 'rate', | |
18 | + 'user_id', | |
19 | + 'sort', | |
20 | + 'text', | |
21 | + 'address', | |
22 | + 'map', | |
23 | + 'site', | |
24 | + ]; | |
25 | + | |
26 | + /* | |
27 | + * Связь таблицы users с таблицей employers | |
28 | + */ | |
29 | + public function users() { | |
30 | + return $this->belongsTo(User::class, 'user_id'); | |
31 | + } | |
32 | + | |
11 | 33 | } |
app/Models/User.php
... | ... | @@ -21,6 +21,18 @@ class User extends Authenticatable |
21 | 21 | 'name', |
22 | 22 | 'email', |
23 | 23 | 'password', |
24 | + 'admin', | |
25 | + 'telephone', | |
26 | + 'surname', | |
27 | + 'name_man', | |
28 | + 'surname2', | |
29 | + 'is_worker', | |
30 | + 'is_lookin', | |
31 | + 'is_message', | |
32 | + 'is_public', | |
33 | + 'is_remove', | |
34 | + 'is_ban', | |
35 | + 'is_new', | |
24 | 36 | ]; |
25 | 37 | |
26 | 38 | /** |
... | ... | @@ -41,4 +53,46 @@ class User extends Authenticatable |
41 | 53 | protected $casts = [ |
42 | 54 | 'email_verified_at' => 'datetime', |
43 | 55 | ]; |
56 | + | |
57 | + /* | |
58 | + * Связь Пользователей системы с работодателями | |
59 | + * users - employers | |
60 | + */ | |
61 | + public function employers() { | |
62 | + return $this->hasMany(Employer::class); | |
63 | + } | |
64 | + | |
65 | + /* | |
66 | + * Связь Пользователей системы с работниками | |
67 | + * users - workers | |
68 | + */ | |
69 | + public function workers() { | |
70 | + return $this->hasMany(Worker::class); | |
71 | + } | |
72 | + | |
73 | + /* | |
74 | + * Связь Пользователей системы с группами юзеров | |
75 | + * users - group_users | |
76 | + */ | |
77 | + public function groups() { | |
78 | + return $this->hasMany(Group_user::class); | |
79 | + } | |
80 | + | |
81 | + /* | |
82 | + * Связь Пользователей системы с ссобщениями | |
83 | + * users - messages | |
84 | + */ | |
85 | + public function messages() { | |
86 | + return $this->hasMany(Message::class); | |
87 | + } | |
88 | + | |
89 | + /* | |
90 | + * Связь Пользователей системы с статистика | |
91 | + * users - static_workers | |
92 | + */ | |
93 | + public function static_user() { | |
94 | + return $this->hasMany(Static_worker::class); | |
95 | + } | |
96 | + | |
97 | + | |
44 | 98 | } |
app/Models/Worker.php
... | ... | @@ -8,4 +8,43 @@ use Illuminate\Database\Eloquent\Model; |
8 | 8 | class Worker extends Model |
9 | 9 | { |
10 | 10 | use HasFactory; |
11 | + | |
12 | + protected $fillable = [ | |
13 | + 'user_id', | |
14 | + 'status_work', | |
15 | + 'position_work', | |
16 | + 'telephone', | |
17 | + 'telephone2', | |
18 | + 'persent_anketa', | |
19 | + 'photo', | |
20 | + 'email_data', | |
21 | + 'status_profile', | |
22 | + 'old_year', | |
23 | + 'experience', | |
24 | + 'en_is', | |
25 | + 'education', | |
26 | + 'email', | |
27 | + 'interpassport', | |
28 | + 'mk', | |
29 | + 'vvp', | |
30 | + 'vlm', | |
31 | + 'reka_diplom', | |
32 | + 'more_diplom', | |
33 | + 'mpss', | |
34 | + 'tanker', | |
35 | + 'gmssb', | |
36 | + 'resume', | |
37 | + 'sort', | |
38 | + 'updated_at', | |
39 | + 'text', | |
40 | + 'address', | |
41 | + 'city', | |
42 | + ]; | |
43 | + | |
44 | + /* | |
45 | + * Связь таблицы users с таблицей workers | |
46 | + */ | |
47 | + public function users() { | |
48 | + return $this->belongsTo(User::class, 'user_id'); | |
49 | + } | |
11 | 50 | } |
database/migrations/2023_05_17_090650_alter_group_users_table.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('group_users', function (Blueprint $table) { | |
17 | + $table->bigInteger('user_id')->nullable(false); | |
18 | + }); | |
19 | + } | |
20 | + | |
21 | + /** | |
22 | + * Reverse the migrations. | |
23 | + * | |
24 | + * @return void | |
25 | + */ | |
26 | + public function down() | |
27 | + { | |
28 | + Schema::table('group_users', function (Blueprint $table) { | |
29 | + $table->dropColumn('user_id'); | |
30 | + }); | |
31 | + } | |
32 | +}; |
database/migrations/2023_05_17_090749_alter_messages_table.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('messages', function (Blueprint $table) { | |
17 | + $table->string('title', 255)->nullable(true); | |
18 | + $table->string('file', 255)->nullable(true); | |
19 | + }); | |
20 | + } | |
21 | + | |
22 | + /** | |
23 | + * Reverse the migrations. | |
24 | + * | |
25 | + * @return void | |
26 | + */ | |
27 | + public function down() | |
28 | + { | |
29 | + Schema::table('messages', function (Blueprint $table) { | |
30 | + $table->dropColumn('title'); | |
31 | + $table->dropColumn('file'); | |
32 | + }); | |
33 | + } | |
34 | +}; |
database/migrations/2023_05_17_090923_alter_employers_table.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('employers', function (Blueprint $table) { | |
17 | + $table->string('address', 255)->nullable(true); | |
18 | + $table->string('map', 255)->nullable(true); | |
19 | + $table->string('site', 255)->nullable(true); | |
20 | + }); | |
21 | + } | |
22 | + | |
23 | + /** | |
24 | + * Reverse the migrations. | |
25 | + * | |
26 | + * @return void | |
27 | + */ | |
28 | + public function down() | |
29 | + { | |
30 | + Schema::table('employers', function (Blueprint $table) { | |
31 | + $table->dropColumn('address'); | |
32 | + $table->dropColumn('map'); | |
33 | + $table->dropColumn('site'); | |
34 | + }); | |
35 | + } | |
36 | +}; |
database/migrations/2023_05_17_090944_alter_workers_table.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('workers', function (Blueprint $table) { | |
17 | + $table->string('address', 255)->nullable(true); | |
18 | + $table->string('city', 255)->nullable(true); | |
19 | + $table->text('text')->nullable(true); | |
20 | + }); | |
21 | + } | |
22 | + | |
23 | + /** | |
24 | + * Reverse the migrations. | |
25 | + * | |
26 | + * @return void | |
27 | + */ | |
28 | + public function down() | |
29 | + { | |
30 | + Schema::table('workers', function (Blueprint $table) { | |
31 | + $table->dropColumn('address'); | |
32 | + $table->dropColumn('city'); | |
33 | + $table->dropColumn('text'); | |
34 | + }); | |
35 | + } | |
36 | +}; |
database/migrations/2023_05_17_095512_alter_users_table.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('users', function (Blueprint $table) { | |
17 | + $table->boolean('is_remove')->default(false); | |
18 | + $table->boolean('is_ban')->default(false); | |
19 | + $table->boolean('is_new')->default(true); | |
20 | + }); | |
21 | + } | |
22 | + | |
23 | + /** | |
24 | + * Reverse the migrations. | |
25 | + * | |
26 | + * @return void | |
27 | + */ | |
28 | + public function down() | |
29 | + { | |
30 | + Schema::table('users', function (Blueprint $table) { | |
31 | + $table->dropColumn('is_remove'); | |
32 | + $table->dropColumn('is_ban'); | |
33 | + $table->dropColumn('is_new'); | |
34 | + }); | |
35 | + } | |
36 | +}; |
resources/views/admin/employer/index.blade.php
... | ... | @@ -0,0 +1,106 @@ |
1 | +@extends('layout.admin', ['title' => 'Админка - Работодатели']) | |
2 | + | |
3 | +@section('script') | |
4 | + <script> | |
5 | + $(document).ready(function() { | |
6 | + $(document).on('click', '.checkban', 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 + "&is_ban=" + 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('content') | |
42 | + <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> | |
43 | + <div class="w-full overflow-x-auto"> | |
44 | + <table class="w-full whitespace-no-wrap"> | |
45 | + <thead> | |
46 | + <tr | |
47 | + 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" | |
48 | + > | |
49 | + <th class="px-4 py-3">№</th> | |
50 | + <th class="px-4 py-3">Название компании</th> | |
51 | + <th class="px-4 py-3">Email/Телефон</th> | |
52 | + <th class="px-4 py-3">Имя</th> | |
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 | + </tr> | |
57 | + </thead> | |
58 | + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | |
59 | + @foreach($users as $user) | |
60 | + <tr class="text-gray-700 dark:text-gray-400"> | |
61 | + <td class="px-4 py-3"> | |
62 | + {{$user->id}} | |
63 | + </td> | |
64 | + <td class="px-4 py-3"> | |
65 | + {{$user->name}} | |
66 | + </td> | |
67 | + <td class="px-4 py-3"> | |
68 | + <div class="flex items-center text-sm"> | |
69 | + <!--<div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> | |
70 | + <div | |
71 | + class="absolute inset-0 rounded-full shadow-inner" | |
72 | + aria-hidden="true" | |
73 | + ></div> | |
74 | + </div>--> | |
75 | + <div> | |
76 | + <p class="font-semibold">{{ empty($user->employers->email) ? $user->email : $user->employers->email }}</p> | |
77 | + <p class="text-xs text-gray-600 dark:text-gray-400"> | |
78 | + {{ empty($user->employers->telephone) ? $user->telephone : $user->employers->telephone }} | |
79 | + </p> | |
80 | + </div> | |
81 | + </div> | |
82 | + | |
83 | + </td> | |
84 | + <td class="px-4 py-3 text-sm"> | |
85 | + {{ $user->name_man }} | |
86 | + </td> | |
87 | + <td class="px-4 py-3 text-sm"> | |
88 | + {{ $user->created_at }} | |
89 | + </td> | |
90 | + <td class="px-4 py-3 text-sm"> | |
91 | + <a href="">Изменить</a> | |
92 | + </td> | |
93 | + <td class="px-4 py-3 text-sm"> | |
94 | + <input type="checkbox" class="checkban" value="{{$user->id}}" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/> | |
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 | + <?=$users->appends($_GET)->links('admin.pagginate'); ?> | |
104 | + </div> | |
105 | + </div> | |
106 | +@endsection |
resources/views/admin/employer/index_ajax.blade.php
... | ... | @@ -0,0 +1,64 @@ |
1 | +<div class="w-full overflow-x-auto"> | |
2 | + <table class="w-full whitespace-no-wrap"> | |
3 | + <thead> | |
4 | + <tr | |
5 | + class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800" | |
6 | + > | |
7 | + <th class="px-4 py-3">№</th> | |
8 | + <th class="px-4 py-3">Название компании</th> | |
9 | + <th class="px-4 py-3">Email/Телефон</th> | |
10 | + <th class="px-4 py-3">Имя</th> | |
11 | + <th class="px-4 py-3">Дата регистрации</th> | |
12 | + <th class="px-4 py-3">Изменить</th> | |
13 | + <th class="px-4 py-3">Блокировать</th> | |
14 | + </tr> | |
15 | + </thead> | |
16 | + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | |
17 | + @foreach($users as $user) | |
18 | + <tr class="text-gray-700 dark:text-gray-400"> | |
19 | + <td class="px-4 py-3"> | |
20 | + {{$user->id}} | |
21 | + </td> | |
22 | + <td class="px-4 py-3"> | |
23 | + {{$user->name}} | |
24 | + </td> | |
25 | + <td class="px-4 py-3"> | |
26 | + <div class="flex items-center text-sm"> | |
27 | + <!--<div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> | |
28 | + <div | |
29 | + class="absolute inset-0 rounded-full shadow-inner" | |
30 | + aria-hidden="true" | |
31 | + ></div> | |
32 | + </div>--> | |
33 | + <div> | |
34 | + <p class="font-semibold">{{ empty($user->employers->email) ? $user->email : $user->employers->email }}</p> | |
35 | + <p class="text-xs text-gray-600 dark:text-gray-400"> | |
36 | + {{ empty($user->employers->telephone) ? $user->telephone : $user->employers->telephone }} | |
37 | + </p> | |
38 | + </div> | |
39 | + </div> | |
40 | + | |
41 | + </td> | |
42 | + <td class="px-4 py-3 text-sm"> | |
43 | + {{ $user->name_man }} | |
44 | + </td> | |
45 | + <td class="px-4 py-3 text-sm"> | |
46 | + {{ $user->created_at }} | |
47 | + </td> | |
48 | + <td class="px-4 py-3 text-sm"> | |
49 | + <a href="">Изменить</a> | |
50 | + </td> | |
51 | + <td class="px-4 py-3 text-sm"> | |
52 | + <input type="checkbox" class="checkban" value="{{$user->id}}" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/> | |
53 | + </td> | |
54 | + </tr> | |
55 | + @endforeach | |
56 | + </tbody> | |
57 | + </table> | |
58 | + </div> | |
59 | + | |
60 | + <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"> | |
61 | + <?//=$users->appends($_GET)->links('admin.pagginate'); ?> | |
62 | + <?=$users->links('admin.pagginate'); ?> | |
63 | + </div> | |
64 | + |
resources/views/admin/login.blade.php
... | ... | @@ -25,7 +25,7 @@ |
25 | 25 | <label class="block text-sm"> |
26 | 26 | <span class="text-gray-700 dark:text-gray-400">Email</span> |
27 | 27 | <input name="email" 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" |
28 | - placeholder="Email пользователя"/> | |
28 | + placeholder="Email пользователя" value="{{ old('email') }}"/> | |
29 | 29 | </label> |
30 | 30 | <label class="block mt-4 text-sm"> |
31 | 31 | <span class="text-gray-700 dark:text-gray-400">Пароль</span> |
resources/views/admin/pagginate.blade.php
... | ... | @@ -0,0 +1,112 @@ |
1 | +@if ($paginator->hasPages()) | |
2 | + <span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end"> | |
3 | + <nav aria-label="Table navigation"> | |
4 | + <ul class="inline-flex items-center"> | |
5 | + @if ($paginator->onFirstPage()) | |
6 | + <li> | |
7 | + <button | |
8 | + class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple" | |
9 | + aria-label="Previous" | |
10 | + > | |
11 | + <svg | |
12 | + aria-hidden="true" | |
13 | + class="w-4 h-4 fill-current" | |
14 | + viewBox="0 0 20 20" | |
15 | + > | |
16 | + <path | |
17 | + 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" | |
18 | + clip-rule="evenodd" | |
19 | + fill-rule="evenodd" | |
20 | + ></path> | |
21 | + </svg> | |
22 | + </button> | |
23 | + </li> | |
24 | + @else | |
25 | + <li> | |
26 | + <a href="{{ $paginator->previousPageUrl() }}" | |
27 | + class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple" | |
28 | + aria-label="Previous" | |
29 | + > | |
30 | + <svg | |
31 | + aria-hidden="true" | |
32 | + class="w-4 h-4 fill-current" | |
33 | + viewBox="0 0 20 20" | |
34 | + > | |
35 | + <path | |
36 | + 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" | |
37 | + clip-rule="evenodd" | |
38 | + fill-rule="evenodd" | |
39 | + ></path> | |
40 | + </svg> | |
41 | + </a> | |
42 | + </li> | |
43 | + @endif | |
44 | + | |
45 | + @foreach ($elements as $element) | |
46 | + @if (is_string($element)) | |
47 | + | |
48 | + <li class="disabled pagination__item"><span>{{ $element }}</span></li> | |
49 | + | |
50 | + @endif | |
51 | + @if (is_array($element)) | |
52 | + @foreach ($element as $page => $url) | |
53 | + @if ($page == $paginator->currentPage()) | |
54 | + <li> | |
55 | + <button 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"> | |
56 | + {{$page}} | |
57 | + </button> | |
58 | + </li> | |
59 | + @else | |
60 | + <li> | |
61 | + <a href="{{$url}}" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"> | |
62 | + {{$page}} | |
63 | + </a> | |
64 | + </li> | |
65 | + @endif | |
66 | + @endforeach | |
67 | + @endif | |
68 | + @endforeach | |
69 | + | |
70 | + @if ($paginator->hasMorePages()) | |
71 | + <li> | |
72 | + <a href="{{ $paginator->nextPageUrl() }}" | |
73 | + class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple" | |
74 | + aria-label="Next" | |
75 | + > | |
76 | + <svg | |
77 | + class="w-4 h-4 fill-current" | |
78 | + aria-hidden="true" | |
79 | + viewBox="0 0 20 20" | |
80 | + > | |
81 | + <path | |
82 | + 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" | |
83 | + clip-rule="evenodd" | |
84 | + fill-rule="evenodd" | |
85 | + ></path> | |
86 | + </svg> | |
87 | + </a> | |
88 | + </li> | |
89 | + @else | |
90 | + <li> | |
91 | + <button | |
92 | + class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple" | |
93 | + aria-label="Next" | |
94 | + > | |
95 | + <svg | |
96 | + class="w-4 h-4 fill-current" | |
97 | + aria-hidden="true" | |
98 | + viewBox="0 0 20 20" | |
99 | + > | |
100 | + <path | |
101 | + 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" | |
102 | + clip-rule="evenodd" | |
103 | + fill-rule="evenodd" | |
104 | + ></path> | |
105 | + </svg> | |
106 | + </button> | |
107 | + </li> | |
108 | + @endif | |
109 | + </ul> | |
110 | + </nav> | |
111 | + </span> | |
112 | +@endif |
resources/views/admin/register.blade.php
... | ... | @@ -40,7 +40,7 @@ |
40 | 40 | <span class="text-gray-700 dark:text-gray-400">Email</span> |
41 | 41 | <input id="email" name="email" type="email" |
42 | 42 | 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" |
43 | - placeholder="Введите email" value="{{ old('email') }}" | |
43 | + placeholder="Введите email" value="{{ old('email') }}" autocomplete="email" | |
44 | 44 | /> |
45 | 45 | @error('email') |
46 | 46 | <span class="invalid-feedback" role="alert"> |
resources/views/admin/users/index.blade.php
... | ... | @@ -0,0 +1,251 @@ |
1 | +@extends('layout.admin', ['title' => 'Админка - Пользователи системы']) | |
2 | + | |
3 | +@section('script') | |
4 | + <script> | |
5 | + $(document).ready(function() { | |
6 | + $(document).on('click', '.checkban', 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 + "&is_ban=" + 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 | + $(document).on('click', '.checknew', function () { | |
38 | + var this_ = $(this); | |
39 | + var value = this_.val(); | |
40 | + var ajax_block = $('#ajax_block'); | |
41 | + var bool = 0; | |
42 | + | |
43 | + if(this.checked){ | |
44 | + bool = 1; | |
45 | + } else { | |
46 | + bool = 0; | |
47 | + } | |
48 | + | |
49 | + $.ajax({ | |
50 | + type: "GET", | |
51 | + url: "{{ url()->full()}}", | |
52 | + data: "id=" + value + "&is_new=" + bool, | |
53 | + success: function (data) { | |
54 | + console.log('Обновление таблицы пользователей '); | |
55 | + //data = JSON.parse(data); | |
56 | + console.log(data); | |
57 | + ajax_block.html(data); | |
58 | + }, | |
59 | + headers: { | |
60 | + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | |
61 | + }, | |
62 | + error: function (data) { | |
63 | + console.log('Error: ' + data); | |
64 | + } | |
65 | + }); | |
66 | + }); | |
67 | + }); | |
68 | + </script> | |
69 | +@endsection | |
70 | + | |
71 | +@section('content') | |
72 | + <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> | |
73 | + <div class="w-full overflow-x-auto"> | |
74 | + <table class="w-full whitespace-no-wrap"> | |
75 | + <thead> | |
76 | + <tr | |
77 | + 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" | |
78 | + > | |
79 | + <th class="px-4 py-3">№</th> | |
80 | + <th class="px-4 py-3">Имя</th> | |
81 | + <th class="px-4 py-3">Email/логин</th> | |
82 | + <th class="px-4 py-3">Работодатель/работник/администратор</th> | |
83 | + <th class="px-4 py-3">Заблокированный</th> | |
84 | + <th class="px-4 py-3">Новый</th> | |
85 | + <th class="px-4 py-3">Дата регистрации</th> | |
86 | + </tr> | |
87 | + </thead> | |
88 | + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | |
89 | + @foreach($users as $user) | |
90 | + <tr class="text-gray-700 dark:text-gray-400"> | |
91 | + <td class="px-4 py-3"> | |
92 | + {{$user->id}} | |
93 | + </td> | |
94 | + <td class="px-4 py-3"> | |
95 | + <!--<div class="flex items-center text-sm"> | |
96 | + <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> | |
97 | + <div | |
98 | + class="absolute inset-0 rounded-full shadow-inner" | |
99 | + aria-hidden="true" | |
100 | + ></div> | |
101 | + </div> | |
102 | + <div> | |
103 | + <p class="font-semibold"><a href="{{ route('admin.users') }}">Пользователи</a></p> | |
104 | + <p class="text-xs text-gray-600 dark:text-gray-400"> | |
105 | + Все пользователи сайта | |
106 | + </p> | |
107 | + </div> | |
108 | + </div> | |
109 | + --> | |
110 | + {{ $user->name }} | |
111 | + </td> | |
112 | + <td class="px-4 py-3 text-sm"> | |
113 | + {{ $user->email }} | |
114 | + </td> | |
115 | + <td class="px-4 py-3 text-xs"> | |
116 | + <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"> | |
117 | + @if ($user->is_worker) | |
118 | + Работник | |
119 | + @else | |
120 | + Работодатель | |
121 | + @endif | |
122 | + </span> | |
123 | + @if ($user->admin) | |
124 | + <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"> | |
125 | + Администратор | |
126 | + </span> | |
127 | + @endif | |
128 | + </td> | |
129 | + <td class="px-4 py-3 text-sm"> | |
130 | + <input type="checkbox" class="checkban" value="{{$user->id}}" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/> | |
131 | + </td> | |
132 | + <td class="px-4 py-3 text-sm"> | |
133 | + <input type="checkbox" class="checknew" value="{{$user->id}}" name="new_{{$user->id}}" {{ ($user->is_new) ? "checked" : "" }}/> | |
134 | + </td> | |
135 | + <td class="px-4 py-3 text-sm"> | |
136 | + {{ $user->created_at }} | |
137 | + </td> | |
138 | + </tr> | |
139 | + @endforeach | |
140 | + </tbody> | |
141 | + </table> | |
142 | + </div> | |
143 | + | |
144 | + <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"> | |
145 | + <?//=$users->appends($_GET)->links('admin.pagginate'); ?> | |
146 | + <?=$users->links('admin.pagginate'); ?> | |
147 | + </div> | |
148 | + | |
149 | + | |
150 | + <!--<div | |
151 | + 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" | |
152 | + > | |
153 | + <span class="flex items-center col-span-3"> | |
154 | + Showing 21-30 of 100 | |
155 | + </span> | |
156 | + <span class="col-span-2"></span> | |
157 | + | |
158 | + <span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end"> | |
159 | + <nav aria-label="Table navigation"> | |
160 | + <ul class="inline-flex items-center"> | |
161 | + <li> | |
162 | + <button | |
163 | + class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple" | |
164 | + aria-label="Previous" | |
165 | + > | |
166 | + <svg | |
167 | + aria-hidden="true" | |
168 | + class="w-4 h-4 fill-current" | |
169 | + viewBox="0 0 20 20" | |
170 | + > | |
171 | + <path | |
172 | + 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" | |
173 | + clip-rule="evenodd" | |
174 | + fill-rule="evenodd" | |
175 | + ></path> | |
176 | + </svg> | |
177 | + </button> | |
178 | + </li> | |
179 | + <li> | |
180 | + <button | |
181 | + class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | |
182 | + > | |
183 | + 1 | |
184 | + </button> | |
185 | + </li> | |
186 | + <li> | |
187 | + <button | |
188 | + class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | |
189 | + > | |
190 | + 2 | |
191 | + </button> | |
192 | + </li> | |
193 | + <li> | |
194 | + <button | |
195 | + 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" | |
196 | + > | |
197 | + 3 | |
198 | + </button> | |
199 | + </li> | |
200 | + <li> | |
201 | + <button | |
202 | + class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | |
203 | + > | |
204 | + 4 | |
205 | + </button> | |
206 | + </li> | |
207 | + <li> | |
208 | + <span class="px-3 py-1">...</span> | |
209 | + </li> | |
210 | + <li> | |
211 | + <button | |
212 | + class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | |
213 | + > | |
214 | + 8 | |
215 | + </button> | |
216 | + </li> | |
217 | + <li> | |
218 | + <button | |
219 | + class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | |
220 | + > | |
221 | + 9 | |
222 | + </button> | |
223 | + </li> | |
224 | + <li> | |
225 | + <button | |
226 | + class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple" | |
227 | + aria-label="Next" | |
228 | + > | |
229 | + <svg | |
230 | + class="w-4 h-4 fill-current" | |
231 | + aria-hidden="true" | |
232 | + viewBox="0 0 20 20" | |
233 | + > | |
234 | + <path | |
235 | + 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" | |
236 | + clip-rule="evenodd" | |
237 | + fill-rule="evenodd" | |
238 | + ></path> | |
239 | + </svg> | |
240 | + </button> | |
241 | + </li> | |
242 | + </ul> | |
243 | + </nav> | |
244 | + </span> | |
245 | + </div>--> | |
246 | + </div> | |
247 | + | |
248 | + <?//=$users->appends($_GET)->links('catalogs.paginate'); ?> | |
249 | + | |
250 | + | |
251 | +@endsection |
resources/views/admin/users/index_ajax.blade.php
... | ... | @@ -0,0 +1,60 @@ |
1 | + <div class="w-full overflow-x-auto"> | |
2 | + <table class="w-full whitespace-no-wrap"> | |
3 | + <thead> | |
4 | + <tr | |
5 | + class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800" | |
6 | + > | |
7 | + <th class="px-4 py-3">№</th> | |
8 | + <th class="px-4 py-3">Имя</th> | |
9 | + <th class="px-4 py-3">Email/логин</th> | |
10 | + <th class="px-4 py-3">Работодатель/работник/администратор</th> | |
11 | + <th class="px-4 py-3">Заблокированный</th> | |
12 | + <th class="px-4 py-3">Новый</th> | |
13 | + <th class="px-4 py-3">Дата регистрации</th> | |
14 | + </tr> | |
15 | + </thead> | |
16 | + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | |
17 | + @foreach($users as $user) | |
18 | + <tr class="text-gray-700 dark:text-gray-400"> | |
19 | + <td class="px-4 py-3"> | |
20 | + {{$user->id}} | |
21 | + </td> | |
22 | + <td class="px-4 py-3"> | |
23 | + {{ $user->name }} | |
24 | + </td> | |
25 | + <td class="px-4 py-3 text-sm"> | |
26 | + {{ $user->email }} | |
27 | + </td> | |
28 | + <td class="px-4 py-3 text-xs"> | |
29 | + <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"> | |
30 | + @if ($user->is_worker) | |
31 | + Работник | |
32 | + @else | |
33 | + Работодатель | |
34 | + @endif | |
35 | + </span> | |
36 | + @if ($user->admin) | |
37 | + <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"> | |
38 | + Администратор | |
39 | + </span> | |
40 | + @endif | |
41 | + </td> | |
42 | + <td class="px-4 py-3 text-sm"> | |
43 | + <input type="checkbox" class="checkban" value="{{$user->id}}" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/> | |
44 | + </td> | |
45 | + <td class="px-4 py-3 text-sm"> | |
46 | + <input type="checkbox" class="checknew" value="{{$user->id}}" name="new_{{$user->id}}" {{ ($user->is_new) ? "checked" : "" }}/> | |
47 | + </td> | |
48 | + <td class="px-4 py-3 text-sm"> | |
49 | + {{ $user->created_at }} | |
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 | + <?//=$users->appends($_GET)->links('admin.pagginate'); ?> | |
59 | + <?=$users->links('admin.pagginate'); ?> | |
60 | + </div> |
resources/views/admin/worker/index.blade.php
... | ... | @@ -0,0 +1,215 @@ |
1 | +@extends('layout.admin', ['title' => 'Админка - Работники']) | |
2 | + | |
3 | +@section('script') | |
4 | + <script> | |
5 | + $(document).ready(function() { | |
6 | + $(document).on('click', '.checkban', 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 + "&is_ban=" + 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('content') | |
42 | + <div class="w-full overflow-hidden rounded-lg shadow-xs"> | |
43 | + <div class="w-full overflow-x-auto"> | |
44 | + <table class="w-full whitespace-no-wrap"> | |
45 | + <thead> | |
46 | + <tr | |
47 | + 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" | |
48 | + > | |
49 | + <th class="px-4 py-3">№</th> | |
50 | + <th class="px-4 py-3">Имя</th> | |
51 | + <th class="px-4 py-3">Email/Телефон</th> | |
52 | + <th class="px-4 py-3">% заполнения анкеты</th> | |
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 | + </tr> | |
57 | + </thead> | |
58 | + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | |
59 | + @foreach($users as $user) | |
60 | + <tr class="text-gray-700 dark:text-gray-400"> | |
61 | + <td class="px-4 py-3"> | |
62 | + {{$user->id}} | |
63 | + </td> | |
64 | + <td class="px-4 py-3"> | |
65 | + {{ !empty($user->name_man) ? $user->name_man : $user->name }} | |
66 | + </td> | |
67 | + <td class="px-4 py-3 text-sm"> | |
68 | + <div class="flex items-center text-sm"> | |
69 | + <div> | |
70 | + <p class="font-semibold">{{ empty($user->workers->email) ? $user->email : $user->workers->email }}</p> | |
71 | + <p class="text-xs text-gray-600 dark:text-gray-400"> | |
72 | + {{ empty($user->workers->telephone) ? $user->telephone : $user->workers->telephone }} | |
73 | + </p> | |
74 | + </div> | |
75 | + </div> | |
76 | + </td> | |
77 | + <td class="px-4 py-3 text-xs"> | |
78 | + @if (!empty($user->workers->persent_anketa)) | |
79 | + @if ($user->workers->persent_anketa > 40) | |
80 | + <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"> | |
81 | + {{$user->workers->persent_anketa}}% | |
82 | + </span> | |
83 | + @else | |
84 | + <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"> | |
85 | + {{$user->workers->persent_anketa}}% | |
86 | + </span> | |
87 | + @endif | |
88 | + @else | |
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"> | |
90 | + 10% | |
91 | + </span> | |
92 | + @endif | |
93 | + </td> | |
94 | + <td class="px-4 py-3 text-sm"> | |
95 | + {{ $user->created_at }} | |
96 | + </td> | |
97 | + <td class="px-4 py-3 text-sm"> | |
98 | + <a href="">Изменить</a> | |
99 | + </td> | |
100 | + <td class="px-4 py-3 text-sm"> | |
101 | + <input type="checkbox" class="checkban" value="{{$user->id}}" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/> | |
102 | + </td> | |
103 | + </tr> | |
104 | + @endforeach | |
105 | + </tbody> | |
106 | + </table> | |
107 | + </div> | |
108 | + | |
109 | + <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 | + <?=$users->appends($_GET)->links('admin.pagginate'); ?> | |
111 | + </div> | |
112 | + | |
113 | + | |
114 | + <!--<div | |
115 | + 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" | |
116 | + > | |
117 | + <span class="flex items-center col-span-3"> | |
118 | + Showing 21-30 of 100 | |
119 | + </span> | |
120 | + <span class="col-span-2"></span> | |
121 | + | |
122 | + <span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end"> | |
123 | + <nav aria-label="Table navigation"> | |
124 | + <ul class="inline-flex items-center"> | |
125 | + <li> | |
126 | + <button | |
127 | + class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple" | |
128 | + aria-label="Previous" | |
129 | + > | |
130 | + <svg | |
131 | + aria-hidden="true" | |
132 | + class="w-4 h-4 fill-current" | |
133 | + viewBox="0 0 20 20" | |
134 | + > | |
135 | + <path | |
136 | + 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" | |
137 | + clip-rule="evenodd" | |
138 | + fill-rule="evenodd" | |
139 | + ></path> | |
140 | + </svg> | |
141 | + </button> | |
142 | + </li> | |
143 | + <li> | |
144 | + <button | |
145 | + class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | |
146 | + > | |
147 | + 1 | |
148 | + </button> | |
149 | + </li> | |
150 | + <li> | |
151 | + <button | |
152 | + class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | |
153 | + > | |
154 | + 2 | |
155 | + </button> | |
156 | + </li> | |
157 | + <li> | |
158 | + <button | |
159 | + 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" | |
160 | + > | |
161 | + 3 | |
162 | + </button> | |
163 | + </li> | |
164 | + <li> | |
165 | + <button | |
166 | + class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | |
167 | + > | |
168 | + 4 | |
169 | + </button> | |
170 | + </li> | |
171 | + <li> | |
172 | + <span class="px-3 py-1">...</span> | |
173 | + </li> | |
174 | + <li> | |
175 | + <button | |
176 | + class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | |
177 | + > | |
178 | + 8 | |
179 | + </button> | |
180 | + </li> | |
181 | + <li> | |
182 | + <button | |
183 | + class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | |
184 | + > | |
185 | + 9 | |
186 | + </button> | |
187 | + </li> | |
188 | + <li> | |
189 | + <button | |
190 | + class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple" | |
191 | + aria-label="Next" | |
192 | + > | |
193 | + <svg | |
194 | + class="w-4 h-4 fill-current" | |
195 | + aria-hidden="true" | |
196 | + viewBox="0 0 20 20" | |
197 | + > | |
198 | + <path | |
199 | + 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" | |
200 | + clip-rule="evenodd" | |
201 | + fill-rule="evenodd" | |
202 | + ></path> | |
203 | + </svg> | |
204 | + </button> | |
205 | + </li> | |
206 | + </ul> | |
207 | + </nav> | |
208 | + </span> | |
209 | + </div>--> | |
210 | + </div> | |
211 | + | |
212 | + <?//=$users->appends($_GET)->links('catalogs.paginate'); ?> | |
213 | + | |
214 | + | |
215 | +@endsection |
resources/views/admin/worker/index_ajax.blade.php
... | ... | @@ -0,0 +1,174 @@ |
1 | +@extends('layout.admin', ['title' => 'Админка - Работники']) | |
2 | + | |
3 | +@section('content') | |
4 | + <div class="w-full overflow-hidden rounded-lg shadow-xs"> | |
5 | + <div class="w-full overflow-x-auto"> | |
6 | + <table class="w-full whitespace-no-wrap"> | |
7 | + <thead> | |
8 | + <tr | |
9 | + 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" | |
10 | + > | |
11 | + <th class="px-4 py-3">№</th> | |
12 | + <th class="px-4 py-3">Имя</th> | |
13 | + <th class="px-4 py-3">Email/логин</th> | |
14 | + <th class="px-4 py-3">Работодатель/работник</th> | |
15 | + <th class="px-4 py-3">Дата регистрации</th> | |
16 | + </tr> | |
17 | + </thead> | |
18 | + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | |
19 | + @foreach($users as $user) | |
20 | + <tr class="text-gray-700 dark:text-gray-400"> | |
21 | + <td class="px-4 py-3"> | |
22 | + {{$user->id}} | |
23 | + </td> | |
24 | + <td class="px-4 py-3"> | |
25 | + <!--<div class="flex items-center text-sm"> | |
26 | + <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> | |
27 | + <div | |
28 | + class="absolute inset-0 rounded-full shadow-inner" | |
29 | + aria-hidden="true" | |
30 | + ></div> | |
31 | + </div> | |
32 | + <div> | |
33 | + <p class="font-semibold"><a href="{{ route('admin.users') }}">Пользователи</a></p> | |
34 | + <p class="text-xs text-gray-600 dark:text-gray-400"> | |
35 | + Все пользователи сайта | |
36 | + </p> | |
37 | + </div> | |
38 | + </div> | |
39 | + --> | |
40 | + {{ $user->name }} | |
41 | + </td> | |
42 | + <td class="px-4 py-3 text-sm"> | |
43 | + {{ $user->email }} | |
44 | + </td> | |
45 | + <td class="px-4 py-3 text-xs"> | |
46 | + <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"> | |
47 | + @if ($user->is_worker) | |
48 | + Работник | |
49 | + @else | |
50 | + Работодатель | |
51 | + @endif | |
52 | + </span> | |
53 | + @if ($user->admin) | |
54 | + <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"> | |
55 | + Администратор | |
56 | + </span> | |
57 | + @endif | |
58 | + </td> | |
59 | + <td class="px-4 py-3 text-sm"> | |
60 | + {{ $user->created_at }} | |
61 | + </td> | |
62 | + </tr> | |
63 | + @endforeach | |
64 | + </tbody> | |
65 | + </table> | |
66 | + </div> | |
67 | + | |
68 | + <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"> | |
69 | + <?=$users->appends($_GET)->links('admin.pagginate'); ?> | |
70 | + </div> | |
71 | + | |
72 | + | |
73 | + <!--<div | |
74 | + 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" | |
75 | + > | |
76 | + <span class="flex items-center col-span-3"> | |
77 | + Showing 21-30 of 100 | |
78 | + </span> | |
79 | + <span class="col-span-2"></span> | |
80 | + | |
81 | + <span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end"> | |
82 | + <nav aria-label="Table navigation"> | |
83 | + <ul class="inline-flex items-center"> | |
84 | + <li> | |
85 | + <button | |
86 | + class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple" | |
87 | + aria-label="Previous" | |
88 | + > | |
89 | + <svg | |
90 | + aria-hidden="true" | |
91 | + class="w-4 h-4 fill-current" | |
92 | + viewBox="0 0 20 20" | |
93 | + > | |
94 | + <path | |
95 | + 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" | |
96 | + clip-rule="evenodd" | |
97 | + fill-rule="evenodd" | |
98 | + ></path> | |
99 | + </svg> | |
100 | + </button> | |
101 | + </li> | |
102 | + <li> | |
103 | + <button | |
104 | + class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | |
105 | + > | |
106 | + 1 | |
107 | + </button> | |
108 | + </li> | |
109 | + <li> | |
110 | + <button | |
111 | + class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | |
112 | + > | |
113 | + 2 | |
114 | + </button> | |
115 | + </li> | |
116 | + <li> | |
117 | + <button | |
118 | + 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" | |
119 | + > | |
120 | + 3 | |
121 | + </button> | |
122 | + </li> | |
123 | + <li> | |
124 | + <button | |
125 | + class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | |
126 | + > | |
127 | + 4 | |
128 | + </button> | |
129 | + </li> | |
130 | + <li> | |
131 | + <span class="px-3 py-1">...</span> | |
132 | + </li> | |
133 | + <li> | |
134 | + <button | |
135 | + class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | |
136 | + > | |
137 | + 8 | |
138 | + </button> | |
139 | + </li> | |
140 | + <li> | |
141 | + <button | |
142 | + class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | |
143 | + > | |
144 | + 9 | |
145 | + </button> | |
146 | + </li> | |
147 | + <li> | |
148 | + <button | |
149 | + class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple" | |
150 | + aria-label="Next" | |
151 | + > | |
152 | + <svg | |
153 | + class="w-4 h-4 fill-current" | |
154 | + aria-hidden="true" | |
155 | + viewBox="0 0 20 20" | |
156 | + > | |
157 | + <path | |
158 | + 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" | |
159 | + clip-rule="evenodd" | |
160 | + fill-rule="evenodd" | |
161 | + ></path> | |
162 | + </svg> | |
163 | + </button> | |
164 | + </li> | |
165 | + </ul> | |
166 | + </nav> | |
167 | + </span> | |
168 | + </div>--> | |
169 | + </div> | |
170 | + | |
171 | + <?//=$users->appends($_GET)->links('catalogs.paginate'); ?> | |
172 | + | |
173 | + | |
174 | +@endsection |
resources/views/layout/admin.blade.php
... | ... | @@ -14,14 +14,9 @@ |
14 | 14 | defer |
15 | 15 | ></script> |
16 | 16 | <script src="{{ asset('./assets/js/init-alpine.js') }}"></script> |
17 | - <link | |
18 | - rel="stylesheet" | |
19 | - href="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.css" | |
20 | - /> | |
21 | - <script | |
22 | - src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.js" | |
23 | - defer | |
24 | - ></script> | |
17 | + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.css"/> | |
18 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.js" defer></script> | |
19 | + <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script> | |
25 | 20 | <script src="{{ asset('./assets/js/charts-lines.js') }}" defer></script> |
26 | 21 | <script src="{{ asset('./assets/js/charts-pie.js') }}" defer></script> |
27 | 22 | </head> |
... | ... | @@ -901,7 +896,7 @@ |
901 | 896 | <!-- CTA --> |
902 | 897 | <a |
903 | 898 | class="flex items-center justify-between p-4 mb-8 text-sm font-semibold text-purple-100 bg-purple-600 rounded-lg shadow-md focus:outline-none focus:shadow-outline-purple" |
904 | - href="https://github.com/estevanmaito/windmill-dashboard" | |
899 | + href="{{ route('admin.admin-users') }}" | |
905 | 900 | > |
906 | 901 | <div class="flex items-center"> |
907 | 902 | <svg |
... | ... | @@ -1587,4 +1582,5 @@ |
1587 | 1582 | </div> |
1588 | 1583 | </div> |
1589 | 1584 | </body> |
1585 | +@yield('script') | |
1590 | 1586 | </html> |
routes/web.php
1 | 1 | <?php |
2 | 2 | |
3 | 3 | use App\Http\Controllers\Admin\AdminController; |
4 | +use App\Http\Controllers\Admin\EmployersController; | |
5 | +use App\Http\Controllers\Admin\UsersController; | |
6 | +use App\Http\Controllers\Admin\WorkersController; | |
4 | 7 | use App\Http\Controllers\Auth\LoginController; |
5 | 8 | use App\Http\Controllers\Auth\RegisterController; |
6 | 9 | use App\Models\User; |
... | ... | @@ -73,13 +76,16 @@ Route::group([ |
73 | 76 | Route::get('cabinet', [AdminController::class, 'index'])->name('index'); |
74 | 77 | |
75 | 78 | // кабинет - пользователи |
76 | - Route::get('users', [AdminController::class, 'index'])->name('users'); | |
79 | + Route::get('users', [UsersController::class, 'index'])->name('users'); | |
80 | + | |
81 | + // кабинет - пользователи | |
82 | + Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users'); | |
77 | 83 | |
78 | 84 | // кабинет - работодатели |
79 | - Route::get('employers', [AdminController::class, 'index'])->name('employers'); | |
85 | + Route::get('employers', [EmployersController::class, 'index'])->name('employers'); | |
80 | 86 | |
81 | 87 | // кабинет - соискатели |
82 | - Route::get('workers', [AdminController::class, 'index'])->name('workers'); | |
88 | + Route::get('workers', [WorkersController::class, 'index'])->name('workers'); | |
83 | 89 | |
84 | 90 | // кабинет - вакансии |
85 | 91 | Route::get('ad-employers', [AdminController::class, 'index'])->name('ad-employers'); |