|
@@ -0,0 +1,140 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace App\Distributor\Controllers;
|
|
|
+
|
|
|
+use App\Admin\Actions\Grid\InquiryAssignment;
|
|
|
+use App\Admin\Actions\Tools\InquiryHandle;
|
|
|
+use App\Admin\Repositories\DistInquiry;
|
|
|
+use Dcat\Admin\Form;
|
|
|
+use Dcat\Admin\Grid;
|
|
|
+use Dcat\Admin\Http\Controllers\AdminController;
|
|
|
+use Dcat\Admin\Layout\Content;
|
|
|
+use Dcat\Admin\Show;
|
|
|
+
|
|
|
+class DistInquiryController extends AdminController
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * page index
|
|
|
+ */
|
|
|
+ public function index(Content $content)
|
|
|
+ {
|
|
|
+ return $content
|
|
|
+ ->header('Inquiry Management')
|
|
|
+ ->description('all')
|
|
|
+ ->breadcrumb(['text'=>'list','url'=>''])
|
|
|
+ ->body($this->grid());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //屏蔽删除
|
|
|
+ public function destroy($id)
|
|
|
+ {
|
|
|
+ abort(404);
|
|
|
+ }
|
|
|
+
|
|
|
+ //屏蔽创建
|
|
|
+ public function create(Content $content)
|
|
|
+ {
|
|
|
+ abort(404);
|
|
|
+ }
|
|
|
+
|
|
|
+ //屏蔽编辑
|
|
|
+ public function edit($id, Content $content)
|
|
|
+ {
|
|
|
+ abort(404);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Make a grid builder.
|
|
|
+ *
|
|
|
+ * @return Grid
|
|
|
+ */
|
|
|
+ protected function grid()
|
|
|
+ {
|
|
|
+ $status = isset($_GET['status']) ? intval($_GET['status']) : -1;
|
|
|
+ return Grid::make(DistInquiry::with(['distributor']), function (Grid $grid) use ($status) {
|
|
|
+ $grid->model()->where('dist_id', getDistributorId())->where('status','>',0);
|
|
|
+ //指定视图,去掉删除按钮
|
|
|
+ $grid->view('admin.grid.table');
|
|
|
+ //字段
|
|
|
+ $grid->column('id')->sortable();
|
|
|
+ $grid->column('order_number');
|
|
|
+ $grid->column('company_name');
|
|
|
+ $grid->column('customer_name');
|
|
|
+ $grid->column('email');
|
|
|
+ $grid->column('consulting_products');
|
|
|
+ //$grid->column('distributor.username', 'Distributor Username');
|
|
|
+ //$grid->column('distributor.company_name', admin_trans_label('distributor_company_name'));
|
|
|
+ $grid->column('status')->using(config('dictionary.inquiryStatus'))->label([
|
|
|
+ 0 => 'default',
|
|
|
+ 1 => 'info',
|
|
|
+ 2 => 'success',
|
|
|
+ ]);
|
|
|
+ $grid->column('created_at');
|
|
|
+ $grid->column('updated_at')->sortable();
|
|
|
+ //筛选
|
|
|
+ $grid->filter(function (Grid\Filter $filter) {
|
|
|
+ $inquiryStatus = config('dictionary.inquiryStatus');
|
|
|
+ unset($inquiryStatus[0]);
|
|
|
+ $filter->panel();
|
|
|
+ $filter->expand();
|
|
|
+ $filter->equal('order_number')->width(2);
|
|
|
+ $filter->equal('company_name')->width(2);
|
|
|
+ $filter->equal('customer_name')->width(2);
|
|
|
+ $filter->equal('status')->select($inquiryStatus)->width(2);
|
|
|
+ });
|
|
|
+ //排序
|
|
|
+ $grid->model()->orderBy("id",'desc');
|
|
|
+ //按钮
|
|
|
+ $grid->disableCreateButton();
|
|
|
+ $grid->disableEditButton();
|
|
|
+ $grid->disableDeleteButton();
|
|
|
+ $grid->disableBatchDelete();
|
|
|
+ $grid->showViewButton();
|
|
|
+ if ($status == 1) {
|
|
|
+ //批量操作
|
|
|
+ $grid->tools([new InquiryHandle()]);
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Make a show builder.
|
|
|
+ *
|
|
|
+ * @param mixed $id
|
|
|
+ *
|
|
|
+ * @return Show
|
|
|
+ */
|
|
|
+ protected function detail($id)
|
|
|
+ {
|
|
|
+ return Show::make($id, new DistInquiry(), function (Show $show) {
|
|
|
+ if ($show->model()->dist_id !== getDistributorId()) {
|
|
|
+ abort(404);
|
|
|
+ }
|
|
|
+ $show->field('id');
|
|
|
+ $show->field('order_number');
|
|
|
+ $show->field('whats_app');
|
|
|
+ $show->field('company_name');
|
|
|
+ $show->field('customer_name');
|
|
|
+ $show->field('email');
|
|
|
+ $show->field('consulting_products');
|
|
|
+ $show->field('freight_forwarder');
|
|
|
+ $show->field('business_model');
|
|
|
+ $show->field('ip_address');
|
|
|
+ $show->field('status')->using(config('dictionary.inquiryStatus'));
|
|
|
+ $show->field('allocate_time');
|
|
|
+ //$show->field('distributor.company_name',admin_trans_label('distributor_company_name'));
|
|
|
+ $show->field('content');
|
|
|
+ $show->field('created_at');
|
|
|
+ $show->field('updated_at');
|
|
|
+ //按钮
|
|
|
+ $show->disableDeleteButton();
|
|
|
+ $show->disableEditButton();
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+}
|