Pman.Tab.MTrackTicket.bjs
authorAlan Knowles <alan@roojs.com>
Thu, 15 Nov 2018 03:07:41 +0000 (11:07 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 15 Nov 2018 03:07:41 +0000 (11:07 +0800)
Pman.Tab.MTrackTicket.js

Pman.Tab.MTrackTicket.bjs
Pman.Tab.MTrackTicket.js

index b8f35c1..8ba7996 100644 (file)
@@ -79,9 +79,9 @@
    "listeners" : {
     "activate" : "function (_self)\n{\n    _this.panel = _self;\n    (function () {\n        if (_this.tpanel) {\n            _this.panel.layout.getRegion('south').hide();\n            //_this.panel.layout.getRegion('north').hide();\n        }\n    }).defer(100);\n    try {\n        if (!_this.url || !_this.project || (_this.project != MTrack.projectCombo.getValue())) {\n            (function() { \n                if (_this.tpanel) { \n                 //   _this.tpanel.mload(\"/Report/1\"); \n                }\n            }).defer(300);\n        }\n        \n        \n    } catch(e) {Roo.log(\"activate fail\" + e.toString()); }\n}"
    },
+   "background" : true,
    "region" : "center",
    "fitToFrame" : true,
-   "background" : true,
    "title" : "Tickets",
    "xtype" : "NestedLayoutPanel",
    "fitContainer" : true,
@@ -94,8 +94,8 @@
      "items" : [
       {
        "xtype" : "LayoutRegion",
-       "$ xns" : "Roo",
        "tabPosition" : "top",
+       "$ xns" : "Roo",
        "* prop" : "center"
       },
       {
        "listeners" : {
         "|activate" : "function() {\n    _this.gpanel = this;\n    if (_this.grid) {\n        _this.grid.ds.load({});\n    }\n}"
        },
+       "background" : true,
        "region" : "north",
        "fitToframe" : true,
-       "background" : true,
        "title" : "mtrack_ticket",
        "xtype" : "GridPanel",
        "fitContainer" : true,
          "items" : [
           {
            "listeners" : {
-            "cellselect" : "function (_self, rowIndex, colIndex)\n{\n    return false;\n    var rec = _this.grid.ds.getAt(rowIndex);\n    \n    // verify nothing has chagned.. \n     \n    // load the ticked, and render a view of it...\n    new Pman.Request({\n        url : baseURL + '/Roo/mtrack_ticket',\n        method : 'GET',\n        params : { \n            _id : rec.data.id\n        },\n        success : function(res) {\n            //Roo.log(res.data);\n            // render it into a template..\n            _this.tpanel.setContent(Pman.MTrack.template.ticket_view(res.data));\n            _this.tpanel.el.scrollTo('top',0);\n             \n            //... ehh\n             Pman.MTrack.loadAudit(rec.data.id, _this.tpanel.el.select('.mtrack-ticket-events',true).first());\n         \n            new Pman.Request({\n                url : baseURL + '/Roo/Images',\n                method : 'GET',\n                params : { \n                    onid : rec.data.id,\n                    ontable : 'mtrack_ticket'\n                },\n                success : function(ares) {\n                    Roo.log(ares.data);\n                    var el = Roo.select('.ticket-status-attachments .attachments-list', true).first();\n                    // fill in the attachement area with data from this..\n                    el.dom.innerHTML =  Pman.MTrack.template.ticket_attachments(ares) ;\n                }\n            });\n             \n            \n            _this.form.reset();\n\n            _this.form.setValues({\n                id : rec.data.id,\n                owner_id : rec.data.owner_id,\n                owner_id_name : rec.data.owner_id_name,\n                status : rec.data.status,\n                status_name : \"No Change\"\n            }); \n            \n            \n            for(var k in res.data) {\n                rec.set(k,res.data[k]);\n            }\n            \n        }\n    });\n        \n    \n    \n}",
-            "afterselectionchange" : "function (_self, rowIndex, colIndex)\n{\n    \n    var   sels =   _this.grid.selModel.getSelections();\n    \n    if (!sels || sels.length > 1) {\n    \n        return;\n    }\n    \n    var rec = sels[0];\n    \n    // verify nothing has chagned.. \n     \n    // load the ticked, and render a view of it...\n    new Pman.Request({\n        url : baseURL + '/Roo/mtrack_ticket',\n        method : 'GET',\n        params : { \n            _id : rec.data.id\n        },\n        success : function(res) {\n            //Roo.log(res.data);\n            // render it into a template..\n            _this.tpanel.setContent(Pman.MTrack.template.ticket_view(res.data));\n            _this.tpanel.el.scrollTo('top',0);\n             \n            //... ehh\n             Pman.MTrack.loadAudit(rec.data.id, _this.tpanel.el.select('.mtrack-ticket-events',true).first());\n         \n            \n           \n            new Pman.Request({\n                url : baseURL + '/Roo/Images',\n                method : 'GET',\n                params : { \n                    onid : rec.data.id,\n                    ontable : 'mtrack_ticket'\n                },\n                success : function(ares) {\n                    Roo.log(ares.data);\n                    var el = Roo.select('.ticket-status-attachments .attachments-list', true).first();\n                    // fill in the attachement area with data from this..\n                    el.dom.innerHTML =  Pman.MTrack.template.ticket_attachments(ares) ;\n                }\n            });\n             \n            \n            _this.form.reset();\n\n            _this.form.setValues({\n                id : rec.data.id,\n                owner_id : rec.data.owner_id,\n                owner_id_name : rec.data.owner_id_name,\n                status : rec.data.status,\n                status_name : \"No Change\"\n            }); \n            \n            \n            for(var k in res.data) {\n                rec.set(k,res.data[k]);\n            }\n            \n        }\n    });\n        \n    \n    \n}"
+            "afterselectionchange" : "function (_self, rowIndex, colIndex)\n{\n    \n    var   sels =   _this.grid.selModel.getSelections();\n    \n    if (!sels || sels.length > 1) {\n    \n        return;\n    }\n    \n    var rec = sels[0];\n    \n    // verify nothing has chagned.. \n     \n    // load the ticked, and render a view of it...\n    new Pman.Request({\n        url : baseURL + '/Roo/mtrack_ticket',\n        method : 'GET',\n        params : { \n            _id : rec.data.id\n        },\n        success : function(res) {\n            //Roo.log(res.data);\n            // render it into a template..\n            _this.tpanel.setContent(Pman.MTrack.template.ticket_view(res.data));\n            _this.tpanel.el.scrollTo('top',0);\n             \n            //... ehh\n             Pman.MTrack.loadAudit(rec.data.id, _this.tpanel.el.select('.mtrack-ticket-events',true).first());\n         \n            \n           \n            new Pman.Request({\n                url : baseURL + '/Roo/Images',\n                method : 'GET',\n                params : { \n                    onid : rec.data.id,\n                    ontable : 'mtrack_ticket'\n                },\n                success : function(ares) {\n                    Roo.log(ares.data);\n                    var el = Roo.select('.ticket-status-attachments .attachments-list', true).first();\n                    // fill in the attachement area with data from this..\n                    el.dom.innerHTML =  Pman.MTrack.template.ticket_attachments(ares) ;\n                }\n            });\n             \n            \n            _this.form.reset();\n\n            _this.form.setValues({\n                id : rec.data.id,\n                owner_id : rec.data.owner_id,\n                owner_id_name : rec.data.owner_id_name,\n                status : rec.data.status,\n                status_name : \"No Change\"\n            }); \n            \n            \n            for(var k in res.data) {\n                rec.set(k,res.data[k]);\n            }\n            \n        }\n    });\n        \n    \n    \n}",
+            "cellselect" : "function (_self, rowIndex, colIndex)\n{\n    return false;\n    var rec = _this.grid.ds.getAt(rowIndex);\n    \n    // verify nothing has chagned.. \n     \n    // load the ticked, and render a view of it...\n    new Pman.Request({\n        url : baseURL + '/Roo/mtrack_ticket',\n        method : 'GET',\n        params : { \n            _id : rec.data.id\n        },\n        success : function(res) {\n            //Roo.log(res.data);\n            // render it into a template..\n            _this.tpanel.setContent(Pman.MTrack.template.ticket_view(res.data));\n            _this.tpanel.el.scrollTo('top',0);\n             \n            //... ehh\n             Pman.MTrack.loadAudit(rec.data.id, _this.tpanel.el.select('.mtrack-ticket-events',true).first());\n         \n            new Pman.Request({\n                url : baseURL + '/Roo/Images',\n                method : 'GET',\n                params : { \n                    onid : rec.data.id,\n                    ontable : 'mtrack_ticket'\n                },\n                success : function(ares) {\n                    Roo.log(ares.data);\n                    var el = Roo.select('.ticket-status-attachments .attachments-list', true).first();\n                    // fill in the attachement area with data from this..\n                    el.dom.innerHTML =  Pman.MTrack.template.ticket_attachments(ares) ;\n                }\n            });\n             \n            \n            _this.form.reset();\n\n            _this.form.setValues({\n                id : rec.data.id,\n                owner_id : rec.data.owner_id,\n                owner_id_name : rec.data.owner_id_name,\n                status : rec.data.status,\n                status_name : \"No Change\"\n            }); \n            \n            \n            for(var k in res.data) {\n                rec.set(k,res.data[k]);\n            }\n            \n        }\n    });\n        \n    \n    \n}"
            },
            "xtype" : "RowSelectionModel",
            "$ xns" : "Roo.grid",
            "items" : [
             {
              "$ url" : "baseURL + '/Roo/mtrack_ticket.php'",
-             "xtype" : "HttpProxy",
              "method" : "GET",
+             "xtype" : "HttpProxy",
              "$ xns" : "Roo.data",
              "* prop" : "proxy"
             },
                 "load" : "function (_self, records, options)\n{\n    Roo.log(records);\n    var ua = _this.personSel.store.reader.newRow({\n        developer_id : -1,\n        developer_id_name : '-- Un-assigned --'\n    });\n    this.insert(0,[ua]);\n//    records.unshift(ua);\n}"
                },
                "xtype" : "Store",
-               "$ xns" : "Roo.data",
                "$ sortInfo" : "{ field : 'developer_id_name' , dir : 'ASC' }",
+               "$ xns" : "Roo.data",
                "* prop" : "store",
                "items" : [
                 {
                  "$ url" : "baseURL + '/Roo/Mtrack_ticket.php'",
-                 "method" : "GET",
                  "xtype" : "HttpProxy",
+                 "method" : "GET",
                  "$ xns" : "Roo.data",
                  "* prop" : "proxy"
                 },
                  "items" : [
                   {
                    "$ url" : "baseURL + '/Roo/mtrack_milestone.php'",
-                   "xtype" : "HttpProxy",
                    "method" : "GET",
+                   "xtype" : "HttpProxy",
                    "$ xns" : "Roo.data",
                    "* prop" : "proxy"
                   },
           },
           {
            "xtype" : "ColumnModel",
-           "width" : 200,
            "header" : "Summary",
+           "width" : 200,
            "$ renderer" : "function(v,x,r) { \n    \n    var col = '#000'; // closed?\n    switch (r.data.status_name) {\n        case 'resolved':\n            col = '#0cc'; break; // blue\n        case 'open':\n        case 'reopened':        \n        case 'new':                \n            col = '#c00'; break; // redish\n        case 'closed':                \n            col = '#999'; break; // grey\n   }\n    \n    return String.format(\n        r.data.status_name == 'closed'  ?\n              '{2}</span><s style=\"color:{3}\">[{1}]</s> {0}':\n              '{2}<span style=\"color:{3}\">[{1}]</span> {0}',\n            v,\n            r.data.status_name == 'closed'  ?\n                r.data.resolution_id_name : \n                 r.data.status_name ,\n            r.json.jira_ref ?  (r.json.jira_ref+ ' ')  : '',\n            col\n            ); \n}\n",
            "$ xns" : "Roo.grid",
            "* prop" : "colModel[]",
           },
           {
            "xtype" : "ColumnModel",
-           "width" : 75,
            "header" : "Owner",
+           "width" : 75,
            "$ renderer" : "function(v) { return String.format('{0}', v); }",
            "$ xns" : "Roo.grid",
            "* prop" : "colModel[]",
           },
           {
            "xtype" : "ColumnModel",
-           "width" : 75,
            "header" : "Developer",
+           "width" : 75,
            "$ renderer" : "function(v,x,r) { return String.format('{0}', r.data.developer_id_name); }",
            "$ xns" : "Roo.grid",
            "* prop" : "colModel[]",
                  "items" : [
                   {
                    "$ url" : "baseURL + '/Roo/Person.php'",
-                   "xtype" : "HttpProxy",
                    "method" : "GET",
+                   "xtype" : "HttpProxy",
                    "$ xns" : "Roo.data",
                    "* prop" : "proxy"
                   },
                  "items" : [
                   {
                    "$ url" : "baseURL + '/Roo/core_enum.php'",
-                   "method" : "GET",
                    "xtype" : "HttpProxy",
+                   "method" : "GET",
                    "$ xns" : "Roo.data",
                    "* prop" : "proxy"
                   },
                  "items" : [
                   {
                    "$ url" : "baseURL + '/Roo/core_enum.php'",
-                   "method" : "GET",
                    "xtype" : "HttpProxy",
+                   "method" : "GET",
                    "$ xns" : "Roo.data",
                    "* prop" : "proxy"
                   },
                  "items" : [
                   {
                    "$ url" : "baseURL + '/Roo/core_enum.php'",
-                   "method" : "GET",
                    "xtype" : "HttpProxy",
+                   "method" : "GET",
                    "$ xns" : "Roo.data",
                    "* prop" : "proxy"
                   },
           },
           {
            "xtype" : "ColumnModel",
-           "width" : 50,
            "header" : "Hours",
+           "width" : 50,
            "$ renderer" : "function(v,x,r) { \n    return String.format('{0}/{1}', r.data.spent, v); \n}",
            "$ xns" : "Roo.grid",
            "* prop" : "colModel[]",
         "resize" : "function (_self, width, height)\n{\n    // create and update the CSS style\n    \n    if (!_this.css) {\n        _this.css = Roo.util.CSS;\n    \n        _this.css.createStyleSheet(\n            \n                \".ticket-view-main .ticket-left-col {  }\\n\" +\n                \".ticket-view-main .readonly-tkt-description { }\\n\" +\n                \".ticket-view-main .mtrack-ticket-events {} \\n\"\n            ,\n            Roo.id()\n        );   \n         \n    }\n    var w = width - 400;\n    Roo.log(\"new width: \" + Math.max(0,w));\n    \n    _this.css.updateRule(\n        \".ticket-view-main .ticket-left-col\", \n            \"width\", Math.max(0, w) +  'px'\n    );\n     _this.css.updateRule(\n        \".ticket-view-main .readonly-tkt-description\",\n            \"width\", Math.max(0, w-10) +  'px'\n    );\n     _this.css.updateRule(\n        \".ticket-view-main .mtrack-ticket-events\",\n            \"width\", Math.max(0, w-10) +  'px'\n    );\n}"
        },
        "autoScroll" : true,
-       "fitToFrame" : true,
        "background" : false,
+       "fitToFrame" : true,
        "region" : "center",
        "title" : "Tickets",
        "xtype" : "ContentPanel",
           "|rendered" : "function (form)\n{\n    _this.form= form;\n}\n"
          },
          "$ url" : "baseURL + '/Roo/mtrack_ticket.php'",
-         "method" : "POST",
          "xtype" : "Form",
+         "method" : "POST",
          "style" : "margin:10px;",
          "$ xns" : "Roo.form",
          "items" : [
           {
            "xtype" : "Row",
-           "width" : 900,
            "$ xns" : "Roo.form",
+           "width" : 900,
            "items" : [
             {
              "labelAlign" : "top",
                  "items" : [
                   {
                    "$ url" : "baseURL + '/Roo/Mtrack_ticket.php'",
-                   "method" : "GET",
                    "xtype" : "HttpProxy",
+                   "method" : "GET",
                    "$ xns" : "Roo.data",
                    "* prop" : "proxy"
                   },
                "items" : [
                 {
                  "listeners" : {
-                  "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    o.params['query[ticket_id]'] =_this.grid.getSelected().data.id;\n    \n    o.params['query[project_id]']= _this.grid.getSelected().data.project_id;\n    o.params._anyrole = 1;\n    \n    o.params.limit = 999;\n}\n"
+                  "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    o.params['query[ticket_id]'] =_this.grid.sm.getSelected().data.id;\n    \n    o.params['query[project_id]']= _this.grid.sm.getSelected().data.project_id;\n    o.params._anyrole = 1;\n    \n    o.params.limit = 999;\n}\n"
                  },
                  "xtype" : "Store",
                  "remoteSort" : true,
                  "items" : [
                   {
                    "$ url" : "baseURL + '/Roo/Person.php'",
-                   "xtype" : "HttpProxy",
                    "method" : "GET",
+                   "xtype" : "HttpProxy",
                    "$ xns" : "Roo.data",
                    "* prop" : "proxy"
                   },
index 05ff514..28c5577 100644 (file)
@@ -2484,9 +2484,9 @@ Pman.Tab.MTrackTicket = new Roo.XComponent({
                 beforeload : function (_self, o){
                      o.params = o.params || {};
                      // set more here
-                     o.params['query[ticket_id]'] =_this.grid.getSelected().data.id;
+                     o.params['query[ticket_id]'] =_this.grid.sm.getSelected().data.id;
                      
-                     o.params['query[project_id]']= _this.grid.getSelected().data.project_id;
+                     o.params['query[project_id]']= _this.grid.sm.getSelected().data.project_id;
                      o.params._anyrole = 1;
                      
                      o.params.limit = 999;