- Implement SettlementsPage for managing settlement requests with approval and rejection functionalities. - Create SmsPage for handling SMS templates, including creation, approval, rejection, and logging. - Add UserDetailPage to display detailed information about users. - Develop UsersPage for listing users with search, view, edit, and delete options. - Introduce new types for User, SmsTemplate, SmsLog, and Settlement to support the new features.
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
export function formatRial(amount: number): string {
|
|
return new Intl.NumberFormat('fa-IR').format(amount) + ' تومان';
|
|
}
|
|
|
|
export function formatNumber(n: number): string {
|
|
return new Intl.NumberFormat('fa-IR').format(n);
|
|
}
|
|
|
|
export function formatDate(dateStr: string | null | undefined): string {
|
|
if (!dateStr) return '—';
|
|
try {
|
|
return new Intl.DateTimeFormat('fa-IR', {
|
|
year: 'numeric',
|
|
month: '2-digit',
|
|
day: '2-digit',
|
|
}).format(new Date(dateStr));
|
|
} catch {
|
|
return dateStr;
|
|
}
|
|
}
|
|
|
|
export function formatDateTime(dateStr: string | null | undefined): string {
|
|
if (!dateStr) return '—';
|
|
try {
|
|
return new Intl.DateTimeFormat('fa-IR', {
|
|
year: 'numeric',
|
|
month: '2-digit',
|
|
day: '2-digit',
|
|
hour: '2-digit',
|
|
minute: '2-digit',
|
|
}).format(new Date(dateStr));
|
|
} catch {
|
|
return dateStr;
|
|
}
|
|
}
|
|
|
|
export function maskMobile(mobile: string): string {
|
|
if (mobile.length < 7) return mobile;
|
|
return mobile.slice(0, 4) + '***' + mobile.slice(-3);
|
|
}
|
|
|
|
export function cn(...classes: (string | undefined | null | false)[]): string {
|
|
return classes.filter(Boolean).join(' ');
|
|
}
|