This commit is contained in:
sairaj mote 2020-10-03 19:14:08 +05:30
parent 22a5d1806a
commit 1b98f4fffc
4 changed files with 71 additions and 55 deletions

View File

@ -254,7 +254,9 @@ border: none;
min-width: 0; min-width: 0;
} }
.input.readonly .clear{ .input.readonly .clear{
display: none; opacity: 0 !important;
margin-right: -2em;
pointer-events: none !important;
} }
.readonly{ .readonly{
pointer-events: none; pointer-events: none;

View File

@ -933,33 +933,34 @@
</section> </section>
<section id="settings_page" class="page hide-completely"> <section id="settings_page" class="page hide-completely">
<h3 class="bottom-margin">Settings<h3> <h3 class="bottom-margin">Settings<h3>
<section> <div id="my_qr_code"></div>
<h4>My FLO address</h4> <section>
<div class="copy-row"> <h4>My FLO address</h4>
<h4 class="user-flo-id copy"></h4> <div class="copy-row">
<svg class="icon" onclick="copyToClipboard(this.parentNode)" viewBox="0 0 64 64"> <h4 class="user-flo-id copy"></h4>
<title>Copy</title> <svg class="icon" onclick="copyToClipboard(this.parentNode)" viewBox="0 0 64 64">
<rect x="16" y="16" width="48" height="48" rx="6" /> <title>Copy</title>
<path d="M.5,47.52V6.5a6,6,0,0,1,6-6h41" /> <rect x="16" y="16" width="48" height="48" rx="6" />
</svg> <path d="M.5,47.52V6.5a6,6,0,0,1,6-6h41" />
</div> </svg>
</section> </div>
<h4>Theme</h4> </section>
<div class="flex"> <h4>Theme</h4>
<p>Toggle dark theme</p> <div class="flex">
<sm-switch id="theme_switcher" class="justify-right"></sm-switch> <p>Toggle dark theme</p>
</div> <sm-switch id="theme_switcher" class="justify-right"></sm-switch>
<div class="user-option"> </div>
<h4 class="top-margin">My UPIs</h4> <div class="user-option">
<div class="upi-container"></div> <h4 class="top-margin">My UPIs</h4>
<p class="empty-state">Add UPI address for easier access during various transactions.</p> <div class="upi-container"></div>
<sm-button variant="no-outline" onclick="showPopup('add_upi_popup')">+ Add UPI address <p class="empty-state">Add UPI address for easier access during various transactions.</p>
</sm-button> <sm-button variant="no-outline" onclick="showPopup('add_upi_popup')">+ Add UPI address
</div> </sm-button>
<h4>Sign Out</h4> </div>
<p>Signing out will erase all the data stored in local storage and Indexed DB. This will remove <h4>Sign Out</h4>
saved private key, UPI addresses and contacts.</p> <p>Signing out will erase all the data stored in local storage and Indexed DB. This will remove
<sm-button variant="primary" onclick="signOut()">Sign out</sm-button> saved private key, UPI addresses and contacts.</p>
<sm-button variant="primary" onclick="signOut()">Sign out</sm-button>
</section> </section>
<section id="transaction_page" class="page"> <section id="transaction_page" class="page">
<header class="flex align-center" onclick="showPage('activity_page', 'activity_page_btn')"> <header class="flex align-center" onclick="showPage('activity_page', 'activity_page_btn')">
@ -1977,24 +1978,19 @@
// Function for accepting payment request // Function for accepting payment request
document.getElementById('payment_request_tab').addEventListener('click', async (e) => { document.getElementById('payment_request_tab').addEventListener('click', async (e) => {
if (e.target.closest('.send-rupee')) { if (e.target.closest('.send-rupee')) {
let parent = e.target.closest('.request'), currentPaymentRequest = e.target.closest('.request')
senderAddress = parent.dataset.senderAddress, let senderAddress = currentPaymentRequest.dataset.senderAddress,
amount = parent.dataset.amount, amount = currentPaymentRequest.dataset.amount
paymentRequestId = parent.dataset.paymentRequestId;;
showPopup('send_rupee_popup');
payingRequested = true; payingRequested = true;
currentPaymentRequest = {
paymentRequest: parent,
requestId: paymentRequestId
}
tokenReceiver.value = senderAddress; tokenReceiver.value = senderAddress;
tokenAmount.value = amount; tokenAmount.value = amount;
tokenReceiver.readOnly = true tokenReceiver.readOnly = true
tokenAmount.readOnly = true tokenAmount.readOnly = true
showPopup('send_rupee_popup');
} }
if (e.target.closest('.decline-request')) { if (e.target.closest('.decline-request')) {
let parent = e.target.closest('.request'), currentPaymentRequest = e.target.closest('.request')
paymentRequestId = parent.dataset.paymentRequestId; let paymentRequestId = currentPaymentRequest.dataset.paymentRequestId;
if (await confirmation(`Do want to decline this request?`, 'No', 'Decline')) { if (await confirmation(`Do want to decline this request?`, 'No', 'Decline')) {
const all_reqs = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations const all_reqs = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations
.TYPE_REQUEST_PAYMENT, "0").reverse()); .TYPE_REQUEST_PAYMENT, "0").reverse());
@ -2003,6 +1999,7 @@
.map(m => m.message)[0]; .map(m => m.message)[0];
payment_request_status(original_req, 'DECLINED') payment_request_status(original_req, 'DECLINED')
declinedPaymentRequestContainer.prepend(e.target.closest('.request'))
e.target.closest('.request').remove() e.target.closest('.request').remove()
} }
} }
@ -2387,6 +2384,8 @@
} }
} }
</script> </script>
<script src="qrcode.min.js"></script>
<script src="qrcode-scanner.min.js"></script>
<script id="init_lib"> <script id="init_lib">
//All util libraries required for Standard operations (DO NOT EDIT ANY) //All util libraries required for Standard operations (DO NOT EDIT ANY)
@ -12014,6 +12013,7 @@
defaultUPI = localStorage.getItem(`defaultUPI${myFloID}`) defaultUPI = localStorage.getItem(`defaultUPI${myFloID}`)
renderUserUPI() renderUserUPI()
renderAllContacts() renderAllContacts()
new QRCode(document.getElementById("my_qr_code"), myFloID);
showPage('home_page', 'home_page_btn') showPage('home_page', 'home_page_btn')
show_payment_requests() show_payment_requests()
@ -12483,21 +12483,23 @@
hidePopup() hidePopup()
return false; return false;
} else { } else {
hidePopup() if (payingRequested) {
showTransactionStatus('success', 'Rupee Sent', 'It may take upto 48 working hours for transaction to be completed.', flo_txid);
sentActivityContainer.prepend(render.activityCard({ type: 'sent', amount: token_amount, timeStamp: `${Date.now()}_${myFloID}`, token_txid: flo_txid, receiver: token_receiver }))
refresh_balance()
if (payingRequested === true) {
const all_reqs = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations const all_reqs = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations
.TYPE_REQUEST_PAYMENT, "0").reverse()); .TYPE_REQUEST_PAYMENT, "0").reverse());
const original_req = all_reqs const original_req = all_reqs
.filter(f => f.message.pay_req_id === currentPaymentRequest.requestId) .filter(f => f.message.pay_req_id === currentPaymentRequest.dataset.paymentRequestId)
.map(m => m.message)[0]; .map(m => m.message)[0];
payment_request_status(original_req, 'APPROVED') payment_request_status(original_req, 'APPROVED')
showPayThruCashierRequests(); paidPaymentRequestContainer.prepend(currentPaymentRequest)
} else if (payingRequested === false) { for(child of pendingPaymentRequestContainer.children){
if(child.dataset.paymentRequestId === currentPaymentRequest.dataset.paymentRequestId){
child.remove()
}
}
show_payment_requests();
} else{
let receiverID = myFloID; let receiverID = myFloID;
floGlobals.appObjects[token_app.master_configurations.TYPE_SENT_TOKENS][flo_txid] = { floGlobals.appObjects[token_app.master_configurations.TYPE_SENT_TOKENS][flo_txid] = {
token_sender, token_receiver, token_amount, token_name_radio, token_sender, token_receiver, token_amount, token_name_radio,
@ -12505,6 +12507,10 @@
}; };
floCloudAPI.updateObjectData(token_app.master_configurations.TYPE_SENT_TOKENS, options = { receiverID }); floCloudAPI.updateObjectData(token_app.master_configurations.TYPE_SENT_TOKENS, options = { receiverID });
} }
hidePopup()
showTransactionStatus('success', 'Rupee Sent', 'It may take upto 48 working hours for transaction to be completed.', flo_txid);
sentActivityContainer.prepend(render.activityCard({ type: 'sent', amount: token_amount, timeStamp: `${Date.now()}_${myFloID}`, token_txid: flo_txid, receiver: token_receiver }))
refresh_balance()
return true; return true;
} }
} }
@ -13225,6 +13231,10 @@
return false; return false;
} }
} }
const pendingPaymentRequestContainer = document.getElementById("pending_payment_request_container"),
paidPaymentRequestContainer = document.getElementById("paid_payment_request_container"),
declinedPaymentRequestContainer = document.getElementById("declined_payment_request_container");
async function show_payment_requests(requests_received = true, recvr_id = '') { async function show_payment_requests(requests_received = true, recvr_id = '') {
try { try {
@ -13253,12 +13263,8 @@
let processed_payments_requests = approved_reqs_list.map(m => m.message.pay_req_id).concat(declined_reqs_list let processed_payments_requests = approved_reqs_list.map(m => m.message.pay_req_id).concat(declined_reqs_list
.map(m => m.message.pay_req_id)); .map(m => m.message.pay_req_id));
let pendingPaymentRequestContainer = document.getElementById("pending_payment_request_container"),
approvedPaymentRequestContainer = document.getElementById("paid_payment_request_container"),
declinedPaymentRequestContainer = document.getElementById("declined_payment_request_container");
pendingPaymentRequestContainer.innerHTML = ``; pendingPaymentRequestContainer.innerHTML = ``;
approvedPaymentRequestContainer.innerHTML = ``; paidPaymentRequestContainer.innerHTML = ``;
declinedPaymentRequestContainer.innerHTML = ``; declinedPaymentRequestContainer.innerHTML = ``;
for (const m of general_msg) { for (const m of general_msg) {
@ -13286,7 +13292,7 @@
} = m.message; } = m.message;
frag.append(render.paymentRequest(datetime, sender_flo_id, amount, pay_req_id)) frag.append(render.paymentRequest(datetime, sender_flo_id, amount, pay_req_id))
} }
approvedPaymentRequestContainer.append(frag) paidPaymentRequestContainer.append(frag)
for (const m of declined_reqs_list) { for (const m of declined_reqs_list) {
let { let {

7
qrcode-scanner.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
qrcode.min.js vendored Normal file

File diff suppressed because one or more lines are too long