2020-06-30 09:31:12 +00:00
@ extends ( " admin.layout.base " )
@ extends ( " admin.layout.header " )
@ section ( " title " )
Rolle - Rediger
@ endsection
@ section ( " path " )
< a href = " { { route('roles.edit', ['role' => $role ]) }} " class = " text-white " > Rediger Rolle </ a > /
@ endsection
@ section ( " content " )
2020-08-28 06:28:32 +00:00
< style >
td > p , td > input {
margin : 0 ;
}
small {
font - size : 16 px ;
}
. form - text {
display : block ;
}
. text - muted {
color : #6c757d !important;
}
2020-09-08 12:12:22 +00:00
. question - mark , . question - mark - div {
float : right ;
width : 24 px ;
vertical - align : sub ;
}
. question - mark - div {
position : relative ;
display : inline - block ;
}
. question - mark - div . question - mark - tooltip {
visibility : hidden ;
width : 150 px ;
background - color : black ;
color : #fff;
text - align : center ;
border - radius : 6 px ;
padding : 6 px 6 px ;
/* Position the tooltip */
position : absolute ;
z - index : 1 ;
top : - 5 px ;
right : 105 % ;
}
. question - mark - div : hover . question - mark - tooltip {
visibility : visible ;
}
th {
overflow : visible ! important ;
text - overflow : unset ! important ;
white - space : unset ! important ;
word - break : break - word ! important ;
}
2020-08-28 06:28:32 +00:00
</ style >
2020-06-30 09:31:12 +00:00
< h1 > Rediger Rolle :</ h1 >
< form method = " post " action = " { { route( " roles . update " , ['role' => $role ]) }} " >
@ csrf
@ method ( " put " )
< label for = " name " > Navn :</ label >
2020-08-17 08:21:02 +00:00
< label hidden id = " error " for = " errormesseages " > Rolle navnet findes allerede </ label >
2020-09-07 10:44:24 +00:00
< input type = " text " name = " name " id = " name " pattern = " [A-Za-z-æøåÆØÅ]+ " title = " Der må ikke være tal eller specialtegn i rollenavnet " placeholder = " Admin " value = " { { $role->name }} " required >
2020-06-30 09:31:12 +00:00
< label for = " name " > Beskrivelse :</ label >
2020-06-30 09:58:00 +00:00
< input type = " text " name = " description " id = " description " placeholder = " Admin rollen bruges til administratorene " value = " { { $role->description }} " required >
2020-08-28 06:28:32 +00:00
< div class = " mb-2 " style = " width: 100%; " >
2020-09-02 09:40:36 +00:00
< button id = " kontoButton " type = " button " class = " btn btn-sde-blue mb-1 mr-1 " value = " konto " > Rediger app rettigheder </ button >
2020-08-28 06:28:32 +00:00
< button id = " adminButton " type = " button " class = " btn btn-sde-blue mb-1 " > Rediger admin rettigheder </ button >
</ div >
< div id = " konto " >
< 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 " >
< tr >
2020-09-02 09:40:36 +00:00
< th > App - side </ th >
2020-09-08 12:12:22 +00:00
< th > Opret / Tilmeld < div class = " question-mark-div " >< img class = " question-mark " src = " { { asset('/images/icons/questionmark.svg') }} " >< span class = " question-mark-tooltip " > Giver tilladelse til at oprette el . tilmelde Reservationer , Aktiviteter & Feedback </ span ></ div ></ th >
< th > Se < div class = " question-mark-div " >< img class = " question-mark " src = " { { asset('/images/icons/questionmark.svg') }} " >< span class = " question-mark-tooltip " > Giver tilladelse til at se diverse sider </ span ></ div ></ th >
< th > Slet / Afmeld < div class = " question-mark-div " >< img class = " question-mark " src = " { { asset('/images/icons/questionmark.svg') }} " >< span class = " question-mark-tooltip " > Giver tilladelse til at slette el . afmelde Reservationer & Aktiviteter </ span ></ div ></ th >
2020-08-28 06:28:32 +00:00
</ tr >
< tr >
< td > Nyheder </ td >
< td ></ td >
2020-09-02 06:56:02 +00:00
< 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 >
2020-08-28 06:28:32 +00:00
< td ></ td >
</ tr >
< tr >
< td > Menuplan </ td >
< td ></ td >
2020-09-02 06:56:02 +00:00
< 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 >
2020-08-28 06:28:32 +00:00
< td ></ td >
</ tr >
< tr >
< td > Aktiviteter </ td >
2020-09-07 06:33:46 +00:00
< td >< input id = " EventParticipateAccount " type = " checkbox " name = " value[] " value = " userevent.create " @ if ( $role -> hasPermissionTo ( " userevent.create " )) checked @ endif ></ td >
2020-09-02 06:56:02 +00:00
< 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 >
2020-09-07 06:33:46 +00:00
< td >< input id = " EventStopParticipatingAccount " type = " checkbox " name = " value[] " value = " userevent.delete " @ if ( $role -> hasPermissionTo ( " userevent.delete " )) checked @ endif ></ td >
2020-08-28 06:28:32 +00:00
</ tr >
< tr >
< td > Reservationer </ td >
2020-09-02 11:31:56 +00:00
< td >< input id = " ReservationCAccount " type = " checkbox " name = " value[] " value = " washing.machine.reservation.create " @ if ( $role -> hasPermissionTo ( " washing.machine.reservation.create " )) checked @ endif ></ td >
2020-09-02 06:56:02 +00:00
< 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 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 >
2020-08-28 06:28:32 +00:00
</ tr >
< tr >
< td > Kontakter </ td >
< td ></ td >
2020-09-02 06:56:02 +00:00
< 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 >
2020-08-28 06:28:32 +00:00
< td ></ td >
</ tr >
< tr >
< td > Vejledning </ td >
< td ></ td >
2020-09-02 06:56:02 +00:00
< 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 >
2020-08-28 06:28:32 +00:00
< td ></ td >
</ tr >
< tr >
< td > Feedback </ td >
2020-09-02 11:31:56 +00:00
< td >< input id = " FeedbackCAccount " type = " checkbox " name = " value[] " value = " feedback.create " @ if ( $role -> hasPermissionTo ( " feedback.create " )) checked @ endif ></ td >
2020-09-02 09:40:36 +00:00
< td ></ td >
2020-08-28 06:28:32 +00:00
< td ></ td >
</ tr >
</ table >
</ div >
< div id = " admin " >
< small class = " form-text text-muted " > Her kan alle rettigheder for administrationssiden slås til eller fra .</ small >
< table class = " tbl mb-2 " >
2020-09-02 09:40:36 +00:00
< tr >
< th > Admin - side </ th >
2020-09-08 12:12:22 +00:00
< th > Opret < div class = " question-mark-div " >< img class = " question-mark " src = " { { asset('/images/icons/questionmark.svg') }} " >< span class = " question-mark-tooltip " > Giver tilladelse til at oprette Menuplaner , Aktiviteter , Brugere m . v .</ span ></ div ></ th >
< th > Se < div class = " question-mark-div " >< img class = " question-mark " src = " { { asset('/images/icons/questionmark.svg') }} " >< span class = " question-mark-tooltip " > Giver tilladelse til at se alle Menuplaner , Aktiviteter , Brugere m . v .</ span ></ div ></ th >
< th > Rediger < div class = " question-mark-div " >< img class = " question-mark " src = " { { asset('/images/icons/questionmark.svg') }} " >< span class = " question-mark-tooltip " > Giver tilladelse til at kunne redigere Menuplaner , Aktiviteter , Brugere m . v .</ span ></ div ></ th >
< th > Slet < div class = " question-mark-div " >< img class = " question-mark " src = " { { asset('/images/icons/questionmark.svg') }} " >< span class = " question-mark-tooltip " > Giver tilladelse til at kunne slette Menuplaner , Aktiviteter , Brugere m . v .</ span ></ div ></ th >
< th > Fuld Kontrol < div class = " question-mark-div " >< img class = " question-mark " src = " { { asset('/images/icons/questionmark.svg') }} " >< span class = " question-mark-tooltip " > Giver alle rettigheder som beskrevet i hhv . 'Opret' , 'Se' , 'Rediger' & 'Slet' </ span ></ div ></ th >
2020-09-02 09:40:36 +00:00
</ tr >
2020-08-28 06:28:32 +00:00
< tr >
< td > Admin Panel </ td >
2020-09-02 10:32:30 +00:00
< td ></ td >
< td colspan = " 4 " >< input type = " checkbox " name = " value[] " value = " admin.panel.show " @ if ( $role -> hasPermissionTo ( " admin.panel.show " )) checked @ endif ></ td >
2020-08-28 06:28:32 +00:00
</ tr >
2020-09-02 09:40:36 +00:00
< tr >
2020-08-28 06:28:32 +00:00
< td > Brugere </ td >
2020-09-02 06:56:02 +00:00
< td >< input id = " UserC " type = " checkbox " name = " value[] " value = " user.create " @ if ( $role -> hasPermissionTo ( " user.create " )) checked @ endif ></ td >
< td >< input id = " UserR " type = " checkbox " name = " value[] " value = " user.show " @ if ( $role -> hasPermissionTo ( " user.show " )) checked @ endif ></ td >
< td >< input id = " UserU " type = " checkbox " name = " value[] " value = " user.edit " @ if ( $role -> hasPermissionTo ( " user.edit " )) checked @ endif ></ td >
< td >< input id = " UserD " type = " checkbox " name = " value[] " value = " user.delete " @ if ( $role -> hasPermissionTo ( " user.delete " )) checked @ endif ></ td >
< td >< input id = " User " type = " checkbox " onclick = " FullControl(this) " ></ td ><!-- Lave en rolle som give fuld adgang ligesom ownuser . edit -->
2020-09-02 09:40:36 +00:00
</ tr >
2020-08-28 06:28:32 +00:00
< tr >
< td > Roller </ td >
2020-09-02 06:56:02 +00:00
< td >< input id = " RoleC " type = " checkbox " name = " value[] " value = " roles.create " @ if ( $role -> hasPermissionTo ( " roles.create " )) checked @ endif ></ td >
< td >< input id = " RoleR " type = " checkbox " name = " value[] " value = " roles.show " @ if ( $role -> hasPermissionTo ( " roles.show " )) checked @ endif ></ td >
< td >< input id = " RoleU " type = " checkbox " name = " value[] " value = " roles.edit " @ if ( $role -> hasPermissionTo ( " roles.edit " )) checked @ endif ></ td >
< td >< input id = " RoleD " type = " checkbox " name = " value[] " value = " roles.delete " @ if ( $role -> hasPermissionTo ( " roles.delete " )) checked @ endif ></ td >
< td >< input id = " Role " type = " checkbox " onclick = " FullControl(this) " ></ td ><!-- Lave en rolle som give fuld adgang ligesom ownuser . edit -->
2020-08-28 06:28:32 +00:00
</ tr >
< tr >
< td > Nyheder </ td >
2020-09-02 06:56:02 +00:00
< td >< input id = " NewsC " type = " checkbox " name = " value[] " value = " news.create " @ if ( $role -> hasPermissionTo ( " news.create " )) checked @ endif ></ 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 id = " NewsU " type = " checkbox " name = " value[] " value = " news.edit " @ if ( $role -> hasPermissionTo ( " news.edit " )) checked @ endif ></ td >
< td >< input id = " NewsD " type = " checkbox " name = " value[] " value = " news.delete " @ if ( $role -> hasPermissionTo ( " news.delete " )) checked @ endif ></ td >
< td >< input id = " News " type = " checkbox " onclick = " FullControl(this) " ></ td >
2020-08-28 06:28:32 +00:00
</ tr >
< tr >
< td > Menuplan </ td >
2020-09-02 06:56:02 +00:00
< td >< input id = " MenuC " type = " checkbox " name = " value[] " value = " menuplan.create " @ if ( $role -> hasPermissionTo ( " menuplan.create " )) checked @ endif ></ 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 id = " MenuU " type = " checkbox " name = " value[] " value = " menuplan.edit " @ if ( $role -> hasPermissionTo ( " menuplan.edit " )) checked @ endif ></ td >
< td >< input id = " MenuD " type = " checkbox " name = " value[] " value = " menuplan.delete " @ if ( $role -> hasPermissionTo ( " menuplan.delete " )) checked @ endif ></ td >
< td >< input id = " Menu " type = " checkbox " onclick = " FullControl(this) " ></ td ><!-- Lave en rolle som give fuld adgang ligesom ownuser . edit -->
2020-08-28 06:28:32 +00:00
</ tr >
< tr >
< td > Aktiviteter </ td >
2020-09-02 06:56:02 +00:00
< td >< input id = " EventC " type = " checkbox " name = " value[] " value = " event.create " @ if ( $role -> hasPermissionTo ( " event.create " )) checked @ endif ></ 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 id = " EventU " type = " checkbox " name = " value[] " value = " event.edit " @ if ( $role -> hasPermissionTo ( " event.edit " )) checked @ endif ></ td >
< td >< input id = " EventD " type = " checkbox " name = " value[] " value = " event.delete " @ if ( $role -> hasPermissionTo ( " event.delete " )) checked @ endif ></ td >
< td >< input id = " Event " type = " checkbox " onclick = " FullControl(this) " ></ td ><!-- Lave en rolle som give fuld adgang ligesom ownuser . edit -->
2020-08-28 06:28:32 +00:00
</ tr >
< tr >
< td > Lokation </ td >
2020-09-02 06:56:02 +00:00
< td >< input id = " LocationC " type = " checkbox " name = " value[] " value = " locations.create " @ if ( $role -> hasPermissionTo ( " locations.create " )) checked @ endif ></ td >
< td >< input id = " LocationR " type = " checkbox " name = " value[] " value = " locations.show " @ if ( $role -> hasPermissionTo ( " locations.show " )) checked @ endif ></ td >
< td >< input id = " LocationU " type = " checkbox " name = " value[] " value = " locations.edit " @ if ( $role -> hasPermissionTo ( " locations.edit " )) checked @ endif ></ td >
< td >< input id = " LocationD " type = " checkbox " name = " value[] " value = " locations.delete " @ if ( $role -> hasPermissionTo ( " locations.delete " )) checked @ endif ></ td >
< td >< input id = " Location " type = " checkbox " onclick = " FullControl(this) " ></ td ><!-- Lave en rolle som give fuld adgang ligesom ownuser . edit -->
2020-08-28 06:28:32 +00:00
</ tr >
< tr >
< td > Vaskemaskiner </ td >
2020-09-02 06:56:02 +00:00
< td >< input id = " WashingMachineC " type = " checkbox " name = " value[] " value = " washing.machine.create " @ if ( $role -> hasPermissionTo ( " washing.machine.create " )) checked @ endif ></ td >
< td >< input id = " WashingMachineR " type = " checkbox " name = " value[] " value = " washing.machine.show " @ if ( $role -> hasPermissionTo ( " washing.machine.show " )) checked @ endif ></ td >
< td >< input id = " WashingMachineU " type = " checkbox " name = " value[] " value = " washing.machine.edit " @ if ( $role -> hasPermissionTo ( " washing.machine.edit " )) checked @ endif ></ td >
< td >< input id = " WashingMachineD " type = " checkbox " name = " value[] " value = " washing.machine.delete " @ if ( $role -> hasPermissionTo ( " washing.machine.delete " )) checked @ endif ></ td >
< td >< input id = " WashingMachine " type = " checkbox " onclick = " FullControl(this) " ></ td ><!-- Lave en rolle som give fuld adgang ligesom ownuser . edit -->
2020-08-28 06:28:32 +00:00
</ tr >
< tr >
< td > Reservationer </ td >
2020-09-02 09:40:36 +00:00
< td ></ td >
2020-09-02 06:56:02 +00:00
< 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 >
2020-09-02 09:40:36 +00:00
< td ></ td >
2020-09-02 06:56:02 +00:00
< 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 >
2020-09-07 06:33:46 +00:00
< td ></ td >
2020-08-28 06:28:32 +00:00
</ tr >
< tr >
< td > Kontakter </ td >
2020-09-02 06:56:02 +00:00
< td >< input id = " ContactC " type = " checkbox " name = " value[] " value = " contact.create " @ if ( $role -> hasPermissionTo ( " contact.create " )) checked @ endif ></ 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 id = " ContactU " type = " checkbox " name = " value[] " value = " contact.edit " @ if ( $role -> hasPermissionTo ( " contact.edit " )) checked @ endif ></ td >
< td >< input id = " ContactD " type = " checkbox " name = " value[] " value = " contact.delete " @ if ( $role -> hasPermissionTo ( " contact.delete " )) checked @ endif ></ td >
< td >< input id = " Contact " type = " checkbox " onclick = " FullControl(this) " ></ td ><!-- Lave en rolle som give fuld adgang ligesom ownuser . edit -->
2020-08-28 06:28:32 +00:00
</ tr >
< tr >
< td > Vejledning </ td >
2020-09-02 06:56:02 +00:00
< td >< input id = " GuideC " type = " checkbox " name = " value[] " value = " guides.create " @ if ( $role -> hasPermissionTo ( " guides.create " )) checked @ endif ></ 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 id = " GuideU " type = " checkbox " name = " value[] " value = " guides.edit " @ if ( $role -> hasPermissionTo ( " guides.edit " )) checked @ endif ></ td >
< td >< input id = " GuideD " type = " checkbox " name = " value[] " value = " guides.delete " @ if ( $role -> hasPermissionTo ( " guides.delete " )) checked @ endif ></ td >
< td >< input id = " Guide " type = " checkbox " onclick = " FullControl(this) " ></ td ><!-- Lave en rolle som give fuld adgang ligesom ownuser . edit -->
2020-08-28 06:28:32 +00:00
</ tr >
< tr >
< td > Feedback </ td >
2020-09-02 09:40:36 +00:00
< td ></ td >
2020-09-02 06:56:02 +00:00
< 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 >
2020-09-02 09:40:36 +00:00
< td ></ td >
2020-09-02 06:56:02 +00:00
< td >< input id = " FeedbackD " type = " checkbox " name = " value[] " value = " feedback.delete " @ if ( $role -> hasPermissionTo ( " feedback.delete " )) checked @ endif ></ td >
2020-09-07 06:33:46 +00:00
< td ></ td >
2020-08-28 06:28:32 +00:00
</ tr >
</ table >
</ div >
2020-08-17 08:21:02 +00:00
< input type = " submit " id = " disable " class = " btn btn-dark text-white " value = " Rediger " >
2020-06-30 09:31:12 +00:00
</ form >
@ endsection
2020-08-11 08:54:01 +00:00
@ section ( " scripts " )
< script >
$ ( function () {
$ ( 'form' ) . areYouSure (
{
message : 'It looks like you have been editing something. '
+ 'If you leave before saving, your changes will be lost.'
}
);
});
2020-08-17 08:21:02 +00:00
$ ( document ) . ready ( function () {
$value = $ ( '#name' ) . val ();
$ . ajax ({
type : 'get' ,
url : '{{route(' roles . nameCheckUpdate ')}}' ,
data : { 'nameCheck' : $value , 'id' : {{ $role -> id }}},
success : function ( data ) {
if ( data ){
$ ( " #error " ) . show ( 100 );
$ ( " #error " ) . css ( 'color' , 'red' );
$ ( " #disable " ) . prop ( 'disabled' , true );
$ ( '#disable' ) . css ( 'cursor' , 'not-allowed' );
} else {
$ ( " #error " ) . hide ();
$ ( " #disable " ) . prop ( 'disabled' , false );
$ ( '#disable' ) . css ( 'cursor' , 'pointer' );
}
},
error : function ( data ) {
console . log ( data );
}
});
});
$ ( '#name' ) . on ( 'keyup' , function () {
$value = $ ( this ) . val ();
$ . ajax ({
type : 'get' ,
url : '{{route(' roles . nameCheckUpdate ')}}' ,
data : { 'nameCheck' : $value , 'id' : {{ $role -> id }}},
success : function ( data ) {
if ( data ){
$ ( " #error " ) . show ( 100 );
$ ( " #error " ) . css ( 'color' , 'red' );
$ ( " #disable " ) . prop ( 'disabled' , true );
$ ( '#disable' ) . css ( 'cursor' , 'not-allowed' );
} else {
$ ( " #error " ) . hide ();
$ ( " #disable " ) . prop ( 'disabled' , false );
$ ( '#disable' ) . css ( 'cursor' , 'pointer' );
}
},
error : function ( data ) {
console . log ( data );
}
});
})
2020-08-28 06:28:32 +00:00
// hide permissions
$ ( '#konto' ) . hide ();
$ ( '#admin' ) . hide ();
//Show konto settings
$ ( " #kontoButton " ) . click ( function (){
var value = $ ( '#kontoButton' ) . text ();
2020-09-02 09:40:36 +00:00
if ( value === 'Rediger app rettigheder' ){
2020-08-28 06:28:32 +00:00
$ ( '#konto' ) . slideDown ( 'slow' );
2020-09-02 09:40:36 +00:00
$ ( '#kontoButton' ) . html ( 'Luk app rettigheder' )
2020-08-28 06:28:32 +00:00
} else {
$ ( '#konto' ) . slideUp ( 'slow' );
2020-09-02 09:40:36 +00:00
$ ( '#kontoButton' ) . html ( 'Rediger app rettigheder' )
2020-08-28 06:28:32 +00:00
}
});
//Show admin permissions
$ ( " #adminButton " ) . click ( function (){
var value = $ ( '#adminButton' ) . text ();
if ( v alue === 'Rediger admin rettigheder' ){
$ ( '#admin' ) . slideDown ( 'slow' );
$ ( '#adminButton' ) . html ( 'Luk admin rettigheder' )
} else {
$ ( '#admin' ) . slideUp ( 'slow' );
$ ( '#adminButton' ) . html ( 'Rediger admin rettigheder' )
}
});
2020-09-02 09:40:36 +00:00
function FullControl ( FC ) { //FC == Full Control checkbox element
2020-09-02 06:56:02 +00:00
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
2020-08-28 06:28:32 +00:00
2020-09-02 06:56:02 +00:00
if ( $ ( FC ) . prop ( 'checked' ) == false ) {
$ ( '#' + Create ) . prop ( 'checked' , false );
$ ( '#' + Read ) . prop ( 'checked' , false );
$ ( '#' + Update ) . prop ( 'checked' , false );
$ ( '#' + Delete ) . prop ( 'checked' , false );
2020-09-07 06:33:46 +00:00
// If there is a button in the app side too - Then check off
$ ( '#' + Create + 'Account' ) . prop ( 'checked' , false );
$ ( '#' + Read + 'Account' ) . prop ( 'checked' , false );
$ ( '#' + Delete + 'Account' ) . prop ( 'checked' , false );
2020-09-02 06:56:02 +00:00
} else {
$ ( '#' + Create ) . prop ( 'checked' , true );
$ ( '#' + Read ) . prop ( 'checked' , true );
$ ( '#' + Update ) . prop ( 'checked' , true );
$ ( '#' + Delete ) . prop ( 'checked' , true );
2020-09-07 06:33:46 +00:00
// If there is a button in the app side too - Then check on
$ ( '#' + Create + 'Account' ) . prop ( 'checked' , true );
$ ( '#' + Read + 'Account' ) . prop ( 'checked' , true );
$ ( '#' + Delete + 'Account' ) . prop ( 'checked' , true );
2020-09-02 06:56:02 +00:00
}
}
2020-08-28 06:28:32 +00:00
2020-09-02 06:56:02 +00:00
$ ( 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 );
}
});
2020-08-11 08:54:01 +00:00
</ script >
@ endsection