mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-13 06:34:37 -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)
|
public function create(ProjectRequest $request)
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
|
'account' => auth()->user()->account,
|
||||||
'project' => null,
|
'project' => null,
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'projects',
|
'url' => 'projects',
|
||||||
@ -67,6 +68,7 @@ class ProjectController extends BaseController
|
|||||||
$project = $request->entity();
|
$project = $request->entity();
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
|
'account' => auth()->user()->account,
|
||||||
'project' => $project,
|
'project' => $project,
|
||||||
'method' => 'PUT',
|
'method' => 'PUT',
|
||||||
'url' => 'projects/' . $project->public_id,
|
'url' => 'projects/' . $project->public_id,
|
||||||
|
@ -52,6 +52,18 @@ class AccountPresenter extends Presenter
|
|||||||
return Utils::addHttp($this->entity->website);
|
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
|
* @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 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')) !!}
|
->help(trans('texts.payment_terms_help')) !!}
|
||||||
@if ($account->isModuleEnabled(ENTITY_TASK))
|
@if ($account->isModuleEnabled(ENTITY_TASK))
|
||||||
{!! Former::text('task_rate')
|
{!! Former::text('task_rate')
|
||||||
|
->placeholder($account->present()->taskRate)
|
||||||
->help('task_rate_help') !!}
|
->help('task_rate_help') !!}
|
||||||
@endif
|
@endif
|
||||||
{!! Former::select('size_id')->addOption('','')
|
{!! Former::select('size_id')->addOption('','')
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
{!! Former::text('name') !!}
|
{!! Former::text('name') !!}
|
||||||
|
|
||||||
{!! Former::text('task_rate')
|
{!! Former::text('task_rate')
|
||||||
|
->placeholder($project && $project->client->task_rate ? $project->client->present()->taskRate : $account->present()->taskRate)
|
||||||
->help('task_rate_help') !!}
|
->help('task_rate_help') !!}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -65,11 +66,13 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
var clients = {!! $clients !!};
|
var clients = {!! $clients !!};
|
||||||
|
var clientMap = {};
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
var $clientSelect = $('select#client_id');
|
var $clientSelect = $('select#client_id');
|
||||||
for (var i=0; i<clients.length; i++) {
|
for (var i=0; i<clients.length; i++) {
|
||||||
var client = clients[i];
|
var client = clients[i];
|
||||||
|
clientMap[client.public_id] = client;
|
||||||
var clientName = getClientDisplayName(client);
|
var clientName = getClientDisplayName(client);
|
||||||
if (!clientName) {
|
if (!clientName) {
|
||||||
continue;
|
continue;
|
||||||
@ -80,7 +83,15 @@
|
|||||||
$clientSelect.val({{ $clientPublicId }});
|
$clientSelect.val({{ $clientPublicId }});
|
||||||
@endif
|
@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)
|
@if ($clientPublicId)
|
||||||
$('#name').focus();
|
$('#name').focus();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user