mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-05 18:52:44 +01:00
wip
This commit is contained in:
parent
2e3179d83e
commit
cb4efc8c61
@ -14,10 +14,74 @@ namespace App\Services\PdfMaker\Designs;
|
||||
|
||||
class Plain
|
||||
{
|
||||
public function html()
|
||||
public function html(): ?string
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('resources/views/pdf-designs//plain.html')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static function elements(): array
|
||||
{
|
||||
return [
|
||||
'company-address' => [
|
||||
'id' => 'company-address',
|
||||
'elements' => [
|
||||
['element' => 'p', 'content' => '$company.address1'],
|
||||
['element' => 'p', 'content' => '$company.address2'],
|
||||
['element' => 'p', 'content' => '$company.city_state_postal'],
|
||||
['element' => 'p', 'content' => '$company.postal_city_state'],
|
||||
['element' => 'p', 'content' => '$company.country'],
|
||||
['element' => 'p', 'content' => '$company1'],
|
||||
['element' => 'p', 'content' => '$company2'],
|
||||
['element' => 'p', 'content' => '$company3'],
|
||||
['element' => 'p', 'content' => '$company4'],
|
||||
],
|
||||
],
|
||||
'entity-details' => [
|
||||
'id' => 'entity-details',
|
||||
'elements' => [
|
||||
['element' => 'tr', 'content' => '', 'elements' => [
|
||||
['element' => 'th', 'content' => '$entity-number-label', 'properties' => ['class' => 'text-left pr-4 font-normal']],
|
||||
['element' => 'th', 'content' => '$entity-number', 'properties' => ['class' => 'text-left pr-4 font-medium']],
|
||||
]],
|
||||
['element' => 'tr', 'content' => '', 'elements' => [
|
||||
['element' => 'th', 'content' => '$entity-date-label', 'properties' => ['class' => 'text-left pr-4 font-normal']],
|
||||
['element' => 'th', 'content' => '$entity-date', 'properties' => ['class' => 'text-left pr-4 font-normal']],
|
||||
]],
|
||||
['element' => 'tr', 'content' => '', 'elements' => [
|
||||
['element' => 'th', 'content' => '$due-date-label', 'properties' => ['class' => 'text-left pr-4 font-normal']],
|
||||
['element' => 'th', 'content' => '$due-date', 'properties' => ['class' => 'text-left pr-4 font-normal']],
|
||||
]],
|
||||
['element' => 'tr', 'content' => '', 'properties' => ['class' => 'bg-gray-200'], 'elements' => [
|
||||
['element' => 'th', 'content' => '$balance-due-label', 'properties' => ['class' => 'text-left pr-4 font-normal']],
|
||||
['element' => 'th', 'content' => '$balance-due', 'properties' => ['class' => 'text-left pr-4 font-normal']],
|
||||
]],
|
||||
],
|
||||
],
|
||||
'client-details' => [
|
||||
'id' => 'client-details',
|
||||
'properties' => ['hidden' => 'true'],
|
||||
'elements' => [
|
||||
['element' => 'p', 'content' => '$client.name', 'properties' => ['class' => 'font-medium']],
|
||||
['element' => 'p', 'content' => '$client.id_number'],
|
||||
['element' => 'p', 'content' => '$client.vat_number'],
|
||||
['element' => 'p', 'content' => '$client.address1'],
|
||||
['element' => 'p', 'content' => '$client.address2'],
|
||||
['element' => 'p', 'content' => '$client.city_state_postal'],
|
||||
['element' => 'p', 'content' => '$client.postal_city_state'],
|
||||
['element' => 'p', 'content' => '$client.country'],
|
||||
['element' => 'p', 'content' => '$client.email'],
|
||||
['element' => 'p', 'content' => '$client.custom1'],
|
||||
['element' => 'p', 'content' => '$client.custom2'],
|
||||
['element' => 'p', 'content' => '$client.custom3'],
|
||||
['element' => 'p', 'content' => '$client.custom4'],
|
||||
['element' => 'p', 'content' => '$contact.custom1'],
|
||||
['element' => 'p', 'content' => '$contact.custom2'],
|
||||
['element' => 'p', 'content' => '$contact.custom3'],
|
||||
['element' => 'p', 'content' => '$contact.custom4'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
@ -103,6 +103,7 @@ class HtmlEngine
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['$global-margin'] = ['value' => 'm-12', 'label' => ''];
|
||||
$data['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')];
|
||||
$data['$app_url'] = ['value' => $this->generateAppUrl(), 'label' => ''];
|
||||
$data['$from'] = ['value' => '', 'label' => ctrans('texts.from')];
|
||||
@ -267,7 +268,7 @@ class HtmlEngine
|
||||
|
||||
$logo = $this->company->present()->logo($this->settings);
|
||||
|
||||
$data['$company.logo'] = ['value' => "<img src='{$logo}' class='h-32' alt='logo'>" ?: ' ', 'label' => ctrans('texts.logo')];
|
||||
$data['$company.logo'] = ['value' => $logo ?: ' ', 'label' => ctrans('texts.logo')];
|
||||
$data['$company_logo'] = &$data['$company.logo'];
|
||||
$data['$company1'] = ['value' => $this->settings->custom_value1 ?: ' ', 'label' => $this->makeCustomField('company1')];
|
||||
$data['$company2'] = ['value' => $this->settings->custom_value2 ?: ' ', 'label' => $this->makeCustomField('company2')];
|
||||
|
@ -14,12 +14,12 @@
|
||||
<body class="$global-margin antialiased break-words bg-white">
|
||||
<!-- Company name, company address, company logo -->
|
||||
<div class="grid grid-cols-12 gap-4">
|
||||
<div class="col-span-4">$company-name</div>
|
||||
<div class="col-span-4">$company.name</div>
|
||||
<div class="col-span-4" id="company-address"></div>
|
||||
<div class="col-span-4">
|
||||
<img
|
||||
src="$company-logo"
|
||||
alt="$company->name logo"
|
||||
src="$company.logo"
|
||||
alt="$company.name logo"
|
||||
class="block w-24 col-span-4 sm:w-32"
|
||||
/>
|
||||
</div>
|
||||
|
@ -18,9 +18,7 @@ class ExampleIntegrationTest extends TestCase
|
||||
$engine = new HtmlEngine($invitation, 'invoice');
|
||||
|
||||
$state = [
|
||||
'template' => [
|
||||
|
||||
],
|
||||
'template' => Plain::elements(),
|
||||
'variables' => $engine->generateLabelsAndValues(),
|
||||
];
|
||||
|
||||
@ -30,7 +28,6 @@ class ExampleIntegrationTest extends TestCase
|
||||
->design(Plain::class)
|
||||
->build();
|
||||
|
||||
info($state);
|
||||
info($maker->getCompiledHTML());
|
||||
// info($maker->getCompiledHTML());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user