Add dynamic category type for modules..

This commit is contained in:
Cüneyt Şentürk
2021-01-11 16:18:17 +03:00
parent 7bdbaa973c
commit 381ce21f25
6 changed files with 59 additions and 31 deletions

View File

@ -14,7 +14,7 @@ class Advanced extends Component
*/
public function render()
{
$category_type = $this->getCategoryType();
$category_type = $this->categoryType;
if ($category_type) {
$categories = Category::$category_type()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
@ -24,31 +24,4 @@ class Advanced extends Component
return view('components.documents.form.advanced', compact('categories', 'category_type'));
}
protected function getCategoryType()
{
$type = '';
switch ($this->type) {
case 'bill':
case 'expense':
case 'purchase':
$type = 'expense';
break;
case 'item':
$type = 'item';
break;
case 'other':
$type = 'other';
break;
case 'transfer':
$type = 'transfer';
break;
default:
$type = 'income';
break;
}
return $type;
}
}