Template variable..

This commit is contained in:
Cüneyt Şentürk 2021-06-25 08:45:00 +03:00
parent 43e31fd647
commit d3f82863f5
3 changed files with 564 additions and 554 deletions

View File

@ -19,134 +19,177 @@ abstract class TransactionTemplate extends Base
use DateTime;
use Transactions;
/** @var string */
public $type;
public $item;
public $transaction;
/** @var string */
public $transactionTemplate;
public $date_format;
public $logo;
public $backgroundColor;
public $hideFooter;
public $hideCompanyLogo;
public $hideCompanyDetails;
public $hideCompanyName;
public $hideCompanyAddress;
public $hideCompanyTaxNumber;
public $hideCompanyPhone;
public $hideCompanyEmail;
public $hideContactInfo;
public $hideContactName;
public $hideContactAddress;
public $hideContactTaxNumber;
public $hideContactPhone;
public $hideContactEmail;
public $hideOrderNumber;
public $hidetransactionNumber;
public $hideIssuedAt;
public $hideDueAt;
/** @var array */
public $payment_methods;
/** @var string */
public $texttransactionTitle;
/** @var bool */
public $hideCompany;
/** @var string */
public $texttransactionSubheading;
/** @var bool */
public $hideCompanyLogo;
public $textContactInfo;
/** @var bool */
public $hideCompanyDetails;
/** @var string */
public $textIssuedAt;
/** @var bool */
public $hideCompanyName;
/** @var string */
public $textDueAt;
/** @var bool */
public $hideCompanyAddress;
/** @var string */
public $texttransactionNumber;
/** @var bool */
public $hideCompanyTaxNumber;
/** @var string */
public $textOrderNumber;
/** @var bool */
public $hideCompanyPhone;
public $hideItems;
/** @var bool */
public $hideCompanyEmail;
public $hideName;
/** @var bool */
public $hideContentTitle;
/** @var bool */
public $hidePaidAt;
/** @var bool */
public $hideAccount;
/** @var bool */
public $hideCategory;
/** @var bool */
public $hidePaymentMethods;
/** @var bool */
public $hideReference;
/** @var bool */
public $hideDescription;
public $hideQuantity;
public $hidePrice;
public $hideDiscount;
/** @var bool */
public $hideAmount;
/** @var string */
public $textItems;
public $textContentTitle;
/** @var string */
public $textQuantity;
public $textPaidAt;
/** @var string */
public $textPrice;
public $textAccount;
/** @var string */
public $textCategory;
/** @var string */
public $textPaymentMethods;
/** @var string */
public $textReference;
/** @var string */
public $textDescription;
/** @var string */
public $textAmount;
public $hideNote;
/** @var string */
public $textPaidBy;
/** @var bool */
public $hideContact;
/** @var bool */
public $hideContactInfo;
/** @var bool */
public $hideContactName;
/** @var bool */
public $hideContactAddress;
/** @var bool */
public $hideContactTaxNumber;
/** @var bool */
public $hideContactPhone;
/** @var bool */
public $hideContactEmail;
/** @var bool */
public $hideReletad;
/** @var bool */
public $hideReletadDocumentNumber;
/** @var bool */
public $hideReletadContact;
/** @var bool */
public $hideReletadDocumentDate;
/** @var bool */
public $hideReletadDocumentAmount;
/** @var bool */
public $hideReletadAmount;
/** @var string */
public $textReleatedTransansaction;
/** @var string */
public $textReleatedDocumentNumber;
/** @var string */
public $textReleatedContact;
/** @var string */
public $textReleatedDocumentDate;
/** @var string */
public $textReleatedDocumentAmount;
/** @var string */
public $textReleatedAmount;
/** @var string */
public $routeDocumentShow;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct(
$type, $transaction, $item = false, $transactionTemplate = '', $logo = '', $backgroundColor = '',
bool $hideFooter = false, bool $hideCompanyLogo = false, bool $hideCompanyDetails = false, array $payment_methods = [],
bool $hideCompanyName = false, bool $hideCompanyAddress = false, bool $hideCompanyTaxNumber = false, bool $hideCompanyPhone = false, bool $hideCompanyEmail = false, bool $hideContactInfo = false,
bool $hideContactName = false, bool $hideContactAddress = false, bool $hideContactTaxNumber = false, bool $hideContactPhone = false, bool $hideContactEmail = false,
bool $hideOrderNumber = false, bool $hidetransactionNumber = false, bool $hideIssuedAt = false, bool $hideDueAt = false,
string $texttransactionTitle = '', string $texttransactionSubheading = '',
string $textContactInfo = '', string $texttransactionNumber = '', string $textOrderNumber = '', string $textIssuedAt = '', string $textDueAt = '',
bool $hideItems = false, bool $hideName = false, bool $hideDescription = false, bool $hideQuantity = false, bool $hidePrice = false, bool $hideDiscount = false, bool $hideAmount = false, bool $hideNote = false,
string $textItems = '', string $textQuantity = '', string $textPrice = '', string $textAmount = ''
$type, $transaction, $logo = '', array $payment_methods = [],
bool $hideCompany = false, bool $hideCompanyLogo = false, bool $hideCompanyDetails = false, bool $hideCompanyName = false, bool $hideCompanyAddress = false,
bool $hideCompanyTaxNumber = false, bool $hideCompanyPhone = false, bool $hideCompanyEmail = false,
bool $hideContentTitle = false,bool $hidePaidAt = false, bool $hideAccount = false, bool $hideCategory = false, bool $hidePaymentMethods = false, bool $hideReference = false, bool $hideDescription = false,
bool $hideAmount = false,
string $textContentTitle = '', string $textPaidAt = '', string $textAccount = '', string $textCategory = '', string $textPaymentMethods = '', string $textReference = '', string $textDescription = '',
string $textAmount = '', string $textPaidBy = '',
bool $hideContact = false, bool $hideContactInfo = false, bool $hideContactName = false, bool $hideContactAddress = false, bool $hideContactTaxNumber = false,
bool $hideContactPhone = false, bool $hideContactEmail = false,
bool $hideReletad = false, bool $hideReletadDocumentNumber = false, bool $hideReletadContact = false, bool $hideReletadDocumentDate = false, bool $hideReletadDocumentAmount = false, bool $hideReletadAmount = false,
string $textReleatedTransansaction = '', string $textReleatedDocumentNumber = '', string $textReleatedContact = '', string $textReleatedDocumentDate = '', string $textReleatedDocumentAmount = '', string $textReleatedAmount = '',
string $routeDocumentShow = ''
) {
$this->type = $type;
$this->item = $item;
$this->transaction = $transaction;
$this->transactionTemplate = $this->gettransactionTemplate($type, $transactionTemplate);
$this->logo = $this->getLogo($logo);
$this->backgroundColor = $this->getBackgroundColor($type, $backgroundColor);
$this->logo = $this->getLogo($logo);
$this->payment_methods = ($payment_methods) ?: Modules::getPaymentMethods();
$this->hideFooter = $hideFooter;
// Company Information Hide checker
$this->hideCompany = $hideCompany;
$this->hideCompanyLogo = $hideCompanyLogo;
$this->hideCompanyDetails = $hideCompanyDetails;
$this->hideCompanyName = $hideCompanyName;
@ -154,53 +197,54 @@ abstract class TransactionTemplate extends Base
$this->hideCompanyTaxNumber = $hideCompanyTaxNumber;
$this->hideCompanyPhone = $hideCompanyPhone;
$this->hideCompanyEmail = $hideCompanyEmail;
// Transaction Information Hide checker
$this->hideContentTitle = $hideContentTitle;
$this->hidePaidAt = $hidePaidAt;
$this->hideAccount = $hideAccount;
$this->hideCategory = $hideCategory;
$this->hidePaymentMethods = $hidePaymentMethods;
$this->hideReference = $hideReference;
$this->hideDescription = $hideDescription;
$this->hideAmount = $hideAmount;
// Transaction Information Text
$this->textContentTitle = $this->getTextContentTitle($type, $textContentTitle);
$this->textPaidAt = $this->getTextPaidAt($type, $textPaidAt);
$this->textAccount = $this->getTextAccount($type, $textAccount);
$this->textCategory = $this->getTextCategory($type, $textCategory);
$this->textPaymentMethods = $this->getTextPaymentMethods($type, $textPaymentMethods);
$this->textReference = $this->getTextReference($type, $textReference);
$this->textDescription = $this->getTextDescription($type, $textDescription);
$this->textAmount = $this->getTextAmount($type, $textAmount);
$this->textPaidBy = $this->getTextPaidBy($type, $textPaidBy);
// Contact Information Hide checker
$this->hideContact = $hideContact;
$this->hideContactInfo = $hideContactInfo;
$this->hideContactName = $hideContactName;
$this->hideContactAddress = $hideContactAddress;
$this->hideContactTaxNumber = $hideContactTaxNumber;
$this->hideContactPhone = $hideContactPhone;
$this->hideContactEmail = $hideContactEmail;
$this->hideOrderNumber = $hideOrderNumber;
$this->hidetransactionNumber = $hidetransactionNumber;
$this->hideIssuedAt = $hideIssuedAt;
$this->hideDueAt = $hideDueAt;
$this->texttransactionTitle = $this->getTexttransactionTitle($type, $texttransactionTitle);
$this->texttransactionSubheading = $this->gettexttransactionSubheading($type, $texttransactionSubheading);
$this->textContactInfo = $this->getTextContactInfo($type, $textContactInfo);
$this->textIssuedAt = $this->getTextIssuedAt($type, $textIssuedAt);
$this->texttransactionNumber = $this->getTexttransactionNumber($type, $texttransactionNumber);
$this->textDueAt = $this->getTextDueAt($type, $textDueAt);
$this->textOrderNumber = $this->getTextOrderNumber($type, $textOrderNumber);
// Releated Information Hide checker
$this->hideReletad = $hideReletad;
$this->hideReletadDocumentNumber = $hideReletadDocumentNumber;
$this->hideReletadContact = $hideReletadContact;
$this->hideReletadDocumentDate = $hideReletadDocumentDate;
$this->hideReletadDocumentAmount = $hideReletadDocumentAmount;
$this->hideReletadAmount = $hideReletadAmount;
$this->hideItems = $this->getHideItems($type, $hideItems, $hideName, $hideDescription);
$this->hideName = $this->getHideName($type, $hideName);
$this->hideDescription = $this->getHideDescription($type, $hideDescription);
$this->hideQuantity = $this->getHideQuantity($type, $hideQuantity);
$this->hidePrice = $this->getHidePrice($type, $hidePrice);
$this->hideDiscount = $this->getHideDiscount($type, $hideDiscount);
$this->hideAmount = $this->getHideAmount($type, $hideAmount);
$this->hideNote = $hideNote;
// Releated Information Text
$this->textReleatedTransansaction = $this->getTextReleatedTransansaction($type, $textReleatedTransansaction);
$this->textReleatedDocumentNumber = $this->getTextReleatedDocumentNumber($type, $textReleatedDocumentNumber);
$this->textReleatedContact = $this->getTextReleatedConcat($type, $textReleatedContact);
$this->textReleatedDocumentDate = $this->getTextReleatedDocumentDate($type, $textReleatedDocumentDate);
$this->textReleatedDocumentAmount = $this->getTextReleatedDocumentAmount($type, $textReleatedDocumentAmount);
$this->textReleatedAmount = $this->getTextReleatedAmount($type, $textReleatedAmount);
$this->textItems = $this->getTextItems($type, $textItems);
$this->textQuantity = $this->getTextQuantity($type, $textQuantity);
$this->textPrice = $this->getTextPrice($type, $textPrice);
$this->textAmount = $this->getTextAmount($type, $textAmount);
}
protected function gettransactionTemplate($type, $transactionTemplate)
{
if (!empty($transactionTemplate)) {
return $transactionTemplate;
}
if ($template = config('type.' . $type . 'template', false)) {
return $template;
}
$transactionTemplate = setting($this->getSettingKey($type, 'template'), 'default');
return $transactionTemplate;
$this->routeDocumentShow = $this->routeDocumentShow($type, $routeDocumentShow);
}
protected function getLogo($logo)
@ -255,242 +299,109 @@ abstract class TransactionTemplate extends Base
return 'data:image/' . $extension . ';base64,' . base64_encode($image);
}
protected function getBackgroundColor($type, $backgroundColor)
protected function getTextContentTitle($type, $textContentTitle)
{
if (!empty($backgroundColor)) {
return $backgroundColor;
if (!empty($textContentTitle)) {
return $textContentTitle;
}
if ($background_color = config('type.' . $type . 'color', false)) {
return $background_color;
}
if (!empty($alias = config('type.' . $type . '.alias'))) {
$type = $alias . '.' . str_replace('-', '_', $type);
}
$backgroundColor = setting($this->getSettingKey($type, 'color'), '#55588b');
return $backgroundColor;
}
protected function getTexttransactionTitle($type, $texttransactionTitle)
{
if (!empty($texttransactionTitle)) {
return $texttransactionTitle;
}
if (!empty(setting($type . '.title'))) {
return setting($type . '.title');
}
$translation = $this->getTextFromConfig($type, 'transaction_title', Str::plural($type));
if (!empty($translation)) {
return trans_choice($translation, 1);
}
return setting('invoice.title');
}
protected function getTexttransactionSubheading($type, $texttransactionSubheading)
{
if (!empty($texttransactionSubheading)) {
return $texttransactionSubheading;
}
if (!empty(setting($type . '.subheading'))) {
return setting($type . '.subheading');
}
$translation = $this->getTextFromConfig($type, 'transaction_subheading', 'subheading');
if (!empty($translation)) {
return trans($translation);
}
return false;
}
protected function getTexttransactionNumber($type, $texttransactionNumber)
{
if (!empty($texttransactionNumber)) {
return $texttransactionNumber;
}
switch ($type) {
case 'bill':
case 'expense':
case 'purchase':
$default_key = 'bill_number';
break;
default:
$default_key = 'invoice_number';
break;
}
$translation = $this->getTextFromConfig($type, 'transaction_number', $default_key);
$translation = $this->getTextFromConfig($type, $type . '_made', 'revenue_made');
if (!empty($translation)) {
return $translation;
}
return 'general.numbers';
return 'revenues.revenue_made';
}
protected function getTextOrderNumber($type, $textOrderNumber)
protected function getTextPaidAt($type, $textPaidAt)
{
if (!empty($textOrderNumber)) {
return $textOrderNumber;
if (!empty($textPaidAt)) {
return $textPaidAt;
}
$translation = $this->getTextFromConfig($type, 'order_number');
$translation = $this->getTextFromConfig($type, 'paid_at', 'date');
if (!empty($translation)) {
return $translation;
}
return 'invoices.order_number';
return 'general.date';
}
protected function getTextContactInfo($type, $textContactInfo)
protected function getTextAccount($type, $textAccount)
{
if (!empty($textContactInfo)) {
return $textContactInfo;
if (!empty($textAccount)) {
return $textAccount;
}
switch ($type) {
case 'bill':
case 'expense':
case 'purchase':
$default_key = 'bill_from';
break;
default:
$default_key = 'bill_to';
break;
}
$translation = $this->getTextFromConfig($type, 'contact_info', $default_key);
$translation = $this->getTextFromConfig($type, 'accounts', 'accounts', 'trans_choice');
if (!empty($translation)) {
return $translation;
}
return 'invoices.bill_to';
return 'general.accounts';
}
protected function getTextIssuedAt($type, $textIssuedAt)
protected function getTextCategory($type, $textCategory)
{
if (!empty($textIssuedAt)) {
return $textIssuedAt;
if (!empty($textCategory)) {
return $textCategory;
}
switch ($type) {
case 'bill':
case 'expense':
case 'purchase':
$default_key = 'bill_date';
break;
default:
$default_key = 'invoice_date';
break;
}
$translation = $this->getTextFromConfig($type, 'issued_at', $default_key);
$translation = $this->getTextFromConfig($type, 'categories', 'categories', 'trans_choice');
if (!empty($translation)) {
return $translation;
}
return 'invoices.invoice_date';
return 'general.categories';
}
protected function getTextDueAt($type, $textDueAt)
protected function getTextPaymentMethods($type, $textPaymentMethods)
{
if (!empty($textDueAt)) {
return $textDueAt;
if (!empty($textPaymentMethods)) {
return $textPaymentMethods;
}
$translation = $this->getTextFromConfig($type, 'due_at', 'due_date');
$translation = $this->getTextFromConfig($type, 'payment_methods', 'payment_methods', 'trans_choice');
if (!empty($translation)) {
return $translation;
}
return 'invoices.due_date';
return 'general.payment_methods';
}
protected function getTextItems($type, $textItems)
protected function getTextReference($type, $textReference)
{
if (!empty($textItems)) {
return $textItems;
if (!empty($textReference)) {
return $textReference;
}
// if you use settting translation
if (setting($this->getSettingKey($type, 'item_name'), 'items') == 'custom') {
if (empty($textItems = setting($this->getSettingKey($type, 'item_name_input')))) {
$textItems = 'general.items';
}
return $textItems;
}
$translation = $this->getTextFromConfig($type, 'items');
$translation = $this->getTextFromConfig($type, 'reference', 'reference');
if (!empty($translation)) {
return $translation;
}
return 'general.items';
return 'general.reference';
}
protected function getTextQuantity($type, $textQuantity)
protected function getTextDescription($type, $textDescription)
{
if (!empty($textQuantity)) {
return $textQuantity;
if (!empty($textDescription)) {
return $textDescription;
}
// if you use settting translation
if (setting($this->getSettingKey($type, 'quantity_name'), 'quantity') === 'custom') {
if (empty($textQuantity = setting($this->getSettingKey($type, 'quantity_name_input')))) {
$textQuantity = 'invoices.quantity';
}
return $textQuantity;
}
$translation = $this->getTextFromConfig($type, 'quantity');
$translation = $this->getTextFromConfig($type, 'description', 'description');
if (!empty($translation)) {
return $translation;
}
return 'invoices.quantity';
}
protected function getTextPrice($type, $textPrice)
{
if (!empty($textPrice)) {
return $textPrice;
}
// if you use settting translation
if (setting($this->getSettingKey($type, 'price_name'), 'price') === 'custom') {
if (empty($textPrice = setting($this->getSettingKey($type, 'price_name_input')))) {
$textPrice = 'invoices.price';
}
return $textPrice;
}
$translation = $this->getTextFromConfig($type, 'price');
if (!empty($translation)) {
return $translation;
}
return 'invoices.price';
return 'general.description';
}
protected function getTextAmount($type, $textAmount)
@ -499,7 +410,7 @@ abstract class TransactionTemplate extends Base
return $textAmount;
}
$translation = $this->getTextFromConfig($type, 'amount');
$translation = $this->getTextFromConfig($type, 'amount', 'amount');
if (!empty($translation)) {
return $translation;
@ -508,146 +419,130 @@ abstract class TransactionTemplate extends Base
return 'general.amount';
}
protected function getHideItems($type, $hideItems, $hideName, $hideDescription)
protected function getTextPaidBy($type, $textPaidBy)
{
if (!empty($hideItems)) {
return $hideItems;
if (!empty($textPaidBy)) {
return $textPaidBy;
}
$hide = $this->getHideFromConfig($type, 'items');
$translation = $this->getTextFromConfig($type, 'paid_by', 'paid_by');
if ($hide) {
return $hide;
if (!empty($translation)) {
return $translation;
}
$hideItems = ($this->getHideName($type, $hideName) & $this->getHideDescription($type, $hideDescription)) ? true : false;
return $hideItems;
return 'general.paid_by';
}
protected function getHideName($type, $hideName)
protected function getTextReleatedTransansaction($type, $textReleatedTransansaction)
{
if (!empty($hideName)) {
return $hideName;
if (!empty($textReleatedTransansaction)) {
return $textReleatedTransansaction;
}
// if you use settting translation
if ($hideName = setting($this->getSettingKey($type, 'hide_item_name'), false)) {
return $hideName;
$translation = $this->getTextFromConfig($type, 'related_revenue', 'related_revenue');
if (!empty($translation)) {
return $translation;
}
$hide = $this->getHideFromConfig($type, 'name');
if ($hide) {
return $hide;
return 'general.related_revenue';
}
// @todo what return value invoice or always false??
return setting('invoice.hide_item_name', $hideName);
}
protected function getHideDescription($type, $hideDescription)
protected function getTextReleatedDocumentNumber($type, $textReleatedDocumentNumber)
{
if (!empty($hideDescription)) {
return $hideDescription;
if (!empty($textReleatedDocumentNumber)) {
return $textReleatedDocumentNumber;
}
// if you use settting translation
if ($hideDescription = setting($this->getSettingKey($type, 'hide_item_description'), false)) {
return $hideDescription;
$translation = $this->getTextFromConfig($type, 'related_document_number', 'numbers');
if (!empty($translation)) {
return $translation;
}
$hide = $this->getHideFromConfig($type, 'description');
if ($hide) {
return $hide;
return 'general.numbers';
}
// @todo what return value invoice or always false??
return setting('invoice.hide_item_description', $hideDescription);
}
protected function getHideQuantity($type, $hideQuantity)
protected function getTextReleatedConcat($type, $textReleatedContact)
{
if (!empty($hideQuantity)) {
return $hideQuantity;
if (!empty($textReleatedContact)) {
return $textReleatedContact;
}
// if you use settting translation
if ($hideQuantity = setting($this->getSettingKey($type, 'hide_quantity'), false)) {
return $hideQuantity;
$translation = $this->getTextFromConfig($type, 'related_contact', 'contact');
if (!empty($translation)) {
return $translation;
}
$hide = $this->getHideFromConfig($type, 'quantity');
if ($hide) {
return $hide;
return 'general.customers';
}
// @todo what return value invoice or always false??
return setting('invoice.hide_quantity', $hideQuantity);
}
protected function getHidePrice($type, $hidePrice)
protected function getTextReleatedDocumentDate($type, $textReleatedDocumentDate)
{
if (!empty($hidePrice)) {
return $hidePrice;
if (!empty($textReleatedDocumentDate)) {
return $textReleatedDocumentDate;
}
// if you use settting translation
if ($hidePrice = setting($this->getSettingKey($type, 'hide_price'), false)) {
return $hidePrice;
$translation = $this->getTextFromConfig($type, 'related_document_date', 'due_date');
if (!empty($translation)) {
return $translation;
}
$hide = $this->getHideFromConfig($type, 'price');
if ($hide) {
return $hide;
return 'invoices.invoice_date';
}
// @todo what return value invoice or always false??
return setting('invoice.hide_price', $hidePrice);
}
protected function getHideDiscount($type, $hideDiscount)
protected function getTextReleatedDocumentAmount($type, $textReleatedDocumentAmount)
{
if (!empty($hideDiscount)) {
return $hideDiscount;
if (!empty($textReleatedDocumentAmount)) {
return $textReleatedDocumentAmount;
}
// if you use settting translation
if ($hideDiscount = setting($this->getSettingKey($type, 'hide_discount'), false)) {
return $hideDiscount;
$translation = $this->getTextFromConfig($type, 'related_document_amount', 'amount');
if (!empty($translation)) {
return $translation;
}
$hide = $this->getHideFromConfig($type, 'discount');
if ($hide) {
return $hide;
return 'general.amount';
}
// @todo what return value invoice or always false??
return setting('invoice.hide_discount', $hideDiscount);
}
protected function getHideAmount($type, $hideAmount)
protected function getTextReleatedAmount($type, $textReleatedAmount)
{
if (!empty($hideAmount)) {
return $hideAmount;
if (!empty($textReleatedAmount)) {
return $textReleatedAmount;
}
// if you use settting translation
if ($hideAmount = setting($this->getSettingKey($type, 'hide_amount'), false)) {
return $hideAmount;
$translation = $this->getTextFromConfig($type, 'related_amount', 'amount');
if (!empty($translation)) {
return $translation;
}
$hide = $this->getHideFromConfig($type, 'amount');
if ($hide) {
return $hide;
return 'general.amount';
}
// @todo what return value invoice or always false??
return setting('invoice.hide_amount', $hideAmount);
protected function routeDocumentShow($type, $routeDocumentShow)
{
if (!empty($routeDocumentShow)) {
return $routeDocumentShow;
}
if (!$this->transaction->document) {
return $routeDocumentShow;
}
//example route parameter.
$parameter = 1;
$route = $this->getRouteFromConfig($this->transaction->document->type, 'show', $parameter);
if (!empty($route)) {
return $route;
}
return 'invoices.show';
}
}

View File

@ -13,6 +13,57 @@
:payment_methods="$payment_methods"
transaction-template="{{ $transactionTemplate }}"
logo="{{ $logo }}"
hide-company="{{ $hideCompany }}"
hide-company-logo="{{ $hideCompanyLogo }}"
hide-company-details="{{ $hideCompanyDetails }}"
hide-company-name="{{ $hideCompanyName }}"
hide-company-address="{{ $hideCompanyAddress }}"
hide-company-tax-number="{{ $hideCompanyTaxNumber }}"
hide-company-phone="{{ $hideCompanyPhone }}"
hide-company-email="{{ $hideCompanyEmail }}"
hide-content-title="{{ $hideContentTitle }}"
hide-paid-at="{{ $hidePaidAt }}"
hide-account="{{ $hideAccount }}"
hide-category="{{ $hideCategory }}"
hide-payment-methods="{{ $hidePaymentMethods }}"
hide-reference="{{ $hideReference }}"
hide-description="{{ $hideDescription }}"
hide-amount="{{ $hideAmount }}"
text-content-title="{{ $textContentTitle }}"
text-paid-at="{{ $textPaidAt }}"
text-account="{{ $textAccount }}"
text-category="{{ $textCategory }}"
text-payment-methods="{{ $textPaymentMethods }}"
text-reference="{{ $textReference }}"
text-description="{{ $textDescription }}"
text-paid-by="{{ $textAmount }}"
hide-contact="{{ $hideContact }}"
hide-contact-info="{{ $hideContactInfo }}"
hide-contact-name="{{ $hideContactName }}"
hide-contact-address="{{ $hideContactAddress }}"
hide-contact-tax-number="{{ $hideContactTaxNumber }}"
hide-contact-phone="{{ $hideContactPhone }}"
hide-contact-email="{{ $hideContactEmail }}"
hide-releated="{{ $hideReletad }}"
hide-releated-document-number="{{ $hideReletadDocumentNumber }}"
hide-releated-contact="{{ $hideReletadContact }}"
hide-releated-document-date="{{ $hideReletadDocumentDate }}"
hide-releated-document-amount="{{ $hideReletadDocumentAmount }}"
hide-releated-amount="{{ $hideReletadAmount }}"
text-releated-transaction="{{ $textReleatedTransansaction }}"
text-releated-document-number="{{ $textReleatedDocumentNumber }}"
text-releated-contact="{{ $textReleatedContact }}"
text-releated-document-date="{{ $textReleatedDocumentDate }}"
text-releated-document-amount="{{ $textReleatedDocumentAmount }}"
text-releated-amount="{{ $textReleatedAmount }}"
route-document-show="{{ $routeDocumentShow }}"
/>
@endswitch
@else

View File

@ -1,10 +1,13 @@
@stack('company_start')
@if (!$hideCompany)
<div class="row border-bottom-1 pt-6 pb-6">
<div class="col-16">
<div class="text company">
@stack('company_logo_start')
@if (!$hideCompanyLogo)
@if (!empty($document->contact->logo) && !empty($document->contact->logo->id))
<img src="{{ Storage::url($document->contact->logo->id) }}" height="128" width="128" alt="{{ $document->contact_name }}"/>
@if (!empty($transaction->contact->logo) && !empty($transaction->contact->logo->id))
<img src="{{ Storage::url($transaction->contact->logo->id) }}" height="128" width="128" alt="{{ $transaction->contact->name }}"/>
@else
<img src="{{ $logo }}" alt="{{ setting('company.name') }}"/>
@endif
@ -51,68 +54,99 @@
</div>
</div>
</div>
@endif
@stack('company_end')
<div class="row border-bottom-1 w-100 mt-6 pb-6 d-flex flex-column">
<h2 class="text-center text-uppercase mb-6">{{ trans('invoices.revenue_made') }}</h2>
@if (!$hideContentTitle)
<h2 class="text-center text-uppercase mb-6">
{{ trans($textContentTitle) }}
</h2>
@endif
<div class="d-flex">
<div class="d-flex flex-column col-lg-7 pl-0">
<div class="d-flex mt-3">
<div class="text company show-company col-lg-4 pl-0">
@if (!$hidePaidAt)
<p>
<strong>{{ trans('general.date') }}:</strong>
<strong>{{ trans($textPaidAt) }}:</strong>
</p>
@endif
@if (!$hideAccount)
<p>
<strong>{{ trans_choice('general.accounts', 1) }}:</strong>
<strong>{{ trans_choice($textAccount, 1) }}:</strong>
</p>
@endif
@if (!$hideCategory)
<p>
{{ trans_choice('general.categories', 1) }}:</strong>
{{ trans_choice($textCategory, 1) }}:</strong>
</p>
@endif
@if (!$hidePaymentMethods)
<p>
<strong>{{ trans_choice('general.payment_methods', 1) }}:</strong>
<strong>{{ trans_choice($textPaymentMethods, 1) }}:</strong>
</p>
@endif
@if (!$hideReference)
<p>
<strong>{{ trans('general.reference') }}:</strong>
<strong>{{ trans($textReference) }}:</strong>
</p>
@endif
@if (!$hideDescription)
<p>
<strong>{{ trans('general.description') }}:</strong>
<strong>{{ trans($textDescription) }}:</strong>
</p>
@endif
</div>
<div class="text company col-lg-8 pr-0 show-company show-company-value">
@if (!$hidePaidAt)
<p class="border-bottom-1">
@date($transaction->paid_at)
</p>
@endif
@if (!$hideAccount)
<p class="border-bottom-1">
{{ $transaction->account->name }}
</p>
@endif
@if (!$hideCategory)
<p class="border-bottom-1">
{{ $transaction->category->name }}
</p>
@endif
@if (!$hidePaymentMethods)
<p class="border-bottom-1">
{{ $payment_methods[$transaction->payment_method] }}
</p>
@endif
@if (!$hideReference)
<p class="border-bottom-1">
{{ $transaction->reference }}
</p>
@endif
@if (!$hideDescription)
<p>
{!! nl2br($transaction->description) !!}
</p>
@endif
</div>
</div>
@if (!$hideContact)
<div class="text company mt-5">
<h2>{{ trans('general.paid_by') }}</h2>
<h2>{{ trans($textPaidBy) }}</h2>
@if ($hideContactInfo)
<strong>{{ trans($textContactInfo) }}</strong><br>
@ -158,14 +192,18 @@
@endif
@stack('email_input_end')
</div>
@endif
</div>
@if (!$hideAmount)
<div class="d-flex flex-column align-items-end col-lg-5 pr-0">
<div class="card bg-success show-card-bg-success border-0 mt-4 mb-0">
<div class="card-body">
<div class="row">
<div class="col card-amount-badge text-center mt-3">
<h5 class="text-muted mb-0 text-white">{{ trans('general.amount') }}</h5>
<h5 class="text-muted mb-0 text-white">
{{ trans($textAmount) }}
</h5>
<span class="h2 font-weight-bold mb-0 text-white">
@money($transaction->amount, $transaction->currency_code, true)
@ -175,63 +213,85 @@
</div>
</div>
</div>
@endif
</div>
</div>
@if (!$hideReletad)
@if ($transaction->document)
<div class="row mt-3 mb-3">
<div class="col-100">
<div class="text">
<h3>{{ trans('invoices.related_revenue') }}</h3>
<h3>{{ trans($textReleatedTransansaction) }}</h3>
<table class="table table-flush table-hover mt-3">
<thead class="thead-light">
<tr class="border-bottom-1">
@if (!$hideReletadDocumentNumber)
<th class="item text-left">
<span>{{ trans_choice('general.numbers', 1) }}</span>
<span>{{ trans_choice($textReleatedDocumentNumber, 1) }}</span>
</th>
@endif
@if (!$hideReletadContact)
<th class="quantity">
{{ trans_choice('general.customers', 1) }}
{{ trans_choice($textReleatedContact, 1) }}
</th>
@endif
@if (!$hideReletadDocumentDate)
<th class="price">
{{ trans('invoices.invoice_date') }}
{{ trans($textReleatedDocumentDate) }}
</th>
@endif
@if (!$hideReletadDocumentAmount)
<th class="price">
{{ trans('invoices.invoice_date') }}
{{ trans($textReleatedDocumentAmount) }}
</th>
@endif
@if (!$hideReletadAmount)
<th class="total">
{{ trans('general.amount') }}
{{ trans($textReleatedAmount) }}
</th>
@endif
</tr>
</thead>
<tbody>
<tr class="border-bottom-1">
@if (!$hideReletadDocumentNumber)
<td class="item">
<a href="{{ route('invoices.show' , $transaction->document->id) }}">
<a href="{{ route($routeDocumentShow, $transaction->document->id) }}">
{{ $transaction->document->document_number }}
</a>
</td>
@endif
@if (!$hideReletadContact)
<td class="quantity">
{{ $transaction->document->contact_name }}
</td>
@endif
@if (!$hideReletadDocumentDate)
<td class="price">
@date($transaction->document->due_at)
</td>
@endif
@if (!$hideReletadDocumentAmount)
<td class="price">
@money($transaction->document->amount, $transaction->document->currency_code, true)
</td>
@endif
@if (!$hideReletadAmount)
<td class="total">
@money($transaction->amount, $transaction->currency_code, true)
</td>
@endif
</tr>
</tbody>
</table>
@ -240,8 +300,12 @@
</div>
@else
<div class="row mt-3 mb-3">
<p>
{{ trans('invoices.overdue_revenue') }}: <strong style="font-weight: bold;">@money($transaction->amount, $transaction->currency_code, true)</strong>
<p class="text-right">
{{ trans('invoices.overdue_revenue') }}:
<strong style="font-weight: bold;">
@money($transaction->amount, $transaction->currency_code, true)
</strong>
</p>
</div>
@endif
@endif