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', [
|
return render('components.livewire.pdf-slot', [
|
||||||
'invitation' => $this->invitation,
|
'invitation' => $this->invitation,
|
||||||
'entity' => $this->entity,
|
'entity' => $this->entity,
|
||||||
|
'data' => $this->invitation->company->settings
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPdf()
|
public function getPdf()
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->pdf = $this->entity->fullscreenPdfViewer($this->invitation);
|
// $this->pdf = $this->entity->fullscreenPdfViewer($this->invitation);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHtml()
|
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);
|
$pdf_service = new PdfService($this->invitation);
|
||||||
@ -66,33 +80,66 @@ class PdfSlot extends Component
|
|||||||
(new VendorHtmlEngine($this->invitation))->generateLabelsAndValues();
|
(new VendorHtmlEngine($this->invitation))->generateLabelsAndValues();
|
||||||
|
|
||||||
$pdf_service->designer = (new PdfDesigner($pdf_service));
|
$pdf_service->designer = (new PdfDesigner($pdf_service));
|
||||||
$pdf_service->designer->template = '<div id="company-details"></div>';
|
|
||||||
|
|
||||||
$pdf_service->builder = (new PdfBuilder($pdf_service));
|
$pdf_service->builder = (new PdfBuilder($pdf_service));
|
||||||
|
|
||||||
$section = [
|
$data = [];
|
||||||
'company-details' => [
|
|
||||||
'id' => 'company-details',
|
|
||||||
'elements' => $pdf_service->builder->companyDetails(),
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
$document = new \DOMDocument();
|
foreach(['company-details', 'company-address','client-details','entity-details','product-table','table-totals'] as $item) {
|
||||||
$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
|
$pdf_service->designer->template = '<div id="'.$item.'"></div>';
|
||||||
->getEmptyElements()
|
|
||||||
->updateElementProperties()
|
|
||||||
->updateVariables();
|
|
||||||
|
|
||||||
$pdf_service->builder->document->removeChild($pdf_service->builder->document->doctype);
|
match($item){
|
||||||
$pdf_service->builder->document->replaceChild($pdf_service->builder->document->firstChild->firstChild->firstChild, $pdf_service->builder->document->firstChild);
|
'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 = [],
|
||||||
|
};
|
||||||
|
|
||||||
nlog($pdf_service->builder->document->saveHTML());
|
$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>
|
||||||
<div id="company-details">
|
<dl>
|
||||||
@foreach($settings->pdf_variables->company_details as $variable)
|
@foreach($data->pdf_variables->company_details as $cd)
|
||||||
<p>{{ $variable }}</p>
|
<dd>{{ $cd }}</dd>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</dl>
|
||||||
|
</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>
|
|
||||||
|
|
||||||
<div id="task-details"></div>
|
|
||||||
|
|
||||||
<div id="totals"></div>
|
|
||||||
|
|
||||||
<div id="notes"></div>
|
|
||||||
|
|
||||||
<div id="terms"></div>
|
|
||||||
|
|
||||||
<div id="footer"></div>
|
|
||||||
</div>
|
</div>
|
@ -41,3 +41,4 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
@include('portal.ninja2020.components.html-viewer', ['data' => $data])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user