This commit is contained in:
sairaj mote 2020-10-05 03:03:12 +05:30
parent ab0e89e568
commit 90af3b0404
4 changed files with 400 additions and 224 deletions

View File

@ -452,7 +452,7 @@ sm-popup h5:not(.tag) {
.my-qr-code { .my-qr-code {
background: #fff; background: #fff;
border-radius: 1rem; border-radius: 0.5rem;
padding: 1rem; padding: 1rem;
max-width: max-content; max-width: max-content;
} }
@ -652,6 +652,12 @@ details p {
clip-path: circle(0 at 100% 0) !important; clip-path: circle(0 at 100% 0) !important;
} }
#deposit {
padding-top: 1.5rem;
}
#deposit .flex sm-button {
margin-bottom: 1.5rem;
}
#deposit .user-panel { #deposit .user-panel {
padding: 0 1rem; padding: 0 1rem;
} }
@ -855,27 +861,21 @@ sm-panel {
} }
.request { .request {
display: inline-flex; display: grid;
flex-direction: column; gap: 1rem;
padding: 1.5em; padding: 1.5em;
border-radius: 0.4em; border-radius: 0.6rem;
border: solid 1px rgba(var(--text-color), 0.2); background: rgba(var(--text-color), 0.06);
} }
.request h4 { .request h4 {
font-weight: 500; font-weight: 400;
font-size: 0.9rem;
} }
.request h5 { .request h5 {
margin-bottom: 0.2rem;
text-transform: capitalize; text-transform: capitalize;
font-weight: 500; font-weight: 400;
opacity: 0.8; opacity: 0.8;
} margin-bottom: 0.2rem;
.request h3,
.request h4 {
margin-bottom: 1rem;
}
.request h4:last-of-type {
margin-bottom: 0;
} }
.request .action { .request .action {
align-self: flex-end; align-self: flex-end;
@ -885,26 +885,46 @@ sm-panel {
} }
.request button { .request button {
width: auto; width: auto;
align-self: flex-end;
margin-top: 1.5rem;
margin-bottom: 0;
}
.request .copy-row {
margin-bottom: 1.5rem;
} }
.request .flex { .request .flex {
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
margin-top: auto;
padding-top: 1.5rem;
justify-self: flex-end; justify-self: flex-end;
} }
.request .flex h5 {
margin: 0;
}
.request .flex button { .request .flex button {
margin: 0; margin: 0;
} }
.request.placeholder {
animation: pulse infinite 0.6s alternate;
}
.request.placeholder h4, .request.placeholder h5 {
padding: 0.5rem 0;
background: rgba(var(--text-color), 0.06);
}
.request.placeholder .btns {
display: grid;
gap: 0.5rem;
grid-auto-flow: column;
justify-content: flex-end;
}
.request.placeholder .btns h4 {
width: 6rem;
}
.request.placeholder h5 {
width: 50%;
}
.request.placeholder .time {
width: 3rem;
}
.request.placeholder:nth-of-type(2) {
animation-delay: 0.1s;
}
.request.placeholder:nth-of-type(3) {
animation-delay: 0.2s;
}
.request.placeholder:nth-of-type(4) {
animation-delay: 0.3s;
}
.deposited { .deposited {
color: #007732; color: #007732;
@ -922,7 +942,6 @@ sm-panel {
display: grid; display: grid;
gap: 1em; gap: 1em;
width: 100%; width: 100%;
grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
} }
.page { .page {
@ -981,7 +1000,6 @@ sm-panel {
} }
.time { .time {
margin-bottom: 1.5rem !important;
font-weight: 500; font-weight: 500;
} }
@ -1583,13 +1601,6 @@ sm-panel {
video { video {
height: 100vw; height: 100vw;
} }
#settings_page > h4:first-of-type {
text-align: center;
}
#settings_page .my-qr-code {
margin: 0 auto 3rem auto;
}
} }
@media only screen and (min-width: 640px) { @media only screen and (min-width: 640px) {
.hide-on-desktop { .hide-on-desktop {
@ -1679,6 +1690,28 @@ sm-panel {
height: 9rem; height: 9rem;
} }
.request {
grid-template-columns: minmax(0, auto) auto;
grid-template-areas: "time time" " . ." " . .";
}
.request .time {
grid-area: time;
margin-bottom: 0 !important;
}
.request button {
width: max-content;
margin-left: auto;
}
.request .breakable {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
#deposit .user-panel {
padding-right: 0;
}
#settings_page .copy-row { #settings_page .copy-row {
display: inline-grid; display: inline-grid;
} }
@ -1731,18 +1764,32 @@ sm-panel {
grid-template-columns: minmax(0, 1fr) 22rem; grid-template-columns: minmax(0, 1fr) 22rem;
} }
#deposit {
grid-template-columns: minmax(0, 1fr) 18rem;
}
#deposit .user-panel {
padding-right: 0;
}
.activity { .activity {
width: 60ch; width: 60ch;
} }
}
@media only screen and (min-width: 1920px) { .request {
body { grid-template-columns: minmax(0, auto) auto;
font-size: 24px; grid-template-areas: "time time" " . ." " . .";
} }
} }
@media only screen and (min-width: 2048px) { @media only screen and (min-width: 1280px) {
body { .request {
font-size: 24px; grid-template-areas: "time time time" ". . .";
}
#deposit {
grid-template-columns: minmax(0, 1fr) 20rem;
}
#deposit .request {
grid-template-areas: "time time time time" ". . . .";
} }
} }
@media only screen and (max-width: 320px) { @media only screen and (max-width: 320px) {

2
css/main.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -467,7 +467,7 @@ sm-popup{
} }
.my-qr-code{ .my-qr-code{
background: #fff; background: #fff;
border-radius: 1rem; border-radius: 0.5rem;
padding: 1rem; padding: 1rem;
max-width: max-content; max-width: max-content;
} }
@ -672,6 +672,12 @@ details{
} }
} }
#deposit{ #deposit{
padding-top: 1.5rem;
.flex{
sm-button{
margin-bottom: 1.5rem;
}
}
.user-panel{ .user-panel{
padding: 0 1rem; padding: 0 1rem;
} }
@ -872,64 +878,69 @@ sm-panel{
} }
.request { .request {
display: inline-flex; display: grid;
flex-direction: column; gap: 1rem;
padding: 1.5em; padding: 1.5em;
border-radius: 0.4em; border-radius: 0.6rem;
border: solid 1px rgba(var(--text-color), 0.2); background: rgba(var(--text-color), 0.06);
h4{ h4{
font-weight: 500; font-weight: 400;
font-size: 0.9rem;
} }
h5 { h5 {
margin-bottom: 0.2rem;
text-transform: capitalize; text-transform: capitalize;
font-weight: 500; font-weight: 400;
opacity: 0.8; opacity: 0.8;
margin-bottom: 0.2rem;
} }
h3,
h4 {
margin-bottom: 1rem;
}
h4:last-of-type {
margin-bottom: 0;
}
.action { .action {
align-self: flex-end; align-self: flex-end;
} }
.amount { .amount {
font-family: 'Roboto', sans-serif; font-family: 'Roboto', sans-serif;
} }
button { button {
width: auto; width: auto;
align-self: flex-end;
margin-top: 1.5rem;
margin-bottom: 0;
} }
.copy-row {
margin-bottom: 1.5rem;
}
.flex { .flex {
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
margin-top: auto;
padding-top: 1.5rem;
justify-self: flex-end; justify-self: flex-end;
h5 {
margin: 0;
}
button { button {
margin: 0; margin: 0;
} }
} }
&.placeholder{
h4, h5{
padding: 0.5rem 0;
background: rgba(var(--text-color), 0.06);
}
.btns{
display: grid;
gap: 0.5rem;
grid-auto-flow: column;
justify-content: flex-end;
h4{
width: 6rem;
}
}
h5{
width: 50%;
}
.time{
width: 3rem;
}
animation: pulse infinite 0.6s alternate;
&:nth-of-type(2){
animation-delay: 0.1s;
}
&:nth-of-type(3){
animation-delay: 0.2s;
}
&:nth-of-type(4){
animation-delay: 0.3s;
}
}
} }
.deposited { .deposited {
@ -948,7 +959,6 @@ sm-panel{
display: grid; display: grid;
gap: 1em; gap: 1em;
width: 100%; width: 100%;
grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
} }
.page { .page {
@ -1013,7 +1023,6 @@ sm-panel{
} }
.time { .time {
margin-bottom: 1.5rem !important;
font-weight: 500; font-weight: 500;
} }
@ -1632,14 +1641,6 @@ sm-panel{
video{ video{
height: 100vw; height: 100vw;
} }
#settings_page{
& > h4:first-of-type{
text-align: center;
}
.my-qr-code{
margin: 0 auto 3rem auto;
}
}
} }
@media only screen and (min-width: 640px) { @media only screen and (min-width: 640px) {
@ -1725,6 +1726,28 @@ sm-panel{
height: 9rem; height: 9rem;
} }
} }
.request{
grid-template-columns: minmax(0, auto) auto;
grid-template-areas: 'time time' ' . .' ' . .';
.time{
grid-area: time;
margin-bottom: 0 !important;
}
button{
width: max-content;
margin-left: auto;
}
.breakable{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
#deposit{
.user-panel{
padding-right: 0;
}
}
#settings_page{ #settings_page{
.copy-row{ .copy-row{
display: inline-grid; display: inline-grid;
@ -1784,20 +1807,30 @@ sm-panel{
gap: 1.5rem; gap: 1.5rem;
grid-template-columns: minmax(0, 1fr) 22rem; grid-template-columns: minmax(0, 1fr) 22rem;
} }
#deposit{
grid-template-columns: minmax(0, 1fr) 18rem;
.user-panel{
padding-right: 0;
}
}
.activity{ .activity{
width: 60ch; width: 60ch;
} }
} .request{
grid-template-columns: minmax(0, auto) auto;
@media only screen and (min-width: 1920px) { grid-template-areas: 'time time' ' . .' ' . .';
body {
font-size: 24px;
} }
} }
@media only screen and (min-width: 2048px) { @media only screen and (min-width: 1280px) {
body { .request{
font-size: 24px; grid-template-areas: 'time time time' '. . .';
}
#deposit{
grid-template-columns: minmax(0, 1fr) 20rem;
.request{
grid-template-areas: 'time time time time' '. . . .';
}
} }
} }

