Bidashboard is a data visualization dashboard designed to provide insights into key metrics and data for business intelligence purposes. It allows users to monitor and analyze various aspects of their business in real-time through interactive charts and graphs.
This extension provides the Business Intelligence Dashboard for the Yii framework 2.0.
For license information check the LICENSE-file.
The preferred way to install this extension is through composer:
composer require --prefer-dist sadi01/yii2-bi-dashboard:"*"
If you prefer adding the bidashboard extension to your composer.json
file manually, you can do so by adding the
following entry to the require
section:
{
"require": {
"sadi01/yii2-bi-dashboard": "*"
}
}
After adding the entry, save the composer.json
file and run the following command in the terminal or command prompt
within your project directory:
composer update
This command will fetch and install the bidashboard extension and its required dependencies into your Yii 2 project.
To use this extension, you have to configure the bidashboard module in your application configuration:
return [
//....
'modules' => [
'bidashboard' => [
'class' => 'sadi01\bidashboard\Module',
],
]
];
You have to add the database configuration to env, its example is in - Env.example
Run module migrations:
php yii migrate --migrationPath=@sadi01/bidashboard/migrations
Or, Add migrations path in console application config:
'controllerMap' => [
'migrate' => [
'class' => 'yii\console\controllers\MigrateController',
'migrationNamespaces' => [],
'migrationPath' => [
'@vendor/sadi01/yii2-bi-dashboard/src/migrations',
'@app/migrations'
]
],
],
add to view model:
use sadi01\bidashboard\widgets\ReportModalWidget;
<?= ReportModalWidget::widget([
'queryParams' => $queryParams,
'searchModel' => $searchModel,
'searchModelMethod' => $searchWidget,
'searchModelRunResultView' => $searchModelRunResultView,
'searchRoute' => Yii::$app->request->pathInfo,
'searchModelFormName' => $searchModelFormName,
'outputColumn' => $outputColumn,
]) ?>
add to search model:
public function searchWidget(array $params,int $rangeType,int $startRange,int $endRange)
{
$query = Invoice::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params, '');
$query->andFilterWhere(['between', 'created_at', $startRange, $endRange]);
if ($rangeType == ReportWidget::RANGE_TYPE_MONTHLY) {
...
}
elseif ($rangeType == ReportWidget::RANGE_TYPE_DAILY) {
...
}
return $dataProvider;
}