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,
);
}