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