1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Fixes for mobile app

This commit is contained in:
Hillel Coren 2019-02-17 13:52:56 +02:00
parent 1da78d8f29
commit 2174ce15d9
7 changed files with 26 additions and 4 deletions

1
.gitignore vendored
View File

@ -39,3 +39,4 @@ tests/_support/_generated/
/c3.php
_ide_helper.php
storage/version.txt

View File

@ -45,7 +45,7 @@ class TaskApiController extends BaseAPIController
{
$tasks = Task::scope()
->withTrashed()
->with('client', 'invoice', 'project')
->with('client', 'invoice', 'project', 'task_status')
->orderBy('updated_at', 'desc');
return $this->listResponse($tasks);

View File

@ -159,7 +159,7 @@ class Task extends EntityModel
$duration += max($endTime - $startTime, 0);
}
return $duration;
return round($duration);
}
public function getTimeLog() {

View File

@ -168,6 +168,7 @@ class InvoiceTransformer extends EntityTransformer
'is_quote' => (bool) $invoice->isType(INVOICE_TYPE_QUOTE), // Temp to support mobile app
'is_public' => (bool) $invoice->is_public,
'filename' => $invoice->getFileName(),
'invoice_design_id' => $invoice->invoice_design_id,
]);
}
}

View File

@ -75,6 +75,8 @@ class TaskTransformer extends EntityTransformer
'is_running' => (bool) $task->is_running,
'custom_value1' => $task->custom_value1 ?: '',
'custom_value2' => $task->custom_value2 ?: '',
'task_status_id' => $task->task_status ? (int) $task->task_status->public_id : 0,
'task_status_sort_order' => $task->task_status_sort_order,
]);
}
}

View File

@ -164,7 +164,7 @@ class UserAccountTransformer extends EntityTransformer
'name' => $account->present()->name ?: '',
'token' => $account->getToken($user->id, $this->tokenName),
'default_url' => SITE_URL,
'plan' => $account->company->plan ?: '',
'plan' => $company->hasActivePlan() && $company->plan ? $company->plan : '',
'logo' => $account->logo ?: '',
'logo_url' => $account->getLogoURL() ?: '',
'currency_id' => (int) $account->currency_id,
@ -216,7 +216,13 @@ class UserAccountTransformer extends EntityTransformer
'email_template_reminder1' => $account->getEmailTemplate('reminder1'),
'email_template_reminder2' => $account->getEmailTemplate('reminder2'),
'email_template_reminder3' => $account->getEmailTemplate('reminder3'),
<<<<<<< HEAD
=======
'has_custom_design1' => (bool) $account->custom_design1,
'has_custom_design2' => (bool) $account->custom_design2,
'has_custom_design3' => (bool) $account->custom_design3,
>>>>>>> cd8b764... Fixes for mobile app
];
}
}

View File

@ -69,7 +69,19 @@
@endif
@endif
@else
refreshPDF();
@if (request()->download)
try {
var doc = generatePDF(invoice, invoice.invoice_design.javascript, true);
var fileName = invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice;
doc.save(fileName + '_' + invoice.invoice_number + '.pdf');
} catch (exception) {
if (location.href.indexOf('/view/') > 0) {
location.href = location.href.replace('/view/', '/download/');
}
}
@else
refreshPDF();
@endif
@endif
});