[DE] Delete last role

This commit is contained in:
Julia Radzhabova 2022-12-28 21:22:33 +03:00
parent 271b467e64
commit ed0a9d7f4c
2 changed files with 5 additions and 11 deletions

View file

@ -250,23 +250,15 @@ define([ 'text!documenteditor/main/app/template/RolesManagerDlg.template',
if (!rec) return;
if (store.length===1 && rec.get('fields')>0) {
Common.UI.warning({
msg: me.warnCantDelete,
buttons: ['ok']
});
return;
}
var callback = function(toRole) {
me.lastSelectedRole = store.indexOf(rec);
me.oformManager.asc_removeRole(rec.get('name'), toRole); // remove role and move it's fields
};
if (rec.get('fields')<1) {
if (store.length===1 || rec.get('fields')<1) {
me._isWarningVisible = true;
Common.UI.warning({
msg: Common.Utils.String.format(me.warnDelete, rec.get('name')),
msg: Common.Utils.String.format(store.length===1 ? me.textDeleteLast : me.warnDelete, rec.get('name')),
buttons: ['ok', 'cancel'],
callback: function(btn) {
if (btn == 'ok') {
@ -366,7 +358,8 @@ define([ 'text!documenteditor/main/app/template/RolesManagerDlg.template',
textUp: 'Move role up',
textDown: 'Move role down',
textDescription: 'Add roles and set the order in which the fillers receive and sign the document',
textAnyone: 'Anyone'
textAnyone: 'Anyone',
textDeleteLast: 'Are you sure you want to delete the role {0}?<br>Once deleted, the default role will be created.'
}, DE.Views.RolesManagerDlg || {}));
});

View file

@ -2698,6 +2698,7 @@
"DE.Views.RolesManagerDlg.txtTitle": "Manage Roles",
"DE.Views.RolesManagerDlg.warnCantDelete": "You cannot delete this role because it has associated fields.",
"DE.Views.RolesManagerDlg.warnDelete": "Are you sure you want to delete the role {0}?",
"DE.Views.RolesManagerDlg.textDeleteLast": "Are you sure you want to delete the role {0}?<br>Once deleted, the default role will be created.",
"DE.Views.SaveFormDlg.saveButtonText": "Save",
"DE.Views.SaveFormDlg.textAnyone": "Anyone",
"DE.Views.SaveFormDlg.textDescription": "When saving to the oform, only roles with fields are added to the filling list",