From d15f406059bdef8f941f8a90ed87b04afadb2d8b Mon Sep 17 00:00:00 2001 From: Anders Date: Tue, 4 Aug 2020 15:09:10 +0200 Subject: [PATCH 1/3] Fail message when making a reservation with taken machine and time --- .../Controllers/WashingReservationController.php | 12 +++++------- .../views/app/washing-reservations/create.blade.php | 1 + 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/skolehjem/app/Http/Controllers/WashingReservationController.php b/skolehjem/app/Http/Controllers/WashingReservationController.php index 38d1d56..47954f1 100644 --- a/skolehjem/app/Http/Controllers/WashingReservationController.php +++ b/skolehjem/app/Http/Controllers/WashingReservationController.php @@ -67,15 +67,13 @@ class WashingReservationController extends Controller $machineReservation = new WashingReservation($data); $machineReservation->user_id = auth()->user()->id; - $machineReservation->save(); - $saved = $machineReservation->save(); + $allMachineReservations = WashingReservation::query()->where('time', '=', $request->time)->where('machine_id', '=', $request->machine_id)->get(); - if (!$saved) { - return Response::detect("washing-reservations.store", [ - "washing_reservation" => $machineReservation - ]); + if (count($allMachineReservations) > 0) { + return redirect()->route("washing-reservations.create", ["washing_reservation" => $machineReservation])->with('ReservationExists', '

Der findes allerede en reservation til denne tid, men denne vaskemaskine!

'); } else { + $machineReservation->save(); $reservations = WashingReservation::query()->paginate($request->input("limit", 20)); return redirect()->route('washing-reservations.appindex', ["reservations" => $reservations]); @@ -174,7 +172,7 @@ class WashingReservationController extends Controller foreach ($reservations as $reservation){ array_push($times, $reservation->time); } - //2020-07-28% + $output = json_encode(['date' => $date, 'washingmachines' => $machines, 'unavailable_times' => $times]); return Response($output); } diff --git a/skolehjem/resources/views/app/washing-reservations/create.blade.php b/skolehjem/resources/views/app/washing-reservations/create.blade.php index 25a48ad..ffe2275 100644 --- a/skolehjem/resources/views/app/washing-reservations/create.blade.php +++ b/skolehjem/resources/views/app/washing-reservations/create.blade.php @@ -7,6 +7,7 @@ @section("content")

Booking Liste

+ {!! session()->get('ReservationExists') !!}
From 0e72166ac4eadf23c850a449da9d7b745c9ba4ff Mon Sep 17 00:00:00 2001 From: Anders Date: Tue, 4 Aug 2020 15:20:56 +0200 Subject: [PATCH 2/3] Removed External Links --- skolehjem/app/ExternalLink.php | 25 ---- .../Controllers/ExternalLinkController.php | 130 ------------------ ...020_06_24_064840_create_external_links.php | 35 ----- .../admin/external-links/create.blade.php | 22 --- .../admin/external-links/delete.blade.php | 13 -- .../views/admin/external-links/edit.blade.php | 23 ---- .../admin/external-links/index.blade.php | 40 ------ .../admin/external-links/store.blade.php | 14 -- .../admin/external-links/update.blade.php | 14 -- .../views/admin/layout/base.blade.php | 3 - 10 files changed, 319 deletions(-) delete mode 100644 skolehjem/app/ExternalLink.php delete mode 100644 skolehjem/app/Http/Controllers/ExternalLinkController.php delete mode 100644 skolehjem/database/migrations/2020_06_24_064840_create_external_links.php delete mode 100644 skolehjem/resources/views/admin/external-links/create.blade.php delete mode 100644 skolehjem/resources/views/admin/external-links/delete.blade.php delete mode 100644 skolehjem/resources/views/admin/external-links/edit.blade.php delete mode 100644 skolehjem/resources/views/admin/external-links/index.blade.php delete mode 100644 skolehjem/resources/views/admin/external-links/store.blade.php delete mode 100644 skolehjem/resources/views/admin/external-links/update.blade.php diff --git a/skolehjem/app/ExternalLink.php b/skolehjem/app/ExternalLink.php deleted file mode 100644 index 7a0076a..0000000 --- a/skolehjem/app/ExternalLink.php +++ /dev/null @@ -1,25 +0,0 @@ -middleware([ "auth" ]); - - $this->middleware("permission:link.external.list")->only("index"); - $this->middleware("permission:link.external.create")->only(["create", "store"]); - $this->middleware("permission:link.external.show")->only("show"); - $this->middleware("permission:link.external.edit")->only(["edit", "update"]); - $this->middleware("permission:link.external.delete")->only("destroy"); - } - - /** - * Display a listing of the resource. - * - * @param Request $request - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View - */ - public function index(Request $request) - { - $externalLink = ExternalLink::query()->paginate($request->input("limit", 20)); - - return Response::detect("external-links.index", [ "links" => $externalLink ]); - } - - /** - * Show the form for creating a new resource. - * - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View - */ - public function create() - { - return Response::detect("external-links.create"); - } - - /** - * Store a newly created resource in storage. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View - */ - public function store(Request $request) - { - $requestBody = $request->validate([ - "name" => "required|max:255", - "link" => "required|max:255" - ]); - - $externalLink = new ExternalLink($requestBody); - $saved = $externalLink->save(); - - if(!$saved){ - return Response::detect("external-links.store"); - }else{ - $externalLink = ExternalLink::query()->paginate($request->input("limit", 20)); - return Response::detect("external-links.index", ['links' => $externalLink]); - } - - } - - /** - * Display the specified resource. - * - * @param int $id - * @return \Illuminate\Http\Response - */ - public function show($id) - { - return Response::detect("external-links.show", [ "link" => $id]); - } - - /** - * Show the form for editing the specified resource. - * - * @param int $id - * @return \Illuminate\Http\Response - */ - public function edit($id) - { - $link = ExternalLink::find($id); - return Response::detect("external-links.edit", ["link" => $link]); - } - - /** - * Update the specified resource in storage. - * - * @param \Illuminate\Http\Request $request - * @param int $id - * @return \Illuminate\Http\Response - */ - public function update(Request $request, $id) - { - $data = $request->all(); - - $link = ExternalLink::find($id); - $link->update($data); - $saved = $link->save(); - - if(!$saved){ - return Response::detect("external-links.update", [ "link" => $link]); - }else{ - $externalLink = ExternalLink::query()->paginate($request->input("limit", 20)); - return Response::detect("external-links.index", ['links' => $externalLink]); - } - - } - - /** - * Remove the specified resource from storage. - * - * @param int $id - * @return \Illuminate\Http\Response - */ - public function destroy($id) - { - $link = ExternalLink::find($id); - $link->delete(); - return redirect()->route("external-links.index"); - } -} diff --git a/skolehjem/database/migrations/2020_06_24_064840_create_external_links.php b/skolehjem/database/migrations/2020_06_24_064840_create_external_links.php deleted file mode 100644 index b6da609..0000000 --- a/skolehjem/database/migrations/2020_06_24_064840_create_external_links.php +++ /dev/null @@ -1,35 +0,0 @@ -id(); - $table->string("name"); - $table->string("link"); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('external_links'); - } -} diff --git a/skolehjem/resources/views/admin/external-links/create.blade.php b/skolehjem/resources/views/admin/external-links/create.blade.php deleted file mode 100644 index 318a6a6..0000000 --- a/skolehjem/resources/views/admin/external-links/create.blade.php +++ /dev/null @@ -1,22 +0,0 @@ -@extends("admin.layout.base") -@extends("admin.layout.header") - -@section("title") - Link - Opret -@endsection - -@section("path") - Opret Link / -@endsection - -@section("content") -

