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