feat(manual-batch): require plate number at manual mode start
ci / smoke (push) Canceled after 0s

Legacy manual batch start locked until plate entered:
- POST /api/batch/start manual branch returns 400 missing_plate when
  plate empty (strip + uppercase, no format regex)
- operator + monitoring start modals gain required plate input,
  confirm button disabled until filled
- operator plate tile also shows for manual batches (was do_manual only)
- do_manual unchanged (plate from DOs)
This commit is contained in:
andrew committed 2026-10-02 15:10:13 +07:00
1 parent f621ae86fb
commit 7ad995d8d1
6 files changed
+118 -6

No files matched your search

+34 -3
View File
@@ -405,10 +405,16 @@
<div id="modalStart" style="position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; z-index: 999; padding: 20px;">
<div style="background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 24px; max-width: 400px; width: 100%; text-align: center;">
<h3 style="font-size: 18px; font-weight: 700; margin-bottom: 12px;"><i class="fa-solid fa-play" style="color: var(--accent-green);"></i> Mulai Batch Baru?</h3>
<p style="font-size: 14px; color: var(--text-secondary); margin-bottom: 24px;">Counter akan diaktifkan dan batch baru akan dibuat.</p>
<p style="font-size: 14px; color: var(--text-secondary); margin-bottom: 12px;">Counter akan diaktifkan dan batch baru akan dibuat.</p>
<div id="monStartPlateRow" style="display:none;margin-bottom: 24px; text-align: left;">
<label for="monStartPlateInput" style="display:block;font-size:12px;color:var(--text-secondary);margin-bottom:4px;">Plat Nomor (wajib)</label>
<input type="text" id="monStartPlateInput" placeholder="B 1234 XYZ" autocomplete="off"
oninput="onMonStartPlateInput()"
style="width:100%;padding:8px 10px;border-radius:var(--radius-md);border:1px solid var(--border-color);background:var(--bg-card);color:var(--text-primary);font-size:14px;text-transform:uppercase;box-sizing:border-box;">
</div>
<div style="display: flex; gap: 12px;">
<button class="btn btn-secondary" style="flex: 1;" onclick="document.getElementById('modalStart').style.display='none'">Batal</button>
<button class="btn btn-primary" style="flex: 1; background-color: var(--accent-green);" onclick="executeStartBatch()">Ya, Mulai</button>
<button id="monBtnStartConfirm" class="btn btn-primary" style="flex: 1; background-color: var(--accent-green);" onclick="executeStartBatch()">Ya, Mulai</button>
</div>
</div>
</div>
@@ -479,7 +485,21 @@
}
}
function onMonStartPlateInput() {
const plate = document.getElementById('monStartPlateInput').value.trim();
const btn = document.getElementById('monBtnStartConfirm');
btn.style.opacity = plate.length === 0 ? '0.6' : '';
btn.style.pointerEvents = plate.length === 0 ? 'none' : '';
}
function confirmStartBatch() {
const plateRow = document.getElementById('monStartPlateRow');
const isManual = currentBatchMode === 'manual';
plateRow.style.display = isManual ? 'block' : 'none';
if (isManual) {
document.getElementById('monStartPlateInput').value = '';
onMonStartPlateInput();
}
document.getElementById('modalStart').style.display = 'flex';
}
@@ -490,7 +510,18 @@
async function executeStartBatch() {
document.getElementById('modalStart').style.display = 'none';
try {
const res = await fetch('/api/batch/start', { method: 'POST' });
let body = null;
let headers = {};
if (currentBatchMode === 'manual') {
const plate = document.getElementById('monStartPlateInput').value.trim().toUpperCase();
if (!plate) {
alert('Plat nomor wajib diisi sebelum batch dimulai.');
return;
}
body = JSON.stringify({ plate: plate });
headers = { 'Content-Type': 'application/json' };
}
const res = await fetch('/api/batch/start', { method: 'POST', headers: headers, body: body });
const data = await res.json();
if (data.success) {
await pollCurrentBatch();