mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 10:50:54 -04:00
injecting signature and sending it to backend
This commit is contained in:
parent
7d1eeafebe
commit
6319c208df
@ -107,7 +107,7 @@ class Designer
|
|||||||
</div>'
|
</div>'
|
||||||
;
|
;
|
||||||
|
|
||||||
$signature = '<div></div>'; /** @wip */
|
$signature = '<img class="h-40" src="$contact.signature" />';
|
||||||
$logo = '<div></div>';
|
$logo = '<div></div>';
|
||||||
|
|
||||||
if (!$this->entity->user->account->isPaid()) {
|
if (!$this->entity->user->account->isPaid()) {
|
||||||
|
@ -14,6 +14,7 @@ namespace App\Http\Controllers\ClientPortal;
|
|||||||
|
|
||||||
use App\Filters\PaymentFilters;
|
use App\Filters\PaymentFilters;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Jobs\Invoice\InjectSignature;
|
||||||
use App\Models\CompanyGateway;
|
use App\Models\CompanyGateway;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
@ -71,8 +72,6 @@ class PaymentController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
// $signature = request()->signature // data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAADICA..
|
|
||||||
|
|
||||||
$invoices = Invoice::whereIn('id', $this->transformKeys(request()->invoices))
|
$invoices = Invoice::whereIn('id', $this->transformKeys(request()->invoices))
|
||||||
->where('company_id', auth('contact')->user()->company->id)
|
->where('company_id', auth('contact')->user()->company->id)
|
||||||
->get();
|
->get();
|
||||||
@ -92,9 +91,14 @@ class PaymentController extends Controller
|
|||||||
$invoices->map(function ($invoice) {
|
$invoices->map(function ($invoice) {
|
||||||
$invoice->balance = Number::formatMoney($invoice->balance, $invoice->client);
|
$invoice->balance = Number::formatMoney($invoice->balance, $invoice->client);
|
||||||
$invoice->due_date = $this->formatDate($invoice->due_date, $invoice->client->date_format());
|
$invoice->due_date = $this->formatDate($invoice->due_date, $invoice->client->date_format());
|
||||||
|
|
||||||
return $invoice;
|
return $invoice;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$invoices->each(function ($invoice) {
|
||||||
|
InjectSignature::dispatch($invoice, request()->signature);
|
||||||
|
});
|
||||||
|
|
||||||
$payment_methods = auth()->user()->client->getPaymentMethods($amount);
|
$payment_methods = auth()->user()->client->getPaymentMethods($amount);
|
||||||
$gateway = CompanyGateway::find(request()->input('company_gateway_id'));
|
$gateway = CompanyGateway::find(request()->input('company_gateway_id'));
|
||||||
|
|
||||||
@ -112,7 +116,6 @@ class PaymentController extends Controller
|
|||||||
'hashed_ids' => request()->invoices,
|
'hashed_ids' => request()->invoices,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
return $gateway->driver(auth()->user()->client)->processPaymentView($data);
|
return $gateway->driver(auth()->user()->client)->processPaymentView($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
56
app/Jobs/Invoice/InjectSignature.php
Normal file
56
app/Jobs/Invoice/InjectSignature.php
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Jobs\Invoice;
|
||||||
|
|
||||||
|
use App\Models\Invoice;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class InjectSignature implements ShouldQueue
|
||||||
|
{
|
||||||
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var App\Models\Invoice
|
||||||
|
*/
|
||||||
|
public $invoice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $signature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new job instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct(Invoice $invoice, string $signature)
|
||||||
|
{
|
||||||
|
$this->invoice = $invoice;
|
||||||
|
|
||||||
|
$this->signature = $signature;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the job.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$invitation = $this->invoice->invitations->whereNotNull('signature_base64')->first();
|
||||||
|
|
||||||
|
if (!$invitation) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$invitation->signature_base64 = $this->signature;
|
||||||
|
$invitation->save();
|
||||||
|
|
||||||
|
CreateInvoicePdf::dispatch($invitation);
|
||||||
|
}
|
||||||
|
}
|
@ -301,7 +301,7 @@ class HtmlEngine
|
|||||||
$data['$task.tax_name2'] = ['value' => '', 'label' => ctrans('texts.tax')];
|
$data['$task.tax_name2'] = ['value' => '', 'label' => ctrans('texts.tax')];
|
||||||
$data['$task.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')];
|
$data['$task.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')];
|
||||||
$data['$task.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')];
|
$data['$task.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')];
|
||||||
//$data['$contact.signature']
|
$data['$contact.signature'] = ['value' => $this->invitation->signature_base64, 'label' => ctrans('texts.signature')];
|
||||||
|
|
||||||
// $data['custom_label1'] = ['value' => '', 'label' => ctrans('texts.')];
|
// $data['custom_label1'] = ['value' => '', 'label' => ctrans('texts.')];
|
||||||
// $data['custom_label2'] = ['value' => '', 'label' => ctrans('texts.')];
|
// $data['custom_label2'] = ['value' => '', 'label' => ctrans('texts.')];
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
</h3>
|
</h3>
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
<p class="text-sm leading-5 text-gray-500">
|
<p class="text-sm leading-5 text-gray-500">
|
||||||
<canvas id="signature-pad" class="signature-pad" width=400 height=200></canvas>
|
<canvas id="signature-pad" class="signature-pad border rounded" width=400 height=200></canvas>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user