@@ -66,7 +66,7 @@ export class CreatePage {
|
||||
minAmount = signal<number>(30);
|
||||
maxAmount = signal<number>(200_000);
|
||||
|
||||
amount = signal<number>(100);
|
||||
amount = signal<number | null>(null);
|
||||
note = signal<string>('');
|
||||
error = signal<string>('');
|
||||
loading = signal<boolean>(false);
|
||||
@@ -122,11 +122,11 @@ export class CreatePage {
|
||||
|
||||
createCheck(): void {
|
||||
const val = this.amount();
|
||||
if (!val || val < this.minAmount()) {
|
||||
if (val !== null && val < this.minAmount()) {
|
||||
this.error.set(`${this.t('errors.invalid_amount')} (мин. ${this.minAmount()} ₽)`);
|
||||
return;
|
||||
}
|
||||
if (val > this.maxAmount()) {
|
||||
if (val !== null && val > this.maxAmount()) {
|
||||
this.error.set(`${this.t('errors.invalid_amount')} (макс. ${this.maxAmount().toLocaleString('ru')} ₽)`);
|
||||
return;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ export class CreatePage {
|
||||
`${QR_VITANOVA_API}/qr`,
|
||||
{
|
||||
qrtype: 'QRDynamic',
|
||||
amount: val,
|
||||
...(val !== null ? { amount: val } : {}),
|
||||
currency: this.currency(),
|
||||
partnerqrID,
|
||||
qrDescription: this.note().trim(),
|
||||
@@ -225,7 +225,7 @@ export class CreatePage {
|
||||
this.store.setCreated({
|
||||
fastcheck: res.fastcheck,
|
||||
code: res.code,
|
||||
amount: this.amount(),
|
||||
amount: this.amount() ?? null,
|
||||
expiration: res.expiration
|
||||
});
|
||||
}
|
||||
@@ -235,9 +235,9 @@ export class CreatePage {
|
||||
});
|
||||
}
|
||||
|
||||
onAmountChange(value: number): void {
|
||||
this.amount.set(value);
|
||||
if (value > 0) this.error.set('');
|
||||
onAmountChange(value: number | null): void {
|
||||
this.amount.set(value || null);
|
||||
if (value && value > 0) this.error.set('');
|
||||
}
|
||||
|
||||
onNoteChange(value: string): void {
|
||||
|
||||
Reference in New Issue
Block a user