1
0
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:
Hillel Coren 2017-09-28 12:34:02 +03:00
parent 657eb454d9
commit b98dfa254d
2 changed files with 32 additions and 15 deletions

View File

@ -101,6 +101,16 @@
.list-group-item-type7:before { background-color: #a87821; }
.list-group-item-type8:before { background-color: #676767; }
.list-group-item-running:after {
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 6px;
content: "";
background-color: #c9302c;
}
body {
margin-bottom: 60px;
}
@ -254,7 +264,7 @@
</div>
<div data-bind="foreach: filteredTasks">
<a href="#" data-bind="click: $parent.selectTask, event: { mouseover: showActionButton, mouseout: hideActionButton }, css: listItemState"
<a href="#" data-bind="click: $parent.selectTask, event: { mouseover: onMouseOver, mouseout: onMouseOut }, css: listItemState"
class="list-group-item">
<div class="pull-right" style="text-align:right;">
<div data-bind="visible: actionButtonVisible()"

View File

@ -424,7 +424,7 @@
self.project_id = ko.observable();
self.client = ko.observable();
self.project = ko.observable();
self.actionButtonVisible = ko.observable(false);
self.isHovered = ko.observable(false);
self.created_at = ko.observable(moment().format('YYYY-MM-DD HH:mm:ss'));
self.mapping = {
@ -603,16 +603,29 @@
return self.public_id();
});
self.isRunning = ko.computed(function() {
var timeLog = self.time_log();
if (! timeLog.length) {
return false;
}
var time = timeLog[timeLog.length-1];
return time.isRunning();
});
self.actionButtonVisible = ko.computed(function() {
return self.isHovered();
});
self.hasFocus = function() {
console.log('focused... ' + self.public_id());
}
self.showActionButton = function() {
self.actionButtonVisible(true);
self.onMouseOver = function() {
self.isHovered(true);
}
self.hideActionButton = function() {
self.actionButtonVisible(false);
self.onMouseOut = function() {
self.isHovered(false);
}
self.addTime = function(time) {
@ -703,6 +716,9 @@
str += ' changed fade-color';
}
}
if (self.isRunning()) {
str += ' list-group-item-running';
}
if (! self.project()) {
return str;
}
@ -712,15 +728,6 @@
});
self.isRunning = ko.computed(function() {
var timeLog = self.time_log();
if (! timeLog.length) {
return false;
}
var time = timeLog[timeLog.length-1];
return time.isRunning();
});
self.clientName = ko.computed(function() {
return self.client() ? self.client().displayName() : '';
});