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