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