diff --git a/application/Espo/Modules/Crm/Resources/layouts/Account/sidePanelsDetailSmall.json b/application/Espo/Modules/Crm/Resources/layouts/Account/sidePanelsDetailSmall.json new file mode 100644 index 0000000000..e7dd9eeeec --- /dev/null +++ b/application/Espo/Modules/Crm/Resources/layouts/Account/sidePanelsDetailSmall.json @@ -0,0 +1,11 @@ +{ + "activities": { + "disabled": true + }, + "history": { + "disabled": true + }, + "tasks": { + "disabled": true + } +} \ No newline at end of file diff --git a/application/Espo/Modules/Crm/Resources/layouts/Case/sidePanelsDetailSmall.json b/application/Espo/Modules/Crm/Resources/layouts/Case/sidePanelsDetailSmall.json new file mode 100644 index 0000000000..e7dd9eeeec --- /dev/null +++ b/application/Espo/Modules/Crm/Resources/layouts/Case/sidePanelsDetailSmall.json @@ -0,0 +1,11 @@ +{ + "activities": { + "disabled": true + }, + "history": { + "disabled": true + }, + "tasks": { + "disabled": true + } +} \ No newline at end of file diff --git a/application/Espo/Modules/Crm/Resources/layouts/Contact/sidePanelsDetailSmall.json b/application/Espo/Modules/Crm/Resources/layouts/Contact/sidePanelsDetailSmall.json new file mode 100644 index 0000000000..e7dd9eeeec --- /dev/null +++ b/application/Espo/Modules/Crm/Resources/layouts/Contact/sidePanelsDetailSmall.json @@ -0,0 +1,11 @@ +{ + "activities": { + "disabled": true + }, + "history": { + "disabled": true + }, + "tasks": { + "disabled": true + } +} \ No newline at end of file diff --git a/application/Espo/Modules/Crm/Resources/layouts/Lead/detail.json b/application/Espo/Modules/Crm/Resources/layouts/Lead/detail.json index 51a6c3a786..103b710f22 100644 --- a/application/Espo/Modules/Crm/Resources/layouts/Lead/detail.json +++ b/application/Espo/Modules/Crm/Resources/layouts/Lead/detail.json @@ -13,7 +13,7 @@ "rows": [ [{"name":"status"},{"name":"source"}], [{"name":"opportunityAmount"},{"name":"campaign"}], - [false, {"name":"industry"}], + [{"name":"industry"}, false], [{"name":"description", "fullWidth": true}] ] } diff --git a/application/Espo/Modules/Crm/Resources/layouts/Lead/sidePanelsDetailSmall.json b/application/Espo/Modules/Crm/Resources/layouts/Lead/sidePanelsDetailSmall.json new file mode 100644 index 0000000000..e7dd9eeeec --- /dev/null +++ b/application/Espo/Modules/Crm/Resources/layouts/Lead/sidePanelsDetailSmall.json @@ -0,0 +1,11 @@ +{ + "activities": { + "disabled": true + }, + "history": { + "disabled": true + }, + "tasks": { + "disabled": true + } +} \ No newline at end of file diff --git a/application/Espo/Modules/Crm/Resources/layouts/Opportunity/sidePanelsDetailSmall.json b/application/Espo/Modules/Crm/Resources/layouts/Opportunity/sidePanelsDetailSmall.json new file mode 100644 index 0000000000..e7dd9eeeec --- /dev/null +++ b/application/Espo/Modules/Crm/Resources/layouts/Opportunity/sidePanelsDetailSmall.json @@ -0,0 +1,11 @@ +{ + "activities": { + "disabled": true + }, + "history": { + "disabled": true + }, + "tasks": { + "disabled": true + } +} \ No newline at end of file diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Account.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Account.json index ae34302d84..b8913e0f47 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Account.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Account.json @@ -24,6 +24,26 @@ "view":"crm:views/record/panels/tasks", "aclScope": "Task" } + ], + "detailSmall": [ + { + "name":"activities", + "label":"Activities", + "view":"crm:views/record/panels/activities", + "aclScope": "Activities" + }, + { + "name":"history", + "label":"History", + "view":"crm:views/record/panels/history", + "aclScope": "Activities" + }, + { + "name":"tasks", + "label":"Tasks", + "view":"crm:views/record/panels/tasks", + "aclScope": "Task" + } ] }, "relationshipPanels": { diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Case.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Case.json index 9abaae85f4..13c1b77504 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Case.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Case.json @@ -3,10 +3,6 @@ "recordViews": { "detail": "crm:views/case/record/detail" }, - "bottomPanels":{ - "detail":[ - ] - }, "sidePanels":{ "detail":[ { @@ -27,6 +23,26 @@ "view":"crm:views/record/panels/tasks", "aclScope": "Task" } + ], + "detailSmall":[ + { + "name":"activities", + "label":"Activities", + "view":"crm:views/case/record/panels/activities", + "aclScope": "Activities" + }, + { + "name":"history", + "label":"History", + "view":"crm:views/record/panels/history", + "aclScope": "Activities" + }, + { + "name":"tasks", + "label":"Tasks", + "view":"crm:views/record/panels/tasks", + "aclScope": "Task" + } ] }, "filterList": [ diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Contact.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Contact.json index 0b90ff2148..0f5dc73542 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Contact.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Contact.json @@ -52,6 +52,26 @@ "view":"crm:views/record/panels/tasks", "aclScope": "Task" } + ], + "detailSmall":[ + { + "name":"activities", + "label":"Activities", + "view":"crm:views/record/panels/activities", + "aclScope": "Activities" + }, + { + "name":"history", + "label":"History", + "view":"crm:views/record/panels/history", + "aclScope": "Activities" + }, + { + "name":"tasks", + "label":"Tasks", + "view":"crm:views/record/panels/tasks", + "aclScope": "Task" + } ] }, "relationshipPanels": { diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json index 0615025594..7b8614c83a 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json @@ -71,6 +71,24 @@ "notRefreshable": true, "hidden": true, "style": "success" + }, + { + "name":"activities", + "label":"Activities", + "view":"crm:views/record/panels/activities", + "aclScope": "Activities" + }, + { + "name":"history", + "label":"History", + "view":"crm:views/record/panels/history", + "aclScope": "Activities" + }, + { + "name":"tasks", + "label":"Tasks", + "view":"crm:views/record/panels/tasks", + "aclScope": "Task" } ], "editSmall": [ diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Opportunity.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Opportunity.json index e6027250e0..e5cc9b1671 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Opportunity.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Opportunity.json @@ -1,7 +1,7 @@ { "controller": "controllers/record", "views":{ - "detail":"Crm:Opportunity.Detail" + "detail":"crm:views/opportunity/detail" }, "sidePanels":{ "detail":[ @@ -23,6 +23,26 @@ "view":"crm:views/record/panels/tasks", "aclScope": "Task" } + ], + "detailSmall":[ + { + "name":"activities", + "label":"Activities", + "view":"crm:views/record/panels/activities", + "aclScope": "Activities" + }, + { + "name":"history", + "label":"History", + "view":"crm:views/record/panels/history", + "aclScope": "Activities" + }, + { + "name":"tasks", + "label":"Tasks", + "view":"crm:views/record/panels/tasks", + "aclScope": "Task" + } ] }, "filterList": [ diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Task.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Task.json index 24bb6f285c..d32248a9dd 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Task.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Task.json @@ -110,7 +110,8 @@ }, "assignedUser": { "type": "belongsTo", - "entity": "User" + "entity": "User", + "foreign": "tasks" }, "teams": { "type": "hasMany", diff --git a/application/Espo/Resources/i18n/en_US/User.json b/application/Espo/Resources/i18n/en_US/User.json index 17f0941f73..02ec766ea9 100644 --- a/application/Espo/Resources/i18n/en_US/User.json +++ b/application/Espo/Resources/i18n/en_US/User.json @@ -35,7 +35,8 @@ "portalRoles": "Portal Roles", "contact": "Contact", "accounts": "Accounts", - "account": "Account (Primary)" + "account": "Account (Primary)", + "tasks": "Tasks" }, "labels": { "Create User": "Create User", diff --git a/application/Espo/Resources/layouts/User/sidePanelsDetailSmall.json b/application/Espo/Resources/layouts/User/sidePanelsDetailSmall.json new file mode 100644 index 0000000000..e7dd9eeeec --- /dev/null +++ b/application/Espo/Resources/layouts/User/sidePanelsDetailSmall.json @@ -0,0 +1,11 @@ +{ + "activities": { + "disabled": true + }, + "history": { + "disabled": true + }, + "tasks": { + "disabled": true + } +} \ No newline at end of file diff --git a/application/Espo/Resources/metadata/clientDefs/User.json b/application/Espo/Resources/metadata/clientDefs/User.json index a31a042174..228e6b2db1 100644 --- a/application/Espo/Resources/metadata/clientDefs/User.json +++ b/application/Espo/Resources/metadata/clientDefs/User.json @@ -10,6 +10,62 @@ "editQuick":"views/user/record/edit-quick", "list":"views/user/record/list" }, + "defaultSidePanelFieldList": { + "detail": [ + "avatar" + ], + "detailSmall": [ + "avatar" + ], + "edit": [ + "avatar" + ], + "editSmall": [ + "avatar" + ] + }, + "sidePanels": { + "detail": [ + { + "name":"activities", + "label":"Activities", + "view":"crm:views/record/panels/activities", + "aclScope": "Activities" + }, + { + "name":"history", + "label":"History", + "view":"crm:views/record/panels/history", + "aclScope": "Activities" + }, + { + "name":"tasks", + "label":"Tasks", + "view":"crm:views/record/panels/tasks", + "aclScope": "Task" + } + ], + "detailSmall": [ + { + "name":"activities", + "label":"Activities", + "view":"crm:views/record/panels/activities", + "aclScope": "Activities" + }, + { + "name":"history", + "label":"History", + "view":"crm:views/record/panels/history", + "aclScope": "Activities" + }, + { + "name":"tasks", + "label":"Tasks", + "view":"crm:views/record/panels/tasks", + "aclScope": "Task" + } + ] + }, "filterList": [ "active", "activePortal" diff --git a/application/Espo/Resources/metadata/entityDefs/User.json b/application/Espo/Resources/metadata/entityDefs/User.json index d5b9ff7da9..6cc8dde72a 100644 --- a/application/Espo/Resources/metadata/entityDefs/User.json +++ b/application/Espo/Resources/metadata/entityDefs/User.json @@ -253,6 +253,11 @@ "entity": "Account", "foreign": "portalUsers", "relationName": "AccountPortalUser" + }, + "tasks": { + "type": "hasMany", + "entity": "Task", + "foreign": "assignedUser" } }, "collection": { diff --git a/client/res/templates/fields/enum-styled/detail.tpl b/client/res/templates/fields/enum-styled/detail.tpl index 5e9de9aedd..da7f568a95 100644 --- a/client/res/templates/fields/enum-styled/detail.tpl +++ b/client/res/templates/fields/enum-styled/detail.tpl @@ -1 +1,5 @@ -{{translateOption value scope=scope field=name}} \ No newline at end of file +{{#if isNotEmpty}} +{{translateOption value scope=scope field=name}} +{{else}} +{{translate 'None'}} +{{/if}} \ No newline at end of file diff --git a/client/res/templates/fields/enum-styled/list.tpl b/client/res/templates/fields/enum-styled/list.tpl new file mode 100644 index 0000000000..d1d8b64cda --- /dev/null +++ b/client/res/templates/fields/enum-styled/list.tpl @@ -0,0 +1,3 @@ +{{#if isNotEmpty}} +{{translateOption value scope=scope field=name}} +{{/if}} \ No newline at end of file diff --git a/client/res/templates/fields/enum/detail.tpl b/client/res/templates/fields/enum/detail.tpl index 638afb78b2..ebafa042ed 100644 --- a/client/res/templates/fields/enum/detail.tpl +++ b/client/res/templates/fields/enum/detail.tpl @@ -1 +1,5 @@ -{{translateOption value scope=scope field=name translatedOptions=translatedOptions}} \ No newline at end of file +{{#if isNotEmpty}} +{{translateOption value scope=scope field=name translatedOptions=translatedOptions}} +{{else}} +{{translate 'None'}} +{{/if}} \ No newline at end of file diff --git a/client/res/templates/fields/enum/list.tpl b/client/res/templates/fields/enum/list.tpl new file mode 100644 index 0000000000..7c02e32281 --- /dev/null +++ b/client/res/templates/fields/enum/list.tpl @@ -0,0 +1,3 @@ +{{#if isNotEmpty}} +{{translateOption value scope=scope field=name translatedOptions=translatedOptions}} +{{/if}} \ No newline at end of file diff --git a/client/src/views/fields/enum-styled.js b/client/src/views/fields/enum-styled.js index f5025e6a27..2bfe91acc4 100644 --- a/client/src/views/fields/enum-styled.js +++ b/client/src/views/fields/enum-styled.js @@ -26,13 +26,13 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('Views.Fields.EnumStyled', 'Views.Fields.Enum', function (Dep) { +Espo.define('views/fields/enum-styled', 'views/fields/enum', function (Dep) { return Dep.extend({ - listTemplate: 'fields.enum-styled.detail', + listTemplate: 'fields/enum-styled/list', - detailTemplate: 'fields.enum-styled.detail', + detailTemplate: 'fields/enum-styled/detail', data: function () { var value = this.model.get(this.name); @@ -49,7 +49,7 @@ Espo.define('Views.Fields.EnumStyled', 'Views.Fields.Enum', function (Dep) { Dep.prototype.setup.call(this); this.styleHash = this.model.getFieldParam(this.name, 'style') || {}; - }, + } }); }); diff --git a/client/src/views/fields/enum.js b/client/src/views/fields/enum.js index efae3e5667..34cb75bb05 100644 --- a/client/src/views/fields/enum.js +++ b/client/src/views/fields/enum.js @@ -32,7 +32,7 @@ Espo.define('views/fields/enum', ['views/fields/base', 'lib!Selectize'], functio type: 'enum', - listTemplate: 'fields/enum/detail', + listTemplate: 'fields/enum/list', detailTemplate: 'fields/enum/detail', @@ -45,6 +45,16 @@ Espo.define('views/fields/enum', ['views/fields/base', 'lib!Selectize'], functio data: function () { var data = Dep.prototype.data.call(this); data.translatedOptions = this.translatedOptions; + var value = this.model.get(this.name); + if ( + value !== null + && + value !== '' + || + value === '' && (value in (this.translatedOptions || {})) + ) { + data.isNotEmpty = true; + } return data; }, diff --git a/client/src/views/fields/varchar.js b/client/src/views/fields/varchar.js index 82e8efa0fe..f3edfa9f41 100644 --- a/client/src/views/fields/varchar.js +++ b/client/src/views/fields/varchar.js @@ -45,6 +45,18 @@ Espo.define('views/fields/varchar', 'views/fields/base', function (Dep) { }, this.events || {}); }, + data: function () { + var data = Dep.prototype.data.call(this); + if ( + this.model.get(this.name) !== null + && + this.model.get(this.name) !== '' + ) { + data.isNotEmpty = true; + } + return data; + }, + handleSearchType: function (type) { if (~['isEmpty', 'isNotEmpty'].indexOf(type)) { this.$el.find('input.main-element').addClass('hidden'); diff --git a/client/src/views/record/detail-bottom.js b/client/src/views/record/detail-bottom.js index 793037a62b..f4ec2c34fa 100644 --- a/client/src/views/record/detail-bottom.js +++ b/client/src/views/record/detail-bottom.js @@ -67,6 +67,8 @@ Espo.define('views/record/detail-bottom', 'view', function (Dep) { }, showPanel: function (name, callback) { + this.recordHelper.setPanelStateParam(name, 'hidden', false); + var isFound = false; this.panelList.forEach(function (d) { if (d.name == name) { @@ -76,8 +78,6 @@ Espo.define('views/record/detail-bottom', 'view', function (Dep) { }, this); if (!isFound) return; - this.recordHelper.setPanelStateParam(name, 'hidden', false); - if (this.isRendered()) { var view = this.getView(name); if (view) { @@ -97,6 +97,8 @@ Espo.define('views/record/detail-bottom', 'view', function (Dep) { }, hidePanel: function (name, callback) { + this.recordHelper.setPanelStateParam(name, 'hidden', true); + var isFound = false; this.panelList.forEach(function (d) { if (d.name == name) { @@ -106,8 +108,6 @@ Espo.define('views/record/detail-bottom', 'view', function (Dep) { }, this); if (!isFound) return; - this.recordHelper.setPanelStateParam(name, 'hidden', true); - if (this.isRendered()) { var view = this.getView(name); if (view) { @@ -129,7 +129,7 @@ Espo.define('views/record/detail-bottom', 'view', function (Dep) { setupPanels: function () { var scope = this.scope; - this.panelList = Espo.Utils.clone(this.getMetadata().get('clientDefs.' + scope + '.bottomPanels.' + this.mode) || this.panelList || []); + this.panelList = Espo.Utils.clone(this.getMetadata().get('clientDefs.' + scope + '.bottomPanels.' + this.type) || this.panelList || []); if (this.streamPanel && this.getMetadata().get('scopes.' + scope + '.stream')) { this.setupStreamPanel(); diff --git a/client/src/views/record/detail-side.js b/client/src/views/record/detail-side.js index 2076b112eb..662090184f 100644 --- a/client/src/views/record/detail-side.js +++ b/client/src/views/record/detail-side.js @@ -140,9 +140,8 @@ Espo.define('views/record/detail-side', 'view', function (Dep) { return item; }, this); - this.wait(true); - this.getHelper().layoutManager.get(this.scope, 'sidePanels' + Espo.Utils.upperCaseFirst(this.mode), function (layoutData) { + this.getHelper().layoutManager.get(this.scope, 'sidePanels' + Espo.Utils.upperCaseFirst(this.type), function (layoutData) { if (layoutData) { this.alterPanels(layoutData); } @@ -267,6 +266,8 @@ Espo.define('views/record/detail-side', 'view', function (Dep) { }, showPanel: function (name, callback) { + this.recordHelper.setPanelStateParam(name, 'hidden', false); + var isFound = false; this.panelList.forEach(function (d) { if (d.name == name) { @@ -276,8 +277,6 @@ Espo.define('views/record/detail-side', 'view', function (Dep) { }, this); if (!isFound) return; - this.recordHelper.setPanelStateParam(name, 'hidden', false); - if (this.isRendered()) { var view = this.getView(name); if (view) { @@ -297,6 +296,8 @@ Espo.define('views/record/detail-side', 'view', function (Dep) { }, hidePanel: function (name, callback) { + this.recordHelper.setPanelStateParam(name, 'hidden', true); + var isFound = false; this.panelList.forEach(function (d) { if (d.name == name) { @@ -306,8 +307,6 @@ Espo.define('views/record/detail-side', 'view', function (Dep) { }, this); if (!isFound) return; - this.recordHelper.setPanelStateParam(name, 'hidden', true); - if (this.isRendered()) { var view = this.getView(name); if (view) { diff --git a/client/src/views/user/record/detail-quick-side.js b/client/src/views/user/record/detail-quick-side.js index 7bbb778211..d3dd7a52bf 100644 --- a/client/src/views/user/record/detail-quick-side.js +++ b/client/src/views/user/record/detail-quick-side.js @@ -26,21 +26,13 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/user/record/detail-quick-side', 'views/record/detail-side', function (Dep) { +Espo.define('views/user/record/detail-quick-side', ['views/record/detail-side', 'views/user/record/detail-side'], function (Dep, UserDetailSide) { return Dep.extend({ - panelList: [ - { - name: 'default', - label: false, - view: 'views/record/panels/side', - options: { - fieldList: ['avatar'], - mode: 'detail', - } - } - ] + setupPanels: function () { + UserDetailSide.prototype.setupPanels.call(this); + } }); diff --git a/client/src/views/user/record/detail-side.js b/client/src/views/user/record/detail-side.js index f941ceb838..f109f62f4a 100644 --- a/client/src/views/user/record/detail-side.js +++ b/client/src/views/user/record/detail-side.js @@ -30,16 +30,6 @@ Espo.define('views/user/record/detail-side', 'views/record/detail-side', functio return Dep.extend({ - defaultPanelDefs: { - name: 'default', - label: false, - view: 'views/record/panels/side', - options: { - fieldList: ['avatar'], - mode: 'detail', - } - }, - setupPanels: function () { Dep.prototype.setupPanels.call(this); @@ -55,26 +45,20 @@ Espo.define('views/user/record/detail-side', 'views/record/detail-side', functio this.showPanel('history', function () { this.getView('history').actionRefresh(); }); + this.showPanel('tasks', function () { + this.getView('tasks').actionRefresh(); + }); } }, this); } } } - this.panelList.push({ - "name":"activities", - "label":"Activities", - "view":"crm:views/record/panels/activities", - "hidden": !showActivities, - "aclScope": "Activities" - }); - this.panelList.push({ - "name":"history", - "label":"History", - "view":"crm:views/record/panels/history", - "hidden": !showActivities, - "aclScope": "Activities" - }); + if (!showActivities) { + this.hidePanel('activities'); + this.hidePanel('history'); + this.hidePanel('tasks'); + } } }); diff --git a/client/src/views/user/record/edit-side.js b/client/src/views/user/record/edit-side.js index 689d4e2ddc..30e280cb25 100644 --- a/client/src/views/user/record/edit-side.js +++ b/client/src/views/user/record/edit-side.js @@ -30,16 +30,6 @@ Espo.define('views/user/record/edit-side', 'views/record/edit-side', function (D return Dep.extend({ - defaultPanelDefs: { - name: 'default', - label: false, - view: 'views/record/panels/side', - options: { - fieldList: ['avatar'], - mode: 'edit', - } - } - }); });