diff --git a/app/Widgets/AccountBalance.php b/app/Widgets/AccountBalance.php index ec7095723..41a6978bb 100644 --- a/app/Widgets/AccountBalance.php +++ b/app/Widgets/AccountBalance.php @@ -7,6 +7,18 @@ use App\Models\Banking\Account; class AccountBalance extends Widget { + public function getDefaultName() + { + return trans('widgets.account_balance'); + } + + public function getDefaultSettings() + { + return [ + 'width' => 'col-md-4', + ]; + } + public function show() { $accounts = Account::enabled()->take(5)->get(); @@ -15,9 +27,4 @@ class AccountBalance extends Widget 'accounts' => $accounts, ]); } - - public function getDefaultName() - { - return trans('widgets.account_balance'); - } } diff --git a/app/Widgets/CashFlow.php b/app/Widgets/CashFlow.php index 824e8cbeb..612b11a9f 100644 --- a/app/Widgets/CashFlow.php +++ b/app/Widgets/CashFlow.php @@ -13,6 +13,18 @@ class CashFlow extends Widget { use Currencies, DateTime; + public function getDefaultName() + { + return trans('widgets.cash_flow'); + } + + public function getDefaultSettings() + { + return [ + 'width' => 'col-md-12', + ]; + } + public function show() { $financial_start = $this->getFinancialStart()->format('Y-m-d'); @@ -170,16 +182,4 @@ class CashFlow extends Widget return $profit; } - - public function getDefaultName() - { - return trans('widgets.cash_flow'); - } - - public function getDefaultSettings() - { - return [ - 'width' => 'col-md-12', - ]; - } } diff --git a/app/Widgets/ExpensesByCategory.php b/app/Widgets/ExpensesByCategory.php index b138f7d00..76d916a77 100644 --- a/app/Widgets/ExpensesByCategory.php +++ b/app/Widgets/ExpensesByCategory.php @@ -7,6 +7,18 @@ use App\Models\Setting\Category; class ExpensesByCategory extends Widget { + public function getDefaultName() + { + return trans('widgets.expenses_by_category'); + } + + public function getDefaultSettings() + { + return [ + 'width' => 'col-md-6', + ]; + } + public function show() { Category::with('expense_transactions')->type('expense')->enabled()->each(function ($category) { @@ -27,16 +39,4 @@ class ExpensesByCategory extends Widget 'chart' => $chart, ]); } - - public function getDefaultName() - { - return trans('widgets.expenses_by_category'); - } - - public function getDefaultSettings() - { - return [ - 'width' => 'col-md-6', - ]; - } } diff --git a/app/Widgets/IncomeByCategory.php b/app/Widgets/IncomeByCategory.php index fc9f536ac..23952184d 100644 --- a/app/Widgets/IncomeByCategory.php +++ b/app/Widgets/IncomeByCategory.php @@ -7,6 +7,18 @@ use App\Models\Setting\Category; class IncomeByCategory extends Widget { + public function getDefaultName() + { + return trans('widgets.income_by_category'); + } + + public function getDefaultSettings() + { + return [ + 'width' => 'col-md-6', + ]; + } + public function show() { Category::with('income_transacions')->type('income')->enabled()->each(function ($category) { @@ -27,16 +39,4 @@ class IncomeByCategory extends Widget 'chart' => $chart, ]); } - - public function getDefaultName() - { - return trans('widgets.income_by_category'); - } - - public function getDefaultSettings() - { - return [ - 'width' => 'col-md-6', - ]; - } } diff --git a/app/Widgets/LatestExpenses.php b/app/Widgets/LatestExpenses.php index 2996a3b78..6a48391e5 100644 --- a/app/Widgets/LatestExpenses.php +++ b/app/Widgets/LatestExpenses.php @@ -7,6 +7,18 @@ use App\Models\Banking\Transaction; class LatestExpenses extends Widget { + public function getDefaultName() + { + return trans('widgets.latest_expenses'); + } + + public function getDefaultSettings() + { + return [ + 'width' => 'col-md-4', + ]; + } + public function show() { $transactions = $this->applyFilters(Transaction::with('category')->type('expense')->orderBy('paid_at', 'desc')->isNotTransfer()->take(5))->get(); @@ -15,9 +27,4 @@ class LatestExpenses extends Widget 'transactions' => $transactions, ]); } - - public function getDefaultName() - { - return trans('widgets.latest_expenses'); - } } diff --git a/app/Widgets/LatestIncome.php b/app/Widgets/LatestIncome.php index 52121176b..933c325e1 100644 --- a/app/Widgets/LatestIncome.php +++ b/app/Widgets/LatestIncome.php @@ -7,6 +7,18 @@ use App\Models\Banking\Transaction; class LatestIncome extends Widget { + public function getDefaultName() + { + return trans('widgets.latest_income'); + } + + public function getDefaultSettings() + { + return [ + 'width' => 'col-md-4', + ]; + } + public function show() { $transactions = $this->applyFilters(Transaction::with('category')->type('income')->orderBy('paid_at', 'desc')->isNotTransfer()->take(5))->get(); @@ -15,9 +27,4 @@ class LatestIncome extends Widget 'transactions' => $transactions, ]); } - - public function getDefaultName() - { - return trans('widgets.latest_income'); - } } diff --git a/app/Widgets/TotalExpenses.php b/app/Widgets/TotalExpenses.php index a05b94ad7..7f633001b 100644 --- a/app/Widgets/TotalExpenses.php +++ b/app/Widgets/TotalExpenses.php @@ -8,6 +8,18 @@ use App\Models\Purchase\Bill; class TotalExpenses extends Widget { + public function getDefaultName() + { + return trans('widgets.total_expenses'); + } + + public function getDefaultSettings() + { + return [ + 'width' => 'col-md-4', + ]; + } + public function show() { $current = $open = $overdue = 0; @@ -40,9 +52,4 @@ class TotalExpenses extends Widget 'totals' => $totals, ]); } - - public function getDefaultName() - { - return trans('widgets.total_expenses'); - } } diff --git a/app/Widgets/TotalIncome.php b/app/Widgets/TotalIncome.php index 021d2592b..dc5e7c50d 100644 --- a/app/Widgets/TotalIncome.php +++ b/app/Widgets/TotalIncome.php @@ -8,6 +8,18 @@ use App\Models\Sale\Invoice; class TotalIncome extends Widget { + public function getDefaultName() + { + return trans('widgets.total_income'); + } + + public function getDefaultSettings() + { + return [ + 'width' => 'col-md-4', + ]; + } + public function show() { $current = $open = $overdue = 0; @@ -40,9 +52,4 @@ class TotalIncome extends Widget 'totals' => $totals, ]); } - - public function getDefaultName() - { - return trans('widgets.total_income'); - } } diff --git a/app/Widgets/TotalProfit.php b/app/Widgets/TotalProfit.php index 1123d660d..bae805d14 100644 --- a/app/Widgets/TotalProfit.php +++ b/app/Widgets/TotalProfit.php @@ -9,6 +9,18 @@ use App\Models\Sale\Invoice; class TotalProfit extends Widget { + public function getDefaultName() + { + return trans('widgets.total_profit'); + } + + public function getDefaultSettings() + { + return [ + 'width' => 'col-md-4', + ]; + } + public function show() { $current_income = $open_invoice = $overdue_invoice = 0; @@ -59,9 +71,4 @@ class TotalProfit extends Widget 'totals' => $totals, ]); } - - public function getDefaultName() - { - return trans('widgets.total_profit'); - } }