updated widgets
This commit is contained in:
@ -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'])
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
|
Reference in New Issue
Block a user