baseCRUD() ->tableLayout('fixed') ->headerToolbar([ $this->createButton(true), ...$this->baseHeaderToolBar(), ]) ->filter($this->baseFilter()->body([ amis()->GroupControl()->mode('horizontal')->body([ amisMake()->TextControl()->name('name')->label(__('employee.name'))->columnRatio(3)->clearable(), amisMake()->TextControl()->name('phone')->label(__('employee.phone'))->columnRatio(3)->clearable(), amisMake()->SelectControl()->name('employee_status')->label(__('employee.employee_status'))->columnRatio(3)->clearable()->options(EmployeeStatus::options()), ]), ])) ->columns([ amisMake()->TableColumn()->name('id')->label(__('employee.id')), amisMake()->TableColumn()->name('name')->label(__('employee.name')), amisMake()->TableColumn()->name('phone')->label(__('employee.phone')), // amisMake()->TableColumn()->name('employee_status_text')->label(__('employee.employee_status')), amisMake()->TableColumn()->name('employee_status_text')->label(__('employee.employee_status'))->set('type', 'tag')->set('color', '${employee_status_color}'), amisMake()->TableColumn()->name('created_at')->label(__('employee.created_at')), $this->rowActions([ $this->rowShowButton(), $this->rowEditButton(true), $this->rowDeleteButton(), ]), ]); return $this->baseList($crud); } public function form($edit): Form { return $this->baseForm()->title('')->body([ amisMake()->TextControl()->name('name')->label(__('employee.name'))->required(), amisMake()->TextControl()->name('phone')->label(__('employee.phone'))->required(), amisMake()->TagControl()->name('jobs')->label(__('employee.jobs')) ->source(admin_url('api/keywords/tree-list') . '?parent_key=' . Employee::JOB_KEY) ->labelField('name') ->valueField('key') ->joinValues(), amisMake()->SelectControl()->name('employee_status')->label(__('employee.employee_status'))->options(EmployeeStatus::options()), amisMake()->TextControl()->name('username')->label(__('admin.username'))->value('${admin_user.username}')->required(!$edit), amisMake()->TextControl()->name('password')->set('type', 'input-password')->label(__('admin.password'))->required(!$edit), amisMake()->TextControl()->name('confirm_password')->set('type', 'input-password')->label(__('admin.confirm_password'))->required(!$edit), ]); } public function detail(): Form { return $this->baseDetail()->title('')->body(amisMake()->Property()->items([ ['label' => __('employee.name'), 'content' => '${name}'], ['label' => __('employee.phone'), 'content' => '${phone}'], ['label' => __('employee.jobs'), 'content' => amisMake()->TagControl()->size('full')->name('jobs')->labelField('name')->valueField('key')->joinValues()->static()], ['label' => __('admin.username'), 'content' => '${admin_user.username}'], ['label' => __('employee.employee_status'), 'content' => amisMake()->Tag()->label('${employee_status_text}')->color('${employee_status_color}')], ])); } }