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 : 'ComboBox',
149           allowBlank : false,
150           alwaysQuery : true,
151           displayField : 'name',
152           emptyText : _this._strings['bf8691517ce00a09186a05cd65863091'] /* Select Item to Merge With */,
153           fieldLabel : _this._strings['03e956f1dca2b4d525df03cb1899cb6f'] /* Merge with */,
154           forceSelection : true,
155           hiddenName : '_merge_id',
156           listWidth : 400,
157           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
158           minChars : 2,
159           name : '_merge_id_name',
160           pageSize : 20,
161           qtip : _this._strings['bf8691517ce00a09186a05cd65863091'] /* Select Item to Merge With */,
162           queryParam : 'query[search_begins]',
163           selectOnFocus : true,
164           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> {name}</div>',
165           triggerAction : 'all',
166           typeAhead : true,
167           valueField : 'id',
168           width : 250,
169           xns : Roo.form,
170           '|xns' : 'Roo.form',
171           store : {
172            xtype : 'Store',
173            remoteSort : true,
174            sortInfo : { direction : 'ASC', field: 'name' },
175            listeners : {
176             beforeload : function (_self, o){
177                  o.params = o.params || {};
178                  
179                  o.params['etype'] = _this.data.etype;
180                  
181                  o.params['!id'] = _this.form.findField('id').getValue();
182                  // set more here
183              }
184            },
185            xns : Roo.data,
186            '|xns' : 'Roo.data',
187            proxy : {
188             xtype : 'HttpProxy',
189             method : 'GET',
190             url : baseURL + '/Roo/Core_enum',
191             xns : Roo.data,
192             '|xns' : 'Roo.data'
193            },
194            reader : {
195             xtype : 'JsonReader',
196             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
197             id : 'id',
198             root : 'data',
199             totalProperty : 'total',
200             xns : Roo.data,
201             '|xns' : 'Roo.data'
202            }
203           }
204          },
205          {
206           xtype : 'Hidden',
207           name : 'etype',
208           xns : Roo.form,
209           '|xns' : 'Roo.form'
210          },
211          {
212           xtype : 'Hidden',
213           name : 'id',
214           xns : Roo.form,
215           '|xns' : 'Roo.form'
216          }
217         ]
218        }
219       ]
220      }
221     ]
222    });
223  }
224 };