0.0.13
This commit is contained in:
parent
db9083b9b5
commit
dbcba951aa
84
index.html
84
index.html
@ -1056,7 +1056,7 @@
|
|||||||
// hides the popup or modal
|
// hides the popup or modal
|
||||||
function hidePopup() {
|
function hidePopup() {
|
||||||
if (popupStack.peek() === undefined)
|
if (popupStack.peek() === undefined)
|
||||||
return
|
return;
|
||||||
let { popup, permission } = popupStack.pop();
|
let { popup, permission } = popupStack.pop();
|
||||||
thisPopup = document.getElementById(popup);
|
thisPopup = document.getElementById(popup);
|
||||||
thisPopup.closest('.popup-container').classList.add('hide');
|
thisPopup.closest('.popup-container').classList.add('hide');
|
||||||
@ -1074,6 +1074,9 @@
|
|||||||
if (thisPopup.querySelector('input').value == '')
|
if (thisPopup.querySelector('input').value == '')
|
||||||
thisPopup.querySelector('.cancel-btn').click()
|
thisPopup.querySelector('.cancel-btn').click()
|
||||||
}
|
}
|
||||||
|
if (popup === 'cash_transfer') {
|
||||||
|
payingRequested = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addEventListener('mousedown', e => {
|
addEventListener('mousedown', e => {
|
||||||
@ -1235,7 +1238,9 @@
|
|||||||
parent.classList.remove('animate-label')
|
parent.classList.remove('animate-label')
|
||||||
}
|
}
|
||||||
|
|
||||||
let allForms = document.querySelectorAll('form');
|
let allForms = document.querySelectorAll('form'),
|
||||||
|
payingRequested = false,
|
||||||
|
currentPaymentRequest;
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
/*document.querySelectorAll('.popup:not(.hide)').forEach(popup => {
|
/*document.querySelectorAll('.popup:not(.hide)').forEach(popup => {
|
||||||
popupStack.push(popup.id)
|
popupStack.push(popup.id)
|
||||||
@ -1329,8 +1334,14 @@
|
|||||||
if (e.target.closest('.send-rupee')) {
|
if (e.target.closest('.send-rupee')) {
|
||||||
let parent = e.target.closest('.request'),
|
let parent = e.target.closest('.request'),
|
||||||
senderAddress = parent.dataset.senderAddress,
|
senderAddress = parent.dataset.senderAddress,
|
||||||
amount = parent.dataset.amount;
|
amount = parent.dataset.amount,
|
||||||
|
paymentRequestId = parent.dataset.paymentRequestId;;
|
||||||
let popup = showPopup('cash_transfer');
|
let popup = showPopup('cash_transfer');
|
||||||
|
payingRequested = true;
|
||||||
|
currentPaymentRequest = {
|
||||||
|
paymentRequest: parent,
|
||||||
|
requestId: paymentRequestId
|
||||||
|
}
|
||||||
popup.querySelector('#token_receiver').value = senderAddress;
|
popup.querySelector('#token_receiver').value = senderAddress;
|
||||||
popup.querySelector('#token_amount').value = amount;
|
popup.querySelector('#token_amount').value = amount;
|
||||||
}
|
}
|
||||||
@ -11328,42 +11339,42 @@
|
|||||||
notify(error, 'error')
|
notify(error, 'error')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function transferTokensManually() {
|
async function transferTokensManually() {
|
||||||
try {
|
try {
|
||||||
send_tokens_btn.onclick = function () {
|
const send_tokens_btn = document.getElementById('send_tokens_btn');
|
||||||
return new Promise(async (resolve, reject) => {
|
send_tokens_btn.onclick = async function () {
|
||||||
const token_sender = myFloID;
|
console.log('hi')
|
||||||
const token_receiver = document.getElementById('token_receiver').value;
|
const token_sender = myFloID;
|
||||||
const send_tokens_btn = document.getElementById('send_tokens_btn');
|
const token_receiver = document.getElementById('token_receiver').value;
|
||||||
const token_amount = Number(document.getElementById('token_amount').value);
|
const token_amount = Number(document.getElementById('token_amount').value);
|
||||||
const token_name_radio = 'rupee';
|
const token_name_radio = 'rupee';
|
||||||
|
const flo_comment = `transfer ${token_amount} ${token_name_radio}# to ${token_receiver}`;
|
||||||
|
const token_balance_url = `https://ranchimallflo.duckdns.org/api/v1.0/getFloAddressBalance?token=${token_name_radio}&floAddress=${token_sender}`;
|
||||||
|
const sender_token_balance = await ajaxGet(token_balance_url);
|
||||||
|
let err_msg = '';
|
||||||
|
|
||||||
const flo_comment = `transfer ${token_amount} ${token_name_radio}# to ${token_receiver}`;
|
if (typeof sender_token_balance !== "object"
|
||||||
const token_balance_url = `https://ranchimallflo.duckdns.org/api/v1.0/getFloAddressBalance?token=${token_name_radio}&floAddress=${token_sender}`;
|
|| typeof sender_token_balance.balance !== "number"
|
||||||
const sender_token_balance = await ajaxGet(token_balance_url);
|
|| sender_token_balance.balance < token_amount) {
|
||||||
let err_msg = '';
|
err_msg = `Sender has insufficient ${token_name_radio} balance.`;
|
||||||
|
notify(err_msg, 'error');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof sender_token_balance !== "object"
|
let flo_txid = await floBlockchainAPI.sendTx(myFloID, token_receiver, 0.001, myPrivKey, flo_comment)
|
||||||
|| typeof sender_token_balance.balance !== "number"
|
console.log(flo_txid);
|
||||||
|| sender_token_balance.balance < token_amount) {
|
if (typeof flo_txid !== "string") {
|
||||||
err_msg = `INFO: Sender has insufficient ${token_name_radio} balance.`;
|
notify(`Transaction unsuccessful.`);
|
||||||
notify(err_msg);
|
return false;
|
||||||
return false;
|
} else {
|
||||||
|
notify(`Transaction successful: ${flo_txid}.`, '', 'fixed', true);
|
||||||
|
if(payingRequested){
|
||||||
|
payment_request_status(currentPaymentRequest.requestId, 'APPROVED')
|
||||||
|
showPayRequests()
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
let flo_txid = await floBlockchainAPI.sendTx(myFloID, token_receiver, 0.001, myPrivKey, flo_comment)
|
}
|
||||||
console.log(flo_txid);
|
|
||||||
if (typeof flo_txid !== "string") {
|
|
||||||
notify(`Transaction unsuccessfull.`);
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
notify(`Transaction successfull: ${flo_txid}.`, '', 'fixed', true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
}
|
}
|
||||||
@ -11767,9 +11778,9 @@
|
|||||||
|
|
||||||
if (req_id.lenght < 1) return false;
|
if (req_id.lenght < 1) return false;
|
||||||
|
|
||||||
if (status = 'DECLINED') {
|
if (status === 'DECLINED') {
|
||||||
status = token_app.master_configurations.TYPE_REQUEST_PAYMENT_DECLINED;
|
status = token_app.master_configurations.TYPE_REQUEST_PAYMENT_DECLINED;
|
||||||
} else if (status = 'APPROVED') {
|
} else if (status === 'APPROVED') {
|
||||||
status = token_app.master_configurations.TYPE_REQUEST_PAYMENT_APPROVED;
|
status = token_app.master_configurations.TYPE_REQUEST_PAYMENT_APPROVED;
|
||||||
} else return;
|
} else return;
|
||||||
|
|
||||||
@ -11825,7 +11836,6 @@
|
|||||||
|
|
||||||
// Show details of unprocessed ones
|
// Show details of unprocessed ones
|
||||||
console.log(unprocessed_deposits_complaints);
|
console.log(unprocessed_deposits_complaints);
|
||||||
let uniqueComplaints = []
|
|
||||||
|
|
||||||
for (const udc of unprocessed_deposits_complaints) {
|
for (const udc of unprocessed_deposits_complaints) {
|
||||||
let all_users_deposits = floDapps.getNextGeneralData(token_app.master_configurations.TYPE_DEPOSITS, "0");
|
let all_users_deposits = floDapps.getNextGeneralData(token_app.master_configurations.TYPE_DEPOSITS, "0");
|
||||||
@ -11863,11 +11873,9 @@
|
|||||||
}
|
}
|
||||||
if (this_user_deposit.length){
|
if (this_user_deposit.length){
|
||||||
frag.append(render.depositComplaint(userData, cashierData, udc))
|
frag.append(render.depositComplaint(userData, cashierData, udc))
|
||||||
uniqueComplaints.push({userData, cashierData})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(uniqueComplaints)
|
|
||||||
let container = document.getElementById('deposit_complaints_container');
|
let container = document.getElementById('deposit_complaints_container');
|
||||||
|
|
||||||
container.innerHTML = ``
|
container.innerHTML = ``
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user