feat(tahesab): minimizable modal for bulk document sync progress

One-click start on customer-sync and documents tabs; poll every 10s, restore the modal after refresh if the server job is still running, and show failed counts with stop.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-02 20:48:14 +03:30
co-authored by Cursor
parent 4d8d35c37d
commit ba12569b97
7 changed files with 888 additions and 1 deletions
+27
View File
@@ -34,11 +34,27 @@ export const getTahesabDetail = async (id: number) =>
export const retryTahesabSanad = async (id: number) =>
await useAxios.post<{ ok: boolean; message: string; tahesab?: TahesabRecord }>(`/admin/tahesab/${id}/retry`)
export interface TahesabDocSyncState {
running: boolean
finished: boolean
stopped: boolean
percent: number
total: number
processed: number
success: number
failed: number
current: string
errors: { label?: string; error?: string }[]
started_at?: string | null
finished_at?: string | null
}
export interface TahesabPendingSummary {
failed_rows: number
missing_withdraws: number
missing_orders: number
total: number
doc_sync?: TahesabDocSyncState
}
export interface TahesabSyncAllResult {
@@ -71,6 +87,16 @@ export const syncAllTahesabPending = async (limit = 80, customerId?: number) =>
...(customerId ? { customer_id: customerId } : {})
})
export const startTahesabDocSync = async () =>
await useAxios.post<{ ok: boolean; message: string; doc_sync: TahesabDocSyncState }>(
'/admin/tahesab/doc-sync/start'
)
export const stopTahesabDocSync = async () =>
await useAxios.post<{ ok: boolean; message: string; doc_sync: TahesabDocSyncState }>(
'/admin/tahesab/doc-sync/stop'
)
export const registerCustomerInTahesab = async (customerId: number) =>
await useAxios.post<{ ok: boolean; message: string; moshtari_code?: string | number }>(
`/admin/customer/${customerId}/tahesab/register`
@@ -129,6 +155,7 @@ export interface CustomerSyncStatus {
last_page: number
total: number
}
doc_sync?: TahesabDocSyncState
}
export const getCustomerSyncStatus = async (params?: {