Commit 57dadebaf039f22de2e5259fad6351a0ef008bf7
Exists in
master
Merge branch 'master' of http://gitlab.nologostudio.ru/alarionov/rekamore-su
Showing 4 changed files Inline Diff
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\Http\Requests\BaseUserRequest; | 6 | use App\Http\Requests\BaseUserRequest; |
7 | use App\Models\ContentRoles; | 7 | use App\Models\ContentRoles; |
8 | use App\Models\Job_title; | 8 | use App\Models\Job_title; |
9 | use App\Models\User; | 9 | use App\Models\User; |
10 | use App\Models\Worker; | 10 | use App\Models\Worker; |
11 | use Illuminate\Http\Request; | 11 | use Illuminate\Http\Request; |
12 | use Illuminate\Support\Facades\Auth; | 12 | use Illuminate\Support\Facades\Auth; |
13 | use Illuminate\Support\Facades\Storage; | 13 | use Illuminate\Support\Facades\Storage; |
14 | use PhpOffice\PhpSpreadsheet\Spreadsheet; | 14 | use PhpOffice\PhpSpreadsheet\Spreadsheet; |
15 | use PhpOffice\PhpSpreadsheet\Style\Alignment; | 15 | use PhpOffice\PhpSpreadsheet\Style\Alignment; |
16 | use PhpOffice\PhpSpreadsheet\Style\Border; | 16 | use PhpOffice\PhpSpreadsheet\Style\Border; |
17 | use PhpOffice\PhpSpreadsheet\Style\Font; | 17 | use PhpOffice\PhpSpreadsheet\Style\Font; |
18 | use PhpOffice\PhpSpreadsheet\Writer\Xlsx; | 18 | use PhpOffice\PhpSpreadsheet\Writer\Xlsx; |
19 | 19 | ||
20 | class UsersController extends Controller | 20 | class UsersController extends Controller |
21 | { | 21 | { |
22 | public function index(Request $request) { | 22 | public function index(Request $request) { |
23 | $title = 'Админка - Пользователи системы'; | 23 | $title = 'Админка - Пользователи системы'; |
24 | $id_admin = Auth::user()->id; | 24 | $id_admin = Auth::user()->id; |
25 | if ($request->ajax()) { | 25 | if ($request->ajax()) { |
26 | $user = User::find($request->id); | 26 | $user = User::find($request->id); |
27 | $request->offsetUnset('id'); | 27 | $request->offsetUnset('id'); |
28 | $user->update($request->all()); | 28 | $user->update($request->all()); |
29 | } | 29 | } |
30 | |||
30 | $find_key = ""; | 31 | $find_key = ""; |
31 | $users = User::query(); | 32 | $users = User::query(); |
32 | if (isset($request->find)) { | 33 | if (isset($request->find)) { |
33 | $find_key = $request->find; | 34 | $find_key = $request->find; |
34 | $users = $users->where('name', 'LIKE', "%$find_key%") | 35 | $users = $users->where('name', 'LIKE', "%$find_key%") |
35 | ->orWhere('email', 'LIKE', "%$find_key%"); | 36 | ->orWhere('email', 'LIKE', "%$find_key%"); |
36 | } | 37 | } |
38 | |||
37 | $users = $users->paginate(15); | 39 | $users = $users->paginate(15); |
38 | 40 | ||
39 | if ($request->ajax()) { | 41 | if ($request->ajax()) { |
40 | return view('admin.users.index_ajax', compact('users', 'id_admin')); | 42 | return view('admin.users.index_ajax', compact('users', 'id_admin')); |
41 | } else { | 43 | } else { |
42 | return view('admin.users.index', compact('users', 'title', 'id_admin', 'find_key')); | 44 | return view('admin.users.index', compact('users', 'title', 'id_admin', 'find_key')); |
43 | } | 45 | } |
44 | } | 46 | } |
45 | 47 | ||
46 | public function index_bd(Request $request) { | 48 | public function index_bd(Request $request) { |
47 | $title = 'Админка - Пользователи базы данных'; | 49 | $title = 'Админка - Пользователи базы данных'; |
48 | 50 | ||
49 | $find_key = ""; | 51 | $find_key = ""; |
50 | $users = User::query(); | 52 | $users = User::query(); |
51 | if (isset($request->find)) { | 53 | if (isset($request->find)) { |
52 | $find_key = $request->find; | 54 | $find_key = $request->find; |
53 | $users = $users->where('name', 'LIKE', "%$find_key%") | 55 | $users = $users->where('name', 'LIKE', "%$find_key%") |
54 | ->orWhere('email', 'LIKE', "%$find_key%") | 56 | ->orWhere('email', 'LIKE', "%$find_key%") |
55 | ->orWhere('telephone', 'LIKE', "%$find_key%"); | 57 | ->orWhere('telephone', 'LIKE', "%$find_key%"); |
56 | } | 58 | } |
57 | 59 | ||
58 | $users = $users->Baseuser()->paginate(15); | 60 | $users = $users->Baseuser()->paginate(15); |
59 | 61 | ||
60 | if ($request->ajax()) { | 62 | if ($request->ajax()) { |
61 | return view('admin.users.index_bd_ajax', compact('users')); | 63 | return view('admin.users.index_bd_ajax', compact('users')); |
62 | } else { | 64 | } else { |
63 | return view('admin.users.index_bd', compact('users', 'title', 'find_key')); | 65 | return view('admin.users.index_bd', compact('users', 'title', 'find_key')); |
64 | } | 66 | } |
65 | } | 67 | } |
66 | 68 | ||
67 | public function add_bd() { | 69 | public function add_bd() { |
68 | $list_job_titles = Job_title::query()->active()->orderBy('name', 'asc')->get(); | 70 | $list_job_titles = Job_title::query()->active()->orderBy('name', 'asc')->get(); |
69 | return view('admin.users.add', compact('list_job_titles')); | 71 | return view('admin.users.add', compact('list_job_titles')); |
70 | } | 72 | } |
71 | 73 | ||
72 | public function add_store_bd(BaseUserRequest $request) { | 74 | public function add_store_bd(BaseUserRequest $request) { |
73 | $params = $request->all(); | 75 | $params = $request->all(); |
74 | $position_work = $request->position_work; | 76 | $position_work = $request->position_work; |
75 | 77 | ||
76 | if ($request->has('file')) { | 78 | if ($request->has('file')) { |
77 | $params['file'] = $request->file('file')->store('basedata', 'public'); | 79 | $params['file'] = $request->file('file')->store('basedata', 'public'); |
78 | } | 80 | } |
79 | 81 | ||
80 | if (isset($request->name)) { | 82 | if (isset($request->name)) { |
81 | $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2; | 83 | $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2; |
82 | } | 84 | } |
83 | 85 | ||
84 | $user = User::create($params); | 86 | $user = User::create($params); |
85 | $user_id = $user->id; | 87 | $user_id = $user->id; |
86 | $worker = new Worker(); | 88 | $worker = new Worker(); |
87 | $worker->position_work = $position_work; | 89 | $worker->position_work = $position_work; |
88 | $worker->user_id = $user_id; | 90 | $worker->user_id = $user_id; |
89 | $worker->save(); | 91 | $worker->save(); |
90 | 92 | ||
91 | return redirect()->route('admin.basedata'); | 93 | return redirect()->route('admin.basedata'); |
92 | } | 94 | } |
93 | 95 | ||
94 | public function edit_bd(User $user) { | 96 | public function edit_bd(User $user) { |
95 | $list_job_titles = Job_title::query()->active()->orderBy('name', 'asc')->get(); | 97 | $list_job_titles = Job_title::query()->active()->orderBy('name', 'asc')->get(); |
96 | return view('admin.users.edit', compact('user', 'list_job_titles')); | 98 | return view('admin.users.edit', compact('user', 'list_job_titles')); |
97 | } | 99 | } |
98 | 100 | ||
99 | public function update_bd(BaseUserRequest $request, User $user) { | 101 | public function update_bd(BaseUserRequest $request, User $user) { |
100 | $params = $request->all(); | 102 | $params = $request->all(); |
101 | $position_work = $request->position_work; | 103 | $position_work = $request->position_work; |
102 | 104 | ||
103 | if ($request->has('file')) { | 105 | if ($request->has('file')) { |
104 | if (!empty($user->file)) Storage::delete($user->file); | 106 | if (!empty($user->file)) Storage::delete($user->file); |
105 | $params['file'] = $request->file('file')->store('basedata', 'public'); | 107 | $params['file'] = $request->file('file')->store('basedata', 'public'); |
106 | } else { | 108 | } else { |
107 | if (!empty($user->image)) $params['file'] = $user->file; | 109 | if (!empty($user->image)) $params['file'] = $user->file; |
108 | } | 110 | } |
109 | 111 | ||
110 | if (isset($request->name)) { | 112 | if (isset($request->name)) { |
111 | $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2; | 113 | $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2; |
112 | } | 114 | } |
113 | 115 | ||
114 | $user->update($params); | 116 | $user->update($params); |
115 | if (isset($user->workers[0]->id)) { | 117 | if (isset($user->workers[0]->id)) { |
116 | $worker = Worker::find($user->workers[0]->id); | 118 | $worker = Worker::find($user->workers[0]->id); |
117 | $worker->position_work = $position_work; | 119 | $worker->position_work = $position_work; |
118 | $worker->save(); | 120 | $worker->save(); |
119 | } else { | 121 | } else { |
120 | $worker = new Worker(); | 122 | $worker = new Worker(); |
121 | $worker->user_id = $user->id; | 123 | $worker->user_id = $user->id; |
122 | $worker->position_work = $position_work; | 124 | $worker->position_work = $position_work; |
123 | $worker->save(); | 125 | $worker->save(); |
124 | } | 126 | } |
125 | 127 | ||
126 | return redirect()->route('admin.basedata'); | 128 | return redirect()->route('admin.basedata'); |
127 | } | 129 | } |
128 | 130 | ||
129 | public function destroy_bd(User $user) { | 131 | public function destroy_bd(User $user) { |
130 | $user->delete(); | 132 | $user->delete(); |
131 | return redirect()->route('admin.basedata'); | 133 | return redirect()->route('admin.basedata'); |
132 | } | 134 | } |
133 | 135 | ||
134 | public function roles(Request $request) { | 136 | public function roles(Request $request) { |
135 | if ($request->ajax()) { | 137 | if ($request->ajax()) { |
136 | $user = User::find($request->id); | 138 | $user = User::find($request->id); |
137 | $request->offsetUnset('id'); | 139 | $request->offsetUnset('id'); |
138 | $user->update($request->all()); | 140 | $user->update($request->all()); |
139 | } | 141 | } |
140 | 142 | ||
141 | $users = User::query()->Realuser()->paginate(15); | 143 | $users = User::query()->Realuser()->paginate(15); |
142 | 144 | ||
143 | if ($request->ajax()) { | 145 | if ($request->ajax()) { |
144 | return view('admin.users.roles.index_ajax', compact('users')); | 146 | return view('admin.users.roles.index_ajax', compact('users')); |
145 | } else { | 147 | } else { |
146 | return view('admin.users.roles.index', compact('users')); | 148 | return view('admin.users.roles.index', compact('users')); |
147 | } | 149 | } |
148 | } | 150 | } |
149 | 151 | ||
150 | public function admin_roles(Request $request) { | 152 | public function admin_roles(Request $request) { |
151 | 153 | ||
152 | if ($request->ajax()) { | 154 | if ($request->ajax()) { |
153 | $id = $request->id; | 155 | $id = $request->id; |
154 | $request->offsetUnset('id'); | 156 | $request->offsetUnset('id'); |
155 | ContentRoles::where('id', '=', $id)->update($request->all()); | 157 | ContentRoles::where('id', '=', $id)->update($request->all()); |
156 | } | 158 | } |
157 | $roles = ContentRoles::query()->OrderBy('id')->paginate(25); | 159 | $roles = ContentRoles::query()->OrderBy('id')->paginate(25); |
158 | 160 | ||
159 | 161 | ||
160 | if ($request->ajax()) { | 162 | if ($request->ajax()) { |
161 | return view('admin.content.roles_index_ajax', compact('roles')); | 163 | return view('admin.content.roles_index_ajax', compact('roles')); |
162 | } else { | 164 | } else { |
163 | return view('admin.content.roles_index', compact('roles')); | 165 | return view('admin.content.roles_index', compact('roles')); |
164 | } | 166 | } |
165 | } | 167 | } |
166 | 168 | ||
167 | public function doc_bd(User $user) { | 169 | public function doc_bd(User $user) { |
168 | $id = $user->id; | 170 | $id = $user->id; |
169 | $spreadsheet = new Spreadsheet(); | 171 | $spreadsheet = new Spreadsheet(); |
170 | $activeWorksheet = $spreadsheet->getActiveSheet(); | 172 | $activeWorksheet = $spreadsheet->getActiveSheet(); |
171 | $activeWorksheet->setCellValue('A1', 'Отчет по соискателю'); | 173 | $activeWorksheet->setCellValue('A1', 'Отчет по соискателю'); |
172 | $activeWorksheet->getStyle('A1')->applyFromArray([ | 174 | $activeWorksheet->getStyle('A1')->applyFromArray([ |
173 | 'font' => [ | 175 | 'font' => [ |
174 | 'name' => 'Arial', | 176 | 'name' => 'Arial', |
175 | 'bold' => true, | 177 | 'bold' => true, |
176 | 'italic' => false, | 178 | 'italic' => false, |
177 | 'underline' => Font::UNDERLINE_DOUBLE, | 179 | 'underline' => Font::UNDERLINE_DOUBLE, |
178 | 'strikethrough' => false, | 180 | 'strikethrough' => false, |
179 | 'color' => [ | 181 | 'color' => [ |
180 | 'rgb' => '808080' | 182 | 'rgb' => '808080' |
181 | ] | 183 | ] |
182 | ], | 184 | ], |
183 | 'borders' => [ | 185 | 'borders' => [ |
184 | 'allBorders' => [ | 186 | 'allBorders' => [ |
185 | 'borderStyle' => Border::BORDER_THIN, | 187 | 'borderStyle' => Border::BORDER_THIN, |
186 | 'color' => [ | 188 | 'color' => [ |
187 | 'rgb' => '808080' | 189 | 'rgb' => '808080' |
188 | ] | 190 | ] |
189 | ], | 191 | ], |
190 | 'outline' => array( | 192 | 'outline' => array( |
191 | 'style' => Border::BORDER_THIN, | 193 | 'style' => Border::BORDER_THIN, |
192 | 'color' => array('rgb' => '000000') | 194 | 'color' => array('rgb' => '000000') |
193 | ), | 195 | ), |
194 | ], | 196 | ], |
195 | 197 | ||
196 | 'alignment' => [ | 198 | 'alignment' => [ |
197 | 'horizontal' => Alignment::HORIZONTAL_CENTER, | 199 | 'horizontal' => Alignment::HORIZONTAL_CENTER, |
198 | 'vertical' => Alignment::VERTICAL_CENTER, | 200 | 'vertical' => Alignment::VERTICAL_CENTER, |
199 | 'wrapText' => true, | 201 | 'wrapText' => true, |
200 | ] | 202 | ] |
201 | ]); | 203 | ]); |
202 | 204 | ||
203 | $activeWorksheet->setCellValue('A2', "Псевдоним/имя: ".$user->name); | 205 | $activeWorksheet->setCellValue('A2', "Псевдоним/имя: ".$user->name); |
204 | $activeWorksheet->setCellValue('A3', "Фамилия: ".$user->surname); | 206 | $activeWorksheet->setCellValue('A3', "Фамилия: ".$user->surname); |
205 | $activeWorksheet->setCellValue('A4', "Имя: ".$user->name_man); | 207 | $activeWorksheet->setCellValue('A4', "Имя: ".$user->name_man); |
206 | $activeWorksheet->setCellValue('A5', "Отчество: ".$user->surname2); | 208 | $activeWorksheet->setCellValue('A5', "Отчество: ".$user->surname2); |
207 | $activeWorksheet->setCellValue('A6', "Телефон: ".$user->telephone); | 209 | $activeWorksheet->setCellValue('A6', "Телефон: ".$user->telephone); |
208 | $activeWorksheet->setCellValue('A7', "Емайл: ".$user->email); | 210 | $activeWorksheet->setCellValue('A7', "Емайл: ".$user->email); |
209 | 211 | ||
210 | if (isset($user->workers[0]->id)) { | 212 | if (isset($user->workers[0]->id)) { |
211 | $activeWorksheet->setCellValue('A9', "Анкета: "); | 213 | $activeWorksheet->setCellValue('A9', "Анкета: "); |
212 | $activeWorksheet->setCellValue('A10', "Телефон: " . $user->workers[0]->telephone); | 214 | $activeWorksheet->setCellValue('A10', "Телефон: " . $user->workers[0]->telephone); |
213 | $activeWorksheet->setCellValue('A11', "Емайл: " . $user->workers[0]->email); | 215 | $activeWorksheet->setCellValue('A11', "Емайл: " . $user->workers[0]->email); |
214 | } | 216 | } |
215 | 217 | ||
216 | if (isset($user->jobtitles[0]->id)) { | 218 | if (isset($user->jobtitles[0]->id)) { |
217 | $activeWorksheet->setCellValue('A12', "Должность: " . $user->jobtitles[0]->name); | 219 | $activeWorksheet->setCellValue('A12', "Должность: " . $user->jobtitles[0]->name); |
218 | } | 220 | } |
219 | $activeWorksheet->getColumnDimension("A")->setWidth(100); | 221 | $activeWorksheet->getColumnDimension("A")->setWidth(100); |
220 | $writer = new Xlsx($spreadsheet); | 222 | $writer = new Xlsx($spreadsheet); |
221 | 223 | ||
222 | header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); | 224 | header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); |
223 | header('Content-Disposition: attachment; filename="user'.$id.'.xlsx"'); | 225 | header('Content-Disposition: attachment; filename="user'.$id.'.xlsx"'); |
224 | header('Cache-Control: no-cache'); | 226 | header('Cache-Control: no-cache'); |
225 | 227 | ||
226 | $writer->save('php://output'); | 228 | $writer->save('php://output'); |
227 | $writer->save(storage_path("app/public/export/user$id.xlsx")); | 229 | $writer->save(storage_path("app/public/export/user$id.xlsx")); |
228 | 230 | ||
229 | //$spreadsheet->disconnectWorksheets(); | 231 | //$spreadsheet->disconnectWorksheets(); |
230 | return redirect()->route('admin.basedata'); | 232 | return redirect()->route('admin.basedata'); |
231 | 233 | ||
232 | } | 234 | } |
233 | } | 235 | } |
234 | 236 |
app/Models/User.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Models; | 3 | namespace App\Models; |
4 | 4 | ||
5 | // use Illuminate\Contracts\Auth\MustVerifyEmail; | 5 | // use Illuminate\Contracts\Auth\MustVerifyEmail; |
6 | use Illuminate\Database\Eloquent\Factories\HasFactory; | 6 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
7 | use Illuminate\Foundation\Auth\User as Authenticatable; | 7 | use Illuminate\Foundation\Auth\User as Authenticatable; |
8 | use Illuminate\Notifications\Notifiable; | 8 | use Illuminate\Notifications\Notifiable; |
9 | use Laravel\Sanctum\HasApiTokens; | 9 | use Laravel\Sanctum\HasApiTokens; |
10 | 10 | ||
11 | class User extends Authenticatable | 11 | class User extends Authenticatable |
12 | { | 12 | { |
13 | use HasApiTokens, HasFactory, Notifiable; | 13 | use HasApiTokens, HasFactory, Notifiable; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * The attributes that are mass assignable. | 16 | * The attributes that are mass assignable. |
17 | * | 17 | * |
18 | * @var array<int, string> | 18 | * @var array<int, string> |
19 | */ | 19 | */ |
20 | |||
20 | protected $fillable = [ | 21 | protected $fillable = [ |
21 | 'name', | 22 | 'name', |
22 | 'email', | 23 | 'email', |
23 | 'password', | 24 | 'password', |
24 | 'admin', | 25 | 'admin', |
25 | 'telephone', | 26 | 'telephone', |
26 | 'surname', | 27 | 'surname', |
27 | 'name_man', | 28 | 'name_man', |
28 | 'surname2', | 29 | 'surname2', |
29 | 'is_worker', | 30 | 'is_worker', |
30 | 'is_lookin', | 31 | 'is_lookin', |
31 | 'is_message', | 32 | 'is_message', |
32 | 'is_public', | 33 | 'is_public', |
33 | 'is_remove', | 34 | 'is_remove', |
34 | 'is_ban', | 35 | 'is_ban', |
35 | 'is_new', | 36 | 'is_new', |
36 | 'is_bd', | 37 | 'is_bd', |
37 | 'email_verified_at', | 38 | 'email_verified_at', |
38 | 'created_at', | 39 | 'created_at', |
39 | 'updated_at', | 40 | 'updated_at', |
40 | 'birthday', | 41 | 'birthday', |
41 | 'file', | 42 | 'file', |
42 | 'pubpassword', | 43 | 'pubpassword', |
44 | 'is_manager', | ||
43 | ]; | 45 | ]; |
44 | 46 | ||
45 | /** | 47 | /** |
46 | * The attributes that should be hidden for serialization. | 48 | * The attributes that should be hidden for serialization. |
47 | * | 49 | * |
48 | * @var array<int, string> | 50 | * @var array<int, string> |
49 | */ | 51 | */ |
50 | protected $hidden = [ | 52 | protected $hidden = [ |
51 | 'password', | 53 | 'password', |
52 | 'remember_token', | 54 | 'remember_token', |
53 | ]; | 55 | ]; |
54 | 56 | ||
55 | /** | 57 | /** |
56 | * The attributes that should be cast. | 58 | * The attributes that should be cast. |
57 | * | 59 | * |
58 | * @var array<string, string> | 60 | * @var array<string, string> |
59 | */ | 61 | */ |
60 | protected $casts = [ | 62 | protected $casts = [ |
61 | 'email_verified_at' => 'datetime', | 63 | 'email_verified_at' => 'datetime', |
62 | ]; | 64 | ]; |
63 | 65 | ||
64 | /* | 66 | /* |
65 | * Связь Пользователей системы с работодателями | 67 | * Связь Пользователей системы с работодателями |
66 | * users - employers | 68 | * users - employers |
67 | */ | 69 | */ |
68 | public function employers() { | 70 | public function employers() { |
69 | return $this->hasMany(Employer::class, 'user_id'); | 71 | return $this->hasMany(Employer::class, 'user_id'); |
70 | } | 72 | } |
71 | 73 | ||
72 | /* | 74 | /* |
73 | * Связь Пользователей системы с работниками | 75 | * Связь Пользователей системы с работниками |
74 | * users - workers | 76 | * users - workers |
75 | */ | 77 | */ |
76 | public function workers() { | 78 | public function workers() { |
77 | return $this->hasMany(Worker::class, 'user_id'); | 79 | return $this->hasMany(Worker::class, 'user_id'); |
78 | } | 80 | } |
79 | 81 | ||
80 | /* | 82 | /* |
81 | * Связь Пользователей системы с работниками | 83 | * Связь Пользователей системы с работниками |
82 | * users - workers | 84 | * users - workers |
83 | */ | 85 | */ |
84 | public function work() { | 86 | public function work() { |
85 | return $this->hasMany(Worker::class, 'user_id')->select('telephone', 'email', 'position_work', 'persent_anketa'); | 87 | return $this->hasMany(Worker::class, 'user_id')->select('telephone', 'email', 'position_work', 'persent_anketa'); |
86 | } | 88 | } |
87 | 89 | ||
88 | /* | 90 | /* |
89 | * Связь Модели Пользователей(Users) с Группами (Group_users) | 91 | * Связь Модели Пользователей(Users) с Группами (Group_users) |
90 | * users - group_users | 92 | * users - group_users |
91 | многие-ко-многим | 93 | многие-ко-многим |
92 | */ | 94 | */ |
93 | public function ingroup() { | 95 | public function ingroup() { |
94 | return $this->belongsToMany(Group_user::class, 'group_works'); | 96 | return $this->belongsToMany(Group_user::class, 'group_works'); |
95 | } | 97 | } |
96 | 98 | ||
97 | /* | 99 | /* |
98 | * Связь Пользователей системы с ссобщениями | 100 | * Связь Пользователей системы с ссобщениями |
99 | * users - messages | 101 | * users - messages |
100 | */ | 102 | */ |
101 | public function messages() { | 103 | public function messages() { |
102 | return $this->hasMany(Message::class); | 104 | return $this->hasMany(Message::class); |
103 | } | 105 | } |
104 | 106 | ||
105 | /* | 107 | /* |
106 | * Связь Пользователей системы с статистика | 108 | * Связь Пользователей системы с статистика |
107 | * users - static_workers | 109 | * users - static_workers |
108 | */ | 110 | */ |
109 | public function static_user() { | 111 | public function static_user() { |
110 | return $this->hasMany(Static_worker::class); | 112 | return $this->hasMany(Static_worker::class); |
111 | } | 113 | } |
112 | 114 | ||
113 | /* | 115 | /* |
114 | * Связь модели Юзеры (users) с моделью Группы пользователей (Group_works) | 116 | * Связь модели Юзеры (users) с моделью Группы пользователей (Group_works) |
115 | один-ко-многим | 117 | один-ко-многим |
116 | */ | 118 | */ |
117 | public function peoples() { | 119 | public function peoples() { |
118 | return $this->hasMany(Group_works::class); | 120 | return $this->hasMany(Group_works::class); |
119 | } | 121 | } |
120 | 122 | ||
121 | /* | 123 | /* |
122 | * Связь Модели Пользователей(Users) с Группами (Group_users) | 124 | * Связь Модели Пользователей(Users) с Группами (Group_users) |
123 | * users - group_users | 125 | * users - group_users |
124 | многие-ко-многим | 126 | многие-ко-многим |
125 | */ | 127 | */ |
126 | public function jobtitles() { | 128 | public function jobtitles() { |
127 | return $this->belongsToMany(Job_title::class, 'Workers', 'user_id', 'position_work'); | 129 | return $this->belongsToMany(Job_title::class, 'Workers', 'user_id', 'position_work'); |
128 | } | 130 | } |
129 | 131 | ||
130 | public function scopeActive($query) { | 132 | public function scopeActive($query) { |
131 | return $query->where('is_remove', '=', '0'); | 133 | return $query->where('is_remove', '=', '0'); |
132 | } | 134 | } |
133 | 135 | ||
134 | public function scopeWorker($query) { | 136 | public function scopeWorker($query) { |
135 | return $query->where('is_worker', '=', '1'); | 137 | return $query->where('is_worker', '=', '1'); |
136 | } | 138 | } |
137 | 139 | ||
138 | public function scopeBaseuser($query) { | 140 | public function scopeBaseuser($query) { |
139 | return $query->where('is_bd', '=', '1'); | 141 | return $query->where('is_bd', '=', '1'); |
140 | } | 142 | } |
141 | 143 | ||
142 | public function scopeRealuser($query) { | 144 | public function scopeRealuser($query) { |
143 | return $query->where('is_bd', '=', '0'); | 145 | return $query->where('is_bd', '=', '0'); |
144 | } | 146 | } |
145 | 147 | ||
146 | public function scopeAdmin($query) { | 148 | public function scopeAdmin($query) { |
147 | return $query->where('admin', '=', '1'); | 149 | return $query->where('admin', '=', '1'); |
148 | } | 150 | } |
149 | 151 | ||
150 | public function scopeNotadmin($query) { | 152 | public function scopeNotadmin($query) { |
151 | return $query->where('admin', '=', '0'); | 153 | return $query->where('admin', '=', '0'); |
152 | } | 154 | } |
153 | 155 | ||
154 | } | 156 | } |
155 | 157 |
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 value_id = this_.attr('data-id'); | ||
10 | var ajax_block = $('#ajax_block'); | 11 | var ajax_block = $('#ajax_block'); |
11 | var bool = 0; | 12 | var bool = 0; |
12 | var str_get = ''; | 13 | var str_get = ''; |
13 | 14 | ||
14 | if(this.checked){ | 15 | if(this.checked){ |
15 | bool = 1; | 16 | bool = 1; |
16 | } else { | 17 | } else { |
17 | bool = 0; | 18 | bool = 0; |
18 | } | 19 | } |
19 | console.log(field); | 20 | console.log(field); |
20 | str_get = "id=" + value + "&" + field + "=" + bool; | 21 | str_get = "id=" + value_id + "&" + field + "=" + bool; |
21 | console.log(str_get); | 22 | console.log(str_get); |
22 | 23 | ||
23 | $.ajax({ | 24 | $.ajax({ |
24 | type: "GET", | 25 | type: "GET", |
25 | url: "{{ url()->full()}}", | 26 | url: "{{ url()->full()}}", |
26 | data: str_get, | 27 | data: str_get, |
27 | success: function (data) { | 28 | success: function (data) { |
28 | console.log('Обновление таблицы пользователей '); | 29 | console.log('Обновление таблицы пользователей '); |
29 | //data = JSON.parse(data); | 30 | //data = JSON.parse(data); |
30 | //console.log(data); | 31 | //console.log(data); |
31 | ajax_block.html(data); | 32 | ajax_block.html(data); |
32 | }, | 33 | }, |
33 | headers: { | 34 | headers: { |
34 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 35 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
35 | }, | 36 | }, |
36 | error: function (data) { | 37 | error: function (data) { |
37 | console.log('Error: ' + data); | 38 | console.log('Error: ' + data); |
38 | } | 39 | } |
39 | }); | 40 | }); |
40 | }); | 41 | }); |
41 | }); | 42 | }); |
42 | </script> | 43 | </script> |
43 | @endsection | 44 | @endsection |
44 | 45 | ||
45 | @section('search') | 46 | @section('search') |
46 | @include('admin.find') | 47 | @include('admin.find') |
47 | @endsection | 48 | @endsection |
48 | 49 | ||
49 | @section('content') | 50 | @section('content') |
50 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> | 51 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> |
51 | <div class="w-full overflow-x-auto"> | 52 | <div class="w-full overflow-x-auto"> |
52 | <table class="w-full whitespace-no-wrap"> | 53 | <table class="w-full whitespace-no-wrap"> |
53 | <thead> | 54 | <thead> |
54 | <tr | 55 | <tr |
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" | 56 | 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" |
56 | > | 57 | > |
57 | <th class="px-4 py-3 text-xs">№</th> | 58 | <th class="px-4 py-3 text-xs">№</th> |
58 | <th class="px-4 py-3 text-xs">Имя</th> | 59 | <th class="px-4 py-3 text-xs">Имя</th> |
59 | <th class="px-4 py-3 text-xs">Email/логин</th> | 60 | <th class="px-4 py-3 text-xs">Email/логин</th> |
60 | <th class="px-4 py-3 text-xs">Работодатель/работник/администратор</th> | 61 | <th class="px-4 py-3 text-xs">Работодатель/работник/администратор</th> |
61 | @if ($id_admin == 1) | ||
62 | <th class="px-4 py-3 text-xs">Админ</th> | 62 | <th class="px-4 py-3 text-xs">Админ</th> |
63 | @endif | 63 | <th class="px-4 py-3 text-xs">Менеджер</th> |
64 | <th class="px-4 py-3 text-xs">Дата регист.</th> | 64 | <th class="px-4 py-3 text-xs">Дата регист.</th> |
65 | </tr> | 65 | </tr> |
66 | </thead> | 66 | </thead> |
67 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | 67 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> |
68 | @foreach($users as $user) | 68 | @foreach($users as $user) |
69 | <tr class="text-gray-700 dark:text-gray-400"> | 69 | <tr class="text-gray-700 dark:text-gray-400"> |
70 | <td class="px-4 py-3 text-xs"> | 70 | <td class="px-4 py-3 text-xs"> |
71 | {{$user->id}} | 71 | {{$user->id}} |
72 | </td> | 72 | </td> |
73 | <td class="px-4 py-3 text-xs"> | 73 | <td class="px-4 py-3 text-xs"> |
74 | <a style="text-decoration: underline;" href="{{ route('admin.user-profile', ['user' => $user->id]) }}">{{ $user->name }}</a> | 74 | <a style="text-decoration: underline;" href="{{ route('admin.user-profile', ['user' => $user->id]) }}">{{ $user->name }}</a> |
75 | </td> | 75 | </td> |
76 | <td class="px-4 py-3 text-xs"> | 76 | <td class="px-4 py-3 text-xs"> |
77 | {{ $user->email }} | 77 | {{ $user->email }} |
78 | </td> | 78 | </td> |
79 | <td class="px-4 py-3 text-xs"> | 79 | <td class="px-4 py-3 text-xs"> |
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"> | 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 | @if ($user->is_worker) | 81 | @if ($user->is_worker) |
82 | Работник | 82 | Работник |
83 | @else | 83 | @else |
84 | Работодатель | 84 | Работодатель |
85 | @endif | 85 | @endif |
86 | </span> | 86 | </span> |
87 | @if ($user->admin) | 87 | @if ($user->admin) |
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"> | 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"> |
89 | Администратор | 89 | Администратор |
90 | </span> | 90 | </span> |
91 | @endif | 91 | @endif |
92 | @if ($user->is_bd) | 92 | @if ($user->is_bd) |
93 | <span class="px-2 py-1 font-semibold leading-tight text-red-700 bg-red-100 rounded-full dark:text-red-100 dark:bg-red-700"> | 93 | <span class="px-2 py-1 font-semibold leading-tight text-red-700 bg-red-100 rounded-full dark:text-red-100 dark:bg-red-700"> |
94 | База данных | 94 | База данных |
95 | </span> | 95 | </span> |
96 | @endif | 96 | @endif |
97 | </td> | 97 | </td> |
98 | 98 | ||
99 | @if ($id_admin == 1) | 99 | <td class="px-4 py-3 text-xs"> |
100 | <td class="px-4 py-3 text-xs"> | 100 | @if ($user->id > 1) |
101 | @if ($user->id > 1) | 101 | <input type="checkbox" class="check_click" data-id="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/> |
102 | <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/> | 102 | @endif |
103 | @endif | 103 | </td> |
104 | </td> | 104 | |
105 | @endif | 105 | <td class="px-4 py-3 text-xs"> |
106 | @if ($user->id > 1) | ||
107 | <input type="checkbox" class="check_click" data-id="{{$user->id}}" data-field="is_manager" name="manager_{{$user->id}}" {{ ($user->is_manager) ? "checked" : "" }}/> | ||
108 | @endif | ||
109 | </td> | ||
106 | 110 | ||
107 | <td class="px-4 py-3 text-xs"> | 111 | <td class="px-4 py-3 text-xs"> |
108 | {{ date('d.m.Y', strtotime($user->created_at)) }} | 112 | {{ date('d.m.Y', strtotime($user->created_at)) }} |
109 | </td> | 113 | </td> |
110 | </tr> | 114 | </tr> |
111 | @endforeach | 115 | @endforeach |
112 | </tbody> | 116 | </tbody> |
113 | </table> | 117 | </table> |
114 | </div> | 118 | </div> |
115 | 119 | ||
116 | <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"> | 120 | <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 | <?//=$users->appends($_GET)->links('admin.pagginate'); ?> | 121 | {{ $users->links('admin.pagginate') }} |
118 | <?=$users->links('admin.pagginate'); ?> | ||
119 | </div> | 122 | </div> |
120 | 123 | ||
121 | 124 | ||
122 | <!--<div | 125 | <!--<div |
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" | 126 | 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" |
124 | > | 127 | > |
125 | <span class="flex items-center col-span-3"> | 128 | <span class="flex items-center col-span-3"> |
126 | Showing 21-30 of 100 | 129 | Showing 21-30 of 100 |
127 | </span> | 130 | </span> |
128 | <span class="col-span-2"></span> | 131 | <span class="col-span-2"></span> |
129 | 132 | ||
130 | <span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end"> | 133 | <span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end"> |
131 | <nav aria-label="Table navigation"> | 134 | <nav aria-label="Table navigation"> |
132 | <ul class="inline-flex items-center"> | 135 | <ul class="inline-flex items-center"> |
133 | <li> | 136 | <li> |
134 | <button | 137 | <button |
135 | class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple" | 138 | class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple" |
136 | aria-label="Previous" | 139 | aria-label="Previous" |
137 | > | 140 | > |
138 | <svg | 141 | <svg |
139 | aria-hidden="true" | 142 | aria-hidden="true" |
140 | class="w-4 h-4 fill-current" | 143 | class="w-4 h-4 fill-current" |
141 | viewBox="0 0 20 20" | 144 | viewBox="0 0 20 20" |
142 | > | 145 | > |
143 | <path | 146 | <path |
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" | 147 | 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" |
145 | clip-rule="evenodd" | 148 | clip-rule="evenodd" |
146 | fill-rule="evenodd" | 149 | fill-rule="evenodd" |
147 | ></path> | 150 | ></path> |
148 | </svg> | 151 | </svg> |
149 | </button> | 152 | </button> |
150 | </li> | 153 | </li> |
151 | <li> | 154 | <li> |
152 | <button | 155 | <button |
153 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | 156 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" |
154 | > | 157 | > |
155 | 1 | 158 | 1 |
156 | </button> | 159 | </button> |
157 | </li> | 160 | </li> |
158 | <li> | 161 | <li> |
159 | <button | 162 | <button |
160 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | 163 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" |
161 | > | 164 | > |
162 | 2 | 165 | 2 |
163 | </button> | 166 | </button> |
164 | </li> | 167 | </li> |
165 | <li> | 168 | <li> |
166 | <button | 169 | <button |
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" | 170 | 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" |
168 | > | 171 | > |
169 | 3 | 172 | 3 |
170 | </button> | 173 | </button> |
171 | </li> | 174 | </li> |
172 | <li> | 175 | <li> |
173 | <button | 176 | <button |
174 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | 177 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" |
175 | > | 178 | > |
176 | 4 | 179 | 4 |
177 | </button> | 180 | </button> |
178 | </li> | 181 | </li> |
179 | <li> | 182 | <li> |
180 | <span class="px-3 py-1">...</span> | 183 | <span class="px-3 py-1">...</span> |
181 | </li> | 184 | </li> |
182 | <li> | 185 | <li> |
183 | <button | 186 | <button |
184 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | 187 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" |
185 | > | 188 | > |
186 | 8 | 189 | 8 |
187 | </button> | 190 | </button> |
188 | </li> | 191 | </li> |
189 | <li> | 192 | <li> |
190 | <button | 193 | <button |
191 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | 194 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" |
192 | > | 195 | > |
193 | 9 | 196 | 9 |
194 | </button> | 197 | </button> |
195 | </li> | 198 | </li> |
196 | <li> | 199 | <li> |
197 | <button | 200 | <button |
198 | class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple" | 201 | class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple" |
199 | aria-label="Next" | 202 | aria-label="Next" |
200 | > | 203 | > |
201 | <svg | 204 | <svg |
202 | class="w-4 h-4 fill-current" | 205 | class="w-4 h-4 fill-current" |
203 | aria-hidden="true" | 206 | aria-hidden="true" |
204 | viewBox="0 0 20 20" | 207 | viewBox="0 0 20 20" |
205 | > | 208 | > |
206 | <path | 209 | <path |
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" | 210 | 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" |
208 | clip-rule="evenodd" | 211 | clip-rule="evenodd" |
209 | fill-rule="evenodd" | 212 | fill-rule="evenodd" |
210 | ></path> | 213 | ></path> |
211 | </svg> | 214 | </svg> |
212 | </button> | 215 | </button> |
213 | </li> | 216 | </li> |
214 | </ul> | 217 | </ul> |
215 | </nav> | 218 | </nav> |
216 | </span> | 219 | </span> |
217 | </div>--> | 220 | </div>--> |
218 | </div> | 221 | </div> |
219 | 222 | ||
220 | <?//=$users->appends($_GET)->links('catalogs.paginate'); ?> | 223 | <?//=$users->appends($_GET)->links('catalogs.paginate'); ?> |
221 | 224 | ||
222 | 225 |
resources/views/admin/users/index_ajax.blade.php
1 | <div class="w-full overflow-x-auto"> | 1 | <div class="w-full overflow-x-auto"> |
2 | <table class="w-full whitespace-no-wrap"> | 2 | <table class="w-full whitespace-no-wrap"> |
3 | <thead> | 3 | <thead> |
4 | <tr | 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" | 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 | > | 6 | > |
7 | <th class="px-4 py-3 text-xs">№</th> | 7 | <th class="px-4 py-3 text-xs">№</th> |
8 | <th class="px-4 py-3 text-xs">Имя</th> | 8 | <th class="px-4 py-3 text-xs">Имя</th> |
9 | <th class="px-4 py-3 text-xs">Email/логин</th> | 9 | <th class="px-4 py-3 text-xs">Email/логин</th> |
10 | <th class="px-4 py-3 text-xs">Работодатель/работник/администратор</th> | 10 | <th class="px-4 py-3 text-xs">Работодатель/работник/администратор</th> |
11 | @if ($id_admin == 1) | 11 | <th class="px-4 py-3 text-xs">Админ</th> |
12 | <th class="px-4 py-3 text-xs">Админ</th> | 12 | <th class="px-4 py-3 text-xs">Менеджер</th> |
13 | @endif | ||
14 | <th class="px-4 py-3 text-xs">Дата регист.</th> | 13 | <th class="px-4 py-3 text-xs">Дата регист.</th> |
15 | </tr> | 14 | </tr> |
16 | </thead> | 15 | </thead> |
17 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | 16 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> |
18 | @foreach($users as $user) | 17 | @foreach($users as $user) |
19 | <tr class="text-gray-700 dark:text-gray-400"> | 18 | <tr class="text-gray-700 dark:text-gray-400"> |
20 | <td class="px-4 py-3 text-xs"> | 19 | <td class="px-4 py-3 text-xs"> |
21 | {{$user->id}} | 20 | {{$user->id}} |
22 | </td> | 21 | </td> |
23 | <td class="px-4 py-3 text-xs"> | 22 | <td class="px-4 py-3 text-xs"> |
24 | <a style="text-decoration: underline;" href="{{ route('admin.user-profile', ['user' => $user->id]) }}">{{ $user->name }}</a> | 23 | <a style="text-decoration: underline;" href="{{ route('admin.user-profile', ['user' => $user->id]) }}">{{ $user->name }}</a> |
25 | </td> | 24 | </td> |
26 | <td class="px-4 py-3 text-xs"> | 25 | <td class="px-4 py-3 text-xs"> |
27 | {{ $user->email }} | 26 | {{ $user->email }} |
28 | </td> | 27 | </td> |
29 | <td class="px-4 py-3 text-xs"> | 28 | <td class="px-4 py-3 text-xs"> |
30 | <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"> | 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"> |
31 | @if ($user->is_worker) | 30 | @if ($user->is_worker) |
32 | Работник | 31 | Работник |
33 | @else | 32 | @else |
34 | Работодатель | 33 | Работодатель |
35 | @endif | 34 | @endif |
36 | </span> | 35 | </span> |
37 | @if ($user->admin) | 36 | @if ($user->admin) |
38 | <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"> | 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"> |
39 | Администратор | 38 | Администратор |
40 | </span> | 39 | </span> |
41 | @endif | 40 | @endif |
42 | @if ($user->is_bd) | 41 | @if ($user->is_bd) |
43 | <span class="px-2 py-1 font-semibold leading-tight text-red-700 bg-red-100 rounded-full dark:text-red-100 dark:bg-red-700"> | 42 | <span class="px-2 py-1 font-semibold leading-tight text-red-700 bg-red-100 rounded-full dark:text-red-100 dark:bg-red-700"> |
44 | База данных | 43 | База данных |
45 | </span> | 44 | </span> |
46 | @endif | 45 | @endif |
47 | </td> | 46 | </td> |
48 | 47 | ||
49 | @if ($id_admin == 1) | 48 | <td class="px-4 py-3 text-xs"> |
50 | <td class="px-4 py-3 text-xs"> | 49 | @if ($user->id > 1) |
51 | @if ($user->id > 1) | 50 | <input type="checkbox" class="check_click" data-id="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/> |
52 | <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/> | 51 | @endif |
53 | @endif | 52 | </td> |
54 | </td> | 53 | |
55 | @endif | 54 | <td class="px-4 py-3 text-xs"> |
55 | @if ($user->id > 1) | ||
56 | <input type="checkbox" class="check_click" data-id="{{$user->id}}" data-field="is_manager" name="manager_{{$user->id}}" {{ ($user->is_manager) ? "checked" : "" }}/> | ||
57 | @endif | ||
58 | </td> | ||
56 | 59 | ||
57 | <td class="px-4 py-3 text-xs"> | 60 | <td class="px-4 py-3 text-xs"> |
58 | {{ date('d.m.Y', strtotime($user->created_at)) }} | 61 | {{ date('d.m.Y', strtotime($user->created_at)) }} |
59 | </td> | 62 | </td> |
60 | </tr> | 63 | </tr> |
61 | @endforeach | 64 | @endforeach |
62 | </tbody> | 65 | </tbody> |
63 | </table> | 66 | </table> |
64 | </div> | 67 | </div> |
65 | 68 | ||
66 | <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 | <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"> |
67 | <?//=$users->appends($_GET)->links('admin.pagginate'); ?> | 70 | {{ $users->links('admin.pagginate') }} |
68 | <?=$users->links('admin.pagginate'); ?> |