Spaces:
Sleeping

doluong6 commited on
Commit
8694e05
·
verified ·
1 Parent(s): 40aff20

Update static/script.js

Browse files
Files changed (1) hide show
  1. static/script.js +11 -9
static/script.js CHANGED
@@ -30,16 +30,19 @@ function chonMuc(muc) {
30
  document.querySelectorAll(".fade-in").forEach(el => el.style.display = "none");
31
 
32
  if (muc === "pycload") {
33
- document.getElementById("pycload").style.display = "flex";
34
- document.getElementById("bangPYCChoXuLy").style.display = "block";
35
- hienThiSoLuongPYCChoXuLy(); // gọi API 1
36
- hienThiDanhSachPYCChoXuLy(); // gọi API 2
 
 
 
 
37
  }
38
 
39
- // Các mục khác sẽ xử lý tương tự
40
  }
41
 
42
- // Gọi API để hiển thị số lượng phiếu đang chờ xử lý
43
  async function hienThiSoLuongPYCChoXuLy() {
44
  try {
45
  const res = await fetch("/dem_pyc_tat_ca");
@@ -47,12 +50,11 @@ async function hienThiSoLuongPYCChoXuLy() {
47
  const so = data?.tong_dang_xu_ly || 0;
48
  document.getElementById("pycCount").innerText = `${so} phiếu`;
49
  } catch (err) {
50
- document.getElementById("pycCount").innerText = "Lỗi tải số liệu";
51
  console.error("Lỗi API dem_pyc_tat_ca:", err);
 
52
  }
53
  }
54
 
55
- // Gọi API để hiển thị bảng danh sách phiếu chờ xử lý
56
  async function hienThiDanhSachPYCChoXuLy() {
57
  try {
58
  const res = await fetch("/ds_pyc_cho_xu_ly");
@@ -69,7 +71,6 @@ async function hienThiDanhSachPYCChoXuLy() {
69
  tbody.innerHTML += row;
70
  });
71
 
72
- // Khởi tạo bảng nếu chưa có
73
  if (!$.fn.DataTable.isDataTable("#tablePYCChoXuLy")) {
74
  $("#tablePYCChoXuLy").DataTable();
75
  }
@@ -77,3 +78,4 @@ async function hienThiDanhSachPYCChoXuLy() {
77
  console.error("Lỗi API ds_pyc_cho_xu_ly:", err);
78
  }
79
  }
 
 
30
  document.querySelectorAll(".fade-in").forEach(el => el.style.display = "none");
31
 
32
  if (muc === "pycload") {
33
+ const stat = document.getElementById("pycload");
34
+ const bang = document.getElementById("bangPYCChoXuLy");
35
+
36
+ if (stat) stat.style.display = "flex";
37
+ if (bang) bang.style.display = "block";
38
+
39
+ hienThiSoLuongPYCChoXuLy();
40
+ hienThiDanhSachPYCChoXuLy();
41
  }
42
 
43
+ // ... các mục khác
44
  }
45
 
 
46
  async function hienThiSoLuongPYCChoXuLy() {
47
  try {
48
  const res = await fetch("/dem_pyc_tat_ca");
 
50
  const so = data?.tong_dang_xu_ly || 0;
51
  document.getElementById("pycCount").innerText = `${so} phiếu`;
52
  } catch (err) {
 
53
  console.error("Lỗi API dem_pyc_tat_ca:", err);
54
+ document.getElementById("pycCount").innerText = "Lỗi tải dữ liệu";
55
  }
56
  }
57
 
 
58
  async function hienThiDanhSachPYCChoXuLy() {
59
  try {
60
  const res = await fetch("/ds_pyc_cho_xu_ly");
 
71
  tbody.innerHTML += row;
72
  });
73
 
 
74
  if (!$.fn.DataTable.isDataTable("#tablePYCChoXuLy")) {
75
  $("#tablePYCChoXuLy").DataTable();
76
  }
 
78
  console.error("Lỗi API ds_pyc_cho_xu_ly:", err);
79
  }
80
  }
81
+