Fix #5702 - Supplier contact details - extra fields
[Pman.Admin] / Pman.Dialog.AdminGeoDivisionEdit.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.AdminGeoDivisionEdit = {
8
9  _strings : {
10   '59716c97497eb9694541f7c3d37b1a4d' :"Country",
11   '3c1df4260ce594cb5594696461087f2f' :"Select Country",
12   '1243daf593fa297e07ab03bf06d925af' :"Searching...",
13   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
14   '49ee3087348e8d44e1feda1917443987' :"Name",
15   '211ffad4dcc51379ddbc8b96230a9bd9' :"Add / Edit Division",
16   'ca0dbad92a874b2f69b549293387925e' :"Code",
17   'c9cc8cce247e49bae79f15173ce97354' :"Save"
18  },
19  _named_strings : {
20   'country_name_qtip' : '3c1df4260ce594cb5594696461087f2f' /* Select Country */ ,
21   'country_name_emptyText' : '3c1df4260ce594cb5594696461087f2f' /* Select Country */ ,
22   'code_fieldLabel' : 'ca0dbad92a874b2f69b549293387925e' /* Code */ ,
23   'name_fieldLabel' : '49ee3087348e8d44e1feda1917443987' /* Name */ ,
24   'country_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
25   'country_name_fieldLabel' : '59716c97497eb9694541f7c3d37b1a4d' /* Country */ 
26  },
27
28  dialog : false,
29  callback:  false,
30
31  show : function(data, cb)
32  {
33   if (!this.dialog) {
34    this.create();
35   }
36
37   this.callback = cb;
38   this.data = data;
39   this.dialog.show(this.data._el);
40   if (this.form) {
41    this.form.reset();
42    this.form.setValues(data);
43    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
44   }
45
46  },
47
48  create : function()
49  {
50    var _this = this;
51    this.dialog = Roo.factory({
52     xtype : 'LayoutDialog',
53     closable : false,
54     collapsible : false,
55     height : 200,
56     modal : true,
57     resizable : false,
58     title : _this._strings['211ffad4dcc51379ddbc8b96230a9bd9'] /* Add / Edit Division */,
59     width : 400,
60     xns : Roo,
61     '|xns' : 'Roo',
62     center : {
63      xtype : 'LayoutRegion',
64      xns : Roo,
65      '|xns' : 'Roo'
66     },
67     buttons : [
68      {
69       xtype : 'Button',
70       text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
71       listeners : {
72        click : function (_self, e)
73         {
74             _this.dialog.hide();
75         }
76       },
77       xns : Roo,
78       '|xns' : 'Roo'
79      },
80      {
81       xtype : 'Button',
82       text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
83       listeners : {
84        click : function (_self, e)
85         {
86             _this.form.doAction("submit");
87         }
88       },
89       xns : Roo,
90       '|xns' : 'Roo'
91      }
92     ],
93     items  : [
94      {
95       xtype : 'ContentPanel',
96       region : 'center',
97       xns : Roo,
98       '|xns' : 'Roo',
99       items  : [
100        {
101         xtype : 'Form',
102         labelWidth : 100,
103         method : 'POST',
104         style : 'margin:10px;',
105         url : baseURL + '/Roo/geoip_division.php',
106         listeners : {
107          actioncomplete : function(_self, action)
108           {
109               if (action.type == 'setdata') {
110                   
111                   if(_this.data.id) {
112                       this.load({ method: 'GET', params: { '_id' : _this.data.id }});
113                   }
114                   return;
115               }
116               if (action.type == 'load') {
117                   
118                   _this.dialog.el.unmask();
119                   
120                   _this.data = action.result.data;
121                   
122                   return;
123               }
124               if (action.type =='submit') {
125                   
126                   _this.dialog.el.unmask();
127                   _this.dialog.hide();
128               
129                    if (_this.callback) {
130                       _this.callback.call(_this, _this.form.getValues());
131                    }
132                    _this.form.reset();
133                    return;
134               }
135           },
136          rendered : function (form)
137           {
138               _this.form= form;
139           }
140         },
141         xns : Roo.form,
142         '|xns' : 'Roo.form',
143         items  : [
144          {
145           xtype : 'TextField',
146           allowBlank : false,
147           fieldLabel : _this._strings['ca0dbad92a874b2f69b549293387925e'] /* Code */,
148           name : 'code',
149           width : 200,
150           xns : Roo.form,
151           '|xns' : 'Roo.form'
152          },
153          {
154           xtype : 'TextField',
155           allowBlank : false,
156           fieldLabel : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
157           name : 'name',
158           width : 200,
159           xns : Roo.form,
160           '|xns' : 'Roo.form'
161          },
162          {
163           xtype : 'ComboBox',
164           allowBlank : false,
165           alwaysQuery : true,
166           displayField : 'lval',
167           editable : true,
168           emptyText : _this._strings['3c1df4260ce594cb5594696461087f2f'] /* Select Country */,
169           fieldLabel : _this._strings['59716c97497eb9694541f7c3d37b1a4d'] /* Country */,
170           forceSelection : true,
171           hiddenName : 'country',
172           listWidth : 400,
173           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
174           minChars : 2,
175           name : 'country_name',
176           pageSize : 20,
177           qtip : _this._strings['3c1df4260ce594cb5594696461087f2f'] /* Select Country */,
178           queryParam : 'query[name]',
179           selectOnFocus : true,
180           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{lval}</b> </div>',
181           triggerAction : 'all',
182           typeAhead : true,
183           valueField : 'lkey',
184           width : 200,
185           xns : Roo.form,
186           '|xns' : 'Roo.form',
187           store : {
188            xtype : 'Store',
189            remoteSort : true,
190            sortInfo : { direction : 'ASC', field: 'lval' },
191            listeners : {
192             beforeload : function (_self, o){
193                  o.params = o.params || {};
194                  // set more here
195                  o.params.ltype = 'c',
196                  o.params.inlang = 'en';
197                  o.is_active = 1;
198              }
199            },
200            xns : Roo.data,
201            '|xns' : 'Roo.data',
202            proxy : {
203             xtype : 'HttpProxy',
204             method : 'GET',
205             url : baseURL + '/Roo/i18n.php',
206             xns : Roo.data,
207             '|xns' : 'Roo.data'
208            },
209            reader : {
210             xtype : 'JsonReader',
211             fields : [
212                 {
213                     "name":"id",
214                     "type":"int"
215                 },
216                 {
217                     "name":"code",
218                     "type":"string"
219                 },
220                 {
221                     "name":"name",
222                     "type":"string"
223                 },
224                 {
225                     "name":"country",
226                     "type":"string"
227                 },
228                 {
229                     "name":"country_name",
230                     "type":"string"
231                 }
232             ],
233             id : 'id',
234             root : 'data',
235             totalProperty : 'total',
236             xns : Roo.data,
237             '|xns' : 'Roo.data'
238            }
239           }
240          },
241          {
242           xtype : 'Hidden',
243           name : 'id',
244           xns : Roo.form,
245           '|xns' : 'Roo.form'
246          }
247         ]
248        }
249       ]
250      }
251     ]
252    });
253  }
254 };