<?php 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; 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 { public function render() { // 只填充内容,不需要标题 return Form::make(new User(), function (Form $form) { $form->disableEditingCheck(); $form->disableViewCheck(); $form->disableResetButton(); $form->disableCreatingCheck(); $form->row(function (Form\Row $form) { $form->width(4)->text('company_name'); $form->width(4)->text('user_sn')->disable(); }); $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)->mobile('phone')->required(); $form->width(4)->email('email')->required(); }); $form->row(function (Form\Row $form) { $form->width(4)->select("account_properties")->options(admin_trans('user.options.account_properties'))->required(); $form->width(4)->text('remark'); }); $form->row(function (Form\Row $form) { $form->array('user_address_list', function ($table) { $table->row(function (Form\Row $table) { $table->width(3)->text('first_name')->label(trans("user-address.fields.first_name"))->required(); $table->width(3)->text('last_name')->label(trans("user-address.fields.last_name"))->required(); }); $table->row(function (Form\Row $table) { $table->width(3)->select('address_type')->label(trans("user-address.fields.address_type"))->options (admin_trans('user-address.options.address_type')) ->required(); $table->width(3)->text('company_name')->label(trans("user-address.fields.company_name")); }); $table->row(function (Form\Row $table) { $table->width(3)->email('email')->label(trans("user-address.fields.email"))->required(); $table->width(3)->mobile('phone')->label(trans("user-address.fields.phone"))->required(); }); $table->row(function (Form\Row $table) { $table->width(3)->select('country')->label(trans("user-address.fields.country"))->options (Country::getCountryMap()) ->required(); $table->width(3)->text('province')->label(trans("user-address.fields.province")); }); $table->row(function (Form\Row $table) { $table->width(3)->text('city')->label(trans("user-address.fields.city"))->required(); $table->width(2)->number('post_code')->label(trans("user-address.fields.post_code"))->required(); }); $table->row(function (Form\Row $table) { $table->width(12)->textarea('detail_address')->label(trans("user-address.fields.detail_address"))->required(); }); $table->row(function (Form\Row $table) { $table->width(3)->switch('is_default')->label(trans("user-address.fields.is_default")); }); }); }); })->render(); } }