define('custom:views/fields/postalCode', 'views/fields/varchar', function (Dep) { return Dep.extend({ type: 'postalCode', data: function () { debugger; var data = Dep.prototype.data.call(this); data.addressPostalCode4Value = this.model.get(this.addressPostalCode4Field); data.addressPostalCodeValue = this.model.get(this.addressPostalCodeField); if (this.mode === 'detail') { data.isNotEmpty = !!data.addressPostalCode4Value || !!data.addressPostalCodeValue; } else if (this.mode === 'list' || this.mode === 'listLink') { data.isNotEmpty = !!data.addressPostalCode4Value || !!data.addressPostalCodeValue; } if (data.isNotEmpty && this.mode == 'detail' || this.mode == 'list' || this.mode === 'listLink') { data.formattedValue = this.getFormattedValue(); data.value = data.formattedValue; } data.valueIsSet = this.model.has(this.addressPostalCode4Field) || this.model.has(this.addressPostalCodeField); return data; }, setup: function () { debugger; Dep.prototype.setup.call(this); this.addressPostalCode4Field = 'addressPostalCode4'; this.addressPostalCodeField = 'addressPostalCode'; }, getFormattedValue: function () { debugger; var code4 = this.model.get(this.addressPostalCode4Field); var code = this.model.get(this.addressPostalCodeField); var value = ''; value += ' ' + code; value += '-' + code4; value = value.trim(); return value; }, _getTemplateName: function () { debugger; return Dep.prototype._getTemplateName.call(this); } }); });