mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add ‘View Invoice’ button in portal to approved quote
This commit is contained in:
parent
a678044b4b
commit
96666a3af8
@ -1594,6 +1594,27 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
|
|
||||||
return $this->isSent() && ! $this->is_recurring;
|
return $this->isSent() && ! $this->is_recurring;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getInvoiceLinkForQuote($contactId)
|
||||||
|
{
|
||||||
|
if (! $this->quote_invoice_id) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$invoice = static::scope($this->quote_invoice_id)->with('invitations')->first();
|
||||||
|
|
||||||
|
if (! $invoice) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($invoice->invitations as $invitation) {
|
||||||
|
if ($invitation->contact_id == $contactId) {
|
||||||
|
return $invitation->getLink();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Invoice::creating(function ($invoice) {
|
Invoice::creating(function ($invoice) {
|
||||||
|
@ -164,6 +164,8 @@
|
|||||||
{!! Button::normal(trans('texts.download'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}
|
{!! Button::normal(trans('texts.download'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}
|
||||||
@if ($showApprove)
|
@if ($showApprove)
|
||||||
{!! Button::success(trans('texts.approve'))->withAttributes(['id' => 'approveButton', 'onclick' => 'onApproveClick()'])->large() !!}
|
{!! Button::success(trans('texts.approve'))->withAttributes(['id' => 'approveButton', 'onclick' => 'onApproveClick()'])->large() !!}
|
||||||
|
@elseif ($invoiceLink = $invoice->getInvoiceLinkForQuote($contact->id))
|
||||||
|
{!! Button::success(trans('texts.view_invoice'))->asLinkTo($invoiceLink)->large() !!}
|
||||||
@endif
|
@endif
|
||||||
@elseif ( ! $invoice->canBePaid())
|
@elseif ( ! $invoice->canBePaid())
|
||||||
{!! Button::normal(trans('texts.download'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}
|
{!! Button::normal(trans('texts.download'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user