diff --git a/app/Services/Preview/StubBuilder.php b/app/Services/Preview/StubBuilder.php index fa71c2fc0bef..3ef3116d0669 100644 --- a/app/Services/Preview/StubBuilder.php +++ b/app/Services/Preview/StubBuilder.php @@ -94,6 +94,7 @@ class StubBuilder public function getPdf(): mixed { +nlog($this->html); if (config('ninja.phantomjs_pdf_generation') || config('ninja.pdf_generator') == 'phantom') { return (new Phantom)->convertHtmlToPdf($this->html); @@ -179,11 +180,8 @@ class StubBuilder $html = new HtmlEngine($this->invitation); $design_string = "{$this->entity_type}_design_id"; - nlog($design_string); $design = DesignModel::withTrashed()->find($this->decodePrimaryKey($html->settings->{$design_string})); - - nlog($design->toArray()); $template = new PdfMakerDesign(strtolower($design->name)); @@ -200,14 +198,10 @@ class StubBuilder $maker = new PdfMaker($state); - nlog("pre html"); - $this->html = $maker->design($template) ->build() ->getCompiledHTML(); - nlog($this->html); - return $this; } @@ -292,6 +286,7 @@ class StubBuilder 'client_id' => $this->recipient->id, 'terms' => $this->company->settings->invoice_terms, 'footer' => $this->company->settings->invoice_footer, + 'status_id' => Invoice::STATUS_PAID, ]); $this->invitation = InvoiceInvitation::factory()->create([ diff --git a/app/Utils/HtmlEngine.php b/app/Utils/HtmlEngine.php index ce716b4d3a11..5b1100cdcb5b 100644 --- a/app/Utils/HtmlEngine.php +++ b/app/Utils/HtmlEngine.php @@ -116,7 +116,7 @@ class HtmlEngine $data['$global_margin'] = ['value' => '6.35mm', 'label' => '']; $data['$company_logo_size'] = ['value' => $this->resolveCompanyLogoSize(), 'label' => '']; - $data['show_shipping_address'] = ['value' => $this->settings?->show_shipping_address ? 'flex' : 'none', 'label' => '']; + $data['$show_shipping_address'] = ['value' => $this->settings?->show_shipping_address ? 'flex' : 'none', 'label' => '']; $data['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')]; $data['$app_url'] = ['value' => $this->generateAppUrl(), 'label' => '']; $data['$from'] = ['value' => '', 'label' => ctrans('texts.from')]; @@ -191,10 +191,10 @@ class HtmlEngine $data['$invoice.project'] = &$data['$project.name']; } - if($this->entity->status_id == 4 && $this->settings->show_paid_stamp) { - $data['$status_logo'] = ['value' => '
' . ctrans('texts.paid') .'
', 'label' => '']; - } + $data['$status_logo'] = ['value' => '
' . ctrans('texts.paid') .'
', 'label' => '']; + $data['$show_paid_stamp'] = ['value' => $this->entity->status_id == 4 && $this->settings?->show_paid_stamp ? 'flex' : 'none', 'label' => '']; + if ($this->entity->vendor) { $data['$invoice.vendor'] = ['value' => $this->entity->vendor->present()->name(), 'label' => ctrans('texts.vendor_name')]; } diff --git a/resources/views/pdf-designs/clean.html b/resources/views/pdf-designs/clean.html index 5ec84a23ee41..082bd5189d2c 100644 --- a/resources/views/pdf-designs/clean.html +++ b/resources/views/pdf-designs/clean.html @@ -309,6 +309,7 @@ opacity: 0.2; z-index:200 !important; position: fixed; + display: $show_paid_stamp; } .project-header {