dmencu 1.0.6 → 1.0.8

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.
@@ -38,6 +38,7 @@ import{
38
38
  getFormulariosForValuePkRaiz,
39
39
  getMainFormForVivienda,
40
40
  intentarBackup,
41
+ respuestasForPk,
41
42
  setCalcularVariables
42
43
  } from "./bypass-formulario"
43
44
  import { dmTraerDatosFormulario, dispatchers,
@@ -125,7 +126,7 @@ export type LibreDespliegueType = (props:{
125
126
 
126
127
  var LibreDespliegue: LibreDespliegueType
127
128
 
128
- const Button = ({variant, onClick, disabled, children, className, color, size,
129
+ export const Button = ({variant, onClick, disabled, children, className, color, size,
129
130
  disableElevation, disableFocusRipple, disableRipple,
130
131
  ...other
131
132
  }:{
@@ -442,6 +443,8 @@ type CasilleroEncabezable = Formulario|Bloque|Filtro|ConjuntoPreguntas|Pregunta|
442
443
 
443
444
  function EncabezadoDespliegue(props:{casillero:CasilleroEncabezable, verIdGuion?:boolean, leer?:boolean, forPk:ForPk}){
444
445
  var {casillero, forPk} = props;
446
+ var [openConfirm, setOpenConfirm] = useState(false)
447
+ var [posGPS, setPosGPS] = useState(null)
445
448
  var conCampoOpciones = useSelector((state:CasoState)=>state.opciones.conCampoOpciones)
446
449
  var handleClickBorrar=()=>{
447
450
  dispatchByPass(accion_registrar_respuesta, {respuesta:null, variable:casillero.var_name as IdVariable, forPk:forPk})
@@ -451,6 +454,9 @@ function EncabezadoDespliegue(props:{casillero:CasilleroEncabezable, verIdGuion?
451
454
  var calculada = casillero.calculada;
452
455
  var id = `id-div-${casillero.var_name||casillero.casillero}`;
453
456
  var idAcciones = "acciones-"+id;
457
+ const handleClose = () => {
458
+ setOpenConfirm(false);
459
+ };
454
460
  return <div
455
461
  className="encabezado"
456
462
  debe-leer={props.leer?'SI':'NO'}
@@ -491,7 +497,62 @@ function EncabezadoDespliegue(props:{casillero:CasilleroEncabezable, verIdGuion?
491
497
  </div>
492
498
  </div>
493
499
  <div className="nombre-div">
494
- <div className="nombre">{breakeableText(casillero.nombre)}</div>
500
+ <div className="nombre">{breakeableText(casillero.nombre)}
501
+ {casillero.especial?.gps?
502
+ <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á 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
+ <Button color="primary" variant="outlined" style={{marginLeft:'10px'}} onClick={(_event)=>{
532
+ const {respuestas} = respuestasForPk(forPk);
533
+ const checkGPS = () =>{
534
+ if(!respuestas[casillero.var_name!]){
535
+ let {siguienteVariable} = dispatchByPass(accion_registrar_respuesta, {forPk:props.forPk, variable:casillero.var_name, respuesta:posGPS})
536
+ if(siguienteVariable){
537
+ enfocarElementoDeVariable(siguienteVariable);
538
+ }
539
+ setOpenConfirm(false);
540
+ }else{
541
+ setOpenConfirm(true);
542
+ }
543
+ }
544
+ navigator.geolocation.getCurrentPosition(position => {
545
+ setPosGPS(JSON.stringify(position));
546
+ checkGPS();
547
+
548
+ }, e => {
549
+ setPosGPS(e.message);
550
+ checkGPS();
551
+ });
552
+ }}><ICON.Location/></Button>
553
+ </span>
554
+ :null}
555
+ </div>
495
556
  {casillero.aclaracion?
496
557
  <div className="aclaracion">
497
558
  {casillero.salto && casillero.tipoc=='FILTRO'?
@@ -597,7 +658,8 @@ function Campo(props:{disabled:boolean, pregunta:PreguntaSimple|PreguntaConOpcio
597
658
  <div className="input-campo">
598
659
  <TextField
599
660
  id={`var-${pregunta.var_name}`}
600
- disabled={disabled}
661
+ //@ts-ignore algunos casilleros tienen especial y otros no
662
+ disabled={disabled || pregunta.especial?.gps}
601
663
  className="variable"
602
664
  //var-length={pregunta.longitud}
603
665
  fullWidth={true}
@@ -623,7 +685,7 @@ function Campo(props:{disabled:boolean, pregunta:PreguntaSimple|PreguntaConOpcio
623
685
  }}
624
686
  />
625
687
  </div>
626
- {disabled || mini?null:
688
+ {disabled || pregunta.especial?.gps || mini?null:
627
689
  <div className="boton-confirmar-campo">
628
690
  <Button variant={editando?"contained":'outlined'} size="small" color={editando?'primary':'default'}
629
691
  boton-confirmar={pregunta.var_name}
@@ -1689,8 +1751,8 @@ export function Atributo(props:{nombre:string, valor:any}){
1689
1751
  </span>:null
1690
1752
  }
1691
1753
 
1692
- const listaEstadosCarga:EstadoCarga[]=['resumen','relevamiento','recibo'];
1693
- var resumidores = [
1754
+ export const listaEstadosCarga:EstadoCarga[]=['resumen','relevamiento','recibo'];
1755
+ export var resumidores = [
1694
1756
  {nombre:'REA' , f:(rr:RespuestasRaiz)=>rr.resumenEstado=="ok" },
1695
1757
  {nombre:'Cita pactada', f:(rr:RespuestasRaiz)=>rr.resumenEstado=="cita pactada"},
1696
1758
  {nombre:'Pendientes' , f:(rr:RespuestasRaiz)=>rr.resumenEstado=="vacio" },
@@ -1700,12 +1762,23 @@ resumidores.push(
1700
1762
  {nombre:'Otros', f:resumidores.reduce((g,r)=>(rr=>!r.f(rr) && g(rr) ),(_:RespuestasRaiz)=>true) }
1701
1763
  )
1702
1764
 
1703
- export function DesplegarLineaResumenUAPrincipal(props:{
1765
+ export type DesplegarLineaResumenUAPrincipalType = (props:{
1704
1766
  numVivienda:IdEnc,
1705
1767
  formPrincipal:IdFormulario,
1706
1768
  tarea: string,
1707
1769
  respuestas:RespuestasRaiz,
1708
- }){
1770
+ })=>JSX.Element;
1771
+
1772
+ export var DesplegarLineaResumenUAPrincipal: DesplegarLineaResumenUAPrincipalType
1773
+
1774
+ export const setDesplegarLineaResumenUAPrincipal = (lineaResumenUAPrincipal:DesplegarLineaResumenUAPrincipalType)=>DesplegarLineaResumenUAPrincipal = lineaResumenUAPrincipal;
1775
+
1776
+ setDesplegarLineaResumenUAPrincipal((props:{
1777
+ numVivienda:IdEnc,
1778
+ formPrincipal:IdFormulario,
1779
+ tarea: string,
1780
+ respuestas:RespuestasRaiz,
1781
+ })=>{
1709
1782
  const {numVivienda, respuestas, formPrincipal, tarea} = props;
1710
1783
  const id='viv-'+numVivienda;
1711
1784
  const estructura = getEstructura();
@@ -1757,9 +1830,9 @@ export function DesplegarLineaResumenUAPrincipal(props:{
1757
1830
  </Button>
1758
1831
  </TableCell>
1759
1832
  </TableRow>
1760
- }
1833
+ });
1761
1834
 
1762
- export function DesplegarCarga(props:{
1835
+ export type DesplegarCargaType = (props:{
1763
1836
  carga:Carga,
1764
1837
  idCarga:IdCarga,
1765
1838
  posicion:number,
@@ -1768,7 +1841,22 @@ export function DesplegarCarga(props:{
1768
1841
  feedbackRowValidator:{
1769
1842
  [formulario in PlainForPk]:FormStructureState<IdVariable, Valor, IdFin>
1770
1843
  }
1771
- }){
1844
+ })=>JSX.Element;
1845
+
1846
+ export var DesplegarCarga: DesplegarCargaType
1847
+
1848
+ export const setDesplegarCarga = (despliegueCarga:DesplegarCargaType)=>DesplegarCarga = despliegueCarga;
1849
+
1850
+ setDesplegarCarga((props:{
1851
+ carga:Carga,
1852
+ idCarga:IdCarga,
1853
+ posicion:number,
1854
+ informacionHdr:InformacionHdr,
1855
+ respuestas: RespuestaLasUA,
1856
+ feedbackRowValidator:{
1857
+ [formulario in PlainForPk]:FormStructureState<IdVariable, Valor, IdFin>
1858
+ }
1859
+ })=>{
1772
1860
  const [newSurvey, setNewSurvey] = useState(0);
1773
1861
  const {carga, idCarga, informacionHdr, respuestas} = props;
1774
1862
  var estructura = getEstructura();
@@ -1851,7 +1939,8 @@ export function DesplegarCarga(props:{
1851
1939
  </Table>
1852
1940
  }
1853
1941
  </Paper>
1854
- }
1942
+ });
1943
+
1855
1944
  export function DesplegarCitaPactada(props:{respuestas:Respuestas}){
1856
1945
  const {respuestas} = props;
1857
1946
  return <div className="cita-pactada">
@@ -1889,7 +1978,13 @@ export function DesplegarTem(props:{tem:TEM}){
1889
1978
  </div>
1890
1979
  }
1891
1980
 
1892
- export function HojaDeRutaDespliegue(){
1981
+ export type HojaDeRutaDespliegueType = (props:{})=>JSX.Element;
1982
+
1983
+ export var HojaDeRutaDespliegue: HojaDeRutaDespliegueType
1984
+
1985
+ export const setHojaDeRutaDespliegue = (hojaDeRuta:HojaDeRutaDespliegueType)=>HojaDeRutaDespliegue = hojaDeRuta
1986
+
1987
+ setHojaDeRutaDespliegue((_props:{})=>{
1893
1988
  var {cargas, num_sincro, informacionHdr, respuestas} = getDatosByPass();
1894
1989
  var {modo} = useSelector((state:CasoState)=>({modo:state.modo}));
1895
1990
  var feedbackRowValidator = getFeedbackRowValidator()
@@ -1949,7 +2044,7 @@ export function HojaDeRutaDespliegue(){
1949
2044
  </div>
1950
2045
  </>
1951
2046
  );
1952
- }
2047
+ });
1953
2048
 
1954
2049
  export function ListaTextos(props:{textos:string[]}){
1955
2050
  return <ul>
@@ -57,6 +57,7 @@ export const materialIoIconsSvgPath={
57
57
  KeyboardArrowDown: "M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z",
58
58
  Label: "M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12l-4.37-6.16z",
59
59
  LocalAtm: "M11 17h2v-1h1c.55 0 1-.45 1-1v-3c0-.55-.45-1-1-1h-3v-1h4V8h-2V7h-2v1h-1c-.55 0-1 .45-1 1v3c0 .55.45 1 1 1h3v1H9v2h2v1zm9-13H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4V6h16v12z",
60
+ Location: "M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7m0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5",
60
61
  Menu: "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z",
61
62
  Navigation: "M12 2L4.5 20.29l.71.71L12 18l6.79 3 .71-.71z",
62
63
  NavigationDown: "M12 22L4.5 3.71l.71 -.71L12 6l6.79 -3 .71 .71z",