From 26086d441a016c01d10ec5a0ffd451a247f1348d Mon Sep 17 00:00:00 2001 From: Lupu Gheorghe Date: Wed, 4 May 2022 13:36:09 +0300 Subject: [PATCH 1/2] fix navbar for admin user --- app/Services/UserService.php | 6 ++++++ resources/views/layouts/partials/sidebars/admin.blade.php | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/Services/UserService.php b/app/Services/UserService.php index e8701ce6..14b1a516 100644 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -150,6 +150,12 @@ public function generateResetTokenAndNotifyUser(User $user): void public static function getChildrenUsers(): array { if (Auth::check()) { + if (\auth()->user()->isAdministrator()) + { + return User::orderBy('name', 'ASC') + ->get() + ->toArray(); + } return User::where('created_by', auth()->user()->id) ->orderBy('name', 'ASC') ->get() diff --git a/resources/views/layouts/partials/sidebars/admin.blade.php b/resources/views/layouts/partials/sidebars/admin.blade.php index db72fe9d..fb8ea949 100644 --- a/resources/views/layouts/partials/sidebars/admin.blade.php +++ b/resources/views/layouts/partials/sidebars/admin.blade.php @@ -11,6 +11,9 @@ Neaprobate + + Adauga cazare + Solicitări cazări @@ -18,7 +21,9 @@ Ultima zi de cazare - + + {{__('Add help request')}} + Utilizatori From 1143192ea3b11871a2737e3336774f2b6d429120 Mon Sep 17 00:00:00 2001 From: Lupu Gheorghe Date: Wed, 11 May 2022 14:03:06 +0300 Subject: [PATCH 2/2] add fixes --- app/Http/Controllers/ShareController.php | 12 +++++------- resources/views/share/help-request-add.blade.php | 2 ++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/ShareController.php b/app/Http/Controllers/ShareController.php index 6d5c5e91..53119f9c 100644 --- a/app/Http/Controllers/ShareController.php +++ b/app/Http/Controllers/ShareController.php @@ -109,15 +109,13 @@ public function helpRequestDetail($id) public function helpRequestCreate(Request $request, SettingRepository $settingRepository) { $user = null; - if (session()->get('createdRefugeeUserId')) + if (session()->get('createdUserId')) { - $user = User::find(session()->get('createdRefugeeUserId')); + $user = User::find(session()->get('createdUserId')); } $languages = Language::orderBy('position', 'asc')->orderBy('name', 'asc')->select('id', 'endonym')->get(); - $lang = App::getLocale() == 'ro' ? 'en' : App::getLocale(); - $counties = UaRegion::all(['id', 'region', 'region_' . $lang . ' as region'])->sortBy('region_' . $lang); - + $counties = County::all(); return view('share.help-request-add') ->with('description', $settingRepository->byKey('request_services_description') ?? '') @@ -130,9 +128,9 @@ public function helpRequestCreate(Request $request, SettingRepository $settingRe public function helpRequestStore(Request $request) { - if (session()->get('createdRefugeeUserId')) + if (session()->get('createdUserId')) { - $sessionUserId = session()->pull('createdRefugeeUserId'); + $sessionUserId = session()->pull('createdUserId'); $user = User::find($sessionUserId); (new HelpRequestService())->create($request, $user, auth()->user()); session()->flash('success',__('Help request created successfully')); diff --git a/resources/views/share/help-request-add.blade.php b/resources/views/share/help-request-add.blade.php index a079c007..0b89a3bf 100644 --- a/resources/views/share/help-request-add.blade.php +++ b/resources/views/share/help-request-add.blade.php @@ -7,10 +7,12 @@ @include('share.partials.select-user') @include('share.partials.add-user-help-request-modal') + @if(session()->get('createdUserId')) @include('partials.forms.request-services-step3', [ 'description' => $description, 'info' => $info, 'languages' => $languages, 'formRoute' => route('share.help.request.store') ]) + @endif @endsection