PHP8
[Pman.BAdmin] / Pman.Dialog.BAdminCompany.js
index 4022178..a71bbe8 100644 (file)
@@ -11,17 +11,27 @@ Roo.apply(Pman.Dialog.BAdminCompany.prototype, {
   '1c76cbfe21c6f44c1d1e59d54f3e4420' :"Company",
   'ce8ae9da5b7cd6c3df2929543a9af92d' :"Email",
   '231bc72756b5e6de492aaaa1577f61b1' :"Remarks",
-  'b999e07cf80ea5eca8e589cd8540a81e' :"Select Logo",
   '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... */ ,
+  'code_fieldLabel' : 'ca0dbad92a874b2f69b549293387925e' /* Code */ ,
+  'name_fieldLabel' : '1c76cbfe21c6f44c1d1e59d54f3e4420' /* Company */ ,
+  'remarks_fieldLabel' : '231bc72756b5e6de492aaaa1577f61b1' /* Remarks */ ,
+  'url_fieldLabel' : 'e6b391a8d2c4d45902a23a8b6585703d' /* URL */ ,
+  'email_fieldLabel' : 'ce8ae9da5b7cd6c3df2929543a9af92d' /* Email */ ,
+  'address_fieldLabel' : 'dd7bf230fde8d4836917806aff6a6b27' /* Address */ ,
+  'comptype_display_name_fieldLabel' : 'a1fa27779242b4902f7ae3bdd5c6d508' /* Type */ 
+ },
 
  dialog : false,
  callback:  false,
@@ -48,12 +58,21 @@ Roo.apply(Pman.Dialog.BAdminCompany.prototype, {
   var _this = this;
   this.dialog = Roo.factory({
     xtype : 'Modal',
-    fitwindow : true,
-    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,
@@ -62,8 +81,7 @@ Roo.apply(Pman.Dialog.BAdminCompany.prototype, {
      {
       xtype : 'Button',
       html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
-      style : 'float: right; margin: 10px;',
-      weight : 'danger',
+      weight : 'default',
       listeners : {
        click : function (_self, e)
         {
@@ -76,7 +94,6 @@ Roo.apply(Pman.Dialog.BAdminCompany.prototype, {
      {
       xtype : 'Button',
       html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
-      style : 'float: right; margin: 10px; width: 70px;',
       weight : 'primary',
       listeners : {
        click : function (_self, e)
@@ -102,11 +119,9 @@ Roo.apply(Pman.Dialog.BAdminCompany.prototype, {
                 success : function(res) {
                    
                     // Adding new record
-                    _this.form.method = 'POST';
                     _this.form.doAction("submit");
                 },
                 failure : function(res) {
-                   _this.form.method = 'POST';
                    _this.form.doAction("submit");
                 }
             });
@@ -125,272 +140,290 @@ Roo.apply(Pman.Dialog.BAdminCompany.prototype, {
     ],
     items  : [
      {
-      xtype : 'Row',
-      cls : 'col-md-12',
+      xtype : 'Container',
+      style : 'width: 100%;',
       xns : Roo.bootstrap,
       '|xns' : 'Roo.bootstrap',
       items  : [
        {
-        xtype : 'Column',
-        xs : 6,
+        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 : 'Form',
-          url : baseURL + '/Roo/Core_company.php',
-          listeners : {
-           actioncomplete : function (_self, action)
-            {
-                if(action.type == 'setdata'){
-                    _self.reset(); 
-                    _this.img_upload_form.reset();
-                    if(_this.data.id * 1 > 0) {
-                        this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
-                        _this.modal.setTitle('Modify Company');
-                        _this.onid.setValue(_this.data.id);
-                        
-                        if(_this.data.logo_id * 1 > 0) {
-                            _this.logo.el.dom.src = String.format('{0}/Images/Thumb/300/{1}/', baseURL, _this.data.logo_id); 
-                        }
-                    } else {
-                       _this.modal.setTitle('Add Company');
-                       _this.onid.setValue(''); 
-                       _this.logo.el.dom.src = ''; 
-                    }
-                    //_this.type.store.load({}); 
-            
-                    _this.ontable.setValue('core_company');
-            
-                    _this.imgtype.setValue('LOGO');
-                    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();
-                   
-                    if(_this.logo.getValue()!='') 
-                    {
-                        _this.img_upload_form.method = 'POST';
-                        _this.img_upload_form.doAction("submit");
-                    }
-                   
-                    //if (_this.callback) {
-                    //    _this.callback.call(this, action.result.data);
-                    //}
-                    return; 
-                }
-            },
-           actionfailed : function (_self, action)
-            {
-                //Pman.standardActionFailed(_self,action);
-                            
-                 Roo.bootstrap.MessageBox.alert(action.result.errorMsg);
-            
-            },
-           render : function (_self)
-            {
-                _this.form = _self; 
-            }
-          },
+          xtype : 'Row',
           xns : Roo.bootstrap,
           '|xns' : 'Roo.bootstrap',
           items  : [
            {
-            xtype : 'Input',
-            inputType : 'hidden',
-            name : 'id',
-            listeners : {
-             render : function (_self)
-              {
-                  _this.companyID = _self;
-              }
-            },
-            xns : Roo.bootstrap,
-            '|xns' : 'Roo.bootstrap'
-           },
-           {
-            xtype : 'ComboBox',
-            allowBlank : false,
-            alwaysQuery : true,
-            displayField : 'display_name',
-            editable : false,
-            fieldLabel : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'] /* Type */,
-            hiddenName : 'comptype',
-            labelAlign : 'left',
-            listWidth : 250,
-            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({});
-              }
-            },
+            xtype : 'Column',
+            md : 12,
             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'
+            items  : [
+             {
+              xtype : 'Input',
+              fieldLabel : _this._strings['ca0dbad92a874b2f69b549293387925e'] /* Code */,
+              indicatorpos : 'left',
+              name : 'code',
+              listeners : {
+               render : function (_self)
+                {
+                    _this.company = _self;
+                }
+              },
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap'
              }
-            }
-           },
-           {
-            xtype : 'Input',
-            fieldLabel : _this._strings['1c76cbfe21c6f44c1d1e59d54f3e4420'] /* Company */,
-            labelAlign : 'left',
-            name : 'name',
-            listeners : {
-             render : function (_self)
-              {
-                  _this.company = _self;
-              }
-            },
-            xns : Roo.bootstrap,
-            '|xns' : 'Roo.bootstrap'
-           },
+            ]
+           }
+          ]
+         },
+         {
+          xtype : 'Row',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
            {
-            xtype : 'Input',
-            fieldLabel : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
-            labelAlign : 'left',
-            name : 'tel',
-            listeners : {
-             render : function (_self)
-              {
-                  _this.tel = _self;
-              }
-            },
+            xtype : 'Column',
+            md : 12,
             xns : Roo.bootstrap,
-            '|xns' : 'Roo.bootstrap'
-           },
-           {
-            xtype : 'Input',
-            fieldLabel : _this._strings['9810aa2b9f44401be4bf73188ef2b67d'] /* Fax */,
-            labelAlign : 'left',
-            name : 'fax',
-            listeners : {
-             render : function (_self)
-              {
-                  _this.fax = _self;
+            '|xns' : 'Roo.bootstrap',
+            items  : [
+             {
+              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',
+              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'
+               }
               }
-            },
-            xns : Roo.bootstrap,
-            '|xns' : 'Roo.bootstrap'
-           },
+             }
+            ]
+           }
+          ]
+         },
+         {
+          xtype : 'Row',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
            {
-            xtype : 'Input',
-            fieldLabel : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
-            labelAlign : 'left',
-            name : 'email',
-            listeners : {
-             render : function (_self)
-              {
-                  _this.fax = _self;
-              }
-            },
+            xtype : 'Column',
+            md : 12,
             xns : Roo.bootstrap,
-            '|xns' : 'Roo.bootstrap'
-           },
+            '|xns' : 'Roo.bootstrap',
+            items  : [
+             {
+              xtype : 'Input',
+              fieldLabel : _this._strings['1c76cbfe21c6f44c1d1e59d54f3e4420'] /* Company */,
+              indicatorpos : 'left',
+              name : 'name',
+              listeners : {
+               render : function (_self)
+                {
+                    _this.company = _self;
+                }
+              },
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap'
+             }
+            ]
+           }
+          ]
+         },
+         {
+          xtype : 'Row',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
            {
-            xtype : 'Input',
-            fieldLabel : _this._strings['e6b391a8d2c4d45902a23a8b6585703d'] /* URL */,
-            labelAlign : 'left',
-            name : 'url',
-            listeners : {
-             render : function (_self)
-              {
-                  _this.url = _self;
-              }
-            },
+            xtype : 'Column',
+            md : 12,
             xns : Roo.bootstrap,
-            '|xns' : 'Roo.bootstrap'
-           },
+            '|xns' : 'Roo.bootstrap',
+            items  : [
+             {
+              xtype : 'Input',
+              fieldLabel : _this._strings['dd7bf230fde8d4836917806aff6a6b27'] /* Address */,
+              indicatorpos : 'left',
+              name : 'address',
+              listeners : {
+               render : function (_self)
+                {
+                    _this.address = _self;
+                }
+              },
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap'
+             }
+            ]
+           }
+          ]
+         },
+         {
+          xtype : 'Row',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
            {
-            xtype : 'Input',
-            fieldLabel : _this._strings['dd7bf230fde8d4836917806aff6a6b27'] /* Address */,
-            labelAlign : 'left',
-            name : 'address',
-            listeners : {
-             render : function (_self)
-              {
-                  _this.address = _self;
-              }
-            },
+            xtype : 'Column',
+            md : 12,
             xns : Roo.bootstrap,
-            '|xns' : 'Roo.bootstrap'
-           },
+            '|xns' : 'Roo.bootstrap',
+            items  : [
+             {
+              xtype : 'Input',
+              fieldLabel : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
+              indicatorpos : 'left',
+              name : 'tel',
+              listeners : {
+               render : function (_self)
+                {
+                    _this.tel = _self;
+                }
+              },
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap'
+             }
+            ]
+           }
+          ]
+         },
+         {
+          xtype : 'Row',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
            {
-            xtype : 'TextArea',
-            fieldLabel : _this._strings['231bc72756b5e6de492aaaa1577f61b1'] /* Remarks */,
-            labelAlign : 'left',
-            name : 'remarks',
-            listeners : {
-             render : function (_self)
-              {
-                  _this.remarks = _self;
-              }
-            },
+            xtype : 'Column',
+            md : 12,
             xns : Roo.bootstrap,
-            '|xns' : 'Roo.bootstrap'
+            '|xns' : 'Roo.bootstrap',
+            items  : [
+             {
+              xtype : 'Input',
+              fieldLabel : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
+              indicatorpos : 'left',
+              name : 'email',
+              listeners : {
+               render : function (_self)
+                {
+                    _this.fax = _self;
+                }
+              },
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap'
+             }
+            ]
            }
           ]
-         }
-        ]
-       },
-       {
-        xtype : 'Column',
-        xs : 6,
-        xns : Roo.bootstrap,
-        '|xns' : 'Roo.bootstrap',
-        items  : [
+         },
          {
           xtype : 'Row',
           xns : Roo.bootstrap,
@@ -398,17 +431,19 @@ Roo.apply(Pman.Dialog.BAdminCompany.prototype, {
           items  : [
            {
             xtype : 'Column',
+            md : 12,
             xns : Roo.bootstrap,
             '|xns' : 'Roo.bootstrap',
             items  : [
              {
-              xtype : 'Img',
-              imgResponsive : true,
-              style : 'text-align: center; margin-left: auto; margin-right: auto; ',
+              xtype : 'Input',
+              fieldLabel : _this._strings['e6b391a8d2c4d45902a23a8b6585703d'] /* URL */,
+              indicatorpos : 'left',
+              name : 'url',
               listeners : {
                render : function (_self)
                 {
-                    _this.logo = _self;
+                    _this.url = _self;
                 }
               },
               xns : Roo.bootstrap,
@@ -420,135 +455,50 @@ Roo.apply(Pman.Dialog.BAdminCompany.prototype, {
          },
          {
           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 : 'Form',
-              fileUpload : true,
-              method : 'POST',
-              style : 'margin:15px;',
-              url : baseURL + '/Roo/Images.php',
+              xtype : 'TextArea',
+              fieldLabel : _this._strings['231bc72756b5e6de492aaaa1577f61b1'] /* Remarks */,
+              indicatorpos : 'left',
+              name : 'remarks',
               listeners : {
-               actioncomplete : function (_self, action)
-                {
-                    if(action.type == 'setdata'){
-                        _self.reset(); 
-                        if(_this.data.id * 1 > 0) {
-                            _this.onid.setValue(_this.data.id);
-                            _this.ontable.setValue('coba_company');
-                        }        
-                        return;
-                    }
-                    
-                   if (action.type == 'submit') { // only submitted here if we are 
-                       //_this.dialog.hide();
-                        if (_this.callback) {
-                            _this.callback.call(this, action.result.data);
-                            
-                            console.log(action.result.data);
-                        }
-                        return;
-                    }
-                },
-               actionfailed : function (_self, action)
-                {
-                
-                },
                render : function (_self)
                 {
-                    _this.img_upload_form = _self;
+                    _this.remarks = _self;
                 }
               },
               xns : Roo.bootstrap,
-              '|xns' : 'Roo.bootstrap',
-              items  : [
-               {
-                xtype : 'Input',
-                allowBlank : false,
-                fieldLabel : _this._strings['b999e07cf80ea5eca8e589cd8540a81e'] /* Select Logo */,
-                forceFeedback : true,
-                inputType : 'file',
-                listeners : { 
-                       'change' : function(e) { 
-                            console.log(e);     
-                       }
-                },
-                name : 'imageUpload',
-                listeners : {
-                 change : function (_self, newValue, oldValue)
-                  { 
-                      console.log(newValue);
-                  }
-                },
-                xns : Roo.bootstrap,
-                '|xns' : 'Roo.bootstrap'
-               },
-               {
-                xtype : 'Input',
-                inputType : 'input',
-                name : 'onid',
-                listeners : {
-                 render : function (_self)
-                  {
-                      _this.onid = _self;
-                  }
-                },
-                xns : Roo.bootstrap,
-                '|xns' : 'Roo.bootstrap'
-               },
-               {
-                xtype : 'Input',
-                inputType : 'input',
-                name : 'ontable',
-                listeners : {
-                 render : function (_self)
-                  {
-                      _this.ontable = _self;
-                  }
-                },
-                xns : Roo.bootstrap,
-                '|xns' : 'Roo.bootstrap'
-               },
-               {
-                xtype : 'Input',
-                inputType : 'input',
-                name : 'imgtype',
-                listeners : {
-                 render : function (_self)
-                  {
-                      _this.imgtype = _self;
-                  }
-                },
-                xns : Roo.bootstrap,
-                '|xns' : 'Roo.bootstrap'
-               }
-              ]
+              '|xns' : 'Roo.bootstrap'
              }
             ]
            }
           ]
+         },
+         {
+          xtype : 'Input',
+          inputType : 'hidden',
+          name : 'id',
+          listeners : {
+           render : function (_self)
+            {
+                _this.companyID = _self;
+            }
+          },
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap'
          }
         ]
        }
       ]
-     },
-     {
-      xtype : 'Row',
-      xns : Roo.bootstrap,
-      '|xns' : 'Roo.bootstrap',
-      items  : [
-       {
-        xtype : 'Column',
-        xns : Roo.bootstrap,
-        '|xns' : 'Roo.bootstrap'
-       }
-      ]
      }
     ]
    }  );