feat(админка): выбор всех по фильтру
This commit is contained in:
+17
-1
@@ -651,6 +651,7 @@ document.addEventListener('DOMContentLoaded',function(){applyThemeIcon();applyDe
|
||||
</div>
|
||||
<div class="toolbar note">
|
||||
Выбрать на странице:
|
||||
<button class="btn-sm" onclick="selectFiltered()">всех по фильтру</button>
|
||||
<button class="btn-sm" onclick="selectGroup('all')">всех живых на странице</button>
|
||||
<button class="btn-sm" onclick="selectGroup('admin')">всех admin</button>
|
||||
<button class="btn-sm" onclick="selectGroup('user')">всех user</button>
|
||||
@@ -1268,6 +1269,21 @@ function clearSelection() {
|
||||
refreshSelection();
|
||||
}
|
||||
|
||||
async function selectFiltered() {
|
||||
const q = (document.getElementById('users-q') || {}).value || '';
|
||||
const status = (document.getElementById('users-status') || {}).value || '';
|
||||
const p = new URLSearchParams();
|
||||
if (q.trim()) p.set('q', q.trim());
|
||||
if (status) p.set('status', status);
|
||||
const r = await запрос('/api/admin/v2/customer-emails?' + p.toString());
|
||||
if (!r.ok) return;
|
||||
const d = await r.json();
|
||||
selected.clear();
|
||||
for (const email of d.emails) selected.add(email);
|
||||
document.querySelectorAll('#users .rowsel').forEach(cb => cb.checked = selected.has(cb.dataset.email));
|
||||
refreshSelection();
|
||||
}
|
||||
|
||||
function selectGroup(kind) {
|
||||
selected.clear();
|
||||
for (const u of LIVE) {
|
||||
@@ -1292,7 +1308,7 @@ function refreshSelection() {
|
||||
}
|
||||
const bar = document.getElementById('selbar');
|
||||
bar.style.display = selected.size ? 'flex' : 'none';
|
||||
const text = selected.size ? 'Выбрано ' + selected.size + ' из ' + LIVE.length : '';
|
||||
const text = selected.size ? 'Выбрано ' + selected.size : '';
|
||||
document.getElementById('sel-count').textContent = text;
|
||||
document.getElementById('users-sr').textContent = text;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user