mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01: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['$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_qrcode'] = ['value' => $this->invitation->getPaymentQrCode(), 'label' => ctrans('texts.pay_now')];
|
||||
|
||||
|
||||
if ($this->entity_string == 'invoice' || $this->entity_string == 'recurring_invoice') {
|
||||
|
@ -13,6 +13,11 @@ namespace App\Utils\Traits;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use Illuminate\Support\Str;
|
||||
use BaconQrCode\Renderer\ImageRenderer;
|
||||
use BaconQrCode\Renderer\Image\SvgImageBackEnd;
|
||||
use BaconQrCode\Renderer\RendererStyle\RendererStyle;
|
||||
use BaconQrCode\Writer;
|
||||
|
||||
|
||||
/**
|
||||
* Class Inviteable.
|
||||
@ -54,6 +59,24 @@ trait Inviteable
|
||||
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()
|
||||
{
|
||||
if (Ninja::isHosted()) {
|
||||
|
Loading…
Reference in New Issue
Block a user