diff --git a/skolehjem/app/Http/Controllers/NewsController.php b/skolehjem/app/Http/Controllers/NewsController.php index ae8a7ff..4f5f491 100644 --- a/skolehjem/app/Http/Controllers/NewsController.php +++ b/skolehjem/app/Http/Controllers/NewsController.php @@ -31,7 +31,7 @@ class NewsController extends Controller */ public function index(Request $request) { - $news = News::query()->paginate($request->input("limit", 20)); + $news = News::query()->orderBy('id', 'asc')->paginate(2); return Response::detect("news.index", [ "news" => $news ]); } diff --git a/skolehjem/app/Http/Controllers/RootController.php b/skolehjem/app/Http/Controllers/RootController.php index 28112ee..f6f6283 100644 --- a/skolehjem/app/Http/Controllers/RootController.php +++ b/skolehjem/app/Http/Controllers/RootController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\News; use Illuminate\Http\Request; use Illuminate\Http\Response; @@ -14,9 +15,20 @@ class RootController extends Controller } public function index() { - if(auth()->user()->can('admin.panel.show')) - return Response::detect("root.index"); - else - return view('app.root.index'); + $perPage = 2; + + if(auth()->user()->can('admin.panel.show')) { + if(Response::detect("root.index")->name() == "admin.root.index") + return Response::detect("root.index"); + else { + $news = News::query()->orderBy('id', 'asc')->paginate($perPage); + return Response::detect("root.index", ["news" => $news]); + } + } + else { + $news = News::query()->orderBy('id', 'asc')->paginate($perPage); + + return view('app.root.index', ["news" => $news]); + } } } diff --git a/skolehjem/public/css/admin.css b/skolehjem/public/css/admin.css index 020f5d2..cc83d34 100644 --- a/skolehjem/public/css/admin.css +++ b/skolehjem/public/css/admin.css @@ -157,6 +157,42 @@ input.appinput { cursor: pointer; } +nav > .pagination { + display: flex; + list-style: none; + -webkit-padding-start: unset; + padding-inline-start: unset; + justify-content: center; +} + +.pagination > .page-item { + display: block; + list-style: none; + padding-right: 8px; + font-size: 1.5rem; + color: black; +} + +.pagination > .page-item:last-child { + padding: 0; +} + +.pagination > .page-item.disabled { + color: darkgrey; +} + +.pagination > .page-item.active { + font-weight: bold; +} + +.page-item.active > span { + font-size: 24px; +} + +.pagination > .page-item.disabled > .page-link { + font-size: 24px; +} + .text-white { color: #ffffff; } diff --git a/skolehjem/public/css/webapp.css b/skolehjem/public/css/webapp.css index 48bd4a0..eb7351b 100644 --- a/skolehjem/public/css/webapp.css +++ b/skolehjem/public/css/webapp.css @@ -157,6 +157,42 @@ input.appinput { cursor: pointer; } +nav > .pagination { + display: flex; + list-style: none; + -webkit-padding-start: unset; + padding-inline-start: unset; + justify-content: center; +} + +.pagination > .page-item { + display: block; + list-style: none; + padding-right: 8px; + font-size: 1.5rem; + color: black; +} + +.pagination > .page-item:last-child { + padding: 0; +} + +.pagination > .page-item.disabled { + color: darkgrey; +} + +.pagination > .page-item.active { + font-weight: bold; +} + +.page-item.active > span { + font-size: 24px; +} + +.pagination > .page-item.disabled > .page-link { + font-size: 24px; +} + .text-white { color: #ffffff; } diff --git a/skolehjem/public/css/webappdark.css b/skolehjem/public/css/webappdark.css index 238bd99..957eae4 100644 --- a/skolehjem/public/css/webappdark.css +++ b/skolehjem/public/css/webappdark.css @@ -157,6 +157,42 @@ input.appinput { cursor: pointer; } +nav > .pagination { + display: flex; + list-style: none; + -webkit-padding-start: unset; + padding-inline-start: unset; + justify-content: center; +} + +.pagination > .page-item { + display: block; + list-style: none; + padding-right: 8px; + font-size: 1.5rem; + color: black; +} + +.pagination > .page-item:last-child { + padding: 0; +} + +.pagination > .page-item.disabled { + color: darkgrey; +} + +.pagination > .page-item.active { + font-weight: bold; +} + +.page-item.active > span { + font-size: 24px; +} + +.pagination > .page-item.disabled > .page-link { + font-size: 24px; +} + .text-white { color: #ffffff; } diff --git a/skolehjem/resources/sass/app/general/_displays.scss b/skolehjem/resources/sass/app/general/_displays.scss index 453b071..4145325 100644 --- a/skolehjem/resources/sass/app/general/_displays.scss +++ b/skolehjem/resources/sass/app/general/_displays.scss @@ -27,3 +27,40 @@ .cursor-pointer { cursor: pointer; } + + + +nav > .pagination { + display: flex; + list-style: none; + padding-inline-start: unset; + justify-content: center; +} + +.pagination > .page-item { + display: block; + list-style: none; + padding-right: 8px; + font-size: 1.5rem; + color: black; +} + +.pagination > .page-item:last-child { + padding: 0; +} + +.pagination > .page-item.disabled { + color: darkgrey; +} + +.pagination > .page-item.active { + font-weight: bold; +} + +.page-item.active > span { + font-size: 24px; +} + +.pagination > .page-item.disabled > .page-link { + font-size: 24px; +} diff --git a/skolehjem/resources/views/admin/locations/show.blade.php b/skolehjem/resources/views/admin/locations/show.blade.php index 8ddf93c..5451d7e 100644 --- a/skolehjem/resources/views/admin/locations/show.blade.php +++ b/skolehjem/resources/views/admin/locations/show.blade.php @@ -13,22 +13,27 @@

Lokation: {{ $location->name }}

- +
@foreach(\App\WashingMachine::query()->where("location_id", "=", $location->id)->get() as $machine) @foreach(\App\WashingReservation::query()->where("machine_id", "=", $machine->id)->where("time", "LIKE", date("Y-m-d"). "%")->orderBy("time", "asc")->get() as $reservation) - @if($i % 3 == 1) + @if (date('Y-m-d H:i:s', strtotime('-1 hour')) < $reservation->time) + @if($i % 3 == 1) +
+
+ @endif +
+

{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}

+
+ Dato: {{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y') }} + Tid: {{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('\k\l\. H:i') }} - {{ \App\User::query()->where("id", "=", $reservation->user_id)->first()->name_first }} {{ \App\User::query()->where("id", "=", $reservation->user_id)->first()->name_last }} +
-
+ @endif -
-

{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}

-
- Dato: {{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y') }} - Tid: {{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('\k\l\. H:i') }} - {{ \App\User::query()->where("id", "=", $reservation->user_id)->first()->name_first }} {{ \App\User::query()->where("id", "=", $reservation->user_id)->first()->name_last }} -
-
- @endforeach @endforeach @if($i == 1) @@ -38,6 +43,13 @@
+ @yield("scripts") diff --git a/skolehjem/resources/views/app/events/index.blade.php b/skolehjem/resources/views/app/events/index.blade.php index 0aa22a0..2fe138b 100644 --- a/skolehjem/resources/views/app/events/index.blade.php +++ b/skolehjem/resources/views/app/events/index.blade.php @@ -79,6 +79,7 @@ @endforeach + {{ $events->links() }} @else

{{__('msg.dereringenaktiviteter')}}!

@endif diff --git a/skolehjem/resources/views/app/guides/index.blade.php b/skolehjem/resources/views/app/guides/index.blade.php index 02e7194..97ef953 100644 --- a/skolehjem/resources/views/app/guides/index.blade.php +++ b/skolehjem/resources/views/app/guides/index.blade.php @@ -54,6 +54,7 @@ @endforeach + {{ $guides->links() }} @else

{{__('msg.dereringenvejledninger')}}.

@endif diff --git a/skolehjem/resources/views/app/news/index.blade.php b/skolehjem/resources/views/app/news/index.blade.php index 19e11d5..491a2d7 100644 --- a/skolehjem/resources/views/app/news/index.blade.php +++ b/skolehjem/resources/views/app/news/index.blade.php @@ -69,8 +69,11 @@ @endforeach @if(count(\App\News::query()->orderBy("created_at", "desc")->get()) == 0)

{{__('msg.ingennyheder')}}

+ @else + {{ $news->links() }} @endif
+ @endsection @section("scripts") diff --git a/skolehjem/resources/views/app/washing-reservations/index.blade.php b/skolehjem/resources/views/app/washing-reservations/index.blade.php index 3035e6a..a82dd51 100644 --- a/skolehjem/resources/views/app/washing-reservations/index.blade.php +++ b/skolehjem/resources/views/app/washing-reservations/index.blade.php @@ -22,6 +22,8 @@ @endforeach @if(count($reservations) < 1)

{{__('msg.duharingenreservationer')}}.

+ @else + {{ $reservations->links() }} @endif {{__('msg.reservervaskemaskine')}}