diff --git a/scripts/fn_ui.js b/scripts/fn_ui.js index b0a11b2..6d71f74 100644 --- a/scripts/fn_ui.js +++ b/scripts/fn_ui.js @@ -45,7 +45,7 @@ function continueWalletTopup() { if (!cashier) return notify("No cashier online. Please try again in a while.", 'error'); // const upiId = getRef('select_topup_upi_id').value; - const txCode = randomString(6); + floGlobals.txCode = randomString(6); // getRef('topup_wallet__code').value = txCode; // if (!upiId) // return notify("Please add the UPI ID which you'll use to send the money", 'error'); @@ -54,10 +54,10 @@ function continueWalletTopup() { // getRef('topup_wallet__upi_id').value = cashierUPI[cashier]; getRef('topup_wallet__qr_code').innerHTML = '' getRef('topup_wallet__qr_code').append(new QRCode({ - msg: `upi://pay?pn=FLOPay&pa=${cashierUPI[cashier]}&am=${amount}&tn=${txCode}`, + msg: `upi://pay?pn=FLOPay&pa=${cashierUPI[cashier]}&am=${amount}&tn=${floGlobals.txCode}`, ecl: 'H' })) - getRef('pay_by_upi').href = `upi://pay?pn=FLOPay&pa=${cashierUPI[cashier]}&am=${amount}&tn=${txCode}` + getRef('pay_by_upi').href = `upi://pay?pn=FLOPay&pa=${cashierUPI[cashier]}&am=${amount}&tn=${floGlobals.txCode}` getRef('pay_by_upi').textContent = `Pay ${formatAmount(amount)} by UPI`; showChildElement('topup_wallet_process', 1) // getRef('topup_wallet__txid').focusIn(); @@ -68,15 +68,16 @@ function depositMoneyToWallet() { return notify("No cashier online. Please try again in a while.", 'error'); let amount = parseFloat(getRef('request_cashier_amount').value.trim()); // let upiTxID = getRef('topup_wallet__txid').value.trim(); - const txCode = getRef('topup_wallet__code').value; + // const txCode = getRef('topup_wallet__code').value; // const upiId = getRef('select_topup_upi_id').value; // if (upiTxID === '') // return notify("Please enter UPI transaction ID", 'error'); buttonLoader('topup_wallet_button', true); - User.cashToToken(cashier, amount, txCode/* , upiId */).then(result => { + User.cashToToken(cashier, amount, floGlobals.txCode/* , upiId */).then(result => { console.log(result); showChildElement('topup_wallet_process', 2); refreshBalance() + floGlobals.txCode = '' }).catch(error => { console.error(error) getRef('topup_failed_reason').textContent = error; diff --git a/scripts/std_ui.js b/scripts/std_ui.js index db4c316..3e531b1 100644 --- a/scripts/std_ui.js +++ b/scripts/std_ui.js @@ -871,6 +871,7 @@ function handleVisibilityChange() { if (document.visibilityState === "hidden") { // code if page is hidden } else { - startStatusInterval() + if (floGlobals.loaded && floGlobals.isSubAdmin) + startStatusInterval() } } \ No newline at end of file