41 lines
1.5 KiB
TypeScript
41 lines
1.5 KiB
TypeScript
import { useAppSelector } from '@hooks';
|
|
import React from 'react';
|
|
import InternalAgentPerformanceCard from './InternalAgentPerformanceCard';
|
|
import PerformanceMeter from './PerformanceMeter';
|
|
import PerformanceOverview from './PerformanceOverview';
|
|
import AnomalyOverviewCard from './AnomalyTracker/AnomalyOverviewCard';
|
|
|
|
const InternalAgentDashboard = () => {
|
|
const performanceData = useAppSelector((state) => state.agentPerformance.performanceData);
|
|
const { totalCashCollected = 0, cases, totalEmiCashCollected = 0 } = performanceData || {};
|
|
|
|
const internalAgentPerformanceOverview = {
|
|
totalCashCollected,
|
|
totalEmiCashCollected,
|
|
atleastOneEmiCollected: cases?.atleastOneEmiCollected,
|
|
totalEmi: cases?.totalEmi,
|
|
};
|
|
const totalOpenAnomalies =
|
|
useAppSelector((state) => state?.anomalyTracker?.openAnomaliesList?.pages?.totalElements) || 0;
|
|
const totalClosedAnomalies =
|
|
useAppSelector((state) => state?.anomalyTracker?.closedAnomaliesList?.pages?.totalElements) ||
|
|
0;
|
|
const enableFieldAppAnomalyTracker = useAppSelector(
|
|
(state) => state?.user?.featureFlags?.enableFieldAppAnomalyTracker
|
|
);
|
|
const isOpenOrClosedAnomaliesPresent = totalOpenAnomalies + totalClosedAnomalies > 0;
|
|
|
|
return (
|
|
<>
|
|
{enableFieldAppAnomalyTracker && isOpenOrClosedAnomaliesPresent ? (
|
|
<AnomalyOverviewCard />
|
|
) : null}
|
|
<PerformanceOverview performanceOverviewData={internalAgentPerformanceOverview} />
|
|
<PerformanceMeter />
|
|
<InternalAgentPerformanceCard />
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default InternalAgentDashboard;
|