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-25 17:26:22 +03:00
parent 63d4196cb8
commit b0dabde7cd
3 changed files with 14 additions and 7 deletions

View File

@ -13,6 +13,7 @@ class TaskRequest extends EntityRequest
{
$input = $this->all();
/*
// check if we're creating a new client
if ($this->client_id == '-1') {
$client = [
@ -23,7 +24,8 @@ class TaskRequest extends EntityRequest
$input['client_id'] = $this->client_id = $client->public_id;
}
}
*/
// check if we're creating a new project
if ($this->project_id == '-1') {
$project = [

View File

@ -246,7 +246,7 @@
$clientSelect.append(new Option('', ''));
@if (Auth::user()->can('create', ENTITY_CLIENT))
$clientSelect.append(new Option("{{ trans('texts.create_client')}}: $name", '-1'));
//$clientSelect.append(new Option("{{ trans('texts.create_client')}}: $name", '-1'));
@endif
for (var i=0; i<clients.length; i++) {
@ -320,7 +320,11 @@
e.preventDefault();return;
}
if (window.model && model.selectedTask()) {
model.selectedTask().client(new ClientModel(client));
var clientModel = new ClientModel(client);
if (clientId == -1) {
clientModel.name($('#client_name').val());
}
model.selectedTask().client(clientModel);
model.selectedTask().client_id(clientId);
model.selectedTask().project_id(0);
model.selectedTask().project(false);
@ -371,7 +375,6 @@
$('#search').focus();
});
@include('partials/entity_combobox', ['entityType' => ENTITY_CLIENT])
@include('partials/entity_combobox', ['entityType' => ENTITY_PROJECT])
refreshClientList();

View File

@ -394,9 +394,11 @@
if (project.public_id() != self.project_id()) {
return "Project id's don't match " + project.public_id() + " " + self.project_id();
}
var client = projectMap[project.public_id()].client;
if (client.public_id != self.client_id()) {
return "Client and project id's don't match " + client.public_id + " " + self.client_id();
if (project.public_id() != -1) {
var client = projectMap[project.public_id()].client;
if (client.public_id != self.client_id()) {
return "Client and project id's don't match " + client.public_id + " " + self.client_id();
}
}
}