# HG changeset patch # User Tom Gottfried # Date 1486141285 -3600 # Node ID d2f06ce4d43a4a62f32111b5f6eba0c9ab152a9c # Parent 7194964183f42aea589f915bbde4c260a2f8355e Use service and widget instead of local store for OrtszuordnungTyp. diff -r 7194964183f4 -r d2f06ce4d43a app.js --- a/app.js Fri Feb 03 17:44:41 2017 +0100 +++ b/app.js Fri Feb 03 18:01:25 2017 +0100 @@ -65,6 +65,7 @@ 'Lada.store.MessungQueries', 'Lada.store.Ktas', 'Lada.store.OrtsZusatz', + 'Lada.store.OrtszuordnungTyp', 'Lada.store.OrtTyp', 'Lada.store.KoordinatenArt', 'Lada.model.MessstelleLabor' @@ -264,6 +265,10 @@ storeId: 'ortszusatz', autoLoad: 'true' }); + Ext.create('Lada.store.OrtszuordnungTyp', { + storeId: 'ortszuordnungtyp', + autoLoad: 'true' + }); Ext.create('Lada.store.OrtTyp', { storeId: 'orttyp', autoLoad: 'true' diff -r 7194964183f4 -r d2f06ce4d43a app/model/OrtszuordnungTyp.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/model/OrtszuordnungTyp.js Fri Feb 03 18:01:25 2017 +0100 @@ -0,0 +1,36 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +/** + * Model for OrtsZusatz Stammdaten. + */ +Ext.define('Lada.model.OrtszuordnungTyp', { + extend: 'Ext.data.Model', + + /** + * Fields are: + * - id: The unique identifier (Primary key). + * - ortstyp: The long description. + */ + fields: [{ + name: 'id' + }, { + name: 'ortstyp' + }], + + idProperty: 'id', + + proxy: { + type: 'rest', + url: 'lada-server/rest/ortszuordnungtyp', + reader: { + type: 'json', + root: 'data' + } + } +}); diff -r 7194964183f4 -r d2f06ce4d43a app/store/OrtszuordnungTyp.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/store/OrtszuordnungTyp.js Fri Feb 03 18:01:25 2017 +0100 @@ -0,0 +1,22 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +/** + * Store for OrtszuordnungTyp + */ +Ext.define('Lada.store.OrtszuordnungTyp', { + extend: 'Ext.data.Store', + model: 'Lada.model.OrtszuordnungTyp', + sorters: [ + { + property: 'id', + direction: 'ASC' + }], + autoLoad: true, + sortOnLoad: true +}); diff -r 7194964183f4 -r d2f06ce4d43a app/view/form/Ortszuordnung.js --- a/app/view/form/Ortszuordnung.js Fri Feb 03 17:44:41 2017 +0100 +++ b/app/view/form/Ortszuordnung.js Fri Feb 03 18:01:25 2017 +0100 @@ -15,6 +15,7 @@ requires: [ 'Lada.view.form.OrtInfo', + 'Lada.view.widget.OrtszuordnungTyp', 'Lada.view.widget.Verwaltungseinheit', 'Lada.view.widget.Staat' ], @@ -99,28 +100,13 @@ name: 'ortszusatztext', fieldLabel: i18n.getMsg('ortszuordnung.form.field.ortszusatztext') }, { - xtype: 'cbox', + xtype: 'ortszuordnungtyp', labelWidth: 125, - maxLength: 1, allowBlank: false, editable: true, name: this.typName, disableKeyFilter: true, fieldLabel: i18n.getMsg('ortszuordnung.form.field.ortszuordnungtyp'), - store: Ext.create('Ext.data.Store', { - fields: ['value', 'label'], - //TODO: Meaning of the letters should be added - data : [ - {'value':'U', 'label':'U'}, - {'value':'E', 'label':'E'}, - {'value':'Z', 'label':'Z'}, - {'value':'A', 'label':'A'} - ] - }), - displayField: 'label', - valueField: 'value', - emptyText: 'Bitte geben Sie einen Ortszuordnungstyp ein', - queryMode: 'local' }, { // this field is hidden because the user doesn't // need to know the internal ortID diff -r 7194964183f4 -r d2f06ce4d43a app/view/widget/OrtszuordnungTyp.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/widget/OrtszuordnungTyp.js Fri Feb 03 18:01:25 2017 +0100 @@ -0,0 +1,38 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +/** + * Combobox for type of Ortszuordnung + */ +Ext.define('Lada.view.widget.OrtszuordnungTyp' ,{ + extend: 'Lada.view.widget.base.ComboBox', + alias: 'widget.ortszuordnungtyp', + store: 'OrtszuordnungTyp', + displayField: 'ortstyp', + valueField: 'id', + editable: this.editable || false, + forceSelection: true, + // Enable filtering of comboboxes + autoSelect: false, + queryMode: 'local', + triggerAction: 'all', + typeAhead: false, + minChars: 0, + + initComponent: function() { + var i18n = Lada.getApplication().bundle; + this.emptyText = i18n.getMsg('emptytext.ortszuordnungtyp'); + + this.store = Ext.data.StoreManager.get('ortszuordnungtyp'); + if (!this.store) { + this.store = Ext.create('Lada.store.OrtszuordnungTyp'); + } + this.store.sort(); + this.callParent(arguments); + } +}); diff -r 7194964183f4 -r d2f06ce4d43a resources/i18n/Lada_de-DE.properties --- a/resources/i18n/Lada_de-DE.properties Fri Feb 03 17:44:41 2017 +0100 +++ b/resources/i18n/Lada_de-DE.properties Fri Feb 03 18:01:25 2017 +0100 @@ -121,6 +121,7 @@ emptytext.koordinatenart:Wählen Sie eine Koordinatenart emptytext.orttyp:Wählen Sie einen Typ emptytext.ortszusatz:Wählen Sie einen Ortszusatz +emptytext.ortszuordnungtyp:Bitte geben Sie einen Ortszuordnungstyp ein ##Fieldsets erwAngaben:Erweiterte Angaben