feat: unify currency display to toman across the application
This commit is contained in:
@@ -6,6 +6,7 @@ import { removeToken } from "@/utils";
|
||||
import { cookies } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
import { fetchReq } from "@/lib/req";
|
||||
import { rialToToman } from "@/lib/money";
|
||||
import { safeJsonParse } from "@/lib/sanitize";
|
||||
import { buildPatientUser } from "@/lib/representationAdapters";
|
||||
import { getServerAccessToken } from "@/lib/serverToken";
|
||||
@@ -44,7 +45,7 @@ export default async function Dashboard({ searchParams }) {
|
||||
const totalRials = payments
|
||||
.filter((p) => p.status === "success")
|
||||
.reduce((sum, p) => sum + (Number(p.amount_rials) || 0), 0);
|
||||
const totalTransactions = Math.round(totalRials / 10); // ریال → تومان
|
||||
const totalTransactions = rialToToman(totalRials); // ریال → تومان
|
||||
|
||||
const extras = {
|
||||
mobile: userInfo?.mobile_number ?? "",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { request } from "@/services/response";
|
||||
import { formatToman } from "@/lib/money";
|
||||
import Cookies from "js-cookie";
|
||||
import Layout from "@/components/layout";
|
||||
|
||||
@@ -95,9 +96,7 @@ export default function PaymentDetailsPage() {
|
||||
}).format(date);
|
||||
};
|
||||
|
||||
const formatAmount = (rials) => {
|
||||
return new Intl.NumberFormat("fa-IR").format(parseInt(rials));
|
||||
};
|
||||
const formatAmount = (rials) => formatToman(rials);
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
@@ -153,7 +152,7 @@ export default function PaymentDetailsPage() {
|
||||
<div className="flex justify-between items-center py-3 border-b border-gray-100">
|
||||
<span className="text-[#616161] font-medium">مبلغ:</span>
|
||||
<span className="text-[#3B3B3B] font-bold text-lg">
|
||||
{formatAmount(payment.amount_rials)} ریال
|
||||
{formatAmount(payment.amount_rials)} تومان
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user