PHP8
[Pman.BAdmin] / Pman.Dialog.BAdminCompany.js
index 2e1d56e..a71bbe8 100644 (file)
@@ -13,18 +13,18 @@ Roo.apply(Pman.Dialog.BAdminCompany.prototype, {
   '231bc72756b5e6de492aaaa1577f61b1' :"Remarks",
   '1243daf593fa297e07ab03bf06d925af' :"Searching...",
   'bcc254b55c4a1babdf1dcb82c207506b' :"Phone",
+  '66bc3ece76861852889e623217049d32' :"Edit Company Details",
   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
-  '30a47f1901469a01975f8d24bbb9f701' :"Modify Company",
+  'ca0dbad92a874b2f69b549293387925e' :"Code",
   'a1fa27779242b4902f7ae3bdd5c6d508' :"Type",
   'dd7bf230fde8d4836917806aff6a6b27' :"Address",
   'c9cc8cce247e49bae79f15173ce97354' :"Save",
-  '9810aa2b9f44401be4bf73188ef2b67d' :"Fax",
   'e6b391a8d2c4d45902a23a8b6585703d' :"URL"
  },
  _named_strings : {
   'tel_fieldLabel' : 'bcc254b55c4a1babdf1dcb82c207506b' /* Phone */ ,
   'comptype_display_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
-  'fax_fieldLabel' : '9810aa2b9f44401be4bf73188ef2b67d' /* Fax */ ,
+  'code_fieldLabel' : 'ca0dbad92a874b2f69b549293387925e' /* Code */ ,
   'name_fieldLabel' : '1c76cbfe21c6f44c1d1e59d54f3e4420' /* Company */ ,
   'remarks_fieldLabel' : '231bc72756b5e6de492aaaa1577f61b1' /* Remarks */ ,
   'url_fieldLabel' : 'e6b391a8d2c4d45902a23a8b6585703d' /* URL */ ,
@@ -58,13 +58,21 @@ Roo.apply(Pman.Dialog.BAdminCompany.prototype, {
   var _this = this;
   this.dialog = Roo.factory({
     xtype : 'Modal',
-    cls : 'enable-overflow',
-    size : 'lg',
-    title : _this._strings['30a47f1901469a01975f8d24bbb9f701'] /* Modify Company */,
+    cls : 'padding-bottom-trim badmin-dialog-company enable-modal-body-overflow',
+    max_width : 650,
+    title : _this._strings['66bc3ece76861852889e623217049d32'] /* Edit Company Details */,
     listeners : {
      render : function (_self)
       {
           _this.modal = _self;
+      },
+     show : function (_self)
+      {
+          _this.form.findField('code').hide();
+      
+          if(appDisabled.indexOf('Coba.SuperAdmin') * 1 == -1) {
+              _this.form.findField('code').show();
+          }
       }
     },
     xns : Roo.bootstrap,
@@ -138,367 +146,334 @@ Roo.apply(Pman.Dialog.BAdminCompany.prototype, {
       '|xns' : 'Roo.bootstrap',
       items  : [
        {
-        xtype : 'Row',
+        xtype : 'Form',
+        url : baseURL + '/Roo/Core_company.php',
+        listeners : {
+         actioncomplete : function (_self, action)
+          {
+              if(action.type == 'setdata'){
+                  _self.reset(); 
+          
+                  if(_this.data.id * 1 > 0) {
+                      this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
+                      _this.modal.setTitle('Edit Company Details');
+                      
+                  } else {
+                     _this.modal.setTitle('Create Company');
+                  }
+                  return;
+              }
+             
+             
+              if (action.type == 'load') {
+                  _this.data = action.result.data;
+                  
+                  if(_this.data.comptype == 'OWNER'){
+                      _this.form.findField('comptype').hide();
+                  }
+                  
+                  return;
+              }
+              
+              
+              if (action.type == 'submit') { // only submitted here if we are 
+                  //_this.dialog.hide();
+                  
+                  _this.dialog.hide();
+                  
+                   if (_this.callback) {
+                      _this.callback.call(this, action.result.data);
+                   }
+                  return; 
+              }
+          },
+         actionfailed : function (_self, action)
+          {
+              //Pman.standardActionFailed(_self,action);
+              
+              if (!this.isValid) {
+                  return;
+              }
+              
+              Roo.bootstrap.MessageBox.alert(action.result.errorMsg);
+          
+          },
+         render : function (_self)
+          {
+              _this.form = _self; 
+          }
+        },
         xns : Roo.bootstrap,
         '|xns' : 'Roo.bootstrap',
         items  : [
          {
-          xtype : 'Column',
-          xs : 12,
+          xtype : 'Row',
           xns : Roo.bootstrap,
           '|xns' : 'Roo.bootstrap',
           items  : [
            {
-            xtype : 'Form',
-            url : baseURL + '/Roo/Core_company.php',
-            listeners : {
-             actioncomplete : function (_self, action)
-              {
-                  if(action.type == 'setdata'){
-                      _self.reset(); 
-              
-                      if(_this.data.id * 1 > 0) {
-                          this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
-                          _this.modal.setTitle('Modify Company');
-                          
-                      } else {
-                         _this.modal.setTitle('Add Company');
-                      }
-                      //_this.type.store.load({}); 
-              
-                      return;
-                  }
-                 
-                 
-                  if (action.type == 'load') {
-                      _this.data = action.result.data;
-                      var meth = _this.data.comptype == 'OWNER' ? 'disable' : 'enable';
-                   
-                          
-                      if (_this.form.findField('comptype')) {
-                          _this.form.findField('comptype')[meth]();
-                      }
-                        
-                     // _this.loaded();
-                      return;
-                  }
-                  
-                  
-                  if (action.type == 'submit') { // only submitted here if we are 
-                      //_this.dialog.hide();
-                      
-                      _this.dialog.hide();
-                      
-                       if (_this.callback) {
-                          _this.callback.call(this, action.result.data);
-                       }
-                      return; 
-                  }
-              },
-             actionfailed : function (_self, action)
-              {
-                  //Pman.standardActionFailed(_self,action);
-                  
-                  if (!this.isValid) {
-                      return;
-                  }
-                  
-                  Roo.bootstrap.MessageBox.alert(action.result.errorMsg);
-              
-              },
-             render : function (_self)
-              {
-                  _this.form = _self; 
-              }
-            },
+            xtype : 'Column',
+            md : 12,
             xns : Roo.bootstrap,
             '|xns' : 'Roo.bootstrap',
             items  : [
              {
-              xtype : 'Row',
-              xns : Roo.bootstrap,
-              '|xns' : 'Roo.bootstrap',
-              items  : [
-               {
-                xtype : 'Column',
-                md : 12,
-                xns : Roo.bootstrap,
-                '|xns' : 'Roo.bootstrap',
-                items  : [
-                 {
-                  xtype : 'ComboBox',
-                  allowBlank : false,
-                  alwaysQuery : true,
-                  displayField : 'display_name',
-                  editable : false,
-                  fieldLabel : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'] /* Type */,
-                  hiddenName : 'comptype',
-                  labelAlign : 'left',
-                  labelWidth : 3,
-                  loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
-                  minChars : 2,
-                  name : 'comptype_display_name',
-                  queryParam : 'query[name]',
-                  selectOnFocus : true,
-                  triggerAction : 'all',
-                  typeAhead : false,
-                  valueField : 'name',
-                  listeners : {
-                   render : function (_self)
-                    {
-                        _this.type = _self;
-                        _self.store.load({});
-                    }
-                  },
-                  xns : Roo.bootstrap,
-                  '|xns' : 'Roo.bootstrap',
-                  store : {
-                   xtype : 'Store',
-                   remoteSort : true,
-                   sortInfo : '{ direction : \'ASC\', field: \'id\' }',
-                   listeners : {
-                    beforeload : function (_self, options)
-                     {
-                         options.params = options.params || {};
-                         // set more here
-                         //o.params['query[empty_etype]'] = 1;
-                         options.params.etype = 'COMPTYPE';
-                     }
-                   },
-                   xns : Roo.data,
-                   '|xns' : 'Roo.data',
-                   proxy : {
-                    xtype : 'HttpProxy',
-                    method : 'GET',
-                    url : baseURL + '/Roo/core_enum.php',
-                    xns : Roo.data,
-                    '|xns' : 'Roo.data'
-                   },
-                   reader : {
-                    xtype : 'JsonReader',
-                    id : 'id',
-                    root : 'data',
-                    totalProperty : 'total',
-                    xns : Roo.data,
-                    '|xns' : 'Roo.data'
-                   }
-                  }
-                 }
-                ]
-               }
-              ]
-             },
-             {
-              xtype : 'Row',
+              xtype : 'Input',
+              fieldLabel : _this._strings['ca0dbad92a874b2f69b549293387925e'] /* Code */,
+              indicatorpos : 'left',
+              name : 'code',
+              listeners : {
+               render : function (_self)
+                {
+                    _this.company = _self;
+                }
+              },
               xns : Roo.bootstrap,
-              '|xns' : 'Roo.bootstrap',
-              items  : [
-               {
-                xtype : 'Column',
-                md : 12,
-                xns : Roo.bootstrap,
-                '|xns' : 'Roo.bootstrap',
-                items  : [
-                 {
-                  xtype : 'Input',
-                  fieldLabel : _this._strings['1c76cbfe21c6f44c1d1e59d54f3e4420'] /* Company */,
-                  labelWidth : 3,
-                  name : 'name',
-                  listeners : {
-                   render : function (_self)
-                    {
-                        _this.company = _self;
-                    }
-                  },
-                  xns : Roo.bootstrap,
-                  '|xns' : 'Roo.bootstrap'
-                 }
-                ]
-               }
-              ]
-             },
+              '|xns' : 'Roo.bootstrap'
+             }
+            ]
+           }
+          ]
+         },
+         {
+          xtype : 'Row',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Column',
+            md : 12,
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            items  : [
              {
-              xtype : 'Row',
+              xtype : 'ComboBox',
+              allowBlank : false,
+              alwaysQuery : true,
+              displayField : 'display_name',
+              editable : false,
+              fieldLabel : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'] /* Type */,
+              hiddenName : 'comptype',
+              indicatorpos : 'left',
+              loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+              minChars : 2,
+              name : 'comptype_display_name',
+              queryParam : 'query[name]',
+              selectOnFocus : true,
+              triggerAction : 'all',
+              typeAhead : false,
+              valueField : 'name',
+              listeners : {
+               render : function (_self)
+                {
+                    _this.type = _self;
+                    _self.store.load({});
+                }
+              },
               xns : Roo.bootstrap,
               '|xns' : 'Roo.bootstrap',
-              items  : [
-               {
-                xtype : 'Column',
-                md : 12,
-                xns : Roo.bootstrap,
-                '|xns' : 'Roo.bootstrap',
-                items  : [
+              store : {
+               xtype : 'Store',
+               remoteSort : true,
+               sortInfo : '{ direction : \'ASC\', field: \'id\' }',
+               listeners : {
+                beforeload : function (_self, options)
                  {
-                  xtype : 'Input',
-                  fieldLabel : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
-                  labelWidth : 3,
-                  name : 'tel',
-                  listeners : {
-                   render : function (_self)
-                    {
-                        _this.tel = _self;
-                    }
-                  },
-                  xns : Roo.bootstrap,
-                  '|xns' : 'Roo.bootstrap'
+                     options.params = options.params || {};
+                     // set more here
+                     //o.params['query[empty_etype]'] = 1;
+                     options.params.etype = 'COMPTYPE';
                  }
-                ]
+               },
+               xns : Roo.data,
+               '|xns' : 'Roo.data',
+               proxy : {
+                xtype : 'HttpProxy',
+                method : 'GET',
+                url : baseURL + '/Roo/core_enum.php',
+                xns : Roo.data,
+                '|xns' : 'Roo.data'
+               },
+               reader : {
+                xtype : 'JsonReader',
+                id : 'id',
+                root : 'data',
+                totalProperty : 'total',
+                xns : Roo.data,
+                '|xns' : 'Roo.data'
                }
-              ]
-             },
+              }
+             }
+            ]
+           }
+          ]
+         },
+         {
+          xtype : 'Row',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Column',
+            md : 12,
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            items  : [
              {
-              xtype : 'Row',
+              xtype : 'Input',
+              fieldLabel : _this._strings['1c76cbfe21c6f44c1d1e59d54f3e4420'] /* Company */,
+              indicatorpos : 'left',
+              name : 'name',
+              listeners : {
+               render : function (_self)
+                {
+                    _this.company = _self;
+                }
+              },
               xns : Roo.bootstrap,
-              '|xns' : 'Roo.bootstrap',
-              items  : [
-               {
-                xtype : 'Column',
-                md : 12,
-                xns : Roo.bootstrap,
-                '|xns' : 'Roo.bootstrap',
-                items  : [
-                 {
-                  xtype : 'Input',
-                  fieldLabel : _this._strings['9810aa2b9f44401be4bf73188ef2b67d'] /* Fax */,
-                  labelWidth : 3,
-                  name : 'fax',
-                  listeners : {
-                   render : function (_self)
-                    {
-                        _this.fax = _self;
-                    }
-                  },
-                  xns : Roo.bootstrap,
-                  '|xns' : 'Roo.bootstrap'
-                 }
-                ]
-               }
-              ]
-             },
+              '|xns' : 'Roo.bootstrap'
+             }
+            ]
+           }
+          ]
+         },
+         {
+          xtype : 'Row',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Column',
+            md : 12,
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            items  : [
              {
-              xtype : 'Row',
+              xtype : 'Input',
+              fieldLabel : _this._strings['dd7bf230fde8d4836917806aff6a6b27'] /* Address */,
+              indicatorpos : 'left',
+              name : 'address',
+              listeners : {
+               render : function (_self)
+                {
+                    _this.address = _self;
+                }
+              },
               xns : Roo.bootstrap,
-              '|xns' : 'Roo.bootstrap',
-              items  : [
-               {
-                xtype : 'Column',
-                md : 12,
-                xns : Roo.bootstrap,
-                '|xns' : 'Roo.bootstrap',
-                items  : [
-                 {
-                  xtype : 'Input',
-                  fieldLabel : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
-                  labelWidth : 3,
-                  name : 'email',
-                  listeners : {
-                   render : function (_self)
-                    {
-                        _this.fax = _self;
-                    }
-                  },
-                  xns : Roo.bootstrap,
-                  '|xns' : 'Roo.bootstrap'
-                 }
-                ]
-               }
-              ]
-             },
+              '|xns' : 'Roo.bootstrap'
+             }
+            ]
+           }
+          ]
+         },
+         {
+          xtype : 'Row',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Column',
+            md : 12,
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            items  : [
              {
-              xtype : 'Row',
+              xtype : 'Input',
+              fieldLabel : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
+              indicatorpos : 'left',
+              name : 'tel',
+              listeners : {
+               render : function (_self)
+                {
+                    _this.tel = _self;
+                }
+              },
               xns : Roo.bootstrap,
-              '|xns' : 'Roo.bootstrap',
-              items  : [
-               {
-                xtype : 'Column',
-                md : 12,
-                xns : Roo.bootstrap,
-                '|xns' : 'Roo.bootstrap',
-                items  : [
-                 {
-                  xtype : 'Input',
-                  fieldLabel : _this._strings['e6b391a8d2c4d45902a23a8b6585703d'] /* URL */,
-                  labelWidth : 3,
-                  name : 'url',
-                  listeners : {
-                   render : function (_self)
-                    {
-                        _this.url = _self;
-                    }
-                  },
-                  xns : Roo.bootstrap,
-                  '|xns' : 'Roo.bootstrap'
-                 }
-                ]
-               }
-              ]
-             },
+              '|xns' : 'Roo.bootstrap'
+             }
+            ]
+           }
+          ]
+         },
+         {
+          xtype : 'Row',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Column',
+            md : 12,
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            items  : [
              {
-              xtype : 'Row',
+              xtype : 'Input',
+              fieldLabel : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
+              indicatorpos : 'left',
+              name : 'email',
+              listeners : {
+               render : function (_self)
+                {
+                    _this.fax = _self;
+                }
+              },
               xns : Roo.bootstrap,
-              '|xns' : 'Roo.bootstrap',
-              items  : [
-               {
-                xtype : 'Column',
-                md : 12,
-                xns : Roo.bootstrap,
-                '|xns' : 'Roo.bootstrap',
-                items  : [
-                 {
-                  xtype : 'Input',
-                  fieldLabel : _this._strings['dd7bf230fde8d4836917806aff6a6b27'] /* Address */,
-                  labelWidth : 3,
-                  name : 'address',
-                  listeners : {
-                   render : function (_self)
-                    {
-                        _this.address = _self;
-                    }
-                  },
-                  xns : Roo.bootstrap,
-                  '|xns' : 'Roo.bootstrap'
-                 }
-                ]
-               }
-              ]
-             },
+              '|xns' : 'Roo.bootstrap'
+             }
+            ]
+           }
+          ]
+         },
+         {
+          xtype : 'Row',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Column',
+            md : 12,
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            items  : [
              {
-              xtype : 'Row',
+              xtype : 'Input',
+              fieldLabel : _this._strings['e6b391a8d2c4d45902a23a8b6585703d'] /* URL */,
+              indicatorpos : 'left',
+              name : 'url',
+              listeners : {
+               render : function (_self)
+                {
+                    _this.url = _self;
+                }
+              },
               xns : Roo.bootstrap,
-              '|xns' : 'Roo.bootstrap',
-              items  : [
-               {
-                xtype : 'Column',
-                md : 12,
-                xns : Roo.bootstrap,
-                '|xns' : 'Roo.bootstrap',
-                items  : [
-                 {
-                  xtype : 'TextArea',
-                  fieldLabel : _this._strings['231bc72756b5e6de492aaaa1577f61b1'] /* Remarks */,
-                  labelWidth : 3,
-                  name : 'remarks',
-                  listeners : {
-                   render : function (_self)
-                    {
-                        _this.remarks = _self;
-                    }
-                  },
-                  xns : Roo.bootstrap,
-                  '|xns' : 'Roo.bootstrap'
-                 }
-                ]
-               }
-              ]
-             },
+              '|xns' : 'Roo.bootstrap'
+             }
+            ]
+           }
+          ]
+         },
+         {
+          xtype : 'Row',
+          cls : 'badmin-company-edit-remark',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Column',
+            md : 12,
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            items  : [
              {
-              xtype : 'Input',
-              inputType : 'hidden',
-              name : 'id',
+              xtype : 'TextArea',
+              fieldLabel : _this._strings['231bc72756b5e6de492aaaa1577f61b1'] /* Remarks */,
+              indicatorpos : 'left',
+              name : 'remarks',
               listeners : {
                render : function (_self)
                 {
-                    _this.companyID = _self;
+                    _this.remarks = _self;
                 }
               },
               xns : Roo.bootstrap,
@@ -507,6 +482,19 @@ Roo.apply(Pman.Dialog.BAdminCompany.prototype, {
             ]
            }
           ]
+         },
+         {
+          xtype : 'Input',
+          inputType : 'hidden',
+          name : 'id',
+          listeners : {
+           render : function (_self)
+            {
+                _this.companyID = _self;
+            }
+          },
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap'
          }
         ]
        }