UX improvement
-- conditionally rendering top-up steps based on QR code state
This commit is contained in:
parent
0077223bb3
commit
46056f9a39
@ -915,8 +915,9 @@ ol li::before {
|
|||||||
#topup_wallet__qr_code {
|
#topup_wallet__qr_code {
|
||||||
background-color: rgba(var(--text-color), 0.03);
|
background-color: rgba(var(--text-color), 0.03);
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
height: 12rem;
|
height: 10rem;
|
||||||
justify-self: flex-start;
|
justify-self: flex-start;
|
||||||
|
width: 10rem;
|
||||||
}
|
}
|
||||||
#topup_wallet__qr_code svg {
|
#topup_wallet__qr_code svg {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
2
css/main.min.css
vendored
2
css/main.min.css
vendored
File diff suppressed because one or more lines are too long
@ -851,8 +851,9 @@ ol {
|
|||||||
#topup_wallet__qr_code {
|
#topup_wallet__qr_code {
|
||||||
background-color: rgba(var(--text-color), 0.03);
|
background-color: rgba(var(--text-color), 0.03);
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
height: 12rem;
|
height: 10rem;
|
||||||
justify-self: flex-start;
|
justify-self: flex-start;
|
||||||
|
width: 10rem;
|
||||||
svg {
|
svg {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|||||||
44
index.html
44
index.html
@ -820,7 +820,7 @@
|
|||||||
</sm-form>
|
</sm-form>
|
||||||
<sm-form id="confirm_topup_form" class="hide">
|
<sm-form id="confirm_topup_form" class="hide">
|
||||||
<h4>Transfer money</h4>
|
<h4>Transfer money</h4>
|
||||||
<ol type="1">
|
<ol id="topup_steps" type="1">
|
||||||
<li>
|
<li>
|
||||||
<p>
|
<p>
|
||||||
Open your<strong> preferred UPI app </strong>
|
Open your<strong> preferred UPI app </strong>
|
||||||
@ -834,10 +834,10 @@
|
|||||||
</p>
|
</p>
|
||||||
<sm-copy id="topup_wallet__upi_id" style="font-weight: 700;"></sm-copy>
|
<sm-copy id="topup_wallet__upi_id" style="font-weight: 700;"></sm-copy>
|
||||||
</div>
|
</div>
|
||||||
<details>
|
<details id="topup_wallet__qr_wrapper">
|
||||||
<summary class="interact">
|
<summary class="interact">
|
||||||
<b style="font-size: 0.9rem;">Or get QR code to scan</b>
|
<b style="font-size: 0.9rem;">Or get QR code to scan</b>
|
||||||
<svg class="icon" xmlns="http://www.w3.org/2000/svg" height="24px"
|
<svg class="icon down-arrow" xmlns="http://www.w3.org/2000/svg" height="24px"
|
||||||
viewBox="0 0 24 24" width="24px" fill="#000000">
|
viewBox="0 0 24 24" width="24px" fill="#000000">
|
||||||
<path d="M0 0h24v24H0V0z" fill="none" />
|
<path d="M0 0h24v24H0V0z" fill="none" />
|
||||||
<path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z" />
|
<path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z" />
|
||||||
@ -845,32 +845,11 @@
|
|||||||
</summary>
|
</summary>
|
||||||
<div class="grid gap-0-5">
|
<div class="grid gap-0-5">
|
||||||
<div id="topup_wallet__qr_code"></div>
|
<div id="topup_wallet__qr_code"></div>
|
||||||
<p>
|
<strong> *All the required details for payment will be auto-filled.</strong>
|
||||||
<strong>
|
|
||||||
*If you are paying by scanning the QR code, amount and remark/message will
|
|
||||||
be
|
|
||||||
added automatically.</strong>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<p id="topup_wallet__details"></p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div class="grid gap-0-5">
|
|
||||||
<p>
|
|
||||||
Enter <strong>code</strong> below in the <strong> message/remark </strong> field
|
|
||||||
</p>
|
|
||||||
<sm-copy id="topup_wallet__code" style="font-weight: 700;"></sm-copy>
|
|
||||||
<p>
|
|
||||||
<strong>*This is very important step. If you skip or enter wrong code, transaction can't
|
|
||||||
be
|
|
||||||
verified.</strong>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<p>
|
<p>
|
||||||
After sending money, press <b>Confirm</b>.
|
After sending money, press <b>Confirm</b>.
|
||||||
@ -1254,6 +1233,21 @@
|
|||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
|
<template id="conditional_steps_template">
|
||||||
|
<li class="conditional">
|
||||||
|
<p>Enter <b class="amount"></b> as amount</p>
|
||||||
|
</li>
|
||||||
|
<li class="conditional">
|
||||||
|
<div class="grid gap-0-5">
|
||||||
|
<p>
|
||||||
|
Enter <strong>code</strong> below in the <strong> message/remark </strong> field
|
||||||
|
</p>
|
||||||
|
<sm-copy class="tx-code" style="font-weight: 700; "></sm-copy>
|
||||||
|
<strong class="warning">*This is very important step. If you skip or enter wrong code, transaction can't
|
||||||
|
be verified.</strong>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
<script src="//unpkg.com/uhtml"></script>
|
<script src="//unpkg.com/uhtml"></script>
|
||||||
<script src="scripts/components.js"></script>
|
<script src="scripts/components.js"></script>
|
||||||
<script src="scripts/std_ui.js"></script>
|
<script src="scripts/std_ui.js"></script>
|
||||||
|
|||||||
@ -45,18 +45,17 @@ function continueWalletTopup() {
|
|||||||
if (!cashier)
|
if (!cashier)
|
||||||
return notify("No cashier online. Please try again in a while.", 'error');
|
return notify("No cashier online. Please try again in a while.", 'error');
|
||||||
// const upiId = getRef('select_topup_upi_id').value;
|
// const upiId = getRef('select_topup_upi_id').value;
|
||||||
const txCode = randomString(6);
|
floGlobals.txCode = randomString(6);
|
||||||
getRef('topup_wallet__code').value = txCode;
|
|
||||||
// if (!upiId)
|
// if (!upiId)
|
||||||
// return notify("Please add the UPI ID which you'll use to send the money", 'error');
|
// return notify("Please add the UPI ID which you'll use to send the money", 'error');
|
||||||
let amount = parseFloat(getRef('request_cashier_amount').value.trim());
|
let amount = parseFloat(getRef('request_cashier_amount').value.trim());
|
||||||
renderElem(getRef('topup_wallet__details'), html`Enter <b>${formatAmount(amount)}</b> as amount`);
|
|
||||||
getRef('topup_wallet__upi_id').value = cashierUPI[cashier];
|
getRef('topup_wallet__upi_id').value = cashierUPI[cashier];
|
||||||
getRef('topup_wallet__qr_code').innerHTML = ''
|
getRef('topup_wallet__qr_code').innerHTML = ''
|
||||||
getRef('topup_wallet__qr_code').append(new QRCode({
|
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'
|
ecl: 'H'
|
||||||
}))
|
}))
|
||||||
|
render.conditionalSteps()
|
||||||
showChildElement('topup_wallet_process', 1)
|
showChildElement('topup_wallet_process', 1)
|
||||||
// getRef('topup_wallet__txid').focusIn();
|
// getRef('topup_wallet__txid').focusIn();
|
||||||
}
|
}
|
||||||
@ -66,12 +65,12 @@ function depositMoneyToWallet() {
|
|||||||
return notify("No cashier online. Please try again in a while.", 'error');
|
return notify("No cashier online. Please try again in a while.", 'error');
|
||||||
let amount = parseFloat(getRef('request_cashier_amount').value.trim());
|
let amount = parseFloat(getRef('request_cashier_amount').value.trim());
|
||||||
// let upiTxID = getRef('topup_wallet__txid').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;
|
// const upiId = getRef('select_topup_upi_id').value;
|
||||||
// if (upiTxID === '')
|
// if (upiTxID === '')
|
||||||
// return notify("Please enter UPI transaction ID", 'error');
|
// return notify("Please enter UPI transaction ID", 'error');
|
||||||
buttonLoader('topup_wallet_button', true);
|
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);
|
console.log(result);
|
||||||
showChildElement('topup_wallet_process', 2);
|
showChildElement('topup_wallet_process', 2);
|
||||||
refreshBalance()
|
refreshBalance()
|
||||||
@ -84,6 +83,8 @@ function depositMoneyToWallet() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getRef('topup_wallet__qr_wrapper').addEventListener('toggle', e => render.conditionalSteps())
|
||||||
|
|
||||||
function withdrawMoneyFromWallet() {
|
function withdrawMoneyFromWallet() {
|
||||||
let cashier = User.findCashier();
|
let cashier = User.findCashier();
|
||||||
if (!cashier)
|
if (!cashier)
|
||||||
@ -701,6 +702,17 @@ const render = {
|
|||||||
frag.append(render.savedId(floID, details));
|
frag.append(render.savedId(floID, details));
|
||||||
})
|
})
|
||||||
getRef('saved_ids_list').append(frag);
|
getRef('saved_ids_list').append(frag);
|
||||||
|
},
|
||||||
|
conditionalSteps() {
|
||||||
|
if (getRef('topup_wallet__qr_wrapper').open) {
|
||||||
|
getRef('topup_steps').querySelectorAll('.conditional').forEach(e => e.remove());
|
||||||
|
} else {
|
||||||
|
const amount = parseFloat(getRef('request_cashier_amount').value.trim());
|
||||||
|
const conditionalSteps = getRef('conditional_steps_template').content.cloneNode(true);
|
||||||
|
conditionalSteps.querySelector('.amount').textContent = formatAmount(amount);
|
||||||
|
conditionalSteps.querySelector('.tx-code').setAttribute('value',floGlobals.txCode);
|
||||||
|
getRef('topup_steps').children[1].after(conditionalSteps)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user