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
@@ -6,7 +6,7 @@
>
<template #extra>
<a-button
v-if="(pending?.total ?? 0) > 0"
v-if="customerId && (pending?.total ?? 0) > 0"
type="primary"
size="small"
:loading="syncing"
@@ -16,6 +16,8 @@
</a-button>
</template>
<TahesabDocSyncBox v-if="!customerId" />
<div
v-if="(pending?.total ?? 0) > 0"
class="mb-3 rounded-lg border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900"
@@ -207,6 +209,7 @@ import { isMobile } from '@core/utils/is'
import BasicModal from '@/components/BasicModal.vue'
import TahesabRetryModal from '@/components/TahesabRetryModal.vue'
import TahesabMobileCardList from '@/pages/menuPages/accounting/components/TahesabMobileCardList.vue'
import TahesabDocSyncBox from '@/pages/menuPages/accounting/components/TahesabDocSyncBox.vue'
import {
tahesabIssueKindLabel,
tahesabStatusLabel
@@ -217,6 +220,9 @@ import {
} from '@/pages/menuPages/accounting/utils/accountingDocAmounts'
import { toJalali } from '@core/utils/useDataTime'
import { accountingTahesabDocsIntro } from '@/utils/adminHelpCopy'
import { useTahesabDocSyncStore } from '@/store/tahesabDocSyncStore'
const docSyncStore = useTahesabDocSyncStore()
const props = defineProps<{
customerId?: number
@@ -386,6 +392,7 @@ function openRegister(record: TahesabRecord) {
async function loadPending() {
try {
pending.value = await getTahesabPendingSummary(props.customerId)
docSyncStore.apply(pending.value?.doc_sync)
} catch {
pending.value = null
}
@@ -397,6 +404,7 @@ async function loadFailedDocs() {
const res = await getTahesabPendingDocs(props.customerId, 200)
failedRows.value = res.rows || []
pending.value = res.summary
docSyncStore.apply(res.summary?.doc_sync)
} catch {
failedRows.value = []
} finally {