Update: 2026-05-03 21:37:02
This commit is contained in:
@@ -50,15 +50,15 @@
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
<div class="p-6 bg-surface border border-gray-800 rounded">
|
||||
<p class="text-gray-500 text-sm">إجمالي الفواتير</p>
|
||||
<p class="text-3xl font-bold mt-2">1,240</p>
|
||||
<p class="text-3xl font-bold mt-2" x-text="stats.total"></p>
|
||||
</div>
|
||||
<div class="p-6 bg-surface border border-gray-800 rounded">
|
||||
<p class="text-gray-500 text-sm">قيد المعالجة</p>
|
||||
<p class="text-3xl font-bold mt-2 text-yellow-500">12</p>
|
||||
<p class="text-3xl font-bold mt-2 text-yellow-500" x-text="stats.pending"></p>
|
||||
</div>
|
||||
<div class="p-6 bg-surface border border-gray-800 rounded">
|
||||
<p class="text-gray-500 text-sm">تم الاعتماد</p>
|
||||
<p class="text-3xl font-bold mt-2 text-emerald-500">1,228</p>
|
||||
<p class="text-3xl font-bold mt-2 text-emerald-500" x-text="stats.approved"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -96,10 +96,12 @@
|
||||
user: JSON.parse(localStorage.getItem('user')),
|
||||
page: 'dashboard',
|
||||
users: [],
|
||||
stats: { total: 0, pending: 0, approved: 0 },
|
||||
|
||||
init() {
|
||||
if (!this.user) window.location.href = '/login.php';
|
||||
this.loadUsers();
|
||||
this.loadStats();
|
||||
},
|
||||
|
||||
title() {
|
||||
@@ -107,7 +109,7 @@
|
||||
},
|
||||
|
||||
async loadUsers() {
|
||||
const res = await fetch('/api/users', {
|
||||
const res = await fetch('/api/v1/users', {
|
||||
headers: { 'Authorization': 'Bearer ' + localStorage.getItem('access_token') }
|
||||
});
|
||||
if (res.status === 401) this.logout();
|
||||
@@ -115,6 +117,14 @@
|
||||
if (json.success) this.users = json.data;
|
||||
},
|
||||
|
||||
async loadStats() {
|
||||
const res = await fetch('/api/v1/dashboard/stats', {
|
||||
headers: { 'Authorization': 'Bearer ' + localStorage.getItem('access_token') }
|
||||
});
|
||||
const json = await res.json();
|
||||
if (json.success) this.stats = json.data;
|
||||
},
|
||||
|
||||
logout() {
|
||||
localStorage.clear();
|
||||
window.location.href = '/login.php';
|
||||
|
||||
Reference in New Issue
Block a user