updated widgets

This commit is contained in:
denisdulici
2020-01-16 00:42:20 +03:00
parent 546cff476d
commit 0430dc5f36
20 changed files with 79 additions and 128 deletions

View File

@ -2,7 +2,6 @@
namespace App\Abstracts;
use App\Models\Sale\Invoice;
use App\Traits\Charts;
use Date;
@ -12,21 +11,39 @@ abstract class Widget
public $model;
public $default_name = '';
public $default_settings = [
'width' => 'col-md-4',
];
public $views = [
'header' => 'partials.widgets.standard_header',
];
public function __construct($model = null)
{
$this->model = $model;
}
public function getDefaultName()
{
return trans($this->default_name);
}
public function getDefaultSettings()
{
return [
'width' => 'col-md-4',
];
return $this->default_settings;
}
public function getViews()
{
return $this->views;
}
public function view($name, $data = [])
{
return view($name, array_merge(['model' => $this->model], (array) $data));
return view($name, array_merge(['class' => $this], (array) $data));
}
public function applyFilters($model, $args = ['date_field' => 'paid_at'])

View File

@ -7,17 +7,7 @@ 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 $default_name = 'widgets.account_balance';
public function show()
{

View File

@ -13,17 +13,11 @@ class CashFlow extends Widget
{
use Currencies, DateTime;
public function getDefaultName()
{
return trans('widgets.cash_flow');
}
public $default_name = 'widgets.cash_flow';
public function getDefaultSettings()
{
return [
'width' => 'col-md-12',
];
}
public $default_settings = [
'width' => 'col-md-12',
];
public function show()
{

View File

@ -7,17 +7,11 @@ use App\Models\Setting\Category;
class ExpensesByCategory extends Widget
{
public function getDefaultName()
{
return trans('widgets.expenses_by_category');
}
public $default_name = 'widgets.expenses_by_category';
public function getDefaultSettings()
{
return [
'width' => 'col-md-6',
];
}
public $default_settings = [
'width' => 'col-md-6',
];
public function show()
{

View File

@ -7,17 +7,11 @@ use App\Models\Setting\Category;
class IncomeByCategory extends Widget
{
public function getDefaultName()
{
return trans('widgets.income_by_category');
}
public $default_name = 'widgets.income_by_category';
public function getDefaultSettings()
{
return [
'width' => 'col-md-6',
];
}
public $default_settings = [
'width' => 'col-md-6',
];
public function show()
{

View File

@ -7,17 +7,7 @@ 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 $default_name = 'widgets.latest_expenses';
public function show()
{

View File

@ -7,17 +7,7 @@ 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 $default_name = 'widgets.latest_income';
public function show()
{

View File

@ -8,17 +8,11 @@ use App\Models\Purchase\Bill;
class TotalExpenses extends Widget
{
public function getDefaultName()
{
return trans('widgets.total_expenses');
}
public $default_name = 'widgets.total_expenses';
public function getDefaultSettings()
{
return [
'width' => 'col-md-4',
];
}
public $views = [
'header' => 'partials.widgets.stats_header',
];
public function show()
{

View File

@ -8,17 +8,11 @@ use App\Models\Sale\Invoice;
class TotalIncome extends Widget
{
public function getDefaultName()
{
return trans('widgets.total_income');
}
public $default_name = 'widgets.total_income';
public function getDefaultSettings()
{
return [
'width' => 'col-md-4',
];
}
public $views = [
'header' => 'partials.widgets.stats_header',
];
public function show()
{

View File

@ -9,17 +9,11 @@ use App\Models\Sale\Invoice;
class TotalProfit extends Widget
{
public function getDefaultName()
{
return trans('widgets.total_profit');
}
public $default_name = 'widgets.total_profit';
public function getDefaultSettings()
{
return [
'width' => 'col-md-4',
];
}
public $views = [
'header' => 'partials.widgets.stats_header',
];
public function show()
{