diff --git a/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.html b/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.html
index 60f67b112..8e2da682b 100644
--- a/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.html
+++ b/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.html
@@ -138,17 +138,16 @@
- @if (loanProductFormValidAndNotPristine) {
-
- {{ 'labels.inputs.PREVIEW' | translate }}
-
-
-
- }
+
+ {{ 'labels.inputs.PREVIEW' | translate }}
+
+
+
diff --git a/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.ts b/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.ts
index 59577cc74..9e0b2af1e 100644
--- a/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.ts
+++ b/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.ts
@@ -255,7 +255,7 @@ export class EditLoanProductComponent implements OnInit {
return this.loanProductAccountingStep.loanProductAccountingForm;
}
- get loanProductFormValidAndNotPristine() {
+ get loanProductFormValid(): boolean {
if (this.isAdvancedPaymentStrategy) {
return (
this.loanProductDetailsForm.valid &&
@@ -264,15 +264,7 @@ export class EditLoanProductComponent implements OnInit {
this.loanProductSettingsForm.valid &&
this.loanProductAccountingForm.valid &&
this.loanIncomeCapitalizationForm != null &&
- this.loanIncomeCapitalizationForm.valid &&
- (!this.loanProductDetailsForm.pristine ||
- !this.loanProductCurrencyForm.pristine ||
- !this.loanProductTermsForm.pristine ||
- !this.loanProductSettingsForm.pristine ||
- !this.loanProductChargesStep.pristine ||
- !this.loanProductAccountingForm.pristine ||
- !this.loanIncomeCapitalizationForm.pristine ||
- this.wasPaymentAllocationChanged)
+ this.loanIncomeCapitalizationForm.valid
);
} else {
return (
@@ -280,18 +272,40 @@ export class EditLoanProductComponent implements OnInit {
this.loanProductCurrencyForm.valid &&
this.loanProductTermsForm.valid &&
this.loanProductSettingsForm.valid &&
- this.loanProductAccountingForm.valid &&
- (!this.loanProductDetailsForm.pristine ||
- !this.loanProductCurrencyForm.pristine ||
- !this.loanProductTermsForm.pristine ||
- !this.loanProductSettingsForm.pristine ||
- !this.loanProductChargesStep.pristine ||
- !this.loanProductAccountingForm.pristine ||
- this.wasPaymentAllocationChanged)
+ this.loanProductAccountingForm.valid
);
}
}
+ get loanProductFormDirty(): boolean {
+ if (this.isAdvancedPaymentStrategy) {
+ return (
+ !this.loanProductDetailsForm.pristine ||
+ !this.loanProductCurrencyForm.pristine ||
+ !this.loanProductTermsForm.pristine ||
+ !this.loanProductSettingsForm.pristine ||
+ !this.loanProductChargesStep.pristine ||
+ !this.loanProductAccountingForm.pristine ||
+ !(this.loanIncomeCapitalizationForm?.pristine ?? true) ||
+ this.wasPaymentAllocationChanged
+ );
+ } else {
+ return (
+ !this.loanProductDetailsForm.pristine ||
+ !this.loanProductCurrencyForm.pristine ||
+ !this.loanProductTermsForm.pristine ||
+ !this.loanProductSettingsForm.pristine ||
+ !this.loanProductChargesStep.pristine ||
+ !this.loanProductAccountingForm.pristine ||
+ this.wasPaymentAllocationChanged
+ );
+ }
+ }
+
+ get loanProductFormValidAndNotPristine(): boolean {
+ return this.loanProductFormValid && this.loanProductFormDirty;
+ }
+
get loanProduct() {
const loanProduct = {
...this.loanProductDetailsStep.loanProductDetails,
diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-preview-step/loan-product-preview-step.component.html b/src/app/products/loan-products/loan-product-stepper/loan-product-preview-step/loan-product-preview-step.component.html
index 0f4b9279a..426778619 100644
--- a/src/app/products/loan-products/loan-product-stepper/loan-product-preview-step/loan-product-preview-step.component.html
+++ b/src/app/products/loan-products/loan-product-stepper/loan-product-preview-step/loan-product-preview-step.component.html
@@ -25,7 +25,7 @@
-