comparison app/view/form/Ortserstellung.js @ 1288:08085b7d1d0b

Ortszuordnung: Search, new orte, display and validity check
author Maximilian Krambach <mkrambach@intevation.de>
date Fri, 27 Jan 2017 13:25:14 +0100
parents faecbb446a04
children bfdc00c24baf
comparison
equal deleted inserted replaced
1287:e317ba349204 1288:08085b7d1d0b
6 * the documentation coming with IMIS-Labordaten-Application for details. 6 * the documentation coming with IMIS-Labordaten-Application for details.
7 */ 7 */
8 8
9 /** 9 /**
10 * Form to create a new Messpunkt 10 * Form to create a new Messpunkt
11 * TODO: layout
12 */ 11 */
13 Ext.define('Lada.view.form.Ortserstellung', { 12 Ext.define('Lada.view.form.Ortserstellung', {
14 extend: 'Ext.form.Panel', 13 extend: 'Ext.form.Panel',
15 alias: 'widget.ortserstellungsform', 14 alias: 'widget.ortserstellungsform',
16 requires: [ 15 requires: [
31 submitValue: true, 30 submitValue: true,
32 fieldLabel: i18n.getMsg('netzbetreiberId'), 31 fieldLabel: i18n.getMsg('netzbetreiberId'),
33 margin : '0, 5, 5, 5', 32 margin : '0, 5, 5, 5',
34 labelWidth: 80, 33 labelWidth: 80,
35 width: 150, 34 width: 150,
36 value: Lada.netzbetreiber 35 value: Lada.netzbetreiber[0]
37 }, { 36 }, {
38 xtype: 'checkbox', 37 xtype: 'checkbox',
39 name: 'aktiv', 38 name: 'aktiv',
40 fieldLabel: 'aktiv:' 39 fieldLabel: 'aktiv:'
41 }, { 40 }, {
236 } 235 }
237 this_panel.record.set('letzteAenderung', 0); 236 this_panel.record.set('letzteAenderung', 0);
238 this_panel.record.set('id', null); 237 this_panel.record.set('id', null);
239 this_panel.record.set('ortId', null); 238 this_panel.record.set('ortId', null);
240 this_panel.record.set('netzbetreiberId', Lada.netzbetreiber[0]); 239 this_panel.record.set('netzbetreiberId', Lada.netzbetreiber[0]);
241 console.log(this_panel.record);
242 this_panel.record.save({ 240 this_panel.record.save({
243 success: function(record, response) { 241 success: function(record, response) {
244 console.log(response);
245 var newOrtId; 242 var newOrtId;
246 Ext.Msg.show({ 243 Ext.Msg.show({
247 title: Lada.getApplication().bundle.getMsg('success'), 244 title: Lada.getApplication().bundle.getMsg('success'),
248 autoScroll: true, 245 autoScroll: true,
249 msg: 'Ort erfolgreich angelegt!', 246 msg: 'Ort erfolgreich angelegt!',
263 }, 260 },
264 scope: this 261 scope: this
265 }); 262 });
266 }, 263 },
267 failure: function(record, response) { 264 failure: function(record, response) {
268 console.log(response); 265 // TODO check
269 // TODO 266 var json = Ext.decode(response.response.responseText);
270 // response.error.status 267 if (json) {
271 // response.error.statusText 268 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){
272 // var json = Ext.decode(response.response.responseText); 269 formPanel.setMessages(json.errors, json.warnings);
273 // if (json) { 270 }
274 // if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ 271 if(json.message){
275 // console.log(json.errors); 272 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
276 // console.log(json.warnings); 273 +' #'+json.message,
277 // formPanel.setMessages(json.errors, json.warnings); 274 Lada.getApplication().bundle.getMsg(json.message));
278 // } 275 } else {
279 // if(json.message){ 276 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
280 // Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title') 277 Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
281 // +' #'+json.message, 278 }
282 // Lada.getApplication().bundle.getMsg(json.message)); 279 } else {
283 // } else { 280 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
284 // Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), 281 Lada.getApplication().bundle.getMsg('err.msg.response.body'));
285 // Lada.getApplication().bundle.getMsg('err.msg.generic.body')); 282 }
286 // }
287 // } else {
288 // Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
289 // Lada.getApplication().bundle.getMsg('err.msg.response.body'));
290 } 283 }
291 }); 284 });
292 } 285 }
293 }); 286 });

http://lada.wald.intevation.org