Update static/script.js
Browse files- static/script.js +4 -65
static/script.js
CHANGED
|
@@ -11,64 +11,6 @@ function login() {
|
|
| 11 |
}
|
| 12 |
}
|
| 13 |
|
| 14 |
-
// Gọi API tổng quan khi đăng nhập thành công
|
| 15 |
-
|
| 16 |
-
async function hienThiDanhSachPYC() {
|
| 17 |
-
try {
|
| 18 |
-
const res = await fetch("/dem_pyc_tat_ca");
|
| 19 |
-
const data = await res.json();
|
| 20 |
-
|
| 21 |
-
// Nếu API trả về số đang xử lý trong key 'tong_dang_xu_ly'
|
| 22 |
-
if (data.tong_dang_xu_ly !== undefined) {
|
| 23 |
-
document.getElementById("pycCount").textContent = data.tong_dang_xu_ly;
|
| 24 |
-
}
|
| 25 |
-
// Nếu bạn đã gán luôn vào 'tong_so_pyc' thì dùng dòng dưới:
|
| 26 |
-
else if (data.tong_so_pyc !== undefined) {
|
| 27 |
-
document.getElementById("pycCount").textContent = data.tong_so_pyc;
|
| 28 |
-
} else {
|
| 29 |
-
document.getElementById("pycCount").textContent = "Không tải được";
|
| 30 |
-
}
|
| 31 |
-
} catch (err) {
|
| 32 |
-
console.error("Lỗi khi gọi API PYC:", err);
|
| 33 |
-
document.getElementById("pycCount").textContent = "Lỗi";
|
| 34 |
-
}
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
async function hienThiSoPYCHoanThanh() {
|
| 39 |
-
try {
|
| 40 |
-
const res = await fetch("/dem_pyc_hoan_thanh");
|
| 41 |
-
const data = await res.json();
|
| 42 |
-
|
| 43 |
-
if (res.ok && data.tong_so_hoan_thanh !== undefined) {
|
| 44 |
-
document.getElementById("completedRequests").textContent = data.tong_so_hoan_thanh;
|
| 45 |
-
} else {
|
| 46 |
-
document.getElementById("completedRequests").textContent = "Không tải được";
|
| 47 |
-
}
|
| 48 |
-
} catch (err) {
|
| 49 |
-
console.error("Lỗi khi gọi API hoàn thành:", err);
|
| 50 |
-
document.getElementById("completedRequests").textContent = "Lỗi";
|
| 51 |
-
}
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
// Gọi API /tong_doanh_thu_pyc
|
| 56 |
-
async function hienThiDoanhThuPYC() {
|
| 57 |
-
try {
|
| 58 |
-
const res = await fetch("/tong_doanh_thu_pyc");
|
| 59 |
-
const data = await res.json();
|
| 60 |
-
if (res.ok && data.tong_doanh_thu !== undefined) {
|
| 61 |
-
const formatted = Number(data.tong_doanh_thu).toLocaleString("vi-VN") + " VND";
|
| 62 |
-
document.getElementById("requestRevenue").textContent = formatted;
|
| 63 |
-
} else {
|
| 64 |
-
document.getElementById("requestRevenue").textContent = "Không tải được";
|
| 65 |
-
}
|
| 66 |
-
} catch (err) {
|
| 67 |
-
console.error("Lỗi khi gọi API doanh thu:", err);
|
| 68 |
-
document.getElementById("requestRevenue").textContent = "Lỗi";
|
| 69 |
-
}
|
| 70 |
-
}
|
| 71 |
-
|
| 72 |
function chonMuc(muc) {
|
| 73 |
// Ẩn toàn bộ stats và nội dung bảng trước
|
| 74 |
document.querySelectorAll(".stats, .tab-content").forEach(el => el.style.display = "none");
|
|
@@ -78,13 +20,10 @@ function chonMuc(muc) {
|
|
| 78 |
const noiDung = document.getElementById("noiDungBang");
|
| 79 |
|
| 80 |
if (muc === "cho_xu_ly") {
|
| 81 |
-
document.getElementById("choXuLy").style.display = "flex";
|
| 82 |
-
hienThiDanhSachPYC();
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
document.getElementById("tieuDeBang").textContent = "Danh sách phiếu chờ xử lý";
|
| 86 |
-
|
| 87 |
-
const noiDung = document.getElementById("noiDungBang");
|
| 88 |
hienThiBangTuAPI("/ds_pyc_cho_xu_ly", noiDung);
|
| 89 |
}
|
| 90 |
else if (muc === "completedRequests") {
|
|
|
|
| 11 |
}
|
| 12 |
}
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
function chonMuc(muc) {
|
| 15 |
// Ẩn toàn bộ stats và nội dung bảng trước
|
| 16 |
document.querySelectorAll(".stats, .tab-content").forEach(el => el.style.display = "none");
|
|
|
|
| 20 |
const noiDung = document.getElementById("noiDungBang");
|
| 21 |
|
| 22 |
if (muc === "cho_xu_ly") {
|
| 23 |
+
document.getElementById("choXuLy").style.display = "flex";
|
| 24 |
+
hienThiDanhSachPYC();
|
| 25 |
+
bang.style.display = "block";
|
| 26 |
+
tieuDe.textContent = "Danh sách phiếu chờ xử lý";
|
|
|
|
|
|
|
|
|
|
| 27 |
hienThiBangTuAPI("/ds_pyc_cho_xu_ly", noiDung);
|
| 28 |
}
|
| 29 |
else if (muc === "completedRequests") {
|