import React from 'react';
import Taro from '@tarojs/taro';
import { View, Text } from '@tarojs/components';
import { Cell, Button } from '@antmjs/vantui';
import style from './style.module.less';

export default (props) => {
  const { detail, onClick } = props;

  const handleClick = (e) => {
    if (onClick) {
      onClick(e)
    }
  }
  
  return (
    <View className={style['check-card-wrapper']}>
      <Cell
        renderTitle={(
          <View className={style['check-card-title']}>
            <View>{detail?.title}</View>
            <View className={style['check-card-subtitle']}>
              <View>{detail?.startDate}</View>
              <View>{detail?.endDate}</View>
            </View>
          </View>
        )}
        renderLabel={(
          <View className={style['check-card-actions']}>
            <View>
              <Button
                plain
                type="primary"
                icon="location-o"
                onClick={() => handleClick('loc')}
              >实地测评</Button>
            </View>
            <View>
              <Button
                plain
                type="primary"
                icon="orders-o"
                onClick={() => handleClick('survey')}
              >调查问卷</Button>
            </View>
          </View>
        )}
      />
    </View>
  )
}
