mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 23:14:34 -04:00
wip
This commit is contained in:
parent
169eb4a766
commit
13e70e24d5
@ -16,6 +16,8 @@ use App\Designs\Designer;
|
|||||||
use App\Factory\InvoiceFactory;
|
use App\Factory\InvoiceFactory;
|
||||||
use App\Jobs\Invoice\CreateInvoicePdf;
|
use App\Jobs\Invoice\CreateInvoicePdf;
|
||||||
use App\Jobs\Util\PreviewPdf;
|
use App\Jobs\Util\PreviewPdf;
|
||||||
|
use App\Services\PdfMaker\PdfMaker;
|
||||||
|
use App\Utils\HtmlEngine;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use App\Utils\Traits\MakesInvoiceHtml;
|
use App\Utils\Traits\MakesInvoiceHtml;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
@ -92,11 +94,33 @@ class PreviewController extends BaseController
|
|||||||
|
|
||||||
$entity_obj->load('client');
|
$entity_obj->load('client');
|
||||||
|
|
||||||
$designer = new Designer($entity_obj, $design_object, $entity_obj->client->getSetting('pdf_variables'), lcfirst($entity));
|
info($entity_obj);
|
||||||
|
|
||||||
$html = $this->generateEntityHtml($designer, $entity_obj);
|
$html = new HtmlEngine(null, $entity_obj->invitations()->first(), request()->entity_type);
|
||||||
|
|
||||||
$file_path = PreviewPdf::dispatchNow($html, auth()->user()->company());
|
$design_namespace = 'App\Services\PdfMaker\Designs\\' . request()->design['name'];
|
||||||
|
|
||||||
|
$design_class = new $design_namespace();
|
||||||
|
|
||||||
|
// $designer = new Designer($entity_obj, $design_object, $entity_obj->client->getSetting('pdf_variables'), lcfirst($entity));
|
||||||
|
// $html = $this->generateEntityHtml($designer, $entity_obj);
|
||||||
|
|
||||||
|
$state = [
|
||||||
|
'template' => $design_class->elements([
|
||||||
|
'client' => $entity_obj->client,
|
||||||
|
'entity' => $entity_obj,
|
||||||
|
'pdf_variables' => (array) $entity_obj->company->settings->pdf_variables,
|
||||||
|
]),
|
||||||
|
'variables' => $html->generateLabelsAndValues(),
|
||||||
|
];
|
||||||
|
|
||||||
|
$maker = new PdfMaker($state);
|
||||||
|
|
||||||
|
$maker
|
||||||
|
->design($design_namespace)
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(), auth()->user()->company());
|
||||||
|
|
||||||
return response()->download($file_path)->deleteFileAfterSend(true);
|
return response()->download($file_path)->deleteFileAfterSend(true);
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ class ExampleIntegrationTest extends TestCase
|
|||||||
->design(Playful::class)
|
->design(Playful::class)
|
||||||
->build();
|
->build();
|
||||||
|
|
||||||
exec('echo "" > storage/logs/laravel.log');
|
// exec('echo "" > storage/logs/laravel.log');
|
||||||
|
|
||||||
info($maker->getCompiledHTML(true));
|
info($maker->getCompiledHTML(true));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user