37 lines
967 B
JavaScript
37 lines
967 B
JavaScript
$(document).ready(function () {
|
|
const createTable = () => {
|
|
const table = document.getElementById("usersTable");
|
|
const tbody = table.querySelector("tbody");
|
|
// Очищаем таблицу
|
|
tbody.innerHTML = "";
|
|
|
|
users.forEach((user) => {
|
|
const row = document.createElement("tr");
|
|
row.setAttribute(
|
|
"onclick",
|
|
`location.href = '/admin/user/` + user.id + `'`
|
|
);
|
|
|
|
const email = document.createElement("td");
|
|
email.textContent = user.email;
|
|
row.appendChild(email);
|
|
|
|
const name = document.createElement("td");
|
|
name.textContent = user.name;
|
|
row.appendChild(name);
|
|
|
|
const phone = document.createElement("td");
|
|
phone.textContent = user.phone;
|
|
row.appendChild(phone);
|
|
|
|
const projects = document.createElement("td");
|
|
projects.textContent = user.projects;
|
|
row.appendChild(projects);
|
|
|
|
tbody.appendChild(row);
|
|
});
|
|
};
|
|
|
|
createTable();
|
|
});
|