Commit afcfbb58 authored by Project Open's avatar Project Open

- WIP

parent 46ba8480
......@@ -67,7 +67,6 @@ function launchTimesheetWeeklyLogging(){
}
});
// !!!
var hourGrid = Ext.create('Ext.grid.Panel', {
store: hourStore,
layout: 'fit',
......@@ -280,7 +279,9 @@ function launchTimesheetWeeklyLogging(){
console.log('GanttButtonController.onWindowKeyDown: code='+keyCode+', ctrl='+keyCtrl);
// cancel hour logging with Esc key
if (27 == keyCode) { this.onButtonCancelLogging(); }
if (27 == keyCode) {
// Cancel Edit
}
if (46 == keyCode) { this.onButtonDeleteEntry(); }
},
......@@ -312,11 +313,10 @@ function launchTimesheetWeeklyLogging(){
var buttonAddEntry = Ext.getCmp('buttonAddEntry');
var buttonDeleteEntry = Ext.getCmp('buttonDeleteEntry');
buttonAddEntry.disable();
buttonDeleteEntry.enable();
// buttonAddEntry.disable();
// buttonDeleteEntry.enable();
rowEditing.cancelEdit();
// !!!
var day = PO.Utilities.dateToPg(new Date());
var hour = new Ext.create('PO.model.timesheet.Hour', {
user_id: @current_user_id@,
......@@ -328,59 +328,6 @@ function launchTimesheetWeeklyLogging(){
rowEditing.startEdit(hour, 0);
},
onButtonStopLogging: function() {
console.log('GanttButtonController.ButtonStopLogging');
var buttonStartLogging = Ext.getCmp('buttonStartLogging');
var buttonStopLogging = Ext.getCmp('buttonStopLogging');
var buttonCancelLogging = Ext.getCmp('buttonCancelLogging');
var buttonAddEntry = Ext.getCmp('buttonAddEntry');
buttonStartLogging.enable();
buttonStopLogging.disable();
buttonCancelLogging.disable();
buttonAddEntry.enable();
// Complete the hour created when starting to log
this.loggingInterval.set('interval_end_time', /\d\d:\d\d/.exec(""+new Date())[0]);
// Not necesary anymore because the store is set to autosync?
this.loggingInterval.save();
rowEditing.cancelEdit();
// Stop logging
this.loggingTask = null;
this.loggingStartDate = null;
// Continue editing the task
var rowIndex = hourStore.count() -1;
rowEditing.startEdit(rowIndex, 3);
},
onButtonCancelLogging: function() {
console.log('GanttButtonController.ButtonCancelLogging');
var buttonStartLogging = Ext.getCmp('buttonStartLogging');
var buttonStopLogging = Ext.getCmp('buttonStopLogging');
var buttonCancelLogging = Ext.getCmp('buttonCancelLogging');
var buttonAddEntry = Ext.getCmp('buttonAddEntry');
buttonStartLogging.enable();
buttonStopLogging.disable();
buttonCancelLogging.disable();
buttonAddEntry.enable();
// Check if a leaf is selected in order to determine if StartLogging can be enabled
var isLeaf = this.ganttTreePanelLeafSelected();
buttonStartLogging.setDisabled(!isLeaf);
buttonAddEntry.setDisabled(!isLeaf);
// Delete the started line
rowEditing.cancelEdit();
hourStore.remove(this.loggingInterval);
// Stop logging
this.loggingTask = null;
this.loggingStartDate = null;
},
onButtonDeleteEntry: function() {
var me = this;
console.log('GanttButtonController.ButtonDeleteLogging');
......@@ -406,12 +353,7 @@ function launchTimesheetWeeklyLogging(){
*/
onTreePanelSelectionChange: function(view, records) {
if (this.debug) { console.log('GanttButtonController.onTreePanelSelectionChange'); }
// Skip changes on the selection model while logging hours
if (this.loggingTask) {
console.log('GanttButtonController.onTreePanelSelectionChange: While logging hours - skip logging');
this.onButtonCancelLogging();
return;
}
var buttonStartLogging = Ext.getCmp('buttonStartLogging');
var buttonAddEntry = Ext.getCmp('buttonAddEntry');
// Not logging already - enable the "start" button
......@@ -519,13 +461,10 @@ function launchTimesheetWeeklyLogging(){
// Testing events
hourButtonPanel.fireEvent('keypress');
// -----------------------------------------------------------------------
// Handle collapsable side menu
sideBarTab.on('click', hourController.onSideBarResize, hourController);
Ext.EventManager.onWindowResize(hourController.onWindowsResize, hourController); // Deal with resizing the main window
};
......@@ -576,12 +515,10 @@ Ext.onReady(function() {
callback: function(records, operation, success) {
var me = this;
if (debug) console.log('PO.store.timesheet.TaskTreeStore: loaded');
if (!success) {
PO.Utilities.reportStoreError("TaskTreeStore", operation);
return;
}
var mainProjectNode = records[0];
mainProjectNode.set('sort_order','0');
me.setRootNode(mainProjectNode);
......@@ -597,16 +534,13 @@ 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 = 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.load({
callback: function() {
console.log('PO.store.project.ProjectMainStore: loaded');
}
});
});
</script>
</div>
......
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