Fix #5702 - Supplier contact details - extra fields
[Pman.Admin] / Pman.Dialog.AdminGeoCityEdit.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.AdminGeoCityEdit = {
8
9  _strings : {
10   '59716c97497eb9694541f7c3d37b1a4d' :"Country",
11   '3c1df4260ce594cb5594696461087f2f' :"Select Country",
12   '43ccafccb532cc57c20bc05a36aad7b7' :"Add / Edit City",
13   '4a39a1ff7adda1ac731be5bf500d0812' :"Select Division",
14   '45c10605e0a492fbe7a3eac258cd1e81' :"Time Zone",
15   '1243daf593fa297e07ab03bf06d925af' :"Searching...",
16   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
17   '25f75488c91cb6c3bab92672e479619f' :"Postal Code",
18   '49ee3087348e8d44e1feda1917443987' :"Name",
19   'c9cc8cce247e49bae79f15173ce97354' :"Save",
20   '3025cdaab2deb0bb2cd642449e570833' :"Division"
21  },
22  _named_strings : {
23   'country_name_qtip' : '3c1df4260ce594cb5594696461087f2f' /* Select Country */ ,
24   'division_id_name_qtip' : '4a39a1ff7adda1ac731be5bf500d0812' /* Select Division */ ,
25   'time_zone_fieldLabel' : '45c10605e0a492fbe7a3eac258cd1e81' /* Time Zone */ ,
26   'country_name_emptyText' : '3c1df4260ce594cb5594696461087f2f' /* Select Country */ ,
27   'postal_code_fieldLabel' : '25f75488c91cb6c3bab92672e479619f' /* Postal Code */ ,
28   'name_fieldLabel' : '49ee3087348e8d44e1feda1917443987' /* Name */ ,
29   'country_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
30   'division_id_name_emptyText' : '4a39a1ff7adda1ac731be5bf500d0812' /* Select Division */ ,
31   'division_id_name_fieldLabel' : '3025cdaab2deb0bb2cd642449e570833' /* Division */ ,
32   'division_id_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
33   'country_name_fieldLabel' : '59716c97497eb9694541f7c3d37b1a4d' /* Country */ 
34  },
35
36  dialog : false,
37  callback:  false,
38
39  show : function(data, cb)
40  {
41   if (!this.dialog) {
42    this.create();
43   }
44
45   this.callback = cb;
46   this.data = data;
47   this.dialog.show(this.data._el);
48   if (this.form) {
49    this.form.reset();
50    this.form.setValues(data);
51    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
52   }
53
54  },
55
56  create : function()
57  {
58    var _this = this;
59    this.dialog = Roo.factory({
60     xtype : 'LayoutDialog',
61     closable : false,
62     collapsible : false,
63     height : 250,
64     modal : true,
65     resizable : false,
66     title : _this._strings['43ccafccb532cc57c20bc05a36aad7b7'] /* Add / Edit City */,
67     width : 400,
68     xns : Roo,
69     '|xns' : 'Roo',
70     center : {
71      xtype : 'LayoutRegion',
72      xns : Roo,
73      '|xns' : 'Roo'
74     },
75     buttons : [
76      {
77       xtype : 'Button',
78       text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
79       listeners : {
80        click : function (_self, e)
81         {
82             _this.dialog.hide();
83         }
84       },
85       xns : Roo,
86       '|xns' : 'Roo'
87      },
88      {
89       xtype : 'Button',
90       text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
91       listeners : {
92        click : function (_self, e)
93         {
94             _this.form.doAction("submit");
95         }
96       },
97       xns : Roo,
98       '|xns' : 'Roo'
99      }
100     ],
101     items  : [
102      {
103       xtype : 'ContentPanel',
104       region : 'center',
105       xns : Roo,
106       '|xns' : 'Roo',
107       items  : [
108        {
109         xtype : 'Form',
110         labelWidth : 100,
111         method : 'POST',
112         style : 'margin:10px;',
113         url : baseURL + '/Roo/geoip_city.php',
114         listeners : {
115          actioncomplete : function(_self, action)
116           {
117               if (action.type == 'setdata') {
118                   
119                   if(_this.data.id) {
120                       this.load({ method: 'GET', params: { '_id' : _this.data.id }});
121                   }
122                   return;
123               }
124               if (action.type == 'load') {
125                   
126                   _this.dialog.el.unmask();
127                   
128                   _this.data = action.result.data;
129                   
130                   return;
131               }
132               if (action.type =='submit') {
133                   
134                   _this.dialog.el.unmask();
135                   _this.dialog.hide();
136               
137                    if (_this.callback) {
138                       _this.callback.call(_this, _this.form.getValues());
139                    }
140                    _this.form.reset();
141                    return;
142               }
143           },
144          rendered : function (form)
145           {
146               _this.form= form;
147           }
148         },
149         xns : Roo.form,
150         '|xns' : 'Roo.form',
151         items  : [
152          {
153           xtype : 'TextField',
154           allowBlank : false,
155           fieldLabel : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
156           name : 'name',
157           width : 200,
158           xns : Roo.form,
159           '|xns' : 'Roo.form'
160          },
161          {
162           xtype : 'TextField',
163           fieldLabel : _this._strings['25f75488c91cb6c3bab92672e479619f'] /* Postal Code */,
164           name : 'postal_code',
165           width : 200,
166           xns : Roo.form,
167           '|xns' : 'Roo.form'
168          },
169          {
170           xtype : 'TextField',
171           fieldLabel : _this._strings['45c10605e0a492fbe7a3eac258cd1e81'] /* Time Zone */,
172           name : 'time_zone',
173           width : 200,
174           xns : Roo.form,
175           '|xns' : 'Roo.form'
176          },
177          {
178           xtype : 'ComboBox',
179           allowBlank : false,
180           alwaysQuery : true,
181           displayField : 'lval',
182           editable : true,
183           emptyText : _this._strings['3c1df4260ce594cb5594696461087f2f'] /* Select Country */,
184           fieldLabel : _this._strings['59716c97497eb9694541f7c3d37b1a4d'] /* Country */,
185           forceSelection : true,
186           hiddenName : 'country',
187           listWidth : 400,
188           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
189           minChars : 2,
190           name : 'country_name',
191           pageSize : 20,
192           qtip : _this._strings['3c1df4260ce594cb5594696461087f2f'] /* Select Country */,
193           queryParam : 'query[name]',
194           selectOnFocus : true,
195           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{lval}</b> </div>',
196           triggerAction : 'all',
197           typeAhead : true,
198           valueField : 'lkey',
199           width : 200,
200           xns : Roo.form,
201           '|xns' : 'Roo.form',
202           store : {
203            xtype : 'Store',
204            remoteSort : true,
205            sortInfo : { direction : 'ASC', field: 'lval' },
206            listeners : {
207             beforeload : function (_self, o){
208                  o.params = o.params || {};
209                  // set more here
210                  o.params.ltype = 'c',
211                  o.params.inlang = 'en';
212                  o.is_active = 1;
213              }
214            },
215            xns : Roo.data,
216            '|xns' : 'Roo.data',
217            proxy : {
218             xtype : 'HttpProxy',
219             method : 'GET',
220             url : baseURL + '/Roo/i18n.php',
221             xns : Roo.data,
222             '|xns' : 'Roo.data'
223            },
224            reader : {
225             xtype : 'JsonReader',
226             fields : [
227                 {
228                     "name":"id",
229                     "type":"int"
230                 },
231                 {
232                     "name":"code",
233                     "type":"string"
234                 },
235                 {
236                     "name":"name",
237                     "type":"string"
238                 },
239                 {
240                     "name":"country",
241                     "type":"string"
242                 },
243                 {
244                     "name":"country_name",
245                     "type":"string"
246                 }
247             ],
248             id : 'id',
249             root : 'data',
250             totalProperty : 'total',
251             xns : Roo.data,
252             '|xns' : 'Roo.data'
253            }
254           }
255          },
256          {
257           xtype : 'ComboBox',
258           alwaysQuery : true,
259           displayField : 'name',
260           editable : true,
261           emptyText : _this._strings['4a39a1ff7adda1ac731be5bf500d0812'] /* Select Division */,
262           fieldLabel : _this._strings['3025cdaab2deb0bb2cd642449e570833'] /* Division */,
263           forceSelection : true,
264           hiddenName : 'division_id',
265           listWidth : 400,
266           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
267           minChars : 2,
268           name : 'division_id_name',
269           pageSize : 20,
270           qtip : _this._strings['4a39a1ff7adda1ac731be5bf500d0812'] /* Select Division */,
271           queryParam : 'query[name]',
272           selectOnFocus : true,
273           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>',
274           triggerAction : 'all',
275           typeAhead : true,
276           valueField : 'id',
277           width : 200,
278           listeners : {
279            beforequery : function (combo, query, forceAll, cancel, e)
280             {
281                 var country = _this.form.findField('country').getValue();
282                 
283                 if(!country.length) {
284                     Roo.MessageBox.alert('Error', 'Please select a country');
285                     return false;
286                 }
287             }
288           },
289           xns : Roo.form,
290           '|xns' : 'Roo.form',
291           store : {
292            xtype : 'Store',
293            remoteSort : true,
294            sortInfo : { direction : 'ASC', field: 'name' },
295            listeners : {
296             beforeload : function (_self, o){
297                  o.params = o.params || {};
298                  
299                  var country = _this.form.findField('country').getValue();
300                  
301                  if(!country.length) {
302                      return false;
303                  }
304                  
305                  o.params.country = country;
306              }
307            },
308            xns : Roo.data,
309            '|xns' : 'Roo.data',
310            proxy : {
311             xtype : 'HttpProxy',
312             method : 'GET',
313             url : baseURL + '/Roo/geoip_division.php',
314             xns : Roo.data,
315             '|xns' : 'Roo.data'
316            },
317            reader : {
318             xtype : 'JsonReader',
319             fields : [
320                 {
321                     "name":"id",
322                     "type":"int"
323                 },
324                 {
325                     "name":"name",
326                     "type":"string"
327                 },
328                 {
329                     "name":"country",
330                     "type":"string"
331                 },
332                 {
333                     "name":"country_name",
334                     "type":"string"
335                 }
336             ],
337             id : 'id',
338             root : 'data',
339             totalProperty : 'total',
340             xns : Roo.data,
341             '|xns' : 'Roo.data'
342            }
343           }
344          },
345          {
346           xtype : 'Hidden',
347           name : 'id',
348           xns : Roo.form,
349           '|xns' : 'Roo.form'
350          }
351         ]
352        }
353       ]
354      }
355     ]
356    });
357  }
358 };