Improvements for live preview

This commit is contained in:
David Bomba 2023-10-19 07:34:40 +11:00
parent e4fc9e2cc8
commit e17af36cf4
2 changed files with 7 additions and 9 deletions

View File

@ -61,11 +61,11 @@ class PreviewController extends BaseController
}
private function purgeCache()
{ nlog(auth()->user()->id);
{
Cache::pull("preview_".auth()->user()->id);
}
public function newLivePreview(PreviewInvoiceRequest $request)
public function live(PreviewInvoiceRequest $request)
{
$time = time();
@ -153,8 +153,6 @@ class PreviewController extends BaseController
$pdf = (new PreviewPdf($maker->getCompiledHTML(true), $company))->handle();
nlog("merpy derp {$time}");
return response()->streamDownload(function () use ($pdf) {
echo $pdf;
}, 'preview.pdf', ['Content-Type' => 'application/pdf','Cache-Control:' => 'no-cache']);
@ -273,7 +271,7 @@ class PreviewController extends BaseController
return $response;
}
public function live(PreviewInvoiceRequest $request)
public function livex(PreviewInvoiceRequest $request)
{
// if(Cache::has("preview_".auth()->user()->id))

View File

@ -92,10 +92,10 @@ class PreviewInvoiceRequest extends Request
return $this->stubInvitation();
match($this->entity){
'invoice' => $invitation = Invoice::withTrashed()->where('invoice_id', $this->entity_id)->first(),
'quote' => $invitation = Quote::withTrashed()->where('quote_id', $this->entity_id)->first(),
'credit' => $invitation = Credit::withTrashed()->where('credit_id', $this->entity_id)->first(),
'recurring_invoice' => $invitation = RecurringInvoice::withTrashed()->where('recurring_invoice_id', $this->entity_id)->first(),
'invoice' => $invitation = InvoiceInvitation::withTrashed()->where('invoice_id', $this->entity_id)->first(),
'quote' => $invitation = QuoteInvitation::withTrashed()->where('quote_id', $this->entity_id)->first(),
'credit' => $invitation = CreditInvitation::withTrashed()->where('credit_id', $this->entity_id)->first(),
'recurring_invoice' => $invitation = RecurringInvoiceInvitation::withTrashed()->where('recurring_invoice_id', $this->entity_id)->first(),
};
if($invitation)