update: tester qr
parent
6080584ac5
commit
5ef8ff38e8
|
@ -384,6 +384,10 @@
|
|||
processScanCode(code) {
|
||||
this.showModal('loading', 'Memproses...', 'Sedang memverifikasi kode SPJ...', false);
|
||||
|
||||
// Testing mode - uncomment untuk testing tanpa backend
|
||||
// this.mockResponse(code);
|
||||
// return;
|
||||
|
||||
$.ajax({
|
||||
url: '@Url.Action("ProcessScan", "Scan")', // nanti tinggal ganti aja yaa
|
||||
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() {
|
||||
this.hideResult();
|
||||
this.hideError();
|
||||
|
|
Loading…
Reference in New Issue