From 89276c5af16f008437a69c9860df3c2b590e88be Mon Sep 17 00:00:00 2001 From: Neerholt Date: Thu, 20 Aug 2020 14:59:22 +0200 Subject: [PATCH] v0.10.11a - Made hide filter, filter washing machine search semi done, and texts fixs --- .../app/Http/Controllers/EventController.php | 1 + .../Http/Controllers/LocationController.php | 50 +++++++++++++++++++ skolehjem/app/WashingMachine.php | 5 ++ .../views/admin/contacts/index.blade.php | 22 ++++++-- .../views/admin/events/create.blade.php | 2 +- .../views/admin/events/index.blade.php | 2 +- .../views/admin/users/index.blade.php | 19 ++++--- .../admin/washing-machines/index.blade.php | 25 ++++++++++ .../resources/views/pdf/menuplan.blade.php | 2 +- skolehjem/routes/web.php | 1 + 10 files changed, 115 insertions(+), 14 deletions(-) diff --git a/skolehjem/app/Http/Controllers/EventController.php b/skolehjem/app/Http/Controllers/EventController.php index b571811..08dd555 100644 --- a/skolehjem/app/Http/Controllers/EventController.php +++ b/skolehjem/app/Http/Controllers/EventController.php @@ -250,6 +250,7 @@ class EventController extends Controller ""; $events = DB::table('events')->orderBY('date' , 'asc')->where('name', 'LIKE',$request->search.'%') ->orWhere('date','LIKE', $request->search.'%') + ->orWhere('accountable','LIKE', $request->search.'%') ->get();//Job is here dude :9 if(count($events) !== 0){ diff --git a/skolehjem/app/Http/Controllers/LocationController.php b/skolehjem/app/Http/Controllers/LocationController.php index 45e9883..29d7c92 100644 --- a/skolehjem/app/Http/Controllers/LocationController.php +++ b/skolehjem/app/Http/Controllers/LocationController.php @@ -163,4 +163,54 @@ class LocationController extends Controller return 1; } } + + + + + public function search(Request $request){ + if($request->ajax()){ + $output = "". + "Navn". + "Lokation". + "\"Update\"". + "\"Delete\"". + ""; + + if($request) { + $locations = Location::query()->orderBy('created_at', 'desc')->where('name', '=', $request->option)->get(); + //$machines = WashingMachine::query()->where('created_at', '=', $locations->created_at)->get(); + } + elseif($request->option == "all"){ + $locations = Location::all(); + } + + + if(count($locations) !== 0){ + foreach ($locations as $key => $location){ + $output.=''. + //'' . $location->name . ''. + '

Test data

'. + '' . $location->name . ''. + '
$location ]). '" class="w-100 nostyle">'. + ' $location ]). '" class="w-100 nostyle">'. + csrf_field(). + method_field("delete"). + + ''. + '
'. + ''. + ''; + } + }else{ + $output.=''. + 'Det er ikke blivet oprettet nogen vaskmaskine på denne lokation i nu'. + ''. + ''. + ''. + ''; + } + return Response($output); + } + } + } diff --git a/skolehjem/app/WashingMachine.php b/skolehjem/app/WashingMachine.php index 37bd859..4ca1f5f 100644 --- a/skolehjem/app/WashingMachine.php +++ b/skolehjem/app/WashingMachine.php @@ -16,4 +16,9 @@ class WashingMachine extends Model protected $fillable = [ 'name', 'location_id' ]; + + public function washingMachine() + { + return $this->hasMany('App\locations'); + } } diff --git a/skolehjem/resources/views/admin/contacts/index.blade.php b/skolehjem/resources/views/admin/contacts/index.blade.php index 0a44909..30a47e1 100644 --- a/skolehjem/resources/views/admin/contacts/index.blade.php +++ b/skolehjem/resources/views/admin/contacts/index.blade.php @@ -15,9 +15,12 @@
@csrf - +
+ + +
@@ -26,9 +29,8 @@ - -

- +
+
@@ -90,6 +92,18 @@ } }); }); + + + + + //Show hide search filter + $('#showHideCheckbox').hide(); + $('#showHideCheckboxs').hide(); + $("#filterButton").click(function(){ + $('#showHideCheckbox').toggle(); + $('#showHideCheckboxs').toggle(); + }); + diff --git a/skolehjem/resources/views/admin/events/create.blade.php b/skolehjem/resources/views/admin/events/create.blade.php index 2555057..f2e0f70 100644 --- a/skolehjem/resources/views/admin/events/create.blade.php +++ b/skolehjem/resources/views/admin/events/create.blade.php @@ -27,7 +27,7 @@ @csrf - + diff --git a/skolehjem/resources/views/admin/events/index.blade.php b/skolehjem/resources/views/admin/events/index.blade.php index 34578de..c566f53 100644 --- a/skolehjem/resources/views/admin/events/index.blade.php +++ b/skolehjem/resources/views/admin/events/index.blade.php @@ -15,7 +15,7 @@ @csrf - + diff --git a/skolehjem/resources/views/admin/users/index.blade.php b/skolehjem/resources/views/admin/users/index.blade.php index a333484..e7f9628 100644 --- a/skolehjem/resources/views/admin/users/index.blade.php +++ b/skolehjem/resources/views/admin/users/index.blade.php @@ -17,10 +17,10 @@ @csrf
- + -
+
@@ -32,6 +32,8 @@
+
+
@@ -96,9 +98,10 @@ diff --git a/skolehjem/resources/views/admin/washing-machines/index.blade.php b/skolehjem/resources/views/admin/washing-machines/index.blade.php index 8ddd5ec..d4e3e41 100644 --- a/skolehjem/resources/views/admin/washing-machines/index.blade.php +++ b/skolehjem/resources/views/admin/washing-machines/index.blade.php @@ -12,6 +12,14 @@ @section("content")
CreateOpret Vaskemaskine +
+ +
@@ -35,4 +43,21 @@ @endforeach
+ @endsection diff --git a/skolehjem/resources/views/pdf/menuplan.blade.php b/skolehjem/resources/views/pdf/menuplan.blade.php index 87f785a..41b606b 100644 --- a/skolehjem/resources/views/pdf/menuplan.blade.php +++ b/skolehjem/resources/views/pdf/menuplan.blade.php @@ -1,7 +1,7 @@ - Title + Menuplan_uge_{{$menuPlan->week}}