v1.1.0 - Washing machines and locations is on the same pages now, made bruger roles immortal so you cant delete it or edit it

This commit is contained in:
2020-09-10 10:39:07 +02:00
parent 1030bcc13f
commit e08a8aa509
4 changed files with 53 additions and 19 deletions
@@ -150,11 +150,6 @@
<div class="tooltip"><h3 class="text-white"><a href="{{ route('events.index') }}" class="text-white"><img src="{{asset("/images/icons/Aktiviteter.svg")}}" class="fa"><span style="margin-left: 4px;">Aktiviteter</span></a></h3><span class="tooltiptext">Aktiviteter</span></div>
</div>
@endif
@if(auth()->user()->can('locations.show'))
<div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "locations.index") active @endif">
<div class="tooltip"><h3 class="text-white"><a href="{{ route('locations.index') }}" class="text-white"><img src="{{asset("/images/icons/location.svg")}}" class="fa"><span style="margin-left: 4px;">Lokationer</span></a></h3><span class="tooltiptext">Lokationer</span></div>
</div>
@endif
@if(auth()->user()->can('washing.machine.show'))
<div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "washing-machines.index") active @endif">
<div class="tooltip"><h3 class="text-white"><a href="{{ route('washing-machines.index') }}" class="text-white"><img src="{{asset("/images/icons/wash.svg")}}" class="fa"><span style="margin-left: 4px;">Vaskemaskiner</span></a></h3><span class="tooltiptext">Vaskemaskiner</span></div>
@@ -14,6 +14,9 @@
@if(auth()->user()->can('washing.machine.create'))
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('washing-machines.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Vaskemaskine</a>
@endif
@if(auth()->user()->can('locations.create'))
<a class="btn btn-inline btn-sde-blue mb-0 ml-1" href="{{ route('locations.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Vaskemaskine lokation</a>
@endif
<div class="mt-1 ml-1">
<select name="risRosName" id="locationID">
<option selected="selected" name="all" value="all">Alle</option>
@@ -23,7 +26,9 @@
</select> <label>Vælg bygning</label>
</div>
</div>
<table class="tbl mt-2">
<div id="searchWashingMachine" class="mt-2">
<label>Vaskemaskiner</label>
<table id="washingSearch" class="tbl">
<tr>
<th>Navn</th>
<th>Lokation</th>
@@ -53,8 +58,43 @@
</tr>
@endforeach
</table>
</div>
<div id="locations" class="mt-2">
<label>Vaskemaskine lokation</label>
<table class="tbl">
<tr>
<th>Navn</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/eye.svg') }}" alt="Show"></th>
@if(auth()->user()->can('locations.edit'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
@endif
@if(auth()->user()->can('locations.delete'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
@endif
</tr>
@foreach(\App\Location::query()->get() as $location)
<tr>
<td>{{$location->name}}</td>
<td><a href="{{ route("locations.show", [ "location" => $location ]) }}"><img class="w-100" src="{{ asset('/images/icons/eye-dark.svg') }}" alt="Show"></a></td>
@if(auth()->user()->can('locations.edit'))
<td><a href="{{ route("locations.edit", [ "location" => $location ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@endif
@if(auth()->user()->can('locations.delete'))
<td><form method="post" action="{{ route("locations.destroy", [ "location" => $location ]) }}" class="w-100 nostyle">
@csrf
@method("delete")
<button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td>
@endif
</tr>
@endforeach
</table>
{{ $machines->links() }}
</div>
{{ $machines->links() }}
<script>
$('#locationID').change(function () {
@@ -65,8 +105,7 @@
url: '{{route('washing-machines.search')}}',
data: {'option':$value},
success:function (data) {
console.log($value);
$('tbody').html(data);
$('#washingSearch').html(data);
},
error:function (data) {
console.log(data);