WEB-172 Merging all changes from main branch into dev branch (#2450)
This commit is contained in:
@@ -200,15 +200,22 @@
|
||||
-->
|
||||
<mat-form-field fxFlex="48%" *ngIf="showMinMaxCap()">
|
||||
<mat-label>{{ 'labels.inputs.Minimum Charge Cap' | translate }}</mat-label>
|
||||
<input matInput formControlName="minCap" />
|
||||
<input matInput autofocus formControlName="minCap" mifosxValidateOnFocus />
|
||||
<mat-error *ngIf="chargeForm.controls.minCap.hasError('maxValue')">
|
||||
{{ 'errors.validation.msg.loanproduct.maximumGap.not.greater.than.specified.number' | translate }} ({{
|
||||
chargeForm.controls.maxCap.value
|
||||
}})
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field fxFlex="48%" *ngIf="showMinMaxCap()">
|
||||
<mat-label>{{ 'labels.inputs.Maximum Charge Cap' | translate }}</mat-label>
|
||||
<input matInput [min]="chargeForm.value.minCap" formControlName="maxCap" />
|
||||
<mat-error *ngIf="chargeForm.errors?.minGreaterThanMax">
|
||||
{{ 'labels.inputs.Maximum Charge Cap' | translate }} ({{ repeatEveryLabel }})
|
||||
<strong>{{ 'labels.commons.must higher than Minimum Charge Cap' | translate }}</strong>
|
||||
<input matInput autofocus formControlName="maxCap" mifosxValidateOnFocus />
|
||||
|
||||
<mat-error *ngIf="chargeForm.controls.maxCap.hasError('minValue')">
|
||||
{{ 'errors.validation.msg.loanproduct.maximumGap.not.greater.than.specified.number' | translate }} ({{
|
||||
chargeForm.controls.minCap.value
|
||||
}})
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { ProductsService } from '../../products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
import { minLessThanOrEqualMaxValidator } from 'app/shared/validators/min-max-values.validator';
|
||||
import { minNumberValueValidator } from 'app/shared/validators/min-number-value.validator';
|
||||
import { maxNumberValueValidator } from 'app/shared/validators/max-number-value.validator';
|
||||
|
||||
/**
|
||||
* Create charge component.
|
||||
@@ -80,40 +81,45 @@ export class CreateChargeComponent implements OnInit {
|
||||
* Creates the charge form.
|
||||
*/
|
||||
createChargeForm() {
|
||||
this.chargeForm = this.formBuilder.group(
|
||||
{
|
||||
chargeAppliesTo: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
name: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
currencyCode: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
chargeTimeType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
chargeCalculationType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
amount: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
active: [false],
|
||||
penalty: [false],
|
||||
taxGroupId: [''],
|
||||
minCap: [''],
|
||||
maxCap: ['']
|
||||
},
|
||||
{ validators: minLessThanOrEqualMaxValidator('minCap', 'maxCap') }
|
||||
);
|
||||
this.chargeForm = this.formBuilder.group({
|
||||
chargeAppliesTo: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
name: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
currencyCode: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
chargeTimeType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
chargeCalculationType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
amount: [
|
||||
'',
|
||||
[
|
||||
Validators.required,
|
||||
Validators.pattern('^\\s*(?=.*[1-9])\\d*(?:\\.\\d+)?\\s*$')]
|
||||
],
|
||||
active: [false],
|
||||
penalty: [false],
|
||||
taxGroupId: [null],
|
||||
minCap: [
|
||||
null,
|
||||
[maxNumberValueValidator('maxCap')]
|
||||
],
|
||||
maxCap: [
|
||||
null,
|
||||
[minNumberValueValidator('minCap')]
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -112,12 +112,11 @@
|
||||
"
|
||||
>
|
||||
<mat-label>{{ 'labels.inputs.Minimum Charge Cap' | translate }}</mat-label>
|
||||
<input matInput autofocus formControlName="minCap" />
|
||||
<mat-error
|
||||
*ngIf="chargeForm.controls.maxCap.hasError('minGreaterThanMax') || chargeForm.errors?.minGreaterThanMax"
|
||||
>
|
||||
{{ 'labels.inputs.Minimum Charge Cap' | translate }} ({{ repeatEveryLabel }})
|
||||
<strong>{{ 'labels.commons.must lower than Maximum Charge Cap' | translate }}</strong>
|
||||
<input matInput autofocus formControlName="minCap" mifosxValidateOnFocus />
|
||||
<mat-error *ngIf="chargeForm.controls.minCap.hasError('maxValue')">
|
||||
{{ 'errors.validation.msg.loanproduct.maximumGap.not.greater.than.specified.number' | translate }} ({{
|
||||
chargeForm.controls.maxCap.value
|
||||
}})
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field
|
||||
@@ -137,10 +136,12 @@
|
||||
"
|
||||
>
|
||||
<mat-label>{{ 'labels.inputs.Maximum Charge Cap' | translate }}</mat-label>
|
||||
<input matInput [min]="chargeForm.value.minCap" autofocus formControlName="maxCap" />
|
||||
<mat-error *ngIf="chargeForm.hasError('minGreaterThanMax') || chargeForm.errors?.minGreaterThanMax">
|
||||
{{ 'labels.inputs.Maximum Charge Cap' | translate }} ({{ repeatEveryLabel }})
|
||||
<strong>{{ 'labels.commons.must be equal or greater than Minimum Charge Cap' | translate }}</strong>
|
||||
<input matInput autofocus formControlName="maxCap" mifosxValidateOnFocus />
|
||||
|
||||
<mat-error *ngIf="chargeForm.controls.maxCap.hasError('minValue')">
|
||||
{{ 'errors.validation.msg.loanproduct.maximumGap.not.greater.than.specified.number' | translate }} ({{
|
||||
chargeForm.controls.minCap.value
|
||||
}})
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
/** Custom Services */
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { minLessThanOrEqualMaxValidator } from 'app/shared/validators/min-max-values.validator';
|
||||
import { maxNumberValueValidator } from 'app/shared/validators/max-number-value.validator';
|
||||
import { minNumberValueValidator } from 'app/shared/validators/min-number-value.validator';
|
||||
|
||||
/**
|
||||
* Edit Charge component.
|
||||
@@ -74,39 +75,43 @@ export class EditChargeComponent implements OnInit {
|
||||
editChargeForm() {
|
||||
this.showFeeOptions = this.chargeData.feeInterval && this.chargeData.feeInterval > 0;
|
||||
|
||||
this.chargeForm = this.formBuilder.group(
|
||||
{
|
||||
name: [
|
||||
this.chargeData.name,
|
||||
Validators.required
|
||||
],
|
||||
chargeAppliesTo: [
|
||||
{ value: this.chargeData.chargeAppliesTo.id, disabled: true },
|
||||
Validators.required
|
||||
],
|
||||
currencyCode: [
|
||||
this.chargeData.currency.code,
|
||||
Validators.required
|
||||
],
|
||||
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
|
||||
]
|
||||
},
|
||||
{ validators: minLessThanOrEqualMaxValidator('minCap', 'maxCap') }
|
||||
);
|
||||
this.chargeForm = this.formBuilder.group({
|
||||
name: [
|
||||
this.chargeData.name,
|
||||
Validators.required
|
||||
],
|
||||
chargeAppliesTo: [
|
||||
{ value: this.chargeData.chargeAppliesTo.id, disabled: true },
|
||||
Validators.required
|
||||
],
|
||||
currencyCode: [
|
||||
this.chargeData.currency.code,
|
||||
Validators.required
|
||||
],
|
||||
amount: [
|
||||
this.chargeData.amount,
|
||||
Validators.required
|
||||
],
|
||||
active: [this.chargeData.active],
|
||||
penalty: [this.chargeData.penalty],
|
||||
minCap: [
|
||||
this.chargeData.minCap || null,
|
||||
,
|
||||
[maxNumberValueValidator('maxCap')]
|
||||
],
|
||||
maxCap: [
|
||||
this.chargeData.maxCap || null,
|
||||
[minNumberValueValidator('minCap')]
|
||||
],
|
||||
chargeTimeType: [
|
||||
this.chargeData.chargeTimeType.id,
|
||||
Validators.required
|
||||
],
|
||||
chargeCalculationType: [
|
||||
this.chargeData.chargeCalculationType.id,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
switch (this.chargeData.chargeAppliesTo.value) {
|
||||
case 'Loan': {
|
||||
this.chargeTimeTypeOptions = this.chargeData.loanChargeTimeTypeOptions;
|
||||
|
||||
Reference in New Issue
Block a user