Mercurial > lada > lada-client
annotate app/view/orte/CreateForm.js @ 496:d07e5086a64b
Moved stammdaten stores to app.js and load them via storemanager.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 06 Nov 2014 10:35:35 +0100 |
parents | 850ccfe5f3c4 |
children | 7c0653e8d9f7 |
rev | line source |
---|---|
472
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
447
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
447
diff
changeset
|
2 * Software engineering by Intevation GmbH |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
447
diff
changeset
|
3 * |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
447
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
447
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
447
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
447
diff
changeset
|
7 */ |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
447
diff
changeset
|
8 |
347
1536fb5c81b7
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
278
diff
changeset
|
9 /* |
1536fb5c81b7
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
278
diff
changeset
|
10 * Formular to create and edit a Ort |
1536fb5c81b7
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
278
diff
changeset
|
11 */ |
109
2308094f5a8c
Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
12 Ext.define('Lada.view.orte.CreateForm', { |
2308094f5a8c
Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
13 extend: 'Lada.view.widgets.LadaForm', |
2308094f5a8c
Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
14 model: 'Lada.model.Ort', |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
15 requires: [ |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
16 'Lada.view.widgets.Ortdetail', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
17 'Lada.view.widgets.Staat', |
447
12231f31c112
Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
432
diff
changeset
|
18 'Lada.view.widgets.Verwaltungseinheit', |
12231f31c112
Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
432
diff
changeset
|
19 'Lada.view.orte.CreateOrt' |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
20 ], |
447
12231f31c112
Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
432
diff
changeset
|
21 edit: false, |
109
2308094f5a8c
Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
22 initComponent: function() { |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
23 this.items = [{ |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
24 xtype: 'ortdetail', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
25 name: 'ortId', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
26 fieldLabel: 'Ort', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
27 listeners: { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
28 scope: this, |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
29 'change': function (field, newv, oldv, opts) { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
30 if (field.up('window')) { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
31 field.up('window').down('fieldset').show(); |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
32 } |
496
d07e5086a64b
Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
33 var orte = Ext.data.StoreManager.get('staOrte'); |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
34 var ort = orte.getById(newv); |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
35 var fields = [ |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
36 'beschreibung', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
37 'bezeichnung', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
38 'hoeheLand', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
39 'latitude', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
40 'longitude', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
41 'staatId', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
42 'gemId' |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
43 ]; |
429
608a1784a8ac
Load currently "selected" verwaltungseinheit when changing the selection.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
347
diff
changeset
|
44 |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
45 // Load currently "selected" verwaltungseinheit. This |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
46 // is needed as without having this record the field |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
47 // would only display the raw value (id) of the |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
48 // verwaltungseinheit. |
496
d07e5086a64b
Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
49 var verw = |
d07e5086a64b
Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
50 Ext.data.StoreManager.get('staVerwaltungseinheiten'); |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
51 if (ort) { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
52 verw.load({ |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
53 id: ort.get('gemId') |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
54 }); |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
55 } |
429
608a1784a8ac
Load currently "selected" verwaltungseinheit when changing the selection.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
347
diff
changeset
|
56 |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
57 var form = this.getForm(); |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
58 if ( ort != undefined ) { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
59 for (var i = fields.length - 1; i >= 0; i--){ |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
60 ffield = form.findField("ort_"+fields[i]); |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
61 ffield.setValue(ort.get(fields[i])); |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
62 } |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
63 } |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
64 } |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
65 } |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
66 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
67 xtype: 'textfield', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
68 name: 'ortsTyp', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
69 maxLength: 1, |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
70 fieldLabel: 'Typ' |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
71 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
72 xtype: 'textareafield', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
73 name: 'ortszusatztext', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
74 maxLength: 100, |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
75 fieldLabel: 'Ortszusatz' |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
76 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
77 xtype: 'button', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
78 name: 'newort', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
79 text: 'Neuen Ort Anlegen', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
80 hidden: this.edit, |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
81 action: 'newort' |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
82 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
83 xtype: 'fieldset', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
84 title: 'Ortsangaben', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
85 hidden: !this.edit, |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
86 defaults: { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
87 labelWidth: 150 |
447
12231f31c112
Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
432
diff
changeset
|
88 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
89 items: [{ |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
90 xtype: 'textfield', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
91 maxLength: 100, |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
92 name: 'ort_beschreibung', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
93 fieldLabel: 'Beschreibung' |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
94 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
95 xtype: 'textfield', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
96 maxLength: 10, |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
97 name: 'ort_bezeichnung', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
98 fieldLabel: 'Bezeichnung' |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
99 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
100 xtype: 'staat', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
101 name: 'ort_staatId', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
102 fieldLabel: 'Staat' |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
103 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
104 xtype: 'verwaltungseinheiten', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
105 name: 'ort_gemId', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
106 fieldLabel: 'Gemeinde' |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
107 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
108 xtype: 'numberfield', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
109 name: 'ort_latitude', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
110 fieldLabel: 'Lat' |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
111 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
112 xtype: 'numberfield', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
113 name: 'ort_longitude', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
114 fieldLabel: 'Lon' |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
115 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
116 xtype: 'numberfield', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
117 name: 'ort_hoeheLand', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
118 fieldLabel: 'Höhe' |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
119 }] |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
120 }]; |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
121 this.callParent(arguments); |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
122 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
123 |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
124 updateOrtInfo: function(field, oldv, newv, opts) { |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
125 console.log(field, oldv, newv, opts); |
109
2308094f5a8c
Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
126 } |
2308094f5a8c
Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
127 }); |