update: tester qr

main
marszayn 2025-08-06 09:58:32 +07:00
parent 6080584ac5
commit 5ef8ff38e8
1 changed files with 22 additions and 0 deletions

View File

@ -384,6 +384,10 @@
processScanCode(code) { processScanCode(code) {
this.showModal('loading', 'Memproses...', 'Sedang memverifikasi kode SPJ...', false); this.showModal('loading', 'Memproses...', 'Sedang memverifikasi kode SPJ...', false);
// Testing mode - uncomment untuk testing tanpa backend
// this.mockResponse(code);
// return;
$.ajax({ $.ajax({
url: '@Url.Action("ProcessScan", "Scan")', // nanti tinggal ganti aja yaa url: '@Url.Action("ProcessScan", "Scan")', // nanti tinggal ganti aja yaa
type: 'POST', type: 'POST',
@ -417,6 +421,24 @@
}); });
} }
// Mock response untuk testing
mockResponse(code) {
setTimeout(() => {
// Simulasi SPJ yang ada
const validCodes = ['SPJ001', 'SPJ002', 'TEST123', '12345', 'ABCDEF'];
if (validCodes.includes(code.toUpperCase())) {
this.showModal('success', 'Scan Berhasil!', `SPJ ${code} berhasil ditemukan dan diproses.`, true);
setTimeout(() => {
this.hideResult();
this.manualInput.value = '';
}, 2000);
} else {
this.showModal('error', 'SPJ Tidak Ditemukan', `Kode SPJ "${code}" tidak ditemukan dalam database.`, true);
}
}, 1500); // Simulasi delay network
}
async retryScan() { async retryScan() {
this.hideResult(); this.hideResult();
this.hideError(); this.hideError();