WEB-697 fix(loan-products): ensure preview step is visible on edit (#3153)
improve
This commit is contained in:
@@ -138,17 +138,16 @@
|
|||||||
</mifosx-loan-product-accounting-step>
|
</mifosx-loan-product-accounting-step>
|
||||||
</mat-step>
|
</mat-step>
|
||||||
|
|
||||||
@if (loanProductFormValidAndNotPristine) {
|
<mat-step state="preview" completed>
|
||||||
<mat-step state="preview" completed>
|
<ng-template matStepLabel>{{ 'labels.inputs.PREVIEW' | translate }}</ng-template>
|
||||||
<ng-template matStepLabel>{{ 'labels.inputs.PREVIEW' | translate }}</ng-template>
|
<mifosx-loan-product-preview-step
|
||||||
<mifosx-loan-product-preview-step
|
[loanProductsTemplate]="loanProductAndTemplate"
|
||||||
[loanProductsTemplate]="loanProductAndTemplate"
|
[accountingRuleData]="accountingRuleData"
|
||||||
[accountingRuleData]="accountingRuleData"
|
[loanProduct]="loanProduct"
|
||||||
[loanProduct]="loanProduct"
|
[isValid]="loanProductFormValid"
|
||||||
(submitEvent)="submit()"
|
(submitEvent)="submit()"
|
||||||
>
|
>
|
||||||
</mifosx-loan-product-preview-step>
|
</mifosx-loan-product-preview-step>
|
||||||
</mat-step>
|
</mat-step>
|
||||||
}
|
|
||||||
</mat-stepper>
|
</mat-stepper>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ export class EditLoanProductComponent implements OnInit {
|
|||||||
return this.loanProductAccountingStep.loanProductAccountingForm;
|
return this.loanProductAccountingStep.loanProductAccountingForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
get loanProductFormValidAndNotPristine() {
|
get loanProductFormValid(): boolean {
|
||||||
if (this.isAdvancedPaymentStrategy) {
|
if (this.isAdvancedPaymentStrategy) {
|
||||||
return (
|
return (
|
||||||
this.loanProductDetailsForm.valid &&
|
this.loanProductDetailsForm.valid &&
|
||||||
@@ -264,15 +264,7 @@ export class EditLoanProductComponent implements OnInit {
|
|||||||
this.loanProductSettingsForm.valid &&
|
this.loanProductSettingsForm.valid &&
|
||||||
this.loanProductAccountingForm.valid &&
|
this.loanProductAccountingForm.valid &&
|
||||||
this.loanIncomeCapitalizationForm != null &&
|
this.loanIncomeCapitalizationForm != null &&
|
||||||
this.loanIncomeCapitalizationForm.valid &&
|
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)
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
@@ -280,18 +272,40 @@ export class EditLoanProductComponent implements OnInit {
|
|||||||
this.loanProductCurrencyForm.valid &&
|
this.loanProductCurrencyForm.valid &&
|
||||||
this.loanProductTermsForm.valid &&
|
this.loanProductTermsForm.valid &&
|
||||||
this.loanProductSettingsForm.valid &&
|
this.loanProductSettingsForm.valid &&
|
||||||
this.loanProductAccountingForm.valid &&
|
this.loanProductAccountingForm.valid
|
||||||
(!this.loanProductDetailsForm.pristine ||
|
|
||||||
!this.loanProductCurrencyForm.pristine ||
|
|
||||||
!this.loanProductTermsForm.pristine ||
|
|
||||||
!this.loanProductSettingsForm.pristine ||
|
|
||||||
!this.loanProductChargesStep.pristine ||
|
|
||||||
!this.loanProductAccountingForm.pristine ||
|
|
||||||
this.wasPaymentAllocationChanged)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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() {
|
get loanProduct() {
|
||||||
const loanProduct = {
|
const loanProduct = {
|
||||||
...this.loanProductDetailsStep.loanProductDetails,
|
...this.loanProductDetailsStep.loanProductDetails,
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@
|
|||||||
<button mat-raised-button [routerLink]="['../']">
|
<button mat-raised-button [routerLink]="['../']">
|
||||||
{{ 'labels.buttons.Cancel' | translate }}
|
{{ 'labels.buttons.Cancel' | translate }}
|
||||||
</button>
|
</button>
|
||||||
<button mat-raised-button color="primary" (click)="submitEvent.emit()">
|
<button mat-raised-button color="primary" [disabled]="!isValid" (click)="submitEvent.emit()">
|
||||||
{{ 'labels.buttons.Submit' | translate }}
|
{{ 'labels.buttons.Submit' | translate }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+1
@@ -28,6 +28,7 @@ export class LoanProductPreviewStepComponent implements OnInit, OnChanges {
|
|||||||
@Input() loanProductsTemplate: any;
|
@Input() loanProductsTemplate: any;
|
||||||
@Input() accountingRuleData: any;
|
@Input() accountingRuleData: any;
|
||||||
@Input() loanProduct: any;
|
@Input() loanProduct: any;
|
||||||
|
@Input() isValid: boolean = true;
|
||||||
@Output() submitEvent = new EventEmitter();
|
@Output() submitEvent = new EventEmitter();
|
||||||
|
|
||||||
isAdvancedPaymentAllocation = false;
|
isAdvancedPaymentAllocation = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user