use format VND instead of inline formating
Browse files
components/shop/CheckoutModal.tsx
CHANGED
|
@@ -20,6 +20,7 @@ import { useSession } from "next-auth/react";
|
|
| 20 |
import { useCartStore } from "@/store/cart-store";
|
| 21 |
import { api } from "@/lib/api/api";
|
| 22 |
import { toast } from "@/lib/toast";
|
|
|
|
| 23 |
import {
|
| 24 |
generateVietQRUrl,
|
| 25 |
getBankByCode,
|
|
@@ -297,7 +298,7 @@ export default function CheckoutModal({
|
|
| 297 |
<div className="p-4 bg-default-50 rounded-lg">
|
| 298 |
<div className="flex justify-between font-semibold">
|
| 299 |
<span>Tổng tiền</span>
|
| 300 |
-
<span>{total()
|
| 301 |
</div>
|
| 302 |
{currentVendorName && (
|
| 303 |
<p className="text-sm text-default-500 mt-1">
|
|
@@ -386,7 +387,7 @@ export default function CheckoutModal({
|
|
| 386 |
Quét mã QR để thanh toán
|
| 387 |
</p>
|
| 388 |
<p className="text-2xl font-bold text-primary">
|
| 389 |
-
{total()
|
| 390 |
</p>
|
| 391 |
</div>
|
| 392 |
|
|
|
|
| 20 |
import { useCartStore } from "@/store/cart-store";
|
| 21 |
import { api } from "@/lib/api/api";
|
| 22 |
import { toast } from "@/lib/toast";
|
| 23 |
+
import { formatVND } from "@/lib/format";
|
| 24 |
import {
|
| 25 |
generateVietQRUrl,
|
| 26 |
getBankByCode,
|
|
|
|
| 298 |
<div className="p-4 bg-default-50 rounded-lg">
|
| 299 |
<div className="flex justify-between font-semibold">
|
| 300 |
<span>Tổng tiền</span>
|
| 301 |
+
<span>{formatVND(total())}</span>
|
| 302 |
</div>
|
| 303 |
{currentVendorName && (
|
| 304 |
<p className="text-sm text-default-500 mt-1">
|
|
|
|
| 387 |
Quét mã QR để thanh toán
|
| 388 |
</p>
|
| 389 |
<p className="text-2xl font-bold text-primary">
|
| 390 |
+
{formatVND(total())}
|
| 391 |
</p>
|
| 392 |
</div>
|
| 393 |
|
components/vendor/OrderDetailsModal.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import { useState, useEffect } from "react";
|
|
| 15 |
|
| 16 |
import { api } from "@/lib/api/api";
|
| 17 |
import { toast } from "@/lib/toast";
|
|
|
|
| 18 |
|
| 19 |
interface OrderItem {
|
| 20 |
id: string;
|
|
@@ -205,20 +206,17 @@ function OrderDetailsContent({
|
|
| 205 |
)}
|
| 206 |
<p className="text-sm text-default-400">
|
| 207 |
SL: {item.quantity} x{" "}
|
| 208 |
-
{
|
| 209 |
</p>
|
| 210 |
</div>
|
| 211 |
<p className="font-semibold">
|
| 212 |
-
{(Number(item.price) * item.quantity)
|
| 213 |
-
"vi-VN",
|
| 214 |
-
)}
|
| 215 |
-
₫
|
| 216 |
</p>
|
| 217 |
</div>
|
| 218 |
))}
|
| 219 |
<div className="p-3 bg-default-50 flex justify-between items-center font-bold">
|
| 220 |
<span>Tổng cộng</span>
|
| 221 |
-
<span>{
|
| 222 |
</div>
|
| 223 |
</div>
|
| 224 |
</div>
|
|
|
|
| 15 |
|
| 16 |
import { api } from "@/lib/api/api";
|
| 17 |
import { toast } from "@/lib/toast";
|
| 18 |
+
import { formatVND } from "@/lib/format";
|
| 19 |
|
| 20 |
interface OrderItem {
|
| 21 |
id: string;
|
|
|
|
| 206 |
)}
|
| 207 |
<p className="text-sm text-default-400">
|
| 208 |
SL: {item.quantity} x{" "}
|
| 209 |
+
{formatVND(item.price)}
|
| 210 |
</p>
|
| 211 |
</div>
|
| 212 |
<p className="font-semibold">
|
| 213 |
+
{formatVND(Number(item.price) * item.quantity)}
|
|
|
|
|
|
|
|
|
|
| 214 |
</p>
|
| 215 |
</div>
|
| 216 |
))}
|
| 217 |
<div className="p-3 bg-default-50 flex justify-between items-center font-bold">
|
| 218 |
<span>Tổng cộng</span>
|
| 219 |
+
<span>{formatVND(order.total)}</span>
|
| 220 |
</div>
|
| 221 |
</div>
|
| 222 |
</div>
|
components/vendor/VendorOrdersPage.tsx
CHANGED
|
@@ -17,6 +17,7 @@ import { Eye, ListOrdered, RefreshCw } from "lucide-react";
|
|
| 17 |
import { useState, useEffect, useCallback } from "react";
|
| 18 |
|
| 19 |
import { api } from "@/lib/api/api";
|
|
|
|
| 20 |
import OrderDetailsModal from "@/components/vendor/OrderDetailsModal";
|
| 21 |
|
| 22 |
interface PaginationInfo {
|
|
@@ -172,7 +173,7 @@ export default function VendorOrdersPage() {
|
|
| 172 |
</Chip>
|
| 173 |
</TableCell>
|
| 174 |
<TableCell>
|
| 175 |
-
{
|
| 176 |
</TableCell>
|
| 177 |
<TableCell>
|
| 178 |
<div className="flex justify-end">
|
|
|
|
| 17 |
import { useState, useEffect, useCallback } from "react";
|
| 18 |
|
| 19 |
import { api } from "@/lib/api/api";
|
| 20 |
+
import { formatVND } from "@/lib/format";
|
| 21 |
import OrderDetailsModal from "@/components/vendor/OrderDetailsModal";
|
| 22 |
|
| 23 |
interface PaginationInfo {
|
|
|
|
| 173 |
</Chip>
|
| 174 |
</TableCell>
|
| 175 |
<TableCell>
|
| 176 |
+
{formatVND(order.total)}
|
| 177 |
</TableCell>
|
| 178 |
<TableCell>
|
| 179 |
<div className="flex justify-end">
|