Hi!
I'm using Dashboard. I would like to create a custom date range with the Date Range Picker :
First day of the current month to Today
So for example we are September 10th : From September 1st to September 10th
1 - Where to put the default Start date and end date?
2 - Where should i put my "custom date function" ?
My SalesDateRange.php looks like this :
<?php
use \koolreport\dashboard\inputs\DateRangePicker;
class SalesDateRange extends DateRangePicker
{
protected function onCreated()
{
$this->defaultValue($this::lastMonth());
}
protected function actionChange($request,$response)
{
//On client change, update table
$this->sibling("SalesByDate")->update();
$this->sibling("SalesTable")->update();
$this->sibling("SalesNetMetric")->update();
$this->sibling("SalesGrossMetric")->update();
$this->sibling("SalesAvgOrderMetric")->update();
$this->sibling("SalesNumOrderMetric")->update();
}
}
And my board:
<?php
use \koolreport\dashboard\Dashboard;
use \koolreport\dashboard\containers\Row;
use \koolreport\dashboard\containers\Panel;
use \koolreport\dashboard\widgets\Text;
use \koolreport\dashboard\containers\Html;
class SalesBoard extends Dashboard
{
protected function widgets()
{
return [
Row::create()->sub([
Row::create(),
SalesDateRange::create()->width(1/3),
]),
Row::create()->sub([
Panel::create()->sub([
SalesGrossMetric::create("SalesGrossMetric"),
])->width(1/4),
Panel::create()->sub([
SalesNetMetric::create("SalesNetMetric"),
])->width(1/4),
Panel::create()->sub([
SalesAvgOrderMetric::create("SalesAvgOrderMetric"),
])->width(1/4),
Panel::create()->sub([
SalesNumOrderMetric::create("SalesNumOrderMetric"),
])->width(1/4)
]),
Row::create()->sub([
Panel::create()->sub([
SalesByDate::create(),
])->width(1/1),
]),
Row::create([
Panel::create()->width(1/1)
->sub([ Html::h2("Daily Sales Details") ])
->cssClass("trans-row")
]),
SalesTable::create(),
];
}
}
Thank you very much for your help!