Commit 7fea6c8d4d5c49c26ae13bb75acfad37d4b5f821
1 parent
ef4723c2f4
Exists in
master
and in
1 other branch
Коммит работодателя в админке - название корпорации
Showing 2 changed files with 4 additions and 1 deletions Inline Diff
app/Http/Controllers/Admin/EmployersController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers\Admin; | 3 | namespace App\Http\Controllers\Admin; |
4 | 4 | ||
5 | use App\Http\Controllers\Controller; | 5 | use App\Http\Controllers\Controller; |
6 | use App\Http\Requests\FlotRequest; | 6 | use App\Http\Requests\FlotRequest; |
7 | use App\Models\Ad_employer; | 7 | use App\Models\Ad_employer; |
8 | use App\Models\Answer; | 8 | use App\Models\Answer; |
9 | use App\Models\CategoryEmp; | 9 | use App\Models\CategoryEmp; |
10 | use App\Models\Employer; | 10 | use App\Models\Employer; |
11 | use App\Models\Flot; | 11 | use App\Models\Flot; |
12 | use App\Models\Static_ad; | 12 | use App\Models\Static_ad; |
13 | use App\Models\User; | 13 | use App\Models\User; |
14 | use Illuminate\Http\Request; | 14 | use Illuminate\Http\Request; |
15 | use Illuminate\Support\Facades\DB; | 15 | use Illuminate\Support\Facades\DB; |
16 | use Illuminate\Support\Facades\Storage; | 16 | use Illuminate\Support\Facades\Storage; |
17 | use Illuminate\Support\Facades\Validator; | 17 | use Illuminate\Support\Facades\Validator; |
18 | 18 | ||
19 | class EmployersController extends Controller | 19 | class EmployersController extends Controller |
20 | { | 20 | { |
21 | public function index(Request $request) { | 21 | public function index(Request $request) { |
22 | //$all_employer = User::where('is_worker', '0')->count(); | 22 | //$all_employer = User::where('is_worker', '0')->count(); |
23 | $all_public = -1; | 23 | $all_public = -1; |
24 | $all_status = -1; | 24 | $all_status = -1; |
25 | if ($request->ajax()) { | 25 | if ($request->ajax()) { |
26 | $user = User::find($request->id); | 26 | $user = User::find($request->id); |
27 | $request->offsetUnset('id'); | 27 | $request->offsetUnset('id'); |
28 | $user->update($request->all()); | 28 | $user->update($request->all()); |
29 | } | 29 | } |
30 | 30 | ||
31 | $users = User::with('employers')->select(['users.*','users.id as usr_id', 'emp.id as emp_id', 'emp.code as code_id', 'emp.logo as emp_logo', 'emp.*']) | 31 | $users = User::with('employers')->select(['users.*','users.id as usr_id', 'emp.id as emp_id', 'emp.code as code_id', 'emp.logo as emp_logo', 'emp.name_company as name_company', 'emp.*']) |
32 | ->join('employers as emp','emp.user_id','users.id') | 32 | ->join('employers as emp','emp.user_id','users.id') |
33 | ->where('users.is_worker', '0')->Realuser(); //->Notadmin(); | 33 | ->where('users.is_worker', '0')->Realuser(); //->Notadmin(); |
34 | $all_employer = $users->count(); | 34 | $all_employer = $users->count(); |
35 | 35 | ||
36 | $all_public = Employer::where('status_hidden', '=', '0')-> | 36 | $all_public = Employer::where('status_hidden', '=', '0')-> |
37 | count(); | 37 | count(); |
38 | 38 | ||
39 | $all_status = Employer::where(function($query) { | 39 | $all_status = Employer::where(function($query) { |
40 | $query->Where('category', '=', 'Не оплачен') | 40 | $query->Where('category', '=', 'Не оплачен') |
41 | ->orWhere('category', '=', 'Не определен') | 41 | ->orWhere('category', '=', 'Не определен') |
42 | ->orWhere('category', '=', 'Согласование'); | 42 | ->orWhere('category', '=', 'Согласование'); |
43 | })->count(); | 43 | })->count(); |
44 | 44 | ||
45 | $find_cat = ""; | 45 | $find_cat = ""; |
46 | if (isset($request->category)) { | 46 | if (isset($request->category)) { |
47 | if ($request->category != 'Все категории') { | 47 | if ($request->category != 'Все категории') { |
48 | $users = $users->where('category', '=', $request->category); | 48 | $users = $users->where('category', '=', $request->category); |
49 | $find_cat = $request->category; | 49 | $find_cat = $request->category; |
50 | } | 50 | } |
51 | } | 51 | } |
52 | $find_key = ""; | 52 | $find_key = ""; |
53 | 53 | ||
54 | if (isset($request->find)) { | 54 | if (isset($request->find)) { |
55 | $find_key = $request->find; | 55 | $find_key = $request->find; |
56 | $users = $users->where(function($query) use($find_key) { | 56 | $users = $users->where(function($query) use($find_key) { |
57 | $query->Where('users.name', 'LIKE', "%$find_key%") | 57 | $query->Where('users.name', 'LIKE', "%$find_key%") |
58 | ->orWhere('emp.email', 'LIKE', "%$find_key%") | 58 | ->orWhere('emp.email', 'LIKE', "%$find_key%") |
59 | ->orWhere('emp.telephone', 'LIKE', "%$find_key%"); | 59 | ->orWhere('emp.telephone', 'LIKE', "%$find_key%"); |
60 | }); | 60 | }); |
61 | } | 61 | } |
62 | 62 | ||
63 | //DB::enableQueryLog(); | 63 | //DB::enableQueryLog(); |
64 | $all_current = $users->count(); | 64 | $all_current = $users->count(); |
65 | $users = $users->paginate(15); | 65 | $users = $users->paginate(15); |
66 | //dd(DB::getQueryLog()); | 66 | //dd(DB::getQueryLog()); |
67 | 67 | ||
68 | $select_category = CategoryEmp::query()->active()->get(); | 68 | $select_category = CategoryEmp::query()->active()->get(); |
69 | 69 | ||
70 | if ($request->ajax()) { | 70 | if ($request->ajax()) { |
71 | return view('admin.employer.index_ajax', compact('users')); | 71 | return view('admin.employer.index_ajax', compact('users')); |
72 | } else { | 72 | } else { |
73 | return view('admin.employer.index', compact('users', | 73 | return view('admin.employer.index', compact('users', |
74 | 'find_key', | 74 | 'find_key', |
75 | 'find_cat', | 75 | 'find_cat', |
76 | 'all_employer', | 76 | 'all_employer', |
77 | 'all_public', | 77 | 'all_public', |
78 | 'all_status', | 78 | 'all_status', |
79 | 'all_current', | 79 | 'all_current', |
80 | 'select_category')); | 80 | 'select_category')); |
81 | } | 81 | } |
82 | } | 82 | } |
83 | 83 | ||
84 | public function comment_read(Employer $employer) { | 84 | public function comment_read(Employer $employer) { |
85 | return view('admin.employer.comment', compact('employer')); | 85 | return view('admin.employer.comment', compact('employer')); |
86 | } | 86 | } |
87 | 87 | ||
88 | // Форма обновления | 88 | // Форма обновления |
89 | public function form_update_employer(Employer $employer) { | 89 | public function form_update_employer(Employer $employer) { |
90 | // данные | 90 | // данные |
91 | $select_category = CategoryEmp::query()->active()->get(); | 91 | $select_category = CategoryEmp::query()->active()->get(); |
92 | $flots = Flot::query()->where('employer_id', '=', $employer->id)->get(); | 92 | $flots = Flot::query()->where('employer_id', '=', $employer->id)->get(); |
93 | return view('admin.employer.edit', compact('employer', 'select_category', 'flots')); | 93 | return view('admin.employer.edit', compact('employer', 'select_category', 'flots')); |
94 | } | 94 | } |
95 | 95 | ||
96 | public function edit_flot(Flot $flot, Employer $employer) { | 96 | public function edit_flot(Flot $flot, Employer $employer) { |
97 | return view('admin.flot.edit', compact('flot', 'employer')); | 97 | return view('admin.flot.edit', compact('flot', 'employer')); |
98 | } | 98 | } |
99 | 99 | ||
100 | public function add_flot(Employer $employer) { | 100 | public function add_flot(Employer $employer) { |
101 | return view('admin.flot.add', compact('employer')); | 101 | return view('admin.flot.add', compact('employer')); |
102 | } | 102 | } |
103 | 103 | ||
104 | public function save_add_flot(FlotRequest $request) { | 104 | public function save_add_flot(FlotRequest $request) { |
105 | $params = $request->all(); | 105 | $params = $request->all(); |
106 | $params['image'] = $request->file('image')->store("flot", 'public'); | 106 | $params['image'] = $request->file('image')->store("flot", 'public'); |
107 | Flot::create($params); | 107 | Flot::create($params); |
108 | return redirect()->route('admin.employer-profile', ['employer' => $params['employer_id']]) | 108 | return redirect()->route('admin.employer-profile', ['employer' => $params['employer_id']]) |
109 | ->with('success', 'Данные были успешно сохранены'); | 109 | ->with('success', 'Данные были успешно сохранены'); |
110 | } | 110 | } |
111 | 111 | ||
112 | public function delete_flot(Flot $flot, $employer_id) { | 112 | public function delete_flot(Flot $flot, $employer_id) { |
113 | $flot->delete(); | 113 | $flot->delete(); |
114 | return redirect()->route('admin.employer-profile', ['employer' => $employer_id]) | 114 | return redirect()->route('admin.employer-profile', ['employer' => $employer_id]) |
115 | ->with('success', 'Данные были успешно сохранены'); | 115 | ->with('success', 'Данные были успешно сохранены'); |
116 | } | 116 | } |
117 | 117 | ||
118 | 118 | ||
119 | public function edit_save_flot(Flot $flot, FlotRequest $request) { | 119 | public function edit_save_flot(Flot $flot, FlotRequest $request) { |
120 | $params = $request->all(); | 120 | $params = $request->all(); |
121 | 121 | ||
122 | if ($request->has('image')) { | 122 | if ($request->has('image')) { |
123 | if (!empty($flot->image)) { | 123 | if (!empty($flot->image)) { |
124 | Storage::delete($flot->image); | 124 | Storage::delete($flot->image); |
125 | } | 125 | } |
126 | $params['image'] = $request->file('image')->store("flot", 'public'); | 126 | $params['image'] = $request->file('image')->store("flot", 'public'); |
127 | } else { | 127 | } else { |
128 | if (!empty($flot->image)) $params['image'] = $flot->image; | 128 | if (!empty($flot->image)) $params['image'] = $flot->image; |
129 | } | 129 | } |
130 | 130 | ||
131 | $flot->update($params); | 131 | $flot->update($params); |
132 | 132 | ||
133 | return redirect()->route('admin.employer-profile', ['employer' => $params['employer_id']]) | 133 | return redirect()->route('admin.employer-profile', ['employer' => $params['employer_id']]) |
134 | ->with('success', 'Данные были успешно сохранены'); | 134 | ->with('success', 'Данные были успешно сохранены'); |
135 | 135 | ||
136 | } | 136 | } |
137 | 137 | ||
138 | public function update_employer(Employer $employer, Request $request) | 138 | public function update_employer(Employer $employer, Request $request) |
139 | { | 139 | { |
140 | $params = $request->all(); | 140 | $params = $request->all(); |
141 | unset($params['logo']); | 141 | unset($params['logo']); |
142 | unset($params['telephone']); | 142 | unset($params['telephone']); |
143 | unset($params['email']); | 143 | unset($params['email']); |
144 | unset($params['address']); | 144 | unset($params['address']); |
145 | unset($params['site']); | 145 | unset($params['site']); |
146 | unset($params['status_hidden']); | 146 | unset($params['status_hidden']); |
147 | unset($params['oficial_status']); | 147 | unset($params['oficial_status']); |
148 | unset($params['social_is']); | 148 | unset($params['social_is']); |
149 | unset($params['sending_is']); | 149 | unset($params['sending_is']); |
150 | unset($params['category']); | 150 | unset($params['category']); |
151 | unset($params['comment_admin']); | 151 | unset($params['comment_admin']); |
152 | 152 | ||
153 | $rules = [ | 153 | $rules = [ |
154 | 'name' => 'required|string|max:255', | 154 | 'name' => 'required|string|max:255', |
155 | ]; | 155 | ]; |
156 | 156 | ||
157 | $messages = [ | 157 | $messages = [ |
158 | 'required' => 'Укажите обязательное поле «:attribute»', | 158 | 'required' => 'Укажите обязательное поле «:attribute»', |
159 | 'confirmed' => 'Пароли не совпадают', | 159 | 'confirmed' => 'Пароли не совпадают', |
160 | 'email' => 'Введите корректный email', | 160 | 'email' => 'Введите корректный email', |
161 | 'min' => [ | 161 | 'min' => [ |
162 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 162 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
163 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 163 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
164 | ], | 164 | ], |
165 | 'max' => [ | 165 | 'max' => [ |
166 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 166 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
167 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 167 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
168 | ], | 168 | ], |
169 | ]; | 169 | ]; |
170 | 170 | ||
171 | $validator = Validator::make($params, $rules, $messages); | 171 | $validator = Validator::make($params, $rules, $messages); |
172 | 172 | ||
173 | if ($validator->fails()) { | 173 | if ($validator->fails()) { |
174 | return back()->withErrors($validator)->withInput(); //->route('admin.register') | 174 | return back()->withErrors($validator)->withInput(); //->route('admin.register') |
175 | 175 | ||
176 | } else { | 176 | } else { |
177 | 177 | ||
178 | //$user = User::find($employer->user_id); | 178 | //$user = User::find($employer->user_id); |
179 | $user_id = $employer->user_id; | 179 | $user_id = $employer->user_id; |
180 | $employer->telephone = $request->telephone; | 180 | $employer->telephone = $request->telephone; |
181 | $employer->email = $request->email; | 181 | $employer->email = $request->email; |
182 | $employer->address = $request->address; | 182 | $employer->address = $request->address; |
183 | $employer->site = $request->site; | 183 | $employer->site = $request->site; |
184 | $employer->text = $request->text; | 184 | $employer->text = $request->text; |
185 | $employer->status_hidden = $request->status_hidden; | 185 | $employer->status_hidden = $request->status_hidden; |
186 | $employer->oficial_status = $request->oficial_status; | 186 | $employer->oficial_status = $request->oficial_status; |
187 | $employer->social_is = $request->social_is; | 187 | $employer->social_is = $request->social_is; |
188 | $employer->sending_is = $request->sending_is; | 188 | $employer->sending_is = $request->sending_is; |
189 | $employer->category = $request->category; | 189 | $employer->category = $request->category; |
190 | $employer->comment_admin = $request->comment_admin; | 190 | $employer->comment_admin = $request->comment_admin; |
191 | 191 | ||
192 | if ($request->has('logo')) { | 192 | if ($request->has('logo')) { |
193 | if (!empty($employer->logo)) { | 193 | if (!empty($employer->logo)) { |
194 | Storage::delete($employer->logo); | 194 | Storage::delete($employer->logo); |
195 | } | 195 | } |
196 | $employer->logo = $request->file('logo')->store("employer/$user_id", 'public'); | 196 | $employer->logo = $request->file('logo')->store("employer/$user_id", 'public'); |
197 | } | 197 | } |
198 | $employer->save(); | 198 | $employer->save(); |
199 | 199 | ||
200 | $user = User::find($user_id); | 200 | $user = User::find($user_id); |
201 | $user->update($params); | 201 | $user->update($params); |
202 | 202 | ||
203 | return redirect()->route('admin.employer-profile', ['employer' => $employer->id]) | 203 | return redirect()->route('admin.employer-profile', ['employer' => $employer->id]) |
204 | ->with('success', 'Данные были успешно сохранены'); | 204 | ->with('success', 'Данные были успешно сохранены'); |
205 | } | 205 | } |
206 | } | 206 | } |
207 | 207 | ||
208 | // Удаление работодателя, вакансий и профиля юзера | 208 | // Удаление работодателя, вакансий и профиля юзера |
209 | public function delete_employer(Employer $employer, User $user) { | 209 | public function delete_employer(Employer $employer, User $user) { |
210 | try { | 210 | try { |
211 | if (!empty($employer)) { | 211 | if (!empty($employer)) { |
212 | if (!empty($employer->logo)) { | 212 | if (!empty($employer->logo)) { |
213 | Storage::delete($employer->logo); | 213 | Storage::delete($employer->logo); |
214 | } | 214 | } |
215 | 215 | ||
216 | foreach($employer->ads as $ad) { | 216 | foreach($employer->ads as $ad) { |
217 | $ads = Ad_employer::find($ad->id); | 217 | $ads = Ad_employer::find($ad->id); |
218 | $ads->employer_id = 2; | 218 | $ads->employer_id = 2; |
219 | $ads->is_remove = 1; | 219 | $ads->is_remove = 1; |
220 | $ads->save(); | 220 | $ads->save(); |
221 | } | 221 | } |
222 | 222 | ||
223 | $employer->delete(); | 223 | $employer->delete(); |
224 | } | 224 | } |
225 | } finally { | 225 | } finally { |
226 | $user->delete(); | 226 | $user->delete(); |
227 | } | 227 | } |
228 | 228 | ||
229 | return redirect()->route('admin.employers')->with('success', 'Данные были удалены о работодателе'); | 229 | return redirect()->route('admin.employers')->with('success', 'Данные были удалены о работодателе'); |
230 | } | 230 | } |
231 | 231 | ||
232 | // кабинет - отзывы о работодателе для модерации | 232 | // кабинет - отзывы о работодателе для модерации |
233 | public function answers(Request $request) { | 233 | public function answers(Request $request) { |
234 | if ($request->ajax()) { | 234 | if ($request->ajax()) { |
235 | $user = Answer::find($request->id); | 235 | $user = Answer::find($request->id); |
236 | $request->offsetUnset('id'); | 236 | $request->offsetUnset('id'); |
237 | $user->update($request->all()); | 237 | $user->update($request->all()); |
238 | } | 238 | } |
239 | 239 | ||
240 | $answers = Answer::query()->orderByDesc('id')->paginate(15); | 240 | $answers = Answer::query()->orderByDesc('id')->paginate(15); |
241 | 241 | ||
242 | if ($request->ajax()) { | 242 | if ($request->ajax()) { |
243 | return view('admin.answers.index_ajax', compact('answers')); | 243 | return view('admin.answers.index_ajax', compact('answers')); |
244 | } else { | 244 | } else { |
245 | return view('admin.answers.index', compact('answers')); | 245 | return view('admin.answers.index', compact('answers')); |
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | // кабинет - статистика вакансий работодателя | 249 | // кабинет - статистика вакансий работодателя |
250 | public function static_ads(Request $request) { | 250 | public function static_ads(Request $request) { |
251 | $stat = Static_ad::with('ads'); | 251 | $stat = Static_ad::with('ads'); |
252 | $ads = Ad_employer::query()->active()->OrderBy('id')->get(); | 252 | $ads = Ad_employer::query()->active()->OrderBy('id')->get(); |
253 | $periods = Static_ad::query()->distinct('year_month')->select('year_month')->get(); | 253 | $periods = Static_ad::query()->distinct('year_month')->select('year_month')->get(); |
254 | if ($request->ajax()) { | 254 | if ($request->ajax()) { |
255 | if (isset($request->ad_employer_id)) | 255 | if (isset($request->ad_employer_id)) |
256 | if (!$request->ad_employer_id == "0") | 256 | if (!$request->ad_employer_id == "0") |
257 | $stat = $stat->Where('ad_employer_id', '=', $request->ad_employer_id); | 257 | $stat = $stat->Where('ad_employer_id', '=', $request->ad_employer_id); |
258 | if (isset($request->year_month)) { | 258 | if (isset($request->year_month)) { |
259 | if (!$request->year_month == "0") | 259 | if (!$request->year_month == "0") |
260 | $stat = $stat->Where('year_month', '=', $request->year_month); | 260 | $stat = $stat->Where('year_month', '=', $request->year_month); |
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | $stat = $stat->OrderByDesc('year_month'); | 264 | $stat = $stat->OrderByDesc('year_month'); |
265 | $stat = $stat->paginate(15); | 265 | $stat = $stat->paginate(15); |
266 | 266 | ||
267 | if ($request->ajax()) | 267 | if ($request->ajax()) |
268 | return view('admin.static.index_ads_ajax', compact('stat')); | 268 | return view('admin.static.index_ads_ajax', compact('stat')); |
269 | else | 269 | else |
270 | return view('admin.static.index_ads', compact('stat', 'ads', 'periods')); | 270 | return view('admin.static.index_ads', compact('stat', 'ads', 'periods')); |
271 | } | 271 | } |
272 | } | 272 | } |
273 | 273 |
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']?>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 | 83 | ||
84 | <div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800"> | 84 | <div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800"> |
85 | <div class="p-3 mr-4 text-orange-500 bg-orange-100 rounded-full dark:text-orange-100 dark:bg-orange-500"> | 85 | <div class="p-3 mr-4 text-orange-500 bg-orange-100 rounded-full dark:text-orange-100 dark:bg-orange-500"> |
86 | <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20"> | 86 | <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20"> |
87 | <path | 87 | <path |
88 | 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> | 88 | 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> |
89 | </svg> | 89 | </svg> |
90 | </div> | 90 | </div> |
91 | <div> | 91 | <div> |
92 | <p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400"> | 92 | <p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400"> |
93 | Опубликованых | 93 | Опубликованых |
94 | </p> | 94 | </p> |
95 | <p class="text-lg font-semibold text-gray-700 dark:text-gray-200"> | 95 | <p class="text-lg font-semibold text-gray-700 dark:text-gray-200"> |
96 | {{ $all_public }} | 96 | {{ $all_public }} |
97 | </p> | 97 | </p> |
98 | </div> | 98 | </div> |
99 | </div> | 99 | </div> |
100 | 100 | ||
101 | <div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800"> | 101 | <div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800"> |
102 | <div class="p-3 mr-4 text-orange-500 bg-orange-100 rounded-full dark:text-orange-100 dark:bg-orange-500"> | 102 | <div class="p-3 mr-4 text-orange-500 bg-orange-100 rounded-full dark:text-orange-100 dark:bg-orange-500"> |
103 | <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20"> | 103 | <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20"> |
104 | <path | 104 | <path |
105 | 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> | 105 | 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> |
106 | </svg> | 106 | </svg> |
107 | </div> | 107 | </div> |
108 | <div> | 108 | <div> |
109 | <p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400"> | 109 | <p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400"> |
110 | На рассмотрении | 110 | На рассмотрении |
111 | </p> | 111 | </p> |
112 | <p class="text-lg font-semibold text-gray-700 dark:text-gray-200"> | 112 | <p class="text-lg font-semibold text-gray-700 dark:text-gray-200"> |
113 | {{ $all_status }} | 113 | {{ $all_status }} |
114 | </p> | 114 | </p> |
115 | </div> | 115 | </div> |
116 | </div> | 116 | </div> |
117 | </div> | 117 | </div> |
118 | 118 | ||
119 | <div class="text-gray-700 dark:text-gray-400"> | 119 | <div class="text-gray-700 dark:text-gray-400"> |
120 | <p class="px-4 py-3">Количество: {{ $all_current }}</p> | 120 | <p class="px-4 py-3">Количество: {{ $all_current }}</p> |
121 | </div> | 121 | </div> |
122 | 122 | ||
123 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> | 123 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> |
124 | <div class="w-full overflow-x-auto"> | 124 | <div class="w-full overflow-x-auto"> |
125 | <table class="w-full whitespace-no-wrap"> | 125 | <table class="w-full whitespace-no-wrap"> |
126 | <thead> | 126 | <thead> |
127 | <tr | 127 | <tr |
128 | 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" | 128 | 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" |
129 | > | 129 | > |
130 | <th class="px-4 py-3">№</th> | 130 | <th class="px-4 py-3">№</th> |
131 | <th class="px-4 py-3">ID</th> | 131 | <th class="px-4 py-3">ID</th> |
132 | <th class="px-4 py-3">Лого</th> | 132 | <th class="px-4 py-3">Лого</th> |
133 | <th class="px-4 py-3">Компания/Email/Тел/Пароль</th> | 133 | <th class="px-4 py-3">Компания/Email/Тел/Пароль</th> |
134 | <th class="px-4 py-3">Категория</th> | 134 | <th class="px-4 py-3">Категория</th> |
135 | <th class="px-4 py-3">Коммент.</th> | 135 | <th class="px-4 py-3">Коммент.</th> |
136 | <th class="px-4 py-3">Дата регист.</th> | 136 | <th class="px-4 py-3">Дата регист.</th> |
137 | <th class="px-4 py-3">Редакт.</th> | 137 | <th class="px-4 py-3">Редакт.</th> |
138 | </tr> | 138 | </tr> |
139 | </thead> | 139 | </thead> |
140 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | 140 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> |
141 | @foreach($users as $user) | 141 | @foreach($users as $user) |
142 | <tr class="text-gray-700 dark:text-gray-400"> | 142 | <tr class="text-gray-700 dark:text-gray-400"> |
143 | <td class="px-4 py-3 text-xs"> | 143 | <td class="px-4 py-3 text-xs"> |
144 | {{$user->id}} | 144 | {{$user->id}} |
145 | </td> | 145 | </td> |
146 | <td class="px-4 py-3 text-xs"> | 146 | <td class="px-4 py-3 text-xs"> |
147 | @if (isset($user->code_id)) | 147 | @if (isset($user->code_id)) |
148 | {{$user->code_id}} | 148 | {{$user->code_id}} |
149 | @endif | 149 | @endif |
150 | </td> | 150 | </td> |
151 | <td class="px-4 py-3 text-xs"> | 151 | <td class="px-4 py-3 text-xs"> |
152 | @if (isset($user->emp_logo) && ($user->emp_logo)) | 152 | @if (isset($user->emp_logo) && ($user->emp_logo)) |
153 | <div class="flex items-center text-sm"> | 153 | <div class="flex items-center text-sm"> |
154 | <div | 154 | <div |
155 | class="relative hidden w-8 h-8 mr-3 rounded-full md:block" | 155 | class="relative hidden w-8 h-8 mr-3 rounded-full md:block" |
156 | > | 156 | > |
157 | <img | 157 | <img |
158 | class="object-cover w-full h-full rounded-full" | 158 | class="object-cover w-full h-full rounded-full" |
159 | src="{{ asset(Storage::url($user->emp_logo)) }}" | 159 | src="{{ asset(Storage::url($user->emp_logo)) }}" |
160 | alt="" | 160 | alt="" |
161 | loading="lazy" | 161 | loading="lazy" |
162 | /> | 162 | /> |
163 | <div | 163 | <div |
164 | class="absolute inset-0 rounded-full shadow-inner" | 164 | class="absolute inset-0 rounded-full shadow-inner" |
165 | aria-hidden="true" | 165 | aria-hidden="true" |
166 | ></div> | 166 | ></div> |
167 | </div> | 167 | </div> |
168 | </div> | 168 | </div> |
169 | @else | 169 | @else |
170 | - | 170 | - |
171 | @endif | 171 | @endif |
172 | </td> | 172 | </td> |
173 | 173 | ||
174 | <td class="px-4 py-3 text-xs"> | 174 | <td class="px-4 py-3 text-xs"> |
175 | <div class="flex items-center text-sm"> | 175 | <div class="flex items-center text-sm"> |
176 | <div> | 176 | <div> |
177 | @if (isset($user->name_company)) | ||
178 | <p class="font-semibold">{{$user->name_company}}</p> | ||
179 | @endif | ||
177 | <p class="font-semibold">{{$user->name}}</p> | 180 | <p class="font-semibold">{{$user->name}}</p> |
178 | <p class="font-semibold">{{ empty($user->employers->email) ? $user->email : $user->employers->email }}</p> | 181 | <p class="font-semibold">{{ empty($user->employers->email) ? $user->email : $user->employers->email }}</p> |
179 | <p class="text-xs text-gray-600 dark:text-gray-400"> | 182 | <p class="text-xs text-gray-600 dark:text-gray-400"> |
180 | {{ empty($user->employers->telephone) ? $user->telephone : $user->employers->telephone }} | 183 | {{ empty($user->employers->telephone) ? $user->telephone : $user->employers->telephone }} |
181 | </p> | 184 | </p> |
182 | <p class="text-xs text-gray-600 dark:text-gray-400"> | 185 | <p class="text-xs text-gray-600 dark:text-gray-400"> |
183 | @if (!empty($user->pubpassword)) | 186 | @if (!empty($user->pubpassword)) |
184 | {{ base64_decode($user->pubpassword) }} | 187 | {{ base64_decode($user->pubpassword) }} |
185 | @endif | 188 | @endif |
186 | </p> | 189 | </p> |
187 | </div> | 190 | </div> |
188 | </div> | 191 | </div> |
189 | 192 | ||
190 | </td> | 193 | </td> |
191 | <td class="px-4 py-3 text-xs"> | 194 | <td class="px-4 py-3 text-xs"> |
192 | {{ $user->category }} | 195 | {{ $user->category }} |
193 | </td> | 196 | </td> |
194 | <td class="px-4 py-3 text-xs"> | 197 | <td class="px-4 py-3 text-xs"> |
195 | @if (!empty($user->comment_admin)) | 198 | @if (!empty($user->comment_admin)) |
196 | 199 | ||
197 | <a style="text-decoration: underline;" href="{{ route('admin.comment-employer', ['employer' => $user->emp_id]) }}">Есть</a> | 200 | <a style="text-decoration: underline;" href="{{ route('admin.comment-employer', ['employer' => $user->emp_id]) }}">Есть</a> |
198 | @else | 201 | @else |
199 | Нет | 202 | Нет |
200 | @endif | 203 | @endif |
201 | </td> | 204 | </td> |
202 | <td class="px-4 py-3 text-xs"> | 205 | <td class="px-4 py-3 text-xs"> |
203 | {{ date('d.m.Y', strtotime($user->created_at)) }} | 206 | {{ date('d.m.Y', strtotime($user->created_at)) }} |
204 | </td> | 207 | </td> |
205 | <td class="px-4 py-3 text-xs"> | 208 | <td class="px-4 py-3 text-xs"> |
206 | @if (!empty($user->emp_id)) | 209 | @if (!empty($user->emp_id)) |
207 | <a href="{{ route('admin.employer-profile', ['employer' => $user->emp_id]) }}">Изменить</a> | 210 | <a href="{{ route('admin.employer-profile', ['employer' => $user->emp_id]) }}">Изменить</a> |
208 | @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> | 211 | @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> |
209 | @endif | 212 | @endif |
210 | @endif | 213 | @endif |
211 | </td> | 214 | </td> |
212 | <!--<td class="px-4 py-3 text-sm"> | 215 | <!--<td class="px-4 py-3 text-sm"> |
213 | @if ($user->usr_id > 1) | 216 | @if ($user->usr_id > 1) |
214 | <input type="checkbox" class="checkban" value="{{$user->usr_id}}" name="ban_{{$user->usr_id}}" {{ ($user->is_ban) ? "checked" : "" }}/> | 217 | <input type="checkbox" class="checkban" value="{{$user->usr_id}}" name="ban_{{$user->usr_id}}" {{ ($user->is_ban) ? "checked" : "" }}/> |
215 | @endif | 218 | @endif |
216 | </td>--> | 219 | </td>--> |
217 | </tr> | 220 | </tr> |
218 | @endforeach | 221 | @endforeach |
219 | </tbody> | 222 | </tbody> |
220 | </table> | 223 | </table> |
221 | </div> | 224 | </div> |
222 | 225 | ||
223 | <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"> | 226 | <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"> |
224 | <?=$users->appends($_GET)->links('admin.pagginate'); ?> | 227 | <?=$users->appends($_GET)->links('admin.pagginate'); ?> |
225 | </div> | 228 | </div> |
226 | </div> | 229 | </div> |
227 | @endsection | 230 | @endsection |
228 | 231 |