Hedera.Shelves = new Class({ Extends: Hedera.Form ,activate: function() { this.$.date.value = new Date(); this.$.useIds.value = false; } ,onConfigChange: function() { const fields = [ 'realm' ,'family' ,'warehouse' ,'shelf' ,'namePrefix' ,'maxAmount' ,'reportTitle' ,'showPacking' ,'stack' ]; const config = this.$.config.$; if (config) for (const field of fields) this.$[field].value = config[field]; } ,onPreviewClick: function() { var fields = [ 'family' ,'warehouse' ,'shelf' ,'namePrefix' ,'maxAmount' ,'reportTitle' ,'showPacking' ,'stack' ,'useIds' ,'date' ]; var batch = new Sql.Batch(); for (const field of fields) batch.addValue(field, this.$[field].value); this.gui.openReport('shelves-report', batch); } });