show submittable warning
This commit is contained in:
parent
23b9de1582
commit
ef041114bb
@ -1,4 +1,8 @@
|
||||
<div class="layout_wrapper">
|
||||
<div id="pe_header"></div>
|
||||
<div id="perm_engine_div" style="margin: 16px;"></div>
|
||||
<div id="submittable_warning" class='help-box' style='display: None'>
|
||||
One of the Roles has <b>Submit</b> permission.
|
||||
You will have to <b>Cancel</b> and then <b>Amend</b> a submitted Document for making changes.
|
||||
</div>
|
||||
</div>
|
@ -130,8 +130,11 @@ pscript.PermEngine.prototype.get_permissions = function() {
|
||||
|
||||
$c_obj('Permission Control','get_permissions',sel_val(me.type_select), function(r,rt) {
|
||||
// Get permissions
|
||||
if(r.message.perms.length)me.get_results(r.message);
|
||||
if(r.message.perms.length) {
|
||||
me.get_results(r.message);
|
||||
}
|
||||
else me.body.innerHTML = '<div style = "color : red; margin:8px 0px;">No Records Found</div>'
|
||||
pscript.show_submittable();
|
||||
});
|
||||
}
|
||||
|
||||
@ -184,6 +187,9 @@ pscript.PermEngine.prototype.get_results = function(r){
|
||||
var val = perms[l][$td(permt,0,m+2).fieldname];
|
||||
if(val == 1) chk.checked = 1;
|
||||
else chk.checked = 0;
|
||||
|
||||
if(m==3) { chk.onclick = pscript.show_submittable }
|
||||
|
||||
chk.doctype = doctype;
|
||||
chk.permlevel = perms[l].permlevel; chk.perm_type = col_labels[m+2].toLowerCase(); chk.role = perms[l].role;
|
||||
pscript.all_checkboxes.push(chk);
|
||||
@ -194,6 +200,24 @@ pscript.PermEngine.prototype.get_results = function(r){
|
||||
me.add_match_select(r, perms, permt, doctype);
|
||||
}
|
||||
|
||||
// Show submittable warning
|
||||
pscript.show_submittable = function() {
|
||||
var submittable = 0;
|
||||
for(i in pscript.all_checkboxes) {
|
||||
c = pscript.all_checkboxes[i];
|
||||
if(c.perm_type=='submit' && c.checked) {
|
||||
submittable = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(submittable) {
|
||||
$('#submittable_warning').toggle(true);
|
||||
} else {
|
||||
$('#submittable_warning').toggle(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// render selects for match
|
||||
// --------------------------------------------
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user