dmencu 2.2.6 → 2.2.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.
- 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 +196 -109
- 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.d.ts +5 -0
- package/dist/unlogged/unlogged/render-formulario.js +152 -80
- package/dist/unlogged/unlogged/render-formulario.tsx +196 -109
- 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;
|
|
@@ -98,6 +92,15 @@ function breakeableText(text: string | null, diccionario?: { [clave: string]: Re
|
|
|
98
92
|
*/
|
|
99
93
|
}
|
|
100
94
|
|
|
95
|
+
export function getBFVarNames(salto: string | null) {
|
|
96
|
+
const armoNomSalto = salto?.substring(0, 2) == 'F:' ? salto.slice(2) : salto;
|
|
97
|
+
return {
|
|
98
|
+
listo: '$B.F:' + armoNomSalto as IdVariable,
|
|
99
|
+
agregar: '$B.F:' + armoNomSalto + '_agregar' as IdVariable,
|
|
100
|
+
idFormulario: 'F:' + armoNomSalto as IdFormulario
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
101
104
|
const VER_DOMINIO = false; // el encuestador no necesita ver el dominio en cada encuesta porque el dominio depende del área y se deduce del primer dígito del número de encuesta
|
|
102
105
|
// no poner VER_DOMINIO en true, cambiar por una variable que se fije si el DM está en modo prueba o en modo "diseño conceptual"
|
|
103
106
|
|
|
@@ -246,8 +249,6 @@ var sp3 = 'sp3' as IdVariable;
|
|
|
246
249
|
var sp4 = 'sp4' as IdVariable;
|
|
247
250
|
var sp5 = 'sp5' as IdVariable;
|
|
248
251
|
|
|
249
|
-
var diccionario = {}
|
|
250
|
-
|
|
251
252
|
/*
|
|
252
253
|
// const takeElementOrDefault<K, T extends [K in], D>()
|
|
253
254
|
function isIn<V, T>(k:keyof T, object:T): object[k] is V{
|
|
@@ -329,7 +330,6 @@ function OpcionDespliegue(props: { casillero: Opcion, valorOpcion: number, varia
|
|
|
329
330
|
if (botonStyle) botonStyle.color = 'green';
|
|
330
331
|
await sleep(DELAY_SCROLL_3);
|
|
331
332
|
if (botonStyle) botonStyle.color = '';
|
|
332
|
-
//@ts-ignore algunos casilleros tienen especial y otros no
|
|
333
333
|
(casillero.especial?.noScroll == true) ? null : enfocarElementoDeVariable(casillero.especial?.scrollTo ?? siguienteVariable);
|
|
334
334
|
}
|
|
335
335
|
}
|
|
@@ -426,7 +426,6 @@ function registradorDeVariable(pregunta: Pregunta | OpcionMultiple | ConjuntoPre
|
|
|
426
426
|
function OpcionMultipleDespliegue(props: { opcionM: OpcionMultiple, forPk: ForPk }) {
|
|
427
427
|
const { opcionM } = props;
|
|
428
428
|
var id = `opcionM-${opcionM.id_casillero}`;
|
|
429
|
-
//@ts-ignore altunos casilleros no tienen especial, no importa, es solo para poner los metadatos
|
|
430
429
|
var styles: React.CSSProperties = opcionM.especial?.flexDirection ? { flexDirection: opcionM.especial.flexDirection } : { flexWrap: 'wrap' };
|
|
431
430
|
registrarElemento({
|
|
432
431
|
id,
|
|
@@ -437,7 +436,7 @@ function OpcionMultipleDespliegue(props: { opcionM: OpcionMultiple, forPk: ForPk
|
|
|
437
436
|
setWindowWidth(window.innerWidth);
|
|
438
437
|
}
|
|
439
438
|
|
|
440
|
-
const [windowWidth, setWindowWidth] = useState();
|
|
439
|
+
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
|
|
441
440
|
window.addEventListener('resize', updateWindowWidth);
|
|
442
441
|
return <DesplegarCasillero
|
|
443
442
|
id={id}
|
|
@@ -468,15 +467,11 @@ const getLosMetadatos = (casillero: CasilleroEncabezable): React.JSX.Element =>
|
|
|
468
467
|
{casillero.tipovar && casillero.tipovar != 'opciones' && casillero.tipovar != 'si_no' ?
|
|
469
468
|
<span el-metadato="tipovar">{casillero.tipovar}</span>
|
|
470
469
|
: null}
|
|
471
|
-
{
|
|
472
|
-
casillero.optativo ? <span el-metadato="optativa">optativa</span> : null
|
|
473
|
-
}
|
|
470
|
+
{casillero.var_name && casillero.optativo ? <span el-metadato="optativa">optativa</span> : null}
|
|
474
471
|
{casillero.calculada ? <span el-metadato="calculada">calculada</span> : null}
|
|
475
472
|
{casillero.despliegueOculta ? <span el-metadato="oculta">oculta</span> : null}
|
|
476
473
|
{casillero.expresion_habilitar ? <span el-metadato="expresion_habilitar">habilita: {casillero.expresion_habilitar}</span> : null}
|
|
477
|
-
{
|
|
478
|
-
casillero.especial?.autoing ? <span el-metadato="expresion_autoing">autoing: {casillero.especial?.autoing}</span> : null
|
|
479
|
-
}
|
|
474
|
+
{casillero.especial?.autoing ? <span el-metadato="expresion_autoing">autoing: {casillero.especial?.autoing}</span> : null}
|
|
480
475
|
</div>
|
|
481
476
|
|
|
482
477
|
function EncabezadoDespliegue(props: {
|
|
@@ -492,7 +487,6 @@ function EncabezadoDespliegue(props: {
|
|
|
492
487
|
dispatchByPass(accion_registrar_respuesta, { respuesta: null, variable: casillero.var_name as IdVariable, forPk: forPk })
|
|
493
488
|
};
|
|
494
489
|
var ver_id = casillero.ver_id ?? casillero.casillero;
|
|
495
|
-
// @ts-ignore no está en todos los casilleros pero acá para el despliegue de metadatos no importa
|
|
496
490
|
var calculada = casillero.calculada;
|
|
497
491
|
var id = `id-div-${casillero.var_name || casillero.casillero}`;
|
|
498
492
|
var idAcciones = "acciones-" + id;
|
|
@@ -512,7 +506,7 @@ function EncabezadoDespliegue(props: {
|
|
|
512
506
|
<div className="id">
|
|
513
507
|
{ver_id}
|
|
514
508
|
</div>
|
|
515
|
-
{(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}
|
|
516
510
|
<div className="acciones-pregunta" id={idAcciones} accion-visible="0">
|
|
517
511
|
{casillero.var_name ? <div><Button
|
|
518
512
|
id={"borrar-pregunta-" + casillero.var_name}
|
|
@@ -541,30 +535,37 @@ function EncabezadoDespliegue(props: {
|
|
|
541
535
|
{casillero.especial?.gps ?
|
|
542
536
|
<span>
|
|
543
537
|
<Button color="primary" variant="outlined" style={{ marginLeft: '10px' }} onClick={(_event) => {
|
|
544
|
-
const
|
|
545
|
-
const agregarInfoGPS = (
|
|
546
|
-
|
|
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() || "[]");
|
|
547
543
|
aux.unshift(info);
|
|
548
|
-
|
|
549
|
-
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) });
|
|
550
545
|
}
|
|
551
|
-
let { siguienteVariable } = agregarInfoGPS(
|
|
546
|
+
let { siguienteVariable } = agregarInfoGPS(`${datetime.now().toYmdHms()} - esperando punto gps`) || {};
|
|
552
547
|
if (siguienteVariable) {
|
|
553
548
|
enfocarElementoDeVariable(siguienteVariable);
|
|
554
549
|
}
|
|
555
550
|
navigator.geolocation.getCurrentPosition(position => {
|
|
556
|
-
|
|
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));
|
|
557
557
|
}, e => {
|
|
558
|
-
agregarInfoGPS(
|
|
559
|
-
});
|
|
560
|
-
}
|
|
558
|
+
agregarInfoGPS(e.message);
|
|
559
|
+
}, { enableHighAccuracy: true, timeout: 10000 });
|
|
560
|
+
}
|
|
561
|
+
}><ICON.Location /></Button>
|
|
561
562
|
</span>
|
|
562
563
|
: null}
|
|
563
564
|
</div>
|
|
564
565
|
{casillero.aclaracion ?
|
|
565
566
|
<div className="aclaracion">
|
|
566
567
|
{casillero.salto && casillero.tipoc == 'FILTRO' ?
|
|
567
|
-
<SaltoDespliegue casillero={casillero} prefijo={breakeableText(casillero.aclaracion)} />
|
|
568
|
+
<SaltoDespliegue casillero={casillero} prefijo={breakeableText(casillero.aclaracion)!} />
|
|
568
569
|
:
|
|
569
570
|
breakeableText(casillero.aclaracion)
|
|
570
571
|
}
|
|
@@ -608,7 +609,7 @@ function DesplegarConfirmarBorrarRespuesta(props: { forPk: ForPk, variableBorrar
|
|
|
608
609
|
</Popover>;
|
|
609
610
|
}
|
|
610
611
|
|
|
611
|
-
function calcularNuestraLongitud(longitud: string | null) {
|
|
612
|
+
function calcularNuestraLongitud(longitud: string | number | null | undefined) {
|
|
612
613
|
return longitud;
|
|
613
614
|
}
|
|
614
615
|
|
|
@@ -625,7 +626,6 @@ function Campo(props: { disabled: boolean, pregunta: PreguntaSimple | PreguntaCo
|
|
|
625
626
|
var { pregunta, disabled, mini } = props;
|
|
626
627
|
var { saltoAutomatico, conCampoOpciones } = useSelector((state: CasoState) => state.opciones);
|
|
627
628
|
const longitud = mini ? pregunta.casilleros.reduce((acum, o) => Math.max(o.casillero.toString().length, acum), 0) :
|
|
628
|
-
// @ts-ignore mini es para los otros
|
|
629
629
|
pregunta.longitud;
|
|
630
630
|
// var [valor, setValor] = useState(props.valor);
|
|
631
631
|
var [editando, setEditando] = useState(false);
|
|
@@ -636,9 +636,8 @@ function Campo(props: { disabled: boolean, pregunta: PreguntaSimple | PreguntaCo
|
|
|
636
636
|
maxLength: longitud,
|
|
637
637
|
};
|
|
638
638
|
const onChange = (nuevoValor: Valor | typeof NO_CAMBIAR__VERIFICAR_SI_ES_NECESARIO) => {
|
|
639
|
-
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 });
|
|
640
640
|
if (siguienteVariable && debeSaltar) {
|
|
641
|
-
//@ts-ignore algunos casilleros tienen especial y otros no
|
|
642
641
|
(pregunta.especial?.noScroll == true) ? null : enfocarElementoDeVariable(pregunta.especial?.scrollTo ?? siguienteVariable);
|
|
643
642
|
}
|
|
644
643
|
};
|
|
@@ -651,8 +650,7 @@ function Campo(props: { disabled: boolean, pregunta: PreguntaSimple | PreguntaCo
|
|
|
651
650
|
/>}
|
|
652
651
|
<div className="input-campo">
|
|
653
652
|
<TextField
|
|
654
|
-
id={`var-${pregunta.var_name}`}
|
|
655
|
-
//@ts-ignore algunos casilleros tienen especial y otros no
|
|
653
|
+
id={`var-${pregunta.var_name || ''}`}
|
|
656
654
|
disabled={disabled || pregunta.especial?.gps}
|
|
657
655
|
className="variable"
|
|
658
656
|
//var-length={pregunta.longitud}
|
|
@@ -796,7 +794,7 @@ function PreguntaDespliegue(props: {
|
|
|
796
794
|
{getLosMetadatos(pregunta)}
|
|
797
795
|
<Campo
|
|
798
796
|
disabled={pregunta.calculada ? true : false}
|
|
799
|
-
pregunta={pregunta}
|
|
797
|
+
pregunta={pregunta as unknown as PreguntaSimple}
|
|
800
798
|
forPk={props.forPk}
|
|
801
799
|
mini={true}
|
|
802
800
|
/>
|
|
@@ -902,9 +900,9 @@ function PMatrizDespliegue(props: {
|
|
|
902
900
|
registrarElemento({
|
|
903
901
|
id,
|
|
904
902
|
direct: true,
|
|
905
|
-
fun: registradorDeVariable(pregunta)
|
|
903
|
+
fun: registradorDeVariable(pregunta as unknown as Pregunta)
|
|
906
904
|
})
|
|
907
|
-
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>
|
|
908
906
|
})}
|
|
909
907
|
</tr>
|
|
910
908
|
|
|
@@ -1072,7 +1070,7 @@ type DefinicionFormularioAbrir =
|
|
|
1072
1070
|
{ forPk: ForPk, num: number, actual: boolean, previo: false, esConfirmar: true } |
|
|
1073
1071
|
{ forPk: ForPk, num: number, actual: boolean, previo: false, permiteBorrar: boolean } |
|
|
1074
1072
|
{ forPk: ForPk, num: false, actual: boolean, previo: true, unico: true })
|
|
1075
|
-
& { esConfirmar?: true, esAgregar?: true, permiteBorrar?: boolean, disabled?: boolean | undefined };
|
|
1073
|
+
& { esConfirmar?: true, esAgregar?: true, permiteBorrar?: boolean, permiteBorrarGabinete?: boolean, disabled?: boolean | undefined };
|
|
1076
1074
|
|
|
1077
1075
|
|
|
1078
1076
|
var botonFormularioConResumen = (
|
|
@@ -1082,7 +1080,8 @@ var botonFormularioConResumen = (
|
|
|
1082
1080
|
casillero: { despliegueOculta?: boolean | null, expresion_habilitar_js?: string, aclaracion: string | null, expresion_habilitar?: string, nombre?: string, salto: string | null, especial?: any },
|
|
1083
1081
|
forPkPadre: ForPk,
|
|
1084
1082
|
idButton: string,
|
|
1085
|
-
formularioAAbrir: Formulario
|
|
1083
|
+
formularioAAbrir: Formulario,
|
|
1084
|
+
pedirConfirmacionBorrado?: (defBoton: DefinicionFormularioAbrir, forPkPadre: ForPk) => void
|
|
1086
1085
|
) => {
|
|
1087
1086
|
var forPk: ForPk = defBoton.forPk;
|
|
1088
1087
|
var sufijoIdElemento = toPlainForPk(forPk) + (defBoton.esConfirmar ? '-listo' : '');
|
|
@@ -1116,12 +1115,9 @@ var botonFormularioConResumen = (
|
|
|
1116
1115
|
if (defBoton.esConfirmar) {
|
|
1117
1116
|
if (defBoton.num != null) {
|
|
1118
1117
|
if (casillero.salto) {
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable:
|
|
1122
|
-
|
|
1123
|
-
var BF_varname_agregar = '$B.F:' + armoNomSalto + '_agregar' as IdVariable;
|
|
1124
|
-
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: BF_varname_agregar, respuesta: 1 as Valor });
|
|
1118
|
+
const { listo, agregar } = getBFVarNames(casillero.salto);
|
|
1119
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: listo, respuesta: defBoton.num as Valor });
|
|
1120
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: agregar, respuesta: 1 as Valor });
|
|
1125
1121
|
}
|
|
1126
1122
|
if (casillero.expresion_habilitar) {
|
|
1127
1123
|
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: casillero.expresion_habilitar as IdVariable, respuesta: defBoton.num as Valor });
|
|
@@ -1143,7 +1139,7 @@ var botonFormularioConResumen = (
|
|
|
1143
1139
|
])
|
|
1144
1140
|
]
|
|
1145
1141
|
}),
|
|
1146
|
-
(defBoton.permiteBorrar ?
|
|
1142
|
+
(defBoton.permiteBorrar || defBoton.permiteBorrarGabinete ?
|
|
1147
1143
|
Button2({
|
|
1148
1144
|
className: "boton-borrar-ua-vacia",
|
|
1149
1145
|
color: "default",
|
|
@@ -1153,16 +1149,18 @@ var botonFormularioConResumen = (
|
|
|
1153
1149
|
html.path({ d: materialIoIconsSvgPath.DeleteForever, style: styleToCss({ fill: 'currentColor' }) })
|
|
1154
1150
|
]),
|
|
1155
1151
|
onClick: () => {
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
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);
|
|
1166
1164
|
}
|
|
1167
1165
|
}
|
|
1168
1166
|
})
|
|
@@ -1180,11 +1178,9 @@ var botonFormularioConResumen = (
|
|
|
1180
1178
|
]),
|
|
1181
1179
|
],
|
|
1182
1180
|
onClick: () => {
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: BF_varname_agregar, respuesta: null as unknown as Valor });
|
|
1187
|
-
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: BF_varname_listo, respuesta: null as unknown as Valor });
|
|
1181
|
+
const { listo, agregar } = getBFVarNames(casillero.salto);
|
|
1182
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: agregar, respuesta: null as unknown as Valor });
|
|
1183
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: listo, respuesta: null as unknown as Valor });
|
|
1188
1184
|
if (casillero.expresion_habilitar) {
|
|
1189
1185
|
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: casillero.expresion_habilitar as IdVariable, respuesta: null as unknown as Valor });
|
|
1190
1186
|
}
|
|
@@ -1194,7 +1190,7 @@ var botonFormularioConResumen = (
|
|
|
1194
1190
|
]),
|
|
1195
1191
|
(defBoton.num !== false && !defBoton.esAgregar && !defBoton.esConfirmar ?
|
|
1196
1192
|
(casillero.especial?.camposResumen ?? [/*defBoton.num.toString()*/]).map(
|
|
1197
|
-
(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())
|
|
1198
1194
|
)
|
|
1199
1195
|
: null)
|
|
1200
1196
|
// html.div({class:'inline-dialog', $attrs:{"inline-dialog-open": confirmarForzarIr == defBoton.num?'visible':'hidden'}},[ ])
|
|
@@ -1215,7 +1211,7 @@ var buscarHnosFormulario = (idFormularioDestino: IdFormulario) => {
|
|
|
1215
1211
|
var estructura = getEstructura();
|
|
1216
1212
|
var ua = estructura.formularios[idFormularioDestino].casilleros.unidad_analisis;
|
|
1217
1213
|
return likeAr(estructura.formularios)
|
|
1218
|
-
.filter((infoFormulario: InfoFormulario,
|
|
1214
|
+
.filter((infoFormulario: InfoFormulario, _idForm: IdFormulario) =>
|
|
1219
1215
|
infoFormulario.casilleros.unidad_analisis == ua
|
|
1220
1216
|
).map((_infoFormulario: InfoFormulario, idForm: IdFormulario) =>
|
|
1221
1217
|
idForm
|
|
@@ -1236,10 +1232,7 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1236
1232
|
var { casillero, forPk } = props;
|
|
1237
1233
|
var habilitador = casillero.expresion_habilitar_js ? getFuncionHabilitar(casillero.expresion_habilitar_js) : () => true;
|
|
1238
1234
|
var { opciones } = useSelectorVivienda(forPk);
|
|
1239
|
-
|
|
1240
|
-
var armoNomSalto = casillero.salto?.substring(0, 2) == 'F:' ? casillero.salto.slice(2) : casillero.salto;
|
|
1241
|
-
//console.log('BotonFormularioDespliegue armoNomSalto ' +armoNomSalto);
|
|
1242
|
-
var idFormularioDestino = 'F:' + armoNomSalto! as IdFormulario;
|
|
1235
|
+
var { listo: BF_listo, agregar: BF_agregar, idFormulario: idFormularioDestino } = getBFVarNames(casillero.salto);
|
|
1243
1236
|
var estructura = getEstructura();
|
|
1244
1237
|
var { formularioAAbrir } = useSelector((_state: CasoState) => ({
|
|
1245
1238
|
formularioAAbrir: estructura.formularios[idFormularioDestino].casilleros,
|
|
@@ -1261,13 +1254,23 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1261
1254
|
*/
|
|
1262
1255
|
const dispatch = useDispatch();
|
|
1263
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
|
+
};
|
|
1264
1268
|
var multipleFormularios = formularioAAbrir.unidad_analisis != props.formulario.unidad_analisis;
|
|
1265
1269
|
var nuevoCampoPk = defOperativo.defUA[formularioAAbrir.unidad_analisis].pk;
|
|
1266
1270
|
// var var_name='$B.'+casillero.salto; //original
|
|
1267
|
-
var
|
|
1268
|
-
var idSeccion = `seccion-boton-formulario-${var_name}`;
|
|
1271
|
+
var idSeccion = `seccion-boton-formulario-${BF_listo}`;
|
|
1269
1272
|
var idButton = `special-button-${idSeccion}`;
|
|
1270
|
-
var var_name_registro = multipleFormularios ?
|
|
1273
|
+
var var_name_registro = multipleFormularios ? BF_agregar : BF_listo;
|
|
1271
1274
|
registrarElemento<HTMLDivElement>({
|
|
1272
1275
|
id: idSeccion,
|
|
1273
1276
|
variable: var_name_registro,
|
|
@@ -1279,25 +1282,25 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1279
1282
|
}
|
|
1280
1283
|
) => {
|
|
1281
1284
|
try {
|
|
1282
|
-
var estado_listo = feedbackRow.feedback[
|
|
1283
|
-
var estado_agregar = multipleFormularios ? (feedbackRow.feedback[
|
|
1285
|
+
var estado_listo = feedbackRow.feedback[BF_listo]?.estado || 'valida';
|
|
1286
|
+
var estado_agregar = multipleFormularios ? (feedbackRow.feedback[BF_agregar]?.estado || 'valida') : 'valida';
|
|
1284
1287
|
var estado_general = estado_agregar !== 'valida' ? estado_agregar : estado_listo;
|
|
1285
1288
|
setAttrDistinto(div, 'nuestro-validator', estado_general);
|
|
1286
1289
|
setAttrDistinto(div, 'tiene-valor', estado_general === 'valida' ? 'valido' : 'NO');
|
|
1287
1290
|
|
|
1288
1291
|
var listaDeBotonesAbrir: DefinicionFormularioAbrir[] = [];
|
|
1289
1292
|
// var esVarActual = feedbackRow.actual == '$B.F:'+casillero.salto; //original
|
|
1290
|
-
var esVarActual = !!feedbackRow.actual?.startsWith(
|
|
1293
|
+
var esVarActual = !!feedbackRow.actual?.startsWith(BF_listo);
|
|
1291
1294
|
// console.log('BotonFormularioDespliegue esVarActual ' +esVarActual );
|
|
1292
1295
|
if (multipleFormularios && casillero.salto != null) {
|
|
1293
1296
|
// let defFormulario:InfoFormulario = estructura.formularios['F:'+casillero.salto as IdFormulario]; //original
|
|
1294
|
-
let defFormulario: InfoFormulario = estructura.formularios[
|
|
1297
|
+
let defFormulario: InfoFormulario = estructura.formularios[idFormularioDestino];
|
|
1295
1298
|
let defUA = estructura.unidades_analisis[defFormulario.casilleros.unidad_analisis!];
|
|
1296
1299
|
let conjunto = respuestasAumentadas[defFormulario.casilleros.unidad_analisis!];
|
|
1297
1300
|
let cantidadEsperada = respuestasAumentadas[casillero.expresion_habilitar as IdVariable];
|
|
1298
1301
|
var numActual: number | null = null;
|
|
1299
1302
|
// var estadoDelBoton = feedbackRow.feedback['$B.F:'+casillero.salto as IdVariable].estado //original
|
|
1300
|
-
var estadoDelBoton = feedbackRow.feedback[
|
|
1303
|
+
var estadoDelBoton = feedbackRow.feedback[BF_listo].estado
|
|
1301
1304
|
// console.log('BotonFormularioDespliegue estadoDelBoton ' +estadoDelBoton );
|
|
1302
1305
|
var configSorteoFormulario = estructura.configSorteo ? estructura.configSorteo[getMainFormForVivienda(forPk[estructura.pkAgregadaUaPpal])] : null
|
|
1303
1306
|
var habilitacionBotonFormulario = estructura.habilitacionBotonFormulario;
|
|
@@ -1318,14 +1321,19 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1318
1321
|
permiteBorrar: likeAr(conjunto).array().length == Number(i) + 1 &&
|
|
1319
1322
|
checkFormsVacios(formHnos, feedbackAll, forPk) &&
|
|
1320
1323
|
calcularPermiteBorrarBF(configSorteoFormulario, idFormularioDestino),
|
|
1324
|
+
permiteBorrarGabinete,
|
|
1321
1325
|
disabled: calcularDisabledBF(configSorteoFormulario, habilitacionBotonFormulario, num, idFormularioDestino, respuestasAumentadas)
|
|
1322
1326
|
}
|
|
1323
1327
|
}).array();
|
|
1324
|
-
if ("puede agregar //TODO VER ESTO" && (conjunto instanceof Array || conjunto == null)) {
|
|
1328
|
+
if (true /*"puede agregar //TODO VER ESTO"*/ && (conjunto instanceof Array || conjunto == null)) {
|
|
1325
1329
|
let nuevoValorPk = (conjunto == null ? 0 : conjunto.length) + 1;
|
|
1326
1330
|
let forPk = { ...props.forPk, formulario: idFormularioDestino, [nuevoCampoPk]: nuevoValorPk };
|
|
1327
|
-
let
|
|
1328
|
-
|
|
1331
|
+
let listoPresionado = respuestasAumentadas[BF_listo] != null;
|
|
1332
|
+
let debeAgregarOlisto = numActual == null &&
|
|
1333
|
+
(casillero.expresion_habilitar ?
|
|
1334
|
+
(cantidadEsperada == null || cantidadEsperada != (conjunto != null && conjunto.length))
|
|
1335
|
+
: !listoPresionado
|
|
1336
|
+
) && (estadoDelBoton == 'valida' || esVarActual);
|
|
1329
1337
|
listaDeBotonesAbrir.push({
|
|
1330
1338
|
forPk,
|
|
1331
1339
|
num: nuevoValorPk,
|
|
@@ -1349,7 +1357,7 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1349
1357
|
}
|
|
1350
1358
|
var todosLosBotones = listaDeBotonesAbrir.map(defBoton =>
|
|
1351
1359
|
botonFormularioConResumen(defBoton, feedbackAll[toPlainForPk(defBoton.forPk)] ?? { resumen: 'vacio' }, respuestasAumentadas,
|
|
1352
|
-
casillero, props.forPk, idButton, formularioAAbrir
|
|
1360
|
+
casillero, props.forPk, idButton, formularioAAbrir, pedirConfirmacionBorrado
|
|
1353
1361
|
)
|
|
1354
1362
|
)
|
|
1355
1363
|
let nombresCamposResumen = likeAr((casillero.especial?.camposResumen || [])).array().map(c => c);
|
|
@@ -1360,11 +1368,11 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1360
1368
|
html.tr([
|
|
1361
1369
|
casillero.aclaracion ? html.th() : null,
|
|
1362
1370
|
html.th(casillero.nombre),
|
|
1363
|
-
nombresCamposResumen.map((nombreCampo) => html.th(nombreCampo)),
|
|
1371
|
+
...nombresCamposResumen.map((nombreCampo) => html.th(nombreCampo as string)),
|
|
1364
1372
|
])
|
|
1365
1373
|
]),
|
|
1366
1374
|
html.tbody([
|
|
1367
|
-
todosLosBotones
|
|
1375
|
+
...todosLosBotones
|
|
1368
1376
|
])
|
|
1369
1377
|
]).create());
|
|
1370
1378
|
} catch (err) {
|
|
@@ -1382,33 +1390,31 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1382
1390
|
dispatch(dispatchers.VOLVER_HDR({}));
|
|
1383
1391
|
} else {
|
|
1384
1392
|
var nuevaForPk = { ...forPk, formulario: idFormularioDestino };
|
|
1385
|
-
var
|
|
1393
|
+
var { listo: BF_listo, agregar: BF_agregar } = getBFVarNames(casillero.salto);
|
|
1386
1394
|
if (multipleFormularios) {
|
|
1387
|
-
|
|
1388
|
-
nuevaForPk[nuevoCampoPk] = defBoton.num
|
|
1395
|
+
(nuevaForPk as any)[nuevoCampoPk] = defBoton.num
|
|
1389
1396
|
if (defBoton.esAgregar) {
|
|
1390
1397
|
dispatchByPass(accion_agregar_formulario, { forPk: nuevaForPk });
|
|
1391
|
-
|
|
1392
|
-
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable:
|
|
1393
|
-
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: BF_varname, respuesta: null as unknown as Valor });
|
|
1398
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: BF_agregar, respuesta: 1 as Valor });
|
|
1399
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: BF_listo, respuesta: null as unknown as Valor });
|
|
1394
1400
|
if (casillero.expresion_habilitar) {
|
|
1395
1401
|
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: casillero.expresion_habilitar as IdVariable, respuesta: null as unknown as Valor });
|
|
1396
1402
|
}
|
|
1397
1403
|
} else {
|
|
1398
1404
|
dispatchByPass(accion_abrir_formulario, { forPk: nuevaForPk });
|
|
1399
1405
|
// Si abro uno existente, también reseteo el listo para forzar que vuelvan a apretarlo si cambian algo
|
|
1400
|
-
//dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable:
|
|
1406
|
+
//dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: BF_listo, respuesta: null as unknown as Valor });
|
|
1401
1407
|
}
|
|
1402
1408
|
} else {
|
|
1403
|
-
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable:
|
|
1409
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: BF_listo, respuesta: 1 as Valor });
|
|
1404
1410
|
}
|
|
1405
1411
|
dispatch(dispatchers.CAMBIAR_FORMULARIO({ forPk: nuevaForPk, apilarVuelta: true }));
|
|
1406
1412
|
}
|
|
1407
1413
|
if (confirmarForzarIr) { setConfirmarForzarIr(false) }
|
|
1408
1414
|
};
|
|
1409
1415
|
return <DesplegarCasillero casillero={casillero}>
|
|
1410
|
-
{multipleFormularios && <span id={'var-' +
|
|
1411
|
-
<span id={'var-' +
|
|
1416
|
+
{multipleFormularios && <span id={'var-' + BF_agregar} style={{ position: 'absolute', marginTop: '-60px' }}></span>}
|
|
1417
|
+
<span id={'var-' + BF_listo} style={{ position: 'absolute', marginTop: '-60px' }}></span>
|
|
1412
1418
|
<div id={idSeccion}>
|
|
1413
1419
|
</div>
|
|
1414
1420
|
<Button className="special-button" id={idButton}
|
|
@@ -1429,6 +1435,86 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1429
1435
|
<Button color="secondary" onClick={() => confirmarForzarIr && ir(confirmarForzarIr)}>forzar</Button>
|
|
1430
1436
|
<Button color="primary" variant="contained" onClick={() => setConfirmarForzarIr(null)}>Entendido</Button>
|
|
1431
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
|
+
)}
|
|
1432
1518
|
</DesplegarCasillero>
|
|
1433
1519
|
}
|
|
1434
1520
|
|
|
@@ -2440,9 +2526,9 @@ setCalcularVariables((respuestasRaiz: RespuestasRaiz, forPk: ForPk) => {
|
|
|
2440
2526
|
}
|
|
2441
2527
|
}
|
|
2442
2528
|
}
|
|
2443
|
-
var uasIterar: {
|
|
2529
|
+
var uasIterar: Partial<{
|
|
2444
2530
|
[key in IdUnidadAnalisis]: ConfigPadre
|
|
2445
|
-
}
|
|
2531
|
+
}>;
|
|
2446
2532
|
var configEncu: ConfigPadre = {
|
|
2447
2533
|
uaPersonas: 'personas',
|
|
2448
2534
|
varSexoPersona: 'sexo' as IdVariable,
|
|
@@ -2462,8 +2548,9 @@ setCalcularVariables((respuestasRaiz: RespuestasRaiz, forPk: ForPk) => {
|
|
|
2462
2548
|
["hogares_sup" as IdUnidadAnalisis]: configSupe
|
|
2463
2549
|
}
|
|
2464
2550
|
likeAr(uasIterar).forEach((configPadre, uaPadre) => {
|
|
2465
|
-
|
|
2466
|
-
|
|
2551
|
+
if (configPadre) {
|
|
2552
|
+
autoCargarPersonas(configPadre, uaPadre as IdUnidadAnalisis, estructura)
|
|
2553
|
+
}
|
|
2467
2554
|
})
|
|
2468
2555
|
} else {
|
|
2469
2556
|
var configPadres: ConfigPadre[] = [configEncu, configSupe];
|
|
@@ -2473,10 +2560,10 @@ setCalcularVariables((respuestasRaiz: RespuestasRaiz, forPk: ForPk) => {
|
|
|
2473
2560
|
}
|
|
2474
2561
|
respuestasRaiz.vdominio = getDatosByPass().informacionHdr[forPk[estructura.pkAgregadaUaPpal]].tem.dominio;
|
|
2475
2562
|
//TODO: MEJORAR EN ALGUN MOMENTO EL BOTON LISTO
|
|
2476
|
-
let totalH = respuestasRaiz['total_h' as IdVariable];
|
|
2477
|
-
respuestasRaiz['$B.F:S1' as IdVariable] = (respuestasRaiz['hogares'] || []).length == totalH ? 'ok' : null;
|
|
2478
|
-
let totalHsup = respuestasRaiz['total_h_sup' as IdVariable];
|
|
2479
|
-
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;
|
|
2480
2567
|
})
|
|
2481
2568
|
|
|
2482
2569
|
window.addEventListener('load', function () {
|