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
6331f44054
commit
a639ff49f0
@ -17,7 +17,7 @@ class TaskRequest extends EntityRequest
|
||||
if ($this->project_id == '-1') {
|
||||
$project = [
|
||||
'name' => trim($this->project_name),
|
||||
'client_id' => Client::getPrivateId($this->client),
|
||||
'client_id' => Client::getPrivateId($this->client_id ?: $this->client),
|
||||
];
|
||||
if (Project::validate($project) === true) {
|
||||
$project = app('App\Ninja\Repositories\ProjectRepository')->save($project);
|
||||
|
@ -84,7 +84,7 @@
|
||||
<!-- Navbar Filter -->
|
||||
<div class="input-group input-group-lg">
|
||||
<span class="input-group-addon" style="width:1%;" title="{{ trans('texts.filter_sort') }}"><span class="glyphicon glyphicon-filter"></span></span>
|
||||
<input type="search" class="form-control search" autocomplete="off" autofocus="autofocus"
|
||||
<input id="search" type="search" class="form-control search" autocomplete="off" autofocus="autofocus"
|
||||
data-bind="event: { focus: onFilterFocus, input: onFilterChanged, keypress: onFilterKeyPress }, value: filter, valueUpdate: 'afterkeydown', attr: {placeholder: placeholder}">
|
||||
<span class="input-group-addon" style="width:1%;" title="{{ trans('texts.refresh') }}"><span class="glyphicon glyphicon-repeat"></span></span>
|
||||
</div>
|
||||
@ -209,7 +209,6 @@
|
||||
var clientMap = {};
|
||||
var projectMap = {};
|
||||
var projectsForClientMap = {};
|
||||
var projectsForAllClients = [];
|
||||
|
||||
function refreshProjectList(forceClear) {
|
||||
var clientId = $('input[name=client_id]').val();
|
||||
@ -222,7 +221,7 @@
|
||||
}
|
||||
@endif
|
||||
|
||||
var list = (clientId && ! forceClear) ? (projectsForClientMap.hasOwnProperty(clientId) ? projectsForClientMap[clientId] : []).concat(projectsForAllClients) : projects;
|
||||
var list = (clientId && ! forceClear) ? (projectsForClientMap.hasOwnProperty(clientId) ? projectsForClientMap[clientId] : []) : projects;
|
||||
|
||||
for (var i=0; i<list.length; i++) {
|
||||
var project = list[i];
|
||||
@ -231,6 +230,15 @@
|
||||
$('select#project_id').combobox('refresh');
|
||||
}
|
||||
|
||||
function addProjectToMaps(project) {
|
||||
var client = project.client;
|
||||
projectMap[project.public_id] = project;
|
||||
if (!projectsForClientMap.hasOwnProperty(client.public_id)) {
|
||||
projectsForClientMap[client.public_id] = [];
|
||||
}
|
||||
projectsForClientMap[client.public_id].push(project);
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
// setup clients and project comboboxes
|
||||
@ -238,17 +246,7 @@
|
||||
|
||||
for (var i=0; i<projects.length; i++) {
|
||||
var project = projects[i];
|
||||
projectMap[project.public_id] = project;
|
||||
|
||||
var client = project.client;
|
||||
if (!client) {
|
||||
projectsForAllClients.push(project);
|
||||
} else {
|
||||
if (!projectsForClientMap.hasOwnProperty(client.public_id)) {
|
||||
projectsForClientMap[client.public_id] = [];
|
||||
}
|
||||
projectsForClientMap[client.public_id].push(project);
|
||||
}
|
||||
addProjectToMaps(project)
|
||||
}
|
||||
|
||||
for (var i=0; i<clients.length; i++) {
|
||||
@ -310,6 +308,12 @@
|
||||
}
|
||||
});
|
||||
|
||||
Mousetrap.bind('/', function(e) {
|
||||
console.log('clicked..');
|
||||
event.preventDefault();
|
||||
$('#search').focus();
|
||||
});
|
||||
|
||||
@include('partials/entity_combobox', ['entityType' => ENTITY_PROJECT])
|
||||
|
||||
$clientSelect.trigger('change');
|
||||
|
@ -35,15 +35,16 @@
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
var task = self.selectedTask();
|
||||
if (task.isNew()) {
|
||||
//self.addTask(task);
|
||||
} else {
|
||||
//self.removeTask(task.original);
|
||||
//self.addTask(task);
|
||||
var projectId = $('input[name=project_id]').val();
|
||||
if (projectId == -1) {
|
||||
var project = response.project;
|
||||
project.client = response.client;
|
||||
projects.push(project);
|
||||
addProjectToMaps(project);
|
||||
refreshProjectList();
|
||||
}
|
||||
task.update(response);
|
||||
self.formChanged(false);
|
||||
//self.selectTask(task);
|
||||
},
|
||||
});
|
||||
}
|
||||
@ -235,7 +236,7 @@
|
||||
self.placeholder = ko.computed(function() {
|
||||
if (self.selectedTask()) {
|
||||
if (self.selectedTask().description()) {
|
||||
return self.selectedTask().description();
|
||||
return self.selectedTask().description.truncated();
|
||||
} else {
|
||||
return "{{ trans('texts.no_description') }}"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user