dmencu 2.2.7 → 2.2.9
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.
- package/dist/client/client/client.js +18 -21
- package/dist/client/unlogged/abrir-formulario.d.ts +2 -4
- package/dist/client/unlogged/abrir-formulario.js +4 -3
- package/dist/client/unlogged/bypass-formulario.d.ts +3 -1
- package/dist/client/unlogged/bypass-formulario.js +12 -10
- package/dist/client/unlogged/redux-formulario.d.ts +3 -3
- package/dist/client/unlogged/redux-formulario.js +2 -2
- package/dist/client/unlogged/render-formulario.tsx +160 -74
- package/dist/client/unlogged/render-general.tsx +63 -75
- package/dist/client/unlogged/tipos.d.ts +17 -1
- package/dist/client/unlogged/tipos.js +1 -2
- package/dist/server/server/app-dmencu.d.ts +9 -7
- package/dist/server/server/app-dmencu.js +51 -38
- package/dist/server/server/procedures-dmencu.d.ts +2 -2
- package/dist/server/server/procedures-dmencu.js +90 -74
- package/dist/server/server/table-areas_asignacion_general.js +8 -5
- package/dist/server/server/table-control_dias_carga.d.ts +1 -1
- package/dist/server/server/table-control_dias_carga.js +2 -2
- package/dist/server/server/table-diccionario.js +5 -5
- package/dist/server/server/table-dictra.js +3 -4
- package/dist/server/server/table-dicvar.js +4 -4
- package/dist/server/server/table-encuestadores.d.ts +4 -3
- package/dist/server/server/table-encuestadores.js +3 -3
- package/dist/server/server/table-grilla_hoja_ruta.d.ts +1 -1
- package/dist/server/server/table-grilla_hoja_ruta.js +2 -2
- package/dist/server/server/table-personal.js +6 -6
- package/dist/server/server/table-personal_rol.js +3 -3
- package/dist/server/server/table-sincronizaciones.js +2 -3
- package/dist/server/server/table-tareas.js +2 -1
- package/dist/server/server/table-tareas_areas.js +7 -6
- package/dist/server/server/table-tareas_tem.d.ts +1 -2
- package/dist/server/server/table-tareas_tem.js +1 -1
- package/dist/server/server/table-tareas_tem_procesamiento.js +3 -3
- package/dist/server/server/table-tem.js +3 -4
- package/dist/server/server/table-tem_asignacion.js +2 -2
- package/dist/server/server/types-dmencu.d.ts +24 -9
- package/dist/server/server/types-dmencu.js +1 -1
- package/dist/server/unlogged/tipos.d.ts +17 -1
- package/dist/server/unlogged/tipos.js +1 -2
- package/dist/unlogged/unlogged/abrir-formulario.d.ts +2 -4
- package/dist/unlogged/unlogged/abrir-formulario.js +4 -3
- package/dist/unlogged/unlogged/bypass-formulario.d.ts +3 -1
- package/dist/unlogged/unlogged/bypass-formulario.js +12 -10
- package/dist/unlogged/unlogged/redux-formulario.d.ts +3 -3
- package/dist/unlogged/unlogged/redux-formulario.js +2 -2
- package/dist/unlogged/unlogged/render-formulario.js +118 -46
- package/dist/unlogged/unlogged/render-formulario.tsx +160 -74
- package/dist/unlogged/unlogged/render-general.d.ts +7 -4
- package/dist/unlogged/unlogged/render-general.js +7 -9
- package/dist/unlogged/unlogged/render-general.tsx +63 -75
- package/dist/unlogged/unlogged/tipos.d.ts +17 -1
- package/dist/unlogged/unlogged/tipos.js +1 -2
- package/dist/unlogged/unlogged/unlogged.js +13 -10
- package/package.json +8 -8
|
@@ -4,9 +4,7 @@ import {
|
|
|
4
4
|
RenderPrincipal,
|
|
5
5
|
adaptarTipoVarCasillero,
|
|
6
6
|
ICON,
|
|
7
|
-
focusToId,
|
|
8
7
|
scrollToTop,
|
|
9
|
-
scrollToBottom,
|
|
10
8
|
materialIoIconsSvgPath,
|
|
11
9
|
useOnlineStatus
|
|
12
10
|
} from "./render-general";
|
|
@@ -19,14 +17,11 @@ import {
|
|
|
19
17
|
Opcion, OpcionMultiple, PlainForPk,
|
|
20
18
|
Pregunta, PreguntaConOpciones, PreguntaSimple,
|
|
21
19
|
Respuestas, RespuestaLasUA, RespuestasRaiz, Valor, TEM, IdCarga, Carga, IdFin, IdUnidadAnalisis,
|
|
22
|
-
ModoAlmacenamiento,
|
|
23
20
|
toPlainForPk,
|
|
24
21
|
IdCasillero,
|
|
25
22
|
PreguntaConSiNo,
|
|
26
|
-
Texto, Estructura, InformacionHdr,
|
|
23
|
+
Texto, Estructura, InformacionHdr, ConfiguracionSorteoFormulario, ResumenEstado, IdOperativo, IdEnc, Libre,
|
|
27
24
|
iterator, empty, ConfiguracionHabilitarBotonFormulario,
|
|
28
|
-
CampoPkRaiz,
|
|
29
|
-
ValuePkRaiz,
|
|
30
25
|
PMatriz,
|
|
31
26
|
ModoDM
|
|
32
27
|
} from "./tipos";
|
|
@@ -48,21 +43,20 @@ import {
|
|
|
48
43
|
import {
|
|
49
44
|
dmTraerDatosFormulario, dispatchers,
|
|
50
45
|
gotoSincronizar,
|
|
51
|
-
getCacheVersion,
|
|
52
46
|
gotoConsistir,
|
|
53
47
|
} from "./redux-formulario";
|
|
54
|
-
import { useState, useEffect
|
|
48
|
+
import { useState, useEffect } from "react";
|
|
55
49
|
import { useSelector, useDispatch } from "react-redux";
|
|
56
|
-
import { strict as likeAr
|
|
50
|
+
import { strict as likeAr } from "like-ar";
|
|
57
51
|
import { sleep, coalesce, datetime } from "best-globals";
|
|
58
52
|
import { unexpected } from "cast-error";
|
|
59
53
|
|
|
60
54
|
import {
|
|
61
|
-
AppBar, ButtonGroup,
|
|
55
|
+
AppBar, ButtonGroup, Checkbox,
|
|
62
56
|
Dialog, DialogActions, DialogContent, DialogContentText,
|
|
63
|
-
DialogTitle, Divider, Fab,
|
|
57
|
+
DialogTitle, Divider, Fab,
|
|
64
58
|
Menu, MenuItem, Paper, Popover,
|
|
65
|
-
Table, TableBody, TableCell, TableHead, TableRow, Toolbar
|
|
59
|
+
Table, TableBody, TableCell, TableHead, TableRow, Toolbar
|
|
66
60
|
} from "@mui/material";
|
|
67
61
|
import { EstadoVariable, FormStructureState } from "row-validator";
|
|
68
62
|
|
|
@@ -87,9 +81,9 @@ import { html, HtmlTag } from "js-to-html";
|
|
|
87
81
|
|
|
88
82
|
const DELAY_SCROLL_3 = 50;
|
|
89
83
|
|
|
90
|
-
function breakeableText(text: string | null): string |
|
|
84
|
+
function breakeableText(text: string | null): string | null;
|
|
91
85
|
function breakeableText(text: string | null, diccionario?: { [clave: string]: React.ReactNode }) {
|
|
92
|
-
if (typeof text != "string") return
|
|
86
|
+
if (typeof text != "string") return null;
|
|
93
87
|
text = text.replace(/\//g, "/\u2063").replace(/\/\u2063(\w)\b/g, '/$1');
|
|
94
88
|
text = text.replace(/___*/g, (todo) => `[${todo}]`).replace(/\@\w+\@/g, (todo) => `[${todo}]`);
|
|
95
89
|
if (!diccionario || true) return text;
|
|
@@ -255,8 +249,6 @@ var sp3 = 'sp3' as IdVariable;
|
|
|
255
249
|
var sp4 = 'sp4' as IdVariable;
|
|
256
250
|
var sp5 = 'sp5' as IdVariable;
|
|
257
251
|
|
|
258
|
-
var diccionario = {}
|
|
259
|
-
|
|
260
252
|
/*
|
|
261
253
|
// const takeElementOrDefault<K, T extends [K in], D>()
|
|
262
254
|
function isIn<V, T>(k:keyof T, object:T): object[k] is V{
|
|
@@ -338,7 +330,6 @@ function OpcionDespliegue(props: { casillero: Opcion, valorOpcion: number, varia
|
|
|
338
330
|
if (botonStyle) botonStyle.color = 'green';
|
|
339
331
|
await sleep(DELAY_SCROLL_3);
|
|
340
332
|
if (botonStyle) botonStyle.color = '';
|
|
341
|
-
//@ts-ignore algunos casilleros tienen especial y otros no
|
|
342
333
|
(casillero.especial?.noScroll == true) ? null : enfocarElementoDeVariable(casillero.especial?.scrollTo ?? siguienteVariable);
|
|
343
334
|
}
|
|
344
335
|
}
|
|
@@ -435,7 +426,6 @@ function registradorDeVariable(pregunta: Pregunta | OpcionMultiple | ConjuntoPre
|
|
|
435
426
|
function OpcionMultipleDespliegue(props: { opcionM: OpcionMultiple, forPk: ForPk }) {
|
|
436
427
|
const { opcionM } = props;
|
|
437
428
|
var id = `opcionM-${opcionM.id_casillero}`;
|
|
438
|
-
//@ts-ignore altunos casilleros no tienen especial, no importa, es solo para poner los metadatos
|
|
439
429
|
var styles: React.CSSProperties = opcionM.especial?.flexDirection ? { flexDirection: opcionM.especial.flexDirection } : { flexWrap: 'wrap' };
|
|
440
430
|
registrarElemento({
|
|
441
431
|
id,
|
|
@@ -446,7 +436,7 @@ function OpcionMultipleDespliegue(props: { opcionM: OpcionMultiple, forPk: ForPk
|
|
|
446
436
|
setWindowWidth(window.innerWidth);
|
|
447
437
|
}
|
|
448
438
|
|
|
449
|
-
const [windowWidth, setWindowWidth] = useState();
|
|
439
|
+
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
|
|
450
440
|
window.addEventListener('resize', updateWindowWidth);
|
|
451
441
|
return <DesplegarCasillero
|
|
452
442
|
id={id}
|
|
@@ -477,15 +467,11 @@ const getLosMetadatos = (casillero: CasilleroEncabezable): React.JSX.Element =>
|
|
|
477
467
|
{casillero.tipovar && casillero.tipovar != 'opciones' && casillero.tipovar != 'si_no' ?
|
|
478
468
|
<span el-metadato="tipovar">{casillero.tipovar}</span>
|
|
479
469
|
: null}
|
|
480
|
-
{
|
|
481
|
-
casillero.optativo ? <span el-metadato="optativa">optativa</span> : null
|
|
482
|
-
}
|
|
470
|
+
{casillero.var_name && casillero.optativo ? <span el-metadato="optativa">optativa</span> : null}
|
|
483
471
|
{casillero.calculada ? <span el-metadato="calculada">calculada</span> : null}
|
|
484
472
|
{casillero.despliegueOculta ? <span el-metadato="oculta">oculta</span> : null}
|
|
485
473
|
{casillero.expresion_habilitar ? <span el-metadato="expresion_habilitar">habilita: {casillero.expresion_habilitar}</span> : null}
|
|
486
|
-
{
|
|
487
|
-
casillero.especial?.autoing ? <span el-metadato="expresion_autoing">autoing: {casillero.especial?.autoing}</span> : null
|
|
488
|
-
}
|
|
474
|
+
{casillero.especial?.autoing ? <span el-metadato="expresion_autoing">autoing: {casillero.especial?.autoing}</span> : null}
|
|
489
475
|
</div>
|
|
490
476
|
|
|
491
477
|
function EncabezadoDespliegue(props: {
|
|
@@ -501,7 +487,6 @@ function EncabezadoDespliegue(props: {
|
|
|
501
487
|
dispatchByPass(accion_registrar_respuesta, { respuesta: null, variable: casillero.var_name as IdVariable, forPk: forPk })
|
|
502
488
|
};
|
|
503
489
|
var ver_id = casillero.ver_id ?? casillero.casillero;
|
|
504
|
-
// @ts-ignore no está en todos los casilleros pero acá para el despliegue de metadatos no importa
|
|
505
490
|
var calculada = casillero.calculada;
|
|
506
491
|
var id = `id-div-${casillero.var_name || casillero.casillero}`;
|
|
507
492
|
var idAcciones = "acciones-" + id;
|
|
@@ -521,7 +506,7 @@ function EncabezadoDespliegue(props: {
|
|
|
521
506
|
<div className="id">
|
|
522
507
|
{ver_id}
|
|
523
508
|
</div>
|
|
524
|
-
{(casillero.tipovar == "si_no" || casillero.tipovar == "opciones") ? <Campo disabled={false} pregunta={casillero} forPk={forPk} mini={true} hidden={!conCampoOpciones && 'quitar'} /> : null}
|
|
509
|
+
{(casillero.tipovar == "si_no" || casillero.tipovar == "opciones") ? <Campo disabled={false} pregunta={casillero as unknown as PreguntaSimple} forPk={forPk} mini={true} hidden={!conCampoOpciones && 'quitar'} /> : null}
|
|
525
510
|
<div className="acciones-pregunta" id={idAcciones} accion-visible="0">
|
|
526
511
|
{casillero.var_name ? <div><Button
|
|
527
512
|
id={"borrar-pregunta-" + casillero.var_name}
|
|
@@ -550,30 +535,37 @@ function EncabezadoDespliegue(props: {
|
|
|
550
535
|
{casillero.especial?.gps ?
|
|
551
536
|
<span>
|
|
552
537
|
<Button color="primary" variant="outlined" style={{ marginLeft: '10px' }} onClick={(_event) => {
|
|
553
|
-
const
|
|
554
|
-
const agregarInfoGPS = (
|
|
555
|
-
|
|
538
|
+
const varName = casillero.var_name!;
|
|
539
|
+
const agregarInfoGPS = (info: string) => {
|
|
540
|
+
const { respuestas: rActuales } = respuestasForPk(forPk);
|
|
541
|
+
const valorActual = rActuales[varName];
|
|
542
|
+
let aux = JSON.parse(valorActual?.toString() || "[]");
|
|
556
543
|
aux.unshift(info);
|
|
557
|
-
|
|
558
|
-
return dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: casillero.var_name, respuesta: respuestaGPS });
|
|
544
|
+
return dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: varName, respuesta: JSON.stringify(aux) });
|
|
559
545
|
}
|
|
560
|
-
let { siguienteVariable } = agregarInfoGPS(
|
|
546
|
+
let { siguienteVariable } = agregarInfoGPS(`${datetime.now().toYmdHms()} - esperando punto gps`) || {};
|
|
561
547
|
if (siguienteVariable) {
|
|
562
548
|
enfocarElementoDeVariable(siguienteVariable);
|
|
563
549
|
}
|
|
564
550
|
navigator.geolocation.getCurrentPosition(position => {
|
|
565
|
-
|
|
551
|
+
const { latitude, longitude, altitude, accuracy, altitudeAccuracy, heading, speed } = position.coords;
|
|
552
|
+
const dataToSave = {
|
|
553
|
+
coords: { latitude, longitude, altitude, accuracy, altitudeAccuracy, heading, speed },
|
|
554
|
+
timestamp: position.timestamp
|
|
555
|
+
};
|
|
556
|
+
agregarInfoGPS(JSON.stringify(dataToSave));
|
|
566
557
|
}, e => {
|
|
567
|
-
agregarInfoGPS(
|
|
568
|
-
});
|
|
569
|
-
}
|
|
558
|
+
agregarInfoGPS(e.message);
|
|
559
|
+
}, { enableHighAccuracy: true, timeout: 10000 });
|
|
560
|
+
}
|
|
561
|
+
}><ICON.Location /></Button>
|
|
570
562
|
</span>
|
|
571
563
|
: null}
|
|
572
564
|
</div>
|
|
573
565
|
{casillero.aclaracion ?
|
|
574
566
|
<div className="aclaracion">
|
|
575
567
|
{casillero.salto && casillero.tipoc == 'FILTRO' ?
|
|
576
|
-
<SaltoDespliegue casillero={casillero} prefijo={breakeableText(casillero.aclaracion)} />
|
|
568
|
+
<SaltoDespliegue casillero={casillero} prefijo={breakeableText(casillero.aclaracion)!} />
|
|
577
569
|
:
|
|
578
570
|
breakeableText(casillero.aclaracion)
|
|
579
571
|
}
|
|
@@ -617,7 +609,7 @@ function DesplegarConfirmarBorrarRespuesta(props: { forPk: ForPk, variableBorrar
|
|
|
617
609
|
</Popover>;
|
|
618
610
|
}
|
|
619
611
|
|
|
620
|
-
function calcularNuestraLongitud(longitud: string | null) {
|
|
612
|
+
function calcularNuestraLongitud(longitud: string | number | null | undefined) {
|
|
621
613
|
return longitud;
|
|
622
614
|
}
|
|
623
615
|
|
|
@@ -634,7 +626,6 @@ function Campo(props: { disabled: boolean, pregunta: PreguntaSimple | PreguntaCo
|
|
|
634
626
|
var { pregunta, disabled, mini } = props;
|
|
635
627
|
var { saltoAutomatico, conCampoOpciones } = useSelector((state: CasoState) => state.opciones);
|
|
636
628
|
const longitud = mini ? pregunta.casilleros.reduce((acum, o) => Math.max(o.casillero.toString().length, acum), 0) :
|
|
637
|
-
// @ts-ignore mini es para los otros
|
|
638
629
|
pregunta.longitud;
|
|
639
630
|
// var [valor, setValor] = useState(props.valor);
|
|
640
631
|
var [editando, setEditando] = useState(false);
|
|
@@ -645,9 +636,8 @@ function Campo(props: { disabled: boolean, pregunta: PreguntaSimple | PreguntaCo
|
|
|
645
636
|
maxLength: longitud,
|
|
646
637
|
};
|
|
647
638
|
const onChange = (nuevoValor: Valor | typeof NO_CAMBIAR__VERIFICAR_SI_ES_NECESARIO) => {
|
|
648
|
-
var { siguienteVariable } = dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: pregunta.var_name, respuesta: nuevoValor });
|
|
639
|
+
var { siguienteVariable } = dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: pregunta.var_name as IdVariable, respuesta: nuevoValor });
|
|
649
640
|
if (siguienteVariable && debeSaltar) {
|
|
650
|
-
//@ts-ignore algunos casilleros tienen especial y otros no
|
|
651
641
|
(pregunta.especial?.noScroll == true) ? null : enfocarElementoDeVariable(pregunta.especial?.scrollTo ?? siguienteVariable);
|
|
652
642
|
}
|
|
653
643
|
};
|
|
@@ -660,8 +650,7 @@ function Campo(props: { disabled: boolean, pregunta: PreguntaSimple | PreguntaCo
|
|
|
660
650
|
/>}
|
|
661
651
|
<div className="input-campo">
|
|
662
652
|
<TextField
|
|
663
|
-
id={`var-${pregunta.var_name}`}
|
|
664
|
-
//@ts-ignore algunos casilleros tienen especial y otros no
|
|
653
|
+
id={`var-${pregunta.var_name || ''}`}
|
|
665
654
|
disabled={disabled || pregunta.especial?.gps}
|
|
666
655
|
className="variable"
|
|
667
656
|
//var-length={pregunta.longitud}
|
|
@@ -805,7 +794,7 @@ function PreguntaDespliegue(props: {
|
|
|
805
794
|
{getLosMetadatos(pregunta)}
|
|
806
795
|
<Campo
|
|
807
796
|
disabled={pregunta.calculada ? true : false}
|
|
808
|
-
pregunta={pregunta}
|
|
797
|
+
pregunta={pregunta as unknown as PreguntaSimple}
|
|
809
798
|
forPk={props.forPk}
|
|
810
799
|
mini={true}
|
|
811
800
|
/>
|
|
@@ -911,9 +900,9 @@ function PMatrizDespliegue(props: {
|
|
|
911
900
|
registrarElemento({
|
|
912
901
|
id,
|
|
913
902
|
direct: true,
|
|
914
|
-
fun: registradorDeVariable(pregunta)
|
|
903
|
+
fun: registradorDeVariable(pregunta as unknown as Pregunta)
|
|
915
904
|
})
|
|
916
|
-
return <td key={id} id={id}><PreguntaDespliegue forPk={props.forPk} pregunta={pregunta} despliegueEncabezado="superior" paraPMatriz={true} /></td>
|
|
905
|
+
return <td key={id} id={id}><PreguntaDespliegue forPk={props.forPk} pregunta={pregunta as unknown as Pregunta} despliegueEncabezado="superior" paraPMatriz={true} /></td>
|
|
917
906
|
})}
|
|
918
907
|
</tr>
|
|
919
908
|
|
|
@@ -1081,7 +1070,7 @@ type DefinicionFormularioAbrir =
|
|
|
1081
1070
|
{ forPk: ForPk, num: number, actual: boolean, previo: false, esConfirmar: true } |
|
|
1082
1071
|
{ forPk: ForPk, num: number, actual: boolean, previo: false, permiteBorrar: boolean } |
|
|
1083
1072
|
{ forPk: ForPk, num: false, actual: boolean, previo: true, unico: true })
|
|
1084
|
-
& { esConfirmar?: true, esAgregar?: true, permiteBorrar?: boolean, disabled?: boolean | undefined };
|
|
1073
|
+
& { esConfirmar?: true, esAgregar?: true, permiteBorrar?: boolean, permiteBorrarGabinete?: boolean, disabled?: boolean | undefined };
|
|
1085
1074
|
|
|
1086
1075
|
|
|
1087
1076
|
var botonFormularioConResumen = (
|
|
@@ -1091,7 +1080,8 @@ var botonFormularioConResumen = (
|
|
|
1091
1080
|
casillero: { despliegueOculta?: boolean | null, expresion_habilitar_js?: string, aclaracion: string | null, expresion_habilitar?: string, nombre?: string, salto: string | null, especial?: any },
|
|
1092
1081
|
forPkPadre: ForPk,
|
|
1093
1082
|
idButton: string,
|
|
1094
|
-
formularioAAbrir: Formulario
|
|
1083
|
+
formularioAAbrir: Formulario,
|
|
1084
|
+
pedirConfirmacionBorrado?: (defBoton: DefinicionFormularioAbrir, forPkPadre: ForPk) => void
|
|
1095
1085
|
) => {
|
|
1096
1086
|
var forPk: ForPk = defBoton.forPk;
|
|
1097
1087
|
var sufijoIdElemento = toPlainForPk(forPk) + (defBoton.esConfirmar ? '-listo' : '');
|
|
@@ -1149,7 +1139,7 @@ var botonFormularioConResumen = (
|
|
|
1149
1139
|
])
|
|
1150
1140
|
]
|
|
1151
1141
|
}),
|
|
1152
|
-
(defBoton.permiteBorrar ?
|
|
1142
|
+
(defBoton.permiteBorrar || defBoton.permiteBorrarGabinete ?
|
|
1153
1143
|
Button2({
|
|
1154
1144
|
className: "boton-borrar-ua-vacia",
|
|
1155
1145
|
color: "default",
|
|
@@ -1159,14 +1149,18 @@ var botonFormularioConResumen = (
|
|
|
1159
1149
|
html.path({ d: materialIoIconsSvgPath.DeleteForever, style: styleToCss({ fill: 'currentColor' }) })
|
|
1160
1150
|
]),
|
|
1161
1151
|
onClick: () => {
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1152
|
+
if (defBoton.permiteBorrar) {
|
|
1153
|
+
accion_borrar_formulario({ forPk, forPkPadre });
|
|
1154
|
+
const { listo, agregar } = getBFVarNames(casillero.salto);
|
|
1155
|
+
if (defBoton.num === 1) {
|
|
1156
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: agregar, respuesta: null as unknown as Valor });
|
|
1157
|
+
}
|
|
1158
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: listo, respuesta: null as unknown as Valor });
|
|
1159
|
+
if (casillero.expresion_habilitar) {
|
|
1160
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: casillero.expresion_habilitar as IdVariable, respuesta: null as unknown as Valor });
|
|
1161
|
+
}
|
|
1162
|
+
} else if (defBoton.permiteBorrarGabinete && pedirConfirmacionBorrado) {
|
|
1163
|
+
pedirConfirmacionBorrado(defBoton, forPkPadre);
|
|
1170
1164
|
}
|
|
1171
1165
|
}
|
|
1172
1166
|
})
|
|
@@ -1196,7 +1190,7 @@ var botonFormularioConResumen = (
|
|
|
1196
1190
|
]),
|
|
1197
1191
|
(defBoton.num !== false && !defBoton.esAgregar && !defBoton.esConfirmar ?
|
|
1198
1192
|
(casillero.especial?.camposResumen ?? [/*defBoton.num.toString()*/]).map(
|
|
1199
|
-
(campo: string) => html.td(respuestasAumentadas[formularioAAbrir.unidad_analisis][defBoton.num - 1][campo as IdVariable])
|
|
1193
|
+
(campo: string) => html.td((respuestasAumentadas[formularioAAbrir.unidad_analisis][defBoton.num - 1][campo as IdVariable] ?? '').toString())
|
|
1200
1194
|
)
|
|
1201
1195
|
: null)
|
|
1202
1196
|
// html.div({class:'inline-dialog', $attrs:{"inline-dialog-open": confirmarForzarIr == defBoton.num?'visible':'hidden'}},[ ])
|
|
@@ -1217,7 +1211,7 @@ var buscarHnosFormulario = (idFormularioDestino: IdFormulario) => {
|
|
|
1217
1211
|
var estructura = getEstructura();
|
|
1218
1212
|
var ua = estructura.formularios[idFormularioDestino].casilleros.unidad_analisis;
|
|
1219
1213
|
return likeAr(estructura.formularios)
|
|
1220
|
-
.filter((infoFormulario: InfoFormulario,
|
|
1214
|
+
.filter((infoFormulario: InfoFormulario, _idForm: IdFormulario) =>
|
|
1221
1215
|
infoFormulario.casilleros.unidad_analisis == ua
|
|
1222
1216
|
).map((_infoFormulario: InfoFormulario, idForm: IdFormulario) =>
|
|
1223
1217
|
idForm
|
|
@@ -1260,6 +1254,17 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1260
1254
|
*/
|
|
1261
1255
|
const dispatch = useDispatch();
|
|
1262
1256
|
var [confirmarForzarIr, setConfirmarForzarIr] = useState<DefinicionFormularioAbrir | false | null>(null);
|
|
1257
|
+
var [confirmacionBorrado, setConfirmacionBorrado] = useState<{defBoton: DefinicionFormularioAbrir, forPkPadre: ForPk, datos: any} | null>(null);
|
|
1258
|
+
var [fraseBorrado, setFraseBorrado] = useState('');
|
|
1259
|
+
var [errorFraseBorrado, setErrorFraseBorrado] = useState(false);
|
|
1260
|
+
var permiteBorrarGabinete = getDatosByPass().permiteBorrarElementosUA ?? false;
|
|
1261
|
+
var pedirConfirmacionBorrado = (defBoton: DefinicionFormularioAbrir, forPkPadre: ForPk) => {
|
|
1262
|
+
const {respuestas} = respuestasForPk(forPkPadre)
|
|
1263
|
+
var datosHijos = respuestas[formularioAAbrir.unidad_analisis][(defBoton.num || 1) - 1];
|
|
1264
|
+
setConfirmacionBorrado({ defBoton, forPkPadre, datos: datosHijos });
|
|
1265
|
+
setFraseBorrado('');
|
|
1266
|
+
setErrorFraseBorrado(false);
|
|
1267
|
+
};
|
|
1263
1268
|
var multipleFormularios = formularioAAbrir.unidad_analisis != props.formulario.unidad_analisis;
|
|
1264
1269
|
var nuevoCampoPk = defOperativo.defUA[formularioAAbrir.unidad_analisis].pk;
|
|
1265
1270
|
// var var_name='$B.'+casillero.salto; //original
|
|
@@ -1316,10 +1321,11 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1316
1321
|
permiteBorrar: likeAr(conjunto).array().length == Number(i) + 1 &&
|
|
1317
1322
|
checkFormsVacios(formHnos, feedbackAll, forPk) &&
|
|
1318
1323
|
calcularPermiteBorrarBF(configSorteoFormulario, idFormularioDestino),
|
|
1324
|
+
permiteBorrarGabinete,
|
|
1319
1325
|
disabled: calcularDisabledBF(configSorteoFormulario, habilitacionBotonFormulario, num, idFormularioDestino, respuestasAumentadas)
|
|
1320
1326
|
}
|
|
1321
1327
|
}).array();
|
|
1322
|
-
if ("puede agregar //TODO VER ESTO" && (conjunto instanceof Array || conjunto == null)) {
|
|
1328
|
+
if (true /*"puede agregar //TODO VER ESTO"*/ && (conjunto instanceof Array || conjunto == null)) {
|
|
1323
1329
|
let nuevoValorPk = (conjunto == null ? 0 : conjunto.length) + 1;
|
|
1324
1330
|
let forPk = { ...props.forPk, formulario: idFormularioDestino, [nuevoCampoPk]: nuevoValorPk };
|
|
1325
1331
|
let listoPresionado = respuestasAumentadas[BF_listo] != null;
|
|
@@ -1351,7 +1357,7 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1351
1357
|
}
|
|
1352
1358
|
var todosLosBotones = listaDeBotonesAbrir.map(defBoton =>
|
|
1353
1359
|
botonFormularioConResumen(defBoton, feedbackAll[toPlainForPk(defBoton.forPk)] ?? { resumen: 'vacio' }, respuestasAumentadas,
|
|
1354
|
-
casillero, props.forPk, idButton, formularioAAbrir
|
|
1360
|
+
casillero, props.forPk, idButton, formularioAAbrir, pedirConfirmacionBorrado
|
|
1355
1361
|
)
|
|
1356
1362
|
)
|
|
1357
1363
|
let nombresCamposResumen = likeAr((casillero.especial?.camposResumen || [])).array().map(c => c);
|
|
@@ -1362,11 +1368,11 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1362
1368
|
html.tr([
|
|
1363
1369
|
casillero.aclaracion ? html.th() : null,
|
|
1364
1370
|
html.th(casillero.nombre),
|
|
1365
|
-
nombresCamposResumen.map((nombreCampo) => html.th(nombreCampo)),
|
|
1371
|
+
...nombresCamposResumen.map((nombreCampo) => html.th(nombreCampo as string)),
|
|
1366
1372
|
])
|
|
1367
1373
|
]),
|
|
1368
1374
|
html.tbody([
|
|
1369
|
-
todosLosBotones
|
|
1375
|
+
...todosLosBotones
|
|
1370
1376
|
])
|
|
1371
1377
|
]).create());
|
|
1372
1378
|
} catch (err) {
|
|
@@ -1386,8 +1392,7 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1386
1392
|
var nuevaForPk = { ...forPk, formulario: idFormularioDestino };
|
|
1387
1393
|
var { listo: BF_listo, agregar: BF_agregar } = getBFVarNames(casillero.salto);
|
|
1388
1394
|
if (multipleFormularios) {
|
|
1389
|
-
|
|
1390
|
-
nuevaForPk[nuevoCampoPk] = defBoton.num
|
|
1395
|
+
(nuevaForPk as any)[nuevoCampoPk] = defBoton.num
|
|
1391
1396
|
if (defBoton.esAgregar) {
|
|
1392
1397
|
dispatchByPass(accion_agregar_formulario, { forPk: nuevaForPk });
|
|
1393
1398
|
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: BF_agregar, respuesta: 1 as Valor });
|
|
@@ -1430,6 +1435,86 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1430
1435
|
<Button color="secondary" onClick={() => confirmarForzarIr && ir(confirmarForzarIr)}>forzar</Button>
|
|
1431
1436
|
<Button color="primary" variant="contained" onClick={() => setConfirmarForzarIr(null)}>Entendido</Button>
|
|
1432
1437
|
</Dialog>
|
|
1438
|
+
{confirmacionBorrado && (
|
|
1439
|
+
<Dialog open={true} onClose={() => {
|
|
1440
|
+
setConfirmacionBorrado(null);
|
|
1441
|
+
setFraseBorrado('');
|
|
1442
|
+
setErrorFraseBorrado(false);
|
|
1443
|
+
}}>
|
|
1444
|
+
<DialogTitle>Advertencia: Se perderán datos</DialogTitle>
|
|
1445
|
+
<DialogContent>
|
|
1446
|
+
<DialogContentText>
|
|
1447
|
+
Está por borrar un formulario que no cumple las condiciones habituales de borrado. Los datos a continuación y todos sus registros asociados se perderán por completo. ¿Desea continuar?
|
|
1448
|
+
</DialogContentText>
|
|
1449
|
+
|
|
1450
|
+
<div style={{ marginTop: '20px', marginBottom: '20px' }}>
|
|
1451
|
+
<DialogContentText>
|
|
1452
|
+
Para confirmar el borrado, escriba la frase <strong>"forzar borrado"</strong> a continuación:
|
|
1453
|
+
</DialogContentText>
|
|
1454
|
+
<input
|
|
1455
|
+
id="input-forzar-borrado"
|
|
1456
|
+
type="text"
|
|
1457
|
+
value={fraseBorrado}
|
|
1458
|
+
onChange={e => {
|
|
1459
|
+
setFraseBorrado(e.target.value);
|
|
1460
|
+
setErrorFraseBorrado(false);
|
|
1461
|
+
}}
|
|
1462
|
+
style={{width: '100%', padding: '8px', border: errorFraseBorrado ? '1px solid red' : '1px solid #ccc', borderRadius: '4px'}}
|
|
1463
|
+
placeholder="forzar borrado"
|
|
1464
|
+
autoComplete="off"
|
|
1465
|
+
/>
|
|
1466
|
+
{errorFraseBorrado && <div style={{color: 'red', marginTop: '5px', fontSize: '0.85em'}}>La frase ingresada es incorrecta.</div>}
|
|
1467
|
+
</div>
|
|
1468
|
+
|
|
1469
|
+
<Typography variant="h6" style={{ marginTop: '10px', fontWeight: 'bold' }}>Datos que se perderán:</Typography>
|
|
1470
|
+
<pre style={{maxWidth: '100%', overflowX: 'auto', background: '#f5f5f5', padding: '10px', marginTop: '10px', marginBottom: '20px'}}>
|
|
1471
|
+
{JSON.stringify(confirmacionBorrado.datos, null, 2)}
|
|
1472
|
+
</pre>
|
|
1473
|
+
</DialogContent>
|
|
1474
|
+
<DialogActions>
|
|
1475
|
+
<Button
|
|
1476
|
+
color="primary"
|
|
1477
|
+
variant="outlined"
|
|
1478
|
+
onClick={() => {
|
|
1479
|
+
setConfirmacionBorrado(null);
|
|
1480
|
+
setFraseBorrado('');
|
|
1481
|
+
setErrorFraseBorrado(false);
|
|
1482
|
+
}}
|
|
1483
|
+
>
|
|
1484
|
+
Cancelar
|
|
1485
|
+
</Button>
|
|
1486
|
+
<Button color="secondary" variant="contained" onClick={() => {
|
|
1487
|
+
if (!confirmacionBorrado) return;
|
|
1488
|
+
|
|
1489
|
+
if (fraseBorrado.trim().toLowerCase() !== "forzar borrado") {
|
|
1490
|
+
setErrorFraseBorrado(true);
|
|
1491
|
+
setTimeout(() => {
|
|
1492
|
+
const input = document.getElementById('input-forzar-borrado');
|
|
1493
|
+
if (input) {
|
|
1494
|
+
input.focus();
|
|
1495
|
+
input.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
1496
|
+
}
|
|
1497
|
+
}, 100);
|
|
1498
|
+
return;
|
|
1499
|
+
}
|
|
1500
|
+
const {defBoton, forPkPadre} = confirmacionBorrado;
|
|
1501
|
+
const forPk = defBoton.forPk;
|
|
1502
|
+
accion_borrar_formulario({ forPk, forPkPadre });
|
|
1503
|
+
const { listo, agregar } = getBFVarNames(casillero.salto);
|
|
1504
|
+
if (defBoton.num === 1) {
|
|
1505
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: agregar, respuesta: null as unknown as Valor });
|
|
1506
|
+
}
|
|
1507
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: listo, respuesta: null as unknown as Valor });
|
|
1508
|
+
if (casillero.expresion_habilitar) {
|
|
1509
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: casillero.expresion_habilitar as IdVariable, respuesta: null as unknown as Valor });
|
|
1510
|
+
}
|
|
1511
|
+
setConfirmacionBorrado(null);
|
|
1512
|
+
setFraseBorrado('');
|
|
1513
|
+
setErrorFraseBorrado(false);
|
|
1514
|
+
}}>Borrar de todas formas</Button>
|
|
1515
|
+
</DialogActions>
|
|
1516
|
+
</Dialog>
|
|
1517
|
+
)}
|
|
1433
1518
|
</DesplegarCasillero>
|
|
1434
1519
|
}
|
|
1435
1520
|
|
|
@@ -2441,9 +2526,9 @@ setCalcularVariables((respuestasRaiz: RespuestasRaiz, forPk: ForPk) => {
|
|
|
2441
2526
|
}
|
|
2442
2527
|
}
|
|
2443
2528
|
}
|
|
2444
|
-
var uasIterar: {
|
|
2529
|
+
var uasIterar: Partial<{
|
|
2445
2530
|
[key in IdUnidadAnalisis]: ConfigPadre
|
|
2446
|
-
}
|
|
2531
|
+
}>;
|
|
2447
2532
|
var configEncu: ConfigPadre = {
|
|
2448
2533
|
uaPersonas: 'personas',
|
|
2449
2534
|
varSexoPersona: 'sexo' as IdVariable,
|
|
@@ -2463,8 +2548,9 @@ setCalcularVariables((respuestasRaiz: RespuestasRaiz, forPk: ForPk) => {
|
|
|
2463
2548
|
["hogares_sup" as IdUnidadAnalisis]: configSupe
|
|
2464
2549
|
}
|
|
2465
2550
|
likeAr(uasIterar).forEach((configPadre, uaPadre) => {
|
|
2466
|
-
|
|
2467
|
-
|
|
2551
|
+
if (configPadre) {
|
|
2552
|
+
autoCargarPersonas(configPadre, uaPadre as IdUnidadAnalisis, estructura)
|
|
2553
|
+
}
|
|
2468
2554
|
})
|
|
2469
2555
|
} else {
|
|
2470
2556
|
var configPadres: ConfigPadre[] = [configEncu, configSupe];
|
|
@@ -2474,10 +2560,10 @@ setCalcularVariables((respuestasRaiz: RespuestasRaiz, forPk: ForPk) => {
|
|
|
2474
2560
|
}
|
|
2475
2561
|
respuestasRaiz.vdominio = getDatosByPass().informacionHdr[forPk[estructura.pkAgregadaUaPpal]].tem.dominio;
|
|
2476
2562
|
//TODO: MEJORAR EN ALGUN MOMENTO EL BOTON LISTO
|
|
2477
|
-
let totalH = respuestasRaiz['total_h' as IdVariable];
|
|
2478
|
-
respuestasRaiz['$B.F:S1' as IdVariable] = (respuestasRaiz['hogares'] || []).length == totalH ? 'ok' : null;
|
|
2479
|
-
let totalHsup = respuestasRaiz['total_h_sup' as IdVariable];
|
|
2480
|
-
respuestasRaiz['$B.F:S1_SUP' as IdVariable] = (respuestasRaiz['hogares_sup' as IdUnidadAnalisis] || []).length == totalHsup ? 'ok' : null;
|
|
2563
|
+
//let totalH = respuestasRaiz['total_h' as IdVariable];
|
|
2564
|
+
//respuestasRaiz['$B.F:S1' as IdVariable] = (respuestasRaiz['hogares'] || []).length == totalH ? 'ok' : null;
|
|
2565
|
+
//let totalHsup = respuestasRaiz['total_h_sup' as IdVariable];
|
|
2566
|
+
//respuestasRaiz['$B.F:S1_SUP' as IdVariable] = (respuestasRaiz['hogares_sup' as IdUnidadAnalisis] || []).length == totalHsup ? 'ok' : null;
|
|
2481
2567
|
})
|
|
2482
2568
|
|
|
2483
2569
|
window.addEventListener('load', function () {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import * as memoizeBadTyped from "memoize-one";
|
|
3
|
-
export declare var memoize: typeof memoizeBadTyped.default;
|
|
4
2
|
import { Store, Action } from "redux";
|
|
5
3
|
import { TipoVariables } from "./tipos";
|
|
6
4
|
export declare const materialIoIconsSvgPath: {
|
|
@@ -93,7 +91,9 @@ export type InputTypes = 'date' | 'number' | 'tel' | 'text';
|
|
|
93
91
|
export declare function adaptarTipoVarCasillero(casilleroDataType: TipoVariables | 'opciones' | 'si_no'): InputTypes;
|
|
94
92
|
export declare const scrollToTop: () => void;
|
|
95
93
|
export declare const scrollToBottom: () => void;
|
|
96
|
-
export declare function ScrollTop(props:
|
|
94
|
+
export declare function ScrollTop(props: {
|
|
95
|
+
children: React.ReactElement;
|
|
96
|
+
}): React.JSX.Element;
|
|
97
97
|
export type FocusOpts = {
|
|
98
98
|
moveToElement: boolean;
|
|
99
99
|
moveBehavior?: 'auto' | 'smooth';
|
|
@@ -115,7 +115,10 @@ export declare class RenderAndCaptureError extends React.Component<{
|
|
|
115
115
|
error: Error | {};
|
|
116
116
|
info?: any;
|
|
117
117
|
}> {
|
|
118
|
-
constructor(props:
|
|
118
|
+
constructor(props: {
|
|
119
|
+
dispatchers: IDispatchers;
|
|
120
|
+
mensajeRetorno: string;
|
|
121
|
+
});
|
|
119
122
|
componentDidCatch(error: Error, info: any): void;
|
|
120
123
|
render(): React.ReactNode;
|
|
121
124
|
}
|