<?php

namespace App\Admin\Controllers;

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

/**
 * 钱包提现记录
 *
 * @property WalletWithdrawRecordService $service
 */
class WalletWithdrawRecordController extends AdminController
{
	protected string $serviceName = WalletWithdrawRecordService::class;

	public function list()
	{
		$crud = $this->baseCRUD()
			->filterTogglable(false)
			->headerToolbar([
				$this->createButton('dialog'),
				...$this->baseHeaderToolBar()
			])
			->columns([
				amis()->TableColumn('id', 'ID')->sortable(),
				amis()->TableColumn('wallet_id', '钱包编号'),
				amis()->TableColumn('external_no', '外部交易单号'),
				amis()->TableColumn('withdraw_type', '提现方式'),
				amis()->TableColumn('withdraw_account', '提现账户'),
				amis()->TableColumn('withdraw_account_name', '提现账户名'),
				amis()->TableColumn('amount', '提现金额'),
				amis()->TableColumn('fee', '提现手续费'),
				amis()->TableColumn('withdraw_time', '提现时间'),
				amis()->TableColumn('area_code', '行政区划代码'),
				amis()->TableColumn('remark', '备注'),
				amis()->TableColumn('auditor', '审核人'),
				amis()->TableColumn('audit_time', '审核时间'),
				amis()->TableColumn('audit_remark', '审核回执'),
				amis()->TableColumn('audit_state', '审核状态'),
				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('wallet_id', '钱包编号'),
			amis()->TextControl('external_no', '外部交易单号'),
			amis()->TextControl('withdraw_type', '提现方式'),
			amis()->TextControl('withdraw_account', '提现账户'),
			amis()->TextControl('withdraw_account_name', '提现账户名'),
			amis()->TextControl('amount', '提现金额'),
			amis()->TextControl('fee', '提现手续费'),
			amis()->TextControl('withdraw_time', '提现时间'),
			amis()->TextControl('area_code', '行政区划代码'),
			amis()->TextControl('remark', '备注'),
			amis()->TextControl('auditor', '审核人'),
			amis()->TextControl('audit_time', '审核时间'),
			amis()->TextControl('audit_remark', '审核回执'),
			amis()->TextControl('audit_state', '审核状态'),
			amis()->TextControl('state', '状态'),
		]);
	}

	public function detail()
	{
		return $this->baseDetail()->body([
			amis()->TextControl('id', 'ID')->static(),
			amis()->TextControl('wallet_id', '钱包编号')->static(),
			amis()->TextControl('external_no', '外部交易单号')->static(),
			amis()->TextControl('withdraw_type', '提现方式')->static(),
			amis()->TextControl('withdraw_account', '提现账户')->static(),
			amis()->TextControl('withdraw_account_name', '提现账户名')->static(),
			amis()->TextControl('amount', '提现金额')->static(),
			amis()->TextControl('fee', '提现手续费')->static(),
			amis()->TextControl('withdraw_time', '提现时间')->static(),
			amis()->TextControl('area_code', '行政区划代码')->static(),
			amis()->TextControl('remark', '备注')->static(),
			amis()->TextControl('auditor', '审核人')->static(),
			amis()->TextControl('audit_time', '审核时间')->static(),
			amis()->TextControl('audit_remark', '审核回执')->static(),
			amis()->TextControl('audit_state', '审核状态')->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(),
		]);
	}
}