Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | 62x 62x 74x 74x 74x 1x 1x 683x 683x | 'use strict';
define([
'jquery',
'underscore',
'oro/translator',
'pim/form',
'pim/template/export/common/edit/validation',
'oro/messenger',
'pim/common/property'
], function ($, _, __, BaseForm, template, messenger, propertyAccessor) {
return BaseForm.extend({
template: _.template(template),
errors: [],
/**
* {@inheritdoc}
*/
configure: function () {
this.listenTo(this.getRoot(), 'pim_enrich:form:filter:extension:add', this.addFilterExtension.bind(this));
this.listenTo(this.getRoot(), 'pim_enrich:form:entity:bad_request', this.setValidationErrors.bind(this));
return BaseForm.prototype.configure.apply(this, arguments);
},
setValidationErrors: function (event) {
this.errors = event.response;
this.getRoot().trigger('pim_enrich:form:entity:validation_error', event);
},
/**
* Adds the extension to filters.
* If there is an error for the current filter, we add an element to it.
*
* @param {Object} event
*/
addFilterExtension: function (event) {
var filter = event.filter;
Iif (null !== propertyAccessor
.accessProperty(this.errors, 'configuration.filters.data' + filter.getField())
) {
var content = $(this.template({
errors: propertyAccessor.accessProperty(
this.errors,
'configuration.filters.data' + filter.getField()
)
}));
event.filter.addElement(
'below-input',
'validation',
content
);
}
}
});
});
|