import { Checkbox, Divider, Group, Text } from '@mantine/core' import _ from 'lodash' import Image from 'rc-image' import { formatCurrencyIDR } from '~/core/utils/currency' import { formatDateText, formatDateTime } from '~/core/utils/date' import classes from '../modal.module.css' interface ItemProps { item: T content: ContentDetailType } type ContentDetailType = { title: string key: string type: ItemType } export enum ItemType { string, boolean, date, number, currency, date_time, html, image, } export default function ModalItemDetail({ item, content }: ItemProps) { const { title, key, type } = content const data = _.get(item, key, '-') return ( <> {title} : {type === ItemType.date && ( // @ts-ignore {formatDateText(data)} )} {type === ItemType.date_time && ( // @ts-ignore {formatDateTime(data)} )} {type === ItemType.currency && ( // @ts-ignore {formatCurrencyIDR(data)} )} {type === ItemType.string && ( // @ts-ignore {data} )} {type === ItemType.boolean && ( // @ts-ignore )} {type === ItemType.image && ( // @ts-ignore {'image'} )} {type === ItemType.html && ( // @ts-ignore
)} ) }