Actualización de lector con código qr
This commit is contained in:
@@ -24,25 +24,37 @@ function iniciarScanner(){
|
||||
scanner = new Html5Qrcode("reader");
|
||||
|
||||
scanner.start(
|
||||
{ facingMode: "environment" },
|
||||
{ fps: 10, qrbox: 250 },
|
||||
(mensaje) => {
|
||||
{ facingMode: "environment" },
|
||||
{ fps: 10, qrbox: 250 },
|
||||
(mensaje) => {
|
||||
|
||||
if(!gpsListo){
|
||||
Swal.fire("GPS","Esperando ubicación...","warning");
|
||||
return;
|
||||
}
|
||||
|
||||
if(yaEscaneado) return;
|
||||
yaEscaneado = true;
|
||||
|
||||
Livewire.dispatch('qrLeido', {
|
||||
texto: mensaje,
|
||||
lat: latitud,
|
||||
lng: longitud
|
||||
});
|
||||
|
||||
if(!gpsListo){
|
||||
Swal.fire("GPS","Esperando ubicación...","warning");
|
||||
return;
|
||||
}
|
||||
).catch(err => {
|
||||
|
||||
if(yaEscaneado) return;
|
||||
yaEscaneado = true;
|
||||
console.error("Error cámara:", err);
|
||||
|
||||
Livewire.dispatch('qrLeido', {
|
||||
texto: mensaje,
|
||||
lat: latitud,
|
||||
lng: longitud
|
||||
});
|
||||
Swal.fire(
|
||||
"Cámara bloqueada",
|
||||
"Debes permitir el acceso a la cámara para escanear el QR",
|
||||
"error"
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
document.addEventListener('livewire:init', () => {
|
||||
@@ -97,7 +109,4 @@ document.addEventListener("visibilitychange", function() {
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
@endpush
|
||||
|
||||
Reference in New Issue
Block a user