-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactive1.html
More file actions
294 lines (254 loc) · 12 KB
/
active1.html
File metadata and controls
294 lines (254 loc) · 12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Active Users - MLM Level 1</title>
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"/>
<style>
:root{
--bg:#f5f7fa;
--card:#ffffff;
--sidebar:#ffffff;
--text:#111;
--accent:#00cfc8;
}
body.dark{
--bg:#0a0a0f;
--card:#111118;
--sidebar:#111118;
--text:#fff;
}
*{margin:0;padding:0;box-sizing:border-box;font-family:Inter,sans-serif;}
body{background:var(--bg);color:var(--text);min-height:100vh;display:flex;flex-direction:column;}
/* SIDEBAR */
.sidebar {
width: 250px;
background: var(--sidebar);
position: fixed;
left: -250px;
top: 0;
height: 100%;
padding: 20px;
transition: .3s;
z-index: 1000;
overflow-y:auto;
}
.sidebar.active{left:0;}
.sidebar h2{text-align:center;margin-bottom:25px;color:var(--accent);}
.menu-item {display:flex;align-items:center;justify-content:space-between;padding:12px;cursor:pointer;border-radius:0 28px 28px 0;}
.menu-item:hover {background: rgba(0,0,0,.05);}
.menu-left {display:flex;align-items:center;gap:6px;text-decoration:none;color:var(--text);}
.submenu{display:none;flex-direction:column;padding-left:28px;}
.submenu a{text-decoration:none;color:var(--accent);padding:10px 0;font-size:14px;}
.menu-item a.active,.menu-item.open>.menu-left{background: rgba(0,207,200,0.15); color: var(--text); width:100%; margin-left:-12px; margin-right:-12px; padding:12px 20px; min-height:40px; display:flex;align-items:center;gap:10px; border-left:10px solid var(--accent); border-radius:0 20px 20px 0;}
/* HEADER */
.header{display:flex;align-items:center;justify-content:space-between;background:var(--card);padding:12px 16px;border-radius:14px;margin-bottom:25px;box-shadow:0 6px 18px rgba(0,0,0,.08);border-left:4px solid var(--accent);}
.menu-toggle{width:38px;height:38px;border-radius:8px;background:var(--accent);display:flex;align-items:center;justify-content:center;cursor:pointer;position:relative;}
.menu-toggle span{width:18px;height:2px;background:#000;position:absolute;transition:.3s;}
body.dark .menu-toggle span{background:#fff;}
.menu-toggle span:nth-child(1){top:12px;}
.menu-toggle span:nth-child(2){top:18px;}
.menu-toggle span:nth-child(3){top:24px;}
.menu-toggle.active span:nth-child(1){top:18px;transform:rotate(45deg);}
.menu-toggle.active span:nth-child(2){opacity:0;}
.menu-toggle.active span:nth-child(3){top:18px;transform:rotate(-45deg);}
.mode-btn{background:var(--card);border:none;padding:8px 12px;border-radius:8px;cursor:pointer;display:flex;align-items:center;justify-content:center;}
/* BRAND */
.brand {display:flex;align-items:center;font-family:Arial,sans-serif;height:40px;padding-left:46px;}
.brand-name{font-size:25px;font-weight:bold;color:#1e1e1e;line-height:1;}
/* MAIN CONTENT */
.main{padding:20px;margin-left:0;transition:.3s;flex:1;display:flex;flex-direction:column;}
.content-wrapper{width:100%;max-width:1200px;flex:1;display:flex;flex-direction:column;}
/* CARD */
.card {background:#fff;border-radius:18px;box-shadow:0 6px 18px rgba(0,0,0,.08);padding:25px;margin-bottom:30px;display:flex;flex-direction:column;}
.card-header {background: linear-gradient(135deg, #00cfc8, #0077ff); color:#fff; padding:15px 20px; font-size:18px; font-weight:bold; border-radius:12px 12px 0 0;}
.card-body {padding:20px;display:flex;flex-direction:column;flex:1;}
/* EARNINGS & SEARCH */
.earnings {color:#4a6cf7;font-weight:bold;margin-bottom:6px;text-align:left;}
.search-box {display:flex;justify-content:flex-end;margin-bottom:15px;}
.search-box input {width:220px;padding:6px 10px;border:1px solid #cfcfe6;border-radius:4px;font-size:13px;}
/* TABLE */
.table-wrapper {max-height:400px;overflow-y:auto;border:1px solid #cfcfe6;border-radius:8px;}
table {width:100%;border-collapse:collapse;}
thead th {position:sticky;top:0;background:#eaeaff;z-index:2;padding:10px;font-size:14px;}
th, td {border:1px solid #cfcfe6;padding:10px;font-size:14px;text-align:center;white-space:nowrap;}
tbody tr:nth-child(even) {background:#fafafa;}
.status {padding:4px 10px;border-radius:12px;font-size:12px;color:white;}
.status.active {background:#2ecc71;}
/* PAGINATION */
.pagination {margin-top:15px;text-align:center;display:flex;justify-content:center;gap:10px;align-items:center;font-size:14px;}
.pagination button {padding:6px 12px;border:none;background:var(--accent);color:#fff;border-radius:6px;cursor:pointer;}
.pagination button:disabled{opacity:0.5;cursor:not-allowed;}
/* FOOTER */
footer{background:#f1f1f1;text-align:center;padding:15px;font-size:14px;margin-top:auto;}
</style>
</head>
<body>
<!-- SIDEBAR -->
<div class="sidebar" id="sidebar">
<strong>MENU</strong>
<div class="menu-item">
<a href="dashboard.html" class="menu-left"><i class="fa-solid fa-house"></i><span>Dashboard</span></a>
</div>
<div class="menu-item has-sub" id="downlinesBtn">
<div class="menu-left"><i class="fa-solid fa-users"></i><span>Downlines</span></div>
<i class="fa-solid fa-chevron-down toggle-icon"></i>
</div>
<div class="submenu">
<div class="menu-left"><span>Level 1</span></div>
<a href="#" class="active">Active</a>
<a href="#">Inactive</a>
</div>
</div>
<!-- MAIN CONTENT -->
<div class="main">
<div class="content-wrapper">
<!-- HEADER -->
<div class="header">
<div class="menu-toggle" id="menuToggle"><span></span><span></span><span></span></div>
<div class="brand"><span class="brand-name">LUMIEARN</span></div>
<div style="display:flex;align-items:center;gap:8px;">
<img id="countryFlag" src="" style="width:28px;height:20px;border-radius:4px;">
<button class="mode-btn" id="modeBtn"><i class="fa-solid fa-moon"></i></button>
<img id="dashboardAvatar" src="https://i.pravatar.cc/150?u=user" style="width:38px;height:38px;border-radius:50%;border:2px solid var(--accent);">
</div>
</div>
<!-- LEVEL 1 CARD -->
<div class="card">
<div class="card-header">ACTIVE USERS – MLM LEVEL 1</div>
<div class="card-body">
<div class="earnings" id="totalEarnings">Total Level 1 Earnings: 0</div>
<div class="earnings" id="totalUsers">Total Users: 0</div>
<div class="search-box">
<input type="text" id="searchInput" placeholder="Search user or phone...">
</div>
<div class="table-wrapper">
<table>
<thead>
<tr>
<th>USERNAME</th>
<th>MOBILE</th>
<th>LEVEL 1 EARNED</th>
<th>STATUS</th>
<th>BALANCE</th>
<th>COUNTRY</th>
<th>DATE JOINED</th>
</tr>
</thead>
<tbody id="tbody"></tbody>
</table>
</div>
<!-- PAGINATION -->
<div class="pagination">
<button id="prevPage">Previous</button>
<span id="pageInfo">Page 1 of 1</span>
<button id="nextPage">Next</button>
</div>
</div>
</div>
</div>
</div>
<!-- FOOTER -->
<footer>
Copyright © 2026 <strong>LUMIEARN</strong>. Designed with ❤️ by <strong>BestChoice Management</strong>. All rights reserved.
</footer>
<script>
document.addEventListener("DOMContentLoaded",()=>{
const VIEW_LEVEL = 1;
const loggedKey = localStorage.getItem("LUMIEARN_LOGGED_IN")?.toLowerCase();
if(!loggedKey) location.href="login.html";
const tbody = document.getElementById("tbody");
const perPage = 10;
let currentPage = 1;
let usersData = [];
const currencyRates = {USD:1,KSH:160,UGX:3900,TZS:2500,GHS:10};
function convertCurrency(amount, from, to){if(!currencyRates[from]||!currencyRates[to]) return 0; return Math.floor((amount/currencyRates[from])*currencyRates[to]);}
const refKey = "LUMIEARN_USER_"+loggedKey;
const referrer = JSON.parse(localStorage.getItem(refKey)) || {};
const refCurrency = referrer.currency || "KSH";
function getAllUsers(){return Object.keys(localStorage).filter(k=>k.startsWith("LUMIEARN_USER_")).map(k=>JSON.parse(localStorage.getItem(k)));}
function getNthUpline(username, level){let current=username.toLowerCase(); for(let i=0;i<level;i++){const u=JSON.parse(localStorage.getItem("LUMIEARN_USER_"+current)); if(!u||!u.referredBy)return null; current=u.referredBy.toLowerCase();} return current;}
function renderTable(){
tbody.innerHTML="";
const start = (currentPage-1)*perPage;
const end = start + perPage;
const pageUsers = usersData.slice(start,end);
let totalConverted = 0;
pageUsers.forEach(user=>{
const earned = user.mlmRewards?.l1 || 0;
const userCurrency = user.currency || "USD";
totalConverted += convertCurrency(earned,userCurrency,refCurrency);
tbody.innerHTML += `<tr>
<td>${user.username}</td>
<td>${user.phone||'N/A'}</td>
<td>${userCurrency} ${earned.toLocaleString()}</td>
<td><span class="status active">Active</span></td>
<td>${userCurrency} 0</td>
<td>${user.country||'N/A'}</td>
<td>${new Date(user.registeredAt).toLocaleDateString()}</td>
</tr>`;
});
document.getElementById("totalUsers").textContent="Total Users: "+usersData.length;
document.getElementById("totalEarnings").textContent=`Total Level 1 Earnings: ${refCurrency} ${totalConverted.toLocaleString()}`;
const totalPages = Math.ceil(usersData.length/perPage);
document.getElementById("pageInfo").textContent=`Page ${currentPage} of ${totalPages}`;
document.getElementById("prevPage").disabled = currentPage===1;
document.getElementById("nextPage").disabled = currentPage===totalPages;
}
usersData = getAllUsers().filter(user=>getNthUpline(user.username,VIEW_LEVEL)===loggedKey);
renderTable();
document.getElementById("prevPage").onclick=()=>{if(currentPage>1){currentPage--;renderTable();}};
document.getElementById("nextPage").onclick=()=>{const totalPages=Math.ceil(usersData.length/perPage); if(currentPage<totalPages){currentPage++;renderTable();}};
document.getElementById("searchInput").addEventListener("input",(e)=>{
const query = e.target.value.toLowerCase();
usersData = getAllUsers().filter(user=>{
const isUpline = getNthUpline(user.username, VIEW_LEVEL) === loggedKey;
const matchesUsername = user.username.toLowerCase().includes(query);
const matchesPhone = (user.phone || '').toLowerCase().includes(query);
return isUpline && (matchesUsername || matchesPhone);
});
currentPage = 1;
renderTable();
});
// Hamburger menu
const menuToggle=document.getElementById("menuToggle");
const sidebar=document.getElementById("sidebar");
menuToggle.onclick=()=>{sidebar.classList.toggle("active");menuToggle.classList.toggle("active");};
document.addEventListener("click",e=>{
if(!sidebar.contains(e.target)&&!menuToggle.contains(e.target)){
sidebar.classList.remove("active");
menuToggle.classList.remove("active");
}
});
// Dark mode
const modeBtn=document.getElementById("modeBtn");
modeBtn.onclick=()=>{document.body.classList.toggle("dark");};
// Submenu toggle
document.querySelectorAll(".menu-item.has-sub").forEach(item=>{
const submenu=item.nextElementSibling;
const toggleIcon=item.querySelector(".toggle-icon");
if(!submenu) return;
item.addEventListener("click",e=>{
e.stopPropagation();
const isOpen=item.classList.toggle("open");
submenu.style.display=isOpen?"flex":"none";
if(toggleIcon) toggleIcon.style.transform=isOpen?"rotate(180deg)":"rotate(0deg)";
});
});
// Country Flag
const userData = JSON.parse(localStorage.getItem(refKey)) || {};
const countryFlags = {
'Kenya':'https://flagcdn.com/w20/ke.png',
'Uganda':'https://flagcdn.com/w20/ug.png',
'Tanzania':'https://flagcdn.com/w20/tz.png',
'United States':'https://flagcdn.com/w20/us.png',
'Ghana':'https://flagcdn.com/w20/gh.png'
};
const flagImg = document.getElementById('countryFlag');
if(flagImg && countryFlags[userData.country]) flagImg.src = countryFlags[userData.country];
});
</script>
</body>
</html>