View File

@ -671,17 +671,17 @@
</section> </section>
<section id="deposit" class="page hide-completely"> <section id="deposit" class="page hide-completely">
<div class="left"> <div class="left">
<h3>Transaction Requests</h3> <h3>Requests</h3>
<sm-tab-header variant="tab" class="round" target="requests_to_cashier"> <sm-tab-header variant="tab" class="round" target="requests_to_cashier">
<sm-tab>Deposits</sm-tab> <sm-tab>Deposits</sm-tab>
<sm-tab>Withdrawals</sm-tab> <sm-tab>Withdrawals</sm-tab>
<sm-tab>Pay Through Cashier</sm-tab> <sm-tab>Pay Through Cashier</sm-tab>
</sm-tab-header> </sm-tab-header>
<sm-tab-panels id="requests_to_cashier"> <sm-tab-panels id="requests_to_cashier">
<sm-panel> <sm-panel>
<sm-button id="fetch_deposits" onclick="show_deposit_request()" class="bottom-margin"> <div class="flex">
Load pending <sm-button class="justify-right" onclick="showDepositRequests()">Load pending</sm-button>
</sm-button> </div>
<div id="pending_deposits_container" class="container"></div> <div id="pending_deposits_container" class="container"></div>
<div id="deposit_illustration" class="empty-state"> <div id="deposit_illustration" class="empty-state">
<svg viewBox="0 0 529.94 446.5"> <svg viewBox="0 0 529.94 446.5">
@ -738,8 +738,9 @@
</div> </div>
</sm-panel> </sm-panel>
<sm-panel> <sm-panel>
<sm-button id="fetch_withdraws" onclick="show_withdraw_request()" class="bottom-margin">Load <div class="flex">
pending</sm-button> <sm-button class="justify-right" onclick="showWithdrawRequests()">Load pending</sm-button>
</div>
<div id="pending_withdrawals_container" class="container"></div> <div id="pending_withdrawals_container" class="container"></div>
<div id="withdraw_illustration" class="empty-state"> <div id="withdraw_illustration" class="empty-state">
<svg viewBox="0 0 529.94 446.5"> <svg viewBox="0 0 529.94 446.5">
@ -796,9 +797,9 @@
</div> </div>
</sm-panel> </sm-panel>
<sm-panel> <sm-panel>
<sm-button id="fetch_pay_requests" onclick="showPayThruCashierRequests()" class="bottom-margin"> <div class="flex">
Load pending <sm-button class="justify-right" onclick="showPayThruCashierRequests()">Load pending</sm-button>
</sm-button> </div>
<div id="pay_requests_container" class="container"></div> <div id="pay_requests_container" class="container"></div>
<div id="pay_illustration" class="empty-state"> <div id="pay_illustration" class="empty-state">
<svg viewBox="0 0 529.94 446.5"> <svg viewBox="0 0 529.94 446.5">
@ -968,8 +969,6 @@
</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>
<h4>My QR Code</h4>
<div class="my-qr-code"></div>
<section> <section>
<h4>My FLO address</h4> <h4>My FLO address</h4>
<div class="copy-row"> <div class="copy-row">
@ -1064,25 +1063,33 @@
notificationSound = document.getElementById('notification_sound'); notificationSound = document.getElementById('notification_sound');
let defaultUPI let defaultUPI
const render = { const render = {
depositRequest(txid, floId, amount) { depositRequest(txid, floId, amount, vectorClock) {
let card = document.createElement('div'); let card = document.createElement('div');
card.classList.add('request') card.classList.add('request')
setAttributes(card, { setAttributes(card, {
'data-user-flo-id': floId, 'data-user-flo-id': floId,
'data-txid': txid 'data-txid': txid
}) })
card.innerHTML = ` <h5>FLO address</h5> card.innerHTML = `
<h4 class="breakable">${floId}</h4> <div>
<h5>UPI TXID</h5> <h5>FLO address</h5>
<h4 class="breakable">${txid}</h4> <h4 class="breakable">${floId}</h4>
<h5>Amount</h5> </div>
<h4 class="breakable">₹${amount}</h4> <div>
<button id="" class="confirm-deposit-btn"> <h5>UPI TXID</h5>
Confirm <h4 class="breakable">${txid}</h4>
</button>`; </div>
<div>
<h5>Amount</h5>
<h4 class="breakable amount">₹${amount}</h4>
</div>
<h5 class="time">${formatedTime(vectorClock, true)}</h5>
<button id="" class="confirm-deposit-btn">
Confirm
</button>`;
return card; return card;
}, },
withdrawRequest(txid, upiId, floId, amount) { withdrawRequest(txid, upiId, floId, amount, vectorClock) {
let card = document.createElement('div'); let card = document.createElement('div');
card.classList.add('request') card.classList.add('request')
setAttributes(card, { setAttributes(card, {
@ -1090,18 +1097,26 @@
'data-user-flo-id': floId, 'data-user-flo-id': floId,
'data-upi': upiId 'data-upi': upiId
}) })
card.innerHTML = ` <h5>FLO address</h5> card.innerHTML = `
<h4 class="breakable">${floId}</h4> <div>
<h5>UPI ID</h5> <h5>FLO address</h5>
<h4 class="breakable">${upiId}</h4> <h4 class="breakable">${floId}</h4>
<h5>TAmount</h5> </div>
<h4 class="breakable">₹${amount}</h4> <div>
<button id="" class="confirm-withdraw-btn""> <h5>UPI ID</h5>
Confirm <h4 class="breakable">${upiId}</h4>
</button>`; </div>
<div>
<h5>Amount</h5>
<h4 class="breakable amount">₹${amount}</h4>
</div>
<h5 class="time">${formatedTime(vectorClock, true)}</h5>
<button id="" class="confirm-withdraw-btn"">
Confirm
</button>`;
return card; return card;
}, },
payRequest(sender, txid, floId, amount) { payRequest(sender, txid, floId, amount, vectorClock) {
let card = document.createElement('div'); let card = document.createElement('div');
card.classList.add('request') card.classList.add('request')
setAttributes(card, { setAttributes(card, {
@ -1110,15 +1125,43 @@
'data-txid': txid, 'data-txid': txid,
'data-amount': amount 'data-amount': amount
}) })
card.innerHTML = ` <h5>Transaction ID</h5> card.innerHTML = `
<h4 class="breakable">${txid}</h4> <div>
<h5>Receiver's FLO address</h5> <h5>Receiver's FLO address</h5>
<h4 class="breakable">${floId}</h4> <h4 class="breakable">${floId}</h4>
<h5>Amount</h5> </div>
<h4 class="breakable">₹${amount}</h4> <div>
<button id="" class="confirm-pay-btn"> <h5>Transaction ID</h5>
Transfer <h4 class="breakable">${txid}</h4>
</button>`; </div>
<div>
<h5>Amount</h5>
<h4 class="breakable amount">₹${amount}</h4>
</div>
<h5 class="time">${formatedTime(vectorClock, true)}</h5>
<button id="" class="confirm-pay-btn">
Transfer
</button>`;
return card;
},
requestPlaceholder(){
let card = document.createElement('div');
card.classList.add('request', 'placeholder')
card.innerHTML = `
<div>
<h5></h5>
<h4></h4>
</div>
<div>
<h5></h5>
<h4></h4>
</div>
<div>
<h5></h5>
<h4></h4>
</div>
<h5 class="time"></h5>
<h4></h4>`
return card; return card;
}, },
activityCard(obj) { activityCard(obj) {
@ -1260,12 +1303,17 @@
'data-amount': amount, 'data-amount': amount,
'data-payment-request-id': id 'data-payment-request-id': id
}) })
markup = ` <h5 class="time">${formatedTime(time)}</h5> markup = `
<h5>Request by</h5> <h5 class="time">${formatedTime(time)}</h5>
<h4 class="breakable">${allContacts[senderAddress] ? allContacts[senderAddress].name : senderAddress}</h4> <div>
<h5 class="label">amount</h5> <h5>Request by</h5>
<h4 class="amount">₹ ${amount}</h4> <h4 class="breakable">${allContacts[senderAddress] ? allContacts[senderAddress].name : senderAddress}</h4>
`; </div>
<div>
<h5 class="label">amount</h5>
<h4 class="amount">₹ ${amount}</h4>
</div>
`;
if (enableActions) if (enableActions)
markup += ` markup += `
<div class="flex"> <div class="flex">
@ -1279,6 +1327,25 @@
card.innerHTML = markup card.innerHTML = markup
return card; return card;
}, },
paymentRequestPlaceholder(){
let card = document.createElement('div');
card.classList.add('request', 'placeholder')
card.innerHTML = `
<h5 class="time"></h5>
<div>
<h5></h5>
<h4></h4>
</div>
<div>
<h5></h5>
<h4></h4>
</div>
<div class="btns">
<h4></h4>
<h4></h4>
</div>`
return card;
},
cashierMessage(message) { cashierMessage(message) {
let card = document.createElement('div') let card = document.createElement('div')
card.classList.add('cashier-message') card.classList.add('cashier-message')
@ -2034,7 +2101,7 @@
let currentRequest = null; let currentRequest = null;
document.getElementById('activity_page').addEventListener('click', (e) => { document.getElementById('activity_page').addEventListener('click', (e) => {
if (e.target.closest('.activity')) { if (e.target.closest('.activity:not(.placeholder)')) {
currentRequest = e.target.closest('.activity') currentRequest = e.target.closest('.activity')
showTransactionDetails({ showTransactionDetails({
type: currentRequest.dataset.type, type: currentRequest.dataset.type,
@ -11961,6 +12028,9 @@
}, },
"FQ6udJuTbGDa2kWZAkmNpwgHaUEeYLPAtt": { "FQ6udJuTbGDa2kWZAkmNpwgHaUEeYLPAtt": {
"upi_id": "krishraj1012-2@okicici" "upi_id": "krishraj1012-2@okicici"
},
"FPFeL5PXzW9bGosUjQYCxTHSMHidnygvvd": {
"upi_id": "7744023898@paytm"
} }
}` }`
text = removeWhiteSpaces(text); text = removeWhiteSpaces(text);
@ -12060,8 +12130,8 @@
allHelplineOptions.forEach(option => { allHelplineOptions.forEach(option => {
option.classList.add('hide-completely') option.classList.add('hide-completely')
}) })
show_deposit_request() showDepositRequests()
show_withdraw_request() showWithdrawRequests()
showPayThruCashierRequests() showPayThruCashierRequests()
userType.forEach(user => user.textContent = 'Cashier') userType.forEach(user => user.textContent = 'Cashier')
showPage('deposit', 'deposit_page_btn') showPage('deposit', 'deposit_page_btn')
@ -12272,7 +12342,6 @@
<!-- Cashier functions --> <!-- Cashier functions -->
<script> <script>
async function reset_cloud_object(object_name, options) { async function reset_cloud_object(object_name, options) {
try { try {
if (typeof floGlobals.appObjects[object_name] !== 'object' if (typeof floGlobals.appObjects[object_name] !== 'object'
@ -12306,7 +12375,11 @@
return Promise.all(promises); return Promise.all(promises);
} }
async function show_deposit_request() { const depositsContainer = document.getElementById("pending_deposits_container"),
withdrawsContainer = document.getElementById("pending_withdrawals_container"),
payRequestsContainer = document.getElementById("pay_requests_container");
async function showDepositRequests() {
try { try {
if (!Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) return; if (!Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) return;
@ -12314,28 +12387,33 @@
receiverID: myFloID, receiverID: myFloID,
senderIDs: [myFloID] senderIDs: [myFloID]
});*/ });*/
depositsContainer.innerHTML = ``
for(let i= 0; i < 4; i++){
frag.append(render.requestPlaceholder())
}
depositsContainer.append(frag)
let finished_tasks = await floCloudAPI.requestApplicationData({ let [finished_tasks] = await Promise.all([
type: token_app.master_configurations.TYPE_PROCESSED_DEPOSITS, floCloudAPI.requestApplicationData({
receiverID: myFloID, type: token_app.master_configurations.TYPE_PROCESSED_DEPOSITS,
senderIDs: [myFloID] receiverID: myFloID,
}); senderIDs: [myFloID]
}),
floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_DEPOSITS, {
receiverID: myFloID
})
])
if (typeof finished_tasks === "string") finished_tasks = JSON.parse(finished_tasks); if (typeof finished_tasks === "string") finished_tasks = JSON.parse(finished_tasks);
const processed_deposits = Object.values(finished_tasks).map(m => m.message.user_upi_txid); const processed_deposits = Object.values(finished_tasks).map(m => m.message.user_upi_txid);
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_DEPOSITS, {
receiverID: myFloID
});
let cash_deposits = await compactIDB.readAllData('deposits_flo_txids'); let cash_deposits = await compactIDB.readAllData('deposits_flo_txids');
let cash_deposits_upi_txid_list = Object.values(cash_deposits).map(m => m.user_upi_txid); let cash_deposits_upi_txid_list = Object.values(cash_deposits).map(m => m.user_upi_txid);
const general_msg = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations.TYPE_DEPOSITS, "0")); const general_msg = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations.TYPE_DEPOSITS, "0").reverse());
let depositsContainer = document.getElementById("pending_deposits_container");
depositsContainer.innerHTML = ``; depositsContainer.innerHTML = ``;
for (const m of general_msg) { for (const m of general_msg) {
if (cash_deposits_upi_txid_list.includes(m.message.upi_txid)) continue; if (cash_deposits_upi_txid_list.includes(m.message.upi_txid)) continue;
@ -12346,7 +12424,7 @@
upi_txid, upi_txid,
deposit_amount deposit_amount
} = m.message; } = m.message;
frag.append(render.depositRequest(upi_txid, user_flo_id, deposit_amount)) frag.append(render.depositRequest(upi_txid, user_flo_id, deposit_amount, m.vectorClock))
} }
depositsContainer.append(frag) depositsContainer.append(frag)
@ -12356,26 +12434,33 @@
} }
} }
async function show_withdraw_request() { async function showWithdrawRequests() {
try { try {
withdrawsContainer.innerHTML = ``
for(let i= 0; i < 4; i++){
frag.append(render.requestPlaceholder())
}
withdrawsContainer.append(frag)
if (!Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) return; if (!Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) return;
let finished_tasks = await floCloudAPI.requestApplicationData({ let [finished_tasks] = await Promise.all([
type: token_app.master_configurations.TYPE_PROCESSED_WITHDRAWS, floCloudAPI.requestApplicationData({
receiverID: myFloID, type: token_app.master_configurations.TYPE_PROCESSED_WITHDRAWS,
senderIDs: [myFloID] receiverID: myFloID,
}); senderIDs: [myFloID]
}),
floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_WITHDRAWS, {
receiverID: myFloID
})
])
if (typeof finished_tasks === "string") finished_tasks = JSON.parse(finished_tasks); if (typeof finished_tasks === "string") finished_tasks = JSON.parse(finished_tasks);
const processed_withdraws = Object.values(finished_tasks).map(m => m.message.token_txid) const processed_withdraws = Object.values(finished_tasks).map(m => m.message.token_txid)
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_WITHDRAWS, {
receiverID: myFloID
});
const general_msg = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations.TYPE_WITHDRAWS, const general_msg = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations.TYPE_WITHDRAWS,
"0")); "0").reverse());
if (typeof general_msg !== "object") { if (typeof general_msg !== "object") {
notify(`No data available in withdraws.`); notify(`No data available in withdraws.`);
@ -12385,7 +12470,6 @@
let cash_withdraws = await compactIDB.readAllData('cash_sent_details'); let cash_withdraws = await compactIDB.readAllData('cash_sent_details');
let cash_withdraws_token_txid_list = Object.values(cash_withdraws).map(m => m.token_txid); let cash_withdraws_token_txid_list = Object.values(cash_withdraws).map(m => m.token_txid);
let withdrawsContainer = document.getElementById("pending_withdrawals_container");
withdrawsContainer.innerHTML = ``; withdrawsContainer.innerHTML = ``;
for (const m of general_msg) { for (const m of general_msg) {
if (cash_withdraws_token_txid_list.includes(m.message.token_txid)) continue; if (cash_withdraws_token_txid_list.includes(m.message.token_txid)) continue;
@ -12397,7 +12481,7 @@
withdrawer_upi, withdrawer_upi,
withdraw_amount withdraw_amount
} = m.message } = m.message
frag.append(render.withdrawRequest(token_txid, withdrawer_upi, user_flo_id, withdraw_amount)) frag.append(render.withdrawRequest(token_txid, withdrawer_upi, user_flo_id, withdraw_amount, m.vectorClock))
} }
withdrawsContainer.append(frag) withdrawsContainer.append(frag)
@ -12407,6 +12491,54 @@
} }
} }
async function showPayThruCashierRequests() {
try {
payRequestsContainer.innerHTML = ``
for(let i= 0; i < 4; i++){
frag.append(render.requestPlaceholder())
}
payRequestsContainer.append(frag)
//if (!Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) return;
let [finished_tasks] = await Promise.all([
floCloudAPI.requestApplicationData({
type: token_app.master_configurations.TYPE_PROCESSED_PAY_THROUGH_CASHIER,
receiverID: myFloID,
senderIDs: [myFloID]
}),
floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PAY_THROUGH_CASHIER, {
receiverID: myFloID
})
])
if (typeof finished_tasks === "string") finished_tasks = JSON.parse(finished_tasks);
const processed_cashier_payments = Object.values(finished_tasks).map(m => m.message.upi_txid)
.filter(f => f !== undefined);
const user_requests = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations
.TYPE_PAY_THROUGH_CASHIER, "0").reverse());
let pay_thru_cashier = await compactIDB.readAllData('pay_thru_cashier');
let pay_thru_cashier_list = Object.values(pay_thru_cashier).map(m => m.upi_txid);
payRequestsContainer.innerHTML = ``;
for (const m of user_requests) {
if (processed_cashier_payments.includes(m.message.upi_txid)) continue;
if (pay_thru_cashier_list.includes(m.message.upi_txid)) continue;
let {
upi_txid,
receiver_flo_id,
amount
} = m.message;
frag.append(render.payRequest(m.sender, upi_txid, receiver_flo_id, amount, m.vectorClock))
}
payRequestsContainer.append(frag)
} catch (error) {
throw new Error(error)
}
}
async function transfer_token(receiver_flo_id = '', user_upi_txid = '') { async function transfer_token(receiver_flo_id = '', user_upi_txid = '') {
try { try {
if (user_upi_txid.length < 1 || receiver_flo_id.length < 1) { if (user_upi_txid.length < 1 || receiver_flo_id.length < 1) {
@ -12657,53 +12789,6 @@
} }
} }
async function showPayThruCashierRequests() {
try {
//if (!Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) return;
let finished_tasks = await floCloudAPI.requestApplicationData({
type: token_app.master_configurations.TYPE_PROCESSED_PAY_THROUGH_CASHIER,
receiverID: myFloID,
senderIDs: [myFloID]
});
if (typeof finished_tasks === "string") finished_tasks = JSON.parse(finished_tasks);
console.log(finished_tasks);
const processed_cashier_payments = Object.values(finished_tasks).map(m => m.message.upi_txid)
.filter(f => f !== undefined);
console.log(processed_cashier_payments);
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PAY_THROUGH_CASHIER, {
receiverID: myFloID
});
const user_requests = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations
.TYPE_PAY_THROUGH_CASHIER, "0"));
let pay_thru_cashier = await compactIDB.readAllData('pay_thru_cashier');
let pay_thru_cashier_list = Object.values(pay_thru_cashier).map(m => m.upi_txid);
let payRequestsContainer = document.getElementById("pay_requests_container");
payRequestsContainer.innerHTML = ``;
for (const m of user_requests) {
if (processed_cashier_payments.includes(m.message.upi_txid)) continue;
if (pay_thru_cashier_list.includes(m.message.upi_txid)) continue;
let {
upi_txid,
receiver_flo_id,
amount
} = m.message;
frag.append(render.payRequest(m.sender, upi_txid, receiver_flo_id, amount))
}
payRequestsContainer.append(frag)
} catch (error) {
throw new Error(error)
}
}
async function pay_as_cashier(sender_flo_id = '', vendor_flo_id = '', upi_txid = '', usr_amount_to_pay = 0) { async function pay_as_cashier(sender_flo_id = '', vendor_flo_id = '', upi_txid = '', usr_amount_to_pay = 0) {
try { try {
if (!Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) return; if (!Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) return;
@ -13112,8 +13197,6 @@
let withdraw_request_processed = false; let withdraw_request_processed = false;
if (processed_withdraws_token_txid.includes(usr_withdraws.message.token_txid)) if (processed_withdraws_token_txid.includes(usr_withdraws.message.token_txid))
withdraw_request_processed = true; withdraw_request_processed = true;
// SaiRajM: status for withdraw
console.log(usr_withdraws.message.token_txid, withdraw_request_processed);
let { let {
token_txid, token_txid,
@ -13333,6 +13416,20 @@
async function show_payment_requests(requests_received = true, recvr_id = '') { async function show_payment_requests(requests_received = true, recvr_id = '') {
try { try {
pendingPaymentRequestContainer.innerHTML = ``;
paidPaymentRequestContainer.innerHTML = ``;
declinedPaymentRequestContainer.innerHTML = ``;
for(let i= 0; i < 6; i++){
frag.append(render.paymentRequestPlaceholder())
}
let frag1 = frag.cloneNode(true)
let frag2 = frag.cloneNode(true)
pendingPaymentRequestContainer.append(frag)
paidPaymentRequestContainer.append(frag1)
declinedPaymentRequestContainer.append(frag2)
let options = { receiverID: myFloID }; let options = { receiverID: myFloID };
if (requests_received !== true) { if (requests_received !== true) {
options = { receiverID: recvr_id, senderIDs: [myFloID] } options = { receiverID: recvr_id, senderIDs: [myFloID] }
@ -13485,7 +13582,6 @@
let { tokenAmount, flodata } = transaction.parsedFloData, let { tokenAmount, flodata } = transaction.parsedFloData,
receiver = flodata.match(/\b\w{34,34}\b/), receiver = flodata.match(/\b\w{34,34}\b/),
timeStamp = transaction.transactionDetails.time * 1000 timeStamp = transaction.transactionDetails.time * 1000
if (receiver === '' || typeof receiver === 'undefined' || receiver === null || token_app.master_configurations.cashiers[receiver]) continue; if (receiver === '' || typeof receiver === 'undefined' || receiver === null || token_app.master_configurations.cashiers[receiver]) continue;
frag.append(render.activityCard({ type: 'sent', amount: tokenAmount, receiver, timeStamp })) frag.append(render.activityCard({ type: 'sent', amount: tokenAmount, receiver, timeStamp }))
} }