fix for recurring_invoice permissions (#2159)

This commit is contained in:
David Bomba 2018-06-10 21:15:04 +10:00 committed by GitHub
parent f4db62cf51
commit 3c8b1791ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,24 +19,24 @@
{!! Former::text('action') !!}
</div>
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.user_details') !!}</h3>
</div>
<div class="panel-body form-padding-right">
</div>
<div class="panel-body form-padding-right">
{!! Former::text('first_name') !!}
{!! Former::text('last_name') !!}
{!! Former::text('email') !!}
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.permissions') !!}</h3>
</div>
<div class="panel-body form-padding-right">
</div>
<div class="panel-body form-padding-right">
@if ( ! Utils::hasFeature(FEATURE_USER_PERMISSIONS))
<div class="alert alert-warning">{{ trans('texts.upgrade_for_permissions') }}</div>
@ -106,8 +106,8 @@
</table>
</div>
</div>
</div>
</div>
</div>
<center class="buttons">
{!! Button::normal(trans('texts.cancel'))->asLinkTo(URL::to('/settings/user_management'))->appendIcon(Icon::create('remove-circle'))->large() !!}
@ -130,20 +130,7 @@
@section('onReady')
//start legacy
$('#first_name').focus();
$('#is_admin, #permissions_view_all').change(fixCheckboxes);
function fixCheckboxes(){
var adminChecked = $('#is_admin').is(':checked');
var viewChecked = $('#permissions_view_all').is(':checked');
$('#permissions_view_all').prop('disabled', adminChecked);
$('#permissions_create_all').prop('disabled', adminChecked);
$('#permissions_edit_all').prop('disabled', adminChecked || !viewChecked);
if(!viewChecked)$('#permissions_edit_all').prop('checked',false)
}
fixCheckboxes();
//end legacy
/*
*
@ -154,7 +141,13 @@
$("input[type='checkbox'][id^='view_']").each(function() {
var entity = $(this).attr('id').split("_")[1].replace("]",""); //get entity name
var entity = $(this).attr('id')
.replace('create_',"")
.replace('view_',"")
.replace('edit_',"")
.replace(']',"")
.replace('[',""); //get entity name
$('#edit_' + entity).prop('disabled', !$('#view_' + entity).is(':checked')); //set state of edit checkbox
});
@ -168,7 +161,12 @@
$("input[type='checkbox'][id^='view_']").change(function(){
var entity = $(this).attr('id').split("_")[1].replace("]",""); //get entity name
var entity = $(this).attr('id')
.replace('create_',"")
.replace('view_',"")
.replace('edit_',"")
.replace(']',"")
.replace('[',""); //get entity name
$('#edit_' + entity).prop('disabled', !$('#view_' + entity).is(':checked')); //set state of edit checkbox
@ -185,15 +183,25 @@
$("input[type='checkbox'][id^=" + permission_type + "]").each(function() {
var entity = $(this).attr('id').split("_")[1].replace("]",""); //get entity name
var entity = $(this).attr('id')
.replace('create_',"")
.replace('view_',"")
.replace('edit_',"")
.replace(']',"")
.replace('[',""); //get entity name
$('#' + permission_type + entity).prop('checked', checked); //set state of edit checkbox
if(!$('#view_' + entity).is(':checked')) {
$('#edit_' + entity).prop('checked', false); //remove checkbox value from edit dependant on View state.
}
$('#edit_' + entity).prop('disabled', !$('#view_' + entity).is(':checked')); //set state of edit checkbox
});
});