diff --git a/client/src/views/admin/dynamic-logic/conditions-string/group-base.js b/client/src/views/admin/dynamic-logic/conditions-string/group-base.js index d86e0a53a4..3ba7420f38 100644 --- a/client/src/views/admin/dynamic-logic/conditions-string/group-base.js +++ b/client/src/views/admin/dynamic-logic/conditions-string/group-base.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/admin/dynamic-logic/conditions-string/group-base', 'view', function (Dep) { +define('views/admin/dynamic-logic/conditions-string/group-base', ['view'], function (Dep) { return Dep.extend({ @@ -38,6 +38,7 @@ define('views/admin/dynamic-logic/conditions-string/group-base', 'view', functio isEmpty: true }; } + return { viewDataList: this.viewDataList, operator: this.operator, diff --git a/client/src/views/admin/dynamic-logic/conditions-string/group-not.js b/client/src/views/admin/dynamic-logic/conditions-string/group-not.js index dd60bd97ab..a8dab8725d 100644 --- a/client/src/views/admin/dynamic-logic/conditions-string/group-not.js +++ b/client/src/views/admin/dynamic-logic/conditions-string/group-not.js @@ -26,7 +26,8 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/admin/dynamic-logic/conditions-string/group-not', 'views/admin/dynamic-logic/conditions-string/group-base', function (Dep) { +define('views/admin/dynamic-logic/conditions-string/group-not', +['views/admin/dynamic-logic/conditions-string/group-base'], function (Dep) { return Dep.extend({ @@ -49,15 +50,12 @@ Espo.define('views/admin/dynamic-logic/conditions-string/group-not', 'views/admi this.itemData = this.options.itemData || {}; this.viewList = []; - var i = 0; var key = 'view-' + this.level.toString() + '-' + this.number.toString() + '-' + i.toString(); this.createItemView(i, key, this.itemData.value); this.viewKey = key; - } - + }, }); - }); diff --git a/client/src/views/admin/dynamic-logic/conditions-string/item-base.js b/client/src/views/admin/dynamic-logic/conditions-string/item-base.js index 42b860bbde..d7d05f22d2 100644 --- a/client/src/views/admin/dynamic-logic/conditions-string/item-base.js +++ b/client/src/views/admin/dynamic-logic/conditions-string/item-base.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/admin/dynamic-logic/conditions-string/item-base', 'view', function (Dep) { +define('views/admin/dynamic-logic/conditions-string/item-base', ['view'], function (Dep) { return Dep.extend({ @@ -84,7 +84,8 @@ Espo.define('views/admin/dynamic-logic/conditions-string/item-base', 'view', fun var key = this.getValueViewKey(); var fieldType = this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'type']) || 'base'; - var viewName = this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'view']) || this.getFieldManager().getViewName(fieldType); + var viewName = this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'view']) || + this.getFieldManager().getViewName(fieldType); this.createView('value', viewName, { model: this.model, @@ -92,8 +93,6 @@ Espo.define('views/admin/dynamic-logic/conditions-string/item-base', 'view', fun el: this.getSelector() + ' [data-view-key="'+key+'"]' }); }, - }); - }); diff --git a/client/src/views/admin/dynamic-logic/conditions-string/item-in-future.js b/client/src/views/admin/dynamic-logic/conditions-string/item-in-future.js index c07a230a6f..ff69b937a3 100644 --- a/client/src/views/admin/dynamic-logic/conditions-string/item-in-future.js +++ b/client/src/views/admin/dynamic-logic/conditions-string/item-in-future.js @@ -26,13 +26,12 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/admin/dynamic-logic/conditions-string/item-in-future', 'views/admin/dynamic-logic/conditions-string/item-operator-only-date', function (Dep) { +define('views/admin/dynamic-logic/conditions-string/item-in-future', +['views/admin/dynamic-logic/conditions-string/item-operator-only-date'], function (Dep) { return Dep.extend({ - dateValue: 'future' - + dateValue: 'future', }); - }); diff --git a/client/src/views/admin/dynamic-logic/conditions-string/item-in-past.js b/client/src/views/admin/dynamic-logic/conditions-string/item-in-past.js index 39ae2b4bcb..d3a519dd10 100644 --- a/client/src/views/admin/dynamic-logic/conditions-string/item-in-past.js +++ b/client/src/views/admin/dynamic-logic/conditions-string/item-in-past.js @@ -26,13 +26,11 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/admin/dynamic-logic/conditions-string/item-in-past', 'views/admin/dynamic-logic/conditions-string/item-operator-only-date', function (Dep) { +define('views/admin/dynamic-logic/conditions-string/item-in-past', +['views/admin/dynamic-logic/conditions-string/item-operator-only-date'], function (Dep) { return Dep.extend({ - dateValue: 'past' - + dateValue: 'past', }); - }); - diff --git a/client/src/views/admin/dynamic-logic/conditions-string/item-is-today.js b/client/src/views/admin/dynamic-logic/conditions-string/item-is-today.js index 2de2bd7a1d..a52370ea54 100644 --- a/client/src/views/admin/dynamic-logic/conditions-string/item-is-today.js +++ b/client/src/views/admin/dynamic-logic/conditions-string/item-is-today.js @@ -26,13 +26,12 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/admin/dynamic-logic/conditions-string/item-is-today', 'views/admin/dynamic-logic/conditions-string/item-operator-only-date', function (Dep) { +define('views/admin/dynamic-logic/conditions-string/item-is-today', +['views/admin/dynamic-logic/conditions-string/item-operator-only-date'], function (Dep) { return Dep.extend({ - dateValue: 'today' + dateValue: 'today', }); - }); - diff --git a/client/src/views/admin/dynamic-logic/conditions-string/item-multiple-values-base.js b/client/src/views/admin/dynamic-logic/conditions-string/item-multiple-values-base.js index edb35a84b9..e32ec571ab 100644 --- a/client/src/views/admin/dynamic-logic/conditions-string/item-multiple-values-base.js +++ b/client/src/views/admin/dynamic-logic/conditions-string/item-multiple-values-base.js @@ -26,7 +26,8 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/admin/dynamic-logic/conditions-string/item-multiple-values-base', 'views/admin/dynamic-logic/conditions-string/item-base', function (Dep) { +define('views/admin/dynamic-logic/conditions-string/item-multiple-values-base', +['views/admin/dynamic-logic/conditions-string/item-base'], function (Dep) { return Dep.extend({ @@ -38,14 +39,13 @@ Espo.define('views/admin/dynamic-logic/conditions-string/item-multiple-values-ba scope: this.scope, operator: this.operator, operatorString: this.operatorString, - field: this.field + field: this.field, }; }, populateValues: function () { }, - getValueViewKey: function (i) { return 'view-' + this.level.toString() + '-' + this.number.toString() + '-' + i.toString(); }, @@ -54,14 +54,17 @@ Espo.define('views/admin/dynamic-logic/conditions-string/item-multiple-values-ba var valueList = this.itemData.value || []; var fieldType = this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'type']) || 'base'; - var viewName = this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'view']) || this.getFieldManager().getViewName(fieldType); + var viewName = this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'view']) || + this.getFieldManager().getViewName(fieldType); this.valueViewDataList = []; + valueList.forEach(function (value, i) { var model = this.model.clone(); model.set(this.itemData.attribute, value); var key = this.getValueViewKey(i); + this.valueViewDataList.push({ key: key, isEnd: i === valueList.length - 1 @@ -74,8 +77,5 @@ Espo.define('views/admin/dynamic-logic/conditions-string/item-multiple-values-ba }); }, this); }, - }); - }); - diff --git a/client/src/views/admin/dynamic-logic/conditions-string/item-operator-only-base.js b/client/src/views/admin/dynamic-logic/conditions-string/item-operator-only-base.js index 4dba0a1569..b1cdc44443 100644 --- a/client/src/views/admin/dynamic-logic/conditions-string/item-operator-only-base.js +++ b/client/src/views/admin/dynamic-logic/conditions-string/item-operator-only-base.js @@ -26,16 +26,14 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/admin/dynamic-logic/conditions-string/item-operator-only-base', 'views/admin/dynamic-logic/conditions-string/item-base', function (Dep) { +define('views/admin/dynamic-logic/conditions-string/item-operator-only-base', +['views/admin/dynamic-logic/conditions-string/item-base'], function (Dep) { return Dep.extend({ template: 'admin/dynamic-logic/conditions-string/item-operator-only-base', - createValueFieldView: function () { - }, + createValueFieldView: function () {}, }); - }); - diff --git a/client/src/views/admin/dynamic-logic/conditions-string/item-operator-only-date.js b/client/src/views/admin/dynamic-logic/conditions-string/item-operator-only-date.js index 4a75b21b2f..3c48fa0153 100644 --- a/client/src/views/admin/dynamic-logic/conditions-string/item-operator-only-date.js +++ b/client/src/views/admin/dynamic-logic/conditions-string/item-operator-only-date.js @@ -26,7 +26,8 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/admin/dynamic-logic/conditions-string/item-operator-only-date', 'views/admin/dynamic-logic/conditions-string/item-operator-only-base', function (Dep) { +define('views/admin/dynamic-logic/conditions-string/item-operator-only-date', +['views/admin/dynamic-logic/conditions-string/item-operator-only-base'], function (Dep) { return Dep.extend({ @@ -37,8 +38,5 @@ Espo.define('views/admin/dynamic-logic/conditions-string/item-operator-only-date data.dateValue = this.dateValue; return data; }, - }); - }); - diff --git a/client/src/views/admin/dynamic-logic/conditions-string/item-value-enum.js b/client/src/views/admin/dynamic-logic/conditions-string/item-value-enum.js index 3821da5806..7d4a1d4ffa 100644 --- a/client/src/views/admin/dynamic-logic/conditions-string/item-value-enum.js +++ b/client/src/views/admin/dynamic-logic/conditions-string/item-value-enum.js @@ -26,10 +26,8 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define( - 'views/admin/dynamic-logic/conditions-string/item-value-enum', - 'views/admin/dynamic-logic/conditions-string/item-base', - function (Dep) { +define('views/admin/dynamic-logic/conditions-string/item-value-enum', +['views/admin/dynamic-logic/conditions-string/item-base'], function (Dep) { return Dep.extend({ @@ -50,7 +48,5 @@ define( } }); }, - }); }); - diff --git a/client/src/views/admin/dynamic-logic/conditions-string/item-value-link.js b/client/src/views/admin/dynamic-logic/conditions-string/item-value-link.js index 30981d7977..38f790a3a8 100644 --- a/client/src/views/admin/dynamic-logic/conditions-string/item-value-link.js +++ b/client/src/views/admin/dynamic-logic/conditions-string/item-value-link.js @@ -26,26 +26,25 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/admin/dynamic-logic/conditions-string/item-value-link', 'views/admin/dynamic-logic/conditions-string/item-base', function (Dep) { +define('views/admin/dynamic-logic/conditions-string/item-value-link', +['views/admin/dynamic-logic/conditions-string/item-base'], function (Dep) { return Dep.extend({ template: 'admin/dynamic-logic/conditions-string/item-base', - createValueFieldView: function () { var key = this.getValueViewKey(); var viewName = 'views/fields/link'; + this.createView('value', viewName, { model: this.model, name: 'link', el: '[data-view-key="'+key+'"]', - foreignScope: this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'entity']) || this.getMetadata().get(['entityDefs', this.scope, 'links', this.field, 'entity']) + foreignScope: this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'entity']) || + this.getMetadata().get(['entityDefs', this.scope, 'links', this.field, 'entity']) }); }, - }); - }); - diff --git a/client/src/views/admin/dynamic-logic/conditions-string/item-value-varchar.js b/client/src/views/admin/dynamic-logic/conditions-string/item-value-varchar.js index fcba5e40fb..1685cd2385 100644 --- a/client/src/views/admin/dynamic-logic/conditions-string/item-value-varchar.js +++ b/client/src/views/admin/dynamic-logic/conditions-string/item-value-varchar.js @@ -26,10 +26,8 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define( - 'views/admin/dynamic-logic/conditions-string/item-value-varchar', - 'views/admin/dynamic-logic/conditions-string/item-base', - function (Dep) { +define('views/admin/dynamic-logic/conditions-string/item-value-varchar', +['views/admin/dynamic-logic/conditions-string/item-base'], function (Dep) { return Dep.extend({ @@ -46,7 +44,5 @@ define( el: this.getSelector() + '[data-view-key="'+key+'"]', }); }, - }); }); - diff --git a/client/src/views/admin/dynamic-logic/fields/field.js b/client/src/views/admin/dynamic-logic/fields/field.js index d28666ea68..5106949793 100644 --- a/client/src/views/admin/dynamic-logic/fields/field.js +++ b/client/src/views/admin/dynamic-logic/fields/field.js @@ -26,38 +26,38 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/admin/dynamic-logic/fields/field', 'views/fields/multi-enum', function (Dep) { +define('views/admin/dynamic-logic/fields/field', ['views/fields/multi-enum'], function (Dep) { return Dep.extend({ getFieldList: function () { var fields = this.getMetadata().get('entityDefs.' + this.options.scope + '.fields'); - var filterList = Object.keys(fields).filter(function (field) { + var filterList = Object.keys(fields).filter(field => { var fieldType = fields[field].type || null; if (fields[field].disabled) return; if (!fieldType) return; - if (!this.getMetadata().get(['clientDefs', 'DynamicLogic', 'fieldTypes', fieldType])) return; return true; - }, this); + }); filterList.push('id'); - filterList.sort(function (v1, v2) { - return this.translate(v1, 'fields', this.options.scope).localeCompare(this.translate(v2, 'fields', this.options.scope)); - }.bind(this)); + filterList.sort((v1, v2) => { + return this.translate(v1, 'fields', this.options.scope) + .localeCompare(this.translate(v2, 'fields', this.options.scope)); + }); return filterList; }, setupTranslatedOptions: function () { this.translatedOptions = {}; - this.params.options.forEach(function (item) { - var field = item; - this.translatedOptions[item] = this.translate(field, 'fields', this.options.scope); - }, this); + + this.params.options.forEach(item => { + this.translatedOptions[item] = this.translate(item, 'fields', this.options.scope); + }); }, setupOptions: function () { @@ -69,12 +69,11 @@ Espo.define('views/admin/dynamic-logic/fields/field', 'views/fields/multi-enum', afterRender: function () { Dep.prototype.afterRender.call(this); + if (this.$element && this.$element[0] && this.$element[0].selectize) { this.$element[0].selectize.focus(); } - } - + }, }); - }); diff --git a/client/src/views/admin/dynamic-logic/modals/add-field.js b/client/src/views/admin/dynamic-logic/modals/add-field.js index 4073b4c0da..2a38b0ee16 100644 --- a/client/src/views/admin/dynamic-logic/modals/add-field.js +++ b/client/src/views/admin/dynamic-logic/modals/add-field.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/admin/dynamic-logic/modals/add-field', ['views/modal', 'model'], function (Dep, Model) { +define('views/admin/dynamic-logic/modals/add-field', ['views/modal', 'model'], function (Dep, Model) { return Dep.extend({ @@ -60,8 +60,6 @@ Espo.define('views/admin/dynamic-logic/modals/add-field', ['views/modal', 'model this.trigger('add-field', list[0]); }, this); }); - } - + }, }); }); - diff --git a/client/src/views/admin/dynamic-logic/modals/edit.js b/client/src/views/admin/dynamic-logic/modals/edit.js index 38adbdd3fc..2d75998e48 100644 --- a/client/src/views/admin/dynamic-logic/modals/edit.js +++ b/client/src/views/admin/dynamic-logic/modals/edit.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/admin/dynamic-logic/modals/edit', 'views/modal', function (Dep) { +define('views/admin/dynamic-logic/modals/edit', ['views/modal'], function (Dep) { return Dep.extend({ diff --git a/client/src/views/admin/entity-manager/record/edit-formula.js b/client/src/views/admin/entity-manager/record/edit-formula.js index f20bd3930b..a2498caf3c 100644 --- a/client/src/views/admin/entity-manager/record/edit-formula.js +++ b/client/src/views/admin/entity-manager/record/edit-formula.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/admin/entity-manager/record/edit-formula', 'views/record/base', function (Dep) { +define('views/admin/entity-manager/record/edit-formula', ['views/record/base'], function (Dep) { return Dep.extend({ @@ -34,12 +34,11 @@ Espo.define('views/admin/entity-manager/record/edit-formula', 'views/record/base setup: function () { Dep.prototype.setup.call(this); + this.createField('beforeSaveCustomScript', 'views/fields/formula', { targetEntityType: this.options.targetEntityType, height: 500 }, 'edit'); - } - + }, }); }); -