Allow zero canister or box count, but not both
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -174,10 +174,14 @@ function showToast(message, isError = false) {
|
||||
|
||||
async function adjustCount(id, field, delta) {
|
||||
const spanId = field === 'canister_count' ? `cc-${id}` : `bc-${id}`;
|
||||
const otherId = field === 'canister_count' ? `bc-${id}` : `cc-${id}`;
|
||||
const span = document.getElementById(spanId);
|
||||
if (!span) return;
|
||||
const next = parseInt(span.textContent, 10) + delta;
|
||||
if (next < 1) return;
|
||||
if (next < 0) return;
|
||||
const other = document.getElementById(otherId);
|
||||
const otherVal = other ? parseInt(other.textContent, 10) : 0;
|
||||
if (next === 0 && otherVal === 0) return;
|
||||
|
||||
try {
|
||||
const res = await fetch(`/api/orders/${id}`, {
|
||||
|
||||
Reference in New Issue
Block a user