feat: improve admin pricing modal quote count display to show period and total counts

This commit is contained in:
2026-02-02 21:34:51 +03:00
parent f25477a25e
commit 2c75a7ccb8
2 changed files with 45 additions and 13 deletions

View File

@@ -591,8 +591,21 @@ async function fetchPreview() {
document.getElementById('modal-new-price').textContent =
data.new_price ? '$' + parseFloat(data.new_price).toFixed(2) : '—';
// Update quote count
document.getElementById('modal-quote-count').textContent = data.quote_count || 0;
// Update quote count with new format "N (всего: M)"
let quoteCountText = '';
if (data.quote_count_period !== undefined && data.quote_count_total !== undefined) {
if (data.quote_count_period === data.quote_count_total) {
// If period count equals total count, just show the total
quoteCountText = data.quote_count_total;
} else {
// Show both counts in format "N (всего: M)"
quoteCountText = data.quote_count_period + ' (всего: ' + data.quote_count_total + ')';
}
} else {
// Fallback for older API responses
quoteCountText = data.quote_count || 0;
}
document.getElementById('modal-quote-count').textContent = quoteCountText;
}
} catch(e) {
console.error('Preview fetch error:', e);