链街Dcat后台
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.

54 lines
1.1 KiB

5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Admin\Actions\Tools;
  3. use Dcat\Admin\Admin;
  4. use Dcat\Admin\Grid\Tools\AbstractTool;
  5. class SalesmanOption extends AbstractTool
  6. {
  7. protected function script()
  8. {
  9. return <<<JS
  10. $('#today').change(function () {
  11. var url = "salesman?type=today&option=1"
  12. Dcat.reload(url);
  13. });
  14. $('#yesterday').change(function () {
  15. var url = "salesman?type=yesterday&option=-1"
  16. Dcat.reload(url);
  17. });
  18. $('#week').change(function () {
  19. var url = "salesman?type=week&option=w"
  20. Dcat.reload(url);
  21. });
  22. $('#month').change(function () {
  23. var url = "salesman?type=month&option=30"
  24. Dcat.reload(url);
  25. });
  26. JS;
  27. }
  28. public function render()
  29. {
  30. Admin::script($this->script());
  31. // $options = [
  32. // 't' => '今日',
  33. // 'y' => '昨日',
  34. // 'w' => '本周',
  35. // 'm' => '本月',
  36. // ];
  37. $options = [
  38. 'all' => 'All',
  39. 'm' => 'Male',
  40. 'f' => 'Female',
  41. ];
  42. return view('admin.tools.salesman', compact('options'));
  43. }
  44. }