baseCRUD() ->tableLayout('fixed') ->headerToolbar([ // $this->createTypeButton('drawer', 'xl')->visible(Admin::user()->can('admin.hr.repairs.create')), ...$this->baseHeaderToolBar(), ]) ->bulkActions([]) ->filter($this->baseFilter()->body([ amis()->GroupControl()->mode('horizontal')->body([ amisMake()->SelectControl()->name('store_id')->label(__('employee_sign_repair.store_id')) ->source(admin_url('api/stores?_all=1')) ->labelField('title') ->valueField('id') ->searchable() ->columnRatio(3) ->clearable(), amisMake()->TextControl()->name('employee_name')->label(__('employee_sign_repair.employee_id')) ->placeholder(__('employee.name').'/'.__('employee.phone')) ->columnRatio(3) ->clearable(), amisMake()->DateRangeControl()->name('date_range')->label(__('employee_sign_repair.date')) ->columnRatio(3) ->clearable(), amisMake()->SelectControl()->name('check_status')->label(__('employee_sign_repair.check_status')) ->options(CheckStatus::options()) ->columnRatio(3) ->clearable(), ]), ])) ->columns([ amisMake()->Column()->name('id')->label(__('employee_sign_repair.id')), amisMake()->Column()->name('store.title')->label(__('employee_sign_repair.store_id')), amisMake()->Column()->name('employee.name')->label(__('employee_sign_repair.employee_id')), amisMake()->Column()->name('date')->label(__('employee_sign_repair.date')), amisMake()->Column()->name('sign_time')->label(__('employee_sign_repair.sign_time')) ->set('type', 'mapping') ->map(SignTime::options()), amisMake()->Column()->name('workflow.check_status')->label(__('employee_sign_repair.check_status')) ->set('type', 'mapping') ->map(CheckStatus::options()), $this->rowActions([ $this->rowShowButton()->visible(Admin::user()->can('admin.hr.repairs.view')), // $this->rowEditTypeButton('drawer', 'xl') // ->visible(Admin::user()->can('admin.hr.repairs.update')) // ->visibleOn('${OR(workflow.check_status == '.CheckStatus::None->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}'), $this->rowDeleteButton() ->visible(Admin::user()->can('admin.hr.repairs.delete')) ->visibleOn('${OR(workflow.check_status == '.CheckStatus::None->value.', workflow.check_status == '.CheckStatus::Cancel->value.', workflow.check_status == '.CheckStatus::Fail->value.')}'), $this->applyAction(), $this->cancelAction(), ]), ]); return $this->baseList($crud); } public function form($edit): Form { return $this->baseForm()->title('')->body([ amisMake()->SelectControl()->name('employee_id')->label(__('employee_sign.employee_id')) ->source(admin_url('api/employees?_all=1&store_id_gt=0&employee_status='.EmployeeStatus::Online->value)) ->labelField('name') ->valueField('id') ->searchable() ->joinValues(false) ->extractValue() ->required(), amisMake()->DateControl() ->format('YYYY-MM-DD HH:mm:ss') ->name('date') ->label(__('employee_sign_repair.date')) ->maxDate('now') ->required(), amisMake()->SelectControl()->options(SignTime::options())->name('sign_time')->label(__('employee_sign_repair.sign_time'))->required(), amisMake()->TextControl()->name('reason')->label(__('employee_sign_repair.reason'))->required(), ]); } public function detail(): Form { $detailId = 'sign-repair-detail'; $serviceId = 'sign-repair-checklog-service'; $detail = amisMake()->Property()->items([ ['label' => __('employee_sign_repair.store_id'), 'content' => '${store.title}'], ['label' => __('employee_sign_repair.employee_id'), 'content' => '${employee.name}'], ['label' => __('employee_sign_repair.date'), 'content' => '${date}'], ['label' => __('employee_sign_repair.sign_time'), 'content' => amisMake()->Mapping()->name('sign_time')->map(SignTime::options())], ['label' => __('employee_sign_repair.reason'), 'content' => '${reason}'], ['label' => __('employee_sign_repair.created_at'), 'content' => '${created_at}'], ['label' => __('workflow_log.check_status'), 'content' => amisMake()->Mapping()->name('workflow.check_status')->map(CheckStatus::options())], ['label' => __('workflow_log.checked_at'), 'content' => '${workflow.checked_at}'], ['label' => __('workflow_log.remarks'), 'content' => '${workflow.check_remarks}'], ]); return $this->baseDetail()->id($detailId)->title('')->onEvent([ 'inited' => [ 'actions' => [ ['actionType' => 'reload', 'componentId' => $serviceId], ], ], ])->body([ $detail, amisMake()->Divider(), $this->baseWorkflowLogService($detailId)->id($serviceId), ]); } }