Template previews

This commit is contained in:
David Bomba 2023-11-16 15:57:24 +11:00
parent fb27bd99e5
commit a8eee34623
2 changed files with 8 additions and 5 deletions

View File

@ -62,7 +62,7 @@ class TemplateAction implements ShouldQueue
private string $template, private string $template,
private string $entity, private string $entity,
private int $user_id, private int $user_id,
private Company $company, public Company $company,
private string $db, private string $db,
private string $hash, private string $hash,
private bool $send_email = false private bool $send_email = false
@ -109,9 +109,12 @@ class TemplateAction implements ShouldQueue
$data[$key] = $result; $data[$key] = $result;
} }
$ts = $template_service->build($data);
// nlog($ts->getHtml()); $ts = $template_service
->setCompany($this->company)
->build($data);
nlog($ts->getHtml());
if($this->send_email) { if($this->send_email) {
$pdf = $ts->getPdf(); $pdf = $ts->getPdf();

View File

@ -214,7 +214,7 @@ class TemplateService
{ {
$this->data = $this->preProcessDataBlocks($data); $this->data = $this->preProcessDataBlocks($data);
nlog($this->data);
return $this; return $this;
} }
@ -596,7 +596,7 @@ class TemplateService
'balance_raw' => ($payment->amount - $payment->refunded - $payment->applied), 'balance_raw' => ($payment->amount - $payment->refunded - $payment->applied),
'date' => $this->translateDate($payment->date, $payment->client->date_format(), $payment->client->locale()), 'date' => $this->translateDate($payment->date, $payment->client->date_format(), $payment->client->locale()),
'method' => $payment->translatedType(), 'method' => $payment->translatedType(),
'currency' => $payment->currency->code, 'currency' => $payment->currency->code ?? $this->company->currency()->code,
'exchange_rate' => $payment->exchange_rate, 'exchange_rate' => $payment->exchange_rate,
'transaction_reference' => $payment->transaction_reference, 'transaction_reference' => $payment->transaction_reference,
'is_manual' => $payment->is_manual, 'is_manual' => $payment->is_manual,