Pman.Tab.AdminOffice.bjs
[Pman.Admin] / Pman.Tab.AdminOffice.js
index f60855e..75d5370 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 : '001-Pman.Tab.AdminOffice',
-        module : Pman.Tab.AdminOffice,
-        region : 'center',
-        parent : Pman.Tab.AdminCompanies,
-        name : "Pman.Tab.AdminOffice",
-        disabled : false, 
-        permname: '' 
-    });
-});
-
-Pman.Tab.AdminOffice = new Roo.util.Observable({
-
-    panel : false,
-    disabled : false,
-    parentLayout:  false,
-
-    add : function(parentLayout, region)
+Pman.Tab.AdminOffice = new Roo.XComponent({
+    part     :  ["Admin","Office"],
+    order    : '001-Pman.Tab.AdminOffice',
+    region   : 'center',
+    parent   : 'Pman.Tab.AdminCompanies',
+    name     : "Pman.Tab.AdminOffice",
+    disabled : false, 
+    permname : '', 
+    _tree : function()
     {
-
         var _this = this;
-        this.parentLayout = parentLayout;
-
-        this.panel = parentLayout.addxtype({
+        var MODULE = this;
+        return {
             xtype: 'GridPanel',
             xns: Roo,
             listeners : {
@@ -44,7 +28,7 @@ Pman.Tab.AdminOffice = new Roo.util.Observable({
             background : true,
             fitContainer : true,
             fitToframe : true,
-            region : 'center',
+            region : 'south',
             tableName : 'Office',
             title : "Offices / Departments / Sub-Companies",
             grid : {
@@ -62,7 +46,7 @@ Pman.Tab.AdminOffice = 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');
                         }); 
                     }
@@ -88,6 +72,7 @@ Pman.Tab.AdminOffice = new Roo.util.Observable({
                                 return false;
                             }
                             
+                            
                          }
                     },
                     remoteSort : true,
@@ -237,8 +222,8 @@ Pman.Tab.AdminOffice = new Roo.util.Observable({
                     xns: Roo,
                     pageSize : 25,
                     displayInfo : true,
-                    displayMsg : 'Displaying Office{0} - {1} of {2}',
-                    emptyMsg : 'No Office found'
+                    displayMsg : "Displaying Office{0} - {1} of {2}",
+                    emptyMsg : "No Office found"
                 },
                 toolbar : {
                     xtype: 'Toolbar',
@@ -252,7 +237,7 @@ Pman.Tab.AdminOffice = new Roo.util.Observable({
                                 {
                                     if (!_this.dialog) return;
                                     
-                                     var cdata = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data;
+                                    var cdata = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data;
                                     _dialog.show( { 
                                         id : 0 ,
                                         company_name : cdata.name,
@@ -263,7 +248,7 @@ Pman.Tab.AdminOffice = new Roo.util.Observable({
                                         email  : cdata.email
                                     } , function() {
                                         _this.grid.footer.onClick('first');
-                                   }); 
+                                   });
                                 }
                             },
                             cls : 'x-btn-text-icon',
@@ -273,9 +258,6 @@ Pman.Tab.AdminOffice = new Roo.util.Observable({
                         {
                             xtype: 'Button',
                             xns: Roo.Toolbar,
-                            text : "Edit",
-                            cls : 'x-btn-text-icon',
-                            icon : Roo.rootURL + 'images/default/tree/leaf.gif',
                             listeners : {
                                 click : function()
                                 {
@@ -285,12 +267,16 @@ Pman.Tab.AdminOffice = new Roo.util.Observable({
                                         return;
                                     }
                                     if (!_this.dialog) return;
+                                    s[0].data.company_name = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data.name;
                                     _this.dialog.show(s[0].data, function() {
                                         _this.grid.footer.onClick('first');
                                     }); 
                                     
                                 }
-                            }
+                            },
+                            cls : 'x-btn-text-icon',
+                            text : "Edit",
+                            icon : Roo.rootURL + 'images/default/tree/leaf.gif'
                         },
                         {
                             xtype: 'Button',
@@ -355,8 +341,6 @@ Pman.Tab.AdminOffice = new Roo.util.Observable({
                     }
                 ]
             }
-        });
-        this.layout = this.panel.layout;
-
+        };
     }
 });