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   '6fd3ea70e4ce522aad292a75f2e16886' :"And replace with:",
11   '8324cdec05065c4bd7d8c5effdf43edf' :"Delete this",
12   '298a183cfe4fddedd4bd17abe8aeb685' :"Merge Pulldown Option",
13   'bf8691517ce00a09186a05cd65863091' :"Select Item to Merge With",
14   '1243daf593fa297e07ab03bf06d925af' :"Searching...",
15   '68be4837f6c739877233e527a996dd00' :"Merge",
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' : '6fd3ea70e4ce522aad292a75f2e16886' /* 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         method : 'POST',
110         style : 'margin: 10px;',
111         url : baseURL + '/Roo/Core_enum.php',
112         listeners : {
113          actioncomplete : function (_self, action)
114           {
115           
116              if (action.type =='submit') {
117                  
118                    _this.dialog.hide();
119                  
120                   if (_this.callback) {
121                      _this.callback.call(_this, _this.form.getValues());
122                   }
123                   _this.form.reset();
124                   return;
125               }
126               if (action.type == 'setdata') {
127                   
128                    var title = _this.data.title  || _this.data.etype;
129                   _this.dialog.setTitle("Delete selected " + title + " and merge data with");
130                    
131                  return;
132               }
133               
134           },
135          actionfailed : function (_self, action)
136           {
137            
138               Pman.standardActionFailed(_self, action);
139           },
140          rendered : function (form)
141           {
142              _this.form = form;
143           }
144         },
145         xns : Roo.form,
146         '|xns' : 'Roo.form',
147         items  : [
148          {
149           xtype : 'TextField',
150           fieldLabel : _this._strings['8324cdec05065c4bd7d8c5effdf43edf'] /* Delete this */,
151           xns : Roo.form,
152           '|xns' : 'Roo.form'
153          },
154          {
155           xtype : 'ComboBox',
156           allowBlank : false,
157           alwaysQuery : true,
158           displayField : 'name',
159           emptyText : _this._strings['bf8691517ce00a09186a05cd65863091'] /* Select Item to Merge With */,
160           fieldLabel : _this._strings['6fd3ea70e4ce522aad292a75f2e16886'] /* And replace with: */,
161           forceSelection : true,
162           hiddenName : '_merge_id',
163           listWidth : 400,
164           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
165           minChars : 2,
166           name : '_merge_id_name',
167           pageSize : 20,
168           qtip : _this._strings['bf8691517ce00a09186a05cd65863091'] /* Select Item to Merge With */,
169           queryParam : 'query[search_begins]',
170           selectOnFocus : true,
171           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> {name}</div>',
172           triggerAction : 'all',
173           typeAhead : true,
174           valueField : 'id',
175           width : 250,
176           xns : Roo.form,
177           '|xns' : 'Roo.form',
178           store : {
179            xtype : 'Store',
180            remoteSort : true,
181            sortInfo : { direction : 'ASC', field: 'name' },
182            listeners : {
183             beforeload : function (_self, o){
184                  o.params = o.params || {};
185                  
186                  o.params['etype'] = _this.data.etype;
187                  
188                  o.params['!id'] = _this.form.findField('id').getValue();
189                  // set more here
190              }
191            },
192            xns : Roo.data,
193            '|xns' : 'Roo.data',
194            proxy : {
195             xtype : 'HttpProxy',
196             method : 'GET',
197             url : baseURL + '/Roo/Core_enum',
198             xns : Roo.data,
199             '|xns' : 'Roo.data'
200            },
201            reader : {
202             xtype : 'JsonReader',
203             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
204             id : 'id',
205             root : 'data',
206             totalProperty : 'total',
207             xns : Roo.data,
208             '|xns' : 'Roo.data'
209            }
210           }
211          },
212          {
213           xtype : 'Hidden',
214           name : 'etype',
215           xns : Roo.form,
216           '|xns' : 'Roo.form'
217          },
218          {
219           xtype : 'Hidden',
220           name : 'id',
221           xns : Roo.form,
222           '|xns' : 'Roo.form'
223          }
224         ]
225        }
226       ]
227      }
228     ]
229    });
230  }
231 };