changeset 1108:7baaf2cd3f57

Redesign in Messgrogrammform
author Evi Huber <ehuber@bfs.de>
date Fri, 13 May 2016 14:24:07 +0200
parents 9bcd17f7a0ae
children 566976d72ce5
files app.js app/controller/form/Messprogramm.js app/view/form/Messprogramm.js app/view/widget/base/ComboBox.js
diffstat 4 files changed, 77 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/app.js	Thu May 12 16:03:04 2016 +0200
+++ b/app.js	Fri May 13 14:24:07 2016 +0200
@@ -163,13 +163,19 @@
                             if (!itemLabor) {
                                 continue;
                             }
+							if ( item.get('messStelle') === itemLabor.get('messStelle') ) {
+								displayCombi = item.get('messStelle');
+							} else {
+								displayCombi = item.get('messStelle') + '/' + itemLabor.get('messStelle')
+							}
                             mstLaborStore.add({
                                 id: i,
                                 messStelle: mstLabor[i].messstelle,
                                 netzbetreiberId: item.get('netzbetreiberId'),
                                 laborMst: mstLabor[i].labor,
-                                displayCombi: item.get('messStelle') +
-                                    '/' + itemLabor.get('messStelle')
+								displayCombi: displayCombi
+                                /*displayCombi: item.get('messStelle') +
+                                    '/' + itemLabor.get('messStelle')*/
                             });
                         }
                     }
@@ -202,7 +208,8 @@
             storeId: 'verwaltungseinheiten'
         });
         Ext.create('Lada.store.Probenehmer', {
-            storeId: 'probenehmer'
+            storeId: 'probenehmer',
+			autoLoad: true
         });
         Ext.create('Lada.store.DatensatzErzeuger', {
             storeId: 'datensatzerzeuger'
--- a/app/controller/form/Messprogramm.js	Thu May 12 16:03:04 2016 +0200
+++ b/app/controller/form/Messprogramm.js	Fri May 13 14:24:07 2016 +0200
@@ -84,7 +84,6 @@
         var netzbetreiber = combo.up().up('form')
                 .down('netzbetreiber').down('combobox');
         var nbId = records[0].get('netzbetreiberId');
-
         if (nbId != null) {
             //select the NB in the NB-Combobox
             netzbetreiber.select(nbId);
@@ -323,8 +322,8 @@
         var desk = field.up('deskriptor');
         var media = field.up('messprogrammform').down('textfield[name="mediaDesk"]');
         var current = media.getValue().split(' ');
-
         if (current.length < 12) {
+            var value;
             for (var i = 0; i <= 12; i++) {
                 if (i === 0) {
                     current.push('D:');
@@ -365,6 +364,37 @@
             }
         }
         media.setValue(current.join(' ').trim());
+
+		if (current[0].length == 0) {
+			current.splice(0,1);
+		}
+		var mediatext = field.up('messprogrammform').down('textfield[name="media"]');
+		
+		if ( (desk.layer === 0 ) && (records[0].get('sn') === 0) ){
+				mediatext.setValue('');
+		} else {
+				if ( current[1] === '01') { 
+					if ( (current[5] !== '00') && (desk.layer === 4 ) ){
+						//mediatext.setValue(records[0].data.beschreibung);
+					} else if ( (current[4] !== '00') && (desk.layer === 3) ) {
+						mediatext.setValue(records[0].data.beschreibung);
+					} else if ( (current[3] !== '00') && (desk.layer === 2) ) {
+						mediatext.setValue(records[0].data.beschreibung);
+					} else if ( (current[2] !== '00') && (desk.layer === 1) ) {
+						mediatext.setValue(records[0].data.beschreibung);
+					} else if ( (current[1] !== '00') && (desk.layer === 0 )) {
+						mediatext.setValue(records[0].data.beschreibung);
+					} 
+				}
+				
+				if ( current[1] !== '01') { 
+					if ((current[2] !== '00') && (desk.layer === 1 )) {
+						mediatext.setValue(records[0].data.beschreibung);
+					} else if ((current[1] !== '00') && (desk.layer === 0 )) {
+						mediatext.setValue(records[0].data.beschreibung);
+					} 
+				}
+            }
     },
 
     clearChildDesk: function(field) {
--- a/app/view/form/Messprogramm.js	Thu May 12 16:03:04 2016 +0200
+++ b/app/view/form/Messprogramm.js	Fri May 13 14:24:07 2016 +0200
@@ -171,17 +171,19 @@
                             }, {
                                 xtype: 'betriebsart',
                                 name: 'baId',
+                                margin: '0, 5, 5, 5',
                                 fieldLabel: i18n.getMsg('baId'),
-                                anchor: '100%',
-                                labelWidth: 105
+                                //anchor: '100%',
+                                width: '35%',
+                                labelWidth: 80
                             }, {
                                 xtype: 'probenart',
                                 editable: false,
                                 name: 'probenartId',
                                 fieldLabel: i18n.getMsg('probenartId'),
-                                margin: '0, 15, 5, 5',
+                                margin: '0, 5, 5, 5',
                                 width: '20%',
-                                labelWidth: 65,
+                                labelWidth: 70,
                                 allowBlank: false
                             }]
                         }]
