Pman.Dialog.CoreEnumMerge.bjs
[Pman.Core] / Pman.Dialog.CoreEnumMerge.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.CoreEnumMerge = {
8
9  _strings : {
10   '8324cdec05065c4bd7d8c5effdf43edf' :"Delete this",
11   '298a183cfe4fddedd4bd17abe8aeb685' :"Merge Pulldown Option",
12   'bf8691517ce00a09186a05cd65863091' :"Select Item to Merge With",
13   '1243daf593fa297e07ab03bf06d925af' :"Searching...",
14   '68be4837f6c739877233e527a996dd00' :"Merge",
15   '266459bee8ed1ca2e0464899e1ef0994' :"And replace with",
16   'ea4788705e6873b424c65e91c2846b19' :"Cancel"
17  },
18  _named_strings : {
19   '_merge_id_name_emptyText' : 'bf8691517ce00a09186a05cd65863091' /* Select Item to Merge With */ ,
20   '_merge_id_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
21   '_merge_id_name_qtip' : 'bf8691517ce00a09186a05cd65863091' /* Select Item to Merge With */ ,
22   '_merge_id_name_fieldLabel' : '266459bee8ed1ca2e0464899e1ef0994' /* And replace with */ ,
23   '_names_fieldLabel' : '8324cdec05065c4bd7d8c5effdf43edf' /* Delete this */ 
24  },
25
26  dialog : false,
27  callback:  false,
28
29  show : function(data, cb)
30  {
31   if (!this.dialog) {
32    this.create();
33   }
34
35   this.callback = cb;
36   this.data = data;
37   this.dialog.show(this.data._el);
38   if (this.form) {
39    this.form.reset();
40    this.form.setValues(data);
41    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
42   }
43
44  },
45
46  create : function()
47  {
48    var _this = this;
49    this.dialog = Roo.factory({
50     xtype : 'LayoutDialog',
51     closable : false,
52     collapsible : false,
53     height : 160,
54     modal : true,
55     resizable : false,
56     title : _this._strings['298a183cfe4fddedd4bd17abe8aeb685'] /* Merge Pulldown Option */,
57     width : 450,
58     listeners : {
59      show : function (_self)
60       {
61           if (_this.isBuilder) {
62               _this.data = { id : 2, comptype : 'SUPPLIER' }
63           }
64       }
65     },
66     xns : Roo,
67     '|xns' : 'Roo',
68     center : {
69      xtype : 'LayoutRegion',
70      xns : Roo,
71      '|xns' : 'Roo'
72     },
73     buttons : [
74      {
75       xtype : 'Button',
76       text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
77       listeners : {
78        click : function (_self, e)
79         {
80             _this.dialog.hide();
81         }
82       },
83       xns : Roo,
84       '|xns' : 'Roo'
85      },
86      {
87       xtype : 'Button',
88       text : _this._strings['68be4837f6c739877233e527a996dd00'] /* Merge */,
89       listeners : {
90        click : function (_self, e)
91         {
92              
93             _this.form.doAction("submit");
94         
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 : 120,
111         method : 'POST',
112         style : 'margin: 10px;',
113         url : baseURL + '/Roo/Core_enum.php',
114         listeners : {
115          actioncomplete : function (_self, action)
116           {
117           
118              if (action.type =='submit') {
119                  
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               if (action.type == 'setdata') {
129                   
130                    var title = _this.data.title  || _this.data.etype;
131                   _this.dialog.setTitle("Delete selected " + title + " and merge data with");
132                   _this.form.findField('_ids').setValue(_this.data._ids);
133                   _this.form.findField('_names').setValue(_this.data.countrylist);
134                    this.load({ method: 'GET', params: { '_id' : _this.data.id }});  
135                   return;
136               }
137               
138           },
139          actionfailed : function (_self, action)
140           {
141            
142               Pman.standardActionFailed(_self, action);
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           fieldLabel : _this._strings['8324cdec05065c4bd7d8c5effdf43edf'] /* Delete this */,
155           name : '_names',
156           readOnly : true,
157           width : 250,
158           xns : Roo.form,
159           '|xns' : 'Roo.form'
160          },
161          {
162           xtype : 'ComboBox',
163           allowBlank : false,
164           alwaysQuery : true,
165           displayField : 'name',
166           emptyText : _this._strings['bf8691517ce00a09186a05cd65863091'] /* Select Item to Merge With */,
167           fieldLabel : _this._strings['266459bee8ed1ca2e0464899e1ef0994'] /* And replace with */,
168           forceSelection : true,
169           hiddenName : '_merge_id',
170           listWidth : 400,
171           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
172           minChars : 2,
173           name : '_merge_id_name',
174           pageSize : 20,
175           qtip : _this._strings['bf8691517ce00a09186a05cd65863091'] /* Select Item to Merge With */,
176           queryParam : 'query[search_begins]',
177           selectOnFocus : true,
178           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> {name}</div>',
179           triggerAction : 'all',
180           typeAhead : true,
181           valueField : 'id',
182           width : 250,
183           xns : Roo.form,
184           '|xns' : 'Roo.form',
185           store : {
186            xtype : 'Store',
187            remoteSort : true,
188            sortInfo : { direction : 'ASC', field: 'name' },
189            listeners : {
190             beforeload : function (_self, o){
191                  o.params = o.params || {};
192                  
193                  o.params['etype'] = _this.data.etype;
194                  
195                  o.params['!id'] = _this.form.findField('id').getValue();
196                  // set more here
197              }
198            },
199            xns : Roo.data,
200            '|xns' : 'Roo.data',
201            proxy : {
202             xtype : 'HttpProxy',
203             method : 'GET',
204             url : baseURL + '/Roo/Core_enum',
205             xns : Roo.data,
206             '|xns' : 'Roo.data'
207            },
208            reader : {
209             xtype : 'JsonReader',
210             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
211             id : 'id',
212             root : 'data',
213             totalProperty : 'total',
214             xns : Roo.data,
215             '|xns' : 'Roo.data'
216            }
217           }
218          },
219          {
220           xtype : 'Hidden',
221           name : 'etype',
222           xns : Roo.form,
223           '|xns' : 'Roo.form'
224          },
225          {
226           xtype : 'Hidden',
227           name : '_ids',
228           xns : Roo.form,
229           '|xns' : 'Roo.form'
230          },
231          {
232           xtype : 'Hidden',
233           name : 'id',
234           xns : Roo.form,
235           '|xns' : 'Roo.form'
236          }
237         ]
238        }
239       ]
240      }
241     ]
242    });
243  }
244 };