<!-- ======================
ADMIN PANEL
====================== -->
<div id="k44-admin-panel">
<div class="k44-admin-title">
ADMIN CHỈNH SỬA THÀNH VIÊN
</div>
<input type="password"
id="admin-pass"
class="k44-admin-input"
placeholder="Mật khẩu admin" />
<div class="k44-load-box">
<input type="number"
id="load-stt"
class="k44-admin-input"
placeholder="Nhập STT" />
<button id="load-btn"
class="k44-admin-btn">
TẢI THÔNG TIN
</button>
</div>
<input type="hidden" id="member-stt" />
<input type="text"
id="member-ho"
class="k44-admin-input"
placeholder="Họ" />
<input type="text"
id="member-ten"
class="k44-admin-input"
placeholder="Tên" />
<input type="text"
id="member-sdt"
class="k44-admin-input"
placeholder="Số điện thoại" />
<input type="text"
id="member-email"
class="k44-admin-input"
placeholder="Email" />
<input type="text"
id="member-congty"
class="k44-admin-input"
placeholder="Công ty" />
<input type="text"
id="member-noilamviec"
class="k44-admin-input"
placeholder="Nơi làm việc" />
<input type="text"
id="member-diachi"
class="k44-admin-input"
placeholder="Địa chỉ" />
<input type="text"
id="member-honnhan"
class="k44-admin-input"
placeholder="Hôn nhân" />
<textarea id="member-ghichu"
class="k44-admin-input"
placeholder="Ghi chú"></textarea>
<button id="update-btn"
class="k44-admin-btn">
CẬP NHẬT THÀNH VIÊN
</button>
<div id="admin-status"></div>
</div>
<style>
#k44-admin-panel{
margin-top:20px;
padding:15px;
background:#fff;
border:1px solid #ddd;
border-radius:12px;
}
.k44-admin-title{
text-align:center;
font-size:16px;
font-weight:bold;
margin-bottom:15px;
color:#e65100;
}
.k44-admin-input{
width:100%;
height:42px;
margin-bottom:10px;
border:1px solid #ccc;
border-radius:8px;
padding:0 12px;
font-size:14px;
box-sizing:border-box;
}
textarea.k44-admin-input{
height:80px;
padding-top:10px;
}
.k44-admin-btn{
width:100%;
height:42px;
border:none;
border-radius:8px;
background:linear-gradient(135deg,#ff9800,#f57c00);
color:#fff;
font-weight:bold;
cursor:pointer;
margin-bottom:10px;
}
#admin-status{
text-align:center;
font-size:14px;
margin-top:10px;
}
</style>
<script>
(function(){
const API =
"https://script.google.com/macros/s/AKfycbzf8EUSjt1wZtzYH2iHFNdj8oqGI3R2x0nWTHAkfhcBXybb7u7UEc5lXXkT1RgjaqGhow/exec";
const loadBtn =
document.getElementById("load-btn");
const updateBtn =
document.getElementById("update-btn");
const status =
document.getElementById("admin-status");
// LOAD MEMBER
loadBtn.addEventListener(
"click",
loadMember
);
function loadMember(){
const stt =
document.getElementById(
"load-stt"
).value;
if(!stt){
alert("Nhập STT");
return;
}
status.innerHTML =
"⏳ Đang tải dữ liệu...";
fetch(API + "?stt=" + stt)
.then(r => r.json())
.then(data => {
if(!data || data.length === 0){
status.innerHTML =
"❌ Không tìm thấy";
return;
}
const item = data[0];
document.getElementById(
"member-stt"
).value = item.stt || "";
document.getElementById(
"member-ho"
).value = item.ho || "";
document.getElementById(
"member-ten"
).value = item.ten || "";
document.getElementById(
"member-sdt"
).value = item.sdt || "";
document.getElementById(
"member-email"
).value = item.email || "";
document.getElementById(
"member-congty"
).value = item.congty || "";
document.getElementById(
"member-noilamviec"
).value = item.noilamviec || "";
document.getElementById(
"member-diachi"
).value = item.diachi || "";
document.getElementById(
"member-honnhan"
).value = item.honnhan || "";
document.getElementById(
"member-ghichu"
).value = item.ghichu || "";
status.innerHTML =
"✅ Đã tải dữ liệu";
})
.catch(err => {
console.log(err);
status.innerHTML =
"❌ Lỗi tải dữ liệu";
});
}
// UPDATE MEMBER
updateBtn.addEventListener(
"click",
updateMember
);
function updateMember(){
const data = {
password:
document.getElementById(
"admin-pass"
).value,
stt:
document.getElementById(
"member-stt"
).value,
ho:
document.getElementById(
"member-ho"
).value,
ten:
document.getElementById(
"member-ten"
).value,
sdt:
document.getElementById(
"member-sdt"
).value,
email:
document.getElementById(
"member-email"
).value,
congty:
document.getElementById(
"member-congty"
).value,
noilamviec:
document.getElementById(
"member-noilamviec"
).value,
diachi:
document.getElementById(
"member-diachi"
).value,
honnhan:
document.getElementById(
"member-honnhan"
).value,
ghichu:
document.getElementById(
"member-ghichu"
).value
};
status.innerHTML =
"⏳ Đang cập nhật...";
fetch(API,{
method:"POST",
body:JSON.stringify(data)
})
.then(r=>r.text())
.then(msg=>{
status.innerHTML =
"✅ " + msg;
})
.catch(err=>{
console.log(err);
status.innerHTML =
"❌ Lỗi cập nhật";
});
}
})();
</script>


tháng 5 24, 2026
khactrinh
Đăng nhận xét