import { MyBetaModalFormProps, renderTextHelper } from '@/common';
import { showTime } from '@/common/utils/day';
import {
  ContractsContractNatureEnum,
  ContractsSettlementModeEnum,
  ContractsStatusEnum,
  ContractTemplatesIncomeExpenseTypeEnum,
} from '@/gen/Enums';
import { ProCard, ProDescriptions } from '@ant-design/pro-components';
import { Space } from 'antd';

export default function ContractsInfo(props: MyBetaModalFormProps) {
  return (
    <Space direction="vertical" size="large" style={{ width: '100%' }}>
      <ProCard title="原合同信息">
        <ProDescriptions bordered column={3} size="small">
          <ProDescriptions.Item label="状态">
            <renderTextHelper.Tag
              Enums={ContractsStatusEnum}
              value={props?.item?.status}
              isColor
              key="status"
            />
          </ProDescriptions.Item>
          <ProDescriptions.Item label="合同名称">
            {props?.item?.name}
          </ProDescriptions.Item>
          <ProDescriptions.Item label="合同编号">
            {props?.item?.code}
          </ProDescriptions.Item>
          <ProDescriptions.Item label="合同性质">
            <renderTextHelper.Tag
              Enums={ContractsContractNatureEnum}
              value={props?.item?.contract_nature}
              key="contract_nature"
            />
          </ProDescriptions.Item>
          <ProDescriptions.Item label="合同类型">
            {props?.item?.contract_type_name}
          </ProDescriptions.Item>
          <ProDescriptions.Item label="收支类型">
            <renderTextHelper.Tag
              Enums={ContractTemplatesIncomeExpenseTypeEnum}
              value={props?.item?.income_expense_type}
              isColor
              key="income_expense_type"
            />
          </ProDescriptions.Item>
          <ProDescriptions.Item label="结算模式">
            <renderTextHelper.Tag
              Enums={ContractsSettlementModeEnum}
              value={props?.item?.settlement_mode}
              key="settlement_mode"
            />
          </ProDescriptions.Item>
          <ProDescriptions.Item label="合同总金额">
            ¥{props?.item?.total_amount}
          </ProDescriptions.Item>
          <ProDescriptions.Item label="合同有效期">
            <Space>
              {showTime(props?.item?.start_time, 10)}至
              {showTime(props?.item?.end_time, 10)}
            </Space>
          </ProDescriptions.Item>
          <ProDescriptions.Item label="账单金额">
            ¥{props?.item?.total_bill_amount}
          </ProDescriptions.Item>
          <ProDescriptions.Item label="已收金额">
            ¥{props?.item?.total_income_amount}
          </ProDescriptions.Item>
          <ProDescriptions.Item label="已付金额">
            ¥{props?.item?.total_expense_amount}
          </ProDescriptions.Item>
          <ProDescriptions.Item label="是否有保证金">
            {props?.item?.is_deposit ? '是' : '否'}
          </ProDescriptions.Item>
          <ProDescriptions.Item label="保证金金额">
            ¥{props?.item?.deposit_amount || '-'}
          </ProDescriptions.Item>
          <ProDescriptions.Item label="签约主体">
            {props?.item?.sign_subject}
          </ProDescriptions.Item>
          <ProDescriptions.Item label="关联项目">
            {props?.item?.project_name || '-'}
          </ProDescriptions.Item>
          {/* <ProDescriptions.Item label="签约部门">
            {props?.item?.sign_department || '-'}
          </ProDescriptions.Item> */}
          <ProDescriptions.Item label="合同对接人">
            {props?.item?.contract_liaison || '-'}
          </ProDescriptions.Item>
          <ProDescriptions.Item label="合同份数">
            {props?.item?.number_contract_copies || '-'}份
          </ProDescriptions.Item>

          <ProDescriptions.Item label="交易方" span={3}>
            {props?.item?.contract_peoples?.map((item: any, index: number) => (
              <div key={index}>{item.counterparty}</div>
            )) || '-'}
          </ProDescriptions.Item>
        </ProDescriptions>
      </ProCard>
    </Space>
  );
}
