From 203e651b485a0d6f686971ffc98e43a34741148d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 10 Jul 2023 23:01:12 +1000 Subject: [PATCH] Working on client portal --- app/Http/Livewire/PdfSlot.php | 77 +++++++++++++---------------------- 1 file changed, 29 insertions(+), 48 deletions(-) diff --git a/app/Http/Livewire/PdfSlot.php b/app/Http/Livewire/PdfSlot.php index 6a4aae34799a..029d7b088c3c 100644 --- a/app/Http/Livewire/PdfSlot.php +++ b/app/Http/Livewire/PdfSlot.php @@ -50,15 +50,17 @@ class PdfSlot extends Component { $this->pdf = $this->entity->fullscreenPdfViewer($this->invitation); + + + } + + public function getHtml() + { + $pdf_service = new PdfService($this->invitation); - - - // $company_details = $pdf_service->config->settings->pdf_variables->company_details; - - + $pdf_service->config = (new PdfConfiguration($pdf_service))->init(); - $pdf_service->html_variables = $pdf_service->config->client ? (new HtmlEngine($this->invitation))->generateLabelsAndValues() : (new VendorHtmlEngine($this->invitation))->generateLabelsAndValues(); @@ -68,55 +70,34 @@ class PdfSlot extends Component $pdf_service->builder = (new PdfBuilder($pdf_service)); -$section = [ - 'company-details' => [ - 'id' => 'company-details', - 'elements' => $pdf_service->builder->companyDetails(), - ] -]; + $section = [ + 'company-details' => [ + 'id' => 'company-details', + 'elements' => $pdf_service->builder->companyDetails(), + ] + ]; + $document = new \DOMDocument(); + $document->validateOnParse = true; + @$document->loadHTML(mb_convert_encoding($pdf_service->designer->template, 'HTML-ENTITIES', 'UTF-8')); + $pdf_service->builder->document = $document; -$document = new \DOMDocument(); -$document->validateOnParse = true; -@$document->loadHTML(mb_convert_encoding($pdf_service->designer->template, 'HTML-ENTITIES', 'UTF-8'), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); -$pdf_service->builder->document = $document; + $pdf_service->builder->sections = $section; -$pdf_service->builder->sections = $section; + $html = $pdf_service->builder + ->getEmptyElements() + ->updateElementProperties() + ->updateVariables() + ->getCompiledHTML(); -$html = $pdf_service->builder - ->getEmptyElements() - ->updateElementProperties() - ->updateVariables(); + $doc = new \DOMDocument(); -nlog($html->getCompiledHTML()); - - - - - // nlog($section); - - // $document = new \DOMDocument(); - // @$document->loadHTML(mb_convert_encoding('
', 'HTML-ENTITIES', 'UTF-8')); - // $pdf_service->designer->template = ''; - // $pdf_service->builder->document = $document; - - // $pdf_service->builder - // ->sections = $section; - - // nlog($pdf_service->builder->sections); - - // $html = $pdf_service->builder - // ->getEmptyElements() - // ->updateElementProperties() - // ->updateVariables(); - - // nlog($html->getCompiledHTML()); - } - - public function getHtml() - { + $doc->loadHTML($html); + $doc->removeChild($doc->doctype); + $doc->replaceChild($doc->firstChild->firstChild->firstChild, $doc->firstChild); + nlog($doc->saveHTML()); } }