const resource = typeof GetParentResourceName === 'function' ? GetParentResourceName() : 'devx_banking'; const app = document.querySelector('#app'); const form = document.querySelector('#transferForm'); const transactions = document.querySelector('#transactions'); const errorEl = document.querySelector('#error'); const format = new Intl.NumberFormat('de-DE'); async function post(event, data = {}) { const response = await fetch(`https://${resource}/${event}`, { method: 'POST', headers: { 'Content-Type': 'application/json; charset=UTF-8' }, body: JSON.stringify(data) }); return response.json(); } function showError(text = '') { errorEl.textContent = text; errorEl.classList.toggle('hidden', !text); } function render(overview) { const account = overview.account; document.querySelector('#accountName').textContent = account.accountName; document.querySelector('#accountNumber').textContent = account.accountNumber; document.querySelector('#balance').textContent = `${format.format(account.balance)} $`; transactions.innerHTML = ''; for (const entry of overview.transactions || []) { const row = document.createElement('div'); row.className = 'transaction'; const sign = entry.direction === 'credit' ? '+' : '−'; row.innerHTML = `