PHP8
[Pman.BAdmin] / Pman.Tab.BAdminCompany.js
index 25081b6..a05e374 100644 (file)
@@ -12,11 +12,11 @@ Pman.Tab.BAdminCompany = new Roo.XComponent({
   'edefbda3a2bdd979e42d8944b7325b79' :"Companies",
   'b80bb7740288fda1f201890375a60c8f' :"id",
   'fc6f97505d89fe9277965c126744647a' :"No Companies found",
+  '694e249c3a9503141fa5ce3fb71d5477' :"<i class=\"fa fa-edit\"></i> Edit",
   '155ca6a755e25c15ad7ce45e2f638f10' :"Displaying Companies{0} - {1} of {2}",
   'fd5293a712d172f5c556a83c62d44bd6' :"<i class=\"fa fa-plus\"></i> Add",
   'ed807858fcb68abdd180481f1fcba5c5' :"<i class=\"fa fa-trash\"></i> Delete",
   'f78e208016407d8756c29673558ac14d' :"Company List",
-  'cd141800fe342ad87f3ed93fbb267ab5' :"<i class=\"fa fa-pencil\"></i> Edit",
   'a1fa27779242b4902f7ae3bdd5c6d508' :"Type",
   '9c9745a343efeacc9efe9b7222b27afb' :"Ref#",
   '49ee3087348e8d44e1feda1917443987' :"Name",
@@ -24,6 +24,10 @@ Pman.Tab.BAdminCompany = new Roo.XComponent({
   'dd7bf230fde8d4836917806aff6a6b27' :"Address",
   '9810aa2b9f44401be4bf73188ef2b67d' :"Fax"
  },
+ _named_strings : {
+  'footer_displayMsg' : '155ca6a755e25c15ad7ce45e2f638f10' /* Displaying Companies{0} - {1} of {2} */ ,
+  'footer_emptyMsg' : 'fc6f97505d89fe9277965c126744647a' /* No Companies found */ 
+ },
 
   part     :  ["BAdmin", "Company" ],
   order    : '002-Pman.Tab.BAdminCompany',
@@ -89,80 +93,104 @@ Pman.Tab.BAdminCompany = new Roo.XComponent({
          items  : [
           {
            xtype : 'NavItem',
-           style : 'float: left',
            xns : Roo.bootstrap,
            '|xns' : 'Roo.bootstrap',
            items  : [
             {
-             xtype : 'Button',
-             html : _this._strings['fd5293a712d172f5c556a83c62d44bd6'] /* <i class="fa fa-plus"></i> Add */,
-             style : 'margin: 10px;',
-             weight : 'default',
-             listeners : {
-              click : function (_self, e)
-               {
-                   Pman.Dialog.BAdminCompany.show({}, function() {
-                       if (_this.table) {
-                           _this.table.footer.onClick('first');
-                       }
-                   }); 
-               }
-             },
-             xns : Roo.bootstrap,
-             '|xns' : 'Roo.bootstrap'
-            },
-            {
-             xtype : 'Button',
-             html : _this._strings['cd141800fe342ad87f3ed93fbb267ab5'] /* <i class="fa fa-pencil"></i> Edit */,
-             style : 'margin: 10px;',
-             weight : 'default',
-             listeners : {
-              click : function (_self, e)
-               {
-                   var s = _this.grid.grid.selModel.getSelections();
-                   if (!s.length || (s.length > 1))  {
-                       Roo.bootstrap.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
-                       return;
-                   }
-                   if (!_this.dialog) {
-                       return;
-                   }
-                   _this.dialog.show(s[0].data, function() {
-                       if (_this.table) {
-                           _this.table.footer.onClick('first');
-                       }
-                   }); 
-                   
-               },
-              render : function (_self)
-               {
-                   _this.edit_btn = this;
-                   
-                   this.hide();
-               }
-             },
+             xtype : 'Element',
              xns : Roo.bootstrap,
-             '|xns' : 'Roo.bootstrap'
-            },
-            {
-             xtype : 'Button',
-             html : _this._strings['ed807858fcb68abdd180481f1fcba5c5'] /* <i class="fa fa-trash"></i> Delete */,
-             style : 'margin: 10px;',
-             weight : 'primary',
-             listeners : {
-              click : function (_self, e)
-               {
-                   Pman.genericDelete(_this.grid, 'core_company'); 
-               },
-              render : function (_self)
-               {
-                   _this.delete_btn = this;
-                   
-                   this.hide();
-               }
-             },
-             xns : Roo.bootstrap,
-             '|xns' : 'Roo.bootstrap'
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Row',
+               cls : 'roo-toolbar',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap',
+               items  : [
+                {
+                 xtype : 'Column',
+                 md : 12,
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap',
+                 items  : [
+                  {
+                   xtype : 'Button',
+                   cls : 'roo-toolbar-button',
+                   html : _this._strings['fd5293a712d172f5c556a83c62d44bd6'] /* <i class="fa fa-plus"></i> Add */,
+                   weight : 'default',
+                   listeners : {
+                    click : function (_self, e)
+                     {
+                         Pman.Dialog.BAdminCompany.show({}, function() {
+                             if (_this.table) {
+                                 _this.table.footer.onClick('first');
+                             }
+                         }); 
+                     }
+                   },
+                   xns : Roo.bootstrap,
+                   '|xns' : 'Roo.bootstrap'
+                  },
+                  {
+                   xtype : 'Button',
+                   cls : 'roo-toolbar-button',
+                   html : _this._strings['694e249c3a9503141fa5ce3fb71d5477'] /* <i class="fa fa-edit"></i> Edit */,
+                   weight : 'default',
+                   listeners : {
+                    click : function (_self, e)
+                     {
+                         var s = _this.table.getSelectionModel().getSelected();
+                             
+                         if (!s || s.data.id * 1 < 1)  {
+                             Roo.bootstrap.MessageBox.alert("Error", 'Please select a company');
+                             return;
+                         }
+                         
+                         Pman.Dialog.BAdminCompany.show({
+                             id : s.data.id
+                         }, function() {
+                             if (_this.table) {
+                                 _this.table.footer.onClick('refresh');
+                             }
+                         });
+                         
+                         
+                     },
+                    render : function (_self)
+                     {
+                         _this.edit_btn = this;
+                         
+                         this.hide();
+                     }
+                   },
+                   xns : Roo.bootstrap,
+                   '|xns' : 'Roo.bootstrap'
+                  },
+                  {
+                   xtype : 'Button',
+                   cls : 'roo-toolbar-button',
+                   html : _this._strings['ed807858fcb68abdd180481f1fcba5c5'] /* <i class="fa fa-trash"></i> Delete */,
+                   weight : 'primary',
+                   listeners : {
+                    click : function (_self, e)
+                     {
+                         Pman.genericDelete(_this.grid, 'core_company'); 
+                     },
+                    render : function (_self)
+                     {
+                         _this.delete_btn = this;
+                         
+                         this.hide();
+                     }
+                   },
+                   xns : Roo.bootstrap,
+                   '|xns' : 'Roo.bootstrap'
+                  }
+                 ]
+                }
+               ]
+              }
+             ]
             }
            ]
           }
@@ -175,7 +203,6 @@ Pman.Tab.BAdminCompany = new Roo.XComponent({
        cls : 'table-fixed',
        hover : true,
        loadMask : true,
-       responsive : true,
        rowSelection : true,
        striped : false,
        listeners : {
@@ -183,6 +210,25 @@ Pman.Tab.BAdminCompany = new Roo.XComponent({
          {
              _this.table = this;
          },
+        rowclick : function (_self, el, rowIndex, e)
+         {
+             (function(){
+                 
+                 _this.edit_btn.hide();
+                 _this.delete_btn.hide();
+                 
+                 var s = _this.table.getSelectionModel().getSelected();
+                 
+                 if (!s || s.data.id * 1 < 1)  {
+                     return;
+                 }
+                 
+                 _this.edit_btn.show();
+                 _this.delete_btn.show();
+                 
+             }).defer(100);
+             
+         },
         rowdblclick : function (_self, el, rowIndex, e)
          {
              var s = _this.table.store.getAt(rowIndex);
@@ -195,7 +241,7 @@ Pman.Tab.BAdminCompany = new Roo.XComponent({
                  id : s.data.id
              }, function() {
                  if (_this.table) {
-                     _this.table.footer.onClick('first');
+                     _this.table.footer.onClick('refresh');
                  }
              });
          }
@@ -224,6 +270,21 @@ Pman.Tab.BAdminCompany = new Roo.XComponent({
         loadMask : true,
         rowSelection : true,
         striped : true,
+        listeners : {
+         beforeload : function (_self, options)
+          {
+               if (!Pman.buildCompleted) {
+                  return false;
+              }
+              
+              options.params = options.params || {};
+          },
+         load : function (_self, records, options)
+          {
+              _this.delete_btn.hide();
+              _this.edit_btn.hide();
+          }
+        },
         xns : Roo.data,
         '|xns' : 'Roo.data',
         proxy : {
@@ -248,6 +309,12 @@ Pman.Tab.BAdminCompany = new Roo.XComponent({
          '|xns' : 'Roo.data'
         }
        },
+       sm : {
+        xtype : 'RowSelectionModel',
+        singleSelect : true,
+        xns : Roo.bootstrap.Table,
+        '|xns' : 'Roo.bootstrap.Table'
+       },
        cm : [
         {
          xtype : 'ColumnModel',