fixed sub category issues

This commit is contained in:
Denis Duliçi
2022-07-21 11:46:18 +03:00
parent e5a68d8450
commit b93a5fcd49
10 changed files with 149 additions and 121 deletions

View File

@ -17,6 +17,7 @@ use App\Models\Setting\Category;
use App\Traits\Charts;
use App\Traits\DateTime;
use App\Traits\SearchString;
use App\Traits\Tailwind;
use App\Traits\Translations;
use App\Utilities\Date;
use App\Utilities\Export as ExportHelper;
@ -24,7 +25,7 @@ use Illuminate\Support\Str;
abstract class Report
{
use Charts, DateTime, SearchString, Translations;
use Charts, DateTime, SearchString, Tailwind, Translations;
public $model;
@ -235,7 +236,9 @@ abstract class Report
foreach ($tmp_values as $id => $value) {
$labels[$id] = $this->row_names[$table_key][$id];
$colors[$id] = ($group == 'category') ? Category::find($id)?->color : '#' . dechex(rand(0x000000, 0xFFFFFF));
$color = ($group == 'category') ? Category::withSubCategory()->find($id)?->color : '#' . dechex(rand(0x000000, 0xFFFFFF));
$colors[$id] = $this->getHexCodeOfTailwindClass($color);
$values[$id] = round(($value * 100 / $total), 0);
}

View File

@ -5,6 +5,7 @@ namespace App\Abstracts\View\Components\Documents;
use App\Traits\DateTime;
use App\Traits\Documents;
use App\Models\Common\Media;
use App\Traits\Tailwind;
use App\Traits\ViewComponents;
use App\Abstracts\View\Component;
use Illuminate\Support\Facades\Log;
@ -17,7 +18,7 @@ use Image;
abstract class Show extends Component
{
use DateTime, Documents, ViewComponents;
use DateTime, Documents, Tailwind, ViewComponents;
public const OBJECT_TYPE = 'document';
public const DEFAULT_TYPE = 'invoice';
@ -337,8 +338,8 @@ abstract class Show extends Component
bool $hideDivider1 = false, bool $hideDivider2 = false, bool $hideDivider3 = false, bool $hideDivider4 = false,
string $accordionActive = '',
bool $hideRecurringMessage = false, string $textRecurringType = '', bool $hideStatusMessage = false, string $textStatusMessage = '',
bool $hideCreated = false, bool $hideSend = false, bool $hideMarkSent = false, string $markSentRoute = '', string $textMarkSent = '',
bool $hideReceive = false, bool $hideMarkReceived = false, string $markReceivedRoute = '', string $textMarkReceived = '',
bool $hideCreated = false, bool $hideSend = false, bool $hideMarkSent = false, string $markSentRoute = '', string $textMarkSent = '',
bool $hideReceive = false, bool $hideMarkReceived = false, string $markReceivedRoute = '', string $textMarkReceived = '',
bool $hideGetPaid = false,
bool $hideRestore = false, bool $hideAddPayment = false, bool $hideAcceptPayment = false, string $transactionEmailRoute = '', string $transactionEmailTemplate = '',
bool $hideMakePayment = false,
@ -464,7 +465,7 @@ abstract class Show extends Component
$this->documentTemplate = $this->getDocumentTemplate($type, $documentTemplate);
$this->logo = $this->getLogo($logo);
$this->backgroundColor = $this->getBackgroundColor($type, $backgroundColor);
$this->hideFooter = $hideFooter;
$this->hideCompanyLogo = $hideCompanyLogo;
$this->hideCompanyDetails = $hideCompanyDetails;
@ -988,7 +989,7 @@ abstract class Show extends Component
$backgroundColor = setting($this->getSettingKey($type, 'color'), '#55588b');
return $this->convertClasstoHex($backgroundColor);
return $this->getHexCodeOfTailwindClass($backgroundColor);
}
protected function getTextDocumentTitle($type, $textDocumentTitle)

View File

@ -6,6 +6,7 @@ use App\Abstracts\View\Component;
use App\Models\Common\Media;
use App\Traits\DateTime;
use App\Traits\Documents;
use App\Traits\Tailwind;
use App\Traits\ViewComponents;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\URL;
@ -17,7 +18,7 @@ use Image;
abstract class Template extends Component
{
use DateTime, Documents, ViewComponents;
use DateTime, Documents, Tailwind, ViewComponents;
public const OBJECT_TYPE = 'document';
public const DEFAULT_TYPE = 'invoice';
@ -276,7 +277,7 @@ abstract class Template extends Component
$backgroundColor = setting($this->getSettingKey($type, 'color'), '#55588b');
return $this->convertClasstoHex($backgroundColor);
return $this->getHexCodeOfTailwindClass($backgroundColor);
}
protected function getTextDocumentTitle($type, $textDocumentTitle)