This commit is contained in:
frederikpyt 2020-06-25 14:24:08 +02:00
commit 3976d37af2
18 changed files with 188 additions and 152 deletions

View File

@ -1,10 +0,0 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Booking extends Model
{
//
}

View File

@ -1,100 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Booking;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class BookingController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$booking = Booking::query()->paginate($request->input("limit", 20));
return Response::detect("bookings.index", [ "bookings" => $booking]);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return Response::detect("bookings.create");
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$requestBooking = $request->validate([
"name_first" => "required|max:255",
"name_last" => "required|max:255",
"phone" => "required|unique:users",
"machine_choice" => "required|max:255",
]);
$booking = new Booking($requestBooking);
$booking->save();
return Response::detect("bookings.store");
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
return Response::detect("bookings.show", [ "bookings" => $id]);
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}

View File

@ -19,7 +19,7 @@ class WashingReservationController extends Controller
{
$reservations = WashingReservation::query()->paginate($request->query("page", 1));
return Response::detect("washing-reservation.index");
return Response::detect("washing-reservations.index", [ "reservations" => $reservations]);
}
/**
@ -29,7 +29,7 @@ class WashingReservationController extends Controller
*/
public function create()
{
return Response::detect("washing-reservation.create");
return Response::detect("washing-reservations.create");
}
/**
@ -47,7 +47,7 @@ class WashingReservationController extends Controller
$machineReservation = new WashingReservation($data);
$machineReservation->save();
return Response::detect("washing-reservation.store");
return Response::detect("washing-reservations.store");
}
/**
@ -60,7 +60,7 @@ class WashingReservationController extends Controller
{
$machineReservation = WashingReservation::find($id);
return Response::detect("washing-reservation.show", [
return Response::detect("washing-reservations.show", [
"machineReservation" => $machineReservation
]);
}
@ -73,7 +73,7 @@ class WashingReservationController extends Controller
*/
public function edit($id)
{
return Response::detect("washing-reservation.edit");
return Response::detect("washing-reservations.edit");
}
/**
@ -95,7 +95,7 @@ class WashingReservationController extends Controller
$machineReservation->save();
return Response::detect("washing-reservation.edit", [
return Response::detect("washing-reservations.edit", [
"washingReservation" => $machineReservation
]);
}
@ -111,6 +111,6 @@ class WashingReservationController extends Controller
$machineReservation = WashingReservation::find($id);
$machineReservation->delete();
return Response::detect("washing-reservation.delete");
return Response::detect("washing-reservations.delete");
}
}

View File

@ -31,10 +31,10 @@
<div class="segment">
<h3 class="text-white">Booking</h3>
<div class="row">
<a href="{{ route("bookings.index") }}" class="text-white"><img src="{{ asset('/images/icons/eye.svg') }}" alt="Read">Vis Bookings</a>
<a href="{{ route("washing-reservations.index") }}" class="text-white"><img src="{{ asset('/images/icons/eye.svg') }}" alt="Read">Vis Bookings</a>
</div>
<div class="row">
<a href="{{ route('bookings.create') }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Booking</a>
<a href="{{ route('washing-reservations.create') }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Booking</a>
</div>
</div>
<div class="segment">

View File

@ -6,7 +6,7 @@
@endsection
@section("path")
<a href="{{ route('menuplans.delete') }}" class="text-white">Fjern Menuplan</a> /
<a href="{{ route('menu-plans.delete') }}" class="text-white">Fjern Menuplan</a> /
@endsection
@section("content")

View File

@ -6,7 +6,7 @@
@endsection
@section("path")
<a href="{{ route('menuplans.edit') }}" class="text-white">Rediger Menuplan</a> /
<a href="{{ route('menu-plans.edit') }}" class="text-white">Rediger Menuplan</a> /
@endsection
@section("content")

View File

@ -2,11 +2,11 @@
@extends("admin.layout.header")
@section("title")
Menuplan - Read
Menuplan - Vis
@endsection
@section("path")
<a href="{{ route('menuplans.show') }}" class="text-white">Vis Menuplan</a> /
<a href="{{ route('menu-plans.show') }}" class="text-white">Vis Menuplan</a> /
@endsection
@section("content")

View File

@ -2,32 +2,13 @@
@extends("admin.layout.header")
@section("title")
Vaskemaskiner - Vis
Vaskemaskiner - Opret
@endsection
@section("path")
<a href="" class="text-white">Vis Vaskemaskiner</a> /
<a href="" class="text-white">Opret Vaskemaskiner</a> /
@endsection
@section("content")
<table class="tbl">
<tr>
<th>ID</th>
<th>Fornavn</th>
<th>Efternavn</th>
<th>Email</th>
<th>Tlf nr</th>
<th style="width: 1px;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
<th style="width: 1px;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
</tr>
<tr>
<td>{ID}</td>
<td>{Fornavn}</td>
<td>{Efternavn}</td>
<td>{Email}</td>
<td>{TLF}</td>
<td><a href=""><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
<td><a href=""><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a></td>
</tr>
</table>
Vaskemaskinen blev (ikke) oprettet.
@endsection

View File

@ -13,7 +13,7 @@
{{--@extends("app.vagttelefons.index")--}}
{{--Booking Liste--}}
{{--@extends("app.bookings.index")--}}
{{--@extends("app.washing-reservations.index")--}}
{{--Menuplan--}}
{{--@extends("app.menuplans.index")--}}
@ -44,10 +44,10 @@
{{--@extends("admin.menuplans.update")--}}
{{--Create booking--}}
{{--@extends("admin.bookings.create")--}}
{{--@extends("admin.washing-reservations.create")--}}
{{--Read booking--}}
{{--@extends("admin.bookings.show")--}}
{{--@extends("admin.washing-reservations.show")--}}
{{--Create washing-machine--}}
{{--@extends("admin.washing-machines.create")--}}

View File

@ -0,0 +1,27 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Booking - Opret
@endsection
@section("path")
<a href="{{ route('washing-reservations.create') }}" class="text-white">Opret Booking</a> /
@endsection
@section("content")
<h1>Opret Booking:</h1>
<form method="post" action="{{ route("washing-reservations.store") }}">
@csrf
<label for="name_first">Fornavn:</label>
<input type="text" name="name_first" id="name_first" required>
<label for="name_last">Efternavn:</label>
<input type="text" name="name_last" id="name_last" required>
<label for="tel">Telefon nr:</label>
<input type="tel" name="phone" id="tel" required>
<select name="machine_choice">
<option>Vaskemaskine 1</option>
</select>
<input type="submit" class="btn btn-dark text-white" value="Opret">
</form>
@endsection

View File

@ -0,0 +1,13 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Booking - Fjern
@endsection
@section("path")
<a href="" class="text-white">Fjern Booking</a> /
@endsection
@section("content")
@endsection

View File

@ -0,0 +1,28 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Booking - Rediger
@endsection
@section("path")
<a href="{{ route('washing-reservations.edit', ['id' => $reservations->id]) }}" class="text-white">Rediger Booking</a> /
@endsection
@section("content")
<h1>Rediger Booking:</h1>
<form method="post" action="">
@csrf
<label for="name_first">Fornavn:</label>
<input type="text" name="name_first" id="name_first" value="{Fornavn}" required>
<label for="name_last">Efternavn:</label>
<input type="text" name="name_last" id="name_last" value="{Efternavn}" required>
<input type="password" id="password2" value="{Password}" required>
<label for="tel">Telefon nr:</label>
<input type="tel" name="phone" id="tel" value="{Telefon}" required>
<select>
<option>Vaskemaskine 1</option>
</select>
<input type="submit" class="btn btn-dark text-white" value="Rediger">
</form>
@endsection

View File

@ -0,0 +1,37 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Booking - Vis
@endsection
@section("path")
<a href="{{ route('washing-reservations.index') }}" class="text-white">Vis Booking</a> /
@endsection
@section("content")
<table class="tbl">
<tr>
<th>ID</th>
<th>Fornavn</th>
<th>Efternavn</th>
<th>Tlf nr</th>
<th>Vaskemaskine</th>
<th style="width: 1px;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
<th style="width: 1px;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
</tr>
@foreach($reservations as $reservation)
<tr>
<td>{ID}</td>
<td>{Fornavn}</td>
<td>{Efternavn}</td>
<td>{Tlf Nr}</td>
<td>{Vaskemaskine Nr.}</td>
<td><a href=""><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
<td><a href=""><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a></td>
</tr>
@endforeach
</table>
{{ $reservations->links() }}
@endsection

View File

@ -0,0 +1,33 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Booking - Vis
@endsection
@section("path")
<a href="{{ route('washing-reservations.index') }}" class="text-white">Vis Booking</a> /
@endsection
@section("content")
<table class="tbl">
<tr>
<th>ID</th>
<th>Fornavn</th>
<th>Efternavn</th>
<th>Telefon Nr.</th>
<th>Vaskemaskine</th>
<th style="width: 1px;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
<th style="width: 1px;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
</tr>
<tr>
<th>ID</th>
<th>Fornavn</th>
<th>Efternavn</th>
<th>Telefon Nr.</th>
<th>Vaskemaskine</th>
<th style="width: 1px;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
<th style="width: 1px;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
</tr>
</table>
@endsection

View File

@ -0,0 +1,14 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Booking - Opret
@endsection
@section("path")
<a href="{{ route('washing-reservations.create') }}" class="text-white">Opret Booking</a> /
@endsection
@section("content")
Booking blev (ikke) oprettet.
@endsection

View File

@ -0,0 +1,14 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Booking - Rediger
@endsection
@section("path")
<a href="{{ route('washing-reservations.edit') }}" class="text-white">Rediger Booking</a> /
@endsection
@section("content")
Din booking blev (ikke) redigeret.
@endsection

View File

@ -16,7 +16,7 @@
{{--@extends("app.vagttelefons.index")--}}
{{--Booking Liste--}}
{{--@extends("app.bookings.index")--}}
{{--@extends("app.washing-reservations.index")--}}
{{--Menuplan--}}
{{--@extends("app.menuplans.index")--}}
@ -47,10 +47,10 @@
{{--@extends("admin.menuplans.update")--}}
{{--Create booking--}}
{{--@extends("admin.bookings.create")--}}
{{--@extends("admin.washing-reservations.create")--}}
{{--Read booking--}}
{{--@extends("admin.bookings.show")--}}
{{--@extends("admin.washing-reservations.show")--}}
{{--Create washing-machine--}}
{{--@extends("admin.washing-machines.create")--}}

View File

@ -32,4 +32,3 @@ Route::resource("washing-machines", "WashingMachineController");
Route::resource("washing-reservations", "WashingReservationController");
Route::resource("feedbacks", "FeedbackController");
Route::resource("external-links", "ExternalLinkController");
Route::resource("bookings", "BookingController");