@@ -195,7 +199,7 @@ const Leaderboard: React.FC = props => {
className={styles.content}
style={{ justifyContent: 'right', flexDirection: 'column', padding: 0 }}
>
-
+
{performanceData ? (
diff --git a/src/components/leaderboard/leaderboardConstant.ts b/src/components/leaderboard/leaderboardConstant.ts
index 62b46aec..7cc83253 100644
--- a/src/components/leaderboard/leaderboardConstant.ts
+++ b/src/components/leaderboard/leaderboardConstant.ts
@@ -2,3 +2,15 @@ export enum PERFORMANCE_CHART_TYPE {
LAST_30_DAYS = 'LAST_30_DAYS',
LAST_7_DAYS = 'LAST_7_DAYS'
}
+
+export enum INCENTIVE_BUCKET_GROUP {
+ TOTAL = 'Total',
+ DPD_1_TO_30 = '1-30',
+ DPD_30_PLUS = '30+'
+}
+
+export const INCENTIVE_MONTH_KEYS = {
+ incentiveData: 'incentiveData',
+ prevMonthIncentiveData: 'prevMonthIncentiveData',
+ monthlyIncentiveData: 'monthlyIncentiveData'
+};
diff --git a/src/pages/Dashboard/Dashboard.tsx b/src/pages/Dashboard/Dashboard.tsx
index 314841cb..17a93050 100644
--- a/src/pages/Dashboard/Dashboard.tsx
+++ b/src/pages/Dashboard/Dashboard.tsx
@@ -393,7 +393,7 @@ const DashBoard = () => {
) : null}
-
+
void) {
+ dispatch(showLoader(true));
await axiosInstance
.get(encodeURI(url), {
headers: { donotHandleError: true },
@@ -366,6 +368,7 @@ export const getLeaderboardDetails = (
dispatch(setLeaderboard(response?.data));
})
.catch(err => {
+ dispatch(showLoader(false));
logError(err, 'Getting error from getLeaderboardDetails :: ' + url);
});
};
diff --git a/src/reducers/leaderboardSlice.ts b/src/reducers/leaderboardSlice.ts
index b31258b3..b9e43690 100644
--- a/src/reducers/leaderboardSlice.ts
+++ b/src/reducers/leaderboardSlice.ts
@@ -23,6 +23,10 @@ export interface ILeaderboard {
totalCurrentMonthCashCollected: any;
totalPrevMonthCashCollected: any;
isExpanded: boolean;
+ incentiveData?: IncentiveData;
+ prevMonthIncentiveData?: IncentiveData;
+ monthlyIncentiveData?: IncentiveData;
+ leaderboardLoading: boolean;
}
export interface IPromiseCount {
@@ -65,6 +69,18 @@ export interface IDataSet {
lowerLevelCashCollectedInLast30Days: string | null;
}
+export interface IncentiveData {
+ totalCashCollected?: number;
+ thresholdForIncentive?: number;
+ amountEligibleForIncentive?: number;
+ incentivePercentage?: number;
+ incentiveEarned?: number;
+ total1To30DaysCashCollected?: number;
+ total30PlusDaysCashCollected?: number;
+ total1To30DaysIncentiveEarned?: number;
+ total30PlusDaysIncentiveEarned?: number;
+}
+
const initialState = {
agentLevelRanking: 0,
maxLevel: 0,
@@ -82,7 +98,8 @@ const initialState = {
levelLowerLimit: 0
}
],
- isExpanded: false
+ isExpanded: false,
+ leaderboardLoading: false
} as unknown as ILeaderboard;
const COLOR_MAPPING = {
@@ -111,7 +128,10 @@ const notificationSlice = createSlice({
totalPrevMonthCashCollected,
todaysCashCollected,
noOfDaysCashCollected,
- dateWhenRankingVisible
+ dateWhenRankingVisible,
+ incentiveData,
+ prevMonthIncentiveData,
+ monthlyIncentiveData
} = action.payload;
// todo make it action.payload
state.agentLevelRanking = agentLevelRanking;
@@ -140,6 +160,10 @@ const notificationSlice = createSlice({
state.totalMonthlyCashCollected = monthlyCashCollected?.totalMonthlyCashCollected;
state.totalCurrentMonthCashCollected = totalCurrentMonthCashCollected;
state.totalPrevMonthCashCollected = totalPrevMonthCashCollected;
+ state.incentiveData = incentiveData;
+ state.prevMonthIncentiveData = prevMonthIncentiveData;
+ state.monthlyIncentiveData = monthlyIncentiveData;
+ state.leaderboardLoading = false;
},
setMonthlyPerformance(state, action) {
// state.performance = payload;
@@ -191,6 +215,9 @@ const notificationSlice = createSlice({
},
setIsExpanded(state, action) {
state.isExpanded = action.payload;
+ },
+ showLoader(state, action) {
+ state.leaderboardLoading = action.payload;
}
}
});
@@ -202,7 +229,8 @@ export const {
setPercentCompletedCases,
setPromiseCount,
setCallbridgeData,
- setIsExpanded
+ setIsExpanded,
+ showLoader
} = notificationSlice.actions;
export default notificationSlice.reducer;
diff --git a/src/utils/commonUtils.ts b/src/utils/commonUtils.ts
index 28ea7742..d5f4af94 100644
--- a/src/utils/commonUtils.ts
+++ b/src/utils/commonUtils.ts
@@ -17,6 +17,7 @@ import { getMaxInputDate } from '../pages/LiveLocationTracker/utils';
import { DateFormat } from './DateHelper';
export const casesPath = `/cases/details/lan/{accountNumber}/customer/{customerReferenceId}/tab/overview`;
+
export const isObjectEmpty = (object: any) => {
for (const prop in object) {
// eslint-disable-next-line no-prototype-builtins
@@ -30,7 +31,8 @@ export enum DEVICES {
IOS = 'IOS'
}
-export const getNumberFormat = (value: number | bigint, fractionalDigits: number) => {
+export const getNumberFormat = (value: number | bigint | undefined, fractionalDigits: number) => {
+ if (!value) return;
return new Intl.NumberFormat('en-IN', {
style: 'currency',
maximumFractionDigits: fractionalDigits,
@@ -126,18 +128,20 @@ export const toFixedWithoughtRoundOff = (value = 0, decimals = 2): string => {
export const shortNumberNotationWithoutTrailingZeroesAndRounding = (
value = 0,
decimals = 2,
- separator = ''
+ separator = '',
+ minThreshold = 1e5,
+ useNumberFormat = false
) => {
if (typeof value !== 'number') return '';
const parsedValue = Number(value);
- if (parsedValue >= 1e7) {
+ if (parsedValue >= 1e7 && minThreshold <= 1e7) {
return '₹' + toFixedWithoughtRoundOff(parsedValue / 1e7, decimals) + `${separator}Cr`;
- } else if (parsedValue >= 1e5) {
+ } else if (parsedValue >= 1e5 && minThreshold <= 1e5) {
return '₹' + toFixedWithoughtRoundOff(parsedValue / 1e5, decimals) + `${separator}L`;
- } else if (parsedValue >= 1e3) {
+ } else if (parsedValue >= 1e3 && minThreshold <= 1e3) {
return '₹' + toFixedWithoughtRoundOff(parsedValue / 1e3, decimals) + `${separator}K`;
}
- return '₹' + parsedValue;
+ return useNumberFormat ? getNumberFormat(parsedValue, decimals) : '₹' + parsedValue;
};
export const shortNumberNotationStartingWithLakhs = (