feat: implement sync icon + pricelist badge UI improvements

- Replace text 'Online/Offline' with SVG icons in sync status
- Change sync button to circular arrow icon
- Add dropdown menu with push changes, full sync, and last sync status
- Add pricelist version badge to configuration page
- Load pricelist version via /api/pricelists/latest on DOMContentLoaded

This completes task 1 of Phase 2.5 (UI Improvements) as specified in CLAUDE.md
This commit is contained in:
Mikhail Chusavitin
2026-02-02 11:18:24 +03:00
parent 9bd2acd4f7
commit e206531364
3 changed files with 159 additions and 28 deletions

View File

@@ -10,6 +10,15 @@
</button>
</div>
<div id="pricelist-badge" class="mt-4 text-sm text-gray-600 hidden">
<span class="bg-blue-100 text-blue-800 px-2 py-1 rounded-full">
<svg class="w-4 h-4 inline mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
</svg>
Активный прайслист: <span id="pricelist-version">-</span>
</span>
</div>
<div id="configs-list">
<div class="text-center py-8 text-gray-500">Загрузка...</div>
</div>
@@ -398,7 +407,25 @@ async function loadConfigs() {
}
}
document.addEventListener('DOMContentLoaded', loadConfigs);
document.addEventListener('DOMContentLoaded', function() {
loadConfigs();
// Load latest pricelist version for badge
loadLatestPricelistVersion();
});
async function loadLatestPricelistVersion() {
try {
const resp = await fetch('/api/pricelists/latest');
if (resp.ok) {
const pricelist = await resp.json();
document.getElementById('pricelist-version').textContent = pricelist.version;
document.getElementById('pricelist-badge').classList.remove('hidden');
}
} catch(e) {
console.error('Failed to load pricelist version:', e);
}
}
</script>
{{end}}