PHP8
[Pman.BAdmin] / Pman.Dialog.BAdminGroups.js
index 2474bfe..34be17a 100644 (file)
@@ -9,10 +9,13 @@ Roo.apply(Pman.Dialog.BAdminGroups.prototype, {
 
  _strings : {
   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
-  'a0f852ef8bfccd86a0e7217d7959e3e8' :"Add / Edit User",
+  '106eefbc3cdf294434c52c2638ce28df' :"Add / Edit Group",
   '49ee3087348e8d44e1feda1917443987' :"Name",
   'c9cc8cce247e49bae79f15173ce97354' :"Save"
  },
+ _named_strings : {
+  'display_name_placeholder' : '49ee3087348e8d44e1feda1917443987' /* Name */ 
+ },
 
  dialog : false,
  callback:  false,
@@ -39,13 +42,8 @@ Roo.apply(Pman.Dialog.BAdminGroups.prototype, {
   var _this = this;
   this.dialog = Roo.factory({
     xtype : 'Modal',
-    title : _this._strings['a0f852ef8bfccd86a0e7217d7959e3e8'] /* Add / Edit User */,
-    listeners : {
-     render : function (_self)
-      {
-          _this.modal = _self;
-      }
-    },
+    cls : 'enable-overflow padding-bottom-trim',
+    title : _this._strings['106eefbc3cdf294434c52c2638ce28df'] /* Add / Edit Group */,
     xns : Roo.bootstrap,
     '|xns' : 'Roo.bootstrap',
     buttons : [
@@ -73,42 +71,8 @@ Roo.apply(Pman.Dialog.BAdminGroups.prototype, {
                 return;
             }
             
-            var myID = _this.form.findField('id').getValue() * 1;
-            var myName = _this.form.findField('name').getValue();
-        
-            if (_this.form.findField('company_id') && !_this.form.findField('company_id').getValue()) {
-                Roo.bootstrap.MessageBox.alert("Error", "Select a Company");
-                return;
-            }
-                
-               // validate password match (only needed if we are not using generated one..
-            if (_this.form.findField('passwd1') 
-                    && _this.form.findField('passwd1').getValue().length > 0 
-                    && _this.form.findField('passwd1').inputEl().dom.type == "password") {
-                    
-                var p1 = _this.form.findField('passwd1').getValue();
-                var p2 = _this.form.findField('passwd2').getValue();
-                    
-                    
-                if (Pman.Login.authUser.id < 0 && !p1.length) {
-                    Roo.bootstrap.MessageBox.alert("Error", "You must create a password for the admin account");
-                    return;
-                }
-                    
-                    
-                if (p1.length || p2.length) {
-                    if (p1 != p2) {
-                        Roo.bootstrap.MessageBox.alert("Error", "Passwords do not match");
-                        return;
-                    }
-                }
-                    
-                
-            }
             _this.form.doAction("submit");
-        
-          
-        
+            
             return;
         }
       },
@@ -125,9 +89,10 @@ Roo.apply(Pman.Dialog.BAdminGroups.prototype, {
        actioncomplete : function (_self, action)
         {
             if(action.type == 'setdata'){
-            
+            _this.dialog.setTitle("Create Group");
                if(_this.data.id * 1 > 0) {
                     this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
+                    _this.dialog.setTitle("Edit Group");
                 } 
                 
                 return;
@@ -135,6 +100,10 @@ Roo.apply(Pman.Dialog.BAdminGroups.prototype, {
            
             if (action.type == 'load') {
                 _this.data = action.result.data;
+                
+                if(!_this.data.display_name.length){
+                    _this.form.findField('display_name').setValue(_this.data.name);
+                }
                 return;
             }
             
@@ -153,7 +122,7 @@ Roo.apply(Pman.Dialog.BAdminGroups.prototype, {
        actionfailed : function (_self, action)
         {
             Roo.log(action);
-            Roo.bootstrap.MessageBox.alert(action.result.errorMsg);
+            Roo.bootstrap.MessageBox.alert('Error', action.result.errorMsg);
         },
        render : function (_self)
         {
@@ -165,7 +134,7 @@ Roo.apply(Pman.Dialog.BAdminGroups.prototype, {
       items  : [
        {
         xtype : 'Input',
-        name : 'name',
+        name : 'display_name',
         placeholder : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
         xns : Roo.bootstrap,
         '|xns' : 'Roo.bootstrap'