diff --git a/index.js b/index.js index 077cff1..719dcdd 100644 --- a/index.js +++ b/index.js @@ -557,7 +557,7 @@ app.get("/project/:name/settings", checkAuthorization, async (req, res) => { }; const source = fs.readFileSync( - "static/templates/project/settings.html", + "static/templates/project/settings/settings.html", "utf8" ); const template = handlebars.compile(source); @@ -574,6 +574,182 @@ app.get("/project/:name/settings", checkAuthorization, async (req, res) => { }); }); +app.get( + "/project/:name/settings/modules", + checkAuthorization, + async (req, res) => { + const token = req.cookies.token; + const name = req.params.name; + console.log(token); + + if (!req.isAuth) { + res.redirect("/"); + return; + } + + var options = { + method: "GET", + url: process.env.API_SERVER + "/modules?name=" + name, + headers: { + Authorization: req.cookies.token, + }, + data: '-----011000010111000001101001\r\nContent-Disposition: form-data; name="searchText"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="page"\r\n\r\n\r\n-----011000010111000001101001--\r\n', + }; + + axios + .request(options) + .then(function (response) { + var templateData = { + API_SERVER: process.env.API_SERVER, + SITE_DOMAIN: process.env.SITE_DOMAIN, + IsAdmin: req.apiResponse.isadmin, + Name: name, + User: response.data.user, + Modules: response.data.data, + Project: response.data.project, + Projects: response.data.projects, + Tests: response.data.tests, + isAuth: req.isAuth, + }; + + const source = fs.readFileSync( + "static/templates/project/settings/modules.html", + "utf8" + ); + const template = handlebars.compile(source); + const resultT = template(templateData); + res.send(resultT); + }) + .catch(function (error) { + if (error.response && error.response.status === 401) { + res.redirect("/"); + } else { + console.error("Ошибка при отправке GET-запроса:", error); + res.status(500).send("Произошла ошибка при выполнении запроса."); + } + }); + } +); + +app.get( + "/project/:name/settings/payments", + checkAuthorization, + async (req, res) => { + const token = req.cookies.token; + const name = req.params.name; + + console.log(token); + + if (!req.isAuth) { + res.redirect("/"); + return; + } + + var options = { + method: "GET", + url: process.env.API_SERVER + "/payments?name=" + name, + headers: { + "Content-Type": + "multipart/form-data; boundary=---011000010111000001101001", + Authorization: req.cookies.token, + }, + data: '-----011000010111000001101001\r\nContent-Disposition: form-data; name="searchText"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="page"\r\n\r\n\r\n-----011000010111000001101001--\r\n', + }; + + axios + .request(options) + .then(function (response) { + var templateData = { + API_SERVER: process.env.API_SERVER, + SITE_DOMAIN: process.env.SITE_DOMAIN, + IsAdmin: req.apiResponse.isadmin, + Name: name, + Project: response.data.data, + Projects: response.data.projects, + User: response.data.user, + Payments: response.data.payments, + isAuth: req.isAuth, + }; + + const source = fs.readFileSync( + "static/templates/project/settings/payments.html", + "utf8" + ); + const template = handlebars.compile(source); + const resultT = template(templateData); + res.send(resultT); + }) + .catch(function (error) { + if (error.response && error.response.status === 401) { + res.redirect("/"); + } else { + console.error("Ошибка при отправке GET-запроса:", error); + res.status(500).send("Произошла ошибка при выполнении запроса."); + } + }); + } +); + +app.get( + "/project/:name/settings/payment/:id", + checkAuthorization, + async (req, res) => { + const token = req.cookies.token; + const name = req.params.name; + const id = req.params.id; + + console.log(token); + + if (!req.isAuth) { + res.redirect("/"); + return; + } + + var options = { + method: "GET", + url: process.env.API_SERVER + "/payment?name=" + name + "&id=" + id, + headers: { + "Content-Type": + "multipart/form-data; boundary=---011000010111000001101001", + Authorization: req.cookies.token, + }, + data: '-----011000010111000001101001\r\nContent-Disposition: form-data; name="searchText"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="page"\r\n\r\n\r\n-----011000010111000001101001--\r\n', + }; + + axios + .request(options) + .then(function (response) { + var templateData = { + API_SERVER: process.env.API_SERVER, + SITE_DOMAIN: process.env.SITE_DOMAIN, + IsAdmin: req.apiResponse.isadmin, + Name: name, + Payment: response.data.data, + Project: response.data.project, + Projects: response.data.projects, + User: response.data.user, + isAuth: req.isAuth, + }; + + const source = fs.readFileSync( + "static/templates/project/settings/payment.html", + "utf8" + ); + const template = handlebars.compile(source); + const resultT = template(templateData); + res.send(resultT); + }) + .catch(function (error) { + if (error.response && error.response.status === 401) { + res.redirect("/"); + } else { + res.redirect("/project/" + name + "/settings/payments"); + console.error("Ошибка при отправке GET-запроса:", error); + } + }); + } +); + app.get("/project/yandexauth", async (req, res) => { const name = req.params.name; var templateData = { diff --git a/static/img/plus.svg b/static/img/plus.svg new file mode 100644 index 0000000..2ebedae --- /dev/null +++ b/static/img/plus.svg @@ -0,0 +1,11 @@ + + + + diff --git a/static/scripts/full-payments-table.js b/static/scripts/full-payments-table.js new file mode 100644 index 0000000..ddd71f7 --- /dev/null +++ b/static/scripts/full-payments-table.js @@ -0,0 +1,40 @@ +$(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"); + row.setAttribute( + "onclick", + `location.href = '/project/codes/settings/payment/` + payment.id + `'` + ); + + const name = document.createElement("td"); + name.textContent = payment.name; + row.appendChild(name); + + const amount = document.createElement("td"); + amount.textContent = payment.amount; + row.appendChild(amount); + + const paid = document.createElement("td"); + if (payment.paid) { + paid.textContent = "Да"; + } else { + paid.textContent = "Нет"; + } + row.appendChild(paid); + + const lastupdate = document.createElement("td"); + lastupdate.textContent = payment.lastupdate; + row.appendChild(lastupdate); + + tbody.appendChild(row); + }); + }; + + createTable(); +}); diff --git a/static/scripts/notifications.js b/static/scripts/notifications.js index 86627de..9da74de 100644 --- a/static/scripts/notifications.js +++ b/static/scripts/notifications.js @@ -30,9 +30,11 @@ class Notifications { notiEl.classList.add("out"); notiEl.addEventListener("animationend", () => { notiEl.remove(); + document.querySelector(".notifications").style.zIndex = 2; }); } else { notiEl.remove(); + document.querySelector(".notifications").style.zIndex = 2; } } @@ -53,6 +55,8 @@ class Notifications { notiCardEl.appendChild(titleEl); notiCardEl.appendChild(descriptionEl); + document.querySelector(".notifications").style.zIndex = 5; + this.el.appendChild(notiEl); console.log("height", notiCardEl.scrollHeight); @@ -87,6 +91,7 @@ class Notifications { notiEl.classList.add("out"); notiEl.addEventListener("animationend", () => { notiEl.remove(); + document.querySelector(".notifications").style.zIndex = 2; }); }, duration * 1000); } diff --git a/static/styles/main.css b/static/styles/main.css index 14fbb16..c29415b 100644 --- a/static/styles/main.css +++ b/static/styles/main.css @@ -369,6 +369,7 @@ input[type="number"] { .form-cell-wrapper { position: relative; margin-bottom: 13px; + display: flex; } .form-cell-wrapper select { @@ -731,7 +732,8 @@ header.menu-opened ul.menu li.menu-item:nth-child(7) { padding: 0 24px; } -.sections a { +.sections a, +.settings-sections a { padding: 5px; border-radius: 6px; color: rgba(0, 0, 0, 0.6); @@ -748,7 +750,8 @@ header.menu-opened ul.menu li.menu-item:nth-child(7) { user-select: none; } -.sections a:hover { +.sections a:hover, +.settings-sections a:hover { background: rgba(0, 0, 0, 0.08); color: #0f0f10; } @@ -760,10 +763,24 @@ header.menu-opened ul.menu li.menu-item:nth-child(7) { border-bottom: 2px solid #000; } -.sections a.selected:hover { +.sections a.selected:hover, +.settings-sections a.selected:hover { background: transparent; } +.settings-sections { + display: inline-flex; + align-items: center; + gap: 20px; +} + +.settings-sections a.selected { + color: #0f0f10; + border-radius: 1px; + padding: 10px; + border-top: 2px solid #000; +} + .content-bg { border-bottom: 1px solid rgba(0, 0, 0, 0.1); border-top: 1px solid rgba(0, 0, 0, 0.1); @@ -780,6 +797,30 @@ header.menu-opened ul.menu li.menu-item:nth-child(7) { gap: 26px; } +.settings-content { + width: 1200px; + margin: 0 auto 48px auto; + height: 100%; + display: flex; + flex-wrap: wrap; + gap: 26px; +} + +input { + color: rgba(0, 0, 0, 0.7); + font-weight: 400; + background: #ffffff; + border: 1px solid rgba(0, 0, 0, 0.1); + outline: none; + background-repeat: no-repeat; + transition: 0.2s; + float: left; + border-radius: 6px; + height: 38px; + padding-left: 12px; + font-size: 18px; +} + .search-input { width: calc(100% - 40px); color: rgba(0, 0, 0, 0.7); @@ -799,12 +840,37 @@ header.menu-opened ul.menu li.menu-item:nth-child(7) { background-image: url("../img/magnifyingglass.svg"); } +.add-input { + width: calc(100% - 40px); + color: rgba(0, 0, 0, 0.7); + font-weight: 400; + background: #ffffff; + border: 1px solid rgba(0, 0, 0, 0.1); + outline: none; + background-repeat: no-repeat; + transition: 0.2s; + float: left; + border-radius: 6px; + height: 38px; + background-size: 18px 18px; + background-position: 12px 11px; + padding-left: 40px; + font-size: 18px; + background-image: url("../img/plus.svg"); +} + .search-input:focus, -.search-input:hover { +.search-input:hover, +.add-input:focus, +.add-input:hover, +input:focus, +input:hover { border: 1px solid rgba(0, 0, 0, 0.3); } -.search-input::placeholder { +.search-input::placeholder, +.add-input::placeholder, +input::placeholder { color: rgba(0, 0, 0, 0.25); opacity: 100%; } @@ -1787,6 +1853,7 @@ li { border: 1px solid rgba(0, 0, 0, 0.1); background: #fff; width: 100%; + min-height: 250px; } .progress-modules-section { @@ -1846,6 +1913,10 @@ li { display: flex; } +.empty-span-area.full { + height: 100%; +} + .empty-span { font-size: 18px; width: fit-content; @@ -1879,6 +1950,7 @@ li { gap: 8px; padding: 0 14px; cursor: pointer; + z-index: 3; } .upload-button:hover { @@ -1953,6 +2025,7 @@ li { border-radius: 15px; border: 1px solid rgba(0, 0, 0, 0.1); background: #fff; + min-height: 250px; } .setting-section { @@ -1963,6 +2036,11 @@ li { position: relative; border-radius: 6px; border: 1px solid #ebebeb; + opacity: 1; +} + +.setting-section.hidden { + opacity: 0; } .setting-top { @@ -2066,6 +2144,7 @@ select { border: 1px solid #000; cursor: pointer; transition: 0.3s; + z-index: 3; } .setting-bottom button:hover { @@ -2077,25 +2156,25 @@ select { background-color: rgba(0, 0, 0, 0.7); } -.setting-bottom button.inactive, -.setting-bottom button.inactive:hover, -.setting-bottom button.inactive:active { +button.inactive, +button.inactive:hover, +button.inactive:active { color: rgb(143, 143, 143); background: rgb(242, 242, 242); border: 1px solid rgba(143, 143, 143, 0.2); cursor: not-allowed; } -.setting-bottom #deleteUser { +.setting-bottom .delete { background: rgb(255, 69, 58); border: 1px solid rgb(255, 69, 58); } -.setting-bottom #deleteUser:hover { +.setting-bottom .delete:hover { background: rgba(255, 69, 58, 0.85); } -.setting-bottom #deleteUser:active { +.setting-bottom .delete:active { color: rgba(255, 255, 255, 0.85); background: rgba(255, 69, 58, 0.7); } @@ -2343,6 +2422,38 @@ input[type="checkbox"] { background: rgba(255, 69, 58, 0.7); } +.progress-bar { + width: 100%; + height: 20px; + background-color: #eee; + margin-top: 10px; + overflow: hidden; + border-radius: 8px; +} + +.progress-fill { + height: 100%; + background-color: rgb(255, 183, 75); + border-radius: 8px; + transition: width 0.7s; +} + +@keyframes fadeOut { + 0% { + opacity: 1; + } + 100% { + opacity: 0; + height: 0; + padding: 0; + margin: 0; + } +} + +.buttons { + z-index: 3; +} + @media (max-width: 1690px) { /* при разрешении монитора до 1690 пикселей */ diff --git a/static/templates/admin/usersettings.html b/static/templates/admin/usersettings.html index c28870e..6fd012a 100644 --- a/static/templates/admin/usersettings.html +++ b/static/templates/admin/usersettings.html @@ -171,7 +171,7 @@
|
-
-
-
+
+ {{#each Releases}}
+ {{this.body}}-{{this.published_at}}- нет приложений -
+ |
-
+
+
- {{this.body}}+{{this.published_at}}+ нет приложений |
| Назначение | +Сумма | +Оплачен ли | +Последнее обновление | +
|---|