Refactor invoice emails (#3625)

This commit is contained in:
David Bomba 2020-04-13 11:49:58 +10:00 committed by GitHub
parent f118f3bfda
commit 2ad84d4b76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 27 deletions

View File

@ -515,27 +515,9 @@ class CreditController extends BaseController
$credit = CloneCreditFactory::create($credit, auth()->user()->id); $credit = CloneCreditFactory::create($credit, auth()->user()->id);
return $this->itemResponse($credit); return $this->itemResponse($credit);
break; break;
case 'clone_to_quote':
$quote = CloneCreditToQuoteFactory::create($credit, auth()->user()->id);
// todo build the quote transformer and return response here
break;
case 'history': case 'history':
# code... # code...
break; break;
case 'delivery_note':
# code...
break;
case 'mark_paid':
if ($credit->balance < 0 || $credit->status_id == Credit::STATUS_PAID || $credit->is_deleted === true) {
return $this->errorResponse(['message' => 'Credit cannot be marked as paid'], 400);
}
//@todo fix and replace
$credit = MarkInvoicePaid::dispatchNow($credit, $credit->company);
if (!$bulk) {
return $this->itemResponse($credit);
}
break;
case 'mark_sent': case 'mark_sent':
$credit->service()->markSent()->save(); $credit->service()->markSent()->save();

View File

@ -31,9 +31,9 @@ class EmailInvoice implements ShouldQueue
public $company; public $company;
/** /**
* *
* EmailQuote constructor. * EmailInvoice constructor.
* @param BuildEmail $email_builder * @param BuildEmail $email_builder
* @param QuoteInvitation $quote_invitation * @param InvoiceInvitation $quote_invitation
*/ */
public function __construct(InvoiceEmail $email_builder, InvoiceInvitation $invoice_invitation, Company $company) public function __construct(InvoiceEmail $email_builder, InvoiceInvitation $invoice_invitation, Company $company)

View File

@ -59,7 +59,7 @@ trait MakesInvoiceHtml
$html = $this->parseLabelsAndValues($labels, $values, $html); $html = $this->parseLabelsAndValues($labels, $values, $html);
info($html); // info($html);
return $html; return $html;
} }

View File

@ -732,7 +732,12 @@ trait MakesInvoiceValues
return rtrim(config('ninja.app_url'), "/"); return rtrim(config('ninja.app_url'), "/");
} }
public function generateCustomCSS() /**
* Builds CSS to assist with the generation
* of Repeating headers and footers on the PDF
* @return string The css string
*/
public function generateCustomCSS() :string
{ {
$settings = $this->client->getMergedSettings(); $settings = $this->client->getMergedSettings();
@ -800,9 +805,6 @@ trait MakesInvoiceValues
}'; }';
$css = ''; $css = '';
\Log::error($settings->all_pages_header);
\Log::error($settings->all_pages_footer);
if($settings->all_pages_header && $settings->all_pages_footer) if($settings->all_pages_header && $settings->all_pages_footer)
$css .= $header_and_footer; $css .= $header_and_footer;
elseif($settings->all_pages_header && !$settings->all_pages_footer) elseif($settings->all_pages_header && !$settings->all_pages_footer)
@ -822,8 +824,8 @@ trait MakesInvoiceValues
html { html {
'; ';
// $css .= 'font-size:' . $settings->font_size . 'px;'; $css .= 'font-size:' . $settings->font_size . 'px;';
$css .= 'font-size:14px;'; // $css .= 'font-size:14px;';
$css .= '}'; $css .= '}';