Skip to content

Commit

Permalink
OPS-480: Add direction param (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
KeinAsylum authored Jul 10, 2024
1 parent 4f8cfd3 commit 1cb2999
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,25 @@
</mat-form-field>
<mat-form-field fxFlex>
<mat-label>{{ d('precision') }}</mat-label>
<input autocomplete="off" formControlName="precision" matInput type="number" />
<input
autocomplete="off"
formControlName="precision"
matInput
required
type="number"
/>
<mat-hint>{{ d('precisionHint') }}</mat-hint>
</mat-form-field>
<label class="dsh-subheading-1">{{ d('direction') }}:</label>
<mat-radio-group formControlName="direction" fxLayout fxLayoutGap="24px">
<mat-radio-button
*ngFor="let directionType of directionTypes"
[value]="directionType"
fxFlex="0 1 calc((100% - 24px * 2)/3)"
>
{{ directionType }}
</mat-radio-button>
</mat-radio-group>
<mat-form-field fxFlex>
<mat-label>{{ d('minAmountCondition') }}</mat-label>
<dsh-format-input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,17 @@ export class InvoiceRandomizeAmountFormComponent

control = this.fb.group({
deviation: null,
precision: null,
precision: 2,
direction: 'both',
minAmountCondition: null,
maxAmountCondition: null,
amountMultiplicityCondition: null,
}) as unknown as FormGroupByValue<Partial<FormData>>;

isRandomizeAmount = this.fb.control(false);

directionTypes: string[] = ['both', 'upward', 'downward'];

constructor(private fb: FormBuilder) {
super();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ReactiveFormsModule } from '@angular/forms';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatRadioModule } from '@angular/material/radio';
import { TranslocoModule } from '@ngneat/transloco';
import { FlexLayoutModule } from 'ng-flex-layout';

Expand All @@ -25,6 +26,7 @@ import { InvoiceRandomizeAmountFormComponent } from './invoice-randomize-amount-
TranslocoModule,
AmountCurrencyModule,
MatCheckboxModule,
MatRadioModule,
],
declarations: [InvoiceRandomizeAmountFormComponent],
exports: [InvoiceRandomizeAmountFormComponent],
Expand Down
3 changes: 2 additions & 1 deletion src/assets/i18n/components/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@
"isRandomizeAmount": "Randomly modify invoice's cost amount",
"deviation": "Deviation",
"deviationHint": "Specify the maximum deviation from the original amount.",
"precision": "Precision (optional)",
"precision": "Precision",
"precisionHint": "Set the parameter to round generated random amounts to the nearest ten.",
"direction": "Direction of deviation from original amount",
"minAmountCondition": "Min amount condition (optional)",
"minAmountConditionHint": "Set the parameter to specify the minimum generated amount.",
"maxAmountCondition": "Max amount condition (optional)",
Expand Down
3 changes: 2 additions & 1 deletion src/assets/i18n/components/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@
"isRandomizeAmount": "Случайным образом изменить сумму инвойса",
"deviation": "Отклонение",
"deviationHint": "Укажите максимальное отклонение от оригинальной суммы.",
"precision": "Точность (опционально)",
"precision": "Точность",
"precisionHint": "Установите параметр для округления генерируемых случайных сумм до ближайшего десятка.",
"direction": "Направление отклонения от оригинальной суммы",
"minAmountCondition": "Min amount condition (опционально)",
"minAmountConditionHint": "Установите параметр для указания минимальной генерируемой суммы.",
"maxAmountCondition": "Max amount condition (опционально)",
Expand Down

0 comments on commit 1cb2999

Please sign in to comment.