Uncommited changes synced
[Pman.MTrack] / Pman.Dialog.MTrackMilestone.js
index fa4f692..562ada4 100644 (file)
@@ -32,9 +32,10 @@ Pman.Dialog.MTrackMilestone = {
             xns: Roo,
             closable : false,
             collapsible : false,
-            height : 390,
+            height : 350,
+            modal : true,
             resizable : false,
-            title : "Edit / Create mtrack_milestone",
+            title : "Edit / Create Milestone",
             width : 400,
             items : [
                 {
@@ -49,17 +50,19 @@ Pman.Dialog.MTrackMilestone = {
                                 actioncomplete : function(_self,action)
                                 {
                                     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;
                                     }
                                     if (action.type =='submit') {
                                     
-                                        _this.dialog.el.unmask();
+                                
                                         _this.dialog.hide();
                                     
                                          if (_this.callback) {
@@ -85,74 +88,44 @@ Pman.Dialog.MTrackMilestone = {
                                     name : 'name',
                                     width : 200
                                 },
-                                {
-                                    xtype: 'TextArea',
-                                    xns: Roo.form,
-                                    fieldLabel : 'Description',
-                                    name : 'description',
-                                    width : 200,
-                                    height : 100
-                                },
-                                {
-                                    xtype: 'DateField',
-                                    xns: Roo.form,
-                                    fieldLabel : 'Startdate',
-                                    name : 'startdate',
-                                    width : 75
-                                },
-                                {
-                                    xtype: 'DateField',
-                                    xns: Roo.form,
-                                    fieldLabel : 'Duedate',
-                                    name : 'duedate',
-                                    width : 75
-                                },
-                                {
-                                    xtype: 'DateField',
-                                    xns: Roo.form,
-                                    fieldLabel : 'Completed',
-                                    name : 'completed',
-                                    width : 75
-                                },
                                 {
                                     xtype: 'ComboBox',
                                     xns: Roo.form,
-                                    allowBlank : 'false',
-                                    editable : 'false',
-                                    emptyText : "Select mtrack_change",
+                                    allowBlank : false,
+                                    displayField : 'name',
+                                    editable : false,
+                                    emptyText : "Select Project",
+                                    fieldLabel : 'Project',
                                     forceSelection : true,
+                                    hiddenName : 'project_id',
                                     listWidth : 400,
                                     loadingText : "Searching...",
                                     minChars : 2,
-                                    pageSize : 20,
-                                    qtip : "Select mtrack_change",
+                                    name : 'project_id_name',
+                                    pageSize : 50,
+                                    qtip : "Select Projects",
+                                    queryParam : 'query[name]',
                                     selectOnFocus : true,
+                                    tpl : '<div class="x-grid-cell-text x-btn button"><b>{code}</b> {name}</div>',
                                     triggerAction : 'all',
-                                    typeAhead : true,
-                                    width : 300,
-                                    tpl : '<div class="x-grid-cell-text x-btn button"><b>{ontable}</b> </div>',
-                                    queryParam : 'query[ontable]',
-                                    fieldLabel : 'Deleted',
                                     valueField : 'id',
-                                    displayField : 'ontable',
-                                    hiddenName : 'deleted',
-                                    name : 'deleted_ontable',
+                                    width : 200,
                                     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: 'code' },
                                         proxy : {
                                             xtype: 'HttpProxy',
                                             xns: Roo.data,
                                             method : 'GET',
-                                            url : baseURL + '/Roo/mtrack_change.php'
+                                            url : baseURL + '/Roo/Projects.php'
                                         },
                                         reader : {
                                             xtype: 'JsonReader',
@@ -160,166 +133,53 @@ Pman.Dialog.MTrackMilestone = {
                                             id : 'id',
                                             root : 'data',
                                             totalProperty : 'total',
-                                            fields : [{"name":"id","type":"int"},{"name":"ontable","type":"string"}]
+                                            fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
                                         }
                                     }
                                 },
                                 {
-                                    xtype: 'ComboBox',
+                                    xtype: 'TextArea',
                                     xns: Roo.form,
-                                    allowBlank : 'false',
-                                    editable : 'false',
-                                    emptyText : "Select mtrack_change",
-                                    forceSelection : true,
-                                    listWidth : 400,
-                                    loadingText : "Searching...",
-                                    minChars : 2,
-                                    pageSize : 20,
-                                    qtip : "Select mtrack_change",
-                                    selectOnFocus : true,
-                                    triggerAction : 'all',
-                                    typeAhead : true,
-                                    width : 300,
-                                    tpl : '<div class="x-grid-cell-text x-btn button"><b>{ontable}</b> </div>',
-                                    queryParam : 'query[ontable]',
-                                    fieldLabel : 'Created',
-                                    valueField : 'id',
-                                    displayField : 'ontable',
-                                    hiddenName : 'created',
-                                    name : 'created_ontable',
-                                    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
-                                            }
-                                        },
-                                        proxy : {
-                                            xtype: 'HttpProxy',
-                                            xns: Roo.data,
-                                            method : 'GET',
-                                            url : baseURL + '/Roo/mtrack_change.php'
-                                        },
-                                        reader : {
-                                            xtype: 'JsonReader',
-                                            xns: Roo.data,
-                                            id : 'id',
-                                            root : 'data',
-                                            totalProperty : 'total',
-                                            fields : [{"name":"id","type":"int"},{"name":"ontable","type":"string"}]
-                                        }
-                                    }
+                                    fieldLabel : 'Description',
+                                    name : 'description',
+                                    width : 200,
+                                    height : 100
                                 },
                                 {
-                                    xtype: 'ComboBox',
+                                    xtype: 'DateField',
                                     xns: Roo.form,
-                                    allowBlank : 'false',
-                                    editable : 'false',
-                                    emptyText : "Select mtrack_change",
-                                    forceSelection : true,
-                                    listWidth : 400,
-                                    loadingText : "Searching...",
-                                    minChars : 2,
-                                    pageSize : 20,
-                                    qtip : "Select mtrack_change",
-                                    selectOnFocus : true,
-                                    triggerAction : 'all',
-                                    typeAhead : true,
-                                    width : 300,
-                                    tpl : '<div class="x-grid-cell-text x-btn button"><b>{ontable}</b> </div>',
-                                    queryParam : 'query[ontable]',
-                                    fieldLabel : 'Updated',
-                                    valueField : 'id',
-                                    displayField : 'ontable',
-                                    hiddenName : 'updated',
-                                    name : 'updated_ontable',
-                                    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
-                                            }
-                                        },
-                                        proxy : {
-                                            xtype: 'HttpProxy',
-                                            xns: Roo.data,
-                                            method : 'GET',
-                                            url : baseURL + '/Roo/mtrack_change.php'
-                                        },
-                                        reader : {
-                                            xtype: 'JsonReader',
-                                            xns: Roo.data,
-                                            id : 'id',
-                                            root : 'data',
-                                            totalProperty : 'total',
-                                            fields : [{"name":"id","type":"int"},{"name":"ontable","type":"string"}]
-                                        }
-                                    }
+                                    altFormats : 'Y-m-d H:i:s',
+                                    fieldLabel : 'Startdate',
+                                    format : 'Y-m-d',
+                                    name : 'startdate',
+                                    width : 100
                                 },
                                 {
-                                    xtype: 'ComboBox',
+                                    xtype: 'DateField',
                                     xns: Roo.form,
-                                    allowBlank : 'false',
-                                    displayField : 'name',
-                                    editable : 'false',
-                                    emptyText : "Select Project",
-                                    fieldLabel : 'Project',
-                                    forceSelection : true,
-                                    hiddenName : 'project_id',
-                                    listWidth : 400,
-                                    loadingText : "Searching...",
-                                    minChars : 2,
-                                    name : 'project_id',
-                                    pageSize : 20,
-                                    qtip : "Select Projects",
-                                    queryParam : 'query[name]',
-                                    selectOnFocus : true,
-                                    tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
-                                    triggerAction : 'all',
-                                    typeAhead : true,
-                                    valueField : 'id',
-                                    width : 300,
-                                    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
-                                            }
-                                        },
-                                        proxy : {
-                                            xtype: 'HttpProxy',
-                                            xns: Roo.data,
-                                            method : 'GET',
-                                            url : baseURL + '/Roo/Projects.php'
-                                        },
-                                        reader : {
-                                            xtype: 'JsonReader',
-                                            xns: Roo.data,
-                                            id : 'id',
-                                            root : 'data',
-                                            totalProperty : 'total',
-                                            fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
-                                        }
-                                    }
+                                    altFormats : 'Y-m-d H:i:s',
+                                    fieldLabel : 'Duedate',
+                                    format : 'Y-m-d',
+                                    name : 'duedate',
+                                    width : 100
                                 },
                                 {
-                                    xtype: 'TextField',
+                                    xtype: 'DateField',
                                     xns: Roo.form,
-                                    fieldLabel : 'Project',
-                                    name : 'project_id',
-                                    width : 75
+                                    altFormats : 'Y-m-d H:i:s',
+                                    fieldLabel : 'Completed',
+                                    format : 'Y-m-d',
+                                    name : 'completed',
+                                    width : 100
+                                },
+                                {
+                                    xtype: 'Checkbox',
+                                    xns: Roo.form,
+                                    boxLabel : 'On hold',
+                                    fieldLabel : 'Status',
+                                    inputValue : 1,
+                                    name : 'on_hold',
+                                    valueOff : 0
                                 },
                                 {
                                     xtype: 'Hidden',
@@ -356,7 +216,7 @@ Pman.Dialog.MTrackMilestone = {
                             // do some checks?
                              
                             
-                            _this.dialog.el.mask("Saving");
+                         
                             _this.form.doAction("submit");
                         
                         }