This commit is contained in:
sairaj mote 2020-09-30 03:01:16 +05:30
parent 184276fb7c
commit 9c1053769a
5 changed files with 223 additions and 75 deletions

View File

@ -1718,6 +1718,7 @@ smPopup.innerHTML = `
:host{ :host{
position: fixed; position: fixed;
display: grid; display: grid;
z-index: 10;
} }
.popup-container{ .popup-container{
display: grid; display: grid;
@ -1847,21 +1848,21 @@ customElements.define('sm-popup', class extends HTMLElement {
if (this.popupStack.items.length > 1){ if (this.popupStack.items.length > 1){
this.popupStack.items[this.popupStack.items.length - 2].popup.classList.add('stacked') this.popupStack.items[this.popupStack.items.length - 2].popup.classList.add('stacked')
} }
this.dispatchEvent(
new CustomEvent("popupopened", {
bubbles: true,
detail: {
popup: this,
popupStack: this.popupStack
}
})
)
this.setAttribute('open', '')
this.pinned = pinned
this.popupContainer.classList.remove('hide')
} }
this.setAttribute('open', '')
this.pinned = pinned
this.popupContainer.classList.remove('hide')
this.popup.style.transform = 'translateY(0)'; this.popup.style.transform = 'translateY(0)';
document.body.setAttribute('style', `overflow: hidden; top: -${window.scrollY}px`) document.body.setAttribute('style', `overflow: hidden; top: -${window.scrollY}px`)
this.dispatchEvent(
new CustomEvent("popupopened", {
bubbles: true,
detail: {
popup: this,
popupStack: this.popupStack
}
})
)
return this.popupStack return this.popupStack
} }
hide = () => { hide = () => {
@ -1930,7 +1931,12 @@ customElements.define('sm-popup', class extends HTMLElement {
this.popup.style.transition = 'transform 0.3s' this.popup.style.transition = 'transform 0.3s'
if (this.touchEndTime - this.touchStartTime > 200) { if (this.touchEndTime - this.touchStartTime > 200) {
if (this.touchEndY - this.touchStartY > this.threshold) { if (this.touchEndY - this.touchStartY > this.threshold) {
this.hide() if (this.pinned) {
this.show()
return
}
else
this.hide()
} }
else { else {
this.show() this.show()
@ -1938,6 +1944,11 @@ customElements.define('sm-popup', class extends HTMLElement {
} }
else { else {
if (this.touchEndY > this.touchStartY) if (this.touchEndY > this.touchStartY)
if (this.pinned) {
this.show()
return
}
else
this.hide() this.hide()
} }
} }
@ -1965,7 +1976,12 @@ customElements.define('sm-popup', class extends HTMLElement {
this.show() this.show()
this.popupContainer.addEventListener('mousedown', e => { this.popupContainer.addEventListener('mousedown', e => {
if (e.target === this.popupContainer && !this.pinned) { if (e.target === this.popupContainer && !this.pinned) {
this.hide() if (this.pinned) {
this.show()
return
}
else
this.hide()
} }
}) })

View File

@ -15,7 +15,7 @@ body {
--text-color-light: 85, 85, 85; --text-color-light: 85, 85, 85;
--foreground-color: 255, 255, 255; --foreground-color: 255, 255, 255;
--background-color: rgba(var(--foreground-color), 1); --background-color: rgba(var(--foreground-color), 1);
--dark-shade: #dadada; --dark-shade: #f4f4f4;
--hue: 255; --hue: 255;
--saturation: 61%; --saturation: 61%;
--lightness: 39%; --lightness: 39%;
@ -455,6 +455,9 @@ details p {
line-height: 1.4; line-height: 1.4;
} }
#sign_in_popup::part(background) {
background: rgba(var(--foreground-color), 1);
}
#sign_in_popup h3 { #sign_in_popup h3 {
margin-top: 2rem; margin-top: 2rem;
} }
@ -737,10 +740,12 @@ details p {
sm-tab-header { sm-tab-header {
position: sticky; position: sticky;
top: 0; top: 0;
background: var(--background-color); display: inline-flex;
background-color: var(--dark-shade);
z-index: 2; z-index: 2;
padding: 1rem 0; padding: 0.3rem;
margin-bottom: 1rem; margin: 1rem 0;
border-radius: 3rem;
} }
sm-tab { sm-tab {
@ -1016,6 +1021,9 @@ sm-panel {
background-position-y: -3rem; background-position-y: -3rem;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
#transaction_result #transaction_heading {
margin-bottom: 2rem;
}
#transaction_result .copy-row { #transaction_result .copy-row {
grid-template-areas: "label label" ". ."; grid-template-areas: "label label" ". .";
margin-top: 1rem; margin-top: 1rem;
@ -1036,6 +1044,10 @@ sm-panel {
margin-top: 6rem; margin-top: 6rem;
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
} }
#transaction_result sm-button {
align-self: center;
width: auto;
}
#success_svg, #failure_svg { #success_svg, #failure_svg {
height: 5rem; height: 5rem;
@ -1118,6 +1130,12 @@ sm-panel {
font-weight: 500; font-weight: 500;
} }
.back-arrow {
stroke-width: 10;
margin-right: 0.5rem;
padding: 0.2rem;
}
.select { .select {
max-width: 50ch; max-width: 50ch;
position: relative; position: relative;
@ -1194,6 +1212,22 @@ sm-panel {
width: max-content; width: max-content;
} }
#transaction_page .grid:first-of-type {
padding: 0.5rem 0;
grid-template-columns: auto 1fr;
grid-template-areas: "back ." "back .";
}
#transaction_page .grid:first-of-type .back-arrow {
grid-area: back;
}
#transaction_page .grid:first-of-type h4 {
text-transform: capitalize;
}
#transaction_page .grid:first-of-type h5 {
font-weight: 400;
font-family: "Roboto", sans-serif;
}
#activity_page .empty-state, #activity_page .empty-state,
#request_page .empty-state, #request_page .empty-state,
#settings_page .empty-state { #settings_page .empty-state {
@ -1229,6 +1263,10 @@ sm-panel {
.hide-on-mobile { .hide-on-mobile {
display: none !important; display: none !important;
} }
#transaction_page {
padding-top: 0;
}
} }
@media only screen and (min-width: 640px) { @media only screen and (min-width: 640px) {
.hide-on-desktop { .hide-on-desktop {

2
css/main.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -15,7 +15,7 @@ body {
--text-color-light: 85, 85, 85; --text-color-light: 85, 85, 85;
--foreground-color: 255, 255, 255; --foreground-color: 255, 255, 255;
--background-color: rgba(var(--foreground-color), 1); --background-color: rgba(var(--foreground-color), 1);
--dark-shade: #dadada; --dark-shade: #f4f4f4;
--hue: 255; --hue: 255;
--saturation: 61%; --saturation: 61%;
--lightness: 39%; --lightness: 39%;
@ -474,6 +474,9 @@ details{
} }
#sign_in_popup { #sign_in_popup {
&::part(background){
background: rgba(var(--foreground-color), 1);
}
h3 { h3 {
margin-top: 2rem; margin-top: 2rem;
} }
@ -550,7 +553,6 @@ details{
stroke: rgba(var(--text-color), 1); stroke: rgba(var(--text-color), 1);
} }
} }
.active{ .active{
opacity: 1; opacity: 1;
} }
@ -764,10 +766,12 @@ details{
sm-tab-header { sm-tab-header {
position: sticky; position: sticky;
top: 0; top: 0;
background: var(--background-color); display: inline-flex;
background-color: var(--dark-shade);
z-index: 2; z-index: 2;
padding: 1rem 0; padding: 0.3rem;
margin-bottom: 1rem; margin: 1rem 0;
border-radius: 3rem;
} }
sm-tab{ sm-tab{
text-transform: capitalize; text-transform: capitalize;
@ -1076,6 +1080,9 @@ sm-panel{
background-position-y: -3rem; background-position-y: -3rem;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
#transaction_heading{
margin-bottom: 2rem;
}
.copy-row{ .copy-row{
grid-template-areas: 'label label' '. .'; grid-template-areas: 'label label' '. .';
margin-top: 1rem; margin-top: 1rem;
@ -1096,6 +1103,10 @@ sm-panel{
margin-top: 6rem; margin-top: 6rem;
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
} }
sm-button{
align-self: center;
width: auto;
}
} }
#success_svg, #failure_svg{ #success_svg, #failure_svg{
height: 5rem; height: 5rem;
@ -1180,6 +1191,11 @@ sm-panel{
font-weight: 500; font-weight: 500;
} }
} }
.back-arrow{
stroke-width: 10;
margin-right: 0.5rem;
padding: 0.2rem;
}
.select{ .select{
max-width: 50ch; max-width: 50ch;
position: relative; position: relative;
@ -1254,6 +1270,25 @@ sm-panel{
justify-self: flex-start; justify-self: flex-start;
width: max-content; width: max-content;
} }
#transaction_page{
.grid:first-of-type{
padding: 0.5rem 0;
grid-template-columns: auto 1fr;
grid-template-areas: 'back .' 'back .';
.back-arrow{
grid-area: back;
}
h4{
text-transform: capitalize;
}
h5{
font-weight: 400;
font-family: 'Roboto', sans-serif;
}
}
}
#activity_page, #activity_page,
#request_page, #request_page,
#settings_page{ #settings_page{
@ -1289,6 +1324,9 @@ sm-panel{
.hide-on-mobile{ .hide-on-mobile{
display: none !important; display: none !important;
} }
#transaction_page{
padding-top: 0;
}
} }
@media only screen and (min-width: 640px) { @media only screen and (min-width: 640px) {

View File

@ -38,7 +38,7 @@
<title>Loader</title> <title>Loader</title>
<path d="M72.5,36.5c0,19.88-16.12,36-36,36s-36-16.12-36-36s16.12-36,36-36S72.5,16.62,72.5,36.5" /> <path d="M72.5,36.5c0,19.88-16.12,36-36,36s-36-16.12-36-36s16.12-36,36-36S72.5,16.62,72.5,36.5" />
</svg> </svg>
<h4 id="tip_container">Loading Blockchain UPI </h4> <h4 id="tip_container">Loading RanchiMall Pay</h4>
<sm-button onclick="signOut()">Sign Out</sm-button> <sm-button onclick="signOut()">Sign Out</sm-button>
</section> </section>
<!-- Sign in popup--> <!-- Sign in popup-->
@ -46,7 +46,7 @@
<div class="container-header"> <div class="container-header">
<h3>Sign In</h3> <h3>Sign In</h3>
</div> </div>
<h4 class="expand light-text">Welcome to RanchiMall Blockchain UPI.<br>Please enter your FLO private key to <h4 class="expand light-text">Welcome to RanchiMall Pay.<br>Please enter your FLO private key to
continue.</h4> continue.</h4>
<sm-input id="get_priv_key_field" placeholder="Private Key" type="password" required animate></sm-input> <sm-input id="get_priv_key_field" placeholder="Private Key" type="password" required animate></sm-input>
<button id="sign_in_btn" class="primary-btn expand" type="submit" disabled> <button id="sign_in_btn" class="primary-btn expand" type="submit" disabled>
@ -90,7 +90,7 @@
<path d="M51.65,8H42.07A18.44,18.44,0,0,1,45,15.78h8.88l-2.2,8H45q-1,7.26-5.8,11.1T25.54,39.47L46,63.43V64H33.41L11,37.93l0-6.72H22.11a13.19,13.19,0,0,0,7.8-2.05,9.77,9.77,0,0,0,3.85-5.38H10.11l2.24-8H33.58Q31.44,9,21.93,9H10.11l2.37-9H53.89Z"/> <path d="M51.65,8H42.07A18.44,18.44,0,0,1,45,15.78h8.88l-2.2,8H45q-1,7.26-5.8,11.1T25.54,39.47L46,63.43V64H33.41L11,37.93l0-6.72H22.11a13.19,13.19,0,0,0,7.8-2.05,9.77,9.77,0,0,0,3.85-5.38H10.11l2.24-8H33.58Q31.44,9,21.93,9H10.11l2.37-9H53.89Z"/>
</svg> </svg>
</sm-input> </sm-input>
<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 address" 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">
@ -208,7 +208,7 @@
</button> </button>
</header> </header>
<p> <p>
Request Rupee from other's using FLO address. Request rupee from other's using FLO address.
</p> </p>
<details> <details>
<summary> <summary>
@ -217,7 +217,7 @@
<h5>Step 1</h5> <h5>Step 1</h5>
<p>Enter amount you want to request</p> <p>Enter amount you want to request</p>
<h5>Step 2</h5> <h5>Step 2</h5>
<p>Enter the FLO ID of person you want to request rupee from.</p> <p>Enter the FLO address of person you want to request rupee from.</p>
<h5>Step 3</h5> <h5>Step 3</h5>
<p>Press <strong>Request</strong> button</p> <p>Press <strong>Request</strong> button</p>
</details> </details>
@ -255,6 +255,23 @@
sent as Rupee. sent as Rupee.
</p> </p>
</details> </details>
<details>
<summary>
How to pay through cashier?
</summary>
<h5>Step 1</h5>
<p>Copy UPI address shown below.</p>
<h5>Step 2</h5>
<p>Open any UPI app of your preference and send money to copied UPI address. <strong>(Do not close this browser)</strong></p>
<h5>Step 3</h5>
<p>Enter the amount you sent to copied address</p>
<h5>Step 4</h5>
<p>Then enter the FLO address of person you want send rupee to.</p>
<h5>Step 5</h5>
<p>Select UPI address that you used when sending money copied UPI address. <strong>If you haven't added UPI address, add one using 'Add UPI address' button.</strong></p>
<h5>Step 6</h5>
<p>Press <strong>Pay</strong> button</p>
</details>
<p class="message">Send money to UPI ID below.</p> <p class="message">Send money to UPI ID below.</p>
<div class="copy-row"> <div class="copy-row">
<h4 id="pay_cashier_info" class="copy"></h4> <h4 id="pay_cashier_info" class="copy"></h4>
@ -270,7 +287,7 @@
<path d="M51.65,8H42.07A18.44,18.44,0,0,1,45,15.78h8.88l-2.2,8H45q-1,7.26-5.8,11.1T25.54,39.47L46,63.43V64H33.41L11,37.93l0-6.72H22.11a13.19,13.19,0,0,0,7.8-2.05,9.77,9.77,0,0,0,3.85-5.38H10.11l2.24-8H33.58Q31.44,9,21.93,9H10.11l2.37-9H53.89Z"/> <path d="M51.65,8H42.07A18.44,18.44,0,0,1,45,15.78h8.88l-2.2,8H45q-1,7.26-5.8,11.1T25.54,39.47L46,63.43V64H33.41L11,37.93l0-6.72H22.11a13.19,13.19,0,0,0,7.8-2.05,9.77,9.77,0,0,0,3.85-5.38H10.11l2.24-8H33.58Q31.44,9,21.93,9H10.11l2.37-9H53.89Z"/>
</svg> </svg>
</sm-input> </sm-input>
<sm-input floId id="recvr_id" placeholder="Reciever's FLO ID" required animate></sm-input> <sm-input floId id="recvr_id" placeholder="Reciever's FLO address" required animate></sm-input>
<h5>Send from</h5> <h5>Send from</h5>
<div class="upi-container"></div> <div class="upi-container"></div>
<sm-button class="add-upi empty-state" variant="no-outline" onclick="showPopup('add_upi_popup')">+ Add UPI address</sm-button> <sm-button class="add-upi empty-state" variant="no-outline" onclick="showPopup('add_upi_popup')">+ Add UPI address</sm-button>
@ -309,6 +326,7 @@
<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-button class="round" variant="outlined" onclick="this.closest('sm-popup').hide()">Done</sm-button>
</sm-popup> </sm-popup>
<sm-popup id="add_upi_popup"> <sm-popup id="add_upi_popup">
<header class="popup-header" slot="header"> <header class="popup-header" slot="header">
@ -365,7 +383,7 @@
<h4>RanchiMall Pay</h4> <h4>RanchiMall Pay</h4>
</div> </div>
<div title="homepage" id="home_page_btn" class="user-option navbar-item active" <div title="homepage" id="home_page_btn" class="user-option navbar-item active"
onclick="showPage(this, 'home_page')"> onclick="showPage('home_page', this)">
<svg class="icon" viewBox="0 0 64 64"> <svg class="icon" viewBox="0 0 64 64">
<path <path
d="M24.77,44.15H40.06V63.5H53.4V36h5.66a3.38,3.38,0,0,0,2.53-5.68l-6.73-7.16V11.26H46.48v3L34.53,1.59a3.49,3.49,0,0,0-5.06,0L2.41,30.35A3.38,3.38,0,0,0,4.94,36H10.6V63.5H24.77" /> d="M24.77,44.15H40.06V63.5H53.4V36h5.66a3.38,3.38,0,0,0,2.53-5.68l-6.73-7.16V11.26H46.48v3L34.53,1.59a3.49,3.49,0,0,0-5.06,0L2.41,30.35A3.38,3.38,0,0,0,4.94,36H10.6V63.5H24.77" />
@ -373,21 +391,21 @@
<h5>Home</h5> <h5>Home</h5>
</div> </div>
<div title="See all cash deposit requests" id="deposit_page_btn" <div title="See all cash deposit requests" id="deposit_page_btn"
class="navbar-item cashier-option hide-completely" onclick="showPage(this, 'deposit')"> class="navbar-item cashier-option hide-completely" onclick="showPage('deposit', this)">
<svg class="icon" viewBox="0 0 64 64"> <svg class="icon" viewBox="0 0 64 64">
<path <path
d="M24.77,44.15H40.06V63.5H53.4V36h5.66a3.38,3.38,0,0,0,2.53-5.68l-6.73-7.16V11.26H46.48v3L34.53,1.59a3.49,3.49,0,0,0-5.06,0L2.41,30.35A3.38,3.38,0,0,0,4.94,36H10.6V63.5H24.77" /> d="M24.77,44.15H40.06V63.5H53.4V36h5.66a3.38,3.38,0,0,0,2.53-5.68l-6.73-7.16V11.26H46.48v3L34.53,1.59a3.49,3.49,0,0,0-5.06,0L2.41,30.35A3.38,3.38,0,0,0,4.94,36H10.6V63.5H24.77" />
</svg> </svg>
<h5>Home</h5> <h5>Home</h5>
</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('request_page', this)">
<svg class="icon request-icon" viewBox="0 0 64 64"> <svg class="icon request-icon" viewBox="0 0 64 64">
<path <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" /> 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>
<div title="activity page" class="navbar-item user-option" onclick="showPage(this, 'activity_page')"> <div title="activity page" id="activity_page_btn" class="navbar-item user-option" onclick="showPage('activity_page', this)">
<svg class="icon" viewBox="0 0 64 64"> <svg class="icon" viewBox="0 0 64 64">
<path <path
d="M60.38,1,32.8,33.23a1.77,1.77,0,0,0,1.34,2.92h9.63a.79.79,0,0,1,.71,1.13L33,61.36A1.49,1.49,0,0,0,35.49,63l27.58-32.2a1.77,1.77,0,0,0-1.34-2.92H52.1a.79.79,0,0,1-.71-1.13L62.85,2.64A1.49,1.49,0,0,0,60.38,1Z" /> d="M60.38,1,32.8,33.23a1.77,1.77,0,0,0,1.34,2.92h9.63a.79.79,0,0,1,.71,1.13L33,61.36A1.49,1.49,0,0,0,35.49,63l27.58-32.2a1.77,1.77,0,0,0-1.34-2.92H52.1a.79.79,0,0,1-.71-1.13L62.85,2.64A1.49,1.49,0,0,0,60.38,1Z" />
@ -398,7 +416,7 @@
<h5>Activity</h5> <h5>Activity</h5>
</div> </div>
<div title="helpline page" class="navbar-item helpline-option" id="helpline_page_btn" <div title="helpline page" class="navbar-item helpline-option" id="helpline_page_btn"
onclick="showPage(this, 'helpline_page')"> onclick="showPage('helpline_page', this)">
<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
@ -410,7 +428,7 @@
</svg> </svg>
<h5>Complaints</h5> <h5>Complaints</h5>
</div> </div>
<div title="profile page" class="navbar-item" onclick="showPage(this, 'settings_page')"> <div title="profile page" class="navbar-item" onclick="showPage('settings_page', this)">
<svg viewBox="0 0 64 64" class="icon"> <svg viewBox="0 0 64 64" class="icon">
<path d="M31.6,0.5c8.3,0,14.2,5.6,14.2,15S41.1,32.9,32,32.9s-13.8-8-13.8-17.3s5.9-15,14.2-15"/> <path d="M31.6,0.5c8.3,0,14.2,5.6,14.2,15S41.1,32.9,32,32.9s-13.8-8-13.8-17.3s5.9-15,14.2-15"/>
<path d="M25.4,33.4c-2.5,4.7-10.5,7.1-16.4,9.7c-2.4,1-4.4,14-1.6,14c7.7,4.4,16.4,6.6,25.2,6.4 <path d="M25.4,33.4c-2.5,4.7-10.5,7.1-16.4,9.7c-2.4,1-4.4,14-1.6,14c7.7,4.4,16.4,6.6,25.2,6.4
@ -741,8 +759,6 @@
</section> </section>
<section id="activity_page" class="page"> <section id="activity_page" class="page">
<h3>Activity</h3> <h3>Activity</h3>
<p class="bottom-margin">*If your request isn't completed in 12hrs, use <strong>REPORT</strong> to get
assistance from our helpline.</p>
<sm-tab-header variant="tab" class="round" target="user_activities"> <sm-tab-header variant="tab" class="round" target="user_activities">
<sm-tab>Sent</sm-tab> <sm-tab>Sent</sm-tab>
<sm-tab>Deposits</sm-tab> <sm-tab>Deposits</sm-tab>
@ -802,7 +818,7 @@
<section id="settings_page" class="page hide-completely"> <section id="settings_page" class="page hide-completely">
<h3 class="bottom-margin">Settings<h3> <h3 class="bottom-margin">Settings<h3>
<section> <section>
<h4>My FLO ID</h4> <h4>My FLO address</h4>
<div class="copy-row"> <div class="copy-row">
<h4 class="user-flo-id copy"></h4> <h4 class="user-flo-id copy"></h4>
<svg class="icon" onclick="copyToClipboard(this.parentNode)" viewBox="0 0 64 64"> <svg class="icon" onclick="copyToClipboard(this.parentNode)" viewBox="0 0 64 64">
@ -821,8 +837,15 @@
<sm-button variant="primary" onclick="signOut()">Sign out</sm-button> <sm-button variant="primary" onclick="signOut()">Sign out</sm-button>
</section> </section>
<section id="transaction_page" class="page"> <section id="transaction_page" class="page">
<h3 class="bottom-margin">Transaction</h3> <div class="grid align-center">
<svg class="icon back-arrow" onclick="showPage('activity_page', 'activity_page_btn')" viewBox="0 0 64 64">
<title>Go to activity page</title>
<polyline points="48.01 0.35 16.35 32 48.01 63.65"/>
</svg>
<h4 id="transaction_type">Transaction</h4>
<h5 id="transaction_time">1pm sep 29 2020</h5>
</div>
<sm-button id="report_btn" variant="outlined">Report</div>
</section> </section>
</main> </main>
<script src="components.js"></script> <script src="components.js"></script>
@ -886,7 +909,7 @@
'data-user-flo-id': floId, 'data-user-flo-id': floId,
'data-txid': txid 'data-txid': txid
}) })
card.innerHTML = ` <h5>FLO ID</h5> card.innerHTML = ` <h5>FLO address</h5>
<h4 class="breakable">${floId}</h4> <h4 class="breakable">${floId}</h4>
<h5>UPI TXID</h5> <h5>UPI TXID</h5>
<h4 class="breakable">${txid}</h4> <h4 class="breakable">${txid}</h4>
@ -903,7 +926,7 @@
'data-user-flo-id': floId, 'data-user-flo-id': floId,
'data-upi': upiId 'data-upi': upiId
}) })
card.innerHTML = ` <h5>FLO ID</h5> card.innerHTML = ` <h5>FLO address</h5>
<h4 class="breakable">${floId}</h4> <h4 class="breakable">${floId}</h4>
<h5>UPI ID</h5> <h5>UPI ID</h5>
<h3 class="breakable">${upiId}</h3> <h3 class="breakable">${upiId}</h3>
@ -925,7 +948,7 @@
}) })
card.innerHTML = ` <h5>Transaction ID</h5> card.innerHTML = ` <h5>Transaction ID</h5>
<h4 class="breakable">${txid}</h4> <h4 class="breakable">${txid}</h4>
<h5>Receiver's FLO ID</h5> <h5>Receiver's FLO address</h5>
<h4 class="breakable">${floId}</h4> <h4 class="breakable">${floId}</h4>
<h5>Amount</h5> <h5>Amount</h5>
<h4 class="breakable">₹${amount}</h4> <h4 class="breakable">₹${amount}</h4>
@ -943,6 +966,7 @@
transaction, transaction,
className className
card.classList.add('activity') card.classList.add('activity')
setAttributes(card, {'data-type': type, 'data-vector-clock': timeStamp})
switch(type){ switch(type){
case 'sent': case 'sent':
icon = ` icon = `
@ -1333,11 +1357,11 @@
let popupStack = new Stack(), let popupStack = new Stack(),
zIndex = 10; zIndex = 10;
function showPopup(popup, permission) { function showPopup(popup, pinned) {
let thisPopup = document.getElementById(popup); let thisPopup = document.getElementById(popup);
zIndex++ zIndex++
thisPopup.setAttribute('style', `z-index: ${zIndex}`) thisPopup.setAttribute('style', `z-index: ${zIndex}`)
popupStack = thisPopup.show(permission, popupStack) popupStack = thisPopup.show(pinned, popupStack)
return thisPopup; return thisPopup;
} }
@ -1647,9 +1671,9 @@
let currentRequest = null; let currentRequest = null;
document.getElementById('activity_page').addEventListener('click', (e) => { document.getElementById('activity_page').addEventListener('click', (e) => {
if (e.target.closest('.report')) { if (e.target.closest('.activity')) {
showPopup('report_popup') currentRequest = e.target.closest('.activity')
currentRequest = e.target.closest('.request') showTransactionDetails({type: currentRequest.dataset.type, timeStamp: currentRequest.dataset.vectorClock})
} }
}) })
// Function for reporting complain // Function for reporting complain
@ -1657,7 +1681,7 @@
let customMsg = document.getElementById('complaint_field').value let customMsg = document.getElementById('complaint_field').value
if (await confirmation( if (await confirmation(
'It may take upto 12hrs to complete your request, are you sure to report this issue?', 'It may take upto 12hrs to complete your request, are you sure to report this issue?',
'Cancel', 'Report' 'No', 'Report'
)) { )) {
file_complaint(currentRequest.dataset.type, currentRequest.dataset.vectorClock, file_complaint(currentRequest.dataset.type, currentRequest.dataset.vectorClock,
customMsg) customMsg)
@ -1740,7 +1764,7 @@
transactionHeading = document.getElementById('transaction_heading'), transactionHeading = document.getElementById('transaction_heading'),
transactionMessage = document.getElementById('transaction_message') transactionMessage = document.getElementById('transaction_message')
function showTrasactionStatus(status, heading, message, transactionId){ function showTransactionStatus(status, heading, message, transactionId){
transactionHeading.textContent = heading transactionHeading.textContent = heading
transactionMessage.innerHTML = message transactionMessage.innerHTML = message
transactionSuccessId.textContent = transactionId transactionSuccessId.textContent = transactionId
@ -1757,21 +1781,47 @@
showPopup('transaction_result') showPopup('transaction_result')
} }
const transactionPage = document.getElementById('transaction_page'),
transactionType = document.getElementById('transaction_type'),
transactionTime = document.getElementById('transaction_time')
function showTransactionDetails(obj){
let {type, timeStamp, } = obj;
if(type === 'payCashier')
type = 'Pay through cashier'
transactionType.textContent = type
transactionTime.textContent = formatedTime(timeStamp)
showPage('transaction_page')
}
let allPages = document.querySelectorAll('.page'), let allPages = document.querySelectorAll('.page'),
allTabs = document.querySelectorAll('.navbar-item'); allTabs = document.querySelectorAll('.navbar-item');
function showPage(btn, page) { function showPage(page, btn) {
allPages.forEach((page) => { allPages.forEach((page) => {
page.classList.add('hide-completely') page.classList.add('hide-completely')
}) })
allTabs.forEach((tab) => { allTabs.forEach((tab) => {
tab.classList.remove('active') tab.classList.remove('active')
}) })
if(btn){
if(typeof btn === 'string')
btn = document.getElementById(btn)
btn.classList.add('active', 'shrink')
}
document.getElementById(page).classList.remove('hide-completely') document.getElementById(page).classList.remove('hide-completely')
btn.classList.add('active', 'shrink')
if (page === 'request_page') { if (page === 'request_page') {
show_payment_requests() show_payment_requests()
} }
if(page === 'transaction_page'){
document.getElementById('navbar').classList.add('hide-on-mobile')
document.getElementById('main_header').classList.add('hide-on-mobile')
}
else{
document.getElementById('navbar').classList.remove('hide-on-mobile')
document.getElementById('main_header').classList.remove('hide-on-mobile')
}
} }
const addUpiInput = document.getElementById('add_upi_input') const addUpiInput = document.getElementById('add_upi_input')
@ -1844,7 +1894,7 @@
function signIn() { function signIn() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
hideLoader() hideLoader()
showPopup('sign_in_popup', 'no') showPopup('sign_in_popup', true)
let signInBtn = document.getElementById('sign_in_btn'), let signInBtn = document.getElementById('sign_in_btn'),
privateKeyInput = document.getElementById('get_priv_key_field') privateKeyInput = document.getElementById('get_priv_key_field')
signInBtn.onclick = () => { signInBtn.onclick = () => {
@ -11338,6 +11388,9 @@
{ {
"FCja6sLv58e3RMy41T5AmWyvXEWesqBCkX": { "FCja6sLv58e3RMy41T5AmWyvXEWesqBCkX": {
"upi_id": "8507742774@ybl" "upi_id": "8507742774@ybl"
},
"FPFeL5PXzW9bGosUjQYCxTHSMHidnygvvd": {
"upi_id": "7744023898@paytm"
} }
}` }`
/* /*
@ -11459,7 +11512,7 @@
show_withdraw_request() show_withdraw_request()
showPayRequests() showPayRequests()
userType.forEach(user => user.textContent = 'Cashier') userType.forEach(user => user.textContent = 'Cashier')
showPage(document.getElementById('deposit_page_btn'), 'deposit') showPage('deposit', 'deposit_page_btn')
} }
//Helpline startup sequence //Helpline startup sequence
@ -11482,7 +11535,7 @@
await Promise.all([load_deposit_complaints(cashierSelect.value), load_withdraw_complaints( await Promise.all([load_deposit_complaints(cashierSelect.value), load_withdraw_complaints(
cashierSelect.value), load_pay_thru_cashier_complaints(cashierSelect.value)]) cashierSelect.value), load_pay_thru_cashier_complaints(cashierSelect.value)])
userType.forEach(user => user.textContent = 'Cashier') userType.forEach(user => user.textContent = 'Cashier')
showPage(document.getElementById('helpline_page_btn'), 'helpline_page') showPage('helpline_page', 'helpline_page_btn')
} }
//user startup sequence //user startup sequence
@ -11499,7 +11552,7 @@
userType.forEach(user => user.textContent = 'User') userType.forEach(user => user.textContent = 'User')
show_all_user_activities() show_all_user_activities()
show_payment_requests() show_payment_requests()
showPage(document.getElementById('home_page_btn'), 'transaction_page') showPage('home_page', 'home_page_btn')
withdraw_token_to_get_cash(); withdraw_token_to_get_cash();
@ -11931,11 +11984,14 @@
flo_comment) flo_comment)
console.log(flo_txid); console.log(flo_txid);
if (typeof flo_txid !== "string") { if (typeof flo_txid !== "string") {
showTrasactionStatus('failure', `Transaction failed.`); showTransactionStatus('failure', `Transaction failed.`);
hidePopup() hidePopup()
return false; return false;
} else { } else {
showTrasactionStatus('success', 'Rupee Sent', 'It may take upto 48 working hours for transaction to be completed.', flo_txid); hidePopup()
showTransactionStatus('success', 'Rupee Sent', 'It may take upto 48 working hours for transaction to be completed.', flo_txid);
sentActivityContainer.prepend(render.activityCard({type: 'sent', amount: token_amount, timeStamp: `${Date.now()}_${myFloID}`, token_txid: flo_txid, receiver: token_receiver}))
refresh_balance()
if (payingRequested === true) { if (payingRequested === true) {
const all_reqs = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations const all_reqs = removeDuplicates(floDapps.getNextGeneralData(token_app.master_configurations
.TYPE_REQUEST_PAYMENT, "0").reverse()); .TYPE_REQUEST_PAYMENT, "0").reverse());
@ -11954,7 +12010,6 @@
}; };
floCloudAPI.updateObjectData(token_app.master_configurations.TYPE_SENT_TOKENS, options = { receiverID }); floCloudAPI.updateObjectData(token_app.master_configurations.TYPE_SENT_TOKENS, options = { receiverID });
} }
hidePopup()
return true; return true;
} }
} }
@ -12255,12 +12310,12 @@
receiverID: cashier receiverID: cashier
}).then(result => { }).then(result => {
hidePopup() hidePopup()
showTrasactionStatus('success', 'Deposit request sent.', 'It may take upto 48 hours for deposited amount to be reflected in your account.') showTransactionStatus('success', 'Deposit request sent.', 'It may take upto 48 hours for deposited amount to be reflected in your account.')
btnLoading('request_tokens_btn', 'stop') btnLoading('request_tokens_btn', 'stop')
depositActivityContainer.prepend(render.activityCard({type: 'deposit', amount: request_object.deposit_amount, timeStamp: `${Date.now()}_${myFloID}}`, upi_txid}))
}) })
return true; return true;
} }
hidePopup()
return false; return false;
} }
} catch (error) { } catch (error) {
@ -12288,15 +12343,14 @@
const user_token_balance_object = await ajaxGet(token_balance_url); const user_token_balance_object = await ajaxGet(token_balance_url);
if (typeof user_token_balance_object !== "object" || typeof user_token_balance_object if (typeof user_token_balance_object !== "object" || typeof user_token_balance_object
.balance !== "number") { .balance !== "number") {
notify('You do not have rupee balance yet. Please deposit rupee to get balance.', showTransactionStatus('failure', 'Insufficient Balance', `You don't have any balance`)
'error');
hidePopup() hidePopup()
return; return;
} }
const current_balance = Number(user_token_balance_object.balance); const current_balance = Number(user_token_balance_object.balance);
if (current_balance < withdraw_cash_amount) { if (current_balance < withdraw_cash_amount) {
hidePopup() hidePopup()
showTrasactionStatus('failure', 'Insufficient Balance', `You have only ₹${user_token_balance_object.balance} balance`) showTransactionStatus('failure', 'Insufficient Balance', `You have only ₹${user_token_balance_object.balance} balance`)
return; return;
} }
@ -12306,7 +12360,7 @@
console.log(flo_txid); console.log(flo_txid);
if (typeof flo_txid !== "string") { if (typeof flo_txid !== "string") {
hidePopup() hidePopup()
showTrasactionStatus('failure', 'Withdrawal failed') showTransactionStatus('failure', 'Withdrawal failed')
return false; return false;
} }
// TODO: Validate https://ranchimallflo.duckdns.org/api/v1.0/getTransactionDetails/${flo_txid} // TODO: Validate https://ranchimallflo.duckdns.org/api/v1.0/getTransactionDetails/${flo_txid}
@ -12325,10 +12379,11 @@
receiverID: cashier receiverID: cashier
}); });
hidePopup() hidePopup()
showTrasactionStatus('success', 'Withdraw request sent.', 'It may take upto 48 working hours to process your withdrawal request.') showTransactionStatus('success', 'Withdraw request sent.', 'It may take upto 48 working hours to process your withdrawal request.')
withdrawActivityContainer.prepend(render.activityCard({type: 'withdraw', amount: withdraw_cash_amount, timeStamp: `${Date.now()}_${myFloID}`, token_txid: flo_txid, receiver: user_withdraw_upi}))
return true; return true;
} }
showTrasactionStatus('failure', 'Failed to send withdraw request.'); showTransactionStatus('failure', 'Failed to send withdraw request.');
return true; return true;
} }
@ -12376,9 +12431,10 @@
}); });
hidePopup() hidePopup()
showTrasactionStatus('success', 'Pay through cashier Request sent.', `Sent to: <b class="breakable">${recvr_id}</b><br> showTransactionStatus('success', 'Pay through cashier Request sent.', `Sent to: <b class="breakable">${recvr_id}</b><br>
through cashier UPI: <b>${cashier_upi}</b>.<br><br> through cashier UPI: <b>${cashier_upi}</b>.<br><br>
Once the cashier receives your payment, they will transfer it to intended receiver.`); Once the cashier receives your payment, they will transfer it to intended receiver.`);
payCashierActivityContainer.prepend(render.activityCard({type: 'payCashier', amount: amount_to_pay, timeStamp: `${Date.now()}_${myFloID}`, receiver: recvr_id, upi_txid: req_object.upi_txid}))
} }
} catch (error) { } catch (error) {
@ -12386,10 +12442,11 @@
} }
} }
const depositActivityContainer = document.getElementById('deposit_activity_container'), const sentActivityContainer = document.getElementById('sent_activity_container'),
withdrawActivityContainer = document.getElementById('withdraw_activity_container'), depositActivityContainer = document.getElementById('deposit_activity_container'),
payCashierActivityContainer = document.getElementById('pay_cashier_activity_container'), withdrawActivityContainer = document.getElementById('withdraw_activity_container'),
cashierMessageContainer = document.getElementById('cashier_message_container') payCashierActivityContainer = document.getElementById('pay_cashier_activity_container'),
cashierMessageContainer = document.getElementById('cashier_message_container')
async function show_all_user_activities() { async function show_all_user_activities() {
try { try {
@ -12594,9 +12651,8 @@
floCloudAPI.sendGeneralData(request_object, token_app.master_configurations.TYPE_REQUEST_PAYMENT, { floCloudAPI.sendGeneralData(request_object, token_app.master_configurations.TYPE_REQUEST_PAYMENT, {
receiverID: receiver_flo_id receiverID: receiver_flo_id
}).then(result => { }).then(result => {
console.log(result);
notify('Request sent.', 'success');
hidePopup() hidePopup()
showTransactionStatus('success', 'Payment request sent.', 'Payment request will be approved or declined by the receiver.');
}); });
return true; return true;