Commit 25329849 authored by Project Open's avatar Project Open

- WIP

parent ef1937b7
......@@ -17,6 +17,9 @@ Ext.Loader.setPath('Ext.ux', '/sencha-core/ux');
Ext.Loader.setPath('PO.view', '/sencha-core/view');
Ext.Loader.setPath('PO.controller', '/sencha-core/controller');
// Disable the ?_dc=123456789 parameter from loader
Ext.Loader.setConfig({disableCaching: false});
Ext.require([
'Ext.data.*',
'Ext.grid.*',
......@@ -72,6 +75,24 @@ function launchTimesheetWeeklyLogging(){
}
});
var summaryType = function(hourArray, dataIndex) {
var sum = 0;
for (var i = 0; i < hourArray.length; i++) {
var vString = hourArray[i].get(dataIndex);
var vFloat = parseFloat(vString);
if (!!vFloat) sum = sum + vFloat;
}
return sum;
};
var summaryRenderer = function(value, summaryData, dataIndex) {
var type = typeof(value);
if ("number" == type) {
return Math.round(value * 100) / 100;
}
return value;
};
var hourGrid = Ext.create('Ext.grid.Panel', {
store: hourStore,
layout: 'fit',
......@@ -85,6 +106,10 @@ function launchTimesheetWeeklyLogging(){
iconCls: 'icon-grid',
margin: '0 0 20 0',
plugins: [rowEditing],
features: [{
ftype: 'summary',
dock: 'bottom'
}],
// reference to controller
hourController: null, // Reference to main controller
......@@ -101,12 +126,12 @@ function launchTimesheetWeeklyLogging(){
},
editor: {
xtype: 'combo',
queryMode:
'local',
queryMode: 'local',
store: projectStore,
displayField: 'project_name',
valueField: 'project_id',
matchFieldWidth: false,
displayTpl: Ext.create('Ext.XTemplate', '<tpl for=".">', '{project_name}', '</tpl>'),
listeners: {
change: function(combo, value, oldValue, event) {
// ToDo: Replace this hard-wired reference with something more intelligent
......@@ -127,13 +152,13 @@ function launchTimesheetWeeklyLogging(){
editor: { xtype: 'pocombotree', store: taskTreeStore, queryMode: 'local', displayField: 'project_name', valueField: 'id'}
},
// { text: "Date", xtype: 'datecolumn', dataIndex: 'day', renderer: Ext.util.Format.dateRenderer('Y-m-d'), editor: {xtype: 'datefield',allowBlank: true}},
{ text: "Mon", width: 60, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0 }},
{ text: "Tue", width: 60, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0 }},
{ text: "Wed", width: 60, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0 }},
{ text: "Thu", width: 60, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0 }},
{ text: "Fri", width: 60, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0 }},
{ text: "Sat", width: 60, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0 }},
{ text: "Sun", width: 60, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0 }},
{text: "<div align=center>Mon<br>3/29/2021</div>", width: 65, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: summaryType, summaryRenderer: summaryRenderer},
{text: "<div align=center>Tue<br>3/30/2021</div>", width: 65, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: summaryType, summaryRenderer: summaryRenderer},
{text: "<div align=center>Wed<br>2/31/2021</div>", width: 65, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: summaryType, summaryRenderer: summaryRenderer},
{text: "<div align=center>Thu<br>2/31/2021</div>", width: 65, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: summaryType, summaryRenderer: summaryRenderer},
{text: "<div align=center>Fri<br>2/31/2021</div>", width: 65, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: summaryType, summaryRenderer: summaryRenderer},
{text: "<div align=center>Sat<br>2/31/2021</div>", width: 65, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: summaryType, summaryRenderer: summaryRenderer},
{text: "<div align=center>Sun<br>2/31/2021</div>", width: 65, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: summaryType, summaryRenderer: summaryRenderer},
// { text: "Note", flex: 1, dataIndex: 'note', editor: { allowBlank: true }}
]
});
......@@ -522,7 +547,7 @@ Ext.onReady(function() {
var coordinator = Ext.create('PO.controller.StoreLoadCoordinator', {
stores: [
'hourStore',
'taskTreeStore',
// 'taskTreeStore',
'projectMainStore'
],
listeners: {
......@@ -535,7 +560,7 @@ Ext.onReady(function() {
});
// Load stores that need parameters
taskTreeStore.getProxy().extraParams = { project_id: @project_id@ };
taskTreeStore.getProxy().extraParams = { project_id: 18228 };
taskTreeStore.load({
callback: function(records, operation, success) {
var me = this;
......@@ -560,7 +585,8 @@ Ext.onReady(function() {
// Load stores that need parameters
// projectStore.getProxy().extraParams = { query: 'parent_id is NULL and project_status_id = 76', format: 'json' };
projectStore.getProxy().extraParams = { query: 'parent_id is NULL and project_status_id in (select * from im_sub_categories(76))', format: 'json' };
projectStore.getProxy().extraParams = { query: 'parent_id is NULL and (project_status_id in (select * from im_sub_categories(76)) OR \
parent_id is null)', format: 'json' };
projectStore.load({
callback: function() {
console.log('PO.store.project.ProjectMainStore: loaded');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment