Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-timesheet2-weekly
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-timesheet2-weekly
Commits
4c87a844
Commit
4c87a844
authored
May 25, 2021
by
Project Open
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- WIP for Champ timesheet redesign
parent
fb63d69c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
127 additions
and
28 deletions
+127
-28
index.adp
www/index.adp
+15
-7
HourWeeklyProxy.js
www/js/HourWeeklyProxy.js
+112
-21
No files found.
www/index.adp
View file @
4c87a844
...
@@ -110,6 +110,7 @@ function launchTimesheetWeeklyLogging(){
...
@@ -110,6 +110,7 @@ function launchTimesheetWeeklyLogging(){
editor: {
editor: {
xtype: 'combo',
xtype: 'combo',
queryMode: 'local',
queryMode: 'local',
// allowBlank: false,
store: projectStore,
store: projectStore,
displayField: 'project_name',
displayField: 'project_name',
valueField: 'project_id',
valueField: 'project_id',
...
@@ -134,21 +135,28 @@ function launchTimesheetWeeklyLogging(){
...
@@ -134,21 +135,28 @@ function launchTimesheetWeeklyLogging(){
if (!taskModel) return "";
if (!taskModel) return "";
return taskModel.get('project_name');
return taskModel.get('project_name');
},
},
editor: { xtype: 'pocombotree', store: taskTreeStore, queryMode: 'local', displayField: 'project_name', valueField: 'id'}
editor: {
xtype: 'pocombotree',
store: taskTreeStore,
queryMode: 'local',
// allowBlank: false,
displayField: 'project_name',
valueField: 'id'
}
},
},
{text: "<div align=center>Mon<br>3/29/2021</div>", width: 65, align: "right", dataIndex: 'hours_0',
{text: "<div align=center>Mon<br>3/29/2021</div>", width: 65, align: "right", dataIndex: 'hours_0',
editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
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_1',
{text: "<div align=center>Tue<br>3/30/2021</div>", width: 65, align: "right", dataIndex: 'hours_1',
editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Wed<br>
2/3
1/2021</div>", width: 65, align: "right", dataIndex: 'hours_2',
{text: "<div align=center>Wed<br>
4/
1/2021</div>", width: 65, align: "right", dataIndex: 'hours_2',
editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
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_3',
{text: "<div align=center>Thu<br>
4/2
/2021</div>", width: 65, align: "right", dataIndex: 'hours_3',
editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
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_4',
{text: "<div align=center>Fri<br>
4/3
/2021</div>", width: 65, align: "right", dataIndex: 'hours_4',
editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
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_5',
{text: "<div align=center>Sat<br>
4/4
/2021</div>", width: 65, align: "right", dataIndex: 'hours_5',
editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
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_6',
{text: "<div align=center>Sun<br>
4/5
/2021</div>", width: 65, align: "right", dataIndex: 'hours_6',
editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{ text: "Sum", width: 65, dataIndex: 'note', align: "center",
{ text: "Sum", width: 65, dataIndex: 'note', align: "center",
renderer: function(value, metaData, record, rowIndex, colIndex, store, view) {
renderer: function(value, metaData, record, rowIndex, colIndex, store, view) {
...
@@ -244,7 +252,7 @@ Ext.onReady(function() {
...
@@ -244,7 +252,7 @@ Ext.onReady(function() {
var debug = PO.Utilities.getDebug('default');
var debug = PO.Utilities.getDebug('default');
var taskTreeStore = Ext.create('PO.store.timesheet.TaskTreeStore');
var taskTreeStore = Ext.create('PO.store.timesheet.TaskTreeStore');
var hourStore = Ext.create('PO.store.timesheet.HourStore');
var hourStore = Ext.create('PO.store.timesheet.HourStore');
var hourWeeklyStore = Ext.create('PO.tsweekly.HourWeeklyStore'
);
var hourWeeklyStore = Ext.create('PO.tsweekly.HourWeeklyStore'
, {hourStore: hourStore}); // Create _after_ hourStore
var projectStore = Ext.create('PO.store.project.ProjectMainStore');
var projectStore = Ext.create('PO.store.project.ProjectMainStore');
// Use a "store coodinator" in order to launchTimesheetWeeklyLogging() only
// Use a "store coodinator" in order to launchTimesheetWeeklyLogging() only
...
...
www/js/HourWeeklyProxy.js
View file @
4c87a844
...
@@ -7,10 +7,33 @@ Ext.define('PO.tsweekly.HourWeeklyProxy', {
...
@@ -7,10 +7,33 @@ Ext.define('PO.tsweekly.HourWeeklyProxy', {
debug
:
true
,
debug
:
true
,
constructor
:
function
(
config
)
{
constructor
:
function
(
config
)
{
var
me
=
this
;
if
(
me
.
debug
)
{
console
.
log
(
'HourWeeklyProxy.constructor: Started'
);
console
.
log
(
config
);
}
this
.
callParent
(
arguments
);
this
.
callParent
(
arguments
);
},
if
(
!
me
.
hourStore
)
me
.
hourStore
=
Ext
.
StoreManager
.
get
(
'hourStore'
);
me
.
hourStore
.
on
(
"add"
,
me
.
onHourAdd
,
me
);
me
.
hourStore
.
on
(
"update"
,
me
.
onHourUpdate
,
me
);
me
.
hourStore
.
on
(
"remove"
,
me
.
onHourRemove
,
me
);
me
.
hourStore
.
on
(
"load"
,
me
.
onHourLoad
,
me
);
if
(
me
.
debug
)
console
.
log
(
'HourWeeklyProxy.constructor: Finished'
);
},
onHourAdd
:
function
(
a
,
b
,
c
,
d
,
e
)
{
console
.
log
(
'HourWeeklyProxy.onHourAdd'
);
},
onHourRemove
:
function
(
a
,
b
,
c
,
d
,
e
)
{
console
.
log
(
'HourWeeklyProxy.onHourRemove'
);
},
onHourUpdate
:
function
(
a
,
b
,
c
,
d
,
e
)
{
console
.
log
(
'HourWeeklyProxy.onHourUpdate'
);
},
onHourLoad
:
function
(
a
,
b
,
c
,
d
,
e
)
{
console
.
log
(
'HourWeeklyProxy.onHourLoad'
);
},
/**
/**
* Fake processing function to commit the records, set the current operation
* Fake processing function to commit the records, set the current operation
* to successful and call the callback if provided. This function is shared
* to successful and call the callback if provided. This function is shared
...
@@ -31,23 +54,88 @@ Ext.define('PO.tsweekly.HourWeeklyProxy', {
...
@@ -31,23 +54,88 @@ Ext.define('PO.tsweekly.HourWeeklyProxy', {
Ext
.
callback
(
callback
,
scope
||
this
,
[
operation
]);
Ext
.
callback
(
callback
,
scope
||
this
,
[
operation
]);
},
},
syncHours
:
function
(
records
)
{
var
me
=
this
;
if
(
me
.
debug
)
{
console
.
log
(
'HourWeeklyProxy.syncHours: Started'
);
console
.
log
(
records
);
}
if
(
!
records
)
return
;
// Create/update hours in the HoursStore
var
hourStore
=
me
.
hourStore
;
// Sync from hourWeeklyStore to HourStore
for
(
var
i
=
0
;
i
<
records
.
length
;
i
++
)
{
var
record
=
records
[
i
];
var
weekDate
=
PO
.
Utilities
.
pgToDate
(
record
.
get
(
'day'
));
var
dayOfWeek
=
weekDate
.
getDay
()
-
1
;
if
(
dayOfWeek
<
0
)
dayOfWeek
=
dayOfWeek
+
7
;
weekDate
.
setHours
(
-
24
*
dayOfWeek
);
var
project_id
=
record
.
get
(
'project_id'
)
+
""
;
var
user_id
=
record
.
get
(
'user_id'
)
+
""
;
console
.
log
(
record
);
for
(
d
=
0
;
d
<
7
;
d
++
)
{
var
hours
=
parseFloat
(
record
.
get
(
'hours_'
+
d
));
if
(
!
hours
)
continue
console
.
log
(
'HourWeeklyProxy.syncHours: d='
+
d
+
', hours='
+
hours
);
// Calculate the date of the day-of-week in PG format
var
weekDateDay
=
new
Date
(
weekDate
.
getTime
());
weekDateDay
.
setHours
(
24
*
d
);
var
weekDateDayPg
=
PO
.
Utilities
.
dateToPg
(
weekDateDay
).
substring
(
0
,
10
);
// Check if the im_hours object already exists
var
hourFound
=
null
;
hourStore
.
each
(
function
(
hour
)
{
var
hourUser
=
hour
.
get
(
'user_id'
);
if
(
hourUser
!==
user_id
)
return
;
var
hourDate
=
hour
.
get
(
'day'
).
substring
(
0
,
10
);
if
(
hourDate
!==
weekDateDayPg
)
return
;
var
hourProjectId
=
hour
.
get
(
'project_id'
);
if
(
hourProjectId
!==
project_id
)
return
;
hourFound
=
hour
;
return
false
;
// abort and exit iteration
});
console
.
log
(
'HourWeeklyProxy.syncHours: d='
+
d
+
', found im_hour:'
);
console
.
log
(
hourFound
);
if
(
!
hourFound
)
{
// Not found - we have to create a new entry in the im_hours store
var
hourFound
=
new
Ext
.
create
(
'PO.model.timesheet.Hour'
,
{
project_id
:
project_id
,
user_id
:
user_id
,
day
:
weekDateDayPg
});
me
.
hourStore
.
add
(
hourFound
);
}
else
{
// Hour found - let's update the logged hours
hourFound
.
set
(
'hours'
,
hours
);
}
me
.
hourStore
.
sync
();
}
}
if
(
me
.
debug
)
console
.
log
(
'HourWeeklyProxy.syncHours: Finished'
);
},
//inherit docs
/**
* A new record has been added to the HourWeeklyStore,
* probably by the user by pressing (+) button.
*/
create
:
function
(
operation
,
callback
,
scope
)
{
create
:
function
(
operation
,
callback
,
scope
)
{
var
me
=
this
;
var
me
=
this
;
if
(
me
.
debug
)
{
console
.
log
(
'HourWeeklyProxy.create: Started'
);
console
.
log
(
operation
);
}
if
(
me
.
debug
)
{
console
.
log
(
'HourWeeklyProxy.create: Started'
);
console
.
log
(
operation
);
}
this
.
updateOperation
.
apply
(
this
,
arguments
);
this
.
updateOperation
.
apply
(
this
,
arguments
);
me
.
syncHours
(
operation
.
records
);
if
(
me
.
debug
)
console
.
log
(
'HourWeeklyProxy.create: Finished'
);
if
(
me
.
debug
)
console
.
log
(
'HourWeeklyProxy.create: Finished'
);
},
},
//inherit docs
//inherit docs
read
:
function
(
operation
,
callback
,
scope
)
{
read
:
function
(
operation
,
callback
,
scope
)
{
var
me
=
this
;
var
me
=
this
;
if
(
me
.
debug
)
{
console
.
log
(
'HourWeeklyProxy.read: Started'
);
console
.
log
(
operation
);
}
if
(
me
.
debug
)
{
console
.
log
(
'HourWeeklyProxy.read: Started'
);
console
.
log
(
operation
);
}
operation
.
setStarted
();
operation
.
setStarted
();
var
data
=
[
var
data
=
[
...
@@ -70,38 +158,41 @@ Ext.define('PO.tsweekly.HourWeeklyProxy', {
...
@@ -70,38 +158,41 @@ Ext.define('PO.tsweekly.HourWeeklyProxy', {
if
(
typeof
callback
==
'function'
)
{
if
(
typeof
callback
==
'function'
)
{
callback
.
call
(
scope
||
this
,
operation
);
callback
.
call
(
scope
||
this
,
operation
);
}
}
if
(
me
.
debug
)
console
.
log
(
'HourWeeklyProxy.read: Finished'
);
if
(
me
.
debug
)
console
.
log
(
'HourWeeklyProxy.read: Finished'
);
},
},
//inherit docs
//inherit docs
update
:
function
(
operation
,
callback
,
scope
)
{
update
:
function
(
operation
,
callback
,
scope
)
{
var
me
=
this
;
var
me
=
this
;
if
(
me
.
debug
)
{
console
.
log
(
'HourWeeklyProxy.update: Started'
);
console
.
log
(
operation
);
}
if
(
me
.
debug
)
{
console
.
log
(
'HourWeeklyProxy.update: Started'
);
console
.
log
(
operation
);
}
this
.
updateOperation
.
apply
(
this
,
arguments
);
this
.
updateOperation
.
apply
(
this
,
arguments
);
me
.
syncHours
(
operation
.
records
);
if
(
me
.
debug
)
console
.
log
(
'HourWeeklyProxy.update: Finished'
);
if
(
me
.
debug
)
console
.
log
(
'HourWeeklyProxy.update: Finished'
);
},
},
//inherit
//inherit
destroy
:
function
(
operation
,
callback
,
scope
)
{
destroy
:
function
(
operation
,
callback
,
scope
)
{
var
me
=
this
;
var
me
=
this
;
if
(
me
.
debug
)
{
console
.
log
(
'HourWeeklyProxy.destroy: Started'
);
console
.
log
(
operation
);
}
if
(
me
.
debug
)
{
console
.
log
(
'HourWeeklyProxy.destroy: Started'
);
console
.
log
(
operation
);
}
this
.
updateOperation
.
apply
(
this
,
arguments
);
this
.
updateOperation
.
apply
(
this
,
arguments
);
me
.
syncHours
(
operation
.
records
);
if
(
me
.
debug
)
console
.
log
(
'HourWeeklyProxy.destroy: Finished'
);
if
(
me
.
debug
)
console
.
log
(
'HourWeeklyProxy.destroy: Finished'
);
},
},
clear
:
function
()
{
clear
:
function
()
{
var
me
=
this
;
var
me
=
this
;
if
(
me
.
debug
)
{
console
.
log
(
'HourWeeklyProxy.clear: Started'
);
console
.
log
(
operation
);
}
if
(
me
.
debug
)
{
console
.
log
(
'HourWeeklyProxy.clear: Started'
);
console
.
log
(
operation
);
}
this
.
updateOperation
.
apply
(
this
,
arguments
);
this
.
updateOperation
.
apply
(
this
,
arguments
);
me
.
syncHours
(
operation
.
records
);
if
(
me
.
debug
)
console
.
log
(
'HourWeeklyProxy.clear: Finished'
);
if
(
me
.
debug
)
console
.
log
(
'HourWeeklyProxy.clear: Finished'
);
}
}
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment