Commit d37c3f4b by 宁成龙

完善列表禁用翻译

parent 93cc1f2d
......@@ -29,9 +29,9 @@ class UserStatusAction extends RowAction
*/
public function title()
{
$buttonName = "启用";
$buttonName = admin_trans("enable");
if ($this->row->status == User::STATUS_NORMAL) {
$buttonName = "禁用";
$buttonName = admin_trans("disable");
}
return $buttonName;
}
......@@ -59,11 +59,11 @@ class UserStatusAction extends RowAction
*/
public function confirm()
{
$buttonName = "启用";
$buttonName = admin_trans("enable");
if ($this->row->status == User::STATUS_NORMAL) {
$buttonName = "禁用";
$buttonName = admin_trans("disable");
}
return ["是否确认 {$buttonName} ?"];
return ["confirm {$buttonName} ?"];
}
/**
......@@ -85,7 +85,7 @@ class UserStatusAction extends RowAction
} catch (\Throwable $e) {
return $this->response()->error($e->getMessage());
}
return $this->response()->success('操作成功')->refresh();
return $this->response()->success(admin_trans("succeeded"))->refresh();
}
/**
......
......@@ -114,23 +114,14 @@ class UserController extends AdminController
}
UserService::createUserAndAddress($params);
} catch (\Throwable $throwable) {
return $this->form()->response()
var_dump((string)$throwable);
return Form::make()->response()
->error(trans('admin.save_failed'))
->withExceptionIf($throwable->getMessage(), $throwable);
}
$url = admin_url("/users/list");
return $this->form()->response()->success('操作成功')->redirect($url)->refresh();
return Form::make()->response()->success('操作成功')->redirect($url)->refresh();
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::dialog("测试");
// return $form;
}
}
......@@ -23,10 +23,10 @@ class UserService
{
$grid->filter(function ($filter) {
$filter->expand(true);
$filter->whereBetween('create_time', function ($q) {
$filter->whereBetween('created_time', function ($q) {
$start = strtotime($this->input['start'] ?? null);
$end = strtotime($this->input['end'] ?? null);
$q->whereBetween('create_time', [$start, $end]);
$q->whereBetween('created_time', [$start, $end]);
})->datetime()->width(3);
$filter->startWith('company_name')->width(2);
......@@ -78,7 +78,7 @@ class UserService
// 获取当前行主键值
$id = $actions->getKey();
$actions->append('<a style="margin-right: 5px" href="' . admin_url("/users/{$id}") . '" class="btn btn-primary btn-sm
btn-mini">detail</a>');
btn-mini">' . admin_trans("detail") . '</a>');
//状态按钮
$actions->append(new UserStatusAction());
});
......@@ -107,8 +107,8 @@ class UserService
"remark" => $params["remark"],
"password" => "1234567",
"status" => User::STATUS_NORMAL,
"sale_id" => request()->user['userId'] ?? "1000",
"sale_name" => request()->user['name'] ?? "admin",
"sale_id" => request()->user->userId ?? "1000",
"sale_name" => request()->user->name ?? "admin",
"created_time" => time(),
"update_time" => time(),
];
......@@ -128,22 +128,22 @@ class UserService
]);
if ($validator->fails()) {
$error = $validator->errors()->first();
throw new \Exception("客户地址错误:" . $error);
throw new \Exception($error);
}
$addressData = [
"user_id" => $userId,
"first_name" => $address["first_name"]??"",
"last_name" => $address["last_name"]??"",
"address_type" => $address["address_type"]??"",
"company_name" => $address["company_name"]??"",
"email" => $address["email"]??"",
"phone" => $address["phone"]??"",
"country" => $address["country"]??"",
"province" => $address["province"]??"",
"city" => $address["city"]??"",
"post_code" => $address["post_code"]??"",
"detail_address" => $address["detail_address"]??"",
"is_default" => $address["is_default"]??"",
"first_name" => $address["first_name"] ?? "",
"last_name" => $address["last_name"] ?? "",
"address_type" => $address["address_type"] ?? "",
"company_name" => $address["company_name"] ?? "",
"email" => $address["email"] ?? "",
"phone" => $address["phone"] ?? "",
"country" => $address["country"] ?? "",
"province" => $address["province"] ?? "",
"city" => $address["city"] ?? "",
"post_code" => $address["post_code"] ?? "",
"detail_address" => $address["detail_address"] ?? "",
"is_default" => $address["is_default"] ?? "",
"create_time" => time(),
"update_time" => time(),
];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment