<?php

namespace App\Admin\Controllers;

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

/**
 * 钱包支付记录
 *
 * @property WalletPaymentRecordService $service
 */
class WalletPaymentRecordController extends AdminController
{
	protected string $serviceName = WalletPaymentRecordService::class;

	public function list()
	{
		$crud = $this->baseCRUD()
			->filterTogglable(false)
			->headerToolbar([
				$this->createButton('dialog'),
				...$this->baseHeaderToolBar()
			])
			->columns([
				amis()->TableColumn('id', 'ID')->sortable(),
				amis()->TableColumn('order_id', '订单编号'),
				amis()->TableColumn('wallet_id', '钱包编号'),
				amis()->TableColumn('trans_record_id', '交易记录编号'),
				amis()->TableColumn('payment_no', '交易单号'),
				amis()->TableColumn('payment_method', '支付方式'),
				amis()->TableColumn('total_amount', '合计支付金额'),
				amis()->TableColumn('actual_amount', '实际支付金额'),
				amis()->TableColumn('used_wallet_balance', '使用钱包余额'),
				amis()->TableColumn('used_recharge_balance', '使用充值余额'),
				amis()->TableColumn('payment_time', '支付时间'),
				amis()->TableColumn('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('order_id', '订单编号'),
			amis()->TextControl('wallet_id', '钱包编号'),
			amis()->TextControl('trans_record_id', '交易记录编号'),
			amis()->TextControl('payment_no', '交易单号'),
			amis()->TextControl('payment_method', '支付方式'),
			amis()->TextControl('total_amount', '合计支付金额'),
			amis()->TextControl('actual_amount', '实际支付金额'),
			amis()->TextControl('used_wallet_balance', '使用钱包余额'),
			amis()->TextControl('used_recharge_balance', '使用充值余额'),
			amis()->TextControl('payment_time', '支付时间'),
			amis()->TextControl('remark', '备注'),
			amis()->TextControl('state', '状态'),
		]);
	}

	public function detail()
	{
		return $this->baseDetail()->body([
			amis()->TextControl('id', 'ID')->static(),
			amis()->TextControl('order_id', '订单编号')->static(),
			amis()->TextControl('wallet_id', '钱包编号')->static(),
			amis()->TextControl('trans_record_id', '交易记录编号')->static(),
			amis()->TextControl('payment_no', '交易单号')->static(),
			amis()->TextControl('payment_method', '支付方式')->static(),
			amis()->TextControl('total_amount', '合计支付金额')->static(),
			amis()->TextControl('actual_amount', '实际支付金额')->static(),
			amis()->TextControl('used_wallet_balance', '使用钱包余额')->static(),
			amis()->TextControl('used_recharge_balance', '使用充值余额')->static(),
			amis()->TextControl('payment_time', '支付时间')->static(),
			amis()->TextControl('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(),
		]);
	}
}