Conflicts:
	skolehjem/app/Http/Controllers/RootController.php
This commit is contained in:
Neerholt 2020-08-31 14:29:24 +02:00
commit efb2840ff0
38 changed files with 323 additions and 214 deletions

View File

@ -15,8 +15,7 @@ class ContactController extends Controller
$this->middleware([ "auth" ]); $this->middleware([ "auth" ]);
$this->middleware([ "lang" ]); $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:contact.list" ])->only("index"); $this->middleware([ "check.auth:contact.show" ])->only("show", "index");
$this->middleware([ "check.auth:contact.show" ])->only("show");
$this->middleware([ "check.auth:contact.create" ])->only("create", "store"); $this->middleware([ "check.auth:contact.create" ])->only("create", "store");
$this->middleware([ "check.auth:contact.edit" ])->only("edit", "update"); $this->middleware([ "check.auth:contact.edit" ])->only("edit", "update");
$this->middleware([ "check.auth:contact.delete" ])->only("delete"); $this->middleware([ "check.auth:contact.delete" ])->only("delete");

View File

@ -11,6 +11,7 @@ use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
date_default_timezone_set('Europe/Copenhagen');
class EventController extends Controller class EventController extends Controller
{ {
@ -19,8 +20,7 @@ class EventController extends Controller
$this->middleware([ "auth" ]); $this->middleware([ "auth" ]);
$this->middleware([ "lang" ]); $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:event.list" ])->only("index"); $this->middleware([ "check.auth:event.show" ])->only("show", "index");
$this->middleware([ "check.auth:event.show" ])->only("show");
$this->middleware([ "check.auth:event.create" ])->only("create", "store"); $this->middleware([ "check.auth:event.create" ])->only("create", "store");
$this->middleware([ "check.auth:event.edit" ])->only("edit", "update"); $this->middleware([ "check.auth:event.edit" ])->only("edit", "update");
$this->middleware([ "check.auth:event.delete" ])->only("delete"); $this->middleware([ "check.auth:event.delete" ])->only("delete");
@ -33,12 +33,15 @@ class EventController extends Controller
*/ */
public function index(Request $request) public function index(Request $request)
{ {
DB::table('user_events') $eventsToDelete = Event::query()->get();
->where('event_id')
->delete(); foreach ($eventsToDelete as $event) {
DB::table('events') if (date('Y-m-d H:i', strtotime('-1 day')) >= date('Y-m-d H:i', strtotime($event->date))) {
->where('events.date', '<=', date('Y-m-d H:i', strtotime('-1 day'))) UserEvent::query()->where('event_id', '=', $event->id)->delete();
->delete();
$event->delete();
}
}
$events = Event::query()->orderBY('date' , 'asc')->paginate($request->input("limit", 20)); $events = Event::query()->orderBY('date' , 'asc')->paginate($request->input("limit", 20));
@ -62,7 +65,7 @@ class EventController extends Controller
* Store a newly created resource in storage. * Store a newly created resource in storage.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View * @return \Illuminate\Http\RedirectResponse
*/ */
public function store(Request $request) public function store(Request $request)
{ {
@ -103,7 +106,6 @@ class EventController extends Controller
return redirect()->route('events.index', ['events' => $events]); return redirect()->route('events.index', ['events' => $events]);
} }
} }
/** /**
@ -234,9 +236,8 @@ class EventController extends Controller
$userEvent->delete(); $userEvent->delete();
} }
$news = News::query()->where("type_id", "=", "3")->where("arrangement_id", "=", $event->id)->first(); $news = News::query()->join('news_types', 'news_types.id', '=', 'news.type_id')->where("type", "=", "Activity")->where("arrangement_id", "=", $id);
if($news !== null) $news->delete();
$news->delete();
$event->delete(); $event->delete();

View File

@ -15,8 +15,7 @@ class FeedbackController extends Controller
$this->middleware([ "auth" ]); $this->middleware([ "auth" ]);
$this->middleware([ "lang" ]); $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:feedback.list" ])->only("index"); $this->middleware([ "check.auth:feedback.show" ])->only("show", "index");
$this->middleware([ "check.auth:feedback.show" ])->only("show");
$this->middleware([ "check.auth:feedback.create" ])->only("create", "store"); $this->middleware([ "check.auth:feedback.create" ])->only("create", "store");
$this->middleware([ "check.auth:feedback.edit" ])->only("edit", "update"); $this->middleware([ "check.auth:feedback.edit" ])->only("edit", "update");
$this->middleware([ "check.auth:feedback.delete" ])->only("delete"); $this->middleware([ "check.auth:feedback.delete" ])->only("delete");

View File

@ -15,8 +15,7 @@ class GuideController extends Controller
$this->middleware([ "auth" ]); $this->middleware([ "auth" ]);
$this->middleware([ "lang" ]); $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:guides.list" ])->only("index"); $this->middleware([ "check.auth:guides.show" ])->only("show", "index");
$this->middleware([ "check.auth:guides.show" ])->only("show");
$this->middleware([ "check.auth:guides.create" ])->only("create", "store"); $this->middleware([ "check.auth:guides.create" ])->only("create", "store");
$this->middleware([ "check.auth:guides.edit" ])->only("edit", "update"); $this->middleware([ "check.auth:guides.edit" ])->only("edit", "update");
$this->middleware([ "check.auth:guides.delete" ])->only("delete"); $this->middleware([ "check.auth:guides.delete" ])->only("delete");
@ -160,17 +159,18 @@ class GuideController extends Controller
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* *
* @param Guide $guide * @param Guide $id
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function destroy($guide) public function destroy($id)
{ {
$guide = Guide::find($guide); // Find the guide you want to remove
$news = News::query()->where("type_id", "=", "4")->where("arrangement_id", "=", $guide->id)->first(); $guide = Guide::find($id);
// Find the news the you made when creating the guide (if there is a news)
if($news !== null) $news = News::query()->join('news_types', 'news_types.id', '=', 'news.type_id')->where("type", "=", "Guide")->where("arrangement_id", "=", $id);
$news->delete();
//Delete the news or/and guide
$news->delete();
$guide->delete(); $guide->delete();

View File

@ -17,8 +17,7 @@ class LocationController extends Controller
$this->middleware([ "auth" ]); $this->middleware([ "auth" ]);
$this->middleware([ "lang" ]); $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:locations.list" ])->only("index"); $this->middleware([ "check.auth:locations.show" ])->only("show", "index");
$this->middleware([ "check.auth:locations.show" ])->only("show");
$this->middleware([ "check.auth:locations.create" ])->only("create", "store"); $this->middleware([ "check.auth:locations.create" ])->only("create", "store");
$this->middleware([ "check.auth:locations.edit" ])->only("edit", "update"); $this->middleware([ "check.auth:locations.edit" ])->only("edit", "update");
$this->middleware([ "check.auth:locations.delete" ])->only("delete"); $this->middleware([ "check.auth:locations.delete" ])->only("delete");

View File

@ -22,8 +22,7 @@ class MenuPlanController extends Controller
$this->middleware([ "auth" ]); $this->middleware([ "auth" ]);
$this->middleware([ "lang" ]); $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:menuplan.list" ])->only("index"); $this->middleware([ "check.auth:menuplan.show" ])->only("show", "index");
$this->middleware([ "check.auth:menuplan.show" ])->only("show");
$this->middleware([ "check.auth:menuplan.create" ])->only("create", "store"); $this->middleware([ "check.auth:menuplan.create" ])->only("create", "store");
$this->middleware([ "check.auth:menuplan.edit" ])->only("edit", "update"); $this->middleware([ "check.auth:menuplan.edit" ])->only("edit", "update");
$this->middleware([ "check.auth:menuplan.delete" ])->only("delete"); $this->middleware([ "check.auth:menuplan.delete" ])->only("delete");
@ -194,7 +193,13 @@ class MenuPlanController extends Controller
*/ */
public function destroy($id) public function destroy($id)
{ {
// Find the menu you want to remove
$menuplan = MenuPlan::find($id); $menuplan = MenuPlan::find($id);
// Find the news the you made when creating the menu (if there is a news)
$news = News::query()->join('news_types', 'news_types.id', '=', 'news.type_id')->where('type', '=', 'Menu')->where('arrangement_id', '=', $id);
//Delete the news or/and menu
$news->delete();
$menuplan->delete(); $menuplan->delete();
return redirect()->route("menu-plans.index"); return redirect()->route("menu-plans.index");
} }

View File

@ -2,6 +2,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Event;
use App\Helpers; use App\Helpers;
use App\News; use App\News;
use App\User; use App\User;
@ -17,8 +18,7 @@ class NewsController extends Controller
$this->middleware([ "auth" ]); $this->middleware([ "auth" ]);
$this->middleware([ "lang" ]); $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:news.list" ])->only("index"); $this->middleware([ "check.auth:news.show" ])->only("show", "index");
$this->middleware([ "check.auth:news.show" ])->only("show");
$this->middleware([ "check.auth:news.create" ])->only("create", "store"); $this->middleware([ "check.auth:news.create" ])->only("create", "store");
$this->middleware([ "check.auth:news.edit" ])->only("edit", "update"); $this->middleware([ "check.auth:news.edit" ])->only("edit", "update");
$this->middleware([ "check.auth:news.delete" ])->only("delete"); $this->middleware([ "check.auth:news.delete" ])->only("delete");

View File

@ -13,8 +13,7 @@ class ResourceCategoryController extends Controller
$this->middleware([ "auth" ]); $this->middleware([ "auth" ]);
$this->middleware([ "lang" ]); $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:resource.category.list" ])->only("index"); $this->middleware([ "check.auth:resource.category.show" ])->only("show", "index");
$this->middleware([ "check.auth:resource.category.show" ])->only("show");
$this->middleware([ "check.auth:resource.category.create" ])->only("create", "store"); $this->middleware([ "check.auth:resource.category.create" ])->only("create", "store");
$this->middleware([ "check.auth:resource.category.edit" ])->only("edit", "update"); $this->middleware([ "check.auth:resource.category.edit" ])->only("edit", "update");
$this->middleware([ "check.auth:resource.category.delete" ])->only("delete"); $this->middleware([ "check.auth:resource.category.delete" ])->only("delete");

View File

@ -16,8 +16,7 @@ class ResourceController extends Controller
$this->middleware([ "auth" ]); $this->middleware([ "auth" ]);
$this->middleware([ "lang" ]); $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:resource.list" ])->only("index"); $this->middleware([ "check.auth:resource.show" ])->only("show", "index");
$this->middleware([ "check.auth:resource.show" ])->only("show");
$this->middleware([ "check.auth:resource.create" ])->only("create", "store"); $this->middleware([ "check.auth:resource.create" ])->only("create", "store");
$this->middleware([ "check.auth:resource.edit" ])->only("edit", "update"); $this->middleware([ "check.auth:resource.edit" ])->only("edit", "update");
$this->middleware([ "check.auth:resource.delete" ])->only("delete"); $this->middleware([ "check.auth:resource.delete" ])->only("delete");

View File

@ -13,8 +13,7 @@ class ResourceExtensionController extends Controller
$this->middleware([ "auth" ]); $this->middleware([ "auth" ]);
$this->middleware([ "lang" ]); $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:resource.extension.list" ])->only("index"); $this->middleware([ "check.auth:resource.extension.show" ])->only("show", "index");
$this->middleware([ "check.auth:resource.extension.show" ])->only("show");
$this->middleware([ "check.auth:resource.extension.create" ])->only("create", "store"); $this->middleware([ "check.auth:resource.extension.create" ])->only("create", "store");
$this->middleware([ "check.auth:resource.extension.edit" ])->only("edit", "update"); $this->middleware([ "check.auth:resource.extension.edit" ])->only("edit", "update");
$this->middleware([ "check.auth:resource.extension.delete" ])->only("delete"); $this->middleware([ "check.auth:resource.extension.delete" ])->only("delete");

View File

@ -8,15 +8,14 @@ use Illuminate\Support\Facades\DB;
use Spatie\Permission\Models\Role; use Spatie\Permission\Models\Role;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
class rolesController extends Controller class RolesController extends Controller
{ {
public function __construct() public function __construct()
{ {
$this->middleware([ "auth" ]); $this->middleware([ "auth" ]);
$this->middleware([ "lang" ]); $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:roles.list" ])->only("index"); $this->middleware([ "check.auth:roles.show" ])->only("show", "index");
$this->middleware([ "check.auth:roles.show" ])->only("show");
$this->middleware([ "check.auth:roles.create" ])->only("create", "store"); $this->middleware([ "check.auth:roles.create" ])->only("create", "store");
$this->middleware([ "check.auth:roles.edit" ])->only("edit", "update"); $this->middleware([ "check.auth:roles.edit" ])->only("edit", "update");
$this->middleware([ "check.auth:roles.delete" ])->only("delete"); $this->middleware([ "check.auth:roles.delete" ])->only("delete");

View File

@ -2,6 +2,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Event;
use App\News; use App\News;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
@ -17,6 +18,15 @@ class RootController extends Controller
public function index() { public function index() {
$perPage = 5; $perPage = 5;
$newsCollection = News::query()->orderBy('id', 'desc')->paginate($perPage);
foreach ($newsCollection as $new)
{
if($new->type_id == 3)
if(Event::query()->where('id', '=', $new->arrangement_id)->first() == null)
$new->delete();
}
if(auth()->user()->can('admin.panel.show')) { if(auth()->user()->can('admin.panel.show')) {
if(Response::detect("root.index")->name() == "admin.root.index") if(Response::detect("root.index")->name() == "admin.root.index")
return view("admin.root.index"); return view("admin.root.index");

View File

@ -23,11 +23,11 @@ class UserController extends Controller
public function __construct() public function __construct()
{ {
$this->middleware([ "auth" ])->only("logout"); $this->middleware([ "auth" ])->only("logout");
$this->middleware([ "guest" ])->only("login"); $this->middleware([ "guest" ])->only("login");
$this->middleware([ "lang" ])->except(["login", "showLogin", "showForgot", "forgot"]); $this->middleware([ "lang" ])->except(["login", "showLogin", "showForgot", "forgot"]);
$this->middleware([ "check.auth:user.list" ])->only("index"); $this->middleware([ "check.auth:user.show" ])->only("show", "index");
$this->middleware([ "check.auth:user.show" ])->only("show");
$this->middleware([ "check.auth:user.create" ])->only("create"); $this->middleware([ "check.auth:user.create" ])->only("create");
$this->middleware([ "check.auth:user.edit" ])->only(["edit", "update"]); $this->middleware([ "check.auth:user.edit" ])->only(["edit", "update"]);
$this->middleware([ "check.auth:user.delete" ])->only("delete"); $this->middleware([ "check.auth:user.delete" ])->only("delete");

View File

@ -20,8 +20,7 @@ class WashingMachineController extends Controller
$this->middleware([ "auth" ]); $this->middleware([ "auth" ]);
$this->middleware([ "lang" ]); $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:washing.machine.list" ])->only("index"); $this->middleware([ "check.auth:washing.machine.show" ])->only("show", "index");
$this->middleware([ "check.auth:washing.machine.show" ])->only("show");
$this->middleware([ "check.auth:washing.machine.create" ])->only("create", "store"); $this->middleware([ "check.auth:washing.machine.create" ])->only("create", "store");
$this->middleware([ "check.auth:washing.machine.edit" ])->only("edit", "update"); $this->middleware([ "check.auth:washing.machine.edit" ])->only("edit", "update");
$this->middleware([ "check.auth:washing.machine.delete" ])->only("delete"); $this->middleware([ "check.auth:washing.machine.delete" ])->only("delete");

View File

@ -24,8 +24,7 @@ class WashingReservationController extends Controller
$this->middleware([ "auth" ]); $this->middleware([ "auth" ]);
$this->middleware([ "lang" ]); $this->middleware([ "lang" ]);
$this->middleware([ "check.auth:washing.machine.reservation.list" ])->only(["index", "appindex"]); $this->middleware([ "check.auth:washing.machine.reservation.show" ])->only("show", "index", "appindex");
$this->middleware([ "check.auth:washing.machine.reservation.show" ])->only("show");
$this->middleware([ "check.auth:washing.machine.reservation.create" ])->only("create", "store"); $this->middleware([ "check.auth:washing.machine.reservation.create" ])->only("create", "store");
$this->middleware([ "check.auth:washing.machine.reservation.edit" ])->only("edit", "update"); $this->middleware([ "check.auth:washing.machine.reservation.edit" ])->only("edit", "update");
$this->middleware([ "check.auth:washing.machine.reservation.delete" ])->only("delete"); $this->middleware([ "check.auth:washing.machine.reservation.delete" ])->only("delete");
@ -266,7 +265,7 @@ class WashingReservationController extends Controller
{ {
WashingReservation::query()->where('time', '<', date('Y-m-d H:i:s', strtotime('-1 hour')))->delete(); 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)); $reservations = WashingReservation::query()->join('washing_machines', 'washing_machines.id', '=', 'washing_reservations.machine_id')->join('locations', 'locations.id', '=', 'washing_machines.location_id')->where("user_id", "=", auth()->user()->id)->orderBY('time' , 'asc')->paginate($request->query("limit", 20));
return Response::detect("washing-reservations.index", [ "reservations" => $reservations]); return Response::detect("washing-reservations.index", [ "reservations" => $reservations]);
} }

View File

@ -18,35 +18,15 @@ class PermissionSeeder extends Seeder
* The USER specific permissions * The USER specific permissions
*/ */
"user.create" => "Creation of new user", "user.create" => "Creation of new user",
"user.list" => "Access to list the users.",
"user.show" => "Shows another user profile.", "user.show" => "Shows another user profile.",
"user.edit" => "Allows editing of other users.", "user.edit" => "Allows editing of other users.",
"user.delete" => "Allows deleting of other users.", "user.delete" => "Allows deleting of other users.",
"ownuser.edit" => "Allows editing of your own user", "ownuser.edit" => "Allows editing of your own user",
/**
* The CALENDAR specific permissions //TODO: Do we use them?
*/
"calendar.create" => "Create a new event.",
"calendar.list" => "Shows all events.",
"calendar.show" => "Shows a specific event.",
"calendar.edit" => "Allows editing of events.",
"calendar.delete" => "Allows the deletion of events.",
/**
* The EXTERNAL LINK specific permissions
*/
"link.external.create" => "Create a new external link.",
"link.external.list" => "List all external links.",
"link.external.show" => "Show a specific external link",
"link.external.edit" => "Allows editing of external links.",
"link.external.delete" => "Allows deletion of external links",
/** /**
* The EVENT specific permissions * The EVENT specific permissions
*/ */
"event.create" => "Create a new event", "event.create" => "Create a new event",
"event.list" => "Shows all events",
"event.show" => "Shows a specific event", "event.show" => "Shows a specific event",
"event.edit" => "Allows editing of events", "event.edit" => "Allows editing of events",
"event.delete" => "Allows deletion of events", "event.delete" => "Allows deletion of events",
@ -55,7 +35,6 @@ class PermissionSeeder extends Seeder
* The CONTACT specific permissions * The CONTACT specific permissions
*/ */
"contact.create" => "Creates a new contact", "contact.create" => "Creates a new contact",
"contact.list" => "Shows all contacts",
"contact.show" => "Shows a specific contact", "contact.show" => "Shows a specific contact",
"contact.edit" => "allows editing of contacts", "contact.edit" => "allows editing of contacts",
"contact.delete" => "Allows deletion of contacts", "contact.delete" => "Allows deletion of contacts",
@ -64,7 +43,6 @@ class PermissionSeeder extends Seeder
* The FEEDBACK specific permissions * The FEEDBACK specific permissions
*/ */
"feedback.create" => "Creates a new feedback message", "feedback.create" => "Creates a new feedback message",
"feedback.list" => "Shows all feedback messages",
"feedback.show" => "Shows a specific feedback message", "feedback.show" => "Shows a specific feedback message",
"feedback.edit" => "allows editing of feedback messages", "feedback.edit" => "allows editing of feedback messages",
"feedback.delete" => "allows deletion of feedback messages", "feedback.delete" => "allows deletion of feedback messages",
@ -73,7 +51,6 @@ class PermissionSeeder extends Seeder
* The MENUPLAN specific permissions * The MENUPLAN specific permissions
*/ */
"menuplan.create" => "Create a new menuplan", "menuplan.create" => "Create a new menuplan",
"menuplan.list" => "Shows all menuplans",
"menuplan.show" => "Shows a specific menuplan", "menuplan.show" => "Shows a specific menuplan",
"menuplan.edit" => "Allows editing of menuplans", "menuplan.edit" => "Allows editing of menuplans",
"menuplan.delete" => "Allows deletion of menuplans", "menuplan.delete" => "Allows deletion of menuplans",
@ -82,7 +59,6 @@ class PermissionSeeder extends Seeder
* The RESOURCE CATEGORY specific permissions * The RESOURCE CATEGORY specific permissions
*/ */
"resource.category.create" => "Create a new resource category", "resource.category.create" => "Create a new resource category",
"resource.category.list" => "Shows all resource categories",
"resource.category.show" => "Shows a specific resource category", "resource.category.show" => "Shows a specific resource category",
"resource.category.edit" => "Allows editing of resource categories", "resource.category.edit" => "Allows editing of resource categories",
"resource.category.delete" => "Allows deletion of resource categories", "resource.category.delete" => "Allows deletion of resource categories",
@ -91,7 +67,6 @@ class PermissionSeeder extends Seeder
* The RESOURCE EXTENSION specific permissions * The RESOURCE EXTENSION specific permissions
*/ */
"resource.extension.create" => "Create a new resource extension", "resource.extension.create" => "Create a new resource extension",
"resource.extension.list" => "Shows all resource extensions",
"resource.extension.show" => "Shows a specific resource extension", "resource.extension.show" => "Shows a specific resource extension",
"resource.extension.edit" => "Allows editing of resource extensions", "resource.extension.edit" => "Allows editing of resource extensions",
"resource.extension.delete" => "Allows deletion of resource extensions", "resource.extension.delete" => "Allows deletion of resource extensions",
@ -100,7 +75,6 @@ class PermissionSeeder extends Seeder
* The RESOURCE specific permissions * The RESOURCE specific permissions
*/ */
"resource.create" => "Create a new resource", "resource.create" => "Create a new resource",
"resource.list" => "Shows all resources",
"resource.show" => "Shows a specific resource", "resource.show" => "Shows a specific resource",
"resource.edit" => "Allows editing of resources", "resource.edit" => "Allows editing of resources",
"resource.delete" => "Allows deletion of resources", "resource.delete" => "Allows deletion of resources",
@ -109,7 +83,6 @@ class PermissionSeeder extends Seeder
* The WASHING MACHINE specific permissions * The WASHING MACHINE specific permissions
*/ */
"washing.machine.create" => "Create a new washing machine", "washing.machine.create" => "Create a new washing machine",
"washing.machine.list" => "Shows all washing machines",
"washing.machine.show" => "Shows a specific washing machine", "washing.machine.show" => "Shows a specific washing machine",
"washing.machine.edit" => "Allows editing of washing machines", "washing.machine.edit" => "Allows editing of washing machines",
"washing.machine.delete" => "Allows deletion of washing machines", "washing.machine.delete" => "Allows deletion of washing machines",
@ -118,7 +91,6 @@ class PermissionSeeder extends Seeder
* The WASHING MACHINE RESERVATION specific permissions * The WASHING MACHINE RESERVATION specific permissions
*/ */
"washing.machine.reservation.create" => "Create a new washing machine reservation", "washing.machine.reservation.create" => "Create a new washing machine reservation",
"washing.machine.reservation.list" => "Shows all washing machine reservations",
"washing.machine.reservation.show" => "Shows a specific washing machine reservation", "washing.machine.reservation.show" => "Shows a specific washing machine reservation",
"washing.machine.reservation.edit" => "Allows editing of washing machine reservations", "washing.machine.reservation.edit" => "Allows editing of washing machine reservations",
"washing.machine.reservation.delete" => "Allows deletion of washing machine reservations", "washing.machine.reservation.delete" => "Allows deletion of washing machine reservations",
@ -127,7 +99,6 @@ class PermissionSeeder extends Seeder
* The ROLES specific permissions * The ROLES specific permissions
*/ */
"roles.create" => "Create a new role", "roles.create" => "Create a new role",
"roles.list" => "Shows all roles",
"roles.show" => "Shows a specific role", "roles.show" => "Shows a specific role",
"roles.edit" => "Allows editing of roles", "roles.edit" => "Allows editing of roles",
"roles.delete" => "Allows deletion of roles", "roles.delete" => "Allows deletion of roles",
@ -136,7 +107,6 @@ class PermissionSeeder extends Seeder
* The GUIDE specific permissions * The GUIDE specific permissions
*/ */
"guides.create" => "Create a new guide", "guides.create" => "Create a new guide",
"guides.list" => "Shows all guides",
"guides.show" => "Shows a specific guide", "guides.show" => "Shows a specific guide",
"guides.edit" => "Allows editing of guides", "guides.edit" => "Allows editing of guides",
"guides.delete" => "Allows deletion of guides", "guides.delete" => "Allows deletion of guides",
@ -145,7 +115,6 @@ class PermissionSeeder extends Seeder
* The LOCATION specific permissions * The LOCATION specific permissions
*/ */
"locations.create" => "Create a new location", "locations.create" => "Create a new location",
"locations.list" => "Shows all locations",
"locations.show" => "Shows a specific location", "locations.show" => "Shows a specific location",
"locations.edit" => "Allows editing of locations", "locations.edit" => "Allows editing of locations",
"locations.delete" => "Allows deletion of locations", "locations.delete" => "Allows deletion of locations",
@ -154,7 +123,6 @@ class PermissionSeeder extends Seeder
* The NEWS specific permissions * The NEWS specific permissions
*/ */
"news.create" => "Create a new location", "news.create" => "Create a new location",
"news.list" => "Shows all locations",
"news.show" => "Shows a specific location", "news.show" => "Shows a specific location",
"news.edit" => "Allows editing of locations", "news.edit" => "Allows editing of locations",
"news.delete" => "Allows deletion of locations", "news.delete" => "Allows deletion of locations",

View File

@ -40,20 +40,15 @@ class RoleSeeder extends Seeder
//Bruger Permissions //Bruger Permissions
$brugerPermissions = new Collection(); $brugerPermissions = new Collection();
$brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "event.list")->first()); $brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "contact.show")->first());
$brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "link.external.list")->first());
$brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "contact.list")->first());
$brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "feedback.create")->first()); $brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "feedback.create")->first());
$brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "menuplan.list")->first()); $brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "menuplan.show")->first());
$brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "washing.machine.reservation.create")->first()); $brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "washing.machine.reservation.create")->first());
$brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "washing.machine.reservation.delete")->first()); $brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "washing.machine.reservation.delete")->first());
$brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "washing.machine.reservation.list")->first()); $brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "washing.machine.reservation.show")->first());
$brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "ownuser.edit")->first()); $brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "ownuser.edit")->first());
$brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "event.list")->first());
$brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "event.show")->first()); $brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "event.show")->first());
$brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "guides.list")->first());
$brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "guides.show")->first()); $brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "guides.show")->first());
$brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "news.list")->first());
$brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "news.show")->first()); $brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "news.show")->first());
//Give permissions to Bruger (id: 2) //Give permissions to Bruger (id: 2)

