Исправление: проверка полей на undefined, кнопка сброса localStorage, фильтр q3/q4
This commit is contained in:
parent
ba1d4344aa
commit
18cdfb1593
22
index.html
22
index.html
@ -107,6 +107,7 @@
|
||||
</div>
|
||||
<span class="kt-ai-spacer"></span>
|
||||
<button class="kt-ai-btn" data-variant="ghost" id="btn-reset">Сбросить фильтры</button>
|
||||
<button class="kt-ai-btn" data-variant="ghost" id="btn-clear-storage" title="Очистить сохранённые данные и загрузить демо заново">Сброс данных</button>
|
||||
</div>
|
||||
|
||||
<div id="empty-state" class="empty-state" style="display:none">
|
||||
@ -280,9 +281,9 @@ function renderGroup(group, index) {
|
||||
<div class="item-name" style="margin-bottom:var(--kt-ai-space-1)">${item.name}</div>
|
||||
<div class="item-code">${item.code}</div>
|
||||
<div style="font-size:var(--kt-ai-text-xs);color:var(--kt-ai-fg-muted);margin-top:var(--kt-ai-space-1)">
|
||||
<div style="margin-bottom:2px"><strong>Характеристики:</strong> ${item.specs}</div>
|
||||
<div style="margin-bottom:2px"><strong>Срок поставки:</strong> ${item.deliveryDate}</div>
|
||||
<div><strong>Место:</strong> ${item.deliveryPlace}</div>
|
||||
${item.specs ? `<div style="margin-bottom:2px"><strong>Характеристики:</strong> ${item.specs}</div>` : ''}
|
||||
${item.deliveryDate ? `<div style="margin-bottom:2px"><strong>Срок поставки:</strong> ${item.deliveryDate}</div>` : '<div style="margin-bottom:2px"><strong>Срок поставки:</strong> <em>не указан</em></div>'}
|
||||
${item.deliveryPlace ? `<div><strong>Место:</strong> ${item.deliveryPlace}</div>` : '<div><strong>Место:</strong> <em>не указано</em></div>'}
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-category"><span class="kt-ai-chip" data-tone="gray">${CATEGORY_NAMES[item.category]}</span></div>
|
||||
@ -335,6 +336,8 @@ function filterGroups() {
|
||||
if (period === '2025' && itemYear !== '2025') return false;
|
||||
if (period === 'q1' && itemPeriod !== 'q1') return false;
|
||||
if (period === 'q2' && itemPeriod !== 'q2') return false;
|
||||
if (period === 'q3' && itemPeriod !== 'q3') return false;
|
||||
if (period === 'q4' && itemPeriod !== 'q4') return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -506,6 +509,19 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
document.getElementById('btn-reset').addEventListener('click', resetFilters);
|
||||
|
||||
document.getElementById('btn-clear-storage').addEventListener('click', function() {
|
||||
if (confirm('Очистить все сохранённые данные и загрузить демо-данные заново?')) {
|
||||
localStorage.removeItem('zakupki-review-state');
|
||||
appState.groups = JSON.parse(JSON.stringify(DEMO_DATA));
|
||||
appState.selectedItems.clear();
|
||||
appState.filters = { category: 'all', status: 'all', period: 'all' };
|
||||
document.getElementById('filter-category').value = 'all';
|
||||
document.getElementById('filter-status').value = 'all';
|
||||
document.getElementById('filter-period').value = 'all';
|
||||
renderGroups();
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('btn-confirm').addEventListener('click', function() {
|
||||
if (appState.selectedItems.size === 0) return;
|
||||
const comment = document.getElementById('group-comment').value || 'Подтверждено пользователем';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user