Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/yandex.market/install/js/field/skufield/ |
Upload File : |
(function(BX) { const Reference = BX.namespace('YandexMarket.Field.Reference'); const SkuField = BX.namespace('YandexMarket.Field.SkuField'); const constructor = SkuField.Table = Reference.Collection.extend({ defaults: { itemElement: '.js-sku-field-row', addElement: '.js-sku-field__add', persistent: true, }, initialize: function() { this.callParent('initialize', constructor); this.bind(); }, destroy: function() { this.unbind(); this.callParent('destroy', constructor); }, bind: function() { this.handleAddClick(true); }, unbind: function() { this.handleAddClick(false); }, handleAddClick: function(dir) { this.getElement('add')[dir ? 'on' : 'off']('click', $.proxy(this.onAddClick, this)); }, onAddClick: function(evt) { this.addItem(); evt.preventDefault(); }, addItem: function(source, context, method, isCopy) { const item = this.callParent('addItem', [source, context, method, isCopy], constructor); item && item.preselect(); return item; }, deleteItem: function(item, silent) { this.callParent('deleteItem', [item, silent], constructor); !silent && this.$el.trigger('change'); }, getValue: function() { const value = this.callParent('getValue', constructor); if (!Array.isArray(value)) { return []; } const filtered = []; for (const row of value) { if ( row['IBLOCK'] > 0 && (row['FIELD'] !== '' && row['FIELD'] != null) ) { filtered.push(row); } } return filtered; }, getItemPlugin: function() { return SkuField.Row; } }, { dataName: 'FieldSkuFieldTable', pluginName: 'YandexMarket.Field.SkuField.Table' }); })(BX);