Merge branch 'master' into title-subheading

This commit is contained in:
Cüneyt Şentürk
2023-07-19 14:43:19 +03:00
committed by GitHub
628 changed files with 65799 additions and 80258 deletions

View File

@ -11,7 +11,6 @@ use App\Abstracts\View\Component;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Intervention\Image\Exception\NotReadableException;
use Image;
@ -742,9 +741,7 @@ abstract class Show extends Component
return $textRecurringType;
}
$default_key = config('type.' . static::OBJECT_TYPE . '.' . $type . '.translation.prefix');
$translation = $this->getTextFromConfig($type, 'recurring_tye', $default_key);
$translation = config('type.' . static::OBJECT_TYPE . '.' . $type . '.translation.tab_document');
if (! empty($translation)) {
return $translation;
@ -910,7 +907,7 @@ abstract class Show extends Component
return $template;
}
$documentTemplate = setting($this->getSettingKey($type, 'template'), 'default');
$documentTemplate = setting($this->getDocumentSettingKey($type, 'template'), 'default');
return $documentTemplate;
}
@ -928,7 +925,7 @@ abstract class Show extends Component
if (! empty($media)) {
$path = $media->getDiskPath();
if (Storage::missing($path)) {
if (! $media->fileExists()) {
return $logo;
}
} else {
@ -941,7 +938,7 @@ abstract class Show extends Component
$height = setting('invoice.logo_size_height');
if ($media) {
$image->make(Storage::get($path))->resize($width, $height)->encode();
$image->make($media->contents())->resize($width, $height)->encode();
} else {
$image->make($path)->resize($width, $height)->encode();
}
@ -975,21 +972,28 @@ abstract class Show extends Component
return $backgroundColor;
}
if ($background_color = config('type.' . static::OBJECT_TYPE . '.' . $type . '.color', false)) {
return $background_color;
// checking setting color
$key = $this->getDocumentSettingKey($type, 'color');
if (! empty(setting($key))) {
$backgroundColor = setting($key);
}
if (! empty($alias = config('type.' . static::OBJECT_TYPE . '.' . $type . '.alias'))) {
$type = $alias . '.' . str_replace('-', '_', $type);
// checking config color
if (empty($backgroundColor) && $background_color = config('type.document.' . $type . '.color', false)) {
$backgroundColor = $background_color;
}
$backgroundColor = setting($this->getSettingKey($type, 'color'), '#55588b');
// set default color
if (empty($backgroundColor)) {
$backgroundColor = '#55588b';
}
return $this->getHexCodeOfTailwindClass($backgroundColor);
}
protected function getTextDocumentTitle($type, $textDocumentTitle)
{
{
if (! empty($textDocumentTitle)) {
return $textDocumentTitle;
}
@ -998,7 +1002,7 @@ abstract class Show extends Component
return $this->document->title;
}
$key = $this->getSettingKey($type, 'title');
$key = $this->getDocumentSettingKey($type, 'title');
if (! empty(setting($key))) {
return setting($key);
@ -1023,7 +1027,7 @@ abstract class Show extends Component
return $this->document->subheading;
}
$key = $this->getSettingKey($type, 'subheading');
$key = $this->getDocumentSettingKey($type, 'subheading');
if (!empty(setting($key))) {
return setting($key);
@ -1153,8 +1157,8 @@ abstract class Show extends Component
}
// if you use settting translation
if (setting($this->getSettingKey($type, 'item_name'), 'items') == 'custom') {
if (empty($textItems = setting($this->getSettingKey($type, 'item_name_input')))) {
if (setting($this->getDocumentSettingKey($type, 'item_name'), 'items') == 'custom') {
if (empty($textItems = setting($this->getDocumentSettingKey($type, 'item_name_input')))) {
$textItems = 'general.items';
}
@ -1177,8 +1181,8 @@ abstract class Show extends Component
}
// if you use settting translation
if (setting($this->getSettingKey($type, 'quantity_name'), 'quantity') === 'custom') {
if (empty($textQuantity = setting($this->getSettingKey($type, 'quantity_name_input')))) {
if (setting($this->getDocumentSettingKey($type, 'quantity_name'), 'quantity') === 'custom') {
if (empty($textQuantity = setting($this->getDocumentSettingKey($type, 'quantity_name_input')))) {
$textQuantity = 'invoices.quantity';
}
@ -1201,8 +1205,8 @@ abstract class Show extends Component
}
// if you use settting translation
if (setting($this->getSettingKey($type, 'price_name'), 'price') === 'custom') {
if (empty($textPrice = setting($this->getSettingKey($type, 'price_name_input')))) {
if (setting($this->getDocumentSettingKey($type, 'price_name'), 'price') === 'custom') {
if (empty($textPrice = setting($this->getDocumentSettingKey($type, 'price_name_input')))) {
$textPrice = 'invoices.price';
}
@ -1256,9 +1260,11 @@ abstract class Show extends Component
return $hideName;
}
$hideName = setting($this->getDocumentSettingKey($type, 'item_name'), false);
// if you use settting translation
if ($hideName = setting($this->getSettingKey($type, 'item_name'), false) && $hideName == 'hide') {
return $hideName;
if ($hideName === 'hide') {
return true;
}
$hide = $this->getHideFromConfig($type, 'name');
@ -1267,8 +1273,7 @@ abstract class Show extends Component
return $hide;
}
// @todo what return value invoice or always false??
return setting('invoice.item_name', $hideName) == 'hide' ? true : false;
return false;
}
protected function getHideDescription($type, $hideDescription)
@ -1278,8 +1283,8 @@ abstract class Show extends Component
}
// if you use settting translation
if ($hideDescription = setting($this->getSettingKey($type, 'hide_item_description'), false)) {
return $hideDescription;
if (setting($this->getDocumentSettingKey($type, 'hide_item_description'), false)) {
return true;
}
$hide = $this->getHideFromConfig($type, 'description');
@ -1288,8 +1293,7 @@ abstract class Show extends Component
return $hide;
}
// @todo what return value invoice or always false??
return setting('invoice.hide_item_description', $hideDescription);
return false;
}
protected function getHideQuantity($type, $hideQuantity)
@ -1298,9 +1302,11 @@ abstract class Show extends Component
return $hideQuantity;
}
$hideQuantity = setting($this->getDocumentSettingKey($type, 'quantity_name'), false);
// if you use settting translation
if ($hideQuantity = setting($this->getSettingKey($type, 'hide_quantity'), false) && $hideQuantity == 'hide') {
return $hideQuantity;
if ($hideQuantity === 'hide') {
return true;
}
$hide = $this->getHideFromConfig($type, 'quantity');
@ -1309,8 +1315,7 @@ abstract class Show extends Component
return $hide;
}
// @todo what return value invoice or always false??
return setting('invoice.quantity_name', $hideQuantity) == 'hide' ? true : false;
return false;
}
protected function getHidePrice($type, $hidePrice)
@ -1319,9 +1324,11 @@ abstract class Show extends Component
return $hidePrice;
}
$hidePrice = setting($this->getDocumentSettingKey($type, 'price_name'), false);
// if you use settting translation
if ($hidePrice = setting($this->getSettingKey($type, 'hide_price'), false) && $hidePrice == 'hide') {
return $hidePrice;
if ($hidePrice === 'hide') {
return true;
}
$hide = $this->getHideFromConfig($type, 'price');
@ -1330,8 +1337,7 @@ abstract class Show extends Component
return $hide;
}
// @todo what return value invoice or always false??
return setting('invoice.price_name', $hidePrice) == 'hide' ? true : false;
return false;
}
protected function getHideDiscount($type, $hideDiscount)
@ -1341,7 +1347,7 @@ abstract class Show extends Component
}
// if you use settting translation
if ($hideDiscount = setting($this->getSettingKey($type, 'hide_discount'), false)) {
if ($hideDiscount = setting($this->getDocumentSettingKey($type, 'hide_discount'), false)) {
return $hideDiscount;
}
@ -1362,8 +1368,8 @@ abstract class Show extends Component
}
// if you use settting translation
if ($hideAmount = setting($this->getSettingKey($type, 'hide_amount'), false)) {
return $hideAmount;
if (setting($this->getDocumentSettingKey($type, 'hide_amount'), false)) {
return true;
}
$hide = $this->getHideFromConfig($type, 'amount');
@ -1372,7 +1378,6 @@ abstract class Show extends Component
return $hide;
}
// @todo what return value invoice or always false??
return setting('invoice.hide_amount', $hideAmount);
return false;
}
}