mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 16:40:56 -04:00
Working on gmail actions
This commit is contained in:
parent
df8fb6f459
commit
bef7454b73
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
use Utils;
|
use Utils;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use App\Models\BalanceAffecting;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
use Laracasts\Presenter\PresentableTrait;
|
||||||
|
use App\Models\BalanceAffecting;
|
||||||
use App\Events\QuoteWasCreated;
|
use App\Events\QuoteWasCreated;
|
||||||
use App\Events\QuoteWasUpdated;
|
use App\Events\QuoteWasUpdated;
|
||||||
use App\Events\InvoiceWasCreated;
|
use App\Events\InvoiceWasCreated;
|
||||||
@ -14,10 +14,12 @@ use App\Events\QuoteInvitationWasEmailed;
|
|||||||
|
|
||||||
class Invoice extends EntityModel implements BalanceAffecting
|
class Invoice extends EntityModel implements BalanceAffecting
|
||||||
{
|
{
|
||||||
|
use PresentableTrait;
|
||||||
use SoftDeletes {
|
use SoftDeletes {
|
||||||
SoftDeletes::trashed as parentTrashed;
|
SoftDeletes::trashed as parentTrashed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected $presenter = 'App\Ninja\Presenters\InvoicePresenter';
|
||||||
protected $dates = ['deleted_at'];
|
protected $dates = ['deleted_at'];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
|
@ -92,6 +92,7 @@ class ContactMailer extends Mailer
|
|||||||
'invoiceId' => $invoice->id,
|
'invoiceId' => $invoice->id,
|
||||||
'invitation' => $invitation,
|
'invitation' => $invitation,
|
||||||
'account' => $account,
|
'account' => $account,
|
||||||
|
'invoice' => $invoice,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($account->attatchPDF()) {
|
if ($account->attatchPDF()) {
|
||||||
|
24
app/Ninja/Presenters/InvoicePresenter.php
Normal file
24
app/Ninja/Presenters/InvoicePresenter.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php namespace App\Ninja\Presenters;
|
||||||
|
|
||||||
|
use Utils;
|
||||||
|
use Laracasts\Presenter\Presenter;
|
||||||
|
|
||||||
|
class InvoicePresenter extends Presenter {
|
||||||
|
|
||||||
|
public function minimumAmountDue()
|
||||||
|
{
|
||||||
|
$amount = $this->entity->getRequestedAmount();
|
||||||
|
$currencyId = $this->entity->client->currency_id;
|
||||||
|
|
||||||
|
return Utils::formatMoney($amount, $currencyId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function totalAmountDue()
|
||||||
|
{
|
||||||
|
$amount = $this->entity->balance;
|
||||||
|
$currencyId = $this->entity->client->currency_id;
|
||||||
|
|
||||||
|
return Utils::formatMoney($amount, $currencyId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
8386
composer.lock
generated
Normal file
8386
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@if (false)
|
@if (Utils::isNinjaDev())
|
||||||
@include('emails.view_action', ['link' => $link, 'entityType' => $entityType])
|
@include('emails.view_action', ['link' => $link, 'entityType' => $entityType])
|
||||||
@endif
|
@endif
|
||||||
{!! $body !!}
|
{!! $body !!}
|
||||||
|
@ -1,17 +1,40 @@
|
|||||||
<script type="application/ld+json">
|
<script type="application/ld+json">
|
||||||
{
|
[
|
||||||
"@context":"http://schema.org",
|
@if ($entityType == ENTITY_INVOICE)
|
||||||
"@type":"EmailMessage",
|
{
|
||||||
"description":"View your {{ $entityType }}",
|
"@context": "http://schema.org",
|
||||||
"action": {
|
"@type": "Invoice",
|
||||||
"@type": "ViewAction",
|
"minimumPaymentDue": {
|
||||||
"url": "{!! $link !!}",
|
"@type": "PriceSpecification",
|
||||||
"name": "View {{ $entityType }}"
|
"price": "{{ $invoice->present()->minimumAmountDue }}"
|
||||||
},
|
},
|
||||||
"publisher": {
|
"paymentStatus": "PaymentDue",
|
||||||
"@type": "Organization",
|
@if ($invoice->due_date)
|
||||||
"name": "Invoice Ninja",
|
"paymentDue": "{{ $invoice->due_date }}T00:00:00+00:00",
|
||||||
"url": "{!! NINJA_WEB_URL !!}"
|
@endif
|
||||||
}
|
"provider": {
|
||||||
}
|
"@type": "Organization",
|
||||||
|
"name": "{{ $account->getDisplayName() }}"
|
||||||
|
},
|
||||||
|
"broker": {
|
||||||
|
"@type": "Organization",
|
||||||
|
"name": "Invoice Ninja",
|
||||||
|
"url": "{!! NINJA_WEB_URL !!}"
|
||||||
|
},
|
||||||
|
"totalPaymentDue": {
|
||||||
|
"@type": "PriceSpecification",
|
||||||
|
"price": "{{ $invoice->present()->totalAmountDue }}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
@endif
|
||||||
|
{
|
||||||
|
"@context": "http://schema.org",
|
||||||
|
"@type": "EmailMessage",
|
||||||
|
"action": {
|
||||||
|
"@type": "ViewAction",
|
||||||
|
"url": "{!! $link !!}",
|
||||||
|
"name": "View {{ $entityType }}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
</script>
|
</script>
|
Loading…
x
Reference in New Issue
Block a user