feat: add ItemOverviewDto for enriched item data in items list
feat: implement CustomerDetailPage for detailed customer view and editing feat: create CustomersPage for listing and managing customers with filters feat: add ColumnsMenu component for customizable table columns visibility feat: implement CSV export functionality for data download feat: add customer code generation logic for unique customer identifiers
This commit is contained in:
@@ -1,15 +1,35 @@
|
||||
import { apiRequest, buildQuery } from "@/lib/api-client"
|
||||
import { PagedResponse } from "@/types/common"
|
||||
import { Customer } from "@/types/customers"
|
||||
// One typed client method per customer endpoint. ETag/If-Match on update, PATCH status
|
||||
// for deactivate (masters are deactivated, not hard-deleted, FR-MD-08).
|
||||
import { apiRequest, apiRequestWithETag, buildQuery } from "@/lib/api-client"
|
||||
import { ApiResult, EntityStatus, PagedResponse } from "@/types/common"
|
||||
import { CreateCustomerRequest, Customer, CustomerType, UpdateCustomerRequest } from "@/types/customers"
|
||||
|
||||
export interface ListCustomersParams {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
q?: string
|
||||
status?: EntityStatus
|
||||
customerType?: CustomerType
|
||||
}
|
||||
|
||||
export const customersApi = {
|
||||
list(params: ListCustomersParams = {}): Promise<PagedResponse<Customer>> {
|
||||
return apiRequest<PagedResponse<Customer>>(`/customers${buildQuery(params)}`)
|
||||
},
|
||||
|
||||
get(customerId: number): Promise<ApiResult<Customer>> {
|
||||
return apiRequestWithETag<Customer>(`/customers/${customerId}`)
|
||||
},
|
||||
|
||||
create(request: CreateCustomerRequest): Promise<ApiResult<Customer>> {
|
||||
return apiRequestWithETag<Customer>("/customers", { method: "POST", body: request })
|
||||
},
|
||||
|
||||
update(customerId: number, request: UpdateCustomerRequest, ifMatch: string): Promise<ApiResult<Customer>> {
|
||||
return apiRequestWithETag<Customer>(`/customers/${customerId}`, { method: "PUT", body: request, ifMatch })
|
||||
},
|
||||
|
||||
updateStatus(customerId: number, status: EntityStatus): Promise<void> {
|
||||
return apiRequest<void>(`/customers/${customerId}/status`, { method: "PATCH", body: { status } })
|
||||
},
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
CreateItemRequest,
|
||||
Item,
|
||||
ItemListItem,
|
||||
ItemOverview,
|
||||
ItemReorderSetting,
|
||||
ItemScanResult,
|
||||
TrackingMode,
|
||||
@@ -25,11 +26,27 @@ export interface ListItemsParams {
|
||||
sort?: string
|
||||
}
|
||||
|
||||
export interface ListItemOverviewParams {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
q?: string
|
||||
status?: EntityStatus
|
||||
categoryId?: number
|
||||
subCategoryId?: number
|
||||
brandId?: number
|
||||
}
|
||||
|
||||
export const itemsApi = {
|
||||
list(params: ListItemsParams = {}): Promise<PagedResponse<ItemListItem>> {
|
||||
return apiRequest<PagedResponse<ItemListItem>>(`/items${buildQuery(params)}`)
|
||||
},
|
||||
|
||||
/** Items list enriched with stock value, low-stock, last-purchase and 30-day sales
|
||||
* aggregates — backs the Items overview table, not the lightweight document pickers. */
|
||||
overview(params: ListItemOverviewParams = {}): Promise<PagedResponse<ItemOverview>> {
|
||||
return apiRequest<PagedResponse<ItemOverview>>(`/items/overview${buildQuery(params)}`)
|
||||
},
|
||||
|
||||
get(itemId: number): Promise<ApiResult<Item>> {
|
||||
return apiRequestWithETag<Item>(`/items/${itemId}`)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user