Download static/script3333.js from doluong6/QLHT6: direct link, hf CLI and curl.
- Browser
- Download file 3.34 kB
-
https://huggingface.co/spaces/doluong6/QLHT6/resolve/main/static/script3333.js
- Command line
-
hf download hf://spaces/doluong6/QLHT6/static/script3333.js
-
curl -L -o script3333.js https://huggingface.co/spaces/doluong6/QLHT6/resolve/main/static/script3333.js
3.34 kB
| function login() { | |
| const u = document.getElementById("username").value; | |
| const p = document.getElementById("password").value; | |
| if (u === "admin" && p === "1234") { | |
| document.getElementById("login").style.display = "none"; | |
| document.getElementById("dashboard").style.display = "block"; | |
| chonMuc("pyc"); | |
| } else { | |
| alert("Sai tên đăng nhập hoặc mật khẩu!"); | |
| } | |
| } | |
| function toggleSubmenu(id) { | |
| const submenu = document.getElementById(id); | |
| const arrow = document.getElementById("arrow-" + id); | |
| if (submenu.style.display === "block") { | |
| submenu.style.display = "none"; | |
| arrow.innerText = "►"; | |
| } else { | |
| submenu.style.display = "block"; | |
| arrow.innerText = "▼"; | |
| } | |
| } | |
| function anTatCa() { | |
| document.querySelectorAll(".fade-in").forEach(el => el.style.display = "none"); | |
| } | |
| function chonMuc(muc) { | |
| anTatCa(); | |
| if (muc === "cho_xu_ly") hienThiPYCChoXuLy(); | |
| if (muc === "pyc") hienThiDanhSachPYC(); | |
| if (muc === "completedRequests") hienThiPYCCompleted(); | |
| if (muc === "requestRevenue") hienThiDoanhThuPYC(); | |
| } | |
| // ===== HIỂN THỊ ===== | |
| async function hienThiPYCChoXuLy() { | |
| try { | |
| const res = await fetch("/ds_pyc_cho_xu_ly"); | |
| const data = await res.json(); | |
| const tbody = document.querySelector("#tablePYCChoXuLy tbody"); | |
| tbody.innerHTML = ""; | |
| data.forEach(row => { | |
| tbody.innerHTML += `<tr><td>${row["Khách hàng"]}</td><td>${row["File PYC"]}</td></tr>`; | |
| }); | |
| document.getElementById("bangPYCChoXuLy").style.display = "block"; | |
| if (!$.fn.DataTable.isDataTable("#tablePYCChoXuLy")) { | |
| $("#tablePYCChoXuLy").DataTable(); | |
| } | |
| } catch (err) { | |
| console.error("Lỗi chờ xử lý:", err); | |
| } | |
| } | |
| async function hienThiDanhSachPYC() { | |
| try { | |
| const res = await fetch("/pyc_chua_hoan_thanh"); | |
| const data = await res.json(); | |
| let html = ` | |
| <table class="display" id="bangPYC"> | |
| <thead><tr><th>Mã phiếu</th><th>Khách hàng</th><th>Ngày tạo</th></tr></thead> | |
| <tbody>`; | |
| data.forEach(item => { | |
| html += `<tr><td>${item["Phiếu yêu cầu"]}</td><td>${item["Khách hàng"]}</td><td>${item["Ngày tạo phiếu"]}</td></tr>`; | |
| }); | |
| html += "</tbody></table>"; | |
| document.getElementById("noiDungBang").innerHTML = html; | |
| $("#bangPYC").DataTable(); | |
| document.getElementById("bangChiTiet").style.display = "block"; | |
| document.getElementById("tieuDeBang").innerText = "Danh sách phiếu chưa hoàn thành"; | |
| } catch (err) { | |
| console.error("Lỗi chưa hoàn thành:", err); | |
| } | |
| } | |
| async function hienThiPYCCompleted() { | |
| try { | |
| const res = await fetch("/dem_pyc_hoan_thanh"); | |
| const data = await res.json(); | |
| const so = data.tong_so_hoan_thanh || 0; | |
| document.getElementById("completedRequests").innerText = so; | |
| document.getElementById("daHoanThanh").style.display = "block"; | |
| } catch (err) { | |
| console.error("Lỗi hoàn thành:", err); | |
| } | |
| } | |
| async function hienThiDoanhThuPYC() { | |
| try { | |
| const res = await fetch("/doanh_thu_theo_pyc"); // Cần xác nhận API này có tồn tại | |
| const data = await res.json(); | |
| const dt = data.doanh_thu || 0; | |
| document.getElementById("requestRevenue").innerText = dt; | |
| document.getElementById("doanhThuPYC").style.display = "block"; | |
| } catch (err) { | |
| console.error("Lỗi doanh thu:", err); | |
| } | |
| } | |