Skip to content

EspoCRM – Open Source CRM Application

ref

Yuri Kuznetsov42213789ba36
diff --git a/client/modules/crm/src/views/campaign/record/panels/campaign-log-records.js b/client/modules/crm/src/views/campaign/record/panels/campaign-log-records.js
index 7ff9ff7776..95eb599b02 100644
--- a/client/modules/crm/src/views/campaign/record/panels/campaign-log-records.js
+++ b/client/modules/crm/src/views/campaign/record/panels/campaign-log-records.js
@@ -26,83 +26,72 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('crm:views/campaign/record/panels/campaign-log-records', ['views/record/panels/relationship'], function (Dep) {
-
- return Dep.extend({
-
- filterList: [
- "all",
- "sent",
- "opened",
- "optedOut",
- "bounced",
- "clicked",
- "optedIn",
- "leadCreated",
- ],
-
- data: function () {
- return _.extend({
- filterList: this.filterList,
- filterValue: this.filterValue,
- }, Dep.prototype.data.call(this));
- },
-
- setup: function () {
- if (this.getAcl().checkScope('TargetList', 'create')) {
- this.actionList.push({
- action: 'createTargetList',
- label: 'Create Target List',
- });
- }
-
- this.filterList = Espo.Utils.clone(this.filterList);
-
- if (!this.getConfig().get('massEmailOpenTracking')) {
- var i = this.filterList.indexOf('opened')
-
- if (~i) {
- this.filterList.splice(i, 1);
- }
- }
-
- Dep.prototype.setup.call(this);
- },
+import RelationshipPanelView from 'views/record/panels/relationship';
+import RecordModal from 'helpers/record-modal';
+
+// noinspection JSUnusedGlobalSymbols
+export default class CampaignLogRecordsPanelView extends RelationshipPanelView {
+
+ filterList = [
+ "all",
+ "sent",
+ "opened",
+ "optedOut",
+ "bounced",
+ "clicked",
+ "optedIn",
+ "leadCreated",
+ ]
+
+ setup() {
+ if (this.getAcl().checkScope('TargetList', 'create')) {
+ this.actionList.push({
+ action: 'createTargetList',
+ label: 'Create Target List',
+ });
+ }
- actionCreateTargetList: function () {
- var attributes = {
- sourceCampaignId: this.model.id,
- sourceCampaignName: this.model.get('name'),
- };
+ this.filterList = Espo.Utils.clone(this.filterList);
- if (!this.collection.data.primaryFilter) {
- attributes.includingActionList = [];
- } else {
- var status = Espo.Utils.upperCaseFirst(this.collection.data.primaryFilter).replace(/([A-Z])/g, ' $1');
+ if (!this.getConfig().get('massEmailOpenTracking')) {
+ const i = this.filterList.indexOf('opened');
- attributes.includingActionList = [status];
+ if (i >= 0) {
+ this.filterList.splice(i, 1);
}
-
- var viewName = this.getMetadata().get('clientDefs.TargetList.modalViews.edit') || 'views/modals/edit';
-
- this.createView('quickCreate', viewName, {
- scope: 'TargetList',
- attributes: attributes,
- fullFormDisabled: true,
- layoutName: 'createFromCampaignLog',
- }, (view) => {
- view.render();
-
- var recordView = view.getView('edit');
-
- if (recordView) {
- recordView.setFieldRequired('includingActionList');
- }
-
- this.listenToOnce(view, 'after:save', () => {
- Espo.Ui.success(this.translate('Done'));
- });
- });
- },
- });
-});
+ }
+
+ super.setup();
+ }
+
+ actionCreateTargetList() {
+ const attributes = {
+ sourceCampaignId: this.model.id,
+ sourceCampaignName: this.model.attributes.name,
+ };
+
+ if (!this.collection.data.primaryFilter) {
+ attributes.includingActionList = [];
+ } else {
+ const status = Espo.Utils.upperCaseFirst(this.collection.data.primaryFilter)
+ .replace(/([A-Z])/g, ' $1');
+
+ attributes.includingActionList = [status];
+ }
+
+ const helper = new RecordModal();
+
+ helper.showCreate(this, {
+ entityType: 'TargetList',
+ attributes: attributes,
+ fullFormDisabled: true,
+ layoutName: 'createFromCampaignLog',
+ afterSave: () => {
+ Espo.Ui.success(this.translate('Done'));
+ },
+ beforeRender: view => {
+ view.getRecordView().setFieldRequired('includingActionList')
+ },
+ });
+ }
+}
diff --git a/client/src/helpers/record-modal.js b/client/src/helpers/record-modal.js
index aea726c525..84043977bf 100644
--- a/client/src/helpers/record-modal.js
+++ b/client/src/helpers/record-modal.js
@@ -68,6 +68,7 @@ class RecordModalHelper {
* editDisabled?: boolean,
* removeDisabled?: boolean,
* rootUrl?: string,
+ * layoutName?: string,
* afterSave?: function(import('model').default, {bypassClose: boolean}),
* afterDestroy?: function(import('model').default),
* beforeRender?: function(import('views/modals/detail').default),
@@ -104,6 +105,7 @@ class RecordModalHelper {
quickEditDisabled: params.editDisabled,
rootUrl: params.rootUrl,
removeDisabled: params.removeDisabled,
+ layoutName: params.layoutName,
};
Espo.Ui.notifyWait();
@@ -148,8 +150,9 @@ class RecordModalHelper {
* id?: string,
* model?: import('model').default,
* rootUrl?: string,
- * noFullForm?: boolean,
+ * fullFormDisabled?: boolean,
* returnUrl?: string,
+ * layoutName?: string,
* afterSave?: function(import('model').default, {bypassClose: boolean}),
* beforeRender?: function(import('views/modals/edit').default),
* onClose?: function(),
@@ -175,9 +178,10 @@ class RecordModalHelper {
entityType: entityType,
id: id,
model: model,
- fullFormDisabled: params.noFullForm,
+ fullFormDisabled: params.fullFormDisabled,
returnUrl: params.returnUrl || this.router.getCurrentUrl(),
returnDispatchParams: params.returnDispatchParams,
+ layoutName: params.layoutName,
};
if (params.rootUrl) {
@@ -220,7 +224,7 @@ class RecordModalHelper {
* @param {{
* entityType: string,
* rootUrl?: string,
- * noFullForm?: boolean,
+ * fullFormDisabled?: boolean,
* returnUrl?: string,
* relate?: model:model~setRelateItem | model:model~setRelateItem[],
* attributes?: Record.<string, *>,
@@ -228,6 +232,7 @@ class RecordModalHelper {
* beforeRender?: function(import('views/modals/edit').default),
* onClose?: function(),
* focusForCreate?: boolean,
+ * layoutName?: string,
* returnDispatchParams?: {
* controller: string,
* action: string|null,
@@ -246,12 +251,13 @@ class RecordModalHelper {
/** @type {module:views/modals/edit~options} */
const options = {
entityType: entityType,
- fullFormDisabled: params.noFullForm,
+ fullFormDisabled: params.fullFormDisabled,
returnUrl: params.returnUrl || this.router.getCurrentUrl(),
returnDispatchParams: params.returnDispatchParams,
relate: params.relate,
attributes: params.attributes,
focusForCreate: params.focusForCreate,
+ layoutName: params.layoutName,
};
if (params.rootUrl) {
diff --git a/client/src/views/record/list.js b/client/src/views/record/list.js
index 6e128d63a1..2eeb11b436 100644
--- a/client/src/views/record/list.js
+++ b/client/src/views/record/list.js
@@ -3364,7 +3364,7 @@ class ListRecordView extends View {
entityType: scope,
id: id,
model: model,
- noFullForm: data.noFullForm,
+ fullFormDisabled: data.noFullForm,
rootUrl: rootUrl,
afterSave: m => {
const model = this.collection.get(m.id);