Fix #7123 - getting abra ready to test
[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                                     listeners : {
82                                         render : function (_self)
83                                         {
84                                             _this.bankSel = _self;
85                                         },
86                                         edit : function (combo, record)
87                                         {
88                                             var id = combo.getValue() * 1;
89                                             
90                                             if(id < 1){
91                                                 Roo.MessageBox.alert('Error', 'Please select a bank account');
92                                                 return;
93                                             }
94                                             
95                                             Pman.Dialog.XtupleBankAccnt.show({id : id});
96                                             
97                                         }
98                                     },
99                                     allowBlank : false,
100                                     alwaysQuery : true,
101                                     displayField : 'bankaccnt_name',
102                                     editable : false,
103                                     emptyText : "Select Bank Accnt",
104                                     fieldLabel : 'Post to',
105                                     forceSelection : true,
106                                     hiddenName : 'bankaccnt_id',
107                                     listWidth : 400,
108                                     loadingText : "Searching...",
109                                     minChars : 2,
110                                     name : 'bankaccnt_id_name',
111                                     pageSize : 20,
112                                     qtip : "Select Bank Accnt",
113                                     queryParam : 'query[bankaccnt_name]',
114                                     selectOnFocus : true,
115                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{bankaccnt_name} - {bankaccnt_descrip}</b> </div>',
116                                     triggerAction : 'all',
117                                     typeAhead : true,
118                                     valueField : 'bankaccnt_id',
119                                     width : 200,
120                                     store : {
121                                         xtype: 'Store',
122                                         xns: Roo.data,
123                                         listeners : {
124                                             beforeload : function (_self, o){
125                                                 o.params = o.params || {};
126                                                 // set more here
127                                                
128                                             }
129                                         },
130                                         remoteSort : true,
131                                         sortInfo : { direction : 'DESC', field: 'bankaccnt_id' },
132                                         proxy : {
133                                             xtype: 'HttpProxy',
134                                             xns: Roo.data,
135                                             method : 'GET',
136                                             url : baseURL + '/Roo/bankaccnt.php'
137                                         },
138                                         reader : {
139                                             xtype: 'JsonReader',
140                                             xns: Roo.data,
141                                             id : 'bankaccnt_id',
142                                             root : 'data',
143                                             totalProperty : 'total',
144                                             fields : [{"name":"bankaccnt_id","type":"int"},"bankaccnt_name"]
145                                         }
146                                     }
147                                 }
148                             ]
149                         }
150                     ]
151                 }
152             ],
153             center : {
154                 xtype: 'LayoutRegion',
155                 xns: Roo
156             },
157             buttons : [
158                 {
159                     xtype: 'Button',
160                     xns: Roo,
161                     listeners : {
162                         click : function (_self, e)
163                         {
164                             _this.dialog.hide();
165                         }
166                     },
167                     text : "Cancel"
168                 },
169                 {
170                     xtype: 'Button',
171                     xns: Roo,
172                     listeners : {
173                         click : function (_self, e)
174                         {
175                             var bank = _this.bankSel.getValue();
176                             
177                             if(bank * 1 < 1){
178                                 Roo.MessageBox.alert("Error", "Please select a bankaccnt");
179                                 return;
180                             }
181                             
182                             _this.dialog.hide();
183                             
184                             _this.callback(_this.form.getValues());
185                         
186                         }
187                     },
188                     text : "Save"
189                 }
190             ]
191         });
192     }
193 };