Mercurial > lada > lada-client
comparison app/view/form/Ortserstellung.js @ 1323:754db8d73691
merged
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 03 Feb 2017 14:32:28 +0100 |
parents | f1e348109ebb 518b4c28e71a |
children | b9f0bb189c25 |
comparison
equal
deleted
inserted
replaced
1322:6edab3ee2198 | 1323:754db8d73691 |
---|---|
272 } | 272 } |
273 }, | 273 }, |
274 | 274 |
275 saveOrt: function() { | 275 saveOrt: function() { |
276 var this_panel = this.up('panel'); | 276 var this_panel = this.up('panel'); |
277 var me = this; | |
277 var form = this_panel.getForm(); | 278 var form = this_panel.getForm(); |
278 var record = form.getRecord(); | 279 var record = form.getRecord(); |
279 var oldId = record.get('ortId'); | |
280 var data = form.getFieldValues(true); | 280 var data = form.getFieldValues(true); |
281 for (var key in data) { | 281 for (var key in data) { |
282 record.set(key, data[key]); | 282 record.set(key, data[key]); |
283 } | 283 } |
284 record.set('id', null); | |
284 record.set('netzbetreiberId', Lada.netzbetreiber[0]); | 285 record.set('netzbetreiberId', Lada.netzbetreiber[0]); |
285 record.save({ | 286 record.save({ |
286 success: function(newrecord, response) { | 287 success: function(newrecord, response) { |
287 form.loadRecord(newrecord); | 288 form.loadRecord(newrecord); |
289 this_panel.down('verwaltungseinheit').store.load( | |
290 { id:newrecord.get('gemId') }); | |
291 console.log(this_panel.down('verwaltungseinheit')); | |
292 this_panel.down('staat').store.load( | |
293 { id : newrecord.get('staat') }); | |
294 me.setDisabled(true); | |
295 me.hide(); | |
288 var ozw = this_panel.up().parentWindow; | 296 var ozw = this_panel.up().parentWindow; |
289 var json = Ext.decode(response.response.responseText); | 297 var json = Ext.decode(response.response.responseText); |
290 if (json) { | 298 if (json) { |
291 this_panel.clearMessages(); | 299 this_panel.clearMessages(); |
292 this_panel.setMessages(json.errors, json.warnings); | 300 this_panel.setMessages(json.errors, json.warnings); |
304 if (json) { | 312 if (json) { |
305 if (json.message == '201') { | 313 if (json.message == '201') { |
306 resulttext = 'Dieser Ort existiert bereits!'; | 314 resulttext = 'Dieser Ort existiert bereits!'; |
307 } | 315 } |
308 if (json.message == '200') { | 316 if (json.message == '200') { |
309 if (oldId === undefined) { | 317 resulttext = 'Ort erfolgreich angelegt!'; |
310 resulttext = 'Ort erfolgreich angelegt!'; | |
311 } else { | |
312 resulttext = 'Bestehender Ort erfolgreich modifiziert!'; | |
313 } | |
314 } | 318 } |
315 } | 319 } |
316 Ext.Msg.show({ | 320 Ext.Msg.show({ |
317 title: Lada.getApplication().bundle.getMsg('success'), | 321 title: Lada.getApplication().bundle.getMsg('success'), |
318 autoScroll: true, | 322 autoScroll: true, |
340 } | 344 } |
341 } else { | 345 } else { |
342 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), | 346 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), |
343 Lada.getApplication().bundle.getMsg('err.msg.response.body')); | 347 Lada.getApplication().bundle.getMsg('err.msg.response.body')); |
344 } | 348 } |
349 me.setDisabled(true); | |
345 } | 350 } |
346 }); | 351 }); |
347 }, | 352 }, |
348 | 353 |
349 setMessages: function(errors, warnings) { | 354 setMessages: function(errors, warnings) { |