EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Activities row actions ref
Yurii55c9b6a83b24
diff --git a/client/modules/crm/src/views/call/record/row-actions/dashlet.js b/client/modules/crm/src/views/call/record/row-actions/dashlet.jsindex 82ea520850..c5e792d3ed 100644--- a/client/modules/crm/src/views/call/record/row-actions/dashlet.js+++ b/client/modules/crm/src/views/call/record/row-actions/dashlet.js@@ -26,52 +26,6 @@* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.************************************************************************/-define('crm:views/call/record/row-actions/dashlet', ['views/record/row-actions/view-and-edit'], function (Dep) {+import DashletMeetingRowActionsView from 'modules/crm/views/meeting/record/row-actions/dashlet';- return Dep.extend({-- getActionList: function () {- var actionList = Dep.prototype.getActionList.call(this);-- if (- this.options.acl.edit &&- !['Held', 'Not Held'].includes(this.model.get('status')) &&- this.getAcl().checkField(this.model.entityType, 'status', 'edit')- ) {- actionList.push({- action: 'setHeld',- label: 'Set Held',- data: {- id: this.model.id- },- groupIndex: 1,- iconClass: 'fas fa-check',- });-- actionList.push({- action: 'setNotHeld',- label: 'Set Not Held',- data: {- id: this.model.id- },- groupIndex: 1,- });- }-- if (this.options.acl.delete) {- actionList.push({- action: 'quickRemove',- label: 'Remove',- data: {- id: this.model.id,- scope: this.model.entityType- },- groupIndex: 0,- iconClass: Dep.ICON_CLASS_REMOVE,- });- }-- return actionList;- }- });-});+export default class extends DashletMeetingRowActionsView {}diff --git a/client/modules/crm/src/views/call/record/row-actions/default.js b/client/modules/crm/src/views/call/record/row-actions/default.jsindex f471d1ae6a..75b5cb9650 100644--- a/client/modules/crm/src/views/call/record/row-actions/default.js+++ b/client/modules/crm/src/views/call/record/row-actions/default.js@@ -26,51 +26,6 @@* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.************************************************************************/-define('crm:views/call/record/row-actions/default', ['views/record/row-actions/view-and-edit'], function (Dep) {+import MeetingDefaultRowActionsView from 'modules/crm/views/meeting/record/row-actions/default';- return Dep.extend({-- getActionList: function () {- const actionList = Dep.prototype.getActionList.call(this);-- if (- this.options.acl.edit &&- !['Held', 'Not Held'].includes(this.model.get('status')) &&- this.getAcl().checkField(this.model.entityType, 'status', 'edit')- ) {- actionList.push({- action: 'setHeld',- label: 'Set Held',- data: {- id: this.model.id- },- groupIndex: 1,- iconClass: 'fas fa-check',- });- actionList.push({- action: 'setNotHeld',- label: 'Set Not Held',- data: {- id: this.model.id- },- groupIndex: 1,- });- }-- if (this.options.acl.delete) {- actionList.push({- action: 'quickRemove',- label: 'Remove',- data: {- id: this.model.id,- scope: this.model.entityType- },- groupIndex: 0,- iconClass: Dep.ICON_CLASS_REMOVE,- });- }-- return actionList;- }- });-});+export default class extends MeetingDefaultRowActionsView {}diff --git a/client/modules/crm/src/views/meeting/record/row-actions/dashlet.js b/client/modules/crm/src/views/meeting/record/row-actions/dashlet.jsindex e4b1608290..75b5cb9650 100644--- a/client/modules/crm/src/views/meeting/record/row-actions/dashlet.js+++ b/client/modules/crm/src/views/meeting/record/row-actions/dashlet.js@@ -26,59 +26,6 @@* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.************************************************************************/-define('crm:views/meeting/record/row-actions/dashlet', ['views/record/row-actions/view-and-edit'], function (Dep) {+import MeetingDefaultRowActionsView from 'modules/crm/views/meeting/record/row-actions/default';- return Dep.extend({-- getActionList: function () {- var actionList = Dep.prototype.getActionList.call(this);-- actionList.forEach(item => {- item.data = item.data || {};- item.data.scope = this.model.entityType;- });-- if (- this.options.acl.edit &&- !['Held', 'Not Held'].includes(this.model.get('status')) &&- this.getAcl().checkField(this.model.entityType, 'status', 'edit')- ) {- actionList.push({- action: 'setHeld',- label: 'Set Held',- data: {- id: this.model.id,- scope: this.model.entityType,- },- groupIndex: 1,- iconClass: 'fas fa-check',- });-- actionList.push({- action: 'setNotHeld',- label: 'Set Not Held',- data: {- id: this.model.id,- scope: this.model.entityType,- },- groupIndex: 1,- });- }-- if (this.options.acl.delete) {- actionList.push({- action: 'quickRemove',- label: 'Remove',- data: {- id: this.model.id,- scope: this.model.entityType,- },- groupIndex: 0,- iconClass: Dep.ICON_CLASS_REMOVE,- });- }-- return actionList;- }- });-});+export default class extends MeetingDefaultRowActionsView {}diff --git a/client/modules/crm/src/views/meeting/record/row-actions/default.js b/client/modules/crm/src/views/meeting/record/row-actions/default.jsindex 30217eff3e..b9db7b93ce 100644--- a/client/modules/crm/src/views/meeting/record/row-actions/default.js+++ b/client/modules/crm/src/views/meeting/record/row-actions/default.js@@ -26,23 +26,32 @@* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.************************************************************************/-define('crm:views/meeting/record/row-actions/default', ['views/record/row-actions/view-and-edit'], function (Dep) {+import DefaultRowActionsView from 'views/record/row-actions/default';- return Dep.extend({+export default class MeetingDefaultRowActionsView extends DefaultRowActionsView {- getActionList: function () {- var actionList = Dep.prototype.getActionList.call(this);+ getActionList() {+ const actionList = super.getActionList();- actionList.forEach(item => {- item.data = item.data || {};- item.data.scope = this.model.entityType;- });+ actionList.forEach(item => {+ item.data = item.data ?? {};+ item.data.scope = this.model.entityType;+ });- if (- this.options.acl.edit &&- !['Held', 'Not Held'].includes(this.model.get('status')) &&- this.getAcl().checkField(this.model.entityType, 'status', 'edit')- ) {+ if (+ this.options.acl.edit &&+ !['Held', 'Not Held'].includes(this.model.attributes.status) &&+ this.getAcl().checkField(this.model.entityType, 'status', 'edit')+ ) {+ /** @type {string[]} */+ const options = this.model.getFieldParam('status', 'options') ?? [];++ const notActualStatuses = [+ ...this.getMetadata().get(`scopes.${this.model.entityType}.completedStatusList`, []),+ ...this.getMetadata().get(`scopes.${this.model.entityType}.canceledStatusList`, []),+ ];++ if (options.includes('Held') && !notActualStatuses.includes(this.model.attributes.status)) {actionList.push({action: 'setHeld',label: 'Set Held',@@ -53,7 +62,9 @@ define('crm:views/meeting/record/row-actions/default', ['views/record/row-actiongroupIndex: 1,iconClass: 'fas fa-check',});+ }+ if (options.includes('Not Held') && !notActualStatuses.includes(this.model.attributes.status)) {actionList.push({action: 'setNotHeld',label: 'Set Not Held',@@ -64,21 +75,9 @@ define('crm:views/meeting/record/row-actions/default', ['views/record/row-actiongroupIndex: 1,});}+ }- if (this.options.acl.delete) {- actionList.push({- action: 'quickRemove',- label: 'Remove',- data: {- id: this.model.id,- scope: this.model.entityType,- },- groupIndex: 0,- iconClass: Dep.ICON_CLASS_REMOVE,- });- }+ return actionList;+ }+}- return actionList;- }- });-});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.jsindex db997a0ac1..d9001efdfd 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,70 +26,69 @@* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.************************************************************************/-define('crm:views/record/row-actions/activities-dashlet', ['views/record/row-actions/view-and-edit'], function (Dep) {+import DefaultRowActionsView from 'views/record/row-actions/default';- return Dep.extend({+export default class ActivitiesDashletRowActionsView extends DefaultRowActionsView {- getActionList: function () {- var actionList = Dep.prototype.getActionList.call(this);+ getActionList() {+ const actionList = super.getActionList();- var scope = this.model.entityType;+ const entityType = this.model.entityType;- actionList.forEach(function (item) {- item.data = item.data || {};- item.data.scope = this.model.entityType;- }, this);+ /** @type {string[]} */+ const options = this.model.getFieldParam('status', 'options') ?? [];- if (scope === 'Task') {- if (this.options.acl.edit && !~['Completed', 'Canceled'].indexOf(this.model.get('status'))) {- actionList.push({- action: 'setCompleted',- label: 'Complete',- data: {- id: this.model.id- },- groupIndex: 1,- iconClass: 'fas fa-check',- });- }- } else {- if (this.options.acl.edit && !~['Held', 'Not Held'].indexOf(this.model.get('status'))) {- actionList.push({- action: 'setHeld',- label: 'Set Held',- data: {- id: this.model.id,- scope: this.model.entityType- },- groupIndex: 1,- iconClass: 'fas fa-check',- });- actionList.push({- action: 'setNotHeld',- label: 'Set Not Held',- data: {- id: this.model.id,- scope: this.model.entityType- },- groupIndex: 1,- });- }+ const notActualStatuses = [+ ...this.getMetadata().get(`scopes.${this.model.entityType}.completedStatusList`, []),+ ...this.getMetadata().get(`scopes.${this.model.entityType}.canceledStatusList`, []),+ ];++ if (entityType === 'Task') {+ if (+ this.options.acl.edit &&+ options.includes('Completed') &&+ !notActualStatuses.includes(this.model.attributes.status)+ ) {+ actionList.push({+ action: 'setCompleted',+ label: 'Complete',+ data: {+ id: this.model.id+ },+ groupIndex: 1,+ iconClass: 'fas fa-check',+ });+ }+ } else if (+ this.options.acl.edit &&+ !notActualStatuses.includes(this.model.attributes.status)+ ) {+ if (options.includes('Held')) {+ actionList.push({+ action: 'setHeld',+ label: 'Set Held',+ data: {+ id: this.model.id,+ scope: this.model.entityType+ },+ groupIndex: 1,+ iconClass: 'fas fa-check',+ });}- if (this.options.acl.edit) {+ if (options.includes('Not Held')) {actionList.push({- action: 'quickRemove',- label: 'Remove',+ action: 'setNotHeld',+ label: 'Set Not Held',data: {id: this.model.id,scope: this.model.entityType},- groupIndex: 0,- iconClass: Dep.ICON_CLASS_REMOVE,+ groupIndex: 1,});}+ }- return actionList;- },- });-});+ 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.jsindex 489ea9f815..10e3da90ad 100644--- a/client/modules/crm/src/views/record/row-actions/activities.js+++ b/client/modules/crm/src/views/record/row-actions/activities.js@@ -26,36 +26,31 @@* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.************************************************************************/-define('crm:views/record/row-actions/activities', ['views/record/row-actions/relationship'], function (Dep) {+import RelationshipRowActionsView from 'views/record/row-actions/relationship';- return Dep.extend({+export default class ActivitiesRowActionsView extends RelationshipRowActionsView {- getActionList: function () {- var list = [{- action: 'quickView',- label: 'View',- data: {- id: this.model.id,- },- link: '#' + this.model.entityType + '/view/' + this.model.id,- groupIndex: 0,- iconClass: Dep.ICON_CLASS_VIEW,- }];+ setup() {+ super.setup();- if (this.options.acl.edit) {- list.push({- action: 'quickEdit',- label: 'Edit',- data: {- id: this.model.id,- },- link: '#' + this.model.entityType + '/edit/' + this.model.id,- groupIndex: 0,- iconClass: Dep.ICON_CLASS_EDIT,- });+ this.options.unlinkDisabled = true;+ }- if (this.model.entityType === 'Meeting' || this.model.entityType === 'Call') {- list.push({+ getActionList() {+ const actionList = super.getActionList();++ if (this.options.acl.edit) {+ if (this.model.entityType === 'Meeting' || this.model.entityType === 'Call') {+ /** @type {string[]} */+ const options = this.model.getFieldParam('status', 'options') ?? [];++ const notActualStatuses = [+ ...this.getMetadata().get(`scopes.${this.model.entityType}.completedStatusList`, []),+ ...this.getMetadata().get(`scopes.${this.model.entityType}.canceledStatusList`, []),+ ];++ if (options.includes('Held') && !notActualStatuses.includes(this.model.attributes.status)) {+ actionList.push({action: 'setHeld',text: this.translate('Set Held', 'labels', 'Meeting'),data: {@@ -64,8 +59,10 @@ define('crm:views/record/row-actions/activities', ['views/record/row-actions/relgroupIndex: 1,iconClass: 'fas fa-check',});+ }- list.push({+ if (options.includes('Not Held') && !notActualStatuses.includes(this.model.attributes.status)) {+ actionList.push({action: 'setNotHeld',text: this.translate('Set Not Held', 'labels', 'Meeting'),data: {@@ -75,20 +72,8 @@ define('crm:views/record/row-actions/activities', ['views/record/row-actions/rel});}}+ }- if (this.options.acl.delete) {- list.push({- action: 'removeRelated',- label: 'Remove',- data: {- id: this.model.id,- },- groupIndex: 0,- iconClass: Dep.ICON_CLASS_REMOVE,- });- }-- return list;- },- });-});+ return actionList;+ }+}diff --git a/client/modules/crm/src/views/record/row-actions/history.js b/client/modules/crm/src/views/record/row-actions/history.jsindex f119c56fb3..9b933b11e0 100644--- a/client/modules/crm/src/views/record/row-actions/history.js+++ b/client/modules/crm/src/views/record/row-actions/history.js@@ -26,63 +26,31 @@* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.************************************************************************/-define('crm:views/record/row-actions/history', ['views/record/row-actions/relationship'], function (Dep) {+import RelationshipRowActionsView from 'views/record/row-actions/relationship';- return Dep.extend({+export default class ActivitiesRowActionsView extends RelationshipRowActionsView {- getActionList: function () {- var list = [{- action: 'quickView',- label: 'View',- data: {- id: this.model.id- },- link: '#' + this.model.entityType + '/view/' + this.model.id,- groupIndex: 0,- iconClass: Dep.ICON_CLASS_VIEW,- }];-- if (this.model.entityType === 'Email') {- list.push({- action: 'reply',- text: this.translate('Reply', 'labels', 'Email'),- data: {- id: this.model.id- },- groupIndex: 1,- iconClass: 'fas fa-reply',- });- }+ setup() {+ super.setup();- if (this.options.acl.edit) {- list = list.concat([- {- action: 'quickEdit',- label: 'Edit',- data: {- id: this.model.id- },- link: '#' + this.model.entityType + '/edit/' + this.model.id,- groupIndex: 0,- iconClass: Dep.ICON_CLASS_EDIT,- },- ]);- }+ this.options.unlinkDisabled = true;+ }- if (this.options.acl.delete) {- list.push({- action: 'removeRelated',- label: 'Remove',- data: {- id: this.model.id- },- groupIndex: 0,- iconClass: Dep.ICON_CLASS_REMOVE,- });- }+ getActionList() {+ const list = super.getActionList();- return list;- },-- });-});+ if (this.model.entityType === 'Email' && this.getAcl().checkScope('Email', 'create')) {+ list.push({+ action: 'reply',+ text: this.translate('Reply', 'labels', 'Email'),+ data: {+ id: this.model.id+ },+ groupIndex: 1,+ iconClass: 'fas fa-reply',+ });+ }++ return list;+ }+}diff --git a/client/modules/crm/src/views/task/record/row-actions/dashlet.js b/client/modules/crm/src/views/task/record/row-actions/dashlet.jsindex 4ae3ba0525..52e5cee4fc 100644--- a/client/modules/crm/src/views/task/record/row-actions/dashlet.js+++ b/client/modules/crm/src/views/task/record/row-actions/dashlet.js@@ -26,39 +26,6 @@* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.************************************************************************/-define('crm:views/task/record/row-actions/dashlet', ['views/record/row-actions/view-and-edit'], function (Dep) {+import TaskDefaultRowActionsView from 'modules/crm/views/task/record/row-actions/default';- return Dep.extend({-- getActionList: function () {- var actionList = Dep.prototype.getActionList.call(this);-- if (this.options.acl.edit && !~['Completed', 'Canceled'].indexOf(this.model.get('status'))) {- actionList.push({- action: 'setCompleted',- label: 'Complete',- data: {- id: this.model.id- },- groupIndex: 1,- iconClass: 'fas fa-check',- });- }-- if (this.options.acl.delete) {- actionList.push({- action: 'quickRemove',- label: 'Remove',- data: {- id: this.model.id,- scope: this.model.entityType- },- groupIndex: 0,- iconClass: Dep.ICON_CLASS_REMOVE,- });- }-- return actionList;- },- });-});+export default class extends TaskDefaultRowActionsView {}diff --git a/client/modules/crm/src/views/task/record/row-actions/default.js b/client/modules/crm/src/views/task/record/row-actions/default.jsindex 7d8ea514b3..1e7b03dc2d 100644--- a/client/modules/crm/src/views/task/record/row-actions/default.js+++ b/client/modules/crm/src/views/task/record/row-actions/default.js@@ -26,39 +26,37 @@* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.************************************************************************/-define('crm:views/task/record/row-actions/default', ['views/record/row-actions/view-and-edit'], function (Dep) {+import DefaultRowActionsView from 'views/record/row-actions/default';- return Dep.extend({+export default class TaskDefaultRowActionsView extends DefaultRowActionsView {- getActionList: function () {- var actionList = Dep.prototype.getActionList.call(this);+ getActionList() {+ const actionList = super.getActionList();- if (this.options.acl.edit && !~['Completed', 'Canceled'].indexOf(this.model.get('status'))) {- actionList.push({- action: 'setCompleted',- label: 'Complete',- data: {- id: this.model.id- },- groupIndex: 1,- iconClass: 'fas fa-check',- });- }+ const historyStatusList = [+ ...this.getMetadata().get(`scopes.${this.model.entityType}.completedStatusList`, []),+ ...this.getMetadata().get(`scopes.${this.model.entityType}.canceledStatusList`, []),+ ];- if (this.options.acl.delete) {- actionList.push({- action: 'quickRemove',- label: 'Remove',- data: {- id: this.model.id,- scope: this.model.entityType- },- groupIndex: 0,- iconClass: Dep.ICON_CLASS_REMOVE,- });- }+ /** @type {string[]} */+ const options = this.model.getFieldParam('status', 'options') ?? [];- return actionList;- },- });-});+ if (+ this.options.acl.edit &&+ options.includes('Completed') &&+ !historyStatusList.includes(this.model.attributes.status)+ ) {+ actionList.push({+ action: 'setCompleted',+ label: 'Complete',+ data: {+ id: this.model.id,+ },+ groupIndex: 1,+ iconClass: 'fas fa-check',+ });+ }++ return actionList;+ }+}