This commit is contained in:
sairaj mote 2020-08-14 18:18:03 +05:30
parent 98a28347ef
commit 445b9c085e

View File

@ -110,7 +110,8 @@
transfer transfer
</button> </button>
<svg viewBox="0 0 73 73" class="loader"> <svg viewBox="0 0 73 73" class="loader">
<path d="M72.5,36.5c0,19.88-16.12,36-36,36s-36-16.12-36-36s16.12-36,36-36S72.5,16.62,72.5,36.5" /> <path
d="M72.5,36.5c0,19.88-16.12,36-36,36s-36-16.12-36-36s16.12-36,36-36S72.5,16.62,72.5,36.5" />
</svg> </svg>
</div> </div>
</div> </div>
@ -144,7 +145,8 @@
deposit deposit
</button> </button>
<svg viewBox="0 0 73 73" class="loader"> <svg viewBox="0 0 73 73" class="loader">
<path d="M72.5,36.5c0,19.88-16.12,36-36,36s-36-16.12-36-36s16.12-36,36-36S72.5,16.62,72.5,36.5" /> <path
d="M72.5,36.5c0,19.88-16.12,36-36,36s-36-16.12-36-36s16.12-36,36-36S72.5,16.62,72.5,36.5" />
</svg> </svg>
</div> </div>
</div> </div>
@ -173,7 +175,8 @@
withdraw withdraw
</button> </button>
<svg viewBox="0 0 73 73" class="loader"> <svg viewBox="0 0 73 73" class="loader">
<path d="M72.5,36.5c0,19.88-16.12,36-36,36s-36-16.12-36-36s16.12-36,36-36S72.5,16.62,72.5,36.5" /> <path
d="M72.5,36.5c0,19.88-16.12,36-36,36s-36-16.12-36-36s16.12-36,36-36S72.5,16.62,72.5,36.5" />
</svg> </svg>
</div> </div>
</div> </div>
@ -206,7 +209,8 @@
request request
</button> </button>
<svg viewBox="0 0 73 73" class="loader"> <svg viewBox="0 0 73 73" class="loader">
<path d="M72.5,36.5c0,19.88-16.12,36-36,36s-36-16.12-36-36s16.12-36,36-36S72.5,16.62,72.5,36.5" /> <path
d="M72.5,36.5c0,19.88-16.12,36-36,36s-36-16.12-36-36s16.12-36,36-36S72.5,16.62,72.5,36.5" />
</svg> </svg>
</div> </div>
</div> </div>
@ -239,7 +243,8 @@
pay pay
</button> </button>
<svg viewBox="0 0 73 73" class="loader"> <svg viewBox="0 0 73 73" class="loader">
<path d="M72.5,36.5c0,19.88-16.12,36-36,36s-36-16.12-36-36s16.12-36,36-36S72.5,16.62,72.5,36.5" /> <path
d="M72.5,36.5c0,19.88-16.12,36-36,36s-36-16.12-36-36s16.12-36,36-36S72.5,16.62,72.5,36.5" />
</svg> </svg>
</div> </div>
</div> </div>
@ -723,7 +728,8 @@
<h4>No withdraw complaints.</h4> <h4>No withdraw complaints.</h4>
</sm-panel> </sm-panel>
<sm-tab slot="tab">Pay through cashier</sm-tab> <sm-tab slot="tab">Pay through cashier</sm-tab>
<sm-panel slot="panel" id="pay_cashier_complaints_container" class="complaints-container hide-completely"> <sm-panel slot="panel" id="pay_cashier_complaints_container"
class="complaints-container hide-completely">
<h4>No pay through cashier complaints.</h4> <h4>No pay through cashier complaints.</h4>
</sm-panel> </sm-panel>
</sm-tabs> </sm-tabs>
@ -744,17 +750,45 @@
<button class="primary-btn top-margin" onclick="signOut()">Sign out</button> <button class="primary-btn top-margin" onclick="signOut()">Sign out</button>
</section> </section>
</main> </main>
<script id="floGlobals">
/* Constants for FLO blockchain operations !!Make sure to add this at begining!! */
const floGlobals = {
//Required for all
blockchain: "FLO",
//Required for blockchain API operators
apiURL: {
FLO: ['https://explorer.mediciland.com/', 'https://livenet.flocha.in/', 'https://flosight.duckdns.org/', 'http://livenet-explorer.floexperiments.com/'],
FLO_TEST: ['https://testnet-flosight.duckdns.org/', 'https://testnet.flocha.in/']
},
adminID: "F7HEAV9226tqXtRk34XrA9nZCb8ZcbVJt1",
sendAmt: 0.001,
fee: 0.0005,
//Required for Supernode operations
SNStorageID: "FEzk75EGMPEQMrCuPosGiwuK162hcEu49E",
supernodes: {}, //each supnernode must be stored as floID : {uri:<uri>,pubKey:<publicKey>}
//for cloud apps
subAdmins: [],
application: "rupeeTokenApp",//rupeeTokenApp
vectorClock: {},
appObjects: {},
generalData: {},
generalVC: {}
}
</script>
<script id="onLoadStartUp"> <script id="onLoadStartUp">
function onLoadStartUp() { function onLoadStartUp() {
showPopup('main_loader', 'no') showPopup('main_loader', 'no')
console.log("Starting the app! Please Wait!") console.log("Starting the app! Please Wait!")
floDapps.launchStartUp().then( async result => { floDapps.launchStartUp().then(async result => {
console.log(result) console.log(`Welcome ${myFloID}`)
await token_app.actions.doShreeGanesh(); await token_app.actions.doShreeGanesh();
refresh_balance()
document.getElementById('user_flo_id').textContent = myFloID document.getElementById('user_flo_id').textContent = myFloID
refresh_balance()
hidePopup() hidePopup()
}).catch(error => console.error(error)) }).catch(error => console.error(error))
} }
@ -931,7 +965,7 @@
{ depositedAmount, customMsg, sender, vectorClock } = userData, { depositedAmount, customMsg, sender, vectorClock } = userData,
composition = ``; composition = ``;
card.classList.add('request', 'complaint') card.classList.add('request', 'complaint')
setAttributes(card, {'data-type': 'deposit','data-udc': JSON.stringify(udc)}) setAttributes(card, { 'data-type': 'deposit', 'data-udc': JSON.stringify(udc) })
composition = ` composition = `
<div class="left"> <div class="left">
@ -1342,6 +1376,7 @@
} }
function formatedTime(time) { function formatedTime(time) {
try {
let timeFrag = new Date(parseInt(time)).toString().split(' '), let timeFrag = new Date(parseInt(time)).toString().split(' '),
day = timeFrag[0], day = timeFrag[0],
month = timeFrag[1], month = timeFrag[1],
@ -1350,7 +1385,11 @@
hours = timeFrag[4].slice(0, timeFrag[4].lastIndexOf(':')), hours = timeFrag[4].slice(0, timeFrag[4].lastIndexOf(':')),
finalTime = ''; finalTime = '';
parseInt(hours.split(':')[0]) > 12 ? finalTime = 'PM' : finalTime = 'AM' parseInt(hours.split(':')[0]) > 12 ? finalTime = 'PM' : finalTime = 'AM'
return `${hours} ${finalTime} ${day} ${date} ${month} ${year}` return `${hours} ${finalTime} ${day} ${date} ${month} ${year}`;
} catch (e) {
console.error(e);
return time;
}
} }
function copyToClipboard(parent) { function copyToClipboard(parent) {
@ -1488,7 +1527,7 @@
request_payment(requestedAddress, requestedAmount) request_payment(requestedAddress, requestedAmount)
}) })
// Function for accepting payment request // Function for accepting payment request
document.getElementById('payment_request_container').addEventListener('click', async(e) => { document.getElementById('payment_request_container').addEventListener('click', async (e) => {
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,
@ -1506,7 +1545,7 @@
if (e.target.closest('.decline-request')) { if (e.target.closest('.decline-request')) {
let parent = e.target.closest('.request'), let parent = e.target.closest('.request'),
paymentRequestId = parent.dataset.paymentRequestId; paymentRequestId = parent.dataset.paymentRequestId;
if(await confirmation(`Do want to decline this request? This will remove the request.`)){ if (await confirmation(`Do want to decline this request? This will remove the request.`)) {
payment_request_status(paymentRequestId, 'DECLINED') payment_request_status(paymentRequestId, 'DECLINED')
e.target.closest('.request').remove() e.target.closest('.request').remove()
} }
@ -1517,11 +1556,11 @@
}) })
document.getElementById('helpline_page').addEventListener('click', async e => { document.getElementById('helpline_page').addEventListener('click', async e => {
if(e.target.closest('.mark-resolved')){ if (e.target.closest('.mark-resolved')) {
let complaint = e.target.closest('.complaint'), let complaint = e.target.closest('.complaint'),
udc = complaint.dataset.udc, udc = complaint.dataset.udc,
type = complaint.dataset.type; type = complaint.dataset.type;
if(await confirmation('Mark this complaint as resolved?')){ if (await confirmation('Mark this complaint as resolved?')) {
mark_complaint_resolved(type, JSON.parse(udc)) mark_complaint_resolved(type, JSON.parse(udc))
complaint.remove() complaint.remove()
} }
@ -2198,35 +2237,6 @@ slot[name="tab"]::slotted(.active){
} }
}) })
</script>
<script id="floGlobals">
/* Constants for FLO blockchain operations !!Make sure to add this at begining!! */
const floGlobals = {
//Required for all
blockchain: "FLO",
//Required for blockchain API operators
apiURL: {
FLO: ['https://explorer.mediciland.com/', 'https://livenet.flocha.in/', 'https://flosight.duckdns.org/', 'http://livenet-explorer.floexperiments.com/'],
FLO_TEST: ['https://testnet-flosight.duckdns.org/', 'https://testnet.flocha.in/']
},
adminID: "F7HEAV9226tqXtRk34XrA9nZCb8ZcbVJt1",
sendAmt: 0.001,
fee: 0.0005,
//Required for Supernode operations
SNStorageID: "FEzk75EGMPEQMrCuPosGiwuK162hcEu49E",
supernodes: {}, //each supnernode must be stored as floID : {uri:<uri>,pubKey:<publicKey>}
//for cloud apps
subAdmins: [],
application: "RUPEE_TOKEN_APP_TEST8",//rupeeTokenApp
vectorClock: {},
appObjects: {},
generalData: {},
generalVC: {}
}
</script> </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)
@ -11472,7 +11482,7 @@ slot[name="tab"]::slotted(.active){
const token_app = { const token_app = {
master_configurations: {}, master_configurations: {},
masterFLOPubKey: '03BA851FE0F28AA156B0D6E00784919133D1E98284F9A94544B470DBBFB3D90EDD', //masterFLOAddress: 'FD5hK9ryBogJ5AcSvCy1tW5as8jRTkMLky',
actions: {}, actions: {},
blocked_flo_ids: [], blocked_flo_ids: [],
}; };
@ -11480,43 +11490,40 @@ slot[name="tab"]::slotted(.active){
token_app.actions = { token_app.actions = {
parse_flo_comments: async function () { parse_flo_comments: async function () {
text = `masterFLOPubKey=03BA851FE0F28AA156B0D6E00784919133D1E98284F9A94544B470DBBFB3D90EDD text = `masterFLOAddress=FD5hK9ryBogJ5AcSvCy1tW5as8jRTkMLky
#!#CURRENCY=INR #!#CURRENCY=INR
#!#TYPE_DEPOSITS=CASH_DEPOSITS_TEST #!#TYPE_DEPOSITS=CASH_DEPOSITS_TEST1
#!#TYPE_WITHDRAWS=CASH_WITHDRAWS_TEST #!#TYPE_WITHDRAWS=CASH_WITHDRAWS_TEST1
#!#TYPE_MSGES=USER_MESSAGES_TEST #!#TYPE_MSGES=USER_MESSAGES_TEST1
#!#TYPE_PROCESSED_DEPOSITS=PROCESSED_DEPOSITS #!#TYPE_PROCESSED_DEPOSITS=PROCESSED_DEPOSITS_TEST1
#!#TYPE_PROCESSED_WITHDRAWS=PROCESSED_WITHDRAWS #!#TYPE_PROCESSED_WITHDRAWS=PROCESSED_WITHDRAWS_TEST1
#!#TYPE_FILE_DEPOSITS_COMPLAINT=DEPOSITS_COMPLAINT #!#TYPE_FILE_DEPOSITS_COMPLAINT=DEPOSITS_COMPLAINT_TEST1
#!#TYPE_PROCESSED_DEPOSITS_COMPLAINT=PROCESSED_DEPOSITS_COMPLAINT #!#TYPE_PROCESSED_DEPOSITS_COMPLAINT=PROCESSED_DEPOSITS_COMPLAINT_TEST1
#!#TYPE_FILE_WITHDRAWS_COMPLAINT=WITHDRAWS_COMPLAINT #!#TYPE_FILE_WITHDRAWS_COMPLAINT=WITHDRAWS_COMPLAINT_TEST1
#!#TYPE_PROCESSED_WITHDRAWS_COMPLAINT=PROCESSED_WITHDRAWS_COMPLAINT #!#TYPE_PROCESSED_WITHDRAWS_COMPLAINT=PROCESSED_WITHDRAWS_COMPLAINT_TEST1
#!#TYPE_PAY_THROUGH_CASHIER=PAY_THRU_CASHIER #!#TYPE_PAY_THROUGH_CASHIER=PAY_THRU_CASHIER_TEST1
#!#TYPE_FILE_PAY_THROUGH_CASHIER_COMPLAINT=PAY_THRU_CASHIER_COMPLAINT #!#TYPE_FILE_PAY_THROUGH_CASHIER_COMPLAINT=PAY_THRU_CASHIER_COMPLAINT_TEST1
#!#TYPE_PROCESSED_PAY_THROUGH_CASHIER=PROCESSED_PAY_THROUGH_CASHIER #!#TYPE_PROCESSED_PAY_THROUGH_CASHIER=PROCESSED_PAY_THROUGH_CASHIER_TEST1
#!#TYPE_PROCESSED_PAY_THROUGH_CASHIER_COMPLAINT=PROCESSED_PAY_THROUGH_CASHIER_COMPLAINT #!#TYPE_PROCESSED_PAY_THROUGH_CASHIER_COMPLAINT=PROCESSED_PAY_THROUGH_CASHIER_COMPLAINT_TEST1
#!#TYPE_REQUEST_PAYMENT_DECLINED=REQUEST_PAYMENT_DECLINED #!#TYPE_REQUEST_PAYMENT_DECLINED=REQUEST_PAYMENT_DECLINED_TEST1
#!#TYPE_REQUEST_PAYMENT_APPROVED=REQUEST_PAYMENT_APPROVED #!#TYPE_REQUEST_PAYMENT_APPROVED=REQUEST_PAYMENT_APPROVED_TEST1
#!#vendors=FGtPEBu2NFFYkqFrA9NDBJJLpVhyuPubDj, #!#vendors=FGtPEBu2NFFYkqFrA9NDBJJLpVhyuPubDj,
#!#helplineFloId=F9MAyvT5b9aSfsuukAungrbt1L5fgmJmuK #!#helplineFloId=F9MAyvT5b9aSfsuukAungrbt1L5fgmJmuK
#!#cashiers= #!#cashiers=
{ {
"FByrY4vc1NRfbkqAqABtUyhhNzMZsKUjqr": { "FCja6sLv58e3RMy41T5AmWyvXEWesqBCkX": {
"upi_id": "johnDoe@upi" "upi_id": "8507742774@ybl"
},
"FHU7dfBVDLZwp3fLRJ5cr7nEABBeeU9Z4T": {
"upi_id": "janeDoe@upi"
} }
}` }`
text = removeWhiteSpaces(text); text = removeWhiteSpaces(text);
return text; return text;
const master_data = await ajaxGet(`${floGlobals.apiURL.FLO[1]}/api/txs/?address=${token_app.masterFLOPubKey}`); const master_data = await ajaxGet(`${floGlobals.apiURL.FLO[1]}/api/txs/?address=${token_app.masterFLOAddress}`);
if (typeof master_data === "object" && typeof master_data.txs === "object") { if (typeof master_data === "object" && typeof master_data.txs === "object") {
let text = ''; let text = '';
let tx_cmnt_arr = []; let tx_cmnt_arr = [];
for (txt of master_data.txs) { for (txt of master_data.txs) {
if (txt.vin[0].addr === token_app.masterFLOPubKey) { if (txt.vin[0].addr === token_app.masterFLOAddress) {
if (txt.floData.length === 0) break; if (txt.floData.length === 0) break;
tx_cmnt_arr.push(txt.floData); tx_cmnt_arr.push(txt.floData);
} }
@ -11657,6 +11664,8 @@ slot[name="tab"]::slotted(.active){
showPage(document.getElementById('home_page_btn'), 'home_page') showPage(document.getElementById('home_page_btn'), 'home_page')
} }
hidePopup()
pay_through_cashier(); pay_through_cashier();
}, },
@ -11948,7 +11957,7 @@ slot[name="tab"]::slotted(.active){
return false; return false;
} else { } else {
notify(`Transaction successful: ${flo_txid}.`, '', 'fixed', true); notify(`Transaction successful: ${flo_txid}.`, '', 'fixed', true);
if(payingRequested){ if (payingRequested) {
payment_request_status(currentPaymentRequest.requestId, 'APPROVED') payment_request_status(currentPaymentRequest.requestId, 'APPROVED')
showPayRequests() showPayRequests()
} }
@ -11964,7 +11973,7 @@ slot[name="tab"]::slotted(.active){
async function refresh_balance(refreshButton) { async function refresh_balance(refreshButton) {
try { try {
if(refreshButton){ if (refreshButton) {
notify('Updating Balance') notify('Updating Balance')
refreshButton.classList.add('animate-loader') refreshButton.classList.add('animate-loader')
} }
@ -12373,6 +12382,7 @@ slot[name="tab"]::slotted(.active){
let { sender_flo_id, receiver_flo_id, amount, datetime, pay_req_id } = m.message; let { sender_flo_id, receiver_flo_id, amount, datetime, pay_req_id } = m.message;
if (processed_payments_requests.includes(pay_req_id || m.message)) continue; if (processed_payments_requests.includes(pay_req_id || m.message)) continue;
console.log(sender_flo_id, amount, datetime, pay_req_id); console.log(sender_flo_id, amount, datetime, pay_req_id);
if (typeof sender_flo_id !== "string") continue;
frag.append(render.paymentRequest(datetime, sender_flo_id, amount, pay_req_id)) frag.append(render.paymentRequest(datetime, sender_flo_id, amount, pay_req_id))
} }
if (frag.children.length) if (frag.children.length)
@ -12484,7 +12494,7 @@ slot[name="tab"]::slotted(.active){
processed: false processed: false
} }
} }
if (this_user_deposit.length){ if (this_user_deposit.length) {
frag.append(render.depositComplaint(userData, cashierData, udc)) frag.append(render.depositComplaint(userData, cashierData, udc))
} }
} }