diff --git a/client/modules/crm/src/views/record/row-actions/activities-dashlet.js b/client/modules/crm/src/views/record/row-actions/activities-dashlet.js index 707f967925..653bba725e 100644 --- a/client/modules/crm/src/views/record/row-actions/activities-dashlet.js +++ b/client/modules/crm/src/views/record/row-actions/activities-dashlet.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('crm:views/record/row-actions/activities-dashlet', 'views/record/row-actions/view-and-edit', function (Dep) { +define('crm:views/record/row-actions/activities-dashlet', 'views/record/row-actions/view-and-edit', function (Dep) { return Dep.extend({ @@ -37,10 +37,9 @@ Espo.define('crm:views/record/row-actions/activities-dashlet', 'views/record/row actionList.forEach(function (item) { item.data = item.data || {}; - item.data.scope = this.model.name + item.data.scope = this.model.name; }, this); - if (scope === 'Task') { if (this.options.acl.edit && !~['Completed', 'Canceled'].indexOf(this.model.get('status'))) { actionList.push({ @@ -71,6 +70,7 @@ Espo.define('crm:views/record/row-actions/activities-dashlet', 'views/record/row }); } } + if (this.options.acl.edit) { actionList.push({ action: 'quickRemove', @@ -83,7 +83,7 @@ Espo.define('crm:views/record/row-actions/activities-dashlet', 'views/record/row } return actionList; - } - }); + }, + }); }); diff --git a/client/modules/crm/src/views/record/row-actions/activities.js b/client/modules/crm/src/views/record/row-actions/activities.js index ba4ab71a4c..f0a136352e 100644 --- a/client/modules/crm/src/views/record/row-actions/activities.js +++ b/client/modules/crm/src/views/record/row-actions/activities.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('crm:views/record/row-actions/activities', 'views/record/row-actions/relationship', function (Dep) { +define('crm:views/record/row-actions/activities', 'views/record/row-actions/relationship', function (Dep) { return Dep.extend({ @@ -39,6 +39,7 @@ Espo.define('crm:views/record/row-actions/activities', 'views/record/row-actions }, link: '#' + this.model.name + '/view/' + this.model.id }]; + if (this.options.acl.edit) { list.push({ action: 'quickEdit', @@ -48,6 +49,7 @@ Espo.define('crm:views/record/row-actions/activities', 'views/record/row-actions }, link: '#' + this.model.name + '/edit/' + this.model.id }); + if (this.model.name == 'Meeting' || this.model.name == 'Call') { list.push({ action: 'setHeld', @@ -56,6 +58,7 @@ Espo.define('crm:views/record/row-actions/activities', 'views/record/row-actions id: this.model.id } }); + list.push({ action: 'setNotHeld', html: this.translate('Set Not Held', 'labels', 'Meeting'), @@ -65,6 +68,7 @@ Espo.define('crm:views/record/row-actions/activities', 'views/record/row-actions }); } } + if (this.options.acl.delete) { list.push({ action: 'removeRelated', @@ -74,10 +78,9 @@ Espo.define('crm:views/record/row-actions/activities', 'views/record/row-actions } }); } + return list; - } + }, }); - }); - diff --git a/client/modules/crm/src/views/record/row-actions/history.js b/client/modules/crm/src/views/record/row-actions/history.js index 4ebbbd1a6b..08d15eb71d 100644 --- a/client/modules/crm/src/views/record/row-actions/history.js +++ b/client/modules/crm/src/views/record/row-actions/history.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('crm:views/record/row-actions/history', 'views/record/row-actions/relationship', function (Dep) { +define('crm:views/record/row-actions/history', 'views/record/row-actions/relationship', function (Dep) { return Dep.extend({ @@ -39,6 +39,7 @@ Espo.define('crm:views/record/row-actions/history', 'views/record/row-actions/re }, link: '#' + this.model.name + '/view/' + this.model.id }]; + if (this.model.name == 'Email') { list.push({ action: 'reply', @@ -48,6 +49,7 @@ Espo.define('crm:views/record/row-actions/history', 'views/record/row-actions/re } }); } + if (this.options.acl.edit) { list = list.concat([ { @@ -60,6 +62,7 @@ Espo.define('crm:views/record/row-actions/history', 'views/record/row-actions/re } ]); } + if (this.options.acl.delete) { list.push({ action: 'removeRelated', @@ -69,9 +72,9 @@ Espo.define('crm:views/record/row-actions/history', 'views/record/row-actions/re } }); } + return list; - } + }, }); - }); diff --git a/client/modules/crm/src/views/record/row-actions/relationship-target.js b/client/modules/crm/src/views/record/row-actions/relationship-target.js index 2862f57080..3032a77d23 100644 --- a/client/modules/crm/src/views/record/row-actions/relationship-target.js +++ b/client/modules/crm/src/views/record/row-actions/relationship-target.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('crm:views/record/row-actions/relationship-target', 'views/record/row-actions/relationship-unlink-only', function (Dep) { +define('crm:views/record/row-actions/relationship-target', 'views/record/row-actions/relationship-unlink-only', function (Dep) { return Dep.extend({ @@ -52,9 +52,9 @@ Espo.define('crm:views/record/row-actions/relationship-target', 'views/record/ro }); } } + return list; - } + }, }); - }); diff --git a/client/modules/crm/src/views/record/row-actions/tasks.js b/client/modules/crm/src/views/record/row-actions/tasks.js index 8c47535d5c..a8c94a4558 100644 --- a/client/modules/crm/src/views/record/row-actions/tasks.js +++ b/client/modules/crm/src/views/record/row-actions/tasks.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('crm:views/record/row-actions/tasks', 'views/record/row-actions/relationship-no-unlink', function (Dep) { +define('crm:views/record/row-actions/tasks', 'views/record/row-actions/relationship-no-unlink', function (Dep) { return Dep.extend({ @@ -39,6 +39,7 @@ Espo.define('crm:views/record/row-actions/tasks', 'views/record/row-actions/rela }, link: '#' + this.model.name + '/view/' + this.model.id }]; + if (this.options.acl.edit) { list.push({ action: 'quickEdit', @@ -59,6 +60,7 @@ Espo.define('crm:views/record/row-actions/tasks', 'views/record/row-actions/rela }); } } + if (this.options.acl.delete) { list.push({ action: 'removeRelated', @@ -68,9 +70,9 @@ Espo.define('crm:views/record/row-actions/tasks', 'views/record/row-actions/rela } }); } + return list; - } + }, }); - }); diff --git a/client/src/views/record/row-actions/default-kanban.js b/client/src/views/record/row-actions/default-kanban.js index 579bd95798..fca0920b00 100644 --- a/client/src/views/record/row-actions/default-kanban.js +++ b/client/src/views/record/row-actions/default-kanban.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/record/row-actions/default-kanban', 'views/record/row-actions/default', function (Dep) { +define('views/record/row-actions/default-kanban', 'views/record/row-actions/default', function (Dep) { return Dep.extend({ @@ -39,6 +39,7 @@ Espo.define('views/record/row-actions/default-kanban', 'views/record/row-actions }, link: '#' + this.model.name + '/view/' + this.model.id }]; + if (this.options.statusFieldIsEditable) { list.push({ action: 'moveOver', @@ -48,6 +49,7 @@ Espo.define('views/record/row-actions/default-kanban', 'views/record/row-actions } }); } + if (this.options.acl.edit) { list.push({ action: 'quickEdit', @@ -58,6 +60,7 @@ Espo.define('views/record/row-actions/default-kanban', 'views/record/row-actions link: '#' + this.model.name + '/edit/' + this.model.id }); } + if (this.options.acl.delete) { list.push({ action: 'quickRemove', @@ -68,7 +71,7 @@ Espo.define('views/record/row-actions/default-kanban', 'views/record/row-actions }); } return list; - } - }); + }, + }); }); diff --git a/client/src/views/record/row-actions/default.js b/client/src/views/record/row-actions/default.js index 1cd5e32a60..5c5d77c7b7 100644 --- a/client/src/views/record/row-actions/default.js +++ b/client/src/views/record/row-actions/default.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/record/row-actions/default', 'view', function (Dep) { +define('views/record/row-actions/default', 'view', function (Dep) { return Dep.extend({ @@ -37,22 +37,27 @@ Espo.define('views/record/row-actions/default', 'view', function (Dep) { }, afterRender: function () { - var $dd = this.$el.find('button[data-toggle="dropdown"]').parent(); + let $dd = this.$el.find('button[data-toggle="dropdown"]').parent(); + + let isChecked = false; + + $dd.on('show.bs.dropdown', () => { + let $el = this.$el.closest('.list-row'); - var isChecked = false; - $dd.on('show.bs.dropdown', function () { - var $el = this.$el.closest('.list-row'); isChecked = false; + if ($el.hasClass('active')) { isChecked = true; } + $el.addClass('active'); - }.bind(this)); - $dd.on('hide.bs.dropdown', function () { + }); + + $dd.on('hide.bs.dropdown', () => { if (!isChecked) { this.$el.closest('.list-row').removeClass('active'); } - }.bind(this)); + }); }, getActionList: function () { @@ -62,8 +67,9 @@ Espo.define('views/record/row-actions/default', 'view', function (Dep) { data: { id: this.model.id }, - link: '#' + this.model.name + '/view/' + this.model.id + link: '#' + this.model.name + '/view/' + this.model.id, }]; + if (this.options.acl.edit) { list.push({ action: 'quickEdit', @@ -71,18 +77,20 @@ Espo.define('views/record/row-actions/default', 'view', function (Dep) { data: { id: this.model.id }, - link: '#' + this.model.name + '/edit/' + this.model.id + link: '#' + this.model.name + '/edit/' + this.model.id, }); } + if (this.options.acl.delete) { list.push({ action: 'quickRemove', label: 'Remove', data: { - id: this.model.id + id: this.model.id, } }); } + return list; }, @@ -90,9 +98,9 @@ Espo.define('views/record/row-actions/default', 'view', function (Dep) { return { acl: this.options.acl, actionList: this.getActionList(), - scope: this.model.name + scope: this.model.name, }; - } - }); + }, + }); }); diff --git a/client/src/views/record/row-actions/edit-and-remove.js b/client/src/views/record/row-actions/edit-and-remove.js index 3595912738..2a5508fb34 100644 --- a/client/src/views/record/row-actions/edit-and-remove.js +++ b/client/src/views/record/row-actions/edit-and-remove.js @@ -26,12 +26,13 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/record/row-actions/edit-and-remove', 'views/record/row-actions/default', function (Dep) { +define('views/record/row-actions/edit-and-remove', 'views/record/row-actions/default', function (Dep) { return Dep.extend({ getActionList: function () { var list = []; + if (this.options.acl.edit) { list.push({ action: 'quickEdit', @@ -42,6 +43,7 @@ Espo.define('views/record/row-actions/edit-and-remove', 'views/record/row-action link: '#' + this.model.name + '/edit/' + this.model.id }); } + if (this.options.acl.delete) { list.push({ action: 'quickRemove', @@ -51,9 +53,9 @@ Espo.define('views/record/row-actions/edit-and-remove', 'views/record/row-action } }); } + return list; - } + }, }); - }); diff --git a/client/src/views/record/row-actions/empty.js b/client/src/views/record/row-actions/empty.js index 8e9a55d7fa..f160d207ae 100644 --- a/client/src/views/record/row-actions/empty.js +++ b/client/src/views/record/row-actions/empty.js @@ -32,7 +32,7 @@ define('views/record/row-actions/empty', 'views/record/row-actions/default', fun getActionList: function () { return []; - } + }, }); }); diff --git a/client/src/views/record/row-actions/relationship-edit-and-remove.js b/client/src/views/record/row-actions/relationship-edit-and-remove.js index ba8d64295e..3eb3c7fcca 100644 --- a/client/src/views/record/row-actions/relationship-edit-and-remove.js +++ b/client/src/views/record/row-actions/relationship-edit-and-remove.js @@ -26,12 +26,13 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/record/row-actions/relationship-edit-and-remove', 'views/record/row-actions/relationship', function (Dep) { +define('views/record/row-actions/relationship-edit-and-remove', 'views/record/row-actions/relationship', function (Dep) { return Dep.extend({ getActionList: function () { var list = []; + if (this.options.acl.edit) { list.push({ action: 'quickEdit', @@ -41,6 +42,7 @@ Espo.define('views/record/row-actions/relationship-edit-and-remove', 'views/reco } }); } + if (this.options.acl.delete) { list.push({ action: 'quickRemove', @@ -51,8 +53,7 @@ Espo.define('views/record/row-actions/relationship-edit-and-remove', 'views/reco }); } return list; - } + }, }); - }); diff --git a/client/src/views/record/row-actions/relationship-no-remove.js b/client/src/views/record/row-actions/relationship-no-remove.js index 6666cdd708..bff96f9504 100644 --- a/client/src/views/record/row-actions/relationship-no-remove.js +++ b/client/src/views/record/row-actions/relationship-no-remove.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/record/row-actions/relationship-no-remove', 'views/record/row-actions/relationship', function (Dep) { +define('views/record/row-actions/relationship-no-remove', 'views/record/row-actions/relationship', function (Dep) { return Dep.extend({ @@ -39,6 +39,7 @@ Espo.define('views/record/row-actions/relationship-no-remove', 'views/record/row }, link: '#' + this.model.name + '/view/' + this.model.id }]; + if (this.options.acl.edit) { list.push({ action: 'quickEdit', @@ -58,9 +59,9 @@ Espo.define('views/record/row-actions/relationship-no-remove', 'views/record/row }); } } + return list; - } + }, }); - }); diff --git a/client/src/views/record/row-actions/relationship-no-unlink.js b/client/src/views/record/row-actions/relationship-no-unlink.js index 74d6a23dc4..5ed8550772 100644 --- a/client/src/views/record/row-actions/relationship-no-unlink.js +++ b/client/src/views/record/row-actions/relationship-no-unlink.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/record/row-actions/relationship-no-unlink', 'views/record/row-actions/relationship', function (Dep) { +define('views/record/row-actions/relationship-no-unlink', 'views/record/row-actions/relationship', function (Dep) { return Dep.extend({ @@ -39,6 +39,7 @@ Espo.define('views/record/row-actions/relationship-no-unlink', 'views/record/row }, link: '#' + this.model.name + '/view/' + this.model.id }]; + if (this.options.acl.edit) { list = list.concat([ { @@ -51,6 +52,7 @@ Espo.define('views/record/row-actions/relationship-no-unlink', 'views/record/row } ]); } + if (this.options.acl.delete) { list.push({ action: 'removeRelated', @@ -60,8 +62,9 @@ Espo.define('views/record/row-actions/relationship-no-unlink', 'views/record/row } }); } + return list; - } + }, }); }); diff --git a/client/src/views/record/row-actions/relationship-remove-only.js b/client/src/views/record/row-actions/relationship-remove-only.js index 95411eda6c..f97297a8fe 100644 --- a/client/src/views/record/row-actions/relationship-remove-only.js +++ b/client/src/views/record/row-actions/relationship-remove-only.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/record/row-actions/relationship-remove-only', 'views/record/row-actions/relationship', function (Dep) { +define('views/record/row-actions/relationship-remove-only', 'views/record/row-actions/relationship', function (Dep) { return Dep.extend({ @@ -42,9 +42,7 @@ Espo.define('views/record/row-actions/relationship-remove-only', 'views/record/r } ]; } - } + }, }); - }); - diff --git a/client/src/views/record/row-actions/relationship-unlink-only.js b/client/src/views/record/row-actions/relationship-unlink-only.js index 7f9d7d9202..f42d4cf593 100644 --- a/client/src/views/record/row-actions/relationship-unlink-only.js +++ b/client/src/views/record/row-actions/relationship-unlink-only.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/record/row-actions/relationship-unlink-only', 'views/record/row-actions/relationship', function (Dep) { +define('views/record/row-actions/relationship-unlink-only', 'views/record/row-actions/relationship', function (Dep) { return Dep.extend({ @@ -42,6 +42,7 @@ Espo.define('views/record/row-actions/relationship-unlink-only', 'views/record/r } ]; } - } + }, + }); }); diff --git a/client/src/views/record/row-actions/relationship-view-and-edit.js b/client/src/views/record/row-actions/relationship-view-and-edit.js index cef89dce13..3eaaceb0fa 100644 --- a/client/src/views/record/row-actions/relationship-view-and-edit.js +++ b/client/src/views/record/row-actions/relationship-view-and-edit.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/record/row-actions/relationship-view-and-edit', 'views/record/row-actions/relationship', function (Dep) { +define('views/record/row-actions/relationship-view-and-edit', 'views/record/row-actions/relationship', function (Dep) { return Dep.extend({ @@ -39,6 +39,7 @@ Espo.define('views/record/row-actions/relationship-view-and-edit', 'views/record }, link: '#' + this.model.name + '/view/' + this.model.id }]; + if (this.options.acl.edit) { list.push({ action: 'quickEdit', @@ -49,10 +50,10 @@ Espo.define('views/record/row-actions/relationship-view-and-edit', 'views/record link: '#' + this.model.name + '/edit/' + this.model.id }); } + return list; }, }); - }); diff --git a/client/src/views/record/row-actions/relationship-view-and-unlink.js b/client/src/views/record/row-actions/relationship-view-and-unlink.js index 24c19d9fa5..e6fbc68c00 100644 --- a/client/src/views/record/row-actions/relationship-view-and-unlink.js +++ b/client/src/views/record/row-actions/relationship-view-and-unlink.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/record/row-actions/relationship-view-and-unlink', 'views/record/row-actions/relationship', function (Dep) { +define('views/record/row-actions/relationship-view-and-unlink', 'views/record/row-actions/relationship', function (Dep) { return Dep.extend({ @@ -39,6 +39,7 @@ Espo.define('views/record/row-actions/relationship-view-and-unlink', 'views/reco }, link: '#' + this.model.name + '/view/' + this.model.id }]; + if (this.options.acl.edit && !this.options.unlinkDisabled) { list.push({ action: 'unlinkRelated', @@ -52,5 +53,4 @@ Espo.define('views/record/row-actions/relationship-view-and-unlink', 'views/reco }, }); - }); diff --git a/client/src/views/record/row-actions/relationship.js b/client/src/views/record/row-actions/relationship.js index 157c7b7f49..174f2bda24 100644 --- a/client/src/views/record/row-actions/relationship.js +++ b/client/src/views/record/row-actions/relationship.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/record/row-actions/relationship', 'views/record/row-actions/default', function (Dep) { +define('views/record/row-actions/relationship', 'views/record/row-actions/default', function (Dep) { return Dep.extend({ @@ -39,6 +39,7 @@ Espo.define('views/record/row-actions/relationship', 'views/record/row-actions/d }, link: '#' + this.model.name + '/view/' + this.model.id }]; + if (this.options.acl.edit) { list.push({ action: 'quickEdit', @@ -48,6 +49,7 @@ Espo.define('views/record/row-actions/relationship', 'views/record/row-actions/d }, link: '#' + this.model.name + '/edit/' + this.model.id }); + if (!this.options.unlinkDisabled) { list.push({ action: 'unlinkRelated', @@ -68,9 +70,9 @@ Espo.define('views/record/row-actions/relationship', 'views/record/row-actions/d } }); } + return list; - } + }, }); - }); diff --git a/client/src/views/record/row-actions/view-and-edit.js b/client/src/views/record/row-actions/view-and-edit.js index a596dc9d49..182334da24 100644 --- a/client/src/views/record/row-actions/view-and-edit.js +++ b/client/src/views/record/row-actions/view-and-edit.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/record/row-actions/view-and-edit', 'views/record/row-actions/default', function (Dep) { +define('views/record/row-actions/view-and-edit', 'views/record/row-actions/default', function (Dep) { return Dep.extend({ @@ -39,6 +39,7 @@ Espo.define('views/record/row-actions/view-and-edit', 'views/record/row-actions/ }, link: '#' + this.model.name + '/view/' + this.model.id }]; + if (this.options.acl.edit) { list = list.concat([ { @@ -51,11 +52,9 @@ Espo.define('views/record/row-actions/view-and-edit', 'views/record/row-actions/ } ]); } + return list; - } + }, }); - }); - - diff --git a/client/src/views/record/row-actions/view-and-remove.js b/client/src/views/record/row-actions/view-and-remove.js index 4acfeaa33a..c81a641fea 100644 --- a/client/src/views/record/row-actions/view-and-remove.js +++ b/client/src/views/record/row-actions/view-and-remove.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/record/row-actions/view-and-remove', 'views/record/row-actions/default', function (Dep) { +define('views/record/row-actions/view-and-remove', 'views/record/row-actions/default', function (Dep) { return Dep.extend({ @@ -39,6 +39,7 @@ Espo.define('views/record/row-actions/view-and-remove', 'views/record/row-action }, link: '#' + this.model.name + '/view/' + this.model.id }]; + if (this.options.acl.delete) { actionList.push({ action: 'quickRemove', @@ -49,8 +50,9 @@ Espo.define('views/record/row-actions/view-and-remove', 'views/record/row-action }); } - return actionList; - } - }); + return actionList; + }, + + }); }); diff --git a/client/src/views/record/row-actions/view-only.js b/client/src/views/record/row-actions/view-only.js index c5d9f16a5a..a10affe081 100644 --- a/client/src/views/record/row-actions/view-only.js +++ b/client/src/views/record/row-actions/view-only.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/record/row-actions/view-only', 'views/record/row-actions/default', function (Dep) { +define('views/record/row-actions/view-only', 'views/record/row-actions/default', function (Dep) { return Dep.extend({ @@ -41,10 +41,7 @@ Espo.define('views/record/row-actions/view-only', 'views/record/row-actions/defa link: '#' + this.model.name + '/view/' + this.model.id } ]; - } + }, }); - }); - -