initial commit
This commit is contained in:
46
static/scripts/payments-table.js
Normal file
46
static/scripts/payments-table.js
Normal file
@@ -0,0 +1,46 @@
|
||||
$(document).ready(function () {
|
||||
const createTable = () => {
|
||||
const table = document.getElementById("paymentsTable");
|
||||
const tbody = table.querySelector("tbody");
|
||||
// Очищаем таблицу
|
||||
tbody.innerHTML = "";
|
||||
|
||||
payments.forEach((payment) => {
|
||||
const row = document.createElement("tr");
|
||||
if (payment.path) {
|
||||
row.setAttribute(
|
||||
"onclick",
|
||||
`window.open('` + API_SERVER + `/` + payment.path + `', '_blank')`
|
||||
);
|
||||
}
|
||||
|
||||
const data = document.createElement("td");
|
||||
|
||||
const rowContainer = document.createElement("div");
|
||||
rowContainer.setAttribute("class", "row-container");
|
||||
|
||||
const rowContent = document.createElement("div");
|
||||
rowContent.setAttribute("class", "row-content");
|
||||
|
||||
const paymentAmount = document.createElement("h1");
|
||||
paymentAmount.textContent =
|
||||
payment.amount.toLocaleString("ru-RU") + " рублей";
|
||||
rowContent.appendChild(paymentAmount);
|
||||
|
||||
const paymentDate = document.createElement("h2");
|
||||
paymentDate.textContent = payment.date;
|
||||
rowContent.appendChild(paymentDate);
|
||||
|
||||
const paymentDescription = document.createElement("span");
|
||||
paymentDescription.textContent = payment.name;
|
||||
rowContent.appendChild(paymentDescription);
|
||||
|
||||
rowContainer.appendChild(rowContent);
|
||||
data.appendChild(rowContainer);
|
||||
row.appendChild(data);
|
||||
tbody.appendChild(row);
|
||||
});
|
||||
};
|
||||
|
||||
createTable();
|
||||
});
|
||||
Reference in New Issue
Block a user