mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
QR codes for invoics as a variable
This commit is contained in:
parent
37682d6f30
commit
a24f23995e
@ -143,6 +143,7 @@ class HtmlEngine
|
|||||||
$data['$credit.datetime'] = &$data['$entity.datetime'];
|
$data['$credit.datetime'] = &$data['$entity.datetime'];
|
||||||
$data['$payment_button'] = ['value' => '<a class="button" href="'.$this->invitation->getPaymentLink().'">'.ctrans('texts.pay_now').'</a>', 'label' => ctrans('texts.pay_now')];
|
$data['$payment_button'] = ['value' => '<a class="button" href="'.$this->invitation->getPaymentLink().'">'.ctrans('texts.pay_now').'</a>', 'label' => ctrans('texts.pay_now')];
|
||||||
$data['$payment_link'] = ['value' => $this->invitation->getPaymentLink(), 'label' => ctrans('texts.pay_now')];
|
$data['$payment_link'] = ['value' => $this->invitation->getPaymentLink(), 'label' => ctrans('texts.pay_now')];
|
||||||
|
$data['$payment_qrcode'] = ['value' => $this->invitation->getPaymentQrCode(), 'label' => ctrans('texts.pay_now')];
|
||||||
|
|
||||||
|
|
||||||
if ($this->entity_string == 'invoice' || $this->entity_string == 'recurring_invoice') {
|
if ($this->entity_string == 'invoice' || $this->entity_string == 'recurring_invoice') {
|
||||||
|
@ -13,6 +13,11 @@ namespace App\Utils\Traits;
|
|||||||
|
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
use BaconQrCode\Renderer\ImageRenderer;
|
||||||
|
use BaconQrCode\Renderer\Image\SvgImageBackEnd;
|
||||||
|
use BaconQrCode\Renderer\RendererStyle\RendererStyle;
|
||||||
|
use BaconQrCode\Writer;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Inviteable.
|
* Class Inviteable.
|
||||||
@ -54,6 +59,24 @@ trait Inviteable
|
|||||||
return $domain.'/client/pay/'.$this->key;
|
return $domain.'/client/pay/'.$this->key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPaymentQrCode()
|
||||||
|
{
|
||||||
|
|
||||||
|
$renderer = new ImageRenderer(
|
||||||
|
new RendererStyle(300),
|
||||||
|
new SvgImageBackEnd()
|
||||||
|
);
|
||||||
|
$writer = new Writer($renderer);
|
||||||
|
|
||||||
|
$qr = $writer->writeString($this->getPaymentLink());
|
||||||
|
|
||||||
|
return "<svg viewBox='0 0 300 300' width='300' height='300' preserveAspectRatio='xMidYMid meet' x='0' y='0' xmlns='http://www.w3.org/2000/svg'>
|
||||||
|
<rect x='0' y='0' width='100%'' height='100%' />
|
||||||
|
{$qr}
|
||||||
|
</svg>";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function getUnsubscribeLink()
|
public function getUnsubscribeLink()
|
||||||
{
|
{
|
||||||
if (Ninja::isHosted()) {
|
if (Ninja::isHosted()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user