|
@@ -44,31 +44,20 @@ class DistAdminDistributorController extends AdminController
|
|
$grid->view('admin.grid.table');
|
|
$grid->view('admin.grid.table');
|
|
|
|
|
|
$grid->column('id')->sortable();
|
|
$grid->column('id')->sortable();
|
|
- $grid->column('company_name')->width('30%');
|
|
|
|
- $grid->column('site_name');
|
|
|
|
- $grid->column('domain_type',admin_trans_label('domain'))->display(function ($domainType) {
|
|
|
|
- $title = "";
|
|
|
|
- if ($domainType == 0) {
|
|
|
|
- $title = $this->secondary_domain;
|
|
|
|
- } else {
|
|
|
|
- $title = $this->custom_domain;
|
|
|
|
- }
|
|
|
|
- return "<span style='color:#586cb1'>$title</span>";
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
|
|
+ $grid->column('client_code',admin_trans_label('client_code'))->width('15%');
|
|
|
|
+ $grid->column('distr_email',admin_trans_label('email'));
|
|
|
|
+ $grid->column('dist_contact_number',admin_trans_label('contact_number'));
|
|
|
|
+ $grid->column('secondary_domain');
|
|
$grid->column('country',);
|
|
$grid->column('country',);
|
|
- $grid->column('appearance.title' ,admin_trans_field('appearance'));
|
|
|
|
- $grid->column('remark');
|
|
|
|
$grid->column('enabled')->switch();
|
|
$grid->column('enabled')->switch();
|
|
- $grid->column('updated_at')->sortable();
|
|
|
|
|
|
+ $grid->column('created_at')->sortable();
|
|
// 过滤
|
|
// 过滤
|
|
$grid->filter(function (Grid\Filter $filter) {
|
|
$grid->filter(function (Grid\Filter $filter) {
|
|
$filter->panel();
|
|
$filter->panel();
|
|
$filter->expand();
|
|
$filter->expand();
|
|
- $filter->equal('company_name', )->width(2);
|
|
|
|
- $filter->equal('site_name')->width(2);
|
|
|
|
- $filter->equal('domain')->width(2);
|
|
|
|
- $filter->equal('enabled', )->select(admin_trans_array(config('dictionary.enabled')))->width(2);
|
|
|
|
|
|
+ $filter->equal('dist_code',admin_trans_label('client_code') )->width(2);
|
|
|
|
+ $filter->equal('secondary_domain')->width(2);
|
|
|
|
+ $filter->equal('enabled')->select(admin_trans_array(config('dictionary.enabled')))->width(2);
|
|
});
|
|
});
|
|
// 排序
|
|
// 排序
|
|
$grid->model()->orderBy("id",'desc');
|
|
$grid->model()->orderBy("id",'desc');
|
|
@@ -96,7 +85,15 @@ class DistAdminDistributorController extends AdminController
|
|
protected function detail($id)
|
|
protected function detail($id)
|
|
{
|
|
{
|
|
return Show::make($id, DistAdminDistributor::with(['appearance']), function (Show $show) {
|
|
return Show::make($id, DistAdminDistributor::with(['appearance']), function (Show $show) {
|
|
- $show->field('id');
|
|
|
|
|
|
+ $show->field('dist_code',admin_trans_label('client_code'));
|
|
|
|
+ $show->field('distr_email',admin_trans_label('email'));
|
|
|
|
+ $show->field('dist_contact_number',admin_trans_label('contact_number'));
|
|
|
|
+ $show->field('secondary_domain');
|
|
|
|
+ $show->field('country');
|
|
|
|
+ $show->field('enabled')->using(admin_trans_array(config('dictionary.enabled')));
|
|
|
|
+ $show->field('created_at');
|
|
|
|
+ $show->field('updated_at');
|
|
|
|
+ /*
|
|
$show->field('company_name');
|
|
$show->field('company_name');
|
|
$show->field('company_address');
|
|
$show->field('company_address');
|
|
$show->field('site_name');
|
|
$show->field('site_name');
|
|
@@ -132,6 +129,7 @@ class DistAdminDistributorController extends AdminController
|
|
$show->field('seo_title');
|
|
$show->field('seo_title');
|
|
$show->field('seo_keywords');
|
|
$show->field('seo_keywords');
|
|
$show->field('seo_description');
|
|
$show->field('seo_description');
|
|
|
|
+ */
|
|
// 按钮
|
|
// 按钮
|
|
$show->disableDeleteButton();
|
|
$show->disableDeleteButton();
|
|
|
|
|
|
@@ -146,6 +144,15 @@ class DistAdminDistributorController extends AdminController
|
|
protected function form()
|
|
protected function form()
|
|
{
|
|
{
|
|
return Form::make(new DistAdminDistributor(), function (Form $form) {
|
|
return Form::make(new DistAdminDistributor(), function (Form $form) {
|
|
|
|
+ $form->text('dist_code',admin_trans_label('client_code'))->width(9,3)->required();
|
|
|
|
+ $form->text('distr_email',admin_trans_label('email'))->width(9,3);
|
|
|
|
+ $form->text('dist_contact_number',admin_trans_label('contact_number'))->width(9,3);
|
|
|
|
+ $form->text('secondary_domain')->width(9,3)
|
|
|
|
+ ->required()
|
|
|
|
+ ->help('Please enter the domain name, such as demo.'.env('TOP_DOMAIN'));
|
|
|
|
+ $form->text('country')->width(9,3)->required();
|
|
|
|
+ $form->switch('enabled')->width(9,3)->default(1);
|
|
|
|
+ /*
|
|
$form->text('company_name')->width(9,3)->required();
|
|
$form->text('company_name')->width(9,3)->required();
|
|
$form->text('company_address',)->width(9,3);
|
|
$form->text('company_address',)->width(9,3);
|
|
$form->text('site_name')->width(9,3)->required();
|
|
$form->text('site_name')->width(9,3)->required();
|
|
@@ -183,46 +190,47 @@ class DistAdminDistributorController extends AdminController
|
|
$form->text('seo_title')->width(9,3)->required();
|
|
$form->text('seo_title')->width(9,3)->required();
|
|
$form->text('seo_keywords')->width(9,3);
|
|
$form->text('seo_keywords')->width(9,3);
|
|
$form->textarea('seo_description')->width(9,3);
|
|
$form->textarea('seo_description')->width(9,3);
|
|
|
|
+ */
|
|
|
|
|
|
//保存前回调
|
|
//保存前回调
|
|
- $form->saving(function (Form $form) {
|
|
|
|
- if (!$form->isCreating()) {
|
|
|
|
- //如果appearance_id有变化,则更新模版与变量
|
|
|
|
- if ($form->model()->appearance_id != $form->input('appearance_id')) {
|
|
|
|
- $id = $form->model()->id;
|
|
|
|
- //更新模版与变量
|
|
|
|
- DistAppearance::switchTheme($form->input('appearance_id'), $id);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+// $form->saving(function (Form $form) {
|
|
|
|
+// if (!$form->isCreating()) {
|
|
|
|
+// //如果appearance_id有变化,则更新模版与变量
|
|
|
|
+// if ($form->model()->appearance_id != $form->input('appearance_id')) {
|
|
|
|
+// $id = $form->model()->id;
|
|
|
|
+// //更新模版与变量
|
|
|
|
+// DistAppearance::switchTheme($form->input('appearance_id'), $id);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// });
|
|
//保存后回调
|
|
//保存后回调
|
|
- $form->saved(function (Form $form, $result) {
|
|
|
|
- if ($form->isCreating()) {
|
|
|
|
- //创建后创建默认分类
|
|
|
|
- $newId = $form->getKey();
|
|
|
|
- $appearanceId = $form->input('appearance_id');
|
|
|
|
- //初始化分销商
|
|
|
|
- DistAdminDistributor::initDist($appearanceId,$newId);
|
|
|
|
- //更新模版与变量
|
|
|
|
- DistAppearance::switchTheme($appearanceId, $newId);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+// $form->saved(function (Form $form, $result) {
|
|
|
|
+// if ($form->isCreating()) {
|
|
|
|
+// //创建后创建默认分类
|
|
|
|
+// $newId = $form->getKey();
|
|
|
|
+// $appearanceId = $form->input('appearance_id');
|
|
|
|
+// //初始化分销商
|
|
|
|
+// DistAdminDistributor::initDist($appearanceId,$newId);
|
|
|
|
+// //更新模版与变量
|
|
|
|
+// DistAppearance::switchTheme($appearanceId, $newId);
|
|
|
|
+// }
|
|
|
|
+// });
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
* 新增事件事务
|
|
* 新增事件事务
|
|
*/
|
|
*/
|
|
- public function store()
|
|
|
|
- {
|
|
|
|
- try {
|
|
|
|
- DB::beginTransaction();
|
|
|
|
- $result = parent::store();
|
|
|
|
- DB::commit();
|
|
|
|
- return $result;
|
|
|
|
- } catch (\Exception $e) {
|
|
|
|
- DB::rollBack();
|
|
|
|
- throw $e;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+// public function store()
|
|
|
|
+// {
|
|
|
|
+// try {
|
|
|
|
+// DB::beginTransaction();
|
|
|
|
+// $result = parent::store();
|
|
|
|
+// DB::commit();
|
|
|
|
+// return $result;
|
|
|
|
+// } catch (\Exception $e) {
|
|
|
|
+// DB::rollBack();
|
|
|
|
+// throw $e;
|
|
|
|
+// }
|
|
|
|
+// }
|
|
}
|
|
}
|