Feat/region mngt #16
@@ -2,6 +2,12 @@ import { api } from '@/lib/api'
|
||||
import type {
|
||||
PaginatedResponse,
|
||||
RegionResponse,
|
||||
RegionalTargetResponse,
|
||||
RegionalBudgetResponse,
|
||||
RegionAgencyMapResponse,
|
||||
RegionalTaxRuleResponse,
|
||||
RegionHierarchyResponse,
|
||||
RegionDashboardResponse,
|
||||
RouteResponse,
|
||||
VehicleResponse,
|
||||
WarehouseResponse,
|
||||
@@ -96,6 +102,24 @@ export const regions = {
|
||||
|
||||
remove: (id: string) =>
|
||||
api.delete(`/regions/${id}`),
|
||||
|
||||
setTarget: (id: string, period: string, targetValue: number) =>
|
||||
api.put<RegionalTargetResponse>(`/regions/${id}/targets/${period}`, { targetValue }).then(r => r.data),
|
||||
|
||||
setBudget: (id: string, period: string, budgetAmount: number) =>
|
||||
api.put<RegionalBudgetResponse>(`/regions/${id}/budgets/${period}`, { budgetAmount }).then(r => r.data),
|
||||
|
||||
mapAgency: (id: string, agencyUserId: string) =>
|
||||
api.post<RegionAgencyMapResponse>(`/regions/${id}/agencies`, { agencyUserId }).then(r => r.data),
|
||||
|
||||
setTaxRule: (id: string, ruleConfig: string) =>
|
||||
api.put<RegionalTaxRuleResponse>(`/regions/${id}/tax-rule`, { ruleConfig }).then(r => r.data),
|
||||
|
||||
hierarchy: (id: string) =>
|
||||
api.get<RegionHierarchyResponse>(`/regions/${id}/hierarchy`).then(r => r.data),
|
||||
|
||||
dashboard: (id: string, period?: string) =>
|
||||
api.get<RegionDashboardResponse>(`/regions/${id}/dashboard`, { params: { period } }).then(r => r.data),
|
||||
}
|
||||
|
||||
// ─── Routes ───────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -85,6 +85,50 @@ export interface RouteResponse {
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
export interface RegionalTargetResponse {
|
||||
regionId: string
|
||||
period: string
|
||||
targetValue: number
|
||||
}
|
||||
|
||||
export interface RegionalBudgetResponse {
|
||||
regionId: string
|
||||
period: string
|
||||
budgetAmount: number
|
||||
}
|
||||
|
||||
export interface RegionAgencyMapResponse {
|
||||
regionId: string
|
||||
agencyUserId: string
|
||||
}
|
||||
|
||||
export interface RegionalTaxRuleResponse {
|
||||
regionId: string
|
||||
ruleConfig: string
|
||||
}
|
||||
|
||||
export interface RegionHierarchyRouteItem {
|
||||
routeId: string
|
||||
routeName: string
|
||||
storeIds: string[]
|
||||
}
|
||||
|
||||
export interface RegionHierarchyResponse {
|
||||
regionId: string
|
||||
regionName: string
|
||||
routes: RegionHierarchyRouteItem[]
|
||||
}
|
||||
|
||||
export interface RegionDashboardResponse {
|
||||
regionId: string
|
||||
period: string
|
||||
targetValue: number | null
|
||||
budgetAmount: number | null
|
||||
orderCount: number
|
||||
actualSales: number
|
||||
lastOrderDate: string | null
|
||||
}
|
||||
|
||||
// ─── Vehicles / Warehouses ───────────────────────────────────────────────────
|
||||
|
||||
export interface VehicleResponse {
|
||||
|
||||
Reference in New Issue
Block a user