Skip to content

Commit d4a042b

Browse files
committed
WEB-460 Shares per Client Field Allows Zero and Negative Values in Share Product Creation Form
1 parent 5666fcb commit d4a042b

File tree

2 files changed

+39
-7
lines changed

2 files changed

+39
-7
lines changed

src/app/products/share-products/share-product-stepper/share-product-settings-step/share-product-settings-step.component.html

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,38 @@ <h4 class="mat-h4 flex-98">
1212

1313
<mat-form-field class="flex-31">
1414
<mat-label>{{ 'labels.inputs.Minimum' | translate }}</mat-label>
15-
<input type="number" matInput formControlName="minimumShares" />
15+
<input type="number" matInput formControlName="minimumShares" min="1" step="1" required />
16+
<mat-error *ngIf="shareProductSettingsForm.get('minimumShares').hasError('required')">
17+
{{ 'labels.inputs.Minimum Shares per Client' | translate }} {{ 'labels.commons.is' | translate }}
18+
<strong>{{ 'labels.commons.required' | translate }}</strong>
19+
</mat-error>
20+
<mat-error *ngIf="shareProductSettingsForm.get('minimumShares').hasError('min')">
21+
{{ 'labels.inputs.Minimum Shares per Client' | translate }} must be greater than zero
22+
</mat-error>
1623
</mat-form-field>
1724

1825
<mat-form-field class="flex-31">
1926
<mat-label>{{ 'labels.inputs.Default' | translate }}</mat-label>
20-
<input type="number" matInput formControlName="nominalShares" required />
21-
<mat-error>
27+
<input type="number" matInput formControlName="nominalShares" min="1" step="1" required />
28+
<mat-error *ngIf="shareProductSettingsForm.get('nominalShares').hasError('required')">
2229
{{ 'labels.inputs.Default Shares per Client' | translate }} {{ 'labels.commons.is' | translate }}
2330
<strong>{{ 'labels.commons.required' | translate }}</strong>
2431
</mat-error>
32+
<mat-error *ngIf="shareProductSettingsForm.get('nominalShares').hasError('min')">
33+
{{ 'labels.inputs.Default Shares per Client' | translate }} must be greater than zero
34+
</mat-error>
2535
</mat-form-field>
2636

2737
<mat-form-field class="flex-31">
2838
<mat-label>{{ 'labels.inputs.Maximum' | translate }}</mat-label>
29-
<input type="number" matInput formControlName="maximumShares" />
39+
<input type="number" matInput formControlName="maximumShares" min="1" step="1" required />
40+
<mat-error *ngIf="shareProductSettingsForm.get('maximumShares').hasError('required')">
41+
{{ 'labels.inputs.Maximum Shares per Client' | translate }} {{ 'labels.commons.is' | translate }}
42+
<strong>{{ 'labels.commons.required' | translate }}</strong>
43+
</mat-error>
44+
<mat-error *ngIf="shareProductSettingsForm.get('maximumShares').hasError('min')">
45+
{{ 'labels.inputs.Maximum Shares per Client' | translate }} must be greater than zero
46+
</mat-error>
3047
</mat-form-field>
3148

3249
<h4 class="mat-h4 flex-98">

src/app/products/share-products/share-product-stepper/share-product-settings-step/share-product-settings-step.component.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,27 @@ export class ShareProductSettingsStepComponent implements OnInit {
5454

5555
createShareProductSettingsForm() {
5656
this.shareProductSettingsForm = this.formBuilder.group({
57-
minimumShares: [''],
57+
minimumShares: [
58+
'',
59+
[
60+
Validators.required,
61+
Validators.min(1)
62+
]
63+
],
5864
nominalShares: [
5965
'',
60-
Validators.required
66+
[
67+
Validators.required,
68+
Validators.min(1)
69+
]
70+
],
71+
maximumShares: [
72+
'',
73+
[
74+
Validators.required,
75+
Validators.min(1)
76+
]
6177
],
62-
maximumShares: [''],
6378
minimumActivePeriodForDividends: [''],
6479
minimumactiveperiodFrequencyType: [''],
6580
lockinPeriodFrequency: [''],

0 commit comments

Comments
 (0)