Sum format function

This commit is contained in:
ariari04 2024-09-18 17:17:17 +06:00
parent 3fecbcd880
commit f7a1bef554
3 changed files with 8 additions and 13 deletions

11
package-lock.json generated
View File

@ -18,7 +18,6 @@
"react": "^18", "react": "^18",
"react-dom": "^18", "react-dom": "^18",
"react-hook-form": "^7.52.2", "react-hook-form": "^7.52.2",
"react-number-format": "^5.4.2",
"react-toastify": "^10.0.5", "react-toastify": "^10.0.5",
"sass": "^1.77.8", "sass": "^1.77.8",
"tailwind-merge": "^2.5.2", "tailwind-merge": "^2.5.2",
@ -4226,16 +4225,6 @@
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
"dev": true "dev": true
}, },
"node_modules/react-number-format": {
"version": "5.4.2",
"resolved": "https://registry.npmjs.org/react-number-format/-/react-number-format-5.4.2.tgz",
"integrity": "sha512-cg//jVdS49PYDgmcYoBnMMHl4XNTMuV723ZnHD2aXYtWWWqbVF3hjQ8iB+UZEuXapLbeA8P8H+1o6ZB1lcw3vg==",
"license": "MIT",
"peerDependencies": {
"react": "^0.14 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^0.14 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0"
}
},
"node_modules/react-toastify": { "node_modules/react-toastify": {
"version": "10.0.5", "version": "10.0.5",
"resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-10.0.5.tgz", "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-10.0.5.tgz",

View File

@ -19,7 +19,6 @@
"react": "^18", "react": "^18",
"react-dom": "^18", "react-dom": "^18",
"react-hook-form": "^7.52.2", "react-hook-form": "^7.52.2",
"react-number-format": "^5.4.2",
"react-toastify": "^10.0.5", "react-toastify": "^10.0.5",
"sass": "^1.77.8", "sass": "^1.77.8",
"tailwind-merge": "^2.5.2", "tailwind-merge": "^2.5.2",

View File

@ -30,6 +30,12 @@ const TenderCard: React.FC<Props> = ({
plan_summ_decimal, plan_summ_decimal,
address_of_organization, address_of_organization,
}: Props) => { }: Props) => {
function formatNumber(value: string) {
return new Intl.NumberFormat("ru-RU", {
style: "decimal",
useGrouping: true,
}).format(parseInt(value));
}
return ( return (
<div className="w-full min-h-[213px] bg-white shadow-sm rounded-sm flex gap-[82px] items-center p-6"> <div className="w-full min-h-[213px] bg-white shadow-sm rounded-sm flex gap-[82px] items-center p-6">
<div className="w-[830px] flex flex-col"> <div className="w-[830px] flex flex-col">
@ -51,9 +57,10 @@ const TenderCard: React.FC<Props> = ({
<div className="w-[290px]"> <div className="w-[290px]">
<p className="text-[14px] leading-6 mb-[6px]">Планируемая сумма</p> <p className="text-[14px] leading-6 mb-[6px]">Планируемая сумма</p>
<Title <Title
text={`${parseInt(plan_summ_decimal)} сом`} text={`${formatNumber(plan_summ_decimal)} сом`}
className="font-extrabold text-[24px] leading-[38px] mb-4" className="font-extrabold text-[24px] leading-[38px] mb-4"
/> />
<p className="text-[14px] leading-6 mb-4"> <p className="text-[14px] leading-6 mb-4">
Окончание приема заявок: {date_of_offer_datetime.slice(0, 10)} Окончание приема заявок: {date_of_offer_datetime.slice(0, 10)}
</p> </p>