Skip to content

EspoCRM – Open Source CRM Application

ref, jsdoc

Yuri Kuznetsov7bc34d3ee732
diff --git a/client/src/views/record/panels-container.js b/client/src/views/record/panels-container.js
index fc4092e510..e24b0ec09c 100644
--- a/client/src/views/record/panels-container.js
+++ b/client/src/views/record/panels-container.js
@@ -610,6 +610,11 @@ class PanelsContainerRecordView extends View {
}
}
+ /**
+ * @param {string} name
+ * @param {string} [softLockedType]
+ * @param [callback] Not to be used.
+ */
showPanel(name, softLockedType, callback) {
if (!this.hasPanel(name)) {
return;
@@ -646,6 +651,12 @@ class PanelsContainerRecordView extends View {
this.processShowPanel(name, callback, wasShown);
}
+ /**
+ * @param {string} name
+ * @param {boolean} [locked=false]
+ * @param {string} [softLockedType]
+ * @param [callback] Not to be used.
+ */
hidePanel(name, locked, softLockedType, callback) {
if (!this.hasPanel(name)) {
return;
diff --git a/client/src/views/user/record/detail-side.js b/client/src/views/user/record/detail-side.js
index 475042c1a6..64d178506c 100644
--- a/client/src/views/user/record/detail-side.js
+++ b/client/src/views/user/record/detail-side.js
@@ -26,55 +26,55 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/user/record/detail-side', ['views/record/detail-side'], function (Dep) {
+import DetailSideRecordView from 'views/record/detail-side';
- return Dep.extend({
+export default class UserDetailSideRecordView extends DetailSideRecordView {
- setupPanels: function () {
- Dep.prototype.setupPanels.call(this);
+ setupPanels() {
+ super.setupPanels();
- if (this.model.isApi() || this.model.isSystem()) {
- this.hidePanel('activities', true);
- this.hidePanel('history', true);
- this.hidePanel('tasks', true);
- this.hidePanel('stream', true);
+ const userModel = /** @type {import('modules/user').default} */this.model;
- return;
- }
+ if (userModel.isApi() || userModel.isSystem()) {
+ this.hidePanel('activities', true);
+ this.hidePanel('history', true);
+ this.hidePanel('tasks', true);
+ this.hidePanel('stream', true);
- const showActivities = this.getAcl().checkPermission('userCalendar', this.model);
+ return;
+ }
- if (
- !showActivities &&
- this.getAcl().getPermissionLevel('userCalendar') === 'team' &&
- !this.model.has('teamsIds')
- ) {
- this.listenToOnce(this.model, 'sync', () => {
- if (!this.getAcl().checkPermission('userCalendar', this.model)) {
- return;
- }
+ const showActivities = this.getAcl().checkPermission('userCalendar', userModel);
- this.onPanelsReady(() => {
- this.showPanel('activities', 'acl');
- this.showPanel('history', 'acl');
+ if (
+ !showActivities &&
+ this.getAcl().getPermissionLevel('userCalendar') === 'team' &&
+ !this.model.has('teamsIds')
+ ) {
+ this.listenToOnce(this.model, 'sync', () => {
+ if (!this.getAcl().checkPermission('userCalendar', userModel)) {
+ return;
+ }
- if (!this.model.isPortal()) {
- this.showPanel('tasks', 'acl');
- }
- });
- });
- }
+ this.onPanelsReady(() => {
+ this.showPanel('activities', 'acl');
+ this.showPanel('history', 'acl');
- if (!showActivities) {
- this.hidePanel('activities', false, 'acl');
- this.hidePanel('history', false, 'acl');
- this.hidePanel('tasks', false, 'acl');
- }
+ if (!userModel.isPortal()) {
+ this.showPanel('tasks', 'acl');
+ }
+ });
+ });
+ }
- if (this.model.isPortal()) {
- this.hidePanel('tasks', true);
- }
- },
+ if (!showActivities) {
+ this.hidePanel('activities', false, 'acl');
+ this.hidePanel('history', false, 'acl');
+ this.hidePanel('tasks', false, 'acl');
+ }
- });
-});
+ if (userModel) {
+ this.hidePanel('tasks', true);
+ }
+ }
+}