Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/navbar user #271

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions app/Http/Controllers/ShareController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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') ?? '')
Expand All @@ -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'));
Expand Down
6 changes: 6 additions & 0 deletions app/Services/UserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 6 additions & 1 deletion resources/views/layouts/partials/sidebars/admin.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@
<a href="{{ route('admin.accommodation-list', ['status' => 2]) }}" class="list-group-item list-group-item-action sub-list ">
<i class="fa fa-minus mx-3"></i>Neaprobate
</a>
<a href="{{ route('share.accommodation.create', ['status' => 1]) }}" class="list-group-item list-group-item-action sub-list ">
<i class="fa fa-minus mx-3"></i>Adauga cazare
</a>
<a href="{{ route('admin.help.request.list') }}" class="list-group-item list-group-item-action ">
<img src="/images/hand-icon.svg" class="mr-3">Solicitări cazări
</a>

<a href="{{ route('admin.allocation.list') }}" class="list-group-item list-group-item-action sub-list ">
<i class="fa fa-minus mx-3"></i>Ultima zi de cazare
</a>

<a href="{{ route('share.help.request.create', ['status' => 1]) }}" class="list-group-item list-group-item-action sub-list ">
<i class="fa fa-minus mx-3"></i>{{__('Add help request')}}
</a>

<a href="{{ route('admin.user-list') }}" class="list-group-item list-group-item-action ">
<i class="fa fa-users mr-3"></i>Utilizatori
Expand Down
2 changes: 2 additions & 0 deletions resources/views/share/help-request-add.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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