fixed ui and some bugs
This commit is contained in:
@@ -34,3 +34,59 @@ export const registerCustomerInTahesab = async (customerId: number) =>
|
||||
await useAxios.post<{ ok: boolean; message: string; moshtari_code?: string | number }>(
|
||||
`/admin/customer/${customerId}/tahesab/register`
|
||||
)
|
||||
|
||||
export interface PanelOnlyCustomer {
|
||||
id: number
|
||||
name: string
|
||||
mobile: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface TahesabOnlyCustomer {
|
||||
code: number
|
||||
name: string
|
||||
tel: string
|
||||
gid: number | null
|
||||
group: string
|
||||
}
|
||||
|
||||
export interface CustomerSyncStatus {
|
||||
panel_total: number
|
||||
panel_registered: number
|
||||
panel_only: number
|
||||
tahesab_total: number
|
||||
tahesab_only_count: number
|
||||
panel_only_list: {
|
||||
data: PanelOnlyCustomer[]
|
||||
current_page: number
|
||||
last_page: number
|
||||
total: number
|
||||
}
|
||||
tahesab_only_list: {
|
||||
data: TahesabOnlyCustomer[]
|
||||
current_page: number
|
||||
last_page: number
|
||||
total: number
|
||||
}
|
||||
}
|
||||
|
||||
export const getCustomerSyncStatus = async (params?: {
|
||||
search?: string
|
||||
page?: number
|
||||
tahesab_page?: number
|
||||
}) => await useAxios.get<CustomerSyncStatus>('/admin/tahesab/customer-sync/status', { params })
|
||||
|
||||
export interface SyncPanelResult {
|
||||
ok: boolean
|
||||
success: number
|
||||
failed: number
|
||||
errors: { name: string; mobile: string; error: string }[]
|
||||
}
|
||||
|
||||
export const syncPanelToTahesab = async () =>
|
||||
await useAxios.post<SyncPanelResult>('/admin/tahesab/customer-sync/panel-to-tahesab')
|
||||
|
||||
export const importFromTahesab = async (customers: TahesabOnlyCustomer[]) =>
|
||||
await useAxios.post<SyncPanelResult>('/admin/tahesab/customer-sync/import-from-tahesab', {
|
||||
customers,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user