diff --git a/src/App.vue b/src/App.vue index d50c623..ad52768 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,6 +2,7 @@ + @@ -12,6 +13,7 @@ import { message } from 'ant-design-vue' import { useConfigStore } from '@/store/configStore' import { initDarkmode } from '@core/stores/darkmode' import CustomerImportProgress from '@/components/CustomerImportProgress.vue' +import TahesabDocSyncProgress from '@/components/TahesabDocSyncProgress.vue' import GroupSmsSendProgress from '@/components/GroupSmsSendProgress.vue' import { useUserStore } from '@/store/userStore' import { bootstrapAdminChat, useAdminChatService } from '@/utils/adminChat' diff --git a/src/api/tahesab.ts b/src/api/tahesab.ts index b3c4224..0a2f943 100644 --- a/src/api/tahesab.ts +++ b/src/api/tahesab.ts @@ -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?: { diff --git a/src/components/TahesabDocSyncProgress.vue b/src/components/TahesabDocSyncProgress.vue new file mode 100644 index 0000000..469b7be --- /dev/null +++ b/src/components/TahesabDocSyncProgress.vue @@ -0,0 +1,658 @@ + + + + + diff --git a/src/pages/menuPages/accounting/components/TahesabCustomerSync.vue b/src/pages/menuPages/accounting/components/TahesabCustomerSync.vue index ef12dfb..c3f08a0 100644 --- a/src/pages/menuPages/accounting/components/TahesabCustomerSync.vue +++ b/src/pages/menuPages/accounting/components/TahesabCustomerSync.vue @@ -63,6 +63,8 @@ + +