<?php

namespace App\Admin\Controllers;

use App\Services\CoachQualRecordService;
use Slowlyo\OwlAdmin\Controllers\AdminController;

/**
 * 技师资质认证记录
 *
 * @property CoachQualRecordService $service
 */
class CoachQualRecordController extends AdminController
{
	protected string $serviceName = CoachQualRecordService::class;

	public function list()
	{
		$crud = $this->baseCRUD()
			->filterTogglable(false)
			->headerToolbar([
				$this->createButton('dialog'),
				...$this->baseHeaderToolBar()
			])
			->columns([
				amis()->TableColumn('id', 'ID')->sortable(),
				amis()->TableColumn('coach_id', '技师编号'),
				amis()->TableColumn('qual_type', '资质类型'),
				amis()->TableColumn('qual_no', '资质证书编号'),
				amis()->TableColumn('qual_photo', '资质证书照片'),
				amis()->TableColumn('valid_start', '有效期开始日期'),
				amis()->TableColumn('valid_end', '有效期结束日期'),
				amis()->TableColumn('auditor', '审核人'),
				amis()->TableColumn('audit_time', '审核时间'),
				amis()->TableColumn('audit_remark', '审核回执'),
				amis()->TableColumn('state', '状态'),
				amis()->TableColumn('created_at', admin_trans('admin.created_at'))->type('datetime')->sortable(),
				amis()->TableColumn('updated_at', admin_trans('admin.updated_at'))->type('datetime')->sortable(),
				$this->rowActions('dialog')
			]);

		return $this->baseList($crud);
	}

	public function form($isEdit = false)
	{
		return $this->baseForm()->body([
			amis()->TextControl('coach_id', '技师编号'),
			amis()->TextControl('qual_type', '资质类型'),
			amis()->TextControl('qual_no', '资质证书编号'),
			amis()->TextControl('qual_photo', '资质证书照片'),
			amis()->TextControl('valid_start', '有效期开始日期'),
			amis()->TextControl('valid_end', '有效期结束日期'),
			amis()->TextControl('auditor', '审核人'),
			amis()->TextControl('audit_time', '审核时间'),
			amis()->TextControl('audit_remark', '审核回执'),
			amis()->TextControl('state', '状态'),
		]);
	}

	public function detail()
	{
		return $this->baseDetail()->body([
			amis()->TextControl('id', 'ID')->static(),
			amis()->TextControl('coach_id', '技师编号')->static(),
			amis()->TextControl('qual_type', '资质类型')->static(),
			amis()->TextControl('qual_no', '资质证书编号')->static(),
			amis()->TextControl('qual_photo', '资质证书照片')->static(),
			amis()->TextControl('valid_start', '有效期开始日期')->static(),
			amis()->TextControl('valid_end', '有效期结束日期')->static(),
			amis()->TextControl('auditor', '审核人')->static(),
			amis()->TextControl('audit_time', '审核时间')->static(),
			amis()->TextControl('audit_remark', '审核回执')->static(),
			amis()->TextControl('state', '状态')->static(),
			amis()->TextControl('created_at', admin_trans('admin.created_at'))->static(),
			amis()->TextControl('updated_at', admin_trans('admin.updated_at'))->static(),
		]);
	}
}