海南旅游SAAS
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.

82 lines
2.2 KiB

  1. <?php
  2. namespace App\AdminSupplier\Controllers;
  3. use App\Admin\Repositories\ProductExportLog;
  4. use Dcat\Admin\Form;
  5. use Dcat\Admin\Grid;
  6. use Dcat\Admin\Show;
  7. use Dcat\Admin\Http\Controllers\AdminController;
  8. use Dcat\Admin\Widgets\Alert;
  9. class ProductExportLogController extends AdminController
  10. {
  11. /**
  12. * Make a grid builder.
  13. *
  14. * @return Grid
  15. */
  16. protected function grid()
  17. {
  18. return Grid::make(new ProductExportLog(), function (Grid $grid) {
  19. $grid->disableActions();
  20. $grid->disableCreateButton();
  21. $grid->disableBatchActions();
  22. $grid->disableRowSelector();
  23. $grid->model()->where('supplier_id', \Admin::user()->id)->orderByDesc('id');
  24. $grid->header(Alert::make('提示:导出产品及规格可能需要几分钟,请稍后再刷新查看!')->info());
  25. \Admin::style('.alert.alert-info{margin-top:1rem;}');
  26. $grid->column('id')->sortable();
  27. $grid->column('filename')->downloadable();
  28. $grid->column('created_at', '导出时间');
  29. $grid->filter(function (Grid\Filter $filter) {
  30. $filter->equal('id')->width(2);
  31. });
  32. });
  33. }
  34. /**
  35. * Make a show builder.
  36. *
  37. * @param mixed $id
  38. *
  39. * @return Show
  40. */
  41. protected function detail($id)
  42. {
  43. return Show::make($id, new ProductExportLog(), function (Show $show) {
  44. $show->disableDeleteButton();
  45. $show->disableEditButton();
  46. $show->field('id');
  47. $show->field('filename')->file();
  48. $show->field('created_at');
  49. $show->field('updated_at');
  50. });
  51. }
  52. /**
  53. * Make a form builder.
  54. *
  55. * @return Form
  56. */
  57. protected function form()
  58. {
  59. return Form::make(new ProductExportLog(), function (Form $form) {
  60. $form->display('id');
  61. $form->text('supplier_id');
  62. $form->text('filename');
  63. $form->display('created_at');
  64. $form->display('updated_at');
  65. })->saving(function (Form $form) {
  66. return $form->response()->error('操作禁止');
  67. })->deleting(function (Form $form) {
  68. return $form->response()->error('操作禁止');
  69. });
  70. }
  71. }