comparison app/view/window/GenProbenFromMessprogramm.js @ 760:2e7e1a8bf79f

Added a Window and Buttons to generate Proben from a Messprogramm
author Dustin Demuth <dustin@intevation.de>
date Fri, 08 May 2015 11:38:00 +0200
parents
children 975183ab775e
comparison
equal deleted inserted replaced
759:b7484c7da2d4 760:2e7e1a8bf79f
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
2 * Software engineering by Intevation GmbH
3 *
4 * This file is Free Software under the GNU GPL (v>=3)
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
6 * the documentation coming with IMIS-Labordaten-Application for details.
7 */
8
9 /*
10 * Window to generate Proben from a Messprogramm
11 */
12 Ext.define('Lada.view.window.GenProbenFromMessprogramm', {
13 extend: 'Ext.window.Window',
14 alias: 'widget.genpfm',
15
16 collapsible: true,
17 maximizable: true,
18 autoShow: true,
19 autoScroll: true,
20 layout: 'fit',
21 constrain: true,
22
23 record: null,
24
25 initComponent: function() {
26 var i18n = Lada.getApplication().bundle;
27
28 this.title = i18n.getMsg('gpfm.window.title');
29 var me = this;
30 this.buttons = [{
31 text: i18n.getMsg('cancel'),
32 scope: this,
33 handler: this.close
34 }, {
35 text: i18n.getMsg('generateproben'),
36 handler: function() {
37 var jsondata = {
38 id: me.record.id,
39 start: me.down('datetime [name=start]').getValue(),
40 end: me.down('datetime [name=end]').getValue()
41 };
42
43
44 Ext.Ajax.request({
45 url: '/lada-server/probe/messprogramm',
46 method: 'POST',
47 headers: {
48 'X-OPENID-PARAMS': Lada.openIDParams
49 },
50 jsonData: jsondata,
51 success: function(form, action) {
52 Ext.Msg.alert('Success', action.result.msg);
53 },
54 failure: function(form, action) {
55 Ext.Msg.alert('Failed', action.result.msg);
56 }
57 });
58 }
59 }];
60 this.width = 400;
61 this.height = 300;
62
63 // add listeners to change the window appearence when it becomes inactive
64 this.on({
65 activate: function(){
66 this.getEl().removeCls('window-inactive');
67 },
68 deactivate: function(){
69 this.getEl().addCls('window-inactive');
70 }
71 });
72
73 // InitialConfig is the config object passed to the constructor on
74 // creation of this window. We need to pass it throuh to the form as
75 // we need the "Id" param to load the correct item.
76 this.items = [{
77 border: 0,
78 autoScroll: true,
79 items: [{
80 xtype: 'text',
81 text: i18n.getMsg('nameofmessprogramm')+ ' '
82 }, {
83 xtype: 'text',
84 text: this.record.get('name')
85 }, {
86 xtype: 'text',
87 text: ' ' + i18n.getMsg('messprogtimeperiod')
88 }, {
89 xtype: 'datetime',
90 fieldLabel: i18n.getMsg('from'),
91 labelWidth: 90,
92 name: 'start',
93 format: 'd.m.Y H:i',
94 period: 'start'
95 }, {
96 xtype: 'datetime',
97 fieldLabel: i18n.getMsg('to'),
98 labelWidth: 90,
99 name: 'end',
100 format: 'd.m.Y H:i',
101 period: 'end'
102 }]
103 }];
104 this.callParent(arguments);
105 },
106
107 /**
108 * Init
109 */
110 initData: function() {
111 var i18n = Lada.getApplication().bundle;
112 me = this;
113 },
114 });

http://lada.wald.intevation.org