fix: default report dates to today

This commit is contained in:
nyan404 committed 2026-09-13 12:28:48 +03:00
1 parent b5ad850a53
commit 8241e84757
3 files changed
+13 -5

No files matched your search

+6 -4
View File
@@ -110,7 +110,7 @@
</div>
<form id="form">
<div id="coaching" class="grid mode">
<label>Дата<input name="date" value="15.08" required>
<label>Дата<input name="date" required>
<div class="quick-actions"><button type="button" id="todayBtn" class="today-btn quick-btn">Сегодня</button></div>
</label>
<label>Навык<select name="skill"><option>ЛУ</option><option>ЗУ</option></select></label>
@@ -129,7 +129,7 @@
</div>
<div id="training" class="grid mode hidden">
<label>Дата<input name="date" value="15.08" inputmode="numeric" pattern="\d{1,2}\.\d{1,2}" required>
<label>Дата<input name="date" inputmode="numeric" pattern="\d{1,2}\.\d{1,2}" required>
<div class="quick-actions"><button type="button" class="today-btn quick-btn">Сегодня</button></div>
</label>
<label>Имя сопровождающего<input name="escort_name"></label>
@@ -332,10 +332,12 @@
pointsActivity.addEventListener('change', updatePointsFields);
document.querySelector('#points [name="kitten_count"]').addEventListener('change', updatePointsFields);
document.querySelector('#coaching [name="skill"]').addEventListener('change', updateStatusRules);
document.querySelectorAll('.today-btn').forEach(button => button.addEventListener('click', () => {
function setToday(button) {
const now = new Date();
button.closest('label').querySelector('input').value = `${String(now.getDate()).padStart(2, '0')}.${String(now.getMonth() + 1).padStart(2, '0')}`;
}));
}
document.querySelectorAll('.today-btn').forEach(setToday);
document.querySelectorAll('.today-btn').forEach(button => button.addEventListener('click', () => setToday(button)));
document.querySelector('#coaching [name="kitten_independence"]').addEventListener('change', updateStatusRules);
// Writes a value into a named field inside a calculator panel.
function setField(panel, name, value) {