dmencu 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -49,7 +49,7 @@ import { dmTraerDatosFormulario, dispatchers,
|
|
|
49
49
|
import { useState, useEffect, useLayoutEffect } from "react";
|
|
50
50
|
import { useSelector, useDispatch } from "react-redux";
|
|
51
51
|
import { strict as likeAr, beingArray } from "like-ar";
|
|
52
|
-
import {sleep, coalesce} from "best-globals";
|
|
52
|
+
import {sleep, coalesce, datetime} from "best-globals";
|
|
53
53
|
import { unexpected } from "cast-error";
|
|
54
54
|
|
|
55
55
|
import {
|
|
@@ -443,8 +443,6 @@ type CasilleroEncabezable = Formulario|Bloque|Filtro|ConjuntoPreguntas|Pregunta|
|
|
|
443
443
|
|
|
444
444
|
function EncabezadoDespliegue(props:{casillero:CasilleroEncabezable, verIdGuion?:boolean, leer?:boolean, forPk:ForPk}){
|
|
445
445
|
var {casillero, forPk} = props;
|
|
446
|
-
var [openConfirm, setOpenConfirm] = useState(false)
|
|
447
|
-
var [posGPS, setPosGPS] = useState(null)
|
|
448
446
|
var conCampoOpciones = useSelector((state:CasoState)=>state.opciones.conCampoOpciones)
|
|
449
447
|
var handleClickBorrar=()=>{
|
|
450
448
|
dispatchByPass(accion_registrar_respuesta, {respuesta:null, variable:casillero.var_name as IdVariable, forPk:forPk})
|
|
@@ -454,9 +452,6 @@ function EncabezadoDespliegue(props:{casillero:CasilleroEncabezable, verIdGuion?
|
|
|
454
452
|
var calculada = casillero.calculada;
|
|
455
453
|
var id = `id-div-${casillero.var_name||casillero.casillero}`;
|
|
456
454
|
var idAcciones = "acciones-"+id;
|
|
457
|
-
const handleClose = () => {
|
|
458
|
-
setOpenConfirm(false);
|
|
459
|
-
};
|
|
460
455
|
return <div
|
|
461
456
|
className="encabezado"
|
|
462
457
|
debe-leer={props.leer?'SI':'NO'}
|
|
@@ -500,54 +495,22 @@ function EncabezadoDespliegue(props:{casillero:CasilleroEncabezable, verIdGuion?
|
|
|
500
495
|
<div className="nombre">{breakeableText(casillero.nombre)}
|
|
501
496
|
{casillero.especial?.gps?
|
|
502
497
|
<span>
|
|
503
|
-
{openConfirm?
|
|
504
|
-
<Dialog
|
|
505
|
-
open={openConfirm}
|
|
506
|
-
onClose={handleClose}
|
|
507
|
-
aria-labelledby="responsive-dialog-title"
|
|
508
|
-
>
|
|
509
|
-
<DialogTitle id="responsive-dialog-title">Registro punto GPS</DialogTitle>
|
|
510
|
-
<DialogContent>
|
|
511
|
-
<DialogContentText>
|
|
512
|
-
Ya existe un punto registrado, si continúa se va a sobrescribir, <b>si no está utilizando un DM DESCARTE el punto</b>
|
|
513
|
-
</DialogContentText>
|
|
514
|
-
</DialogContent>
|
|
515
|
-
<DialogActions>
|
|
516
|
-
<Button onClick={()=>{
|
|
517
|
-
let {siguienteVariable} = dispatchByPass(accion_registrar_respuesta, {forPk:props.forPk, variable:casillero.var_name, respuesta:posGPS})
|
|
518
|
-
if(siguienteVariable){
|
|
519
|
-
enfocarElementoDeVariable(siguienteVariable);
|
|
520
|
-
}
|
|
521
|
-
handleClose();
|
|
522
|
-
}} color="secondary" variant="outlined">
|
|
523
|
-
Guardar
|
|
524
|
-
</Button>
|
|
525
|
-
<Button onClick={handleClose} color="primary" variant="outlined">
|
|
526
|
-
Descartar
|
|
527
|
-
</Button>
|
|
528
|
-
</DialogActions>
|
|
529
|
-
</Dialog>
|
|
530
|
-
:null}
|
|
531
498
|
<Button color="primary" variant="outlined" style={{marginLeft:'10px'}} onClick={(_event)=>{
|
|
532
499
|
const {respuestas} = respuestasForPk(forPk);
|
|
533
|
-
const
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
}
|
|
500
|
+
const agregarInfoGPS = (respuestaGPS:Valor, info:string)=>{
|
|
501
|
+
let aux = JSON.parse(respuestaGPS || JSON.stringify([]));
|
|
502
|
+
aux.unshift(info);
|
|
503
|
+
respuestaGPS = JSON.stringify(aux);
|
|
504
|
+
return dispatchByPass(accion_registrar_respuesta, {forPk:props.forPk, variable:casillero.var_name, respuesta:respuestaGPS});
|
|
505
|
+
}
|
|
506
|
+
let {siguienteVariable} = agregarInfoGPS(respuestas[casillero.var_name!], `${datetime.now().toYmdHms()} - esperando punto gps`);
|
|
507
|
+
if(siguienteVariable){
|
|
508
|
+
enfocarElementoDeVariable(siguienteVariable);
|
|
543
509
|
}
|
|
544
510
|
navigator.geolocation.getCurrentPosition(position => {
|
|
545
|
-
|
|
546
|
-
checkGPS();
|
|
547
|
-
|
|
511
|
+
agregarInfoGPS(respuestas[casillero.var_name!], JSON.stringify(position));
|
|
548
512
|
}, e => {
|
|
549
|
-
|
|
550
|
-
checkGPS();
|
|
513
|
+
agregarInfoGPS(respuestas[casillero.var_name!], e.message);
|
|
551
514
|
});
|
|
552
515
|
}}><ICON.Location/></Button>
|
|
553
516
|
</span>
|