баг-фикс 30/34

This commit is contained in:
Zuev
2026-07-19 14:40:43 +03:00
parent 3d798c13e3
commit bc0e1ab1b4
172 changed files with 13431 additions and 2910 deletions

View File

@@ -25,24 +25,44 @@ export function hideAlert(elementId) {
el.textContent = '';
}
/** Форматирует календарную дату по локальным компонентам без UTC-сдвига. */
export function formatLocalDate(date) {
if (!(date instanceof Date) || Number.isNaN(date.getTime())) {
throw new TypeError('Ожидалась корректная дата');
}
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
export function renderStatusMessage(container, message, className = 'form-alert error') {
if (!container) return;
const element = document.createElement('div');
element.className = className;
element.textContent = message;
container.replaceChildren(element);
}
export function renderTableMessage(tbody, columnCount, message) {
if (!tbody) return;
const row = document.createElement('tr');
const cell = document.createElement('td');
cell.colSpan = columnCount;
cell.className = 'loading-row';
cell.textContent = message;
row.appendChild(cell);
tbody.replaceChildren(row);
}
export function applyRippleEffect() {
document.addEventListener('click', function (e) {
const btn = e.target.closest('.btn-primary, .btn-danger, .btn-danger-subtle, .btn-logout');
if (!btn) return;
const rect = btn.getBoundingClientRect();
const x = e.clientX - rect.left;
const y = e.clientY - rect.top;
const ripple = document.createElement('span');
ripple.classList.add('ripple');
ripple.style.left = `${x}px`;
ripple.style.top = `${y}px`;
if (getComputedStyle(btn).position === 'static') {
btn.style.position = 'relative';
}
btn.style.overflow = 'hidden';
btn.classList.add('ripple-host');
btn.appendChild(ripple);