import { formatIDR } from '@/utils' import { HiClipboardDocumentList, HiShare } from 'react-icons/hi2' import { toast } from 'react-toastify' import { toastSuccess } from '../utils' export default function VoucherCard(props) { const { item: { share_word, additional_info_json }, } = props const sale_item = JSON.parse(additional_info_json) const voucher = sale_item?.voucher const handleShare = () => { if (navigator.canShare) { navigator.share({ title: share_word, text: share_word, }) return } navigator.clipboard.writeText(share_word) toastSuccess('copied to clipboard') return } const handleCopyToClipboard = (text) => { toastSuccess('copied to clipboard') navigator.clipboard.writeText(text) } return (
{voucher.location_profile.location.name}
{voucher.location_profile.display_note}
Rp {formatIDR(voucher.validate_price)}
{+voucher.discount !== 0 && (
{voucher.discount}%
{formatIDR(voucher.validate_display_price)}
)}
{voucher.location_profile.quota}
{voucher.location_profile.display_expired}
Kode :
{voucher.username}
handleCopyToClipboard(voucher.username) } >
handleShare()} >
Share
) }