From 49879b432499f4d9b3032db6511a1497f511c53e Mon Sep 17 00:00:00 2001 From: Pushpendra Kumar Date: Tue, 2 Jan 2024 21:35:09 +0530 Subject: [PATCH] fix: view charge does not show minCap and maxCap --- .../create-charge.component.html | 60 +++++++++++++------ .../create-charge/create-charge.component.ts | 10 ++-- .../edit-charge/edit-charge.component.html | 33 ++++++++-- .../edit-charge/edit-charge.component.ts | 16 +++-- .../view-charge/view-charge.component.html | 21 ++++++- .../view-charge/view-charge.component.ts | 17 ++++-- 6 files changed, 118 insertions(+), 39 deletions(-) diff --git a/src/app/products/charges/create-charge/create-charge.component.html b/src/app/products/charges/create-charge/create-charge.component.html index cff1abf4a9..b36f0a00e5 100644 --- a/src/app/products/charges/create-charge/create-charge.component.html +++ b/src/app/products/charges/create-charge/create-charge.component.html @@ -11,7 +11,8 @@ Charge Applies To - + {{ chargeAppliesTo.value }} @@ -22,7 +23,8 @@ -
+
Charge Name @@ -59,7 +61,8 @@ Charge Calculation Type - + {{ chargeCalculationType.value }} @@ -71,7 +74,8 @@ Charge Payment Mode - + {{ chargePaymentMode.value }} @@ -86,7 +90,9 @@
- + Frequency Interval @@ -97,10 +103,13 @@ - + Charge Frequency - + {{ feeFrequency.value }} @@ -109,9 +118,12 @@ - + Due Date - + @@ -119,13 +131,15 @@ - + Repeat Every ({{ repeatEveryLabel }}) Repeat Every ({{ repeatEveryLabel }}) is required - + Repeat Every ({{ repeatEveryLabel }}) must be between 1 and 12 @@ -140,19 +154,27 @@ Amount is required - Amount must be a positive number with {{ currencyDecimalPlaces ? 'up to ' + currencyDecimalPlaces : 'no' }} decimal places + Amount must be a positive number with {{ currencyDecimalPlaces ? 'up to ' + + currencyDecimalPlaces : 'no' }} decimal places Amount must be a positive number - - + + Minimum Charge Cap - + Maximum Charge Cap @@ -174,7 +196,8 @@ Income from Charge - + {{ incomeOrLiabilityAccount.name }} @@ -197,11 +220,12 @@ - + -
+ \ No newline at end of file diff --git a/src/app/products/charges/create-charge/create-charge.component.ts b/src/app/products/charges/create-charge/create-charge.component.ts index 8ab738b535..98d01bb5c6 100644 --- a/src/app/products/charges/create-charge/create-charge.component.ts +++ b/src/app/products/charges/create-charge/create-charge.component.ts @@ -47,11 +47,11 @@ export class CreateChargeComponent implements OnInit { * @param {SettingsService} settingsService Settings Service */ constructor(private formBuilder: UntypedFormBuilder, - private productsService: ProductsService, - private route: ActivatedRoute, - private router: Router, - private dateUtils: Dates, - private settingsService: SettingsService) { + private productsService: ProductsService, + private route: ActivatedRoute, + private router: Router, + private dateUtils: Dates, + private settingsService: SettingsService) { this.route.data.subscribe((data: { chargesTemplate: any }) => { this.chargesTemplateData = data.chargesTemplate; if (data.chargesTemplate.incomeOrLiabilityAccountOptions.liabilityAccountOptions) { diff --git a/src/app/products/charges/edit-charge/edit-charge.component.html b/src/app/products/charges/edit-charge/edit-charge.component.html index 7840248004..675731cb54 100644 --- a/src/app/products/charges/edit-charge/edit-charge.component.html +++ b/src/app/products/charges/edit-charge/edit-charge.component.html @@ -11,7 +11,8 @@ Charges applies to - + {{ chargeAppliesTo.value }} @@ -70,7 +71,8 @@ Charge Payment By - + {{ chargePaymentMode.value }} @@ -86,11 +88,28 @@ Amount is required + + + Minimum Charge Cap + + + + Maximum Charge Cap + + Income from charge - + {{ income.name }} @@ -115,7 +134,8 @@
- + Add Fee Frequency
@@ -161,11 +181,12 @@ - + - + \ No newline at end of file diff --git a/src/app/products/charges/edit-charge/edit-charge.component.ts b/src/app/products/charges/edit-charge/edit-charge.component.ts index b3d8047bda..7feadb5b19 100644 --- a/src/app/products/charges/edit-charge/edit-charge.component.ts +++ b/src/app/products/charges/edit-charge/edit-charge.component.ts @@ -54,10 +54,10 @@ export class EditChargeComponent implements OnInit { * @param {SettingsService} settingsService Settings Service */ constructor(private productsService: ProductsService, - private formBuilder: UntypedFormBuilder, - private route: ActivatedRoute, - private router: Router, - private settingsService: SettingsService) { + private formBuilder: UntypedFormBuilder, + private route: ActivatedRoute, + private router: Router, + private settingsService: SettingsService) { this.route.data.subscribe((data: { chargesTemplate: any }) => { this.chargeData = data.chargesTemplate; }); @@ -80,6 +80,8 @@ export class EditChargeComponent implements OnInit { 'amount': [this.chargeData.amount, Validators.required], 'active': [this.chargeData.active], 'penalty': [this.chargeData.penalty], + 'minCap': [this.chargeData.minCap], + 'maxCap': [this.chargeData.maxCap], 'chargeTimeType': [this.chargeData.chargeTimeType.id, Validators.required], 'chargeCalculationType': [this.chargeData.chargeCalculationType.id, Validators.required], }); @@ -152,6 +154,12 @@ export class EditChargeComponent implements OnInit { if (charges.taxGroupId.value === '') { delete charges.taxGroupId; } + if (!charges.minCap) { + delete charges.minCap; + } + if (!charges.maxCap) { + delete charges.maxCap; + } this.productsService.updateCharge(this.chargeData.id.toString(), charges) .subscribe((response: any) => { this.router.navigate(['../'], { relativeTo: this.route }); diff --git a/src/app/products/charges/view-charge/view-charge.component.html b/src/app/products/charges/view-charge/view-charge.component.html index 8f61e4634e..537e5880fc 100644 --- a/src/app/products/charges/view-charge/view-charge.component.html +++ b/src/app/products/charges/view-charge/view-charge.component.html @@ -49,6 +49,22 @@ {{ chargeData.amount }} +
+ Minimum Charge Cap +
+ +
+ {{ chargeData.minCap }} +
+ +
+ Maximum Charge Cap +
+ +
+ {{ chargeData.maxCap }} +
+
Charge Time Type
@@ -93,7 +109,8 @@ Fee Frequency -
+
{{ chargeData.feeFrequency.value }}
@@ -130,4 +147,4 @@ -
+ \ No newline at end of file diff --git a/src/app/products/charges/view-charge/view-charge.component.ts b/src/app/products/charges/view-charge/view-charge.component.ts index cf42a71d48..c4e3a971f9 100644 --- a/src/app/products/charges/view-charge/view-charge.component.ts +++ b/src/app/products/charges/view-charge/view-charge.component.ts @@ -21,7 +21,9 @@ export class ViewChargeComponent implements OnInit { /** Charge data. */ chargeData: any; - + /** Boolean for MinCap and MaxCap */ + minCap: boolean; + maxCap: boolean; /** * Retrieves the charge data from `resolve`. * @param {ProductsService} productsService Products Service. @@ -30,11 +32,18 @@ export class ViewChargeComponent implements OnInit { * @param {MatDialog} dialog Dialog reference. */ constructor(private productsService: ProductsService, - private route: ActivatedRoute, - private router: Router, - private dialog: MatDialog) { + private route: ActivatedRoute, + private router: Router, + private dialog: MatDialog) { this.route.data.subscribe((data: { charge: any }) => { + console.log(data.charge); this.chargeData = data.charge; + if (this.chargeData.minCap) { + this.minCap = true; + } + if (this.chargeData.maxCap) { + this.maxCap = true; + } }); }