{"id":195,"date":"2026-05-21T11:07:53","date_gmt":"2026-05-21T11:07:53","guid":{"rendered":"https:\/\/cashchat.se\/dir\/?page_id=195"},"modified":"2026-05-21T11:07:53","modified_gmt":"2026-05-21T11:07:53","slug":"africa","status":"publish","type":"page","link":"https:\/\/cashchat.se\/dir\/africa\/","title":{"rendered":"Africa"},"content":{"rendered":"\n<meta charset=\"UTF-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <title>Adase Ads \u2013 Complete Dashboard<\/title>\n  <script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/html2canvas\/1.4.1\/html2canvas.min.js\"><\/script>\n  <script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jspdf\/2.5.1\/jspdf.umd.min.js\"><\/script>\n  <style>\n    * { margin: 0; padding: 0; box-sizing: border-box; }\n    :root {\n      --primary: #0a1f44;\n      --gold: #c49a2b;\n      --bg: #f4f6f9;\n      --card-bg: #ffffff;\n      --text: #1e293b;\n      --shadow: 0 10px 25px -5px rgba(0,0,0,0.05), 0 8px 10px -6px rgba(0,0,0,0.02);\n      --radius: 16px;\n    }\n    body {\n      font-family: 'Inter', system-ui, -apple-system, sans-serif;\n      background: var(--bg);\n      color: var(--text);\n      display: flex;\n      min-height: 100vh;\n    }\n    .sidebar {\n      width: 260px;\n      background: var(--primary);\n      color: #fff;\n      padding: 24px 16px;\n      position: fixed;\n      top: 0; left: 0; bottom: 0;\n      z-index: 100;\n      transition: transform 0.3s ease;\n      display: flex;\n      flex-direction: column;\n    }\n    .sidebar .logo {\n      font-family: 'Playfair Display', serif;\n      font-size: 24px;\n      font-weight: 700;\n      text-align: center;\n      letter-spacing: 2px;\n      margin-bottom: 32px;\n    }\n    .sidebar .logo span { color: var(--gold); }\n    .sidebar nav a {\n      display: flex;\n      align-items: center;\n      gap: 10px;\n      color: rgba(255,255,255,0.8);\n      text-decoration: none;\n      padding: 12px 16px;\n      border-radius: 10px;\n      margin-bottom: 6px;\n      font-weight: 500;\n      transition: background 0.2s, color 0.2s;\n    }\n    .sidebar nav a:hover,\n    .sidebar nav a.active { background: rgba(255,255,255,0.08); color: var(--gold); }\n    .main {\n      margin-left: 260px;\n      flex: 1;\n      padding: 28px 32px;\n      transition: margin-left 0.3s;\n    }\n    .mobile-header {\n      display: none;\n      align-items: center;\n      gap: 16px;\n      background: var(--primary);\n      color: #fff;\n      padding: 14px 20px;\n      position: sticky;\n      top: 0; z-index: 99;\n    }\n    .mobile-header .menu-toggle {\n      background: none; border: none; color: #fff; font-size: 24px; cursor: pointer;\n    }\n    .section {\n      background: var(--card-bg);\n      border-radius: var(--radius);\n      padding: 24px;\n      margin-bottom: 24px;\n      box-shadow: var(--shadow);\n      display: none;\n    }\n    .section.active { display: block; }\n    h2 {\n      font-family: 'Playfair Display', serif;\n      color: var(--primary);\n      font-size: 22px;\n      margin-bottom: 20px;\n      border-bottom: 2px solid var(--gold);\n      padding-bottom: 10px;\n      display: inline-block;\n    }\n    h3 { color: var(--primary); margin: 16px 0 10px; }\n    .wallet-balance { font-size: 32px; font-weight: 700; color: var(--gold); }\n    .btn {\n      display: inline-flex;\n      align-items: center;\n      gap: 6px;\n      background: var(--primary);\n      color: #fff;\n      border: none;\n      padding: 10px 20px;\n      border-radius: 30px;\n      font-weight: 600;\n      cursor: pointer;\n      transition: all 0.2s;\n      font-size: 14px;\n    }\n    .btn-gold { background: var(--gold); color: var(--primary); }\n    .btn-outline {\n      background: transparent;\n      border: 1.5px solid var(--primary);\n      color: var(--primary);\n    }\n    .btn:hover { opacity: 0.9; transform: translateY(-1px); }\n    .btn-danger { background: #dc3545; }\n    .form-group { margin-bottom: 16px; }\n    .form-group label {\n      display: block;\n      font-weight: 600;\n      margin-bottom: 6px;\n      color: var(--primary);\n    }\n    .form-control {\n      width: 100%;\n      padding: 10px 14px;\n      border: 1.5px solid #e2e8f0;\n      border-radius: 10px;\n      font-size: 15px;\n      transition: border 0.2s;\n    }\n    .form-control:focus { border-color: var(--gold); outline: none; }\n    .row { display: flex; gap: 20px; flex-wrap: wrap; }\n    .col { flex: 1; min-width: 200px; }\n    table {\n      width: 100%;\n      border-collapse: collapse;\n      margin-top: 12px;\n    }\n    th, td {\n      padding: 12px 14px;\n      border-bottom: 1px solid #e2e8f0;\n      text-align: left;\n      font-size: 14px;\n    }\n    th { background: #f8fafc; color: var(--primary); font-weight: 600; }\n    .badge {\n      display: inline-block;\n      padding: 2px 10px;\n      border-radius: 12px;\n      font-size: 12px;\n      font-weight: 600;\n    }\n    .badge-success { background: #d4edda; color: #155724; }\n    .badge-warning { background: #fff3cd; color: #856404; }\n    .badge-danger { background: #f8d7da; color: #721c24; }\n    .notification {\n      background: #fff3cd;\n      border-left: 4px solid #ffc107;\n      padding: 12px;\n      border-radius: 8px;\n      margin-bottom: 12px;\n      display: flex;\n      justify-content: space-between;\n      align-items: center;\n    }\n    .auth-container {\n      max-width: 500px;\n      margin: 40px auto;\n      background: var(--card-bg);\n      border-radius: var(--radius);\n      padding: 32px;\n      box-shadow: var(--shadow);\n    }\n    .terms-box {\n      display: flex;\n      align-items: center;\n      gap: 8px;\n      margin: 16px 0;\n      font-size: 14px;\n    }\n    .terms-box input[type=\"checkbox\"] { width: 18px; height: 18px; cursor: pointer; }\n    @media (max-width: 768px) {\n      .sidebar { transform: translateX(-100%); }\n      .sidebar.open { transform: translateX(0); }\n      .main { margin-left: 0; }\n      .mobile-header { display: flex; }\n      .row { flex-direction: column; }\n    }\n  <\/style>\n\n\n  <!-- Sidebar -->\n  <aside class=\"sidebar\" id=\"sidebar\">\n    <div class=\"logo\">ADASE <span>ADS<\/span><\/div>\n    <nav>\n      <a href=\"#dashboard\" class=\"active\" data-section=\"dashboard\">\ud83d\udcca Dashboard<\/a>\n      <a href=\"#wallet\" data-section=\"wallet\">\ud83d\udcb0 Wallet<\/a>\n      <a href=\"#invest\" data-section=\"invest\">\ud83d\udcdc Buy Notes<\/a>\n      <a href=\"#history-invest\" data-section=\"history-invest\">\ud83c\udfe6 Investments<\/a>\n      <a href=\"#history-tx\" data-section=\"history-tx\">\ud83e\uddfe Transactions<\/a>\n      <a href=\"#\" id=\"logoutSidebar\">\ud83d\udeaa Logout<\/a>\n      <a href=\"#\" id=\"adminSidebarLink\" style=\"margin-top:20px; border-top:1px solid rgba(255,255,255,0.2); padding-top:15px;\">\ud83d\udd10 Admin<\/a>\n    <\/nav>\n  <\/aside>\n\n  <!-- Mobile header -->\n  <div class=\"mobile-header\">\n    <button class=\"menu-toggle\" id=\"menuToggle\">\u2630<\/button>\n    <span style=\"font-weight:600;\">Adase Dashboard<\/span>\n  <\/div>\n\n  <!-- Main content -->\n  <main class=\"main\" id=\"mainContent\">\n    <!-- ========== USER AUTH ========== -->\n    <div id=\"authSection\">\n      <div class=\"auth-container\">\n        <h2 style=\"text-align:center;\">Welcome<\/h2>\n        <div style=\"display:flex; gap:8px; justify-content:center; margin-bottom:20px;\">\n          <button class=\"btn\" onclick=\"showAuthTab('login')\">Login<\/button>\n          <button class=\"btn btn-outline\" onclick=\"showAuthTab('register')\">Register<\/button>\n        <\/div>\n        <!-- LOGIN -->\n        <div id=\"loginForm\">\n          <div class=\"form-group\"><label>Email<\/label><input type=\"email\" class=\"form-control\" id=\"loginEmail\" placeholder=\"you@example.com\"><\/div>\n          <div class=\"form-group\"><label>Password<\/label><input type=\"password\" class=\"form-control\" id=\"loginPassword\" placeholder=\"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\"><\/div>\n          <button class=\"btn btn-gold\" onclick=\"login()\" style=\"width:100%;\">Login<\/button>\n        <\/div>\n        <!-- REGISTER -->\n        <div id=\"registerForm\" style=\"display:none;\">\n          <div class=\"row\">\n            <div class=\"col\"><div class=\"form-group\"><label>First Name *<\/label><input type=\"text\" class=\"form-control\" id=\"regFirstName\" required=\"\"><\/div><\/div>\n            <div class=\"col\"><div class=\"form-group\"><label>Last Name *<\/label><input type=\"text\" class=\"form-control\" id=\"regLastName\" required=\"\"><\/div><\/div>\n          <\/div>\n          <div class=\"form-group\"><label>Email *<\/label><input type=\"email\" class=\"form-control\" id=\"regEmail\" required=\"\"><\/div>\n          <div class=\"row\">\n            <div class=\"col\"><div class=\"form-group\"><label>Country *<\/label><input type=\"text\" class=\"form-control\" id=\"regCountry\" required=\"\"><\/div><\/div>\n            <div class=\"col\"><div class=\"form-group\"><label>Mobile Number *<\/label><input type=\"text\" class=\"form-control\" id=\"regMobile\" required=\"\"><\/div><\/div>\n          <\/div>\n          <div class=\"form-group\"><label>NIN \/ Passport Number *<\/label><input type=\"text\" class=\"form-control\" id=\"regNIN\" required=\"\"><\/div>\n          <div class=\"row\">\n            <div class=\"col\"><div class=\"form-group\"><label>Password *<\/label><input type=\"password\" class=\"form-control\" id=\"regPassword\" required=\"\"><\/div><\/div>\n            <div class=\"col\"><div class=\"form-group\"><label>Confirm Password *<\/label><input type=\"password\" class=\"form-control\" id=\"regConfirmPassword\" required=\"\"><\/div><\/div>\n          <\/div>\n          <div class=\"terms-box\">\n            <input type=\"checkbox\" id=\"acceptTerms\" required=\"\">\n            <label for=\"acceptTerms\">I accept the <a href=\"\/terms\" target=\"_blank\" style=\"color:var(--gold);\">Terms and Conditions<\/a><\/label>\n          <\/div>\n          <button class=\"btn btn-gold\" onclick=\"register()\" style=\"width:100%;\">Register<\/button>\n        <\/div>\n      <\/div>\n    <\/div>\n\n    <!-- ========== USER DASHBOARD ========== -->\n    <div id=\"dashboardSections\" style=\"display:none;\">\n      <section class=\"section active\" id=\"section-dashboard\">\n        <h2>Dashboard<\/h2>\n        <div class=\"row\">\n          <div class=\"col\"><p style=\"color:#666;\">Wallet Balance<\/p><div class=\"wallet-balance\" id=\"balanceDisplay\">0 UGX<\/div><\/div>\n          <div class=\"col\" style=\"text-align:right;\"><span id=\"userNameDisplay\"><\/span><\/div>\n        <\/div>\n        <div style=\"margin-top:20px;\">\n          <button class=\"btn btn-gold\" onclick=\"switchSection('wallet')\">\ud83d\udcb5 Add Money<\/button>\n          <button class=\"btn\" onclick=\"switchSection('invest')\">\ud83d\udcdc Buy Notes<\/button>\n        <\/div>\n        <h3 style=\"margin-top:24px;\">\ud83d\udd14 Notifications<\/h3>\n        <div id=\"notificationsPreview\"><\/div>\n      <\/section>\n\n      <section class=\"section\" id=\"section-wallet\">\n        <h2>Wallet<\/h2>\n        <div class=\"row\">\n          <div class=\"col\"><h3>Add Money (Top\u2011up)<\/h3><div class=\"form-group\"><label>Amount (UGX)<\/label><input type=\"number\" class=\"form-control\" id=\"topupAmount\" placeholder=\"e.g., 500000\"><\/div><button class=\"btn btn-gold\" onclick=\"submitTopup()\">Request Top\u2011up<\/button><\/div>\n          <div class=\"col\"><h3>Withdraw<\/h3><div class=\"form-group\"><label>Amount (UGX)<\/label><input type=\"number\" class=\"form-control\" id=\"withdrawAmount\" placeholder=\"e.g., 200000\"><\/div><button class=\"btn btn-outline\" onclick=\"submitWithdraw()\">Request Withdrawal<\/button><\/div>\n        <\/div>\n        <div style=\"margin-top:30px;\">\n          <h3>Transfer to Another User<\/h3>\n          <div class=\"row\">\n            <div class=\"col\"><div class=\"form-group\"><label>Recipient Email<\/label><input type=\"email\" class=\"form-control\" id=\"transferEmail\" placeholder=\"user@example.com\"><\/div><\/div>\n            <div class=\"col\"><div class=\"form-group\"><label>Amount (UGX)<\/label><input type=\"number\" class=\"form-control\" id=\"transferAmount\" placeholder=\"e.g., 100000\"><\/div><\/div>\n          <\/div>\n          <button class=\"btn\" onclick=\"submitTransfer()\">Request Transfer<\/button>\n        <\/div>\n      <\/section>\n\n      <section class=\"section\" id=\"section-invest\">\n        <h2>Buy Convertible Notes<\/h2>\n        <p style=\"color:#666; margin-bottom:20px;\">Minimum 100,000 UGX. Amount deducted from wallet on purchase.<\/p>\n        <div class=\"row\">\n          <div class=\"col\"><div class=\"form-group\"><label>Investment Amount (UGX)<\/label><input type=\"number\" class=\"form-control\" id=\"investAmount\" min=\"100000\" placeholder=\"e.g., 1000000\"><\/div><\/div>\n          <div class=\"col\" style=\"display:flex; align-items:flex-end;\"><button class=\"btn btn-gold\" onclick=\"buyAndDownload()\" style=\"width:100%;\">Buy &amp; Download Certificate<\/button><\/div>\n        <\/div>\n        <p id=\"investMsg\" style=\"margin-top:12px;\"><\/p>\n      <\/section>\n\n      <section class=\"section\" id=\"section-history-invest\">\n        <h2>Investment History<\/h2>\n        <table><thead><tr><th>Certificate No<\/th><th>Principal<\/th><th>Date<\/th><th>Download<\/th><\/tr><\/thead><tbody id=\"investHistoryBody\"><tr><td colspan=\"4\">Loading&#8230;<\/td><\/tr><\/tbody><\/table>\n      <\/section>\n\n      <section class=\"section\" id=\"section-history-tx\">\n        <h2>Wallet Transactions<\/h2>\n        <table><thead><tr><th>Type<\/th><th>Amount<\/th><th>Status<\/th><th>Date<\/th><th>Note<\/th><\/tr><\/thead><tbody id=\"txHistoryBody\"><tr><td colspan=\"5\">Loading&#8230;<\/td><\/tr><\/tbody><\/table>\n      <\/section>\n    <\/div>\n\n    <!-- ========== ADMIN PANEL ========== -->\n    <div id=\"adminPanel\" style=\"display:none;\">\n      <div style=\"margin-bottom:20px;\">\n        <button class=\"btn\" onclick=\"switchToUserView()\">\u2b05 User Dashboard<\/button>\n        <button class=\"btn btn-danger\" onclick=\"adminLogout()\" style=\"float:right;\">Logout Admin<\/button>\n      <\/div>\n      <section class=\"section active\" id=\"admin-requests\">\n        <h2>Pending Requests<\/h2>\n        <button class=\"btn\" onclick=\"loadAdminRequests()\">Refresh<\/button>\n        <div id=\"adminRequestsContainer\"><\/div>\n      <\/section>\n      <section class=\"section\" id=\"admin-users\">\n        <h2>Registered Users<\/h2>\n        <button class=\"btn\" onclick=\"loadAdminUsers()\">Refresh<\/button>\n        <div id=\"adminUsersContainer\"><\/div>\n      <\/section>\n      <section class=\"section\">\n        <h3>Send Notification to User<\/h3>\n        <div class=\"row\">\n          <div class=\"col\"><input type=\"text\" class=\"form-control\" id=\"notifyUserId\" placeholder=\"User ID\"><\/div>\n          <div class=\"col\"><input type=\"text\" class=\"form-control\" id=\"notifyMsg\" placeholder=\"Message (e.g., MTN number)\"><\/div>\n        <\/div>\n        <button class=\"btn\" onclick=\"adminSendNotification()\" style=\"margin-top:10px;\">Send<\/button>\n      <\/section>\n    <\/div>\n\n    <!-- ========== ADMIN LOGIN ========== -->\n    <div id=\"adminLoginSection\" style=\"display:none;\">\n      <div class=\"auth-container\" style=\"max-width:400px; margin:80px auto;\">\n        <h2 style=\"text-align:center;\">Admin Login<\/h2>\n        <div class=\"form-group\"><label>Password<\/label><input type=\"password\" class=\"form-control\" id=\"adminPassword\" placeholder=\"Admin password\"><\/div>\n        <button class=\"btn btn-gold\" onclick=\"adminLogin()\" style=\"width:100%;\">Login<\/button>\n        <p style=\"text-align:center; margin-top:15px;\"><a href=\"#\" onclick=\"switchToUserView()\" style=\"color:var(--gold);\">\u2190 Back to User Dashboard<\/a><\/p>\n      <\/div>\n    <\/div>\n  <\/main>\n\n  <script>\n    \/\/ ==================== CONFIGURATION ====================\n    const API_BASE = 'http:\/\/localhost:3000\/api';   \/\/ \u2b05\ufe0f CHANGE TO YOUR LIVE BACKEND URL\n\n    let token = localStorage.getItem('token');\n    let adminToken = localStorage.getItem('adminToken');\n    let currentUser = null;\n\n    \/\/ Helpers\n    function $(sel) { return document.querySelector(sel); }\n    function $$(sel) { return document.querySelectorAll(sel); }\n\n    function switchSection(name) {\n      $$('.section').forEach(s => s.classList.remove('active'));\n      const target = document.getElementById(`section-${name}`);\n      if (target) target.classList.add('active');\n      $$('.sidebar nav a').forEach(a => a.classList.remove('active'));\n      const link = document.querySelector(`.sidebar nav a[data-section=\"${name}\"]`);\n      if (link) link.classList.add('active');\n      document.getElementById('sidebar').classList.remove('open');\n      if (name === 'history-invest') fetchInvestments();\n      if (name === 'history-tx') fetchTransactions();\n    }\n\n    function showAuthTab(tab) {\n      $('#loginForm').style.display = (tab === 'login') ? 'block' : 'none';\n      $('#registerForm').style.display = (tab === 'register') ? 'block' : 'none';\n    }\n\n    \/\/ Generic API call\n    async function apiCall(url, method = 'GET', body = null, isAdmin = false) {\n      const headers = { 'Content-Type': 'application\/json' };\n      if (isAdmin && adminToken) headers['x-admin-token'] = adminToken;\n      else if (token) headers['x-auth-token'] = token;\n      const options = { method, headers };\n      if (body) options.body = JSON.stringify(body);\n      const res = await fetch(API_BASE + url, options);\n      const data = await res.json();\n      if (!res.ok) throw new Error(data.msg || 'Request failed');\n      return data;\n    }\n\n    \/\/ ==================== USER AUTH ====================\n    async function login() {\n      const email = $('#loginEmail').value.trim();\n      const password = $('#loginPassword').value;\n      try {\n        const data = await apiCall('\/users\/login', 'POST', { email, password });\n        token = data.token;\n        localStorage.setItem('token', token);\n        currentUser = data.user;\n        showUserDashboard();\n      } catch (e) { alert(e.message); }\n    }\n\n    async function register() {\n      const fields = {\n        firstName: $('#regFirstName').value.trim(),\n        lastName: $('#regLastName').value.trim(),\n        email: $('#regEmail').value.trim(),\n        country: $('#regCountry').value.trim(),\n        mobile: $('#regMobile').value.trim(),\n        nin: $('#regNIN').value.trim(),\n        password: $('#regPassword').value,\n        confirmPassword: $('#regConfirmPassword').value,\n      };\n      if (!fields.firstName || !fields.lastName || !fields.email || !fields.country || !fields.mobile || !fields.nin || !fields.password || !fields.confirmPassword) {\n        return alert('Please fill in all fields.');\n      }\n      if (fields.password !== fields.confirmPassword) return alert('Passwords do not match.');\n      if (!$('#acceptTerms').checked) return alert('You must accept the Terms and Conditions.');\n\n      try {\n        const data = await apiCall('\/users\/register', 'POST', {\n          firstName: fields.firstName,\n          lastName: fields.lastName,\n          email: fields.email,\n          country: fields.country,\n          mobile: fields.mobile,\n          nin: fields.nin,\n          password: fields.password\n        });\n        token = data.token;\n        localStorage.setItem('token', token);\n        currentUser = data.user;\n        showUserDashboard();\n      } catch (e) { alert(e.message); }\n    }\n\n    function showUserDashboard() {\n      $('#authSection').style.display = 'none';\n      $('#dashboardSections').style.display = 'block';\n      $('#adminPanel').style.display = 'none';\n      $('#adminLoginSection').style.display = 'none';\n      $('#userNameDisplay').textContent = currentUser.name;\n      updateBalance(currentUser.walletBalance);\n      fetchNotifications();\n      fetchInvestments();\n      fetchTransactions();\n      switchSection('dashboard');\n    }\n\n    function userLogout() {\n      localStorage.removeItem('token');\n      token = null;\n      currentUser = null;\n      location.reload();\n    }\n\n    \/\/ ==================== DATA FETCHING ====================\n    function updateBalance(bal) {\n      $('#balanceDisplay').textContent = bal.toLocaleString() + ' UGX';\n    }\n\n    async function refreshUser() {\n      const u = await apiCall('\/users\/me');\n      currentUser = u;\n      updateBalance(u.walletBalance);\n    }\n\n    async function fetchNotifications() {\n      try {\n        const notifs = await apiCall('\/notifications');\n        const container = $('#notificationsPreview');\n        container.innerHTML = notifs.length\n          ? notifs.map(n => `<div class=\"notification\"><span>${n.message} <small>(${new Date(n.createdAt).toLocaleString()})<\/small><\/span><button class=\"btn\" style=\"padding:4px 10px;\" onclick=\"dismissNotif('${n._id}')\">Dismiss<\/button><\/div>`).join('')\n          : '<p>No new notifications<\/p>';\n      } catch (e) {}\n    }\n\n    async function dismissNotif(id) {\n      await apiCall('\/notifications\/read\/' + id, 'POST');\n      fetchNotifications();\n    }\n\n    async function fetchInvestments() {\n      try {\n        const invs = await apiCall('\/investments');\n        $('#investHistoryBody').innerHTML = invs.map(i =>\n          `<tr><td>${i.certificateNumber}<\/td><td>${i.principal.toLocaleString()} UGX<\/td><td>${new Date(i.issuedAt).toLocaleDateString()}<\/td><td><button class=\"btn\" onclick=\"downloadExistingCert('${i.certificateNumber}',${i.principal})\">Download<\/button><\/td><\/tr>`\n        ).join('') || '<tr><td colspan=\"4\">No investments yet.<\/td><\/tr>';\n      } catch (e) { $('#investHistoryBody').innerHTML = '<tr><td colspan=\"4\">Error loading<\/td><\/tr>'; }\n    }\n\n    async function fetchTransactions() {\n      try {\n        const txns = await apiCall('\/transactions');\n        $('#txHistoryBody').innerHTML = txns.map(t =>\n          `<tr><td>${t.type}<\/td><td>${t.amount.toLocaleString()} UGX<\/td><td><span class=\"badge ${t.status==='approved'?'badge-success':t.status==='pending'?'badge-warning':'badge-danger'}\">${t.status}<\/span><\/td><td>${new Date(t.createdAt).toLocaleString()}<\/td><td>${t.description||''}<\/td><\/tr>`\n        ).join('') || '<tr><td colspan=\"5\">No transactions<\/td><\/tr>';\n      } catch (e) { $('#txHistoryBody').innerHTML = '<tr><td colspan=\"5\">Error loading<\/td><\/tr>'; }\n    }\n\n    \/\/ ==================== WALLET ACTIONS ====================\n    async function submitTopup() {\n      const amount = parseFloat($('#topupAmount').value);\n      if (!amount || amount <= 0) return alert('Enter a valid amount');\n      await apiCall('\/wallet\/topup', 'POST', { amount });\n      alert('Top-up request submitted. Admin will review.');\n      $('#topupAmount').value = '';\n    }\n\n    async function submitWithdraw() {\n      const amount = parseFloat($('#withdrawAmount').value);\n      if (!amount || amount <= 0) return alert('Enter a valid amount');\n      await apiCall('\/wallet\/withdraw', 'POST', { amount });\n      alert('Withdrawal request submitted.');\n      $('#withdrawAmount').value = '';\n    }\n\n    async function submitTransfer() {\n      const toEmail = $('#transferEmail').value.trim();\n      const amount = parseFloat($('#transferAmount').value);\n      if (!toEmail || !amount || amount <= 0) return alert('Enter valid email and amount');\n      const res = await apiCall('\/wallet\/transfer', 'POST', { toEmail, amount });\n      alert(res.msg);\n      $('#transferEmail').value = '';\n      $('#transferAmount').value = '';\n    }\n\n    \/\/ ==================== INVEST &#038; CERTIFICATE ====================\n    async function buyAndDownload() {\n      const principal = parseFloat($('#investAmount').value);\n      if (principal < 100000) return alert('Minimum investment is 100,000 UGX');\n      try {\n        const data = await apiCall('\/invest', 'POST', { principal });\n        alert(`Investment successful! Certificate: ${data.certificateNumber}`);\n        await refreshUser();\n        fetchInvestments();\n        fetchTransactions();\n        generateCertificate(data.certificateNumber, principal, currentUser.name);\n        $('#investAmount').value = '';\n      } catch (e) { alert(e.message); }\n    }\n\n    function downloadExistingCert(certNumber, amount) {\n      generateCertificate(certNumber, amount, currentUser.name);\n    }\n\n    async function generateCertificate(certNumber, amount, name) {\n      const issueDate = new Date().toISOString().split('T')[0];\n      const maturity = new Date(new Date().setFullYear(new Date().getFullYear() + 3)).toISOString().split('T')[0];\n      const wrapper = document.createElement('div');\n      wrapper.style.position = 'absolute';\n      wrapper.style.left = '-9999px';\n      wrapper.innerHTML = `\n        <div style=\"width:800px;padding:40px;background:#fefdf8;border:6px double #0a1f44;font-family:Inter,sans-serif;\">\n          <div style=\"text-align:center;font-size:28px;font-weight:700;color:#0a1f44;\">ADASE ADS LTD<\/div>\n          <div style=\"text-align:center;font-size:20px;color:#c49a2b;margin:8px 0 20px;\">Convertible Note Certificate<\/div>\n          <p style=\"font-size:16px;\">This certifies that <strong>${name}<\/strong> has invested <strong>UGX ${amount.toLocaleString()}<\/strong> on <strong>${issueDate}<\/strong>.<\/p>\n          <table style=\"width:100%;margin:20px 0;font-size:14px;border-collapse:collapse;\">\n            <tr><td style=\"padding:8px 0;border-bottom:1px dotted #ccc;\">Certificate No<\/td><td style=\"font-weight:bold;\">${certNumber}<\/td><\/tr>\n            <tr><td style=\"padding:8px 0;border-bottom:1px dotted #ccc;\">Interest Rate<\/td><td>17% p.a.<\/td><\/tr>\n            <tr><td style=\"padding:8px 0;border-bottom:1px dotted #ccc;\">Maturity<\/td><td>${maturity}<\/td><\/tr>\n            <tr><td style=\"padding:8px 0;border-bottom:1px dotted #ccc;\">Conversion Discount<\/td><td>20%<\/td><\/tr>\n          <\/table>\n          <p style=\"margin-top:32px;font-style:italic;\">Authorized Signatory<\/p>\n        <\/div>\n      `;\n      document.body.appendChild(wrapper);\n      const canvas = await html2canvas(wrapper.firstChild, { scale: 2 });\n      document.body.removeChild(wrapper);\n      const link = document.createElement('a');\n      link.download = `Adase_Note_${certNumber}.png`;\n      link.href = canvas.toDataURL();\n      link.click();\n    }\n\n    \/\/ ==================== ADMIN ====================\n    \/\/ Show admin login or panel depending on whether admin is already logged in\n    function showAdminLoginOrPanel() {\n      if (adminToken) {\n        \/\/ Already logged in as admin \u2192 show panel directly\n        showAdminPanel();\n      } else {\n        \/\/ Show admin login form\n        $('#authSection').style.display = 'none';\n        $('#dashboardSections').style.display = 'none';\n        $('#adminPanel').style.display = 'none';\n        $('#adminLoginSection').style.display = 'block';\n      }\n    }\n\n    async function adminLogin() {\n      const password = $('#adminPassword').value;\n      try {\n        const data = await apiCall('\/admin\/login', 'POST', { email: 'shares@cashchat.se', password }, true);\n        adminToken = data.token;\n        localStorage.setItem('adminToken', adminToken);\n        showAdminPanel();\n      } catch (e) { alert('Admin login failed'); }\n    }\n\n    function showAdminPanel() {\n      $('#authSection').style.display = 'none';\n      $('#dashboardSections').style.display = 'none';\n      $('#adminPanel').style.display = 'block';\n      $('#adminLoginSection').style.display = 'none';\n      loadAdminRequests();\n      loadAdminUsers();\n    }\n\n    function adminLogout() {\n      localStorage.removeItem('adminToken');\n      adminToken = null;\n      \/\/ After logout, go to user view (or auth)\n      if (token) showUserDashboard();\n      else location.reload();\n    }\n\n    \/\/ Switch from admin panel back to user dashboard\n    function switchToUserView() {\n      if (token) {\n        showUserDashboard();\n      } else {\n        \/\/ No user logged in \u2013 go to main auth\n        $('#authSection').style.display = 'block';\n        $('#dashboardSections').style.display = 'none';\n        $('#adminPanel').style.display = 'none';\n        $('#adminLoginSection').style.display = 'none';\n      }\n    }\n\n    async function loadAdminRequests() {\n      try {\n        const res = await apiCall('\/admin\/requests', 'GET', null, true);\n        const { topups, withdraws, transfers } = res;\n        let html = '<h3>Top\u2011ups<\/h3>' + renderAdminTable(topups, 'topup') +\n                   '<h3>Withdrawals<\/h3>' + renderAdminTable(withdraws, 'withdraw') +\n                   '<h3>Transfers<\/h3>' + renderAdminTable(transfers, 'transfer');\n        $('#adminRequestsContainer').innerHTML = html;\n      } catch (e) { $('#adminRequestsContainer').innerHTML = 'Error loading'; }\n    }\n\n    function renderAdminTable(items, type) {\n      if (!items.length) return '<p>None<\/p>';\n      let html = '<table><thead><tr>';\n      if (type === 'transfer') html += '<th>From<\/th><th>To<\/th>';\n      else html += '<th>User<\/th>';\n      html += '<th>Amount<\/th><th>Status<\/th><th>Actions<\/th><\/tr><\/thead><tbody>';\n      items.forEach(item => {\n        const userName = item.userId ? (item.userId.firstName||'') + ' ' + (item.userId.lastName||'') : (item.fromUserId ? (item.fromUserId.firstName||'') + ' ' + (item.fromUserId.lastName||'') : '');\n        if (type === 'transfer') {\n          html += `<tr>\n            <td>${userName} (${item.fromUserId?.email})<\/td>\n            <td>${item.toUserEmail}<\/td>\n            <td>${item.amount}<\/td>\n            <td><span class=\"badge ${item.status==='approved'?'badge-success':item.status==='pending'?'badge-warning':'badge-danger'}\">${item.status}<\/span><\/td>\n            <td>${item.status==='pending' ? `<button class=\"btn\" onclick=\"adminApprove('transfer','${item._id}')\">Approve<\/button><button class=\"btn btn-outline\" onclick=\"adminDecline('transfer','${item._id}')\">Decline<\/button>` : ''}<\/td>\n          <\/tr>`;\n        } else {\n          html += `<tr>\n            <td>${userName} (${item.userId?.email})<\/td>\n            <td>${item.amount}<\/td>\n            <td><span class=\"badge ${item.status==='approved'?'badge-success':item.status==='pending'?'badge-warning':'badge-danger'}\">${item.status}<\/span><\/td>\n            <td>${item.status==='pending' ? `<button class=\"btn\" onclick=\"adminApprove('${type}','${item._id}')\">Approve<\/button><button class=\"btn btn-outline\" onclick=\"adminDecline('${type}','${item._id}')\">Decline<\/button><button class=\"btn\" onclick=\"adminRequestPayment('${item.userId?._id}')\">Req Payment<\/button>` : ''}<\/td>\n          <\/tr>`;\n        }\n      });\n      html += '<\/tbody><\/table>';\n      return html;\n    }\n\n    async function adminApprove(type, id) {\n      await apiCall(`\/admin\/${type}\/${id}`, 'POST', { status: 'approved' }, true);\n      loadAdminRequests();\n    }\n\n    async function adminDecline(type, id) {\n      await apiCall(`\/admin\/${type}\/${id}`, 'POST', { status: 'declined' }, true);\n      loadAdminRequests();\n    }\n\n    async function adminRequestPayment(userId) {\n      const msg = prompt('Enter message to request payment details (e.g., MTN number):');\n      if (msg) {\n        await apiCall(`\/admin\/notify\/${userId}`, 'POST', { message: msg }, true);\n        alert('Notification sent');\n      }\n    }\n\n    async function loadAdminUsers() {\n      try {\n        const users = await apiCall('\/admin\/users', 'GET', null, true);\n        let html = '<table><thead><tr><th>ID<\/th><th>Name<\/th><th>Email<\/th><th>Country<\/th><th>Mobile<\/th><th>NIN\/Passport<\/th><th>Wallet<\/th><th>Joined<\/th><\/tr><\/thead><tbody>';\n        users.forEach(u => {\n          html += `<tr>\n            <td>${u._id}<\/td>\n            <td>${u.firstName||''} ${u.lastName||''}<\/td>\n            <td>${u.email}<\/td>\n            <td>${u.country||''}<\/td>\n            <td>${u.mobile||''}<\/td>\n            <td>${u.nin||''}<\/td>\n            <td>${u.walletBalance.toLocaleString()} UGX<\/td>\n            <td>${new Date(u.createdAt).toLocaleDateString()}<\/td>\n          <\/tr>`;\n        });\n        html += '<\/tbody><\/table>';\n        $('#adminUsersContainer').innerHTML = html || '<p>No users found.<\/p>';\n      } catch (e) { $('#adminUsersContainer').innerHTML = 'Error loading'; }\n    }\n\n    async function adminSendNotification() {\n      const userId = $('#notifyUserId').value.trim();\n      const message = $('#notifyMsg').value.trim();\n      if (!userId || !message) return alert('Fill both fields');\n      await apiCall(`\/admin\/notify\/${userId}`, 'POST', { message }, true);\n      alert('Notification sent');\n    }\n\n    \/\/ ==================== INITIALIZATION ====================\n    document.querySelectorAll('.sidebar nav a[data-section]').forEach(a => {\n      a.addEventListener('click', e => {\n        e.preventDefault();\n        switchSection(a.dataset.section);\n      });\n    });\n    $('#logoutSidebar').addEventListener('click', e => {\n      e.preventDefault();\n      userLogout();\n    });\n    \/\/ Admin sidebar link\n    $('#adminSidebarLink').addEventListener('click', e => {\n      e.preventDefault();\n      showAdminLoginOrPanel();\n    });\n    $('#menuToggle').addEventListener('click', () => {\n      document.getElementById('sidebar').classList.toggle('open');\n    });\n\n    \/\/ Auto-login check\n    if (adminToken) {\n      apiCall('\/admin\/requests', 'GET', null, true)\n        .then(() => showAdminPanel())\n        .catch(() => { localStorage.removeItem('adminToken'); adminToken = null; });\n    } else if (token) {\n      apiCall('\/users\/me')\n        .then(u => { currentUser = u; showUserDashboard(); })\n        .catch(() => { localStorage.removeItem('token'); token = null; });\n    }\n\n    \/\/ Support for URL hash #admin (still works)\n    if (window.location.hash === '#admin') {\n      document.getElementById('authSection').style.display = 'none';\n      if (adminToken) showAdminPanel();\n      else document.getElementById('adminLoginSection').style.display = 'block';\n    }\n  <\/script>\n","protected":false},"excerpt":{"rendered":"<p>Adase Ads \u2013 Complete Dashboard ADASE ADS \ud83d\udcca Dashboard \ud83d\udcb0 Wallet \ud83d\udcdc Buy Notes \ud83c\udfe6 Investments \ud83e\uddfe Transactions \ud83d\udeaa Logout \ud83d\udd10 Admin \u2630 Adase Dashboard Welcome Login Register Email Password Login First Name * Last Name * Email * Country * Mobile Number * NIN \/ Passport Number * Password * Confirm Password * I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"pagelayer_contact_templates":[],"_pagelayer_content":"","footnotes":""},"class_list":["post-195","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/cashchat.se\/dir\/wp-json\/wp\/v2\/pages\/195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cashchat.se\/dir\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/cashchat.se\/dir\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/cashchat.se\/dir\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cashchat.se\/dir\/wp-json\/wp\/v2\/comments?post=195"}],"version-history":[{"count":1,"href":"https:\/\/cashchat.se\/dir\/wp-json\/wp\/v2\/pages\/195\/revisions"}],"predecessor-version":[{"id":196,"href":"https:\/\/cashchat.se\/dir\/wp-json\/wp\/v2\/pages\/195\/revisions\/196"}],"wp:attachment":[{"href":"https:\/\/cashchat.se\/dir\/wp-json\/wp\/v2\/media?parent=195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}