Merge branch 'master' of https://github.com/sebathefox/skolehjem-webapp
This commit is contained in:
commit
666e8cb7f3
|
@ -305,18 +305,72 @@ class UserController extends Controller
|
||||||
$users = User::query()->where('phone', 'LIKE',$request->search.'%')->get();
|
$users = User::query()->where('phone', 'LIKE',$request->search.'%')->get();
|
||||||
elseif ($request->isCheck === "telefon")
|
elseif ($request->isCheck === "telefon")
|
||||||
$users = User::query()->where('phone', 'LIKE',$request->search.'%')->get();
|
$users = User::query()->where('phone', 'LIKE',$request->search.'%')->get();
|
||||||
elseif ($request->isCheck)
|
elseif ($request->isCheck) {
|
||||||
$users = User::query()->where('Roles', 'LIKE',$request->search.'%')->with(Role::class)->get();
|
$roles = Role::query()->where('name', 'LIKE', $request->search . '%')->get();
|
||||||
else
|
$usersTEMP = User::all();
|
||||||
$users = User::query()
|
$users = [];
|
||||||
->where('name_first', 'LIKE',$request->search.'%')
|
|
||||||
->orWhere('name_last','LIKE', $request->search.'%')
|
|
||||||
->orWhere('phone','LIKE', $request->search.'%')
|
|
||||||
->orWhere('email','LIKE',$request->search. '%')
|
|
||||||
->orWhere('name','LIKE',$request->search. '%')
|
|
||||||
->orWhere('roles','LIKE',$request->search. '%')
|
|
||||||
->get();
|
|
||||||
|
|
||||||
|
foreach ($usersTEMP as $user) {
|
||||||
|
foreach ($roles as $role) {
|
||||||
|
if($user->hasRole($role)) {
|
||||||
|
array_push($users, $user);
|
||||||
|
break 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($request->search == "")
|
||||||
|
$users = User::all();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$usersTEMP = User::query()
|
||||||
|
->where('name_first', 'LIKE', $request->search . '%')
|
||||||
|
->orWhere('name_last', 'LIKE', $request->search . '%')
|
||||||
|
->orWhere('phone', 'LIKE', $request->search . '%')
|
||||||
|
->orWhere('email', 'LIKE', $request->search . '%')
|
||||||
|
->orWhere('name', 'LIKE', $request->search . '%')
|
||||||
|
->get();
|
||||||
|
$roles = Role::query()->where('name', 'LIKE', $request->search . '%')->get();
|
||||||
|
|
||||||
|
$users = [];
|
||||||
|
|
||||||
|
$allUsers = User::all();
|
||||||
|
|
||||||
|
//For hver user i systemet, check om han har en af de roller der matcher søgeordet
|
||||||
|
foreach ($allUsers as $user) {
|
||||||
|
foreach ($roles as $role) {
|
||||||
|
if($user->hasRole($role)) {
|
||||||
|
array_push($users, $user);
|
||||||
|
break 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//For hver user der har data, der matcher søgeordet, check om useren allerede er i resultatet, hvis ikke så tilføj ham
|
||||||
|
foreach ($usersTEMP as $userTEMP){
|
||||||
|
$isInUsers = false;
|
||||||
|
foreach ($users as $user) {
|
||||||
|
if($userTEMP == $user) {
|
||||||
|
$isInUsers = true;
|
||||||
|
break 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($isInUsers == false)
|
||||||
|
array_push($users, $userTEMP);
|
||||||
|
}
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
foreach ($users as $user){
|
||||||
|
$i++;
|
||||||
|
foreach ($users as $userr){
|
||||||
|
if($user->id == $userr->id) {
|
||||||
|
unset($users[$i]);
|
||||||
|
break 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -351,7 +405,7 @@ class UserController extends Controller
|
||||||
'<td>' . $user->name_last . '</td>'.
|
'<td>' . $user->name_last . '</td>'.
|
||||||
'<td>' . $user->email . '</td>'.
|
'<td>' . $user->email . '</td>'.
|
||||||
'<td>' . $user->phone .'</td>'.
|
'<td>' . $user->phone .'</td>'.
|
||||||
'<td>' . $user->name .'</td>'.
|
'<td>' . $rolesString .'</td>'.
|
||||||
'<td><a href="'. route("users.edit", [ "user" => $user->id ]) . '"><img class="w-100" src="'. asset('/images/icons/pencil-dark.svg') . '" alt="Update"></a></td>'.
|
'<td><a href="'. route("users.edit", [ "user" => $user->id ]) . '"><img class="w-100" src="'. asset('/images/icons/pencil-dark.svg') . '" alt="Update"></a></td>'.
|
||||||
'<td><form method="post" action="' .route("users.destroy", [ "user" => $user->id ]). '" class="w-100 nostyle">'.
|
'<td><form method="post" action="' .route("users.destroy", [ "user" => $user->id ]). '" class="w-100 nostyle">'.
|
||||||
csrf_field().
|
csrf_field().
|
||||||
|
|
|
@ -341,6 +341,7 @@ a {
|
||||||
|
|
||||||
.links {
|
.links {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
align-self: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
bottom: 8px;
|
bottom: 8px;
|
||||||
height: 2rem;
|
height: 2rem;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<h3 class="sde-blue bold text-center mb-0">{{$userevent->name}}</h3>
|
<h3 class="sde-blue bold text-center mb-0">{{$userevent->name}}</h3>
|
||||||
<p class="text-center mt-0">{{$userevent->date}}</p>
|
<p class="text-center mt-0">{{$userevent->date}}</p>
|
||||||
<p class="text-center">{{$userevent->description}}</p>
|
<p class="text-center">{{$userevent->description}}</p>
|
||||||
<button type="submit" class="btn text-center btn-sde-blue" id="tilmeld">Afmeld</button>
|
<button type="submit" class="btn text-center btn-sde-blue" onclick="return confirm('Are you sure you want to remove this reservation?');">Afmeld</button>
|
||||||
</form>
|
</form>
|
||||||
@endforeach
|
@endforeach
|
||||||
@else
|
@else
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
Konto
|
Konto
|
||||||
</a>
|
</a>
|
||||||
<a href="{{ route('users.logout') }}">
|
<a href="{{ route('users.logout') }}">
|
||||||
<img src="{{URL::asset('/images/icons/Logout.svg')}}" alt="Menuplan">
|
<img src="{{URL::asset('/images/icons/Logout.svg')}}" alt="Logud">
|
||||||
Log Ud
|
Log Ud
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
<div class="d-flex col block-container mt-2">
|
<div class="d-flex col block-container mt-2">
|
||||||
<a href="{{ route('menu-plans.index') }}" class="block text-center mb-1">Menuplan</a>
|
<a href="{{ route('menu-plans.index') }}" class="block text-center mb-1">Menuplan</a>
|
||||||
<a href="{{ route('events.index') }}" class="block text-center mb-1">Aktiviteter</a>
|
<a href="{{ route('events.index') }}" class="block text-center mb-1">Aktiviteter</a>
|
||||||
<a href="{{ route('washing-reservations.index') }}" class="block text-center mb-1">Vaskemaskine Reservationer</a>
|
<a href="{{ route('washing-reservations.index') }}" class="block text-center mb-1">Reservationer</a>
|
||||||
|
<a href="{{ route('contacts.index') }}" class="block text-center mb-1">Kontoret</a>
|
||||||
|
<a href="{{ route('phones.index') }}" class="block text-center mb-1">Vagttelefon</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="links row">
|
<div class="links row">
|
||||||
<a href="https://www.facebook.com" target="_blank" class="link">
|
<a href="https://www.facebook.com" target="_blank" class="link">
|
||||||
|
|
Loading…
Reference in New Issue