mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 05:24:34 -04:00
Show account\client task rate as placeholder
This commit is contained in:
parent
5083d44b0a
commit
61b27b6acb
@ -51,6 +51,7 @@ class ProjectController extends BaseController
|
||||
public function create(ProjectRequest $request)
|
||||
{
|
||||
$data = [
|
||||
'account' => auth()->user()->account,
|
||||
'project' => null,
|
||||
'method' => 'POST',
|
||||
'url' => 'projects',
|
||||
@ -67,6 +68,7 @@ class ProjectController extends BaseController
|
||||
$project = $request->entity();
|
||||
|
||||
$data = [
|
||||
'account' => auth()->user()->account,
|
||||
'project' => $project,
|
||||
'method' => 'PUT',
|
||||
'url' => 'projects/' . $project->public_id,
|
||||
|
@ -52,6 +52,18 @@ class AccountPresenter extends Presenter
|
||||
return Utils::addHttp($this->entity->website);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function taskRate()
|
||||
{
|
||||
if ($this->entity->task_rate) {
|
||||
return Utils::roundSignificant($this->entity->task_rate);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
|
@ -50,4 +50,16 @@ class ClientPresenter extends EntityPresenter
|
||||
|
||||
return sprintf('%s: %s %s', trans('texts.payment_terms'), trans('texts.payment_terms_net'), $client->defaultDaysDue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function taskRate()
|
||||
{
|
||||
if ($this->entity->task_rate) {
|
||||
return Utils::roundSignificant($this->entity->task_rate);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -158,6 +158,7 @@
|
||||
->help(trans('texts.payment_terms_help')) !!}
|
||||
@if ($account->isModuleEnabled(ENTITY_TASK))
|
||||
{!! Former::text('task_rate')
|
||||
->placeholder($account->present()->taskRate)
|
||||
->help('task_rate_help') !!}
|
||||
@endif
|
||||
{!! Former::select('size_id')->addOption('','')
|
||||
|
@ -41,6 +41,7 @@
|
||||
{!! Former::text('name') !!}
|
||||
|
||||
{!! Former::text('task_rate')
|
||||
->placeholder($project && $project->client->task_rate ? $project->client->present()->taskRate : $account->present()->taskRate)
|
||||
->help('task_rate_help') !!}
|
||||
|
||||
</div>
|
||||
@ -65,11 +66,13 @@
|
||||
<script>
|
||||
|
||||
var clients = {!! $clients !!};
|
||||
var clientMap = {};
|
||||
|
||||
$(function() {
|
||||
var $clientSelect = $('select#client_id');
|
||||
for (var i=0; i<clients.length; i++) {
|
||||
var client = clients[i];
|
||||
clientMap[client.public_id] = client;
|
||||
var clientName = getClientDisplayName(client);
|
||||
if (!clientName) {
|
||||
continue;
|
||||
@ -80,7 +83,15 @@
|
||||
$clientSelect.val({{ $clientPublicId }});
|
||||
@endif
|
||||
|
||||
$clientSelect.combobox({highlighter: comboboxHighlighter});
|
||||
$clientSelect.combobox({highlighter: comboboxHighlighter}).change(function() {
|
||||
var client = clientMap[$('#client_id').val()];
|
||||
if (client && parseFloat(client.task_rate)) {
|
||||
var rate = client.task_rate;
|
||||
} else {
|
||||
var rate = {{ $account->present()->taskRate }};
|
||||
}
|
||||
$('#task_rate').attr('placeholder', roundSignificant(rate));
|
||||
});
|
||||
|
||||
@if ($clientPublicId)
|
||||
$('#name').focus();
|
||||
|
Loading…
x
Reference in New Issue
Block a user