Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a186db08e2 | ||
|
|
958f29b685 |
+5
-10
@@ -1,5 +1,10 @@
|
|||||||
import { User } from "@/types/user";
|
import { User } from "@/types/user";
|
||||||
|
|
||||||
|
// Single source of truth for product type labels lives in types/product.ts
|
||||||
|
// (kept in sync with the backend Product::TYPES). Re-exported here so existing
|
||||||
|
// `@/lib/utils` imports keep working without a divergent (previously wrong) map.
|
||||||
|
export { getProductTypeLabel } from "@/types/product";
|
||||||
|
|
||||||
export const formatDate = (dateString: string | null): string => {
|
export const formatDate = (dateString: string | null): string => {
|
||||||
if (!dateString) return 'نامشخص';
|
if (!dateString) return 'نامشخص';
|
||||||
|
|
||||||
@@ -20,16 +25,6 @@ export const formatPrice = (price: number | null): string => {
|
|||||||
return new Intl.NumberFormat('fa-IR').format(price);
|
return new Intl.NumberFormat('fa-IR').format(price);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getProductTypeLabel = (type: number | null): string => {
|
|
||||||
const types: Record<number, string> = {
|
|
||||||
1: 'ماهیانه',
|
|
||||||
2: 'سه ماهه',
|
|
||||||
3: 'شش ماهه',
|
|
||||||
4: 'سالیانه',
|
|
||||||
};
|
|
||||||
return type && types[type] ? types[type] : 'نامشخص';
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getFullName = (user: User): string => {
|
export const getFullName = (user: User): string => {
|
||||||
if (user.full_name) return user.full_name;
|
if (user.full_name) return user.full_name;
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -4,9 +4,10 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build && next export && mv out appro-admin",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "eslint"
|
"lint": "eslint",
|
||||||
|
"prepare": "git config core.hooksPath .githooks || true"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@heroicons/react": "^2.2.0",
|
"@heroicons/react": "^2.2.0",
|
||||||
|
|||||||
+2
-1
@@ -35,7 +35,8 @@ export const PRODUCT_TYPES = {
|
|||||||
1: 'دائمی',
|
1: 'دائمی',
|
||||||
2: 'سالیانه',
|
2: 'سالیانه',
|
||||||
3: '۶ ماهه',
|
3: '۶ ماهه',
|
||||||
4: 'ماهیانه'
|
4: 'ماهیانه',
|
||||||
|
5: 'سه ماهه'
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export type ProductType = keyof typeof PRODUCT_TYPES;
|
export type ProductType = keyof typeof PRODUCT_TYPES;
|
||||||
|
|||||||
Reference in New Issue
Block a user