View File

@ -7127,11 +7127,11 @@ main {
html, html,
body { body {
background-color: #666666; background-color: #2c2f33;
} }
main { main {
background-color: #666666; background-color: #2c2f33;
} }
* { * {

View File

@ -4,6 +4,7 @@ function toggleMenu(menu) {
let htmlElement = document.getElementsByTagName('html')[0]; let htmlElement = document.getElementsByTagName('html')[0];
let mainElement = document.getElementsByTagName('main')[0]; let mainElement = document.getElementsByTagName('main')[0];
let iconElement = document.getElementById("icon"); let iconElement = document.getElementById("icon");
let headerElement = document.getElementById("header");
if(menuElement.classList.contains("hide")) { if(menuElement.classList.contains("hide")) {
menuElement.classList.remove("hide"); menuElement.classList.remove("hide");
@ -12,6 +13,7 @@ function toggleMenu(menu) {
logoElement.src = '/images/logos/Logo-hvid.svg'; logoElement.src = '/images/logos/Logo-hvid.svg';
iconElement.classList.remove("fa-times"); iconElement.classList.remove("fa-times");
iconElement.classList.add("fa-bars"); iconElement.classList.add("fa-bars");
headerElement.style.position = 'fixed';
} else { } else {
menuElement.classList.add("hide"); menuElement.classList.add("hide");
mainElement.classList.add("d-none"); mainElement.classList.add("d-none");
@ -19,6 +21,8 @@ function toggleMenu(menu) {
logoElement.src = '/images/logos/Logo-hvid.svg'; logoElement.src = '/images/logos/Logo-hvid.svg';
iconElement.classList.remove("fa-bars"); iconElement.classList.remove("fa-bars");
iconElement.classList.add("fa-times"); iconElement.classList.add("fa-times");
headerElement.style.position = 'relative';
headerElement.style.top = '0';
} }
} }

View File

@ -1,9 +1,9 @@
html, body { html, body {
background-color: rgb(102, 102, 102); background-color: #2c2f33;
} }
main { main {
background-color: rgb(102, 102, 102); background-color: #2c2f33;
} }
* { * {

View File

@ -11,7 +11,9 @@
@section("content") @section("content")
<div class="row align-items-center"> <div class="row align-items-center">
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('contacts.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Kontakt</a> @if(auth()->user()->can('contact.create'))
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('contacts.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Kontakt</a>
@endif
<form method="post" action="{{ route("users.store") }}"> <form method="post" action="{{ route("users.store") }}">
@csrf @csrf
@ -20,7 +22,7 @@
<button id="filterButton" type="button" class="btn btn-sde-blue mb-0">Filter</button> <button id="filterButton" type="button" class="btn btn-sde-blue mb-0">Filter</button>
</div> </div>
<div id="showHideCheckbox" class="mt-1 "> <div id="showHideCheckbox" class="mt-1">
<input class="checkbox-inline" type="checkbox" name="checkbox" id="navn" value="navn"> <input class="checkbox-inline" type="checkbox" name="checkbox" id="navn" value="navn">
<label for="navn">Navn</label> <label for="navn">Navn</label>
<input class="checkbox-inline" type="checkbox" name="checkbox" id="titel" value="titel"> <input class="checkbox-inline" type="checkbox" name="checkbox" id="titel" value="titel">
@ -38,8 +40,12 @@
<th>Titel</th> <th>Titel</th>
<th>E-mail</th> <th>E-mail</th>
<th>Tlf</th> <th>Tlf</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th> @if(auth()->user()->can('contact.edit'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th> <th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
@endif
@if(auth()->user()->can('contact.delete'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
@endif
</tr> </tr>
@foreach($contacts as $contact) @foreach($contacts as $contact)
<tr> <tr>
@ -47,14 +53,18 @@
<td>{{ $contact->title }}</td> <td>{{ $contact->title }}</td>
<td>{{ $contact->email }}</td> <td>{{ $contact->email }}</td>
<td>{{ $contact->phone }}</td> <td>{{ $contact->phone }}</td>
<td><a href="{{ route("contacts.edit", [ "contact" => $contact ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> @if(auth()->user()->can('contact.edit'))
<td><form method="post" action="{{ route("contacts.destroy", [ "contact" => $contact ]) }}" class="w-100 nostyle"> <td><a href="{{ route("contacts.edit", [ "contact" => $contact ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@csrf @endif
@method("delete") @if(auth()->user()->can('contact.delete'))
<td><form method="post" action="{{ route("contacts.destroy", [ "contact" => $contact ]) }}" class="w-100 nostyle">
@csrf
@method("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> <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> </form>
</td> </td>
@endif
</tr> </tr>
@endforeach @endforeach
</table> </table>

View File

@ -14,7 +14,9 @@
date_default_timezone_set('Europe/Copenhagen'); date_default_timezone_set('Europe/Copenhagen');
?> ?>
<div class="row align-items-center"> <div class="row align-items-center">
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('events.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Aktivitet</a> @if(auth()->user()->can('event.show'))
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('events.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Aktivitet</a>
@endif
<form method="post" action="{{ route("events.store") }}"> <form method="post" action="{{ route("events.store") }}">
@csrf @csrf
@ -28,8 +30,12 @@
<th>Aktivitet Ansvarlig</th> <th>Aktivitet Ansvarlig</th>
<th>Aktivitet Dato</th> <th>Aktivitet Dato</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/eye.svg') }}" alt="Show"></th> <th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/eye.svg') }}" alt="Show"></th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th> @if(auth()->user()->can('event.edit'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th> <th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
@endif
@if(auth()->user()->can('event.delete'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
@endif
</tr> </tr>
@foreach($events as $event) @foreach($events as $event)
@if (date('Y-m-d H:i', strtotime('-1 day')) < date('Y-m-d H:i', strtotime($event->date))) @if (date('Y-m-d H:i', strtotime('-1 day')) < date('Y-m-d H:i', strtotime($event->date)))
@ -38,14 +44,18 @@
<td>{{ $event->accountable }}</td> <td>{{ $event->accountable }}</td>
<td>{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($event->date))->format('d/m/Y \k\l\. H:i') }}</td> <td>{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($event->date))->format('d/m/Y \k\l\. H:i') }}</td>
<td><a href="{{ route("events.signups", [ "event" => $event ]) }}"><img class="w-100" src="{{ asset('/images/icons/eye-dark.svg') }}" alt="Show"></a></td> <td><a href="{{ route("events.signups", [ "event" => $event ]) }}"><img class="w-100" src="{{ asset('/images/icons/eye-dark.svg') }}" alt="Show"></a></td>
<td><a href="{{ route("events.edit", [ "event" => $event ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> @if(auth()->user()->can('event.edit'))
<td><form method="post" action="{{ route("events.destroy", [ "event" => $event ]) }}" class="w-100 nostyle"> <td><a href="{{ route("events.edit", [ "event" => $event ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@csrf @endif
@method("delete") @if(auth()->user()->can('event.delete'))
<td><form method="post" action="{{ route("events.destroy", [ "event" => $event ]) }}" class="w-100 nostyle">
@csrf
@method("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> <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> </form>
</td> </td>
@endif
</tr> </tr>
@endif @endif
@endforeach @endforeach

View File

@ -34,20 +34,24 @@
<th style="width: 6em;">Dato</th> <th style="width: 6em;">Dato</th>
<th>Feedback Besked</th> <th>Feedback Besked</th>
<th style="width: 5em;">Ris el. Ros</th> <th style="width: 5em;">Ris el. Ros</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th> @if(auth()->user()->can('feedback.delete'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
@endif
</tr> </tr>
@foreach($feedback as $fb) @foreach($feedback as $fb)
<tr> <tr>
<td>{{ date('d-m-Y', strtotime($fb->created_at)) }}</td> <td>{{ date('d-m-Y', strtotime($fb->created_at)) }}</td>
<td>{{ $fb->message }}</td> <td>{{ $fb->message }}</td>
<td>{{ $fb->suggestion_form }}</td> <td>{{ $fb->suggestion_form }}</td>
<td><form method="post" action="{{ route("feedbacks.destroy", [ "feedback" => $fb ]) }}" class="w-100 nostyle"> @if(auth()->user()->can('feedback.delete'))
@csrf <td><form method="post" action="{{ route("feedbacks.destroy", [ "feedback" => $fb ]) }}" class="w-100 nostyle">
@method("delete") @csrf
@method("delete")
<button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button> <button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form> </form>
</td> </td>
@endif
</tr> </tr>
@endforeach @endforeach
</table> </table>

View File

@ -10,26 +10,36 @@
@endsection @endsection
@section("content") @section("content")
<div class="row align-items-center"> @if(auth()->user()->can('guides.create'))
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('guides.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Bruger Vejledning</a> <div class="row align-items-center mb-2">
</div> <a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('guides.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Bruger Vejledning</a>
<table class="tbl mt-2"> </div>
@endif
<table class="tbl">
<tr> <tr>
<th>Navn</th> <th>Navn</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th> @if(auth()->user()->can('guides.edit'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th> <th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
@endif
@if(auth()->user()->can('guides.delete'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
@endif
</tr> </tr>
@foreach($guides as $guide) @foreach($guides as $guide)
<tr> <tr>
<td>{{$guide->name}}</td> <td>{{$guide->name}}</td>
<td><a href="{{ route("guides.edit", [ "guide" => $guide ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> @if(auth()->user()->can('guides.edit'))
<td><form method="post" action="{{ route("guides.destroy", [ "guide" => $guide ]) }}" class="w-100 nostyle"> <td><a href="{{ route("guides.edit", [ "guide" => $guide ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@csrf @endif
@method("delete") @if(auth()->user()->can('guides.delete'))
<td><form method="post" action="{{ route("guides.destroy", [ "guide" => $guide ]) }}" class="w-100 nostyle">
@csrf
@method("delete")
<button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button> <button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form> </form>
</td> </td>
@endif
</tr> </tr>
@endforeach @endforeach
</table> </table>

View File

@ -125,39 +125,61 @@
</div> </div>
</div> </div>
@if(auth()->user()->can('user.show'))
<div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "users.index") active @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 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> </div>
@endif
@if(auth()->user()->can('roles.show'))
<div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "roles.index") active @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 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> </div>
@endif
@if(auth()->user()->can('news.show'))
<div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "news.index") active @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 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> </div>
@endif
@if(auth()->user()->can('menuplan.show'))
<div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "menu-plans.index") active @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 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> </div>
@endif
@if(auth()->user()->can('event.show'))
<div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "events.index") active @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 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> </div>
@endif
@if(auth()->user()->can('locations.show'))
<div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "locations.index") active @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 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> </div>
@endif
@if(auth()->user()->can('washing.machine.show'))
<div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "washing-machines.index") active @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 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> </div>
@endif
@if(auth()->user()->can('washing.machine.reservation.show'))
<div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "washing-reservations.index") active @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 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> </div>
@endif
@if(auth()->user()->can('contact.show'))
<div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "contacts.index") active @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 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> </div>
@endif
@if(auth()->user()->can('guides.show'))
<div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "guides.index") active @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 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> </div>
@endif
@if(auth()->user()->can('feedback.show'))
<div class="segment @if(\Illuminate\Support\Facades\Request::route()->getName() == "feedbacks.index") active @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 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>
@endif
</div> </div>
<div class="w-85" style="background-color: #cccccc;"> <div class="w-85" style="background-color: #cccccc;">
<div class="directorypath text-white"> <div class="directorypath text-white">

View File

@ -10,28 +10,38 @@
@endsection @endsection
@section("content") @section("content")
<div class="row align-items-center"> @if(auth()->user()->can('locations.create'))
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('locations.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Lokation</a> <div class="row align-items-center mb-2">
</div> <a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('locations.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Lokation</a>
<table class="tbl mt-2"> </div>
@endif
<table class="tbl">
<tr> <tr>
<th>Navn</th> <th>Navn</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/eye.svg') }}" alt="Show"></th> <th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/eye.svg') }}" alt="Show"></th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th> @if(auth()->user()->can('locations.edit'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th> <th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
@endif
@if(auth()->user()->can('locations.delete'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
@endif
</tr> </tr>
@foreach($locations as $location) @foreach($locations as $location)
<tr> <tr>
<td>{{$location->name}}</td> <td>{{$location->name}}</td>
<td><a href="{{ route("locations.show", [ "location" => $location ]) }}"><img class="w-100" src="{{ asset('/images/icons/eye-dark.svg') }}" alt="Show"></a></td> <td><a href="{{ route("locations.show", [ "location" => $location ]) }}"><img class="w-100" src="{{ asset('/images/icons/eye-dark.svg') }}" alt="Show"></a></td>
<td><a href="{{ route("locations.edit", [ "location" => $location ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> @if(auth()->user()->can('locations.edit'))
<td><form method="post" action="{{ route("locations.destroy", [ "location" => $location ]) }}" class="w-100 nostyle"> <td><a href="{{ route("locations.edit", [ "location" => $location ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@csrf @endif
@method("delete") @if(auth()->user()->can('locations.delete'))
<td><form method="post" action="{{ route("locations.destroy", [ "location" => $location ]) }}" class="w-100 nostyle">
@csrf
@method("delete")
<button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button> <button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form> </form>
</td> </td>
@endif
</tr> </tr>
@endforeach @endforeach
</table> </table>

View File

@ -11,29 +11,39 @@
@section("content") @section("content")
<script src="{{ asset("/js/jquery-3.2.1.min.js") }}"></script> <script src="{{ asset("/js/jquery-3.2.1.min.js") }}"></script>
<div class="row align-items-center"> @if(auth()->user()->can('menuplan.create'))
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('menu-plans.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Menuplan</a> <div class="row align-items-center mb-2">
</div> <a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('menu-plans.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Menuplan</a>
</div>
@endif
<table class="tbl mt-2"> <table class="tbl">
<tr> <tr>
<th>Uge</th> <th>Uge</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/print-hvid.svg') }}" alt="Print"></th> <th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/print-hvid.svg') }}" alt="Print"></th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th> @if(auth()->user()->can('menuplan.edit'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th> <th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
@endif
@if(auth()->user()->can('menuplan.delete'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
@endif
</tr> </tr>
@foreach($menuPlans as $menuplan) @foreach($menuPlans as $menuplan)
<tr> <tr>
<td>{{$menuplan->week}}</td> <td>{{$menuplan->week}}</td>
<td><a href="{{ route("pdf.genPDF", [ "menuPlan" => $menuplan ]) }}" target="_blank"><img class="w-100" src="{{ asset('/images/icons/print.svg') }}" alt="Print"></a></td> <td><a href="{{ route("pdf.genPDF", [ "menuPlan" => $menuplan ]) }}" target="_blank"><img class="w-100" src="{{ asset('/images/icons/print.svg') }}" alt="Print"></a></td>
<td><a href="{{ route("menu-plans.edit", [ "menu_plan" => $menuplan ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> @if(auth()->user()->can('menuplan.edit'))
<td><form method="post" action="{{ route("menu-plans.destroy", [ "menu_plan" => $menuplan ]) }}" class="w-100 nostyle"> <td><a href="{{ route("menu-plans.edit", [ "menu_plan" => $menuplan ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@csrf @endif
@method("delete") @if(auth()->user()->can('menuplan.delete'))
<td><form method="post" action="{{ route("menu-plans.destroy", [ "menu_plan" => $menuplan ]) }}" class="w-100 nostyle">
@csrf
@method("delete")
<button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button> <button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form> </form>
</td> </td>
@endif
</tr> </tr>
@endforeach @endforeach
</table> </table>

View File

@ -10,26 +10,36 @@
@endsection @endsection
@section("content") @section("content")
<div class="row align-items-center"> @if(auth()->user()->can('news.create'))
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('news.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Nyheder</a> <div class="row align-items-center mb-2">
</div> <a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('news.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Nyheder</a>
<table class="tbl mt-2"> </div>
@endif
<table class="tbl">
<tr> <tr>
<th>Navn</th> <th>Navn</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th> @if(auth()->user()->can('news.edit'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th> <th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
@endif
@if(auth()->user()->can('news.delete'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
@endif
</tr> </tr>
@foreach($news as $new) @foreach($news as $new)
<tr> <tr>
<td>{{$new->subname}}</td> <td>{{$new->subname}}</td>
<td><a href="{{ route("news.edit", [ "news" => $new ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> @if(auth()->user()->can('news.edit'))
<td><form method="post" action="{{ route("news.destroy", [ "news" => $new ]) }}" class="w-100 nostyle"> <td><a href="{{ route("news.edit", [ "news" => $new ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@csrf @endif
@method("delete") @if(auth()->user()->can('news.delete'))
<td><form method="post" action="{{ route("news.destroy", [ "news" => $new ]) }}" class="w-100 nostyle">
@csrf
@method("delete")
<button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button> <button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form> </form>
</td> </td>
@endif
</tr> </tr>
@endforeach @endforeach
</table> </table>

View File

@ -11,7 +11,9 @@
@section("content") @section("content")
<div class="row align-items-center"> <div class="row align-items-center">
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('roles.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Rolle</a> @if(auth()->user()->can('roles.create'))
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('roles.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Rolle</a>
@endif
<form method="post" action="{{ route("roles.store") }}"> <form method="post" action="{{ route("roles.store") }}">
@csrf @csrf
@ -23,21 +25,29 @@
<tr> <tr>
<th>Navn</th> <th>Navn</th>
<th>Beskrivelse</th> <th>Beskrivelse</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th> @if(auth()->user()->can('roles.edit'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th> <th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
@endif
@if(auth()->user()->can('roles.delete'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
@endif
</tr> </tr>
@foreach($roles as $role) @foreach($roles as $role)
<tr> <tr>
<td>{{ $role->name }}</td> <td>{{ $role->name }}</td>
<td>{{ $role->description }}</td> <td>{{ $role->description }}</td>
<td><a href="{{ route("roles.edit", [ "role" => $role->id ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> @if(auth()->user()->can('roles.edit'))
<td><form method="post" action="{{ route("roles.destroy", [ "role" => $role ]) }}" class="w-100 nostyle"> <td><a href="{{ route("roles.edit", [ "role" => $role->id ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@endif
@if(auth()->user()->can('roles.delete'))
<td><form method="post" action="{{ route("roles.destroy", [ "role" => $role ]) }}" class="w-100 nostyle">
@csrf @csrf
@method("delete") @method("delete")
<button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button> <button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form> </form>
</td> </td>
@endif
</tr> </tr>
@endforeach @endforeach
</table> </table>

View File

@ -50,7 +50,9 @@
<div class="row align-items-center"> <div class="row align-items-center">
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('users.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Bruger</a> @if(auth()->user()->can('user.create'))
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('users.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Bruger</a>
@endif
<form method="post" action="{{ route("users.store") }}"> <form method="post" action="{{ route("users.store") }}">
@csrf @csrf
@ -82,8 +84,12 @@
<th>Tlf nr</th> <th>Tlf nr</th>
<th>Rolle(r)</th> <th>Rolle(r)</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/eye.svg') }}" alt="ShowImage"></th> <th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/eye.svg') }}" alt="ShowImage"></th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th> @if(auth()->user()->can('user.edit'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th> <th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
@endif
@if(auth()->user()->can('user.delete'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
@endif
</tr> </tr>
@foreach($users as $user) @foreach($users as $user)
<tr> <tr>
@ -106,14 +112,18 @@
@else @else
<td style="overflow: visible"><a class="showUsers noImages"><img src="{{ asset('/images/icons/eye-dark.svg') }}"><img src="" class="showUserImages"></a></td> <td style="overflow: visible"><a class="showUsers noImages"><img src="{{ asset('/images/icons/eye-dark.svg') }}"><img src="" class="showUserImages"></a></td>
@endif @endif
<td><a href="{{ route("users.edit", [ "user" => $user->id ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> @if(auth()->user()->can('user.edit'))
<td><form method="post" action="{{ route("users.destroy", [ "user" => $user ]) }}" class="w-100 nostyle"> <td><a href="{{ route("users.edit", [ "user" => $user->id ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@csrf @endif
@method("delete") @if(auth()->user()->can('user.delete'))
<td><form method="post" action="{{ route("users.destroy", [ "user" => $user ]) }}" class="w-100 nostyle">
@csrf
@method("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> <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> </form>
</td> </td>
@endif
</tr> </tr>
@endforeach @endforeach
</table> </table>

View File

@ -11,7 +11,9 @@
@section("content") @section("content")
<div class="row align-items-center"> <div class="row align-items-center">
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('washing-machines.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Vaskemaskine</a> @if(auth()->user()->can('washing.machine.create'))
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('washing-machines.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Vaskemaskine</a>
@endif
<div class="mt-1 ml-1"> <div class="mt-1 ml-1">
<select name="risRosName" id="locationID"> <select name="risRosName" id="locationID">
<option selected="selected" name="all" value="all">Alle</option> <option selected="selected" name="all" value="all">Alle</option>
@ -25,21 +27,29 @@
<tr> <tr>
<th>Navn</th> <th>Navn</th>
<th>Lokation</th> <th>Lokation</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th> @if(auth()->user()->can('washing.machine.edit'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th> <th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
@endif
@if(auth()->user()->can('washing.machine.delete'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
@endif
</tr> </tr>
@foreach($machines as $machine) @foreach($machines as $machine)
<tr> <tr>
<td>{{$machine->name}}</td> <td>{{$machine->name}}</td>
<td>{{\App\Location::query()->where("id", "=", $machine->location_id)->first()->name}}</td> <td>{{\App\Location::query()->where("id", "=", $machine->location_id)->first()->name}}</td>
<td><a href="{{ route('washing-machines.edit', [ 'washing_machine' => $machine ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> @if(auth()->user()->can('washing.machine.edit'))
<td><form method="post" action="{{ route('washing-machines.destroy', [ 'washing_machine' => $machine ]) }}" class="w-100 nostyle"> <td><a href="{{ route('washing-machines.edit', [ 'washing_machine' => $machine ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@csrf @endif
@method("delete") @if(auth()->user()->can('washing.machine.delete'))
<td><form method="post" action="{{ route('washing-machines.destroy', [ 'washing_machine' => $machine ]) }}" class="w-100 nostyle">
@csrf
@method("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> <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> </form>
</td> </td>
@endif
</tr> </tr>
@endforeach @endforeach
</table> </table>

View File

@ -19,7 +19,9 @@
<th>Vaskemaskine</th> <th>Vaskemaskine</th>
<th>Tidspunkt</th> <th>Tidspunkt</th>
<th>Bruger</th> <th>Bruger</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th> @if(auth()->user()->can('washing.machine.reservation.delete'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
@endif
</tr> </tr>
@foreach($reservations as $reservation) @foreach($reservations as $reservation)
@if(date('Y-m-d H:i:s', strtotime('-1 hour')) < $reservation->time) @if(date('Y-m-d H:i:s', strtotime('-1 hour')) < $reservation->time)
@ -28,13 +30,15 @@
<td>{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}</td> <td>{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}</td>
<td>{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y \k\l\. H:i') }}</td> <td>{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y \k\l\. H:i') }}</td>
<td>{{ ucfirst(\App\User::query()->find($reservation->user_id)->name_first) }} {{ ucfirst(\App\User::query()->find($reservation->user_id)->name_last) }}</td> <td>{{ ucfirst(\App\User::query()->find($reservation->user_id)->name_first) }} {{ ucfirst(\App\User::query()->find($reservation->user_id)->name_last) }}</td>
<td><form method="post" action="{{ route('washing-reservations.destroy', ['washing_reservation' => $reservation]) }}" class="w-100 nostyle"> @if(auth()->user()->can('washing.machine.reservation.delete'))
@csrf <td><form method="post" action="{{ route('washing-reservations.destroy', ['washing_reservation' => $reservation]) }}" class="w-100 nostyle">
@method("delete") @csrf
@method("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> <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> </form>
</td> </td>
@endif
</tr> </tr>
@endif @endif
@endforeach @endforeach

View File

@ -47,7 +47,8 @@
</div> </div>
@endif @endif
<div class="container"> <div class="container">
{!! \App\Helpers::closetags(substr($guide->guide_articles, 0, 300)) !!} @php $tags = [ '<p>', '<b>', '<em>', '<a>', '<u>', '<s>', '<sub>', '<ul>', '<li>', '<sup>', '<div>', '<blockquote>', '<ol>', '<strong>', '<br>', '<h1>', '<h2>', '<h3>', '<h4>', '<h5>', '<h6>', '<h7>', '<span>'] @endphp
{!! \App\Helpers::closetags(substr(strip_tags($guide->guide_articles, $tags), 0, 300)) !!}
<div class="row" style="justify-content: center;"> <div class="row" style="justify-content: center;">
<a style="margin: 0; padding: 0; text-align: center; font-weight: 700;" class="sde-blue" href="{{route("guides.show", ["guide" => $guide->id ])}}">{{__('msg.læsmere')}}</a> <a style="margin: 0; padding: 0; text-align: center; font-weight: 700;" class="sde-blue" href="{{route("guides.show", ["guide" => $guide->id ])}}">{{__('msg.læsmere')}}</a>
</div> </div>

View File

@ -34,30 +34,40 @@
<img src="{{URL::asset('/images/icons/Home.svg')}}" alt="Home"> <img src="{{URL::asset('/images/icons/Home.svg')}}" alt="Home">
Home Home
</a> </a>
@if(auth()->user()->can('menuplan.show'))
<a href="{{ route("menu-plans.index") }}"> <a href="{{ route("menu-plans.index") }}">
<img src="{{URL::asset('/images/icons/Menuplan.svg')}}" alt="Menuplan"> <img src="{{URL::asset('/images/icons/Menuplan.svg')}}" alt="Menuplan">
{{ __('msg.menuplan') }} {{ __('msg.menuplan') }}
</a> </a>
@endif
@if(auth()->user()->can('event.show'))
<a href="{{ route("events.index") }}"> <a href="{{ route("events.index") }}">
<img src="{{URL::asset('/images/icons/Aktiviteter.svg')}}" alt="Aktiviteter"> <img src="{{URL::asset('/images/icons/Aktiviteter.svg')}}" alt="Aktiviteter">
{{ __('msg.aktiviteter') }} {{ __('msg.aktiviteter') }}
</a> </a>
@endif
@if(auth()->user()->can('washing.machine.reservation.show'))
<a href="{{ route("washing-reservations.appindex") }}"> <a href="{{ route("washing-reservations.appindex") }}">
<img src="{{URL::asset('/images/icons/Vaske booking liste.svg')}}" alt="Reservationer"> <img src="{{URL::asset('/images/icons/Vaske booking liste.svg')}}" alt="Reservationer">
{{ __('msg.reservationer') }} {{ __('msg.reservationer') }}
</a> </a>
@endif
@if(auth()->user()->can('contact.show'))
<a href="{{ route("contacts.index") }}"> <a href="{{ route("contacts.index") }}">
<img src="{{URL::asset('/images/icons/Kontoret.svg')}}" alt="Kontakter"> <img src="{{URL::asset('/images/icons/Kontoret.svg')}}" alt="Kontakter">
{{ __('msg.kontoret') }} {{ __('msg.kontoret') }}
</a> </a>
@endif
<a href="{{ route("phones.index") }}"> <a href="{{ route("phones.index") }}">
<img src="{{URL::asset('/images/icons/Vagttelefon-hvid.svg')}}" alt="Vagttelefon"> <img src="{{URL::asset('/images/icons/Vagttelefon-hvid.svg')}}" alt="Vagttelefon">
{{ __('msg.vagttelefon') }} {{ __('msg.vagttelefon') }}
</a> </a>
@if(auth()->user()->can('guides.show'))
<a href="{{ route("guides.index") }}"> <a href="{{ route("guides.index") }}">
<img src="{{URL::asset('/images/icons/Vejledninger.svg')}}" alt="Guide"> <img src="{{URL::asset('/images/icons/Vejledninger.svg')}}" alt="Guide">
{{ __('msg.vejledning') }} {{ __('msg.vejledning') }}
</a> </a>
@endif
<a href="{{ route("users.account") }}"> <a href="{{ route("users.account") }}">
<img src="{{URL::asset('/images/icons/user-hvid.svg')}}" alt="Konto"> <img src="{{URL::asset('/images/icons/user-hvid.svg')}}" alt="Konto">
{{ __('msg.konto') }} {{ __('msg.konto') }}

View File

@ -86,8 +86,6 @@
let date = moment().locale("da").day(weekDay).week(week); let date = moment().locale("da").day(weekDay).week(week);
var datetext = moment().locale("da").day(weekDay).week(week).year() + "-" + prependZero((moment().locale("da").day(weekDay).week(week).month() + 1)) + "-" + prependZero(moment().locale("da").day(weekDay).week(week).date()); var datetext = moment().locale("da").day(weekDay).week(week).year() + "-" + prependZero((moment().locale("da").day(weekDay).week(week).month() + 1)) + "-" + prependZero(moment().locale("da").day(weekDay).week(week).date());
let dayHolder = document.createElement("div"); let dayHolder = document.createElement("div");
dayHolder.classList.add("calendar-table__col"); dayHolder.classList.add("calendar-table__col");
@ -95,6 +93,11 @@
day.classList.add("calendar-table__item"); day.classList.add("calendar-table__item");
day.innerText = date.date(); day.innerText = date.date();
//If any date is selected, Add selected class to the selected day
if(momentDate !== null)
if(date.diff(momentDate, 'hours') == 0)
dayHolder.classList.add("selected");
dayHolder.appendChild(day); dayHolder.appendChild(day);
//If date hasn't already happened //If date hasn't already happened
@ -175,7 +178,7 @@
fillMachines(data["washingmachines"], machine_id); fillMachines(data["washingmachines"], machine_id);
//Fill events (times) and remove unavailable_times //Fill events (times) and remove unavailable_times
fillTimes(data["unavailable_times"], datetext); fillTimes(data["unavailable_times"], datetext, date);
}); });
} }
@ -281,7 +284,7 @@
} }
//Fill events (times) and remove unavailable_times //Fill events (times) and remove unavailable_times
function fillTimes(unavailable_times, datetext) { function fillTimes(unavailable_times, datetext, date) {
var element; var element;
//If a events (times) select exists, set element to the select element //If a events (times) select exists, set element to the select element
@ -311,7 +314,7 @@
//Add times 8:00-20:00 //Add times 8:00-20:00
for (let hour = 8; hour < 20; hour++) { for (let hour = 8; hour < 20; hour++) {
if(hour < new Date().getHours()) if(hour < new Date().getHours() && moment().locale("da").diff(date, 'hours') == 0)
continue; continue;
let value = datetext + " " + prependZero(hour) + ":00:00"; let value = datetext + " " + prependZero(hour) + ":00:00";

View File

@ -15,7 +15,8 @@
<div class="reservation" style="margin: 0 32px 1.75rem 32px;"> <div class="reservation" style="margin: 0 32px 1.75rem 32px;">
<h3>{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}</h3> <h3>{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}</h3>
<div class="row align-items-center"> <div class="row align-items-center">
<span style="font-size: 4vw"><b>{{__('msg.tid')}}:</b> {{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y \k\l\. H:i') }}</span> <span style="font-size: 4vw; white-space: pre-line;"><b>{{__('msg.tid')}}:</b> {{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y \k\l\. H:i') }}
- {{ $reservation->name }}</span>
<form class="ml-auto" method="post" action="{{ route("washing-reservations.destroy", [ "washing_reservation" => $reservation ]) }}"> <form class="ml-auto" method="post" action="{{ route("washing-reservations.destroy", [ "washing_reservation" => $reservation ]) }}">
@csrf @csrf
@method("delete") @method("delete")

View File

@ -17,7 +17,7 @@
} }
</script> </script>
</head> </head>
<body onload="onLoadRedirect()"> <body>
<main style="justify-content: unset"> <main style="justify-content: unset">
<h1 class="sde-blue" style="font-size: 12vw; text-align: center">{{__("msg.error")}}</h1> <h1 class="sde-blue" style="font-size: 12vw; text-align: center">{{__("msg.error")}}</h1>

View File

@ -17,7 +17,7 @@
} }
</script> </script>
</head> </head>
<body onload="onLoadRedirect()"> <body>
<main style="justify-content: unset"> <main style="justify-content: unset">
<h1 class="sde-blue" style="font-size: 12vw; text-align: center">{{__("msg.error")}}</h1> <h1 class="sde-blue" style="font-size: 12vw; text-align: center">{{__("msg.error")}}</h1>