Commit eb8596db66c772ba6f16740ed42179b0ab051f4c

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

Правки вакансии, образование, форма регистрации

Showing 17 changed files with 350 additions and 103 deletions Inline Diff

app/Classes/Tools.php
File was created 1 <?php
2
3
4 namespace App\Classes;
5
6
7 class Tools
8 {
9 static function generator_id($length = 6)
10 {
11 $word = '';
12 $arr = array(
13 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
14 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
15 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
16 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
17 '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'
18 );
19
20 for ($i = 0; $i < $length; $i++) {
21 $word .= $arr[random_int(0, count($arr) - 1)];
22 }
23 return $word;
24 }
25 }
26
app/Http/Controllers/Admin/Ad_EmployersController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers\Admin; 3 namespace App\Http\Controllers\Admin;
4 4
5 use App\Http\Controllers\Controller; 5 use App\Http\Controllers\Controller;
6 use App\Models\Ad_employer; 6 use App\Models\Ad_employer;
7 use App\Models\Employer; 7 use App\Models\Employer;
8 use App\Models\Job_title; 8 use App\Models\Job_title;
9 use App\Models\User; 9 use App\Models\User;
10 use Carbon\Carbon; 10 use Carbon\Carbon;
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\Validator; 13 use Illuminate\Support\Facades\Validator;
14 14
15 class Ad_EmployersController extends Controller 15 class Ad_EmployersController extends Controller
16 { 16 {
17 /** 17 /**
18 * Display a listing of the resource. 18 * Display a listing of the resource.
19 * 19 *
20 * @return \Illuminate\Http\Response 20 * @return \Illuminate\Http\Response
21 */ 21 */
22 public function index(Request $request) 22 public function index(Request $request)
23 { 23 {
24 $title = 'Админка - Вакансии работодателей'; 24 $title = 'Админка - Вакансии работодателей';
25 if ($request->ajax()) { 25 if ($request->ajax()) {
26 $params = $request->all(); 26 $params = $request->all();
27 foreach ($params['data'] as $item) { 27 foreach ($params['data'] as $item) {
28 $emp = Ad_employer::find($item); 28 $emp = Ad_employer::find($item);
29 $emp->updated_at = Carbon::now(); 29 $emp->updated_at = Carbon::now();
30 $emp->save(); 30 $emp->save();
31 } 31 }
32 } 32 }
33 33
34 $select_job = Job_title::query()->active()->get(); 34 $select_job = Job_title::query()->active()->get();
35 $all_ad = Ad_employer::with('employer')->with('jobs') 35 $all_ad = Ad_employer::with('employer')->with('jobs')
36 ->where('is_remove', '0')->get()->count(); 36 ->where('is_remove', '0')->get()->count();
37 37
38 $ad_employers = Ad_employer::where('is_remove', '0'); 38 $ad_employers = Ad_employer::where('is_remove', '0');
39 39
40 $find_job = ""; 40 $find_job = "";
41 if (isset($request->category_job)) { 41 if (isset($request->category_job)) {
42 if ($request->category_job != 'Все вакансии') { 42 if ($request->category_job != 'Все вакансии') {
43 $find_job = $request->category_job; 43 $find_job = $request->category_job;
44 $ad_employers = $ad_employers->WhereHas('jobs', function($query) use ($find_job){ 44 $ad_employers = $ad_employers->WhereHas('jobs', function($query) use ($find_job){
45 return $query->where('name', 'LIKE', '%'.$find_job.'%'); 45 return $query->where('name', 'LIKE', '%'.$find_job.'%');
46 }); 46 });
47 } 47 }
48 } else { 48 } else {
49 $ad_employers = $ad_employers->with('jobs'); 49 $ad_employers = $ad_employers->with('jobs');
50 } 50 }
51 51
52 $find_key = ""; 52 $find_key = "";
53 if (isset($request->find)) { 53 if (isset($request->find)) {
54 $find_key = $request->find; 54 $find_key = $request->find;
55 $ad_employers = $ad_employers->whereHas('employer', function($query) use($find_key) { 55 $ad_employers = $ad_employers->whereHas('employer', function($query) use($find_key) {
56 $query->Where('name_company', 'LIKE', "%$find_key%"); 56 $query->Where('name_company', 'LIKE', "%$find_key%");
57 $query->orWhere('name', 'LIKE', "%$find_key%"); 57 $query->orWhere('name', 'LIKE', "%$find_key%");
58 }); 58 });
59 59
60 } else { 60 } else {
61 $ad_employers = $ad_employers->with('employer'); 61 $ad_employers = $ad_employers->with('employer');
62 } 62 }
63 63
64 $ad_employers = $ad_employers->OrderBy('updated_at', 'desc')->paginate(15); 64 $ad_employers = $ad_employers->OrderBy('updated_at', 'desc')->paginate(15);
65 65
66 if ($request->ajax()) { 66 if ($request->ajax()) {
67 return view('admin.ad_employers.index_ajax', compact('ad_employers', 'params')); 67 return view('admin.ad_employers.index_ajax', compact('ad_employers', 'params'));
68 } else { 68 } else {
69 return view('admin.ad_employers.index', compact('ad_employers', 69 return view('admin.ad_employers.index', compact('ad_employers',
70 'title', 70 'title',
71 'all_ad', 71 'all_ad',
72 'find_job', 72 'find_job',
73 'find_key', 73 'find_key',
74 'select_job')); 74 'select_job'));
75 } 75 }
76 } 76 }
77 77
78 /** 78 /**
79 * Show the form for creating a new resource. 79 * Show the form for creating a new resource
80 *
81 * @return \Illuminate\Http\Response 80 * @return \Illuminate\Http\Response
82 */ 81 */
83 public function create() 82 public function create()
84 { 83 {
85 // 84 $job_titles = Job_title::query()->active()->get();
85 return view('admin.ad_employers.add', compact('job_titles'));
86 } 86 }
87 87
88 /** 88 /**
89 * Store a newly created resource in storage. 89 * Store a newly created resource in storage.
90 * 90 *
91 * @param \Illuminate\Http\Request $request 91 * @param \Illuminate\Http\Request $request
92 * @return \Illuminate\Http\Response 92 * @return \Illuminate\Http\Response
93 */ 93 */
94 public function store(Request $request) 94 public function store(Request $request)
95 { 95 {
96 // 96 $params = $request->all();
97 unset($params->position_work);
98 $rules = [
99 'name' => 'required|min:3',
100 ];
101 $messages = [
102 'required' => 'Укажите обязательное поле',
103 ];
104 $validator = Validator::make($params, $rules, $messages);
105
106 if ($validator->fails()) {
107 return redirect()->route('admin.add-ad-employers')
108 ->withErrors($validator);
109 } else {
110 $ad_employer = new Ad_employer();
111 $params['employer_id'] = 1;
112 $data_ad = $ad_employer->create($params);
113 $data_ad->jobs()->sync($request->position_work);
114 //$ad_employer->jobs()->sync($request->position_work);
115
116
117 return redirect()->route('admin.ad-employers')
118 ->with('success', 'Данные были успешно сохранены');
119 }
120 return redirect()->route('admin.ad-employers');
97 } 121 }
98 122
99 /** 123 /**
100 * Display the specified resource. 124 * Display the specified resource.
101 * 125 *
102 * @param \App\Models\Ad_employer $ad_employer 126 * @param \App\Models\Ad_employer $ad_employer
103 * @return \Illuminate\Http\Response 127 * @return \Illuminate\Http\Response
104 */ 128 */
105 public function show(Ad_employer $ad_employer) 129 public function show(Ad_employer $ad_employer)
106 { 130 {
107 // 131 //
108 } 132 }
109 133
110 /** 134 /**
111 * Show the form for editing the specified resource. 135 * Show the form for editing the specified resource.
112 * 136 *
113 * @param \App\Models\Ad_employer $ad_employer 137 * @param \App\Models\Ad_employer $ad_employer
114 * @return \Illuminate\Http\Response 138 * @return \Illuminate\Http\Response
115 */ 139 */
116 public function edit(Ad_employer $ad_employer) 140 public function edit(Ad_employer $ad_employer)
117 { 141 {
118 $sel = Array(); 142 $sel = Array();
119 $job_titles = Job_title::active()->get(); 143 $job_titles = Job_title::active()->get();
120 144
121 foreach ($ad_employer->jobs as $j) { 145 foreach ($ad_employer->jobs as $j) {
122 $sel[] = $j->id; 146 $sel[] = $j->id;
123 } 147 }
124 148
125 return view('admin.ad_employers.edit', compact('ad_employer', 'job_titles', 'sel')); 149 return view('admin.ad_employers.edit', compact('ad_employer', 'job_titles', 'sel'));
126 } 150 }
127 151
128 /** 152 /**
129 * Update the specified resource in storage. 153 * Update the specified resource in storage.
130 * 154 *
131 * @param \Illuminate\Http\Request $request 155 * @param \Illuminate\Http\Request $request
132 * @param \App\Models\Ad_employer $ad_employer 156 * @param \App\Models\Ad_employer $ad_employer
133 * @return \Illuminate\Http\Response 157 * @return \Illuminate\Http\Response
134 */ 158 */
135 public function update(Request $request, Ad_employer $ad_employer) 159 public function update(Request $request, Ad_employer $ad_employer)
136 { 160 {
137 $params = $request->all(); 161 $params = $request->all();
138 unset($params->position_work); 162 unset($params->position_work);
139 $rules = [ 163 $rules = [
140 'name' => 'required|min:3', 164 'name' => 'required|min:3',
141 ]; 165 ];
142 $messages = [ 166 $messages = [
143 'required' => 'Укажите обязательное поле', 167 'required' => 'Укажите обязательное поле',
144 ]; 168 ];
145 $validator = Validator::make($params, $rules, $messages); 169 $validator = Validator::make($params, $rules, $messages);
146 170
147 if ($validator->fails()) { 171 if ($validator->fails()) {
148 return redirect()->route('admin.edit-ad-employers', ['ad_employer' => $ad_employer->id]) 172 return redirect()->route('admin.edit-ad-employers', ['ad_employer' => $ad_employer->id])
149 ->withErrors($validator); 173 ->withErrors($validator);
150 } else { 174 } else {
151 $ad_employer->update($params); 175 $ad_employer->update($params);
152 $ad_employer->jobs()->sync($request->position_work); 176 $ad_employer->jobs()->sync($request->position_work);
153 177
154 return redirect()->route('admin.ad-employers') 178 return redirect()->route('admin.ad-employers')
155 ->with('success', 'Данные были успешно сохранены'); 179 ->with('success', 'Данные были успешно сохранены');
156 } 180 }
157 return redirect()->route('admin.ad-employers'); 181 return redirect()->route('admin.ad-employers');
158 } 182 }
159 183
160 /** 184 /**
161 * Remove the specified resource from storage. 185 * Remove the specified resource from storage.
162 * 186 *
163 * @param \App\Models\Ad_employer $ad_employer 187 * @param \App\Models\Ad_employer $ad_employer
164 * @return \Illuminate\Http\Response 188 * @return \Illuminate\Http\Response
165 */ 189 */
166 public function destroy(Ad_employer $ad_employer) 190 public function destroy(Ad_employer $ad_employer)
167 { 191 {
168 // 192 $ad_employer->is_remove = 1;
193 $ad_employer->save();
194
195 return redirect()->route('admin.ad-employers');
169 } 196 }
170 } 197 }
app/Http/Controllers/Admin/AdminController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers\Admin; 3 namespace App\Http\Controllers\Admin;
4 4
5 use App\Classes\Tools;
5 use App\Http\Controllers\Controller; 6 use App\Http\Controllers\Controller;
6 use App\Http\Requests\CompanyRequest; 7 use App\Http\Requests\CompanyRequest;
7 use App\Models\Company; 8 use App\Models\Company;
8 use App\Models\Employer; 9 use App\Models\Employer;
9 use App\Models\User; 10 use App\Models\User;
10 use Carbon\Carbon; 11 use Carbon\Carbon;
11 use Illuminate\Http\Request; 12 use Illuminate\Http\Request;
12 use Illuminate\Support\Facades\Auth; 13 use Illuminate\Support\Facades\Auth;
13 use Illuminate\Support\Facades\Hash; 14 use Illuminate\Support\Facades\Hash;
14 use Illuminate\Support\Facades\Storage; 15 use Illuminate\Support\Facades\Storage;
15 use Illuminate\Support\Facades\Validator; 16 use Illuminate\Support\Facades\Validator;
16 17
17 class AdminController extends Controller 18 class AdminController extends Controller
18 { 19 {
19 /** 20 /**
20 * Handle the incoming request. 21 * Handle the incoming request.
21 * 22 *
22 * @param \Illuminate\Http\Request $request 23 * @param \Illuminate\Http\Request $request
23 * @return \Illuminate\Http\Response 24 * @return \Illuminate\Http\Response
24 */ 25 */
25 public function __invoke(Request $request) 26 public function __invoke(Request $request)
26 { 27 {
27 // 28 //
28 } 29 }
29 30
30 public function register() { 31 public function register() {
31 return view('admin.register'); 32 $code_emp = Tools::generator_id(10);
33 return view('admin.register', compact('code_emp'));
32 } 34 }
33 35
34 public function create(Request $request) { 36 public function create(Request $request) {
35 37
36 $rules = [ 38 $params = $request->all();
39 unset($params['code_emp']);
40 $rules = [
37 'name' => 'required|string|max:255', 41 'name' => 'required|string|max:255',
38 'email' => 'required|string|email|max:255|unique:users', 42 'email' => 'required|string|email|max:255|unique:users',
39 'password' => 'required|string|min:8|confirmed', 43 'password' => 'required|string|min:8|confirmed',
40 ]; 44 ];
41 45
42 $messages = [ 46 $messages = [
43 'required' => 'Укажите обязательное поле «:attribute»', 47 'required' => 'Укажите обязательное поле «:attribute»',
44 'confirmed' => 'Пароли не совпадают', 48 'confirmed' => 'Пароли не совпадают',
45 'email' => 'Введите корректный email', 49 'email' => 'Введите корректный email',
46 'unique' => 'Данный email занят уже', 50 'unique' => 'Данный email занят уже',
47 'min' => [ 51 'min' => [
48 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 52 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
49 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 53 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
50 ], 54 ],
51 'max' => [ 55 'max' => [
52 'string' => 'Поле «:attribute» должно быть не больше :max символов', 56 'string' => 'Поле «:attribute» должно быть не больше :max символов',
53 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 57 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
54 ], 58 ],
55 ]; 59 ];
56 60
57 $validator = Validator::make($request->all(), $rules, $messages); 61 $validator = Validator::make($params, $rules, $messages);
58 62
59 if ($validator->fails()) { 63 if ($validator->fails()) {
60 return back()->withErrors($validator)->withInput(); //->route('admin.register') 64 return back()->withErrors($validator)->withInput();
61 65
62 } else { 66 } else {
63 $params = $request->all(); 67 try {
64 68 $user = User::create([
65 User::create([ 69 'name' => $request->name,
66 'name' => $request->name, 70 'email' => $request->email,
67 'email' => $request->email, 71 'password' => Hash::make($request->password),
68 'password' => Hash::make($request->password), 72 'pubpassword' => base64_encode($request->password),
69 'pubpassword' => base64_encode($request->password), 73 'admin' => '1',
70 'admin' => '1', 74 'is_worker' => '0',
71 'email_verified_at' => Carbon::now() 75 'email_verified_at' => Carbon::now()
76 ]);
77 } finally {
78 $emp = Employer::create([
79 'name_company' => 'Администратор',
80 'user_id' => $user->id,
81 'code' => $request->code_emp
82 ]);
83 }
72 84
73 ]);
74 return redirect() 85 return redirect()
75 ->route('admin.login') 86 ->route('admin.login')
76 ->with('success', 'Вы успешно зарегистрировались'); 87 ->with('success', 'Вы успешно зарегистрировались');
77 } 88 }
78 } 89 }
79 90
80 public function login() { 91 public function login() {
81 return view('admin.login'); 92 return view('admin.login');
82 } 93 }
83 94
84 // Аутентификация 95 // Аутентификация
85 public function autenticate(Request $request) { 96 public function autenticate(Request $request) {
86 //$request->validate( 97 //$request->validate(
87 $rules = [ 98 $rules = [
88 'email' => 'required|string|email', 99 'email' => 'required|string|email',
89 'password' => 'required|string', 100 'password' => 'required|string',
90 ]; 101 ];
91 102
92 $messages = [ 103 $messages = [
93 'required' => 'Укажите обязательное поле «:attribute»', 104 'required' => 'Укажите обязательное поле «:attribute»',
94 'email' => 'Введите корректный email', 105 'email' => 'Введите корректный email',
95 'min' => [ 106 'min' => [
96 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 107 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
97 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 108 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
98 ], 109 ],
99 'max' => [ 110 'max' => [
100 'string' => 'Поле «:attribute» должно быть не больше :max символов', 111 'string' => 'Поле «:attribute» должно быть не больше :max символов',
101 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 112 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
102 ], 113 ],
103 ]; 114 ];
104 115
105 116
106 $validator = Validator::make($request->all(), $rules, $messages); 117 $validator = Validator::make($request->all(), $rules, $messages);
107 118
108 if ($validator->fails()) { 119 if ($validator->fails()) {
109 return back()->withErrors($validator)->withInput(); 120 return back()->withErrors($validator)->withInput();
110 121
111 } else { 122 } else {
112 123
113 $credentials = $request->only('email', 'password'); 124 $credentials = $request->only('email', 'password');
114 125
115 if (Auth::attempt($credentials, $request->has('remember'))) { 126 if (Auth::attempt($credentials, $request->has('remember'))) {
116 127
117 if (is_null(Auth::user()->email_verified_at)) { 128 if (is_null(Auth::user()->email_verified_at)) {
118 Auth::logout(); 129 Auth::logout();
119 return back()->withErrors('Адрес почты не подтвержден')->withInput(); 130 return back()->withErrors('Адрес почты не подтвержден')->withInput();
120 } 131 }
121 132
122 if (!Auth::user()->admin) { 133 if (!Auth::user()->admin) {
123 Auth::logout(); 134 Auth::logout();
124 return //redirect()->route('admin.login') 135 return //redirect()->route('admin.login')
125 back()->withErrors('Вы не являетесь админом!')->withInput();; 136 back()->withErrors('Вы не являетесь админом!')->withInput();;
126 137
127 } 138 }
128 139
129 return redirect() 140 return redirect()
130 ->route('admin.index') 141 ->route('admin.index')
131 ->with('success', 'Вы вошли в личный кабинет.'); 142 ->with('success', 'Вы вошли в личный кабинет.');
132 } 143 }
133 } 144 }
134 145
135 return redirect() 146 return redirect()
136 ->route('admin.login') 147 ->route('admin.login')
137 ->withErrors('Неверный логин или пароль!')->withInput(); 148 ->withErrors('Неверный логин или пароль!')->withInput();
138 149
139 } 150 }
140 151
141 public function logout() { 152 public function logout() {
142 Auth::logout(); 153 Auth::logout();
143 return redirect()->route('index') 154 return redirect()->route('index')
144 ->with('success', 'Вы вышли из личного кабинета'); 155 ->with('success', 'Вы вышли из личного кабинета');
145 } 156 }
146 157
147 public function index() { 158 public function index() {
148 $all_user = User::query()->count(); 159 $all_user = User::query()->count();
149 $all_employer = User::where('is_worker', '0')->count(); 160 $all_employer = User::where('is_worker', '0')->count();
150 $all_worker = User::where('is_worker', '1')->count(); 161 $all_worker = User::where('is_worker', '1')->count();
151 $all_admin = User::where('admin', '1')->count(); 162 $all_admin = User::where('admin', '1')->count();
152 return view('admin.index', compact('all_employer', 'all_user', 'all_worker', 'all_admin')); 163 return view('admin.index', compact('all_employer', 'all_user', 'all_worker', 'all_admin'));
153 } 164 }
154 165
155 public function index_admin(Request $request) { 166 public function index_admin(Request $request) {
156 $title = 'Админка - Администраторы системы'; 167 $title = 'Админка - Администраторы системы';
157 $id_admin = Auth::user()->id; 168 $id_admin = Auth::user()->id;
158 169
159 if ($request->ajax()) { 170 if ($request->ajax()) {
160 $user = User::find($request->id); 171 $user = User::find($request->id);
161 $request->offsetUnset('id'); 172 $request->offsetUnset('id');
162 $user->update($request->all()); 173 $user->update($request->all());
163 } 174 }
164 $find_key = ''; 175 $find_key = '';
165 $users = User::where('admin', '1'); 176 $users = User::where('admin', '1');
166 if (isset($request->find)) { 177 if (isset($request->find)) {
167 $find_key = $request->find; 178 $find_key = $request->find;
168 $users = $users->where(function($query) use($find_key) { 179 $users = $users->where(function($query) use($find_key) {
169 $query->Where('name', 'LIKE', "%$find_key%") 180 $query->Where('name', 'LIKE', "%$find_key%")
170 ->orWhere('email', 'LIKE', "%$find_key%"); 181 ->orWhere('email', 'LIKE', "%$find_key%");
171 }); 182 });
172 } 183 }
173 $users = $users->paginate(15); 184 $users = $users->paginate(15);
174 185
175 if ($request->ajax()) { 186 if ($request->ajax()) {
176 return view('admin.users.index_ajax', compact('users', 'id_admin')); 187 return view('admin.users.index_ajax', compact('users', 'id_admin'));
177 } else { 188 } else {
178 return view('admin.users.index', compact('users', 'title', 'id_admin', 'find_key')); 189 return view('admin.users.index', compact('users', 'title', 'id_admin', 'find_key'));
179 } 190 }
180 } 191 }
181 192
182 //Страница профиль пользователя - форма 193 //Страница профиль пользователя - форма
183 public function profile_user(User $user) { 194 public function profile_user(User $user) {
184 $visible = false; 195 $visible = false;
185 if($user->is_worker) { 196 if($user->is_worker) {
186 $caption = "Карточка работника"; 197 $caption = "Карточка работника";
187 if (isset($user->workers[0]->id)) { 198 if (isset($user->workers[0]->id)) {
188 $link = route('admin.worker-profile-edit', ['worker' => $user->workers[0]->id]); 199 $link = route('admin.worker-profile-edit', ['worker' => $user->workers[0]->id]);
189 $visible = true; 200 $visible = true;
190 } else { 201 } else {
191 $link = ""; 202 $link = "";
192 } 203 }
193 204
194 } else { 205 } else {
195 $caption = "Карточка работодателя"; 206 $caption = "Карточка работодателя";
196 if (isset($user->employers[0]->id)) { 207 if (isset($user->employers[0]->id)) {
197 208
198 $link = route('admin.employer-profile', ['employer' => $user->employers[0]->id]); 209 $link = route('admin.employer-profile', ['employer' => $user->employers[0]->id]);
199 $visible = true; 210 $visible = true;
200 } else { 211 } else {
201 $link = ""; 212 $link = "";
202 } 213 }
203 } 214 }
204 215
205 return view('admin.users.profile', compact('user', 'visible', 'link', 'caption')); 216 return view('admin.users.profile', compact('user', 'visible', 'link', 'caption'));
206 } 217 }
207 218
208 //Страница профиль пользователя - сохранение формы 219 //Страница профиль пользователя - сохранение формы
209 public function store_profile_user(User $user, Request $request) { 220 public function store_profile_user(User $user, Request $request) {
210 $rules = [ 221 $rules = [
211 'name' => 'required|min:3', 222 'name' => 'required|min:3',
212 ]; 223 ];
213 $messages = [ 224 $messages = [
214 'required' => 'Укажите обязательное поле', 225 'required' => 'Укажите обязательное поле',
215 'email' => 'Это поле должно быть определено, как Email' 226 'email' => 'Это поле должно быть определено, как Email'
216 ]; 227 ];
217 $validator = Validator::make($request->all(), $rules, $messages); 228 $validator = Validator::make($request->all(), $rules, $messages);
218 229
219 if ($validator->fails()) { 230 if ($validator->fails()) {
220 return redirect()->route('admin.user-profile', ['user' => $user->id]) 231 return redirect()->route('admin.user-profile', ['user' => $user->id])
221 ->withErrors($validator); 232 ->withErrors($validator);
222 } else { 233 } else {
223 $user->update($request->all()); 234 $user->update($request->all());
224 return redirect()->route('admin.user-profile', ['user' => $user->id]) 235 return redirect()->route('admin.user-profile', ['user' => $user->id])
225 ->with('success', 'Данные были успешно сохранены'); 236 ->with('success', 'Данные были успешно сохранены');
226 } 237 }
227 return redirect()->route('admin.user-profile', ['user' => $user->id]); 238 return redirect()->route('admin.user-profile', ['user' => $user->id]);
228 } 239 }
229 240
230 // Страница профиль админа - форма 241 // Страница профиль админа - форма
231 public function profile() { 242 public function profile() {
232 $id = Auth::user()->id; 243 $id = Auth::user()->id;
233 $user = User::find($id); 244 $user = User::find($id);
234 245
235 return view('admin.profile', compact('user')); 246 return view('admin.profile', compact('user'));
236 } 247 }
237 248
238 // Страница профиль админа - сохранение формы 249 // Страница профиль админа - сохранение формы
239 public function store_profile(Request $request) { 250 public function store_profile(Request $request) {
240 $id = Auth::user()->id; 251 $id = Auth::user()->id;
241 $user = User::find($id); 252 $user = User::find($id);
242 253
243 $rules = [ 254 $rules = [
244 'name' => 'required|min:3', 255 'name' => 'required|min:3',
245 'email' => 'required|email|min:3', 256 'email' => 'required|email|min:3',
246 ]; 257 ];
247 $messages = [ 258 $messages = [
248 'required' => 'Укажите обязательное поле', 259 'required' => 'Укажите обязательное поле',
249 'email' => 'Это поле должно быть определено, как Email' 260 'email' => 'Это поле должно быть определено, как Email'
250 ]; 261 ];
251 $validator = Validator::make($request->all(), $rules, $messages); 262 $validator = Validator::make($request->all(), $rules, $messages);
252 263
253 if ($validator->fails()) { 264 if ($validator->fails()) {
254 return redirect()->route('admin.profile') 265 return redirect()->route('admin.profile')
255 ->withErrors($validator); 266 ->withErrors($validator);
256 } else { 267 } else {
257 $user->update($request->all()); 268 $user->update($request->all());
258 return redirect()->route('admin.profile') 269 return redirect()->route('admin.profile')
259 ->with('success', 'Данные были успешно сохранены'); 270 ->with('success', 'Данные были успешно сохранены');
260 } 271 }
261 return redirect()->route('admin.profile'); 272 return redirect()->route('admin.profile');
262 } 273 }
263 274
264 // Форма смены пароля администоратора 275 // Форма смены пароля администоратора
265 public function profile_password() { 276 public function profile_password() {
266 $id = Auth::user()->id; 277 $id = Auth::user()->id;
267 $user = User::find($id); 278 $user = User::find($id);
268 $username = $user->name; 279 $username = $user->name;
269 280
270 return view('admin.password', compact('username')); 281 return view('admin.password', compact('username'));
271 } 282 }
272 283
273 // Сохранение формы смены пароля администоратора 284 // Сохранение формы смены пароля администоратора
274 public function profile_password_new(Request $request) { 285 public function profile_password_new(Request $request) {
275 286
276 $rules = [ 287 $rules = [
277 'old_password' => 'required|min:6', //|current_password:api', 288 'old_password' => 'required|min:6', //|current_password:api',
278 'password' => 'required|min:6|confirmed', 289 'password' => 'required|min:6|confirmed',
279 ]; 290 ];
280 $messages = [ 291 $messages = [
281 'required' => 'Укажите обязательное поле', 292 'required' => 'Укажите обязательное поле',
282 'confirmed' => 'Пароли не совпадают' 293 'confirmed' => 'Пароли не совпадают'
283 ]; 294 ];
284 295
285 $validator = Validator::make($request->all(), $rules, $messages); 296 $validator = Validator::make($request->all(), $rules, $messages);
286 297
287 if (! Hash::check($request->old_password, $request->user()->password)) { 298 if (! Hash::check($request->old_password, $request->user()->password)) {
288 return back()->withErrors([ 299 return back()->withErrors([
289 'old_password' => ['Неверный предыдущий пароль'] 300 'old_password' => ['Неверный предыдущий пароль']
290 ]); 301 ]);
291 } 302 }
292 303
293 if ($validator->fails()) { 304 if ($validator->fails()) {
294 return redirect()->route('admin.password') 305 return redirect()->route('admin.password')
295 ->withErrors($validator); 306 ->withErrors($validator);
296 } else { 307 } else {
297 $params = $request->all(); 308 $params = $request->all();
298 // устанавливаем новый пароль для пользователя 309 // устанавливаем новый пароль для пользователя
299 User::where('id', Auth::id()) 310 User::where('id', Auth::id())
300 ->update(['password' => Hash::make($request->password)]); 311 ->update(['password' => Hash::make($request->password)]);
301 session()->flash('success', 'Успешно изменен пароль!'); 312 session()->flash('success', 'Успешно изменен пароль!');
302 313
303 return redirect()->route('admin.password'); 314 return redirect()->route('admin.password');
304 } 315 }
305 } 316 }
306 317
307 // Страница конфигурация сайта - форма 318 // Страница конфигурация сайта - форма
308 public function config_form() { 319 public function config_form() {
309 $config = Company::find(1); 320 $config = Company::find(1);
310 return view('admin.config', compact('config')); 321 return view('admin.config', compact('config'));
311 } 322 }
312 323
313 // Страница конфигурация сайта - сохранение формы 324 // Страница конфигурация сайта - сохранение формы
314 public function store_config(CompanyRequest $request) { 325 public function store_config(CompanyRequest $request) {
315 $config = Company::find(1); 326 $config = Company::find(1);
316 327
317 $params = $request->all(); 328 $params = $request->all();
318 unset($params['logo']); 329 unset($params['logo']);
319 unset($params['image']); 330 unset($params['image']);
320 331
321 if ($request->has('logo')) { 332 if ($request->has('logo')) {
322 Storage::delete($config->logo); 333 Storage::delete($config->logo);
323 $params['logo'] = $request->file('logo')->store('config', 'public'); 334 $params['logo'] = $request->file('logo')->store('config', 'public');
324 } 335 }
325 336
326 if ($request->has('image')) { 337 if ($request->has('image')) {
327 Storage::delete($config->image); 338 Storage::delete($config->image);
328 $params['image'] = $request->file('image')->store('config', 'public'); 339 $params['image'] = $request->file('image')->store('config', 'public');
329 } 340 }
330 341
331 if (is_null($config)) { 342 if (is_null($config)) {
332 Company::create($params); 343 Company::create($params);
333 } else { 344 } else {
334 $config->update($params); 345 $config->update($params);
335 } 346 }
336 347
337 return redirect()->route('admin.config'); 348 return redirect()->route('admin.config');
338 } 349 }
339 350
340 351
341 } 352 }
app/Http/Controllers/Admin/EducationController.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\EducationRequest; 6 use App\Http\Requests\EducationRequest;
7 use App\Http\Requests\ProgramEducationRequest; 7 use App\Http\Requests\ProgramEducationRequest;
8 use App\Models\Education; 8 use App\Models\Education;
9 use App\Models\ProgramEducation; 9 use App\Models\ProgramEducation;
10 use Illuminate\Http\Request; 10 use Illuminate\Http\Request;
11 use Illuminate\Support\Facades\Storage; 11 use Illuminate\Support\Facades\Storage;
12 12
13 class EducationController extends Controller 13 class EducationController extends Controller
14 { 14 {
15 /** 15 /**
16 * Display a listing of the resource. 16 * Display a listing of the resource.
17 * 17 *
18 * @return \Illuminate\Http\Response 18 * @return \Illuminate\Http\Response
19 */ 19 */
20 public function index() 20 public function index()
21 { 21 {
22 $education = Education::query()->active()->paginate(15); 22 $education = Education::query()->active()->paginate(15);
23 return view('admin.education.index', compact('education')); 23 return view('admin.education.index', compact('education'));
24 } 24 }
25 25
26 /** 26 /**
27 * Show the form for creating a new resource. 27 * Show the form for creating a new resource.
28 * 28 *
29 * @return \Illuminate\Http\Response 29 * @return \Illuminate\Http\Response
30 */ 30 */
31 public function create() 31 public function create()
32 { 32 {
33 return view('admin.education.add'); 33 return view('admin.education.add');
34 } 34 }
35 35
36 /** 36 /**
37 * Store a newly created resource in storage. 37 * Store a newly created resource in storage.
38 * 38 *
39 * @param \Illuminate\Http\Request $request 39 * @param \Illuminate\Http\Request $request
40 * @return \Illuminate\Http\Response 40 * @return \Illuminate\Http\Response
41 */ 41 */
42 public function store(EducationRequest $request) 42 public function store(EducationRequest $request)
43 { 43 {
44 $params = $request->all(); 44 $params = $request->all();
45 if ($request->has('image')) { 45 if ($request->has('image')) {
46 $params['image'] = $request->file('image')->store("education", 'public'); 46 $params['image'] = $request->file('image')->store("education", 'public');
47 } 47 }
48 Education::create($params); 48 Education::create($params);
49 49
50 50
51 return redirect()->route('admin.education.index'); 51 return redirect()->route('admin.education.index');
52 } 52 }
53 53
54 /** 54 /**
55 * Display the specified resource. 55 * Display the specified resource.
56 * 56 *
57 * @param \App\Models\Education $education 57 * @param \App\Models\Education $education
58 * @return \Illuminate\Http\Response 58 * @return \Illuminate\Http\Response
59 */ 59 */
60 public function show(Education $education) 60 public function show(Education $education)
61 { 61 {
62 // 62 //
63 } 63 }
64 64
65 /** 65 /**
66 * Show the form for editing the specified resource. 66 * Show the form for editing the specified resource.
67 * 67 *
68 * @param \App\Models\Education $education 68 * @param \App\Models\Education $education
69 * @return \Illuminate\Http\Response 69 * @return \Illuminate\Http\Response
70 */ 70 */
71 public function edit(Education $education) 71 public function edit(Education $education)
72 { 72 {
73 $program1 = ProgramEducation::query()->where('education_id', '=', $education->id) 73 /*$program1 = ProgramEducation::query()->where('education_id', '=', $education->id)
74 ->where('level', '=', '1')->get(); 74 ->where('level', '=', '1')->get();
75 $program2 = ProgramEducation::query()->where('education_id', '=', $education->id) 75 $program2 = ProgramEducation::query()->where('education_id', '=', $education->id)
76 ->where('level', '=', '2')->get(); 76 ->where('level', '=', '2')->get();
77 $program3 = ProgramEducation::query()->where('education_id', '=', $education->id) 77 $program3 = ProgramEducation::query()->where('education_id', '=', $education->id)
78 ->where('level', '=', '3')->get(); 78 ->where('level', '=', '3')->get();
79 */
79 80
80 return view('admin.education.edit', compact('education', 'program1', 'program2', 'program3')); 81 $program = ProgramEducation::query()->where('education_id', '=', $education->id)
82 ->orderBy('level')->get();
83
84 return view('admin.education.edit', compact('education', 'program'));
81 } 85 }
82 86
83 /** 87 /**
84 * Update the specified resource in storage. 88 * Update the specified resource in storage.
85 * 89 *
86 * @param \Illuminate\Http\Request $request 90 * @param \Illuminate\Http\Request $request
87 * @param \App\Models\Education $education 91 * @param \App\Models\Education $education
88 * @return \Illuminate\Http\Response 92 * @return \Illuminate\Http\Response
89 */ 93 */
90 public function update(EducationRequest $request, Education $education) 94 public function update(EducationRequest $request, Education $education)
91 { 95 {
92 $params = $request->all(); 96 $params = $request->all();
93 if ($request->has('image')) { 97 if ($request->has('image')) {
94 if (!empty($education->image)) { 98 if (!empty($education->image)) {
95 Storage::delete($education->image); 99 Storage::delete($education->image);
96 } 100 }
97 $params['image'] = $request->file('image')->store("education", 'public'); 101 $params['image'] = $request->file('image')->store("education", 'public');
98 } 102 }
99 103
100 $education->update($params); 104 $education->update($params);
101 return redirect()->route('admin.education.index'); 105 return redirect()->route('admin.education.index');
102 } 106 }
103 107
104 /** 108 /**
105 * Remove the specified resource from storage. 109 * Remove the specified resource from storage.
106 * 110 *
107 * @param \App\Models\Education $education 111 * @param \App\Models\Education $education
108 * @return \Illuminate\Http\Response 112 * @return \Illuminate\Http\Response
109 */ 113 */
110 public function destroy(Education $education) 114 public function destroy(Education $education)
111 { 115 {
112 $education->update(['is_remove' => 1]); 116 $education->update(['is_remove' => 1]);
113 return redirect()->route('admin.education.index'); 117 return redirect()->route('admin.education.index');
114 } 118 }
115 119
116 public function add_program(Education $education, int $level) { 120 public function add_program(Request $request) {
117 $id_education = $education->id; 121 $id_education = $request->id;
122 $level = $request->level;
118 return view('admin.education.program', compact('id_education', 'level')); 123 return view('admin.education.program', compact('id_education', 'level'));
119 } 124 }
120 125
121 public function store_program(ProgramEducationRequest $request) { 126 public function store_program(ProgramEducationRequest $request) {
122 $education = $request->education_id; 127 $education = $request->education_id;
123 ProgramEducation::create($request->all()); 128 ProgramEducation::create($request->all());
124 129
125 return redirect()->route('admin.education.edit', ['education' => $education]); 130 return redirect()->route('admin.education.edit', ['education' => $education]);
126 } 131 }
127 132
128 } 133 }
129 134
app/Http/Controllers/Admin/EmployersController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers\Admin; 3 namespace App\Http\Controllers\Admin;
4 4
5 use App\Http\Controllers\Controller; 5 use App\Http\Controllers\Controller;
6 use App\Models\Ad_employer; 6 use App\Models\Ad_employer;
7 use App\Models\Answer; 7 use App\Models\Answer;
8 use App\Models\CategoryEmp; 8 use App\Models\CategoryEmp;
9 use App\Models\Employer; 9 use App\Models\Employer;
10 use App\Models\Static_ad; 10 use App\Models\Static_ad;
11 use App\Models\User; 11 use App\Models\User;
12 use Illuminate\Http\Request; 12 use Illuminate\Http\Request;
13 use Illuminate\Support\Facades\DB; 13 use Illuminate\Support\Facades\DB;
14 use Illuminate\Support\Facades\Storage; 14 use Illuminate\Support\Facades\Storage;
15 use Illuminate\Support\Facades\Validator; 15 use Illuminate\Support\Facades\Validator;
16 16
17 class EmployersController extends Controller 17 class EmployersController extends Controller
18 { 18 {
19 public function index(Request $request) { 19 public function index(Request $request) {
20 //$all_employer = User::where('is_worker', '0')->count(); 20 //$all_employer = User::where('is_worker', '0')->count();
21 21
22 if ($request->ajax()) { 22 if ($request->ajax()) {
23 $user = User::find($request->id); 23 $user = User::find($request->id);
24 $request->offsetUnset('id'); 24 $request->offsetUnset('id');
25 $user->update($request->all()); 25 $user->update($request->all());
26 } 26 }
27 27
28 $users = User::with('employers')->select(['users.*','users.id as usr_id', 'emp.id as emp_id', 'emp.logo as emp_logo', 'emp.*']) 28 $users = User::with('employers')->select(['users.*','users.id as usr_id', 'emp.id as emp_id', 'emp.logo as emp_logo', 'emp.*'])
29 ->join('employers as emp','emp.user_id','users.id') 29 ->join('employers as emp','emp.user_id','users.id')
30 ->where('users.is_worker', '0')->Realuser(); 30 ->where('users.is_worker', '0')->Realuser()->Notadmin();
31 $all_employer = $users->count(); 31 $all_employer = $users->count();
32 32
33 $find_cat = ""; 33 $find_cat = "";
34 if (isset($request->category)) { 34 if (isset($request->category)) {
35 if ($request->category != 'Все категории') { 35 if ($request->category != 'Все категории') {
36 $users = $users->where('category', '=', $request->category); 36 $users = $users->where('category', '=', $request->category);
37 $find_cat = $request->category; 37 $find_cat = $request->category;
38 } 38 }
39 } 39 }
40 $find_key = ""; 40 $find_key = "";
41 41
42 if (isset($request->find)) { 42 if (isset($request->find)) {
43 $find_key = $request->find; 43 $find_key = $request->find;
44 $users = $users->where(function($query) use($find_key) { 44 $users = $users->where(function($query) use($find_key) {
45 $query->Where('users.name', 'LIKE', "%$find_key%") 45 $query->Where('users.name', 'LIKE', "%$find_key%")
46 ->orWhere('emp.email', 'LIKE', "%$find_key%") 46 ->orWhere('emp.email', 'LIKE', "%$find_key%")
47 ->orWhere('emp.telephone', 'LIKE', "%$find_key%"); 47 ->orWhere('emp.telephone', 'LIKE', "%$find_key%");
48 }); 48 });
49 } 49 }
50 50
51 //DB::enableQueryLog(); 51 //DB::enableQueryLog();
52 $users = $users->paginate(15); 52 $users = $users->paginate(15);
53 //dd(DB::getQueryLog()); 53 //dd(DB::getQueryLog());
54 54
55 $select_category = CategoryEmp::query()->active()->get(); 55 $select_category = CategoryEmp::query()->active()->get();
56 56
57 if ($request->ajax()) { 57 if ($request->ajax()) {
58 return view('admin.employer.index_ajax', compact('users')); 58 return view('admin.employer.index_ajax', compact('users'));
59 } else { 59 } else {
60 return view('admin.employer.index', compact('users', 'find_key', 'find_cat', 'all_employer', 'select_category')); 60 return view('admin.employer.index', compact('users',
61 'find_key',
62 'find_cat',
63 'all_employer',
64 'select_category'));
61 } 65 }
62 } 66 }
63 67
64 public function comment_read(Employer $employer) { 68 public function comment_read(Employer $employer) {
65 return view('admin.employer.comment', compact('employer')); 69 return view('admin.employer.comment', compact('employer'));
66 } 70 }
67 71
68 public function form_update_employer(Employer $employer) { 72 public function form_update_employer(Employer $employer) {
69 $select_category = CategoryEmp::query()->active()->get(); 73 $select_category = CategoryEmp::query()->active()->get();
70 return view('admin.employer.edit', compact('employer', 'select_category')); 74 return view('admin.employer.edit', compact('employer', 'select_category'));
71 } 75 }
72 76
73 public function update_employer(Employer $employer, Request $request) 77 public function update_employer(Employer $employer, Request $request)
74 { 78 {
75 $params = $request->all(); 79 $params = $request->all();
76 unset($params['logo']); 80 unset($params['logo']);
77 unset($params['telephone']); 81 unset($params['telephone']);
78 unset($params['email']); 82 unset($params['email']);
79 unset($params['address']); 83 unset($params['address']);
80 unset($params['site']); 84 unset($params['site']);
81 unset($params['status_hidden']); 85 unset($params['status_hidden']);
82 unset($params['oficial_status']); 86 unset($params['oficial_status']);
83 unset($params['social_is']); 87 unset($params['social_is']);
84 unset($params['sending_is']); 88 unset($params['sending_is']);
85 unset($params['category']); 89 unset($params['category']);
86 unset($params['comment_admin']); 90 unset($params['comment_admin']);
87 91
88 $rules = [ 92 $rules = [
89 'name' => 'required|string|max:255', 93 'name' => 'required|string|max:255',
90 ]; 94 ];
91 95
92 $messages = [ 96 $messages = [
93 'required' => 'Укажите обязательное поле «:attribute»', 97 'required' => 'Укажите обязательное поле «:attribute»',
94 'confirmed' => 'Пароли не совпадают', 98 'confirmed' => 'Пароли не совпадают',
95 'email' => 'Введите корректный email', 99 'email' => 'Введите корректный email',
96 'min' => [ 100 'min' => [
97 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 101 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
98 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 102 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
99 ], 103 ],
100 'max' => [ 104 'max' => [
101 'string' => 'Поле «:attribute» должно быть не больше :max символов', 105 'string' => 'Поле «:attribute» должно быть не больше :max символов',
102 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 106 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
103 ], 107 ],
104 ]; 108 ];
105 109
106 $validator = Validator::make($params, $rules, $messages); 110 $validator = Validator::make($params, $rules, $messages);
107 111
108 if ($validator->fails()) { 112 if ($validator->fails()) {
109 return back()->withErrors($validator)->withInput(); //->route('admin.register') 113 return back()->withErrors($validator)->withInput(); //->route('admin.register')
110 114
111 } else { 115 } else {
112 116
113 //$user = User::find($employer->user_id); 117 //$user = User::find($employer->user_id);
114 $user_id = $employer->user_id; 118 $user_id = $employer->user_id;
115 $employer->telephone = $request->telephone; 119 $employer->telephone = $request->telephone;
116 $employer->email = $request->email; 120 $employer->email = $request->email;
117 $employer->address = $request->address; 121 $employer->address = $request->address;
118 $employer->site = $request->site; 122 $employer->site = $request->site;
119 $employer->text = $request->text; 123 $employer->text = $request->text;
120 $employer->status_hidden = $request->status_hidden; 124 $employer->status_hidden = $request->status_hidden;
121 $employer->oficial_status = $request->oficial_status; 125 $employer->oficial_status = $request->oficial_status;
122 $employer->social_is = $request->social_is; 126 $employer->social_is = $request->social_is;
123 $employer->sending_is = $request->sending_is; 127 $employer->sending_is = $request->sending_is;
124 $employer->category = $request->category; 128 $employer->category = $request->category;
125 $employer->comment_admin = $request->comment_admin; 129 $employer->comment_admin = $request->comment_admin;
126 130
127 if ($request->has('logo')) { 131 if ($request->has('logo')) {
128 if (!empty($employer->logo)) { 132 if (!empty($employer->logo)) {
129 Storage::delete($employer->logo); 133 Storage::delete($employer->logo);
130 } 134 }
131 $employer->logo = $request->file('logo')->store("employer/$user_id", 'public'); 135 $employer->logo = $request->file('logo')->store("employer/$user_id", 'public');
132 } 136 }
133 $employer->save(); 137 $employer->save();
134 138
135 $user = User::find($user_id); 139 $user = User::find($user_id);
136 $user->update($params); 140 $user->update($params);
137 141
138 return redirect()->route('admin.employer-profile', ['employer' => $employer->id]) 142 return redirect()->route('admin.employer-profile', ['employer' => $employer->id])
139 ->with('success', 'Данные были успешно сохранены'); 143 ->with('success', 'Данные были успешно сохранены');
140 } 144 }
141 } 145 }
142 146
143 // Удаление работодателя, вакансий и профиля юзера 147 // Удаление работодателя, вакансий и профиля юзера
144 public function delete_employer(Employer $employer, User $user) { 148 public function delete_employer(Employer $employer, User $user) {
145 try { 149 try {
146 if (!empty($employer)) { 150 if (!empty($employer)) {
147 $employer->ads()->delete();
148 if (!empty($employer->logo)) { 151 if (!empty($employer->logo)) {
149 Storage::delete($employer->logo); 152 Storage::delete($employer->logo);
150 } 153 }
154
155 foreach($employer->ads as $ad) {
156 $ads = Ad_employer::find($ad->id);
157 $ads->employer_id = 2;
158 $ads->is_remove = 1;
159 $ads->save();
160 }
161
151 $employer->delete(); 162 $employer->delete();
152 } 163 }
153 } finally { 164 } finally {
154 $user->delete(); 165 $user->delete();
155 } 166 }
156 167
157 return redirect()->route('admin.employers')->with('success', 'Данные были удалены о работодателе'); 168 return redirect()->route('admin.employers')->with('success', 'Данные были удалены о работодателе');
158 } 169 }
159 170
160 // кабинет - отзывы о работодателе для модерации 171 // кабинет - отзывы о работодателе для модерации
161 public function answers(Request $request) { 172 public function answers(Request $request) {
162 if ($request->ajax()) { 173 if ($request->ajax()) {
163 $user = Answer::find($request->id); 174 $user = Answer::find($request->id);
164 $request->offsetUnset('id'); 175 $request->offsetUnset('id');
165 $user->update($request->all()); 176 $user->update($request->all());
166 } 177 }
167 178
168 $answers = Answer::query()->orderByDesc('id')->paginate(15); 179 $answers = Answer::query()->orderByDesc('id')->paginate(15);
169 180
170 if ($request->ajax()) { 181 if ($request->ajax()) {
171 return view('admin.answers.index_ajax', compact('answers')); 182 return view('admin.answers.index_ajax', compact('answers'));
172 } else { 183 } else {
173 return view('admin.answers.index', compact('answers')); 184 return view('admin.answers.index', compact('answers'));
174 } 185 }
175 } 186 }
176 187
177 // кабинет - статистика вакансий работодателя 188 // кабинет - статистика вакансий работодателя
178 public function static_ads(Request $request) { 189 public function static_ads(Request $request) {
179 $stat = Static_ad::with('ads'); 190 $stat = Static_ad::with('ads');
180 $ads = Ad_employer::query()->active()->OrderBy('id')->get(); 191 $ads = Ad_employer::query()->active()->OrderBy('id')->get();
181 $periods = Static_ad::query()->distinct('year_month')->select('year_month')->get(); 192 $periods = Static_ad::query()->distinct('year_month')->select('year_month')->get();
182 if ($request->ajax()) { 193 if ($request->ajax()) {
183 if (isset($request->ad_employer_id)) 194 if (isset($request->ad_employer_id))
184 if (!$request->ad_employer_id == "0") 195 if (!$request->ad_employer_id == "0")
185 $stat = $stat->Where('ad_employer_id', '=', $request->ad_employer_id); 196 $stat = $stat->Where('ad_employer_id', '=', $request->ad_employer_id);
186 if (isset($request->year_month)) { 197 if (isset($request->year_month)) {
187 if (!$request->year_month == "0") 198 if (!$request->year_month == "0")
188 $stat = $stat->Where('year_month', '=', $request->year_month); 199 $stat = $stat->Where('year_month', '=', $request->year_month);
189 } 200 }
190 } 201 }
191 202
192 $stat = $stat->OrderByDesc('year_month'); 203 $stat = $stat->OrderByDesc('year_month');
193 $stat = $stat->paginate(15); 204 $stat = $stat->paginate(15);
194 205
195 if ($request->ajax()) 206 if ($request->ajax())
196 return view('admin.static.index_ads_ajax', compact('stat')); 207 return view('admin.static.index_ads_ajax', compact('stat'));
197 else 208 else
198 return view('admin.static.index_ads', compact('stat', 'ads', 'periods')); 209 return view('admin.static.index_ads', compact('stat', 'ads', 'periods'));
199 210
200 } 211 }
201 212
202 213
203 } 214 }
app/Models/Employer.php
1 <?php 1 <?php
2 2
3 namespace App\Models; 3 namespace App\Models;
4 4
5 use Illuminate\Database\Eloquent\Factories\HasFactory; 5 use Illuminate\Database\Eloquent\Factories\HasFactory;
6 use Illuminate\Database\Eloquent\Model; 6 use Illuminate\Database\Eloquent\Model;
7 7
8 class Employer extends Model 8 class Employer extends Model
9 { 9 {
10 use HasFactory; 10 use HasFactory;
11 11
12 protected $fillable = [ 12 protected $fillable = [
13 'name_company', 13 'name_company',
14 'email', 14 'email',
15 'telephone', 15 'telephone',
16 'logo', 16 'logo',
17 'rate', 17 'rate',
18 'user_id', 18 'user_id',
19 'sort', 19 'sort',
20 'text', 20 'text',
21 'address', 21 'address',
22 'map', 22 'map',
23 'site', 23 'site',
24 'coord', 24 'coord',
25 'plus', 25 'plus',
26 'is_remove', 26 'is_remove',
27 'oficial_status', 27 'oficial_status',
28 'social_is', 28 'social_is',
29 'sending_is', 29 'sending_is',
30 'category',
31 'comment_admin',
32 'code',
33 'status_hidden'
30 ]; 34 ];
31 35
32 /* 36 /*
33 * Связь таблицы users с таблицей employers 37 * Связь таблицы users с таблицей employers
34 */ 38 */
35 public function users() { 39 public function users() {
36 return $this->belongsTo(User::class, 'user_id'); 40 return $this->belongsTo(User::class, 'user_id');
37 } 41 }
38 42
39 /* 43 /*
40 * Связь Работодателя с вакансиями 44 * Связь Работодателя с вакансиями
41 */ 45 */
42 public function ads() { 46 public function ads() {
43 return $this->hasMany(Ad_employer::class); 47 return $this->hasMany(Ad_employer::class);
44 } 48 }
45 49
46 public function scopeActive($query) { 50 public function scopeActive($query) {
47 return $query->where('is_remove', '=', '0'); 51 return $query->where('is_remove', '=', '0');
48 } 52 }
49 53
50 } 54 }
51 55
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 'file',
42 'pubpassword', 42 'pubpassword',
43 ]; 43 ];
44 44
45 /** 45 /**
46 * The attributes that should be hidden for serialization. 46 * The attributes that should be hidden for serialization.
47 * 47 *
48 * @var array<int, string> 48 * @var array<int, string>
49 */ 49 */
50 protected $hidden = [ 50 protected $hidden = [
51 'password', 51 'password',
52 'remember_token', 52 'remember_token',
53 ]; 53 ];
54 54
55 /** 55 /**
56 * The attributes that should be cast. 56 * The attributes that should be cast.
57 * 57 *
58 * @var array<string, string> 58 * @var array<string, string>
59 */ 59 */
60 protected $casts = [ 60 protected $casts = [
61 'email_verified_at' => 'datetime', 61 'email_verified_at' => 'datetime',
62 ]; 62 ];
63 63
64 /* 64 /*
65 * Связь Пользователей системы с работодателями 65 * Связь Пользователей системы с работодателями
66 * users - employers 66 * users - employers
67 */ 67 */
68 public function employers() { 68 public function employers() {
69 return $this->hasMany(Employer::class, 'user_id'); 69 return $this->hasMany(Employer::class, 'user_id');
70 } 70 }
71 71
72 /* 72 /*
73 * Связь Пользователей системы с работниками 73 * Связь Пользователей системы с работниками
74 * users - workers 74 * users - workers
75 */ 75 */
76 public function workers() { 76 public function workers() {
77 return $this->hasMany(Worker::class, 'user_id'); 77 return $this->hasMany(Worker::class, 'user_id');
78 } 78 }
79 79
80 /* 80 /*
81 * Связь Пользователей системы с работниками 81 * Связь Пользователей системы с работниками
82 * users - workers 82 * users - workers
83 */ 83 */
84 public function work() { 84 public function work() {
85 return $this->hasMany(Worker::class, 'user_id')->select('telephone', 'email', 'position_work', 'persent_anketa'); 85 return $this->hasMany(Worker::class, 'user_id')->select('telephone', 'email', 'position_work', 'persent_anketa');
86 } 86 }
87 87
88 /* 88 /*
89 * Связь Модели Пользователей(Users) с Группами (Group_users) 89 * Связь Модели Пользователей(Users) с Группами (Group_users)
90 * users - group_users 90 * users - group_users
91 многие-ко-многим 91 многие-ко-многим
92 */ 92 */
93 public function ingroup() { 93 public function ingroup() {
94 return $this->belongsToMany(Group_user::class, 'group_works'); 94 return $this->belongsToMany(Group_user::class, 'group_works');
95 } 95 }
96 96
97 /* 97 /*
98 * Связь Пользователей системы с ссобщениями 98 * Связь Пользователей системы с ссобщениями
99 * users - messages 99 * users - messages
100 */ 100 */
101 public function messages() { 101 public function messages() {
102 return $this->hasMany(Message::class); 102 return $this->hasMany(Message::class);
103 } 103 }
104 104
105 /* 105 /*
106 * Связь Пользователей системы с статистика 106 * Связь Пользователей системы с статистика
107 * users - static_workers 107 * users - static_workers
108 */ 108 */
109 public function static_user() { 109 public function static_user() {
110 return $this->hasMany(Static_worker::class); 110 return $this->hasMany(Static_worker::class);
111 } 111 }
112 112
113 /* 113 /*
114 * Связь модели Юзеры (users) с моделью Группы пользователей (Group_works) 114 * Связь модели Юзеры (users) с моделью Группы пользователей (Group_works)
115 один-ко-многим 115 один-ко-многим
116 */ 116 */
117 public function peoples() { 117 public function peoples() {
118 return $this->hasMany(Group_works::class); 118 return $this->hasMany(Group_works::class);
119 } 119 }
120 120
121 /* 121 /*
122 * Связь Модели Пользователей(Users) с Группами (Group_users) 122 * Связь Модели Пользователей(Users) с Группами (Group_users)
123 * users - group_users 123 * users - group_users
124 многие-ко-многим 124 многие-ко-многим
125 */ 125 */
126 public function jobtitles() { 126 public function jobtitles() {
127 return $this->belongsToMany(Job_title::class, 'Workers', 'user_id', 'position_work'); 127 return $this->belongsToMany(Job_title::class, 'Workers', 'user_id', 'position_work');
128 } 128 }
129 129
130 public function scopeActive($query) { 130 public function scopeActive($query) {
131 return $query->where('is_remove', '=', '0'); 131 return $query->where('is_remove', '=', '0');
132 } 132 }
133 133
134 public function scopeWorker($query) { 134 public function scopeWorker($query) {
135 return $query->where('is_worker', '=', '1'); 135 return $query->where('is_worker', '=', '1');
136 } 136 }
137 137
138 public function scopeBaseuser($query) { 138 public function scopeBaseuser($query) {
139 return $query->where('is_bd', '=', '1'); 139 return $query->where('is_bd', '=', '1');
140 } 140 }
141 141
142 public function scopeRealuser($query) { 142 public function scopeRealuser($query) {
143 return $query->where('is_bd', '=', '0'); 143 return $query->where('is_bd', '=', '0');
144 } 144 }
145 145
146 public function scopeAdmin($query) {
147 return $query->where('admin', '=', '1');
148 }
149
150 public function scopeNotadmin($query) {
151 return $query->where('admin', '=', '0');
152 }
153
146 } 154 }
147 155
database/migrations/2023_10_31_060833_alter_table_employers.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('employers', function (Blueprint $table) {
17 $table->string('code', 100)->nullable(false);
18 });
19 }
20
21 /**
22 * Reverse the migrations.
23 *
24 * @return void
25 */
26 public function down()
27 {
28 Schema::table('employers', function (Blueprint $table) {
29 $table->dropColumn('code');
30 });
31 }
32 };
33
resources/views/admin/ad_employers/add.blade.php
File was created 1 @extends('layout.admin', ['title' => 'Админка - Добавление вакансии'])
2
3 @section('script')
4
5 @endsection
6
7 @section('content')
8 <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">
9 Добавление вакансии
10 </h4>
11 <form method="POST" action="{{ route('admin.store-ad-employers')}}">
12 @csrf
13 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
14 <label class="block text-sm">
15 <span class="text-gray-700 dark:text-gray-400">Название вакансии</span>
16 <input name="name" id="name"
17 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
18 placeholder="Название вакансии" value="{{ old('name') ?? '' }}"
19 />
20 @error('name')
21 <span class="text-xs text-red-600 dark:text-red-400">
22 {{ $message }}
23 </span>
24 @enderror
25 </label>
26
27 <label class="block mt-4 text-sm">
28 <span class="text-gray-700 dark:text-gray-400">
29 Категории должности
30 </span>
31 <select
32 class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-multiselect focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
33 multiple
34 name="position_work[]" id="position_work"
35 >
36 @foreach($job_titles as $job)
37 <option value="{{$job->id}}" @if (old('position_work') == $job->id) selected @endif >
38 {{ $job->name }} ({{$job->id}})
39 </option>
40 @endforeach
41 </select>
42 </label><br>
43
44 <label class="block text-sm">
45 <span class="text-gray-700 dark:text-gray-400">Текст-описание вакансии</span>
46 <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor" name="text" placeholder="Описание вакансии (text/html)"
47 rows="10">{{ old('text') ?? '' }}</textarea>
48 @error('text')
49 <span class="text-xs text-red-600 dark:text-red-400">
50 {{ $message }}
51 </span>
52 @enderror
53 </label>
54
55 <label class="block mt-4 text-sm">
56 <span class="text-gray-700 dark:text-gray-400">
57 Статус вакансии
58 </span>
59 <select
60 class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-multiselect focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
61 name="status" id="status"
62 >
63 <option value="Не задан" @if (old('status') == "Не задан") selected @endif >
64 Не задан
65 </option>
66 <option value="Открыта" @if (old('status') == "Открыта") selected @endif >
67 Открыта
68 </option>
69 <option value="Закрыта" @if (old('status') == "Закрыта") selected @endif >
70 Закрыта
71 </option>
72 </select>
73 </label><br>
74
75 <label class="block text-sm">
76 <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Срочная вакансия</p>
77 <input type="hidden" name="sroch_vacancy" value="0" />
78 <input name="sroch_vacancy"
79 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 "
80 placeholder="" type="checkbox" value="1"
81 /><br>
82
83 <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Избранная вакансия</p>
84 <input type="hidden" name="favorite_vacancy" value="0" />
85 <input name="favorite_vacancy" id="favorite_vacancy"
86 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 "
87 placeholder="" type="checkbox" value="1"
88 /><br>
89 </label>
90
91 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
92 <div>
93 <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">
94 Сохранить
95 </button>
96 <a href="{{ route('admin.ad-employers') }}"
97 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 style="display: -webkit-inline-box; height: 30px!important;"
99 >Назад</a>
100 </div>
101 </div>
102 </div>
103 </form>
104 @endsection
105
resources/views/admin/ad_employers/edit.blade.php
1 @extends('layout.admin', ['title' => 'Админка - Редактирование вакансии']) 1 @extends('layout.admin', ['title' => 'Админка - Редактирование вакансии'])
2 2
3 @section('script') 3 @section('script')
4 4
5 @endsection 5 @endsection
6 6
7 @section('content') 7 @section('content')
8 <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300"> 8 <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">
9 Редактирование вакансии 9 Редактирование вакансии
10 </h4> 10 </h4>
11 <form method="POST" action="{{ route('admin.update-ad-employers', ['ad_employer' => $ad_employer->id]) }}"> 11 <form method="POST" action="{{ route('admin.update-ad-employers', ['ad_employer' => $ad_employer->id]) }}">
12 @csrf 12 @csrf
13 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> 13 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
14 <label class="block text-sm"> 14 <label class="block text-sm">
15 <span class="text-gray-700 dark:text-gray-400">Название вакансии</span> 15 <span class="text-gray-700 dark:text-gray-400">Название вакансии</span>
16 <input name="name" id="name" 16 <input name="name" id="name"
17 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 17 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
18 placeholder="Название вакансии" value="{{ old('name') ?? $ad_employer->name ?? '' }}" 18 placeholder="Название вакансии" value="{{ old('name') ?? $ad_employer->name ?? '' }}"
19 /> 19 />
20 @error('name') 20 @error('name')
21 <span class="text-xs text-red-600 dark:text-red-400"> 21 <span class="text-xs text-red-600 dark:text-red-400">
22 {{ $message }} 22 {{ $message }}
23 </span> 23 </span>
24 @enderror 24 @enderror
25 </label> 25 </label>
26 26
27 <label class="block mt-4 text-sm"> 27 <label class="block mt-4 text-sm">
28 <span class="text-gray-700 dark:text-gray-400"> 28 <span class="text-gray-700 dark:text-gray-400">
29 Категории должности 29 Категории должности
30 </span> 30 </span>
31 <select 31 <select
32 class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-multiselect focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray" 32 class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-multiselect focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
33 multiple 33 multiple
34 name="position_work[]" id="position_work" 34 name="position_work[]" id="position_work"
35 > 35 >
36 @foreach($job_titles as $job) 36 @foreach($job_titles as $job)
37 <option value="{{$job->id}}" @if (in_array($job->id, $sel)) selected @endif > 37 <option value="{{$job->id}}" @if (in_array($job->id, $sel)) selected @endif >
38 {{ $job->name }} ({{$job->id}}) 38 {{ $job->name }} ({{$job->id}})
39 </option> 39 </option>
40 @endforeach 40 @endforeach
41 </select> 41 </select>
42 </label><br>
43
44 <label class="block text-sm">
45 <span class="text-gray-700 dark:text-gray-400">Текст-описание вакансии</span>
46 <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor" name="text" placeholder="Описание вакансии (text/html)"
47 rows="10">{{ old('text') ?? $ad_employer->text ?? '' }}</textarea>
48 @error('text')
49 <span class="text-xs text-red-600 dark:text-red-400">
50 {{ $message }}
51 </span>
52 @enderror
42 </label> 53 </label>
43 54
44 <label class="block mt-4 text-sm"> 55 <label class="block mt-4 text-sm">
45 <span class="text-gray-700 dark:text-gray-400"> 56 <span class="text-gray-700 dark:text-gray-400">
46 Статус вакансии 57 Статус вакансии
47 </span> 58 </span>
48 <select 59 <select
49 class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-multiselect focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray" 60 class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-multiselect focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
50 name="status" id="status" 61 name="status" id="status"
51 > 62 >
52 <option value="Не задан" @if ($ad_employer->status == "Не задан") selected @endif > 63 <option value="Не задан" @if ($ad_employer->status == "Не задан") selected @endif >
53 Не задан 64 Не задан
54 </option> 65 </option>
55 <option value="Открыта" @if ($ad_employer->status == "Открыта") selected @endif > 66 <option value="Открыта" @if ($ad_employer->status == "Открыта") selected @endif >
56 Открыта 67 Открыта
57 </option> 68 </option>
58 <option value="Закрыта" @if ($ad_employer->status == "Закрыта") selected @endif > 69 <option value="Закрыта" @if ($ad_employer->status == "Закрыта") selected @endif >
59 Закрыта 70 Закрыта
60 </option> 71 </option>
61 </select> 72 </select>
62 </label><br> 73 </label><br>
63 74
64 <label class="block text-sm"> 75 <label class="block text-sm">
65 <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Срочная вакансия</p> 76 <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Срочная вакансия</p>
66 <input type="hidden" name="sroch_vacancy" value="0" /> 77 <input type="hidden" name="sroch_vacancy" value="0" />
67 <input name="sroch_vacancy" @if ($ad_employer->sroch_vacancy) checked @endif 78 <input name="sroch_vacancy" @if ($ad_employer->sroch_vacancy) checked @endif
68 class="block mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray " 79 class="block mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray "
69 placeholder="" type="checkbox" value="1" 80 placeholder="" type="checkbox" value="1"
70 /><br> 81 /><br>
71 82
72 <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Избранная вакансия</p> 83 <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Избранная вакансия</p>
73 <input type="hidden" name="favorite_vacancy" value="0" /> 84 <input type="hidden" name="favorite_vacancy" value="0" />
74 <input name="favorite_vacancy" id="favorite_vacancy" @if ($ad_employer->favorite_vacancy)checked @endif 85 <input name="favorite_vacancy" id="favorite_vacancy" @if ($ad_employer->favorite_vacancy)checked @endif
75 class="block mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray " 86 class="block mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray "
76 placeholder="" type="checkbox" value="1" 87 placeholder="" type="checkbox" value="1"
77 /><br> 88 /><br>
78 </label> 89 </label>
79 90
80 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> 91 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
81 <div> 92 <div>
82 <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"> 93 <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
83 Сохранить 94 Сохранить
84 </button> 95 </button>
85 <a href="{{ route('admin.ad-employers') }}" 96 <a href="{{ route('admin.ad-employers') }}"
86 class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" 97 class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"
87 style="display: -webkit-inline-box; height: 30px!important;" 98 style="display: -webkit-inline-box; height: 30px!important;"
88 >Назад</a> 99 >Назад</a>
89 </div> 100 </div>
90 </div> 101 </div>
91 </div> 102 </div>
92 </form> 103 </form>
93 @endsection 104 @endsection
94 105
resources/views/admin/ad_employers/index.blade.php
1 @extends('layout.admin', ['title' => 'Админка - Вакансии']) 1 @extends('layout.admin', ['title' => 'Админка - Вакансии'])
2 2
3 @section('script') 3 @section('script')
4 <script> 4 <script>
5 $(document).ready(function() { 5 $(document).ready(function() {
6 $(document).on('click', '#refresh_btn', function () { 6 $(document).on('click', '#refresh_btn', function () {
7 var this_ = $(this); 7 var this_ = $(this);
8 var ajax_block = $('#ajax_block'); 8 var ajax_block = $('#ajax_block');
9 var mas = []; 9 var mas = [];
10 var str_get = ''; 10 var str_get = '';
11 11
12 $('input:checkbox:checked').each(function(){ 12 $('input:checkbox:checked').each(function(){
13 mas.push($(this).val()); 13 mas.push($(this).val());
14 console.log($(this).val()); 14 console.log($(this).val());
15 }); 15 });
16 16
17 $.ajax({ 17 $.ajax({
18 type: "GET", 18 type: "GET",
19 dataType: 'html', 19 dataType: 'html',
20 url: "{{ url()->full()}}", 20 url: "{{ url()->full()}}",
21 data: ({data:mas}), 21 data: ({data:mas}),
22 success: function (data) { 22 success: function (data) {
23 console.log('Обновление таблицы пользователей '); 23 console.log('Обновление таблицы пользователей ');
24 //data = JSON.parse(data); 24 //data = JSON.parse(data);
25 //console.log(data); 25 //console.log(data);
26 ajax_block.html(data); 26 ajax_block.html(data);
27 }, 27 },
28 headers: { 28 headers: {
29 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 29 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
30 }, 30 },
31 error: function (data) { 31 error: function (data) {
32 console.log('Error: ' + data); 32 console.log('Error: ' + data);
33 } 33 }
34 }); 34 });
35 }); 35 });
36 }); 36 });
37 </script> 37 </script>
38 @endsection 38 @endsection
39 39
40 @section('search') 40 @section('search')
41 @include('admin.find_ad_employer', ['select_job' => $select_job]) 41 @include('admin.find_ad_employer', ['select_job' => $select_job])
42 @endsection 42 @endsection
43 43
44 @section('content') 44 @section('content')
45 <div class="grid gap-6 mb-8 md:grid-cols-2 xl:grid-cols-4"> 45 <div class="grid gap-6 mb-8 md:grid-cols-2 xl:grid-cols-4">
46 46
47 <div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800"> 47 <div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800">
48 <div class="p-3 mr-4 text-orange-500 bg-orange-100 rounded-full dark:text-orange-100 dark:bg-orange-500"> 48 <div class="p-3 mr-4 text-orange-500 bg-orange-100 rounded-full dark:text-orange-100 dark:bg-orange-500">
49 <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20"> 49 <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
50 <path 50 <path
51 d="M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3zM6 8a2 2 0 11-4 0 2 2 0 014 0zM16 18v-3a5.972 5.972 0 00-.75-2.906A3.005 3.005 0 0119 15v3h-3zM4.75 12.094A5.973 5.973 0 004 15v3H1v-3a3 3 0 013.75-2.906z"></path> 51 d="M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3zM6 8a2 2 0 11-4 0 2 2 0 014 0zM16 18v-3a5.972 5.972 0 00-.75-2.906A3.005 3.005 0 0119 15v3h-3zM4.75 12.094A5.973 5.973 0 004 15v3H1v-3a3 3 0 013.75-2.906z"></path>
52 </svg> 52 </svg>
53 </div> 53 </div>
54 <div> 54 <div>
55 <p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400"> 55 <p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">
56 Всего вакансий 56 Всего вакансий
57 </p> 57 </p>
58 <p class="text-lg font-semibold text-gray-700 dark:text-gray-200"> 58 <p class="text-lg font-semibold text-gray-700 dark:text-gray-200">
59 {{ $all_ad }} 59 {{ $all_ad }}
60 </p> 60 </p>
61 </div> 61 </div>
62 </div> 62 </div>
63 </div> 63 </div>
64 64
65 <button style="margin-bottom: 10px; width:165px" id="refresh_btn" name="refresh_btn" 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"> 65 <div>
66 Обновить вакансии 66 <button style="margin-bottom: 10px; width:165px; display: inline-block;" id="refresh_btn" name="refresh_btn" 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">
67 </button> 67 Обновить вакансии
68 </button>
69 <a href="{{ route('admin.add-ad-employers') }}" style="margin-bottom: 10px; width:310px; display: inline-block;" 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">
70 Добавить вакансии от администратора
71 </a>
72 </div>
68 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> 73 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
69 <div class="w-full overflow-x-auto"> 74 <div class="w-full overflow-x-auto">
70 <table class="w-full whitespace-no-wrap"> 75 <table class="w-full whitespace-no-wrap">
71 <thead> 76 <thead>
72 <tr 77 <tr
73 class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800" 78 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"
74 > 79 >
75 <th class="px-4 py-3"></th> 80 <th class="px-4 py-3"></th>
76 <th class="px-4 py-3 class1">№</th> 81 <th class="px-4 py-3 class1">№</th>
77 <th class="px-4 py-3 class2">Лого/Заголовок/Компания</th> 82 <th class="px-4 py-3 class2">Лого/Заголовок/Компания</th>
78 <th class="px-4 py-3 class4">Должности</th> 83 <th class="px-4 py-3 class4">Должности</th>
79 <th class="px-4 py-3 class5">Избр.</th> 84 <th class="px-4 py-3 class5">Избр.</th>
80 <th class="px-4 py-3 class6">Сроч.</th> 85 <th class="px-4 py-3 class6">Сроч.</th>
81 <th class="px-4 py-3 class7">Статус</th> 86 <th class="px-4 py-3 class7">Статус</th>
82 <th class="px-4 py-3 class8">Дата создан/изменен.</th> 87 <th class="px-4 py-3 class8">Дата создан/изменен.</th>
83 <th class="px-4 py-3 class10">Изменить</th> 88 <th class="px-4 py-3 class10">Изменить</th>
84 </tr> 89 </tr>
85 </thead> 90 </thead>
86 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> 91 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
87 @foreach($ad_employers as $ad) 92 @foreach($ad_employers as $ad)
88 <tr class="text-gray-700 dark:text-gray-400"> 93 <tr class="text-gray-700 dark:text-gray-400">
89 <td class="px-4 py-3 class1"> 94 <td class="px-4 py-3 class1">
90 <input type="checkbox" class="box" name="vacan_{{$ad->id}}" id="vacan_{{$ad->id}}" value="{{$ad->id}}"/> 95 <input type="checkbox" class="box" name="vacan_{{$ad->id}}" id="vacan_{{$ad->id}}" value="{{$ad->id}}"/>
91 </td> 96 </td>
92 <td class="px-4 py-3 class1"> 97 <td class="px-4 py-3 class1">
93 {{$ad->id}} 98 {{$ad->id}}
94 </td> 99 </td>
95 <td class="px-4 py-3 class2"> 100 <td class="px-4 py-3 class2">
96 <div class="flex items-center text-sm"> 101 <div class="flex items-center text-sm">
97 <div 102 <div
98 class="relative hidden w-8 h-8 mr-3 rounded-full md:block" 103 class="relative hidden w-8 h-8 mr-3 rounded-full md:block"
99 > 104 >
100 @if (isset($ad->employer->logo)) 105 @if (isset($ad->employer->logo))
101 <img 106 <img
102 class="object-cover w-full h-full rounded-full" 107 class="object-cover w-full h-full rounded-full"
103 src="{{ asset(Storage::url($ad->employer->logo)) }}" 108 src="{{ asset(Storage::url($ad->employer->logo)) }}"
104 alt="" 109 alt=""
105 loading="lazy" 110 loading="lazy"
106 /> 111 />
107 @endif 112 @endif
108 <div 113 <div
109 class="absolute inset-0 rounded-full shadow-inner" 114 class="absolute inset-0 rounded-full shadow-inner"
110 aria-hidden="true" 115 aria-hidden="true"
111 ></div> 116 ></div>
112 </div> 117 </div>
113 <div> 118 <div>
114 <p class="font-semibold">{{$ad->name}}</p> 119 <p class="font-semibold">{{$ad->name}}</p>
115 <p class="text-xs text-gray-600 dark:text-gray-400"> 120 <p class="text-xs text-gray-600 dark:text-gray-400">
116 {{$ad->employer->name_company}} 121 {{$ad->employer->name_company}}
117 </p> 122 </p>
118 </div> 123 </div>
119 </div> 124 </div>
120 </td> 125 </td>
121 126
122 <td class="px-4 py-3 class4"> 127 <td class="px-4 py-3 class4">
123 <div class="flex items-center text-sm"> 128 <div class="flex items-center text-sm">
124 @if ($ad->jobs->count()) 129 @if ($ad->jobs->count())
125 <div> 130 <div>
126 <?php $i = 0;?> 131 <?php $i = 0;?>
127 @foreach ($ad->jobs as $title) 132 @foreach ($ad->jobs as $title)
128 <?php if ($i==0) {?> 133 <?php if ($i==0) {?>
129 <p class="font-semibold">{{$title->name}}</p> 134 <p class="font-semibold">{{$title->name}}</p>
130 <?php } else {?> 135 <?php } else {?>
131 <p class="font-semibold">/ {{$title->name}}</p> 136 <p class="font-semibold">/ {{$title->name}}</p>
132 <?php } 137 <?php }
133 $i++; 138 $i++;
134 ?> 139 ?>
135 @endforeach 140 @endforeach
136 </div> 141 </div>
137 @endif 142 @endif
138 </div> 143 </div>
139 144
140 </td> 145 </td>
141 146
142 <td class="px-4 py-3 text-sm class5"> 147 <td class="px-4 py-3 text-sm class5">
143 @if ($ad->favorite_vacancy==1) 148 @if ($ad->favorite_vacancy==1)
144 <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"> 149 <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">
145 Да 150 Да
146 </span> 151 </span>
147 @else 152 @else
148 <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"> 153 <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">
149 Нет 154 Нет
150 </span> 155 </span>
151 @endif 156 @endif
152 </td> 157 </td>
153 158
154 <td class="px-4 py-3 text-sm class6"> 159 <td class="px-4 py-3 text-sm class6">
155 @if ($ad->sroch_vacancy==1) 160 @if ($ad->sroch_vacancy==1)
156 <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"> 161 <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">
157 Да 162 Да
158 </span> 163 </span>
159 @else 164 @else
160 <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"> 165 <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">
161 Нет 166 Нет
162 </span> 167 </span>
163 @endif 168 @endif
164 </td> 169 </td>
165 170
166 <td class="px-4 py-3 text-sm class7"> 171 <td class="px-4 py-3 text-sm class7">
167 {{ $ad->status }} 172 {{ $ad->status }}
168 </td> 173 </td>
169 174
170 <td class="px-4 py-3 text-sm class8"> 175 <td class="px-4 py-3 text-sm class8">
171 <div class="flex items-center text-sm"> 176 <div class="flex items-center text-sm">
172 <div> 177 <div>
173 <p class="font-semibold">{{ date('d.m.Y', strtotime($ad->created_at)) }}</p> 178 <p class="font-semibold">{{ date('d.m.Y', strtotime($ad->created_at)) }}</p>
174 <p class="text-xs text-gray-600 dark:text-gray-400"> 179 <p class="text-xs text-gray-600 dark:text-gray-400">
175 {{ date('d.m.Y', strtotime($ad->updated_at)) }} 180 {{ date('d.m.Y', strtotime($ad->updated_at)) }}
176 </p> 181 </p>
177 </div> 182 </div>
178 </div> 183 </div>
179 184
180 </td> 185 </td>
181 186
182 <td class="px-4 py-3 text-sm class10"> 187 <td class="px-4 py-3 text-sm class10">
183 <a href="{{ route('admin.edit-ad-employers', ['ad_employer' => $ad->id]) }}"> 188 <form action="{{ route('admin.delete-ad-employer', ['ad_employer' => $ad->id]) }}" method="POST">
184 Изменить 189 <a href="{{ route('admin.edit-ad-employers', ['ad_employer' => $ad->id]) }}">Изменить</a> |
185 </a> 190 @csrf
191 @method('DELETE')
192 <input class="btn btn-danger" type="submit" value="Удалить"/>
193 </form>
186 </td> 194 </td>
187 </tr> 195 </tr>
188 @endforeach 196 @endforeach
189 </tbody> 197 </tbody>
190 </table> 198 </table>
191 </div> 199 </div>
192 200
193 <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"> 201 <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">
194 {{ $ad_employers->appends($_GET)->links('admin.pagginate') }} 202 {{ $ad_employers->appends($_GET)->links('admin.pagginate') }}
195 </div> 203 </div>
196 </div> 204 </div>
197 @endsection 205 @endsection
198 206
resources/views/admin/education/edit.blade.php
1 @extends('layout.admin', ['title' => 'Админка - Редактирование образования']) 1 @extends('layout.admin', ['title' => 'Админка - Редактирование образования'])
2 2
3 @section('content') 3 @section('content')
4 <form method="POST" action="{{ route('admin.education.update', ['education' => $education->id]) }}" enctype="multipart/form-data"> 4 @include('admin.education.form')
5 @include('admin.education.form')
6 </form>
7 @endsection 5 @endsection
8 6
resources/views/admin/education/form.blade.php
1 @csrf 1 @csrf
2 2
3 @isset($education) 3 @isset($education)
4 @method('PUT') 4 @method('PUT')
5 @endisset 5 @endisset
6 6
7 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> 7 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
8 <form method="POST" action="{{ route('admin.education.update', ['education' => $education->id]) }}" enctype="multipart/form-data">
8 <label class="block text-sm"> 9 <label class="block text-sm">
9 <span class="text-gray-700 dark:text-gray-400">Название учебного заведения</span> 10 <span class="text-gray-700 dark:text-gray-400">Название учебного заведения</span>
10 <input name="name" id="name" 11 <input name="name" id="name"
11 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 12 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
12 placeholder="Название учебного заведения" value="{{ old('name') ?? $education->name ?? '' }}" 13 placeholder="Название учебного заведения" value="{{ old('name') ?? $education->name ?? '' }}"
13 /> 14 />
14 @error('name') 15 @error('name')
15 <span class="text-xs text-red-600 dark:text-red-400"> 16 <span class="text-xs text-red-600 dark:text-red-400">
16 {{ $message }} 17 {{ $message }}
17 </span> 18 </span>
18 @enderror 19 @enderror
19 </label><br> 20 </label><br>
20 21
21 <label class="block text-sm"> 22 <label class="block text-sm">
22 <span class="text-gray-700 dark:text-gray-400">Адрес</span> 23 <span class="text-gray-700 dark:text-gray-400">Адрес</span>
23 <input name="address" id="address" 24 <input name="address" id="address"
24 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" 25 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"
25 placeholder="Адрес" value="{{ old('address') ?? $education->address ?? '' }}" 26 placeholder="Адрес" value="{{ old('address') ?? $education->address ?? '' }}"
26 /> 27 />
27 @error('address') 28 @error('address')
28 <span class="text-xs text-red-600 dark:text-red-400"> 29 <span class="text-xs text-red-600 dark:text-red-400">
29 {{ $message }} 30 {{ $message }}
30 </span> 31 </span>
31 @enderror 32 @enderror
32 </label><br> 33 </label><br>
33 34
34 <label class="block text-sm"> 35 <label class="block text-sm">
35 <span class="text-gray-700 dark:text-gray-400">Email</span> 36 <span class="text-gray-700 dark:text-gray-400">Email</span>
36 <input name="email" id="email" 37 <input name="email" id="email"
37 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" 38 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"
38 placeholder="Email" value="{{ old('email') ?? $education->email ?? '' }}" 39 placeholder="Email" value="{{ old('email') ?? $education->email ?? '' }}"
39 /> 40 />
40 @error('email') 41 @error('email')
41 <span class="text-xs text-red-600 dark:text-red-400"> 42 <span class="text-xs text-red-600 dark:text-red-400">
42 {{ $message }} 43 {{ $message }}
43 </span> 44 </span>
44 @enderror 45 @enderror
45 </label><br> 46 </label><br>
46 47
47 <label class="block text-sm"> 48 <label class="block text-sm">
48 <span class="text-gray-700 dark:text-gray-400">Телефон</span> 49 <span class="text-gray-700 dark:text-gray-400">Телефон</span>
49 <input name="telephone" id="telephone" 50 <input name="telephone" id="telephone"
50 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" 51 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"
51 placeholder="Телефон" value="{{ old('telephone') ?? $education->telephone ?? '' }}" 52 placeholder="Телефон" value="{{ old('telephone') ?? $education->telephone ?? '' }}"
52 /> 53 />
53 @error('telephone') 54 @error('telephone')
54 <span class="text-xs text-red-600 dark:text-red-400"> 55 <span class="text-xs text-red-600 dark:text-red-400">
55 {{ $message }} 56 {{ $message }}
56 </span> 57 </span>
57 @enderror 58 @enderror
58 </label><br> 59 </label><br>
59 60
60 <label class="block text-sm"> 61 <label class="block text-sm">
61 <span class="text-gray-700 dark:text-gray-400">Текст</span> 62 <span class="text-gray-700 dark:text-gray-400">Текст</span>
62 <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor" name="text" placeholder="Текст (html)" required 63 <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor_" name="text" placeholder="Текст (html)" required
63 rows="10">{{ old('text') ?? $education->text ?? '' }}</textarea> 64 rows="10">{{ old('text') ?? $education->text ?? '' }}</textarea>
64 @error('text') 65 @error('text')
65 <span class="text-xs text-red-600 dark:text-red-400"> 66 <span class="text-xs text-red-600 dark:text-red-400">
66 {{ $message }} 67 {{ $message }}
67 </span> 68 </span>
68 @enderror 69 @enderror
69 </label><br> 70 </label><br>
70 71
71 <label class="block text-sm"> 72 <label class="block text-sm">
72 <span class="text-gray-700 dark:text-gray-400">Картинка</span> 73 <span class="text-gray-700 dark:text-gray-400">Картинка</span>
73 <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 74 <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700
74 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple 75 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple
75 dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 76 dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
76 id="image" name="image" accept="image/png, image/jpeg"> 77 id="image" name="image" accept="image/png, image/jpeg">
77 @error('image') 78 @error('image')
78 <span class="text-xs text-red-600 dark:text-red-400"> 79 <span class="text-xs text-red-600 dark:text-red-400">
79 {{ $message }} 80 {{ $message }}
80 </span> 81 </span>
81 @enderror 82 @enderror
82 @isset($education->image) 83 @isset($education->image)
83 <img src="{{asset(Storage::url($education->image))}}" width="100px"/> 84 <img src="{{asset(Storage::url($education->image))}}" width="100px"/>
84 @endisset 85 @endisset
85 </label><br> 86 </label><br>
86 87
87
88 @isset($education)
89 <div class="tabs">
90 <input type="radio" name="tab-btn" id="tab-btn-1" value="" checked>
91 <label for="tab-btn-1">Высшее образование</label>
92 <input type="radio" name="tab-btn" id="tab-btn-2" value="">
93 <label for="tab-btn-2">Средне-профессиональное образование</label>
94 <input type="radio" name="tab-btn" id="tab-btn-3" value="">
95 <label for="tab-btn-3">Дополнительное образование</label>
96 <div id="content-1">
97 <a id="add1" 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 href="{{ route('admin.add-program-education', ['education' => $education->id, 'level' => 1]) }}"
99 >Добавить специализацию</a><br>
100 @if ((isset($program1)) && ($program1->count()))
101 @foreach ($program1 as $prog1)
102 <hr>
103 <label class="block text-sm">
104 <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">Специальность: {{$prog1->name}}</h4>
105 <span class="text-gray-700 dark:text-gray-400">Описание: {{$prog1->text}}</span>
106 </label><br>
107 @endforeach
108 @else
109 <span class="text-gray-700 dark:text-gray-400">Нет записей</span>
110 @endif
111 </div>
112 <div id="content-2">
113 <a id="add2" 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"
114 href="{{ route('admin.add-program-education', ['education' => $education->id, 'level' => 2]) }}"
115 >Добавить специализацию</a><br>
116 @if ((isset($program2)) && ($program2->count()))
117 @foreach ($program2 as $prog2)
118 <hr>
119 <label class="block text-sm">
120 <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">Специальность: {{$prog2->name}}</h4>
121 <span class="text-gray-700 dark:text-gray-400">Описание: {{$prog2->text}}</span>
122 </label><br>
123 @endforeach
124 @else
125 <span class="text-gray-700 dark:text-gray-400">Нет записей</span>
126 @endif
127 </div>
128 <div id="content-3">
129 <a id="add3" 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"
130 href="{{ route('admin.add-program-education', ['education' => $education->id, 'level' => 3]) }}"
131 >Добавить специализацию</a><br>
132 @if ((isset($program3)) && ($program3->count()))
133 @foreach ($program3 as $prog3)
134 <hr>
135 <label class="block text-sm">
136 <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">Специальность: {{$prog3->name}}</h4>
137 <span class="text-gray-700 dark:text-gray-400">Описание: {{$prog3->text}}</span>
138 </label><br>
139 @endforeach
140 @else
141 <span class="text-gray-700 dark:text-gray-400">Нет записей</span>
142 @endif
143 </div>
144 </div><br>
145 @endisset
146
147 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> 88 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
148 <div> 89 <div>
149 <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"> 90 <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">
150 Сохранить 91 Сохранить
151 </button> 92 </button>
152 <a href="{{ route('admin.education.index') }}" 93 <a href="{{ route('admin.education.index') }}"
153 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" 94 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"
154 style="display: -webkit-inline-box; height: 30px!important;" 95 style="display: -webkit-inline-box; height: 30px!important;"
155 >Назад</a> 96 >Назад</a>
156 </div> 97 </div>
157 </div> 98 </div>
99 </form>
100
101 @isset($education)
102 <hr>
103 <form method="GET" action="{{ route('admin.add-program-education') }}">
104 <label class="block text-sm">
105 <span class="text-gray-700 dark:text-gray-400">Категория образования</span>
106 <input type="hidden" name="id" value="{{ $education->id }}"/>
107 <input name="level" id="level"
108 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"
109 placeholder="Новое образование" value=""
resources/views/admin/employer/index.blade.php
1 @extends('layout.admin', ['title' => 'Админка - Работодатели']) 1 @extends('layout.admin', ['title' => 'Админка - Работодатели'])
2 2
3 @section('script') 3 @section('script')
4 <script> 4 <script>
5 $(document).ready(function() { 5 $(document).ready(function() {
6 $(document).on('click', '.checkban', function () { 6 $(document).on('click', '.checkban', function () {
7 var this_ = $(this); 7 var this_ = $(this);
8 var value = this_.val(); 8 var value = this_.val();
9 var ajax_block = $('#ajax_block'); 9 var ajax_block = $('#ajax_block');
10 var bool = 0; 10 var bool = 0;
11 11
12 if(this.checked){ 12 if(this.checked){
13 bool = 1; 13 bool = 1;
14 } else { 14 } else {
15 bool = 0; 15 bool = 0;
16 } 16 }
17 17
18 $.ajax({ 18 $.ajax({
19 type: "GET", 19 type: "GET",
20 url: "{{ url()->full()}}", 20 url: "{{ url()->full()}}",
21 data: "id=" + value + "&is_ban=" + bool, 21 data: "id=" + value + "&is_ban=" + bool,
22 success: function (data) { 22 success: function (data) {
23 console.log('Обновление таблицы пользователей '); 23 console.log('Обновление таблицы пользователей ');
24 //data = JSON.parse(data); 24 //data = JSON.parse(data);
25 //console.log(data); 25 //console.log(data);
26 ajax_block.html(data); 26 ajax_block.html(data);
27 }, 27 },
28 headers: { 28 headers: {
29 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 29 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
30 }, 30 },
31 error: function (data) { 31 error: function (data) {
32 console.log('Error: ' + data); 32 console.log('Error: ' + data);
33 } 33 }
34 }); 34 });
35 }); 35 });
36 36
37 }); 37 });
38 </script> 38 </script>
39 <script> 39 <script>
40 const btns = document.querySelectorAll('.btn_del'); 40 const btns = document.querySelectorAll('.btn_del');
41 btns.forEach(btn => { 41 btns.forEach(btn => {
42 btn.addEventListener('click', (e) => { 42 btn.addEventListener('click', (e) => {
43 console.log('click button'); 43 console.log('click button');
44 let id = e.target.id; 44 let id = e.target.id;
45 let form = document.getElementById("form_modal_del"); 45 let form = document.getElementById("form_modal_del");
46 form.action = "<?=$_SERVER['APP_URL']?>admin/employers/delete/"+e.target.getAttribute('data-employer')+'/'+e.target.getAttribute('data-user'); 46 form.action = "<?=$_SERVER['APP_URL']?>public/admin/employers/delete/"+e.target.getAttribute('data-employer')+'/'+e.target.getAttribute('data-user');
47 //document.getElementById("title_modal").innerHTML = id; 47 //document.getElementById("title_modal").innerHTML = id;
48 console.log(e.target.getAttribute('data-employer')); 48 console.log(e.target.getAttribute('data-employer'));
49 console.log(e.target.getAttribute('data-user')); 49 console.log(e.target.getAttribute('data-user'));
50 50
51 }); 51 });
52 }); 52 });
53 </script> 53 </script>
54 @endsection 54 @endsection
55 55
56 @section('search') 56 @section('search')
57 @include('admin.find_employer', ['select_category' => $select_category]) 57 @include('admin.find_employer', ['select_category' => $select_category])
58 @endsection 58 @endsection
59 59
60 @section('modal') 60 @section('modal')
61 @include('admin.employer.modal') 61 @include('admin.employer.modal')
62 @endsection 62 @endsection
63 63
64 @section('content') 64 @section('content')
65 <div class="grid gap-6 mb-8 md:grid-cols-2 xl:grid-cols-4"> 65 <div class="grid gap-6 mb-8 md:grid-cols-2 xl:grid-cols-4">
66 66
67 <div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800"> 67 <div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800">
68 <div class="p-3 mr-4 text-orange-500 bg-orange-100 rounded-full dark:text-orange-100 dark:bg-orange-500"> 68 <div class="p-3 mr-4 text-orange-500 bg-orange-100 rounded-full dark:text-orange-100 dark:bg-orange-500">
69 <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20"> 69 <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
70 <path 70 <path
71 d="M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3zM6 8a2 2 0 11-4 0 2 2 0 014 0zM16 18v-3a5.972 5.972 0 00-.75-2.906A3.005 3.005 0 0119 15v3h-3zM4.75 12.094A5.973 5.973 0 004 15v3H1v-3a3 3 0 013.75-2.906z"></path> 71 d="M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3zM6 8a2 2 0 11-4 0 2 2 0 014 0zM16 18v-3a5.972 5.972 0 00-.75-2.906A3.005 3.005 0 0119 15v3h-3zM4.75 12.094A5.973 5.973 0 004 15v3H1v-3a3 3 0 013.75-2.906z"></path>
72 </svg> 72 </svg>
73 </div> 73 </div>
74 <div> 74 <div>
75 <p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400"> 75 <p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">
76 Всего работодателей 76 Всего работодателей
77 </p> 77 </p>
78 <p class="text-lg font-semibold text-gray-700 dark:text-gray-200"> 78 <p class="text-lg font-semibold text-gray-700 dark:text-gray-200">
79 {{ $all_employer }} 79 {{ $all_employer }}
80 </p> 80 </p>
81 </div> 81 </div>
82 </div> 82 </div>
83 </div> 83 </div>
84 84
85 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> 85 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
86 <div class="w-full overflow-x-auto"> 86 <div class="w-full overflow-x-auto">
87 <table class="w-full whitespace-no-wrap"> 87 <table class="w-full whitespace-no-wrap">
88 <thead> 88 <thead>
89 <tr 89 <tr
90 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" 90 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"
91 > 91 >
92 <th class="px-4 py-3">№</th> 92 <th class="px-4 py-3">№</th>
93 <th class="px-4 py-3">Лого</th> 93 <th class="px-4 py-3">Лого</th>
94 <th class="px-4 py-3">Название компании/Email/Тел/Пароль</th> 94 <th class="px-4 py-3">Название компании/Email/Тел/Пароль</th>
95 <th class="px-4 py-3">Категория</th> 95 <th class="px-4 py-3">Категория</th>
96 <th class="px-4 py-3">Комментарий</th> 96 <th class="px-4 py-3">Комментарий</th>
97 <th class="px-4 py-3">Дата регистрации</th> 97 <th class="px-4 py-3">Дата регистрации</th>
98 <th class="px-4 py-3">Редакт.</th> 98 <th class="px-4 py-3">Редакт.</th>
99 </tr> 99 </tr>
100 </thead> 100 </thead>
101 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> 101 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
102 @foreach($users as $user) 102 @foreach($users as $user)
103 <tr class="text-gray-700 dark:text-gray-400"> 103 <tr class="text-gray-700 dark:text-gray-400">
104 <td class="px-4 py-3"> 104 <td class="px-4 py-3">
105 {{$user->id}} 105 {{$user->id}}
106 </td> 106 </td>
107 <td class="px-4 py-3"> 107 <td class="px-4 py-3">
108 @if (isset($user->emp_logo) && ($user->emp_logo)) 108 @if (isset($user->emp_logo) && ($user->emp_logo))
109 <div class="flex items-center text-sm"> 109 <div class="flex items-center text-sm">
110 <div 110 <div
111 class="relative hidden w-8 h-8 mr-3 rounded-full md:block" 111 class="relative hidden w-8 h-8 mr-3 rounded-full md:block"
112 > 112 >
113 <img 113 <img
114 class="object-cover w-full h-full rounded-full" 114 class="object-cover w-full h-full rounded-full"
115 src="{{ asset(Storage::url($user->emp_logo)) }}" 115 src="{{ asset(Storage::url($user->emp_logo)) }}"
116 alt="" 116 alt=""
117 loading="lazy" 117 loading="lazy"
118 /> 118 />
119 <div 119 <div
120 class="absolute inset-0 rounded-full shadow-inner" 120 class="absolute inset-0 rounded-full shadow-inner"
121 aria-hidden="true" 121 aria-hidden="true"
122 ></div> 122 ></div>
123 </div> 123 </div>
124 </div> 124 </div>
125 @else 125 @else
126 - 126 -
127 @endif 127 @endif
128 </td> 128 </td>
129 129
130 <td class="px-4 py-3"> 130 <td class="px-4 py-3">
131 <div class="flex items-center text-sm"> 131 <div class="flex items-center text-sm">
132 <div> 132 <div>
133 <p class="font-semibold">{{$user->name}}</p> 133 <p class="font-semibold">{{$user->name}}</p>
134 <p class="font-semibold">{{ empty($user->employers->email) ? $user->email : $user->employers->email }}</p> 134 <p class="font-semibold">{{ empty($user->employers->email) ? $user->email : $user->employers->email }}</p>
135 <p class="text-xs text-gray-600 dark:text-gray-400"> 135 <p class="text-xs text-gray-600 dark:text-gray-400">
136 {{ empty($user->employers->telephone) ? $user->telephone : $user->employers->telephone }} 136 {{ empty($user->employers->telephone) ? $user->telephone : $user->employers->telephone }}
137 </p> 137 </p>
138 <p class="text-xs text-gray-600 dark:text-gray-400"> 138 <p class="text-xs text-gray-600 dark:text-gray-400">
139 @if (!empty($user->pubpassword)) 139 @if (!empty($user->pubpassword))
140 {{ base64_decode($user->pubpassword) }} 140 {{ base64_decode($user->pubpassword) }}
141 @endif 141 @endif
142 </p> 142 </p>
143 </div> 143 </div>
144 </div> 144 </div>
145 145
146 </td> 146 </td>
147 <td class="px-4 py-3 text-sm"> 147 <td class="px-4 py-3 text-sm">
148 {{ $user->category }} 148 {{ $user->category }}
149 </td> 149 </td>
150 <td class="px-4 py-3 text-sm"> 150 <td class="px-4 py-3 text-sm">
151 @if (!empty($user->comment_admin)) 151 @if (!empty($user->comment_admin))
152 152
153 <a style="text-decoration: underline;" href="{{ route('admin.comment-employer', ['employer' => $user->emp_id]) }}">Есть</a> 153 <a style="text-decoration: underline;" href="{{ route('admin.comment-employer', ['employer' => $user->emp_id]) }}">Есть</a>
154 @else 154 @else
155 Нет 155 Нет
156 @endif 156 @endif
157 </td> 157 </td>
158 <td class="px-4 py-3 text-sm"> 158 <td class="px-4 py-3 text-sm">
159 {{ date('d.m.Y', strtotime($user->created_at)) }} 159 {{ date('d.m.Y', strtotime($user->created_at)) }}
160 </td> 160 </td>
161 <td class="px-4 py-3 text-sm"> 161 <td class="px-4 py-3 text-sm">
162 @if (!empty($user->emp_id)) 162 @if (!empty($user->emp_id))
163 <a href="{{ route('admin.employer-profile', ['employer' => $user->emp_id]) }}">Изменить</a> | 163 <a href="{{ route('admin.employer-profile', ['employer' => $user->emp_id]) }}">Изменить</a>
164 <a @click="openModal" style="cursor: pointer;" data-employer="{{$user->emp_id}}" data-user="{{$user->user_id}}" class="btn_del btn btn-danger">Удалить</a> 164 @if ($user->emp_id > 2) | <a @click="openModal" style="cursor: pointer;" data-employer="{{$user->emp_id}}" data-user="{{$user->user_id}}" class="btn_del btn btn-danger">Удалить</a>
165 @endif
165 @endif 166 @endif
166 </td> 167 </td>
167 <!--<td class="px-4 py-3 text-sm"> 168 <!--<td class="px-4 py-3 text-sm">
168 @if ($user->usr_id > 1) 169 @if ($user->usr_id > 1)
169 <input type="checkbox" class="checkban" value="{{$user->usr_id}}" name="ban_{{$user->usr_id}}" {{ ($user->is_ban) ? "checked" : "" }}/> 170 <input type="checkbox" class="checkban" value="{{$user->usr_id}}" name="ban_{{$user->usr_id}}" {{ ($user->is_ban) ? "checked" : "" }}/>
170 @endif 171 @endif
171 </td>--> 172 </td>-->
172 </tr> 173 </tr>
173 @endforeach 174 @endforeach
174 </tbody> 175 </tbody>
175 </table> 176 </table>
176 </div> 177 </div>
177 178
178 <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"> 179 <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">
179 <?=$users->appends($_GET)->links('admin.pagginate'); ?> 180 <?=$users->appends($_GET)->links('admin.pagginate'); ?>
180 </div> 181 </div>
181 </div> 182 </div>
182 @endsection 183 @endsection
183 184
resources/views/admin/register.blade.php
1 @extends('layout.authorize', ['title' => 'Регистрация в административной панели']) 1 @extends('layout.authorize', ['title' => 'Регистрация в административной панели'])
2 2
3 @section('image') 3 @section('image')
4 <img 4 <img
5 aria-hidden="true" 5 aria-hidden="true"
6 class="object-cover w-full h-full dark:hidden" 6 class="object-cover w-full h-full dark:hidden"
7 src="{{ asset('assets/img/create-account-office.jpeg') }}" 7 src="{{ asset('assets/img/create-account-office.jpeg') }}"
8 alt="Office" 8 alt="Office"
9 /> 9 />
10 <img 10 <img
11 aria-hidden="true" 11 aria-hidden="true"
12 class="hidden object-cover w-full h-full dark:block" 12 class="hidden object-cover w-full h-full dark:block"
13 src="{{ asset('assets/img/create-account-office-dark.jpeg') }}" 13 src="{{ asset('assets/img/create-account-office-dark.jpeg') }}"
14 alt="Office" 14 alt="Office"
15 /> 15 />
16 @endsection 16 @endsection
17 17
18 @section('content') 18 @section('content')
19 <h1 19 <h1
20 class="mb-4 text-xl font-semibold text-gray-700 dark:text-gray-200" 20 class="mb-4 text-xl font-semibold text-gray-700 dark:text-gray-200"
21 > 21 >
22 Создание аккаунта администратора 22 Создание аккаунта администратора
23 </h1> 23 </h1>
24 <form method="POST" action="{{ route('admin.create') }}"> 24 <form method="POST" action="{{ route('admin.create') }}">
25 @csrf 25 @csrf
26
27 <input type="hidden" id="code_emp" name="code_emp"
28 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"
29 placeholder="" value="{{ $code_emp }}"
30 />
31
26 <label class="block text-sm"> 32 <label class="block text-sm">
27 <span class="text-gray-700 dark:text-gray-400">Имя</span> 33 <span class="text-gray-700 dark:text-gray-400">Имя</span>
28 <input id="name" name="name" 34 <input id="name" name="name"
29 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" 35 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
30 placeholder="Введите имя" value="{{ old('name') }}" 36 placeholder="Введите имя" value="{{ old('name') }}"
31 /> 37 />
32 @error('name') 38 @error('name')
33 <span class="invalid-feedback" role="alert"> 39 <span class="invalid-feedback" role="alert">
34 <strong>{{ $message }}</strong> 40 <strong>{{ $message }}</strong>
35 </span> 41 </span>
36 @enderror 42 @enderror
37 </label> 43 </label>
38 44
39 <label class="block text-sm"> 45 <label class="block text-sm">
40 <span class="text-gray-700 dark:text-gray-400">Email</span> 46 <span class="text-gray-700 dark:text-gray-400">Email</span>
41 <input id="email" name="email" type="email" 47 <input id="email" name="email" type="email"
42 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 48 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
43 placeholder="Введите email" value="{{ old('email') }}" autocomplete="email" 49 placeholder="Введите email" value="{{ old('email') }}" autocomplete="email"
44 /> 50 />
45 @error('email') 51 @error('email')
46 <span class="invalid-feedback" role="alert"> 52 <span class="invalid-feedback" role="alert">
47 <strong>{{ $message }}</strong> 53 <strong>{{ $message }}</strong>
48 </span> 54 </span>
49 @enderror 55 @enderror
50 </label> 56 </label>
51 57
52 <label class="block mt-4 text-sm"> 58 <label class="block mt-4 text-sm">
53 <span class="text-gray-700 dark:text-gray-400">Пароль</span> 59 <span class="text-gray-700 dark:text-gray-400">Пароль</span>
54 <input id="password" name="password" 60 <input id="password" name="password"
55 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" 61 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"
56 placeholder="Пароль" 62 placeholder="Пароль"
57 type="password" 63 type="password"
58 /> 64 />
59 @error('password') 65 @error('password')
60 <span class="invalid-feedback" role="alert"> 66 <span class="invalid-feedback" role="alert">
61 <strong>{{ $message }}</strong> 67 <strong>{{ $message }}</strong>
62 </span> 68 </span>
63 @enderror 69 @enderror
64 </label> 70 </label>
65 71
66 <label class="block mt-4 text-sm"> 72 <label class="block mt-4 text-sm">
67 <span class="text-gray-700 dark:text-gray-400"> 73 <span class="text-gray-700 dark:text-gray-400">
68 Подтверждение пароля 74 Подтверждение пароля
69 </span> 75 </span>
70 <input id="password-confirm" name="password_confirmation" 76 <input id="password-confirm" name="password_confirmation"
71 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" 77 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"
72 placeholder="Подтверждение пароля" 78 placeholder="Подтверждение пароля"
73 type="password" 79 type="password"
74 /> 80 />
75 </label> 81 </label>
76 82
77 <div class="flex mt-6 text-sm"> 83 <div class="flex mt-6 text-sm">
78 <label class="flex items-center dark:text-gray-400"> 84 <label class="flex items-center dark:text-gray-400">
79 <input 85 <input
80 type="checkbox" 86 type="checkbox"
81 class="text-purple-600 form-checkbox focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray" 87 class="text-purple-600 form-checkbox focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
82 /> 88 />
83 <span class="ml-2"> 89 <span class="ml-2">
84 Я принимаю условия 90 Я принимаю условия
85 <span class="underline">политики безопасности</span> 91 <span class="underline">политики безопасности</span>
86 </span> 92 </span>
87 </label> 93 </label>
88 </div> 94 </div>
89 95
90 <!-- You should use a button here, as the anchor is only used for the example --> 96 <!-- You should use a button here, as the anchor is only used for the example -->
91 <button 97 <button
92 class="block w-full px-4 py-2 mt-4 text-sm font-medium leading-5 text-center text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-lg active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" 98 class="block w-full px-4 py-2 mt-4 text-sm font-medium leading-5 text-center text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-lg active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"
93 type="submit" 99 type="submit"
94 > 100 >
95 Создать пользователя 101 Создать пользователя
96 </button> 102 </button>
97 </form> 103 </form>
98 <hr class="my-8" /> 104 <hr class="my-8" />
99 105
100 <!--<button 106 <!--<button
101 class="flex items-center justify-center w-full px-4 py-2 text-sm font-medium leading-5 text-white text-gray-700 transition-colors duration-150 border border-gray-300 rounded-lg dark:text-gray-400 active:bg-transparent hover:border-gray-500 focus:border-gray-500 active:text-gray-500 focus:outline-none focus:shadow-outline-gray" 107 class="flex items-center justify-center w-full px-4 py-2 text-sm font-medium leading-5 text-white text-gray-700 transition-colors duration-150 border border-gray-300 rounded-lg dark:text-gray-400 active:bg-transparent hover:border-gray-500 focus:border-gray-500 active:text-gray-500 focus:outline-none focus:shadow-outline-gray"
102 > 108 >
103 <svg 109 <svg
104 class="w-4 h-4 mr-2" 110 class="w-4 h-4 mr-2"
105 aria-hidden="true" 111 aria-hidden="true"
106 viewBox="0 0 24 24" 112 viewBox="0 0 24 24"
107 fill="currentColor" 113 fill="currentColor"
108 > 114 >
109 <path 115 <path
110 d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" 116 d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"
111 /> 117 />
112 </svg> 118 </svg>
113 Github 119 Github
114 </button> 120 </button>
115 <button 121 <button
116 class="flex items-center justify-center w-full px-4 py-2 mt-4 text-sm font-medium leading-5 text-white text-gray-700 transition-colors duration-150 border border-gray-300 rounded-lg dark:text-gray-400 active:bg-transparent hover:border-gray-500 focus:border-gray-500 active:text-gray-500 focus:outline-none focus:shadow-outline-gray" 122 class="flex items-center justify-center w-full px-4 py-2 mt-4 text-sm font-medium leading-5 text-white text-gray-700 transition-colors duration-150 border border-gray-300 rounded-lg dark:text-gray-400 active:bg-transparent hover:border-gray-500 focus:border-gray-500 active:text-gray-500 focus:outline-none focus:shadow-outline-gray"
117 > 123 >
118 <svg 124 <svg
119 class="w-4 h-4 mr-2" 125 class="w-4 h-4 mr-2"
120 aria-hidden="true" 126 aria-hidden="true"
121 viewBox="0 0 24 24" 127 viewBox="0 0 24 24"
122 fill="currentColor" 128 fill="currentColor"
123 > 129 >
124 <path 130 <path
125 d="M23.954 4.569c-.885.389-1.83.654-2.825.775 1.014-.611 1.794-1.574 2.163-2.723-.951.555-2.005.959-3.127 1.184-.896-.959-2.173-1.559-3.591-1.559-2.717 0-4.92 2.203-4.92 4.917 0 .39.045.765.127 1.124C7.691 8.094 4.066 6.13 1.64 3.161c-.427.722-.666 1.561-.666 2.475 0 1.71.87 3.213 2.188 4.096-.807-.026-1.566-.248-2.228-.616v.061c0 2.385 1.693 4.374 3.946 4.827-.413.111-.849.171-1.296.171-.314 0-.615-.03-.916-.086.631 1.953 2.445 3.377 4.604 3.417-1.68 1.319-3.809 2.105-6.102 2.105-.39 0-.779-.023-1.17-.067 2.189 1.394 4.768 2.209 7.557 2.209 9.054 0 13.999-7.496 13.999-13.986 0-.209 0-.42-.015-.63.961-.689 1.8-1.56 2.46-2.548l-.047-.02z" 131 d="M23.954 4.569c-.885.389-1.83.654-2.825.775 1.014-.611 1.794-1.574 2.163-2.723-.951.555-2.005.959-3.127 1.184-.896-.959-2.173-1.559-3.591-1.559-2.717 0-4.92 2.203-4.92 4.917 0 .39.045.765.127 1.124C7.691 8.094 4.066 6.13 1.64 3.161c-.427.722-.666 1.561-.666 2.475 0 1.71.87 3.213 2.188 4.096-.807-.026-1.566-.248-2.228-.616v.061c0 2.385 1.693 4.374 3.946 4.827-.413.111-.849.171-1.296.171-.314 0-.615-.03-.916-.086.631 1.953 2.445 3.377 4.604 3.417-1.68 1.319-3.809 2.105-6.102 2.105-.39 0-.779-.023-1.17-.067 2.189 1.394 4.768 2.209 7.557 2.209 9.054 0 13.999-7.496 13.999-13.986 0-.209 0-.42-.015-.63.961-.689 1.8-1.56 2.46-2.548l-.047-.02z"
126 /> 132 />
127 </svg> 133 </svg>
128 Twitter 134 Twitter
129 </button>--> 135 </button>-->
130 136
131 <p class="mt-4"> 137 <p class="mt-4">
132 <a 138 <a
133 class="text-sm font-medium text-purple-600 dark:text-purple-400 hover:underline" 139 class="text-sm font-medium text-purple-600 dark:text-purple-400 hover:underline"
134 href="{{ route('admin.login') }}" 140 href="{{ route('admin.login') }}"
135 > 141 >
136 Авторизация в системе 142 Авторизация в системе
137 </a> 143 </a>
138 </p> 144 </p>
139 <p class="mt-1"> 145 <p class="mt-1">
140 <a 146 <a
141 class="text-sm font-medium text-purple-600 dark:text-purple-400 hover:underline" 147 class="text-sm font-medium text-purple-600 dark:text-purple-400 hover:underline"
142 href="{{ route('index') }}" 148 href="{{ route('index') }}"
143 > 149 >
144 Главная страница 150 Главная страница
145 </a> 151 </a>
146 </p> 152 </p>
147 @endsection 153 @endsection
148 154
resources/views/admin/users/index.blade.php
1 @extends('layout.admin', ['title' => $title]) 1 @extends('layout.admin', ['title' => $title])
2 2
3 @section('script') 3 @section('script')
4 <script> 4 <script>
5 $(document).ready(function() { 5 $(document).ready(function() {
6 $(document).on('click', '.check_click', function () { 6 $(document).on('click', '.check_click', function () {
7 var this_ = $(this); 7 var this_ = $(this);
8 var value = this_.val(); 8 var value = this_.val();
9 var field = this_.attr('data-field'); 9 var field = this_.attr('data-field');
10 var ajax_block = $('#ajax_block'); 10 var ajax_block = $('#ajax_block');
11 var bool = 0; 11 var bool = 0;
12 var str_get = ''; 12 var str_get = '';
13 13
14 if(this.checked){ 14 if(this.checked){
15 bool = 1; 15 bool = 1;
16 } else { 16 } else {
17 bool = 0; 17 bool = 0;
18 } 18 }
19 console.log(field); 19 console.log(field);
20 str_get = "id=" + value + "&" + field + "=" + bool; 20 str_get = "id=" + value + "&" + field + "=" + bool;
21 console.log(str_get); 21 console.log(str_get);
22 22
23 $.ajax({ 23 $.ajax({
24 type: "GET", 24 type: "GET",
25 url: "{{ url()->full()}}", 25 url: "{{ url()->full()}}",
26 data: str_get, 26 data: str_get,
27 success: function (data) { 27 success: function (data) {
28 console.log('Обновление таблицы пользователей '); 28 console.log('Обновление таблицы пользователей ');
29 //data = JSON.parse(data); 29 //data = JSON.parse(data);
30 //console.log(data); 30 //console.log(data);
31 ajax_block.html(data); 31 ajax_block.html(data);
32 }, 32 },
33 headers: { 33 headers: {
34 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 34 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
35 }, 35 },
36 error: function (data) { 36 error: function (data) {
37 console.log('Error: ' + data); 37 console.log('Error: ' + data);
38 } 38 }
39 }); 39 });
40 }); 40 });
41 }); 41 });
42 </script> 42 </script>
43 @endsection 43 @endsection
44 44
45 @section('search') 45 @section('search')
46 @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 <table class="w-full whitespace-no-wrap"> 52 <table class="w-full whitespace-no-wrap">
53 <thead> 53 <thead>
54 <tr 54 <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" 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 > 56 >
57 <th class="px-4 py-3">№</th> 57 <th class="px-4 py-3">№</th>
58 <th class="px-4 py-3">Имя</th> 58 <th class="px-4 py-3">Имя</th>
59 <th class="px-4 py-3">Email/логин</th> 59 <th class="px-4 py-3">Email/логин</th>
60 <th class="px-4 py-3">Работодатель/работник/администратор</th> 60 <th class="px-4 py-3">Работодатель/работник/администратор</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 @if ($id_admin == 1) 63 @if ($id_admin == 1)
64 <th class="px-4 py-3">Админ</th> 64 <th class="px-4 py-3">Админ</th>
65 @endif 65 @endif
66 <th class="px-4 py-3">Дата регистрации</th> 66 <th class="px-4 py-3">Дата регист.</th>
67 </tr> 67 </tr>
68 </thead> 68 </thead>
69 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> 69 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
70 @foreach($users as $user) 70 @foreach($users as $user)
71 <tr class="text-gray-700 dark:text-gray-400"> 71 <tr class="text-gray-700 dark:text-gray-400">
72 <td class="px-4 py-3"> 72 <td class="px-4 py-3">
73 {{$user->id}} 73 {{$user->id}}
74 </td> 74 </td>
75 <td class="px-4 py-3"> 75 <td class="px-4 py-3">
76 <!--<div class="flex items-center text-sm"> 76 <!--<div class="flex items-center text-sm">
77 <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> 77 <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block">
78 <div 78 <div
79 class="absolute inset-0 rounded-full shadow-inner" 79 class="absolute inset-0 rounded-full shadow-inner"
80 aria-hidden="true" 80 aria-hidden="true"
81 ></div> 81 ></div>
82 </div> 82 </div>
83 <div> 83 <div>
84 <p class="font-semibold"><a href="{{ route('admin.users') }}">Пользователи</a></p> 84 <p class="font-semibold"><a href="{{ route('admin.users') }}">Пользователи</a></p>
85 <p class="text-xs text-gray-600 dark:text-gray-400"> 85 <p class="text-xs text-gray-600 dark:text-gray-400">
86 Все пользователи сайта 86 Все пользователи сайта
87 </p> 87 </p>
88 </div> 88 </div>
89 </div> 89 </div>
90 --> 90 -->
91 <a style="text-decoration: underline;" href="{{ route('admin.user-profile', ['user' => $user->id]) }}">{{ $user->name }}</a> 91 <a style="text-decoration: underline;" href="{{ route('admin.user-profile', ['user' => $user->id]) }}">{{ $user->name }}</a>
92 </td> 92 </td>
93 <td class="px-4 py-3 text-sm"> 93 <td class="px-4 py-3 text-sm">
94 {{ $user->email }} 94 {{ $user->email }}
95 </td> 95 </td>
96 <td class="px-4 py-3 text-xs"> 96 <td class="px-4 py-3 text-xs">
97 <span class="px-2 py-1 font-semibold leading-tight text-green-700 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100"> 97 <span class="px-2 py-1 font-semibold leading-tight text-green-700 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100">
98 @if ($user->is_worker) 98 @if ($user->is_worker)
99 Работник 99 Работник
100 @else 100 @else
101 Работодатель 101 Работодатель
102 @endif 102 @endif
103 </span> 103 </span>
104 @if ($user->admin) 104 @if ($user->admin)
105 <span class="px-2 py-1 font-semibold leading-tight text-orange-700 bg-orange-100 rounded-full dark:text-white dark:bg-orange-600"> 105 <span class="px-2 py-1 font-semibold leading-tight text-orange-700 bg-orange-100 rounded-full dark:text-white dark:bg-orange-600">
106 Администратор 106 Администратор
107 </span> 107 </span>
108 @endif 108 @endif
109 @if ($user->is_bd) 109 @if ($user->is_bd)
110 <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"> 110 <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">
111 База данных 111 База данных
112 </span> 112 </span>
113 @endif 113 @endif
114 </td> 114 </td>
115 <td class="px-4 py-3 text-sm"> 115 <td class="px-4 py-3 text-sm">
116 @if ($user->id > 1) 116 @if ($user->id > 1)
117 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_ban" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/> 117 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_ban" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/>
118 @endif 118 @endif
119 </td> 119 </td>
120 120
121 <td class="px-4 py-3 text-sm"> 121 <td class="px-4 py-3 text-sm">
122 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_new" name="new_{{$user->id}}" {{ ($user->is_new) ? "checked" : "" }}/> 122 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_new" name="new_{{$user->id}}" {{ ($user->is_new) ? "checked" : "" }}/>
123 </td> 123 </td>
124 124
125 @if ($id_admin == 1) 125 @if ($id_admin == 1)
126 <td class="px-4 py-3 text-sm"> 126 <td class="px-4 py-3 text-sm">
127 @if ($user->id > 1) 127 @if ($user->id > 1)
128 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/> 128 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/>
129 @endif 129 @endif
130 </td> 130 </td>
131 @endif 131 @endif
132 132
133 <td class="px-4 py-3 text-sm"> 133 <td class="px-4 py-3 text-sm">
134 {{ date('d.m.Y', strtotime($user->created_at)) }} 134 {{ date('d.m.Y', strtotime($user->created_at)) }}
135 </td> 135 </td>
136 </tr> 136 </tr>
137 @endforeach 137 @endforeach
138 </tbody> 138 </tbody>
139 </table> 139 </table>
140 </div> 140 </div>
141 141
142 <div class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800"> 142 <div class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800">
143 <?//=$users->appends($_GET)->links('admin.pagginate'); ?> 143 <?//=$users->appends($_GET)->links('admin.pagginate'); ?>
144 <?=$users->links('admin.pagginate'); ?> 144 <?=$users->links('admin.pagginate'); ?>
145 </div> 145 </div>
146 146
147 147
148 <!--<div 148 <!--<div
149 class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800" 149 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"
150 > 150 >
151 <span class="flex items-center col-span-3"> 151 <span class="flex items-center col-span-3">
152 Showing 21-30 of 100 152 Showing 21-30 of 100
153 </span> 153 </span>
154 <span class="col-span-2"></span> 154 <span class="col-span-2"></span>
155 155
156 <span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end"> 156 <span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end">
157 <nav aria-label="Table navigation"> 157 <nav aria-label="Table navigation">
158 <ul class="inline-flex items-center"> 158 <ul class="inline-flex items-center">
159 <li> 159 <li>
160 <button 160 <button
161 class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple" 161 class="px-3 py-1 rounded-md rounded-l-lg focus:outline-none focus:shadow-outline-purple"
162 aria-label="Previous" 162 aria-label="Previous"
163 > 163 >
164 <svg 164 <svg
165 aria-hidden="true" 165 aria-hidden="true"
166 class="w-4 h-4 fill-current" 166 class="w-4 h-4 fill-current"
167 viewBox="0 0 20 20" 167 viewBox="0 0 20 20"
168 > 168 >
169 <path 169 <path
170 d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" 170 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"
171 clip-rule="evenodd" 171 clip-rule="evenodd"
172 fill-rule="evenodd" 172 fill-rule="evenodd"
173 ></path> 173 ></path>
174 </svg> 174 </svg>
175 </button> 175 </button>
176 </li> 176 </li>
177 <li> 177 <li>
178 <button 178 <button
179 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 179 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
180 > 180 >
181 1 181 1
182 </button> 182 </button>
183 </li> 183 </li>
184 <li> 184 <li>
185 <button 185 <button
186 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 186 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
187 > 187 >
188 2 188 2
189 </button> 189 </button>
190 </li> 190 </li>
191 <li> 191 <li>
192 <button 192 <button
193 class="px-3 py-1 text-white transition-colors duration-150 bg-purple-600 border border-r-0 border-purple-600 rounded-md focus:outline-none focus:shadow-outline-purple" 193 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"
194 > 194 >
195 3 195 3
196 </button> 196 </button>
197 </li> 197 </li>
198 <li> 198 <li>
199 <button 199 <button
200 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 200 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
201 > 201 >
202 4 202 4
203 </button> 203 </button>
204 </li> 204 </li>
205 <li> 205 <li>
206 <span class="px-3 py-1">...</span> 206 <span class="px-3 py-1">...</span>
207 </li> 207 </li>
208 <li> 208 <li>
209 <button 209 <button
210 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 210 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
211 > 211 >
212 8 212 8
213 </button> 213 </button>
214 </li> 214 </li>
215 <li> 215 <li>
216 <button 216 <button
217 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple" 217 class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple"
218 > 218 >
219 9 219 9
220 </button> 220 </button>
221 </li> 221 </li>
222 <li> 222 <li>
223 <button 223 <button
224 class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple" 224 class="px-3 py-1 rounded-md rounded-r-lg focus:outline-none focus:shadow-outline-purple"
225 aria-label="Next" 225 aria-label="Next"
226 > 226 >
227 <svg 227 <svg
228 class="w-4 h-4 fill-current" 228 class="w-4 h-4 fill-current"
229 aria-hidden="true" 229 aria-hidden="true"
230 viewBox="0 0 20 20" 230 viewBox="0 0 20 20"
231 > 231 >
232 <path 232 <path
233 d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" 233 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"
234 clip-rule="evenodd" 234 clip-rule="evenodd"
235 fill-rule="evenodd" 235 fill-rule="evenodd"
236 ></path> 236 ></path>
237 </svg> 237 </svg>
238 </button> 238 </button>
239 </li> 239 </li>
240 </ul> 240 </ul>
241 </nav> 241 </nav>
242 </span> 242 </span>
243 </div>--> 243 </div>-->
244 </div> 244 </div>
245 245
246 <?//=$users->appends($_GET)->links('catalogs.paginate'); ?> 246 <?//=$users->appends($_GET)->links('catalogs.paginate'); ?>
247 247
248 248
249 @endsection 249 @endsection
250 250
1 <?php 1 <?php
2 2
3 use App\Http\Controllers\AdEmployerController; 3 use App\Http\Controllers\AdEmployerController;
4 use App\Http\Controllers\Admin\AdminController; 4 use App\Http\Controllers\Admin\AdminController;
5 use App\Http\Controllers\Admin\CategoryController; 5 use App\Http\Controllers\Admin\CategoryController;
6 use App\Http\Controllers\Admin\CategoryEmpController; 6 use App\Http\Controllers\Admin\CategoryEmpController;
7 use App\Http\Controllers\Admin\EducationController; 7 use App\Http\Controllers\Admin\EducationController;
8 use App\Http\Controllers\Admin\EmployersController; 8 use App\Http\Controllers\Admin\EmployersController;
9 use App\Http\Controllers\Admin\InfoBloksController; 9 use App\Http\Controllers\Admin\InfoBloksController;
10 use App\Http\Controllers\Admin\JobTitlesController; 10 use App\Http\Controllers\Admin\JobTitlesController;
11 use App\Http\Controllers\Admin\UsersController; 11 use App\Http\Controllers\Admin\UsersController;
12 use App\Http\Controllers\Admin\WorkersController; 12 use App\Http\Controllers\Admin\WorkersController;
13 use App\Http\Controllers\Auth\ForgotPasswordController; 13 use App\Http\Controllers\Auth\ForgotPasswordController;
14 use App\Http\Controllers\Auth\LoginController; 14 use App\Http\Controllers\Auth\LoginController;
15 use App\Http\Controllers\Auth\RegisterController; 15 use App\Http\Controllers\Auth\RegisterController;
16 use App\Http\Controllers\CKEditorController; 16 use App\Http\Controllers\CKEditorController;
17 use App\Http\Controllers\MediaController; 17 use App\Http\Controllers\MediaController;
18 use App\Http\Controllers\WorkerController; 18 use App\Http\Controllers\WorkerController;
19 use App\Models\User; 19 use App\Models\User;
20 use App\Http\Controllers\MainController; 20 use App\Http\Controllers\MainController;
21 use App\Http\Controllers\HomeController; 21 use App\Http\Controllers\HomeController;
22 use Illuminate\Support\Facades\Route; 22 use Illuminate\Support\Facades\Route;
23 use App\Http\Controllers\Admin\CompanyController; 23 use App\Http\Controllers\Admin\CompanyController;
24 use App\Http\Controllers\Admin\Ad_EmployersController; 24 use App\Http\Controllers\Admin\Ad_EmployersController;
25 use App\Http\Controllers\Admin\MsgAnswersController; 25 use App\Http\Controllers\Admin\MsgAnswersController;
26 use App\Http\Controllers\Admin\GroupsController; 26 use App\Http\Controllers\Admin\GroupsController;
27 use App\Http\Controllers\PagesController; 27 use App\Http\Controllers\PagesController;
28 use Illuminate\Support\Facades\Storage; 28 use Illuminate\Support\Facades\Storage;
29 29
30 30
31 /* 31 /*
32 |-------------------------------------------------------------------------- 32 |--------------------------------------------------------------------------
33 | Web Routes 33 | Web Routes
34 |-------------------------------------------------------------------------- 34 |--------------------------------------------------------------------------
35 | 35 |
36 | Here is where you can register web routes for your application. These 36 | Here is where you can register web routes for your application. These
37 | routes are loaded by the RouteServiceProvider within a group which 37 | routes are loaded by the RouteServiceProvider within a group which
38 | contains the "web" middleware group. Now create something great! 38 | contains the "web" middleware group. Now create something great!
39 | 39 |
40 */ 40 */
41 /* 41 /*
42 Route::get('/', function () { 42 Route::get('/', function () {
43 return view('welcome'); 43 return view('welcome');
44 })->name('index'); 44 })->name('index');
45 */ 45 */
46 Route::get('/', [MainController::class, 'index'])->name('index'); 46 Route::get('/', [MainController::class, 'index'])->name('index');
47 47
48 //Роуты авторизации, регистрации, восстановления, аутентификации 48 //Роуты авторизации, регистрации, восстановления, аутентификации
49 Auth::routes(['verify' => true]); 49 Auth::routes(['verify' => true]);
50 50
51 // роуты регистрации, авторизации, восстановления пароля, верификации почты 51 // роуты регистрации, авторизации, восстановления пароля, верификации почты
52 /*Route::group([ 52 /*Route::group([
53 'as' => 'auth.', //имя маршрута, например auth.index 53 'as' => 'auth.', //имя маршрута, например auth.index
54 'prefix' => 'auth', // префикс маршрута, например, auth/index 54 'prefix' => 'auth', // префикс маршрута, например, auth/index
55 ], function () { 55 ], function () {
56 //форма регистрации 56 //форма регистрации
57 Route::get('register', [RegisterController::class, 'register'])->name('register'); 57 Route::get('register', [RegisterController::class, 'register'])->name('register');
58 58
59 //создание пользователя 59 //создание пользователя
60 Route::post('register', [RegisterController::class, 'create'])->name('create'); 60 Route::post('register', [RegisterController::class, 'create'])->name('create');
61 61
62 //форма входа авторизации 62 //форма входа авторизации
63 Route::get('login', [LoginController::class, 'login'])->name('login'); 63 Route::get('login', [LoginController::class, 'login'])->name('login');
64 64
65 //аутентификация 65 //аутентификация
66 Route::post('login', [LoginController::class, 'authenticate'])->name('auth'); 66 Route::post('login', [LoginController::class, 'authenticate'])->name('auth');
67 67
68 //выход 68 //выход
69 Route::get('logout', [LoginController::class, 'logout'])->name('logout'); 69 Route::get('logout', [LoginController::class, 'logout'])->name('logout');
70 70
71 //форма ввода адреса почты 71 //форма ввода адреса почты
72 Route::get('forgot-password', [ForgotPasswordController::class, 'form'])->name('forgot-form'); 72 Route::get('forgot-password', [ForgotPasswordController::class, 'form'])->name('forgot-form');
73 73
74 //письмо на почту 74 //письмо на почту
75 Route::post('forgot-password', [ForgotPasswordController::class, 'mail'])->name('forgot-mail'); 75 Route::post('forgot-password', [ForgotPasswordController::class, 'mail'])->name('forgot-mail');
76 76
77 //форма восстановления пароля 77 //форма восстановления пароля
78 Route::get('reset-password/token/{token}/email/{email}', 78 Route::get('reset-password/token/{token}/email/{email}',
79 [ResetPasswordController::class, 'form'] 79 [ResetPasswordController::class, 'form']
80 )->name('reset-form'); 80 )->name('reset-form');
81 81
82 //восстановление пароля 82 //восстановление пароля
83 Route::post('reset-password', 83 Route::post('reset-password',
84 [ResetPasswordController::class, 'reset'] 84 [ResetPasswordController::class, 'reset']
85 )->name('reset-password'); 85 )->name('reset-password');
86 86
87 //сообщение о необходимости проверки адреса почты 87 //сообщение о необходимости проверки адреса почты
88 Route::get('verify-message', [VerifyEmailController::class, 'message'])->name('verify-message'); 88 Route::get('verify-message', [VerifyEmailController::class, 'message'])->name('verify-message');
89 89
90 //подтверждение адреса почты нового пользователя 90 //подтверждение адреса почты нового пользователя
91 Route::get('verify-email/token/{token}/id/{id}', [VerifyEmailController::class, 'verify']) 91 Route::get('verify-email/token/{token}/id/{id}', [VerifyEmailController::class, 'verify'])
92 ->where('token', '[a-f0-9]{32}') 92 ->where('token', '[a-f0-9]{32}')
93 ->where('id', '[0-9]+') 93 ->where('id', '[0-9]+')
94 ->name('verify-email'); 94 ->name('verify-email');
95 });*/ 95 });*/
96 96
97 //Личный кабинет пользователя 97 //Личный кабинет пользователя
98 Route::get('/home', [HomeController::class, 'index'])->name('home'); 98 Route::get('/home', [HomeController::class, 'index'])->name('home');
99 99
100 /* 100 /*
101 Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) { 101 Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) {
102 $user = User::where('email',$request->input('email'))->first(); 102 $user = User::where('email',$request->input('email'))->first();
103 103
104 $user->sendEmailVerificationNotification(); 104 $user->sendEmailVerificationNotification();
105 105
106 return 'your response'; 106 return 'your response';
107 })->middleware('throttle:6,1')->name('verification.resend'); 107 })->middleware('throttle:6,1')->name('verification.resend');
108 */ 108 */
109 109
110 // Авторизация, регистрация в админку 110 // Авторизация, регистрация в админку
111 Route::group([ 111 Route::group([
112 'as' => 'admin.', // имя маршрута, например auth.index 112 'as' => 'admin.', // имя маршрута, например auth.index
113 'prefix' => 'admin', // префикс маршрута, например auth/index 113 'prefix' => 'admin', // префикс маршрута, например auth/index
114 'middleware' => ['guest'], 114 'middleware' => ['guest'],
115 ], function () { 115 ], function () {
116 // Форма регистрации 116 // Форма регистрации
117 Route::get('register', [AdminController::class, 'register'])->name('register'); 117 Route::get('register', [AdminController::class, 'register'])->name('register');
118
119 // Создание пользователя 118 // Создание пользователя
120 Route::post('register', [AdminController::class, 'create'])->name('create'); 119 Route::post('register', [AdminController::class, 'create'])->name('create');
120
121 //Форма входа 121 //Форма входа
122 Route::get('login', [AdminController::class, 'login'])->name('login'); 122 Route::get('login', [AdminController::class, 'login'])->name('login');
123 123
124 // аутентификация 124 // аутентификация
125 Route::post('login', [AdminController::class, 'autenticate'])->name('auth'); 125 Route::post('login', [AdminController::class, 'autenticate'])->name('auth');
126 126
127 }); 127 });
128 128
129 // Личный кабинет админки 129 // Личный кабинет админки
130 Route::group([ 130 Route::group([
131 'as' => 'admin.', // имя маршрута, например auth.index 131 'as' => 'admin.', // имя маршрута, например auth.index
132 'prefix' => 'admin', // префикс маршрута, например auth/index 132 'prefix' => 'admin', // префикс маршрута, например auth/index
133 'middleware' => ['auth'], ['admin'], 133 'middleware' => ['auth'], ['admin'],
134 ], function() { 134 ], function() {
135 135
136 // выход 136 // выход
137 Route::get('logout', [AdminController::class, 'logout'])->name('logout'); 137 Route::get('logout', [AdminController::class, 'logout'])->name('logout');
138 138
139 // кабинет главная страница 139 // кабинет главная страница
140 Route::get('cabinet', [AdminController::class, 'index'])->name('index'); 140 Route::get('cabinet', [AdminController::class, 'index'])->name('index');
141 141
142 // кабинет профиль админа - форма 142 // кабинет профиль админа - форма
143 Route::get('profile', [AdminController::class, 'profile'])->name('profile'); 143 Route::get('profile', [AdminController::class, 'profile'])->name('profile');
144 // кабинет профиль админа - сохранение формы 144 // кабинет профиль админа - сохранение формы
145 Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile'); 145 Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile');
146 146
147 //кабинет сообщения админа 147 //кабинет сообщения админа
148 //Route::get('messages', [AdminController::class, 'profile'])->name('profile'); 148 //Route::get('messages', [AdminController::class, 'profile'])->name('profile');
149 149
150 150
151 // кабинет профиль - форма пароли 151 // кабинет профиль - форма пароли
152 Route::get('password', [AdminController::class, 'profile_password'])->name('password'); 152 Route::get('password', [AdminController::class, 'profile_password'])->name('password');
153 // кабинет профиль - сохранение формы пароля 153 // кабинет профиль - сохранение формы пароля
154 Route::post('password', [AdminController::class, 'profile_password_new'])->name('password'); 154 Route::post('password', [AdminController::class, 'profile_password_new'])->name('password');
155 155
156 156
157 // кабинет профиль пользователя - форма 157 // кабинет профиль пользователя - форма
158 Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile'); 158 Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile');
159 // кабинет профиль пользователя - сохранение формы 159 // кабинет профиль пользователя - сохранение формы
160 Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile'); 160 Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile');
161 161
162 // кабинет профиль работодатель - форма 162 // кабинет профиль работодатель - форма
163 Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile'); 163 Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile');
164 // кабинет профиль работодатель - сохранение формы 164 // кабинет профиль работодатель - сохранение формы
165 Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile'); 165 Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile');
166 // кабинет удаление профиль работодателя и юзера 166 // кабинет удаление профиль работодателя и юзера
167 Route::delete('employers/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer'); 167 Route::delete('employers/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer');
168 168
169 // кабинет профиль работник - форма 169 // кабинет профиль работник - форма
170 Route::get('worker-profile/add/{user}', [WorkersController::class, 'form_add_worker'])->name('worker-profile-add'); 170 Route::get('worker-profile/add/{user}', [WorkersController::class, 'form_add_worker'])->name('worker-profile-add');
171 Route::post('worker-profile/add/{user}', [WorkersController::class, 'form_store_worker'])->name('worker-profile-store'); 171 Route::post('worker-profile/add/{user}', [WorkersController::class, 'form_store_worker'])->name('worker-profile-store');
172 Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit'); 172 Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit');
173 // кабинет профиль работник - сохранение формы 173 // кабинет профиль работник - сохранение формы
174 Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update'); 174 Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update');
175 175
176 // Медиа 176 // Медиа
177 Route::get('media', [MediaController::class, 'index'])->name('media'); 177 Route::get('media', [MediaController::class, 'index'])->name('media');
178 Route::delete('media/{media}', [MediaController::class, 'delete'])->name('delete-media'); 178 Route::delete('media/{media}', [MediaController::class, 'delete'])->name('delete-media');
179 179
180 // кабинет настройки сайта - форма 180 // кабинет настройки сайта - форма
181 Route::get('config', [AdminController::class, 'config_form'])->name('config'); 181 Route::get('config', [AdminController::class, 'config_form'])->name('config');
182 // кабинет настройки сайта сохранение формы 182 // кабинет настройки сайта сохранение формы
183 Route::post('config', [AdminController::class, 'store_config'])->name('store_config'); 183 Route::post('config', [AdminController::class, 'store_config'])->name('store_config');
184 184
185 // кабинет - пользователи 185 // кабинет - пользователи
186 Route::get('users', [UsersController::class, 'index'])->name('users'); 186 Route::get('users', [UsersController::class, 'index'])->name('users');
187 187
188 // кабинет - пользователи 188 // кабинет - пользователи
189 Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users'); 189 Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users');
190 190
191 // кабинет - работодатели 191 // кабинет - работодатели
192 Route::get('employers', [EmployersController::class, 'index'])->name('employers'); 192 Route::get('employers', [EmployersController::class, 'index'])->name('employers');
193 193
194 Route::get('employers/comment/{employer}', [EmployersController::class, 'comment_read'])->name('comment-employer'); 194 Route::get('employers/comment/{employer}', [EmployersController::class, 'comment_read'])->name('comment-employer');
195 195
196 // кабинет - соискатели 196 // кабинет - соискатели
197 Route::get('workers', [WorkersController::class, 'index'])->name('workers'); 197 Route::get('workers', [WorkersController::class, 'index'])->name('workers');
198 198
199 // кабинет - база данных 199 // кабинет - база данных
200 Route::get('basedata', [UsersController::class, 'index_bd'])->name('basedata'); 200 Route::get('basedata', [UsersController::class, 'index_bd'])->name('basedata');
201 Route::get('basedata/add', [UsersController::class, 'add_bd'])->name('add-basedata'); 201 Route::get('basedata/add', [UsersController::class, 'add_bd'])->name('add-basedata');
202 Route::post('basedata/add', [UsersController::class, 'add_store_bd'])->name('add-store-basedata'); 202 Route::post('basedata/add', [UsersController::class, 'add_store_bd'])->name('add-store-basedata');
203 Route::get('basedata/edit/{user}', [UsersController::class, 'edit_bd'])->name('edit-basedata'); 203 Route::get('basedata/edit/{user}', [UsersController::class, 'edit_bd'])->name('edit-basedata');
204 Route::put('basedata/edit/{user}', [UsersController::class, 'update_bd'])->name('update-basedata'); 204 Route::put('basedata/edit/{user}', [UsersController::class, 'update_bd'])->name('update-basedata');
205 Route::delete('basedata/delete/{user}', [UsersController::class, 'destroy_bd'])->name('delete-basedata'); 205 Route::delete('basedata/delete/{user}', [UsersController::class, 'destroy_bd'])->name('delete-basedata');
206 Route::get('basedata/doc/{user}', [UsersController::class, 'doc_bd'])->name('doc-basedata'); 206 Route::get('basedata/doc/{user}', [UsersController::class, 'doc_bd'])->name('doc-basedata');
207 207
208 // кабинет - вакансии 208 // кабинет - вакансии
209 Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers'); 209 Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers');
210 Route::get('ad-employers/add', [Ad_EmployersController::class, 'create'])->name('add-ad-employers');
211 Route::post('ad-employers/add', [Ad_EmployersController::class, 'store'])->name('store-ad-employers');
210 Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers'); 212 Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers');
211 Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers'); 213 Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers');
214 Route::delete('ad-employers/delete/{ad_employer}', [Ad_EmployersController::class, 'destroy'])->name('delete-ad-employer');
212 215
213 // кабинет - категории 216 // кабинет - категории
214 //Route::get('categories', [AdminController::class, 'index'])->name('categories'); 217 //Route::get('categories', [AdminController::class, 'index'])->name('categories');
215 /* 218 /*
216 * CRUD-операции над Справочником Категории 219 * CRUD-операции над Справочником Категории
217 */ 220 */
218 Route::resource('categories', CategoryController::class, ['except' => ['show']]); 221 Route::resource('categories', CategoryController::class, ['except' => ['show']]);
219 222
220 // CRUD-операции над справочником Категории для работодателей 223 // CRUD-операции над справочником Категории для работодателей
221 Route::resource('category-emp', CategoryEmpController::class, ['except' => ['show']]); 224 Route::resource('category-emp', CategoryEmpController::class, ['except' => ['show']]);
222 225
223 // CRUD-операции над справочником Образование 226 // CRUD-операции над справочником Образование
224 Route::resource('education', EducationController::class, ['except' => ['show']]); 227 Route::resource('education', EducationController::class, ['except' => ['show']]);
225 228
226 Route::get('program-education/{education}/{level}', [EducationController::class, 'add_program'])->name('add-program-education'); 229 Route::get('program-education', [EducationController::class, 'add_program'])->name('add-program-education');
227 Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education'); 230 Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education');
228 231
229 //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles'); 232 //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles');
230 /* 233 /*
231 * кабинет - CRUD-операции по справочнику должности 234 * кабинет - CRUD-операции по справочнику должности
232 * 235 *
233 */ 236 */
234 Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]); 237 Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]);
235 238
236 // кабинет - сообщения (чтение чужих) 239 // кабинет - сообщения (чтение чужих)
237 Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages'); 240 Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages');
238 // кабинет - просмотр сообщения чужого (чтение) 241 // кабинет - просмотр сообщения чужого (чтение)
239 Route::get('messages/{message}', [MsgAnswersController::class, 'read_message'])->name('read-message'); 242 Route::get('messages/{message}', [MsgAnswersController::class, 'read_message'])->name('read-message');
240 243
241 // кабинет - сообщения (админские) 244 // кабинет - сообщения (админские)
242 Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages'); 245 Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages');
243 // кабинет - сообщения (админские) 246 // кабинет - сообщения (админские)
244 Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post'); 247 Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post');
245 // кабинет - sql - конструкция запросов 248 // кабинет - sql - конструкция запросов
246 Route::get('messages-sql', [MsgAnswersController::class, 'messages_sql'])->name('messages-sql'); 249 Route::get('messages-sql', [MsgAnswersController::class, 'messages_sql'])->name('messages-sql');
247 250
248 /* 251 /*
249 * Расписанный подход в описании каждой директорий групп пользователей. 252 * Расписанный подход в описании каждой директорий групп пользователей.
250 */ 253 */
251 // кабинет - группы пользователей 254 // кабинет - группы пользователей
252 Route::get('groups', [GroupsController::class, 'index'])->name('groups'); 255 Route::get('groups', [GroupsController::class, 'index'])->name('groups');
253 // кабинет - добавление форма группы пользователей 256 // кабинет - добавление форма группы пользователей
254 Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group'); 257 Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group');
255 // кабинет - сохранение формы группы пользователей 258 // кабинет - сохранение формы группы пользователей
256 Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store'); 259 Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store');
257 // кабинет - редактирование форма группы пользователей 260 // кабинет - редактирование форма группы пользователей
258 Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group'); 261 Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group');
259 // кабинет - сохранение редактированной формы группы пользователей 262 // кабинет - сохранение редактированной формы группы пользователей
260 Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group'); 263 Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group');
261 // кабинет - удаление группы пользователей 264 // кабинет - удаление группы пользователей
262 Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group'); 265 Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group');
263 266
264 267
265 // кабинет - список админов 268 // кабинет - список админов
266 Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin'); 269 Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin');
267 270
268 271
269 /////редактор////// кабинет - редактор сайта//////////////////////// 272 /////редактор////// кабинет - редактор сайта////////////////////////
270 Route::get('editor-site', function() { 273 Route::get('editor-site', function() {
271 return view('admin.editor.index'); 274 return view('admin.editor.index');
272 })->name('editor-site'); 275 })->name('editor-site');
273 276
274 277
275 // кабинет - редактор шапки-футера сайта 278 // кабинет - редактор шапки-футера сайта
276 Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks'); 279 Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks');
277 Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block'); 280 Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block');
278 Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store'); 281 Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store');
279 Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block'); 282 Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block');
280 Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block'); 283 Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block');
281 Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block'); 284 Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block');
282 Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block'); 285 Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block');
283 286
284 287
285 // кабинет - редактор должности на главной 288 // кабинет - редактор должности на главной
286 Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main'); 289 Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main');
287 290
288 // кабинет - редактор работодатели на главной 291 // кабинет - редактор работодатели на главной
289 Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main'); 292 Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main');
290 293
291 294
292 // кабинет - редактор seo-сайта 295 // кабинет - редактор seo-сайта
293 Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo'); 296 Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo');
294 Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo'); 297 Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo');
295 Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store'); 298 Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store');
296 Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo'); 299 Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo');
297 Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo'); 300 Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo');
298 Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo'); 301 Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo');
299 Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo'); 302 Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo');
300 303
301 304
302 // кабинет - редактор страниц 305 // кабинет - редактор страниц
303 Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages'); 306 Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages');
304 // кабинет - добавление страницы 307 // кабинет - добавление страницы
305 Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page'); 308 Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page');
306 // кабинет - сохранение формы страницы 309 // кабинет - сохранение формы страницы
307 Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store'); 310 Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store');
308 // кабинет - редактирование форма страницы 311 // кабинет - редактирование форма страницы
309 Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page'); 312 Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page');
310 // кабинет - сохранение редактированной формы страницы 313 // кабинет - сохранение редактированной формы страницы
311 Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page'); 314 Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page');
312 // кабинет - удаление страницы 315 // кабинет - удаление страницы
313 Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page'); 316 Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page');
314 317
315 318
316 // кабинет - реклама сайта 319 // кабинет - реклама сайта
317 Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames'); 320 Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames');
318 Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames'); 321 Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames');
319 Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store'); 322 Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store');
320 Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames'); 323 Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames');
321 Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames'); 324 Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames');
322 Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames'); 325 Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames');
323 //////////////////////////////////////////////////////////////////////// 326 ////////////////////////////////////////////////////////////////////////
324 327
325 328
326 // кабинет - отзывы о работодателе для модерации 329 // кабинет - отзывы о работодателе для модерации
327 Route::get('answers', [EmployersController::class, 'answers'])->name('answers'); 330 Route::get('answers', [EmployersController::class, 'answers'])->name('answers');
328 331
329 // Общая страница статистики 332 // Общая страница статистики
330 Route::get('statics', function () { 333 Route::get('statics', function () {
331 return view('admin.static.index'); 334 return view('admin.static.index');
332 })->name('statics'); 335 })->name('statics');
333 336
334 // кабинет - статистика работников 337 // кабинет - статистика работников
335 Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers'); 338 Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers');
336 339
337 // кабинет - статистика вакансий работодателя 340 // кабинет - статистика вакансий работодателя
338 Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads'); 341 Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads');
339 342
340 // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника 343 // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника
341 /* 344 /*
342 * CRUD-операции над справочником дипломы и документы 345 * CRUD-операции над справочником дипломы и документы
343 */ 346 */
344 //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks'); 347 //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks');
345 Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]); 348 Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]);
346 349
347 // кабинет - роли пользователя 350 // кабинет - роли пользователя
348 Route::get('roles', [UsersController::class, 'roles'])->name('roles'); 351 Route::get('roles', [UsersController::class, 'roles'])->name('roles');
349 352
350 Route::get('logs', function() { 353 Route::get('logs', function() {
351 $files = Storage::files('logs/laravel.log'); 354 $files = Storage::files('logs/laravel.log');
352 print_r($files); 355 print_r($files);
353 })->name('logs'); 356 })->name('logs');
354 357
355 }); 358 });
356 359
357 // Инструментальные страницы 360 // Инструментальные страницы
358 Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload'); 361 Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload');
359 362
360 Route::get('redis/', [PagesController::class, 'redis'])->name('redis'); 363 Route::get('redis/', [PagesController::class, 'redis'])->name('redis');
361 364
362 Route::get('excel/', [PagesController::class, 'excel'])->name('excel'); 365 Route::get('excel/', [PagesController::class, 'excel'])->name('excel');
363 366
364 // Страницы с произвольным контентом 367 // Страницы с произвольным контентом
365 Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page'); 368 Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page');
366 369
367 // Публичные страницы соискателя 370 // Публичные страницы соискателя
368 Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page'); 371 Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page');
369 372
370 //Страница вакансии 373 //Страница вакансии
371 Route::get('employer/ad/{ad_employer}', [AdEmployerController::class, 'ad_employer'])->name('ad-employer'); 374 Route::get('employer/ad/{ad_employer}', [AdEmployerController::class, 'ad_employer'])->name('ad-employer');