feat(settlement, admin): introduce new types and functions for downline share and settlement period hints
Added new types for downline share breakdown and settlement period open hints to enhance the agent settlement API. Updated the admin console components to support these new features, improving the user experience with better data presentation and interaction. Additionally, refined the date range field to accommodate new calendar markers and hints, ensuring a more intuitive interface for managing settlement periods.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import {
|
||||
@@ -18,8 +18,9 @@ import {
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { useAdminProfile } from "@/stores/admin-session";
|
||||
|
||||
const REPORT_TYPES: AgentSettlementReportType[] = [
|
||||
const ALL_REPORT_TYPES: AgentSettlementReportType[] = [
|
||||
"summary",
|
||||
"player_win_loss",
|
||||
"agent_share",
|
||||
@@ -43,6 +44,14 @@ export function AgentSettlementReportsPanel({
|
||||
currencyCode,
|
||||
}: AgentSettlementReportsPanelProps): React.ReactElement {
|
||||
const { t } = useTranslation(["agents", "common"]);
|
||||
const profile = useAdminProfile();
|
||||
const reportTypes = useMemo(
|
||||
() =>
|
||||
profile?.agent != null
|
||||
? ALL_REPORT_TYPES.filter((type) => type !== "platform_pnl")
|
||||
: ALL_REPORT_TYPES,
|
||||
[profile?.agent],
|
||||
);
|
||||
const [reportType, setReportType] = useState<AgentSettlementReportType>("summary");
|
||||
const [response, setResponse] = useState<AgentSettlementReportResponse | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -82,7 +91,7 @@ export function AgentSettlementReportsPanel({
|
||||
<SelectValue>{() => reportTypeLabel(reportType)}</SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{REPORT_TYPES.map((key) => (
|
||||
{reportTypes.map((key) => (
|
||||
<SelectItem key={key} value={key}>
|
||||
{reportTypeLabel(key)}
|
||||
</SelectItem>
|
||||
|
||||
Reference in New Issue
Block a user