1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Enable setting the width of the logo via settings

This commit is contained in:
David Bomba 2023-01-27 22:49:25 +11:00
parent 411ae1100a
commit 423a7f4cc9
4 changed files with 50 additions and 5 deletions

View File

@ -453,9 +453,15 @@ class CompanySettings extends BaseSettings
public $show_email_footer = true;
public $company_logo_size = '65%';
public $company_logo_size = '';
public $show_paid_stamp = false;
public $show_shipping_address = false;
public static $casts = [
'show_paid_stamp' => 'bool',
'show_shipping_address' => 'bool',
'company_logo_size' => 'string',
'show_email_footer' => 'bool',
'email_alignment' => 'string',

View File

@ -508,7 +508,7 @@ class CompanyImport implements ShouldQueue
if(Ninja::isHosted())
{
$this->company->portal_mode = 'sub_domain';
$this->company->portal_mode = 'subdomain';
$this->company->portal_domain = '';
}

View File

@ -98,6 +98,43 @@ class HtmlEngine
}
}
private function resolveCompanyLogoSize()
{
$design_map = [
"VolejRejNm" => "65%", // "Plain",
"Wpmbk5ezJn" => "65%", //"Clean",
"Opnel5aKBz" => "100%", //"Bold",
"wMvbmOeYAl" => "55%", //Modern",
"4openRe7Az" => "65%", //"Business",
"WJxbojagwO" => "65%", //"Creative",
"k8mep2bMyJ" => "55%", //"Elegant",
"l4zbq2dprO" => "65%", //"Hipster",
"yMYerEdOBQ" => "65%", //"Playful",
"gl9avmeG1v" => "65%", //"Tech",
"7LDdwRb1YK" => "65%", //"Calm",
];
if(strlen($this->settings->company_logo_size) > 1)
{
return $this->settings->company_logo_size;
}
if($this->entity->design_id && array_key_exists($this->entity->design_id, $design_map))
{
return $design_map[$this->entity->design_id];
}
$default_design_id = $this->entity_string."_design_id";
$design_id = $this->settings->{$default_design_id};
if(array_key_exists($design_id, $design_map))
return $design_map[$this->entity->design_id];
return '65%';
}
public function buildEntityDataArray() :array
{
if (! $this->client->currency()) {
@ -111,8 +148,9 @@ class HtmlEngine
$t->replace(Ninja::transformTranslations($this->settings));
$data = [];
//$data['<html>'] = ['value' => '<html dir="rtl">', 'label' => ''];
$data['$global_margin'] = ['value' => '6.35mm', 'label' => ''];
$data['$company_logo_size'] = ['value' => $this->resolveCompanyLogoSize(), 'label' => ''];
$data['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')];
$data['$app_url'] = ['value' => $this->generateAppUrl(), 'label' => ''];
$data['$from'] = ['value' => '', 'label' => ctrans('texts.from')];

View File

@ -63,10 +63,11 @@
.company-logo-wrapper {
padding-bottom: 60px;
height: 5rem;
}
.company-logo-wrapper {
height: 5rem;
.company-logo {
max-width: 65%;
}
.header-invoice-number {