summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-04-03 10:52:08 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-04-03 10:52:08 +0700
commit596c019af400cc21d2890f875a7570f044866210 (patch)
treebab1e9640194c03f2df1daee5f81b86048c6b508 /src
parent028d3a21b17ea56f959c2a42b97353ef58e3eac4 (diff)
fix price display in checkout
Diffstat (limited to 'src')
-rw-r--r--src/lib/transaction/components/Transaction.jsx35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx
index 51c89b28..e992580a 100644
--- a/src/lib/transaction/components/Transaction.jsx
+++ b/src/lib/transaction/components/Transaction.jsx
@@ -103,14 +103,14 @@ const Transaction = ({ id }) => {
<p className='text-gray_r-12/70'>Total Diskon</p>
<p>{currencyFormat(-totalDiscountAmount)}</p>
</div>
+ <div className='flex justify-between mt-1'>
+ <p className='text-gray_r-12/70'>PPN 11%</p>
+ <p>{currencyFormat(transaction.data?.amountTax)}</p>
+ </div>
<div className='flex justify-between mt-1 font-medium'>
<p>Total Belanja</p>
<p>{currencyFormat(transaction.data?.amountTotal)}</p>
</div>
- <div className='flex justify-between mt-1'>
- <p className='text-gray_r-12/70'>PPN 11% (Incl.)</p>
- <p>{currencyFormat(totalAmount * 0.11)}</p>
- </div>
</div>
),
[transaction.data, totalAmount, totalDiscountAmount]
@@ -144,7 +144,11 @@ const Transaction = ({ id }) => {
>
Ya, Batalkan
</button>
- <button className='btn-light w-full md:w-fit' type='button' onClick={closeCancelTransaction}>
+ <button
+ className='btn-light w-full md:w-fit'
+ type='button'
+ onClick={closeCancelTransaction}
+ >
Batal
</button>
</div>
@@ -392,35 +396,42 @@ const Transaction = ({ id }) => {
</div>
</td>
<td>{product.quantity}</td>
- <td>{currencyFormat(product.price.price)}</td>
+ <td>
+ {product.price.discountPercentage > 0 && (
+ <div className='line-through mb-1 text-caption-1 text-gray_r-12/70'>
+ {currencyFormat(product.price.price)}
+ </div>
+ )}
+ <div>{currencyFormat(product.price.priceDiscount)}</div>
+ </td>
<td>
{product.price.discountPercentage > 0
? `${product.price.discountPercentage}%`
: ''}
</td>
- <td>{currencyFormat(product.price.priceDiscount * product.quantity)}</td>
+ <td>{currencyFormat(product.price.subtotal)}</td>
</tr>
))}
</tbody>
</table>
<div className='flex justify-end mt-4'>
- <div className='w-1/4 grid grid-cols-2 gap-y-2 text-gray_r-12/80'>
+ <div className='w-1/4 grid grid-cols-2 gap-y-3 text-gray_r-12/80'>
<div className='text-right'>Subtotal</div>
<div className='text-right font-medium'>{currencyFormat(totalAmount)}</div>
<div className='text-right'>Total Diskon</div>
- <div className='text-right font-medium'>
+ <div className='text-right font-medium text-red_r-11'>
{currencyFormat(-totalDiscountAmount)}
</div>
+ <div className='text-right'>PPN 11%</div>
+ <div className='text-right font-medium'>{currencyFormat(transaction.data?.amountTax)}</div>
+
<div className='text-right'>Grand Total</div>
<div className='text-right font-medium text-gray_r-12'>
{currencyFormat(transaction.data?.amountTotal)}
</div>
-
- <div className='text-right'>PPN 11% (Incl.)</div>
- <div className='text-right font-medium'>{currencyFormat(totalAmount * 0.11)}</div>
</div>
</div>