fixed : proper enabling of inputs after each scanning in depist and withdraw
This commit is contained in:
parent
68d3ff34da
commit
8bdd2e0b74
@ -99,20 +99,37 @@
|
||||
<div class="deposit-form">
|
||||
<label>Operator ID</label>
|
||||
<input
|
||||
type="text"
|
||||
[(ngModel)]="depositOperatorId"
|
||||
class="deposit-input"
|
||||
/>
|
||||
type="text"
|
||||
[(ngModel)]="depositOperatorId"
|
||||
class="deposit-input"
|
||||
maxlength="12"
|
||||
inputmode="numeric"
|
||||
pattern="\d*"
|
||||
(input)="checkDepositOperatorLength()"
|
||||
aria-label="Deposit Operator ID"
|
||||
/>
|
||||
|
||||
|
||||
<label>Shroff ID</label>
|
||||
<input
|
||||
type="text"
|
||||
[(ngModel)]="depositShroffId"
|
||||
class="deposit-input"
|
||||
/>
|
||||
#depositShroffIdInput
|
||||
type="text"
|
||||
[(ngModel)]="depositShroffId"
|
||||
class="deposit-input"
|
||||
maxlength="12"
|
||||
inputmode="numeric"
|
||||
pattern="\d*"
|
||||
aria-label="Deposit Shroff ID"
|
||||
(input)="checkDepositShroffLength()"
|
||||
/>
|
||||
|
||||
<label>Amount</label>
|
||||
<input type="text" [(ngModel)]="depositAmount" class="deposit-input" />
|
||||
<input
|
||||
#depositAmountInput
|
||||
type="text"
|
||||
[(ngModel)]="depositAmount"
|
||||
class="deposit-input"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Right Side: Balance & Numpad -->
|
||||
@ -184,24 +201,34 @@
|
||||
<div class="withdraw-form">
|
||||
<label>Operator ID</label>
|
||||
<input
|
||||
type="text"
|
||||
[(ngModel)]="withdrawOperatorId"
|
||||
class="withdraw-input"
|
||||
/>
|
||||
type="text"
|
||||
[(ngModel)]="withdrawOperatorId"
|
||||
class="withdraw-input"
|
||||
maxlength="12"
|
||||
inputmode="numeric"
|
||||
pattern="\d*"
|
||||
(input)="checkWithdrawOperatorLength()"
|
||||
/>
|
||||
|
||||
<label>Shroff ID</label>
|
||||
<input
|
||||
type="text"
|
||||
[(ngModel)]="withdrawShroffId"
|
||||
class="withdraw-input"
|
||||
/>
|
||||
#withdrawShroffIdInput
|
||||
type="text"
|
||||
[(ngModel)]="withdrawShroffId"
|
||||
class="withdraw-input"
|
||||
maxlength="12"
|
||||
inputmode="numeric"
|
||||
pattern="\d*"
|
||||
(input)="checkWithdrawShroffLength()"
|
||||
/>
|
||||
|
||||
<label>Amount</label>
|
||||
<input
|
||||
type="text"
|
||||
[(ngModel)]="withdrawAmount"
|
||||
class="withdraw-input"
|
||||
/>
|
||||
#withdrawAmountInput
|
||||
type="text"
|
||||
[(ngModel)]="withdrawAmount"
|
||||
class="withdraw-input"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, Output, EventEmitter } from '@angular/core';
|
||||
import { Component, Output, EventEmitter,ViewChild, ElementRef } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { BtcService } from '../../service/btc.service';
|
||||
@ -17,6 +17,14 @@ export class SidebarComponent {
|
||||
@Output() payoutClick = new EventEmitter<void>();
|
||||
@Output() cancelClick = new EventEmitter<void>();
|
||||
|
||||
|
||||
|
||||
@ViewChild('depositShroffIdInput') depositShroffIdInput!: ElementRef<HTMLInputElement>;
|
||||
@ViewChild('withdrawShroffIdInput') withdrawShroffIdInput!: ElementRef<HTMLInputElement>;
|
||||
@ViewChild('depositAmountInput') depositAmountInput!: ElementRef<HTMLInputElement>;
|
||||
@ViewChild('withdrawAmountInput') withdrawAmountInput!: ElementRef<HTMLInputElement>;
|
||||
|
||||
|
||||
showCancel: boolean = false;
|
||||
ticketNo: string = '';
|
||||
|
||||
@ -40,6 +48,65 @@ export class SidebarComponent {
|
||||
|
||||
loadingMessage: string = '';
|
||||
|
||||
checkDepositShroffLength() {
|
||||
const shroff = (this.depositShroffId || '').toString();
|
||||
if (shroff.length === 12) {
|
||||
setTimeout(() => {
|
||||
try {
|
||||
this.depositAmountInput?.nativeElement?.focus();
|
||||
this.depositAmountInput?.nativeElement?.select();
|
||||
} catch (e) {
|
||||
console.warn('focus failed for depositAmountInput', e);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
checkWithdrawShroffLength() {
|
||||
const shroff = (this.withdrawShroffId || '').toString();
|
||||
if (shroff.length === 12) {
|
||||
setTimeout(() => {
|
||||
try {
|
||||
this.withdrawAmountInput?.nativeElement?.focus();
|
||||
this.withdrawAmountInput?.nativeElement?.select();
|
||||
} catch (e) {
|
||||
console.warn('focus failed for withdrawAmountInput', e);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
checkDepositOperatorLength() {
|
||||
const op = (this.depositOperatorId || '').toString();
|
||||
// if exactly 12 characters, focus the shroff input
|
||||
if (op.length === 12) {
|
||||
// focus in next macrotask so DOM is stable
|
||||
setTimeout(() => {
|
||||
try {
|
||||
this.depositShroffIdInput?.nativeElement?.focus();
|
||||
this.depositShroffIdInput?.nativeElement?.select();
|
||||
} catch (e) {
|
||||
console.warn('focus failed for depositShroffIdInput', e);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// withdraw
|
||||
checkWithdrawOperatorLength() {
|
||||
const op = (this.withdrawOperatorId || '').toString();
|
||||
if (op.length === 12) {
|
||||
setTimeout(() => {
|
||||
try {
|
||||
this.withdrawShroffIdInput?.nativeElement?.focus();
|
||||
this.withdrawShroffIdInput?.nativeElement?.select();
|
||||
} catch (e) {
|
||||
console.warn('focus failed for withdrawShroffIdInput', e);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Modal handlers...
|
||||
openCancelPopup() {
|
||||
this.cancelClick.emit();
|
||||
@ -740,7 +807,7 @@ async printWithdraw() {
|
||||
btId: resolvedBtId,
|
||||
btMake: resolvedBtMake
|
||||
};
|
||||
|
||||
this.loadingMessage = 'Printing Withdraw — please wait...';
|
||||
console.log("📡 Sending withdraw API request:", apiPayload);
|
||||
|
||||
try {
|
||||
@ -900,6 +967,9 @@ ${receiptText}
|
||||
console.error("❌ Withdraw API call failed:", err);
|
||||
this.withdrawWarning = '❌ Withdraw API call failed. Please try again.';
|
||||
}
|
||||
finally {
|
||||
this.loadingMessage = ''; // ALWAYS clear loading message
|
||||
}
|
||||
}
|
||||
//----------------------------------------------PRINT WITHDRAW TICKET ENDS HERE -----------------------------
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user