mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on client portal
This commit is contained in:
parent
dfc67da3ef
commit
f37620300b
@ -43,18 +43,32 @@ class PdfSlot extends Component
|
||||
return render('components.livewire.pdf-slot', [
|
||||
'invitation' => $this->invitation,
|
||||
'entity' => $this->entity,
|
||||
'data' => $this->invitation->company->settings
|
||||
]);
|
||||
}
|
||||
|
||||
public function getPdf()
|
||||
{
|
||||
|
||||
$this->pdf = $this->entity->fullscreenPdfViewer($this->invitation);
|
||||
// $this->pdf = $this->entity->fullscreenPdfViewer($this->invitation);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getHtml()
|
||||
{
|
||||
$pdf_service = new PdfService($this->invitation);
|
||||
|
||||
$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();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getHtmlX()
|
||||
{
|
||||
|
||||
$pdf_service = new PdfService($this->invitation);
|
||||
@ -66,33 +80,66 @@ class PdfSlot extends Component
|
||||
(new VendorHtmlEngine($this->invitation))->generateLabelsAndValues();
|
||||
|
||||
$pdf_service->designer = (new PdfDesigner($pdf_service));
|
||||
$pdf_service->designer->template = '<div id="company-details"></div>';
|
||||
|
||||
$pdf_service->builder = (new PdfBuilder($pdf_service));
|
||||
|
||||
$section = [
|
||||
'company-details' => [
|
||||
'id' => 'company-details',
|
||||
'elements' => $pdf_service->builder->companyDetails(),
|
||||
]
|
||||
];
|
||||
$data = [];
|
||||
|
||||
$document = new \DOMDocument();
|
||||
$document->validateOnParse = true;
|
||||
@$document->loadHTML(mb_convert_encoding($pdf_service->designer->template, 'HTML-ENTITIES', 'UTF-8'));
|
||||
foreach(['company-details', 'company-address','client-details','entity-details','product-table','table-totals'] as $item) {
|
||||
|
||||
$pdf_service->builder->document = $document;
|
||||
$pdf_service->builder->sections = $section;
|
||||
|
||||
$html = $pdf_service->builder
|
||||
->getEmptyElements()
|
||||
->updateElementProperties()
|
||||
->updateVariables();
|
||||
$pdf_service->designer->template = '<div id="'.$item.'"></div>';
|
||||
|
||||
$pdf_service->builder->document->removeChild($pdf_service->builder->document->doctype);
|
||||
$pdf_service->builder->document->replaceChild($pdf_service->builder->document->firstChild->firstChild->firstChild, $pdf_service->builder->document->firstChild);
|
||||
|
||||
nlog($pdf_service->builder->document->saveHTML());
|
||||
match($item){
|
||||
'company-details' => $block = $pdf_service->builder->companyDetails(),
|
||||
'company-address' => $block = $pdf_service->builder->companyAddress(),
|
||||
'client-details' => $block = $pdf_service->builder->clientDetails(),
|
||||
'entity-details' => $block = $pdf_service->builder->invoiceDetails(),
|
||||
'product-table' => $block = $this->productTable(),
|
||||
'table-totals' => $block = $pdf_service->builder->getTableTotals(),
|
||||
default => $block = [],
|
||||
};
|
||||
|
||||
$section = [
|
||||
$item => [
|
||||
'id' => $item,
|
||||
'elements' => $block,
|
||||
]
|
||||
];
|
||||
|
||||
$document = new \DOMDocument();
|
||||
$document->validateOnParse = true;
|
||||
@$document->loadHTML(mb_convert_encoding($pdf_service->designer->template, 'HTML-ENTITIES', 'UTF-8'));
|
||||
|
||||
$pdf_service->builder->document = $document;
|
||||
$pdf_service->builder->sections = $section;
|
||||
|
||||
$html = $pdf_service->builder
|
||||
->getEmptyElements()
|
||||
->updateElementProperties()
|
||||
->updateVariables();
|
||||
|
||||
// $pdf_service->builder->document->removeChild($pdf_service->builder->document->doctype);
|
||||
// $pdf_service->builder->document->replaceChild($pdf_service->builder->document->firstChild->firstChild->firstChild, $pdf_service->builder->document->firstChild);
|
||||
|
||||
$data[$item] = $pdf_service->builder->document->saveHTML();
|
||||
|
||||
$section = [];
|
||||
}
|
||||
// nlog($pdf_service->builder->document->saveHTML());
|
||||
|
||||
nlog($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function productTable()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private function sectionBuilder($tag)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +1,11 @@
|
||||
<div class="flex flex-col w-full">
|
||||
|
||||
<div>
|
||||
<div id="company-details">
|
||||
@foreach($settings->pdf_variables->company_details as $variable)
|
||||
<p>{{ $variable }}</p>
|
||||
<dl>
|
||||
@foreach($data->pdf_variables->company_details as $cd)
|
||||
<dd>{{ $cd }}</dd>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
|
||||
<div id="company-address">
|
||||
@foreach($settings->pdf_variables->company_address as $variable)
|
||||
<p>{{ $variable }}</p>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div id="entity-details"></div>
|
||||
|
||||
<div id="user-details"></div>
|
||||
|
||||
<div id="product-details"></div>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div id="task-details"></div>
|
||||
|
||||
<div id="totals"></div>
|
||||
|
||||
<div id="notes"></div>
|
||||
|
||||
<div id="terms"></div>
|
||||
|
||||
<div id="footer"></div>
|
||||
</div>
|
@ -41,3 +41,4 @@
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@include('portal.ninja2020.components.html-viewer', ['data' => $data])
|
||||
|
Loading…
x
Reference in New Issue
Block a user