Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleLocation.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.XtupleLocation = {
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 : 200,
36             modal : true,
37             resizable : false,
38             title : "Edit / Create location",
39             width : 500,
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                                  
54                                         if (_this.data.location_id) {
55                                             this.load({ method: 'GET', params: { '_id' : _this.data.location_id }});
56                                         }
57                                         
58                                        return;
59                                     }
60                                     if (action.type == 'load') {
61                                  
62                                         return;
63                                     }
64                                     if (action.type =='submit') {
65                                     
66                                  
67                                         _this.dialog.hide();
68                                     
69                                          if (_this.callback) {
70                                             _this.callback.call(_this, _this.form.getValues());
71                                          }
72                                          _this.form.reset();
73                                          return;
74                                     }
75                                 },
76                                 rendered : function (form)
77                                 {
78                                     _this.form= form;
79                                 }
80                             },
81                             method : 'POST',
82                             style : 'margin:10px;',
83                             url : baseURL + '/Roo/location.php',
84                             items : [
85                                 {
86                                     xtype: 'TextField',
87                                     xns: Roo.form,
88                                     fieldLabel : 'Name',
89                                     name : 'location_name',
90                                     width : 300
91                                 },
92                                 {
93                                     xtype: 'TextField',
94                                     xns: Roo.form,
95                                     fieldLabel : 'Description',
96                                     name : 'location_descrip',
97                                     width : 300
98                                 },
99                                 {
100                                     xtype: 'ComboBox',
101                                     xns: Roo.form,
102                                     allowBlank : false,
103                                     displayField : 'cust_name',
104                                     editable : true,
105                                     emptyText : "Select custinfo",
106                                     fieldLabel : 'Customer',
107                                     forceSelection : true,
108                                     hiddenName : 'location_cust_id',
109                                     listWidth : 400,
110                                     loadingText : "Searching...",
111                                     minChars : 2,
112                                     name : 'location_cust_id_cust_name',
113                                     pageSize : 20,
114                                     qtip : "Select custinfo",
115                                     queryParam : 'query[cust_name]',
116                                     selectOnFocus : true,
117                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{cust_name}</b> ({cust_number}) </div>',
118                                     triggerAction : 'all',
119                                     valueField : 'cust_id',
120                                     width : 300,
121                                     store : {
122                                         xtype: 'Store',
123                                         xns: Roo.data,
124                                         listeners : {
125                                             beforeload : function (_self, o){
126                                                 o.params = o.params || {};
127                                                 // set more here
128                                             }
129                                         },
130                                         remoteSort : true,
131                                         sortInfo : { direction : 'ASC', field: 'cust_name' },
132                                         proxy : {
133                                             xtype: 'HttpProxy',
134                                             xns: Roo.data,
135                                             method : 'GET',
136                                             url : baseURL + '/Roo/custinfo.php'
137                                         },
138                                         reader : {
139                                             xtype: 'JsonReader',
140                                             xns: Roo.data,
141                                             id : 'id',
142                                             root : 'data',
143                                             totalProperty : 'total',
144                                             fields : [{"name":"id","type":"int"},{"name":"cust_name","type":"string"}]
145                                         }
146                                     }
147                                 },
148                                 {
149                                     xtype: 'Hidden',
150                                     xns: Roo.form,
151                                     name : 'location_id'
152                                 }
153                             ]
154                         }
155                     ]
156                 }
157             ],
158             center : {
159                 xtype: 'LayoutRegion',
160                 xns: Roo
161             },
162             buttons : [
163                 {
164                     xtype: 'Button',
165                     xns: Roo,
166                     listeners : {
167                         click : function (_self, e)
168                         {
169                             _this.dialog.hide();
170                         }
171                     },
172                     text : "Cancel"
173                 },
174                 {
175                     xtype: 'Button',
176                     xns: Roo,
177                     listeners : {
178                         click : function (_self, e)
179                         {
180                             // do some checks?
181                              
182                             
183                          
184                             _this.form.doAction("submit");
185                         
186                         }
187                     },
188                     text : "Save"
189                 }
190             ]
191         });
192     }
193 };