mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Working on time tracker
This commit is contained in:
parent
e37a3b7c73
commit
94d8fbfdb9
@ -202,7 +202,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="pull-right" style="text-align:right">
|
||||
<div data-bind="text: duration, style: { fontWeight: isRunning() ? 'bold' : '' }"></div>
|
||||
<div data-bind="text: totalDuration, style: { fontWeight: isRunning() ? 'bold' : '' }"></div>
|
||||
<div data-bind="text: age, style: { fontWeight: isRunning() ? 'bold' : '' }" style="padding-top: 2px"></div>
|
||||
</div>
|
||||
<h4 class="list-group-item-heading">
|
||||
|
@ -366,7 +366,7 @@
|
||||
}
|
||||
setTimeout(function() {
|
||||
self.isStartEnabled(true);
|
||||
}, 2000);
|
||||
}, 2000);
|
||||
},
|
||||
});
|
||||
}
|
||||
@ -545,15 +545,14 @@
|
||||
return time.age();
|
||||
});
|
||||
|
||||
self.duration = ko.computed(function() {
|
||||
model.clock(); // bind to the clock
|
||||
self.calcDuration = function(total) {
|
||||
if (! self.time_log().length) {
|
||||
return '0:00:00';
|
||||
}
|
||||
var time = self.lastTime();
|
||||
var now = new Date().getTime();
|
||||
var duration = 0;
|
||||
if (time.isRunning()) {
|
||||
if (time.isRunning() && ! total) {
|
||||
var duration = now - (time.startTime() * 1000);
|
||||
duration = Math.floor(duration / 100) / 10;
|
||||
} else {
|
||||
@ -564,6 +563,16 @@
|
||||
|
||||
var duration = moment.duration(duration * 1000);
|
||||
return Math.floor(duration.asHours()) + moment.utc(duration.asMilliseconds()).format(":mm:ss");
|
||||
}
|
||||
|
||||
self.totalDuration = ko.computed(function() {
|
||||
model.clock(); // bind to the clock
|
||||
return self.calcDuration(true);
|
||||
});
|
||||
|
||||
self.duration = ko.computed(function() {
|
||||
model.clock(); // bind to the clock
|
||||
return self.calcDuration(false);
|
||||
});
|
||||
}
|
||||
|
||||
@ -662,7 +671,8 @@
|
||||
});
|
||||
|
||||
self.duration = ko.computed(function() {
|
||||
return self.endTime() - self.startTime();
|
||||
model.clock(); // bind to the clock
|
||||
return (self.endTime() || moment().unix()) - self.startTime();
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user