Commit 3fd8a748 authored by Project Open's avatar Project Open

- Cleanup before main developments

parent f07c57ee
......@@ -7,7 +7,6 @@
<div id=@task_editor_id@>
<script type='text/javascript' <if @::__csp_nonce@ not nil>nonce="@::__csp_nonce;literal@"</if>>
// Ext.Loader.setConfig({enabled: true});
Ext.Loader.setPath('PO', '/sencha-core');
Ext.Loader.setPath('PO.model', '/sencha-core/model');
......@@ -58,18 +57,6 @@ function launchTimesheetWeeklyLogging(){
}
});
// Cell-Editor for the hour grid
var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1,
clicksToMoveEditor: 1,
listeners: {
edit: function(editor, context, eOpts) {
// Check that the endTime is later than startTime
context.record.save();
}
}
});
var sumType = function(hourArray, dataIndex) {
var sum = 0;
for (var i = 0; i < hourArray.length; i++) {
......@@ -148,15 +135,21 @@ 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: "<div align=center>Mon<br>3/29/2021</div>", width: 75, align: "right", dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Tue<br>3/30/2021</div>", width: 75, align: "right", dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Wed<br>2/31/2021</div>", width: 75, align: "right", dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Thu<br>2/31/2021</div>", width: 75, align: "right", dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Fri<br>2/31/2021</div>", width: 75, align: "right", dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Sat<br>2/31/2021</div>", width: 75, align: "right", dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Sun<br>2/31/2021</div>", width: 75, align: "right", dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{ text: "Sum", width: 75, dataIndex: 'note', align: "center",
{text: "<div align=center>Mon<br>3/29/2021</div>", width: 65, align: "right", dataIndex: 'hours',
editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Tue<br>3/30/2021</div>", width: 65, align: "right", dataIndex: 'hours',
editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Wed<br>2/31/2021</div>", width: 65, align: "right", dataIndex: 'hours',
editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Thu<br>2/31/2021</div>", width: 65, align: "right", dataIndex: 'hours',
editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Fri<br>2/31/2021</div>", width: 65, align: "right", dataIndex: 'hours',
editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Sat<br>2/31/2021</div>", width: 65, align: "right", dataIndex: 'hours',
editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Sun<br>2/31/2021</div>", width: 65, align: "right", dataIndex: 'hours',
editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{ text: "Sum", width: 65, dataIndex: 'note', align: "center",
renderer: function(value, metaData, record, rowIndex, colIndex, store, view) {
var hoursString = record.get('hours');
var hoursFloat = parseFloat(hoursString)
......@@ -180,63 +173,37 @@ function launchTimesheetWeeklyLogging(){
return value;
}
}
// { text: "Note", flex: 1, dataIndex: 'note', editor: { allowBlank: true }}
]
});
// -----------------------------------------------------------------------
// Outer panel joining the two parts (Buttons + Grid)
var screenSize = Ext.getBody().getViewSize(); // Size calculation based on specific ]po[ layout
var sideBarSize = Ext.get('sidebar').getSize();
var width = screenSize.width - sideBarSize.width - 95;
var height = screenSize.height - 280;
Ext.define('PO.tsweekly.HourWeeklyButtonPanel', {
extend: 'Ext.panel.Panel',
alias: 'ganttButtonPanel',
width: 900,
height: 500,
layout: 'border',
defaults: {
collapsible: true,
split: true,
bodyPadding: 0
},
tbar: [
{
icon: '/intranet/images/navbar_default/add.png',
tooltip: '<%= [lang::message::lookup "" intranet-timesheet2-weekly.Manual_logging "Manual logging"] %>',
id: 'buttonAddEntry',
disabled: false
}, {
icon: '/intranet/images/navbar_default/delete.png',
tooltip: '<%= [lang::message::lookup "" intranet-timesheet2-weekly.Delete_logging "Delete entry"] %>',
id: 'buttonDeleteEntry',
disabled: false
}, {
xtype: 'tbseparator'
}, {
xtype: 'datefield',
// anchor: '100%',
// fieldLabel: 'From',
name: 'from_date',
value: new Date(),
maxValue: new Date(),
format: "Y-W",
startDay: 1
}
]
});
// Use the button panel as a container for the task tree and the hour grid
var hourButtonPanel = Ext.create('PO.tsweekly.HourWeeklyButtonPanel', {
//
var hourButtonPanel = Ext.create('Ext.panel.Panel', {
renderTo: '@task_editor_id@',
width: width,
height: height,
resizable: true, // Add handles to the panel, so the user can change size
items: [
hourGrid
]
layout: 'border',
items: [hourGrid],
tbar: [{
icon: '/intranet/images/navbar_default/add.png',
tooltip: '<%= [lang::message::lookup "" intranet-timesheet2-weekly.Manual_logging "Manual logging"] %>',
id: 'buttonAddEntry',
disabled: false
}, {
icon: '/intranet/images/navbar_default/delete.png',
tooltip: '<%= [lang::message::lookup "" intranet-timesheet2-weekly.Delete_logging "Delete entry"] %>',
id: 'buttonDeleteEntry',
disabled: false
}, { xtype: 'tbseparator'}, {
xtype: 'datefield',
// anchor: '100%',
// fieldLabel: 'From',
name: 'from_date',
value: new Date(),
maxValue: new Date(),
format: "Y-W",
startDay: 1
}]
});
var hourController = Ext.create('PO.tsweekly.HourWeeklyController', {
......@@ -249,6 +216,7 @@ function launchTimesheetWeeklyLogging(){
// -----------------------------------------------------------------------
// Controller to handle size and resizing related events
//
var renderDiv = Ext.get("@task_editor_id@");
var resizeController = Ext.create('PO.controller.ResizeController', {
debug: PO.Utilities.getDebug('resizeController'),
......@@ -276,7 +244,6 @@ Ext.onReady(function() {
var coordinator = Ext.create('PO.controller.StoreLoadCoordinator', {
stores: [
'hourStore',
// 'taskTreeStore',
'projectMainStore'
],
listeners: {
......@@ -289,7 +256,7 @@ Ext.onReady(function() {
});
// Load stores that need parameters
taskTreeStore.getProxy().extraParams = { project_id: 18228 };
taskTreeStore.getProxy().extraParams = { project_id: 0 }; // Load an empty tree
taskTreeStore.load({
callback: function(records, operation, success) {
var me = this;
......
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