Unify FunZone voucher sync on the accounting documents page.
Consolidate sync buttons into one flow on ????? ????????, deduplicate treasury vs invoice and customer vouchers, add FunZone inventory lifecycle views, and improve stat card number display. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -90,7 +90,7 @@ interface AppStoreValue {
|
||||
loading: boolean
|
||||
error: string | null
|
||||
ready: boolean
|
||||
reload: () => void
|
||||
reload: () => Promise<AppData | null>
|
||||
upsertAccount: (item: Account) => void
|
||||
removeAccount: (id: string) => void
|
||||
upsertVoucher: (item: Voucher) => void
|
||||
@@ -163,7 +163,7 @@ export function AppStoreProvider({ children }: { children: ReactNode }) {
|
||||
[disconnect],
|
||||
)
|
||||
|
||||
const load = useCallback(async () => {
|
||||
const load = useCallback(async (): Promise<AppData | null> => {
|
||||
setLoading(true)
|
||||
setError(null)
|
||||
try {
|
||||
@@ -181,11 +181,14 @@ export function AppStoreProvider({ children }: { children: ReactNode }) {
|
||||
acct.get(ENDPOINT.payslips).then(asList<Payslip>),
|
||||
acct.get<CompanySettings>(ACCOUNTING_ENDPOINTS.SETTINGS),
|
||||
])
|
||||
setData({ accounts, vouchers, parties, products, invoices, salesTypes, partyAdjustments, treasury, employees, payslips, settings })
|
||||
const loaded = { accounts, vouchers, parties, products, invoices, salesTypes, partyAdjustments, treasury, employees, payslips, settings }
|
||||
setData(loaded)
|
||||
setReady(true)
|
||||
return loaded
|
||||
} catch (err) {
|
||||
setReady(false)
|
||||
handleApiError(err)
|
||||
return null
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
@@ -279,9 +282,7 @@ export function AppStoreProvider({ children }: { children: ReactNode }) {
|
||||
loading,
|
||||
error,
|
||||
ready,
|
||||
reload: () => {
|
||||
void load()
|
||||
},
|
||||
reload: load,
|
||||
upsertAccount: (item) => void upsert('accounts', item),
|
||||
removeAccount: (id) => void remove('accounts', id),
|
||||
upsertVoucher: (item) => void upsert('vouchers', item),
|
||||
|
||||
Reference in New Issue
Block a user