sync
[Pman.Admin] / Pman.Dialog.AdminWatch.js
index 9178584..f98c5c3 100644 (file)
@@ -33,6 +33,7 @@ Pman.Dialog.AdminWatch = {
             closable : false,
             collapsible : false,
             height : 230,
+            modal : true,
             resizable : false,
             title : "Edit / Create core_watch",
             width : 500,
@@ -50,17 +51,17 @@ Pman.Dialog.AdminWatch = {
                                 {
                                     if (action.type == 'setdata') {
                                        //_this.dialog.el.mask("Loading");
-                                       //this.load({ method: 'GET', params: { '_id' : _this.data.id }});
+                                       if (_this.data.id) {
+                                           this.load({ method: 'GET', params: { '_id' : _this.data.id }});
+                                       }
                                        return;
                                     }
                                     if (action.type == 'load') {
-                                        _this.dialog.el.unmask();
-                                        return;
+                                         return;
                                     }
                                     if (action.type =='submit') {
                                     
-                                        _this.dialog.el.unmask();
-                                        _this.dialog.hide();
+                                            _this.dialog.hide();
                                     
                                          if (_this.callback) {
                                             _this.callback.call(_this, _this.form.getValues());
@@ -118,7 +119,7 @@ Pman.Dialog.AdminWatch = {
                                             {
                                                 o.params = o.params || {};
                                                 // staff can see all logs, other companies can only see their own.
-                                                if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
+                                                if ((typeof(Pman.Login) != 'undefined') && Pman.Login.authUser.company_id_comptype != 'OWNER') {
                                                     o.params.company_id = Pman.Login.authUser.company_id;
                                                 }
                                                 o.params._distinct = 'on_table';
@@ -270,7 +271,7 @@ Pman.Dialog.AdminWatch = {
                                     fieldLabel : 'Notify Who',
                                     forceSelection : true,
                                     hiddenName : 'person_id',
-                                    listWidth : 400,
+                                    listWidth : 500,
                                     loadingText : "Searching...",
                                     minChars : 2,
                                     name : 'person_id_name',
@@ -278,7 +279,7 @@ Pman.Dialog.AdminWatch = {
                                     qtip : "Select Person",
                                     queryParam : 'query[name]',
                                     selectOnFocus : true,
-                                    tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
+                                    tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> ({company_id_name}) &lt;{email}&gt;</div>',
                                     triggerAction : 'all',
                                     typeAhead : true,
                                     valueField : 'id',
@@ -286,19 +287,19 @@ Pman.Dialog.AdminWatch = {
                                     store : {
                                         xtype: 'Store',
                                         xns: Roo.data,
-                                        remoteSort : true,
-                                        sortInfo : { direction : 'ASC', field: 'id' },
                                         listeners : {
                                             beforeload : function (_self, o){
                                                 o.params = o.params || {};
                                                 // set more here
                                             }
                                         },
+                                        remoteSort : true,
+                                        sortInfo : { direction : 'ASC', field: 'name' },
                                         proxy : {
                                             xtype: 'HttpProxy',
                                             xns: Roo.data,
                                             method : 'GET',
-                                            url : baseURL + '/Roo/Person.php'
+                                            url : baseURL + '/Roo/core_person'
                                         },
                                         reader : {
                                             xtype: 'JsonReader',
@@ -310,13 +311,6 @@ Pman.Dialog.AdminWatch = {
                                         }
                                     }
                                 },
-                                {
-                                    xtype: 'TextField',
-                                    xns: Roo.form,
-                                    fieldLabel : 'Event',
-                                    name : 'event',
-                                    width : 200
-                                },
                                 {
                                     xtype: 'ComboBox',
                                     xns: Roo.form,
@@ -332,10 +326,9 @@ Pman.Dialog.AdminWatch = {
                                     },
                                     allowBlank : true,
                                     displayField : 'action',
-                                    editable : false,
-                                    emptyText : "Select Action",
+                                    editable : true,
                                     fieldLabel : 'Match Event',
-                                    forceSelection : true,
+                                    forceSelection : false,
                                     listWidth : 300,
                                     loadingText : "Searching...",
                                     minChars : 2,
@@ -357,7 +350,7 @@ Pman.Dialog.AdminWatch = {
                                             {
                                                 o.params = o.params || {};
                                                 // staff can see all logs, other companies can only see their own.
-                                                if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
+                                                if (typeof(Pman.Login) !='undefined' && Pman.Login.authUser.company_id_comptype != 'OWNER') {
                                                     o.params.company_id = Pman.Login.authUser.company_id;
                                                 }
                                                 o.params._distinct = 'action';
@@ -493,18 +486,30 @@ Pman.Dialog.AdminWatch = {
                                     }
                                 },
                                 {
-                                    xtype: 'TextField',
+                                    xtype: 'ComboBox',
                                     xns: Roo.form,
+                                    allowBlank : true,
+                                    displayField : 'val',
+                                    editable : true,
                                     fieldLabel : 'Action',
+                                    forceSelection : false,
+                                    listWidth : 200,
                                     name : 'medium',
-                                    width : 200
+                                    triggerAction : 'all',
+                                    valueField : 'val',
+                                    width : 200,
+                                    store : {
+                                        xtype: 'SimpleStore',
+                                        xns: Roo.data,
+                                        data : [ [ 'email' ], [ 'APPROVAL' ], ['ENDOFDAYMAIL'] ],
+                                        fields : [ 'val' ]
+                                    }
                                 },
                                 {
-                                    xtype: 'TextField',
+                                    xtype: 'Checkbox',
                                     xns: Roo.form,
-                                    fieldLabel : 'Active',
-                                    name : 'active',
-                                    width : 75
+                                    fieldLabel : 'Active?',
+                                    name : 'active'
                                 },
                                 {
                                     xtype: 'Hidden',
@@ -541,7 +546,7 @@ Pman.Dialog.AdminWatch = {
                             // do some checks?
                              
                             
-                            _this.dialog.el.mask("Saving");
+                         
                             _this.form.doAction("submit");
                         
                         }