Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/app/api/store/[slug]/orders/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ function generateOrderNumber(): string {
* Format currency for display
*/
function formatCurrency(amount: number, currency: string = 'BDT'): string {
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency,
return 'BDT ' + new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
}).format(amount);
}

Expand Down
4 changes: 1 addition & 3 deletions src/components/analytics-dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ export function AnalyticsDashboard({ storeId, dateRange }: AnalyticsDashboardPro

// Format currency
const formatCurrency = (amount: number) => {
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'BDT',
return 'BDT ' + new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
}).format(amount);
Expand Down
6 changes: 3 additions & 3 deletions src/components/analytics/analytics-dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ export function AnalyticsDashboard({ storeId: propStoreId }: AnalyticsDashboardP
}, [timeRange, storeId]);

const formatCurrency = (value: number) => {
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'BDT',
return 'BDT ' + new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
}).format(value);
};

Expand Down
6 changes: 3 additions & 3 deletions src/components/analytics/customer-metrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ export function CustomerMetrics({ storeId, timeRange }: CustomerMetricsProps) {

const formatCurrency = (value: number | undefined | null) => {
if (value === null || value === undefined) return 'BDT 0.00';
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'BDT',
return 'BDT ' + new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
}).format(value);
};

Expand Down
5 changes: 2 additions & 3 deletions src/components/analytics/revenue-chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,9 @@ export function RevenueChart({ storeId, timeRange }: RevenueChartProps) {
}

const formatCurrency = (value: number) => {
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'BDT',
return 'BDT ' + new Intl.NumberFormat('en-US', {
minimumFractionDigits: 0,
maximumFractionDigits: 0,
}).format(value);
};

Expand Down
5 changes: 2 additions & 3 deletions src/components/analytics/top-products-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ export function TopProductsTable({ storeId, timeRange }: TopProductsTableProps)
}, [storeId, timeRange]);

const formatCurrency = (value: number) => {
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'BDT',
return 'BDT ' + new Intl.NumberFormat('en-US', {
minimumFractionDigits: 0,
maximumFractionDigits: 0,
}).format(value);
};

Expand Down
6 changes: 3 additions & 3 deletions src/components/customers/customer-detail-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ export function CustomerDetailDialog({
onOpenChange,
}: CustomerDetailDialogProps) {
const formatCurrency = (value: number) => {
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'BDT',
return 'BDT ' + new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
}).format(value);
};

Expand Down
6 changes: 3 additions & 3 deletions src/components/customers/customers-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ export function CustomersList({ storeId }: CustomersListProps) {
};

const formatCurrency = (value: number) => {
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'BDT',
return 'BDT ' + new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
}).format(value);
};

Expand Down
6 changes: 3 additions & 3 deletions src/components/order-detail-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,9 @@ export function OrderDetailClient({ orderId, storeId }: OrderDetailClientProps)

// Format currency
const formatCurrency = (amount: number) => {
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'BDT',
return 'BDT ' + new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
}).format(amount);
};

Expand Down
6 changes: 3 additions & 3 deletions src/components/orders-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ const paymentStatusColors: Record<string, string> = {

// Format currency
const formatCurrency = (amount: number) => {
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'BDT',
return 'BDT ' + new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
}).format(amount);
};

Expand Down
5 changes: 4 additions & 1 deletion src/components/orders/refund-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ export function RefundDialog({

const refundableBalance = totalAmount - refundedAmount;
const formatCurrency = (amount: number) =>
new Intl.NumberFormat('en-US', { style: 'currency', currency: 'BDT' }).format(amount);
'BDT ' + new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2,
maximumFractionDigits: 2
}).format(amount);

const handleRefund = async () => {
setError('');
Expand Down
8 changes: 2 additions & 6 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ export function formatCurrency(
currency: string = "BDT",
locale: string = "en-US"
): string {
return new Intl.NumberFormat(locale, {
style: "currency",
currency,
return currency + ' ' + new Intl.NumberFormat(locale, {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
}).format(amount / 100); // Assuming amounts are stored in paisa
Expand All @@ -35,9 +33,7 @@ export function formatCurrencyFromTaka(
currency: string = "BDT",
locale: string = "en-US"
): string {
return new Intl.NumberFormat(locale, {
style: "currency",
currency,
return currency + ' ' + new Intl.NumberFormat(locale, {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
}).format(amount);
Expand Down