changeset 1323:754db8d73691

merged
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 03 Feb 2017 14:32:28 +0100
parents 6edab3ee2198 (current diff) 518b4c28e71a (diff)
children 09d121acda6c
files app/view/form/Ortserstellung.js
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/app/view/form/Ortserstellung.js	Fri Feb 03 14:32:12 2017 +0100
+++ b/app/view/form/Ortserstellung.js	Fri Feb 03 14:32:28 2017 +0100
@@ -274,17 +274,25 @@
 
     saveOrt: function() {
         var this_panel = this.up('panel');
+        var me = this;
         var form = this_panel.getForm();
         var record = form.getRecord();
-        var oldId = record.get('ortId');
         var data = form.getFieldValues(true);
         for (var key in data) {
             record.set(key, data[key]);
         }
+        record.set('id', null);
         record.set('netzbetreiberId', Lada.netzbetreiber[0]);
         record.save({
             success: function(newrecord, response) {
                 form.loadRecord(newrecord);
+                this_panel.down('verwaltungseinheit').store.load(
+                        { id:newrecord.get('gemId') });
+                console.log(this_panel.down('verwaltungseinheit'));
+                this_panel.down('staat').store.load(
+                        { id : newrecord.get('staat') });
+                me.setDisabled(true);
+                me.hide();
                 var ozw = this_panel.up().parentWindow;
                 var json = Ext.decode(response.response.responseText);
                 if (json) {
@@ -306,11 +314,7 @@
                                 resulttext = 'Dieser Ort existiert bereits!';
                             }
                             if (json.message == '200') {
-                                if (oldId === undefined) {
-                                    resulttext = 'Ort erfolgreich angelegt!';
-                                } else {
-                                    resulttext = 'Bestehender Ort erfolgreich modifiziert!';
-                                }
+                                resulttext = 'Ort erfolgreich angelegt!';
                             }
                         }
                         Ext.Msg.show({
@@ -342,6 +346,7 @@
                     Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
                         Lada.getApplication().bundle.getMsg('err.msg.response.body'));
                 }
+                me.setDisabled(true);
             }
         });
     },

http://lada.wald.intevation.org