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