changed positions

This commit is contained in:
denisdulici 2020-01-10 17:49:31 +03:00
parent 134bed0cc6
commit b5519004a0
9 changed files with 108 additions and 66 deletions

View File

@ -7,6 +7,18 @@ use App\Models\Banking\Account;
class AccountBalance extends Widget class AccountBalance extends Widget
{ {
public function getDefaultName()
{
return trans('widgets.account_balance');
}
public function getDefaultSettings()
{
return [
'width' => 'col-md-4',
];
}
public function show() public function show()
{ {
$accounts = Account::enabled()->take(5)->get(); $accounts = Account::enabled()->take(5)->get();
@ -15,9 +27,4 @@ class AccountBalance extends Widget
'accounts' => $accounts, 'accounts' => $accounts,
]); ]);
} }
public function getDefaultName()
{
return trans('widgets.account_balance');
}
} }

View File

@ -13,6 +13,18 @@ class CashFlow extends Widget
{ {
use Currencies, DateTime; use Currencies, DateTime;
public function getDefaultName()
{
return trans('widgets.cash_flow');
}
public function getDefaultSettings()
{
return [
'width' => 'col-md-12',
];
}
public function show() public function show()
{ {
$financial_start = $this->getFinancialStart()->format('Y-m-d'); $financial_start = $this->getFinancialStart()->format('Y-m-d');
@ -170,16 +182,4 @@ class CashFlow extends Widget
return $profit; return $profit;
} }
public function getDefaultName()
{
return trans('widgets.cash_flow');
}
public function getDefaultSettings()
{
return [
'width' => 'col-md-12',
];
}
} }

View File

@ -7,6 +7,18 @@ use App\Models\Setting\Category;
class ExpensesByCategory extends Widget class ExpensesByCategory extends Widget
{ {
public function getDefaultName()
{
return trans('widgets.expenses_by_category');
}
public function getDefaultSettings()
{
return [
'width' => 'col-md-6',
];
}
public function show() public function show()
{ {
Category::with('expense_transactions')->type('expense')->enabled()->each(function ($category) { Category::with('expense_transactions')->type('expense')->enabled()->each(function ($category) {
@ -27,16 +39,4 @@ class ExpensesByCategory extends Widget
'chart' => $chart, 'chart' => $chart,
]); ]);
} }
public function getDefaultName()
{
return trans('widgets.expenses_by_category');
}
public function getDefaultSettings()
{
return [
'width' => 'col-md-6',
];
}
} }

View File

@ -7,6 +7,18 @@ use App\Models\Setting\Category;
class IncomeByCategory extends Widget class IncomeByCategory extends Widget
{ {
public function getDefaultName()
{
return trans('widgets.income_by_category');
}
public function getDefaultSettings()
{
return [
'width' => 'col-md-6',
];
}
public function show() public function show()
{ {
Category::with('income_transacions')->type('income')->enabled()->each(function ($category) { Category::with('income_transacions')->type('income')->enabled()->each(function ($category) {
@ -27,16 +39,4 @@ class IncomeByCategory extends Widget
'chart' => $chart, 'chart' => $chart,
]); ]);
} }
public function getDefaultName()
{
return trans('widgets.income_by_category');
}
public function getDefaultSettings()
{
return [
'width' => 'col-md-6',
];
}
} }

View File

@ -7,6 +7,18 @@ use App\Models\Banking\Transaction;
class LatestExpenses extends Widget class LatestExpenses extends Widget
{ {
public function getDefaultName()
{
return trans('widgets.latest_expenses');
}
public function getDefaultSettings()
{
return [
'width' => 'col-md-4',
];
}
public function show() public function show()
{ {
$transactions = $this->applyFilters(Transaction::with('category')->type('expense')->orderBy('paid_at', 'desc')->isNotTransfer()->take(5))->get(); $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, 'transactions' => $transactions,
]); ]);
} }
public function getDefaultName()
{
return trans('widgets.latest_expenses');
}
} }

View File

@ -7,6 +7,18 @@ use App\Models\Banking\Transaction;
class LatestIncome extends Widget class LatestIncome extends Widget
{ {
public function getDefaultName()
{
return trans('widgets.latest_income');
}
public function getDefaultSettings()
{
return [
'width' => 'col-md-4',
];
}
public function show() public function show()
{ {
$transactions = $this->applyFilters(Transaction::with('category')->type('income')->orderBy('paid_at', 'desc')->isNotTransfer()->take(5))->get(); $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, 'transactions' => $transactions,
]); ]);
} }
public function getDefaultName()
{
return trans('widgets.latest_income');
}
} }

View File

@ -8,6 +8,18 @@ use App\Models\Purchase\Bill;
class TotalExpenses extends Widget class TotalExpenses extends Widget
{ {
public function getDefaultName()
{
return trans('widgets.total_expenses');
}
public function getDefaultSettings()
{
return [
'width' => 'col-md-4',
];
}
public function show() public function show()
{ {
$current = $open = $overdue = 0; $current = $open = $overdue = 0;
@ -40,9 +52,4 @@ class TotalExpenses extends Widget
'totals' => $totals, 'totals' => $totals,
]); ]);
} }
public function getDefaultName()
{
return trans('widgets.total_expenses');
}
} }

View File

@ -8,6 +8,18 @@ use App\Models\Sale\Invoice;
class TotalIncome extends Widget class TotalIncome extends Widget
{ {
public function getDefaultName()
{
return trans('widgets.total_income');
}
public function getDefaultSettings()
{
return [
'width' => 'col-md-4',
];
}
public function show() public function show()
{ {
$current = $open = $overdue = 0; $current = $open = $overdue = 0;
@ -40,9 +52,4 @@ class TotalIncome extends Widget
'totals' => $totals, 'totals' => $totals,
]); ]);
} }
public function getDefaultName()
{
return trans('widgets.total_income');
}
} }

View File

@ -9,6 +9,18 @@ use App\Models\Sale\Invoice;
class TotalProfit extends Widget class TotalProfit extends Widget
{ {
public function getDefaultName()
{
return trans('widgets.total_profit');
}
public function getDefaultSettings()
{
return [
'width' => 'col-md-4',
];
}
public function show() public function show()
{ {
$current_income = $open_invoice = $overdue_invoice = 0; $current_income = $open_invoice = $overdue_invoice = 0;
@ -59,9 +71,4 @@ class TotalProfit extends Widget
'totals' => $totals, 'totals' => $totals,
]); ]);
} }
public function getDefaultName()
{
return trans('widgets.total_profit');
}
} }