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

export default function SummaryInfo(props: MyBetaModalFormProps) {
  const navigate = useNavigate();
  const totalPayableSum = props?.item?.total_payable_sum;

  return (
    <ProCard>
      <ProDescriptions>
        <ProDescriptions.Item label="应收金额">
          <Space>
            {totalPayableSum ? `¥${totalPayableSum}` : ''}
            {totalPayableSum ? (
              <MyButtons.View
                title="查看账单"
                size="small"
                type="link"
                onClick={() => {
                  navigate(`/bills/summary/show/${props?.item?.id || 0}`);
                }}
              />
            ) : (
              '无账单'
            )}
          </Space>
        </ProDescriptions.Item>
      </ProDescriptions>
    </ProCard>
  );
}
