You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
2.1 KiB
React
51 lines
2.1 KiB
React
1 year ago
|
import { formatIDR } from '@/utils'
|
||
1 year ago
|
import { router } from '@inertiajs/react'
|
||
1 year ago
|
|
||
|
export default function VoucherCard({ voucher }) {
|
||
1 year ago
|
const addCart = () => {
|
||
|
router.post(route('cart.store', voucher))
|
||
|
}
|
||
1 year ago
|
return (
|
||
1 year ago
|
<div
|
||
|
className="px-3 py-1 shadow-md rounded border border-gray-100 hover:bg-gray-50"
|
||
|
onClick={addCart}
|
||
|
>
|
||
1 year ago
|
<div className="w-full flex flex-row justify-between">
|
||
|
<div className="text-base font-bold">
|
||
1 year ago
|
{voucher.location_profile.location.name}
|
||
1 year ago
|
</div>
|
||
|
<div className="text-sm text-gray-500"></div>
|
||
|
</div>
|
||
1 year ago
|
<div className="w-full border border-dashed"></div>
|
||
|
<div className="flex flex-row justify-between items-center">
|
||
|
<div>
|
||
|
<div className="text-xs text-gray-400 py-1">
|
||
1 year ago
|
{voucher.location_profile.display_note}
|
||
1 year ago
|
</div>
|
||
|
<div className="text-xl font-bold">
|
||
1 year ago
|
IDR {formatIDR(voucher.validate_price)}
|
||
1 year ago
|
</div>
|
||
|
{+voucher.discount !== 0 && (
|
||
|
<div className="flex flex-row space-x-2 items-center text-xs pb-2">
|
||
|
<div className="bg-red-300 text-red-600 px-1 py-0.5 font-bold rounded">
|
||
|
{voucher.discount}%
|
||
|
</div>
|
||
|
<div className="text-gray-400 line-through">
|
||
1 year ago
|
{formatIDR(voucher.validate_display_price)}
|
||
1 year ago
|
</div>
|
||
|
</div>
|
||
|
)}
|
||
|
</div>
|
||
1 year ago
|
<div className="flex flex-col justify-end text-right">
|
||
1 year ago
|
<div className="text-3xl font-bold">
|
||
1 year ago
|
{voucher.location_profile.quota}
|
||
1 year ago
|
</div>
|
||
1 year ago
|
<div className="text-gray-400 ">
|
||
1 year ago
|
{voucher.location_profile.diplay_expired}
|
||
1 year ago
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
)
|
||
|
}
|