From 2ff6946b9155cbc846b6f7724d63faeb7f0920a8 Mon Sep 17 00:00:00 2001 From: yuri Date: Thu, 5 Mar 2015 11:14:02 +0200 Subject: [PATCH] dev --- .../Crm/Resources/i18n/en_US/Campaign.json | 14 +++- .../metadata/entityDefs/Campaign.json | 74 ++++++++++++++++++- .../campaign/record/panels/statistics.js | 33 ++++++++- 3 files changed, 116 insertions(+), 5 deletions(-) diff --git a/application/Espo/Modules/Crm/Resources/i18n/en_US/Campaign.json b/application/Espo/Modules/Crm/Resources/i18n/en_US/Campaign.json index 68c32d34c3..ffa1892b7a 100644 --- a/application/Espo/Modules/Crm/Resources/i18n/en_US/Campaign.json +++ b/application/Espo/Modules/Crm/Resources/i18n/en_US/Campaign.json @@ -6,7 +6,16 @@ "type": "Type", "startDate": "Start Date", "endDate": "End Date", - "targetLists": "Target Lists" + "targetLists": "Target Lists", + "sentCount": "Sent", + "openedCount": "Opened", + "clickedCount": "Clicked", + "optedOutCount": "Opted Out", + "bouncedCount": "Bounced", + "hardBouncedCount": "Hard Bounced", + "softBouncedCount": "Soft Bounced", + "leadCreatedCount": "Leads Created", + "revenue": "Revenue" }, "links": { "targetLists": "Target Lists", @@ -22,7 +31,8 @@ "Web": "Web", "Television": "Television", "Radio": "Radio", - "Newsletter": "Newsletter" + "Newsletter": "Newsletter", + "Mail": "Mail" }, "status": { "Planning": "Planning", diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Campaign.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Campaign.json index 90d6128e76..a99375488d 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Campaign.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Campaign.json @@ -11,7 +11,7 @@ }, "type": { "type": "enum", - "options": ["Email", "Web", "Television", "Radio", "Newsletter"] + "options": ["Email", "Newsletter", "Web", "Television", "Radio", "Mail"] }, "startDate": { "type": "date" @@ -47,6 +47,78 @@ }, "targetLists": { "type": "linkMultiple" + }, + "sentCount": { + "type": "int", + "notStorable": true, + "readOnly": true, + "layoutDetailDisabled": true, + "layoutListDisabled": true, + "layoutSearchDisabled": true + }, + "openedCount": { + "type": "int", + "notStorable": true, + "readOnly": true, + "layoutDetailDisabled": true, + "layoutListDisabled": true, + "layoutSearchDisabled": true + }, + "clickedCount": { + "type": "int", + "notStorable": true, + "readOnly": true, + "layoutDetailDisabled": true, + "layoutListDisabled": true, + "layoutSearchDisabled": true + }, + "optedOutCount": { + "type": "int", + "notStorable": true, + "readOnly": true, + "layoutDetailDisabled": true, + "layoutListDisabled": true, + "layoutSearchDisabled": true + }, + "bouncedCount": { + "type": "int", + "notStorable": true, + "readOnly": true, + "layoutDetailDisabled": true, + "layoutListDisabled": true, + "layoutSearchDisabled": true + }, + "hardBouncedCount": { + "type": "int", + "notStorable": true, + "readOnly": true, + "layoutDetailDisabled": true, + "layoutListDisabled": true, + "layoutSearchDisabled": true + }, + "softBouncedCount": { + "type": "int", + "notStorable": true, + "readOnly": true, + "layoutDetailDisabled": true, + "layoutListDisabled": true, + "layoutSearchDisabled": true + }, + "leadCreatedCount": { + "type": "int", + "notStorable": true, + "readOnly": true, + "layoutDetailDisabled": true, + "layoutListDisabled": true, + "layoutSearchDisabled": true + }, + "revenue": { + "type": "currency", + "notStorable": true, + "readOnly": true, + "layoutDetailDisabled": true, + "layoutListDisabled": true, + "layoutSearchDisabled": true } }, "links": { diff --git a/frontend/client/modules/crm/src/views/campaign/record/panels/statistics.js b/frontend/client/modules/crm/src/views/campaign/record/panels/statistics.js index 01629d586c..dab13c449d 100644 --- a/frontend/client/modules/crm/src/views/campaign/record/panels/statistics.js +++ b/frontend/client/modules/crm/src/views/campaign/record/panels/statistics.js @@ -24,17 +24,46 @@ Espo.define('Crm:Views.Campaign.Record.Panels.Statistics', 'Views.Record.Panels. return Dep.extend({ - template: 'crm:campaign.record.panels.statistics', - data: function () { + /*data: function () { return {}; + },*/ + + setupFieldList: function () { + var type = this.model.get('type'); + switch (type) { + case 'Email': + case 'Newsletter': + this.fields = ['sentCount', 'openedCount', 'clickedCount', 'optedOutCount', 'bouncedCount', 'revenue']; + break; + case 'Web': + case 'Television': + case 'Radio': + this.fields = ['leadCreatedCount', 'revenue']; + break; + case 'Mail': + this.fields = ['sentCount', 'leadCreatedCount', 'revenue']; + break; + default: + this.fields = ['leadCreatedCount', 'revenue']; + } }, setup: function () { + this.fields = ['sentCount', 'openedCount', 'clickedCount', 'optedOutCount', 'bouncedCount', 'leadCreatedCount', 'revenue']; Dep.prototype.setup.call(this); + this.setupFieldList(); + + this.listenTo(this.model, 'change:type', function () { + this.setupFieldList(); + if (this.isRendered()) { + this.render(); + } + }, this); } + }); });