You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1007 B
47 lines
1007 B
<?php
|
|
|
|
|
|
namespace App\Admin\Actions\Tools;
|
|
|
|
|
|
use Dcat\Admin\Admin;
|
|
use Dcat\Admin\Grid\Tools\AbstractTool;
|
|
|
|
class SalesmanOption extends AbstractTool
|
|
{
|
|
protected $url;
|
|
protected $option;
|
|
protected function script()
|
|
{
|
|
return <<<JS
|
|
$("#{$this->option}").change(function () {
|
|
var url = "{$this->url}"
|
|
Dcat.reload(url)
|
|
});
|
|
JS;
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
$options = [
|
|
'today' => '今日',
|
|
'yesterday' => '昨日',
|
|
'week' => '本周',
|
|
'month' => '本月',
|
|
];
|
|
|
|
$data = [
|
|
'today' => '1',
|
|
'yesterday' => '-1',
|
|
'week' => 'w',
|
|
'month' => '30',
|
|
];
|
|
|
|
foreach ($data as $key=>$value){
|
|
$this->url = "salesman?type={$key}&option={$value}";
|
|
$this->option = $key;
|
|
Admin::script($this->script());
|
|
}
|
|
return view('admin.tools.salesman', compact('options'));
|
|
}
|
|
}
|