87c807c16c
- Implemented ChequeBooksPage for viewing and filtering cheque books. - Added NewReceivedChequePage for recording received cheques. - Created ReceivedChequesPage for listing and managing received cheques. - Introduced API endpoints for bank accounts, cheque books, and received cheques. - Defined types for payments including bank accounts, cheque books, and received cheques.
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { api } from '@/lib/api'
|
|
import type {
|
|
BankAccountResponse,
|
|
BankAccountType,
|
|
CashAccountTypeDto,
|
|
CreateBankAccountRequest,
|
|
CreateCashAccountRequest,
|
|
} from '@/types/payments'
|
|
|
|
export const bankAccounts = {
|
|
list: (accountType?: BankAccountType) =>
|
|
api
|
|
.get<BankAccountResponse[]>('/bank-accounts', {
|
|
params: accountType ? { accountType } : undefined,
|
|
})
|
|
.then(r => r.data),
|
|
|
|
createBank: (body: CreateBankAccountRequest) =>
|
|
api.post<BankAccountResponse>('/bank-accounts', body).then(r => r.data),
|
|
|
|
createCash: (body: CreateCashAccountRequest) =>
|
|
api.post<BankAccountResponse>('/cash-accounts', body).then(r => r.data),
|
|
|
|
updateCash: (id: string, accountName: string) =>
|
|
api.put<BankAccountResponse>(`/cash-accounts/${id}`, { accountName }).then(r => r.data),
|
|
|
|
setCashStatus: (id: string, isActive: boolean) =>
|
|
api.patch<BankAccountResponse>(`/cash-accounts/${id}/status`, { isActive }).then(r => r.data),
|
|
|
|
deleteCash: (id: string) => api.delete(`/cash-accounts/${id}`),
|
|
|
|
cashAccountTypes: () =>
|
|
api.get<CashAccountTypeDto[]>('/cash-account-types').then(r => r.data),
|
|
}
|