Pman.Dialog.XtupleUploadHSBC.bjs
[Pman.Xtuple] / Pman.Dialog.XtupleUploadHSBC.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.XtupleUploadHSBC = {
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 HSBC",
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: 'DateField',
80                                     xns: Roo.form,
81                                     allowBlank : false,
82                                     fieldLabel : 'Apply Date',
83                                     format : 'Y-m-d',
84                                     name : 'apply_date',
85                                     width : 200
86                                 }
87                             ]
88                         }
89                     ]
90                 }
91             ],
92             center : {
93                 xtype: 'LayoutRegion',
94                 xns: Roo
95             },
96             buttons : [
97                 {
98                     xtype: 'Button',
99                     xns: Roo,
100                     listeners : {
101                         click : function (_self, e)
102                         {
103                             _this.dialog.hide();
104                         }
105                     },
106                     text : "Cancel"
107                 },
108                 {
109                     xtype: 'Button',
110                     xns: Roo,
111                     listeners : {
112                         click : function (_self, e)
113                         {
114                             var ref = _this.form.findField('reference').getValue();
115                             var d = _this.form.findField('apply_date').getValue();
116                             
117                             if(!ref.length || !d){
118                                 Roo.MessageBox.alert("Error", "Referenct and Apply date must be filled in");
119                                 return;
120                             }
121                             
122                             _this.dialog.hide();
123                             
124                             _this.callback(_this.form.getValues());
125                         
126                         }
127                     },
128                     text : "Save"
129                 }
130             ]
131         });
132     }
133 };