document.addEventListener("DOMContentLoaded", function () {
    const html5QrcodeScanner = new Html5QrcodeScanner(
        "reader",
        { fps: 10, qrbox: 250 },
        false
    );

    html5QrcodeScanner.render(onScanSuccess, onScanError);

    function onScanSuccess(decodedText, decodedResult) {
        document.getElementById("no_bj").value = `${decodedText}`;
        scan(`${decodedText}`);
    }

    function onScanError(errorMessage) {
        console.error(`Pemindaian gagal: ${errorMessage}`);
    }
});
