$(document).ready(function () { $("#date-range").dateRangePicker({ autoClose: true, format: "DD/MM/YYYY", separator: " - ", language: "ru", startOfWeek: "monday", getValue: function () { return this.innerHTML; }, setValue: function (s) { this.innerHTML = ` ` + s; }, startDate: false, endDate: false, time: { enabled: false, }, minDays: 0, maxDays: 0, showShortcuts: false, shortcuts: { //'prev-days': [1,3,5,7], //'next-days': [3,5,7], //'prev' : ['week','month','year'], //'next' : ['week','month','year'] }, customShortcuts: [], inline: false, container: "body", alwaysOpen: false, singleDate: false, lookBehind: false, batchMode: false, duration: 200, stickyMonths: false, dayDivAttrs: [], dayTdAttrs: [], applyBtnClass: "", singleMonth: "true", hoveringTooltip: function (days, startTime, hoveringTime) { return days > 1 ? days + " " + lang("days") : ""; }, showTopbar: false, swapTime: false, selectForward: false, selectBackward: false, showWeekNumbers: false, getWeekNumber: function (date) { return moment(date).format("w"); }, monthSelect: false, yearSelect: false, }); const createTable = () => { const table = document.getElementById("modules-table"); const tbody = table.querySelector("tbody"); // Очищаем таблицу tbody.innerHTML = ""; modules.forEach((modul) => { const row = document.createElement("tr"); 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 moduleName = document.createElement("h1"); moduleName.textContent = modul.name; rowContent.appendChild(moduleName); const moduleStatus = document.createElement("h2"); moduleStatus.textContent = modul.status + "%"; rowContent.appendChild(moduleStatus); const status = document.createElement("div"); status.setAttribute("class", "status"); status.style.backgroundColor = "rgba(0, 0, 0, 0.05)"; const fill = document.createElement("div"); if (modul.status === 100) { fill.style.width = `${modul.status}%`; fill.style.height = "100%"; fill.style.backgroundColor = "#32D74B"; fill.style.borderRadius = "5px"; } else { fill.style.width = `${modul.status}%`; fill.style.height = "100%"; fill.style.backgroundColor = "#FFB74B"; fill.style.borderRadius = "5px 0px 0px 5px"; } status.appendChild(fill); rowContent.appendChild(status); rowContainer.appendChild(rowContent); data.appendChild(rowContainer); row.appendChild(data); tbody.appendChild(row); }); }; createTable(); });