10.
Implementation A partner, not just software HexDive Technologies' local team handles setup, data migration, training and ongoing support — in Sinhala, Tamil and English. [confirm] 1 Discovery Map your network, products and processes. 2 Configuration Set up depots, pricing, schemes, routes and users. 3 Migration & training Move your data and train every team. 4 Go-live & support Dedicated account manager and local support desk.
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
import { api } from '@/lib/api'
|
||||
import type {
|
||||
CreateExpenseCategoryRequest,
|
||||
CreateExpenseRequest,
|
||||
CreateExpenseVendorRequest,
|
||||
CreateRecurringExpenseRequest,
|
||||
ExpenseAction,
|
||||
ExpenseAttachmentResponse,
|
||||
ExpenseCategoryResponse,
|
||||
ExpensePaymentRequest,
|
||||
ExpenseResponse,
|
||||
ExpenseStatus,
|
||||
ExpenseVendorResponse,
|
||||
PagedExpenseVendorsResponse,
|
||||
PagedExpensesResponse,
|
||||
PagedRecurringExpensesResponse,
|
||||
RecurringExpenseResponse,
|
||||
RunDueResponse,
|
||||
UpdateExpenseCategoryRequest,
|
||||
UpdateExpenseDraftRequest,
|
||||
UpdateExpenseVendorRequest,
|
||||
UpdateRecurringExpenseRequest,
|
||||
} from '@/types/expenses'
|
||||
|
||||
// Categories
|
||||
|
||||
export const expenseCategories = {
|
||||
tree: () =>
|
||||
api.get<ExpenseCategoryResponse[]>('/expense-categories').then(r => r.data),
|
||||
|
||||
create: (body: CreateExpenseCategoryRequest) =>
|
||||
api.post<ExpenseCategoryResponse>('/expense-categories', body).then(r => r.data),
|
||||
|
||||
update: (id: string, body: UpdateExpenseCategoryRequest) =>
|
||||
api.put<ExpenseCategoryResponse>(`/expense-categories/${id}`, body).then(r => r.data),
|
||||
}
|
||||
|
||||
// Vendors
|
||||
|
||||
export const expenseVendors = {
|
||||
list: (params?: { search?: string; page?: number; pageSize?: number }) =>
|
||||
api.get<PagedExpenseVendorsResponse>('/expense-vendors', { params }).then(r => r.data),
|
||||
|
||||
create: (body: CreateExpenseVendorRequest) =>
|
||||
api.post<ExpenseVendorResponse>('/expense-vendors', body).then(r => r.data),
|
||||
|
||||
update: (id: string, body: UpdateExpenseVendorRequest) =>
|
||||
api.put<ExpenseVendorResponse>(`/expense-vendors/${id}`, body).then(r => r.data),
|
||||
}
|
||||
|
||||
// Expenses
|
||||
|
||||
export interface ExpenseListParams {
|
||||
status?: ExpenseStatus
|
||||
categoryId?: string
|
||||
warehouseId?: string
|
||||
from?: string
|
||||
to?: string
|
||||
page?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
export const expenses = {
|
||||
list: (params?: ExpenseListParams) =>
|
||||
api.get<PagedExpensesResponse>('/expenses', { params }).then(r => r.data),
|
||||
|
||||
get: (id: string) =>
|
||||
api.get<ExpenseResponse>(`/expenses/${id}`).then(r => r.data),
|
||||
|
||||
create: (body: CreateExpenseRequest, action: ExpenseAction = 'Draft') =>
|
||||
api.post<ExpenseResponse>('/expenses', body, { params: { action } }).then(r => r.data),
|
||||
|
||||
updateDraft: (id: string, body: UpdateExpenseDraftRequest) =>
|
||||
api.put<ExpenseResponse>(`/expenses/${id}`, body).then(r => r.data),
|
||||
|
||||
post: (id: string) =>
|
||||
api.post<ExpenseResponse>(`/expenses/${id}/post`).then(r => r.data),
|
||||
|
||||
pay: (id: string, body: ExpensePaymentRequest) =>
|
||||
api.post<ExpenseResponse>(`/expenses/${id}/pay`, body).then(r => r.data),
|
||||
|
||||
void: (id: string, reason?: string) =>
|
||||
api.post<ExpenseResponse>(`/expenses/${id}/void`, { reason }).then(r => r.data),
|
||||
|
||||
uploadAttachment: (expenseId: string, file: File) => {
|
||||
const form = new FormData()
|
||||
form.append('file', file)
|
||||
return api.post<ExpenseAttachmentResponse>(`/expenses/${expenseId}/attachments`, form, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
}).then(r => r.data)
|
||||
},
|
||||
|
||||
downloadAttachmentUrl: (attachmentId: string) =>
|
||||
`${api.defaults.baseURL}/expense-attachments/${attachmentId}/download`,
|
||||
|
||||
deleteAttachment: (attachmentId: string) =>
|
||||
api.delete(`/expense-attachments/${attachmentId}`),
|
||||
}
|
||||
|
||||
// Recurring
|
||||
|
||||
export const recurringExpenses = {
|
||||
list: (params?: { page?: number; pageSize?: number }) =>
|
||||
api.get<PagedRecurringExpensesResponse>('/recurring-expenses', { params }).then(r => r.data),
|
||||
|
||||
create: (body: CreateRecurringExpenseRequest) =>
|
||||
api.post<RecurringExpenseResponse>('/recurring-expenses', body).then(r => r.data),
|
||||
|
||||
update: (id: string, body: UpdateRecurringExpenseRequest) =>
|
||||
api.put<RecurringExpenseResponse>(`/recurring-expenses/${id}`, body).then(r => r.data),
|
||||
|
||||
toggle: (id: string, paused: boolean) =>
|
||||
api.post<RecurringExpenseResponse>(`/recurring-expenses/${id}/toggle`, { paused }).then(r => r.data),
|
||||
|
||||
runDue: () =>
|
||||
api.post<RunDueResponse>('/recurring-expenses/run-due').then(r => r.data),
|
||||
}
|
||||
Reference in New Issue
Block a user