fix: determine select border class by lowest seats across all servers, bump cache buster
This commit is contained in:
@@ -553,6 +553,18 @@
|
||||
const list = raw && Array.isArray(raw.data) ? raw.data : Array.isArray(raw) ? raw : [raw].filter(Boolean);
|
||||
const servers = list.filter(function(s) { return s && s.server; });
|
||||
sel.innerHTML = '';
|
||||
// Determine overall select styling based on lowest availability
|
||||
var minAvail = Infinity;
|
||||
servers.forEach(function(s) {
|
||||
var a = parseInt(s['Seats Available'], 10) || 0;
|
||||
if (a < minAvail) minAvail = a;
|
||||
});
|
||||
sel.classList.remove('low-seats', 'no-seats');
|
||||
if (minAvail <= 0) {
|
||||
sel.classList.add('no-seats');
|
||||
} else if (minAvail < 10) {
|
||||
sel.classList.add('low-seats');
|
||||
}
|
||||
servers.forEach(function(s) {
|
||||
const server = s.server || '';
|
||||
const available = parseInt(s['Seats Available'], 10) || 0;
|
||||
@@ -564,19 +576,14 @@
|
||||
opt.disabled = true;
|
||||
opt.style.color = '#ff4444';
|
||||
opt.style.fontWeight = '600';
|
||||
sel.classList.remove('low-seats');
|
||||
sel.classList.add('no-seats');
|
||||
} else if (available < 10) {
|
||||
opt.textContent = label + ' (available ' + available + ')';
|
||||
opt.style.color = '#ff9900';
|
||||
opt.style.fontWeight = '600';
|
||||
sel.classList.add('low-seats');
|
||||
sel.classList.remove('no-seats');
|
||||
} else {
|
||||
opt.textContent = label + ' (available ' + available + ')';
|
||||
opt.style.color = '';
|
||||
opt.style.fontWeight = '';
|
||||
sel.classList.remove('low-seats', 'no-seats');
|
||||
}
|
||||
sel.appendChild(opt);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user