2025-10-05 11:29:51 +03:30
|
|
|
import useAxios from '@core/utils/useAxios'
|
|
|
|
|
import type { AddId, Customer } from '@/model/customer'
|
|
|
|
|
import type { TableInput } from '@core/type/baseTable'
|
|
|
|
|
import type { Accounting } from "@/model/accounting"
|
|
|
|
|
import type { Balance, SetActiveTime } from "@/model/product";
|
|
|
|
|
|
|
|
|
|
export const createProduct = async (obj: Customer) =>
|
|
|
|
|
await useAxios.post<AddId>(`/admin/product`, obj)
|
|
|
|
|
|
|
|
|
|
export const deleteCustomer = async (id: number) => await useAxios.delete(`/admin/product/${id}`)
|
2026-02-09 11:59:33 +03:30
|
|
|
export const updateProduct = async (id: number, obj: Customer) =>
|
2025-10-05 11:29:51 +03:30
|
|
|
await useAxios.put<AddId>(`/admin/product/${id}`, obj)
|
|
|
|
|
|
|
|
|
|
export const getCustomerTable = async (params: TableInput) =>
|
|
|
|
|
await useAxios.post<Array<Customer>>('/admin/product/table', params)
|
|
|
|
|
|
|
|
|
|
export const getCustomersList = async () => await useAxios.get<Customer[]>(`/admin/product/list`)
|
|
|
|
|
|
|
|
|
|
export const changeProductActivation = async (id: number) =>
|
|
|
|
|
await useAxios.get(`/admin/product/active/${id}`)
|
|
|
|
|
|
|
|
|
|
export const changeCustomerOrderActivation = async (id: number) =>
|
|
|
|
|
await useAxios.get(`/admin/product/trade/${id}`)
|
|
|
|
|
|
|
|
|
|
export const changeCustomerArchive = async (id: number) =>
|
|
|
|
|
await useAxios.get(`/admin/product/archive/${id}`)
|
|
|
|
|
|
|
|
|
|
export const confirmUser = async (id: number) =>
|
|
|
|
|
await useAxios.get(`/admin/product/is_valid/${id}`)
|
|
|
|
|
|
|
|
|
|
export const getCustomerArchiveTable = async (params: TableInput) =>
|
|
|
|
|
await useAxios.post<Array<Customer>>('/admin/product/archive/table', params)
|
|
|
|
|
|
|
|
|
|
export const getSingleTable = async (params: TableInput) =>
|
|
|
|
|
await useAxios.post<Array<Customer>>('/admin/product/single/table', params)
|
|
|
|
|
|
|
|
|
|
export const getSingleArchiveTable = async (params: TableInput) =>
|
|
|
|
|
await useAxios.post<Array<Customer>>('/admin/product/single/archive/table', params)
|
|
|
|
|
|
|
|
|
|
export const getCustomerById = async (id: number) => {
|
|
|
|
|
return await useAxios.get(`/admin/product/${id}`)
|
|
|
|
|
}
|
|
|
|
|
export const changeBuyActiveProduct = async (id?: number) => {
|
|
|
|
|
return await useAxios.get(`/admin/product/open_buy/${id}`)
|
|
|
|
|
}
|
|
|
|
|
export const changeSellActiveProduct = async (id?: number) => {
|
|
|
|
|
return await useAxios.get(`/admin/product/open_sell/${id}`)
|
|
|
|
|
}
|
|
|
|
|
export const changeActiveProduct = async (id: number) => {
|
|
|
|
|
return await useAxios.get(`/admin/product/active/${id}`)
|
|
|
|
|
}
|
|
|
|
|
export const changeVisibilityProduct = async (id: number) => {
|
|
|
|
|
return await useAxios.get(`/admin/product/hide/${id}`)
|
|
|
|
|
}
|
|
|
|
|
export const setActiveTime = async (open: string, close: string) =>{
|
|
|
|
|
await useAxios.put<SetActiveTime>(`/admin/products`, {auto_open_at: open, auto_close_at: close})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const getBalance = async (startDate: string, endDate: string) => {
|
|
|
|
|
return await useAxios.post<Balance>('/admin/getBalance', {startDate, endDate})
|
|
|
|
|
}
|