1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
7 // register the module first
8 Pman.on('beforeload', function()
11 modKey : '001-Pman.Tab.CmsProduct',
12 module : Pman.Tab.CmsProduct,
14 parent : Pman.Tab.CmsProductMgr,
15 name : "Pman.Tab.CmsProduct",
17 permname: 'Cms.Products'
21 Pman.Tab.CmsProduct = new Roo.util.Observable({
27 add : function(parentLayout, region)
31 this.parentLayout = parentLayout;
33 this.panel = parentLayout.addxtype({
39 tableName : 'Product',
43 activate : function() {
46 _this.grid.footer.onClick('first');
57 _this.dialog = Pman.Dialog.CmsProduct;
58 if (_this.panel.active) {
59 this.footer.onClick('first');
62 rowdblclick : function (_self, rowIndex, e)
64 if (!_this.dialog) return;
65 _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
66 _this.grid.footer.onClick('first');
70 autoExpandColumn : 'description',
78 beforeload : function (_self, options)
80 if (!Pman.Tab.CmsProductCategory.panel) {
83 options.params['query[search]'] = _this.searchBox.getValue();
85 var sn = Pman.Tab.CmsProductCategory.panel.tree.getSelectionModel().getSelectedNode();
86 if (sn && !isNaN(parseInt(sn.attributes.id))) {
87 options.params.category_id = sn.attributes.id;
93 sortInfo : { field : 'name', direction: 'ASC' },
98 url : baseURL + '/Roo/Product.php'
103 totalProperty : 'total',
128 'name': 'description',
140 'name': 'category_id',
148 'name': 'vender_url',
152 'name': 'supplier_id',
159 xtype: 'PagingToolbar',
163 displayMsg : 'Displaying Product{0} - {1} of {2}',
164 emptyMsg : 'No Product found'
174 render : function (_self)
176 _this.searchBox = _self;
178 specialkey : function (_self, e)
180 if (e.getKey() == 13) {
181 _this.grid.footer.onClick( 'first' );
190 click : function (_self, e)
192 _this.grid.footer.onClick('first');
196 icon : rootURL + '/Pman/templates/images/search.gif'
202 click : function (_self, e)
204 _this.searchBox.setValue('');
205 _this.grid.footer.onClick('first');
209 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
221 if (!_this.dialog) return;
223 var sel = Pman.Tab.CmsProductCategory.panel.tree.getSelectionModel().getSelectedNode();
224 var id = (!sel || isNaN(parseInt(sel.attributes.id))) ? 0 : sel.attributes.id;
226 Roo.MessageBox.alert("Error", "Select a Category to add it to");
231 _this.dialog.show( { id : 0, category_id :id } , function(data) {
232 _this.searchBox.setValue(data.name);
233 _this.grid.footer.onClick('first');
237 cls : 'x-btn-text-icon',
239 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
245 cls : 'x-btn-text-icon',
246 icon : Roo.rootURL + 'images/default/tree/leaf.gif',
250 var s = _this.grid.getSelectionModel().getSelections();
251 if (!s.length || (s.length > 1)) {
252 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
255 if (!_this.dialog) return;
256 _this.dialog.show(s[0].data, function() {
257 _this.grid.footer.onClick('first');
267 cls : 'x-btn-text-icon',
268 icon : rootURL + '/Pman/templates/images/trash.gif',
272 Pman.genericDelete(_this, 'Product');
280 xtype: 'ColumnModel',
285 renderer : function(v,x,r) {
286 if (!r.json.images.length) {
290 return String.format('<img height="100" src="{0}/Images/Thumb/100x100/{1}/{2}">',
291 baseURL , r.json.images[0].id,r.json.images[0].filename ); }
294 xtype: 'ColumnModel',
296 dataIndex : 'category_id_title',
299 renderer : function(v) { return String.format('{0}', v); },
303 xtype: 'ColumnModel',
309 renderer : function(v) { return String.format('{0}', v); }
312 xtype: 'ColumnModel',
317 renderer : function(v) { return String.format('{0}', v); },
321 xtype: 'ColumnModel',
323 dataIndex : 'description',
324 header : 'Description',
327 renderer : function(v) { return String.format('{0}', v); }
330 xtype: 'ColumnModel',
332 dataIndex : 'visible',
336 renderer : function(v) { return String.format('{0}', v); }
341 this.layout = this.panel.layout;