EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Ref
Yurii09e11d333fea
diff --git a/client/res/templates/admin/field-manager/list.tpl b/client/res/templates/admin/field-manager/list.tplindex de9c54aab9..e233852534 100644--- a/client/res/templates/admin/field-manager/list.tpl+++ b/client/res/templates/admin/field-manager/list.tpl@@ -30,7 +30,7 @@</thead><tbody>{{#each fieldDefsArray}}- <tr data-name="{{name}}" class="field-row">+ <tr data-name="{{name}}" class="field-row {{#if accented}} accented {{/if}} "><td>{{#if isEditable}}<adiff --git a/client/src/views/admin/field-manager/list.js b/client/src/views/admin/field-manager/list.jsindex 1be753f0f8..f1ee7c144d 100644--- a/client/src/views/admin/field-manager/list.js+++ b/client/src/views/admin/field-manager/list.js@@ -28,11 +28,21 @@import View from 'view';import ViewDetailsModalView from 'views/admin/field-manager/modals/view-details';+import Ajax from 'ajax';+import Ui from 'ui';class FieldManagerListView extends View {template = 'admin/field-manager/list'+ /**+ * @todo Implement. Set after a new field is created..+ *+ * @private+ * @type {Record<string, true>}+ */+ accentedFieldMap+data() {return {scope: this.scope,@@ -58,6 +68,8 @@ class FieldManagerListView extends View {setup() {this.addActionHandler('viewDetails', (e, target) => this.viewDetails(target.dataset.name));+ this.accentedFieldMap = {};+this.scope = this.options.scope;this.isCustomizable =@@ -83,38 +95,38 @@ class FieldManagerListView extends View {this.$el.find('input[data-name="quick-search"]').focus();}- buildFieldDefs() {- return this.getModelFactory().create(this.scope).then(model => {- this.fields = model.defs.fields;-- this.fieldList = Object.keys(this.fields).sort();- this.fieldDefsArray = [];-- this.fieldList.forEach(field => {- const defs = /** @type {Record} */this.fields[field];-- this.fieldDefsArray.push({- name: field,- isCustom: defs.isCustom || false,- type: defs.type,- label: this.translate(field, 'fields', this.scope),- isEditable: !defs.customizationDisabled &&- !defs.utility &&- this.isCustomizable,- });+ async buildFieldDefs() {+ const model = await this.getModelFactory().create(this.scope);++ this.fields = model.defs.fields;+ this.fieldList = Object.keys(this.fields).sort();+ this.fieldDefsArray = [];++ this.fieldList.forEach(field => {+ const defs = /** @type {Record} */ this.fields[field];++ this.fieldDefsArray.push({+ name: field,+ isCustom: defs.isCustom || false,+ type: defs.type,+ label: this.translate(field, 'fields', this.scope),+ isEditable: !defs.customizationDisabled &&+ !defs.utility &&+ this.isCustomizable,+ accented: this.accentedFieldMap[field] ?? false,});+ });- this.fieldDefsArray = this.fieldDefsArray.sort((a, b) => {- if (a.isEditable && !b.isEditable) {- return -1;- }+ this.fieldDefsArray = this.fieldDefsArray.sort((a, b) => {+ if (a.isEditable && !b.isEditable) {+ return -1;+ }- if (!a.isEditable && b.isEditable) {- return 1;- }+ if (!a.isEditable && b.isEditable) {+ return 1;+ }- return 0;- })+ return 0;});}@@ -123,10 +135,10 @@ class FieldManagerListView extends View {.replace('{field}', field);this.confirm(msg, () => {- Espo.Ui.notifyWait();+ Ui.notifyWait();- Espo.Ajax.deleteRequest('Admin/fieldManager/' + this.scope + '/' + field).then(() => {- Espo.Ui.success(this.translate('Removed'));+ Ajax.deleteRequest('Admin/fieldManager/' + this.scope + '/' + field).then(() => {+ Ui.success(this.translate('Removed'));this.$el.find(`tr[data-name="${field}"]`).remove();@@ -139,7 +151,7 @@ class FieldManagerListView extends View {return this.reRender();})- .then(() => Espo.Ui.success(this.translate('Removed')))+ .then(() => Ui.success(this.translate('Removed')))});});});