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   'd928853fb4dfe148595cef31a72d52f5' :"Merge Company",
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['d928853fb4dfe148595cef31a72d52f5'] /* Merge Company */,
49     width : 400,
50     listeners : {
51      show : function (_self)
52       {
53           
54       }
55     },
56     xns : Roo,
57     '|xns' : 'Roo',
58     center : {
59      xtype : 'LayoutRegion',
60      xns : Roo,
61      '|xns' : 'Roo'
62     },
63     buttons : [
64      {
65       xtype : 'Button',
66       text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
67       listeners : {
68        click : function (_self, e)
69         {
70             _this.dialog.hide();
71         }
72       },
73       xns : Roo,
74       '|xns' : 'Roo'
75      },
76      {
77       xtype : 'Button',
78       text : _this._strings['68be4837f6c739877233e527a996dd00'] /* Merge */,
79       listeners : {
80        click : function (_self, e)
81         {
82              
83             _this.form.doAction("submit");
84         
85         }
86       },
87       xns : Roo,
88       '|xns' : 'Roo'
89      }
90     ],
91     items  : [
92      {
93       xtype : 'ContentPanel',
94       region : 'center',
95       xns : Roo,
96       '|xns' : 'Roo',
97       items  : [
98        {
99         xtype : 'Form',
100         method : 'POST',
101         style : 'margin: 10px;',
102         url : baseURL + '/Roo/Core_company.php',
103         listeners : {
104          actioncomplete : function (_self, action)
105           {
106           
107              if (action.type =='submit') {
108                  
109                    _this.dialog.hide();
110                  
111                   if (_this.callback) {
112                      _this.callback.call(_this, _this.form.getValues());
113                   }
114                   _this.form.reset();
115                   return;
116               }
117               
118               if (action.type == 'setdata') {
119                   
120                    var title = _this.data.title  || _this.data.etype;
121                   _this.dialog.setTitle("Delete selected " + title + " and merge data with");
122                    
123                  return;
124               }
125               
126           },
127          actionfailed : function (_self, action)
128           {
129            
130               Pman.standardActionFailed(_self, action);
131           },
132          rendered : function (form)
133           {
134              _this.form = form;
135           }
136         },
137         xns : Roo.form,
138         '|xns' : 'Roo.form',
139         items  : [
140          {
141           xtype : 'ComboBox',
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           store : {
165            xtype : 'Store',
166            remoteSort : true,
167            sortInfo : { direction : 'ASC', field: 'name' },
168            listeners : {
169             beforeload : function (_self, o){
170                  o.params = o.params || {};
171                  
172                  o.params['etype'] = _this.data.etype;
173                  
174                  o.params['!id'] = _this.form.findField('id').getValue();
175                  // set more here
176              }
177            },
178            xns : Roo.data,
179            '|xns' : 'Roo.data',
180            proxy : {
181             xtype : 'HttpProxy',
182             method : 'GET',
183             url : baseURL + '/Roo/Core_enum',
184             xns : Roo.data,
185             '|xns' : 'Roo.data'
186            },
187            reader : {
188             xtype : 'JsonReader',
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            }
196           }
197          },
198          {
199           xtype : 'Hidden',
200           name : 'etype',
201           xns : Roo.form,
202           '|xns' : 'Roo.form'
203          },
204          {
205           xtype : 'Hidden',
206           name : 'id',
207           xns : Roo.form,
208           '|xns' : 'Roo.form'
209          }
210         ]
211        }
212       ]
213      }
214     ]
215    });
216  }
217 };