v0.5.3 - Added Locations and a location_id to washing machines

This commit is contained in:
frederikpyt
2020-08-06 08:37:16 +02:00
parent 9b631843b0
commit 5452711665
22 changed files with 424 additions and 40 deletions
@@ -23,6 +23,9 @@
<div class="segment">
<h3 class="text-white"><a href="{{ route("events.index") }}" class="text-white"><i class="fa fa-link"></i><span style="margin-left: 4px;">Aktiviteter</span></a></h3>
</div>
<div class="segment">
<h3 class="text-white"><a href="{{ route("locations.index") }}" class="text-white"><i class="fa fa-link"></i><span style="margin-left: 4px;">Lokationer</span></a></h3>
</div>
<div class="segment">
<h3 class="text-white"><a href="{{ route("washing-machines.index") }}" class="text-white"><i class="fa fa-link"></i><span style="margin-left: 4px;">Vaskemaskiner</span></a></h3>
</div>
@@ -0,0 +1,20 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Opret Lokation
@endsection
@section("path")
<a href="{{ route('locations.create') }}" class="text-white">Opret Lokation</a> /
@endsection
@section("content")
<h1>Opret Lokation</h1>
<form method="post" action="{{ route("locations.store") }}">
@csrf
<label for="name">Lokationsnavn:</label>
<input type="text" name="name" id="name" placeholder="Bygning A" required>
<input type="submit" class="btn btn-dark text-white" value="Opret">
</form>
@endsection
@@ -0,0 +1,13 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Vejledning - Fjern
@endsection
@section("path")
<a href="{{ route('guides.delete') }}" class="text-white">Fjern Guide</a> /
@endsection
@section("content")
@endsection
@@ -0,0 +1,21 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Lokation - Rediger
@endsection
@section("path")
<a href="{{route('locations.edit', ['location' => $location ])}}" class="text-white">Rediger lokation</a> /
@endsection
@section("content")
<h1>Rediger Lokation</h1>
<form method="post" action="{{ route("locations.update", ['location' => $location ]) }}">
@csrf
@method("put")
<label for="name">Lokationsnavn:</label>
<input type="text" name="name" id="name" value="{{ $location->name }}" required>
<input type="submit" class="btn btn-dark text-white" value="Rediger">
</form>
@endsection
@@ -0,0 +1,38 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Vis Lokationer
@endsection
@section("path")
<a href="{{ route('locations.index') }}" class="text-white">Vis lokationer</a> /
@endsection
@section("content")
<div class="row align-items-center">
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('locations.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Lokation</a>
</div>
<table class="tbl mt-2">
<tr>
<th>Navn</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
</tr>
@foreach($locations as $location)
<tr>
<td>{{$location->name}}</td>
<td><a href="{{ route("locations.edit", [ "location" => $location ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
<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>
</tr>
@endforeach
</table>
{{ $locations->links() }}
@endsection
@@ -0,0 +1,14 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Vejledning - Opret
@endsection
@section("path")
<a href="{{ route('guides.create') }}" class="text-white">Opret vejledning</a> /
@endsection
@section("content")
vejledning blev (ikke) oprettet.
@endsection
@@ -0,0 +1,14 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Vejledning - Rediger
@endsection
@section("path")
<a href="{{ route('guides.edit', ["guide" => $link]) }}" class="text-white">Vejledning</a> /
@endsection
@section("content")
Din vejledning blev (ikke) redigeret.
@endsection
@@ -56,8 +56,7 @@
<option {{ $selected }} value="{{ $role->name }}">{{ $role->name }}</option>
@endforeach
@endif
</select>
</select>
<input type="submit" class="btn btn-dark text-white" value="Rediger">
</form>
@endsection
@@ -15,6 +15,17 @@
@csrf
<label for="name_first">Vaskemaskine Navn:</label>
<input type="text" name="name" id="name" max="60" placeholder="Vaskemaskine nr. 1" required>
<label for="location_id">Lokation:</label>
<select name="location_id" id="location_id" class="mb-2" required>
<option disabled selected value> -- Vælg Lokation -- </option>
@if(count($locations) > 0)
@foreach($locations as $location)
<option value="{{ $location->id }}">{{ $location->name }}</option>
@endforeach
@else
<option disabled> Der er ingen lokationer oprettet!</option>
@endif
</select>
<input type="submit" class="btn btn-dark text-white" value="Opret">
</form>
@endsection
@@ -15,6 +15,16 @@
@method("put")
<label for="name_first">Vaskemaskine Navn:</label>
<input type="text" name="name" id="name" max="60" value="{{$machine->name}}" required>
<select class="w-100" name="location_id" id="location_id" class="mb-2" required>
<option disabled> -- Vælg Lokation -- </option>
@foreach($locations as $location)
{{ $selected = "" }}
@if($machine->location_id == $location->id)
{{ $selected = "selected" }}
@endif
<option {{ $selected }} value="{{ $location->id }}">{{ $location->name }}</option>
@endforeach
</select>
<input type="submit" class="btn btn-dark text-white" value="Rediger">
</form>
@endsection
@@ -17,12 +17,14 @@
<table class="tbl mt-2">
<tr>
<th>Navn</th>
<th>Lokation</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
</tr>
@foreach($machines as $machine)
<tr>
<td>{{$machine->name}}</td>
<td>{{\App\Location::query()->where("id", "=", $machine->location_id)->first()->name}}</td>
<td><a href="{{ route('washing-machines.edit', [ 'washing_machine' => $machine ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
<td><form method="post" action="{{ route('washing-machines.destroy', [ 'washing_machine' => $machine ]) }}" class="w-100 nostyle">
@csrf