added payment status functionality

This commit is contained in:
sairaj mote 2020-07-09 17:18:58 +05:30 committed by GitHub
parent 4e226a2656
commit e717c0a0c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 617 additions and 274 deletions

View File

@ -50,8 +50,8 @@ button {
-ms-flex-pack: center; -ms-flex-pack: center;
justify-content: center; justify-content: center;
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.1em; letter-spacing: 0.08em;
padding: 0.6rem 1rem; padding: 0.4rem 0.7rem;
font-weight: 600; font-weight: 600;
cursor: pointer; cursor: pointer;
border-radius: 0.2em; border-radius: 0.2em;
@ -152,6 +152,10 @@ input:invalid {
gap: 1em; gap: 1em;
} }
.label {
margin-bottom: 0.4rem;
}
.light-text { .light-text {
color: rgba(var(--text-light), 1); color: rgba(var(--text-light), 1);
} }
@ -544,8 +548,8 @@ form {
display: -ms-flexbox; display: -ms-flexbox;
display: flex; display: flex;
background: rgba(var(--foreground), 1); background: rgba(var(--foreground), 1);
-webkit-transform: translateY(1rem); -webkit-transform: translateY(100%);
transform: translateY(1rem); transform: translateY(100%);
-webkit-transition: -webkit-transform 0.3s; -webkit-transition: -webkit-transform 0.3s;
transition: -webkit-transform 0.3s; transition: -webkit-transform 0.3s;
transition: transform 0.3s; transition: transform 0.3s;
@ -841,7 +845,7 @@ form {
font-size: 0.9em; font-size: 0.9em;
text-transform: uppercase; text-transform: uppercase;
width: 100%; width: 100%;
letter-spacing: 0.1em; letter-spacing: 0.08em;
} }
#navbar .navbar-item h5 { #navbar .navbar-item h5 {
@ -914,7 +918,7 @@ form {
} }
.options-tab .option h4 { .options-tab .option h4 {
font-weight: 600; font-weight: 400;
} }
.options-tab .option:nth-of-type(1) .icon { .options-tab .option:nth-of-type(1) .icon {
@ -988,6 +992,7 @@ form {
.request h5 { .request h5 {
color: rgba(var(--text-light), 1); color: rgba(var(--text-light), 1);
margin-bottom: 0.4rem; margin-bottom: 0.4rem;
text-transform: capitalize;
} }
.request h3, .request h4 { .request h3, .request h4 {
@ -1171,6 +1176,7 @@ form {
.time { .time {
font-family: 'Roboto', sans-serif; font-family: 'Roboto', sans-serif;
margin-bottom: 1.5rem !important; margin-bottom: 1.5rem !important;
font-weight: 400;
} }
#report_popup h4 { #report_popup h4 {
@ -1196,12 +1202,55 @@ form {
align-self: flex-start; align-self: flex-start;
} }
.complaint {
display: -ms-grid;
display: grid;
gap: 1.5rem 0;
}
.complaint .complaint-actions {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
margin: 1.5rem 0 0 0;
}
.complaint .processed {
color: #007732;
}
.complaint .unprocessed {
color: #d43125;
}
.complaint button .icon {
padding: 0.2rem;
margin-right: 0.5rem;
stroke: var(--primary-color);
stroke-width: 8;
}
.complaints-container {
padding-top: 1.5rem;
display: -ms-grid;
display: grid;
gap: 1.5rem;
}
@media only screen and (max-width: 640px) {
sm-select {
width: 100%;
}
}
@media only screen and (min-width: 640px) { @media only screen and (min-width: 640px) {
body { body {
padding: 1rem 6vw; padding: 1rem 6vw;
margin-left: 6rem; margin-left: 6rem;
} }
.popup-container .popup { .popup-container .popup {
-webkit-transform: translateY(0) scale(0.96);
transform: translateY(0) scale(0.96);
width: 24rem; width: 24rem;
-ms-flex-item-align: center; -ms-flex-item-align: center;
-ms-grid-row-align: center; -ms-grid-row-align: center;
@ -1332,6 +1381,35 @@ form {
-ms-grid-columns: (1fr)[3]; -ms-grid-columns: (1fr)[3];
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
} }
.complaint {
gap: 0 1.5rem;
-ms-grid-columns: 1fr 1fr;
grid-template-columns: 1fr 1fr;
grid-template-areas: '. . ' 'header header';
}
.complaint .complaint-actions {
-ms-grid-row: 2;
-ms-grid-column: 1;
-ms-grid-column-span: 2;
grid-area: header;
}
.complaint .left {
border-right: 1px solid rgba(var(--text), 0.2);
}
.complaint .left, .complaint .right {
padding-right: 1.5rem;
}
.complaint .right {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
} }
@media only screen and (min-width: 1280px) { @media only screen and (min-width: 1280px) {

File diff suppressed because one or more lines are too long

View File

@ -37,8 +37,8 @@ button{
align-items: center; align-items: center;
justify-content: center; justify-content: center;
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.1em; letter-spacing: 0.08em;
padding: 0.6rem 1rem; padding: 0.4rem 0.7rem;
font-weight: 600; font-weight: 600;
cursor: pointer; cursor: pointer;
border-radius: 0.2em; border-radius: 0.2em;
@ -102,6 +102,9 @@ input:invalid{
grid-template-columns: auto auto; grid-template-columns: auto auto;
gap: 1em; gap: 1em;
} }
.label{
margin-bottom: 0.4rem;
}
.light-text{ .light-text{
color: rgba(var(--text-light), 1); color: rgba(var(--text-light), 1);
} }
@ -353,7 +356,7 @@ form{
position: relative; position: relative;
display: flex; display: flex;
background: rgba(var(--foreground), 1); background: rgba(var(--foreground), 1);
transform: translateY(1rem); transform: translateY(100%);
transition: transform 0.3s; transition: transform 0.3s;
box-shadow: 0 2rem 2rem rgba($color: #000000, $alpha: 0.24); box-shadow: 0 2rem 2rem rgba($color: #000000, $alpha: 0.24);
overflow-y: auto; overflow-y: auto;
@ -561,7 +564,7 @@ form{
font-size: 0.9em; font-size: 0.9em;
text-transform: uppercase; text-transform: uppercase;
width: 100%; width: 100%;
letter-spacing: 0.1em; letter-spacing: 0.08em;
h5{ h5{
font-size: 0.6em; font-size: 0.6em;
margin-top: 0.4em; margin-top: 0.4em;
@ -616,7 +619,7 @@ form{
stroke: rgba(var(--text), 0.4); stroke: rgba(var(--text), 0.4);
} }
h4{ h4{
font-weight: 600; font-weight: 400;
} }
&:nth-of-type(1){ &:nth-of-type(1){
.icon{ .icon{
@ -682,6 +685,7 @@ form{
h5{ h5{
color: rgba(var(--text-light), 1); color: rgba(var(--text-light), 1);
margin-bottom: 0.4rem; margin-bottom: 0.4rem;
text-transform: capitalize;
} }
h3,h4{ h3,h4{
margin-bottom: 1.5rem; margin-bottom: 1.5rem;
@ -818,6 +822,7 @@ form{
.time{ .time{
font-family: 'Roboto', sans-serif; font-family: 'Roboto', sans-serif;
margin-bottom: 1.5rem !important; margin-bottom: 1.5rem !important;
font-weight: 400;
} }
#report_popup{ #report_popup{
h4{ h4{
@ -834,6 +839,38 @@ form{
align-self: flex-start; align-self: flex-start;
} }
} }
.complaint{
display: grid;
gap: 1.5rem 0;
.complaint-actions{
align-items: center;
margin: 1.5rem 0 0 0;
}
.processed{
color: #007732;
}
.unprocessed{
color: #d43125;
}
button{
.icon{
padding: 0.2rem;
margin-right: 0.5rem;
stroke: var(--primary-color);
stroke-width: 8;
}
}
}
.complaints-container{
padding-top: 1.5rem;
display: grid;
gap: 1.5rem;
}
@media only screen and (max-width: 640px){
sm-select{
width: 100%;
}
}
@media only screen and (min-width: 640px){ @media only screen and (min-width: 640px){
body{ body{
padding: 1rem 6vw; padding: 1rem 6vw;
@ -841,6 +878,7 @@ form{
} }
.popup-container{ .popup-container{
.popup{ .popup{
transform: translateY(0) scale(0.96);
width: 24rem; width: 24rem;
align-self: center; align-self: center;
border-radius: 0.2rem; border-radius: 0.2rem;
@ -947,6 +985,25 @@ form{
.container{ .container{
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
} }
.complaint{
gap: 0 1.5rem;
grid-template-columns: 1fr 1fr;
grid-template-areas: '. . ' 'header header';
.complaint-actions{
grid-area: header;
}
.left{
border-right: 1px solid rgba(var(--text), 0.2);
}
.left, .right{
padding-right: 1.5rem;
}
.right{
display: flex;
align-items: center;
justify-content: center;
}
}
} }
@media only screen and (min-width: 1280px){ @media only screen and (min-width: 1280px){
body{ body{

View File

@ -5,6 +5,9 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Blockchain UPI</title> <title>Blockchain UPI</title>
<link
href="https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&family=Roboto:wght@400;500;700&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="css/main.css"> <link rel="stylesheet" href="css/main.css">
</head> </head>
@ -316,8 +319,8 @@
</svg> </svg>
<h5>Deposit</h5> <h5>Deposit</h5>
</div> </div>
<div title="See all cash withdraw requests" id="deposit_page_btn" class="navbar-item cashier-option hide-completely" <div title="See all cash withdraw requests" id="deposit_page_btn"
onclick="showPage(this, 'withdraw')"> class="navbar-item cashier-option hide-completely" onclick="showPage(this, 'withdraw')">
<svg class="icon banking" viewBox="0 0 52 60"> <svg class="icon banking" viewBox="0 0 52 60">
<line x1="4" y1="33.5" x2="4" y2="25" /> <line x1="4" y1="33.5" x2="4" y2="25" />
<polyline points="41.52 6.5 51 6.5 51 53.5 41.69 53.5" /> <polyline points="41.52 6.5 51 6.5 51 53.5 41.69 53.5" />
@ -364,12 +367,14 @@
</svg> </svg>
<h5>Activity</h5> <h5>Activity</h5>
</div> </div>
<div title="helpline page" class="navbar-item helpline-option" id="helpline_page_btn" onclick="showPage(this, 'helpline_page')"> <div title="helpline page" class="navbar-item helpline-option" id="helpline_page_btn"
onclick="showPage(this, 'helpline_page')">
<svg class="icon" viewBox="0 0 64 64"> <svg class="icon" viewBox="0 0 64 64">
<rect x="16.52" y="24.22" width="21.12" height="5.76" transform="translate(54.18 0.03) rotate(90)" /> <rect x="16.52" y="24.22" width="21.12" height="5.76" transform="translate(54.18 0.03) rotate(90)" />
<path <path
d="M29.46,16.62A3.68,3.68,0,0,1,32.58,13l17.61-2.64a13.57,13.57,0,0,0,7.19-4h0a4.7,4.7,0,0,1,6.12,4.48V43.41a4.69,4.69,0,0,1-6.12,4.48h0a13.62,13.62,0,0,0-7.19-4L32.58,41.23a3.68,3.68,0,0,1-3.12-3.64Z" /> d="M29.46,16.62A3.68,3.68,0,0,1,32.58,13l17.61-2.64a13.57,13.57,0,0,0,7.19-4h0a4.7,4.7,0,0,1,6.12,4.48V43.41a4.69,4.69,0,0,1-6.12,4.48h0a13.62,13.62,0,0,0-7.19-4L32.58,41.23a3.68,3.68,0,0,1-3.12-3.64Z" />
<rect x="-1.18" y="15.26" width="27.05" height="23.69" rx="3.39" transform="translate(39.45 14.76) rotate(90)" /> <rect x="-1.18" y="15.26" width="27.05" height="23.69" rx="3.39"
transform="translate(39.45 14.76) rotate(90)" />
<path <path
d="M7.24,40.63H17.45a0,0,0,0,1,0,0v15a2.27,2.27,0,0,1-2.27,2.27H9.51a2.27,2.27,0,0,1-2.27-2.27v-15a0,0,0,0,1,0,0Z" /> d="M7.24,40.63H17.45a0,0,0,0,1,0,0v15a2.27,2.27,0,0,1-2.27,2.27H9.51a2.27,2.27,0,0,1-2.27-2.27v-15a0,0,0,0,1,0,0Z" />
</svg> </svg>
@ -668,7 +673,7 @@
<sm-select name="activity type" id="activity_type"> <sm-select name="activity type" id="activity_type">
<sm-option value="deposits">Deposits</sm-option> <sm-option value="deposits">Deposits</sm-option>
<sm-option value="withdraws">Withdrawals</sm-option> <sm-option value="withdraws">Withdrawals</sm-option>
<sm-option value="cashierMsg">Messages from cashier</sm-option> <sm-option value="cashierMsg">System notifications</sm-option>
</sm-select> </sm-select>
</div> </div>
<p class="bottom-margin">*If your request isn't completed in 12hrs, use <strong>REPORT</strong> to get <p class="bottom-margin">*If your request isn't completed in 12hrs, use <strong>REPORT</strong> to get
@ -683,23 +688,22 @@
<h4>No messages from cashier.</h4> <h4>No messages from cashier.</h4>
</div> </div>
</section> </section>
<section id="helpline_page" class="page"> <section id="helpline_page" class="page hide-completely">
<div class="container-header"> <div class="container-header">
<h2>Complaints</h2> <h2>Complaints</h2>
<sm-select name="complaint type" id="complaint_type"> <sm-select name="complaint type" id="complaint_type">
<sm-option value="deposits">Deposits</sm-option> <sm-option value="deposits">Deposits</sm-option>
<sm-option value="withdraws">Withdrawals</sm-option> <sm-option value="withdraws">Withdrawals</sm-option>
<sm-option value="payCashier">Pay through cashier</option> <sm-option value="payCashier">Pay through cashier</sm-option>
</sm-select> </sm-select>
</div> </div>
<h5 class="label">Select Cashier</h5>
<sm-select name="cashier" id="select_cashier"></sm-select> <sm-select name="cashier" id="select_cashier"></sm-select>
<div id="deposit_complaints_container" class="container complaints-container"> <div id="deposit_complaints_container" class="complaints-container"></div>
<h4>No deposit complaints.</h4> <div id="withdraw_complaints_container" class="complaints-container hide-completely">
</div>
<div id="withdraw_complaints_container" class="container complaints-container hide-completely">
<h4>No withdraw complaints.</h4> <h4>No withdraw complaints.</h4>
</div> </div>
<div id="pay_cashier_complaints_container" class="container complaints-container hide-completely"> <div id="pay_cashier_complaints_container" class="complaints-container hide-completely">
<h4>No pay through cashier complaints.</h4> <h4>No pay through cashier complaints.</h4>
</div> </div>
</section> </section>
@ -813,19 +817,10 @@
}, },
depositActivity(vectorClock, txid, amount) { depositActivity(vectorClock, txid, amount) {
let card = document.createElement('div'), let card = document.createElement('div'),
time = 0; time = parseInt(vectorClock.split('_')[0])
time = new Date(parseInt(vectorClock.split('_')[0]))
card.classList.add('request') card.classList.add('request')
let timeFrag = time.toString().split(' '),
day = timeFrag[0],
month = timeFrag[1],
date = timeFrag[2],
year = timeFrag[3],
hours = timeFrag[4].slice(0, timeFrag[4].lastIndexOf(':')),
finalTime = '';
parseInt(hours.split(':')[0]) > 12 ? finalTime = 'PM' : finalTime = 'AM'
setAttributes(card, { 'data-vector-clock': vectorClock, 'data-type': 'deposit' }) setAttributes(card, { 'data-vector-clock': vectorClock, 'data-type': 'deposit' })
card.innerHTML = ` <h5 class="time">${hours} ${finalTime} ${day} ${date} ${month} ${year}</h5> card.innerHTML = ` <h5 class="time">${formatedTime(time)}</h5>
<h5>UPI Transanction ID</h5> <h5>UPI Transanction ID</h5>
<div class="copy-row"> <div class="copy-row">
<h4 class="copy">${txid}</h4> <h4 class="copy">${txid}</h4>
@ -846,19 +841,11 @@
}, },
withdrawActivity(vectorClock, txid, upi, amount) { withdrawActivity(vectorClock, txid, upi, amount) {
let card = document.createElement('div'), let card = document.createElement('div'),
time = 0; time = parseInt(vectorClock.split('_')[0])
time = new Date(parseInt(vectorClock.split('_')[0]))
card.classList.add('request') card.classList.add('request')
let timeFrag = time.toString().split(' '), let timeFrag = time.toString().split(' ');
day = timeFrag[0],
month = timeFrag[1],
date = timeFrag[2],
year = timeFrag[3],
hours = timeFrag[4].slice(0, timeFrag[4].lastIndexOf(':')),
finalTime = '';
parseInt(hours.split(':')[0]) > 12 ? finalTime = 'PM' : finalTime = 'AM'
setAttributes(card, { 'data-vector-clock': vectorClock, 'data-type': 'withdraw' }) setAttributes(card, { 'data-vector-clock': vectorClock, 'data-type': 'withdraw' })
card.innerHTML = ` <h5 class="time">${hours} ${finalTime} ${day} ${date} ${month} ${year}</h5> card.innerHTML = ` <h5 class="time">${formatedTime(time)}</h5>
<h5>Transanction ID</h5> <h5>Transanction ID</h5>
<div class="copy-row"> <div class="copy-row">
<h4 class="copy">${txid}</h4> <h4 class="copy">${txid}</h4>
@ -879,19 +866,12 @@
</div>`; </div>`;
return card; return card;
}, },
paymentRequest(time, senderAddress, amount, pay_req_id) { paymentRequest(time, senderAddress, amount, id) {
let card = document.createElement('div') let card = document.createElement('div')
card.classList.add('request') card.classList.add('request')
let timeFrag = new Date(time).toString().split(' '),
day = timeFrag[0], setAttributes(card, { 'data-sender-address': senderAddress, 'data-amount': amount, 'data-payment-request-id': id })
month = timeFrag[1], card.innerHTML = ` <h5 class="time">${formatedTime(time)}</h5>
date = timeFrag[2],
year = timeFrag[3],
hours = timeFrag[4].slice(0, timeFrag[4].lastIndexOf(':')),
finalTime = '';
parseInt(hours.split(':')[0]) > 12 ? finalTime = 'PM' : finalTime = 'AM'
setAttributes(card, { 'data-sender-address': senderAddress, 'data-amount': amount })
card.innerHTML = ` <h5 class="time">${hours} ${finalTime} ${day} ${date} ${month} ${year}</h5>
<h5>Request by</h5> <h5>Request by</h5>
<div class="copy-row"> <div class="copy-row">
<h4 class="copy">${senderAddress}</h4> <h4 class="copy">${senderAddress}</h4>
@ -904,7 +884,7 @@
<h5 class="label">amount</h5> <h5 class="label">amount</h5>
<h4>₹ ${amount}</h4> <h4>₹ ${amount}</h4>
<div class="flex"> <div class="flex">
<button class="decline-request secondary-btn" onclick="payment_request_status('${pay_req_id}', 'DECLINED')"> <button class="decline-request secondary-btn">
decline decline
</button> </button>
<button class="send-rupee"> <button class="send-rupee">
@ -919,6 +899,109 @@
card.innerHTML = `<p>${message}</p>`; card.innerHTML = `<p>${message}</p>`;
return card; return card;
}, },
depositComplaint(userData, cashierData, udc) {
let card = document.createElement('div'),
{ depositedAmount, customMsg, sender, vectorClock } = userData,
composition = ``;
card.classList.add('request', 'complaint')
setAttributes(card, {'data-type': 'deposit','data-udc': JSON.stringify(udc)})
composition = `
<div class="left">
<h5>Sender</h5>
<div class="copy-row">
<h4 class="copy">${sender}</h4>
<svg class="icon" onclick="copyToClipboard(this.parentNode)" viewBox="0 0 64 64">
<title>Copy</title>
<rect x="16" y="16" width="48" height="48" rx="6" />
<path d="M.5,47.52V6.5a6,6,0,0,1,6-6h41" />
</svg>
</div>`
if (customMsg && customMsg !== '')
composition += ` <h5>Issue description</h5>
<h4>${customMsg}</h4>`
composition += ` <h5>Deposited</h5>
<h4>₹${depositedAmount}</h4>
<h5>Deposited on</h5>
<h4>${formatedTime(vectorClock.split('_')[0])}</h4>
</div>`
if (cashierData.processed) {
let { time, floTxId } = cashierData
composition += `
<div class="right">
<h4 class="processed">Cashier processed the request on ${formatedTime(time)}</h4>
</div>`;
}
else {
composition += `
<div class="right">
<h4 class="unprocessed">Cashier hasn't processed the request</h4>
</div>`;
}
composition += `
<div class="complaint-actions flex">
<button class="mark-resolved">
<svg class="icon" viewBox="0 0 64 64">
<polyline points="0.35 31.82 21.45 52.98 63.65 10.66"/>
</svg>
Mark as Resolved
</button>
</div>`
card.innerHTML = composition;
return card;
},
withdrawComplaint(userData, cashierData, udc) {
let card = document.createElement('div'),
{ withdrawnAmount, customMsg, sender, vectorClock } = userData,
composition = ``;
card.classList.add('request', 'complaint')
setAttributes(card, { 'data-type': 'withdraw', 'data-udc': JSON.stringify(udc) })
composition = `
<div class="left">
<h5>Sender</h5>
<div class="copy-row">
<h4 class="copy">${sender}</h4>
<svg class="icon" onclick="copyToClipboard(this.parentNode)" viewBox="0 0 64 64">
<title>Copy</title>
<rect x="16" y="16" width="48" height="48" rx="6" />
<path d="M.5,47.52V6.5a6,6,0,0,1,6-6h41" />
</svg>
</div>`
if (customMsg && customMsg !== '')
composition += ` <h5>Issue description</h5>
<h4>${customMsg}</h4>`
composition += ` <h5>withdrawn</h5>
<h4>₹${withdrawnAmount}</h4>
<h5>Withdrawn on</h5>
<h4>${formatedTime(vectorClock.split('_')[0])}</h4>
</div>`
if (cashierData.processed) {
let { time, floTxId } = cashierData
composition += `
<div class="right">
<h4 class="processed">Cashier processed the request on ${formatedTime(time)}</h4>
</div>`;
}
else {
composition += `
<div class="right">
<h4 class="unprocessed">Cashier hasn't processed the request</h4>
</div>`;
}
composition += `
<div class="complaint-actions flex">
<button class="mark-resolved">
<svg class="icon" viewBox="0 0 64 64">
<polyline points="0.35 31.82 21.45 52.98 63.65 10.66"/>
</svg>
Mark as Resolved
</button>
</div>`
card.innerHTML = composition;
return card;
},
} }
//Checks for internet connection status //Checks for internet connection status
@ -973,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');
@ -984,13 +1067,16 @@
thisPopup.parentNode.setAttribute('style', `z-index: ${zIndex}`) thisPopup.parentNode.setAttribute('style', `z-index: ${zIndex}`)
}, 400) }, 400)
if (popup === 'main_loader' || popup === 'sign_in_popup') { if (popup === 'main_loader' || popup === 'sign_in_popup') {
//loader.classList.remove('animate-loader') loader.classList.remove('animate-loader')
document.querySelector('main').classList.remove('hide-completely') document.querySelector('main').classList.remove('hide-completely')
} }
if (popup === 'prompt') { if (popup === 'prompt') {
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 => {
@ -1054,7 +1140,7 @@
} }
// displays a popup for asking permission. Use this instead of JS confirm // displays a popup for asking permission. Use this instead of JS confirm
let askConfirmation = function (message) { let confirmation = function (message) {
return new Promise(resolve => { return new Promise(resolve => {
let popup = document.getElementById('confirmation'); let popup = document.getElementById('confirmation');
showPopup('confirmation') showPopup('confirmation')
@ -1097,6 +1183,18 @@
}) })
} }
function formatedTime(time) {
let timeFrag = new Date(parseInt(time)).toString().split(' '),
day = timeFrag[0],
month = timeFrag[1],
date = timeFrag[2],
year = timeFrag[3],
hours = timeFrag[4].slice(0, timeFrag[4].lastIndexOf(':')),
finalTime = '';
parseInt(hours.split(':')[0]) > 12 ? finalTime = 'PM' : finalTime = 'AM'
return `${hours} ${finalTime} ${day} ${date} ${month} ${year}`
}
function copyToClipboard(parent) { function copyToClipboard(parent) {
let toast = document.getElementById('textCopied'), let toast = document.getElementById('textCopied'),
textToCopy = parent.querySelector('.copy').textContent; textToCopy = parent.querySelector('.copy').textContent;
@ -1140,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)
@ -1174,7 +1274,7 @@
// Function for confirming deposit requests // Function for confirming deposit requests
document.getElementById('pending_deposits_container').addEventListener('click', async (e) => { document.getElementById('pending_deposits_container').addEventListener('click', async (e) => {
if (e.target.closest('.confirm-deposit-btn')) if (e.target.closest('.confirm-deposit-btn'))
if(await askConfirmation('Confirm this deposit request?')){ if (await confirmation('Confirm this deposit request?')) {
let depositRequest = e.target.closest('.request'), let depositRequest = e.target.closest('.request'),
status = await transfer_token(depositRequest.dataset.userFloId, depositRequest.dataset.txid) status = await transfer_token(depositRequest.dataset.userFloId, depositRequest.dataset.txid)
if (status) { if (status) {
@ -1187,7 +1287,7 @@
// Function for confirming withdraw requests // Function for confirming withdraw requests
document.getElementById('pending_withdrawals_container').addEventListener('click', async (e) => { document.getElementById('pending_withdrawals_container').addEventListener('click', async (e) => {
if (e.target.closest('.confirm-withdraw-btn')) if (e.target.closest('.confirm-withdraw-btn'))
if(await askConfirmation('Confirm this withdraw request?')) { if (await confirmation('Confirm this withdraw request?')) {
let withdrawRequest = e.target.closest('.request'), let withdrawRequest = e.target.closest('.request'),
status = await cash_sent(withdrawRequest.dataset.txid, withdrawRequest.dataset.userFloId, withdrawRequest.dataset.upi) status = await cash_sent(withdrawRequest.dataset.txid, withdrawRequest.dataset.userFloId, withdrawRequest.dataset.upi)
if (status) { if (status) {
@ -1199,7 +1299,7 @@
// Function for confirming pay requests // Function for confirming pay requests
document.getElementById('pay_requests_container').addEventListener('click', async (e) => { document.getElementById('pay_requests_container').addEventListener('click', async (e) => {
if (e.target.closest('.confirm-pay-btn')) if (e.target.closest('.confirm-pay-btn'))
if(await askConfirmation('Confirm this pay request?')){ if (await confirmation('Confirm this pay request?')) {
let payRequest = e.target.closest('.request'), let payRequest = e.target.closest('.request'),
status = await pay_through_cashier(payRequest.dataset.sender, payRequest.dataset.receiverFloId, payRequest.dataset.txid, payRequest.dataset.amount) status = await pay_through_cashier(payRequest.dataset.sender, payRequest.dataset.receiverFloId, payRequest.dataset.txid, payRequest.dataset.amount)
if (status) { if (status) {
@ -1218,7 +1318,7 @@
// Function for reporting complain // Function for reporting complain
document.getElementById('report_btn').addEventListener('click', async (e) => { document.getElementById('report_btn').addEventListener('click', async (e) => {
let customMsg = document.getElementById('complaint_field').value let customMsg = document.getElementById('complaint_field').value
if(await askConfirmation('It may take upto 12hrs to complete your request, are you sure to report this issue?')){ if (await confirmation('It may take upto 12hrs to complete your request, are you sure to report this issue?')) {
file_complaint(currentRequest.dataset.type, currentRequest.dataset.vectorClock, customMsg) file_complaint(currentRequest.dataset.type, currentRequest.dataset.vectorClock, customMsg)
} }
}) })
@ -1230,18 +1330,29 @@
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', (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,
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;
} }
if (e.target.closest('.decline-request')) { if (e.target.closest('.decline-request')) {
let parent = e.target.closest('.request'),
paymentRequestId = parent.dataset.paymentRequestId;
if(await confirmation(`Do want to decline this request? This will remove the request.`)){
payment_request_status(paymentRequestId, 'DECLINED')
e.target.closest('.request').remove() e.target.closest('.request').remove()
} }
}
}) })
document.getElementById('activity_type').addEventListener('change', function (e) { document.getElementById('activity_type').addEventListener('change', function (e) {
showActivities(this.value) showActivities(this.value)
@ -1249,13 +1360,23 @@
document.getElementById('complaint_type').addEventListener('change', function (e) { document.getElementById('complaint_type').addEventListener('change', function (e) {
showComplaints(this.value) showComplaints(this.value)
}) })
document.getElementById('select_cashier').addEventListener('change', function (e) { document.getElementById('select_cashier').addEventListener('change', async function (e) {
console.log(this.value) await Promise.all([load_deposit_complaints(this.value), load_withdraw_complaints(this.value)])
load_deposit_complaints(this.value)
//load_withdraw_complaints(this.value)
//load_pay_thru_cashier_complaints(this.value) //load_pay_thru_cashier_complaints(this.value)
}) })
document.getElementById('helpline_page').addEventListener('click', async e => {
if(e.target.closest('.mark-resolved')){
let complaint = e.target.closest('.complaint'),
udc = complaint.dataset.udc,
type = complaint.dataset.type;
if(await confirmation('Mark this complaint as resolved?')){
mark_complaint_resolved(type, JSON.parse(udc))
complaint.remove()
}
}
})
}) })
let allActivities = document.querySelectorAll('.activity-container') let allActivities = document.querySelectorAll('.activity-container')
@ -1314,15 +1435,15 @@
hidePopup() hidePopup()
showPopup('sign_in_popup', 'no') showPopup('sign_in_popup', 'no')
let signInBtn = document.getElementById('sign_in_btn'), let signInBtn = document.getElementById('sign_in_btn'),
privKeyInput = document.getElementById('get_priv_key_field') privateKeyInput = document.getElementById('get_priv_key_field')
signInBtn.onclick = () => { signInBtn.onclick = () => {
resolve(privKeyInput.value) resolve(privateKeyInput.value)
} }
}) })
} }
async function signOut() { async function signOut() {
if(await askConfirmation('Do you want to sign out?')){ if (await confirmation('Do you want to sign out?')) {
document.querySelector('main').classList.add('hide-completely') document.querySelector('main').classList.add('hide-completely')
floDapps.clearCredentials() floDapps.clearCredentials()
compactIDB.deleteDB().then((message) => { compactIDB.deleteDB().then((message) => {
@ -1365,33 +1486,49 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
cursor: pointer; cursor: pointer;
width: 100%;
}
.option-text{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
.selection{ .selection{
border-radius: 0.2rem; border-radius: 0.2rem;
display: flex; display: flex;
padding: 0.6rem 0.8rem; padding: 0.4rem 0.7rem;
background: rgba(var(--text), 0.1); background: rgba(var(--text), 0.1);
align-items: center; align-items: center;
justify-content: space-between;
outline: none;
} }
.icon{ .icon{
margin-left: 1rem; margin-left: 1rem;
} }
.options{ .options{
overflow: hidden auto;
margin-top: 0.5rem;
position: absolute; position: absolute;
grid-area: options; grid-area: options;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
top: 100%; top: 100%;
right: 0; right: 0;
width: 100%; min-width: 100%;
transform: translateY(-0.5rem);
padding: 0.5rem 0;
background: rgba(var(--foreground), 1); background: rgba(var(--foreground), 1);
transition: opacity 0.3s; transition: opacity 0.3s, transform 0.3s;
box-shadow: 0 0.2rem 1rem #00000040; border: solid 1px rgba(var(--text), 0.2);
border-radius: 0 0 0.2rem 0.2rem; border-radius: 0.2rem;
z-index: 2;
} }
.rotate{ .rotate{
transform: rotate(-180deg) transform: rotate(-180deg)
} }
.no-transformations{
transform: none;
}
</style> </style>
<div class="sm-select"> <div class="sm-select">
<div class="selection" tabindex="0"> <div class="selection" tabindex="0">
@ -1426,6 +1563,7 @@
this.addEventListener('click', e => { this.addEventListener('click', e => {
chevron.classList.toggle('rotate') chevron.classList.toggle('rotate')
optionList.classList.toggle('hide') optionList.classList.toggle('hide')
optionList.classList.toggle('no-transformations')
}) })
this.addEventListener('optionSelected', e => { this.addEventListener('optionSelected', e => {
if (currentOption !== e.detail.value) { if (currentOption !== e.detail.value) {
@ -1448,6 +1586,7 @@
if (!this.contains(e.target)) { if (!this.contains(e.target)) {
chevron.classList.remove('rotate') chevron.classList.remove('rotate')
optionList.classList.add('hide') optionList.classList.add('hide')
optionList.classList.remove('no-transformations')
} }
}) })
} }
@ -1469,6 +1608,8 @@
width: 100%; width: 100%;
padding: 0.6rem 0.8rem; padding: 0.6rem 0.8rem;
cursor: pointer; cursor: pointer;
overflow-wrap: break-word;
outline: none;
} }
.sm-option:hover{ .sm-option:hover{
background: rgba(var(--text), 0.1); background: rgba(var(--text), 0.1);
@ -10917,9 +11058,7 @@
for (cashier in token_app.master_configurations.cashiers) for (cashier in token_app.master_configurations.cashiers)
cashierList += `<sm-option value = "${cashier}">${cashier}</sm-option>` cashierList += `<sm-option value = "${cashier}">${cashier}</sm-option>`
cashierSelect.innerHTML = cashierList; cashierSelect.innerHTML = cashierList;
console.log(cashierSelect.value) await Promise.all([load_deposit_complaints(cashierSelect.value), load_withdraw_complaints(cashierSelect.value)])
load_deposit_complaints(cashierSelect.value)
//load_withdraw_complaints(cashierSelect.value)
//load_pay_thru_cashier_complaints(cashierSelect.value) //load_pay_thru_cashier_complaints(cashierSelect.value)
userType.textContent = 'Helpline' userType.textContent = 'Helpline'
showPage(document.getElementById('helpline_page_btn'), 'helpline_page') showPage(document.getElementById('helpline_page_btn'), 'helpline_page')
@ -10952,28 +11091,31 @@
floCloudAPI.requestObjectData(floGlobals.application, { receiverID, senderIDs }); floCloudAPI.requestObjectData(floGlobals.application, { receiverID, senderIDs });
if (Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) { if (Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) {
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_DEPOSITS await Promise.all([floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_DEPOSITS
, { receiverID: myFloID }); , { receiverID: myFloID }),
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_WITHDRAWS floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_WITHDRAWS
, { receiverID: myFloID }); , { receiverID: myFloID }),
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_MSGES floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_MSGES
, { receiverID: myFloID }) , { receiverID: myFloID }),
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PAY_THROUGH_CASHIER, floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PAY_THROUGH_CASHIER,
{ receiverID: myFloID }); { receiverID: myFloID })
])
return true; return true;
} else if (token_app.master_configurations.helplineFloId === myFloID) { } else if (token_app.master_configurations.helplineFloId === myFloID) {
await clearCashierData(); await clearCashierData();
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_FILE_DEPOSITS_COMPLAINT); await Promise.all([
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_FILE_PAY_THROUGH_CASHIER_COMPLAINT); floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_FILE_DEPOSITS_COMPLAINT),
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_FILE_WITHDRAWS_COMPLAINT); floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_FILE_PAY_THROUGH_CASHIER_COMPLAINT),
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PROCESSED_DEPOSITS_COMPLAINT); floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_FILE_WITHDRAWS_COMPLAINT),
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PROCESSED_PAY_THROUGH_CASHIER_COMPLAINT); floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PROCESSED_DEPOSITS_COMPLAINT),
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PROCESSED_WITHDRAWS_COMPLAINT); floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PROCESSED_PAY_THROUGH_CASHIER_COMPLAINT),
floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PROCESSED_WITHDRAWS_COMPLAINT)
])
return true; return true;
} else { } else {
@ -11197,17 +11339,15 @@
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 () {
console.log('hi')
const token_sender = myFloID; const token_sender = myFloID;
const token_receiver = document.getElementById('token_receiver').value; const token_receiver = document.getElementById('token_receiver').value;
const send_tokens_btn = document.getElementById('send_tokens_btn');
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 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 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); const sender_token_balance = await ajaxGet(token_balance_url);
@ -11216,23 +11356,25 @@
if (typeof sender_token_balance !== "object" if (typeof sender_token_balance !== "object"
|| typeof sender_token_balance.balance !== "number" || typeof sender_token_balance.balance !== "number"
|| sender_token_balance.balance < token_amount) { || sender_token_balance.balance < token_amount) {
err_msg = `INFO: Sender has insufficient ${token_name_radio} balance.`; err_msg = `Sender has insufficient ${token_name_radio} balance.`;
notify(err_msg); notify(err_msg, 'error');
return false; return false;
} }
let flo_txid = await floBlockchainAPI.sendTx(myFloID, token_receiver, 0.001, myPrivKey, flo_comment) let flo_txid = await floBlockchainAPI.sendTx(myFloID, token_receiver, 0.001, myPrivKey, flo_comment)
console.log(flo_txid); console.log(flo_txid);
if (typeof flo_txid !== "string") { if (typeof flo_txid !== "string") {
notify(`Transaction unsuccessfull.`); notify(`Transaction unsuccessful.`);
return false; return false;
} else { } else {
notify(`Transaction successfull: ${flo_txid}.`, '', 'fixed', true); notify(`Transaction successful: ${flo_txid}.`, '', 'fixed', true);
return false; if(payingRequested){
payment_request_status(currentPaymentRequest.requestId, 'APPROVED')
showPayRequests()
}
return true;
} }
})
} }
} catch (error) { } catch (error) {
throw new Error(error); throw new Error(error);
} }
@ -11507,27 +11649,28 @@
const withdraw_msg = floDapps.getNextGeneralData(token_app.master_configurations.TYPE_WITHDRAWS, "0").reverse(); const withdraw_msg = floDapps.getNextGeneralData(token_app.master_configurations.TYPE_WITHDRAWS, "0").reverse();
const user_msg = floDapps.getNextGeneralData(token_app.master_configurations.TYPE_MSGES, "0").reverse(); const user_msg = floDapps.getNextGeneralData(token_app.master_configurations.TYPE_MSGES, "0").reverse();
console.log(deposit_msg, withdraw_msg, user_msg)
depositActivityContainer.innerHTML = ``;
for (usr_deposits of deposit_msg) { for (usr_deposits of deposit_msg) {
let { upi_txid, deposit_amount } = usr_deposits.message; let { upi_txid, deposit_amount } = usr_deposits.message;
frag.append(render.depositActivity(usr_deposits.vectorClock, upi_txid, deposit_amount)) frag.append(render.depositActivity(usr_deposits.vectorClock, upi_txid, deposit_amount))
} }
if (frag.children.length)
depositActivityContainer.innerHTML = ``;
depositActivityContainer.append(frag) depositActivityContainer.append(frag)
withdrawActivityContainer.innerHTML = ``;
for (usr_withdraws of withdraw_msg) { for (usr_withdraws of withdraw_msg) {
let { token_txid, withdrawer_upi, withdraw_amount } = usr_withdraws.message; let { token_txid, withdrawer_upi, withdraw_amount } = usr_withdraws.message;
frag.append(render.withdrawActivity(usr_withdraws.vectorClock, token_txid, withdrawer_upi, withdraw_amount)) frag.append(render.withdrawActivity(usr_withdraws.vectorClock, token_txid, withdrawer_upi, withdraw_amount))
} }
if (frag.children.length)
withdrawActivityContainer.innerHTML = ``;
withdrawActivityContainer.append(frag) withdrawActivityContainer.append(frag)
cashierMessageContainer.innerHTML = ``;
for (msg of user_msg) { for (msg of user_msg) {
frag.append(render.cashierMessage(msg)) frag.append(render.cashierMessage(msg))
} }
if (frag.children.length)
cashierMessageContainer.innerHTML = ``;
cashierMessageContainer.append(frag) cashierMessageContainer.append(frag)
} catch (e) { } catch (e) {
notify(e, 'error'); notify(e, 'error');
@ -11537,7 +11680,7 @@
async function file_complaint(order_type = '', order_vc = '', custom_msg = '') { async function file_complaint(order_type = '', order_vc = '', custom_msg = '') {
try { try {
let input_data = { let input_data = {
order_type, order_vc, custom_msg order_type, order_vc, custom_msg,
} }
console.log(input_data); console.log(input_data);
@ -11596,16 +11739,17 @@
async function show_payment_requests() { async function show_payment_requests() {
try { try {
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_REQUEST_PAYMENT, await Promise.all([
{ receiverID: myFloID }); floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_REQUEST_PAYMENT,
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_REQUEST_PAYMENT_DECLINED, { receiverID: myFloID }),
{ receiverID: myFloID }); floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_REQUEST_PAYMENT_DECLINED,
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_REQUEST_PAYMENT_APPROVED, { receiverID: myFloID }),
{ receiverID: myFloID }); floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_REQUEST_PAYMENT_APPROVED,
{ receiverID: myFloID })
const general_msg = floDapps.getNextGeneralData(token_app.master_configurations.TYPE_REQUEST_PAYMENT, "0").reverse(); ])
const declined_reqs_list = floDapps.getNextGeneralData(token_app.master_configurations.TYPE_REQUEST_PAYMENT_DECLINED, "0").reverse(); const general_msg = floDapps.getNextGeneralData(token_app.master_configurations.TYPE_REQUEST_PAYMENT, "0").reverse(),
const approved_reqs_list = floDapps.getNextGeneralData(token_app.master_configurations.TYPE_REQUEST_PAYMENT_APPROVED, "0").reverse(); declined_reqs_list = floDapps.getNextGeneralData(token_app.master_configurations.TYPE_REQUEST_PAYMENT_DECLINED, "0").reverse(),
approved_reqs_list = floDapps.getNextGeneralData(token_app.master_configurations.TYPE_REQUEST_PAYMENT_APPROVED, "0").reverse();
console.log(general_msg); console.log(general_msg);
console.log(approved_reqs_list); console.log(approved_reqs_list);
@ -11626,18 +11770,17 @@
paymentRequestContainer.append(frag) paymentRequestContainer.append(frag)
} catch (e) { } catch (e) {
console.error(e); console.error(e);
return false; return false
} }
} }
function payment_request_status(req_id = '', status = '') { function payment_request_status(req_id = '', status = '') {
try { try {
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;
@ -11651,7 +11794,6 @@
console.log(e); console.log(e);
} }
} }
</script> </script>
<!-- Helpline --> <!-- Helpline -->
@ -11662,10 +11804,12 @@
await clearCashierData(); await clearCashierData();
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_DEPOSITS, await Promise.all([
{ receiverID: receiver }); floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_DEPOSITS,
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PROCESSED_DEPOSITS, { receiverID: receiver }),
{ receiverID: receiver }); floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PROCESSED_DEPOSITS,
{ receiverID: receiver })
])
let options = { let options = {
type: token_app.master_configurations.TYPE_FILE_DEPOSITS_COMPLAINT, type: token_app.master_configurations.TYPE_FILE_DEPOSITS_COMPLAINT,
@ -11688,25 +11832,57 @@
// filter out processed tasks from unprocessed ones // filter out processed tasks from unprocessed ones
const unprocessed_deposits_complaints = Object.values(all_deposits_complaints) const unprocessed_deposits_complaints = Object.values(all_deposits_complaints)
.filter(orders_comparer(Object.values(processed_deposits_complaints))); .filter(orders_comparer(Object.values(processed_deposits_complaints))).reverse();
// Show details of unprocessed ones // Show details of unprocessed ones
//console.log(unprocessed_deposits_complaints); console.log(unprocessed_deposits_complaints);
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");
let this_user_deposit = all_users_deposits.filter(f => f.vectorClock === udc.message.order_vc); let this_user_deposit = all_users_deposits.filter(f => f.vectorClock === udc.message.order_vc);
console.log(this_user_deposit);
console.log(udc)
let this_user_deposit_upi_txid_list = this_user_deposit.map(m => m.message.upi_txid); let this_user_deposit_upi_txid_list = this_user_deposit.map(m => m.message.upi_txid);
let userData = {}, cashierData = {};
let all_cashier_processed_deposits = floDapps let all_cashier_processed_deposits = floDapps
.getNextGeneralData(token_app.master_configurations.TYPE_PROCESSED_DEPOSITS, "0"); .getNextGeneralData(token_app.master_configurations.TYPE_PROCESSED_DEPOSITS, "0");
console.log(udc)
let this_cashier_processed_user_deposit = all_cashier_processed_deposits let this_cashier_processed_user_deposit = all_cashier_processed_deposits
.filter(f => this_user_deposit_upi_txid_list.includes(f.message.user_upi_txid)); .filter(f => this_user_deposit_upi_txid_list.includes(f.message.user_upi_txid));
console.log(this_cashier_processed_user_deposit); if (this_user_deposit.length) {
let { deposit_amount, upi_txid, user_flo_id } = this_user_deposit[0].message;
userData = {
depositedAmount: deposit_amount,
upiTxId: upi_txid,
sender: user_flo_id,
vectorClock: this_user_deposit[0].vectorClock,
customMsg: udc.message.custom_msg
} }
}
if (this_cashier_processed_user_deposit.length) {
let { datetime, flo_txid } = this_cashier_processed_user_deposit[0].message;
cashierData = {
processed: true,
time: datetime,
floTxId: flo_txid
}
}
else {
cashierData = {
processed: false
}
}
if (this_user_deposit.length){
frag.append(render.depositComplaint(userData, cashierData, udc))
}
}
let container = document.getElementById('deposit_complaints_container');
container.innerHTML = ``
if (frag.children.length)
container.append(frag)
else
container.innerHTML = `<h4>No complaints available.</h4>`
// Display both this_user_deposit and this_cashier_processed_user_deposit // Display both this_user_deposit and this_cashier_processed_user_deposit
// side by side and attach button to mark resolved // side by side and attach button to mark resolved
@ -11716,7 +11892,6 @@
} catch (e) { } catch (e) {
console.error(e); console.error(e);
notify(e);
} }
} }
@ -11725,10 +11900,10 @@
await clearCashierData(); await clearCashierData();
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_WITHDRAWS, await Promise.all([floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_WITHDRAWS,
{ receiverID: receiver }); { receiverID: receiver }),
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PROCESSED_WITHDRAWS, floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PROCESSED_WITHDRAWS,
{ receiverID: receiver }); { receiverID: receiver })])
let options = { let options = {
type: token_app.master_configurations.TYPE_FILE_WITHDRAWS_COMPLAINT, type: token_app.master_configurations.TYPE_FILE_WITHDRAWS_COMPLAINT,
@ -11763,7 +11938,40 @@
let this_cashier_processed_user_withdraws = all_cashier_processed_withdraws let this_cashier_processed_user_withdraws = all_cashier_processed_withdraws
.filter(f => this_user_withdraws_token_txid_list.includes(f.message.token_txid)); .filter(f => this_user_withdraws_token_txid_list.includes(f.message.token_txid));
console.log(this_cashier_processed_user_withdraws); console.log(this_cashier_processed_user_withdraws);
if (this_user_withdraws.length) {
let { withdraw_amount, upi_txid, user_flo_id } = this_user_withdraws[0].message;
userData = {
withdrawnAmount: withdraw_amount,
upiTxId: upi_txid,
sender: user_flo_id,
vectorClock: this_user_withdraws[0].vectorClock,
customMsg: udc.message.custom_msg
} }
}
if (this_cashier_processed_user_withdraws.length) {
let { datetime, flo_txid } = this_cashier_processed_user_withdraws[0].message;
cashierData = {
processed: true,
time: datetime,
floTxId: flo_txid
}
}
else {
cashierData = {
processed: false
}
}
if (this_user_withdraws.length)
frag.append(render.withdrawComplaint(userData, cashierData, udc))
}
let container = document.getElementById('withdraw_complaints_container');
container.innerHTML = ``
if (frag.children.length)
container.append(frag)
else
container.innerHTML = `<h4>No complaints available.</h4>`
// Display both this_user_withdraws and this_cashier_processed_user_withdraws // Display both this_user_withdraws and this_cashier_processed_user_withdraws
// side by side and attach button to mark resolved // side by side and attach button to mark resolved
@ -11782,10 +11990,10 @@
await clearCashierData(); await clearCashierData();
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PAY_THROUGH_CASHIER, await Promise.all([floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PAY_THROUGH_CASHIER,
{ receiverID: receiver }); { receiverID: receiver }),
await floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PROCESSED_PAY_THROUGH_CASHIER, floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PROCESSED_PAY_THROUGH_CASHIER,
{ receiverID: receiver }); { receiverID: receiver })])
let options = { let options = {
type: token_app.master_configurations.TYPE_FILE_PAY_THROUGH_CASHIER_COMPLAINT, type: token_app.master_configurations.TYPE_FILE_PAY_THROUGH_CASHIER_COMPLAINT,
@ -11840,7 +12048,7 @@
complaint_type = token_app.master_configurations.TYPE_PROCESSED_PAY_THROUGH_CASHIER_COMPLAINT; complaint_type = token_app.master_configurations.TYPE_PROCESSED_PAY_THROUGH_CASHIER_COMPLAINT;
} else return false; } else return false;
floCloudAPI.sendGeneralData(input_data, complaint_type, floCloudAPI.sendGeneralData(input_data.message, complaint_type,
{ receiverID: token_app.master_configurations.helplineFloId }); { receiverID: token_app.master_configurations.helplineFloId });
notify('Complaint marked as resolved.'); notify('Complaint marked as resolved.');