feat: add cheque books and received cheques management
CI/CD - ERP Distribution / Build & Deploy Backend (pull_request) Failing after 11m8s
CI/CD - ERP Distribution / Build & Deploy Frontend (pull_request) Failing after 14m49s

- 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.
This commit is contained in:
Kalana B. Thilakarathna
2026-10-19 16:09:05 +05:30
parent f3f2b71bd4
commit 87c807c16c
39 changed files with 10095 additions and 50 deletions
+34
View File
@@ -0,0 +1,34 @@
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),
}
+51
View File
@@ -0,0 +1,51 @@
import { api } from '@/lib/api'
import type {
ChequeBookResponse,
ChequeBookStatus,
ChequePageResponse,
CreateChequeBookRequest,
IssueChequePageRequest,
PagedResult,
UpdateChequePageStatusRequest,
} from '@/types/payments'
export const chequeBooks = {
list: (params?: {
bankAccountId?: string
branchId?: number
status?: ChequeBookStatus
page?: number
pageSize?: number
}) =>
api
.get<PagedResult<ChequeBookResponse>>('/cheque-books', { params })
.then(r => r.data),
get: (chequeBookNo: string, expandPages = false) =>
api
.get<ChequeBookResponse>(`/cheque-books/${encodeURIComponent(chequeBookNo)}`, {
params: expandPages ? { expand: 'pages' } : undefined,
})
.then(r => r.data),
create: (body: CreateChequeBookRequest) =>
api.post<ChequeBookResponse>('/cheque-books', body).then(r => r.data),
}
export const chequePages = {
issue: (chequeNo: string, body: IssueChequePageRequest) =>
api
.put<ChequePageResponse>(
`/cheque-pages/${encodeURIComponent(chequeNo)}/issue`,
body,
)
.then(r => r.data),
updateStatus: (chequeNo: string, body: UpdateChequePageStatusRequest) =>
api
.put<ChequePageResponse>(
`/cheque-pages/${encodeURIComponent(chequeNo)}/status`,
body,
)
.then(r => r.data),
}
+3
View File
@@ -12,6 +12,9 @@ export { productReports } from './reports'
export { shopPos, invoices, payments } from './sales'
export { saleReturns, claims, supplierClaims } from './returns-claims'
export { sysConfig, ITEM_TRACKING_KEYS, GRN_TAX_KEYS, grnTaxSettings, DEFAULT_GRN_TAX_SETTINGS } from './sys-config'
export { bankAccounts } from './bank-accounts'
export { chequeBooks, chequePages } from './cheques'
export { receivedCheques } from './received-cheques'
export { getPaginatedItems } from './paginated'
export type { PageParams } from './master'
@@ -0,0 +1,29 @@
import { api } from '@/lib/api'
import type {
CreateReceivedChequeRequest,
PagedResult,
ReceivedChequeResponse,
ReceivedChequeStatus,
ReceivedFromType,
UpdateReceivedChequeStatusRequest,
} from '@/types/payments'
export const receivedCheques = {
list: (params?: {
companyId?: number
branchId?: number
status?: ReceivedChequeStatus
receivedFromType?: ReceivedFromType
page?: number
pageSize?: number
}) =>
api
.get<PagedResult<ReceivedChequeResponse>>('/received-cheques', { params })
.then(r => r.data),
create: (body: CreateReceivedChequeRequest) =>
api.post<ReceivedChequeResponse>('/received-cheques', body).then(r => r.data),
updateStatus: (id: string, body: UpdateReceivedChequeStatusRequest) =>
api.put<ReceivedChequeResponse>(`/received-cheques/${id}/status`, body).then(r => r.data),
}