Skip to content
This repository was archived by the owner on Feb 20, 2026. It is now read-only.

Commit d90f9a9

Browse files
Update balance chart for admin view
Bug is in admin view due to logic issue, fixed by making it have different values Signed-off-by: Shahm Najeeb <Nirt_12023@outlook.com>
1 parent 61380ed commit d90f9a9

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

templates/wallet.html

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -231,26 +231,42 @@ <h5 class="mb-0">Recent Activity</h5>
231231

232232
// Balance Chart
233233
const ctx = document.getElementById('balanceChart').getContext('2d');
234+
const is_admin = window.location.pathname.includes('/wallet/admin');
234235
const balanceChart = new Chart(ctx, {
235236
type: 'doughnut',
236237
data: {
237-
labels: ['Your Balance', 'In Circulation (Others)', 'Available in Bank'],
238+
labels: is_admin ? ['In Circulation', 'Not in Circulation'] : ['Your Balance', 'In Circulation (Others)', 'Available in Bank'],
238239
datasets: [{
239-
data: [
240-
{{ user.current_currency }},
241-
{{ total_used - user.current_currency }},
242-
{{ settings.maximum_currency - total_used }}
243-
],
244-
backgroundColor: [
245-
'rgba(54, 162, 235, 0.8)',
246-
'rgba(255, 159, 64, 0.8)',
247-
'rgba(75, 192, 192, 0.8)'
248-
],
249-
borderColor: [
250-
'rgba(54, 162, 235, 1)',
251-
'rgba(255, 159, 64, 1)',
252-
'rgba(75, 192, 192, 1)'
253-
],
240+
data: is_admin
241+
? [
242+
{{ total_used }},
243+
{{ settings.maximum_currency - total_used }}
244+
]
245+
: [
246+
{{ user.current_currency }},
247+
{{ total_used - user.current_currency }},
248+
{{ settings.maximum_currency - total_used }}
249+
],
250+
backgroundColor: is_admin
251+
? [
252+
'rgba(255, 159, 64, 0.8)',
253+
'rgba(75, 192, 192, 0.8)'
254+
]
255+
: [
256+
'rgba(54, 162, 235, 0.8)',
257+
'rgba(255, 159, 64, 0.8)',
258+
'rgba(75, 192, 192, 0.8)'
259+
],
260+
borderColor: is_admin
261+
? [
262+
'rgba(255, 159, 64, 1)',
263+
'rgba(75, 192, 192, 1)'
264+
]
265+
: [
266+
'rgba(54, 162, 235, 1)',
267+
'rgba(255, 159, 64, 1)',
268+
'rgba(75, 192, 192, 1)'
269+
],
254270
borderWidth: 1
255271
}]
256272
},

0 commit comments

Comments
 (0)