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