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">
|
<div class="deposit-form">
|
||||||
<label>Operator ID</label>
|
<label>Operator ID</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
[(ngModel)]="depositOperatorId"
|
[(ngModel)]="depositOperatorId"
|
||||||
class="deposit-input"
|
class="deposit-input"
|
||||||
/>
|
maxlength="12"
|
||||||
|
inputmode="numeric"
|
||||||
|
pattern="\d*"
|
||||||
|
(input)="checkDepositOperatorLength()"
|
||||||
|
aria-label="Deposit Operator ID"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
<label>Shroff ID</label>
|
<label>Shroff ID</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
#depositShroffIdInput
|
||||||
[(ngModel)]="depositShroffId"
|
type="text"
|
||||||
class="deposit-input"
|
[(ngModel)]="depositShroffId"
|
||||||
/>
|
class="deposit-input"
|
||||||
|
maxlength="12"
|
||||||
|
inputmode="numeric"
|
||||||
|
pattern="\d*"
|
||||||
|
aria-label="Deposit Shroff ID"
|
||||||
|
(input)="checkDepositShroffLength()"
|
||||||
|
/>
|
||||||
|
|
||||||
<label>Amount</label>
|
<label>Amount</label>
|
||||||
<input type="text" [(ngModel)]="depositAmount" class="deposit-input" />
|
<input
|
||||||
|
#depositAmountInput
|
||||||
|
type="text"
|
||||||
|
[(ngModel)]="depositAmount"
|
||||||
|
class="deposit-input"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Right Side: Balance & Numpad -->
|
<!-- Right Side: Balance & Numpad -->
|
||||||
@ -184,24 +201,34 @@
|
|||||||
<div class="withdraw-form">
|
<div class="withdraw-form">
|
||||||
<label>Operator ID</label>
|
<label>Operator ID</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
[(ngModel)]="withdrawOperatorId"
|
[(ngModel)]="withdrawOperatorId"
|
||||||
class="withdraw-input"
|
class="withdraw-input"
|
||||||
/>
|
maxlength="12"
|
||||||
|
inputmode="numeric"
|
||||||
|
pattern="\d*"
|
||||||
|
(input)="checkWithdrawOperatorLength()"
|
||||||
|
/>
|
||||||
|
|
||||||
<label>Shroff ID</label>
|
<label>Shroff ID</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
#withdrawShroffIdInput
|
||||||
[(ngModel)]="withdrawShroffId"
|
type="text"
|
||||||
class="withdraw-input"
|
[(ngModel)]="withdrawShroffId"
|
||||||
/>
|
class="withdraw-input"
|
||||||
|
maxlength="12"
|
||||||
|
inputmode="numeric"
|
||||||
|
pattern="\d*"
|
||||||
|
(input)="checkWithdrawShroffLength()"
|
||||||
|
/>
|
||||||
|
|
||||||
<label>Amount</label>
|
<label>Amount</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
#withdrawAmountInput
|
||||||
[(ngModel)]="withdrawAmount"
|
type="text"
|
||||||
class="withdraw-input"
|
[(ngModel)]="withdrawAmount"
|
||||||
/>
|
class="withdraw-input"
|
||||||
|
/>
|
||||||
</div>
|
</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 { CommonModule } from '@angular/common';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { BtcService } from '../../service/btc.service';
|
import { BtcService } from '../../service/btc.service';
|
||||||
@ -17,6 +17,14 @@ export class SidebarComponent {
|
|||||||
@Output() payoutClick = new EventEmitter<void>();
|
@Output() payoutClick = new EventEmitter<void>();
|
||||||
@Output() cancelClick = 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;
|
showCancel: boolean = false;
|
||||||
ticketNo: string = '';
|
ticketNo: string = '';
|
||||||
|
|
||||||
@ -40,6 +48,65 @@ export class SidebarComponent {
|
|||||||
|
|
||||||
loadingMessage: string = '';
|
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...
|
// Modal handlers...
|
||||||
openCancelPopup() {
|
openCancelPopup() {
|
||||||
this.cancelClick.emit();
|
this.cancelClick.emit();
|
||||||
@ -740,7 +807,7 @@ async printWithdraw() {
|
|||||||
btId: resolvedBtId,
|
btId: resolvedBtId,
|
||||||
btMake: resolvedBtMake
|
btMake: resolvedBtMake
|
||||||
};
|
};
|
||||||
|
this.loadingMessage = 'Printing Withdraw — please wait...';
|
||||||
console.log("📡 Sending withdraw API request:", apiPayload);
|
console.log("📡 Sending withdraw API request:", apiPayload);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -900,6 +967,9 @@ ${receiptText}
|
|||||||
console.error("❌ Withdraw API call failed:", err);
|
console.error("❌ Withdraw API call failed:", err);
|
||||||
this.withdrawWarning = '❌ Withdraw API call failed. Please try again.';
|
this.withdrawWarning = '❌ Withdraw API call failed. Please try again.';
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
this.loadingMessage = ''; // ALWAYS clear loading message
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------PRINT WITHDRAW TICKET ENDS HERE -----------------------------
|
//----------------------------------------------PRINT WITHDRAW TICKET ENDS HERE -----------------------------
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user