Fixes for designs" (#3557)

* fixes for tests

* Working on Invoice Designs
This commit is contained in:
David Bomba 2020-03-28 15:29:52 +11:00 committed by GitHub
parent de9faa9bc2
commit 84e572de07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 56 deletions

View File

@ -60,10 +60,7 @@ class Bold extends AbstractDesign
</div>
<div class="w-1/2">
<div class="w-full bg-teal-600 px-5 py-3 text-white flex">
<div class="w-48 flex flex-col text-white">
$entity_labels
</div>
<div class="w-32 flex flex-col text-white">
<div class="w-80 flex flex-col text-white">
$entity_details
</div>
</div>

View File

@ -149,13 +149,13 @@ class Designer
$this->exported_variables['$company_address'] = $this->processVariables($this->input_variables['company_address'], $this->companyAddress($company));
if ($this->entity_string == 'invoice') {
$this->exported_variables['$entity_labels'] = $this->processLabels($this->input_variables['invoice_details'], $this->invoiceDetails($company));
//$this->exported_variables['$entity_labels'] = $this->processLabels($this->input_variables['invoice_details'], $this->invoiceDetails($company));
$this->exported_variables['$entity_details'] = $this->processVariables($this->input_variables['invoice_details'], $this->invoiceDetails($company));
} elseif ($this->entity_string == 'credit') {
$this->exported_variables['$entity_labels'] = $this->processLabels($this->input_variables['credit_details'], $this->creditDetails($company));
//$this->exported_variables['$entity_labels'] = $this->processLabels($this->input_variables['credit_details'], $this->creditDetails($company));
$this->exported_variables['$entity_details'] = $this->processVariables($this->input_variables['credit_details'], $this->creditDetails($company));
} elseif ($this->entity_string == 'quote') {
$this->exported_variables['$entity_labels'] = $this->processLabels($this->input_variables['quote_details'], $this->quoteDetails($company));
//$this->exported_variables['$entity_labels'] = $this->processLabels($this->input_variables['quote_details'], $this->quoteDetails($company));
$this->exported_variables['$entity_details'] = $this->processVariables($this->input_variables['quote_details'], $this->quoteDetails($company));
}
@ -214,15 +214,15 @@ class Designer
'$client.city_state_postal' => '<p>$client.city_state_postal</p>',
'$client.postal_city_state' => '<p>$client.postal_city_state</p>',
'$client.country' => '<p>$client.country</p>',
'$contact.email' => '<p>$client.email</p>',
'$contact.email' => '<p>$client.email</p>',
'$client.custom1' => '<p>$client.custom1</p>',
'$client.custom2' => '<p>$client.custom2</p>',
'$client.custom3' => '<p>$client.custom3</p>',
'$client.custom4' => '<p>$client.custom4</p>',
'$contact.contact1' => '<p>$contact.custom1</p>',
'$contact.contact2' => '<p>$contact.custom2</p>',
'$contact.contact3' => '<p>$contact.custom3</p>',
'$contact.contact4' => '<p>$contact.custom4</p>',
'$contact.contact1' => '<p>$contact.custom1</p>',
'$contact.contact2' => '<p>$contact.custom2</p>',
'$contact.contact3' => '<p>$contact.custom3</p>',
'$contact.contact4' => '<p>$contact.custom4</p>',
];
return $this->processCustomFields($company, $data);
@ -266,21 +266,21 @@ class Designer
private function invoiceDetails(Company $company)
{
$data = [
'$invoice.number' => '<span>$invoice.number_label: $invoice.number</span>',
'$invoice.po_number' => '<span>$invoice.po_number_label: $invoice.po_number</span>',
'$invoice.date' => '<span>$invoice.date_label: $invoice.date</span>',
'$invoice.due_date' => '<span>$invoice.due_date_label: $invoice.due_date</span>',
'$invoice.balance_due' => '<span>$invoice.balance_due_label: $invoice.balance_due</span>',
'$invoice.total' => '<span>$invoice.total_label: $invoice.total</span>',
'$invoice.partial_due' => '<span>$invoice.partial_due_label: $invoice.partial_due</span>',
'$invoice.custom1' => '<span>$invoice1_label: $invoice.custom1</span>',
'$invoice.custom2' => '<span>$invoice2_label: $invoice.custom2</span>',
'$invoice.custom3' => '<span>$invoice3_label: $invoice.custom3</span>',
'$invoice.custom4' => '<span>$invoice4_label: $invoice.custom4</span>',
'$surcharge1' => '<span>$surcharge1_label: $surcharge1</span>',
'$surcharge2' => '<span>$surcharge2_label: $surcharge2</span>',
'$surcharge3' => '<span>$surcharge3_label: $surcharge3</span>',
'$surcharge4' => '<span>$surcharge4_label: $surcharge4</span>',
'$invoice.number' => '<span class="flex content-between flex-wrap">$invoice.number_label: $invoice.number</span>',
'$invoice.po_number' => '<span class="flex content-between flex-wrap">$invoice.po_number_label: $invoice.po_number</span>',
'$invoice.date' => '<span class="flex content-between flex-wrap">$invoice.date_label: $invoice.date</span>',
'$invoice.due_date' => '<span class="flex content-between flex-wrap">$invoice.due_date_label: $invoice.due_date</span>',
'$invoice.balance_due' => '<span class="flex content-between flex-wrap">$invoice.balance_due_label: $invoice.balance_due</span>',
'$invoice.total' => '<span class="flex content-between flex-wrap">$invoice.total_label: $invoice.total</span>',
'$invoice.partial_due' => '<span class="flex content-between flex-wrap">$invoice.partial_due_label: $invoice.partial_due</span>',
'$invoice.custom1' => '<span class="flex content-between flex-wrap">$invoice1_label: $invoice.custom1</span>',
'$invoice.custom2' => '<span class="flex content-between flex-wrap">$invoice2_label: $invoice.custom2</span>',
'$invoice.custom3' => '<span class="flex content-between flex-wrap">$invoice3_label: $invoice.custom3</span>',
'$invoice.custom4' => '<span class="flex content-between flex-wrap">$invoice4_label: $invoice.custom4</span>',
'$surcharge1' => '<span class="flex content-between flex-wrap">$surcharge1_label: $surcharge1</span>',
'$surcharge2' => '<span class="flex content-between flex-wrap">$surcharge2_label: $surcharge2</span>',
'$surcharge3' => '<span class="flex content-between flex-wrap">$surcharge3_label: $surcharge3</span>',
'$surcharge4' => '<span class="flex content-between flex-wrap">$surcharge4_label: $surcharge4</span>',
];
return $this->processCustomFields($company, $data);
@ -289,21 +289,21 @@ class Designer
private function quoteDetails(Company $company)
{
$data = [
'$quote.quote_number' => '<span>$quote.number</span>',
'$quote.po_number' => '<span>$quote.po_number</span>',
'$quote.quote_date' => '<span>$quote.date</span>',
'$quote.valid_until' => '<span>$quote.valid_until</span>',
'$quote.balance_due' => '<span>$quote.balance_due</span>',
'$quote.quote_total' => '<span>$quote.total</span>',
'$quote.partial_due' => '<span>$quote.partial_due</span>',
'$quote.quote1' => '<span>$quote1</span>',
'$quote.quote2' => '<span>$quote2</span>',
'$quote.quote3' => '<span>$quote3</span>',
'$quote.quote4' => '<span>$quote4</span>',
'$quote.surcharge1' => '<span>$surcharge1</span>',
'$quote.surcharge2' => '<span>$surcharge2</span>',
'$quote.surcharge3' => '<span>$surcharge3</span>',
'$quote.surcharge4' => '<span>$surcharge4</span>',
'$quote.quote_number' => '<span class="flex content-between flex-wrap">$quote.number_label: $quote.number</span>',
'$quote.po_number' => '<span class="flex content-between flex-wrap">$quote.po_number_label: $quote.po_number</span>',
'$quote.quote_date' => '<span class="flex content-between flex-wrap">$quote.date_label: $quote.date</span>',
'$quote.valid_until' => '<span class="flex content-between flex-wrap">$quote.valid_until_label: $quote.valid_until</span>',
'$quote.balance_due' => '<span class="flex content-between flex-wrap">$quote.balance_due_label: $quote.balance_due</span>',
'$quote.quote_total' => '<span class="flex content-between flex-wrap">$quote.total_label: $quote.total</span>',
'$quote.partial_due' => '<span class="flex content-between flex-wrap">$quote.partial_due_label: $quote.partial_due</span>',
'$quote.custom1' => '<span class="flex content-between flex-wrap">$quote.custom1_label: $quote.custom1</span>',
'$quote.custom2' => '<span class="flex content-between flex-wrap">$quote.custom2_label: $quote.custom2</span>',
'$quote.custom3' => '<span class="flex content-between flex-wrap">$quote.custom3_label: $quote.custom3</span>',
'$quote.custom4' => '<span class="flex content-between flex-wrap">$quote.custom4_label: $quote.custom4</span>',
'$quote.surcharge1' => '<span class="flex content-between flex-wrap">$surcharge1_label: $surcharge1</span>',
'$quote.surcharge2' => '<span class="flex content-between flex-wrap">$surcharge2_label: $surcharge2</span>',
'$quote.surcharge3' => '<span class="flex content-between flex-wrap">$surcharge3_label: $surcharge3</span>',
'$quote.surcharge4' => '<span class="flex content-between flex-wrap">$surcharge4_label: $surcharge4</span>',
];
return $this->processCustomFields($company, $data);
@ -318,14 +318,14 @@ class Designer
'$credit.credit_balance' => '<span>$credit.balance</span>',
'$credit.credit_amount' => '<span>$credit.amount</span>',
'$credit.partial_due' => '<span>$credit.partial_due</span>',
'$credit.credit1' => '<span>$credit1</span>',
'$credit.credit2' => '<span>$credit2</span>',
'$credit.credit3' => '<span>$credit3</span>',
'$credit.credit4' => '<span>$credit4</span>',
'$credit.surcharge1' => '<span>$surcharge1</span>',
'$credit.surcharge2' => '<span>$surcharge2</span>',
'$credit.surcharge3' => '<span>$surcharge3</span>',
'$credit.surcharge4' => '<span>$surcharge4</span>',
'$credit.custom1' => '<span>$credit.custom1</span>',
'$credit.custom2' => '<span>$credit.custom2</span>',
'$credit.custom3' => '<span>$credit.custom3</span>',
'$credit.custom4' => '<span>$credit.custom4</span>',
'$credit.surcharge1' => '<span>$surcharge1_label: $surcharge1</span>',
'$credit.surcharge2' => '<span>$surcharge2_label: $surcharge2</span>',
'$credit.surcharge3' => '<span>$surcharge3_label: $surcharge3</span>',
'$credit.surcharge4' => '<span>$surcharge4_label: $surcharge4</span>',
];
return $this->processCustomFields($company, $data);

View File

@ -192,8 +192,11 @@ trait MakesInvoiceValues
$data['$credit.total'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: '&nbsp;', 'label' => ctrans('texts.credit_total')];
$data['$credit.number'] = ['value' => $this->number ?: '&nbsp;', 'label' => ctrans('texts.credit_number')];
$data['$credit.amount'] = &$data['$credit.total'];
$data['$credit.po_number'] = &$data['$invoice.po_number'];
$data['$credit.date'] = ['value' => $this->date, 'label' => ctrans('texts.credit_date')];
$data['$balance'] = ['value' => Number::formatMoney($calc->getBalance(), $this->client) ?: '&nbsp;', 'label' => ctrans('texts.balance')];
$data['$credit.balance'] = &$data['$balance'];
$data['$invoice.balance'] = &$data['$balance'];
$data['$taxes'] = ['value' => Number::formatMoney($calc->getItemTotalTaxes(), $this->client) ?: '&nbsp;', 'label' => ctrans('texts.taxes')];
$data['$invoice.taxes'] = &$data['$taxes'];

View File

@ -45,13 +45,13 @@ class ImportTest extends TestCase
$this->migration_array = json_decode(file_get_contents($migration_file), 1);
}
// public function testImportClassExists()
// {
// $status = class_exists('App\Jobs\Util\Import');
public function testImportClassExists()
{
$status = class_exists('App\Jobs\Util\Import');
// $this->assertTrue($status);
$this->assertTrue($status);
// }
}
// public function testExceptionOnUnavailableResource()
// {

View File

@ -18,6 +18,11 @@ class PdfVariablesTest extends TestCase
$this->settings = CompanySettings::defaults();
}
public function testPdfVariableDefaults()
{
$this->assertTrue(is_array($this->settings->pdf_variables->client_details));
}
/*
public function testPdfVariableDefaults()
{