Sign In @@ -206,14 +197,42 @@ Accounts + + Active + Closed + - No accounts so far. + + + + + + + + + + + + + + Nothing to see here + Make a deposit or take a loan and it'll appear here. + @@ -225,6 +244,8 @@ No notifications so far. + My FLO ID + Sign out @@ -310,13 +331,13 @@
- + - + - + - + @@ -367,20 +388,23 @@ - + Done - - - - - + + + + + + + Transaction + @@ -388,21 +412,21 @@ - - - - + - - - - - + + + + + + + Account + @@ -439,15 +463,12 @@ - - - - - + + - + - + @@ -601,33 +622,6 @@ }) } - // displays a popup for asking user input. Use this instead of JS prompt - async function getPromptInput(title, message = '', isPassword = true, cancelText = 'Cancel', confirmText = 'OK') { - showPopup('prompt_popup', true) - getRef('prompt_title').textContent = title; - let input = getRef('prompt_input'); - input.setAttribute("placeholder", message) - let buttons = getRef('prompt_popup').querySelectorAll("sm-button"); - if (isPassword) - input.setAttribute("type", "text") - else - input.setAttribute("type", "password") - input.focusIn() - buttons[0].textContent = cancelText; - buttons[1].textContent = confirmText; - return new Promise((resolve, reject) => { - buttons[0].onclick = () => { - hidePopup() - return; - } - buttons[1].onclick = () => { - let value = input.value; - hidePopup() - resolve(value) - } - }) - } - //Function for displaying toast notifications. pass in error for mode param if you want to show an error. function notify(message, mode, options = {}) { const { pinned = false, sound = false } = options @@ -785,6 +779,9 @@ case 'account': showAccountDetails(params) break; + case 'result': + showActionResult(params) + break; } document.querySelector('.page:not(.hide-completely)')?.classList.add('hide-completely') getRef(pageId)?.classList.remove('hide-completely') @@ -809,7 +806,7 @@ if (pagesData.openedSubPages.includes(subPageId)) { accountLoader.reset() } else { - accountLoader = new LazyLoader('#user_accounts', bank_app.accounts.reverse(), render.accountCard, { batchSize: 10 }) + accountLoader = new LazyLoader('#user_accounts', getAccounts(), render.accountCard, { batchSize: 10 }) accountLoader.init() } break; @@ -869,6 +866,7 @@ this.lazyContainer = document.querySelector(container) + this.update = this.update.bind(this) this.render = this.render.bind(this) this.init = this.init.bind(this) this.clear = this.clear.bind(this) @@ -897,7 +895,10 @@ childList: true, }) this.render() - console.log(this.arrayOfElements.length) + } + update(arrayOfElements) { + this.arrayOfElements = arrayOfElements + this.render() } render(options = {}) { let { lazyLoad = false } = options @@ -912,7 +913,7 @@ this.updateEndIndex = this.arrayOfElements.length > this.batchSize ? this.batchSize : this.arrayOfElements.length } for (let index = this.updateStartIndex; index < this.updateEndIndex; index++) { - frag.append(this.renderFn(this.arrayOfElements[index], index)) + frag.append(this.renderFn(this.arrayOfElements[index])) } this.lazyContainer.append(frag) } @@ -928,7 +929,7 @@
- + - + @@ -367,20 +388,23 @@ - + Done - - - - - + + + + + + + Transaction + @@ -388,21 +412,21 @@ - - - - +
- - - - - + + + + + + + Account + @@ -439,15 +463,12 @@ - - - - - + + - + - + @@ -601,33 +622,6 @@ }) } - // displays a popup for asking user input. Use this instead of JS prompt - async function getPromptInput(title, message = '', isPassword = true, cancelText = 'Cancel', confirmText = 'OK') { - showPopup('prompt_popup', true) - getRef('prompt_title').textContent = title; - let input = getRef('prompt_input'); - input.setAttribute("placeholder", message) - let buttons = getRef('prompt_popup').querySelectorAll("sm-button"); - if (isPassword) - input.setAttribute("type", "text") - else - input.setAttribute("type", "password") - input.focusIn() - buttons[0].textContent = cancelText; - buttons[1].textContent = confirmText; - return new Promise((resolve, reject) => { - buttons[0].onclick = () => { - hidePopup() - return; - } - buttons[1].onclick = () => { - let value = input.value; - hidePopup() - resolve(value) - } - }) - } - //Function for displaying toast notifications. pass in error for mode param if you want to show an error. function notify(message, mode, options = {}) { const { pinned = false, sound = false } = options @@ -785,6 +779,9 @@ case 'account': showAccountDetails(params) break; + case 'result': + showActionResult(params) + break; } document.querySelector('.page:not(.hide-completely)')?.classList.add('hide-completely') getRef(pageId)?.classList.remove('hide-completely') @@ -809,7 +806,7 @@ if (pagesData.openedSubPages.includes(subPageId)) { accountLoader.reset() } else { - accountLoader = new LazyLoader('#user_accounts', bank_app.accounts.reverse(), render.accountCard, { batchSize: 10 }) + accountLoader = new LazyLoader('#user_accounts', getAccounts(), render.accountCard, { batchSize: 10 }) accountLoader.init() } break; @@ -869,6 +866,7 @@ this.lazyContainer = document.querySelector(container) + this.update = this.update.bind(this) this.render = this.render.bind(this) this.init = this.init.bind(this) this.clear = this.clear.bind(this) @@ -897,7 +895,10 @@ childList: true, }) this.render() - console.log(this.arrayOfElements.length) + } + update(arrayOfElements) { + this.arrayOfElements = arrayOfElements + this.render() } render(options = {}) { let { lazyLoad = false } = options @@ -912,7 +913,7 @@ this.updateEndIndex = this.arrayOfElements.length > this.batchSize ? this.batchSize : this.arrayOfElements.length } for (let index = this.updateStartIndex; index < this.updateEndIndex; index++) { - frag.append(this.renderFn(this.arrayOfElements[index], index)) + frag.append(this.renderFn(this.arrayOfElements[index])) } this.lazyContainer.append(frag) } @@ -928,7 +929,7 @@