diff --git a/frontend/Exence/src/app/private/debts/create-debt-dialog/create-debt-dialog.component.html b/frontend/Exence/src/app/private/debts/create-debt-dialog/create-debt-dialog.component.html index b3b27941..3da86272 100644 --- a/frontend/Exence/src/app/private/debts/create-debt-dialog/create-debt-dialog.component.html +++ b/frontend/Exence/src/app/private/debts/create-debt-dialog/create-debt-dialog.component.html @@ -28,6 +28,7 @@ [control]="form.controls.originalAmount" [label]="'debts.create.originalAmount'" [min]="1" + [step]="amountStep()" /> @let currencyControl = form.controls.currency; diff --git a/frontend/Exence/src/app/private/debts/create-debt-dialog/create-debt-dialog.component.ts b/frontend/Exence/src/app/private/debts/create-debt-dialog/create-debt-dialog.component.ts index 6a5cd6bd..17d91326 100644 --- a/frontend/Exence/src/app/private/debts/create-debt-dialog/create-debt-dialog.component.ts +++ b/frontend/Exence/src/app/private/debts/create-debt-dialog/create-debt-dialog.component.ts @@ -23,7 +23,7 @@ import { EnumValuePipe } from '../../../shared/pipes/enum-value.pipe'; import { TranslatePipe } from '../../../shared/pipes/translate.pipe'; import { SelectAutoFocusDirective } from '../../../shared/select-auto-focus.directive'; import { TranslationCode } from '../../../shared/i18n/translation-types'; -import { localizeCurrency, toRawValueSignal } from '../../../shared/util/utils'; +import { getAmountStep, localizeCurrency, toRawValueSignal } from '../../../shared/util/utils'; import { ValidatorComponent } from '../../../shared/validator/validator.component'; import { CategoryService } from '../../transactions-and-categories/category.service'; import { MatDialogClose } from '@angular/material/dialog'; @@ -77,6 +77,8 @@ export class CreateDebtDialogComponent extends DialogComponent getAmountStep(1, this.currencyValue())); filteredCategories = computed(() => { const search = this.searchText(); diff --git a/frontend/Exence/src/app/private/debts/edit-debt-dialog/edit-debt-dialog.component.html b/frontend/Exence/src/app/private/debts/edit-debt-dialog/edit-debt-dialog.component.html index cabd9515..abf8743e 100644 --- a/frontend/Exence/src/app/private/debts/edit-debt-dialog/edit-debt-dialog.component.html +++ b/frontend/Exence/src/app/private/debts/edit-debt-dialog/edit-debt-dialog.component.html @@ -105,6 +105,7 @@ [control]="paymentForm.controls.amount" [label]="'debts.paymentAmount'" [min]="0.01" + [step]="amountStep()" /> getAmountStep(1, this.data.debt.currency)); debtTypes = DebtType; debtStatuses = DebtStatus; diff --git a/frontend/Exence/src/app/private/goals/create-goal-dialog/create-goal-dialog.component.html b/frontend/Exence/src/app/private/goals/create-goal-dialog/create-goal-dialog.component.html index 82396bca..340cfc48 100644 --- a/frontend/Exence/src/app/private/goals/create-goal-dialog/create-goal-dialog.component.html +++ b/frontend/Exence/src/app/private/goals/create-goal-dialog/create-goal-dialog.component.html @@ -18,12 +18,14 @@ [control]="form.controls.targetAmount" [label]="'goals.create.targetAmount'" [min]="1" + [step]="amountStep()" /> @if (form.hasError('initialAmountMax')) { diff --git a/frontend/Exence/src/app/private/goals/create-goal-dialog/create-goal-dialog.component.ts b/frontend/Exence/src/app/private/goals/create-goal-dialog/create-goal-dialog.component.ts index 806d449f..946c74af 100644 --- a/frontend/Exence/src/app/private/goals/create-goal-dialog/create-goal-dialog.component.ts +++ b/frontend/Exence/src/app/private/goals/create-goal-dialog/create-goal-dialog.component.ts @@ -21,7 +21,7 @@ import { InputClearButtonComponent } from '../../../shared/input-clear-button/in import { EnumValuePipe } from '../../../shared/pipes/enum-value.pipe'; import { TranslatePipe } from '../../../shared/pipes/translate.pipe'; import { SelectAutoFocusDirective } from '../../../shared/select-auto-focus.directive'; -import { localizeCurrency, toRawValueSignal } from '../../../shared/util/utils'; +import { getAmountStep, localizeCurrency, toRawValueSignal } from '../../../shared/util/utils'; import { ValidatorComponent } from '../../../shared/validator/validator.component'; import { ExtraValidators } from '../../../shared/validators'; import { CategoryService } from '../../transactions-and-categories/category.service'; @@ -76,6 +76,8 @@ export class CreateGoalDialogComponent extends DialogComponent getAmountStep(1, this.currencyValue())); filteredCategories = computed(() => { const search = this.searchText(); diff --git a/frontend/Exence/src/app/private/goals/edit-goal-dialog/edit-goal-dialog.component.html b/frontend/Exence/src/app/private/goals/edit-goal-dialog/edit-goal-dialog.component.html index 8cc3205d..bbce1e79 100644 --- a/frontend/Exence/src/app/private/goals/edit-goal-dialog/edit-goal-dialog.component.html +++ b/frontend/Exence/src/app/private/goals/edit-goal-dialog/edit-goal-dialog.component.html @@ -13,8 +13,18 @@
- - + +
@if (form.hasError('fieldNotLessThan')) { diff --git a/frontend/Exence/src/app/private/goals/edit-goal-dialog/edit-goal-dialog.component.ts b/frontend/Exence/src/app/private/goals/edit-goal-dialog/edit-goal-dialog.component.ts index c889958c..ef2fb2c9 100644 --- a/frontend/Exence/src/app/private/goals/edit-goal-dialog/edit-goal-dialog.component.ts +++ b/frontend/Exence/src/app/private/goals/edit-goal-dialog/edit-goal-dialog.component.ts @@ -21,7 +21,7 @@ import { InputClearButtonComponent } from '../../../shared/input-clear-button/in import { EnumValuePipe } from '../../../shared/pipes/enum-value.pipe'; import { TranslatePipe } from '../../../shared/pipes/translate.pipe'; import { SelectAutoFocusDirective } from '../../../shared/select-auto-focus.directive'; -import { localizeCurrency, toRawValueSignal } from '../../../shared/util/utils'; +import { getAmountStep, localizeCurrency, toRawValueSignal } from '../../../shared/util/utils'; import { ValidatorComponent } from '../../../shared/validator/validator.component'; import { ExtraValidators } from '../../../shared/validators'; import { CategoryService } from '../../transactions-and-categories/category.service'; @@ -60,6 +60,7 @@ export class EditGoalDialogComponent extends DialogComponent getAmountStep(1, this.data.goal.currency)); currencies = SupportedCurrency; goalStatuses = GoalStatus; diff --git a/frontend/Exence/src/app/private/investments/create-investment-dialog/create-investment-dialog.component.html b/frontend/Exence/src/app/private/investments/create-investment-dialog/create-investment-dialog.component.html index 32cfcc19..6e2d048e 100644 --- a/frontend/Exence/src/app/private/investments/create-investment-dialog/create-investment-dialog.component.html +++ b/frontend/Exence/src/app/private/investments/create-investment-dialog/create-investment-dialog.component.html @@ -51,6 +51,7 @@ [control]="form.controls.amount" [label]="'investments.create.amount'" [min]="0.01" + [step]="amountStep()" /> @let currencyControl = form.controls.currency; diff --git a/frontend/Exence/src/app/private/investments/create-investment-dialog/create-investment-dialog.component.ts b/frontend/Exence/src/app/private/investments/create-investment-dialog/create-investment-dialog.component.ts index ad146682..79db4604 100644 --- a/frontend/Exence/src/app/private/investments/create-investment-dialog/create-investment-dialog.component.ts +++ b/frontend/Exence/src/app/private/investments/create-investment-dialog/create-investment-dialog.component.ts @@ -1,4 +1,4 @@ -import { Component, DestroyRef, inject, signal } from '@angular/core'; +import { Component, computed, DestroyRef, inject, signal } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { NonNullableFormBuilder, ReactiveFormsModule, Validators } from '@angular/forms'; import { MatAutocompleteModule, MatAutocompleteSelectedEvent } from '@angular/material/autocomplete'; @@ -22,6 +22,7 @@ import { InputClearButtonComponent } from '../../../shared/input-clear-button/in import { EnumValuePipe } from '../../../shared/pipes/enum-value.pipe'; import { TranslatePipe } from '../../../shared/pipes/translate.pipe'; import { TranslationCode } from '../../../shared/i18n/translation-types'; +import { getAmountStep, toRawValueSignal } from '../../../shared/util/utils'; import { ValidatorComponent } from '../../../shared/validator/validator.component'; export interface CreateInvestmentDialogData { @@ -74,6 +75,9 @@ export class CreateInvestmentDialogComponent extends DialogComponent< note: this.fb.control('', [Validators.maxLength(500)]), }); + private currencyValue = toRawValueSignal(this.form.controls.currency); + amountStep = computed(() => getAmountStep(1, this.currencyValue())); + filteredAssets = signal<{ name: string; type: InvestmentType }[]>([]); constructor() { diff --git a/frontend/Exence/src/app/private/investments/edit-investment-dialog/edit-investment-dialog.component.html b/frontend/Exence/src/app/private/investments/edit-investment-dialog/edit-investment-dialog.component.html index 7341ab95..36cbd722 100644 --- a/frontend/Exence/src/app/private/investments/edit-investment-dialog/edit-investment-dialog.component.html +++ b/frontend/Exence/src/app/private/investments/edit-investment-dialog/edit-investment-dialog.component.html @@ -48,6 +48,7 @@ [control]="form.controls.amount" [label]="'investments.edit.amount'" [min]="0.01" + [step]="amountStep()" /> @let noteControl = form.controls.note; diff --git a/frontend/Exence/src/app/private/investments/edit-investment-dialog/edit-investment-dialog.component.ts b/frontend/Exence/src/app/private/investments/edit-investment-dialog/edit-investment-dialog.component.ts index dea2023a..1dd11fdd 100644 --- a/frontend/Exence/src/app/private/investments/edit-investment-dialog/edit-investment-dialog.component.ts +++ b/frontend/Exence/src/app/private/investments/edit-investment-dialog/edit-investment-dialog.component.ts @@ -1,4 +1,4 @@ -import { Component, DestroyRef, inject, signal } from '@angular/core'; +import { Component, computed, DestroyRef, inject, signal } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { NonNullableFormBuilder, ReactiveFormsModule, Validators } from '@angular/forms'; import { MatAutocompleteModule, MatAutocompleteSelectedEvent } from '@angular/material/autocomplete'; @@ -21,6 +21,7 @@ import { InputClearButtonComponent } from '../../../shared/input-clear-button/in import { EnumValuePipe } from '../../../shared/pipes/enum-value.pipe'; import { TranslatePipe } from '../../../shared/pipes/translate.pipe'; import { TranslationCode } from '../../../shared/i18n/translation-types'; +import { getAmountStep } from '../../../shared/util/utils'; import { ValidatorComponent } from '../../../shared/validator/validator.component'; export interface EditInvestmentDialogData { @@ -55,6 +56,7 @@ export class EditInvestmentDialogComponent extends DialogComponent getAmountStep(1, this.data.investment.currency)); form = this.fb.group({ asset: this.fb.control(this.data.investment.asset, [Validators.required, Validators.maxLength(100)]), diff --git a/frontend/Exence/src/app/private/transactions-and-categories/create-transaction-dialog/create-transaction-dialog.component.html b/frontend/Exence/src/app/private/transactions-and-categories/create-transaction-dialog/create-transaction-dialog.component.html index 1d2464e9..173f3f25 100644 --- a/frontend/Exence/src/app/private/transactions-and-categories/create-transaction-dialog/create-transaction-dialog.component.html +++ b/frontend/Exence/src/app/private/transactions-and-categories/create-transaction-dialog/create-transaction-dialog.component.html @@ -22,7 +22,12 @@
@let amountControl = form.controls.amount; - + @let dateControl = form.controls.date; getAmountStep(1, this.currencyValue())); + recurringDateFilter = computed((): DateFilterFn => { const frequency = this.frequencyValue(); const dayOfWeek = this.dayOfWeekValue(); diff --git a/frontend/Exence/src/app/private/transactions-and-categories/edit-transaction-dialog/edit-transaction-dialog.component.html b/frontend/Exence/src/app/private/transactions-and-categories/edit-transaction-dialog/edit-transaction-dialog.component.html index 39f0133c..5ca2449f 100644 --- a/frontend/Exence/src/app/private/transactions-and-categories/edit-transaction-dialog/edit-transaction-dialog.component.html +++ b/frontend/Exence/src/app/private/transactions-and-categories/edit-transaction-dialog/edit-transaction-dialog.component.html @@ -22,7 +22,12 @@
@let amountControl = form.controls.amount; - + @let dateControl = form.controls.date; {{ 'transaction.edit.date' | translate }} diff --git a/frontend/Exence/src/app/private/transactions-and-categories/edit-transaction-dialog/edit-transaction-dialog.component.ts b/frontend/Exence/src/app/private/transactions-and-categories/edit-transaction-dialog/edit-transaction-dialog.component.ts index 871f56b6..40ed4817 100644 --- a/frontend/Exence/src/app/private/transactions-and-categories/edit-transaction-dialog/edit-transaction-dialog.component.ts +++ b/frontend/Exence/src/app/private/transactions-and-categories/edit-transaction-dialog/edit-transaction-dialog.component.ts @@ -25,7 +25,7 @@ import { InputClearButtonComponent } from '../../../shared/input-clear-button/in import { EnumValuePipe } from '../../../shared/pipes/enum-value.pipe'; import { TranslatePipe } from '../../../shared/pipes/translate.pipe'; import { SelectAutoFocusDirective } from '../../../shared/select-auto-focus.directive'; -import { localizeCurrency, toRawValueSignal } from '../../../shared/util/utils'; +import { getAmountStep, localizeCurrency, toRawValueSignal } from '../../../shared/util/utils'; import { ValidatorComponent } from '../../../shared/validator/validator.component'; import { CategoryService } from '../category.service'; import { ExchangeRateRequest, ExchangeRateService } from '../../../shared/exchange-rate.service'; @@ -102,6 +102,8 @@ export class EditTransactionDialogComponent extends DialogComponent< private currencyValue = toRawValueSignal(this.form.controls.currency); private selectedType = toRawValueSignal(this.form.controls.type); + amountStep = computed(() => getAmountStep(1, this.currencyValue())); + private categories = signal([]); filteredCategories = computed(() => { diff --git a/frontend/Exence/src/app/shared/util/utils.ts b/frontend/Exence/src/app/shared/util/utils.ts index b8c30522..b99c74d3 100644 --- a/frontend/Exence/src/app/shared/util/utils.ts +++ b/frontend/Exence/src/app/shared/util/utils.ts @@ -9,6 +9,22 @@ import { TransactionFilter } from '../../data-model/modules/transaction/Transact import { TransactionType } from '../../data-model/modules/transaction/TransactionType'; import { SupportedCurrency } from '../../data-model/modules/user-settings/SupportedCurrency'; +const CURRENCY_STEP_MULTIPLIERS: Record = { + [SupportedCurrency.HUF]: 100, + [SupportedCurrency.EUR]: 1, + [SupportedCurrency.USD]: 1, + [SupportedCurrency.CAD]: 1, + [SupportedCurrency.GBP]: 1, + [SupportedCurrency.CHF]: 1, + [SupportedCurrency.PLN]: 1, + [SupportedCurrency.CZK]: 5, + [SupportedCurrency.RON]: 1, +}; + +export function getAmountStep(eurAmount: number, currency: SupportedCurrency): number { + return eurAmount * CURRENCY_STEP_MULTIPLIERS[currency]; +} + export function toRawValueSignal(control: AbstractControl): Signal { return toSignal(control.valueChanges.pipe(map(() => control.getRawValue() as T)), { initialValue: control.getRawValue() as T,