import { MyBetaModalFormProps, renderTextHelper } from '@/common';
import { RefundsTypeEnum } from '@/gen/Enums';
import BIllInfo from '@/pages/bills/house_bills/modals/BIllInfo';

import { ProCard, ProDescriptions } from '@ant-design/pro-components';
import { useNavigate } from '@umijs/max';
import { Form, Space } from 'antd';

export default function Update(props: MyBetaModalFormProps) {
  const [form] = Form.useForm();
  const navigate = useNavigate();

  return (
    <>
      <Space direction="vertical" style={{ width: '100%' }}>
        <ProCard title="基本信息" size="small">
          <ProDescriptions size="small" column={2}>
            <ProDescriptions.Item label="申请事项" span={2}>
              {props?.item?.title || '-'}
            </ProDescriptions.Item>
            <ProDescriptions.Item label="账单类型">
              <renderTextHelper.Tag
                Enums={RefundsTypeEnum}
                value={props?.item?.model?.type}
              />
            </ProDescriptions.Item>
            <ProDescriptions.Item label="退款金额">
              <Space>
                {props?.item?.model?.refund_amount &&
                props?.item?.model?.refund_amount !== '-'
                  ? (
                      parseFloat(props?.item?.model?.refund_amount) / 100
                    ).toFixed(2)
                  : '-'}
                元
                <BIllInfo
                  item={{
                    id: props?.item?.model?.refundable_id,
                    type: 'link',
                  }}
                  title="查看账单"
                />
              </Space>
            </ProDescriptions.Item>
            <ProDescriptions.Item label="付款信息" span={2}>
              {props?.item?.model?.payer_name || '-'}｜
              {props?.item?.model?.payer_bank || '-'}｜
              {props?.item?.model?.payer_account || '-'}
            </ProDescriptions.Item>
            <ProDescriptions.Item label="收款信息" span={2}>
              {props?.item?.model?.payee_name || '-'}
              {props?.item?.model?.payee_bank || '-'}
              {props?.item?.model?.payee_account || '-'}
            </ProDescriptions.Item>

            <ProDescriptions.Item label="申请时间">
              {props?.item?.created_at || '-'}
            </ProDescriptions.Item>
          </ProDescriptions>
        </ProCard>
      </Space>
    </>
  );
}
