Pushing to update server
This commit is contained in:
parent
6d6bfd9089
commit
ce4c977efc
@ -31,8 +31,6 @@ export default function MatcherPageClient({
|
|||||||
}: MatcherPageClientProps) {
|
}: MatcherPageClientProps) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [matchType, setMatchType] = useState(initialMatchType);
|
const [matchType, setMatchType] = useState(initialMatchType);
|
||||||
const [sourceItems, setSourceItems] = useState(initialSourceItems);
|
|
||||||
const [targetItems, setTargetItems] = useState(initialTargetItems);
|
|
||||||
|
|
||||||
const currentConfig = MATCH_CONFIGS[matchType] || initialConfig;
|
const currentConfig = MATCH_CONFIGS[matchType] || initialConfig;
|
||||||
|
|
||||||
@ -99,8 +97,8 @@ export default function MatcherPageClient({
|
|||||||
</Alert>
|
</Alert>
|
||||||
|
|
||||||
<MatcherBoard
|
<MatcherBoard
|
||||||
sourceItems={sourceItems}
|
sourceItems={initialSourceItems}
|
||||||
targetItems={targetItems}
|
targetItems={initialTargetItems}
|
||||||
config={currentConfig}
|
config={currentConfig}
|
||||||
onMatch={handleMatch}
|
onMatch={handleMatch}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import {
|
|||||||
} from "@/app/dashboard/audits/auditConstants";
|
} from "@/app/dashboard/audits/auditConstants";
|
||||||
|
|
||||||
type AuditPageProps = {
|
type AuditPageProps = {
|
||||||
searchParams?: Record<string, string | string[] | undefined>;
|
searchParams?: Promise<Record<string, string | string[] | undefined>>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const toSingleValue = (value?: string | string[]): string | undefined => {
|
const toSingleValue = (value?: string | string[]): string | undefined => {
|
||||||
@ -24,11 +24,12 @@ const clampNumber = (value: number, min: number, max?: number) => {
|
|||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default async function AuditPage({ searchParams = {} }: AuditPageProps) {
|
export default async function AuditPage({ searchParams }: AuditPageProps) {
|
||||||
const pageParam = toSingleValue(searchParams.page);
|
const params = searchParams ? await searchParams : {};
|
||||||
const limitParam = toSingleValue(searchParams.limit);
|
const pageParam = toSingleValue(params?.page);
|
||||||
const sortParam = toSingleValue(searchParams.sort) || undefined;
|
const limitParam = toSingleValue(params?.limit);
|
||||||
const entityQuery = toSingleValue(searchParams.entity)?.trim() || "";
|
const sortParam = toSingleValue(params?.sort) || undefined;
|
||||||
|
const entityQuery = toSingleValue(params?.entity)?.trim() || "";
|
||||||
|
|
||||||
const page = clampNumber(parseInt(pageParam || "1", 10), 1);
|
const page = clampNumber(parseInt(pageParam || "1", 10), 1);
|
||||||
const parsedLimit = parseInt(limitParam || String(DEFAULT_PAGE_SIZE), 10);
|
const parsedLimit = parseInt(limitParam || String(DEFAULT_PAGE_SIZE), 10);
|
||||||
|
|||||||
@ -17,7 +17,7 @@ import { Range } from "react-date-range";
|
|||||||
import { DateRangePicker } from "../DateRangePicker/DateRangePicker";
|
import { DateRangePicker } from "../DateRangePicker/DateRangePicker";
|
||||||
import { StatItem } from "./components/StatItem";
|
import { StatItem } from "./components/StatItem";
|
||||||
import { DEFAULT_DATE_RANGE } from "./constants";
|
import { DEFAULT_DATE_RANGE } from "./constants";
|
||||||
import { IHealthData } from "@/app/services/health";
|
import { type IHealthData } from "@/app/services/types";
|
||||||
import { useDebouncedDateRange } from "@/app/hooks/useDebouncedDateRange";
|
import { useDebouncedDateRange } from "@/app/hooks/useDebouncedDateRange";
|
||||||
import { dashboardService } from "@/app/services/dashboardService";
|
import { dashboardService } from "@/app/services/dashboardService";
|
||||||
import { normalizeDateRangeForAPI } from "@/app/utils/formatDate";
|
import { normalizeDateRangeForAPI } from "@/app/utils/formatDate";
|
||||||
|
|||||||
@ -336,11 +336,10 @@ export function ApproveTable<T extends { id: string | number }>({
|
|||||||
|
|
||||||
<StatusChangeDialog
|
<StatusChangeDialog
|
||||||
open={modalOpen}
|
open={modalOpen}
|
||||||
|
transactionId={selected[0] as number}
|
||||||
newStatus={action}
|
newStatus={action}
|
||||||
reason={reason}
|
onClose={() => setModalOpen(false)}
|
||||||
setReason={setReason}
|
onStatusUpdated={handleStatusSave}
|
||||||
handleClose={() => setModalOpen(false)}
|
|
||||||
handleSave={handleStatusSave}
|
|
||||||
/>
|
/>
|
||||||
<HistoryModal
|
<HistoryModal
|
||||||
open={historyModal}
|
open={historyModal}
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
|
import { Range } from "react-date-range";
|
||||||
import { Box } from "@mui/material";
|
import { Box } from "@mui/material";
|
||||||
import { GeneralHealthCard } from "../../GeneralHealthCard/GeneralHealthCard";
|
import { GeneralHealthCard } from "../../GeneralHealthCard/GeneralHealthCard";
|
||||||
import { TransactionsWaitingApproval } from "../../TransactionsWaitingApproval/TransactionsWaitingApproval";
|
import { TransactionsWaitingApproval } from "../../TransactionsWaitingApproval/TransactionsWaitingApproval";
|
||||||
import { TransactionsOverView } from "../../TransactionsOverView/TransactionsOverview";
|
import { TransactionsOverView } from "../../TransactionsOverView/TransactionsOverview";
|
||||||
import { Range } from "react-date-range";
|
|
||||||
import {
|
import {
|
||||||
ITransactionsOverviewData,
|
type ITransactionsOverviewData,
|
||||||
IReviewTransactionsData,
|
type IReviewTransactionsData,
|
||||||
} from "@/app/services/health";
|
} from "@/app/services/types";
|
||||||
import { dashboardService } from "@/app/services/dashboardService";
|
import { dashboardService } from "@/app/services/dashboardService";
|
||||||
|
|
||||||
interface IDashboardHomePageProps {
|
interface IDashboardHomePageProps {
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import {
|
|||||||
type IReviewTransactionsData,
|
type IReviewTransactionsData,
|
||||||
type IReviewTransaction,
|
type IReviewTransaction,
|
||||||
} from "@/app/services/types";
|
} from "@/app/services/types";
|
||||||
|
import StatusChangeDialog from "../DataTable/StatusChangeDialog";
|
||||||
|
|
||||||
interface ITransactionsWaitingApprovalProps {
|
interface ITransactionsWaitingApprovalProps {
|
||||||
initialReviewTransactions?: IReviewTransactionsData | null;
|
initialReviewTransactions?: IReviewTransactionsData | null;
|
||||||
@ -40,6 +41,10 @@ export const TransactionsWaitingApproval = ({
|
|||||||
dashboardService.getCurrentDashboardData()?.reviewTransactions ||
|
dashboardService.getCurrentDashboardData()?.reviewTransactions ||
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
const [statusDialogData, setStatusDialogData] = useState<{
|
||||||
|
rowId: number;
|
||||||
|
newStatus: string;
|
||||||
|
} | null>(null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subscribe to dashboard data changes
|
* Subscribe to dashboard data changes
|
||||||
@ -67,7 +72,7 @@ export const TransactionsWaitingApproval = ({
|
|||||||
: "";
|
: "";
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: tx.id?.toString() || tx.external_id || "",
|
id: tx.id ?? tx.external_id ?? "",
|
||||||
user: tx.customer || "",
|
user: tx.customer || "",
|
||||||
created: formattedDate,
|
created: formattedDate,
|
||||||
type: tx.type || "",
|
type: tx.type || "",
|
||||||
@ -81,6 +86,10 @@ export const TransactionsWaitingApproval = ({
|
|||||||
const transactions = reviewTransactions?.transactions || [];
|
const transactions = reviewTransactions?.transactions || [];
|
||||||
const displayTransactions = transactions.map(formatTransaction);
|
const displayTransactions = transactions.map(formatTransaction);
|
||||||
|
|
||||||
|
const handleStatusChange = (rowId: number, newStatus: string) => {
|
||||||
|
setStatusDialogData({ rowId, newStatus });
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper elevation={3} className="transactions-waiting-approval">
|
<Paper elevation={3} className="transactions-waiting-approval">
|
||||||
<Box sx={{ p: 3 }}>
|
<Box sx={{ p: 3 }}>
|
||||||
@ -141,10 +150,16 @@ export const TransactionsWaitingApproval = ({
|
|||||||
<TableCell>{tx.amount}</TableCell>
|
<TableCell>{tx.amount}</TableCell>
|
||||||
<TableCell>{tx.psp}</TableCell>
|
<TableCell>{tx.psp}</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<IconButton color="success">
|
<IconButton
|
||||||
|
color="success"
|
||||||
|
onClick={() => handleStatusChange(tx.id, "approved")}
|
||||||
|
>
|
||||||
<CheckCircleIcon />
|
<CheckCircleIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton color="error">
|
<IconButton
|
||||||
|
color="error"
|
||||||
|
onClick={() => handleStatusChange(tx.id, "declined")}
|
||||||
|
>
|
||||||
<CancelIcon />
|
<CancelIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
@ -164,6 +179,12 @@ export const TransactionsWaitingApproval = ({
|
|||||||
</TableContainer>
|
</TableContainer>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
<StatusChangeDialog
|
||||||
|
open={Boolean(statusDialogData)}
|
||||||
|
transactionId={statusDialogData?.rowId ?? undefined}
|
||||||
|
newStatus={statusDialogData?.newStatus ?? ""}
|
||||||
|
onClose={() => setStatusDialogData(null)}
|
||||||
|
/>
|
||||||
</Paper>
|
</Paper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -73,7 +73,7 @@ export async function fetchDashboardDataService({
|
|||||||
fetchConfig
|
fetchConfig
|
||||||
),
|
),
|
||||||
fetch(
|
fetch(
|
||||||
`${BE_BASE_URL}/api/v1/transactions?limit=1000${
|
`${BE_BASE_URL}/api/v1/transactions?limit=1000&page=1${
|
||||||
queryString ? `&${queryString}` : ""
|
queryString ? `&${queryString}` : ""
|
||||||
}&Status==/review`,
|
}&Status==/review`,
|
||||||
fetchConfig
|
fetchConfig
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user