mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 13:54:30 -04:00
Working on time tracker
This commit is contained in:
parent
858724ff94
commit
d3ab0a522e
@ -104,7 +104,7 @@
|
|||||||
<div class="well" data-bind="visible: selectedTask" style="padding-bottom:0px; margin-bottom:0px; display:none;">
|
<div class="well" data-bind="visible: selectedTask" style="padding-bottom:0px; margin-bottom:0px; display:none;">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<form id="taskForm">
|
<form id="taskForm" data-bind="event: { keypress: onFormKeyPress }">
|
||||||
<span class="client-select">
|
<span class="client-select">
|
||||||
{!! Former::select('client_id')
|
{!! Former::select('client_id')
|
||||||
->addOption('', '')
|
->addOption('', '')
|
||||||
@ -214,6 +214,9 @@
|
|||||||
},
|
},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
//var task = new TaskModel(response);
|
||||||
|
self.selectedTask().update(response);
|
||||||
|
self.addTask(self.selectedTask());
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -242,6 +245,13 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.onFormKeyPress = function(data, event) {
|
||||||
|
if (event.which == 13) {
|
||||||
|
self.onSaveClick();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
self.viewClient = function(task) {
|
self.viewClient = function(task) {
|
||||||
self.filter(task.client().displayName());
|
self.filter(task.client().displayName());
|
||||||
return false;
|
return false;
|
||||||
@ -371,15 +381,20 @@
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data) {
|
self.update = function(data) {
|
||||||
|
var times = JSON.parse(data.time_log);
|
||||||
|
data.time_log = false;
|
||||||
ko.mapping.fromJS(data, self.mapping, this);
|
ko.mapping.fromJS(data, self.mapping, this);
|
||||||
self.time_log = ko.observableArray();
|
self.time_log = ko.observableArray();
|
||||||
data = JSON.parse(data.time_log);
|
for (var i=0; i<times.length; i++) {
|
||||||
for (var i=0; i<data.length; i++) {
|
self.time_log.push(new TimeModel(times[i]));
|
||||||
self.time_log.push(new TimeModel(data[i]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data) {
|
||||||
|
self.update(data);
|
||||||
|
}
|
||||||
|
|
||||||
self.showActionButton = function() {
|
self.showActionButton = function() {
|
||||||
self.actionButtonVisible(true);
|
self.actionButtonVisible(true);
|
||||||
}
|
}
|
||||||
@ -435,10 +450,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
self.isRunning = ko.computed(function() {
|
self.isRunning = ko.computed(function() {
|
||||||
if (! self.time_log().length) {
|
var timeLog = self.time_log();
|
||||||
|
if (! timeLog.length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var timeLog = self.time_log();
|
|
||||||
var time = timeLog[timeLog.length-1];
|
var time = timeLog[timeLog.length-1];
|
||||||
return time.isRunning();
|
return time.isRunning();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user