Commit 2f6ed246 by 宁成龙

完善新增客户页面

parent d7071222
......@@ -5,6 +5,7 @@ namespace App\Admin\Renderable;
use App\Admin\Actions\User\UserEditAction;
use App\Admin\Repositories\Inquiry;
use App\Admin\Repositories\User;
use App\Models\Country;
use App\Models\InquiryItems;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
......@@ -12,6 +13,7 @@ use Dcat\Admin\Grid\LazyRenderable;
use Dcat\Admin\Models\Administrator;
use Dcat\Admin\Show;
use Dcat\Admin\Widgets\Table;
use PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\F;
class CreateUser extends \Dcat\Admin\Support\LazyRenderable
{
......@@ -19,10 +21,10 @@ class CreateUser extends \Dcat\Admin\Support\LazyRenderable
{
// 只填充内容,不需要标题
return Form::make(new User(), function (Form $form) {
$form->disableDeleteButton();
$form->disableCreatingCheck();
$form->disableViewCheck();
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableResetButton();
$form->disableCreatingCheck();
$form->row(function (Form\Row $form) {
$form->width(4)->text('company_name')->required();
$form->width(4)->text('user_sn')->required();
......@@ -36,9 +38,39 @@ class CreateUser extends \Dcat\Admin\Support\LazyRenderable
$form->width(4)->text('email')->required();
});
$form->row(function (Form\Row $form) {
$form->width(4)->text('reg_source')->required();
$form->width(4)->select("reg_source")->options(admin_trans('user.options.reg_source'))->required();
$form->width(4)->text('remark')->required();
});
$form->row(function (Form\Row $form) {
$form->array('column_name', function ($table) {
$table->row(function (Form\Row $table) {
$table->width(3)->text('first_name')->required();
$table->width(3)->text('last_name')->required();
});
$table->row(function (Form\Row $table) {
$table->width(3)->select('address_type')->options(admin_trans('user-address.options.address_type'))
->required();
$table->width(3)->text('company_name')->required();
});
$table->row(function (Form\Row $table) {
$table->width(3)->text('email')->required();
$table->width(3)->text('phone')->required();
});
$table->row(function (Form\Row $table) {
$table->width(3)->select('country')->options(Country::getCountryMap())->required();
$table->width(3)->text('province')->required();
$table->width(3)->text('city')->required();
$table->width(2)->text('post_code')->required();
});
$table->row(function (Form\Row $table) {
$table->width(3)->textarea('detail_address')->required();
});
$table->row(function (Form\Row $table) {
$table->width(3)->switch('is_default')->required();
});
});
});
})->render();
}
......
......@@ -2,6 +2,7 @@
namespace App\Models;
use App\Models\Cms\CmsUser;
use Illuminate\Database\Eloquent\Model;
class Country extends Model
......@@ -9,4 +10,12 @@ class Country extends Model
//
protected $table = 'country';
public $timestamps = false;
public static function getCountryMap()
{
$res = self::pluck('name', 'id')
->toArray();
return $res;
}
}
......@@ -70,4 +70,10 @@ class User extends Model
return self::whereIn("id", $idArr)->update($update);
}
public function user_address()
{
return $this->hasMany(UserAddress::class, 'user_id', 'id');
}
}
......@@ -22,5 +22,13 @@ return [
"update_time" => "修改时间",
],
'options' => [
"address_type"=> [
"0" => "个人",
"1" => "公司",
],
"is_default"=> [
"1" => "是",
"0" => "否",
],
],
];
......@@ -23,6 +23,9 @@ return [
'created_time' => '创建时间',
'update_time' => '更新时间',
'reg_source' => '注册来源',
'user_address' => [
'consignee' => 'Sales Name',
]
],
'options' => [
"status"=>[
......
<?php
return [
'labels' => [
'UserAddress' => 'UserAddress',
'user-address' => 'UserAddress',
],
'fields' => [
"address_id" => "用户用户地址ID",
"user_id" => "会员ID",
"address_type" => "地址类型;0:个人,1:公司",
"consignee" => "收货人/收货公司",
"email" => "邮箱",
"post_code" => "邮政编码",
"phone" => "手机/电话",
"country" => "国家",
"province" => "省份",
"city" => "城市",
"detail_address" => "详细地址",
"is_default" => "是否默认(1=是|0=否)",
"create_time" => "创建时间",
"update_time" => "修改时间",
],
'options' => [
"address_type"=> [
"0" => "个人",
"1" => "公司",
],
"is_default"=> [
"1" => "是",
"0" => "否",
],
],
];
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