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: 'ComboBox',
80                                     xns: Roo.form,
81                                     allowBlank : false,
82                                     displayField : 'bankaccnt_name',
83                                     editable : false,
84                                     emptyText : "Select Bank Accnt",
85                                     fieldLabel : 'Post to',
86                                     forceSelection : true,
87                                     hiddenName : 'checkhead_bankaccnt_id',
88                                     listWidth : 400,
89                                     loadingText : "Searching...",
90                                     minChars : 2,
91                                     name : 'checkhead_bankaccnt_id_name',
92                                     pageSize : 20,
93                                     qtip : "Select Bank Accnt",
94                                     queryParam : 'query[bankaccnt_name]',
95                                     selectOnFocus : true,
96                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{bankaccnt_name} - {bankaccnt_descrip}</b> </div>',
97                                     triggerAction : 'all',
98                                     typeAhead : true,
99                                     valueField : 'bankaccnt_id',
100                                     width : 200,
101                                     store : {
102                                         xtype: 'Store',
103                                         xns: Roo.data,
104                                         listeners : {
105                                             beforeload : function (_self, o){
106                                                 o.params = o.params || {};
107                                                 // set more here
108                                                
109                                             }
110                                         },
111                                         remoteSort : true,
112                                         sortInfo : { direction : 'DESC', field: 'bankaccnt_id' },
113                                         proxy : {
114                                             xtype: 'HttpProxy',
115                                             xns: Roo.data,
116                                             method : 'GET',
117                                             url : baseURL + '/Roo/bankaccnt.php'
118                                         },
119                                         reader : {
120                                             xtype: 'JsonReader',
121                                             xns: Roo.data,
122                                             id : 'bankaccnt_id',
123                                             root : 'data',
124                                             totalProperty : 'total',
125                                             fields : [{"name":"bankaccnt_id","type":"int"},"bankaccnt_name"]
126                                         }
127                                     }
128                                 }
129                             ]
130                         }
131                     ]
132                 }
133             ],
134             center : {
135                 xtype: 'LayoutRegion',
136                 xns: Roo
137             },
138             buttons : [
139                 {
140                     xtype: 'Button',
141                     xns: Roo,
142                     listeners : {
143                         click : function (_self, e)
144                         {
145                             _this.dialog.hide();
146                         }
147                     },
148                     text : "Cancel"
149                 },
150                 {
151                     xtype: 'Button',
152                     xns: Roo,
153                     listeners : {
154                         click : function (_self, e)
155                         {
156                             var ref = _this.form.findField('reference').getValue();
157                             var d = _this.form.findField('apply_date').getValue();
158                             
159                             if(!ref.length || !d){
160                                 Roo.MessageBox.alert("Error", "Referenct and Apply date must be filled in");
161                                 return;
162                             }
163                             
164                             _this.dialog.hide();
165                             
166                             _this.callback(_this.form.getValues());
167                         
168                         }
169                     },
170                     text : "Save"
171                 }
172             ]
173         });
174     }
175 };