diff --git a/client/src/views/admin/entity-manager/fields/primary-filters.js b/client/src/views/admin/entity-manager/fields/primary-filters.js
new file mode 100644
index 0000000000..79f904becc
--- /dev/null
+++ b/client/src/views/admin/entity-manager/fields/primary-filters.js
@@ -0,0 +1,80 @@
+/************************************************************************
+ * This file is part of EspoCRM.
+ *
+ * EspoCRM – Open Source CRM application.
+ * Copyright (C) 2014-2024 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
+ * Website: https://www.espocrm.com
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see
.
+ *
+ * The interactive user interfaces in modified source and object code versions
+ * of this program must display Appropriate Legal Notices, as required under
+ * Section 5 of the GNU Affero General Public License version 3.
+ *
+ * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
+ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
+ ************************************************************************/
+
+import ArrayFieldView from 'views/fields/array';
+
+class EntityManagerPrimaryFiltersFieldView extends ArrayFieldView {
+
+ // language=Handlebars
+ detailTemplateContent = `
+ {{#unless isEmpty}}
+
+
+ {{#each dateList}}
+
+ | {{name}} |
+ {{label}} |
+
+ {{/each}}
+
+
+ {{else}}
+ {{#if valueIsSet}}
+
{{translate 'None'}}
+ {{else}}
+
+ {{/if}}
+ {{/unless}}
+ `
+
+ // noinspection JSCheckFunctionSignatures
+ data() {
+ // noinspection JSValidateTypes
+ return {
+ ...super.data(),
+ dateList: this.getValuesItems(),
+ };
+ }
+
+ constructor(options) {
+ super(options);
+
+ this.targetEntityType = options.targetEntityType;
+ }
+
+ getValuesItems() {
+ return (this.model.get(this.name) || []).map(/** string */item => {
+ return {
+ name: item,
+ label: this.translate(item, 'presetFilters', this.targetEntityType),
+ };
+ });
+ }
+}
+
+export default EntityManagerPrimaryFiltersFieldView;
diff --git a/client/src/views/admin/entity-manager/scope.js b/client/src/views/admin/entity-manager/scope.js
index 551c4196c4..a5adfb12d0 100644
--- a/client/src/views/admin/entity-manager/scope.js
+++ b/client/src/views/admin/entity-manager/scope.js
@@ -27,6 +27,9 @@
************************************************************************/
import View from 'view';
+import DetailRecordView from 'views/record/detail';
+import Model from 'model';
+import EntityManagerPrimaryFiltersFieldView from 'views/admin/entity-manager/fields/primary-filters';
class EntityManagerScopeView extends View {
@@ -68,6 +71,84 @@ class EntityManagerScopeView extends View {
this.scope = this.options.scope;
this.setupScopeData();
+
+ this.model = new Model({
+ name: this.scope,
+ type: this.type,
+ label: this.label,
+ primaryFilters: this.getPrimaryFilters(),
+ });
+
+ this.model.setDefs({
+ fields: {
+ name: {
+ type: 'varchar',
+ },
+ type: {
+ type: 'varchar',
+ },
+ label: {
+ type: 'varchar',
+ },
+ primaryFilters: {
+ type: 'array',
+ },
+ }
+ });
+
+ this.recordView = new DetailRecordView({
+ model: this.model,
+ inlineEditDisabled: true,
+ buttonsDisabled: true,
+ readOnly: true,
+ detailLayout: [
+ {
+ tabBreak: true,
+ tabLabel: this.translate('General', 'labels', 'Settings'),
+ rows: [
+ [
+ {
+ name: 'name',
+ labelText: this.translate('name', 'fields', 'EntityManager'),
+ },
+ {
+ name: 'type',
+ labelText: this.translate('type', 'fields', 'EntityManager'),
+ }
+ ],
+ [
+ {
+ name: 'label',
+ labelText: this.translate('label', 'fields', 'EntityManager'),
+ },
+ false
+ ]
+ ]
+ },
+ {
+ tabBreak: true,
+ tabLabel: this.translate('Details'),
+ rows: [
+ [
+ {
+ view: new EntityManagerPrimaryFiltersFieldView({
+ name: 'primaryFilters',
+ labelText: this.translate('primaryFilters', 'fields', 'EntityManager'),
+ targetEntityType: this.scope,
+ }),
+ },
+ false
+ ]
+ ]
+ }
+ ],
+ });
+
+ this.assignView('record', this.recordView, '.record-container');
+
+ if (!this.type) {
+ this.recordView.hideField('type');
+ }
}
setupScopeData() {
@@ -182,6 +263,19 @@ class EntityManagerScopeView extends View {
this.getHelper().broadcastChannel.postMessage('update:metadata');
this.getHelper().broadcastChannel.postMessage('update:settings');
}
+
+ /**
+ * @return {string[]}
+ */
+ getPrimaryFilters() {
+ return this.getMetadata().get(`clientDefs.${this.scope}.filterList`, []).map(item => {
+ if (typeof item === 'object' && item.name) {
+ return item.name;
+ }
+
+ return item.toString();
+ });
+ }
}
export default EntityManagerScopeView;