fix price

This commit is contained in:
hamid zarghami
2025-12-17 11:20:23 +03:30
parent ffe9348640
commit ecda73e63c
4 changed files with 33 additions and 28 deletions
@@ -47,7 +47,7 @@ const CartItemsList = () => {
} }
return ( return (
<div className='flex-1 space-y-4 pb-6'> <div className='flex-1 space-y-4'>
{cartFoods.map((food) => ( {cartFoods.map((food) => (
<MenuItemRenderer key={food.id}> <MenuItemRenderer key={food.id}>
<MenuItem food={food} /> <MenuItem food={food} />
@@ -52,7 +52,7 @@ const CartSummary = ({ description = '', onDescriptionChange }: CartSummaryProps
return ( return (
<> <>
<div> <div className='mt-2'>
<div className='relative'> <div className='relative'>
<h3 className='text-sm'>{t('InputDescription.Label')}</h3> <h3 className='text-sm'>{t('InputDescription.Label')}</h3>
<textarea <textarea
@@ -67,32 +67,36 @@ const CartSummary = ({ description = '', onDescriptionChange }: CartSummaryProps
</div> </div>
</div> </div>
<div className='flex flex-col gap-4 pb-24'> <div
<div>
<div className='text-sm font-semibold'>
{`جمع خرید: ${formatPrice(totalPrice)} تومان`}
</div>
</div>
</div>
<Link
href={'order/checkout/0'}
onClick={(event) => {
if (isCartEmpty) {
event.preventDefault();
return;
}
if (!isSuccess) {
event.preventDefault();
const redirectUrl = encodeURIComponent(pathname);
router.push(`/${name}/auth?redirect=${redirectUrl}`);
return;
}
}}
className={`fixed bottom-0 left-0 right-0 z-50 bg-white border-t border-border p-4 w-full ${isCartEmpty ? 'pointer-events-none opacity-60' : ''}`} className={`fixed bottom-0 left-0 right-0 z-50 bg-white border-t border-border p-4 w-full ${isCartEmpty ? 'pointer-events-none opacity-60' : ''}`}
> >
<Button className='w-full! px-4' disabled={isCartEmpty}>{t('ButtonCheckout')}</Button> <div className='flex justify-between items-center gap-4'>
</Link>
<div className='flex flex-col'>
<div className='text-xs text-gray-400'>{t('PayableAmountLabel')}</div>
<div className='text-sm mt-2 font-semibold'>{formatPrice(totalPrice)} تومان</div>
</div>
<Link
href={'order/checkout/0'}
onClick={(event) => {
if (isCartEmpty) {
event.preventDefault();
return;
}
if (!isSuccess) {
event.preventDefault();
const redirectUrl = encodeURIComponent(pathname);
router.push(`/${name}/auth?redirect=${redirectUrl}`);
return;
}
}}
>
<Button className='w-fit! px-6' disabled={isCartEmpty}>{t('ButtonCheckout')}</Button>
</Link>
</div>
</div>
{/* {!isCartEmpty && ( {/* {!isCartEmpty && (
<div className='flex items-center justify-between rounded-xl border border-border px-4 py-3 text-xs text-muted-foreground'> <div className='flex items-center justify-between rounded-xl border border-border px-4 py-3 text-xs text-muted-foreground'>
+1 -1
View File
@@ -47,7 +47,7 @@ const CartIndex = () => {
/> />
</div> </div>
<div className='flex overflow-y-auto noscrollbar flex-col h-full pt-4 gap-6' dir='rtl'> <div className='flex overflow-y-auto noscrollbar flex-col h-full pt-4 gap-4 pb-24' dir='rtl'>
<CartItemsList /> <CartItemsList />
<CartSummary description={description} onDescriptionChange={setDescription} /> <CartSummary description={description} onDescriptionChange={setDescription} />
</div> </div>
+2 -1
View File
@@ -22,7 +22,8 @@
}, },
"SumOfItemsLabel": "جمع خرید:", "SumOfItemsLabel": "جمع خرید:",
"SumOfItemsValue": "{price} تومان", "SumOfItemsValue": "{price} تومان",
"ButtonCheckout": "مشاهده فاکتور و پرداخت" "ButtonCheckout": "ادامه خرید",
"PayableAmountLabel": "مبلغ قابل پرداخت"
}, },
"OrderDetail": { "OrderDetail": {
"Heading": "ثبت نهایی", "Heading": "ثبت نهایی",