mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Working on time tracker
This commit is contained in:
parent
92fbcffcc0
commit
b02d7e810b
@ -98,8 +98,8 @@
|
|||||||
<div data-bind="visible: actionButtonVisible()"
|
<div data-bind="visible: actionButtonVisible()"
|
||||||
data-bindx="style : { visibility : actionButtonVisible() ? '' : 'hidden' }">
|
data-bindx="style : { visibility : actionButtonVisible() ? '' : 'hidden' }">
|
||||||
|
|
||||||
<button type="button" data-bind="css: startClass"
|
<button type="button" data-bind="css: startClass, click: onStartClick"
|
||||||
class="btn btn-sm" style="padding-left:0px; margin-top:5px;">
|
class="btn btn-sm" style="padding-left:0px; padding-right: 12px; margin-top:5px;">
|
||||||
<span data-bind="css: startIcon"></span>
|
<span data-bind="css: startIcon"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -160,9 +160,8 @@
|
|||||||
|
|
||||||
self.onStartClick = function() {
|
self.onStartClick = function() {
|
||||||
if (self.selectedTask()) {
|
if (self.selectedTask()) {
|
||||||
console.log('start w/selected...');
|
self.selectedTask().onStartClick();
|
||||||
} else {
|
} else {
|
||||||
console.log('start w/o selected...');
|
|
||||||
var time = new TimeModel();
|
var time = new TimeModel();
|
||||||
time.startTime(moment().unix());
|
time.startTime(moment().unix());
|
||||||
var task = new TaskModel();
|
var task = new TaskModel();
|
||||||
@ -295,6 +294,18 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.onStartClick = function() {
|
||||||
|
if (self.isRunning()) {
|
||||||
|
var times = self.time_log();
|
||||||
|
var time = times[times.length-1];
|
||||||
|
time.endTime(moment().unix());
|
||||||
|
} else {
|
||||||
|
var time = new TimeModel();
|
||||||
|
time.startTime(moment().unix());
|
||||||
|
self.addTime(time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.isRunning = ko.computed(function() {
|
self.isRunning = ko.computed(function() {
|
||||||
if (! self.time_log().length) {
|
if (! self.time_log().length) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user