mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Add link to payments from invoice page
This commit is contained in:
parent
9fe89eea1c
commit
ddbc254d4b
@ -89,7 +89,7 @@ class InvoiceController extends BaseController
|
||||
{
|
||||
$account = Auth::user()->account;
|
||||
$invoice = Invoice::scope($publicId)
|
||||
->with('invitations', 'account.country', 'client.contacts', 'client.country', 'invoice_items')
|
||||
->with('invitations', 'account.country', 'client.contacts', 'client.country', 'invoice_items', 'payments')
|
||||
->withTrashed()
|
||||
->firstOrFail();
|
||||
|
||||
@ -155,6 +155,14 @@ class InvoiceController extends BaseController
|
||||
if (!$invoice->is_recurring && $invoice->balance > 0) {
|
||||
$actions[] = ['url' => 'javascript:onPaymentClick()', 'label' => trans('texts.enter_payment')];
|
||||
}
|
||||
|
||||
foreach ($invoice->payments as $payment) {
|
||||
$label = trans("texts.view_payment");
|
||||
if (count($invoice->payments) > 1) {
|
||||
$label .= ' - ' . $account->formatMoney($payment->amount, $invoice->client);
|
||||
}
|
||||
$actions[] = ['url' => $payment->present()->url, 'label' => $label];
|
||||
}
|
||||
}
|
||||
|
||||
if (count($actions) > 3) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php namespace App\Ninja\Presenters;
|
||||
|
||||
use URL;
|
||||
use Utils;
|
||||
use Laracasts\Presenter\Presenter;
|
||||
|
||||
@ -24,4 +25,14 @@ class PaymentPresenter extends Presenter {
|
||||
}
|
||||
}
|
||||
|
||||
public function url()
|
||||
{
|
||||
return URL::to('/payments/' . $this->entity->public_id . '/edit');
|
||||
}
|
||||
|
||||
public function link()
|
||||
{
|
||||
return link_to('/payments/' . $this->entity->public_id . '/edit', $this->entity->getDisplayName());
|
||||
}
|
||||
|
||||
}
|
@ -1082,7 +1082,7 @@ $LANG = array(
|
||||
'create_all_help' => 'Allow user to create and modify records',
|
||||
'view_all_help' => 'Allow user to view records they didn\'t create',
|
||||
'edit_all_help' => 'Allow user to modify records they didn\'t create',
|
||||
|
||||
'view_payment' => 'View Payment',
|
||||
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user