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