feat(api, i18n): add agent_node_id to various admin queries and enhance multi-language support

Introduced the agent_node_id field in AdminDrawListQuery, AdminPlayerListQuery, AdminSettlementBatchListQuery, TicketItemsListQuery, and TransferOrderListQuery to improve filtering capabilities. Updated the admin-breadcrumb and admin-sidebar components to include new translations for agent-related terms in English, Nepali, and Chinese, enhancing the overall user experience and multi-language support across the admin interface.
This commit is contained in:
2026-06-02 14:37:08 +08:00
parent a4e7a2d228
commit b15e377187
105 changed files with 5305 additions and 1596 deletions

113
src/api/admin-agents.ts Normal file
View File

@@ -0,0 +1,113 @@
import { adminRequest } from "@/lib/admin-http";
import type { AdminRoleRow } from "@/types/api/admin-user";
import type {
AgentAdminUserCreatePayload,
AgentAdminUserListData,
AgentAdminUserRoleSyncPayload,
AgentNodeCreatePayload,
AgentNodeRow,
AgentNodeUpdatePayload,
AgentRoleCreatePayload,
AgentRoleListData,
AgentTreeData,
AgentDelegationGrantsData,
AgentDelegationGrantSyncPayload,
} from "@/types/api/admin-agent";
import type { AdminUserPermissionRow } from "@/types/api/admin-user";
const A = `/admin`;
export async function getAgentTree(adminSiteId?: number): Promise<AgentTreeData> {
return adminRequest.get<AgentTreeData>(`${A}/agent-nodes/tree`, {
params: adminSiteId ? { admin_site_id: adminSiteId } : undefined,
});
}
export async function postAgentNode(body: AgentNodeCreatePayload): Promise<AgentNodeRow> {
return adminRequest.post<AgentNodeRow>(`${A}/agent-nodes`, body);
}
export async function putAgentNode(
agentNodeId: number,
body: AgentNodeUpdatePayload,
): Promise<AgentNodeRow> {
return adminRequest.put<AgentNodeRow>(`${A}/agent-nodes/${agentNodeId}`, body);
}
export async function deleteAgentNode(agentNodeId: number): Promise<null> {
return adminRequest.delete<null>(`${A}/agent-nodes/${agentNodeId}`);
}
export async function getAgentNodeRoles(agentNodeId: number): Promise<AgentRoleListData> {
return adminRequest.get<AgentRoleListData>(`${A}/agent-nodes/${agentNodeId}/roles`);
}
export async function postAgentRole(
agentNodeId: number,
body: AgentRoleCreatePayload,
): Promise<AdminRoleRow> {
return adminRequest.post<AdminRoleRow>(`${A}/agent-nodes/${agentNodeId}/roles`, body);
}
export async function putAgentRole(
roleId: number,
body: { name?: string; description?: string | null; status?: number },
): Promise<AdminRoleRow> {
return adminRequest.put<AdminRoleRow>(`${A}/agent-roles/${roleId}`, body);
}
export async function putAgentRolePermissions(
roleId: number,
permissionSlugs: string[],
): Promise<AdminRoleRow> {
return adminRequest.put<AdminRoleRow>(`${A}/agent-roles/${roleId}/permissions`, {
permission_slugs: permissionSlugs,
});
}
export async function deleteAgentRole(roleId: number): Promise<{ deleted: boolean; id: number }> {
return adminRequest.delete<{ deleted: boolean; id: number }>(`${A}/agent-roles/${roleId}`);
}
export async function getAgentNodeAdminUsers(agentNodeId: number): Promise<AgentAdminUserListData> {
return adminRequest.get<AgentAdminUserListData>(`${A}/agent-nodes/${agentNodeId}/admin-users`);
}
export async function postAgentAdminUser(
agentNodeId: number,
body: AgentAdminUserCreatePayload,
): Promise<AdminUserPermissionRow> {
return adminRequest.post<AdminUserPermissionRow>(
`${A}/agent-nodes/${agentNodeId}/admin-users`,
body,
);
}
export async function putAgentAdminUserRoles(
adminUserId: number,
body: AgentAdminUserRoleSyncPayload,
): Promise<AdminUserPermissionRow> {
return adminRequest.put<AdminUserPermissionRow>(
`${A}/agent-admin-users/${adminUserId}/roles`,
body,
);
}
export async function getAgentDelegationGrants(
agentNodeId: number,
): Promise<AgentDelegationGrantsData> {
return adminRequest.get<AgentDelegationGrantsData>(
`${A}/agent-nodes/${agentNodeId}/delegation-grants`,
);
}
export async function putAgentDelegationGrants(
agentNodeId: number,
body: AgentDelegationGrantSyncPayload,
): Promise<AgentDelegationGrantsData> {
return adminRequest.put<AgentDelegationGrantsData>(
`${A}/agent-nodes/${agentNodeId}/delegation-grants`,
body,
);
}

View File

@@ -22,6 +22,7 @@ export type AdminDrawListQuery = {
per_page?: number;
draw_no?: string;
status?: string;
agent_node_id?: number;
};
export async function getAdminDraws(q: AdminDrawListQuery = {}): Promise<AdminDrawListData> {

View File

@@ -17,6 +17,7 @@ export async function getAdminPlayers(params?: {
keyword?: string;
status?: number;
site_code?: string;
agent_node_id?: number;
}): Promise<AdminPlayerListData> {
return adminRequest.get<AdminPlayerListData>(`${A}/players`, { params });
}

View File

@@ -27,3 +27,14 @@ export async function updateAdminSetting(
): Promise<AdminSettingItem> {
return adminRequest.put<AdminSettingItem>(`${A}/settings/${key}`, { value });
}
export type AdminSettingBatchItem = {
key: string;
value: unknown;
};
export async function updateAdminSettingsBatch(
items: AdminSettingBatchItem[],
): Promise<AdminSettingListResponse> {
return adminRequest.put<AdminSettingListResponse>(`${A}/settings/batch`, { items });
}

View File

@@ -18,6 +18,7 @@ export type AdminSettlementBatchListQuery = {
per_page?: number;
draw_no?: string;
status?: string;
agent_node_id?: number;
};
export async function getAdminSettlementBatches(
@@ -33,6 +34,7 @@ export async function getAdminSettlementBatch(batchId: number): Promise<AdminSet
export type AdminSettlementBatchDetailsQuery = {
page?: number;
per_page?: number;
agent_node_id?: number;
};
export async function getAdminSettlementBatchDetails(

View File

@@ -11,6 +11,7 @@ export type TicketItemsListQuery = {
player_id?: number;
player_account?: string;
site_code?: string;
agent_node_id?: number;
draw_no?: string;
status?: string[];
number?: string;

View File

@@ -22,6 +22,8 @@ export type TransferOrderListQuery = {
status?: string;
/** 仅异常processing / failed / pending_reconcile */
abnormal?: boolean;
site_code?: string;
agent_node_id?: number;
};
export async function getAdminTransferOrders(
@@ -45,6 +47,8 @@ export type WalletTransactionListQuery = {
biz_type?: string;
status?: string;
abnormal?: boolean;
site_code?: string;
agent_node_id?: number;
};
export async function getAdminWalletTransactions(