feat: add product 3 mount
This commit is contained in:
+5
-10
@@ -1,5 +1,10 @@
|
||||
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 => {
|
||||
if (!dateString) return 'نامشخص';
|
||||
|
||||
@@ -20,16 +25,6 @@ export const formatPrice = (price: number | null): string => {
|
||||
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 => {
|
||||
if (user.full_name) return user.full_name;
|
||||
|
||||
|
||||
+2
-1
@@ -35,7 +35,8 @@ export const PRODUCT_TYPES = {
|
||||
1: 'دائمی',
|
||||
2: 'سالیانه',
|
||||
3: '۶ ماهه',
|
||||
4: 'ماهیانه'
|
||||
4: 'ماهیانه',
|
||||
5: 'سه ماهه'
|
||||
} as const;
|
||||
|
||||
export type ProductType = keyof typeof PRODUCT_TYPES;
|
||||
|
||||
Reference in New Issue
Block a user