feat: add cheque books and received cheques management
- 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:
@@ -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),
|
||||
}
|
||||
Reference in New Issue
Block a user