Mercurial > lada > lada-client
changeset 1276:8f37f8832c4a
fix mediadescription in probe form
author | Michael Stanko <mstanko@bfs.de> |
---|---|
date | Wed, 11 Jan 2017 16:32:51 +0100 |
parents | 1df7a0899ebe |
children | cb9609380056 8012e5212bd5 |
files | app/controller/form/Messprogramm.js app/controller/form/Probe.js app/view/form/Messprogramm.js app/view/form/Probe.js |
diffstat | 4 files changed, 92 insertions(+), 57 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controller/form/Messprogramm.js Tue Jan 10 10:05:00 2017 +0100 +++ b/app/controller/form/Messprogramm.js Wed Jan 11 16:32:51 2017 +0100 @@ -318,7 +318,6 @@ } }, - deskriptorSelect: function(field, records) { var desk = field.up('deskriptor'); var media = field.up('messprogrammform').down('textfield[name="mediaDesk"]'); @@ -366,36 +365,34 @@ } 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); - } - } + 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[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/controller/form/Probe.js Tue Jan 10 10:05:00 2017 +0100 +++ b/app/controller/form/Probe.js Wed Jan 11 16:32:51 2017 +0100 @@ -230,8 +230,8 @@ var desk = field.up('deskriptor'); var media = field.up('probeform').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:'); @@ -272,6 +272,35 @@ } } media.setValue(current.join(' ').trim()); + + if (current[0].length == 0) { + current.splice(0,1); + } + var mediatext = field.up('probeform').down('textfield[name="media"]'); + + if ( (desk.layer === 0 ) && (records[0].get('sn') === 0) ){ + mediatext.setValue(''); + } else { + if ( current[1] === '01') { + 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 Tue Jan 10 10:05:00 2017 +0100 +++ b/app/view/form/Messprogramm.js Wed Jan 11 16:32:51 2017 +0100 @@ -538,20 +538,21 @@ laborMstId = ''; } var id = this.down('messstellelabor').store.count() + 1; - 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 - }] - }); + 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); } @@ -578,9 +579,8 @@ setMediaSN: function(ndx, media, beschreibung) { var mediabeschreibung = this.getForm().findField('media'); - if (ndx >= 12) { - mediabeschreibung.setValue(beschreibung); + mediabeschreibung.setValue(beschreibung); return; } var me = this; @@ -606,14 +606,14 @@ return; } cbox.select(cbox.store.findRecord('sn', parseInt(media[ndx + 1], 10))); - 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; - } - } + 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/form/Probe.js Tue Jan 10 10:05:00 2017 +0100 +++ b/app/view/form/Probe.js Wed Jan 11 16:32:51 2017 +0100 @@ -416,8 +416,9 @@ } }, - setMediaSN: function(ndx, media) { + setMediaSN: function(ndx, media, beschreibung) { if (ndx >= 12) { + mediabeschreibung.setValue(beschreibung); return; } var me = this; @@ -443,7 +444,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); }); },