sync
[web.mtrack] / MTrackWeb / templates / images / MTrackWeb / MTrackWeb.Tab.TicketView.js
index c865a9f..9ec27c3 100644 (file)
@@ -5,8 +5,8 @@
 MTrackWeb.Tab.TicketView = new Roo.XComponent({
     order    : '001-MTrackWeb.Tab.TicketView',
     region   : 'center',
-    parent   : false,
-    name     : "unnamed module",
+    parent   : 'Pman',
+    name     : "TicketView",
     disabled : false, 
     tree : function()
     {
@@ -15,15 +15,734 @@ MTrackWeb.Tab.TicketView = new Roo.XComponent({
         return {
             xtype: 'NestedLayoutPanel',
             xns: Roo,
+            region : 'center',
+            title : "Tickets",
             layout : {
                 xtype: 'BorderLayout',
                 xns: Roo,
                 items : [
+                    {
+                        xtype: 'GridPanel',
+                        xns: Roo,
+                        title : "mtrack_ticket",
+                        fitToframe : true,
+                        fitContainer : true,
+                        tableName : 'mtrack_ticket',
+                        background : true,
+                        region : 'center',
+                        listeners : {
+                            activate : function() {
+                                _this.panel = this;
+                                if (_this.grid) {
+                                    _this.grid.footer.onClick('first');
+                                }
+                            }
+                        },
+                        grid : {
+                            xtype: 'Grid',
+                            xns: Roo.grid,
+                            autoExpandColumn : 'summary',
+                            loadMask : true,
+                            listeners : {
+                                render : function() 
+                                {
+                                    _this.grid = this; 
+                                    //_this.dialog = Pman.Dialog.FILL_IN
+                                    if (_this.panel.active) {
+                                       this.footer.onClick('first');
+                                    }
+                                },
+                                rowdblclick : function (_self, rowIndex, e)
+                                {
+                                    if (!_this.dialog) return;
+                                    _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
+                                        _this.grid.footer.onClick('first');
+                                    }); 
+                                }
+                            },
+                            dataSource : {
+                                xtype: 'Store',
+                                xns: Roo.data,
+                                remoteSort : true,
+                                sortInfo : { field : 'summary', direction: 'ASC' },
+                                proxy : {
+                                    xtype: 'HttpProxy',
+                                    xns: Roo.data,
+                                    method : 'GET',
+                                    url : baseURL + '/Roo/mtrack_ticket.php'
+                                },
+                                reader : {
+                                    xtype: 'JsonReader',
+                                    xns: Roo.data,
+                                    totalProperty : 'total',
+                                    root : 'data',
+                                    id : 'id',
+                                    fields : [
+                                        {
+                                            'name': 'id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'summary',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'description',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'changelog',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'created',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'updated',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'owner_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'priority_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'severity_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'classification_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'resolution_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'cc',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'status',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'estimated',
+                                            'type': 'float'
+                                        },
+                                        {
+                                            'name': 'spent',
+                                            'type': 'float'
+                                        },
+                                        {
+                                            'name': 'x_fieldname',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'project_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'developer_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'milestone_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'updated_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'updated_person_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'updated_ontable',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'updated_onid',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'updated_changedate',
+                                            'type': 'date'
+                                        },
+                                        {
+                                            'name': 'updated_reason',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'created_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'created_person_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'created_ontable',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'created_onid',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'created_changedate',
+                                            'type': 'date'
+                                        },
+                                        {
+                                            'name': 'created_reason',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'owner_id_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'owner_id_office_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'owner_id_name',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'owner_id_phone',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'owner_id_fax',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'owner_id_email',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'owner_id_company_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'owner_id_role',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'owner_id_active',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'owner_id_remarks',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'owner_id_passwd',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'owner_id_owner_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'owner_id_lang',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'owner_id_no_reset_sent',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'owner_id_action_type',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'owner_id_project_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'owner_id_deleted_by',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'owner_id_deleted_dt',
+                                            'type': 'date'
+                                        },
+                                        {
+                                            'name': 'developer_id_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'developer_id_office_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'developer_id_name',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'developer_id_phone',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'developer_id_fax',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'developer_id_email',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'developer_id_company_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'developer_id_role',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'developer_id_active',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'developer_id_remarks',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'developer_id_passwd',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'developer_id_owner_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'developer_id_lang',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'developer_id_no_reset_sent',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'developer_id_action_type',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'developer_id_project_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'developer_id_deleted_by',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'developer_id_deleted_dt',
+                                            'type': 'date'
+                                        },
+                                        {
+                                            'name': 'priority_id_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'priority_id_etype',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'priority_id_name',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'priority_id_active',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'priority_id_seqid',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'severity_id_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'severity_id_etype',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'severity_id_name',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'severity_id_active',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'severity_id_seqid',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'classification_id_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'classification_id_etype',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'classification_id_name',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'classification_id_active',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'classification_id_seqid',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'resolution_id_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'resolution_id_etype',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'resolution_id_name',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'resolution_id_active',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'resolution_id_seqid',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'status_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'status_etype',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'status_name',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'status_active',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'status_seqid',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'project_id_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'project_id_name',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'project_id_remarks',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'project_id_owner_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'project_id_code',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'project_id_active',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'project_id_type',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'project_id_client_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'project_id_team_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'project_id_file_location',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'project_id_open_date',
+                                            'type': 'date'
+                                        },
+                                        {
+                                            'name': 'project_id_open_by',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'project_id_close_date',
+                                            'type': 'date'
+                                        },
+                                        {
+                                            'name': 'project_id_countries',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'project_id_languages',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'project_id_agency_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'milestone_id_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'milestone_id_name',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'milestone_id_description',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'milestone_id_startdate',
+                                            'type': 'date'
+                                        },
+                                        {
+                                            'name': 'milestone_id_duedate',
+                                            'type': 'date'
+                                        },
+                                        {
+                                            'name': 'milestone_id_completed',
+                                            'type': 'date'
+                                        },
+                                        {
+                                            'name': 'milestone_id_deleted',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'milestone_id_created',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'milestone_id_updated',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'milestone_id_project_id',
+                                            'type': 'int'
+                                        }
+                                    ]
+                                }
+                            },
+                            footer : {
+                                xtype: 'PagingToolbar',
+                                xns: Roo,
+                                pageSize : 25,
+                                displayInfo : true,
+                                displayMsg : 'Displaying mtrack_ticket{0} - {1} of {2}',
+                                emptyMsg : 'No mtrack_ticket found'
+                            },
+                            toolbar : {
+                                xtype: 'Toolbar',
+                                xns: Roo,
+                                items : [
+                                    {
+                                        xtype: 'Fill',
+                                        xns: Roo.Toolbar
+                                    },
+                                    {
+                                        xtype: 'Button',
+                                        xns: Roo.Toolbar,
+                                        listeners : {
+                                            click : function()
+                                            {
+                                                if (!_this.dialog) return;
+                                                _this.dialog.show( { id : 0 } , function() {
+                                                    _this.grid.footer.onClick('first');
+                                               }); 
+                                            }
+                                        },
+                                        cls : 'x-btn-text-icon',
+                                        text : "Create Ticket",
+                                        icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
+                                    },
+                                    {
+                                        xtype: 'Button',
+                                        xns: Roo.Toolbar,
+                                        text : "Edit",
+                                        cls : 'x-btn-text-icon',
+                                        icon : Roo.rootURL + 'images/default/tree/leaf.gif',
+                                        listeners : {
+                                            click : function()
+                                            {
+                                                var s = _this.grid.getSelectionModel().getSelections();
+                                                if (!s.length || (s.length > 1))  {
+                                                    Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
+                                                    return;
+                                                }
+                                                if (!_this.dialog) return;
+                                                _this.dialog.show(s[0].data, function() {
+                                                    _this.grid.footer.onClick('first');
+                                                }); 
+                                                
+                                            }
+                                        }
+                                    },
+                                    {
+                                        xtype: 'Button',
+                                        xns: Roo.Toolbar,
+                                        listeners : {
+                                            click : function()
+                                            {
+                                                 Pman.genericDelete(_this, 'mtrack_ticket'); 
+                                            }
+                                        },
+                                        cls : 'x-btn-text-icon',
+                                        text : "Quick Close",
+                                        icon : rootURL + '/Pman/templates/images/trash.gif'
+                                    }
+                                ]
+                            },
+                            colModel : [
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Id',
+                                    width : 75,
+                                    dataIndex : 'id',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Summary',
+                                    width : 200,
+                                    dataIndex : 'summary',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Project',
+                                    width : 75,
+                                    dataIndex : 'project_id',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Milestone',
+                                    width : 75,
+                                    dataIndex : 'milestone_id',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Owner',
+                                    width : 75,
+                                    dataIndex : 'owner_id',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Created',
+                                    width : 75,
+                                    dataIndex : 'created',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Updated',
+                                    width : 75,
+                                    dataIndex : 'updated',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Priority',
+                                    width : 75,
+                                    dataIndex : 'priority_id',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Severity',
+                                    width : 75,
+                                    dataIndex : 'severity_id',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Classification',
+                                    width : 75,
+                                    dataIndex : 'classification_id',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Estimated',
+                                    width : 75,
+                                    dataIndex : 'estimated',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Spent',
+                                    width : 75,
+                                    dataIndex : 'spent',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Project',
+                                    width : 75,
+                                    dataIndex : 'project_id',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                },
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    header : 'Developer',
+                                    width : 75,
+                                    dataIndex : 'developer_id',
+                                    renderer : function(v) { return String.format('{0}', v); }
+                                }
+                            ]
+                        }
+                    },
                     {
                         xtype: 'ContentPanel',
                         xns: Roo,
                         autoScroll : true,
-                        region : 'center',
+                        region : 'east',
                         title : "Add / Edit Ticket",
                         adjustments : [30, 30],
                         items : [
@@ -112,7 +831,7 @@ MTrackWeb.Tab.TicketView = new Roo.XComponent({
                                                                 xtype: 'HttpProxy',
                                                                 xns: Roo.data,
                                                                 method : 'GET',
-                                                                url : baseURL + '/Roo/Projects.php'
+                                                                url : baseURL + '/Roo/core_project.php'
                                                             },
                                                             reader : {
                                                                 xtype: 'JsonReader',
@@ -811,7 +1530,7 @@ MTrackWeb.Tab.TicketView = new Roo.XComponent({
                         xtype: 'ContentPanel',
                         xns: Roo,
                         background : true,
-                        region : 'center',
+                        region : 'east',
                         title : "Full history"
                     }
                 ],
@@ -819,6 +1538,14 @@ MTrackWeb.Tab.TicketView = new Roo.XComponent({
                     xtype: 'LayoutRegion',
                     xns: Roo
                 },
+                east : {
+                    xtype: 'LayoutRegion',
+                    xns: Roo,
+                    collapsible : true,
+                    tabPosition : 'top',
+                    title : "Ticket Details",
+                    width : 550
+                },
                 center : {
                     xtype: 'LayoutRegion',
                     xns: Roo