Fix: Product charges use of Min and Max Cap values

This commit is contained in:
Jose Alberto Hernandez
2024-04-19 06:32:32 -06:00
committed by Jose Alberto Hernandez
parent 8875d6b693
commit 64758cb847
2 changed files with 17 additions and 4 deletions
@@ -167,14 +167,12 @@
* In saving case: Only for 1. charge time type is "withdrawlfee" or "savings no activity fee" with charge calculation type as "% amount"
* In shares case: Only for charge time type: SHARE_PURCHASE and SHARE_REDEEM and with charge calculation type as % amount only
-->
<mat-form-field fxFlex="48%"
*ngIf="(chargeForm.controls.chargeAppliesTo.value === 1 && (chargeForm.controls.chargeCalculationType.value === 2 || chargeForm.controls.chargeCalculationType.value === 3 || chargeForm.controls.chargeCalculationType.value === 4 || chargeForm.controls.chargeCalculationType.value==5)) || (chargeForm.controls.chargeAppliesTo.value === 2 && (chargeForm.controls.chargeTimeType.value === 16 || chargeForm.controls.chargeTimeType.value === 5)&&(chargeForm.controls.chargeCalculationType.value === 2)) || (chargeForm.controls.chargeAppliesTo.value === 4 && (chargeForm.controls.chargeTimeType.value==14 || chargeForm.controls.chargeTimeType.value==15) && chargeForm.controls.chargeCalculationType.value === 2)">
<mat-form-field fxFlex="48%" *ngIf="showMinMaxCap()">
<mat-label>{{"labels.inputs.Minimum Charge Cap" | translate}}</mat-label>
<input matInput formControlName="minCap">
</mat-form-field>
<mat-form-field fxFlex="48%"
*ngIf="(chargeForm.controls.chargeAppliesTo.value === 1 && (chargeForm.controls.chargeCalculationType.value === 2 || chargeForm.controls.chargeCalculationType.value === 3 || chargeForm.controls.chargeCalculationType.value === 4 || chargeForm.controls.chargeCalculationType.value==5)) || (chargeForm.controls.chargeAppliesTo.value === 2 && (chargeForm.controls.chargeTimeType.value === 16 || chargeForm.controls.chargeTimeType.value === 5)&&(chargeForm.controls.chargeCalculationType.value === 2)) || (chargeForm.controls.chargeAppliesTo.value === 4 && (chargeForm.controls.chargeTimeType.value==14 || chargeForm.controls.chargeTimeType.value==15) && chargeForm.controls.chargeCalculationType.value === 2)">
<mat-form-field fxFlex="48%" *ngIf="showMinMaxCap()">
<mat-label>{{"labels.inputs.Maximum Charge Cap" | translate}}</mat-label>
<input matInput formControlName="maxCap">
</mat-form-field>
@@ -138,6 +138,21 @@ export class CreateChargeComponent implements OnInit {
});
}
showMinMaxCap(): boolean {
const chargeAppliesTo = this.chargeForm.controls.chargeAppliesTo.value;
const chargeCalculationType = this.chargeForm.controls.chargeCalculationType.value;
const chargeTimeType = this.chargeForm.controls.chargeTimeType.value;
if (chargeAppliesTo === 1) {
return (chargeCalculationType === 2 || chargeCalculationType === 3 || chargeCalculationType === 4 || chargeCalculationType === 5);
} else if (chargeAppliesTo === 2) {
return (chargeTimeType === 16 || chargeTimeType === 5) && (chargeCalculationType === 2);
} else if (chargeAppliesTo === 4) {
return ((chargeTimeType === 14 || chargeTimeType === 15) && chargeCalculationType === 2);
}
return false;
}
/**
* Sets the conditional controls of the user form
*/