first upload
[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 Pman.Dialog.XtuplePriceList = {
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 : 300,
36             modal : true,
37             resizable : false,
38             title : "Edit / Create Price List",
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                                 actioncomplete : function(_self,action)
51                                 {
52                                     if (action.type == 'setdata') {
53                                        //_this.dialog.el.mask("Loading");
54                                 
55                                        
56                                        if (_this.data.ipshead_id) { 
57                                            this.load({ method: 'GET', params: { '_id' : _this.data.ipshead_id }});
58                                            return;
59                                        }
60                                        this.setValues({
61                                             ipshead_effective : new Date(1970,1,1),
62                                             ipshead_expires :new Date(2100,1,1)
63                                 
64                                        });
65                                        
66                                        
67                                        return;
68                                     }
69                                     if (action.type == 'load') {
70                                         _this.dialog.el.unmask();
71                                         return;
72                                     }
73                                     if (action.type =='submit') {
74                                     
75                                         _this.dialog.el.unmask();
76                                         _this.dialog.hide();
77                                     
78                                          if (_this.callback) {
79                                             _this.callback.call(_this, _this.form.getValues());
80                                          }
81                                          _this.form.reset();
82                                          return;
83                                     }
84                                 },
85                                 rendered : function (form)
86                                 {
87                                     _this.form= form;
88                                 }
89                             },
90                             method : 'POST',
91                             style : 'margin:10px;',
92                             url : baseURL + '/Roo/ipshead.php',
93                             items : [
94                                 {
95                                     xtype: 'TextField',
96                                     xns: Roo.form,
97                                     allowBlank : false,
98                                     fieldLabel : 'Name',
99                                     name : 'ipshead_name',
100                                     width : 250
101                                 },
102                                 {
103                                     xtype: 'TextArea',
104                                     xns: Roo.form,
105                                     fieldLabel : 'Description',
106                                     height : 80,
107                                     name : 'ipshead_descrip',
108                                     width : 250
109                                 },
110                                 {
111                                     xtype: 'ComboBox',
112                                     xns: Roo.form,
113                                     allowBlank : false,
114                                     displayField : 'curr_name',
115                                     editable : false,
116                                     emptyText : "Select currency",
117                                     fieldLabel : 'Currency',
118                                     forceSelection : true,
119                                     hiddenName : 'ipshead_curr_id',
120                                     listWidth : 150,
121                                     loadingText : "Searching...",
122                                     minChars : 2,
123                                     name : 'ipshead_curr_id_curr_name',
124                                     pageSize : 20,
125                                     qtip : "Select curr_symbol",
126                                     queryParam : 'query[curr_name]',
127                                     selectOnFocus : true,
128                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{curr_name}</b> </div>',
129                                     triggerAction : 'all',
130                                     typeAhead : true,
131                                     valueField : 'curr_id',
132                                     width : 150,
133                                     store : {
134                                         xtype: 'Store',
135                                         xns: Roo.data,
136                                         remoteSort : true,
137                                         sortInfo : { direction : 'ASC', field: 'id' },
138                                         listeners : {
139                                             beforeload : function (_self, o){
140                                                 o.params = o.params || {};
141                                                 // set more here
142                                             }
143                                         },
144                                         proxy : {
145                                             xtype: 'HttpProxy',
146                                             xns: Roo.data,
147                                             method : 'GET',
148                                             url : baseURL + '/Roo/curr_symbol.php'
149                                         },
150                                         reader : {
151                                             xtype: 'JsonReader',
152                                             xns: Roo.data,
153                                             id : 'id',
154                                             root : 'data',
155                                             totalProperty : 'total',
156                                             fields : [{"name":"id","type":"int"},{"name":"curr_name","type":"string"}]
157                                         }
158                                     }
159                                 },
160                                 {
161                                     xtype: 'DateField',
162                                     xns: Roo.form,
163                                     allowBlank : false,
164                                     altFormats : 'Y-m-d',
165                                     fieldLabel : 'Effective',
166                                     format : 'd/M/Y',
167                                     name : 'ipshead_effective',
168                                     width : 150,
169                                     useIso : true
170                                 },
171                                 {
172                                     xtype: 'DateField',
173                                     xns: Roo.form,
174                                     allowBlank : false,
175                                     altFormats : 'Y-m-d',
176                                     fieldLabel : 'Expires',
177                                     format : 'd/M/Y',
178                                     name : 'ipshead_expires',
179                                     width : 150,
180                                     useIso : true
181                                 }
182                             ]
183                         }
184                     ]
185                 }
186             ],
187             center : {
188                 xtype: 'LayoutRegion',
189                 xns: Roo
190             },
191             buttons : [
192                 {
193                     xtype: 'Button',
194                     xns: Roo,
195                     listeners : {
196                         click : function (_self, e)
197                         {
198                             _this.dialog.hide();
199                         }
200                     },
201                     text : "Cancel"
202                 },
203                 {
204                     xtype: 'Button',
205                     xns: Roo,
206                     listeners : {
207                         click : function (_self, e)
208                         {
209                             // do some checks?
210                              
211                             
212                             //_this.dialog.el.mask("Saving");
213                             _this.form.doAction("submit");
214                         
215                         }
216                     },
217                     text : "Save"
218                 }
219             ]
220         });
221     }
222 };