TP-23087|Kunal|Emi format changes (#211)

* TP-23087|Kunal|Emi format changes

* TP-23087|Kunal|Emi format changes
This commit is contained in:
Kunal Sharma
2023-04-06 20:47:33 +05:30
committed by GitHub Enterprise
parent c7f0d5055d
commit 9c09d4e3da
5 changed files with 43 additions and 65 deletions

View File

@@ -260,15 +260,13 @@ export enum InteractionStatuses {
export interface IOutstandingEmiDetail {
referenceId: string;
emiAmount: number;
penalInterest: number;
lateFee: number;
bounceFee: number;
otherFees: number;
emiPenaltyCharges: number;
}
export interface IOutstandingAmountBreakup {
emiAmount: number;
penalInterest: number;
lateFee: number;
bounceFee: number;
otherFees: number;
emiPenaltyCharges: number;
totalOverdueAmount: number;
}

View File

@@ -58,21 +58,18 @@ const getOutstandingAmountBreakUp = (
) => {
const outstandingAmountBreakup: IOutstandingAmountBreakup = {
emiAmount: 0,
penalInterest: 0,
lateFee: 0,
bounceFee: 0,
otherFees: 0,
emiPenaltyCharges: 0,
totalOverdueAmount: totalOverdueAmount,
};
_map(outstandingEmiDetails, record => {
outstandingAmountBreakup.emiAmount =
outstandingAmountBreakup.emiAmount + Number(record.emiAmount);
outstandingAmountBreakup.penalInterest =
outstandingAmountBreakup.penalInterest +
Number(record.penalInterest);
outstandingAmountBreakup.lateFee =
outstandingAmountBreakup.lateFee + Number(record.lateFee);
outstandingAmountBreakup.bounceFee =
outstandingAmountBreakup.bounceFee + Number(record.bounceFee);
outstandingAmountBreakup.emiAmount + (Number(record.emiAmount) ?? 0);
outstandingAmountBreakup.otherFees =
outstandingAmountBreakup.otherFees +
(Number(record.otherFees) ?? 0);
outstandingAmountBreakup.emiPenaltyCharges =
outstandingAmountBreakup.emiPenaltyCharges + (Number(record.emiPenaltyCharges) ?? 0);
});
return outstandingAmountBreakup;
@@ -546,9 +543,6 @@ const CollectionCaseDetails: React.FC<ICaseDetails> = props => {
caseDetail.outstandingEmiDetails,
caseDetail.totalOverdueAmount,
)}
outstandingEmiDetailsCount={
caseDetail.outstandingEmiDetails?.length
}
setShowOutstandingAmountBreakupBottomSheet={
setShowOutstandingAmountBottomSheet
}

View File

@@ -15,7 +15,6 @@ interface IOutstandingAmountBreakupProps {
React.SetStateAction<boolean>
>;
showOutstandingAmountBreakupBottomSheet: boolean;
outstandingEmiDetailsCount?: number;
}
const OutstandingAmountBreakupBottomSheet: React.FC<
@@ -24,11 +23,10 @@ const OutstandingAmountBreakupBottomSheet: React.FC<
outstandingEmiDetails,
setShowOutstandingAmountBreakupBottomSheet,
showOutstandingAmountBreakupBottomSheet,
outstandingEmiDetailsCount = 0 ,
}) => {
return (
<BottomSheet
heightPercentage={50}
heightPercentage={40}
visible={showOutstandingAmountBreakupBottomSheet}
HeaderNode={() => (
<View
@@ -63,9 +61,7 @@ const OutstandingAmountBreakupBottomSheet: React.FC<
GenericStyles.spaceBetween,
GenericStyles.pb16
]}>
<Text light>{`${outstandingEmiDetailsCount} EMI${
outstandingEmiDetailsCount > 1 ? 's' : ''
}`}</Text>
<Text light>{`EMI Amount`}</Text>
<Text dark>{formatAmount(outstandingEmiDetails.emiAmount)}</Text>
</View>
<View
@@ -75,10 +71,8 @@ const OutstandingAmountBreakupBottomSheet: React.FC<
GenericStyles.spaceBetween,
GenericStyles.pb16
]}>
<Text light>{`${outstandingEmiDetailsCount} Penal Interest${
outstandingEmiDetailsCount > 1 ? 's' : ''
}`}</Text>
<Text dark>{formatAmount(outstandingEmiDetails.penalInterest)}</Text>
<Text light>{`Emi Penalty Charges`}</Text>
<Text dark>{formatAmount(outstandingEmiDetails.emiPenaltyCharges)}</Text>
</View>
<View
style={[
@@ -87,22 +81,8 @@ const OutstandingAmountBreakupBottomSheet: React.FC<
GenericStyles.spaceBetween,
GenericStyles.pb16
]}>
<Text light>{`${outstandingEmiDetailsCount} Late fee${
outstandingEmiDetailsCount > 1 ? 's' : ''
}`}</Text>
<Text dark>{formatAmount(outstandingEmiDetails.lateFee)}</Text>
</View>
<View
style={[
GenericStyles.row,
GenericStyles.fill,
GenericStyles.spaceBetween,
GenericStyles.pb16
]}>
<Text light>{`${outstandingEmiDetailsCount} Bounce fee${
outstandingEmiDetailsCount > 1 ? 's' : ''
}`}</Text>
<Text dark>{formatAmount(outstandingEmiDetails.bounceFee)}</Text>
<Text light>{`Other Fees`}</Text>
<Text dark>{formatAmount(outstandingEmiDetails.otherFees)}</Text>
</View>
<View style={[styles.horizontalLine]} />
<View

