Pman.Tab.AdminCompanies.bjs
[Pman.Admin] / Pman.Tab.AdminCompanies.js
index 6ae8c14..280dffa 100644 (file)
@@ -2,35 +2,19 @@
 
 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
 
-
-
-// register the module first
-Pman.on('beforeload', function()
-{
-    Pman.register({
-        modKey : '030-Pman.Tab.AdminCompanies',
-        module : Pman.Tab.AdminCompanies,
-        region : 'center',
-        parent : Pman.Tab.Admin,
-        name : "Pman.Tab.AdminCompanies",
-        disabled : false, 
-        permname: '' 
-    });
-});
-
-Pman.Tab.AdminCompanies = new Roo.util.Observable({
-
-    panel : false,
-    disabled : false,
-    parentLayout:  false,
-
-    add : function(parentLayout, region)
+Pman.Tab.AdminCompanies = new Roo.XComponent({
+    part     :  ["Admin","Companies"],
+    order    : '030-Pman.Tab.AdminCompanies',
+    region   : 'center',
+    parent   : 'Pman.Tab.Admin',
+    name     : "Pman.Tab.AdminCompanies",
+    disabled : false, 
+    permname : 'Admin.Companies', 
+    _tree : function()
     {
-
         var _this = this;
-        this.parentLayout = parentLayout;
-
-        this.panel = parentLayout.addxtype({
+        var MODULE = this;
+        return {
             xtype: 'NestedLayoutPanel',
             xns: Roo,
             region : 'center',
@@ -71,13 +55,15 @@ Pman.Tab.AdminCompanies = new Roo.util.Observable({
                                 rowdblclick : function (_self, rowIndex, e)
                                 {
                                     if (!_this.dialog) return;
-                                    _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
+                                    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
                                         _this.grid.footer.onClick('first');
                                     }); 
+                                    
+                                    
                                 },
                                 rowclick : function (_self, rowIndex, e)
                                 {
-                                  try { Pman.Tab.AdminOffice.paging.onClick('refresh'); } catch(e) {}
+                                  try { Pman.Tab.AdminOffice.grid.footer.onClick('refresh'); } catch(e) {}
                                 }
                             },
                             autoExpandColumn : 'name',
@@ -95,7 +81,9 @@ Pman.Tab.AdminCompanies = new Roo.util.Observable({
                                     beforeload : function (_self, o)
                                     {
                                        o.params = o.params || {};
-                                       o.params['query[name]'] = _this.searchBox.getValue();
+                                       try {
+                                           o.params['query[name]'] = _this.searchBox.getValue();
+                                       } catch(e) { return false; }
                                     }
                                 },
                                 remoteSort : true,
@@ -389,8 +377,8 @@ Pman.Tab.AdminCompanies = new Roo.util.Observable({
                                 xns: Roo,
                                 pageSize : 25,
                                 displayInfo : true,
-                                displayMsg : 'Displaying Companies{0} - {1} of {2}',
-                                emptyMsg : 'No Companies found'
+                                displayMsg : "Displaying Companies{0} - {1} of {2}",
+                                emptyMsg : "No Companies found"
                             },
                             toolbar : {
                                 xtype: 'Toolbar',
@@ -402,13 +390,17 @@ Pman.Tab.AdminCompanies = new Roo.util.Observable({
                                         listeners : {
                                             show : function (_self)
                                             {
-                                            _this.searchBox = _self;
+                                            
                                             },
                                             specialkey : function (_self, e)
                                             {
                                              if (e.getKey() == 13) {
                                                  _this.grid.footer.onClick( 'first' );
                                               }
+                                            },
+                                            render : function (_self)
+                                            {
+                                            _this.searchBox = _self;
                                             }
                                         }
                                     },
@@ -444,9 +436,6 @@ Pman.Tab.AdminCompanies = new Roo.util.Observable({
                                     {
                                         xtype: 'Button',
                                         xns: Roo.Toolbar,
-                                        text : "Add",
-                                        cls : 'x-btn-text-icon',
-                                        icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
                                         listeners : {
                                             click : function()
                                             {
@@ -455,7 +444,10 @@ Pman.Tab.AdminCompanies = new Roo.util.Observable({
                                                     _this.grid.footer.onClick('first');
                                                }); 
                                             }
-                                        }
+                                        },
+                                        cls : 'x-btn-text-icon',
+                                        text : "Add",
+                                        icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
                                     },
                                     {
                                         xtype: 'Button',
@@ -503,7 +495,8 @@ Pman.Tab.AdminCompanies = new Roo.util.Observable({
                                     sortable : true,
                                     width : 90,
                                     renderer : function (v,x ,r) {
-                                        return Pman.Dialog.Companies.comptypeListToString(r.data.isOwner ? 'OWNER' : v);
+                                        //return Pman.Dialog.Companies.comptypeListToString(r.data.isOwner ? 'OWNER' : v);
+                                        return v;
                                     }
                                 },
                                 {
@@ -523,7 +516,7 @@ Pman.Tab.AdminCompanies = new Roo.util.Observable({
                                     sortable : true,
                                     width : 200,
                                     renderer : function(v,x,r) {
-                                        return String.format(r.data.isOwner ? '<B>{0}</B>' : '{0}',v);    
+                                        return String.format(r.data.comptype == 'OWNER' ? '<B>{0}</B>' : '{0}',v);    
                                     }
                                 },
                                 {
@@ -582,11 +575,12 @@ Pman.Tab.AdminCompanies = new Roo.util.Observable({
                 },
                 south : {
                     xtype: 'LayoutRegion',
-                    xns: Roo
+                    xns: Roo,
+                    height : 150,
+                    split : true,
+                    titlebar : true
                 }
             }
-        });
-        this.layout = this.panel.layout;
-
+        };
     }
 });