This commit is contained in:
sairaj mote 2020-09-15 04:25:48 +05:30
parent 267372cff1
commit ec6fd0ba5a
5 changed files with 893 additions and 558 deletions

View File

@ -204,6 +204,7 @@ border: none;
.input { .input {
display: flex; display: flex;
align-items: center; align-items: center;
text-align: left;
position: relative; position: relative;
gap: 1em; gap: 1em;
padding: 0.7em 1em; padding: 0.7em 1em;
@ -1685,14 +1686,18 @@ background: rgba(0, 0, 0, 0.6);
z-index: 10; z-index: 10;
transition: opacity 0.3s ease; transition: opacity 0.3s ease;
} }
:host(.stacked) .popup{
transform: scale(0.9) translateY(-1rem) !important;
}
.popup{ .popup{
margin-bottom: 0.5rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
position: relative; position: relative;
align-self: flex-end; align-self: flex-end;
align-items: flex-start; align-items: flex-start;
width: 100%; width: calc(100% - 1rem);
border-radius: 0.5rem 0.5rem 0 0; border-radius: 0.8rem;
transform: translateY(100%); transform: translateY(100%);
transition: transform 0.3s; transition: transform 0.3s;
background: rgba(var(--foreground-color), 1); background: rgba(var(--foreground-color), 1);
@ -1709,6 +1714,8 @@ display: flex;
width: 100%; width: 100%;
} }
.popup-body{ .popup-body{
display: flex;
flex-direction: column;
flex: 1; flex: 1;
width: 100%; width: 100%;
padding: 1.5rem; padding: 1.5rem;
@ -1730,6 +1737,7 @@ pointer-events: none;
align-self: center; align-self: center;
border-radius: 0.4rem; border-radius: 0.4rem;
height: auto; height: auto;
transform: translateY(1rem);
box-shadow: 0 3rem 2rem -0.5rem #00000040; box-shadow: 0 3rem 2rem -0.5rem #00000040;
} }
} }
@ -1785,9 +1793,6 @@ customElements.define('sm-popup', class extends HTMLElement {
} }
show(pinned, popupStack) { show(pinned, popupStack) {
setTimeout(() => {
this.allowClosing = true
}, 300);
this.setAttribute('open', '') this.setAttribute('open', '')
this.pinned = pinned this.pinned = pinned
this.popupStack = popupStack this.popupStack = popupStack
@ -1796,29 +1801,21 @@ customElements.define('sm-popup', class extends HTMLElement {
document.body.setAttribute('style', `overflow: hidden; top: -${window.scrollY}px`) document.body.setAttribute('style', `overflow: hidden; top: -${window.scrollY}px`)
} }
hide() { hide() {
if (!this.allowClosing) return
setTimeout(() => {
this.allowClosing = false
}, 300);
this.removeAttribute('open') this.removeAttribute('open')
if (window.innerWidth < 648) { if(window.innerWidth < 640)
this.popup.style.transform = 'translateY(100%)'; this.popup.style.transform = 'translateY(100%)';
else
this.popup.style.transform = 'translateY(1rem)';
this.popupContainer.classList.add('hide')
if (typeof this.popupStack !== 'undefined') {
this.popupStack.pop()
if (this.popupStack.items.length === 0) {
this.resumeScrolling()
}
} }
else { else {
this.popup.style.transform = 'scale(0.9)';
setTimeout(() => {
this.popup.style.transform = 'translateY(100%) scale(1)'
}, 300)
}
this.popupContainer.classList.add('hide')
/*if (typeof this.popupStack !== 'undefined') {
if (this.popupStack.items.length === 1) {
this.resumeScrolling() this.resumeScrolling()
} }
}
else {*/
this.resumeScrolling()
//}
if (this.inputFields.length) { if (this.inputFields.length) {
setTimeout(() => { setTimeout(() => {
@ -1830,7 +1827,14 @@ customElements.define('sm-popup', class extends HTMLElement {
}) })
}, 300); }, 300);
} }
return this; this.dispatchEvent(
new CustomEvent("popupclosed", {
bubbles: true,
detail: {
popup: this
}
})
)
} }
handleTouchStart(e) { handleTouchStart(e) {
@ -2176,6 +2180,7 @@ opacity: 1;
display: flex; display: flex;
opacity: 0; opacity: 0;
padding: 1rem 1.5rem; padding: 1rem 1.5rem;
margin-bottom: 0.5rem;
transform: translateY(-1rem); transform: translateY(-1rem);
position: relative; position: relative;
border-radius: 0.3rem; border-radius: 0.3rem;
@ -2264,7 +2269,7 @@ stroke-width: 6;
transform: translateX(1rem); transform: translateX(1rem);
} }
} }
@media screen and (max-width: 640px){ @media screen and (any-hover: none){
.close{ .close{
display: none display: none
} }

View File

@ -240,7 +240,7 @@ input:invalid {
background: none; background: none;
} }
.action h4 { .action h4 {
padding: 0.5rem 0.8rem; padding: 0.5rem 1.2rem;
font-size: 0.9rem; font-size: 0.9rem;
clip-path: circle(100%); clip-path: circle(100%);
transition: clip-path 0.3s; transition: clip-path 0.3s;
@ -382,10 +382,6 @@ textarea {
background: rgba(var(--foreground-color), 1) !important; background: rgba(var(--foreground-color), 1) !important;
} }
form {
width: 100%;
}
#confirmation, #confirmation,
#prompt { #prompt {
flex-direction: column; flex-direction: column;
@ -419,6 +415,16 @@ form {
margin-bottom: 1em; margin-bottom: 1em;
} }
sm-popup .illustration {
position: relative;
height: 4rem;
width: 4rem;
padding: 1rem;
stroke: var(--accent-color);
margin-bottom: 1rem;
border-radius: 5rem;
background: rgba(var(--text-color), 0.06);
}
sm-popup sm-input:not(:last-of-type) { sm-popup sm-input:not(:last-of-type) {
margin-bottom: 1rem; margin-bottom: 1rem;
} }
@ -444,6 +450,17 @@ sm-popup p {
margin-left: auto; margin-left: auto;
} }
details, summary {
margin-bottom: 1rem;
}
details p {
border-radius: 0.2rem;
padding: 0.5rem 1rem;
background: rgba(var(--text-color), 0.06);
margin-bottom: 0;
}
#sign_in_popup h3 { #sign_in_popup h3 {
margin-top: 2rem; margin-top: 2rem;
} }
@ -931,6 +948,50 @@ sm-panel {
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }
@keyframes popup {
0% {
stroke-dashoffset: 50;
transform: translateY(4rem) scale(0.2, 0.6);
}
40% {
transform: translateY(0) scale(0.2);
}
41% {
transform: translateY(0) scale(0.2);
}
50% {
stroke-dashoffset: 50;
transform: translateY(0) scale(1);
}
100% {
stroke-dashoffset: 0;
}
}
#success_section h4, #failure_section h4 {
text-align: center;
margin-top: 1rem;
}
#success_svg, #failure_svg {
height: 5rem;
width: 5rem;
stroke-width: 4;
align-self: center;
stroke: none;
stroke-dasharray: 50;
fill: rgba(var(--text-color), 0.06);
animation: popup 2s forwards infinite cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#success_svg polyline {
fill: none;
stroke: #00C853;
}
#failure_svg line {
stroke: #EF5350;
}
@media only screen and (max-width: 640px) { @media only screen and (max-width: 640px) {
#home_page, #deposit { #home_page, #deposit {
display: grid; display: grid;

2
css/main.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -241,7 +241,6 @@ input:invalid {
justify-content: center; justify-content: center;
padding: 0; padding: 0;
background: none; background: none;
&[disabled] { &[disabled] {
.primary-btn { .primary-btn {
background: none; background: none;
@ -249,7 +248,7 @@ input:invalid {
} }
h4 { h4 {
padding: 0.5rem 0.8rem; padding: 0.5rem 1.2rem;
font-size: 0.9rem; font-size: 0.9rem;
clip-path: circle(100%); clip-path: circle(100%);
transition: clip-path 0.3s; transition: clip-path 0.3s;
@ -403,10 +402,6 @@ textarea {
background: rgba(var(--foreground-color), 1) !important; background: rgba(var(--foreground-color), 1) !important;
} }
form {
width: 100%;
}
#confirmation, #confirmation,
#prompt { #prompt {
flex-direction: column; flex-direction: column;
@ -441,6 +436,16 @@ form {
} }
sm-popup{ sm-popup{
.illustration{
position: relative;
height: 4rem;
width: 4rem;
padding: 1rem;
stroke: var(--accent-color);
margin-bottom: 1rem;
border-radius: 5rem;
background: rgba(var(--text-color), 0.06);
}
sm-input:not(:last-of-type) { sm-input:not(:last-of-type) {
margin-bottom: 1rem; margin-bottom: 1rem;
} }
@ -467,6 +472,18 @@ sm-popup{
} }
} }
details, summary{
margin-bottom: 1rem;
}
details{
p{
border-radius: 0.2rem;
padding: 0.5rem 1rem;
background: rgba(var(--text-color), 0.06);
margin-bottom: 0;
}
}
#sign_in_popup { #sign_in_popup {
h3 { h3 {
margin-top: 2rem; margin-top: 2rem;
@ -1003,6 +1020,54 @@ sm-panel{
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }
@keyframes popup{
0%{
stroke-dashoffset: 50;
transform: translateY(4rem) scale(0.2, 0.6);
}
40%{
transform: translateY(0) scale(0.2);
}
41%{
transform: translateY(0) scale(0.2);
}
50%{
stroke-dashoffset: 50;
transform: translateY(0) scale(1);
}
100%{
stroke-dashoffset: 0;
}
}
#success_section, #failure_section{
h4{
text-align: center;
margin-top: 1rem;
}
}
#success_svg, #failure_svg{
height: 5rem;
width: 5rem;
stroke-width: 4;
align-self: center;
stroke: none;
stroke-dasharray: 50;
fill: rgba(var(--text-color), 0.06);
animation: popup 2s forwards infinite cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#success_svg{
polyline{
fill: none;
stroke: #00C853 ;
}
}
#failure_svg{
line{
stroke: #EF5350;
}
}
@media only screen and (max-width: 640px) { @media only screen and (max-width: 640px) {
#home_page, #deposit{ #home_page, #deposit{
display: grid; display: grid;

View File

@ -5,7 +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=Poppins:wght@400;500;600;700;800;900&family=Roboto:wght@400;500;700&display=swap" rel="stylesheet"> <link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800;900&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>
@ -51,9 +53,9 @@
Sign In Sign In
</button> </button>
</sm-popup> </sm-popup>
<sm-popup id="cash_transfer"> <sm-popup id="cash_transfer" open>
<header class="popup-header" slot="header"> <header class="popup-header" slot="header">
<svg class="icon" onclick="hidePopup()" viewBox="0 0 64 64"> <svg class="icon" onclick="this.closest('sm-popup').hide()" viewBox="0 0 64 64">
<title>close</title> <title>close</title>
<line x1="64" y1="0" x2="0" y2="64" /> <line x1="64" y1="0" x2="0" y2="64" />
<line x1="64" y1="64" x2="0" y2="0" /> <line x1="64" y1="64" x2="0" y2="0" />
@ -64,21 +66,24 @@
Send Send
</h4> </h4>
<svg viewBox="0 0 73 73" class="loader"> <svg viewBox="0 0 73 73" class="loader">
<path <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" />
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>
</button> </button>
</header> </header>
<svg class="icon illustration" viewBox="0 0 64 64">
<path
d="M47.28,16.8,29.6,34.64a3.3,3.3,0,0,1-3.59.71L2.5,25.42a3.28,3.28,0,0,1,.26-6.13L59.21.87A3.28,3.28,0,0,1,63.32,5l-18.93,56a3.26,3.26,0,0,1-6.12.18l-6.4-15.68" />
</svg>
<p> <p>
Send Rupees to any FLO address.<br> Send rupee to any FLO address.<br>
*Requires Rupee to be deposited first. *Requires Rupee to be deposited first.
</p> </p>
<sm-input floId id="token_receiver" placeholder="Reciever's FLO ID" required animate></sm-input> <sm-input floId id="token_receiver" placeholder="Reciever's FLO ID" required animate></sm-input>
<sm-input id="token_amount" placeholder="mount" type="number" min="1" required animate></sm-input> <sm-input id="token_amount" placeholder="Amount" type="number" min="1" required animate></sm-input>
</sm-popup> </sm-popup>
<sm-popup id="deposit_rupee"> <sm-popup id="deposit_rupee">
<header class="popup-header" slot="header"> <header class="popup-header" slot="header">
<svg class="icon" onclick="hidePopup()" viewBox="0 0 64 64"> <svg class="icon" onclick="this.closest('sm-popup').hide()" viewBox="0 0 64 64">
<title>close</title> <title>close</title>
<line x1="64" y1="0" x2="0" y2="64" /> <line x1="64" y1="0" x2="0" y2="64" />
<line x1="64" y1="64" x2="0" y2="0" /> <line x1="64" y1="64" x2="0" y2="0" />
@ -89,18 +94,28 @@
Continue Continue
</h4> </h4>
<svg viewBox="0 0 73 73" class="loader"> <svg viewBox="0 0 73 73" class="loader">
<path <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" />
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>
</button> </button>
</header> </header>
<svg class="icon illustration" viewBox="0 0 64 64">
<title>deposit</title>
<path d="M29.58,35.76V60.47H5.13A4.63,4.63,0,0,1,.5,55.83V9.63" />
<path d="M59.5,47v8.85a4.63,4.63,0,0,1-4.63,4.64H42.16" />
<path
d="M49.44,3.53H6.09A5.59,5.59,0,0,0,.5,9.12h0a5.59,5.59,0,0,0,5.59,5.59H38.91l14.38,0a6,6,0,0,1,6.21,6V32" />
<path
d="M54.39,32h6.08a3,3,0,0,1,3,3V44a3,3,0,0,1-3,3H54.39a7.49,7.49,0,0,1-7.49-7.49v0A7.49,7.49,0,0,1,54.39,32Z" />
<polyline points="38.61 44.12 29.54 35.05 20.39 44.2" />
</svg>
<sm-button onclick="showPopup('transaction_result')">result</sm-button>
<section id="deposit_amount_section"> <section id="deposit_amount_section">
<p> <p>
Deposit rupee through UPI to use as digital currency powered by FLO blockchain. Deposit rupee through UPI.
</p> </p>
<sm-input id="token_amount_to_buy" placeholder="Amount" type="number" min="1" required animate></sm-input> <sm-input id="token_amount_to_buy" placeholder="Amount" type="number" min="1" required animate></sm-input>
</section> </section>
<section id="upi_txId_section" class="hide-completely top-padding"> <section id="upi_txId_section" class="hide-completely">
<p id="send_amount_to_deposit"></p> <p id="send_amount_to_deposit"></p>
<div class="copy-row"> <div class="copy-row">
<h4 id="send_cash_to_deposit" class="copy"></h4> <h4 id="send_cash_to_deposit" class="copy"></h4>
@ -110,12 +125,13 @@
<path d="M.5,47.52V6.5a6,6,0,0,1,6-6h41" /> <path d="M.5,47.52V6.5a6,6,0,0,1,6-6h41" />
</svg> </svg>
</div> </div>
<sm-input id="deposited_rupee_txid" placeholder="UPI Transaction ID" pattern="^[a-zA-z0-9]+" disabled required animate></sm-input> <sm-input id="deposited_rupee_txid" placeholder="UPI Transaction ID" pattern="^[a-zA-z0-9]+" disabled
required animate></sm-input>
</section> </section>
</sm-popup> </sm-popup>
<sm-popup id="withdraw_rupee"> <sm-popup id="withdraw_rupee">
<header class="popup-header" slot="header"> <header class="popup-header" slot="header">
<svg class="icon" onclick="hidePopup()" viewBox="0 0 64 64"> <svg class="icon" onclick="this.closest('sm-popup').hide()" viewBox="0 0 64 64">
<title>close</title> <title>close</title>
<line x1="64" y1="0" x2="0" y2="64" /> <line x1="64" y1="0" x2="0" y2="64" />
<line x1="64" y1="64" x2="0" y2="0" /> <line x1="64" y1="64" x2="0" y2="0" />
@ -126,20 +142,31 @@
withdraw withdraw
</h4> </h4>
<svg viewBox="0 0 73 73" class="loader"> <svg viewBox="0 0 73 73" class="loader">
<path <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" />
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>
</button> </button>
</header> </header>
<svg class="icon illustration" viewBox="0 0 64 64">
<title>withdraw</title>
<path d="M15.18,60.47h-10A4.63,4.63,0,0,1,.5,55.83V9.63" />
<line x1="29.42" y1="59.04" x2="29.42" y2="34.34" />
<path d="M59.5,47v8.85a4.63,4.63,0,0,1-4.63,4.64H43.62" />
<path
d="M49.44,3.53H6.09A5.59,5.59,0,0,0,.5,9.12h0a5.59,5.59,0,0,0,5.59,5.59H38.91l14.38,0a6,6,0,0,1,6.21,6V32" />
<path
d="M54.39,32h6.08a3,3,0,0,1,3,3V44a3,3,0,0,1-3,3H54.39a7.49,7.49,0,0,1-7.49-7.49v0A7.49,7.49,0,0,1,54.39,32Z" />
<polyline points="20.39 50.69 29.45 59.76 38.61 50.6" />
</svg>
<p> <p>
Withdraw or redeem your Rupee back to your specified UPI address. Withdraw or redeem your Rupee back to your specified UPI address.
</p> </p>
<sm-input id="user_withdraw_upi" placeholder="Reciever's UPI address" pattern="^[a-zA-z0-9]+@[a-zA-z0-9]+" required animate></sm-input> <sm-input id="user_withdraw_upi" placeholder="Reciever's UPI address" pattern="^[a-zA-z0-9]+@[a-zA-z0-9]+"
required animate></sm-input>
<sm-input id="withdraw_cash_amount" placeholder="Amount" type="number" min="1" required animate></sm-input> <sm-input id="withdraw_cash_amount" placeholder="Amount" type="number" min="1" required animate></sm-input>
</sm-popup> </sm-popup>
<sm-popup id="request_rupee"> <sm-popup id="request_rupee">
<header class="popup-header" slot="header"> <header class="popup-header" slot="header">
<svg class="icon" onclick="hidePopup()" viewBox="0 0 64 64"> <svg class="icon" onclick="this.closest('sm-popup').hide()" viewBox="0 0 64 64">
<title>close</title> <title>close</title>
<line x1="64" y1="0" x2="0" y2="64" /> <line x1="64" y1="0" x2="0" y2="64" />
<line x1="64" y1="64" x2="0" y2="0" /> <line x1="64" y1="64" x2="0" y2="0" />
@ -155,6 +182,10 @@
</svg> </svg>
</button> </button>
</header> </header>
<svg class="icon request-icon illustration" viewBox="0 0 64 64">
<path
d="M47.28,16.8,29.6,34.64a3.3,3.3,0,0,1-3.59.71L2.5,25.42a3.28,3.28,0,0,1,.26-6.13L59.21.87A3.28,3.28,0,0,1,63.32,5l-18.93,56a3.26,3.26,0,0,1-6.12.18l-6.4-15.68" />
</svg>
<p> <p>
Request Rupee from other's using FLO address. Request Rupee from other's using FLO address.
</p> </p>
@ -163,7 +194,7 @@
</sm-popup> </sm-popup>
<sm-popup id="pay_anyone"> <sm-popup id="pay_anyone">
<header class="popup-header" slot="header"> <header class="popup-header" slot="header">
<svg class="icon" onclick="hidePopup()" viewBox="0 0 64 64"> <svg class="icon" onclick="this.closest('sm-popup').hide()" viewBox="0 0 64 64">
<title>close</title> <title>close</title>
<line x1="64" y1="0" x2="0" y2="64" /> <line x1="64" y1="0" x2="0" y2="64" />
<line x1="64" y1="64" x2="0" y2="0" /> <line x1="64" y1="64" x2="0" y2="0" />
@ -174,24 +205,68 @@
pay pay
</h4> </h4>
<svg viewBox="0 0 73 73" class="loader"> <svg viewBox="0 0 73 73" class="loader">
<path <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" />
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>
</button> </button>
</header> </header>
<svg class="icon illustration" viewBox="0 0 64 64">
<path d="M32,37.75A10.19,10.19,0,1,0,21.81,27.44V46.62" />
<rect height="64" width="64" rx="8"></rect>
</svg>
<details>
<summary>
What is this?
</summary>
<p> <p>
Don't have enough Rupee balance? Pay to our cashier through UPI and your cash will be Don't have enough Rupee balance? Pay to our cashier through UPI and your cash will be
sent as Rupee. sent as Rupee.
</p> </p>
</details>
<p id="pay_cashier_info"></p> <p id="pay_cashier_info"></p>
<sm-input floId id="recvr_id" placeholder="Reciever's FLO ID" required animaate></sm-input> <sm-input floId id="recvr_id" placeholder="Reciever's FLO ID" required animaate></sm-input>
<sm-input id="recvr_amount_to_pay" placeholder="Amount" type="number" min="1" required animate></sm-input> <sm-input id="recvr_amount_to_pay" placeholder="Amount" type="number" min="1" required animate></sm-input>
<sm-input id="paid_cashier_upi" placeholder="Sender's UPI address" pattern="^[a-zA-z0-9]+@[a-zA-z0-9]+" required animate></sm-input> <sm-input id="paid_cashier_upi" placeholder="Sender's UPI address" pattern="^[a-zA-z0-9]+@[a-zA-z0-9]+" required
animate></sm-input>
</sm-popup>
<sm-popup id="transaction_result">
<header class="popup-header" slot="header">
<svg class="icon" onclick="this.closest('sm-popup').hide()" viewBox="0 0 64 64">
<title>close</title>
<line x1="64" y1="0" x2="0" y2="64" />
<line x1="64" y1="64" x2="0" y2="0" />
</svg>
</header>
<section id="success_section" class="flex direction-column">
<svg id="success_svg" class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<title>success</title>
<ellipse cx="32" cy="32" rx="31.5" ry="31.49"/>
<polyline points="17.04 30.48 27.92 41.36 46.96 22.32"/>
</svg>
<h4>Transaction Successful</h4>
<div class="copy-row">
<h4 id="successful_transaction_id" class="copy"></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>
</section>
<section id="failure_section" class="hide-completely flex direction-column">
<svg id="failure_svg" class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<title>failure</title>
<ellipse cx="32" cy="32" rx="31.5" ry="31.49"/>
<line x1="22.5" y1="22.5" x2="41.5" y2="41.5"/>
<line x1="41.5" y1="22.5" x2="22.5" y2="41.5"/>
</svg>
<h4>Transaction Failed</h4>
</section>
<p id="transaction_message"></p>
</sm-popup> </sm-popup>
<!-- Report popup--> <!-- Report popup-->
<sm-popup id="report_popup"> <sm-popup id="report_popup">
<header class="popup-header" slot="header"> <header class="popup-header" slot="header">
<svg class="icon" onclick="hidePopup()" viewBox="0 0 64 64"> <svg class="icon" onclick="this.closest('sm-popup').hide()" viewBox="0 0 64 64">
<title>close</title> <title>close</title>
<line x1="64" y1="0" x2="0" y2="64" /> <line x1="64" y1="0" x2="0" y2="64" />
<line x1="64" y1="64" x2="0" y2="0" /> <line x1="64" y1="64" x2="0" y2="0" />
@ -243,7 +318,8 @@
</div> </div>
<div title="requests page" class="navbar-item user-option" onclick="showPage(this, 'request_page')"> <div title="requests page" class="navbar-item user-option" onclick="showPage(this, 'request_page')">
<svg class="icon request-icon" viewBox="0 0 64 64"> <svg class="icon request-icon" viewBox="0 0 64 64">
<path d="M47.28,16.8,29.6,34.64a3.3,3.3,0,0,1-3.59.71L2.5,25.42a3.28,3.28,0,0,1,.26-6.13L59.21.87A3.28,3.28,0,0,1,63.32,5l-18.93,56a3.26,3.26,0,0,1-6.12.18l-6.4-15.68"/> <path
d="M47.28,16.8,29.6,34.64a3.3,3.3,0,0,1-3.59.71L2.5,25.42a3.28,3.28,0,0,1,.26-6.13L59.21.87A3.28,3.28,0,0,1,63.32,5l-18.93,56a3.26,3.26,0,0,1-6.12.18l-6.4-15.68" />
</svg> </svg>
<h5>requests</h5> <h5>requests</h5>
</div> </div>
@ -273,8 +349,12 @@
<div title="profile page" class="navbar-item" onclick="showPage(this, 'settings_page')"> <div title="profile page" class="navbar-item" onclick="showPage(this, 'settings_page')">
<svg class="icon" viewBox="0 0 64 64"> <svg class="icon" viewBox="0 0 64 64">
<title>settings</title> <title>settings</title>
<path d="M41,62.92a1.7,1.7,0,0,1-1.45-.83L37,57.7a2.63,2.63,0,0,0-2.27-1.34h-.26a23.91,23.91,0,0,1-5,0h-.26A2.63,2.63,0,0,0,27,57.7l-2.54,4.39a1.67,1.67,0,0,1-1.44.83,1.72,1.72,0,0,1-.83-.22L10.33,55.86a1.67,1.67,0,0,1-.61-2.27l2.54-4.41a2.61,2.61,0,0,0-.12-2.85A23.77,23.77,0,0,1,9.65,42,2.65,2.65,0,0,0,7.24,40.5H2.17A1.67,1.67,0,0,1,.5,38.83V25.17A1.67,1.67,0,0,1,2.17,23.5H7.24A2.64,2.64,0,0,0,9.65,22a25,25,0,0,1,2.49-4.31,2.63,2.63,0,0,0,.12-2.85l-2.54-4.4a1.67,1.67,0,0,1,.61-2.27L22.17,1.3A1.72,1.72,0,0,1,23,1.08a1.67,1.67,0,0,1,1.44.83L27,6.3a2.63,2.63,0,0,0,2.27,1.34h.26a23.91,23.91,0,0,1,5,0h.26A2.63,2.63,0,0,0,37,6.3l2.53-4.39A1.7,1.7,0,0,1,41,1.08a1.72,1.72,0,0,1,.83.22L53.67,8.14a1.67,1.67,0,0,1,.61,2.27l-2.54,4.41a2.61,2.61,0,0,0,.12,2.85A24.46,24.46,0,0,1,54.35,22a2.65,2.65,0,0,0,2.41,1.52h5.07a1.67,1.67,0,0,1,1.67,1.67V38.83a1.67,1.67,0,0,1-1.67,1.67H56.76A2.63,2.63,0,0,0,54.35,42a24.63,24.63,0,0,1-2.49,4.31,2.63,2.63,0,0,0-.12,2.85l2.54,4.4a1.68,1.68,0,0,1-.61,2.27L41.83,62.7A1.72,1.72,0,0,1,41,62.92Z"/> <path
<path d="M23,1.58h0a1.16,1.16,0,0,1,1,.58l2.54,4.39a3.14,3.14,0,0,0,2.7,1.59l.31,0C30.37,8,31.19,8,32,8s1.63,0,2.44.12l.31,0a3.14,3.14,0,0,0,2.7-1.59L40,2.16a1.16,1.16,0,0,1,1-.58,1.1,1.1,0,0,1,.58.16L53.42,8.57a1.16,1.16,0,0,1,.42,1.59L51.3,14.57a3.15,3.15,0,0,0,.15,3.4,23.69,23.69,0,0,1,2.45,4.21A3.12,3.12,0,0,0,56.76,24h5.07A1.17,1.17,0,0,1,63,25.17V38.83A1.17,1.17,0,0,1,61.83,40H56.76a3.11,3.11,0,0,0-2.86,1.82,24.33,24.33,0,0,1-2.44,4.23,3.11,3.11,0,0,0-.15,3.39l2.53,4.4a1.13,1.13,0,0,1,.12.88,1.17,1.17,0,0,1-.54.71L41.58,62.26a1.08,1.08,0,0,1-.58.16,1.16,1.16,0,0,1-1-.58l-2.54-4.39a3.14,3.14,0,0,0-2.7-1.59l-.31,0C33.63,56,32.81,56,32,56s-1.63,0-2.44-.12l-.31,0a3.14,3.14,0,0,0-2.7,1.59L24,61.84a1.16,1.16,0,0,1-1,.58,1.1,1.1,0,0,1-.58-.16L10.58,55.43a1.16,1.16,0,0,1-.42-1.59l2.54-4.41a3.15,3.15,0,0,0-.15-3.4,23.69,23.69,0,0,1-2.45-4.21A3.12,3.12,0,0,0,7.24,40H2.17A1.17,1.17,0,0,1,1,38.83V25.17A1.17,1.17,0,0,1,2.17,24H7.24a3.11,3.11,0,0,0,2.86-1.82A24.33,24.33,0,0,1,12.54,18a3.11,3.11,0,0,0,.15-3.39l-2.53-4.4a1.16,1.16,0,0,1,.42-1.59L22.42,1.74A1.08,1.08,0,0,1,23,1.58m0-1a2.11,2.11,0,0,0-1.08.29L10.08,7.7a2.17,2.17,0,0,0-.79,3l2.54,4.4a2.15,2.15,0,0,1-.1,2.31,24.92,24.92,0,0,0-2.54,4.4A2.13,2.13,0,0,1,7.24,23H2.17A2.17,2.17,0,0,0,0,25.17V38.83A2.17,2.17,0,0,0,2.17,41H7.24a2.13,2.13,0,0,1,1.95,1.23,25.25,25.25,0,0,0,2.55,4.39,2.13,2.13,0,0,1,.09,2.31L9.29,53.34a2.17,2.17,0,0,0,.79,3l11.84,6.83a2.11,2.11,0,0,0,1.08.29,2.17,2.17,0,0,0,1.88-1.08L27.41,58a2.14,2.14,0,0,1,1.84-1.09h.21a24.88,24.88,0,0,0,5.08,0h.21A2.14,2.14,0,0,1,36.59,58l2.53,4.39A2.17,2.17,0,0,0,41,63.42a2.11,2.11,0,0,0,1.08-.29L53.92,56.3a2.17,2.17,0,0,0,.79-3l-2.54-4.4a2.15,2.15,0,0,1,.1-2.31,24.92,24.92,0,0,0,2.54-4.4A2.13,2.13,0,0,1,56.76,41h5.07A2.17,2.17,0,0,0,64,38.83V25.17A2.17,2.17,0,0,0,61.83,23H56.76a2.13,2.13,0,0,1-1.95-1.23,25.25,25.25,0,0,0-2.55-4.39,2.13,2.13,0,0,1-.09-2.31l2.54-4.41a2.17,2.17,0,0,0-.79-3L42.08.87A2.11,2.11,0,0,0,41,.58a2.17,2.17,0,0,0-1.88,1.08L36.59,6.05a2.14,2.14,0,0,1-1.84,1.09h-.21a24.88,24.88,0,0,0-5.08,0h-.21a2.14,2.14,0,0,1-1.84-1.09L24.88,1.66A2.17,2.17,0,0,0,23,.58Z"/><circle class="a" cx="32" cy="32" r="11.5"/><path d="M32,21A11,11,0,1,1,21,32,11,11,0,0,1,32,21m0-1A12,12,0,1,0,44,32,12,12,0,0,0,32,20Z"/> d="M41,62.92a1.7,1.7,0,0,1-1.45-.83L37,57.7a2.63,2.63,0,0,0-2.27-1.34h-.26a23.91,23.91,0,0,1-5,0h-.26A2.63,2.63,0,0,0,27,57.7l-2.54,4.39a1.67,1.67,0,0,1-1.44.83,1.72,1.72,0,0,1-.83-.22L10.33,55.86a1.67,1.67,0,0,1-.61-2.27l2.54-4.41a2.61,2.61,0,0,0-.12-2.85A23.77,23.77,0,0,1,9.65,42,2.65,2.65,0,0,0,7.24,40.5H2.17A1.67,1.67,0,0,1,.5,38.83V25.17A1.67,1.67,0,0,1,2.17,23.5H7.24A2.64,2.64,0,0,0,9.65,22a25,25,0,0,1,2.49-4.31,2.63,2.63,0,0,0,.12-2.85l-2.54-4.4a1.67,1.67,0,0,1,.61-2.27L22.17,1.3A1.72,1.72,0,0,1,23,1.08a1.67,1.67,0,0,1,1.44.83L27,6.3a2.63,2.63,0,0,0,2.27,1.34h.26a23.91,23.91,0,0,1,5,0h.26A2.63,2.63,0,0,0,37,6.3l2.53-4.39A1.7,1.7,0,0,1,41,1.08a1.72,1.72,0,0,1,.83.22L53.67,8.14a1.67,1.67,0,0,1,.61,2.27l-2.54,4.41a2.61,2.61,0,0,0,.12,2.85A24.46,24.46,0,0,1,54.35,22a2.65,2.65,0,0,0,2.41,1.52h5.07a1.67,1.67,0,0,1,1.67,1.67V38.83a1.67,1.67,0,0,1-1.67,1.67H56.76A2.63,2.63,0,0,0,54.35,42a24.63,24.63,0,0,1-2.49,4.31,2.63,2.63,0,0,0-.12,2.85l2.54,4.4a1.68,1.68,0,0,1-.61,2.27L41.83,62.7A1.72,1.72,0,0,1,41,62.92Z" />
<path
d="M23,1.58h0a1.16,1.16,0,0,1,1,.58l2.54,4.39a3.14,3.14,0,0,0,2.7,1.59l.31,0C30.37,8,31.19,8,32,8s1.63,0,2.44.12l.31,0a3.14,3.14,0,0,0,2.7-1.59L40,2.16a1.16,1.16,0,0,1,1-.58,1.1,1.1,0,0,1,.58.16L53.42,8.57a1.16,1.16,0,0,1,.42,1.59L51.3,14.57a3.15,3.15,0,0,0,.15,3.4,23.69,23.69,0,0,1,2.45,4.21A3.12,3.12,0,0,0,56.76,24h5.07A1.17,1.17,0,0,1,63,25.17V38.83A1.17,1.17,0,0,1,61.83,40H56.76a3.11,3.11,0,0,0-2.86,1.82,24.33,24.33,0,0,1-2.44,4.23,3.11,3.11,0,0,0-.15,3.39l2.53,4.4a1.13,1.13,0,0,1,.12.88,1.17,1.17,0,0,1-.54.71L41.58,62.26a1.08,1.08,0,0,1-.58.16,1.16,1.16,0,0,1-1-.58l-2.54-4.39a3.14,3.14,0,0,0-2.7-1.59l-.31,0C33.63,56,32.81,56,32,56s-1.63,0-2.44-.12l-.31,0a3.14,3.14,0,0,0-2.7,1.59L24,61.84a1.16,1.16,0,0,1-1,.58,1.1,1.1,0,0,1-.58-.16L10.58,55.43a1.16,1.16,0,0,1-.42-1.59l2.54-4.41a3.15,3.15,0,0,0-.15-3.4,23.69,23.69,0,0,1-2.45-4.21A3.12,3.12,0,0,0,7.24,40H2.17A1.17,1.17,0,0,1,1,38.83V25.17A1.17,1.17,0,0,1,2.17,24H7.24a3.11,3.11,0,0,0,2.86-1.82A24.33,24.33,0,0,1,12.54,18a3.11,3.11,0,0,0,.15-3.39l-2.53-4.4a1.16,1.16,0,0,1,.42-1.59L22.42,1.74A1.08,1.08,0,0,1,23,1.58m0-1a2.11,2.11,0,0,0-1.08.29L10.08,7.7a2.17,2.17,0,0,0-.79,3l2.54,4.4a2.15,2.15,0,0,1-.1,2.31,24.92,24.92,0,0,0-2.54,4.4A2.13,2.13,0,0,1,7.24,23H2.17A2.17,2.17,0,0,0,0,25.17V38.83A2.17,2.17,0,0,0,2.17,41H7.24a2.13,2.13,0,0,1,1.95,1.23,25.25,25.25,0,0,0,2.55,4.39,2.13,2.13,0,0,1,.09,2.31L9.29,53.34a2.17,2.17,0,0,0,.79,3l11.84,6.83a2.11,2.11,0,0,0,1.08.29,2.17,2.17,0,0,0,1.88-1.08L27.41,58a2.14,2.14,0,0,1,1.84-1.09h.21a24.88,24.88,0,0,0,5.08,0h.21A2.14,2.14,0,0,1,36.59,58l2.53,4.39A2.17,2.17,0,0,0,41,63.42a2.11,2.11,0,0,0,1.08-.29L53.92,56.3a2.17,2.17,0,0,0,.79-3l-2.54-4.4a2.15,2.15,0,0,1,.1-2.31,24.92,24.92,0,0,0,2.54-4.4A2.13,2.13,0,0,1,56.76,41h5.07A2.17,2.17,0,0,0,64,38.83V25.17A2.17,2.17,0,0,0,61.83,23H56.76a2.13,2.13,0,0,1-1.95-1.23,25.25,25.25,0,0,0-2.55-4.39,2.13,2.13,0,0,1-.09-2.31l2.54-4.41a2.17,2.17,0,0,0-.79-3L42.08.87A2.11,2.11,0,0,0,41,.58a2.17,2.17,0,0,0-1.88,1.08L36.59,6.05a2.14,2.14,0,0,1-1.84,1.09h-.21a24.88,24.88,0,0,0-5.08,0h-.21a2.14,2.14,0,0,1-1.84-1.09L24.88,1.66A2.17,2.17,0,0,0,23,.58Z" />
<circle class="a" cx="32" cy="32" r="11.5" />
<path d="M32,21A11,11,0,1,1,21,32,11,11,0,0,1,32,21m0-1A12,12,0,1,0,44,32,12,12,0,0,0,32,20Z" />
</svg> </svg>
<h5>Settings</h5> <h5>Settings</h5>
</div> </div>
@ -286,7 +366,8 @@
<sm-carousel class="options-tab"> <sm-carousel class="options-tab">
<div class="option" onclick="showPopup('cash_transfer')"> <div class="option" onclick="showPopup('cash_transfer')">
<svg class="icon" viewBox="0 0 64 64"> <svg class="icon" viewBox="0 0 64 64">
<path d="M47.28,16.8,29.6,34.64a3.3,3.3,0,0,1-3.59.71L2.5,25.42a3.28,3.28,0,0,1,.26-6.13L59.21.87A3.28,3.28,0,0,1,63.32,5l-18.93,56a3.26,3.26,0,0,1-6.12.18l-6.4-15.68"/> <path
d="M47.28,16.8,29.6,34.64a3.3,3.3,0,0,1-3.59.71L2.5,25.42a3.28,3.28,0,0,1,.26-6.13L59.21.87A3.28,3.28,0,0,1,63.32,5l-18.93,56a3.26,3.26,0,0,1-6.12.18l-6.4-15.68" />
</svg> </svg>
<h4>Send</h4> <h4>Send</h4>
</div> </div>
@ -295,8 +376,10 @@
<title>deposit</title> <title>deposit</title>
<path d="M29.58,35.76V60.47H5.13A4.63,4.63,0,0,1,.5,55.83V9.63" /> <path d="M29.58,35.76V60.47H5.13A4.63,4.63,0,0,1,.5,55.83V9.63" />
<path d="M59.5,47v8.85a4.63,4.63,0,0,1-4.63,4.64H42.16" /> <path d="M59.5,47v8.85a4.63,4.63,0,0,1-4.63,4.64H42.16" />
<path d="M49.44,3.53H6.09A5.59,5.59,0,0,0,.5,9.12h0a5.59,5.59,0,0,0,5.59,5.59H38.91l14.38,0a6,6,0,0,1,6.21,6V32"/> <path
<path d="M54.39,32h6.08a3,3,0,0,1,3,3V44a3,3,0,0,1-3,3H54.39a7.49,7.49,0,0,1-7.49-7.49v0A7.49,7.49,0,0,1,54.39,32Z"/> d="M49.44,3.53H6.09A5.59,5.59,0,0,0,.5,9.12h0a5.59,5.59,0,0,0,5.59,5.59H38.91l14.38,0a6,6,0,0,1,6.21,6V32" />
<path
d="M54.39,32h6.08a3,3,0,0,1,3,3V44a3,3,0,0,1-3,3H54.39a7.49,7.49,0,0,1-7.49-7.49v0A7.49,7.49,0,0,1,54.39,32Z" />
<polyline points="38.61 44.12 29.54 35.05 20.39 44.2" /> <polyline points="38.61 44.12 29.54 35.05 20.39 44.2" />
</svg> </svg>
<h4>deposit</h4> <h4>deposit</h4>
@ -307,15 +390,18 @@
<path d="M15.18,60.47h-10A4.63,4.63,0,0,1,.5,55.83V9.63" /> <path d="M15.18,60.47h-10A4.63,4.63,0,0,1,.5,55.83V9.63" />
<line x1="29.42" y1="59.04" x2="29.42" y2="34.34" /> <line x1="29.42" y1="59.04" x2="29.42" y2="34.34" />
<path d="M59.5,47v8.85a4.63,4.63,0,0,1-4.63,4.64H43.62" /> <path d="M59.5,47v8.85a4.63,4.63,0,0,1-4.63,4.64H43.62" />
<path d="M49.44,3.53H6.09A5.59,5.59,0,0,0,.5,9.12h0a5.59,5.59,0,0,0,5.59,5.59H38.91l14.38,0a6,6,0,0,1,6.21,6V32"/> <path
<path d="M54.39,32h6.08a3,3,0,0,1,3,3V44a3,3,0,0,1-3,3H54.39a7.49,7.49,0,0,1-7.49-7.49v0A7.49,7.49,0,0,1,54.39,32Z"/> d="M49.44,3.53H6.09A5.59,5.59,0,0,0,.5,9.12h0a5.59,5.59,0,0,0,5.59,5.59H38.91l14.38,0a6,6,0,0,1,6.21,6V32" />
<path
d="M54.39,32h6.08a3,3,0,0,1,3,3V44a3,3,0,0,1-3,3H54.39a7.49,7.49,0,0,1-7.49-7.49v0A7.49,7.49,0,0,1,54.39,32Z" />
<polyline points="20.39 50.69 29.45 59.76 38.61 50.6" /> <polyline points="20.39 50.69 29.45 59.76 38.61 50.6" />
</svg> </svg>
<h4>Withdraw</h4> <h4>Withdraw</h4>
</div> </div>
<div class="option" onclick="showPopup('request_rupee')"> <div class="option" onclick="showPopup('request_rupee')">
<svg class="icon request-icon" viewBox="0 0 64 64"> <svg class="icon request-icon" viewBox="0 0 64 64">
<path d="M47.28,16.8,29.6,34.64a3.3,3.3,0,0,1-3.59.71L2.5,25.42a3.28,3.28,0,0,1,.26-6.13L59.21.87A3.28,3.28,0,0,1,63.32,5l-18.93,56a3.26,3.26,0,0,1-6.12.18l-6.4-15.68"/> <path
d="M47.28,16.8,29.6,34.64a3.3,3.3,0,0,1-3.59.71L2.5,25.42a3.28,3.28,0,0,1,.26-6.13L59.21.87A3.28,3.28,0,0,1,63.32,5l-18.93,56a3.26,3.26,0,0,1-6.12.18l-6.4-15.68" />
</svg> </svg>
<h4>Request</h4> <h4>Request</h4>
</div> </div>
@ -626,7 +712,7 @@
</section> </section>
<section id="helpline_page" class="page hide-completely"> <section id="helpline_page" class="page hide-completely">
<div class="container-header"> <div class="container-header">
<h3>Complaints</<h3> <h3>Complaints<h3>
</div> </div>
<h5 class="label">Select Cashier</h5> <h5 class="label">Select Cashier</h5>
<sm-strip-select name="cashier" id="select_cashier"></sm-strip-select> <sm-strip-select name="cashier" id="select_cashier"></sm-strip-select>
@ -1183,6 +1269,11 @@
zIndex = 10; zIndex = 10;
function showPopup(popup, permission) { function showPopup(popup, permission) {
console.log(popupStack.peek())
if (popupStack.peek() !== undefined){
let prevPopup = document.getElementById(popupStack.peek().popup)
prevPopup.classList.add('stacked')
}
let thisPopup = document.getElementById(popup); let thisPopup = document.getElementById(popup);
popupStack.push({ popupStack.push({
popup, popup,
@ -1213,29 +1304,38 @@
thisPopup.querySelector("button[type='submit']").disabled = true; thisPopup.querySelector("button[type='submit']").disabled = true;
} }
}, 400) }, 400)
if (popup === 'sign_in_popup') {
loader.classList.remove('animate-loader')
document.querySelector('main').classList.remove('hide-completely')
document.querySelector('#navbar').classList.remove('hide-completely')
document.querySelector('#main_header').classList.remove('hide-completely')
}
if (popup === 'prompt') { if (popup === 'prompt') {
if (thisPopup.querySelector('sm-input').value == '') if (thisPopup.querySelector('sm-input').value == '')
thisPopup.querySelector('.cancel-btn').click() thisPopup.querySelector('.cancel-btn').click()
} }
if (popup === 'cash_transfer') { }
document.addEventListener('popupclosed', e => {
if (popupStack.peek() !== undefined){
let prevPopup = document.getElementById(popupStack.peek().popup)
prevPopup.classList.remove('stacked')
}
switch(e.detail.popup.id){
case 'sign_in_popup' :
loader.classList.remove('animate-loader')
document.querySelector('main').classList.remove('hide-completely')
document.querySelector('#navbar').classList.remove('hide-completely')
document.querySelector('#main_header').classList.remove('hide-completely')
break;
case 'cash_transfer' :
payingRequested = false; payingRequested = false;
tokenReceiver.disabled = false tokenReceiver.disabled = false
tokenAmount.disabled = false tokenAmount.disabled = false
} break;
if (popup === 'deposit_rupee') { case 'deposit_rupee':
depositRequested = 0; depositRequested = 0;
document.getElementById('upi_txId_section').classList.add('hide-completely') document.getElementById('upi_txId_section').classList.add('hide-completely')
document.getElementById('deposit_amount_section').classList.remove('hide-completely') document.getElementById('deposit_amount_section').classList.remove('hide-completely')
depositedRupeeTxId.disabled = true depositedRupeeTxId.disabled = true
document.getElementById('request_tokens_btn').children[0].textContent = 'Continue' document.getElementById('request_tokens_btn').children[0].textContent = 'Continue'
break;
} }
} })
function btnLoading(btn, option) { function btnLoading(btn, option) {
if (typeof btn === 'string') if (typeof btn === 'string')
@ -1373,24 +1473,22 @@
notify('Copied', 'success') notify('Copied', 'success')
} }
function areInputsEmpty(parent) { function areInputsValid(parent) {
let allInputs = parent.querySelectorAll("sm-input:not([disabled])"); let allInputs = parent.querySelectorAll("sm-input:not([disabled])");
return [...allInputs].every(input => input.isValid) return [...allInputs].every(input => {
if(input.hasAttribute('floId')){
if(floCrypto.validateAddr(input.value.trim())) return true
}
else
return input.isValid
})
} }
function formValidation(formElement) { function formValidation(formElement) {
let parent = formElement.closest('sm-popup'), let parent = formElement.closest('sm-popup'),
submitBtn = parent.querySelector("button[type='submit']"); submitBtn = parent.querySelector("button[type='submit']");
if (!submitBtn) return; if (!submitBtn) return;
if (formElement.hasAttribute('floId')) { if (areInputsValid(parent))
if (floCrypto.validateAddr(formElement.value.trim())) {
submitBtn.disabled = false;
} else {
submitBtn.disabled = true;
return
}
}
if (areInputsEmpty(parent))
submitBtn.disabled = false; submitBtn.disabled = false;
else else
submitBtn.disabled = true; submitBtn.disabled = true;
@ -11006,14 +11104,16 @@
master_configurations: {}, master_configurations: {},
actions: {}, actions: {},
blocked_flo_ids: [], blocked_flo_ids: [],
personal_data: null,
}; };
token_app.actions = { token_app.actions = {
parse_flo_comments: async function () { parse_flo_comments: async function () {
const num=3; const num = 4;
text = `masterFLOAddress=FD5hK9ryBogJ5AcSvCy1tW5as8jRTkMLky text = `masterFLOAddress=FD5hK9ryBogJ5AcSvCy1tW5as8jRTkMLky
#!#CURRENCY=INR #!#CURRENCY=INR
#!#TYPE_UPI_APP=UPI_APP_TEST${num}
#!#TYPE_DEPOSITS=CASH_DEPOSITS_TEST${num} #!#TYPE_DEPOSITS=CASH_DEPOSITS_TEST${num}
#!#TYPE_WITHDRAWS=CASH_WITHDRAWS_TEST${num} #!#TYPE_WITHDRAWS=CASH_WITHDRAWS_TEST${num}
#!#TYPE_MSGES=USER_MESSAGES_TEST${num} #!#TYPE_MSGES=USER_MESSAGES_TEST${num}
@ -11031,6 +11131,10 @@
#!#TYPE_REQUEST_PAYMENT_DECLINED=REQUEST_PAYMENT_DECLINED_TEST${num} #!#TYPE_REQUEST_PAYMENT_DECLINED=REQUEST_PAYMENT_DECLINED_TEST${num}
#!#TYPE_REQUEST_PAYMENT_APPROVED=REQUEST_PAYMENT_APPROVED_TEST${num} #!#TYPE_REQUEST_PAYMENT_APPROVED=REQUEST_PAYMENT_APPROVED_TEST${num}
#!#TYPE_UNCONFIRMED_BALANCE_CLAIM_REQUESTS=TYPE_UNCONFIRMED_BALANCE_CLAIM_REQUESTS_TEST${num} #!#TYPE_UNCONFIRMED_BALANCE_CLAIM_REQUESTS=TYPE_UNCONFIRMED_BALANCE_CLAIM_REQUESTS_TEST${num}
#!#TYPE_SENT_TOKENS=TYPE_SENT_TOKENS_TEST${num}
#!#TYPE_MY_PERSONAL_DATA=TYPE_MY_PERSONAL_DATA_TEST${num}
#!#TYPE_UNCONFIRMED_RUPEE_DEPOSITS=TYPE_UNCONFIRMED_RUPEE_DEPOSITS_TEST${num}
#!#TYPE_PROCESSED_UNCONFIRMED_BALANCE_CLAIM_REQUESTS=TYPE_PROCESSED_UNCONFIRMED_BALANCE_CLAIM_REQUESTS_TEST${num}
#!#vendors=FGtPEBu2NFFYkqFrA9NDBJJLpVhyuPubDj, #!#vendors=FGtPEBu2NFFYkqFrA9NDBJJLpVhyuPubDj,
#!#helplineFloId=F9MAyvT5b9aSfsuukAungrbt1L5fgmJmuK #!#helplineFloId=F9MAyvT5b9aSfsuukAungrbt1L5fgmJmuK
#!#cashiers= #!#cashiers=
@ -11039,6 +11143,24 @@
"upi_id": "8507742774@ybl" "upi_id": "8507742774@ybl"
} }
}` }`
/*
,
"FHW2kgYEhDt85vjAiMMF7bQqdP74L7iwvQ": {
"upi_id": "8340617958@ybl"
},
"FTmJ6QeBjDFjdqS6Zs4V5amac2X19AjXcF": {
"upi_id": "8902496422@ybl"
},
"FBun3694ZdxmD66os9oL5DxMrif3vyVjT3": {
"upi_id": "7004801428@ybl"
},
"FTpxFWdBDvYARGZuPWDhw9gke72J2pruvv": {
"upi_id": "aakriti1705sinha@okicici"
},
"FQ6udJuTbGDa2kWZAkmNpwgHaUEeYLPAtt": {
"upi_id": "krishraj1012-2@okicici"
}
*/
text = removeWhiteSpaces(text); text = removeWhiteSpaces(text);
return text; return text;
const master_data = await ajaxGet( const master_data = await ajaxGet(
@ -11191,7 +11313,7 @@
showPage(document.getElementById('home_page_btn'), 'home_page') showPage(document.getElementById('home_page_btn'), 'home_page')
} }
//Hide loader hidePopup()
pay_through_cashier(); pay_through_cashier();
}, },
@ -11205,7 +11327,12 @@
}); });
if (Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) { if (Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) {
await Promise.all([floCloudAPI.requestGeneralData(token_app.master_configurations
await Promise.all([
create_root_structure(),
floCloudAPI.requestGeneralData(token_app.master_configurations
.TYPE_DEPOSITS, { .TYPE_DEPOSITS, {
receiverID: myFloID receiverID: myFloID
}), }),
@ -11229,6 +11356,9 @@
await clearCashierData(); await clearCashierData();
await Promise.all([ await Promise.all([
create_root_structure(),
floCloudAPI.requestGeneralData(token_app.master_configurations floCloudAPI.requestGeneralData(token_app.master_configurations
.TYPE_FILE_DEPOSITS_COMPLAINT), .TYPE_FILE_DEPOSITS_COMPLAINT),
floCloudAPI.requestGeneralData(token_app.master_configurations floCloudAPI.requestGeneralData(token_app.master_configurations
@ -11280,6 +11410,8 @@
await Promise.all(promises.map(prom => prom.func.call(floCloudAPI, prom.arg1, prom.arg2))); await Promise.all(promises.map(prom => prom.func.call(floCloudAPI, prom.arg1, prom.arg2)));
create_root_structure();
return promises; return promises;
} }
@ -11290,20 +11422,37 @@
<!-- Cashier functions --> <!-- Cashier functions -->
<script> <script>
// Create root structure
function create_root_structure() { async function reset_cloud_object(object_name, options) {
token_app.requests = {}; try {
token_app.requests.deposits = {}; if (typeof floGlobals.appObjects[object_name] !== 'object'
token_app.requests.withdraws = {}; || floGlobals.appObjects[object_name] == null) {
floCloudAPI.resetObjectData(token_app, floGlobals.application, { floCloudAPI.requestObjectData(object_name, options)
receiverID: floGlobals.adminID .then(resp => {
if (typeof floGlobals.appObjects[object_name] !== 'object'
|| floGlobals.appObjects[object_name] == null) {
floGlobals.appObjects[object_name] = {};
floCloudAPI.resetObjectData(object_name)
.then(() => floCloudAPI.requestObjectData(object_name, options))
.then(() => true);
} else return false;
}); });
} else return false;
} catch (error) {
throw new Error(error);
}
}
// Create root structure
async function create_root_structure() {
floGlobals.appObjects["unconfirmed_rupee_deposits"] = {}; let promises = [];
floCloudAPI.resetObjectData("unconfirmed_rupee_deposits"); promises.push(reset_cloud_object(token_app.master_configurations.TYPE_MY_PERSONAL_DATA));
if (Object.keys(token_app.master_configurations.cashiers).includes(myFloID)) {
promises.push(reset_cloud_object(token_app.master_configurations.TYPE_UNCONFIRMED_RUPEE_DEPOSITS));
promises.push(reset_cloud_object(token_app.master_configurations.TYPE_PROCESSED_UNCONFIRMED_BALANCE_CLAIM_REQUESTS));
}
floGlobals.appObjects["processed_unconfirmed_balance_claim_requests"] = {}; return Promise.all(promises);
floCloudAPI.resetObjectData("processed_unconfirmed_balance_claim_requests");
} }
async function show_deposit_request() { async function show_deposit_request() {
@ -11445,9 +11594,9 @@
validateDepositTxidInBlockchain(); validateDepositTxidInBlockchain();
n++; n++;
} else { } else {
floGlobals.appObjects["unconfirmed_rupee_deposits"][flo_txid] = input_data; floGlobals.appObjects[token_app.master_configurations.TYPE_UNCONFIRMED_RUPEE_DEPOSITS][flo_txid] = input_data;
let receiverID = floGlobals.adminID; let receiverID = floGlobals.adminID;
floCloudAPI.updateObjectData("unconfirmed_rupee_deposits", { receiverID }); floCloudAPI.updateObjectData(token_app.master_configurations.TYPE_UNCONFIRMED_RUPEE_DEPOSITS, { receiverID });
notify('Txid ' + flo_txid + ' added in Unconfirmed Rupee Deposits.', 'error'); notify('Txid ' + flo_txid + ' added in Unconfirmed Rupee Deposits.', 'error');
} }
@ -11546,12 +11695,14 @@
if (token_receiver.length < 1 || !floCrypto.validateAddr(token_receiver)) { if (token_receiver.length < 1 || !floCrypto.validateAddr(token_receiver)) {
err_msg = `Invalid receiver FLO address.`; err_msg = `Invalid receiver FLO address.`;
notify(err_msg, 'error'); notify(err_msg, 'error');
hidePopup();
return false; return false;
} }
if (typeof sender_token_balance !== "object") { if (typeof sender_token_balance !== "object") {
err_msg = `Failed to load Sender balance.`; err_msg = `Failed to load Sender balance.`;
notify(err_msg, 'error'); notify(err_msg, 'error');
hidePopup()
return false; return false;
} }
@ -11572,7 +11723,7 @@
return false; return false;
} else { } else {
notify(`Transaction successful: ${flo_txid}`, 'success', true, true); notify(`Transaction successful: ${flo_txid}`, 'success', true, true);
if (payingRequested) { if (payingRequested === true) {
const all_reqs = floDapps.getNextGeneralData(token_app.master_configurations const all_reqs = floDapps.getNextGeneralData(token_app.master_configurations
.TYPE_REQUEST_PAYMENT, "0").reverse(); .TYPE_REQUEST_PAYMENT, "0").reverse();
@ -11582,6 +11733,13 @@
payment_request_status(original_req, 'APPROVED') payment_request_status(original_req, 'APPROVED')
showPayRequests(); showPayRequests();
} else if (payingRequested === false) {
let receiverID = myFloID;
floGlobals.appObjects[token_app.master_configurations.TYPE_SENT_TOKENS][flo_txid] = {
token_sender, token_receiver, token_amount, token_name_radio,
flo_txid, "datetime": + new Date()
};
floCloudAPI.updateObjectData(token_app.master_configurations.TYPE_SENT_TOKENS, options = { receiverID });
} }
hidePopup() hidePopup()
return true; return true;
@ -11602,15 +11760,17 @@
const get_user_rupee_balance = await ajaxGet( const get_user_rupee_balance = await ajaxGet(
'https://ranchimallflo.duckdns.org/api/v1.0/getFloAddressBalance?token=rupee&floAddress=' + 'https://ranchimallflo.duckdns.org/api/v1.0/getFloAddressBalance?token=rupee&floAddress=' +
myFloID) myFloID)
const get_user_unconfirmed_rupee_balance = await get_unconfirmed_balance(myFloID);
const get_user_flo_balance = await floBlockchainAPI.getBalance(myFloID)
console.log(get_user_flo_balance)
if (typeof get_user_rupee_balance === "object" && get_user_rupee_balance.balance >= 0) { if (typeof get_user_rupee_balance === "object" && get_user_rupee_balance.balance >= 0) {
if (get_user_rupee_balance.balance === null) if (get_user_rupee_balance.balance === null)
get_user_rupee_balance.balance = 0; get_user_rupee_balance.balance = 0;
document.querySelectorAll('.token-balance').forEach(bal => bal.textContent = get_user_rupee_balance.balance); document.querySelectorAll('.token-balance').forEach(bal => bal.textContent = get_user_rupee_balance.balance);
} }
const get_user_unconfirmed_rupee_balance = await get_unconfirmed_balance(myFloID, get_user_rupee_balance.balance);
const get_user_flo_balance = await floBlockchainAPI.getBalance(myFloID)
console.log(get_user_flo_balance)
if (typeof get_user_unconfirmed_rupee_balance == "number" && !isNaN(get_user_unconfirmed_rupee_balance)) { if (typeof get_user_unconfirmed_rupee_balance == "number" && !isNaN(get_user_unconfirmed_rupee_balance)) {
document.querySelectorAll('.uncnf-token-balance').forEach(elem => elem.textContent = get_user_unconfirmed_rupee_balance); document.querySelectorAll('.uncnf-token-balance').forEach(elem => elem.textContent = get_user_unconfirmed_rupee_balance);
} }
@ -11754,8 +11914,10 @@
.TYPE_UNCONFIRMED_BALANCE_CLAIM_REQUESTS, "0"); .TYPE_UNCONFIRMED_BALANCE_CLAIM_REQUESTS, "0");
// load processed claims // load processed claims
await floCloudAPI.requestObjectData("processed_unconfirmed_balance_claim_requests", { receiverID:floGlobals.adminID }); const cashiersList = Object.keys(token_app.master_configurations.cashiers);
const processed_unconfirmed_balance_claim_requests_list = floGlobals.appObjects["processed_unconfirmed_balance_claim_requests"]; await floCloudAPI.requestObjectData(token_app.master_configurations.TYPE_PROCESSED_UNCONFIRMED_BALANCE_CLAIM_REQUESTS,
{ receiverID: floGlobals.adminID, senderIDs: cashiersList });
const processed_unconfirmed_balance_claim_requests_list = floGlobals.appObjects[TYPE_PROCESSED_UNCONFIRMED_BALANCE_CLAIM_REQUESTS];
const processed_unconfirmed_balance_claim_requests_txid_arr = Object.keys(processed_unconfirmed_balance_claim_requests_list); const processed_unconfirmed_balance_claim_requests_txid_arr = Object.keys(processed_unconfirmed_balance_claim_requests_list);
console.log(unconfirmed_cash_deposit_claims); console.log(unconfirmed_cash_deposit_claims);
@ -11806,9 +11968,9 @@
if (typeof validate_txid == "object" && validate_txid.result == "ok") { if (typeof validate_txid == "object" && validate_txid.result == "ok") {
// mark as resolved // mark as resolved
subject_req.new_flo_txid = new_txid; subject_req.new_flo_txid = new_txid;
floGlobals.appObjects["processed_unconfirmed_balance_claim_requests"][subject_req.flo_txid] = subject_req; floGlobals.appObjects[TYPE_PROCESSED_UNCONFIRMED_BALANCE_CLAIM_REQUESTS][subject_req.flo_txid] = subject_req;
let receiverID = floGlobals.adminID; let receiverID = floGlobals.adminID;
await floCloudAPI.updateObjectData("processed_unconfirmed_balance_claim_requests", { receiverID }); await floCloudAPI.updateObjectData(TYPE_PROCESSED_UNCONFIRMED_BALANCE_CLAIM_REQUESTS, { receiverID });
notify('Token transfer for unconfirmed desposit successfull. Txid: ' + new_txid); notify('Token transfer for unconfirmed desposit successfull. Txid: ' + new_txid);
} else if (n <= 30) { } else if (n <= 30) {
@ -12054,7 +12216,6 @@
depositActivityContainer.innerHTML = ``; depositActivityContainer.innerHTML = ``;
depositActivityContainer.append(frag) depositActivityContainer.append(frag)
for (usr_withdraws of withdraw_msg) { for (usr_withdraws of withdraw_msg) {
let { let {
token_txid, token_txid,
@ -12159,21 +12320,19 @@
} }
} }
async function show_payment_requests() { async function show_payment_requests(requests_received = true, recvr_id = '') {
try { try {
let options = { receiverID: myFloID };
if (requests_received !== true) {
options = { receiverID: recvr_id, senderIDs: [myFloID] }
}
await Promise.all([ await Promise.all([
floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_REQUEST_PAYMENT, { floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_REQUEST_PAYMENT, options),
receiverID: myFloID floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_REQUEST_PAYMENT_DECLINED, options),
}), floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_REQUEST_PAYMENT_APPROVED, options)
floCloudAPI.requestGeneralData(token_app.master_configurations ]);
.TYPE_REQUEST_PAYMENT_DECLINED, {
receiverID: myFloID
}),
floCloudAPI.requestGeneralData(token_app.master_configurations
.TYPE_REQUEST_PAYMENT_APPROVED, {
receiverID: myFloID
})
])
const general_msg = floDapps.getNextGeneralData(token_app.master_configurations const general_msg = floDapps.getNextGeneralData(token_app.master_configurations
.TYPE_REQUEST_PAYMENT, "0").reverse(), .TYPE_REQUEST_PAYMENT, "0").reverse(),
declined_reqs_list = floDapps.getNextGeneralData(token_app.master_configurations declined_reqs_list = floDapps.getNextGeneralData(token_app.master_configurations
@ -12265,28 +12424,28 @@
} }
} }
async function get_unconfirmed_balance(flo_id='') { async function get_unconfirmed_balance(flo_id = '', token_balance = 0) {
try { try {
let api = `https://ranchimallflo.duckdns.org/api/v1.0/getFloAddressTransactions?floAddress=${flo_id}`; let api = `https://ranchimallflo.duckdns.org/api/v1.0/getFloAddressTransactions?floAddress=${flo_id}`;
let token_balance = await ajaxGet(`https://ranchimallflo.duckdns.org/api/v1.0/getFloAddressBalance?token=rupee&floAddress=${flo_id}`);
token_balance = token_balance.balance;
let tokens_transfers_tx_list = await ajaxGet(api); let tokens_transfers_tx_list = await ajaxGet(api);
tokens_transfers_tx_list = Object.keys(tokens_transfers_tx_list.transactions); tokens_transfers_tx_list = Object.keys(tokens_transfers_tx_list.transactions);
let receiverID = floGlobals.adminID; let receiverID = floGlobals.adminID;
let senderIDs = Object.keys(token_app.master_configurations.cashiers); let senderIDs = Object.keys(token_app.master_configurations.cashiers);
await floCloudAPI.requestObjectData("unconfirmed_rupee_deposits", { receiverID, senderIDs }); await floCloudAPI.requestObjectData(token_app.master_configurations.TYPE_UNCONFIRMED_RUPEE_DEPOSITS,
let unconfirmed_tx_list = Object.keys(floGlobals.appObjects["unconfirmed_rupee_deposits"]); { receiverID, senderIDs });
let unconfirmed_tx_list = Object.keys(floGlobals.appObjects[token_app.master_configurations.TYPE_UNCONFIRMED_RUPEE_DEPOSITS]);
//console.log(unconfirmed_tx_list); //console.log(unconfirmed_tx_list);
//console.log(tokens_transfers_tx_list); //console.log(tokens_transfers_tx_list);
//console.log(token_balance); //console.log(token_balance);
let unconfirmed_balance = 0; let unconfirmed_balance = 0;
for (ut of unconfirmed_tx_list) { for (ut of unconfirmed_tx_list) {
let subject_deposit = floGlobals.appObjects["unconfirmed_rupee_deposits"][ut]; let subject_deposit = floGlobals.appObjects[token_app.master_configurations.TYPE_UNCONFIRMED_RUPEE_DEPOSITS][ut];
if (subject_deposit.receiver_flo_id !== myFloID) continue;
if (tokens_transfers_tx_list.includes(ut)) { if (tokens_transfers_tx_list.includes(ut)) {
// remove this item from unconfirmed_tx_list // remove this item from unconfirmed_tx_list
if (delete subject_deposit) if (delete subject_deposit)
floCloudAPI.updateObjectData("unconfirmed_rupee_deposits", { receiverID }); floCloudAPI.updateObjectData(token_app.master_configurations.TYPE_UNCONFIRMED_RUPEE_DEPOSITS, { receiverID });
} else { } else {
unconfirmed_balance += Number(subject_deposit["tokens_transferred"]); unconfirmed_balance += Number(subject_deposit["tokens_transferred"]);
let dt1 = new Date(subject_deposit["datetime"]); let dt1 = new Date(subject_deposit["datetime"]);
@ -12299,14 +12458,65 @@
receiverID: cashier receiverID: cashier
}); });
subject_deposit["unconfirmed_balance_claimed"] = true; subject_deposit["unconfirmed_balance_claimed"] = true;
floCloudAPI.updateObjectData("unconfirmed_rupee_deposits", { receiverID }); floCloudAPI.updateObjectData(token_app.master_configurations.TYPE_UNCONFIRMED_RUPEE_DEPOSITS, { receiverID });
} }
} }
} }
console.log(token_balance, unconfirmed_balance); console.log(token_balance, unconfirmed_balance);
return unconfirmed_balance; return unconfirmed_balance;
} catch (error) { } catch (error) {
notify('Failed to get rupee balance.', 'error') notify('Failed to get unconfirmed rupee balance.', 'error')
throw new Error(error);
}
}
async function get_sent_rupee_list() {
try {
let senderIDs = [myFloID];
let receiverID = myFloID;
floGlobals.appObjects[token_app.master_configurations.TYPE_SENT_TOKENS][flo_txid] = {
token_sender, token_receiver, token_amount, token_name_radio,
flo_txid, "datetime": + new Date()
};
await floCloudAPI.requestObjectData(token_app.master_configurations.TYPE_SENT_TOKENS,
options = { receiverID, senderIDs });
const sent_tokens_list = Object.keys(floGlobals.appObjects
[token_app.master_configurations.TYPE_SENT_TOKENS]);
console.log(sent_tokens_list);
// #todo: while displying validate senderIDs===myFloID
} catch (error) {
throw new Error(error);
}
}
async function update_my_personal_data(upi_id) {
try {
let senderIDs = [myFloID];
let receiverID = myFloID;
floGlobals.appObjects[token_app.master_configurations.TYPE_MY_PERSONAL_DATA][myFloID] = {
myFloID, "myUPI": upi_id, "last_update": + new Date()
};
await floCloudAPI.requestObjectData(token_app.master_configurations.TYPE_MY_PERSONAL_DATA,
options = { receiverID, senderIDs });
await floCloudAPI.updateObjectData(token_app.master_configurations.TYPE_MY_PERSONAL_DATA,
options = { receiverID, senderIDs });
await floCloudAPI.requestObjectData(token_app.master_configurations.TYPE_MY_PERSONAL_DATA,
options = { receiverID, senderIDs });
const sent_tokens_list = Object.keys(floGlobals.appObjects
[token_app.master_configurations.TYPE_MY_PERSONAL_DATA]);
notify('Personal information updated successfully.')
return sent_tokens_list;
} catch (error) {
throw new Error(error); throw new Error(error);
} }
} }
@ -12412,12 +12622,6 @@
else else
container.innerHTML = `<h4>No complaints available.</h4>` container.innerHTML = `<h4>No complaints available.</h4>`
// Display both this_user_deposit and this_cashier_processed_user_deposit
// side by side and attach button to mark resolved
// After resolving the dispute mark it as resolved
// set onclick event => mark_complaint_resolved(order_type='deposit', input_data={});
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }