0.0.14
This commit is contained in:
parent
dbcba951aa
commit
81c7cf6514
22
css/main.css
22
css/main.css
@ -11,6 +11,10 @@
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
html {
|
||||
margin-left: calc(100vw - 100%);
|
||||
}
|
||||
|
||||
body {
|
||||
--primary-color: #303F9F;
|
||||
--text: 17, 17, 17;
|
||||
@ -132,7 +136,7 @@ input:invalid {
|
||||
}
|
||||
|
||||
.top-margin {
|
||||
margin-top: 1em;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
.flex {
|
||||
@ -870,6 +874,7 @@ form {
|
||||
margin-top: 4vw;
|
||||
margin-bottom: 1rem;
|
||||
font-weight: 700;
|
||||
font-size: 3rem;
|
||||
}
|
||||
|
||||
#home_page p {
|
||||
@ -1223,6 +1228,10 @@ form {
|
||||
color: #d43125;
|
||||
}
|
||||
|
||||
.complaint .processed, .complaint .unprocessed {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.complaint button .icon {
|
||||
padding: 0.2rem;
|
||||
margin-right: 0.5rem;
|
||||
@ -1237,6 +1246,10 @@ form {
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
#helpline_page sm-select {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 640px) {
|
||||
sm-select {
|
||||
width: 100%;
|
||||
@ -1403,12 +1416,13 @@ form {
|
||||
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;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -8,6 +8,9 @@
|
||||
:root{
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
html{
|
||||
margin-left: calc(100vw - 100%);
|
||||
}
|
||||
body{
|
||||
--primary-color: #303F9F;
|
||||
--text: 17, 17, 17;
|
||||
@ -90,7 +93,7 @@ input:invalid{
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
.top-margin{
|
||||
margin-top: 1em;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
.flex{
|
||||
display: flex;
|
||||
@ -586,6 +589,7 @@ form{
|
||||
margin-top: 4vw;
|
||||
margin-bottom: 1rem;
|
||||
font-weight: 700;
|
||||
font-size: 3rem;
|
||||
}
|
||||
p{
|
||||
margin-bottom: 3rem;
|
||||
@ -852,6 +856,9 @@ form{
|
||||
.unprocessed{
|
||||
color: #d43125;
|
||||
}
|
||||
.processed, .unprocessed{
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
button{
|
||||
.icon{
|
||||
padding: 0.2rem;
|
||||
@ -866,6 +873,11 @@ form{
|
||||
display: grid;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
#helpline_page{
|
||||
sm-select{
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
}
|
||||
@media only screen and (max-width: 640px){
|
||||
sm-select{
|
||||
width: 100%;
|
||||
@ -1000,8 +1012,8 @@ form{
|
||||
}
|
||||
.right{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
571
index.html
571
index.html
@ -392,9 +392,9 @@
|
||||
<h5 id="user_type">Cashier</h5>
|
||||
</div>
|
||||
</nav>
|
||||
<main class="">
|
||||
<main>
|
||||
<section class="page hide-completely" id="home_page">
|
||||
<h1>What do we offer?</h1>
|
||||
<h1>What DO WE OFFER?</h1>
|
||||
<p>
|
||||
Your Rupee balance is digital footprint of actual cash.<br> Deposit, Withdraw or Pay Rupee digitally
|
||||
using a FLO Blockchain address.
|
||||
@ -670,42 +670,48 @@
|
||||
<section id="activity_page" class="page">
|
||||
<div class="container-header">
|
||||
<h2>Activity</h2>
|
||||
<sm-select name="activity type" id="activity_type">
|
||||
<sm-option value="deposits">Deposits</sm-option>
|
||||
<sm-option value="withdraws">Withdrawals</sm-option>
|
||||
<sm-option value="cashierMsg">System notifications</sm-option>
|
||||
</sm-select>
|
||||
</div>
|
||||
<p class="bottom-margin">*If your request isn't completed in 12hrs, use <strong>REPORT</strong> to get
|
||||
assistance from our helpline.</p>
|
||||
<div id="deposit_activity_container" class="container activity-container">
|
||||
<h4>You haven't deposited rupee yet.</h4>
|
||||
</div>
|
||||
<div id="withdraw_activity_container" class="container activity-container hide-completely">
|
||||
<h4>You haven't withdrawn rupee yet.</h4>
|
||||
</div>
|
||||
<div id="cashier_message_container" class="container activity-container hide-completely">
|
||||
<h4>No messages from cashier.</h4>
|
||||
</div>
|
||||
<sm-tabs>
|
||||
<sm-tab slot="tab" active>Deposits</sm-tab>
|
||||
<sm-panel slot="panel" id="deposit_activity_container" class="container activity-container">
|
||||
<h4>You haven't deposited rupee yet.</h4>
|
||||
</sm-panel>
|
||||
<sm-tab slot="tab">Withdrawals</sm-tab>
|
||||
<sm-panel slot="panel" id="withdraw_activity_container" class="container activity-container">
|
||||
<h4>You haven't withdrawn rupee yet.</h4>
|
||||
</sm-panel>
|
||||
<sm-tab slot="tab">Pay through cashier</sm-tab>
|
||||
<sm-panel slot="panel" id="pay_cashier_activity_container" class="container activity-container">
|
||||
<h4>You haven't paid through cashier yet.</h4>
|
||||
</sm-panel>
|
||||
<sm-tab slot="tab">System Notifications</sm-tab>
|
||||
<sm-panel slot="panel" id="cashier_message_container" class="container activity-container">
|
||||
<h4>No messages from cashier.</h4>
|
||||
</sm-panel>
|
||||
</sm-tabs>
|
||||
</section>
|
||||
<section id="helpline_page" class="page hide-completely">
|
||||
<div class="container-header">
|
||||
<h2>Complaints</h2>
|
||||
<sm-select name="complaint type" id="complaint_type">
|
||||
<sm-option value="deposits">Deposits</sm-option>
|
||||
<sm-option value="withdraws">Withdrawals</sm-option>
|
||||
<sm-option value="payCashier">Pay through cashier</sm-option>
|
||||
</sm-select>
|
||||
</div>
|
||||
<h5 class="label">Select Cashier</h5>
|
||||
<sm-select name="cashier" id="select_cashier"></sm-select>
|
||||
<div id="deposit_complaints_container" class="complaints-container"></div>
|
||||
<div id="withdraw_complaints_container" class="complaints-container hide-completely">
|
||||
<h4>No withdraw complaints.</h4>
|
||||
</div>
|
||||
<div id="pay_cashier_complaints_container" class="complaints-container hide-completely">
|
||||
<h4>No pay through cashier complaints.</h4>
|
||||
</div>
|
||||
<sm-tabs>
|
||||
<sm-tab slot="tab" active>Deposit</sm-tab>
|
||||
<sm-panel slot="panel" id="deposit_complaints_container" class="complaints-container">
|
||||
<h4>No deposit complaints.</h4>
|
||||
</sm-panel>
|
||||
<sm-tab slot="tab">Withdraw</sm-tab>
|
||||
<sm-panel slot="panel" id="withdraw_complaints_container" class="complaints-container hide-completely">
|
||||
<h4>No withdraw complaints.</h4>
|
||||
</sm-panel>
|
||||
<sm-tab slot="tab">Pay through cashier</sm-tab>
|
||||
<sm-panel slot="panel" id="pay_cashier_complaints_container" class="complaints-container hide-completely">
|
||||
<h4>No pay through cashier complaints.</h4>
|
||||
</sm-panel>
|
||||
</sm-tabs>
|
||||
</section>
|
||||
<section id="profile_page" class="page hide-completely">
|
||||
<div class="container-header">
|
||||
@ -745,7 +751,7 @@
|
||||
|
||||
//for cloud apps
|
||||
subAdmins: [],
|
||||
application: "RUPEE_TOKEN_APP_TEST7",//rupeeTokenApp
|
||||
application: "RUPEE_TOKEN_APP_TEST8",//rupeeTokenApp
|
||||
vectorClock: {},
|
||||
appObjects: {},
|
||||
generalData: {},
|
||||
@ -866,6 +872,40 @@
|
||||
</div>`;
|
||||
return card;
|
||||
},
|
||||
payCashierActivity(vectorClock, receiver, upiTxid, amount) {
|
||||
let card = document.createElement('div'),
|
||||
time = parseInt(vectorClock.split('_')[0])
|
||||
card.classList.add('request')
|
||||
let timeFrag = time.toString().split(' ');
|
||||
setAttributes(card, { 'data-vector-clock': vectorClock, 'data-type': 'pay_thru_cashier' })
|
||||
card.innerHTML = ` <h5 class="time">${formatedTime(time)}</h5>
|
||||
<h5>UPI Transanction ID</h5>
|
||||
<div class="copy-row">
|
||||
<h4 class="copy">${upiTxid}</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>
|
||||
<h5 class="label">Sent to</h5>
|
||||
<div class="copy-row">
|
||||
<h4 class="copy">${receiver}</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>
|
||||
<h5>Amount</h5>
|
||||
<h4 class="withdrawn">₹${amount}</h4>
|
||||
<div class="flex">
|
||||
<button class="report secondary-btn">
|
||||
report
|
||||
</button>
|
||||
</div>`;
|
||||
return card;
|
||||
},
|
||||
paymentRequest(time, senderAddress, amount, id) {
|
||||
let card = document.createElement('div')
|
||||
card.classList.add('request')
|
||||
@ -931,6 +971,15 @@
|
||||
composition += `
|
||||
<div class="right">
|
||||
<h4 class="processed">Cashier processed the request on ${formatedTime(time)}</h4>
|
||||
<h5 class="top-margin">Rupee Transaction ID</h5>
|
||||
<div class="copy-row">
|
||||
<h4 class="copy">${floTxId}</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>
|
||||
</div>`;
|
||||
}
|
||||
else {
|
||||
@ -982,6 +1031,84 @@
|
||||
composition += `
|
||||
<div class="right">
|
||||
<h4 class="processed">Cashier processed the request on ${formatedTime(time)}</h4>
|
||||
<h5 class="top-margin">Rupee Transaction ID</h5>
|
||||
<div class="copy-row">
|
||||
<h4 class="copy">${floTxId}</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>
|
||||
</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;
|
||||
},
|
||||
payCashierComplaint(userData, cashierData, udc) {
|
||||
let card = document.createElement('div'),
|
||||
{ amount, customMsg, sender, receiver, 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>
|
||||
<h5>Receiver</h5>
|
||||
<div class="copy-row">
|
||||
<h4 class="copy">${receiver}</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>Paid</h5>
|
||||
<h4>₹${amount}</h4>
|
||||
<h5>Paid 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>
|
||||
<h5 class="top-margin">Rupee Transaction ID</h5>
|
||||
<div class="copy-row">
|
||||
<h4 class="copy">${floTxId}</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>
|
||||
</div>`;
|
||||
}
|
||||
else {
|
||||
@ -1301,7 +1428,7 @@
|
||||
if (e.target.closest('.confirm-pay-btn'))
|
||||
if (await confirmation('Confirm this pay 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_as_cashier(payRequest.dataset.sender, payRequest.dataset.receiverFloId, payRequest.dataset.txid, payRequest.dataset.amount)
|
||||
if (status) {
|
||||
refresh_balance()
|
||||
payRequest.remove()
|
||||
@ -1354,15 +1481,8 @@
|
||||
}
|
||||
}
|
||||
})
|
||||
document.getElementById('activity_type').addEventListener('change', function (e) {
|
||||
showActivities(this.value)
|
||||
})
|
||||
document.getElementById('complaint_type').addEventListener('change', function (e) {
|
||||
showComplaints(this.value)
|
||||
})
|
||||
document.getElementById('select_cashier').addEventListener('change', async function (e) {
|
||||
await Promise.all([load_deposit_complaints(this.value), load_withdraw_complaints(this.value)])
|
||||
//load_pay_thru_cashier_complaints(this.value)
|
||||
await Promise.all([load_deposit_complaints(this.value), load_withdraw_complaints(this.value), load_pay_thru_cashier_complaints(this.value)])
|
||||
})
|
||||
|
||||
document.getElementById('helpline_page').addEventListener('click', async e => {
|
||||
@ -1379,38 +1499,6 @@
|
||||
|
||||
})
|
||||
|
||||
let allActivities = document.querySelectorAll('.activity-container')
|
||||
function showActivities(activity) {
|
||||
allActivities.forEach(act => {
|
||||
act.classList.add('hide-completely')
|
||||
})
|
||||
if (activity === 'deposits') {
|
||||
document.getElementById('deposit_activity_container').classList.remove('hide-completely')
|
||||
}
|
||||
if (activity === 'withdraws') {
|
||||
document.getElementById('withdraw_activity_container').classList.remove('hide-completely')
|
||||
}
|
||||
if (activity === 'cashierMsg') {
|
||||
document.getElementById('cashier_message_container').classList.remove('hide-completely')
|
||||
}
|
||||
}
|
||||
|
||||
let allComplaints = document.querySelectorAll('.complaints-container')
|
||||
function showComplaints(complaint) {
|
||||
allComplaints.forEach(comp => {
|
||||
comp.classList.add('hide-completely')
|
||||
})
|
||||
if (complaint === 'deposits') {
|
||||
document.getElementById('deposit_complaints_container').classList.remove('hide-completely')
|
||||
}
|
||||
if (complaint === 'withdraws') {
|
||||
document.getElementById('withdraw_complaints_container').classList.remove('hide-completely')
|
||||
}
|
||||
if (complaint === 'payCashier') {
|
||||
document.getElementById('pay_cashier_complaints_container').classList.remove('hide-completely')
|
||||
}
|
||||
}
|
||||
|
||||
let allPages = document.querySelectorAll('.page'),
|
||||
allTabs = document.querySelectorAll('.navbar-item');
|
||||
function showPage(btn, page) {
|
||||
@ -1650,6 +1738,288 @@
|
||||
}
|
||||
}
|
||||
})
|
||||
// tab-header
|
||||
|
||||
const smTabs = document.createElement('template')
|
||||
smTabs.innerHTML = `
|
||||
<style>
|
||||
*{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
:host{
|
||||
display: flex;
|
||||
}
|
||||
.tabs{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
.tab-header{
|
||||
position: relative;
|
||||
overflow: auto hidden;
|
||||
max-width: 100%;
|
||||
border-bottom: solid 1px rgba(var(--text), .2);
|
||||
scrollbar-width: 0;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.tab-header::-webkit-scrollbar-track {
|
||||
-webkit-box-shadow: none !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.tab-header::-webkit-scrollbar {
|
||||
height: 0;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.indicator{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
height: 0.12rem;
|
||||
background: var(--primary-color);
|
||||
}
|
||||
slot[name="tab"]{
|
||||
display: flex;
|
||||
}
|
||||
:host([type="tab"]) .indicator{
|
||||
height: 100%;
|
||||
border-radius: 0.2rem
|
||||
}
|
||||
:host([type="tab"]) .tab-header{
|
||||
border-bottom: none;
|
||||
}
|
||||
:host([type="tab"]) slot[name="tab"]{
|
||||
border-radius: 0.2rem;
|
||||
grid-auto-columns: 1fr;
|
||||
border-bottom: none;
|
||||
}
|
||||
.transition{
|
||||
transition: transform 0.3s cubic-bezier(0.785, 0.135, 0.15, 0.86), width 0.4s;
|
||||
}
|
||||
.hide-completely{
|
||||
display: none;
|
||||
}
|
||||
:host([type="tab"]) slot[name="tab"]::slotted(.active){
|
||||
color: rgba(var(--foreground), 1);
|
||||
}
|
||||
slot[name="tab"]::slotted(.active){
|
||||
color: var(--primary-color);
|
||||
}
|
||||
</style>
|
||||
<div class="tabs">
|
||||
<div class="tab-header">
|
||||
<slot name="tab">Nothing to see here</slot>
|
||||
<div class="indicator"></div>
|
||||
</div>
|
||||
<slot name="panel">Nothing to see here</slot>
|
||||
</div>
|
||||
`;
|
||||
|
||||
customElements.define('sm-tabs', class extends HTMLElement {
|
||||
constructor() {
|
||||
super()
|
||||
this.attachShadow({ mode: 'open' }).append(smTabs.content.cloneNode(true))
|
||||
this.indicator = this.shadowRoot.querySelector('.indicator');
|
||||
this.tabSlot = this.shadowRoot.querySelector('slot[name="tab"]');
|
||||
this.panelSlot = this.shadowRoot.querySelector('slot[name="panel"]');
|
||||
this.tabHeader = this.shadowRoot.querySelector('.tab-header');
|
||||
}
|
||||
connectedCallback() {
|
||||
|
||||
//animations
|
||||
let flyInLeft = [
|
||||
{
|
||||
opacity: 0,
|
||||
transform: 'translateX(-1rem)'
|
||||
},
|
||||
{
|
||||
opacity: 1,
|
||||
transform: 'none'
|
||||
}
|
||||
];
|
||||
let flyInRight = [
|
||||
{
|
||||
opacity: 0,
|
||||
transform: 'translateX(1rem)'
|
||||
},
|
||||
{
|
||||
opacity: 1,
|
||||
transform: 'none'
|
||||
}
|
||||
]
|
||||
let flyOutLeft = [
|
||||
{
|
||||
opacity: 1,
|
||||
transform: 'none'
|
||||
},
|
||||
{
|
||||
opacity: 0,
|
||||
transform: 'translateX(-1rem)'
|
||||
}
|
||||
]
|
||||
let flyOutRight = [
|
||||
{
|
||||
opacity: 1,
|
||||
transform: 'none'
|
||||
},
|
||||
{
|
||||
opacity: 0,
|
||||
transform: 'translateX(1rem)'
|
||||
}
|
||||
]
|
||||
let animationOptions = {
|
||||
duration: 300,
|
||||
fill: 'forwards',
|
||||
easing: 'ease'
|
||||
}
|
||||
this.prevTab
|
||||
this.shadowRoot.querySelector('slot[name="panel"]').addEventListener('slotchange', () => {
|
||||
this.shadowRoot.querySelector('slot[name="panel"]').assignedElements().forEach((panel, index) => {
|
||||
panel.classList.add('hide-completely')
|
||||
})
|
||||
})
|
||||
this.shadowRoot.querySelector('slot[name="tab"]').addEventListener('slotchange', () => {
|
||||
this.shadowRoot.querySelector('slot[name="tab"]').assignedElements().forEach((panel, index) => {
|
||||
panel.setAttribute('rank', index + 1)
|
||||
})
|
||||
})
|
||||
this.addEventListener('switchTab', e => {
|
||||
if (e.target === this.prevTab)
|
||||
return
|
||||
if (this.prevTab)
|
||||
this.prevTab.classList.remove('active')
|
||||
e.target.classList.add('active')
|
||||
|
||||
if (this.prevTab) {
|
||||
let targetBody = e.target.nextElementSibling,
|
||||
currentBody = this.prevTab.nextElementSibling;
|
||||
|
||||
if (this.prevTab.getAttribute('rank') < e.target.getAttribute('rank')) {
|
||||
if (currentBody && !targetBody)
|
||||
currentBody.animate(flyOutLeft, animationOptions).onfinish = () => {
|
||||
currentBody.classList.add('hide-completely')
|
||||
}
|
||||
else if (targetBody && !currentBody) {
|
||||
targetBody.classList.remove('hide-completely')
|
||||
targetBody.animate(flyInRight, animationOptions)
|
||||
}
|
||||
else if (currentBody && targetBody) {
|
||||
currentBody.animate(flyOutLeft, animationOptions).onfinish = () => {
|
||||
currentBody.classList.add('hide-completely')
|
||||
targetBody.classList.remove('hide-completely')
|
||||
targetBody.animate(flyInRight, animationOptions)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (currentBody && !targetBody)
|
||||
currentBody.animate(flyOutRight, animationOptions).onfinish = () => {
|
||||
currentBody.classList.add('hide-completely')
|
||||
}
|
||||
else if (targetBody && !currentBody) {
|
||||
targetBody.classList.remove('hide-completely')
|
||||
targetBody.animate(flyInLeft, animationOptions)
|
||||
}
|
||||
else if (currentBody && targetBody) {
|
||||
currentBody.animate(flyOutRight, animationOptions).onfinish = () => {
|
||||
currentBody.classList.add('hide-completely')
|
||||
targetBody.classList.remove('hide-completely')
|
||||
targetBody.animate(flyInLeft, animationOptions)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
e.target.nextElementSibling.classList.remove('hide-completely')
|
||||
}
|
||||
e.target.scrollIntoView({ behavior: 'smooth', inline: 'center', block: 'nearest' })
|
||||
this.indicator.setAttribute('style', `width: ${e.target.getBoundingClientRect().width}px; transform: translateX(${e.target.getBoundingClientRect().left - e.target.parentNode.getBoundingClientRect().left + this.tabHeader.scrollLeft}px)`)
|
||||
this.prevTab = e.target;
|
||||
})
|
||||
let observer = new IntersectionObserver((entries) => {
|
||||
entries.forEach((entry) => {
|
||||
if (entry.isIntersecting) {
|
||||
let activeElement = this.tabSlot.assignedElements().filter(element => {
|
||||
if (element.classList.contains('active'))
|
||||
return true
|
||||
})
|
||||
if (activeElement.length) {
|
||||
let tabDimensions = activeElement[0].getBoundingClientRect();
|
||||
this.indicator.setAttribute('style', `width: ${tabDimensions.width}px; transform: translateX(${tabDimensions.left - activeElement[0].parentNode.getBoundingClientRect().left + this.tabHeader.scrollLeft}px)`)
|
||||
}
|
||||
else {
|
||||
let tabDimensions = this.tabSlot.assignedElements()[0].getBoundingClientRect();
|
||||
this.indicator.setAttribute('style', `width: ${tabDimensions.width}px; transform: translateX(${tabDimensions.left - this.tabSlot.assignedElements()[0].parentNode.getBoundingClientRect().left + this.tabHeader.scrollLeft}px)`)
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.indicator.classList.add('transition')
|
||||
}, 100);
|
||||
}
|
||||
})
|
||||
},
|
||||
{ threshold: 1.0 })
|
||||
observer.observe(this.tabHeader)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// tab
|
||||
const smTab = document.createElement('template')
|
||||
smTab.innerHTML = `
|
||||
<style>
|
||||
*{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
:host{
|
||||
display: inline-flex;
|
||||
z-index: 1;
|
||||
}
|
||||
.tab{
|
||||
user-select: none;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
white-space: nowrap;
|
||||
font-size: 0.9rem;
|
||||
padding: 0.4rem 0.6rem;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.06em;
|
||||
word-spacing: 0.1em;
|
||||
text-align: center;
|
||||
transition: color 0.3s;
|
||||
text-transform: uppercase;
|
||||
font-family: var(--font-family);
|
||||
}
|
||||
</style>
|
||||
<div class="tab">
|
||||
<slot></slot>
|
||||
</div>
|
||||
`;
|
||||
|
||||
customElements.define('sm-tab', class extends HTMLElement {
|
||||
constructor() {
|
||||
super()
|
||||
this.shadow = this.attachShadow({ mode: 'open' }).append(smTab.content.cloneNode(true))
|
||||
}
|
||||
connectedCallback() {
|
||||
let switchTab = new CustomEvent('switchTab', {
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
})
|
||||
this.addEventListener('click', () => {
|
||||
this.dispatchEvent(switchTab)
|
||||
})
|
||||
if (this.hasAttribute('active')) {
|
||||
setTimeout(() => {
|
||||
this.dispatchEvent(switchTab)
|
||||
}, 0)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
<script id="init_lib">
|
||||
@ -11058,8 +11428,7 @@
|
||||
for (cashier in token_app.master_configurations.cashiers)
|
||||
cashierList += `<sm-option value = "${cashier}">${cashier}</sm-option>`
|
||||
cashierSelect.innerHTML = cashierList;
|
||||
await Promise.all([load_deposit_complaints(cashierSelect.value), load_withdraw_complaints(cashierSelect.value)])
|
||||
//load_pay_thru_cashier_complaints(cashierSelect.value)
|
||||
await Promise.all([load_deposit_complaints(cashierSelect.value), load_withdraw_complaints(cashierSelect.value), load_pay_thru_cashier_complaints(cashierSelect.value)])
|
||||
userType.textContent = 'Helpline'
|
||||
showPage(document.getElementById('helpline_page_btn'), 'helpline_page')
|
||||
}
|
||||
@ -11129,15 +11498,19 @@
|
||||
let p2 = floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_WITHDRAWS
|
||||
, { receiverID: cashier, senderIDs: [myFloID] })
|
||||
|
||||
let p3 = floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_PAY_THROUGH_CASHIER,
|
||||
{ receiverID: cashier, senderIDs: [myFloID] })
|
||||
|
||||
promises.push(p1);
|
||||
promises.push(p2);
|
||||
promises.push(p3);
|
||||
|
||||
}
|
||||
|
||||
let p3 = floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_MSGES
|
||||
let p4 = floCloudAPI.requestGeneralData(token_app.master_configurations.TYPE_MSGES
|
||||
, { receiverID: myFloID })
|
||||
|
||||
promises.push(p3);
|
||||
promises.push(p4);
|
||||
|
||||
await Promise.all(promises);
|
||||
|
||||
@ -11343,7 +11716,6 @@
|
||||
try {
|
||||
const send_tokens_btn = document.getElementById('send_tokens_btn');
|
||||
send_tokens_btn.onclick = async function () {
|
||||
console.log('hi')
|
||||
const token_sender = myFloID;
|
||||
const token_receiver = document.getElementById('token_receiver').value;
|
||||
const token_amount = Number(document.getElementById('token_amount').value);
|
||||
@ -11376,6 +11748,7 @@
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
notify(error, 'error', 'fixed', true);
|
||||
throw new Error(error);
|
||||
}
|
||||
}
|
||||
@ -11639,6 +12012,7 @@
|
||||
|
||||
const depositActivityContainer = document.getElementById('deposit_activity_container'),
|
||||
withdrawActivityContainer = document.getElementById('withdraw_activity_container'),
|
||||
payCashierActivityContainer = document.getElementById('pay_cashier_activity_container'),
|
||||
cashierMessageContainer = document.getElementById('cashier_message_container')
|
||||
|
||||
async function show_user_activities() {
|
||||
@ -11648,6 +12022,7 @@
|
||||
const deposit_msg = floDapps.getNextGeneralData(token_app.master_configurations.TYPE_DEPOSITS, "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 pay_thru_cashier_msg = floDapps.getNextGeneralData(token_app.master_configurations.TYPE_PAY_THROUGH_CASHIER, "0").reverse();
|
||||
|
||||
console.log(deposit_msg, withdraw_msg, user_msg)
|
||||
depositActivityContainer.innerHTML = ``;
|
||||
@ -11666,6 +12041,15 @@
|
||||
|
||||
withdrawActivityContainer.append(frag)
|
||||
|
||||
payCashierActivityContainer.innerHTML = ``;
|
||||
for (cashier_message of pay_thru_cashier_msg) {
|
||||
console.log(cashier_message)
|
||||
let { receiver_flo_id, upi_txid, amount } = cashier_message.message;
|
||||
frag.append(render.payCashierActivity(cashier_message.vectorClock, receiver_flo_id, upi_txid, amount))
|
||||
}
|
||||
|
||||
payCashierActivityContainer.append(frag)
|
||||
|
||||
cashierMessageContainer.innerHTML = ``;
|
||||
for (msg of user_msg) {
|
||||
frag.append(render.cashierMessage(msg))
|
||||
@ -12019,7 +12403,7 @@
|
||||
let this_user_pay_thru_cashier = all_users_pay_thru_cashier.filter(f => f.vectorClock === udc.message.order_vc);
|
||||
console.log(this_user_pay_thru_cashier);
|
||||
|
||||
let this_user_pay_thru_cashier_upi_txid_list = this_user_withdraws.map(m => m.message.upi_txid);
|
||||
let this_user_pay_thru_cashier_upi_txid_list = this_user_pay_thru_cashier.map(m => m.message.upi_txid);
|
||||
|
||||
let all_cashier_processed_pay_thru_cashier = floDapps
|
||||
.getNextGeneralData(token_app.master_configurations.TYPE_PROCESSED_WITHDRAWS, "0");
|
||||
@ -12027,8 +12411,41 @@
|
||||
let this_cashier_processed_user_pay_thru_cashier = all_cashier_processed_pay_thru_cashier
|
||||
.filter(f => this_user_pay_thru_cashier_upi_txid_list.includes(f.message.upi_txid));
|
||||
console.log(this_cashier_processed_user_pay_thru_cashier);
|
||||
}
|
||||
|
||||
if (this_user_pay_thru_cashier.length) {
|
||||
let { amount, upi_txid, receiver_flo_id } = this_user_pay_thru_cashier[0].message;
|
||||
userData = {
|
||||
amount: amount,
|
||||
upiTxId: upi_txid,
|
||||
sender: this_user_pay_thru_cashier[0].sender,
|
||||
receiver: receiver_flo_id,
|
||||
vectorClock: this_user_pay_thru_cashier[0].vectorClock,
|
||||
customMsg: udc.message.custom_msg
|
||||
}
|
||||
}
|
||||
if (this_cashier_processed_user_pay_thru_cashier.length) {
|
||||
let { datetime, flo_txid } = this_cashier_processed_user_pay_thru_cashier[0].message;
|
||||
cashierData = {
|
||||
processed: true,
|
||||
time: datetime,
|
||||
floTxId: flo_txid
|
||||
}
|
||||
}
|
||||
else {
|
||||
cashierData = {
|
||||
processed: false
|
||||
}
|
||||
}
|
||||
if (this_user_pay_thru_cashier.length)
|
||||
frag.append(render.payCashierComplaint(userData, cashierData, udc))
|
||||
}
|
||||
let container = document.getElementById('pay_cashier_complaints_container');
|
||||
|
||||
container.innerHTML = ``
|
||||
if (frag.children.length)
|
||||
container.append(frag)
|
||||
else
|
||||
container.innerHTML = `<h4>No complaints available.</h4>`
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
notify(e);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user