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/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 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