Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtuplePriceList.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Pman.Dialog');
6
7 Pman.Dialog.XtuplePriceList = {
8
9     dialog : false,
10     callback:  false,
11
12     show : function(data, cb)
13     {
14         if (!this.dialog) {
15             this.create();
16         }
17
18         this.callback = cb;
19         this.data = data;
20         this.dialog.show(this.data._el);
21         if (this.form) {
22            this.form.reset();
23            this.form.setValues(data);
24            this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
25         }
26
27     },
28
29     create : function()
30     {
31         var _this = this;
32         this.dialog = Roo.factory({
33             center : {
34                 '|xns' : 'Roo',
35                 xtype : 'LayoutRegion',
36                 xns : Roo
37             },
38             '|xns' : 'Roo',
39             modal : true,
40             collapsible : false,
41             title : "Edit / Create Price List",
42             xtype : 'LayoutDialog',
43             width : 400,
44             xns : Roo,
45             closable : false,
46             resizable : false,
47             height : 300,
48             buttons : [
49                  {
50                         '|xns' : 'Roo',
51                         text : "Cancel",
52                         xtype : 'Button',
53                         xns : Roo,
54                         listeners : {
55                                 click : function (_self, e)
56                                    {
57                                        _this.dialog.hide();
58                                    }
59                         }
60                     },
61 {
62                         '|xns' : 'Roo',
63                         text : "Save",
64                         xtype : 'Button',
65                         xns : Roo,
66                         listeners : {
67                                 click : function (_self, e)
68                                    {
69                                        // do some checks?
70                                         
71                                        
72                                        //_this.dialog.el.mask("Saving");
73                                        _this.form.doAction("submit");
74                                    
75                                    }
76                         }
77                     }
78             ],
79             items : [
80                 {
81                     '|xns' : 'Roo',
82                     region : 'center',
83                     xtype : 'ContentPanel',
84                     xns : Roo,
85                     items : [
86                         {
87                             '|xns' : 'Roo.form',
88                             url : baseURL + '/Roo/ipshead.php',
89                             method : 'POST',
90                             xtype : 'Form',
91                             style : 'margin:10px;',
92                             xns : Roo.form,
93                             listeners : {
94                                 actioncomplete : function(_self,action)
95                                    {
96                                        if (action.type == 'setdata') {
97                                           //_this.dialog.el.mask("Loading");
98                                    
99                                           
100                                           if (_this.data.ipshead_id) { 
101                                               this.load({ method: 'GET', params: { '_id' : _this.data.ipshead_id }});
102                                               return;
103                                           }
104                                           this.setValues({
105                                                ipshead_effective : new Date(1970,1,1),
106                                                ipshead_expires :new Date(2100,1,1)
107                                    
108                                           });
109                                           
110                                           
111                                           return;
112                                        }
113                                        if (action.type == 'load') {
114                                            _this.dialog.el.unmask();
115                                            return;
116                                        }
117                                        if (action.type =='submit') {
118                                        
119                                            _this.dialog.el.unmask();
120                                            _this.dialog.hide();
121                                        
122                                             if (_this.callback) {
123                                                _this.callback.call(_this, _this.form.getValues());
124                                             }
125                                             _this.form.reset();
126                                             return;
127                                        }
128                                    },
129                                 rendered : function (form)
130                                    {
131                                        _this.form= form;
132                                    }
133                             },
134                             items : [
135                                 {
136                                     '|xns' : 'Roo.form',
137                                     fieldLabel : 'Name',
138                                     xtype : 'TextField',
139                                     allowBlank : false,
140                                     width : 250,
141                                     xns : Roo.form,
142                                     name : 'ipshead_name'
143                                 },
144                                 {
145                                     '|xns' : 'Roo.form',
146                                     fieldLabel : 'Description',
147                                     xtype : 'TextArea',
148                                     width : 250,
149                                     xns : Roo.form,
150                                     name : 'ipshead_descrip',
151                                     height : 80
152                                 },
153                                 {
154                                     store : {
155                                         proxy : {
156                                             '|xns' : 'Roo.data',
157                                             url : baseURL + '/Roo/curr_symbol.php',
158                                             xtype : 'HttpProxy',
159                                             method : 'GET',
160                                             xns : Roo.data
161                                         },
162                                         reader : {
163                                             '|xns' : 'Roo.data',
164                                             id : 'id',
165                                             root : 'data',
166                                             xtype : 'JsonReader',
167                                             xns : Roo.data,
168                                             fields : [{"name":"id","type":"int"},{"name":"curr_name","type":"string"}],
169                                             totalProperty : 'total'
170                                         },
171                                         '|xns' : 'Roo.data',
172                                         xtype : 'Store',
173                                         remoteSort : true,
174                                         xns : Roo.data,
175                                         sortInfo : { direction : 'ASC', field: 'id' },
176                                         listeners : {
177                                                 beforeload : function (_self, o){
178                                                        o.params = o.params || {};
179                                                        // set more here
180                                                    }
181                                         },
182                                         items : [
183
184                                         ]
185
186                                     },
187                                     '|xns' : 'Roo.form',
188                                     listWidth : 250,
189                                     triggerAction : 'all',
190                                     fieldLabel : 'Currency',
191                                     forceSelection : true,
192                                     selectOnFocus : true,
193                                     pageSize : 20,
194                                     displayField : 'curr_name',
195                                     emptyText : "Select currency",
196                                     hiddenName : 'ipshead_curr_id',
197                                     minChars : 2,
198                                     valueField : 'curr_id',
199                                     xtype : 'ComboBox',
200                                     allowBlank : false,
201                                     typeAhead : true,
202                                     editable : false,
203                                     width : 250,
204                                     xns : Roo.form,
205                                     name : 'ipshead_curr_id_curr_name',
206                                     qtip : "Select curr_symbol",
207                                     queryParam : 'query[curr_name]',
208                                     tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{curr_name}</b> </div>',
209                                     loadingText : "Searching...",
210                                     items : [
211
212                                     ]
213
214                                 },
215                                 {
216                                     '|xns' : 'Roo.form',
217                                     fieldLabel : 'Effective',
218                                     format : 'd/M/Y',
219                                     xtype : 'DateField',
220                                     useIso : true,
221                                     allowBlank : false,
222                                     width : 250,
223                                     xns : Roo.form,
224                                     altFormats : 'Y-m-d',
225                                     name : 'ipshead_effective'
226                                 },
227                                 {
228                                     '|xns' : 'Roo.form',
229                                     fieldLabel : 'Expires',
230                                     format : 'd/M/Y',
231                                     xtype : 'DateField',
232                                     useIso : true,
233                                     allowBlank : false,
234                                     width : 250,
235                                     xns : Roo.form,
236                                     altFormats : 'Y-m-d',
237                                     name : 'ipshead_expires'
238                                 },
239                                 {
240                                     '|xns' : 'Roo.form',
241                                     name : 'ipshead_id',
242                                     xtype : 'Hidden',
243                                     xns : Roo.form
244                                 }
245                             ]
246
247                         }
248                     ]
249
250                 }
251             ]
252
253         });
254     }
255 };