Opret Link:

-
- @csrf - - - - - -
-@endsection diff --git a/skolehjem/resources/views/admin/external-links/delete.blade.php b/skolehjem/resources/views/admin/external-links/delete.blade.php deleted file mode 100644 index 2573007..0000000 --- a/skolehjem/resources/views/admin/external-links/delete.blade.php +++ /dev/null @@ -1,13 +0,0 @@ -@extends("admin.layout.base") -@extends("admin.layout.header") - -@section("title") - Link - Fjern -@endsection - -@section("path") - Fjern Link / -@endsection - -@section("content") -@endsection diff --git a/skolehjem/resources/views/admin/external-links/edit.blade.php b/skolehjem/resources/views/admin/external-links/edit.blade.php deleted file mode 100644 index 250ec21..0000000 --- a/skolehjem/resources/views/admin/external-links/edit.blade.php +++ /dev/null @@ -1,23 +0,0 @@ -@extends("admin.layout.base") -@extends("admin.layout.header") - -@section("title") - Link - Rediger -@endsection - -@section("path") - Rediger Link / -@endsection - -@section("content") -

Rediger Link:

-
$link])}}"> - @csrf - @method("PUT") - - - - - -
-@endsection diff --git a/skolehjem/resources/views/admin/external-links/index.blade.php b/skolehjem/resources/views/admin/external-links/index.blade.php deleted file mode 100644 index 4e4dcad..0000000 --- a/skolehjem/resources/views/admin/external-links/index.blade.php +++ /dev/null @@ -1,40 +0,0 @@ -@extends("admin.layout.base") -@extends("admin.layout.header") - -@section("title") - Link - Vis -@endsection - -@section("path") - Vis Link / -@endsection - -@section("content") - - - - - - - - - @foreach($links as $link) - - - - - - - @endforeach -
TitleLinkUpdateDelete
{{$link->name}}{{$link->link}} $link ]) }}">Update
$link ]) }}" class="w-100 nostyle"> - @csrf - @method("delete") - - -
-
- - {{ $links->links() }} -@endsection diff --git a/skolehjem/resources/views/admin/external-links/store.blade.php b/skolehjem/resources/views/admin/external-links/store.blade.php deleted file mode 100644 index efdc62b..0000000 --- a/skolehjem/resources/views/admin/external-links/store.blade.php +++ /dev/null @@ -1,14 +0,0 @@ -@extends("admin.layout.base") -@extends("admin.layout.header") - -@section("title") - Link - Opret -@endsection - -@section("path") - Opret External Link / -@endsection - -@section("content") - Link blev (ikke) oprettet. -@endsection diff --git a/skolehjem/resources/views/admin/external-links/update.blade.php b/skolehjem/resources/views/admin/external-links/update.blade.php deleted file mode 100644 index d0f6663..0000000 --- a/skolehjem/resources/views/admin/external-links/update.blade.php +++ /dev/null @@ -1,14 +0,0 @@ -@extends("admin.layout.base") -@extends("admin.layout.header") - -@section("title") - link - Rediger -@endsection - -@section("path") - $link]) }}" class="text-white">External link / -@endsection - -@section("content") - Din link blev (ikke) redigeret. -@endsection diff --git a/skolehjem/resources/views/admin/layout/base.blade.php b/skolehjem/resources/views/admin/layout/base.blade.php index 81e0863..554104c 100644 --- a/skolehjem/resources/views/admin/layout/base.blade.php +++ b/skolehjem/resources/views/admin/layout/base.blade.php @@ -29,9 +29,6 @@ - From 9dd09f22052d12a5834e22d2fe5cced971916e9e Mon Sep 17 00:00:00 2001 From: Neerholt Date: Tue, 4 Aug 2020 15:29:08 +0200 Subject: [PATCH 3/3] Made it so they can now make there own dynamic guide --- .../Http/Controllers/ContactController.php | 14 +++++++- .../WashingReservationController.php | 1 - .../views/admin/contacts/index.blade.php | 34 +++++++++++++++++-- .../washing-reservations/index.blade.php | 4 +-- 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/skolehjem/app/Http/Controllers/ContactController.php b/skolehjem/app/Http/Controllers/ContactController.php index 345c17c..2a2195d 100644 --- a/skolehjem/app/Http/Controllers/ContactController.php +++ b/skolehjem/app/Http/Controllers/ContactController.php @@ -146,6 +146,18 @@ class ContactController extends Controller "\"Update\"". "\"Delete\"". ""; + + + + if($request->isCheck === "navn") + $users = Contact::query()->where('contactname', 'LIKE',$request->search.'%')->get(); + elseif ($request->isCheck === "titel") + $users = Contact::query()->where('title', 'LIKE',$request->search.'%')->get(); + elseif ($request->isCheck === "email") + $users = Contact::query()->where('email', 'LIKE',$request->search.'%')->get(); + elseif ($request->isCheck === "tf") + $users = Contact::query()->where('phone', 'LIKE',$request->search.'%')->get(); + else $users = DB::table('contacts')->where('contactname', 'LIKE',$request->search.'%') ->orWhere('title','LIKE', $request->search.'%') ->orWhere('phone','LIKE', $request->search.'%') @@ -170,7 +182,7 @@ class ContactController extends Controller } }else{ $output.=''. - 'Din søgning matchede ikke nogen personer'. + 'Intet match'. ''. ''. ''. diff --git a/skolehjem/app/Http/Controllers/WashingReservationController.php b/skolehjem/app/Http/Controllers/WashingReservationController.php index 38d1d56..b730161 100644 --- a/skolehjem/app/Http/Controllers/WashingReservationController.php +++ b/skolehjem/app/Http/Controllers/WashingReservationController.php @@ -231,7 +231,6 @@ class WashingReservationController extends Controller ''. ''. ''. - ''. ''; } return Response($output); diff --git a/skolehjem/resources/views/admin/contacts/index.blade.php b/skolehjem/resources/views/admin/contacts/index.blade.php index 04442cd..0a44909 100644 --- a/skolehjem/resources/views/admin/contacts/index.blade.php +++ b/skolehjem/resources/views/admin/contacts/index.blade.php @@ -2,7 +2,7 @@ @extends("admin.layout.header") @section("title") - Events - Vis + Kontakt - Vis @endsection @section("path") @@ -15,9 +15,18 @@
@csrf - +
+ + + + + + + + +

@@ -51,11 +60,13 @@ + + + + @endsection diff --git a/skolehjem/resources/views/admin/washing-reservations/index.blade.php b/skolehjem/resources/views/admin/washing-reservations/index.blade.php index b44879d..acc4864 100644 --- a/skolehjem/resources/views/admin/washing-reservations/index.blade.php +++ b/skolehjem/resources/views/admin/washing-reservations/index.blade.php @@ -15,14 +15,14 @@
@csrf - +
- +