<?php

namespace App\Admin\Controllers;

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

/**
 * 用户实名认证记录
 *
 * @property MemberRealAuthRecordService $service
 */
class MemberRealAuthRecordController extends AdminController
{
	protected string $serviceName = MemberRealAuthRecordService::class;

	public function list()
	{
		$crud = $this->baseCRUD()
			->filterTogglable(false)
			->headerToolbar([
				$this->createButton('dialog'),
				...$this->baseHeaderToolBar()
			])
			->columns([
				amis()->TableColumn('id', 'ID')->sortable(),
				amis()->TableColumn('user_id', '用户编号'),
				amis()->TableColumn('real_name', '真实姓名'),
				amis()->TableColumn('id_card', '身份证号'),
				amis()->TableColumn('id_card_front_photo', '身份证正面照片'),
				amis()->TableColumn('id_card_back_photo', '身份证反面照片'),
				amis()->TableColumn('id_card_hand_photo', '手持身份证照片'),
				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('user_id', '用户编号'),
			amis()->TextControl('real_name', '真实姓名'),
			amis()->TextControl('id_card', '身份证号'),
			amis()->TextControl('id_card_front_photo', '身份证正面照片'),
			amis()->TextControl('id_card_back_photo', '身份证反面照片'),
			amis()->TextControl('id_card_hand_photo', '手持身份证照片'),
			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('user_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('id_card_hand_photo', '手持身份证照片')->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(),
		]);
	}
}