feat: complete application updates

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-09-24 22:29:28 +03:30
co-authored by Copilot
parent 981f4fdaf9
commit 148f00a75d
94 changed files with 1351 additions and 458 deletions
+16
View File
@@ -24,9 +24,25 @@ export const ADMIN_NAV_ITEMS: NavItem[] = [
{ name: 'shipping', label: 'ارسال و باربری', path: '/shipping', icon: 'shipping' },
{ name: 'reports', label: 'گزارش‌ها', path: '/reports', icon: 'reports' },
{ name: 'settings', label: 'تنظیمات', path: '/settings', icon: 'settings' },
{ name: 'sms-tariff', label: 'تعرفه پیامک‌ها', path: '/sms-tariff', icon: 'sms' },
{ name: 'users', label: 'کاربران و دسترسی‌ها', path: '/users', icon: 'users' },
]
export const SMS_WALLET_OWNER_PHONE = '09128081392'
export function isSmsWalletOwner(phone?: string | null): boolean {
if (!phone) return false
let digits = phone.replace(/\D/g, '')
if (digits.startsWith('98') && digits.length === 12) digits = `0${digits.slice(2)}`
if (digits.length === 10 && digits.startsWith('9')) digits = `0${digits}`
return digits === SMS_WALLET_OWNER_PHONE
}
export function navItemsForPhone(phone?: string | null): NavItem[] {
if (isSmsWalletOwner(phone)) return ADMIN_NAV_ITEMS
return ADMIN_NAV_ITEMS.filter((item) => item.name !== 'sms-tariff')
}
export function isNavActive(path: string, currentPath: string): boolean {
if (path === '/') return currentPath === '/'
// چک‌های یک سفارش زیر منوی «چک‌ها» فعال می‌شود، نه «سفارش‌ها»
+12
View File
@@ -0,0 +1,12 @@
export function formatCardNumber(raw: string): string {
const digits = raw.replace(/\D/g, '')
return digits.replace(/(\d{4})(?=\d)/g, '$1 ').trim()
}
export function formatSheba(raw: string): string {
const compact = raw.replace(/[\s-]/g, '').toUpperCase()
const body = compact.startsWith('IR') ? compact.slice(2) : compact
if (body.length < 2) return compact
const groups = body.slice(2).replace(/(.{4})/g, '$1 ').trim()
return `IR${body.slice(0, 2)} ${groups}`.trim()
}