This commit is contained in:
Neerholt 2020-09-03 08:31:42 +02:00
commit b62582e039
16 changed files with 235 additions and 184 deletions

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role; use Spatie\Permission\Models\Role;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
@ -117,9 +118,31 @@ class RolesController extends Controller
*/ */
public function update(Request $request, $id) public function update(Request $request, $id)
{ {
$data = $request->all(); $data = $request->validate([
"name" => "required|max:255",
"description" => "required|max:255"
]);
$role = Role::find($id); $role = Role::find($id);
$brugerPermissions = new Collection();
if ($request->value !== null) {
foreach ($request->value as $valuee) {
$brugerPermissions->add(Permission::query()->where("name", "=", $valuee)->first());
}
}
// Delete all permission to the role you're editing, so you can give new ones
foreach (Permission::query()->get() as $permission) {
Role::query()->find($id)->revokePermissionTo($permission);
}
// Give new permissions to the tole you're editing
if (!$brugerPermissions->isEmpty()) {
foreach ($brugerPermissions as $permission) {
Role::query()->find($id)->givePermissionTo($permission);
}
}
$allRoles = Role::query()->where('name', '=', $request->name)->where('id', '!=', $id)->get(); $allRoles = Role::query()->where('name', '=', $request->name)->where('id', '!=', $id)->get();
if(count($allRoles) > 0){ if(count($allRoles) > 0){
@ -127,6 +150,7 @@ class RolesController extends Controller
}else{ }else{
$role->update($data); $role->update($data);
$role->save(); $role->save();
$roles = Role::query()->paginate($request->input("limit", 20)); $roles = Role::query()->paginate($request->input("limit", 20));
return redirect()->route("roles.index", ['roles' => $roles]); return redirect()->route("roles.index", ['roles' => $roles]);
} }

View File

@ -22,7 +22,7 @@ class UserController extends Controller
{ {
public function __construct() public function __construct()
{ {
$this->middleware([ "auth" ])->only("logout"); $this->middleware([ "auth" ])->only(["accountupdate", "accountedit", "accounteditpass", "account", "logout"]);
$this->middleware([ "guest" ])->only(["login", "signup"]); $this->middleware([ "guest" ])->only(["login", "signup"]);
$this->middleware([ "lang" ])->except(["login", "showLogin", "showForgot", "forgot","signup"]); $this->middleware([ "lang" ])->except(["login", "showLogin", "showForgot", "forgot","signup"]);
@ -31,8 +31,6 @@ class UserController extends Controller
$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");
$this->middleware([ "check.auth:ownuser.edit" ])->only(["accountupdate", "accountedit", "accounteditpass", "account"]);
} }
/** /**

View File

@ -12,6 +12,8 @@ class UserEventController extends Controller
{ {
$this->middleware(["auth"]); $this->middleware(["auth"]);
$this->middleware(["lang"]); $this->middleware(["lang"]);
$this->middleware([ "check.auth:userevent.create" ])->only("create");
$this->middleware([ "check.auth:userevent.delete" ])->only("destroy");
} }
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.

View File

@ -133,6 +133,7 @@ class WashingReservationController extends Controller
public function destroy($id) public function destroy($id)
{ {
$machineReservation = WashingReservation::find($id); $machineReservation = WashingReservation::find($id);
dd($id);
$machineReservation->delete(); $machineReservation->delete();
$reservations = WashingReservation::query()->paginate( 20); $reservations = WashingReservation::query()->paginate( 20);
@ -266,7 +267,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()->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)); $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]); return Response::detect("washing-reservations.index", [ "reservations" => $reservations]);
} }

View File

@ -21,7 +21,6 @@ class PermissionSeeder extends Seeder
"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",
/** /**
* The EVENT specific permissions * The EVENT specific permissions
@ -30,6 +29,8 @@ class PermissionSeeder extends Seeder
"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",
"userevent.create" => "Allows participation in an event",
"userevent.delete" => "Allows removing participation in an event",
/** /**
* The CONTACT specific permissions * The CONTACT specific permissions
@ -44,7 +45,6 @@ class PermissionSeeder extends Seeder
*/ */
"feedback.create" => "Creates a new feedback message", "feedback.create" => "Creates a new feedback message",
"feedback.show" => "Shows a specific feedback message", "feedback.show" => "Shows a specific feedback message",
"feedback.edit" => "allows editing of feedback messages",
"feedback.delete" => "allows deletion of feedback messages", "feedback.delete" => "allows deletion of feedback messages",
/** /**

View File

@ -46,8 +46,9 @@ class RoleSeeder extends Seeder
$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.show")->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", "=", "event.show")->first()); $brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "event.show")->first());
$brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "userevent.create")->first());
$brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "userevent.delete")->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.show")->first()); $brugerPermissions->add(\Spatie\Permission\Models\Permission::query()->where("name", "=", "news.show")->first());

View File

@ -36,7 +36,7 @@
<script> <script>
ClassicEditor ClassicEditor
.create( document.querySelector( '#editor' ), { .create( document.querySelector( '#editor' ), {
toolbar: [ 'heading', '|', 'bold', 'italic', 'link' ], toolbar: [ 'heading', '|', 'bold', 'italic' ],
heading: { heading: {
options: [ options: [
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' }, { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },

View File

@ -37,7 +37,7 @@
<script> <script>
ClassicEditor ClassicEditor
.create( document.querySelector( '#editor' ), { .create( document.querySelector( '#editor' ), {
toolbar: [ 'heading', '|', 'bold', 'italic', 'link' ], toolbar: [ 'heading', '|', 'bold', 'italic' ],
heading: { heading: {
options: [ options: [
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' }, { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },

View File

@ -44,11 +44,24 @@
<script src="{{ mix("/js/app.js") }}"></script> <script src="{{ mix("/js/app.js") }}"></script>
<script type="text/javascript"> <script type="text/javascript">
speed = 10000;
function scroll(speed) {
$('html, body').animate({ scrollTop: $(document).height() - $(window).height() }, speed, function() {
$(this).animate({ scrollTop: 0 }, speed);
});
}
$(document).ready(function () { $(document).ready(function () {
setInterval(function(){ // There has to be a space between " and # or it will not load correctly setInterval(function(){ // There has to be a space between " and # or it will not load correctly
$('#mainDiv').load(" #mainDiv"); $('#mainDiv').load(" #mainDiv");
}, (60000*1)); }, (60000*1));
//Autoscroll
scroll(speed)
setInterval(function(){scroll(speed)}, speed * 2);
}); });
</script> </script>
@yield("scripts") @yield("scripts")
</body> </body>

View File

@ -32,13 +32,13 @@
@csrf @csrf
<label for="name">Navn:</label> <label for="name">Navn:</label>
<label hidden id="error" for="errormesseages">Rolle navnet findes allerede</label> <label hidden id="error" for="errormesseages">Rolle navnet findes allerede</label>
<input type="text" name="name" id="name" placeholder="Admin" required> <input type="text" name="name" id="name" pattern="[A-Za-z]+" title="Der må ikke være tal i rollenavnet" placeholder="Admin" required>
<label for="name">Beskrivelse:</label> <label for="name">Beskrivelse:</label>
<input type="text" name="description" id="description" placeholder="Admin rollen bruges til administratorene" required> <input type="text" name="description" id="description" placeholder="Admin rollen bruges til administratorene" required>
<div class="mb-2" style="width: 100%;"> <div class="mb-2" style="width: 100%;">
<button id="kontoButton" type="button" class="btn btn-sde-blue mb-1 mr-1" value="konto">Konto rettigheder</button> <button id="kontoButton" type="button" class="btn btn-sde-blue mb-1 mr-1" value="konto">App rettigheder</button>
<button id="adminButton" type="button" class="btn btn-sde-blue mb-1">Admin rettigheder</button> <button id="adminButton" type="button" class="btn btn-sde-blue mb-1">Admin rettigheder</button>
</div> </div>
@ -47,66 +47,59 @@
<small class="form-text text-muted">Her kan alle basale rettigheder for appens forbrugere slås til eller fra.</small> <small class="form-text text-muted">Her kan alle basale rettigheder for appens forbrugere slås til eller fra.</small>
<table class="tbl mb-2"> <table class="tbl mb-2">
<tr> <tr>
<th>Konto</th> <th>App-side</th>
<th>Beskrivelse</th> <th>Beskrivelse kan fjernes?</th>
<th>Create</th> <th>Opret/Tilmeld</th>
<th>Read</th> <th>Se</th>
<th>Delete</th> <th>Slet/Afmeld</th>
</tr>
<tr>
<td>Konto</td>
<td><p>Egen bruger</p></td>
<td></td>
<td><input type="checkbox" name="value[]" value="ownuser.edit"></td>
<td></td>
</tr> </tr>
<tr> <tr>
<td>Nyheder</td> <td>Nyheder</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td></td> <td></td>
<td><input type="checkbox" name="value[]" value="news.show"></td> <td><input id="NewsRAccount" onclick="if ($('#NewsR').prop('checked') == false) $('#NewsR').prop('checked', true); else $('#NewsR').prop('checked', false);" type="checkbox" name="value[]" value="news.show"></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>Menuplan</td> <td>Menuplan</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td></td> <td></td>
<td><input type="checkbox" name="value[]" value="menuplan.show"></td> <td><input id="MenuRAccount" onclick="if ($('#MenuR').prop('checked') == false) $('#MenuR').prop('checked', true); else $('#MenuR').prop('checked', false);" type="checkbox" name="value[]" value="menuplan.show"></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>Aktiviteter</td> <td>Aktiviteter</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td></td> <td><input id="EventCAccount" type="checkbox" name="value[]" value="userevent.create"></td>
<td><input type="checkbox" name="value[]" value="event.show"></td> <td><input id="EventRAccount" onclick="if ($('#EventR').prop('checked') == false) $('#EventR').prop('checked', true); else $('#EventR').prop('checked', false);" type="checkbox" name="value[]" value="event.show"></td>
<td></td> <td><input id="EventDAccount" type="checkbox" name="value[]" value="userevent.delete"></td>
</tr> </tr>
<tr> <tr>
<td>Reservationer</td> <td>Reservationer</td>
<td>Empty</td> <td>Empty</td>
<td><input type="checkbox" name="value[]" value="washing.machine.reservation.create"></td> <td><input id="ReservationCAccount" type="checkbox" name="value[]" value="washing.machine.reservation.create"></td>
<td><input type="checkbox" name="value[]" value="washing.machine.reservation.show"></td> <td><input id="ReservationRAccount" onclick="if ($('#ReservationR').prop('checked') == false) $('#ReservationR').prop('checked', true); else $('#ReservationR').prop('checked', false);" type="checkbox" name="value[]" value="washing.machine.reservation.show"></td>
<td><input type="checkbox" name="value[]" value="washing.machine.reservation.delete"></td> <td><input id="ReservationDAccount" onclick="if ($('#ReservationD').prop('checked') == false) $('#ReservationD').prop('checked', true); else $('#ReservationD').prop('checked', false);" type="checkbox" name="value[]" value="washing.machine.reservation.delete"></td>
</tr> </tr>
<tr> <tr>
<td>Kontakter</td> <td>Kontakter</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td></td> <td></td>
<td><input type="checkbox" name="value[]" value="contact.show"></td> <td><input id="ContactRAccount" onclick="if ($('#ContactR').prop('checked') == false) $('#ContactR').prop('checked', true); else $('#ContactR').prop('checked', false);" type="checkbox" name="value[]" value="contact.show"></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>Vejledning</td> <td>Vejledning</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td></td> <td></td>
<td><input type="checkbox" name="value[]" value="guides.show"></td> <td><input id="GuideRAccount" onclick="if ($('#GuideR').prop('checked') == false) $('#GuideR').prop('checked', true); else $('#GuideR').prop('checked', false);" type="checkbox" name="value[]" value="guides.show"></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>Feedback</td> <td>Feedback</td>
<td>Empty</td> <td>Empty</td>
<td><input type="checkbox" name="value[]" value="feedback.create"></td> <td><input id="FeedbackCAccount" type="checkbox" name="value[]" value="feedback.create"></td>
<td><input type="checkbox" name="value[]" value="feedback.show"></td> <td></td>
<td></td> <td></td>
</tr> </tr>
</table> </table>
@ -118,22 +111,19 @@
<small class="form-text text-muted">Her kan alle rettigheder for administrationssiden slås til eller fra.</small> <small class="form-text text-muted">Her kan alle rettigheder for administrationssiden slås til eller fra.</small>
<table class="tbl mb-2" > <table class="tbl mb-2" >
<tr><!--Header Start--> <tr><!--Header Start-->
<th>Side</th> <th>Admin-side</th>
<th>Beskrivelse</th> <th>Beskrivelse kan fjernes?</th>
<th>Create</th> <th>Opret</th>
<th>Read</th> <th>Se</th>
<th>Update</th> <th>Rediger</th>
<th>Delete</th> <th>Slet</th>
<th>Fuld Kontrol</th> <th>Fuld Kontrol</th>
</tr><!--Header Slut--> </tr><!--Header Slut-->
<tr> <tr>
<td>Admin Panel</td> <td>Admin Panel</td>
<td><p>Adgang til admin panelet</p></td> <td><p>Adgang til admin panelet</p></td>
<td></td> <td></td>
<td><input type="checkbox" name="value[]" value="admin.panel.show"></td> <td colspan="4"><input type="checkbox" name="value[]" value="admin.panel.show"></td>
<td></td>
<td></td>
<td></td>
</tr> </tr>
<tr><!--Bruger Start--> <tr><!--Bruger Start-->
<td>Brugere</td> <td>Brugere</td>
@ -156,28 +146,28 @@
<tr> <tr>
<td>Nyheder</td> <td>Nyheder</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td><input id="NewsC" type="checkbox" name="value[]" value="Bike"></td> <td><input id="NewsC" type="checkbox" name="value[]" value="news.create"></td>
<td><input id="NewsR" type="checkbox" name="value[]" value="Bike"></td> <td><input id="NewsR" onclick="if ($('#NewsRAccount').prop('checked') == false) $('#NewsRAccount').prop('checked', true); else $('#NewsRAccount').prop('checked', false);" type="checkbox" name="value[]" value="news.show"></td>
<td><input id="NewsU" type="checkbox" name="value[]" value="Bike"></td> <td><input id="NewsU" type="checkbox" name="value[]" value="news.edit"></td>
<td><input id="NewsD" type="checkbox" name="value[]" value="Bike"></td> <td><input id="NewsD" type="checkbox" name="value[]" value="news.delete"></td>
<td><input id="News" type="checkbox" onclick="FullControl(this)"></td> <td><input id="News" type="checkbox" onclick="FullControl(this)"></td>
</tr> </tr>
<tr> <tr>
<td>Menuplan</td> <td>Menuplan</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td><input id="MenuC" type="checkbox" name="value[]" value="news.create"></td> <td><input id="MenuC" type="checkbox" name="value[]" value="menuplan.create"></td>
<td><input id="MenuR" type="checkbox" name="value[]" value="news.show"></td> <td><input id="MenuR" onclick="if ($('#MenuRAccount').prop('checked') == false) $('#MenuRAccount').prop('checked', true); else $('#MenuRAccount').prop('checked', false);" type="checkbox" name="value[]" value="menuplan.show"></td>
<td><input id="MenuU" type="checkbox" name="value[]" value="news.edit"></td> <td><input id="MenuU" type="checkbox" name="value[]" value="menuplan.edit"></td>
<td><input id="MenuD" type="checkbox" name="value[]" value="news.delete"></td> <td><input id="MenuD" type="checkbox" name="value[]" value="menuplan.delete"></td>
<td><input id="Menu" type="checkbox" onclick="FullControl(this)"></td> <td><input id="Menu" type="checkbox" onclick="FullControl(this)"></td>
</tr> </tr>
<tr> <tr>
<td>Aktiviteter</td> <td>Aktiviteter</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td><input id="EventC" type="checkbox" name="value[]" value="events.create"></td> <td><input id="EventC" type="checkbox" name="value[]" value="event.create"></td>
<td><input id="EventR" type="checkbox" name="value[]" value="events.show"></td> <td><input id="EventR" onclick="if ($('#EventRAccount').prop('checked') == false) $('#EventRAccount').prop('checked', true); else $('#EventRAccount').prop('checked', false);" type="checkbox" name="value[]" value="event.show"></td>
<td><input id="EventU" type="checkbox" name="value[]" value="events.edit"></td> <td><input id="EventU" type="checkbox" name="value[]" value="event.edit"></td>
<td><input id="EventD" type="checkbox" name="value[]" value="events.delete"></td> <td><input id="EventD" type="checkbox" name="value[]" value="event.delete"></td>
<td><input id="Event" type="checkbox" onclick="FullControl(this)"></td> <td><input id="Event" type="checkbox" onclick="FullControl(this)"></td>
</tr> </tr>
<tr> <tr>
@ -201,17 +191,17 @@
<tr> <tr>
<td>Reservationer</td> <td>Reservationer</td>
<td>Empty</td> <td>Empty</td>
<td><input id="ReservationC" type="checkbox" name="value[]" value="washing.machine.reservation.create"></td> <td></td>
<td><input id="ReservationR" type="checkbox" name="value[]" value="washing.machine.reservation.show"></td> <td><input id="ReservationR" onclick="if ($('#ReservationRAccount').prop('checked') == false) $('#ReservationRAccount').prop('checked', true); else $('#ReservationRAccount').prop('checked', false);" type="checkbox" name="value[]" value="washing.machine.reservation.show"></td>
<td><input id="ReservationU" type="checkbox" name="value[]" value="washing.machine.reservation.edit"></td> <td></td>
<td><input id="ReservationD" type="checkbox" name="value[]" value="washing.machine.reservation.delete"></td> <td><input id="ReservationD" onclick="if ($('#ReservationCAccount').prop('checked') == false) $('#ReservationDAccount').prop('checked', true); else $('#ReservationDAccount').prop('checked', false);" type="checkbox" name="value[]" value="washing.machine.reservation.delete"></td>
<td><input id="Reservation" type="checkbox" onclick="FullControl(this)"></td> <td><input id="Reservation" type="checkbox" onclick="FullControl(this)"></td>
</tr> </tr>
<tr> <tr>
<td>Kontakter</td> <td>Kontakter</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td><input id="ContactC" type="checkbox" name="value[]" value="contact.create"></td> <td><input id="ContactC" type="checkbox" name="value[]" value="contact.create"></td>
<td><input id="ContactR" type="checkbox" name="value[]" value="contact.show"></td> <td><input id="ContactR" onclick="if ($('#ContactRAccount').prop('checked') == false) $('#ContactRAccount').prop('checked', true); else $('#ContactRAccount').prop('checked', false);" type="checkbox" name="value[]" value="contact.show"></td>
<td><input id="ContactU" type="checkbox" name="value[]" value="contact.edit"></td> <td><input id="ContactU" type="checkbox" name="value[]" value="contact.edit"></td>
<td><input id="ContactD" type="checkbox" name="value[]" value="contact.delete"></td> <td><input id="ContactD" type="checkbox" name="value[]" value="contact.delete"></td>
<td><input id="Contact" type="checkbox" onclick="FullControl(this)"></td> <td><input id="Contact" type="checkbox" onclick="FullControl(this)"></td>
@ -220,7 +210,7 @@
<td>Vejledning</td> <td>Vejledning</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td><input id="GuideC" type="checkbox" name="value[]" value="guides.create"></td> <td><input id="GuideC" type="checkbox" name="value[]" value="guides.create"></td>
<td><input id="GuideR" type="checkbox" name="value[]" value="guides.show"></td> <td><input id="GuideR" onclick="if ($('#GuideRRAccount').prop('checked') == false) $('#GuideRAccount').prop('checked', true); else $('#GuideRAccount').prop('checked', false);" type="checkbox" name="value[]" value="guides.show"></td>
<td><input id="GuideU" type="checkbox" name="value[]" value="guides.edit"></td> <td><input id="GuideU" type="checkbox" name="value[]" value="guides.edit"></td>
<td><input id="GuideD" type="checkbox" name="value[]" value="guides.delete"></td> <td><input id="GuideD" type="checkbox" name="value[]" value="guides.delete"></td>
<td><input id="Guide" type="checkbox" onclick="FullControl(this)"></td> <td><input id="Guide" type="checkbox" onclick="FullControl(this)"></td>
@ -228,9 +218,9 @@
<tr> <tr>
<td>Feedback</td> <td>Feedback</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td><input id="FeedbackC" type="checkbox" name="value[]" value="feedback.create"></td> <td></td>
<td><input id="FeedbackR" type="checkbox" name="value[]" value="feedback.show"></td> <td><input id="FeedbackR" type="checkbox" name="value[]" value="feedback.show"></td>
<td><input id="FeedbackU" type="checkbox" name="value[]" value="feedback.edit"></td> <td></td>
<td><input id="FeedbackD" type="checkbox" name="value[]" value="feedback.delete"></td> <td><input id="FeedbackD" type="checkbox" name="value[]" value="feedback.delete"></td>
<td><input id="Feedback" type="checkbox" onclick="FullControl(this)"></td> <td><input id="Feedback" type="checkbox" onclick="FullControl(this)"></td>
</tr> </tr>
@ -309,12 +299,12 @@
//Show konto settings //Show konto settings
$("#kontoButton").click(function(){ $("#kontoButton").click(function(){
var value = $('#kontoButton').text(); var value = $('#kontoButton').text();
if(value === 'Konto rettigheder'){ if(value === 'App rettigheder'){
$('#konto').slideDown('slow'); $('#konto').slideDown('slow');
$('#kontoButton').html('Luk konto rettigheder') $('#kontoButton').html('Luk app rettigheder')
}else{ }else{
$('#konto').slideUp('slow'); $('#konto').slideUp('slow');
$('#kontoButton').html('Konto rettigheder') $('#kontoButton').html('App rettigheder')
} }
}); });
@ -337,9 +327,7 @@
var Update = $(FC).attr('id') + 'U'; // Takes FC's ID Name and puts U at the back of it var Update = $(FC).attr('id') + 'U'; // Takes FC's ID Name and puts U at the back of it
var Delete = $(FC).attr('id') + 'D'; // Takes FC's ID Name and puts D at the back of it var Delete = $(FC).attr('id') + 'D'; // Takes FC's ID Name and puts D at the back of it
$(FC).prop('checked', false); if ($(FC).prop('checked') == false) {
if ($('#' + Create).prop('checked') == true && $('#' + Read).prop('checked') == true && $('#' + Update).prop('checked') == true && $('#' + Delete).prop('checked') == true) {
$('#' + Create).prop('checked', false); $('#' + Create).prop('checked', false);
$('#' + Read).prop('checked', false); $('#' + Read).prop('checked', false);
$('#' + Update).prop('checked', false); $('#' + Update).prop('checked', false);

View File

@ -33,81 +33,73 @@
@method("put") @method("put")
<label for="name">Navn:</label> <label for="name">Navn:</label>
<label hidden id="error" for="errormesseages">Rolle navnet findes allerede</label> <label hidden id="error" for="errormesseages">Rolle navnet findes allerede</label>
<input type="text" name="name" id="name" placeholder="Admin" value="{{ $role->name }}" required> <input type="text" name="name" id="name" pattern="[A-Za-z]+" title="Der må ikke være tal i rollenavnet" placeholder="Admin" value="{{ $role->name }}" required>
<label for="name">Beskrivelse:</label> <label for="name">Beskrivelse:</label>
<input type="text" name="description" id="description" placeholder="Admin rollen bruges til administratorene" value="{{ $role->description }}" required> <input type="text" name="description" id="description" placeholder="Admin rollen bruges til administratorene" value="{{ $role->description }}" required>
<div class="mb-2" style="width: 100%;"> <div class="mb-2" style="width: 100%;">
<button id="kontoButton" type="button" class="btn btn-sde-blue mb-1 mr-1" value="konto">Rediger konto rettigheder</button> <button id="kontoButton" type="button" class="btn btn-sde-blue mb-1 mr-1" value="konto">Rediger app rettigheder</button>
<button id="adminButton" type="button" class="btn btn-sde-blue mb-1">Rediger admin rettigheder</button> <button id="adminButton" type="button" class="btn btn-sde-blue mb-1">Rediger admin rettigheder</button>
</div> </div>
<div id="konto"> <div id="konto">
<small class="form-text text-muted">Her kan alle basale rettigheder for appens forbrugere slås til eller fra.</small> <small class="form-text text-muted">Her kan alle basale rettigheder for appens forbrugere slås til eller fra.</small>
<table class="tbl mb-2"> <table class="tbl mb-2">
<tr> <tr>
<th>Konto</th> <th>App-side</th>
<th>Beskrivelse</th> <th>Beskrivelse kan fjernes?</th>
<th>Create</th> <th>Opret/Tilmeld</th>
<th>Read</th> <th>Se</th>
<th>Delete</th> <th>Slet/Afmeld</th>
</tr>
<tr>
<td>Konto</td>
<td><p>Egen bruger</p></td>
<td></td>
<td><input type="checkbox" name="value[]" value="ownuser.edit"></td>
<td></td>
</tr> </tr>
<tr> <tr>
<td>Nyheder</td> <td>Nyheder</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td></td> <td></td>
<td><input type="checkbox" name="value[]" value="news.show"></td> <td><input id="NewsRAccount" onclick="if ($('#NewsR').prop('checked') == false) $('#NewsR').prop('checked', true); else $('#NewsR').prop('checked', false);" type="checkbox" name="value[]" value="news.show" @if ($role->hasPermissionTo("news.show")) checked @endif></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>Menuplan</td> <td>Menuplan</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td></td> <td></td>
<td><input type="checkbox" name="value[]" value="menuplan.show"></td> <td><input id="MenuRAccount" onclick="if ($('#MenuR').prop('checked') == false) $('#MenuR').prop('checked', true); else $('#MenuR').prop('checked', false);" type="checkbox" name="value[]" value="menuplan.show" @if ($role->hasPermissionTo("menuplan.show")) checked @endif></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>Aktiviteter</td> <td>Aktiviteter</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td></td> <td><input id="EventRAccount" type="checkbox" name="value[]" value="userevent.create" @if ($role->hasPermissionTo("userevent.create")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="event.show"></td> <td><input id="EventRAccount" onclick="if ($('#EventR').prop('checked') == false) $('#EventR').prop('checked', true); else $('#EventR').prop('checked', false);" type="checkbox" name="value[]" value="event.show" @if ($role->hasPermissionTo("event.show")) checked @endif></td>
<td></td> <td><input id="EventRAccount" type="checkbox" name="value[]" value="userevent.delete" @if ($role->hasPermissionTo("userevent.delete")) checked @endif></td>
</tr> </tr>
<tr> <tr>
<td>Reservationer</td> <td>Reservationer</td>
<td>Empty</td> <td>Empty</td>
<td><input type="checkbox" name="value[]" value="washing.machine.reservation.create"></td> <td><input id="ReservationCAccount" type="checkbox" name="value[]" value="washing.machine.reservation.create" @if ($role->hasPermissionTo("washing.machine.reservation.create")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="washing.machine.reservation.show"></td> <td><input id="ReservationRAccount" onclick="if ($('#ReservationR').prop('checked') == false) $('#ReservationR').prop('checked', true); else $('#ReservationR').prop('checked', false);" type="checkbox" name="value[]" value="washing.machine.reservation.show" @if ($role->hasPermissionTo("washing.machine.reservation.show")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="washing.machine.reservation.delete"></td> <td><input id="ReservationDAccount" onclick="if ($('#ReservationD').prop('checked') == false) $('#ReservationD').prop('checked', true); else $('#ReservationD').prop('checked', false);" type="checkbox" name="value[]" value="washing.machine.reservation.delete" @if ($role->hasPermissionTo("washing.machine.reservation.delete")) checked @endif></td>
</tr> </tr>
<tr> <tr>
<td>Kontakter</td> <td>Kontakter</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td></td> <td></td>
<td><input type="checkbox" name="value[]" value="contact.show"></td> <td><input id="ContactRAccount" onclick="if ($('#ContactR').prop('checked') == false) $('#ContactR').prop('checked', true); else $('#ContactR').prop('checked', false);" type="checkbox" name="value[]" value="contact.show" @if ($role->hasPermissionTo("contact.show")) checked @endif></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>Vejledning</td> <td>Vejledning</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td></td> <td></td>
<td><input type="checkbox" name="value[]" value="guides.show"></td> <td><input id="GuideRAccount" onclick="if ($('#GuideR').prop('checked') == false) $('#GuideR').prop('checked', true); else $('#GuideR').prop('checked', false);" type="checkbox" name="value[]" value="guides.show" @if ($role->hasPermissionTo("guides.show")) checked @endif></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>Feedback</td> <td>Feedback</td>
<td>Empty</td> <td>Empty</td>
<td><input type="checkbox" name="value[]" value="feedback.create"></td> <td><input id="FeedbackCAccount" type="checkbox" name="value[]" value="feedback.create" @if ($role->hasPermissionTo("feedback.create")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="feedback.show"></td> <td></td>
<td></td> <td></td>
</tr> </tr>
</table> </table>
@ -118,122 +110,119 @@
<div id="admin"> <div id="admin">
<small class="form-text text-muted">Her kan alle rettigheder for administrationssiden slås til eller fra.</small> <small class="form-text text-muted">Her kan alle rettigheder for administrationssiden slås til eller fra.</small>
<table class="tbl mb-2" > <table class="tbl mb-2" >
<tr><!--Header Start--> <tr>
<th>Side</th> <th>Admin-side</th>
<th>Beskrivelse</th> <th>Beskrivelse kan fjernes?</th>
<th>Create</th> <th>Opret</th>
<th>Read</th> <th>Se</th>
<th>Update</th> <th>Rediger</th>
<th>Delete</th> <th>Slet</th>
<th>Fuld Kontrol</th> <th>Fuld Kontrol</th>
</tr><!--Header Slut--> </tr>
<tr> <tr>
<td>Admin Panel</td> <td>Admin Panel</td>
<td><p>Adgang til admin panelet</p></td> <td><p>Adgang til admin panelet</p></td>
<td></td> <td></td>
<td><input type="checkbox" name="value[]" value="admin.panel.show"></td> <td colspan="4"><input type="checkbox" name="value[]" value="admin.panel.show" @if ($role->hasPermissionTo("admin.panel.show")) checked @endif></td>
<td></td>
<td></td>
<td></td>
</tr> </tr>
<tr><!--Bruger Start--> <tr>
<td>Brugere</td> <td>Brugere</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td><input type="checkbox" name="value[]" value="user.create"></td> <td><input id="UserC" type="checkbox" name="value[]" value="user.create" @if ($role->hasPermissionTo("user.create")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="user.show"></td> <td><input id="UserR" type="checkbox" name="value[]" value="user.show" @if ($role->hasPermissionTo("user.show")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="user.edit"></td> <td><input id="UserU" type="checkbox" name="value[]" value="user.edit" @if ($role->hasPermissionTo("user.edit")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="user.delete"></td> <td><input id="UserD" type="checkbox" name="value[]" value="user.delete" @if ($role->hasPermissionTo("user.delete")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="Bike"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit--> <td><input id="User" type="checkbox" onclick="FullControl(this)"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit-->
</tr><!--Bruger Start--> </tr>
<tr> <tr>
<td>Roller</td> <td>Roller</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td><input type="checkbox" name="value[]" value="roles.create"></td> <td><input id="RoleC" type="checkbox" name="value[]" value="roles.create" @if ($role->hasPermissionTo("roles.create")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="roles.show"></td> <td><input id="RoleR" type="checkbox" name="value[]" value="roles.show" @if ($role->hasPermissionTo("roles.show")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="roles.edit"></td> <td><input id="RoleU" type="checkbox" name="value[]" value="roles.edit" @if ($role->hasPermissionTo("roles.edit")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="roles.delete"></td> <td><input id="RoleD" type="checkbox" name="value[]" value="roles.delete" @if ($role->hasPermissionTo("roles.delete")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="Bike"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit--> <td><input id="Role" type="checkbox" onclick="FullControl(this)"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit-->
</tr> </tr>
<tr> <tr>
<td>Nyheder</td> <td>Nyheder</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td><input type="checkbox" name="value[]" value="Bike"></td> <td><input id="NewsC" type="checkbox" name="value[]" value="news.create" @if ($role->hasPermissionTo("news.create")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="Bike"></td> <td><input id="NewsR" onclick="if ($('#NewsRAccount').prop('checked') == false) $('#NewsRAccount').prop('checked', true); else $('#NewsRAccount').prop('checked', false);" type="checkbox" name="value[]" value="news.show" @if ($role->hasPermissionTo("news.show")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="Bike"></td> <td><input id="NewsU" type="checkbox" name="value[]" value="news.edit" @if ($role->hasPermissionTo("news.edit")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="Bike"></td> <td><input id="NewsD" type="checkbox" name="value[]" value="news.delete" @if ($role->hasPermissionTo("news.delete")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="Bike"></td> <td><input id="News" type="checkbox" onclick="FullControl(this)"></td>
</tr> </tr>
<tr> <tr>
<td>Menuplan</td> <td>Menuplan</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td><input type="checkbox" name="value[]" value="news.create"></td> <td><input id="MenuC" type="checkbox" name="value[]" value="menuplan.create" @if ($role->hasPermissionTo("menuplan.create")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="news.show"></td> <td><input id="MenuR" onclick="if ($('#MenuRAccount').prop('checked') == false) $('#MenuRAccount').prop('checked', true); else $('#MenuRAccount').prop('checked', false);" type="checkbox" name="value[]" value="menuplan.show" @if ($role->hasPermissionTo("menuplan.show")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="news.edit"></td> <td><input id="MenuU" type="checkbox" name="value[]" value="menuplan.edit" @if ($role->hasPermissionTo("menuplan.edit")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="news.delete"></td> <td><input id="MenuD" type="checkbox" name="value[]" value="menuplan.delete" @if ($role->hasPermissionTo("menuplan.delete")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="Bike"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit--> <td><input id="Menu" type="checkbox" onclick="FullControl(this)"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit-->
</tr> </tr>
<tr> <tr>
<td>Aktiviteter</td> <td>Aktiviteter</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td><input type="checkbox" name="value[]" value="events.create"></td> <td><input id="EventC" type="checkbox" name="value[]" value="event.create" @if ($role->hasPermissionTo("event.create")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="events.show"></td> <td><input id="EventR" onclick="if ($('#EventRAccount').prop('checked') == false) $('#EventRAccount').prop('checked', true); else $('#EventRAccount').prop('checked', false);" type="checkbox" name="value[]" value="event.show" @if ($role->hasPermissionTo("event.show")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="events.edit"></td> <td><input id="EventU" type="checkbox" name="value[]" value="event.edit" @if ($role->hasPermissionTo("event.edit")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="events.delete"></td> <td><input id="EventD" type="checkbox" name="value[]" value="event.delete" @if ($role->hasPermissionTo("event.delete")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="Bike"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit--> <td><input id="Event" type="checkbox" onclick="FullControl(this)"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit-->
</tr> </tr>
<tr> <tr>
<td>Lokation</td> <td>Lokation</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td><input type="checkbox" name="value[]" value="locations.create"></td> <td><input id="LocationC" type="checkbox" name="value[]" value="locations.create" @if ($role->hasPermissionTo("locations.create")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="locations.show"></td> <td><input id="LocationR" type="checkbox" name="value[]" value="locations.show" @if ($role->hasPermissionTo("locations.show")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="locations.edit"></td> <td><input id="LocationU" type="checkbox" name="value[]" value="locations.edit" @if ($role->hasPermissionTo("locations.edit")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="locations.delete"></td> <td><input id="LocationD" type="checkbox" name="value[]" value="locations.delete" @if ($role->hasPermissionTo("locations.delete")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="Bike"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit--> <td><input id="Location" type="checkbox" onclick="FullControl(this)"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit-->
</tr> </tr>
<tr> <tr>
<td>Vaskemaskiner</td> <td>Vaskemaskiner</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td><input type="checkbox" name="value[]" value="washing.machine.create"></td> <td><input id="WashingMachineC" type="checkbox" name="value[]" value="washing.machine.create" @if ($role->hasPermissionTo("washing.machine.create")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="washing.machine.show"></td> <td><input id="WashingMachineR" type="checkbox" name="value[]" value="washing.machine.show" @if ($role->hasPermissionTo("washing.machine.show")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="washing.machine.edit"></td> <td><input id="WashingMachineU" type="checkbox" name="value[]" value="washing.machine.edit" @if ($role->hasPermissionTo("washing.machine.edit")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="washing.machine.delete"></td> <td><input id="WashingMachineD" type="checkbox" name="value[]" value="washing.machine.delete" @if ($role->hasPermissionTo("washing.machine.delete")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="Bike"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit--> <td><input id="WashingMachine" type="checkbox" onclick="FullControl(this)"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit-->
</tr> </tr>
<tr> <tr>
<td>Reservationer</td> <td>Reservationer</td>
<td>Empty</td> <td>Empty</td>
<td><input type="checkbox" name="value[]" value="washing.machine.reservation.create"></td> <td></td>
<td><input type="checkbox" name="value[]" value="washing.machine.reservation.show"></td> <td><input id="ReservationR" onclick="if ($('#ReservationRAccount').prop('checked') == false) $('#ReservationRAccount').prop('checked', true); else $('#ReservationRAccount').prop('checked', false);" type="checkbox" name="value[]" value="washing.machine.reservation.show" @if ($role->hasPermissionTo("washing.machine.reservation.show")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="washing.machine.reservation.edit"></td> <td></td>
<td><input type="checkbox" name="value[]" value="washing.machine.reservation.delete"></td> <td><input id="ReservationD" onclick="if ($('#ReservationDAccount').prop('checked') == false) $('#ReservationDAccount').prop('checked', true); else $('#ReservationDAccount').prop('checked', false);" type="checkbox" name="value[]" value="washing.machine.reservation.delete" @if ($role->hasPermissionTo("washing.machine.reservation.delete")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="Bike"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit--> <td><input id="Reservation" type="checkbox" onclick="FullControl(this)"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit-->
</tr> </tr>
<tr> <tr>
<td>Kontakter</td> <td>Kontakter</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td><input type="checkbox" name="value[]" value="contact.create"></td> <td><input id="ContactC" type="checkbox" name="value[]" value="contact.create" @if ($role->hasPermissionTo("contact.create")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="contact.show"></td> <td><input id="ContactR" onclick="if ($('#ContactRAccount').prop('checked') == false) $('#ContactRAccount').prop('checked', true); else $('#ContactRAccount').prop('checked', false);" type="checkbox" name="value[]" value="contact.show" @if ($role->hasPermissionTo("contact.show")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="contact.edit"></td> <td><input id="ContactU" type="checkbox" name="value[]" value="contact.edit" @if ($role->hasPermissionTo("contact.edit")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="contact.delete"></td> <td><input id="ContactD" type="checkbox" name="value[]" value="contact.delete" @if ($role->hasPermissionTo("contact.delete")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="Bike"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit--> <td><input id="Contact" type="checkbox" onclick="FullControl(this)"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit-->
</tr> </tr>
<tr> <tr>
<td>Vejledning</td> <td>Vejledning</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td><input type="checkbox" name="value[]" value="guides.create"></td> <td><input id="GuideC" type="checkbox" name="value[]" value="guides.create" @if ($role->hasPermissionTo("guides.create")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="guides.show"></td> <td><input id="GuideR" onclick="if ($('#GuideRRAccount').prop('checked') == false) $('#GuideRAccount').prop('checked', true); else $('#GuideRAccount').prop('checked', false);" type="checkbox" name="value[]" value="guides.show" @if ($role->hasPermissionTo("guides.show")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="guides.edit"></td> <td><input id="GuideU" type="checkbox" name="value[]" value="guides.edit" @if ($role->hasPermissionTo("guides.edit")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="guides.delete"></td> <td><input id="GuideD" type="checkbox" name="value[]" value="guides.delete" @if ($role->hasPermissionTo("guides.delete")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="Bike"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit--> <td><input id="Guide" type="checkbox" onclick="FullControl(this)"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit-->
</tr> </tr>
<tr> <tr>
<td>Feedback</td> <td>Feedback</td>
<td><p>Empty</p></td> <td><p>Empty</p></td>
<td><input type="checkbox" name="value[]" value="feedback.create"></td> <td></td>
<td><input type="checkbox" name="value[]" value="feedback.show"></td> <td><input id="FeedbackR" onclick="if ($('#FeedbackRAccount').prop('checked') == false) $('#FeedbackRAccount').prop('checked', true); else $('#FeedbackRAccount').prop('checked', false);" type="checkbox" name="value[]" value="feedback.show" @if ($role->hasPermissionTo("feedback.show")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="feedback.edit"></td> <td></td>
<td><input type="checkbox" name="value[]" value="feedback.delete"></td> <td><input id="FeedbackD" type="checkbox" name="value[]" value="feedback.delete" @if ($role->hasPermissionTo("feedback.delete")) checked @endif></td>
<td><input type="checkbox" name="value[]" value="Bike"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit--> <td><input id="Feedback" type="checkbox" onclick="FullControl(this)"></td><!--Lave en rolle som give fuld adgang ligesom ownuser.edit-->
</tr> </tr>
</table> </table>
</div> </div>
@ -312,12 +301,12 @@
//Show konto settings //Show konto settings
$("#kontoButton").click(function(){ $("#kontoButton").click(function(){
var value = $('#kontoButton').text(); var value = $('#kontoButton').text();
if(value === 'Rediger konto rettigheder'){ if(value === 'Rediger app rettigheder'){
$('#konto').slideDown('slow'); $('#konto').slideDown('slow');
$('#kontoButton').html('Luk konto rettigheder') $('#kontoButton').html('Luk app rettigheder')
}else{ }else{
$('#konto').slideUp('slow'); $('#konto').slideUp('slow');
$('#kontoButton').html('Rediger konto rettigheder') $('#kontoButton').html('Rediger app rettigheder')
} }
}); });
@ -334,7 +323,35 @@
} }
}); });
function FullControl(FC) { //FC == Full Control checkbox element
var Create = $(FC).attr('id') + 'C'; // Takes FC's ID Name and puts C at the back of it
var Read = $(FC).attr('id') + 'R'; // Takes FC's ID Name and puts R at the back of it
var Update = $(FC).attr('id') + 'U'; // Takes FC's ID Name and puts U at the back of it
var Delete = $(FC).attr('id') + 'D'; // Takes FC's ID Name and puts D at the back of it
if ($(FC).prop('checked') == false) {
$('#' + Create).prop('checked', false);
$('#' + Read).prop('checked', false);
$('#' + Update).prop('checked', false);
$('#' + Delete).prop('checked', false);
} else {
$('#' + Create).prop('checked', true);
$('#' + Read).prop('checked', true);
$('#' + Update).prop('checked', true);
$('#' + Delete).prop('checked', true);
}
}
$(document).ready(function () {
var arr = ['User', 'Role', 'News', 'Menu', 'Event', 'Location', 'WashingMachine', 'Reservation', 'Contact', 'Guide', 'Feedback'];
for (i = 0; i < arr.length; i++) {
if ($('#'+arr[i]+'C').prop('checked') == true && $('#'+arr[i]+'R').prop('checked') == true && $('#'+arr[i]+'U').prop('checked') == true && $('#'+arr[i]+'D').prop('checked') == true)
$('#'+arr[i]).prop('checked', true);
else if(arr[i] == 'Feedback' || arr[i] == 'Reservation')
if($('#'+arr[i]+'R').prop('checked') == true && $('#'+arr[i]+'D').prop('checked') == true)
$('#'+arr[i]).prop('checked', true);
}
});
</script> </script>
@endsection @endsection

View File

@ -20,7 +20,7 @@
<label for="email">Email:</label> <label for="email">Email:</label>
<label hidden id="erroremail">Der findes allerede en bruger med denne email!</label> <label hidden id="erroremail">Der findes allerede en bruger med denne email!</label>
<input type="email" name="email" id="email" placeholder="x@y.z" required> <input type="email" name="email" id="email" placeholder="x@y.z" required>
<label for="password1">Adgangskode:</label> <label for="password1">Adgangskode:</label> <!--Tilføj dette til passwords: pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" title="Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters"-->
<label hidden id="errornotsamepass" for="errormesseages">Der stod ikke det samme i `Adgangskode` & `Bekræft Adgangskode`!</label> <label hidden id="errornotsamepass" for="errormesseages">Der stod ikke det samme i `Adgangskode` & `Bekræft Adgangskode`!</label>
<div class="input-group text-left"> <div class="input-group text-left">
<input type="password" class="form-control" name="password" id="password1" placeholder="******" required> <input type="password" class="form-control" name="password" id="password1" placeholder="******" required>

View File

@ -39,8 +39,9 @@
/*Alert box*/ /*Alert box*/
.alert { .alert {
opacity: 0.8;
padding: 20px; padding: 20px;
background-color: #f44336; background-color: #00788A;
color: white; color: white;
border-radius: 10px; border-radius: 10px;
} }

View File

@ -45,16 +45,26 @@
.img{ .img{
width: 1em; width: 1em;
height: calc(1em + 20px);
margin-top: 5px; margin-top: 5px;
margin-bottom: 5px; margin-bottom: 5px;
margin-left: 5px; margin-left: 5px;
font-size: 20px; font-size: 20px;
padding: 3px 10px; padding: 0 10px;
border-color: cadetblue; border-color: #00788a;
border-radius: 100%; border-radius: 100%;
background-color: cadetblue; background-color: #00788a;
line-height: 30px; line-height: 30px;
float: left; float: left;
display: flex;
justify-content: center;
}
.img > a {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
} }
.information{ .information{
@ -69,7 +79,7 @@
width: 100%; width: 100%;
} }
html,body,main{ html,main{
@if(request()->cookie("mode") == "dark") @if(request()->cookie("mode") == "dark")
@else @else

View File

@ -174,11 +174,7 @@
//Fill locations //Fill locations
fillLocations(data["locations"], location_id); fillLocations(data["locations"], location_id);
//Fill washing-machines updateForm();
fillMachines(data["washingmachines"], machine_id);
//Fill events (times) and remove unavailable_times
fillTimes(data["unavailable_times"], datetext, date);
}); });
} }
@ -410,7 +406,7 @@
var data = response.data; var data = response.data;
//Fill events (times) and remove unavailable_times //Fill events (times) and remove unavailable_times
fillTimes(data["unavailable_times"], dateText); fillTimes(data["unavailable_times"], dateText, momentDate);
}); });
}); });
} }

View File

@ -16,7 +16,7 @@
<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; white-space: pre-line;"><b>{{__('msg.tid')}}:</b> {{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y \k\l\. H:i') }} <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> - {{ \App\Location::query()->where('id', '=', \App\WashingMachine::query()->find($reservation->machine_id)->location_id)->first()->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")