diff --git a/app/Http/Controllers/Admin/EmployersController.php b/app/Http/Controllers/Admin/EmployersController.php index d407b63..b75c168 100644 --- a/app/Http/Controllers/Admin/EmployersController.php +++ b/app/Http/Controllers/Admin/EmployersController.php @@ -9,6 +9,7 @@ use App\Models\Employer; use App\Models\Static_ad; use App\Models\User; use Illuminate\Http\Request; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Validator; @@ -21,7 +22,7 @@ class EmployersController extends Controller $user->update($request->all()); } - $users = User::where('is_worker', '0'); + /*$users = User::with('employers')->where('is_worker', '0'); $find_key = ""; if (isset($request->find)) { $find_key = $request->find; @@ -30,8 +31,23 @@ class EmployersController extends Controller ->orWhere('email', 'LIKE', "%$find_key%") ->orWhere('telephone', 'LIKE', "%$find_key%"); }); + }*/ + + $users = User::select(['users.*', 'emp.id as emp_id', 'emp.*'])->join('employers as emp','emp.user_id','users.id') + ->where('users.is_worker', '0'); + $find_key = ""; + if (isset($request->find)) { + $find_key = $request->find; + $users = $users->where(function($query) use($find_key) { + $query->Where('users.name', 'LIKE', "%$find_key%") + ->orWhere('emp.email', 'LIKE', "%$find_key%") + ->orWhere('emp.telephone', 'LIKE', "%$find_key%"); + }); } + + //DB::enableQueryLog(); $users = $users->paginate(15); + //dd(DB::getQueryLog()); if ($request->ajax()) { return view('admin.employer.index_ajax', compact('users')); @@ -52,6 +68,10 @@ class EmployersController extends Controller unset($params['email']); unset($params['address']); unset($params['site']); + unset($params['status_hidden']); + unset($params['oficial_status']); + unset($params['social_is']); + unset($params['sending_is']); $rules = [ 'name' => 'required|string|max:255', @@ -85,6 +105,10 @@ class EmployersController extends Controller $employer->address = $request->address; $employer->site = $request->site; $employer->text = $request->text; + $employer->status_hidden = $request->status_hidden; + $employer->oficial_status = $request->oficial_status; + $employer->social_is = $request->social_is; + $employer->sending_is = $request->sending_is; if ($request->has('logo')) { if (!empty($employer->logo)) { diff --git a/public/assets/css/tabs.css b/public/assets/css/tabs.css new file mode 100644 index 0000000..ebd683f --- /dev/null +++ b/public/assets/css/tabs.css @@ -0,0 +1,47 @@ +.tabs { + font-size: 0; +} + +.tabs>input[type="radio"] { + display: none; +} + +.tabs>div { + /* скрыть контент по умолчанию */ + display: none; + border: 1px solid #e0e0e0; + padding: 10px 15px; + font-size: 16px; +} + +/* отобразить контент, связанный с вабранной радиокнопкой (input type="radio") */ +#tab-btn-1:checked~#content-1, +#tab-btn-2:checked~#content-2, +#tab-btn-3:checked~#content-3 { + display: block; +} + +.tabs>label { + display: inline-block; + text-align: center; + vertical-align: middle; + user-select: none; + background-color: #f5f5f5; + border: 1px solid #e0e0e0; + padding: 2px 8px; + font-size: 16px; + line-height: 1.5; + transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out; + cursor: pointer; + position: relative; + top: 1px; +} + +.tabs>label:not(:first-of-type) { + border-left: none; +} + +.tabs>input[type="radio"]:checked+label { + background-color: #fff; + border-bottom: 1px solid #fff; +} diff --git a/resources/views/admin/employer/edit.blade.php b/resources/views/admin/employer/edit.blade.php index 0504525..d3c7eaf 100644 --- a/resources/views/admin/employer/edit.blade.php +++ b/resources/views/admin/employer/edit.blade.php @@ -5,143 +5,195 @@ Работодатель-пользователь: "{{$employer->users->name_man}} ({{$employer->user_id}})"