comparison app/controller/grid/Ortszuordnung.js @ 1289:bfdc00c24baf

Ortszuordnung for messprogramm and probe using same form
author Maximilian Krambach <mkrambach@intevation.de>
date Wed, 01 Feb 2017 14:52:51 +0100
parents 08085b7d1d0b
children e9f812528324
comparison
equal deleted inserted replaced
1288:08085b7d1d0b 1289:bfdc00c24baf
60 }); 60 });
61 }, 61 },
62 62
63 /** 63 /**
64 * When open is called, a {@link Lada.view.window.Ortszuordnung} 64 * When open is called, a {@link Lada.view.window.Ortszuordnung}
65 * is created which allows to edit the Orte 65 * is created which allows to edit the Orte. record is an ortszuordnung
66 * or ortzuordnungMp
66 */ 67 */
67 open: function(grid, record) { 68 open: function(grid, record) {
68 var probe = grid.up('window').record; 69 var parent = grid.up('window').record;
70 // parent is either probe or messprogramm.
71 var parentisMp = false;
72 if (parent.data.hauptprobenNr === undefined) {
73 parentisMp = true;
74 }
69 var win = Ext.create('Lada.view.window.Ortszuordnung', { 75 var win = Ext.create('Lada.view.window.Ortszuordnung', {
70 parentWindow: grid.up('window'), 76 parentWindow: grid.up('window'),
71 probe: probe, 77 probe: parentisMp ? null: parent,
78 messprogramm: parentisMp ? parent: null,
72 record: record, 79 record: record,
73 grid: grid 80 grid: grid
74 }); 81 });
75 win.show(); 82 win.show();
76 win.initData(); 83 win.initData();
78 85
79 /** 86 /**
80 * This function adds a new row to add an Ort 87 * This function adds a new row to add an Ort
81 */ 88 */
82 add: function(button) { 89 add: function(button) {
83 var probe = button.up('window').record; 90 var parent = button.up('window').record;
91 var parentisMp = false;
92 if (parent.data.hauptprobenNr === undefined) {
93 parentisMp = true;
94 }
84 var win = Ext.create('Lada.view.window.Ortszuordnung', { 95 var win = Ext.create('Lada.view.window.Ortszuordnung', {
85 parentWindow: button.up('window'), 96 parentWindow: button.up('window'),
86 probe: probe, 97 probe: parentisMp ? null: parent,
98 messprogramm: parentisMp ? parent: null,
87 record: null, 99 record: null,
88 grid: button.up('ortszuordnung') 100 grid: button.up('ortszuordnung')
89 }); 101 });
90 win.show(); 102 win.show();
91 win.initData(); 103 win.initData();
238 250
239 if (!this.resultPanel) { 251 if (!this.resultPanel) {
240 this.resultPanel = Ext.create('Lada.view.window.OrtFilter', { 252 this.resultPanel = Ext.create('Lada.view.window.OrtFilter', {
241 x: 500, 253 x: 500,
242 y: 500, 254 y: 500,
243 alwaysOnTop: true 255 alwaysOnTop: true,
256 parentWindow: this
244 }); 257 });
245 } 258 }
246 this.resultPanel.show(); 259 this.resultPanel.show();
247 this.resultPanel.updateGrids(messpunkte, verwaltungseinheiten, staaten); 260 this.resultPanel.updateGrids(messpunkte, verwaltungseinheiten, staaten);
248 this.resultPanel.reposition(field.getX() + field.getLabelWidth(), field.getY()); 261 this.resultPanel.reposition(field.getX() + field.getLabelWidth(), field.getY());
258 grid.getView().focusRow(record); 271 grid.getView().focusRow(record);
259 }, 272 },
260 273
261 selectedVerwaltungseinheit: function(grid, record) { 274 selectedVerwaltungseinheit: function(grid, record) {
262 var win = grid.up('window'); 275 var win = grid.up('window');
276 var panel = this.searchField.up('panel').up('window');
263 win.hide(); 277 win.hide();
264 this.searchField.reset(); 278 this.searchField.reset();
265 Ext.create('Lada.view.window.Ortserstellung', { 279 Ext.create('Lada.view.window.Ortserstellung', {
266 record: Ext.create('Lada.model.Ort', record.data), 280 record: Ext.create('Lada.model.Ort', {
267 parentWindow: grid.up('ortszuordnungwindow') 281 gemId: record.get('id')
282 }),
283 parentWindow: panel
268 }).show(); 284 }).show();
269 }, 285 },
270 286
271 selectedStaat: function(grid, record) { 287 selectedStaat: function(grid, record) {
272 var win = grid.up('window'); 288 var win = grid.up('window');
273 console.log(grid.up('ortszuordnungwindow'));
274 win.hide(); 289 win.hide();
290 this.searchField.reset();
275 Ext.create('Lada.view.window.Ortserstellung', { 291 Ext.create('Lada.view.window.Ortserstellung', {
276 record: Ext.create('Lada.model.Ort', record.data), 292 record: Ext.create('Lada.model.Ort', {
277 parentWindow: grid.up('ortszuordnungwindow') 293 staatId: record.get('id')
278 }).show(); 294 }),
279 this.searchField.reset(); 295 parentWindow: win
296 }).show();
280 } 297 }
281 }); 298 });

http://lada.wald.intevation.org