diff --git a/app/Abstracts/View/Components/Documents/Show.php b/app/Abstracts/View/Components/Documents/Show.php index 26d642703..672958ec4 100644 --- a/app/Abstracts/View/Components/Documents/Show.php +++ b/app/Abstracts/View/Components/Documents/Show.php @@ -975,7 +975,7 @@ abstract class Show extends Component $backgroundColor = setting($this->getSettingKey($type, 'color'), '#55588b'); - return $backgroundColor; + return $this->convertClasstoHex($backgroundColor); } protected function getTextDocumentTitle($type, $textDocumentTitle) diff --git a/app/Abstracts/View/Components/Documents/Template.php b/app/Abstracts/View/Components/Documents/Template.php index 2934fb50b..317805d01 100644 --- a/app/Abstracts/View/Components/Documents/Template.php +++ b/app/Abstracts/View/Components/Documents/Template.php @@ -276,7 +276,7 @@ abstract class Template extends Component $backgroundColor = setting($this->getSettingKey($type, 'color'), '#55588b'); - return $backgroundColor; + return $this->convertClasstoHex($backgroundColor); } protected function getTextDocumentTitle($type, $textDocumentTitle) diff --git a/app/Traits/Translations.php b/app/Traits/Translations.php index 3b557d2b1..7efaa59ff 100644 --- a/app/Traits/Translations.php +++ b/app/Traits/Translations.php @@ -3,11 +3,14 @@ namespace App\Traits; use Throwable; +use Illuminate\Support\Arr; trait Translations { public function findTranslation($keys, $number = 2) { + $keys = Arr::wrap($keys); + try { foreach ($keys as $key) { if (is_array($key)) { diff --git a/app/Traits/ViewComponents.php b/app/Traits/ViewComponents.php index 5c0224520..27e440a88 100644 --- a/app/Traits/ViewComponents.php +++ b/app/Traits/ViewComponents.php @@ -752,4 +752,111 @@ trait ViewComponents return ''; } + + protected function convertClasstoHex($class) + { + $colors = [ + 'gray' => '#6b7280', + 'gray-50' => '#f9fafb', + 'gray-100' => '#f3f4f6', + 'gray-200' => '#e5e7eb', + 'gray-300' => '#d1d5db', + 'gray-400' => '#9ca3af', + 'gray-500' => '#6b7280', + 'gray-600' => '#4b5563', + 'gray-700' => '#374151', + 'gray-800' => '#1f2937', + 'gray-900' => '#111827', + + 'red' => '#cc0000', + 'red-50' => '#fcf2f2', + 'red-100' => '#fae6e6', + 'red-200' => '#f2bfbf', + 'red-300' => '#eb9999', + 'red-400' => '#db4d4d', + 'red-500' => '#cc0000', + 'red-600' => '#b80000', + 'red-700' => '#990000', + 'red-800' => '#7a0000', + 'red-900' => '#640000', + + 'yellow' => '#eab308', + 'yellow-50' => '#fefce8', + 'yellow-100' => '#fef9c3', + 'yellow-200' => '#fef08a', + 'yellow-300' => '#fde047', + 'yellow-400' => '#facc15', + 'yellow-500' => '#eab308', + 'yellow-600' => '#ca8a04', + 'yellow-700' => '#a16207', + 'yellow-800' => '#854d0e', + 'yellow-900' => '#713f12', + + 'green' => '#6ea152', + 'green-50' => '#f8faf6', + 'green-100' => '#f1f6ee', + 'green-200' => '#dbe8d4', + 'green-300' => '#c5d9ba', + 'green-400' => '#9abd86', + 'green-500' => '#6ea152', + 'green-600' => '#63914a', + 'green-700' => '#53793e', + 'green-800' => '#426131', + 'green-900' => '#364f28', + + 'blue' => '#006ea6', + 'blue-50' => '#f2f8fb', + 'blue-100' => '#e6f1f6', + 'blue-200' => '#bfdbe9', + 'blue-300' => '#99c5db', + 'blue-400' => '#4d9ac1', + 'blue-500' => '#006ea6', + 'blue-600' => '#006395', + 'blue-700' => '#00537d', + 'blue-800' => '#004264', + 'blue-900' => '#003651', + + 'indigo' => '#6366f1', + 'indigo-50' => '#eef2ff', + 'indigo-100' => '#e0e7ff', + 'indigo-200' => '#c7d2fe', + 'indigo-300' => '#a5b4fc', + 'indigo-400' => '#818cf8', + 'indigo-500' => '#6366f1', + 'indigo-600' => '#4f46e5', + 'indigo-700' => '#4338ca', + 'indigo-800' => '#3730a3', + 'indigo-900' => '#312e81', + + 'purple' => '#55588b', + 'purple-50' => '#f7f7f9', + 'purple-100' => '#eeeef3', + 'purple-200' => '#d5d5e2', + 'purple-300' => '#bbbcd1', + 'purple-400' => '#888aae', + 'purple-500' => '#55588b', + 'purple-600' => '#4d4f7d', + 'purple-700' => '#404268', + 'purple-800' => '#333553', + 'purple-900' => '#2a2b44', + + 'pink' => '#ec4899', + 'pink-50' => '#fdf2f8', + 'pink-100' => '#fce7f3', + 'pink-200' => '#fbcfe8', + 'pink-300' => '#f9a8d4', + 'pink-400' => '#f472b6', + 'pink-500' => '#ec4899', + 'pink-600' => '#db2777', + 'pink-700' => '#be185d', + 'pink-800' => '#9d174d', + 'pink-900' => '#831843', + ]; + + if (Arr::exists($colors, $class)) { + return $colors[$class]; + } + + return $class; + } } diff --git a/app/View/Components/SearchString.php b/app/View/Components/SearchString.php index c24479f34..ae524cb70 100644 --- a/app/View/Components/SearchString.php +++ b/app/View/Components/SearchString.php @@ -4,11 +4,12 @@ namespace App\View\Components; use App\Abstracts\View\Component; use App\Traits\DateTime; +use App\Traits\Translations; use Illuminate\Support\Str; class SearchString extends Component { - use DateTime; + use DateTime, Translations; public $filters; @@ -203,16 +204,16 @@ class SearchString extends Component $values = [ [ 'key' => 0, - 'value' => empty($options['translation']) ? trans('general.no') : trans($options['translation'][0]), + 'value' => empty($options['translation']) ? trans('general.no') : $this->findTranslation($options['translation'][0], 1), ], [ 'key' => 1, - 'value' => empty($options['translation']) ? trans('general.yes') : trans($options['translation'][1]), + 'value' => empty($options['translation']) ? trans('general.yes') : $this->findTranslation($options['translation'][1], 1), ], ]; } else if (isset($options['values'])) { foreach ($options['values'] as $key => $value) { - $values[$key] = trans($value); + $values[$key] = $this->findTranslation($value, 1); } } else if ($search = request()->get('search', false)) { $fields = explode(' ', $search); diff --git a/config/setting.php b/config/setting.php index e234fa46f..e94112ad7 100644 --- a/config/setting.php +++ b/config/setting.php @@ -119,7 +119,7 @@ return [ 'hide_amount' => env('SETTING_FALLBACK_INVOICE_HIDE_AMOUNT', false), 'payment_terms' => env('SETTING_FALLBACK_INVOICE_PAYMENT_TERMS', '0'), 'template' => env('SETTING_FALLBACK_INVOICE_TEMPLATE', 'default'), - 'color' => env('SETTING_FALLBACK_INVOICE_COLOR', '#55588b'), + 'color' => env('SETTING_FALLBACK_INVOICE_COLOR', 'purple-500'), 'logo_size_width' => env('SETTING_FALLBACK_INVOICE_LOGO_SIZE_WIDTH', 128), 'logo_size_height' => env('SETTING_FALLBACK_INVOICE_LOGO_SIZE_HEIGHT', 128), 'item_search_char_limit' => env('SETTING_FALLBACK_INVOICE_ITEM_SEARCH_CHAR_LIMIT', 3), @@ -138,7 +138,7 @@ return [ 'quantity_name' => env('SETTING_FALLBACK_BILL_QUANTITY_NAME', 'settings.invoice.quantity'), 'payment_terms' => env('SETTING_FALLBACK_BILL_PAYMENT_TERMS', '0'), 'template' => env('SETTING_FALLBACK_BILL_TEMPLATE', 'default'), - 'color' => env('SETTING_FALLBACK_BILL_COLOR', '#55588b'), + 'color' => env('SETTING_FALLBACK_BILL_COLOR', 'purple-500'), 'item_search_char_limit' => env('SETTING_FALLBACK_BILL_ITEM_SEARCH_CHAR_LIMIT', 3), ], 'bill-recurring' => [ diff --git a/resources/views/components/documents/template/default.blade.php b/resources/views/components/documents/template/default.blade.php index 67a42d9c5..ebdd281eb 100644 --- a/resources/views/components/documents/template/default.blade.php +++ b/resources/views/components/documents/template/default.blade.php @@ -196,7 +196,7 @@
- {{ trans($textContentTitle) }} + {{ $textContentTitle != trans_choice($textContentTitle, 1) ? trans_choice($textContentTitle, 1) : trans($textContentTitle) }} |