Создание заказов

This commit is contained in:
Халимов Рустам
2026-03-08 00:55:59 +03:00
parent 612aebbce2
commit 878934e705
14 changed files with 1820 additions and 41 deletions
+26
View File
@@ -0,0 +1,26 @@
/**
* Форматирует цену с разделением разрядов пробелом (русский стандарт).
* Пример: 400000 → "400 000 ₽"
*/
export function formatPrice(amount: number, type?: number | string): string {
if (type === 2 || type === "Negotiable") return "Договорная"
const formatted = amount.toLocaleString("ru-RU", {
maximumFractionDigits: 0,
useGrouping: true,
})
const suffix = (type === 1 || type === "Hourly") ? "/час" : ""
return `${formatted}${suffix}`
}
/**
* Форматирует число с разделением разрядов пробелом.
* Пример: 400000 → "400 000"
*/
export function formatNumber(amount: number): string {
return amount.toLocaleString("ru-RU", {
maximumFractionDigits: 0,
useGrouping: true,
})
}