OPS-480: Add direction param (#190)

This commit is contained in:
Ildar Galeev 2024-07-10 17:47:08 +07:00 committed by GitHub
parent 4f8cfd3076
commit 1cb2999e20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 27 additions and 4 deletions

View File

@ -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

View File

@ -42,7 +42,8 @@ export class InvoiceRandomizeAmountFormComponent
control = this.fb.group({
deviation: null,
precision: null,
precision: 2,
direction: 'both',
minAmountCondition: null,
maxAmountCondition: null,
amountMultiplicityCondition: null,
@ -50,6 +51,8 @@ export class InvoiceRandomizeAmountFormComponent
isRandomizeAmount = this.fb.control(false);
directionTypes: string[] = ['both', 'upward', 'downward'];
constructor(private fb: FormBuilder) {
super();
}

View File

@ -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';
@ -25,6 +26,7 @@ import { InvoiceRandomizeAmountFormComponent } from './invoice-randomize-amount-
TranslocoModule,
AmountCurrencyModule,
MatCheckboxModule,
MatRadioModule,
],
declarations: [InvoiceRandomizeAmountFormComponent],
exports: [InvoiceRandomizeAmountFormComponent],

View File

@ -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)",

View File

@ -74,8 +74,9 @@
"isRandomizeAmount": "Случайным образом изменить сумму инвойса",
"deviation": "Отклонение",
"deviationHint": "Укажите максимальное отклонение от оригинальной суммы.",
"precision": "Точность (опционально)",
"precision": "Точность",
"precisionHint": "Установите параметр для округления генерируемых случайных сумм до ближайшего десятка.",
"direction": "Направление отклонения от оригинальной суммы",
"minAmountCondition": "Min amount condition (опционально)",
"minAmountConditionHint": "Установите параметр для указания минимальной генерируемой суммы.",
"maxAmountCondition": "Max amount condition (опционально)",