diff --git a/distribution_fe/lib/api/master.ts b/distribution_fe/lib/api/master.ts index 2cf514e..5fec4f2 100644 --- a/distribution_fe/lib/api/master.ts +++ b/distribution_fe/lib/api/master.ts @@ -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(`/regions/${id}/targets/${period}`, { targetValue }).then(r => r.data), + + setBudget: (id: string, period: string, budgetAmount: number) => + api.put(`/regions/${id}/budgets/${period}`, { budgetAmount }).then(r => r.data), + + mapAgency: (id: string, agencyUserId: string) => + api.post(`/regions/${id}/agencies`, { agencyUserId }).then(r => r.data), + + setTaxRule: (id: string, ruleConfig: string) => + api.put(`/regions/${id}/tax-rule`, { ruleConfig }).then(r => r.data), + + hierarchy: (id: string) => + api.get(`/regions/${id}/hierarchy`).then(r => r.data), + + dashboard: (id: string, period?: string) => + api.get(`/regions/${id}/dashboard`, { params: { period } }).then(r => r.data), } // ─── Routes ─────────────────────────────────────────────────────────────────── diff --git a/distribution_fe/types/api.ts b/distribution_fe/types/api.ts index 31f2162..8f6a317 100644 --- a/distribution_fe/types/api.ts +++ b/distribution_fe/types/api.ts @@ -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 {