close #2999 Enhancement: Invoice item columns setting styling ( #866acb813 )

This commit is contained in:
Cüneyt Şentürk 2023-07-03 18:10:11 +03:00
parent c58db84339
commit f3169536fe
2 changed files with 134 additions and 41 deletions

View File

@ -164,30 +164,45 @@ abstract class Form extends Component
/** @var bool */ /** @var bool */
public $hideItemName; public $hideItemName;
/** @var bool */
public $hideSettingItemName;
/** @var string */ /** @var string */
public $textItemName; public $textItemName;
/** @var bool */ /** @var bool */
public $hideItemDescription; public $hideItemDescription;
/** @var bool */
public $hideSettingItemDescription;
/** @var string */ /** @var string */
public $textItemDescription; public $textItemDescription;
/** @var bool */ /** @var bool */
public $hideItemQuantity; public $hideItemQuantity;
/** @var bool */
public $hideSettingItemQuantity;
/** @var string */ /** @var string */
public $textItemQuantity; public $textItemQuantity;
/** @var bool */ /** @var bool */
public $hideItemPrice; public $hideItemPrice;
/** @var bool */
public $hideSettingItemPrice;
/** @var string */ /** @var string */
public $textItemPrice; public $textItemPrice;
/** @var bool */ /** @var bool */
public $hideItemAmount; public $hideItemAmount;
/** @var bool */
public $hideSettingItemAmount;
/** @var string */ /** @var string */
public $textItemAmount; public $textItemAmount;
@ -276,8 +291,8 @@ abstract class Form extends Component
string $textAddContact = '', string $textCreateNewContact = '', string $textEditContact = '', string $textContactInfo = '', string $textChooseDifferentContact = '', string $textAddContact = '', string $textCreateNewContact = '', string $textEditContact = '', string $textContactInfo = '', string $textChooseDifferentContact = '',
bool $hideIssuedAt = false, string $textIssuedAt = '', string $issuedAt = '', bool $hideDueAt = false, string $textDueAt = '', string $dueAt = '', $periodDueAt = '', bool $hideIssuedAt = false, string $textIssuedAt = '', string $issuedAt = '', bool $hideDueAt = false, string $textDueAt = '', string $dueAt = '', $periodDueAt = '',
bool $hideDocumentNumber = false, string $textDocumentNumber = '', string $documentNumber = '', bool $hideOrderNumber = false, string $textOrderNumber = '', string $orderNumber = '', bool $hideDocumentNumber = false, string $textDocumentNumber = '', string $documentNumber = '', bool $hideOrderNumber = false, string $textOrderNumber = '', string $orderNumber = '',
bool $hideEditItemColumns = false, bool $hideItems = false, bool $hideItemName = false, string $textItemName = '', bool $hideItemDescription = false, string $textItemDescription = '', bool $hideEditItemColumns = false, bool $hideItems = false, bool $hideItemName = false, bool $hideSettingItemName = false, string $textItemName = '', bool $hideItemDescription = false, bool $hideSettingItemDescription = false, string $textItemDescription = '',
bool $hideItemQuantity = false, string $textItemQuantity = '', bool $hideItemPrice = false, string $textItemPrice = '', bool $hideItemAmount = false, string $textItemAmount = '', bool $hideItemQuantity = false, bool $hideSettingItemQuantity = false, string $textItemQuantity = '', bool $hideItemPrice = false, bool $hideSettingItemPrice = false, string $textItemPrice = '', bool $hideItemAmount = false, bool $hideSettingItemAmount = false, string $textItemAmount = '',
bool $hideDiscount = false, bool $isSalePrice = false, bool $isPurchasePrice = false, int $searchCharLimit = 0, string $notes = '', bool $hideDiscount = false, bool $isSalePrice = false, bool $isPurchasePrice = false, int $searchCharLimit = 0, string $notes = '',
bool $showRecurring = false, bool $showRecurring = false,
bool $hideAdvanced = false, string $textSectionAdvancedTitle = '', string $textSectionAdvancedDescription = '', bool $hideAdvanced = false, string $textSectionAdvancedTitle = '', string $textSectionAdvancedDescription = '',
@ -358,18 +373,23 @@ abstract class Form extends Component
$this->hideItems = $this->getHideItems($type, $hideItems, $hideItemName, $hideItemDescription); $this->hideItems = $this->getHideItems($type, $hideItems, $hideItemName, $hideItemDescription);
$this->hideItemName = $this->getHideItemName($type, $hideItemName); $this->hideItemName = $this->getHideItemName($type, $hideItemName);
$this->hideSettingItemName = $this->getHideSettingItemName($type, $hideSettingItemName);
$this->textItemName = $this->getTextItemName($type, $textItemName); $this->textItemName = $this->getTextItemName($type, $textItemName);
$this->hideItemDescription = $this->getHideItemDescription($type, $hideItemDescription); $this->hideItemDescription = $this->getHideItemDescription($type, $hideItemDescription);
$this->hideSettingItemDescription = $this->getHideSettingItemDescription($type, $hideSettingItemDescription);
$this->textItemDescription = $this->getTextItemDescription($type, $textItemDescription); $this->textItemDescription = $this->getTextItemDescription($type, $textItemDescription);
$this->hideItemQuantity = $this->getHideItemQuantity($type, $hideItemQuantity); $this->hideItemQuantity = $this->getHideItemQuantity($type, $hideItemQuantity);
$this->hideSettingItemQuantity = $this->getHideSettingItemQuantity($type, $hideSettingItemQuantity);
$this->textItemQuantity = $this->getTextItemQuantity($type, $textItemQuantity); $this->textItemQuantity = $this->getTextItemQuantity($type, $textItemQuantity);
$this->hideItemPrice = $this->getHideItemPrice($type, $hideItemPrice); $this->hideItemPrice = $this->getHideItemPrice($type, $hideItemPrice);
$this->hideSettingItemPrice = $this->getHideSettingItemPrice($type, $hideSettingItemPrice);
$this->textItemPrice = $this->getTextItemPrice($type, $textItemPrice); $this->textItemPrice = $this->getTextItemPrice($type, $textItemPrice);
$this->hideItemAmount = $this->getHideItemAmount($type, $hideItemAmount); $this->hideItemAmount = $this->getHideItemAmount($type, $hideItemAmount);
$this->hideSettingItemAmount = $this->getHideSettingItemAmount($type, $hideSettingItemAmount);
$this->textItemAmount = $this->getTextItemAmount($type, $textItemAmount); $this->textItemAmount = $this->getTextItemAmount($type, $textItemAmount);
$this->hideDiscount = $this->getHideDiscount($type, $hideDiscount); $this->hideDiscount = $this->getHideDiscount($type, $hideDiscount);
@ -880,6 +900,21 @@ abstract class Form extends Component
return $hideItemName; return $hideItemName;
} }
$hide = $this->getHideFromConfig($type, 'name');
if ($hide) {
return $hide;
}
return false;
}
protected function getHideSettingItemName($type, $hideSettingItemName): bool
{
if (! empty($hideSettingItemName)) {
return $hideSettingItemName;
}
$hideItemName = setting($this->getDocumentSettingKey($type, 'item_name'), false); $hideItemName = setting($this->getDocumentSettingKey($type, 'item_name'), false);
// if you use settting translation // if you use settting translation
@ -887,12 +922,6 @@ abstract class Form extends Component
return true; return true;
} }
$hide = $this->getHideFromConfig($type, 'name');
if ($hide) {
return $hide;
}
return false; return false;
} }
@ -932,13 +961,6 @@ abstract class Form extends Component
return $hideItemDescription; return $hideItemDescription;
} }
// if you use settting translation
if (setting($this->getDocumentSettingKey($type, 'hide_item_description'), false)) {
return true;
}
$hide = $this->getHideFromConfig($type, 'description'); $hide = $this->getHideFromConfig($type, 'description');
if ($hide) { if ($hide) {
@ -948,6 +970,20 @@ abstract class Form extends Component
return false; return false;
} }
protected function getHideSettingItemDescription($type, $hideSettingItemDescription): bool
{
if (! empty($hideSettingItemDescription)) {
return $hideSettingItemDescription;
}
// if you use settting translation
if (setting($this->getDocumentSettingKey($type, 'hide_item_description'), false)) {
return true;
}
return false;
}
protected function getTextItemDescription($type, $textItemDescription) protected function getTextItemDescription($type, $textItemDescription)
{ {
if (! empty($textItemDescription)) { if (! empty($textItemDescription)) {
@ -969,6 +1005,21 @@ abstract class Form extends Component
return $hideItemQuantity; return $hideItemQuantity;
} }
$hide = $this->getHideFromConfig($type, 'quantity');
if ($hide) {
return $hide;
}
return false;
}
protected function getHideSettingItemQuantity($type, $hideSettingItemQuantity): bool
{
if (! empty($hideSettingItemQuantity)) {
return $hideSettingItemQuantity;
}
$hideItemQuantity = setting($this->getDocumentSettingKey($type, 'quantity_name'), false); $hideItemQuantity = setting($this->getDocumentSettingKey($type, 'quantity_name'), false);
// if you use settting translation // if you use settting translation
@ -976,12 +1027,6 @@ abstract class Form extends Component
return true; return true;
} }
$hide = $this->getHideFromConfig($type, 'quantity');
if ($hide) {
return $hide;
}
return false; return false;
} }
@ -1021,6 +1066,21 @@ abstract class Form extends Component
return $hideItemPrice; return $hideItemPrice;
} }
$hide = $this->getHideFromConfig($type, 'price');
if ($hide) {
return $hide;
}
return false;
}
protected function getHideSettingItemPrice($type, $hideSettingItemPrice): bool
{
if (! empty($hideSettingItemPrice)) {
return $hideSettingItemPrice;
}
$hideItemPrice = setting($this->getDocumentSettingKey($type, 'price_name'), false); $hideItemPrice = setting($this->getDocumentSettingKey($type, 'price_name'), false);
// if you use settting translation // if you use settting translation
@ -1028,12 +1088,6 @@ abstract class Form extends Component
return true; return true;
} }
$hide = $this->getHideFromConfig($type, 'price');
if ($hide) {
return $hide;
}
return false; return false;
} }
@ -1073,11 +1127,6 @@ abstract class Form extends Component
return $hideItemAmount; return $hideItemAmount;
} }
// if you use settting translation
if (setting($this->getDocumentSettingKey($type, 'hide_amount'), false)) {
return true;
}
$hide = $this->getHideFromConfig($type, 'amount'); $hide = $this->getHideFromConfig($type, 'amount');
if ($hide) { if ($hide) {
@ -1087,6 +1136,20 @@ abstract class Form extends Component
return false; return false;
} }
protected function getHideSettingItemAmount($type, $hideSettingItemAmount): bool
{
if (! empty($hideSettingItemAmount)) {
return $hideSettingItemAmount;
}
// if you use settting translation
if (setting($this->getDocumentSettingKey($type, 'hide_amount'), false)) {
return true;
}
return false;
}
protected function getTextItemAmount($type, $textItemAmount) protected function getTextItemAmount($type, $textItemAmount)
{ {
if (!empty($textItemAmount)) { if (!empty($textItemAmount)) {

View File

@ -30,6 +30,13 @@
<th class="px-3 py-1 ltr:pl-2 rtl:pr-2 ltr:text-left rtl:text-right text-xs font-normal border-t-0 border-r-0 border-b-0" style="vertical-align:bottom;"> <th class="px-3 py-1 ltr:pl-2 rtl:pr-2 ltr:text-left rtl:text-right text-xs font-normal border-t-0 border-r-0 border-b-0" style="vertical-align:bottom;">
@if (! $hideItemName) @if (! $hideItemName)
{{ (trans_choice($textItemName, 2) != $textItemName) ? trans_choice($textItemName, 2) : trans($textItemName) }} {{ (trans_choice($textItemName, 2) != $textItemName) ? trans_choice($textItemName, 2) : trans($textItemName) }}
@if ($hideSettingItemName)
&nbsp;&nbsp;
<x-tooltip id="tooltip-item-price" placement="top" message="{{ trans('documents.item_price_hidden', ['type' => config('type.document.' . $type . '.translation.prefix')]) }}">
<x-icon icon="visibility_off" class="text-sm font-normal"></x-icon>
</x-tooltip>
@endif
@endif @endif
</th> </th>
@ -40,6 +47,13 @@
<th class="px-3 py-1 text-left text-xs font-normal border-t-0 border-r-0 border-b-0" style=" vertical-align:bottom;"> <th class="px-3 py-1 text-left text-xs font-normal border-t-0 border-r-0 border-b-0" style=" vertical-align:bottom;">
@if (! $hideItemDescription) @if (! $hideItemDescription)
{{ trans($textItemDescription) }} {{ trans($textItemDescription) }}
@if ($hideSettingItemDescription)
&nbsp;&nbsp;
<x-tooltip id="tooltip-item-price" placement="top" message="{{ trans('documents.item_price_hidden', ['type' => config('type.document.' . $type . '.translation.prefix')]) }}">
<x-icon icon="visibility_off" class="text-sm font-normal"></x-icon>
</x-tooltip>
@endif
@endif @endif
</th> </th>
@ -51,6 +65,13 @@
<th class="px-3 py-1 ltr:text-left rtl:text-right text-xs font-normal border-t-0 border-r-0 border-b-0" style="vertical-align:bottom;"> <th class="px-3 py-1 ltr:text-left rtl:text-right text-xs font-normal border-t-0 border-r-0 border-b-0" style="vertical-align:bottom;">
@if (! $hideItemQuantity) @if (! $hideItemQuantity)
{{ trans($textItemQuantity) }} {{ trans($textItemQuantity) }}
@if ($hideSettingItemQuantity)
&nbsp;&nbsp;
<x-tooltip id="tooltip-item-price" placement="top" message="{{ trans('documents.item_price_hidden', ['type' => config('type.document.' . $type . '.translation.prefix')]) }}">
<x-icon icon="visibility_off" class="text-sm font-normal"></x-icon>
</x-tooltip>
@endif
@endif @endif
</th> </th>
@ -59,14 +80,16 @@
@stack('price_th_start') @stack('price_th_start')
<th class="px-3 py-1 ltr:text-left rtl:text-right text-xs font-normal border-t-0 border-r-0 border-b-0 pr-1" style="vertical-align:bottom;"> <th class="px-3 py-1 ltr:text-left rtl:text-right text-xs font-normal border-t-0 border-r-0 border-b-0 pr-1" style="vertical-align:bottom;">
@if (! $hideItemPrice)
{{ trans($textItemPrice) }} {{ trans($textItemPrice) }}
@if ($hideItemPrice) @if ($hideSettingItemPrice)
&nbsp;&nbsp; &nbsp;&nbsp;
<x-tooltip id="tooltip-item-price" placement="top" message="{{ trans('documents.item_price_hidden', ['type' => config('type.document.' . $type . '.translation.prefix')]) }}"> <x-tooltip id="tooltip-item-price" placement="top" message="{{ trans('documents.item_price_hidden', ['type' => config('type.document.' . $type . '.translation.prefix')]) }}">
<x-icon icon="visibility_off" class="text-sm font-normal"></x-icon> <x-icon icon="visibility_off" class="text-sm font-normal"></x-icon>
</x-tooltip> </x-tooltip>
@endif @endif
@endif
</th> </th>
@stack('price_th_end') @stack('price_th_end')
@ -76,6 +99,13 @@
<th class="px-3 py-1 ltr:text-right rtl:text-left text-xs font-normal border-t-0 border-b-0 item-total" style="vertical-align:bottom;"> <th class="px-3 py-1 ltr:text-right rtl:text-left text-xs font-normal border-t-0 border-b-0 item-total" style="vertical-align:bottom;">
@if (! $hideItemAmount) @if (! $hideItemAmount)
{{ trans($textItemAmount) }} {{ trans($textItemAmount) }}
@if ($hideSettingItemAmount)
&nbsp;&nbsp;
<x-tooltip id="tooltip-item-price" placement="top" message="{{ trans('documents.item_price_hidden', ['type' => config('type.document.' . $type . '.translation.prefix')]) }}">
<x-icon icon="visibility_off" class="text-sm font-normal"></x-icon>
</x-tooltip>
@endif
@endif @endif
</th> </th>