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:
Shayan Azadi
2026-07-06 22:09:08 +03:30
parent 4508be582a
commit f6b6e27294
24 changed files with 1258 additions and 90 deletions

22
src/utils/eventName.ts Normal file
View 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
}