Add FunZone sync for sales and purchases, voucher filters, and event-name support.
Manual sync buttons pull customer payments and owner payouts into treasury, invoices, and accounting vouchers; voucher page gains category, date, status, and search filters; supplier vouchers dedupe against treasury-backed entries. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
22
src/utils/eventName.ts
Normal file
22
src/utils/eventName.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/** Human-readable label for a FunZone event name (wallet → کیف پول). */
|
||||
export function formatEventName(eventName: string | null | undefined): string {
|
||||
if (!eventName?.trim()) return '—'
|
||||
return eventName.toLowerCase() === 'wallet' ? 'کیف پول' : eventName.trim()
|
||||
}
|
||||
|
||||
/** Raw event name stored on records (wallet stays as wallet). */
|
||||
export function normalizeEventName(value: string): string {
|
||||
const trimmed = value.trim()
|
||||
if (!trimmed) return ''
|
||||
if (trimmed === 'کیف پول') return 'wallet'
|
||||
return trimmed
|
||||
}
|
||||
|
||||
/** Parses event name from a FunZone treasury import description block. */
|
||||
export function eventNameFromTreasuryDescription(description: string): string | undefined {
|
||||
const line = description.split('\n').find((l) => l.startsWith('رویداد:'))
|
||||
if (!line) return undefined
|
||||
const raw = line.replace(/^رویداد:\s*/, '').trim()
|
||||
if (!raw || raw === '—') return undefined
|
||||
return raw === 'کیف پول' ? 'wallet' : raw
|
||||
}
|
||||
Reference in New Issue
Block a user