Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleUploadBalances.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Dialog.XtupleUploadBalances = {
6
7     dialog : false,
8     callback:  false,
9
10     show : function(data, cb)
11     {
12         if (!this.dialog) {
13             this.create();
14         }
15
16         this.callback = cb;
17         this.data = data;
18         this.dialog.show(this.data._el);
19         if (this.form) {
20            this.form.reset();
21            this.form.setValues(data);
22            this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
23         }
24
25     },
26
27     create : function()
28     {
29         var _this = this;
30         this.dialog = Roo.factory({
31             xtype: 'LayoutDialog',
32             xns: Roo,
33             closable : false,
34             collapsible : false,
35             height : 140,
36             modal : true,
37             resizable : false,
38             title : "Upload new Balances",
39             width : 400,
40             items : [
41                 {
42                     xtype: 'ContentPanel',
43                     xns: Roo,
44                     region : 'center',
45                     items : [
46                         {
47                             xtype: 'Form',
48                             xns: Roo.form,
49                             listeners : {
50                                 rendered : function (form)
51                                 {
52                                     _this.form= form;
53                                 },
54                                 actioncomplete : function(_self,action)\r
55                                 {\r
56                                     if (action.type == 'setdata') {\r
57                                        return;\r
58                                     }\r
59                                     if (action.type == 'load') {\r
60                                         return;\r
61                                     }\r
62                                     if (action.type =='submit') {\r
63                                     \r
64                                         _this.dialog.hide();\r
65                                 \r
66                                          if (_this.callback) {\r
67                                             _this.callback.call(_this, _this.form.getValues());\r
68                                          }\r
69                                          _this.form.reset();\r
70                                          return;\r
71                                     }\r
72                                 }
73                             },
74                             method : 'GET',
75                             style : 'margin:10px;',
76                             url : baseURL + '/Roo/INGORE.php',
77                             items : [
78                                 {
79                                     xtype: 'TextField',
80                                     xns: Roo.form,
81                                     allowBlank : false,
82                                     fieldLabel : 'Reference',
83                                     name : 'reference',
84                                     width : 200
85                                 },
86                                 {
87                                     xtype: 'DateField',
88                                     xns: Roo.form,
89                                     allowBlank : false,
90                                     fieldLabel : 'Apply Date',
91                                     format : 'Y-m-d',
92                                     name : 'apply_date',
93                                     width : 200
94                                 }
95                             ]
96                         }
97                     ]
98                 }
99             ],
100             center : {
101                 xtype: 'LayoutRegion',
102                 xns: Roo
103             },
104             buttons : [
105                 {
106                     xtype: 'Button',
107                     xns: Roo,
108                     listeners : {
109                         click : function (_self, e)
110                         {
111                             _this.dialog.hide();
112                         }
113                     },
114                     text : "Cancel"
115                 },
116                 {
117                     xtype: 'Button',
118                     xns: Roo,
119                     listeners : {
120                         click : function (_self, e)
121                         {
122                             var ref = _this.form.findField('reference').getValue();
123                             var d = _this.form.findField('apply_date').getValue();
124                             
125                             if(!ref.length || !d){
126                                 Roo.MessageBox.alert("Error", "Referenct and Apply date must be filled in");
127                                 return;
128                             }
129                             
130                             _this.dialog.hide();
131                             
132                             _this.callback(_this.form.getValues());
133                         
134                         }
135                     },
136                     text : "Save"
137                 }
138             ]
139         });
140     }
141 };