View File

@@ -20,7 +20,7 @@ const EmiBreakupBottomSheet: React.FC<IEmiBreakupBottomSheet> = props => {
const { openBottomSheet, setOpenBottomSheet, emiItem, listNumber } = props;
return (
<BottomSheet
heightPercentage={50}
heightPercentage={40}
visible={openBottomSheet}
HeaderNode={() => (
<View style={[...row, GenericStyles.p16]}>
@@ -46,24 +46,29 @@ const EmiBreakupBottomSheet: React.FC<IEmiBreakupBottomSheet> = props => {
{formatAmount(emiItem?.totalUnpaidInterest ?? 0)}
</Text>
</View>
<View style={[...row, GenericStyles.pb16]}>
<Text light>Penal interest</Text>
<Text dark bold>
{formatAmount(emiItem?.totalUnpaidPenalInterest ?? 0)}
</Text>
</View>
<View style={[...row, GenericStyles.pb16]}>
<Text light>Late fees</Text>
<Text dark bold>
{formatAmount(emiItem?.totalUnpaidLateFeeAmount ?? 0)}
</Text>
</View>
<View style={[...row, GenericStyles.pb16]}>
<Text light>Bounce fees</Text>
<Text dark bold>
{formatAmount(emiItem?.totalUnpaidBounceFeeAmount ?? 0)}
</Text>
</View>
{
emiItem?.totalUnpaidEmiPenaltyCharges ?
(
<>
<View style={[...row, GenericStyles.pb16]}>
<Text light>Interest</Text>
<Text dark bold>
{formatAmount(emiItem?.totalUnpaidEmiPenaltyCharges ?? 0)}
</Text>
</View>
</>
) :
(
<>
<View style={[...row, GenericStyles.pb16]}>
<Text light>Other fees</Text>
<Text dark bold>
{formatAmount((emiItem?.totalUnpaidBounceFeeAmount ?? 0) + (emiItem?.totalUnpaidLateFeeAmount ?? 0) + (emiItem?.totalUnpaidPenalInterest ?? 0))}
</Text>
</View>
</>
)
}
<View style={styles.horizontalLine} />
<View style={[...row, GenericStyles.pb16]}>
<Text dark bold>

View File

@@ -22,6 +22,7 @@ export interface IEmiItem {
totalUnpaidPenalInterest: number;
totalUnpaidLateFeeAmount: number;
totalUnpaidBounceFeeAmount: number;
totalUnpaidEmiPenaltyCharges: number;
}
interface IEmiScheduleItem {
listNumber: number;