diff --git a/src/api/tahesab.ts b/src/api/tahesab.ts
index 6fde2af..0f23573 100644
--- a/src/api/tahesab.ts
+++ b/src/api/tahesab.ts
@@ -101,6 +101,14 @@ export const stopTahesabDocSync = async () =>
'/admin/tahesab/doc-sync/stop'
)
+export const resetTahesabLocalDocs = async () =>
+ await useAxios.post<{
+ ok: boolean
+ message: string
+ cleared: number
+ summary: TahesabPendingSummary
+ }>('/admin/tahesab/doc-sync/reset-local')
+
export const startTahesabCustomerOutbound = async () =>
await useAxios.post<{ ok: boolean; message: string; doc_sync: TahesabDocSyncState }>(
'/admin/tahesab/customer-sync/outbound/start'
diff --git a/src/pages/menuPages/accounting/components/TahesabDocSyncBox.vue b/src/pages/menuPages/accounting/components/TahesabDocSyncBox.vue
index d30d794..8d45cec 100644
--- a/src/pages/menuPages/accounting/components/TahesabDocSyncBox.vue
+++ b/src/pages/menuPages/accounting/components/TahesabDocSyncBox.vue
@@ -7,24 +7,38 @@
با یک کلیک همهٔ سفارشها و شارژهای جاافتاده یکییکی و با فاصله به تهحساب میروند.
بعد از سندها، مشتریان پنلِ بدون کد هم همانجا ثبت میشوند. پیشرفت را میتوانید کوچک کنید.
+ اگر سندها در تهحساب پاک شده، اول وضعیت محلی را بازنشانی کنید.
-
- {{ store.active ? 'در حال ارسال…' : 'ارسال همه سندها' }}
-
+
+
+ {{ store.active ? 'در حال ارسال…' : 'ارسال همه سندها' }}
+
+
+ بازنشانی وضعیت محلی
+
+
diff --git a/src/pages/menuPages/accounting/components/tahesabTable.vue b/src/pages/menuPages/accounting/components/tahesabTable.vue
index e531831..2eacdb6 100644
--- a/src/pages/menuPages/accounting/components/tahesabTable.vue
+++ b/src/pages/menuPages/accounting/components/tahesabTable.vue
@@ -16,7 +16,7 @@
-
+
{
const visible = ref(false)
const minimized = ref(false)
const starting = ref(false)
+ const resetting = ref(false)
const message = ref('')
let timer: ReturnType | null = null
@@ -188,11 +190,27 @@ export const useTahesabDocSyncStore = defineStore('tahesabDocSync', () => {
minimized.value = false
}
+ async function resetLocal() {
+ if (resetting.value || state.value.running) return null
+ resetting.value = true
+ try {
+ const res = await resetTahesabLocalDocs()
+ message.value = res.message || ''
+ apply(res.summary?.doc_sync)
+ visible.value = false
+ minimized.value = false
+ return res
+ } finally {
+ resetting.value = false
+ }
+ }
+
return {
state,
visible,
minimized,
starting,
+ resetting,
message,
active,
finished,
@@ -204,6 +222,7 @@ export const useTahesabDocSyncStore = defineStore('tahesabDocSync', () => {
start,
startOutbound,
startInbound,
+ resetLocal,
stop,
minimize,
expand,