protected function widgets()
{
return [
Row::create([
Panel::create()->type("primary")->header("<b>Sales</b>")->sub([
Text::create()->text("<label><strong>DateRangePicker</strong></label>")->asHtml(true),
SaleDateRangePicker::create()
]),
Panel::create()->type("primary")->sub([
Result::create("Result"),
// RecievedParam::create('RecievedParam')
]),
]),
Row::create()->sub([
SaleCredit::create()->params([
"date" => Result::create("Result")
]),
SaleCash::create(),
SaleNet::create(),
]),
];
}
}
inside SaleCredit.php
protected $from_date;
protected $to_date;
protected function onInit()
{
// $value = json_encode($this->sibling('SaleDateRangePicker')->value());
$value = json_encode($this->params("date"));
$this->from_date = $value[0];
$this->to_date = $value[1];
}
protected function dataSource()
{
return AutoMaker::table("transactions")
->where('transactions.invoice_type', 'CREDIT')
->where('transactions.status', 3)
->whereBetween('transactions.created_at', [$this->from_date, $this->to_date])
->where('transactions.transaction_type', 1);
}
SaleDateRangTimePicker.php
class SaleDateRangePicker extends DateRangePicker
{
protected function onCreated()
{
$this->defaultValue(DateRangePicker::today());
}
protected function actionChange($request, $response)
{
$this->sibling("Result")->update();
// $this->sibling("RecievedParam")->update();
}
}
so how could be solve?