diff --git a/skolehjem/app/Http/Controllers/LocationController.php b/skolehjem/app/Http/Controllers/LocationController.php index d60aba5..33b73f5 100644 --- a/skolehjem/app/Http/Controllers/LocationController.php +++ b/skolehjem/app/Http/Controllers/LocationController.php @@ -165,82 +165,4 @@ class LocationController extends Controller return 1; } } - - - - - public function search(Request $request){ - if($request->ajax()){ - $output = "<tr>". - "<th>Navn</th>". - "<th>Lokation</th>". - "<th style=\"width: 1em;\"><img class=\"w-100\" src=".asset('/images/icons/trashcan-dark.svg')." alt=\"Update\"></th>". - "<th style=\"width: 1em;\"><img class=\"w-100\" src=".asset('/images/icons/trashcan.svg')." alt=\"Delete\"></th>". - "</tr>"; - - if($request->option !== 'all') { - $locations = DB::table('washing_machines') - ->join('locations', 'washing_machines.location_id','=', 'locations.id') - ->select(DB::raw('washing_machines.name as washing_name, locations.name as location_name, locations.id as id')) - ->where('locations.id', '=', $request->option) - ->get(); - - if(count($locations) !== 0){ - foreach ($locations as $key => $location){ - $output.='<tr>'. - '<td>' . $location->washing_name . '</td>'. - '<td>' . $location->location_name . '</td>'. - '<td><form method="post" action="' .route("locations.destroy", [ "location" => $location->id ]). '" class="w-100 nostyle">'. - '<td><form method="post" action="' .route("locations.edit", [ "location" => $location->id ]). '" class="w-100 nostyle">'. - csrf_field(). - method_field("delete"). - - '<button class="w-100 nostyle" onclick="return confirm(\'Are you sure you want to delete?\');" type="submit"><img class="w-100 cursor-pointer" src="'. asset('/images/icons/trashcan-dark.svg') . '" alt="Delete"></button>'. - '</form>'. - '</td>'. - '</tr>'; - } - }else{ - $output.='<tr>'. - '<td>Det er ikke blivet oprettet nogen vaskmaskine på denne lokation i nu</td>'. - '<td></td>'. - '<td></td>'. - '<td></td>'. - '</tr>'; - } - } - elseif($request->option === "all"){ - $machines = WashingMachine::all(); - - if(count($machines) !== 0){ - foreach($machines as $machine) { - $output.= '<tr>'. - '<td>'.$machine->name.'</td>'. - '<td>'.Location::query()->where("id", "=", $machine->location_id)->first()->name.'</td>'. - '<td><a href="'. route("washing-machines.edit", [ "washing_machine" => $machine->id]) . '"><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->id ]) .'" class="w-100 nostyle">'. - csrf_field(). - method_field("delete"). - '<button class="w-100 nostyle" onclick="return confirm('."'Are you sure you want to delete?'".');" type="submit"><img class="w-100 cursor-pointer" src="'. asset('/images/icons/trashcan-dark.svg'). '" alt="Delete"></button>'. - '</form>'. - '</td>'. - '</tr>'; - } - }else{ - $output.='<tr>'. - '<td>Det er ikke blivet oprettet nogen vaskmaskine på denne lokation i nu</td>'. - '<td></td>'. - '<td></td>'. - '<td></td>'. - '</tr>'; - } - } - - - - - return Response($output); - } - } - } diff --git a/skolehjem/app/Http/Controllers/WashingMachineController.php b/skolehjem/app/Http/Controllers/WashingMachineController.php index 921e5bb..85b458d 100644 --- a/skolehjem/app/Http/Controllers/WashingMachineController.php +++ b/skolehjem/app/Http/Controllers/WashingMachineController.php @@ -10,6 +10,7 @@ use Illuminate\Http\Request; use Illuminate\Http\Response; use App\WashingMachine; +use Illuminate\Support\Facades\DB; use Illuminate\View\View; class WashingMachineController extends Controller @@ -167,4 +168,78 @@ class WashingMachineController extends Controller return 1; } } + + public function search(Request $request){ + if($request->ajax()){ + $output = "<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>"; + + if($request->option !== 'all') { + $machines = DB::table('washing_machines') + ->join('locations', 'washing_machines.location_id','=', 'locations.id') + ->select(DB::raw('washing_machines.name as washing_name, locations.name as location_name, washing_machines.id as id')) + ->where('locations.id', '=', $request->option) + ->get(); + + if(count($machines) !== 0){ + foreach ($machines as $machine){ + $output.='<tr>'. + '<td>' . $machine->washing_name . '</td>'. + '<td>' . $machine->location_name . '</td>'. + '<td><a href="'. route("washing-machines.edit", [ "washing_machine" => $machine->id ]) . '"><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->id ]). '" class="w-100 nostyle">'. + csrf_field(). + method_field("delete"). + + '<button class="w-100 nostyle" onclick="return confirm(\'Are you sure you want to delete?\');" type="submit"><img class="w-100 cursor-pointer" src="'. asset('/images/icons/trashcan-dark.svg') . '" alt="Delete"></button>'. + '</form>'. + '</td>'. + '</tr>'; + } + }else{ + $output.='<tr>'. + '<td>Det er ikke blivet oprettet nogen vaskmaskine på denne lokation i nu</td>'. + '<td></td>'. + '<td></td>'. + '<td></td>'. + '</tr>'; + } + } + elseif($request->option === "all"){ + $machines = WashingMachine::all(); + + if(count($machines) !== 0){ + foreach($machines as $machine) { + $output.= '<tr>'. + '<td>'.$machine->name.'</td>'. + '<td>'.Location::query()->where("id", "=", $machine->location_id)->first()->name.'</td>'. + '<td><a href="'. route("washing-machines.edit", [ "washing_machine" => $machine->id]) . '"><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->id ]) .'" class="w-100 nostyle">'. + csrf_field(). + method_field("delete"). + '<button class="w-100 nostyle" onclick="return confirm('."'Are you sure you want to delete?'".');" type="submit"><img class="w-100 cursor-pointer" src="'. asset('/images/icons/trashcan-dark.svg'). '" alt="Delete"></button>'. + '</form>'. + '</td>'. + '</tr>'; + } + }else{ + $output.='<tr>'. + '<td>Det er ikke blivet oprettet nogen vaskmaskine på denne lokation i nu</td>'. + '<td></td>'. + '<td></td>'. + '<td></td>'. + '</tr>'; + } + } + + + + + return Response($output); + } + } } diff --git a/skolehjem/app/Http/Controllers/WashingReservationController.php b/skolehjem/app/Http/Controllers/WashingReservationController.php index a2fca22..e187c80 100644 --- a/skolehjem/app/Http/Controllers/WashingReservationController.php +++ b/skolehjem/app/Http/Controllers/WashingReservationController.php @@ -15,6 +15,8 @@ use App\WashingReservation; use Illuminate\Support\Facades\DB; use Illuminate\View\View; +date_default_timezone_set('Europe/Copenhagen'); + class WashingReservationController extends Controller { public function __construct() @@ -37,6 +39,8 @@ class WashingReservationController extends Controller */ public function index(Request $request) { + WashingReservation::query()->where('time', '<', date('Y-m-d H:i:s', strtotime('-1 hour')))->delete(); + $reservations = WashingReservation::query()->orderBY('time' , 'asc')->paginate($request->query("limit", 20)); return Response::detect("washing-reservations.index", [ "reservations" => $reservations]); @@ -260,6 +264,8 @@ class WashingReservationController extends Controller public function appindex(Request $request) { + WashingReservation::query()->where('time', '<', date('Y-m-d H:i:s', strtotime('-1 hour')))->delete(); + $reservations = WashingReservation::query()->where("user_id", "=", auth()->user()->id)->orderBY('time' , 'asc')->paginate($request->query("limit", 20)); return Response::detect("washing-reservations.index", [ "reservations" => $reservations]); diff --git a/skolehjem/public/css/admin.css b/skolehjem/public/css/admin.css index ee7f16d..7803f31 100644 --- a/skolehjem/public/css/admin.css +++ b/skolehjem/public/css/admin.css @@ -6667,7 +6667,7 @@ main { background-color: #00788A; } -.segment > h3 { +.segment > div > h3 { margin-left: -1rem; margin-top: 0; width: calc(100% + 1rem); @@ -6675,12 +6675,12 @@ main { font-size: 1.15em; } -.segment > h3 > a { +.segment > div > h3 > a { padding: 1rem 2rem; display: flex; } -.segment > h3 > a > img { +.segment > div > h3 > a > img { width: 1.5em; } @@ -6691,7 +6691,7 @@ main { margin-bottom: .5rem;*/ } -.segment > h3:hover { +.segment > div > h3:hover { background-color: rgba(0, 0, 0, 0.2); } diff --git a/skolehjem/resources/lang/dk/msg.php b/skolehjem/resources/lang/dk/msg.php index 8400730..1cb10fb 100644 --- a/skolehjem/resources/lang/dk/msg.php +++ b/skolehjem/resources/lang/dk/msg.php @@ -59,6 +59,8 @@ return[ "sedeltagere" => "Se deltagere", "af" => "Af", "programmedby" => "Programmeret af", + "omappen" => "Om appen", + "infoomappen" => "Denne app er udviklet til Odense erhvervskollegie.", "error" => "Fejl", "404" => "Denne side findes ikke.", "canceled" => "Aflyst" diff --git a/skolehjem/resources/lang/en/msg.php b/skolehjem/resources/lang/en/msg.php index 0aa43e8..587823e 100644 --- a/skolehjem/resources/lang/en/msg.php +++ b/skolehjem/resources/lang/en/msg.php @@ -66,6 +66,8 @@ return[ "sedeltagere" => "See participants", "af" => "By", "programmedby" => "Programmed by", + "omappen" => "The App", + "infoomappen" => "The app is developed and designed for 'Odense erhvervskollegie'.", "error" => "Error", "404" => "This page doesn't exist.", "canceled" => "Canceled" diff --git a/skolehjem/resources/sass/admin/nav/nav.scss b/skolehjem/resources/sass/admin/nav/nav.scss index be2c737..44a326e 100644 --- a/skolehjem/resources/sass/admin/nav/nav.scss +++ b/skolehjem/resources/sass/admin/nav/nav.scss @@ -13,7 +13,7 @@ div.w-85 { background-color: #00788A; } -.segment > h3 { +.segment > div > h3 { margin-left: -1rem; margin-top: 0; width: calc(100% + 1rem); @@ -21,12 +21,12 @@ div.w-85 { font-size: 1.15em; } -.segment > h3 > a { +.segment > div > h3 > a { padding: 1rem 2rem; display: flex; } -.segment > h3 > a > img { +.segment > div > h3 > a > img { width: 1.5em; } @@ -37,7 +37,7 @@ div.w-85 { margin-bottom: .5rem;*/ } -.segment > h3:hover { +.segment > div > h3:hover { background-color: rgba(0,0,0, 0.2); } @@ -46,10 +46,6 @@ div.w-85 { padding-right: 8px; } -.segment > div > a { - -} - .btn-inline { display: inline-flex; align-items: center; diff --git a/skolehjem/resources/views/admin/layout/base.blade.php b/skolehjem/resources/views/admin/layout/base.blade.php index b34963c..85bb23a 100644 --- a/skolehjem/resources/views/admin/layout/base.blade.php +++ b/skolehjem/resources/views/admin/layout/base.blade.php @@ -20,11 +20,19 @@ var w85 = document.getElementsByClassName("w-85")[0]; $(".w-85").css({ "width": "85%" }); - $(".segment > h3").css({"margin-left": "", "width": ""}); - $(".segment > h3 > a").css({ "display": ""}); - $(".segment > h3 > a > span").css({"display": ""}); + $(".segment > div > h3").css({"margin-left": "", "width": ""}); + $(".segment > div > h3 > a").css({ "display": ""}); + $(".segment > div > h3 > a > span").css({"display": ""}); - $(".segment > div").css({"margin-left": "-1rem", "padding": "1rem 0rem 1rem 2rem", "width": "calc(100% - 3rem)"}); + $(document).on({ + mouseenter: function() { + $(this).find('.tooltiptext').css("visibility", "hidden"); + }, + mouseleave: function() { + $(this).find('.tooltiptext').css("visibility", "hidden"); + } + }, ".tooltip"); + $(".segment .hamburger > div").css({"margin-left": "-1rem", "width": "calc(100% - 3rem)"}); $(".segment > div > a").css({"margin-left": "auto", "margin-right": ""}); localStorage.setItem("collapsed", "false"); @@ -46,11 +54,20 @@ var w85 = document.getElementsByClassName("w-85")[0]; $(".w-85").css({ "width": "calc(100% - 64px)"}); - $(".segment > h3").css({"margin-left": "0", "width": "100%"}); - $(".segment > h3 > a").css({"display": "flex"}); - $(".segment > h3 > a > span").css({"display": "none"}); + $(".segment > div > h3").css({"margin-left": "0", "width": "100%"}); + $(".segment > div > h3 > a").css({"display": "flex"}); + $(".segment > div > h3 > a > span").css({"display": "none"}); - $(".segment > div").css({"margin-left": "0", "padding": "1rem 0", "width": "100%"}); + $(document).on({ + mouseenter: function() { + $(this).find('.tooltiptext').css("visibility", "visible"); + }, + mouseleave: function() { + $(this).find('.tooltiptext').css("visibility", "hidden"); + } + }, ".tooltip"); + + $(".segment.hamburger > div").css({"margin-left": "0", "width": "calc(100% - 4rem)"}); $(".segment > div > a").css({"margin-left": "auto", "margin-right": "auto"}); localStorage.setItem("collapsed", "true"); @@ -66,102 +83,80 @@ <link type="text/css" rel="stylesheet" href="{{ mix("/css/admin.css") }}"> </head> <body> +<style> + .tooltip { + position: relative; + display: inline-block; + width: 100%; + } + + .tooltip .tooltiptext { + visibility: hidden; + display: flex; + width: auto; + height: 100%; + background-color: #333333; + color: #fff; + text-align: center; + border-bottom-right-radius: 3px; + margin-top: auto; + padding: 0 1rem; + justify-content: center; + align-items: center; + margin-bottom: auto; + position: absolute; + z-index: 1; + top: 0px; + left: 100%; + font-size: 25px; + } + + .tooltip:hover .tooltiptext { + /*visibility: visible;*/ + } +</style> @yield("header") <main class="row"> <div class="col nav" style="background-color: #333333;"> - <div class="segment" style="height: 60px;"> + <div class="segment hamburger" style="height: 60px;"> <div class="text-white row align-items-center" style="margin-left: -1rem; margin-top: 0; margin-bottom: 0; font-size: 1.15rem; height: calc(100% - 2rem); padding: 1rem 2rem; width: calc(100% - 3rem); background-color: #333333 !important;"> <a href="javascript:void(0)" id="open" style="padding: 0; margin-left: auto; display: none;" onclick="openNav()" class="open-btn text-white"><i class="fa fa-bars"></i></a> <a href="javascript:void(0)" id="close" style="padding: 0; margin-left: auto;" onclick="closeNav()" class="close-btn text-white"><i class="fa fa-times"></i></a> </div> </div> - @if(\Illuminate\Support\Facades\Request::route()->getName() == "users.index") - <div class="segment active"> - <h3 class="text-white"><a href="#" class="text-white"><img src="{{asset("/images/icons/users-hvid.svg")}}" class="fa"><span style="margin-left: 4px;">Brugere</span></a></h3> - @else - <div class="segment"> - <h3 class="text-white"><a href="{{ route('users.index') }}" class="text-white"><img src="{{asset("/images/icons/users-hvid.svg")}}" class="fa"><span style="margin-left: 4px;">Brugere</span></a></h3> - @endif + + <div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "users.index") active @endif"> + <div class="tooltip"><h3 class="text-white"><a href="{{ route('users.index') }}" class="text-white"><img src="{{asset("/images/icons/users-hvid.svg")}}" class="fa"><span style="margin-left: 4px;">Brugere</span></a></h3><span class="tooltiptext">Brugere</span></div> </div> - @if(\Illuminate\Support\Facades\Request::route()->getName() == "roles.index") - <div class="segment active"> - <h3 class="text-white"><a href="#" class="text-white"><img src="{{asset("/images/icons/role.svg")}}" class="fa"><span style="margin-left: 4px;">Roller</span></a></h3> - @else - <div class="segment"> - <h3 class="text-white"><a href="{{ route("roles.index") }}" class="text-white"><img src="{{asset("/images/icons/role.svg")}}" class="fa"><span style="margin-left: 4px;">Roller</span></a></h3> - @endif + <div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "roles.index") active @endif"> + <div class="tooltip"><h3 class="text-white"><a href="{{ route('roles.index') }}" class="text-white"><img src="{{asset("/images/icons/role.svg")}}" class="fa"><span style="margin-left: 4px;">Roller</span></a></h3><span class="tooltiptext">Roller</span></div> </div> - @if(\Illuminate\Support\Facades\Request::route()->getName() == "news.index") - <div class="segment active"> - <h3 class="text-white"><a href="#" class="text-white"><img src="{{asset("/images/icons/news.svg")}}" class="fa"><span style="margin-left: 4px;">Nyheder</span></a></h3> - @else - <div class="segment"> - <h3 class="text-white"><a href="{{ route("news.index")}}" class="text-white"><img src="{{asset("/images/icons/news.svg")}}" class="fa"><span style="margin-left: 4px;">Nyheder</span></a></h3> - @endif + <div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "news.index") active @endif"> + <div class="tooltip"><h3 class="text-white"><a href="{{ route('news.index') }}" class="text-white"><img src="{{asset("/images/icons/news.svg")}}" class="fa"><span style="margin-left: 4px;">Nyheder</span></a></h3><span class="tooltiptext">Nyheder</span></div> </div> - @if(\Illuminate\Support\Facades\Request::route()->getName() == "menu-plans.index") - <div class="segment active"> - <h3 class="text-white"><a href="#" class="text-white"><img src="{{asset("/images/icons/Menuplan.svg")}}" class="fa"><span style="margin-left: 4px;">Menuplan</span></a></h3> - @else - <div class="segment"> - <h3 class="text-white"><a href="{{ route("menu-plans.index")}}" class="text-white"><img src="{{asset("/images/icons/Menuplan.svg")}}" class="fa"><span style="margin-left: 4px;">Menuplan</span></a></h3> - @endif + <div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "menu-plans.index") active @endif"> + <div class="tooltip"><h3 class="text-white"><a href="{{ route('menu-plans.index') }}" class="text-white"><img src="{{asset("/images/icons/Menuplan.svg")}}" class="fa"><span style="margin-left: 4px;">Menuplan</span></a></h3><span class="tooltiptext">Menuplan</span></div> </div> - @if(\Illuminate\Support\Facades\Request::route()->getName() == "events.index") - <div class="segment active"> - <h3 class="text-white"><a href="#" class="text-white"><img src="{{asset("/images/icons/Aktiviteter.svg")}}" class="fa"><span style="margin-left: 4px;">Aktiviteter</span></a></h3> - @else - <div class="segment"> - <h3 class="text-white"><a href="{{ route("events.index") }}" class="text-white"><img src="{{asset("/images/icons/Aktiviteter.svg")}}" class="fa"><span style="margin-left: 4px;">Aktiviteter</span></a></h3> - @endif + <div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "events.index") active @endif"> + <div class="tooltip"><h3 class="text-white"><a href="{{ route('events.index') }}" class="text-white"><img src="{{asset("/images/icons/Aktiviteter.svg")}}" class="fa"><span style="margin-left: 4px;">Aktiviteter</span></a></h3><span class="tooltiptext">Aktiviteter</span></div> </div> - @if(\Illuminate\Support\Facades\Request::route()->getName() == "locations.index") - <div class="segment active"> - <h3 class="text-white"><a href="#" class="text-white"><img src="{{asset("/images/icons/location.svg")}}" class="fa"><span style="margin-left: 4px;">Lokationer</span></a></h3> - @else - <div class="segment"> - <h3 class="text-white"><a href="{{ route("locations.index") }}" class="text-white"><img src="{{asset("/images/icons/location.svg")}}" class="fa"><span style="margin-left: 4px;">Lokationer</span></a></h3> - @endif + <div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "locations.index") active @endif"> + <div class="tooltip"><h3 class="text-white"><a href="{{ route('locations.index') }}" class="text-white"><img src="{{asset("/images/icons/location.svg")}}" class="fa"><span style="margin-left: 4px;">Lokationer</span></a></h3><span class="tooltiptext">Lokationer</span></div> </div> - @if(\Illuminate\Support\Facades\Request::route()->getName() == "washing-machines.index") - <div class="segment active"> - <h3 class="text-white"><a href="#" class="text-white"><img src="{{asset("/images/icons/wash.svg")}}" class="fa"><span style="margin-left: 4px;">Vaskemaskiner</span></a></h3> - @else - <div class="segment"> - <h3 class="text-white"><a href="{{ route("washing-machines.index") }}" class="text-white"><img src="{{asset("/images/icons/wash.svg")}}" class="fa"><span style="margin-left: 4px;">Vaskemaskiner</span></a></h3> - @endif + <div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "washing-machines.index") active @endif"> + <div class="tooltip"><h3 class="text-white"><a href="{{ route('washing-machines.index') }}" class="text-white"><img src="{{asset("/images/icons/wash.svg")}}" class="fa"><span style="margin-left: 4px;">Vaskemaskiner</span></a></h3><span class="tooltiptext">Vaskemaskiner</span></div> </div> - @if(\Illuminate\Support\Facades\Request::route()->getName() == "washing-reservations.index") - <div class="segment active"> - <h3 class="text-white"><a href="#" class="text-white"><img src="{{asset("/images/icons/wash_res.svg")}}" class="fa"><span style="margin-left: 4px;">Reservationer</span></a></h3> - @else - <div class="segment"> - <h3 class="text-white"><a href="{{ route("washing-reservations.index") }}" class="text-white"><img src="{{asset("/images/icons/wash_res.svg")}}" class="fa"><span style="margin-left: 4px;">Reservationer</span></a></h3> - @endif + <div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "washing-reservations.index") active @endif"> + <div class="tooltip"><h3 class="text-white"><a href="{{ route('washing-reservations.index') }}" class="text-white"><img src="{{asset("/images/icons/wash_res.svg")}}" class="fa"><span style="margin-left: 4px;">Reservationer</span></a></h3><span class="tooltiptext">Reservationer</span></div> </div> - @if(\Illuminate\Support\Facades\Request::route()->getName() == "contacts.index") - <div class="segment active"> - <h3 class="text-white"><a href="#" class="text-white"><img src="{{asset("/images/icons/phone.svg")}}" class="fa"><span style="margin-left: 4px;">Kontakter</span></a></h3> - @else - <div class="segment"> - <h3 class="text-white"><a href="{{ route("contacts.index") }}" class="text-white"><img src="{{asset("/images/icons/phone.svg")}}" class="fa"><span style="margin-left: 4px;">Kontakter</span></a></h3> - @endif + <div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "contacts.index") active @endif"> + <div class="tooltip"><h3 class="text-white"><a href="{{ route('contacts.index') }}" class="text-white"><img src="{{asset("/images/icons/phone.svg")}}" class="fa"><span style="margin-left: 4px;">Kontakter</span></a></h3><span class="tooltiptext">Kontakter</span></div> </div> - @if(\Illuminate\Support\Facades\Request::route()->getName() == "guides.index") - <div class="segment active"> - <h3 class="text-white"><a href="#" class="text-white"><img src="{{asset("/images/icons/Vejledninger.svg")}}" class="fa"><span style="margin-left: 4px;">Vejledning</span></a></h3> - @else - <div class="segment"> - <h3 class="text-white"><a href="{{ route('guides.index') }}" class="text-white"><img src="{{asset("/images/icons/Vejledninger.svg")}}" class="fa"><span style="margin-left: 4px;">Vejledning</span></a></h3> - @endif + <div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "guides.index") active @endif"> + <div class="tooltip"><h3 class="text-white"><a href="{{ route('guides.index') }}" class="text-white"><img src="{{asset("/images/icons/Vejledninger.svg")}}" class="fa"><span style="margin-left: 4px;">Vejledning</span></a></h3><span class="tooltiptext">Vejledning</span></div> </div> - @if(\Illuminate\Support\Facades\Request::route()->getName() == "feedbacks.index") - <div class="segment active"> - <h3 class="text-white"><a href="#" class="text-white"><img src="{{asset("/images/icons/feedback.svg")}}" class="fa"><span style="margin-left: 4px;">Feedback</span></a></h3> - @else - <div class="segment"> - <h3 class="text-white"><a href="{{ route('feedbacks.index') }}" class="text-white"><img src="{{asset("/images/icons/feedback.svg")}}" class="fa"><span style="margin-left: 4px;">Feedback</span></a></h3> - @endif + <div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "feedbacks.index") active @endif"> + <div class="tooltip"><h3 class="text-white"><a href="{{ route('feedbacks.index') }}" class="text-white"><img src="{{asset("/images/icons/feedback.svg")}}" class="fa"><span style="margin-left: 4px;">Feedback</span></a></h3><span class="tooltiptext">Feedback</span></div> </div> </div> <div class="w-85" style="background-color: #cccccc;"> @@ -172,11 +167,14 @@ @yield("content") </div> </div> + <script> + if(localStorage.getItem("collapsed") == "true") + closeNav(); - <script> - if(localStorage.getItem("collapsed") == "true") - closeNav(); - </script> + $('.segment.active > .tooltip > h3 > a').click(function (e) { + e.preventDefault(); + }); + </script> </main> <script src="{{ mix("/js/app.js") }}"></script> diff --git a/skolehjem/resources/views/admin/locations/show.blade.php b/skolehjem/resources/views/admin/locations/show.blade.php index 43c8a97..d32860c 100644 --- a/skolehjem/resources/views/admin/locations/show.blade.php +++ b/skolehjem/resources/views/admin/locations/show.blade.php @@ -18,23 +18,23 @@ $i = 1; ?> <div class="row"> - @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 (date('Y-m-d H:i:s', strtotime('-1 hour')) < $reservation->time) - @if($i % 3 == 1) - </div> - <div class="row w-100"> - @endif - <div class="reservation col align-items-center" style="margin: 0 32px 1.75rem 32px; width: calc(33% - 64px);"> - <h2 style="font-size: 2vw">{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}</h2> - <div class="col align-items-center"> - <span style="font-size: 1vw"><b>Dato:</b> {{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y') }}</span> - <span style="font-size: 2vw"><b>Tid:</b> {{ \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 }}</span> - </div> + @foreach(\App\WashingReservation::query()->join('washing_machines', 'washing_machines.id', '=', 'washing_reservations.machine_id')->where("location_id", "=", $location->id)->where("time", "LIKE", date("Y-m-d"). "%")->orderBy("time", "asc")->get() as $reservation) + @if (date('Y-m-d H:i:s', strtotime('-1 hour')) < $reservation->time) + @if($i % 3 == 1) </div> - <?php $i++; ?> + <div class="row w-100"> @endif - @endforeach + <div class="reservation col align-items-center" style="margin: 0 32px 1.75rem 32px; width: calc(33% - 64px);"> + <h2 style="font-size: 2vw">{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}</h2> + <div class="col align-items-center"> + <span style="font-size: 1vw"><b>Dato:</b> {{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y') }}</span> + <span style="font-size: 2vw"><b>Tid:</b> {{ \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 }}</span> + </div> + </div> + <?php $i++; ?> + @else + {{ \App\WashingReservation::query()->join('washing_machines', 'washing_machines.id', '=', 'washing_reservations.machine_id')->where("location_id", "=", $location->id)->where('time', '<', date('Y-m-d H:i:s'). '%')->delete() }} + @endif @endforeach @if($i == 1) <b class="w-100 text-center" style="font-size: 2vw; padding-top: 16px;">Der er ingen vaskemaskine reservationer for i dag.</b> @@ -46,8 +46,8 @@ <script type="text/javascript"> $(document).ready(function () { setInterval(function(){ // There has to be a space between " and # or it will not load correctly - $('#mainDiv').load(" #mainDiv").fadeIn(); - }, (60000*5)); + $('#mainDiv').load(" #mainDiv"); + }, (60000*1)); }); </script> @yield("scripts") diff --git a/skolehjem/resources/views/admin/washing-machines/index.blade.php b/skolehjem/resources/views/admin/washing-machines/index.blade.php index 8e1844b..9be1d94 100644 --- a/skolehjem/resources/views/admin/washing-machines/index.blade.php +++ b/skolehjem/resources/views/admin/washing-machines/index.blade.php @@ -49,7 +49,7 @@ console.log($value); $.ajax({ type: 'get', - url: '{{route('locations.search')}}', + url: '{{route('washing-machines.search')}}', data: {'option':$value}, success:function (data) { console.log($value); diff --git a/skolehjem/resources/views/app/about/index.blade.php b/skolehjem/resources/views/app/about/index.blade.php index fdab4ff..3f62ebd 100644 --- a/skolehjem/resources/views/app/about/index.blade.php +++ b/skolehjem/resources/views/app/about/index.blade.php @@ -8,13 +8,13 @@ <h1 class="text-center sde-blue mb-0" style="margin-bottom: 2rem">{{ __('msg.omkring') }}</h1> <h4 class="mb-0 mt-1">Version:</h4> <p>1.0</p> - <h4 class="mb-0 mt-1">Om appen:</h4> - <p>Denne app er udviklet til Odense erhvervskollegie.</p> + <h4 class="mb-0 mt-1">{{__("msg.omappen")}}:</h4> + <p>{{__("msg.infoomappen")}}</p> <h4 class="mb-1 mt-1">{{__("msg.programmedby")}}:</h4> <span style="margin-bottom: 0.2rem;"><span style="float: left;">Anders Rasmussen,</span><span style="float: right;">anders164a@gmail.com</span></span> <span style="margin-bottom: 0.2rem;">Frederik Milling Pytlick,<span style="float: right;">frederikpyt@gmail.com</span></span> - <span style="margin-bottom: 0.2rem;">Vedran Zelen,<span style="float: right;">vedr0021@gmail.com</span></span> + <span style="margin-bottom: 0.2rem;">Vedran Zelen,<span style="float: right;">zelenvedran@gmail.com</span></span> <span style="margin-bottom: 0.2rem;">Victor Neerholt,<span style="float: right;">victorneerholt@gmail.com</span></span> - <span style="margin-bottom: 0.2rem;">Sebastian Davaris,<span style="float: right;">seba4928@edu.sde.dk</span></span> + <span style="margin-bottom: 0.2rem;">Sebastian Davaris,<span style="float: right;">sebastian@davaris.dk</span></span> </main> @endsection diff --git a/skolehjem/routes/web.php b/skolehjem/routes/web.php index d03be30..9690eb4 100644 --- a/skolehjem/routes/web.php +++ b/skolehjem/routes/web.php @@ -49,7 +49,7 @@ Route::get("/rolesapi", "RolesController@search")->name("roles.search"); Route::get("/userapi", "UserController@search")->name("users.search"); Route::get("/vaskeapi", "WashingReservationController@search")->name("washing-reservations.search"); Route::get("/risrosapi", "FeedbackController@search")->name("feedbacks.search"); -Route::get("/locationapi", "LocationController@search")->name("locations.search"); +Route::get("/machineapi", "WashingMachineController@search")->name("washing-machines.search"); //Cookies Route::get("/languages", "UserController@setLanguages")->name("users.setLanguages");