Commit 97532c3e by LJM
parents e0a4bc3a d7071222
......@@ -2,12 +2,18 @@
namespace App\Admin\Controllers;
use App\Admin\Metrics\Examples\Tickets;
use App\Admin\Renderable\CreateUser;
use App\Admin\Renderable\UserDetail;
use App\Admin\Repositories\User;
use App\Admin\Repositories\UserAddress;
use App\Admin\Service\UserService;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Http\Controllers\Dashboard;
use Dcat\Admin\Layout\Column;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Layout\Row;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
......@@ -43,7 +49,23 @@ class UserController extends AdminController
protected function detail($id)
{
$address_list = (\App\Admin\Renderable\UserAddress::make(["key" => $id])->render());
return UserDetail::make(["key" => $id])->render().$address_list;
return UserDetail::make(["key" => $id])->render() . $address_list;
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
public function create(Content $content)
{
return $content
->header('Dashboard')
->description('Description...')
->body(CreateUser::make()->render());
}
/**
......
<?php
namespace App\Admin\Renderable;
use App\Admin\Actions\User\UserEditAction;
use App\Admin\Repositories\Inquiry;
use App\Admin\Repositories\User;
use App\Models\InquiryItems;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;
use Dcat\Admin\Models\Administrator;
use Dcat\Admin\Show;
use Dcat\Admin\Widgets\Table;
class CreateUser extends \Dcat\Admin\Support\LazyRenderable
{
public function render()
{
// 只填充内容,不需要标题
return Form::make(new User(), function (Form $form) {
$form->disableDeleteButton();
$form->disableCreatingCheck();
$form->disableViewCheck();
$form->disableEditingCheck();
$form->row(function (Form\Row $form) {
$form->width(4)->text('company_name')->required();
$form->width(4)->text('user_sn')->required();
});
$form->row(function (Form\Row $form) {
$form->width(4)->text('first_name')->required();
$form->width(4)->text('last_name')->required();
});
$form->row(function (Form\Row $form) {
$form->width(4)->text('phone')->required();
$form->width(4)->text('email')->required();
});
$form->row(function (Form\Row $form) {
$form->width(4)->text('reg_source')->required();
$form->width(4)->text('remark')->required();
});
})->render();
}
}
......@@ -36,8 +36,8 @@ class UserService
public static function userListListField(Grid $grid)
{
$grid->column('company_name');
$grid->column('user_sn')->link(function ($user_sn) {
return admin_url('/' . $user_sn);
$grid->column('user_sn')->link(function ($user_sn)use($grid) {
return admin_url("/users/{$this->id}");
});
$grid->column('name');
$grid->column('phone');
......@@ -50,6 +50,8 @@ class UserService
$grid->column('status')->using(admin_trans('user.options.status'));
}
public static function userListTool(Grid $grid)
{
$grid->tools([
......
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