Commit 0961cd3e6075f5cfb89de83771b5406eb43a7c15
1 parent
313a7a8059
Exists in
master
and in
1 other branch
Модель программы образования, прикрепление анкет соискателям
Showing 10 changed files with 160 additions and 7 deletions Inline Diff
- app/Http/Controllers/Admin/UsersController.php
- app/Models/ProgramEducation.php
- app/Models/User.php
- database/migrations/2023_10_16_082838_alter_table_users.php
- database/migrations/2023_10_16_083006_alter_table_education.php
- database/migrations/2023_10_16_083120_create_program_education_table.php
- resources/views/admin/users/add.blade.php
- resources/views/admin/users/edit.blade.php
- resources/views/admin/users/form.blade.php
- resources/views/admin/users/index_bd.blade.php
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\User; | 7 | use App\Models\User; |
8 | use Illuminate\Http\Request; | 8 | use Illuminate\Http\Request; |
9 | use Illuminate\Support\Facades\Auth; | 9 | use Illuminate\Support\Facades\Auth; |
10 | use Illuminate\Support\Facades\Storage; | ||
10 | use PhpOffice\PhpSpreadsheet\Spreadsheet; | 11 | use PhpOffice\PhpSpreadsheet\Spreadsheet; |
11 | use PhpOffice\PhpSpreadsheet\Style\Alignment; | 12 | use PhpOffice\PhpSpreadsheet\Style\Alignment; |
12 | use PhpOffice\PhpSpreadsheet\Style\Border; | 13 | use PhpOffice\PhpSpreadsheet\Style\Border; |
13 | use PhpOffice\PhpSpreadsheet\Style\Font; | 14 | use PhpOffice\PhpSpreadsheet\Style\Font; |
14 | use PhpOffice\PhpSpreadsheet\Writer\Xlsx; | 15 | use PhpOffice\PhpSpreadsheet\Writer\Xlsx; |
15 | 16 | ||
16 | class UsersController extends Controller | 17 | class UsersController extends Controller |
17 | { | 18 | { |
18 | public function index(Request $request) { | 19 | public function index(Request $request) { |
19 | $title = 'Админка - Пользователи системы'; | 20 | $title = 'Админка - Пользователи системы'; |
20 | $id_admin = Auth::user()->id; | 21 | $id_admin = Auth::user()->id; |
21 | if ($request->ajax()) { | 22 | if ($request->ajax()) { |
22 | $user = User::find($request->id); | 23 | $user = User::find($request->id); |
23 | $request->offsetUnset('id'); | 24 | $request->offsetUnset('id'); |
24 | $user->update($request->all()); | 25 | $user->update($request->all()); |
25 | } | 26 | } |
26 | $find_key = ""; | 27 | $find_key = ""; |
27 | $users = User::query(); | 28 | $users = User::query(); |
28 | if (isset($request->find)) { | 29 | if (isset($request->find)) { |
29 | $find_key = $request->find; | 30 | $find_key = $request->find; |
30 | $users = $users->where('name', 'LIKE', "%$find_key%") | 31 | $users = $users->where('name', 'LIKE', "%$find_key%") |
31 | ->orWhere('email', 'LIKE', "%$find_key%"); | 32 | ->orWhere('email', 'LIKE', "%$find_key%"); |
32 | } | 33 | } |
33 | $users = $users->paginate(15); | 34 | $users = $users->paginate(15); |
34 | 35 | ||
35 | if ($request->ajax()) { | 36 | if ($request->ajax()) { |
36 | return view('admin.users.index_ajax', compact('users', 'id_admin')); | 37 | return view('admin.users.index_ajax', compact('users', 'id_admin')); |
37 | } else { | 38 | } else { |
38 | return view('admin.users.index', compact('users', 'title', 'id_admin', 'find_key')); | 39 | return view('admin.users.index', compact('users', 'title', 'id_admin', 'find_key')); |
39 | } | 40 | } |
40 | } | 41 | } |
41 | 42 | ||
42 | public function index_bd(Request $request) { | 43 | public function index_bd(Request $request) { |
43 | $title = 'Админка - Пользователи базы данных'; | 44 | $title = 'Админка - Пользователи базы данных'; |
44 | 45 | ||
45 | $find_key = ""; | 46 | $find_key = ""; |
46 | $users = User::query(); | 47 | $users = User::query(); |
47 | if (isset($request->find)) { | 48 | if (isset($request->find)) { |
48 | $find_key = $request->find; | 49 | $find_key = $request->find; |
49 | $users = $users->where('name', 'LIKE', "%$find_key%") | 50 | $users = $users->where('name', 'LIKE', "%$find_key%") |
50 | ->orWhere('email', 'LIKE', "%$find_key%") | 51 | ->orWhere('email', 'LIKE', "%$find_key%") |
51 | ->orWhere('telephone', 'LIKE', "%$find_key%"); | 52 | ->orWhere('telephone', 'LIKE', "%$find_key%"); |
52 | } | 53 | } |
53 | 54 | ||
54 | $users = $users->Baseuser()->paginate(15); | 55 | $users = $users->Baseuser()->paginate(15); |
55 | 56 | ||
56 | if ($request->ajax()) { | 57 | if ($request->ajax()) { |
57 | return view('admin.users.index_bd_ajax', compact('users')); | 58 | return view('admin.users.index_bd_ajax', compact('users')); |
58 | } else { | 59 | } else { |
59 | return view('admin.users.index_bd', compact('users', 'title', 'find_key')); | 60 | return view('admin.users.index_bd', compact('users', 'title', 'find_key')); |
60 | } | 61 | } |
61 | } | 62 | } |
62 | 63 | ||
63 | public function add_bd() { | 64 | public function add_bd() { |
64 | return view('admin.users.add'); | 65 | return view('admin.users.add'); |
65 | } | 66 | } |
66 | 67 | ||
67 | public function add_store_bd(BaseUserRequest $request) { | 68 | public function add_store_bd(BaseUserRequest $request) { |
68 | $params = $request->all(); | 69 | $params = $request->all(); |
70 | |||
71 | if ($request->has('file')) { | ||
72 | $params['file'] = $request->file('file')->store('basedata', 'public'); | ||
73 | } | ||
74 | |||
69 | $user = User::create($params); | 75 | $user = User::create($params); |
70 | return redirect()->route('admin.worker-profile-add', ['user' => $user]); | 76 | return redirect()->route('admin.basedata'); |
71 | } | 77 | } |
72 | 78 | ||
73 | public function edit_bd(User $user) { | 79 | public function edit_bd(User $user) { |
74 | return view('admin.users.edit', compact('user')); | 80 | return view('admin.users.edit', compact('user')); |
75 | } | 81 | } |
76 | 82 | ||
77 | public function update_bd(BaseUserRequest $request, User $user) { | 83 | public function update_bd(BaseUserRequest $request, User $user) { |
78 | $params = $request->all(); | 84 | $params = $request->all(); |
85 | |||
86 | if ($request->has('file')) { | ||
87 | if (!empty($user->file)) Storage::delete($user->file); | ||
88 | $params['file'] = $request->file('file')->store('basedata', 'public'); | ||
89 | } else { | ||
90 | if (!empty($user->image)) $params['file'] = $user->file; | ||
91 | } | ||
92 | |||
79 | $user->update($params); | 93 | $user->update($params); |
80 | return redirect()->route('admin.basedata'); | 94 | return redirect()->route('admin.basedata'); |
81 | } | 95 | } |
82 | 96 | ||
83 | public function destroy_bd(User $user) { | 97 | public function destroy_bd(User $user) { |
84 | $user->delete(); | 98 | $user->delete(); |
85 | return redirect()->route('admin.basedata'); | 99 | return redirect()->route('admin.basedata'); |
86 | } | 100 | } |
87 | 101 | ||
88 | public function roles(Request $request) { | 102 | public function roles(Request $request) { |
89 | if ($request->ajax()) { | 103 | if ($request->ajax()) { |
90 | $user = User::find($request->id); | 104 | $user = User::find($request->id); |
91 | $request->offsetUnset('id'); | 105 | $request->offsetUnset('id'); |
92 | $user->update($request->all()); | 106 | $user->update($request->all()); |
93 | } | 107 | } |
94 | 108 | ||
95 | $users = User::query()->Realuser()->paginate(15); | 109 | $users = User::query()->Realuser()->paginate(15); |
96 | 110 | ||
97 | if ($request->ajax()) { | 111 | if ($request->ajax()) { |
98 | return view('admin.users.roles.index_ajax', compact('users')); | 112 | return view('admin.users.roles.index_ajax', compact('users')); |
99 | } else { | 113 | } else { |
100 | return view('admin.users.roles.index', compact('users')); | 114 | return view('admin.users.roles.index', compact('users')); |
101 | } | 115 | } |
102 | } | 116 | } |
103 | 117 | ||
104 | public function doc_bd(User $user) { | 118 | public function doc_bd(User $user) { |
105 | $id = $user->id; | 119 | $id = $user->id; |
106 | $spreadsheet = new Spreadsheet(); | 120 | $spreadsheet = new Spreadsheet(); |
107 | $activeWorksheet = $spreadsheet->getActiveSheet(); | 121 | $activeWorksheet = $spreadsheet->getActiveSheet(); |
108 | $activeWorksheet->setCellValue('A1', 'Отчет по соискателю'); | 122 | $activeWorksheet->setCellValue('A1', 'Отчет по соискателю'); |
109 | $activeWorksheet->getStyle('A1')->applyFromArray([ | 123 | $activeWorksheet->getStyle('A1')->applyFromArray([ |
110 | 'font' => [ | 124 | 'font' => [ |
111 | 'name' => 'Arial', | 125 | 'name' => 'Arial', |
112 | 'bold' => true, | 126 | 'bold' => true, |
113 | 'italic' => false, | 127 | 'italic' => false, |
114 | 'underline' => Font::UNDERLINE_DOUBLE, | 128 | 'underline' => Font::UNDERLINE_DOUBLE, |
115 | 'strikethrough' => false, | 129 | 'strikethrough' => false, |
116 | 'color' => [ | 130 | 'color' => [ |
117 | 'rgb' => '808080' | 131 | 'rgb' => '808080' |
118 | ] | 132 | ] |
119 | ], | 133 | ], |
120 | 'borders' => [ | 134 | 'borders' => [ |
121 | 'allBorders' => [ | 135 | 'allBorders' => [ |
122 | 'borderStyle' => Border::BORDER_THIN, | 136 | 'borderStyle' => Border::BORDER_THIN, |
123 | 'color' => [ | 137 | 'color' => [ |
124 | 'rgb' => '808080' | 138 | 'rgb' => '808080' |
125 | ] | 139 | ] |
126 | ], | 140 | ], |
141 | 'outline' => array( | ||
142 | 'style' => Border::BORDER_THIN, | ||
143 | 'color' => array('rgb' => '000000') | ||
144 | ), | ||
127 | ], | 145 | ], |
146 | |||
128 | 'alignment' => [ | 147 | 'alignment' => [ |
129 | 'horizontal' => Alignment::HORIZONTAL_CENTER, | 148 | 'horizontal' => Alignment::HORIZONTAL_CENTER, |
130 | 'vertical' => Alignment::VERTICAL_CENTER, | 149 | 'vertical' => Alignment::VERTICAL_CENTER, |
131 | 'wrapText' => true, | 150 | 'wrapText' => true, |
132 | ] | 151 | ] |
133 | ]); | 152 | ]); |
134 | 153 | ||
135 | $activeWorksheet->setCellValue('A2', "Псевдоним/имя: ".$user->name); | 154 | $activeWorksheet->setCellValue('A2', "Псевдоним/имя: ".$user->name); |
136 | $activeWorksheet->setCellValue('A3', "Фамилия: ".$user->surname); | 155 | $activeWorksheet->setCellValue('A3', "Фамилия: ".$user->surname); |
137 | $activeWorksheet->setCellValue('A4', "Имя: ".$user->name_man); | 156 | $activeWorksheet->setCellValue('A4', "Имя: ".$user->name_man); |
138 | $activeWorksheet->setCellValue('A5', "Отчество: ".$user->surname2); | 157 | $activeWorksheet->setCellValue('A5', "Отчество: ".$user->surname2); |
139 | $activeWorksheet->setCellValue('A6', "Телефон: ".$user->telephone); | 158 | $activeWorksheet->setCellValue('A6', "Телефон: ".$user->telephone); |
140 | $activeWorksheet->setCellValue('A7', "Емайл: ".$user->email); | 159 | $activeWorksheet->setCellValue('A7', "Емайл: ".$user->email); |
141 | 160 | ||
142 | if (isset($user->workers[0]->id)) { | 161 | if (isset($user->workers[0]->id)) { |
143 | $activeWorksheet->setCellValue('A9', "Анкета: "); | 162 | $activeWorksheet->setCellValue('A9', "Анкета: "); |
144 | $activeWorksheet->setCellValue('A10', "Телефон: " . $user->workers[0]->telephone); | 163 | $activeWorksheet->setCellValue('A10', "Телефон: " . $user->workers[0]->telephone); |
145 | $activeWorksheet->setCellValue('A11', "Емайл: " . $user->workers[0]->email); | 164 | $activeWorksheet->setCellValue('A11', "Емайл: " . $user->workers[0]->email); |
146 | } | 165 | } |
147 | 166 | ||
148 | if (isset($user->jobtitles[0]->id)) { | 167 | if (isset($user->jobtitles[0]->id)) { |
149 | $activeWorksheet->setCellValue('A12', "Должность: " . $user->jobtitles[0]->name); | 168 | $activeWorksheet->setCellValue('A12', "Должность: " . $user->jobtitles[0]->name); |
150 | } | 169 | } |
151 | 170 | $activeWorksheet->getColumnDimension("A")->setWidth(100); | |
152 | $writer = new Xlsx($spreadsheet); | 171 | $writer = new Xlsx($spreadsheet); |
153 | 172 | ||
154 | header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); | 173 | header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); |
155 | header('Content-Disposition: attachment; filename="user'.$id.'.xlsx"'); | 174 | header('Content-Disposition: attachment; filename="user'.$id.'.xlsx"'); |
156 | header('Cache-Control: no-cache'); | 175 | header('Cache-Control: no-cache'); |
157 | 176 | ||
158 | $writer->save('php://output'); | 177 | $writer->save('php://output'); |
159 | $writer->save(storage_path("app/public/export/user$id.xlsx")); | 178 | $writer->save(storage_path("app/public/export/user$id.xlsx")); |
160 | 179 | ||
161 | //$spreadsheet->disconnectWorksheets(); | 180 | //$spreadsheet->disconnectWorksheets(); |
162 | return redirect()->route('admin.basedata'); | 181 | return redirect()->route('admin.basedata'); |
163 | 182 | ||
164 | } | 183 | } |
165 | } | 184 | } |
166 | 185 |
app/Models/ProgramEducation.php
File was created | 1 | <?php | |
2 | |||
3 | namespace App\Models; | ||
4 | |||
5 | use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
6 | use Illuminate\Database\Eloquent\Model; | ||
7 | |||
8 | class ProgramEducation extends Model | ||
9 | { | ||
10 | use HasFactory; | ||
11 | } | ||
12 |
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 | protected $fillable = [ | 20 | protected $fillable = [ |
21 | 'name', | 21 | 'name', |
22 | 'email', | 22 | 'email', |
23 | 'password', | 23 | 'password', |
24 | 'admin', | 24 | 'admin', |
25 | 'telephone', | 25 | 'telephone', |
26 | 'surname', | 26 | 'surname', |
27 | 'name_man', | 27 | 'name_man', |
28 | 'surname2', | 28 | 'surname2', |
29 | 'is_worker', | 29 | 'is_worker', |
30 | 'is_lookin', | 30 | 'is_lookin', |
31 | 'is_message', | 31 | 'is_message', |
32 | 'is_public', | 32 | 'is_public', |
33 | 'is_remove', | 33 | 'is_remove', |
34 | 'is_ban', | 34 | 'is_ban', |
35 | 'is_new', | 35 | 'is_new', |
36 | 'is_bd', | 36 | 'is_bd', |
37 | 'email_verified_at', | 37 | 'email_verified_at', |
38 | 'created_at', | 38 | 'created_at', |
39 | 'updated_at', | 39 | 'updated_at', |
40 | 'birthday' | 40 | 'birthday', |
41 | 'file' | ||
41 | ]; | 42 | ]; |
42 | 43 | ||
43 | /** | 44 | /** |
44 | * The attributes that should be hidden for serialization. | 45 | * The attributes that should be hidden for serialization. |
45 | * | 46 | * |
46 | * @var array<int, string> | 47 | * @var array<int, string> |
47 | */ | 48 | */ |
48 | protected $hidden = [ | 49 | protected $hidden = [ |
49 | 'password', | 50 | 'password', |
50 | 'remember_token', | 51 | 'remember_token', |
51 | ]; | 52 | ]; |
52 | 53 | ||
53 | /** | 54 | /** |
54 | * The attributes that should be cast. | 55 | * The attributes that should be cast. |
55 | * | 56 | * |
56 | * @var array<string, string> | 57 | * @var array<string, string> |
57 | */ | 58 | */ |
58 | protected $casts = [ | 59 | protected $casts = [ |
59 | 'email_verified_at' => 'datetime', | 60 | 'email_verified_at' => 'datetime', |
60 | ]; | 61 | ]; |
61 | 62 | ||
62 | /* | 63 | /* |
63 | * Связь Пользователей системы с работодателями | 64 | * Связь Пользователей системы с работодателями |
64 | * users - employers | 65 | * users - employers |
65 | */ | 66 | */ |
66 | public function employers() { | 67 | public function employers() { |
67 | return $this->hasMany(Employer::class, 'user_id'); | 68 | return $this->hasMany(Employer::class, 'user_id'); |
68 | } | 69 | } |
69 | 70 | ||
70 | /* | 71 | /* |
71 | * Связь Пользователей системы с работниками | 72 | * Связь Пользователей системы с работниками |
72 | * users - workers | 73 | * users - workers |
73 | */ | 74 | */ |
74 | public function workers() { | 75 | public function workers() { |
75 | return $this->hasMany(Worker::class, 'user_id'); | 76 | return $this->hasMany(Worker::class, 'user_id'); |
76 | } | 77 | } |
77 | 78 | ||
78 | /* | 79 | /* |
79 | * Связь Пользователей системы с работниками | 80 | * Связь Пользователей системы с работниками |
80 | * users - workers | 81 | * users - workers |
81 | */ | 82 | */ |
82 | public function work() { | 83 | public function work() { |
83 | return $this->hasMany(Worker::class, 'user_id')->select('telephone', 'email', 'position_work', 'persent_anketa'); | 84 | return $this->hasMany(Worker::class, 'user_id')->select('telephone', 'email', 'position_work', 'persent_anketa'); |
84 | } | 85 | } |
85 | 86 | ||
86 | /* | 87 | /* |
87 | * Связь Модели Пользователей(Users) с Группами (Group_users) | 88 | * Связь Модели Пользователей(Users) с Группами (Group_users) |
88 | * users - group_users | 89 | * users - group_users |
89 | многие-ко-многим | 90 | многие-ко-многим |
90 | */ | 91 | */ |
91 | public function ingroup() { | 92 | public function ingroup() { |
92 | return $this->belongsToMany(Group_user::class, 'group_works'); | 93 | return $this->belongsToMany(Group_user::class, 'group_works'); |
93 | } | 94 | } |
94 | 95 | ||
95 | /* | 96 | /* |
96 | * Связь Пользователей системы с ссобщениями | 97 | * Связь Пользователей системы с ссобщениями |
97 | * users - messages | 98 | * users - messages |
98 | */ | 99 | */ |
99 | public function messages() { | 100 | public function messages() { |
100 | return $this->hasMany(Message::class); | 101 | return $this->hasMany(Message::class); |
101 | } | 102 | } |
102 | 103 | ||
103 | /* | 104 | /* |
104 | * Связь Пользователей системы с статистика | 105 | * Связь Пользователей системы с статистика |
105 | * users - static_workers | 106 | * users - static_workers |
106 | */ | 107 | */ |
107 | public function static_user() { | 108 | public function static_user() { |
108 | return $this->hasMany(Static_worker::class); | 109 | return $this->hasMany(Static_worker::class); |
109 | } | 110 | } |
110 | 111 | ||
111 | /* | 112 | /* |
112 | * Связь модели Юзеры (users) с моделью Группы пользователей (Group_works) | 113 | * Связь модели Юзеры (users) с моделью Группы пользователей (Group_works) |
113 | один-ко-многим | 114 | один-ко-многим |
114 | */ | 115 | */ |
115 | public function peoples() { | 116 | public function peoples() { |
116 | return $this->hasMany(Group_works::class); | 117 | return $this->hasMany(Group_works::class); |
117 | } | 118 | } |
118 | 119 | ||
119 | /* | 120 | /* |
120 | * Связь Модели Пользователей(Users) с Группами (Group_users) | 121 | * Связь Модели Пользователей(Users) с Группами (Group_users) |
121 | * users - group_users | 122 | * users - group_users |
122 | многие-ко-многим | 123 | многие-ко-многим |
123 | */ | 124 | */ |
124 | public function jobtitles() { | 125 | public function jobtitles() { |
125 | return $this->belongsToMany(Job_title::class, 'Workers', 'user_id', 'position_work'); | 126 | return $this->belongsToMany(Job_title::class, 'Workers', 'user_id', 'position_work'); |
126 | } | 127 | } |
127 | 128 | ||
128 | public function scopeActive($query) { | 129 | public function scopeActive($query) { |
129 | return $query->where('is_remove', '=', '0'); | 130 | return $query->where('is_remove', '=', '0'); |
130 | } | 131 | } |
131 | 132 | ||
132 | public function scopeBaseuser($query) { | 133 | public function scopeBaseuser($query) { |
133 | return $query->where('is_bd', '=', '1'); | 134 | return $query->where('is_bd', '=', '1'); |
134 | } | 135 | } |
135 | 136 | ||
136 | public function scopeRealuser($query) { | 137 | public function scopeRealuser($query) { |
137 | return $query->where('is_bd', '=', '0'); | 138 | return $query->where('is_bd', '=', '0'); |
138 | } | 139 | } |
139 | 140 | ||
140 | } | 141 | } |
141 | 142 |
database/migrations/2023_10_16_082838_alter_table_users.php
File was created | 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->string('file', 255)->nullable(); | ||
18 | }); | ||
19 | } | ||
20 | |||
21 | /** | ||
22 | * Reverse the migrations. | ||
23 | * | ||
24 | * @return void | ||
25 | */ | ||
26 | public function down() | ||
27 | { | ||
28 | Schema::table('users', function (Blueprint $table) { | ||
29 | $table->dropColumn('file'); | ||
30 | }); | ||
31 | } | ||
32 | }; | ||
33 |
database/migrations/2023_10_16_083006_alter_table_education.php
File was created | 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('education', function (Blueprint $table) { | ||
17 | $table->string('site', 255)->nullable(); | ||
18 | }); | ||
19 | } | ||
20 | |||
21 | /** | ||
22 | * Reverse the migrations. | ||
23 | * | ||
24 | * @return void | ||
25 | */ | ||
26 | public function down() | ||
27 | { | ||
28 | Schema::table('site', function (Blueprint $table) { | ||
29 | // | ||
30 | }); | ||
31 | } | ||
32 | }; | ||
33 |
database/migrations/2023_10_16_083120_create_program_education_table.php
File was created | 1 | <?php | |
2 | |||
3 | use Illuminate\Database\Migrations\Migration; | ||
4 | use Illuminate\Database\Schema\Blueprint; | ||
5 | use Illuminate\Support\Facades\Schema; | ||
6 | |||
7 | return new class extends Migration | ||
8 | { | ||
9 | /** | ||
10 | * Run the migrations. | ||
11 | * | ||
12 | * @return void | ||
13 | */ | ||
14 | public function up() | ||
15 | { | ||
16 | Schema::create('program_education', function (Blueprint $table) { | ||
17 | $table->id(); | ||
18 | $table->integer('education_id')->nullable(false); | ||
19 | $table->string('level')->nullable(); | ||
20 | $table->string('name', 255)->nullable(false); | ||
21 | $table->text('text')->nullable(); | ||
22 | $table->string('email', 255)->nullable(); | ||
23 | $table->string('telephone', 255); | ||
24 | $table->timestamps(); | ||
25 | }); | ||
26 | } | ||
27 | |||
28 | /** | ||
29 | * Reverse the migrations. | ||
30 | * | ||
31 | * @return void | ||
32 | */ | ||
33 | public function down() | ||
34 | { | ||
35 | Schema::dropIfExists('program_education'); | ||
36 | } | ||
37 | }; | ||
38 |
resources/views/admin/users/add.blade.php
1 | @extends('layout.admin', ['title' => 'Админка - Добавление пользователя в базу данных']) | 1 | @extends('layout.admin', ['title' => 'Админка - Добавление пользователя в базу данных']) |
2 | 2 | ||
3 | @section('content') | 3 | @section('content') |
4 | <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300"> | 4 | <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300"> |
5 | Добавление пользователя в базу данных | 5 | Добавление пользователя в базу данных |
6 | </h4> | 6 | </h4> |
7 | <form method="POST" action="{{ route('admin.add-store-basedata') }}"> | 7 | <form method="POST" action="{{ route('admin.add-store-basedata') }}" enctype="multipart/form-data"> |
8 | @csrf | 8 | @csrf |
9 | @include('admin.users.form') | 9 | @include('admin.users.form') |
10 | </form> | 10 | </form> |
11 | @endsection | 11 | @endsection |
12 | 12 |
resources/views/admin/users/edit.blade.php
1 | @extends('layout.admin', ['title' => 'Админка - Редактирование пользователя в базу данных']) | 1 | @extends('layout.admin', ['title' => 'Админка - Редактирование пользователя в базу данных']) |
2 | 2 | ||
3 | @section('content') | 3 | @section('content') |
4 | <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300"> | 4 | <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300"> |
5 | Редактирование пользователя в базу данных | 5 | Редактирование пользователя в базу данных |
6 | </h4> | 6 | </h4> |
7 | <form method="POST" action="{{ route('admin.update-basedata', ['user' => $user->id]) }}"> | 7 | <form method="POST" action="{{ route('admin.update-basedata', ['user' => $user->id]) }}" enctype="multipart/form-data"> |
8 | @csrf | 8 | @csrf |
9 | @isset($user) | 9 | @isset($user) |
10 | @method('PUT') | 10 | @method('PUT') |
11 | @endisset | 11 | @endisset |
12 | 12 | ||
13 | @include('admin.users.form') | 13 | @include('admin.users.form') |
14 | </form> | 14 | </form> |
15 | @endsection | 15 | @endsection |
16 | 16 |
resources/views/admin/users/form.blade.php
1 | <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> | 1 | <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> |
2 | <label class="block text-sm"> | 2 | <label class="block text-sm"> |
3 | <span class="text-gray-700 dark:text-gray-400">Имя/Псевдоним</span> | 3 | <span class="text-gray-700 dark:text-gray-400">Имя/Псевдоним</span> |
4 | <input name="name" id="name" | 4 | <input name="name" id="name" |
5 | 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" | 5 | 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" |
6 | placeholder="Имя/Псевдоним" value="{{ old('name') ?? $user->name ?? '' }}" | 6 | placeholder="Имя/Псевдоним" value="{{ old('name') ?? $user->name ?? '' }}" |
7 | /> | 7 | /> |
8 | @error('name') | 8 | @error('name') |
9 | <span class="text-xs text-red-600 dark:text-red-400"> | 9 | <span class="text-xs text-red-600 dark:text-red-400"> |
10 | {{ $message }} | 10 | {{ $message }} |
11 | </span> | 11 | </span> |
12 | @enderror | 12 | @enderror |
13 | </label><br> | 13 | </label><br> |
14 | 14 | ||
15 | <label class="block text-sm"> | 15 | <label class="block text-sm"> |
16 | <span class="text-gray-700 dark:text-gray-400">Фамилия</span> | 16 | <span class="text-gray-700 dark:text-gray-400">Фамилия</span> |
17 | <input name="surname" id="surname" | 17 | <input name="surname" id="surname" |
18 | class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" | 18 | 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" |
19 | placeholder="Фамилия" value="{{ old('surname') ?? $user->surname ?? '' }}" | 19 | placeholder="Фамилия" value="{{ old('surname') ?? $user->surname ?? '' }}" |
20 | /> | 20 | /> |
21 | @error('surname') | 21 | @error('surname') |
22 | <span class="text-xs text-red-600 dark:text-red-400"> | 22 | <span class="text-xs text-red-600 dark:text-red-400"> |
23 | {{ $message }} | 23 | {{ $message }} |
24 | </span> | 24 | </span> |
25 | @enderror | 25 | @enderror |
26 | </label><br> | 26 | </label><br> |
27 | 27 | ||
28 | <label class="block text-sm"> | 28 | <label class="block text-sm"> |
29 | <span class="text-gray-700 dark:text-gray-400">Имя</span> | 29 | <span class="text-gray-700 dark:text-gray-400">Имя</span> |
30 | <input name="name_man" id="name_man" | 30 | <input name="name_man" id="name_man" |
31 | 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" | 31 | 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" |
32 | placeholder="Имя" value="{{ old('name_man') ?? $user->name_man ?? '' }}" | 32 | placeholder="Имя" value="{{ old('name_man') ?? $user->name_man ?? '' }}" |
33 | /> | 33 | /> |
34 | @error('name_man') | 34 | @error('name_man') |
35 | <span class="text-xs text-red-600 dark:text-red-400"> | 35 | <span class="text-xs text-red-600 dark:text-red-400"> |
36 | {{ $message }} | 36 | {{ $message }} |
37 | </span> | 37 | </span> |
38 | @enderror | 38 | @enderror |
39 | </label><br> | 39 | </label><br> |
40 | 40 | ||
41 | <input type="hidden" name="is_worker" id="is_worker" value="1"/> | 41 | <input type="hidden" name="is_worker" id="is_worker" value="1"/> |
42 | <input type="hidden" name="is_bd" id="is_bd" value="1"/> | 42 | <input type="hidden" name="is_bd" id="is_bd" value="1"/> |
43 | <input type="hidden" name="admin" id="admin" value="0"/> | 43 | <input type="hidden" name="admin" id="admin" value="0"/> |
44 | <input type="hidden" name="password" id="password" value="1234567890"/> | 44 | <input type="hidden" name="password" id="password" value="1234567890"/> |
45 | 45 | ||
46 | <label class="block text-sm"> | 46 | <label class="block text-sm"> |
47 | <span class="text-gray-700 dark:text-gray-400">Отчество</span> | 47 | <span class="text-gray-700 dark:text-gray-400">Отчество</span> |
48 | <input name="surname2" id="surname2" | 48 | <input name="surname2" id="surname2" |
49 | 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" | 49 | 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" |
50 | placeholder="Отчество" value="{{ old('surname2') ?? $user->surname2 ?? '' }}" | 50 | placeholder="Отчество" value="{{ old('surname2') ?? $user->surname2 ?? '' }}" |
51 | /> | 51 | /> |
52 | @error('surname2') | 52 | @error('surname2') |
53 | <span class="text-xs text-red-600 dark:text-red-400"> | 53 | <span class="text-xs text-red-600 dark:text-red-400"> |
54 | {{ $message }} | 54 | {{ $message }} |
55 | </span> | 55 | </span> |
56 | @enderror | 56 | @enderror |
57 | </label><br> | 57 | </label><br> |
58 | 58 | ||
59 | <label class="block text-sm"> | 59 | <label class="block text-sm"> |
60 | <span class="text-gray-700 dark:text-gray-400">Email</span> | 60 | <span class="text-gray-700 dark:text-gray-400">Email</span> |
61 | <input name="email" id="email" | 61 | <input name="email" id="email" |
62 | 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" | 62 | 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" |
63 | placeholder="Email" value="{{ old('email') ?? $user->email ?? '' }}" | 63 | placeholder="Email" value="{{ old('email') ?? $user->email ?? '' }}" |
64 | /> | 64 | /> |
65 | @error('email') | 65 | @error('email') |
66 | <span class="text-xs text-red-600 dark:text-red-400"> | 66 | <span class="text-xs text-red-600 dark:text-red-400"> |
67 | {{ $message }} | 67 | {{ $message }} |
68 | </span> | 68 | </span> |
69 | @enderror | 69 | @enderror |
70 | </label><br> | 70 | </label><br> |
71 | 71 | ||
72 | <label class="block text-sm"> | 72 | <label class="block text-sm"> |
73 | <span class="text-gray-700 dark:text-gray-400">Телефон</span> | 73 | <span class="text-gray-700 dark:text-gray-400">Телефон</span> |
74 | <input name="telephone" id="telephone" | 74 | <input name="telephone" id="telephone" |
75 | 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" | 75 | 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" |
76 | placeholder="Телефон" value="{{ old('telephone') ?? $user->telephone ?? '' }}" | 76 | placeholder="Телефон" value="{{ old('telephone') ?? $user->telephone ?? '' }}" |
77 | /> | 77 | /> |
78 | @error('telephone') | 78 | @error('telephone') |
79 | <span class="text-xs text-red-600 dark:text-red-400"> | 79 | <span class="text-xs text-red-600 dark:text-red-400"> |
80 | {{ $message }} | 80 | {{ $message }} |
81 | </span> | 81 | </span> |
82 | @enderror | 82 | @enderror |
83 | </label><br> | 83 | </label><br> |
84 | 84 | ||
85 | <label class="block text-sm"> | ||
86 | <span class="text-gray-700 dark:text-gray-400">Файл-анкета</span> | ||
87 | <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 | ||
88 | focus:border-purple-400 focus:outline-none focus:shadow-outline-purple | ||
89 | dark:text-gray-300 dark:focus:shadow-outline-gray form-input" | ||
90 | id="file" name="file"> | ||
91 | @error('file') | ||
92 | <span class="text-xs text-red-600 dark:text-red-400"> | ||
93 | {{ $message }} | ||
94 | </span> | ||
95 | @enderror | ||
96 | @isset($user->file) | ||
97 | <a class="text-gray-700 dark:text-gray-400" target="blank" href="{{ asset(Storage::url($user->file)) }}">{{ $user->file }}</a> | ||
98 | @endisset | ||
99 | </label><br> | ||
100 | |||
85 | <!--<label class="block text-sm"> | 101 | <!--<label class="block text-sm"> |
86 | 102 | ||
87 | <input type="hidden" name="page_worker" value="0" /> | 103 | <input type="hidden" name="page_worker" value="0" /> |
88 | <input name="page_worker" @php if (isset($user->workers->id)) echo "checked"; @endphp | 104 | <input name="page_worker" @php if (isset($user->workers->id)) echo "checked"; @endphp |
89 | class="block mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray " | 105 | class="block mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray " |
90 | placeholder="" style="float:left; margin-right: 5px" type="checkbox" value="1" | 106 | placeholder="" style="float:left; margin-right: 5px" type="checkbox" value="1" |
91 | /><p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Анкета </p><br> | 107 | /><p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Анкета </p><br> |
92 | 108 | ||
93 | </label><br>--> | 109 | </label><br>--> |
94 | 110 | ||
95 | <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> | 111 | <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> |
96 | <div> | 112 | <div> |
97 | <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"> | 113 | <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"> |
98 | Сохранить | 114 | Сохранить |
99 | </button> | 115 | </button> |
100 | <a href="{{ route('admin.basedata') }}" | 116 | <a href="{{ route('admin.basedata') }}" |
101 | class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" | 117 | class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" |
102 | style="display: -webkit-inline-box; height: 30px!important;" | 118 | style="display: -webkit-inline-box; height: 30px!important;" |
103 | >Назад</a> | 119 | >Назад</a> |
104 | </div> | 120 | </div> |
105 | </div> | 121 | </div> |
106 | </div> | 122 | </div> |
107 | 123 |
resources/views/admin/users/index_bd.blade.php
1 | @extends('layout.admin', ['title' => $title]) | 1 | @extends('layout.admin', ['title' => $title]) |
2 | 2 | ||
3 | @section('script') | 3 | @section('script') |
4 | <script> | 4 | <script> |
5 | $(document).ready(function() { | 5 | $(document).ready(function() { |
6 | $(document).on('click', '.check_click', function () { | 6 | $(document).on('click', '.check_click', function () { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var value = this_.val(); | 8 | var value = this_.val(); |
9 | var field = this_.attr('data-field'); | 9 | var field = this_.attr('data-field'); |
10 | var ajax_block = $('#ajax_block'); | 10 | var ajax_block = $('#ajax_block'); |
11 | var bool = 0; | 11 | var bool = 0; |
12 | var str_get = ''; | 12 | var str_get = ''; |
13 | 13 | ||
14 | if(this.checked){ | 14 | if(this.checked){ |
15 | bool = 1; | 15 | bool = 1; |
16 | } else { | 16 | } else { |
17 | bool = 0; | 17 | bool = 0; |
18 | } | 18 | } |
19 | console.log(field); | 19 | console.log(field); |
20 | str_get = "id=" + value + "&" + field + "=" + bool; | 20 | str_get = "id=" + value + "&" + field + "=" + bool; |
21 | console.log(str_get); | 21 | console.log(str_get); |
22 | 22 | ||
23 | $.ajax({ | 23 | $.ajax({ |
24 | type: "GET", | 24 | type: "GET", |
25 | url: "{{ url()->full()}}", | 25 | url: "{{ url()->full()}}", |
26 | data: str_get, | 26 | data: str_get, |
27 | success: function (data) { | 27 | success: function (data) { |
28 | console.log('Обновление таблицы пользователей '); | 28 | console.log('Обновление таблицы пользователей '); |
29 | //data = JSON.parse(data); | 29 | //data = JSON.parse(data); |
30 | //console.log(data); | 30 | //console.log(data); |
31 | ajax_block.html(data); | 31 | ajax_block.html(data); |
32 | }, | 32 | }, |
33 | headers: { | 33 | headers: { |
34 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 34 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
35 | }, | 35 | }, |
36 | error: function (data) { | 36 | error: function (data) { |
37 | console.log('Error: ' + data); | 37 | console.log('Error: ' + data); |
38 | } | 38 | } |
39 | }); | 39 | }); |
40 | }); | 40 | }); |
41 | }); | 41 | }); |
42 | </script> | 42 | </script> |
43 | @endsection | 43 | @endsection |
44 | 44 | ||
45 | @section('search') | 45 | @section('search') |
46 | @include('admin.find') | 46 | @include('admin.find') |
47 | @endsection | 47 | @endsection |
48 | 48 | ||
49 | @section('content') | 49 | @section('content') |
50 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> | 50 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> |
51 | <div class="w-full overflow-x-auto"> | 51 | <div class="w-full overflow-x-auto"> |
52 | <a class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" href="{{ route('admin.add-basedata') }}">Добавить пользователя</a><br><br> | 52 | <a class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" href="{{ route('admin.add-basedata') }}">Добавить пользователя</a><br><br> |
53 | <table class="w-full whitespace-no-wrap"> | 53 | <table class="w-full whitespace-no-wrap"> |
54 | <thead> | 54 | <thead> |
55 | <tr | 55 | <tr |
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 | 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" |
57 | > | 57 | > |
58 | <th class="px-4 py-3">№</th> | 58 | <th class="px-4 py-3">№</th> |
59 | <th class="px-4 py-3">Имя</th> | 59 | <th class="px-4 py-3">Имя</th> |
60 | <th class="px-4 py-3">Email/телефон</th> | 60 | <th class="px-4 py-3">Email/телефон</th> |
61 | <th class="px-4 py-3">Статус</th> | 61 | <th class="px-4 py-3">Статус</th> |
62 | <th class="px-4 py-3">Анкета</th> | 62 | <th class="px-4 py-3">Анкета</th> |
63 | <th class="px-4 py-3">Дата регистрации</th> | 63 | <th class="px-4 py-3">Дата регистрации</th> |
64 | <th class="px-4 py-3">Изменить</th> | 64 | <th class="px-4 py-3">Изменить</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"> | 70 | <td class="px-4 py-3"> |
71 | {{$user->id}} | 71 | {{$user->id}} |
72 | </td> | 72 | </td> |
73 | <td class="px-4 py-3"> | 73 | <td class="px-4 py-3"> |
74 | <!--<div class="flex items-center text-sm"> | 74 | <!--<div class="flex items-center text-sm"> |
75 | <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> | 75 | <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> |
76 | <div | 76 | <div |
77 | class="absolute inset-0 rounded-full shadow-inner" | 77 | class="absolute inset-0 rounded-full shadow-inner" |
78 | aria-hidden="true" | 78 | aria-hidden="true" |
79 | ></div> | 79 | ></div> |
80 | </div> | 80 | </div> |
81 | <div> | 81 | <div> |
82 | <p class="font-semibold"><a href="{{ route('admin.users') }}">Пользователи</a></p> | 82 | <p class="font-semibold"><a href="{{ route('admin.users') }}">Пользователи</a></p> |
83 | <p class="text-xs text-gray-600 dark:text-gray-400"> | 83 | <p class="text-xs text-gray-600 dark:text-gray-400"> |
84 | Все пользователи сайта | 84 | Все пользователи сайта |
85 | </p> | 85 | </p> |
86 | </div> | 86 | </div> |
87 | </div> | 87 | </div> |
88 | --> | 88 | --> |
89 | <!--<a style="text-decoration: underline;" href="{{ route('admin.user-profile', ['user' => $user->id]) }}"></a>--> | 89 | <!--<a style="text-decoration: underline;" href="{{ route('admin.user-profile', ['user' => $user->id]) }}"></a>--> |
90 | 90 | ||
91 | {{ $user->name }} | 91 | {{ $user->name }} |
92 | </td> | 92 | </td> |
93 | 93 | ||
94 | <td class="px-4 py-3"> | 94 | <td class="px-4 py-3"> |
95 | <div class="flex items-center text-sm"> | 95 | <div class="flex items-center text-sm"> |
96 | <!--<div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> | 96 | <!--<div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> |
97 | <div | 97 | <div |
98 | class="absolute inset-0 rounded-full shadow-inner" | 98 | class="absolute inset-0 rounded-full shadow-inner" |
99 | aria-hidden="true" | 99 | aria-hidden="true" |
100 | ></div> | 100 | ></div> |
101 | </div>--> | 101 | </div>--> |
102 | <div> | 102 | <div> |
103 | <p class="font-semibold">{{ empty($user->employers->email) ? $user->email : $user->employers->email }}</p> | 103 | <p class="font-semibold">{{ empty($user->employers->email) ? $user->email : $user->employers->email }}</p> |
104 | <p class="text-xs text-gray-600 dark:text-gray-400"> | 104 | <p class="text-xs text-gray-600 dark:text-gray-400"> |
105 | {{ empty($user->employers->telephone) ? $user->telephone : $user->employers->telephone }} | 105 | {{ empty($user->employers->telephone) ? $user->telephone : $user->employers->telephone }} |
106 | </p> | 106 | </p> |
107 | </div> | 107 | </div> |
108 | </div> | 108 | </div> |
109 | </td> | 109 | </td> |
110 | 110 | ||
111 | <td class="px-4 py-3 text-xs"> | 111 | <td class="px-4 py-3 text-xs"> |
112 | <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"> | 112 | <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"> |
113 | @if ($user->is_worker) | 113 | @if ($user->is_worker) |
114 | Работник | 114 | Работник |
115 | @else | 115 | @else |
116 | Работодатель | 116 | Работодатель |
117 | @endif | 117 | @endif |
118 | </span> | 118 | </span> |
119 | @if ($user->admin) | 119 | @if ($user->admin) |
120 | <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"> | 120 | <span class="px-2 py-1 font-semibold leading-tight text-orange-700 bg-orange-100 rounded-full dark:text-white dark:bg-orange-600"> |
121 | Администратор | 121 | Администратор |
122 | </span> | 122 | </span> |
123 | @endif | 123 | @endif |
124 | @if ($user->is_bd) | 124 | @if ($user->is_bd) |
125 | <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"> | 125 | <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"> |
126 | База данных | 126 | База данных |
127 | </span> | 127 | </span> |
128 | @endif | 128 | @endif |
129 | </td> | 129 | </td> |
130 | 130 | ||
131 | <td class="px-4 py-3 text-sm"> | 131 | <td class="px-4 py-3 text-sm"> |
132 | @if (isset($user->workers[0]->id)) | 132 | @if (isset($user->workers[0]->id)) |
133 | <a href="{{ route('admin.worker-profile-edit', ['worker' => $user->workers[0]->id]) }}">Править</a> | | 133 | <!--<a href="{{ route('admin.worker-profile-edit', ['worker' => $user->workers[0]->id]) }}">Править</a> |--> |
134 | <a href="{{ route('admin.doc-basedata', ['user' => $user->id]) }}">Скачать</a> | 134 | <!--<a href="{{ route('admin.doc-basedata', ['user' => $user->id]) }}">Скачать</a>--> |
135 | @endif | 135 | @endif |
136 | @isset($user->file) | ||
137 | <a class="text-gray-700 dark:text-gray-400" target="blank" href="{{ asset(Storage::url($user->file)) }}">Скачать</a> | ||
138 | @else | ||
139 | <p class="text-gray-700 dark:text-gray-400">-</p> | ||
140 | @endisset | ||
136 | </td> | 141 | </td> |
137 | 142 | ||
138 | <td class="px-4 py-3 text-sm"> | 143 | <td class="px-4 py-3 text-sm"> |
139 | {{ date('d.m.Y', strtotime($user->created_at)) }} | 144 | {{ date('d.m.Y', strtotime($user->created_at)) }} |
140 | </td> | 145 | </td> |
141 | 146 | ||
142 | <td class="px-4 py-3 text-sm_"> | 147 | <td class="px-4 py-3 text-sm_"> |
143 | <form action="{{ route('admin.delete-basedata', ['user' => $user->id]) }}" method="POST"> | 148 | <form action="{{ route('admin.delete-basedata', ['user' => $user->id]) }}" method="POST"> |
144 | <a href="{{ route('admin.edit-basedata', ['user' => $user->id]) }}">Изменить</a> | | 149 | <a href="{{ route('admin.edit-basedata', ['user' => $user->id]) }}">Изменить</a> | |
145 | @csrf | 150 | @csrf |
146 | @method('DELETE') | 151 | @method('DELETE') |
147 | <input class="btn btn-danger" type="submit" value="Удалить"/> | 152 | <input class="btn btn-danger" type="submit" value="Удалить"/> |
148 | </form> | 153 | </form> |
149 | </td> | 154 | </td> |
150 | </tr> | 155 | </tr> |
151 | @endforeach | 156 | @endforeach |
152 | </tbody> | 157 | </tbody> |
153 | </table> | 158 | </table> |
154 | </div> | 159 | </div> |
155 | 160 | ||
156 | <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"> | 161 | <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"> |
157 | <?//=$users->appends($_GET)->links('admin.pagginate'); ?> | 162 | <?//=$users->appends($_GET)->links('admin.pagginate'); ?> |
158 | <?=$users->links('admin.pagginate'); ?> | 163 | <?=$users->links('admin.pagginate'); ?> |
159 | </div> | 164 | </div> |
160 | 165 | ||
161 | 166 | ||
162 | <!--<div | 167 | <!--<div |
163 | 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" | 168 | 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" |
164 | > | 169 | > |
165 | <span class="flex items-center col-span-3"> | 170 | <span class="flex items-center col-span-3"> |
166 | Showing 21-30 of 100 | 171 | Showing 21-30 of 100 |
167 | </span> | 172 | </span> |
168 | <span class="col-span-2"></span> | 173 | <span class="col-span-2"></span> |
169 | 174 | ||
170 | <span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end"> | 175 | <span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end"> |
171 | <nav aria-label="Table navigation"> | 176 | <nav aria-label="Table navigation"> |
172 | <ul class="inline-flex items-center"> | 177 | <ul class="inline-flex items-center"> |
173 | <li> | 178 | <li> |
174 | <button | 179 | <button |
175 | class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple" | 180 | class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple" |
176 | aria-label="Previous" | 181 | aria-label="Previous" |
177 | > | 182 | > |
178 | <svg | 183 | <svg |
179 | aria-hidden="true" | 184 | aria-hidden="true" |
180 | class="w-4 h-4 fill-current" | 185 | class="w-4 h-4 fill-current" |
181 | viewBox="0 0 20 20" | 186 | viewBox="0 0 20 20" |
182 | > | 187 | > |
183 | <path | 188 | <path |
184 | 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" | 189 | 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" |
185 | clip-rule="evenodd" | 190 | clip-rule="evenodd" |
186 | fill-rule="evenodd" | 191 | fill-rule="evenodd" |
187 | ></path> | 192 | ></path> |
188 | </svg> | 193 | </svg> |
189 | </button> | 194 | </button> |
190 | </li> | 195 | </li> |
191 | <li> | 196 | <li> |
192 | <button | 197 | <button |
193 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | 198 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" |
194 | > | 199 | > |
195 | 1 | 200 | 1 |
196 | </button> | 201 | </button> |
197 | </li> | 202 | </li> |
198 | <li> | 203 | <li> |
199 | <button | 204 | <button |
200 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | 205 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" |
201 | > | 206 | > |
202 | 2 | 207 | 2 |
203 | </button> | 208 | </button> |
204 | </li> | 209 | </li> |
205 | <li> | 210 | <li> |
206 | <button | 211 | <button |
207 | 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" | 212 | 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" |
208 | > | 213 | > |
209 | 3 | 214 | 3 |
210 | </button> | 215 | </button> |
211 | </li> | 216 | </li> |
212 | <li> | 217 | <li> |
213 | <button | 218 | <button |
214 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | 219 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" |
215 | > | 220 | > |
216 | 4 | 221 | 4 |
217 | </button> | 222 | </button> |
218 | </li> | 223 | </li> |
219 | <li> | 224 | <li> |
220 | <span class="px-3 py-1">...</span> | 225 | <span class="px-3 py-1">...</span> |
221 | </li> | 226 | </li> |
222 | <li> | 227 | <li> |
223 | <button | 228 | <button |
224 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | 229 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" |
225 | > | 230 | > |
226 | 8 | 231 | 8 |
227 | </button> | 232 | </button> |
228 | </li> | 233 | </li> |
229 | <li> | 234 | <li> |
230 | <button | 235 | <button |
231 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" | 236 | class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" |
232 | > | 237 | > |
233 | 9 | 238 | 9 |
234 | </button> | 239 | </button> |
235 | </li> | 240 | </li> |
236 | <li> | 241 | <li> |
237 | <button | 242 | <button |
238 | class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple" | 243 | class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple" |
239 | aria-label="Next" | 244 | aria-label="Next" |
240 | > | 245 | > |
241 | <svg | 246 | <svg |
242 | class="w-4 h-4 fill-current" | 247 | class="w-4 h-4 fill-current" |
243 | aria-hidden="true" | 248 | aria-hidden="true" |
244 | viewBox="0 0 20 20" | 249 | viewBox="0 0 20 20" |
245 | > | 250 | > |
246 | <path | 251 | <path |
247 | 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" | 252 | 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" |
248 | clip-rule="evenodd" | 253 | clip-rule="evenodd" |
249 | fill-rule="evenodd" | 254 | fill-rule="evenodd" |
250 | ></path> | 255 | ></path> |
251 | </svg> | 256 | </svg> |
252 | </button> | 257 | </button> |
253 | </li> | 258 | </li> |
254 | </ul> | 259 | </ul> |
255 | </nav> | 260 | </nav> |
256 | </span> | 261 | </span> |
257 | </div>--> | 262 | </div>--> |
258 | </div> | 263 | </div> |
259 | 264 | ||
260 | <?//=$users->appends($_GET)->links('catalogs.paginate'); ?> | 265 | <?//=$users->appends($_GET)->links('catalogs.paginate'); ?> |
261 | 266 | ||
262 | 267 | ||
263 | @endsection | 268 | @endsection |
264 | 269 |