<?php

namespace App\Admin\Controllers;

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

/**
 * 代理商实名认证记录
 *
 * @property AgentRealAuthRecordService $service
 */
class AgentRealAuthRecordController extends AdminController
{
	protected string $serviceName = AgentRealAuthRecordService::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('real_name', '法人姓名'),
				amis()->TableColumn('id_card', '法人身份证号'),
				amis()->TableColumn('id_card_front_photo', '法人身份证正面照片'),
				amis()->TableColumn('id_card_back_photo', '法人身份证反面照片'),
				amis()->TableColumn('business_license', '营业执照照片'),
				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('real_name', '法人姓名'),
			amis()->TextControl('id_card', '法人身份证号'),
			amis()->TextControl('id_card_front_photo', '法人身份证正面照片'),
			amis()->TextControl('id_card_back_photo', '法人身份证反面照片'),
			amis()->TextControl('business_license', '营业执照照片'),
			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('real_name', '法人姓名')->static(),
			amis()->TextControl('id_card', '法人身份证号')->static(),
			amis()->TextControl('id_card_front_photo', '法人身份证正面照片')->static(),
			amis()->TextControl('id_card_back_photo', '法人身份证反面照片')->static(),
			amis()->TextControl('business_license', '营业执照照片')->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(),
		]);
	}
}