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