feat(tahesab): poll customer sync from any page and reuse the progress modal

Start outbound/inbound on the server; hydrate after refresh so the transfer modal returns without opening accounting.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-03 10:09:54 +03:30
co-authored by Cursor
parent 6ab14313dd
commit 62a6a91455
6 changed files with 197 additions and 64 deletions
+14
View File
@@ -38,6 +38,7 @@ export interface TahesabDocSyncState {
running: boolean
finished: boolean
stopped: boolean
stage?: 'docs' | 'customers_out' | 'customers_in'
percent: number
total: number
processed: number
@@ -45,6 +46,9 @@ export interface TahesabDocSyncState {
failed: number
current: string
errors: { label?: string; error?: string }[]
doc_total?: number
doc_success?: number
doc_failed?: number
started_at?: string | null
finished_at?: string | null
}
@@ -97,6 +101,16 @@ export const stopTahesabDocSync = async () =>
'/admin/tahesab/doc-sync/stop'
)
export const startTahesabCustomerOutbound = async () =>
await useAxios.post<{ ok: boolean; message: string; doc_sync: TahesabDocSyncState }>(
'/admin/tahesab/customer-sync/outbound/start'
)
export const startTahesabCustomerInbound = async () =>
await useAxios.post<{ ok: boolean; message: string; doc_sync: TahesabDocSyncState }>(
'/admin/tahesab/customer-sync/inbound/start'
)
export const registerCustomerInTahesab = async (customerId: number) =>
await useAxios.post<{ ok: boolean; message: string; moshtari_code?: string | number }>(
`/admin/customer/${customerId}/tahesab/register`