<?php

namespace App\Admin\Controllers;

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

/**
 * 代理商信息认证记录
 *
 * @property AgentInfoRecordService $service
 */
class AgentInfoRecordController extends AdminController
{
	protected string $serviceName = AgentInfoRecordService::class;

	public function list()
	{
		$crud = $this->baseCRUD()
			->filterTogglable(false)
			->headerToolbar([
				$this->createButton('dialog'),
				...$this->baseHeaderToolBar()
			])
			->columns([
				amis()->TableColumn('id', 'ID')->sortable(),
				amis()->TableColumn('agent_id', '代理商编号'),
				amis()->TableColumn('company_name', '公司名称'),
				amis()->TableColumn('company_address', '公司地址'),
				amis()->TableColumn('contact_name', '联系人姓名'),
				amis()->TableColumn('contact_mobile', '联系人手机号'),
				amis()->TableColumn('business_area', '经营区域'),
				amis()->TableColumn('business_scope', '经营范围'),
				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('agent_id', '代理商编号'),
			amis()->TextControl('company_name', '公司名称'),
			amis()->TextControl('company_address', '公司地址'),
			amis()->TextControl('contact_name', '联系人姓名'),
			amis()->TextControl('contact_mobile', '联系人手机号'),
			amis()->TextControl('business_area', '经营区域'),
			amis()->TextControl('business_scope', '经营范围'),
			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('agent_id', '代理商编号')->static(),
			amis()->TextControl('company_name', '公司名称')->static(),
			amis()->TextControl('company_address', '公司地址')->static(),
			amis()->TextControl('contact_name', '联系人姓名')->static(),
			amis()->TextControl('contact_mobile', '联系人手机号')->static(),
			amis()->TextControl('business_area', '经营区域')->static(),
			amis()->TextControl('business_scope', '经营范围')->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(),
		]);
	}
}