Fix incomplete pricelist sync status
This commit is contained in:
@@ -92,6 +92,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="modal-pricelist-sync-issue" class="hidden">
|
||||
<h4 class="font-medium text-red-700 mb-2">Состояние прайслистов</h4>
|
||||
<div class="bg-red-50 border border-red-200 rounded px-3 py-2 text-sm space-y-1">
|
||||
<div id="modal-pricelist-sync-summary" class="text-red-700">—</div>
|
||||
<div id="modal-pricelist-sync-attempt" class="text-red-600 text-xs hidden"></div>
|
||||
<div id="modal-pricelist-sync-error" class="text-red-600 text-xs hidden whitespace-pre-wrap"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Section 2: Statistics -->
|
||||
<div>
|
||||
<h4 class="font-medium text-gray-900 mb-2">Статистика</h4>
|
||||
@@ -229,6 +238,43 @@
|
||||
readinessMinVersion.textContent = '';
|
||||
}
|
||||
|
||||
const syncIssueSection = document.getElementById('modal-pricelist-sync-issue');
|
||||
const syncIssueSummary = document.getElementById('modal-pricelist-sync-summary');
|
||||
const syncIssueAttempt = document.getElementById('modal-pricelist-sync-attempt');
|
||||
const syncIssueError = document.getElementById('modal-pricelist-sync-error');
|
||||
const hasSyncFailure = data.last_pricelist_sync_status === 'failed';
|
||||
if (data.has_incomplete_server_sync) {
|
||||
syncIssueSection.classList.remove('hidden');
|
||||
syncIssueSummary.textContent = 'Последняя синхронизация прайслистов прервалась. На сервере есть изменения, которые еще не загружены локально.';
|
||||
} else if (hasSyncFailure) {
|
||||
syncIssueSection.classList.remove('hidden');
|
||||
syncIssueSummary.textContent = 'Последняя синхронизация прайслистов завершилась ошибкой.';
|
||||
} else {
|
||||
syncIssueSection.classList.add('hidden');
|
||||
syncIssueSummary.textContent = '';
|
||||
}
|
||||
if (syncIssueSection.classList.contains('hidden')) {
|
||||
syncIssueAttempt.classList.add('hidden');
|
||||
syncIssueAttempt.textContent = '';
|
||||
syncIssueError.classList.add('hidden');
|
||||
syncIssueError.textContent = '';
|
||||
} else {
|
||||
if (data.last_pricelist_attempt_at) {
|
||||
syncIssueAttempt.classList.remove('hidden');
|
||||
syncIssueAttempt.textContent = 'Последняя попытка: ' + new Date(data.last_pricelist_attempt_at).toLocaleString('ru-RU');
|
||||
} else {
|
||||
syncIssueAttempt.classList.add('hidden');
|
||||
syncIssueAttempt.textContent = '';
|
||||
}
|
||||
if (data.last_pricelist_sync_error) {
|
||||
syncIssueError.classList.remove('hidden');
|
||||
syncIssueError.textContent = data.last_pricelist_sync_error;
|
||||
} else {
|
||||
syncIssueError.classList.add('hidden');
|
||||
syncIssueError.textContent = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Section 2: Statistics
|
||||
document.getElementById('modal-lot-count').textContent = data.is_online ? data.lot_count.toLocaleString() : '—';
|
||||
document.getElementById('modal-lotlog-count').textContent = data.is_online ? data.lot_log_count.toLocaleString() : '—';
|
||||
|
||||
@@ -2558,7 +2558,7 @@ async function refreshPrices() {
|
||||
}
|
||||
|
||||
// Re-render UI
|
||||
await refreshPriceLevels();
|
||||
await refreshPriceLevels({ force: true, noCache: true });
|
||||
renderTab();
|
||||
updateCartUI();
|
||||
|
||||
|
||||
@@ -14,7 +14,21 @@
|
||||
</span>
|
||||
{{end}}
|
||||
|
||||
{{if .IsBlocked}}
|
||||
{{if .HasIncompleteServerSync}}
|
||||
<span class="bg-red-100 text-red-800 px-2 py-0.5 rounded-full text-xs font-medium flex items-center gap-1 cursor-pointer" title="{{.SyncIssueTitle}}" onclick="openSyncModal()">
|
||||
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-7.938 4h15.876c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L2.33 16c-.77 1.333.192 3 1.732 3z"></path>
|
||||
</svg>
|
||||
Не докачано
|
||||
</span>
|
||||
{{else if .HasFailedSync}}
|
||||
<span class="bg-orange-100 text-orange-800 px-2 py-0.5 rounded-full text-xs font-medium flex items-center gap-1 cursor-pointer" title="{{.SyncIssueTitle}}" onclick="openSyncModal()">
|
||||
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M4.93 19h14.14c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.2 16c-.77 1.333.192 3 1.732 3z"></path>
|
||||
</svg>
|
||||
Sync error
|
||||
</span>
|
||||
{{else if .IsBlocked}}
|
||||
<span class="bg-red-100 text-red-800 px-2 py-0.5 rounded-full text-xs font-medium flex items-center gap-1 cursor-pointer" title="{{.BlockedReason}}" onclick="openSyncModal()">
|
||||
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-7.938 4h15.876c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L2.33 16c-.77 1.333.192 3 1.732 3z"></path>
|
||||
|
||||
Reference in New Issue
Block a user