@@ -222,7 +224,7 @@
                             fieldLabel: i18n.getMsg('teilintervallBis'),
                             margin: '0, 15, 5, 5',
                             labelWidth: 18,
-                            width: '12%',
+                            width: '15%',
                             name: 'teilintervallBis',
                             period: 'end'
                         }, {
@@ -230,7 +232,7 @@
                             margin: '0, 10, 5, 5',
                             fieldLabel: i18n.getMsg('offset'),
                             labelWidth: 45,
-                            width: '18%',
+                            width: '17%',
                             name: 'intervallOffset'
                         }]
                     }, {
@@ -463,7 +465,6 @@
 
     setRecord: function(messRecord) {
         this.clearMessages();
-
         this.getForm().loadRecord(messRecord);
         //Set the intervall numberfields and the slider.
         this.down('probenintervallslider').setValue([
@@ -493,16 +494,20 @@
                 laborMstId = '';
             }
             var id = this.down('messstellelabor').store.count() + 1;
-            var newStore = Ext.create('Ext.data.Store', {
-                model: 'Lada.model.MessstelleLabor',
-                data: [{
-                    id: id,
-                    laborMst: messRecord.get('laborMstId'),
-                    messStelle: messRecord.get('mstId'),
-                    displayCombi: mstId.get('messStelle') +
-                        '/' + laborMstId
-                }]
-            });
+			if ( messRecord.get('mstId') === messRecord.get('laborMstId') ) {
+				displayCombi = mstId.get('messStelle');
+			} else {
+				displayCombi = mstId.get('messStelle') + '/' + laborMstId
+			}
+			var newStore = Ext.create('Ext.data.Store', {
+				model: 'Lada.model.MessstelleLabor',
+				data: [{
+					id: id,
+					laborMst: messRecord.get('laborMstId'),
+					messStelle: messRecord.get('mstId'),
+					displayCombi: displayCombi
+				}]
+			});
             this.down('messstellelabor').down('combobox').store = newStore;
             this.down('messstellelabor').setValue(id);
         }
@@ -523,8 +528,11 @@
         this.setMediaSN(0, media);
     },
 
-    setMediaSN: function(ndx, media) {
+    setMediaSN: function(ndx, media, beschreibung) {
+        var mediabeschreibung = this.getForm().findField('media');
+		
         if (ndx >= 12) {
+			mediabeschreibung.setValue(beschreibung);
             return;
         }
         var me = this;
@@ -550,7 +558,15 @@
                 return;
             }
             cbox.select(cbox.store.findRecord('sn', parseInt(media[ndx + 1], 10)));
-            me.setMediaSN(++ndx, media);
+			var mediatext = cbox.store.findRecord('sn', parseInt(media[ndx + 1], 10));
+			if (mediatext !== null) {
+				if ( (ndx <= 3) && (media[1] === '01') && (mediatext.data.beschreibung !== "leer") ) {
+					beschreibung = mediatext.data.beschreibung;
+				} else if ( (media[1] !== '01') && (mediatext.data.beschreibung !== "leer") && (ndx <= 1) ) {
+					beschreibung = mediatext.data.beschreibung;
+				}
+			}
+            me.setMediaSN(++ndx, media, beschreibung);
         });
     },
 
--- a/app/view/widget/base/ComboBox.js	Thu May 12 16:03:04 2016 +0200
+++ b/app/view/widget/base/ComboBox.js	Fri May 13 14:24:07 2016 +0200
@@ -20,7 +20,6 @@
     margin: '0, 0, 5, 0',
 
     initComponent: function() {
-        console.log(this.editable);
         if (this.editable === undefined) {
             this.editable = true;
         }

http://lada.wald.intevation.org