dmencu 2.1.21 → 2.2.0
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/unlogged/redux-formulario.js +21 -6
- package/dist/client/unlogged/render-formulario.tsx +1315 -1235
- package/dist/client/unlogged/tipos.d.ts +2 -1
- package/dist/client/unlogged/tipos.js +1 -1
- package/dist/server/unlogged/tipos.d.ts +2 -1
- package/dist/server/unlogged/tipos.js +1 -1
- package/dist/unlogged/unlogged/redux-formulario.js +21 -6
- package/dist/unlogged/unlogged/render-formulario.js +98 -27
- package/dist/unlogged/unlogged/render-formulario.tsx +1315 -1235
- package/dist/unlogged/unlogged/tipos.d.ts +2 -1
- package/dist/unlogged/unlogged/tipos.js +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as ReactDOM from "react-dom";
|
|
3
|
-
import {
|
|
4
|
-
RenderPrincipal,
|
|
3
|
+
import {
|
|
4
|
+
RenderPrincipal,
|
|
5
5
|
adaptarTipoVarCasillero,
|
|
6
6
|
ICON,
|
|
7
7
|
focusToId,
|
|
@@ -10,13 +10,14 @@ import {
|
|
|
10
10
|
materialIoIconsSvgPath,
|
|
11
11
|
useOnlineStatus
|
|
12
12
|
} from "./render-general";
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
import {
|
|
14
|
+
Bloque, BotonFormulario,
|
|
15
|
+
CasilleroBase, CasoState, ConjuntoPreguntas, Consistencia,
|
|
16
|
+
EstadoCarga, Filtro, ForPk, ForPkRaiz, Formulario,
|
|
16
17
|
IdFormulario, IdPregunta, IdTarea, IdVariable, InfoFormulario,
|
|
17
18
|
ModoDespliegue,
|
|
18
|
-
Opcion, OpcionMultiple, PlainForPk,
|
|
19
|
-
Pregunta, PreguntaConOpciones, PreguntaSimple,
|
|
19
|
+
Opcion, OpcionMultiple, PlainForPk,
|
|
20
|
+
Pregunta, PreguntaConOpciones, PreguntaSimple,
|
|
20
21
|
Respuestas, RespuestaLasUA, RespuestasRaiz, Valor, TEM, IdCarga, Carga, IdFin, IdUnidadAnalisis,
|
|
21
22
|
ModoAlmacenamiento,
|
|
22
23
|
toPlainForPk,
|
|
@@ -29,7 +30,7 @@ import {Bloque, BotonFormulario,
|
|
|
29
30
|
PMatriz,
|
|
30
31
|
ModoDM
|
|
31
32
|
} from "./tipos";
|
|
32
|
-
import{
|
|
33
|
+
import {
|
|
33
34
|
accion_abrir_formulario,
|
|
34
35
|
accion_borrar_formulario,
|
|
35
36
|
calcularActualBF,
|
|
@@ -44,34 +45,35 @@ import{
|
|
|
44
45
|
respuestasForPk,
|
|
45
46
|
setCalcularVariables
|
|
46
47
|
} from "./bypass-formulario"
|
|
47
|
-
import {
|
|
48
|
+
import {
|
|
49
|
+
dmTraerDatosFormulario, dispatchers,
|
|
48
50
|
gotoSincronizar,
|
|
49
51
|
getCacheVersion,
|
|
50
52
|
gotoConsistir,
|
|
51
53
|
} from "./redux-formulario";
|
|
52
54
|
import { useState, useEffect, useLayoutEffect } from "react";
|
|
53
|
-
import { useSelector, useDispatch } from "react-redux";
|
|
55
|
+
import { useSelector, useDispatch } from "react-redux";
|
|
54
56
|
import { strict as likeAr, beingArray } from "like-ar";
|
|
55
|
-
import {sleep, coalesce, datetime} from "best-globals";
|
|
57
|
+
import { sleep, coalesce, datetime } from "best-globals";
|
|
56
58
|
import { unexpected } from "cast-error";
|
|
57
59
|
|
|
58
60
|
import {
|
|
59
|
-
AppBar, ButtonGroup, CircularProgress, Checkbox,
|
|
60
|
-
Dialog, DialogActions, DialogContent, DialogContentText,
|
|
61
|
+
AppBar, ButtonGroup, CircularProgress, Checkbox,
|
|
62
|
+
Dialog, DialogActions, DialogContent, DialogContentText,
|
|
61
63
|
DialogTitle, Divider, Fab, IconButton,
|
|
62
64
|
Menu, MenuItem, Paper, Popover,
|
|
63
65
|
Table, TableBody, TableCell, TableHead, TableRow, Toolbar, CssBaselineProps
|
|
64
66
|
} from "@mui/material";
|
|
65
67
|
import { EstadoVariable, FormStructureState } from "row-validator";
|
|
66
68
|
|
|
67
|
-
import {
|
|
68
|
-
registrarElemento, setAttrDistinto, setValorDistinto, dispatchByPass,
|
|
69
|
+
import {
|
|
70
|
+
registrarElemento, setAttrDistinto, setValorDistinto, dispatchByPass,
|
|
69
71
|
getDirty, getFeedbackRowValidator,
|
|
70
|
-
getFuncionHabilitar,
|
|
71
|
-
getEstructura,
|
|
72
|
+
getFuncionHabilitar,
|
|
73
|
+
getEstructura,
|
|
72
74
|
defOperativo,
|
|
73
75
|
volcadoInicialElementosRegistrados,
|
|
74
|
-
numberOrStringIncIfArray,
|
|
76
|
+
numberOrStringIncIfArray,
|
|
75
77
|
calcularElementoEnfocado,
|
|
76
78
|
accion_registrar_respuesta,
|
|
77
79
|
accion_id_pregunta,
|
|
@@ -81,16 +83,16 @@ import {
|
|
|
81
83
|
MODO_DM_LOCALSTORAGE_KEY
|
|
82
84
|
} from "./bypass-formulario"
|
|
83
85
|
|
|
84
|
-
import {html, HtmlTag} from "js-to-html";
|
|
86
|
+
import { html, HtmlTag } from "js-to-html";
|
|
85
87
|
|
|
86
88
|
const DELAY_SCROLL_3 = 50;
|
|
87
89
|
|
|
88
|
-
function breakeableText(text:string|null):string|undefined;
|
|
89
|
-
function breakeableText(text:string|null, diccionario?:{[clave:string]:React.ReactNode}){
|
|
90
|
-
if(typeof text != "string") return undefined;
|
|
91
|
-
text = text.replace(/\//g,"/\u2063").replace(/\/\u2063(\w)\b/g,'/$1');
|
|
92
|
-
text = text.replace(/___*/g,(todo)
|
|
93
|
-
if(!diccionario || true) return text;
|
|
90
|
+
function breakeableText(text: string | null): string | undefined;
|
|
91
|
+
function breakeableText(text: string | null, diccionario?: { [clave: string]: React.ReactNode }) {
|
|
92
|
+
if (typeof text != "string") return undefined;
|
|
93
|
+
text = text.replace(/\//g, "/\u2063").replace(/\/\u2063(\w)\b/g, '/$1');
|
|
94
|
+
text = text.replace(/___*/g, (todo) => `[${todo}]`).replace(/\@\w+\@/g, (todo) => `[${todo}]`);
|
|
95
|
+
if (!diccionario || true) return text;
|
|
94
96
|
/*
|
|
95
97
|
return <span>{partes.map((parte:string, i:number) => <span style={i%2==1?{textDecoration:"underline"}:{}}> {parte+" "} </span>)}</span>
|
|
96
98
|
*/
|
|
@@ -102,131 +104,140 @@ const VER_DOMINIO = false; // el encuestador no necesita ver el dominio en cada
|
|
|
102
104
|
const ID_BOTON_VOLVER_HDR = 'boton-volver-hdr';
|
|
103
105
|
const ID_BOTON_CERRAR = 'boton-cerrar-encuesta';
|
|
104
106
|
|
|
105
|
-
var debeSaltar:boolean = false;
|
|
107
|
+
var debeSaltar: boolean = false;
|
|
106
108
|
|
|
107
|
-
window.addEventListener('load', ()=>{
|
|
109
|
+
window.addEventListener('load', () => {
|
|
108
110
|
/*
|
|
109
111
|
window.addEventListener('keydown', (ev:KeyboardEvent)=>{
|
|
110
112
|
debeSaltar = ev.key == 'Enter' || ev.keyCode == 13;
|
|
111
113
|
})
|
|
112
114
|
*/
|
|
113
|
-
window.addEventListener('click', ()=>{
|
|
115
|
+
window.addEventListener('click', () => {
|
|
114
116
|
debeSaltar = false;
|
|
115
117
|
})
|
|
116
118
|
})
|
|
117
119
|
|
|
118
120
|
// /*
|
|
119
121
|
|
|
120
|
-
type CommonAttributes = {className?:string,style?:React.CSSProperties,id?:string, tabIndex?:number} // CSSProperties
|
|
121
|
-
type ColorValues = 'primary'|'secondary'|'default'|'inherit'|'success'
|
|
122
|
+
type CommonAttributes = { className?: string, style?: React.CSSProperties, id?: string, tabIndex?: number } // CSSProperties
|
|
123
|
+
type ColorValues = 'primary' | 'secondary' | 'default' | 'inherit' | 'success'
|
|
122
124
|
|
|
123
|
-
export type LibreDespliegueType = (props:{
|
|
124
|
-
key:string
|
|
125
|
-
casillero:Libre
|
|
126
|
-
formulario:Formulario
|
|
127
|
-
forPk:ForPk
|
|
128
|
-
})=>JSX.Element;
|
|
125
|
+
export type LibreDespliegueType = (props: {
|
|
126
|
+
key: string
|
|
127
|
+
casillero: Libre
|
|
128
|
+
formulario: Formulario
|
|
129
|
+
forPk: ForPk
|
|
130
|
+
}) => JSX.Element;
|
|
129
131
|
|
|
130
132
|
var LibreDespliegue: LibreDespliegueType
|
|
131
133
|
|
|
132
|
-
export const Button = ({variant, onClick, disabled, children, className, color, size,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
variant?:string,
|
|
137
|
-
color?:ColorValues,
|
|
138
|
-
onClick?:React.MouseEventHandler<HTMLButtonElement>, // (event:MouseEvent/* <HTMLButtonElement, MouseEvent>*/)=>void,
|
|
139
|
-
disabled?:boolean
|
|
140
|
-
children:any,
|
|
141
|
-
className?:string,
|
|
142
|
-
size?:'small',
|
|
143
|
-
disableElevation?:any, disableFocusRipple?:any, disableRipple?:any,
|
|
144
|
-
} & CommonAttributes)
|
|
134
|
+
export const Button = ({ variant, onClick, disabled, children, className, color, size,
|
|
135
|
+
disableElevation, disableFocusRipple, disableRipple,
|
|
136
|
+
...other
|
|
137
|
+
}: {
|
|
138
|
+
variant?: string,
|
|
139
|
+
color?: ColorValues,
|
|
140
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>, // (event:MouseEvent/* <HTMLButtonElement, MouseEvent>*/)=>void,
|
|
141
|
+
disabled?: boolean
|
|
142
|
+
children: any,
|
|
143
|
+
className?: string,
|
|
144
|
+
size?: 'small',
|
|
145
|
+
disableElevation?: any, disableFocusRipple?: any, disableRipple?: any,
|
|
146
|
+
} & CommonAttributes) => <button
|
|
145
147
|
{...other}
|
|
146
|
-
className={`btn btn${variant=='contained'?'':'-'+(variant=='outlined'?'outline':variant)}-${(color=='default' || color=='inherit'?'secondary':color=='secondary'?'danger':color)||'secondary'} ${className||''} ${size=='small'?'btn-sm':''}`}
|
|
148
|
+
className={`btn btn${variant == 'contained' ? '' : '-' + (variant == 'outlined' ? 'outline' : variant)}-${(color == 'default' || color == 'inherit' ? 'secondary' : color == 'secondary' ? 'danger' : color) || 'secondary'} ${className || ''} ${size == 'small' ? 'btn-sm' : ''}`}
|
|
147
149
|
disabled={disabled}
|
|
148
150
|
onClick={onClick}
|
|
149
151
|
>{children}</button>;
|
|
150
152
|
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
153
|
+
const styleToCss = (style: React.CSSProperties | string | undefined): string | undefined => {
|
|
154
|
+
if (typeof style === 'string' || style == null) return style;
|
|
155
|
+
return Object.entries(style).map(([k, v]) =>
|
|
156
|
+
`${k.replace(/[A-Z]/g, m => "-" + m.toLowerCase())}:${v}`
|
|
157
|
+
).join(';');
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const Button2 = ({ variant, onClick, disabled, children, className, color, size, style, ...other }: {
|
|
161
|
+
variant?: string,
|
|
162
|
+
color?: ColorValues,
|
|
163
|
+
onClick?: () => void,
|
|
164
|
+
disabled?: boolean
|
|
165
|
+
children: any,
|
|
166
|
+
className?: string,
|
|
167
|
+
size?: 'small',
|
|
168
|
+
style?: React.CSSProperties | string,
|
|
169
|
+
$attrs?: {}
|
|
170
|
+
} & CommonAttributes) => html.button({
|
|
161
171
|
...other,
|
|
162
|
-
|
|
172
|
+
style: styleToCss(style),
|
|
173
|
+
class: `btn btn${variant == 'contained' ? '' : '-' + (variant == 'outlined' ? 'outline' : variant)}-${(color == 'default' || color == 'inherit' ? 'secondary' : color == 'secondary' ? 'danger' : color) || 'secondary'} ${className || ''} ${size == 'small' ? 'btn-sm' : ''}`,
|
|
163
174
|
disabled,
|
|
164
|
-
$on:{click:onClick}
|
|
175
|
+
$on: { click: onClick }
|
|
165
176
|
}, children);
|
|
166
177
|
|
|
167
178
|
|
|
168
|
-
const TextField = (props:{
|
|
169
|
-
id:string,
|
|
170
|
-
disabled?:boolean,
|
|
171
|
-
className?:string,
|
|
172
|
-
autoFocus?:boolean,
|
|
173
|
-
fullWidth:boolean
|
|
174
|
-
inputProps?:any,
|
|
175
|
-
value?:any,
|
|
176
|
-
type:any,
|
|
177
|
-
label?:string,
|
|
178
|
-
error?:boolean,
|
|
179
|
-
helperText?:string,
|
|
180
|
-
multiline?:boolean,
|
|
181
|
-
onChange?:(event:any)=>void,
|
|
182
|
-
onFocus?:(event:any)=>void,
|
|
183
|
-
onBlur?:(event:any, valor:any)=>void,
|
|
179
|
+
const TextField = (props: {
|
|
180
|
+
id: string,
|
|
181
|
+
disabled?: boolean,
|
|
182
|
+
className?: string,
|
|
183
|
+
autoFocus?: boolean,
|
|
184
|
+
fullWidth: boolean
|
|
185
|
+
inputProps?: any,
|
|
186
|
+
value?: any,
|
|
187
|
+
type: any,
|
|
188
|
+
label?: string,
|
|
189
|
+
error?: boolean,
|
|
190
|
+
helperText?: string,
|
|
191
|
+
multiline?: boolean,
|
|
192
|
+
onChange?: (event: any) => void,
|
|
193
|
+
onFocus?: (event: any) => void,
|
|
194
|
+
onBlur?: (event: any, valor: any) => void,
|
|
184
195
|
// onKeyDown?:(event:KeyboardEvent)=>void // KeyboardEventHandler<HTMLInputElement>
|
|
185
|
-
onKeyDown?:React.KeyboardEventHandler<HTMLInputElement>
|
|
186
|
-
})
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
/>;
|
|
199
|
-
|
|
200
|
-
const Typography = ({children, ...others}:{
|
|
201
|
-
children:any,
|
|
202
|
-
component?:string
|
|
203
|
-
variant?:'h6'
|
|
204
|
-
}&CommonAttributes)=>React.createElement(others.variant||others.component||'div',others,children);
|
|
205
|
-
|
|
206
|
-
function Grid(props:{
|
|
207
|
-
container?:boolean,
|
|
208
|
-
spacing?:number,
|
|
209
|
-
item?:boolean,
|
|
210
|
-
wrap?:'wrap'|'nowrap',
|
|
211
|
-
direction?:'row'|'column'
|
|
212
|
-
alignItems?:'stretch' | 'flex-start' | 'flex-end' | 'center' | 'baseline',
|
|
213
|
-
children:any,
|
|
214
|
-
xs?:number,
|
|
215
|
-
sm?:number,
|
|
216
|
-
}&CommonAttributes){
|
|
217
|
-
var {container, item, wrap, direction, alignItems, children, className, xs, sm, spacing, ...other} = props;
|
|
196
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>
|
|
197
|
+
}) => <input
|
|
198
|
+
id={props.id}
|
|
199
|
+
disabled={props.disabled}
|
|
200
|
+
className={props.className}
|
|
201
|
+
autoFocus={props.autoFocus}
|
|
202
|
+
value={props.value}
|
|
203
|
+
type={props.type}
|
|
204
|
+
onChange={props.onChange}
|
|
205
|
+
onFocus={props.onFocus}
|
|
206
|
+
onBlur={(evt) => props.onBlur?.(evt, evt.target.value)}
|
|
207
|
+
onKeyDown={props.onKeyDown}
|
|
208
|
+
placeholder={props.label}
|
|
209
|
+
/>;
|
|
210
|
+
|
|
211
|
+
const Typography = ({ children, ...others }: {
|
|
212
|
+
children: any,
|
|
213
|
+
component?: string
|
|
214
|
+
variant?: 'h6'
|
|
215
|
+
} & CommonAttributes) => React.createElement(others.variant || others.component || 'div', others, children);
|
|
216
|
+
|
|
217
|
+
function Grid(props: {
|
|
218
|
+
container?: boolean,
|
|
219
|
+
spacing?: number,
|
|
220
|
+
item?: boolean,
|
|
221
|
+
wrap?: 'wrap' | 'nowrap',
|
|
222
|
+
direction?: 'row' | 'column'
|
|
223
|
+
alignItems?: 'stretch' | 'flex-start' | 'flex-end' | 'center' | 'baseline',
|
|
224
|
+
children: any,
|
|
225
|
+
xs?: number,
|
|
226
|
+
sm?: number,
|
|
227
|
+
} & CommonAttributes) {
|
|
228
|
+
var { container, item, wrap, direction, alignItems, children, className, xs, sm, spacing, ...other } = props;
|
|
218
229
|
return <div
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
>{children}</div>
|
|
230
|
+
{...other}
|
|
231
|
+
className={`${className || ''} ${xs != null ? 'grid-xs-' + xs : ''} ${sm != null ? 'grid-sm-' + sm : ''}`}
|
|
232
|
+
style={container ? {
|
|
233
|
+
display: 'flex',
|
|
234
|
+
flexWrap: wrap,
|
|
235
|
+
flexDirection: direction,
|
|
236
|
+
alignItems: alignItems,
|
|
237
|
+
margin: spacing != null ? spacing * 8 + 'px' : undefined
|
|
238
|
+
} : {
|
|
239
|
+
}}
|
|
240
|
+
>{children}</div>
|
|
230
241
|
}
|
|
231
242
|
|
|
232
243
|
var p12 = 'p12' as IdVariable;
|
|
@@ -243,29 +254,29 @@ function isIn<V, T>(k:keyof T, object:T): object[k] is V{
|
|
|
243
254
|
return true
|
|
244
255
|
}
|
|
245
256
|
*/
|
|
246
|
-
function takeElementOrDefault<V,K extends string,KO extends string>(k:K, object:{[k in KO]:V}, defaultValue:V):V{
|
|
247
|
-
return k in object ?
|
|
257
|
+
function takeElementOrDefault<V, K extends string, KO extends string>(k: K, object: { [k in KO]: V }, defaultValue: V): V {
|
|
258
|
+
return k in object ?
|
|
248
259
|
// @ts-expect-error por alguna razón TS no quiere entender que si k está en object, object[k] existe
|
|
249
|
-
object[k]
|
|
250
|
-
|
|
260
|
+
object[k]
|
|
261
|
+
: defaultValue
|
|
251
262
|
}
|
|
252
263
|
|
|
253
|
-
function DespliegueEncabezado(props:{casillero:CasilleroEncabezable, leer?:boolean}){
|
|
254
|
-
const forPkNull={} as ForPk;
|
|
255
|
-
return <EncabezadoDespliegue casillero={props.casillero} leer={props.leer} forPk={forPkNull}/>;
|
|
264
|
+
function DespliegueEncabezado(props: { casillero: CasilleroEncabezable, leer?: boolean }) {
|
|
265
|
+
const forPkNull = {} as ForPk;
|
|
266
|
+
return <EncabezadoDespliegue casillero={props.casillero} leer={props.leer} forPk={forPkNull} />;
|
|
256
267
|
}
|
|
257
268
|
|
|
258
|
-
function subirHasta(elemento:HTMLElement|null, fun:(elemento:HTMLElement)=>boolean):HTMLElement|null{
|
|
259
|
-
if(elemento == null) return null;
|
|
260
|
-
if(fun(elemento)) return elemento;
|
|
269
|
+
function subirHasta(elemento: HTMLElement | null, fun: (elemento: HTMLElement) => boolean): HTMLElement | null {
|
|
270
|
+
if (elemento == null) return null;
|
|
271
|
+
if (fun(elemento)) return elemento;
|
|
261
272
|
return subirHasta(elemento.parentElement, fun);
|
|
262
273
|
}
|
|
263
274
|
|
|
264
|
-
var elementoConSennialBorrar:HTMLElement|null = null;
|
|
275
|
+
var elementoConSennialBorrar: HTMLElement | null = null;
|
|
265
276
|
|
|
266
|
-
function BotonBorrar({id, variable, forPk, valorOpcion}:{id:string, variable:IdVariable, forPk:ForPk, valorOpcion?:any}){
|
|
267
|
-
var handleClickBorrar=()=>{
|
|
268
|
-
dispatchByPass(accion_registrar_respuesta, {respuesta:null, variable:variable, forPk:forPk})
|
|
277
|
+
function BotonBorrar({ id, variable, forPk, valorOpcion }: { id: string, variable: IdVariable, forPk: ForPk, valorOpcion?: any }) {
|
|
278
|
+
var handleClickBorrar = () => {
|
|
279
|
+
dispatchByPass(accion_registrar_respuesta, { respuesta: null, variable: variable, forPk: forPk })
|
|
269
280
|
};
|
|
270
281
|
return <div className="boton-borrar">
|
|
271
282
|
<Button
|
|
@@ -276,61 +287,61 @@ function BotonBorrar({id, variable, forPk, valorOpcion}:{id:string, variable:IdV
|
|
|
276
287
|
className="boton-opcion boton-opcion-borrar"
|
|
277
288
|
onClick={handleClickBorrar}
|
|
278
289
|
>
|
|
279
|
-
<ICON.DeleteForever/>
|
|
290
|
+
<ICON.DeleteForever />
|
|
280
291
|
</Button>
|
|
281
292
|
</div>
|
|
282
293
|
}
|
|
283
294
|
|
|
284
|
-
function SaltoDespliegue({casillero,prefijo}:{casillero:Pregunta|Opcion|Filtro, prefijo?:string}){
|
|
285
|
-
return casillero.salto?
|
|
295
|
+
function SaltoDespliegue({ casillero, prefijo }: { casillero: Pregunta | Opcion | Filtro, prefijo?: string }) {
|
|
296
|
+
return casillero.salto ?
|
|
286
297
|
<div className="pase">
|
|
287
|
-
{prefijo
|
|
298
|
+
{prefijo ? <span className="prefijo">{prefijo} </span> : null}
|
|
288
299
|
<ICON.TrendingFlat /><span>{casillero.salto}</span>
|
|
289
300
|
</div>
|
|
290
|
-
|
|
301
|
+
: null
|
|
291
302
|
}
|
|
292
303
|
|
|
293
|
-
function OpcionDespliegue(props:{casillero:Opcion, valorOpcion:number, variable:IdVariable, forPk:ForPk, leer:boolean, conBotonBorrar:boolean}){
|
|
294
|
-
const {casillero} = props;
|
|
304
|
+
function OpcionDespliegue(props: { casillero: Opcion, valorOpcion: number, variable: IdVariable, forPk: ForPk, leer: boolean, conBotonBorrar: boolean }) {
|
|
305
|
+
const { casillero } = props;
|
|
295
306
|
const dispatch = useDispatch();
|
|
296
|
-
var saltoAutomatico = useSelector((state:CasoState)=>state.opciones.saltoAutomatico);
|
|
297
|
-
var handleClick:React.MouseEventHandler<HTMLButtonElement> = async (event)=>{
|
|
298
|
-
var container = subirHasta(event.target as HTMLElement, elemento=>elemento.classList.contains('pregunta') || elemento.classList.contains('multiple')) || document.getElementById('main_layout')!;
|
|
307
|
+
var saltoAutomatico = useSelector((state: CasoState) => state.opciones.saltoAutomatico);
|
|
308
|
+
var handleClick: React.MouseEventHandler<HTMLButtonElement> = async (event) => {
|
|
309
|
+
var container = subirHasta(event.target as HTMLElement, elemento => elemento.classList.contains('pregunta') || elemento.classList.contains('multiple')) || document.getElementById('main_layout')!;
|
|
299
310
|
var tiene = container.getAttribute('estoy-borrando');
|
|
300
|
-
container.setAttribute('estoy-borrando','NO');
|
|
301
|
-
if(elementoConSennialBorrar){
|
|
302
|
-
elementoConSennialBorrar.setAttribute('estoy-borrando','NO');
|
|
311
|
+
container.setAttribute('estoy-borrando', 'NO');
|
|
312
|
+
if (elementoConSennialBorrar) {
|
|
313
|
+
elementoConSennialBorrar.setAttribute('estoy-borrando', 'NO');
|
|
303
314
|
elementoConSennialBorrar = null;
|
|
304
315
|
}
|
|
305
|
-
var {recentModified, siguienteVariable} = dispatchByPass(accion_registrar_respuesta, {respuesta:props.valorOpcion, variable:props.variable, forPk:props.forPk});
|
|
306
|
-
if(!recentModified){
|
|
307
|
-
container.setAttribute('estoy-borrando',tiene=='SI'?'NO':'SI');
|
|
308
|
-
if(tiene!='SI'){
|
|
309
|
-
elementoConSennialBorrar=container;
|
|
316
|
+
var { recentModified, siguienteVariable } = dispatchByPass(accion_registrar_respuesta, { respuesta: props.valorOpcion, variable: props.variable, forPk: props.forPk });
|
|
317
|
+
if (!recentModified) {
|
|
318
|
+
container.setAttribute('estoy-borrando', tiene == 'SI' ? 'NO' : 'SI');
|
|
319
|
+
if (tiene != 'SI') {
|
|
320
|
+
elementoConSennialBorrar = container;
|
|
310
321
|
}
|
|
311
|
-
}else{
|
|
312
|
-
if(siguienteVariable && saltoAutomatico){
|
|
322
|
+
} else {
|
|
323
|
+
if (siguienteVariable && saltoAutomatico) {
|
|
313
324
|
var botonStyle = (event.target as HTMLElement)?.style;
|
|
314
|
-
if(botonStyle) botonStyle.color = 'green';
|
|
325
|
+
if (botonStyle) botonStyle.color = 'green';
|
|
315
326
|
await sleep(DELAY_SCROLL_3);
|
|
316
|
-
if(botonStyle) botonStyle.color = 'blue';
|
|
327
|
+
if (botonStyle) botonStyle.color = 'blue';
|
|
317
328
|
await sleep(DELAY_SCROLL_3);
|
|
318
|
-
if(botonStyle) botonStyle.color = 'green';
|
|
329
|
+
if (botonStyle) botonStyle.color = 'green';
|
|
319
330
|
await sleep(DELAY_SCROLL_3);
|
|
320
|
-
if(botonStyle) botonStyle.color = '';
|
|
331
|
+
if (botonStyle) botonStyle.color = '';
|
|
321
332
|
//@ts-ignore algunos casilleros tienen especial y otros no
|
|
322
|
-
(casillero.especial?.noScroll == true)?null:enfocarElementoDeVariable(casillero.especial?.scrollTo ?? siguienteVariable);
|
|
333
|
+
(casillero.especial?.noScroll == true) ? null : enfocarElementoDeVariable(casillero.especial?.scrollTo ?? siguienteVariable);
|
|
323
334
|
}
|
|
324
335
|
}
|
|
325
336
|
};
|
|
326
|
-
return <Grid className="opcion">
|
|
327
|
-
{props.conBotonBorrar
|
|
337
|
+
return <Grid className="opcion">
|
|
338
|
+
{props.conBotonBorrar ? <BotonBorrar
|
|
328
339
|
id={`opcion-var-${props.variable}-${props.valorOpcion}-borrar`}
|
|
329
340
|
forPk={props.forPk}
|
|
330
341
|
variable={props.variable}
|
|
331
342
|
valorOpcion={props.valorOpcion}
|
|
332
|
-
|
|
333
|
-
<Button
|
|
343
|
+
/> : null}
|
|
344
|
+
<Button
|
|
334
345
|
id={`opcion-var-${props.variable}-${props.valorOpcion}`}
|
|
335
346
|
mi-variable={props.variable}
|
|
336
347
|
valor-opcion={props.valorOpcion}
|
|
@@ -344,201 +355,201 @@ function OpcionDespliegue(props:{casillero:Opcion, valorOpcion:number, variable:
|
|
|
344
355
|
{casillero.ver_id || casillero.casillero}
|
|
345
356
|
</Grid>
|
|
346
357
|
<Grid className="opcion-texto">
|
|
347
|
-
<Typography debe-leer={casillero.leer?'SI':casillero.leer===false?'NO':props.leer?'SI':'NO'}>{breakeableText(casillero.nombre)}</Typography>
|
|
348
|
-
{casillero.aclaracion?
|
|
358
|
+
<Typography debe-leer={casillero.leer ? 'SI' : casillero.leer === false ? 'NO' : props.leer ? 'SI' : 'NO'}>{breakeableText(casillero.nombre)}</Typography>
|
|
359
|
+
{casillero.aclaracion ?
|
|
349
360
|
<Typography className='aclaracion'>{breakeableText(casillero.aclaracion)}</Typography>
|
|
350
|
-
|
|
361
|
+
: null}
|
|
351
362
|
</Grid>
|
|
352
363
|
</Grid>
|
|
353
364
|
</Button>
|
|
354
|
-
<SaltoDespliegue casillero={casillero}/>
|
|
365
|
+
<SaltoDespliegue casillero={casillero} />
|
|
355
366
|
</Grid>
|
|
356
367
|
}
|
|
357
|
-
interface IcasilleroConOpciones{
|
|
358
|
-
var_name:IdVariable,
|
|
359
|
-
despliegueContenido:'vertical'|'horizontal'|null,
|
|
360
|
-
casilleros:Opcion[]
|
|
368
|
+
interface IcasilleroConOpciones {
|
|
369
|
+
var_name: IdVariable,
|
|
370
|
+
despliegueContenido: 'vertical' | 'horizontal' | null,
|
|
371
|
+
casilleros: Opcion[]
|
|
361
372
|
}
|
|
362
373
|
|
|
363
374
|
|
|
364
|
-
function SiNoDespliegue(props:{casilleroConOpciones:IcasilleroConOpciones, forPk:ForPk, despliegueContenido:'vertical'|'horizontal'}){
|
|
365
|
-
return <OpcionesDespliegue
|
|
366
|
-
casilleroConOpciones={props.casilleroConOpciones}
|
|
367
|
-
forPk={props.forPk}
|
|
375
|
+
function SiNoDespliegue(props: { casilleroConOpciones: IcasilleroConOpciones, forPk: ForPk, despliegueContenido: 'vertical' | 'horizontal' }) {
|
|
376
|
+
return <OpcionesDespliegue
|
|
377
|
+
casilleroConOpciones={props.casilleroConOpciones}
|
|
378
|
+
forPk={props.forPk}
|
|
368
379
|
leer={false}
|
|
369
380
|
despliegueContenido={props.despliegueContenido}
|
|
370
381
|
/>
|
|
371
382
|
}
|
|
372
383
|
|
|
373
|
-
function registradorDeVariable(pregunta:Pregunta|OpcionMultiple|ConjuntoPreguntas){
|
|
384
|
+
function registradorDeVariable(pregunta: Pregunta | OpcionMultiple | ConjuntoPreguntas) {
|
|
374
385
|
return (
|
|
375
|
-
respuestas:Respuestas, feedbackForm: FormStructureState<IdVariable, Valor, IdFin>, elemento:HTMLDivElement
|
|
376
|
-
)=>{
|
|
386
|
+
respuestas: Respuestas, feedbackForm: FormStructureState<IdVariable, Valor, IdFin>, elemento: HTMLDivElement
|
|
387
|
+
) => {
|
|
377
388
|
var valorActual = pregunta.var_name == null ? null : respuestas[pregunta.var_name];
|
|
378
389
|
var feedbackRow = feedbackForm.feedback;
|
|
379
390
|
var feedbackVar = pregunta.var_name == null ? null : feedbackRow[pregunta.var_name];
|
|
380
|
-
var tieneValor=valorActual!=null && feedbackVar!=null?(feedbackVar.conProblema?'invalido':'valido'):'NO';
|
|
381
|
-
var estado:EstadoVariable;
|
|
382
|
-
if(pregunta.tipovar){
|
|
383
|
-
estado=feedbackVar?.estado!;
|
|
384
|
-
}else{
|
|
385
|
-
var feedbackMulti = pregunta.casilleros.filter(c=>c.var_name!=null).reduce((pv, om)=>{
|
|
386
|
-
var fb=feedbackRow?.[om.var_name!]!
|
|
391
|
+
var tieneValor = valorActual != null && feedbackVar != null ? (feedbackVar.conProblema ? 'invalido' : 'valido') : 'NO';
|
|
392
|
+
var estado: EstadoVariable;
|
|
393
|
+
if (pregunta.tipovar) {
|
|
394
|
+
estado = feedbackVar?.estado!;
|
|
395
|
+
} else {
|
|
396
|
+
var feedbackMulti = pregunta.casilleros.filter(c => c.var_name != null).reduce((pv, om) => {
|
|
397
|
+
var fb = feedbackRow?.[om.var_name!]!
|
|
387
398
|
return {
|
|
388
|
-
tieneActual: pv.tieneActual || fb.estado=='actual',
|
|
389
|
-
estaSalteada: pv.estaSalteada && (fb.estado=='salteada' || fb.estado=='fuera_de_flujo_por_salto')
|
|
399
|
+
tieneActual: pv.tieneActual || fb.estado == 'actual',
|
|
400
|
+
estaSalteada: pv.estaSalteada && (fb.estado == 'salteada' || fb.estado == 'fuera_de_flujo_por_salto')
|
|
390
401
|
}
|
|
391
|
-
}, {tieneActual:false, estaSalteada:true});
|
|
392
|
-
estado=feedbackMulti.tieneActual?'actual':feedbackMulti.estaSalteada?'salteada':'todavia_no'
|
|
402
|
+
}, { tieneActual: false, estaSalteada: true });
|
|
403
|
+
estado = feedbackMulti.tieneActual ? 'actual' : feedbackMulti.estaSalteada ? 'salteada' : 'todavia_no'
|
|
393
404
|
}
|
|
394
405
|
setAttrDistinto(elemento, 'nuestro-validator', estado);
|
|
395
406
|
setAttrDistinto(elemento, 'tiene-valor', tieneValor);
|
|
396
|
-
setAttrDistinto(elemento, 'esta-inhabilitada', feedbackVar?.inhabilitada?'SI':'NO');
|
|
397
|
-
if(pregunta.var_name){
|
|
398
|
-
var opciones:HTMLButtonElement[] = Array.prototype.slice.call(elemento.querySelectorAll(`.boton-opcion[mi-variable="${pregunta.var_name}"]`),0);
|
|
399
|
-
var elementoOpcion:HTMLButtonElement;
|
|
400
|
-
for(elementoOpcion of opciones){
|
|
407
|
+
setAttrDistinto(elemento, 'esta-inhabilitada', feedbackVar?.inhabilitada ? 'SI' : 'NO');
|
|
408
|
+
if (pregunta.var_name) {
|
|
409
|
+
var opciones: HTMLButtonElement[] = Array.prototype.slice.call(elemento.querySelectorAll(`.boton-opcion[mi-variable="${pregunta.var_name}"]`), 0);
|
|
410
|
+
var elementoOpcion: HTMLButtonElement;
|
|
411
|
+
for (elementoOpcion of opciones) {
|
|
401
412
|
var valorOpcion = elementoOpcion.getAttribute('valor-opcion');
|
|
402
|
-
setAttrDistinto(elementoOpcion, 'opcion-seleccionada', valorOpcion == valorActual ? "SI": "NO")
|
|
413
|
+
setAttrDistinto(elementoOpcion, 'opcion-seleccionada', valorOpcion == valorActual ? "SI" : "NO")
|
|
403
414
|
}
|
|
404
|
-
var elementosInput:HTMLInputElement[] = Array.prototype.slice.call(elemento.querySelectorAll('.variable'));
|
|
405
|
-
var elementoInput:HTMLInputElement;
|
|
406
|
-
for(elementoInput of elementosInput){
|
|
415
|
+
var elementosInput: HTMLInputElement[] = Array.prototype.slice.call(elemento.querySelectorAll('.variable'));
|
|
416
|
+
var elementoInput: HTMLInputElement;
|
|
417
|
+
for (elementoInput of elementosInput) {
|
|
407
418
|
setValorDistinto(elementoInput, 'value', valorActual == null ? '' : valorActual.toString());
|
|
408
419
|
}
|
|
409
|
-
var botonNsNc = document.getElementById("nsnc-pregunta-"+pregunta.var_name)!;
|
|
420
|
+
var botonNsNc = document.getElementById("nsnc-pregunta-" + pregunta.var_name)!;
|
|
410
421
|
setAttrDistinto(botonNsNc, 'opcion-seleccionada', valorActual == (pregunta.valor_ns_nc ?? -9) ? "SI" : "NO")
|
|
411
422
|
}
|
|
412
423
|
}
|
|
413
424
|
}
|
|
414
425
|
|
|
415
|
-
function OpcionMultipleDespliegue(props:{opcionM:OpcionMultiple, forPk:ForPk}){
|
|
416
|
-
const {opcionM} = props;
|
|
426
|
+
function OpcionMultipleDespliegue(props: { opcionM: OpcionMultiple, forPk: ForPk }) {
|
|
427
|
+
const { opcionM } = props;
|
|
417
428
|
var id = `opcionM-${opcionM.id_casillero}`;
|
|
418
429
|
//@ts-ignore altunos casilleros no tienen especial, no importa, es solo para poner los metadatos
|
|
419
|
-
var styles: React.CSSProperties = opcionM.especial?.flexDirection?{flexDirection:opcionM.especial.flexDirection}:{flexWrap:'wrap'};
|
|
430
|
+
var styles: React.CSSProperties = opcionM.especial?.flexDirection ? { flexDirection: opcionM.especial.flexDirection } : { flexWrap: 'wrap' };
|
|
420
431
|
registrarElemento({
|
|
421
|
-
id,
|
|
422
|
-
direct:true,
|
|
432
|
+
id,
|
|
433
|
+
direct: true,
|
|
423
434
|
fun: registradorDeVariable(opcionM)
|
|
424
435
|
})
|
|
425
|
-
const updateWindowWidth = function(){
|
|
436
|
+
const updateWindowWidth = function () {
|
|
426
437
|
setWindowWidth(window.innerWidth);
|
|
427
438
|
}
|
|
428
|
-
|
|
439
|
+
|
|
429
440
|
const [windowWidth, setWindowWidth] = useState();
|
|
430
|
-
window.addEventListener('resize',
|
|
431
|
-
return <DesplegarCasillero
|
|
441
|
+
window.addEventListener('resize', updateWindowWidth);
|
|
442
|
+
return <DesplegarCasillero
|
|
432
443
|
id={id}
|
|
433
444
|
casillero={opcionM}
|
|
434
445
|
despliegueEncabezado='lateral'
|
|
435
446
|
style={styles}
|
|
436
447
|
>
|
|
437
|
-
<EncabezadoDespliegue
|
|
438
|
-
casillero={opcionM}
|
|
439
|
-
verIdGuion={true}
|
|
440
|
-
leer={opcionM.leer!==false}
|
|
448
|
+
<EncabezadoDespliegue
|
|
449
|
+
casillero={opcionM}
|
|
450
|
+
verIdGuion={true}
|
|
451
|
+
leer={opcionM.leer !== false}
|
|
441
452
|
forPk={props.forPk}
|
|
442
|
-
style={{maxWidth:windowWidth-400}} //TODO MEJORAR
|
|
453
|
+
style={{ maxWidth: windowWidth - 400 }} //TODO MEJORAR
|
|
443
454
|
/>
|
|
444
|
-
<SiNoDespliegue
|
|
445
|
-
casilleroConOpciones={opcionM}
|
|
455
|
+
<SiNoDespliegue
|
|
456
|
+
casilleroConOpciones={opcionM}
|
|
446
457
|
forPk={props.forPk}
|
|
447
|
-
despliegueContenido={props.opcionM.despliegueContenido??'horizontal'}
|
|
458
|
+
despliegueContenido={props.opcionM.despliegueContenido ?? 'horizontal'}
|
|
448
459
|
/>
|
|
449
460
|
</DesplegarCasillero>
|
|
450
461
|
}
|
|
451
462
|
|
|
452
|
-
type CasilleroEncabezable = Formulario|Bloque|Filtro|ConjuntoPreguntas|Pregunta|OpcionMultiple|PreguntaSimple|Consistencia|Texto|PMatriz
|
|
463
|
+
type CasilleroEncabezable = Formulario | Bloque | Filtro | ConjuntoPreguntas | Pregunta | OpcionMultiple | PreguntaSimple | Consistencia | Texto | PMatriz
|
|
453
464
|
|
|
454
465
|
const getLosMetadatos = (casillero: CasilleroEncabezable): React.JSX.Element =>
|
|
455
466
|
<div los-metadatos="si">
|
|
456
467
|
<span el-metadato="variable">{casillero.var_name}</span>
|
|
457
|
-
{casillero.tipovar && casillero.tipovar!='opciones' && casillero.tipovar!='si_no'?
|
|
468
|
+
{casillero.tipovar && casillero.tipovar != 'opciones' && casillero.tipovar != 'si_no' ?
|
|
458
469
|
<span el-metadato="tipovar">{casillero.tipovar}</span>
|
|
459
|
-
|
|
470
|
+
: null}
|
|
460
471
|
{ //@ts-ignore una opción múltiple nunca lo a a ser, no tiene el campo, no importa
|
|
461
|
-
casillero.optativo
|
|
472
|
+
casillero.optativo ? <span el-metadato="optativa">optativa</span> : null
|
|
462
473
|
}
|
|
463
|
-
{casillero.calculada
|
|
464
|
-
{casillero.despliegueOculta
|
|
465
|
-
{casillero.expresion_habilitar
|
|
474
|
+
{casillero.calculada ? <span el-metadato="calculada">calculada</span> : null}
|
|
475
|
+
{casillero.despliegueOculta ? <span el-metadato="oculta">oculta</span> : null}
|
|
476
|
+
{casillero.expresion_habilitar ? <span el-metadato="expresion_habilitar">habilita: {casillero.expresion_habilitar}</span> : null}
|
|
466
477
|
{ //@ts-ignore altunos casilleros no tienen especial, no importa, es solo para poner los metadatos
|
|
467
|
-
casillero.especial?.autoing
|
|
478
|
+
casillero.especial?.autoing ? <span el-metadato="expresion_autoing">autoing: {casillero.especial?.autoing}</span> : null
|
|
468
479
|
}
|
|
469
480
|
</div>
|
|
470
481
|
|
|
471
|
-
function EncabezadoDespliegue(props:{
|
|
472
|
-
style?:React.CSSProperties,
|
|
473
|
-
casillero:CasilleroEncabezable,
|
|
474
|
-
verIdGuion?:boolean,
|
|
475
|
-
leer?:boolean,
|
|
476
|
-
forPk:ForPk
|
|
477
|
-
}){
|
|
478
|
-
var {casillero, forPk} = props;
|
|
479
|
-
var conCampoOpciones = useSelector((state:CasoState)=>state.opciones.conCampoOpciones)
|
|
480
|
-
var handleClickBorrar=()=>{
|
|
481
|
-
dispatchByPass(accion_registrar_respuesta, {respuesta:null, variable:casillero.var_name as IdVariable, forPk:forPk})
|
|
482
|
+
function EncabezadoDespliegue(props: {
|
|
483
|
+
style?: React.CSSProperties,
|
|
484
|
+
casillero: CasilleroEncabezable,
|
|
485
|
+
verIdGuion?: boolean,
|
|
486
|
+
leer?: boolean,
|
|
487
|
+
forPk: ForPk
|
|
488
|
+
}) {
|
|
489
|
+
var { casillero, forPk } = props;
|
|
490
|
+
var conCampoOpciones = useSelector((state: CasoState) => state.opciones.conCampoOpciones)
|
|
491
|
+
var handleClickBorrar = () => {
|
|
492
|
+
dispatchByPass(accion_registrar_respuesta, { respuesta: null, variable: casillero.var_name as IdVariable, forPk: forPk })
|
|
482
493
|
};
|
|
483
494
|
var ver_id = casillero.ver_id ?? casillero.casillero;
|
|
484
495
|
// @ts-ignore no está en todos los casilleros pero acá para el despliegue de metadatos no importa
|
|
485
496
|
var calculada = casillero.calculada;
|
|
486
|
-
var id = `id-div-${casillero.var_name||casillero.casillero}`;
|
|
487
|
-
var idAcciones = "acciones-"+id;
|
|
488
|
-
return <div
|
|
489
|
-
className="encabezado"
|
|
490
|
-
debe-leer={props.leer?'SI':'NO'}
|
|
497
|
+
var id = `id-div-${casillero.var_name || casillero.casillero}`;
|
|
498
|
+
var idAcciones = "acciones-" + id;
|
|
499
|
+
return <div
|
|
500
|
+
className="encabezado"
|
|
501
|
+
debe-leer={props.leer ? 'SI' : 'NO'}
|
|
491
502
|
style={props.style}
|
|
492
503
|
>
|
|
493
504
|
<div id={id} className="id-div" title={`${casillero.casillero} - ${casillero.var_name}`}
|
|
494
|
-
onClick={()=>{
|
|
505
|
+
onClick={() => {
|
|
495
506
|
var div = document.getElementById(idAcciones);
|
|
496
|
-
div!.setAttribute("accion-visible", (1-Number(div!.getAttribute("accion-visible"))).toString());
|
|
507
|
+
div!.setAttribute("accion-visible", (1 - Number(div!.getAttribute("accion-visible"))).toString());
|
|
497
508
|
// TODO. Ver qué hacemos cuando se toca el ID de la pregutna
|
|
498
|
-
dispatchByPass(accion_id_pregunta, {pregunta: casillero.casillero as IdPregunta, forPk});
|
|
509
|
+
dispatchByPass(accion_id_pregunta, { pregunta: casillero.casillero as IdPregunta, forPk });
|
|
499
510
|
}}
|
|
500
511
|
>
|
|
501
512
|
<div className="id">
|
|
502
513
|
{ver_id}
|
|
503
514
|
</div>
|
|
504
|
-
{(casillero.tipovar=="si_no"||casillero.tipovar=="opciones")
|
|
515
|
+
{(casillero.tipovar == "si_no" || casillero.tipovar == "opciones") ? <Campo disabled={false} pregunta={casillero} forPk={forPk} mini={true} hidden={!conCampoOpciones && 'quitar'} /> : null}
|
|
505
516
|
<div className="acciones-pregunta" id={idAcciones} accion-visible="0">
|
|
506
|
-
{casillero.var_name
|
|
507
|
-
id={"borrar-pregunta-"+casillero.var_name}
|
|
517
|
+
{casillero.var_name ? <div><Button
|
|
518
|
+
id={"borrar-pregunta-" + casillero.var_name}
|
|
508
519
|
mi-variable={casillero.var_name}
|
|
509
520
|
variant="outlined"
|
|
510
521
|
className="boton-pregunta-borrar"
|
|
511
522
|
onClick={handleClickBorrar}
|
|
512
523
|
>
|
|
513
|
-
<ICON.DeleteForever/>
|
|
514
|
-
</Button></div
|
|
515
|
-
{casillero.var_name?(ns_nc
|
|
516
|
-
id={"nsnc-pregunta-"+casillero.var_name}
|
|
524
|
+
<ICON.DeleteForever />
|
|
525
|
+
</Button></div> : null}
|
|
526
|
+
{casillero.var_name ? (ns_nc => <div><Button
|
|
527
|
+
id={"nsnc-pregunta-" + casillero.var_name}
|
|
517
528
|
mi-variable={casillero.var_name}
|
|
518
529
|
variant="outlined"
|
|
519
530
|
className="boton-pregunta-nsnc"
|
|
520
|
-
onClick={()=>{
|
|
521
|
-
dispatchByPass(accion_registrar_respuesta, {respuesta:ns_nc, variable:casillero.var_name as IdVariable, forPk:forPk})
|
|
531
|
+
onClick={() => {
|
|
532
|
+
dispatchByPass(accion_registrar_respuesta, { respuesta: ns_nc, variable: casillero.var_name as IdVariable, forPk: forPk })
|
|
522
533
|
}}
|
|
523
534
|
>
|
|
524
535
|
NS/NC
|
|
525
|
-
</Button></div>)(casillero.valor_ns_nc
|
|
536
|
+
</Button></div>)(casillero.valor_ns_nc ?? -9) : null}
|
|
526
537
|
</div>
|
|
527
538
|
</div>
|
|
528
539
|
<div className="nombre-div">
|
|
529
540
|
<div className="nombre">{breakeableText(casillero.nombre)}
|
|
530
|
-
{casillero.especial?.gps?
|
|
541
|
+
{casillero.especial?.gps ?
|
|
531
542
|
<span>
|
|
532
|
-
<Button color="primary" variant="outlined" style={{marginLeft:'10px'}} onClick={(_event)=>{
|
|
533
|
-
const {respuestas} = respuestasForPk(forPk);
|
|
534
|
-
const agregarInfoGPS = (respuestaGPS:Valor, info:string)=>{
|
|
543
|
+
<Button color="primary" variant="outlined" style={{ marginLeft: '10px' }} onClick={(_event) => {
|
|
544
|
+
const { respuestas } = respuestasForPk(forPk);
|
|
545
|
+
const agregarInfoGPS = (respuestaGPS: Valor, info: string) => {
|
|
535
546
|
let aux = JSON.parse(respuestaGPS || JSON.stringify([]));
|
|
536
547
|
aux.unshift(info);
|
|
537
548
|
respuestaGPS = JSON.stringify(aux);
|
|
538
|
-
return dispatchByPass(accion_registrar_respuesta, {forPk:props.forPk, variable:casillero.var_name, respuesta:respuestaGPS});
|
|
549
|
+
return dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: casillero.var_name, respuesta: respuestaGPS });
|
|
539
550
|
}
|
|
540
|
-
let {siguienteVariable} = agregarInfoGPS(respuestas[casillero.var_name!], `${datetime.now().toYmdHms()} - esperando punto gps`);
|
|
541
|
-
if(siguienteVariable){
|
|
551
|
+
let { siguienteVariable } = agregarInfoGPS(respuestas[casillero.var_name!], `${datetime.now().toYmdHms()} - esperando punto gps`);
|
|
552
|
+
if (siguienteVariable) {
|
|
542
553
|
enfocarElementoDeVariable(siguienteVariable);
|
|
543
554
|
}
|
|
544
555
|
navigator.geolocation.getCurrentPosition(position => {
|
|
@@ -546,74 +557,74 @@ function EncabezadoDespliegue(props:{
|
|
|
546
557
|
}, e => {
|
|
547
558
|
agregarInfoGPS(respuestas[casillero.var_name!], e.message);
|
|
548
559
|
});
|
|
549
|
-
}}><ICON.Location/></Button>
|
|
560
|
+
}}><ICON.Location /></Button>
|
|
550
561
|
</span>
|
|
551
|
-
|
|
562
|
+
: null}
|
|
552
563
|
</div>
|
|
553
|
-
{casillero.aclaracion?
|
|
564
|
+
{casillero.aclaracion ?
|
|
554
565
|
<div className="aclaracion">
|
|
555
|
-
{casillero.salto && casillero.tipoc=='FILTRO'?
|
|
556
|
-
<SaltoDespliegue casillero={casillero} prefijo={breakeableText(casillero.aclaracion)}/>
|
|
557
|
-
|
|
566
|
+
{casillero.salto && casillero.tipoc == 'FILTRO' ?
|
|
567
|
+
<SaltoDespliegue casillero={casillero} prefijo={breakeableText(casillero.aclaracion)} />
|
|
568
|
+
:
|
|
558
569
|
breakeableText(casillero.aclaracion)
|
|
559
|
-
}
|
|
570
|
+
}
|
|
560
571
|
</div>
|
|
561
|
-
|
|
572
|
+
: null}
|
|
562
573
|
{getLosMetadatos(casillero)}
|
|
563
574
|
</div>
|
|
564
575
|
</div>
|
|
565
576
|
}
|
|
566
577
|
|
|
567
|
-
function DesplegarConfirmarBorrarRespuesta(props:{forPk:ForPk, variableBorrar:IdVariable}){
|
|
578
|
+
function DesplegarConfirmarBorrarRespuesta(props: { forPk: ForPk, variableBorrar: IdVariable }) {
|
|
568
579
|
var [open, setOpen] = useState(!!props.variableBorrar)
|
|
569
580
|
const dispatch = useDispatch();
|
|
570
581
|
const handleClose = () => {
|
|
571
|
-
dispatch(dispatchers.CONFIRMAR_BORRAR_RESPUESTA({forPk:props.forPk, variable:null}));
|
|
582
|
+
dispatch(dispatchers.CONFIRMAR_BORRAR_RESPUESTA({ forPk: props.forPk, variable: null }));
|
|
572
583
|
setOpen(false);
|
|
573
584
|
}
|
|
574
585
|
return <Popover
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
586
|
+
id={"popover-confirmar"}
|
|
587
|
+
open={open}
|
|
588
|
+
onClose={handleClose}
|
|
589
|
+
anchorOrigin={{
|
|
590
|
+
vertical: 'bottom',
|
|
591
|
+
horizontal: 'center',
|
|
592
|
+
}}
|
|
593
|
+
transformOrigin={{
|
|
594
|
+
vertical: 'top',
|
|
595
|
+
horizontal: 'left',
|
|
596
|
+
}}
|
|
597
|
+
>
|
|
598
|
+
<Typography>La pregunta tiene registrada una respuesta que no fue detectada como errónea</Typography>
|
|
599
|
+
<div className="confirma-botones">
|
|
600
|
+
<Button color="secondary" variant="outlined" onClick={() => {
|
|
601
|
+
if (props.variableBorrar) {
|
|
602
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: props.variableBorrar, respuesta: null })
|
|
603
|
+
}
|
|
604
|
+
handleClose();
|
|
605
|
+
}}>borrar respuesta</Button>
|
|
606
|
+
<Button color="primary" variant="outlined" onClick={handleClose}>volver sin borrar</Button>
|
|
607
|
+
</div>
|
|
608
|
+
</Popover>;
|
|
598
609
|
}
|
|
599
610
|
|
|
600
|
-
function calcularNuestraLongitud(longitud:string |null){
|
|
611
|
+
function calcularNuestraLongitud(longitud: string | null) {
|
|
601
612
|
return longitud;
|
|
602
613
|
}
|
|
603
614
|
|
|
604
|
-
function enfocarElementoDeVariable(siguienteVariable:IdVariable|IdFin){
|
|
615
|
+
function enfocarElementoDeVariable(siguienteVariable: IdVariable | IdFin) {
|
|
605
616
|
debeSaltar = false;
|
|
606
|
-
var {top, enfocado, elementoInputVariable} = calcularElementoEnfocado(siguienteVariable);
|
|
607
|
-
if(top != null && top>0 && (!enfocado || "salta siempre")){
|
|
608
|
-
window.scrollTo({top, left:0, behavior:'smooth'});
|
|
617
|
+
var { top, enfocado, elementoInputVariable } = calcularElementoEnfocado(siguienteVariable);
|
|
618
|
+
if (top != null && top > 0 && (!enfocado || "salta siempre")) {
|
|
619
|
+
window.scrollTo({ top, left: 0, behavior: 'smooth' });
|
|
609
620
|
}
|
|
610
621
|
elementoInputVariable?.focus();
|
|
611
622
|
}
|
|
612
623
|
|
|
613
|
-
function Campo(props:{disabled:boolean, pregunta:PreguntaSimple|PreguntaConOpciones|PreguntaConSiNo|OpcionMultiple, forPk:ForPk, mini?:boolean, hidden?:boolean|'quitar'}){
|
|
614
|
-
var {pregunta, disabled, mini } = props;
|
|
615
|
-
var {saltoAutomatico, conCampoOpciones} = useSelector((state:CasoState)=>state.opciones);
|
|
616
|
-
const longitud = mini ? pregunta.casilleros.reduce((acum, o)=>Math.max(o.casillero.toString().length, acum), 0) :
|
|
624
|
+
function Campo(props: { disabled: boolean, pregunta: PreguntaSimple | PreguntaConOpciones | PreguntaConSiNo | OpcionMultiple, forPk: ForPk, mini?: boolean, hidden?: boolean | 'quitar' }) {
|
|
625
|
+
var { pregunta, disabled, mini } = props;
|
|
626
|
+
var { saltoAutomatico, conCampoOpciones } = useSelector((state: CasoState) => state.opciones);
|
|
627
|
+
const longitud = mini ? pregunta.casilleros.reduce((acum, o) => Math.max(o.casillero.toString().length, acum), 0) :
|
|
617
628
|
// @ts-ignore mini es para los otros
|
|
618
629
|
pregunta.longitud;
|
|
619
630
|
// var [valor, setValor] = useState(props.valor);
|
|
@@ -624,43 +635,43 @@ function Campo(props:{disabled:boolean, pregunta:PreguntaSimple|PreguntaConOpcio
|
|
|
624
635
|
const inputProps = {
|
|
625
636
|
maxLength: longitud,
|
|
626
637
|
};
|
|
627
|
-
const onChange=(nuevoValor:Valor|typeof NO_CAMBIAR__VERIFICAR_SI_ES_NECESARIO)=>{
|
|
628
|
-
var {siguienteVariable} = dispatchByPass(accion_registrar_respuesta, {forPk:props.forPk, variable:pregunta.var_name, respuesta:nuevoValor});
|
|
629
|
-
if(siguienteVariable && debeSaltar){
|
|
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 });
|
|
640
|
+
if (siguienteVariable && debeSaltar) {
|
|
630
641
|
//@ts-ignore algunos casilleros tienen especial y otros no
|
|
631
|
-
(pregunta.especial?.noScroll == true)?null:enfocarElementoDeVariable(pregunta.especial?.scrollTo ?? siguienteVariable);
|
|
642
|
+
(pregunta.especial?.noScroll == true) ? null : enfocarElementoDeVariable(pregunta.especial?.scrollTo ?? siguienteVariable);
|
|
632
643
|
}
|
|
633
644
|
};
|
|
634
645
|
var nuestraLongitud = calcularNuestraLongitud(pregunta.longitud || longitud)
|
|
635
|
-
return <div className="campo" nuestra-longitud={nuestraLongitud} style={props.hidden=='quitar'?{display:'none'}:props.hidden?{visibility:'hidden'}:undefined}>
|
|
636
|
-
{mini?null
|
|
646
|
+
return <div className="campo" nuestra-longitud={nuestraLongitud} style={props.hidden == 'quitar' ? { display: 'none' } : props.hidden ? { visibility: 'hidden' } : undefined}>
|
|
647
|
+
{mini ? null : <BotonBorrar
|
|
637
648
|
id={`borrar-abierta-${pregunta.var_name}`}
|
|
638
649
|
variable={pregunta.var_name}
|
|
639
650
|
forPk={props.forPk}
|
|
640
651
|
/>}
|
|
641
652
|
<div className="input-campo">
|
|
642
|
-
<TextField
|
|
653
|
+
<TextField
|
|
643
654
|
id={`var-${pregunta.var_name}`}
|
|
644
655
|
//@ts-ignore algunos casilleros tienen especial y otros no
|
|
645
656
|
disabled={disabled || pregunta.especial?.gps}
|
|
646
|
-
className="variable"
|
|
657
|
+
className="variable"
|
|
647
658
|
//var-length={pregunta.longitud}
|
|
648
659
|
fullWidth={true}
|
|
649
660
|
inputProps={inputProps}
|
|
650
|
-
type={pregunta.despliegueTipoInput??adaptarTipoVarCasillero(pregunta.tipovar)}
|
|
651
|
-
onKeyDown={(event:React.KeyboardEvent)=>{
|
|
661
|
+
type={pregunta.despliegueTipoInput ?? adaptarTipoVarCasillero(pregunta.tipovar)}
|
|
662
|
+
onKeyDown={(event: React.KeyboardEvent) => {
|
|
652
663
|
var esEnter = (event.key == 'Enter' || event.keyCode == 13)
|
|
653
664
|
debeSaltar = esEnter && (saltoAutomatico || conCampoOpciones);
|
|
654
|
-
if(esEnter){
|
|
655
|
-
if(event.target instanceof HTMLElement){
|
|
665
|
+
if (esEnter) {
|
|
666
|
+
if (event.target instanceof HTMLElement) {
|
|
656
667
|
event.target.blur();
|
|
657
668
|
}
|
|
658
669
|
event.preventDefault();
|
|
659
670
|
}
|
|
660
671
|
}}
|
|
661
|
-
onFocus={(_event)=>setEditando(true)}
|
|
662
|
-
onBlur={(event, valor)=>{
|
|
663
|
-
if(event?.relatedTarget?.getAttribute('boton-confirmar')){
|
|
672
|
+
onFocus={(_event) => setEditando(true)}
|
|
673
|
+
onBlur={(event, valor) => {
|
|
674
|
+
if (event?.relatedTarget?.getAttribute('boton-confirmar')) {
|
|
664
675
|
debeSaltar = true;
|
|
665
676
|
}
|
|
666
677
|
onChange(valor);
|
|
@@ -668,65 +679,65 @@ function Campo(props:{disabled:boolean, pregunta:PreguntaSimple|PreguntaConOpcio
|
|
|
668
679
|
}}
|
|
669
680
|
/>
|
|
670
681
|
</div>
|
|
671
|
-
{disabled || pregunta.especial?.gps || mini?null:
|
|
682
|
+
{disabled || pregunta.especial?.gps || mini ? null :
|
|
672
683
|
<div className="boton-confirmar-campo">
|
|
673
|
-
<Button variant={editando?"contained":'outlined'} size="small" color={editando?'primary':'default'}
|
|
684
|
+
<Button variant={editando ? "contained" : 'outlined'} size="small" color={editando ? 'primary' : 'default'}
|
|
674
685
|
boton-confirmar={pregunta.var_name}
|
|
675
686
|
tabIndex={-1}
|
|
676
|
-
onClick={()=>{
|
|
687
|
+
onClick={() => {
|
|
677
688
|
onChange(NO_CAMBIAR__VERIFICAR_SI_ES_NECESARIO);
|
|
678
689
|
setEditando(false)
|
|
679
690
|
}}
|
|
680
|
-
><ICON.Check/></Button>
|
|
691
|
+
><ICON.Check /></Button>
|
|
681
692
|
</div>
|
|
682
693
|
}
|
|
683
694
|
</div>
|
|
684
695
|
}
|
|
685
696
|
|
|
686
|
-
interface IcasilleroConOpciones{
|
|
687
|
-
var_name:IdVariable,
|
|
688
|
-
casilleros:Opcion[]
|
|
697
|
+
interface IcasilleroConOpciones {
|
|
698
|
+
var_name: IdVariable,
|
|
699
|
+
casilleros: Opcion[]
|
|
689
700
|
}
|
|
690
701
|
|
|
691
702
|
function OpcionesDespliegue(
|
|
692
|
-
{casilleroConOpciones, forPk,
|
|
693
|
-
|
|
694
|
-
){
|
|
695
|
-
const desplegarOtros = (opcion:Opcion, soloParaDespliegue:'vertical'|'horizontal'|null) => opcion.casilleros.map((subPregunta:Pregunta)=>(
|
|
703
|
+
{ casilleroConOpciones, forPk, leer, despliegueContenido }:
|
|
704
|
+
{ casilleroConOpciones: IcasilleroConOpciones, forPk: ForPk, leer: boolean, despliegueContenido: 'vertical' | 'horizontal' }
|
|
705
|
+
) {
|
|
706
|
+
const desplegarOtros = (opcion: Opcion, soloParaDespliegue: 'vertical' | 'horizontal' | null) => opcion.casilleros.map((subPregunta: Pregunta) => (
|
|
696
707
|
soloParaDespliegue == null || soloParaDespliegue == subPregunta.despliegueContenido ?
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
708
|
+
<div className="otros-especificar" style={{ width: '100%' }} key={subPregunta.id_casillero}>
|
|
709
|
+
<PreguntaDespliegue
|
|
710
|
+
pregunta={subPregunta}
|
|
711
|
+
forPk={forPk}
|
|
712
|
+
despliegueEncabezado='superior'
|
|
713
|
+
/>
|
|
714
|
+
</div> : null
|
|
704
715
|
))
|
|
705
716
|
return <><div className="contenido">
|
|
706
|
-
<div className="opciones" despliegue-contenido={despliegueContenido??'vertical'}>
|
|
707
|
-
{casilleroConOpciones.casilleros.map((opcion:Opcion, i:number)=>
|
|
717
|
+
<div className="opciones" despliegue-contenido={despliegueContenido ?? 'vertical'}>
|
|
718
|
+
{casilleroConOpciones.casilleros.map((opcion: Opcion, i: number) =>
|
|
708
719
|
<Grid key={opcion.id_casillero} item
|
|
709
|
-
ocultar-salteada={opcion.despliegueOculta?(opcion.expresion_habilitar_js?'INHABILITAR':'SI'):'NO'}
|
|
720
|
+
ocultar-salteada={opcion.despliegueOculta ? (opcion.expresion_habilitar_js ? 'INHABILITAR' : 'SI') : 'NO'}
|
|
710
721
|
>
|
|
711
|
-
<OpcionDespliegue
|
|
712
|
-
casillero={opcion}
|
|
713
|
-
variable={casilleroConOpciones.var_name}
|
|
722
|
+
<OpcionDespliegue
|
|
723
|
+
casillero={opcion}
|
|
724
|
+
variable={casilleroConOpciones.var_name}
|
|
714
725
|
valorOpcion={opcion.casillero}
|
|
715
|
-
forPk={forPk}
|
|
726
|
+
forPk={forPk}
|
|
716
727
|
leer={leer}
|
|
717
|
-
conBotonBorrar={i==0 || despliegueContenido!='horizontal'}
|
|
728
|
+
conBotonBorrar={i == 0 || despliegueContenido != 'horizontal'}
|
|
718
729
|
/>
|
|
719
|
-
{despliegueContenido=='horizontal'?null:desplegarOtros(opcion,null)}
|
|
730
|
+
{despliegueContenido == 'horizontal' ? null : desplegarOtros(opcion, null)}
|
|
720
731
|
</Grid>
|
|
721
732
|
)}
|
|
722
733
|
</div>
|
|
723
734
|
</div>
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
735
|
+
{despliegueContenido == 'horizontal' ? casilleroConOpciones.casilleros.map((opcion: Opcion) =>
|
|
736
|
+
desplegarOtros(opcion, null)
|
|
737
|
+
) : null}</>
|
|
727
738
|
}
|
|
728
739
|
|
|
729
|
-
const nombreCasillero={
|
|
740
|
+
const nombreCasillero = {
|
|
730
741
|
F: 'formulario',
|
|
731
742
|
B: 'bloque',
|
|
732
743
|
P: 'pregunta',
|
|
@@ -740,410 +751,454 @@ const nombreCasillero={
|
|
|
740
751
|
PMATRIZ: 'preguntaenformadematriz',
|
|
741
752
|
}
|
|
742
753
|
|
|
743
|
-
function DesplegarCasillero(props:{
|
|
744
|
-
casillero:Pregunta|Bloque|Filtro|ConjuntoPreguntas|BotonFormulario|Consistencia|OpcionMultiple|Texto|PMatriz,
|
|
745
|
-
id?:string,
|
|
746
|
-
style?:React.CSSProperties,
|
|
747
|
-
despliegueEncabezado?:'lateral'|'superior'
|
|
748
|
-
children:React.ReactNode|React.ReactNode[],
|
|
749
|
-
"ocultar-salteada"?:'SI'|'NO'|'INHABILITAR'|undefined
|
|
750
|
-
}){
|
|
751
|
-
return <div
|
|
752
|
-
key={`${props.casillero.tipoc}-${props.id||props.casillero.id_casillero}`}
|
|
754
|
+
function DesplegarCasillero(props: {
|
|
755
|
+
casillero: Pregunta | Bloque | Filtro | ConjuntoPreguntas | BotonFormulario | Consistencia | OpcionMultiple | Texto | PMatriz,
|
|
756
|
+
id?: string,
|
|
757
|
+
style?: React.CSSProperties,
|
|
758
|
+
despliegueEncabezado?: 'lateral' | 'superior'
|
|
759
|
+
children: React.ReactNode | React.ReactNode[],
|
|
760
|
+
"ocultar-salteada"?: 'SI' | 'NO' | 'INHABILITAR' | undefined
|
|
761
|
+
}) {
|
|
762
|
+
return <div
|
|
763
|
+
key={`${props.casillero.tipoc}-${props.id || props.casillero.id_casillero}`}
|
|
753
764
|
className={`casillero ${nombreCasillero[props.casillero.tipoc]}`}
|
|
754
765
|
id={props.id}
|
|
755
766
|
style={props.style}
|
|
756
|
-
despliegue-encabezado={props.casillero.despliegueEncabezado??props.despliegueEncabezado??'superior'}
|
|
767
|
+
despliegue-encabezado={props.casillero.despliegueEncabezado ?? props.despliegueEncabezado ?? 'superior'}
|
|
757
768
|
ocultar-salteada={props["ocultar-salteada"]}
|
|
758
769
|
>{props.children}</div>
|
|
759
770
|
}
|
|
760
771
|
|
|
761
|
-
function PreguntaDespliegue(props:{
|
|
762
|
-
pregunta:Pregunta,
|
|
763
|
-
forPk:ForPk,
|
|
764
|
-
despliegueEncabezado:'lateral'|'superior',
|
|
765
|
-
paraPMatriz?:true
|
|
766
|
-
}){
|
|
767
|
-
var {pregunta} = props;
|
|
768
|
-
const dispatch=useDispatch();
|
|
769
|
-
var estado:EstadoVariable;
|
|
772
|
+
function PreguntaDespliegue(props: {
|
|
773
|
+
pregunta: Pregunta,
|
|
774
|
+
forPk: ForPk,
|
|
775
|
+
despliegueEncabezado: 'lateral' | 'superior',
|
|
776
|
+
paraPMatriz?: true
|
|
777
|
+
}) {
|
|
778
|
+
var { pregunta } = props;
|
|
779
|
+
const dispatch = useDispatch();
|
|
780
|
+
var estado: EstadoVariable;
|
|
770
781
|
var id = `pregunta-${pregunta.id_casillero}`
|
|
771
782
|
registrarElemento({
|
|
772
|
-
id,
|
|
773
|
-
direct:true,
|
|
783
|
+
id,
|
|
784
|
+
direct: true,
|
|
774
785
|
fun: registradorDeVariable(pregunta)
|
|
775
786
|
})
|
|
776
787
|
var id = `pregunta-${pregunta.id_casillero}`
|
|
777
788
|
var style: React.CSSProperties = {}
|
|
778
|
-
if(pregunta.despliegue == 'grid'){
|
|
789
|
+
if (pregunta.despliegue == 'grid') {
|
|
779
790
|
style.display = 'grid';
|
|
780
791
|
style.gridTemplateColumns = 'repeat(3,1fr)';
|
|
781
792
|
}
|
|
782
|
-
|
|
783
|
-
return props.paraPMatriz?
|
|
793
|
+
|
|
794
|
+
return props.paraPMatriz ?
|
|
784
795
|
<>
|
|
785
796
|
{getLosMetadatos(pregunta)}
|
|
786
797
|
<Campo
|
|
787
|
-
disabled={pregunta.calculada?true:false}
|
|
798
|
+
disabled={pregunta.calculada ? true : false}
|
|
788
799
|
pregunta={pregunta}
|
|
789
800
|
forPk={props.forPk}
|
|
790
801
|
mini={true}
|
|
791
802
|
/>
|
|
792
803
|
</>
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
804
|
+
: <DesplegarCasillero
|
|
805
|
+
id={id}
|
|
806
|
+
casillero={pregunta}
|
|
807
|
+
style={style}
|
|
808
|
+
nuestro-tipovar={pregunta.tipovar || "multiple"}
|
|
809
|
+
ocultar-salteada={pregunta.despliegueOculta ? (pregunta.expresion_habilitar_js ? 'INHABILITAR' : 'SI') : 'NO'}
|
|
810
|
+
despliegueEncabezado={props.despliegueEncabezado}
|
|
800
811
|
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
casillero={pregunta}
|
|
804
|
-
leer={pregunta.leer!==false}
|
|
805
|
-
forPk={props.forPk}
|
|
806
|
-
/>
|
|
807
|
-
<div className="contenido">{
|
|
808
|
-
pregunta.tipovar=="si_no"?<Grid container>
|
|
809
|
-
<SiNoDespliegue
|
|
810
|
-
casilleroConOpciones={pregunta}
|
|
811
|
-
forPk={props.forPk}
|
|
812
|
-
despliegueContenido={props.pregunta.despliegueContenido??'vertical'}
|
|
813
|
-
/>
|
|
814
|
-
</Grid>:
|
|
815
|
-
pregunta.tipovar=="opciones" ?
|
|
816
|
-
<OpcionesDespliegue
|
|
817
|
-
casilleroConOpciones={pregunta}
|
|
818
|
-
forPk={props.forPk}
|
|
819
|
-
leer={!!pregunta.leer}
|
|
820
|
-
despliegueContenido={pregunta.despliegueContenido??'vertical'}
|
|
821
|
-
/>:
|
|
822
|
-
pregunta.tipovar==null?
|
|
823
|
-
(pregunta.casilleros as (OpcionMultiple|Consistencia)[]).map((opcionMultiple)=>
|
|
824
|
-
opcionMultiple.tipoc=='OM'?
|
|
825
|
-
<OpcionMultipleDespliegue
|
|
826
|
-
key={opcionMultiple.id_casillero}
|
|
827
|
-
opcionM={opcionMultiple}
|
|
828
|
-
forPk={props.forPk}
|
|
829
|
-
/>
|
|
830
|
-
: //las consistencias pueden ser hermanas de OM
|
|
831
|
-
<ConsistenciaDespliegue
|
|
832
|
-
key={opcionMultiple.id_casillero}
|
|
833
|
-
casillero={opcionMultiple}
|
|
834
|
-
forPk={props.forPk}
|
|
835
|
-
/>
|
|
836
|
-
)
|
|
837
|
-
:
|
|
838
|
-
((preguntaSimple:PreguntaSimple)=>
|
|
839
|
-
<Campo
|
|
840
|
-
disabled={preguntaSimple.calculada?true:false}
|
|
841
|
-
pregunta={preguntaSimple}
|
|
842
|
-
forPk={props.forPk}
|
|
843
|
-
/>
|
|
844
|
-
)(pregunta)
|
|
845
|
-
}</div>
|
|
846
|
-
<div className="pie-pregunta">
|
|
847
|
-
<SaltoDespliegue
|
|
812
|
+
>
|
|
813
|
+
<EncabezadoDespliegue
|
|
848
814
|
casillero={pregunta}
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
):""}
|
|
815
|
+
leer={pregunta.leer !== false}
|
|
816
|
+
forPk={props.forPk}
|
|
852
817
|
/>
|
|
853
|
-
|
|
854
|
-
|
|
818
|
+
<div className="contenido">{
|
|
819
|
+
pregunta.tipovar == "si_no" ? <Grid container>
|
|
820
|
+
<SiNoDespliegue
|
|
821
|
+
casilleroConOpciones={pregunta}
|
|
822
|
+
forPk={props.forPk}
|
|
823
|
+
despliegueContenido={props.pregunta.despliegueContenido ?? 'vertical'}
|
|
824
|
+
/>
|
|
825
|
+
</Grid> :
|
|
826
|
+
pregunta.tipovar == "opciones" ?
|
|
827
|
+
<OpcionesDespliegue
|
|
828
|
+
casilleroConOpciones={pregunta}
|
|
829
|
+
forPk={props.forPk}
|
|
830
|
+
leer={!!pregunta.leer}
|
|
831
|
+
despliegueContenido={pregunta.despliegueContenido ?? 'vertical'}
|
|
832
|
+
/> :
|
|
833
|
+
pregunta.tipovar == null ?
|
|
834
|
+
(pregunta.casilleros as (OpcionMultiple | Consistencia)[]).map((opcionMultiple) =>
|
|
835
|
+
opcionMultiple.tipoc == 'OM' ?
|
|
836
|
+
<OpcionMultipleDespliegue
|
|
837
|
+
key={opcionMultiple.id_casillero}
|
|
838
|
+
opcionM={opcionMultiple}
|
|
839
|
+
forPk={props.forPk}
|
|
840
|
+
/>
|
|
841
|
+
: //las consistencias pueden ser hermanas de OM
|
|
842
|
+
<ConsistenciaDespliegue
|
|
843
|
+
key={opcionMultiple.id_casillero}
|
|
844
|
+
casillero={opcionMultiple}
|
|
845
|
+
forPk={props.forPk}
|
|
846
|
+
/>
|
|
847
|
+
)
|
|
848
|
+
:
|
|
849
|
+
((preguntaSimple: PreguntaSimple) =>
|
|
850
|
+
<Campo
|
|
851
|
+
disabled={preguntaSimple.calculada ? true : false}
|
|
852
|
+
pregunta={preguntaSimple}
|
|
853
|
+
forPk={props.forPk}
|
|
854
|
+
/>
|
|
855
|
+
)(pregunta)
|
|
856
|
+
}</div>
|
|
857
|
+
<div className="pie-pregunta">
|
|
858
|
+
<SaltoDespliegue
|
|
859
|
+
casillero={pregunta}
|
|
860
|
+
prefijo={pregunta.tipovar == "opciones" ? (
|
|
861
|
+
pregunta.casilleros.some(opcion => opcion.salto) ? "resto de las opciones" : "todas las opciones"
|
|
862
|
+
) : ""}
|
|
863
|
+
/>
|
|
864
|
+
</div>
|
|
865
|
+
</DesplegarCasillero>
|
|
855
866
|
}
|
|
856
867
|
|
|
857
|
-
function PMatrizDespliegue(props:{
|
|
858
|
-
casillero:PMatriz,
|
|
859
|
-
forPk:ForPk,
|
|
860
|
-
}){
|
|
861
|
-
var {casillero} = props;
|
|
868
|
+
function PMatrizDespliegue(props: {
|
|
869
|
+
casillero: PMatriz,
|
|
870
|
+
forPk: ForPk,
|
|
871
|
+
}) {
|
|
872
|
+
var { casillero } = props;
|
|
862
873
|
var id = `pregunta-${casillero.id_casillero}`
|
|
863
|
-
const cols = (casillero.casilleros as (OpcionMultiple|Consistencia)[])
|
|
864
|
-
.find((opcionMultiple)=>opcionMultiple.tipoc=='OM')?.casilleros
|
|
865
|
-
.map((pregunta)=>pregunta.nombre);
|
|
866
|
-
const tdStyle:React.CSSProperties={textAlign: 'center', width:cols?(550/(cols.length)).toString()+'px':''};
|
|
874
|
+
const cols = (casillero.casilleros as (OpcionMultiple | Consistencia)[])
|
|
875
|
+
.find((opcionMultiple) => opcionMultiple.tipoc == 'OM')?.casilleros
|
|
876
|
+
.map((pregunta) => pregunta.nombre);
|
|
877
|
+
const tdStyle: React.CSSProperties = { textAlign: 'center', width: cols ? (550 / (cols.length)).toString() + 'px' : '' };
|
|
867
878
|
return <DesplegarCasillero
|
|
868
879
|
id={id}
|
|
869
880
|
casillero={casillero}
|
|
870
|
-
ocultar-salteada={casillero.despliegueOculta?(casillero.expresion_habilitar_js?'INHABILITAR':'SI'):'NO'}
|
|
881
|
+
ocultar-salteada={casillero.despliegueOculta ? (casillero.expresion_habilitar_js ? 'INHABILITAR' : 'SI') : 'NO'}
|
|
871
882
|
>
|
|
872
|
-
<EncabezadoDespliegue
|
|
873
|
-
casillero={casillero}
|
|
874
|
-
leer={casillero.leer!==false}
|
|
883
|
+
<EncabezadoDespliegue
|
|
884
|
+
casillero={casillero}
|
|
885
|
+
leer={casillero.leer !== false}
|
|
875
886
|
forPk={props.forPk}
|
|
876
887
|
/>
|
|
877
888
|
<table className="table table-striped">
|
|
878
889
|
<thead>
|
|
879
890
|
<tr>
|
|
880
891
|
<th></th>
|
|
881
|
-
{cols?.map((col, i)
|
|
892
|
+
{cols?.map((col, i) => <th key={i} scope="col" style={tdStyle}>{col}</th>)}
|
|
882
893
|
</tr>
|
|
883
894
|
</thead>
|
|
884
895
|
<tbody>
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
896
|
+
{(casillero.casilleros as (OpcionMultiple | Consistencia)[]).map((opcionMultiple, i) =>
|
|
897
|
+
opcionMultiple.tipoc == 'OM' ?
|
|
898
|
+
<tr key={i}>
|
|
899
|
+
<td>{opcionMultiple.nombre}</td>
|
|
900
|
+
{opcionMultiple.casilleros.map((pregunta) => {
|
|
901
|
+
var id = `pregunta-${pregunta.id_casillero}`
|
|
902
|
+
registrarElemento({
|
|
903
|
+
id,
|
|
904
|
+
direct: true,
|
|
905
|
+
fun: registradorDeVariable(pregunta)
|
|
906
|
+
})
|
|
907
|
+
return <td key={id} id={id}><PreguntaDespliegue forPk={props.forPk} pregunta={pregunta} despliegueEncabezado="superior" paraPMatriz={true} /></td>
|
|
908
|
+
})}
|
|
909
|
+
</tr>
|
|
910
|
+
|
|
911
|
+
: //las consistencias pueden ser hermanas de OM
|
|
912
|
+
<ConsistenciaDespliegue
|
|
913
|
+
key={opcionMultiple.id_casillero}
|
|
914
|
+
casillero={opcionMultiple}
|
|
915
|
+
forPk={props.forPk}
|
|
916
|
+
/>
|
|
917
|
+
)}
|
|
907
918
|
</tbody>
|
|
908
919
|
</table>
|
|
909
|
-
|
|
920
|
+
|
|
910
921
|
<div className="pie-pregunta"></div>
|
|
911
922
|
</DesplegarCasillero>
|
|
912
923
|
}
|
|
913
924
|
|
|
914
925
|
var calcularDisabledBFAgregarListo = (
|
|
915
|
-
configSorteoFormulario:ConfiguracionSorteoFormulario|null,
|
|
916
|
-
habilitacionBotonFormulario: ConfiguracionHabilitarBotonFormulario|null,
|
|
917
|
-
formulario:IdFormulario
|
|
918
|
-
)=>{
|
|
919
|
-
if(habilitacionBotonFormulario && habilitacionBotonFormulario[formulario]){
|
|
926
|
+
configSorteoFormulario: ConfiguracionSorteoFormulario | null,
|
|
927
|
+
habilitacionBotonFormulario: ConfiguracionHabilitarBotonFormulario | null,
|
|
928
|
+
formulario: IdFormulario
|
|
929
|
+
) => {
|
|
930
|
+
if (habilitacionBotonFormulario && habilitacionBotonFormulario[formulario]) {
|
|
920
931
|
return !habilitacionBotonFormulario[formulario].habilitar_agregar_listo
|
|
921
|
-
}else{
|
|
932
|
+
} else {
|
|
922
933
|
return !!(configSorteoFormulario && configSorteoFormulario.id_formulario_individual == formulario)
|
|
923
934
|
}
|
|
924
935
|
}
|
|
925
936
|
|
|
926
|
-
function botonesDelFormulario(r:Respuestas, unidad_analisis:IdUnidadAnalisis, estructura:Estructura, forPkPadre:ForPk, feedbackAll:{[formulario in PlainForPk]:FormStructureState<IdVariable, Valor, IdFin>}):HtmlTag<HTMLDivElement>{
|
|
937
|
+
function botonesDelFormulario(r: Respuestas, unidad_analisis: IdUnidadAnalisis, estructura: Estructura, forPkPadre: ForPk, feedbackAll: { [formulario in PlainForPk]: FormStructureState<IdVariable, Valor, IdFin> }): HtmlTag<HTMLDivElement> {
|
|
927
938
|
var formsVivienda = getFormulariosForValuePkRaiz(forPkPadre[estructura.pkAgregadaUaPpal]);
|
|
928
939
|
var uaDef = estructura.unidades_analisis[unidad_analisis];
|
|
929
940
|
var arrayEstructuraFormularios = (likeAr(estructura.formularios)).array();
|
|
930
|
-
var x = likeAr(uaDef.hijas).filter(uaHija=>
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
941
|
+
var x = likeAr(uaDef.hijas).filter(uaHija =>
|
|
942
|
+
//descarto uas que no estén en ningun form
|
|
943
|
+
arrayEstructuraFormularios.filter((infoFormulario) =>
|
|
944
|
+
infoFormulario.casilleros.unidad_analisis == uaHija?.unidad_analisis && formsVivienda.includes(infoFormulario.casilleros.id_casillero as IdFormulario)
|
|
945
|
+
).length > 0
|
|
946
|
+
).map(uaHija => (
|
|
936
947
|
uaHija == null ? null :
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
948
|
+
html.div({ class: 'ua-hijas' }, [
|
|
949
|
+
html.div(uaHija.unidad_analisis),
|
|
950
|
+
html.div(
|
|
951
|
+
likeAr(r[uaHija.unidad_analisis] || []).map((respuestasHija, i) => {
|
|
952
|
+
var num = Number(i) + 1
|
|
953
|
+
var forPkHijaParcial = { ...forPkPadre, [uaHija.pk_agregada]: num };
|
|
954
|
+
var configSorteoFormulario = estructura.configSorteo ? estructura.configSorteo[getMainFormForVivienda(forPkPadre[estructura.pkAgregadaUaPpal])] : null
|
|
955
|
+
var habilitacionBotonFormulario = estructura.habilitacionBotonFormulario;
|
|
956
|
+
return html.div({ class: 'numerador-ua' }, [
|
|
957
|
+
html.div({ class: 'botones-ua' }, [
|
|
958
|
+
html.div({ class: 'numero-ua' }, num.toString()),
|
|
959
|
+
...likeAr(estructura.formularios)
|
|
960
|
+
.filter(formDef => formDef.casilleros.unidad_analisis == uaHija.unidad_analisis && formsVivienda.includes(formDef.casilleros.id_casillero as IdFormulario))
|
|
961
|
+
.map((_formDef, formulario) => {
|
|
962
|
+
var forPk = { ...forPkHijaParcial, formulario };
|
|
963
|
+
var feedbackForm = feedbackAll[toPlainForPk(forPk)];
|
|
964
|
+
return feedbackForm ? html.div({}, [
|
|
965
|
+
// html.button((uaHija!).pk_agregada+" ok: "+(Number(i)+1)),
|
|
966
|
+
botonFormularioConResumen(
|
|
967
|
+
{
|
|
968
|
+
forPk,
|
|
969
|
+
num,
|
|
970
|
+
actual: true || calcularActualBF(configSorteoFormulario, num, null, formulario, r), //REVISAR true para que no se grisen
|
|
971
|
+
previo: false,
|
|
972
|
+
disabled: calcularDisabledBF(configSorteoFormulario, habilitacionBotonFormulario, num, formulario, r)
|
|
973
|
+
},
|
|
974
|
+
feedbackForm,
|
|
975
|
+
r,
|
|
976
|
+
{ despliegueOculta: false, expresion_habilitar_js: '', nombre: formulario, aclaracion: null, salto: formulario },
|
|
977
|
+
forPkPadre,
|
|
978
|
+
"boton-ir-resumen-formulario",
|
|
979
|
+
estructura.formularios[formulario].casilleros
|
|
980
|
+
)
|
|
981
|
+
]) : null
|
|
982
|
+
}).array().map(x => x == null ? null : x).reverse(),
|
|
983
|
+
])
|
|
984
|
+
, botonesDelFormulario(respuestasHija, uaHija.unidad_analisis, estructura, forPkHijaParcial, feedbackAll)
|
|
972
985
|
])
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
])
|
|
978
|
-
)).array().map(x=>x == null ? null : x);
|
|
986
|
+
}).array().map(x => x == null ? null : x)
|
|
987
|
+
)
|
|
988
|
+
])
|
|
989
|
+
)).array().map(x => x == null ? null : x);
|
|
979
990
|
return html.div(/*{style:'display:flex; flex-direction:row'},*/x);
|
|
980
991
|
}
|
|
981
992
|
|
|
982
|
-
function TextoDespliegue(props:{casillero:Texto, forPk:ForPk}){
|
|
983
|
-
var {casillero, forPk} = props;
|
|
993
|
+
function TextoDespliegue(props: { casillero: Texto, forPk: ForPk }) {
|
|
994
|
+
var { casillero, forPk } = props;
|
|
984
995
|
const dispatch = useDispatch();
|
|
985
|
-
var habilitador = casillero.expresion_habilitar_js?getFuncionHabilitar(casillero.expresion_habilitar_js):()=>true;
|
|
986
|
-
var {modoDespliegue} = useSelectorVivienda(forPk);
|
|
996
|
+
var habilitador = casillero.expresion_habilitar_js ? getFuncionHabilitar(casillero.expresion_habilitar_js) : () => true;
|
|
997
|
+
var { modoDespliegue } = useSelectorVivienda(forPk);
|
|
987
998
|
var id = `texto-${casillero.id_casillero}`;
|
|
988
|
-
registrarElemento({id, style:'display', fun:(r:Respuestas)=>habilitador(r) || modoDespliegue=='metadatos'?'block':'none'})
|
|
989
|
-
var esResumenFormulario = casillero.casillero=='ResFor' as IdCasillero; // TODO: Cambia esto que está jarcodeado.
|
|
990
|
-
if(esResumenFormulario){
|
|
991
|
-
registrarElemento({
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
999
|
+
registrarElemento({ id, style: 'display', fun: (r: Respuestas) => habilitador(r) || modoDespliegue == 'metadatos' ? 'block' : 'none' })
|
|
1000
|
+
var esResumenFormulario = casillero.casillero == 'ResFor' as IdCasillero; // TODO: Cambia esto que está jarcodeado.
|
|
1001
|
+
if (esResumenFormulario) {
|
|
1002
|
+
registrarElemento({
|
|
1003
|
+
id, direct: true,
|
|
1004
|
+
fun: (
|
|
1005
|
+
r: Respuestas,
|
|
1006
|
+
_feedbackForm: FormStructureState<IdVariable, Valor, IdFin>,
|
|
1007
|
+
elemento: HTMLDivElement,
|
|
1008
|
+
feedbackAll: { [formulario in PlainForPk]: FormStructureState<IdVariable, Valor, IdFin> },
|
|
1009
|
+
estructura: Estructura
|
|
1010
|
+
) => {
|
|
1011
|
+
elemento.style.display = '';
|
|
1000
1012
|
//@ts-ignore las respuestas son respuestasRaiz porque ResFor está en el form ppal
|
|
1001
|
-
if(r['resumenEstado'] as ResumenEstado == 'vacio'){
|
|
1013
|
+
if (r['resumenEstado'] as ResumenEstado == 'vacio') {
|
|
1002
1014
|
elemento.textContent = "relevamiento sin empezar";
|
|
1003
|
-
}else{
|
|
1015
|
+
} else {
|
|
1004
1016
|
elemento.textContent = "relevamiento empezado";
|
|
1005
|
-
var {unidad_analisis} = estructura.formularios[forPk.formulario].casilleros;
|
|
1006
|
-
elemento.innerHTML="";
|
|
1017
|
+
var { unidad_analisis } = estructura.formularios[forPk.formulario].casilleros;
|
|
1018
|
+
elemento.innerHTML = "";
|
|
1007
1019
|
elemento.appendChild(botonesDelFormulario(r, unidad_analisis, estructura, forPk, feedbackAll).create());
|
|
1008
1020
|
}
|
|
1009
1021
|
}
|
|
1010
1022
|
})
|
|
1011
1023
|
}
|
|
1012
|
-
var ir = (defBoton:DefinicionFormularioAbrir)=>{
|
|
1024
|
+
var ir = (defBoton: DefinicionFormularioAbrir) => {
|
|
1013
1025
|
// var nuevaForPk={...forPk, formulario:idFormularioDestino};
|
|
1014
1026
|
// nuevaForPk[nuevoCampoPk] = defBoton.num
|
|
1015
|
-
dispatchByPass(accion_abrir_formulario,{forPk:defBoton.forPk});
|
|
1016
|
-
dispatch(dispatchers.CAMBIAR_FORMULARIO({forPk:defBoton.forPk, apilarVuelta:true}));
|
|
1027
|
+
dispatchByPass(accion_abrir_formulario, { forPk: defBoton.forPk });
|
|
1028
|
+
dispatch(dispatchers.CAMBIAR_FORMULARIO({ forPk: defBoton.forPk, apilarVuelta: true }));
|
|
1017
1029
|
}
|
|
1018
|
-
return <DesplegarCasillero
|
|
1030
|
+
return <DesplegarCasillero
|
|
1019
1031
|
id={`${id}-externo`}
|
|
1020
1032
|
casillero={casillero}
|
|
1021
1033
|
>
|
|
1022
|
-
<EncabezadoDespliegue casillero={casillero} leer={false} forPk={forPk}/>
|
|
1023
|
-
<div id={id} style={{display:'none'}}></div>
|
|
1024
|
-
{esResumenFormulario?
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1034
|
+
<EncabezadoDespliegue casillero={casillero} leer={false} forPk={forPk} />
|
|
1035
|
+
<div id={id} style={{ display: 'none' }}></div>
|
|
1036
|
+
{esResumenFormulario ?
|
|
1037
|
+
<Button className="special-button" id="boton-ir-resumen-formulario" style={{ display: 'none' }}
|
|
1038
|
+
onClick={(event) => {
|
|
1039
|
+
ir(JSON.parse((event.target! as unknown as HTMLButtonElement).getAttribute('def-button')!))
|
|
1040
|
+
}}
|
|
1041
|
+
>ir (interno)</Button>
|
|
1042
|
+
: null}
|
|
1031
1043
|
|
|
1032
1044
|
</DesplegarCasillero>
|
|
1033
1045
|
}
|
|
1034
1046
|
|
|
1035
|
-
function FiltroDespliegue(props:{filtro:Filtro, forPk:ForPk}){
|
|
1036
|
-
var {filtro} = props;
|
|
1047
|
+
function FiltroDespliegue(props: { filtro: Filtro, forPk: ForPk }) {
|
|
1048
|
+
var { filtro } = props;
|
|
1037
1049
|
return <DesplegarCasillero casillero={filtro}>
|
|
1038
|
-
<DespliegueEncabezado casillero={filtro}/>
|
|
1050
|
+
<DespliegueEncabezado casillero={filtro} />
|
|
1039
1051
|
</DesplegarCasillero>
|
|
1040
1052
|
}
|
|
1041
1053
|
|
|
1042
|
-
function ConsistenciaDespliegue(props:{casillero:Consistencia, forPk:ForPk}){
|
|
1043
|
-
var {casillero, forPk} = props;
|
|
1044
|
-
var habilitador = casillero.expresion_habilitar_js?getFuncionHabilitar(casillero.expresion_habilitar_js):()=>true;
|
|
1045
|
-
var {modoDespliegue} = useSelectorVivienda(forPk);
|
|
1054
|
+
function ConsistenciaDespliegue(props: { casillero: Consistencia, forPk: ForPk }) {
|
|
1055
|
+
var { casillero, forPk } = props;
|
|
1056
|
+
var habilitador = casillero.expresion_habilitar_js ? getFuncionHabilitar(casillero.expresion_habilitar_js) : () => true;
|
|
1057
|
+
var { modoDespliegue } = useSelectorVivienda(forPk);
|
|
1046
1058
|
var id = `consistencia-${casillero.id_casillero}`;
|
|
1047
|
-
registrarElemento({id, style:'display', fun:(r:Respuestas)=>habilitador(r) || modoDespliegue=='metadatos'?'block':'none'})
|
|
1048
|
-
return <DesplegarCasillero
|
|
1059
|
+
registrarElemento({ id, style: 'display', fun: (r: Respuestas) => habilitador(r) || modoDespliegue == 'metadatos' ? 'block' : 'none' })
|
|
1060
|
+
return <DesplegarCasillero
|
|
1049
1061
|
id={id}
|
|
1050
1062
|
casillero={casillero}
|
|
1051
|
-
style={{display:'none'}}
|
|
1063
|
+
style={{ display: 'none' }}
|
|
1052
1064
|
>
|
|
1053
|
-
<EncabezadoDespliegue casillero={casillero} leer={false} forPk={forPk}/>
|
|
1065
|
+
<EncabezadoDespliegue casillero={casillero} leer={false} forPk={forPk} />
|
|
1054
1066
|
</DesplegarCasillero>
|
|
1055
1067
|
}
|
|
1056
1068
|
|
|
1057
|
-
type DefinicionFormularioAbrir=
|
|
1058
|
-
({forPk:ForPk, num:number, actual:boolean, previo:boolean} |
|
|
1059
|
-
{forPk:ForPk, num:number, actual:boolean, previo:false, esAgregar:true} |
|
|
1060
|
-
{forPk:ForPk, num:number, actual:boolean, previo:false, esConfirmar:true} |
|
|
1061
|
-
{forPk:ForPk, num:number, actual:boolean, previo:false, permiteBorrar:boolean} |
|
|
1062
|
-
{forPk:ForPk, num:false, actual:boolean, previo:true, unico:true})
|
|
1063
|
-
& {esConfirmar?:true, esAgregar?:true, permiteBorrar?:boolean, disabled?:boolean|undefined};
|
|
1069
|
+
type DefinicionFormularioAbrir =
|
|
1070
|
+
({ forPk: ForPk, num: number, actual: boolean, previo: boolean } |
|
|
1071
|
+
{ forPk: ForPk, num: number, actual: boolean, previo: false, esAgregar: true } |
|
|
1072
|
+
{ forPk: ForPk, num: number, actual: boolean, previo: false, esConfirmar: true } |
|
|
1073
|
+
{ forPk: ForPk, num: number, actual: boolean, previo: false, permiteBorrar: boolean } |
|
|
1074
|
+
{ forPk: ForPk, num: false, actual: boolean, previo: true, unico: true })
|
|
1075
|
+
& { esConfirmar?: true, esAgregar?: true, permiteBorrar?: boolean, disabled?: boolean | undefined };
|
|
1064
1076
|
|
|
1065
1077
|
|
|
1066
1078
|
var botonFormularioConResumen = (
|
|
1067
|
-
defBoton:DefinicionFormularioAbrir,
|
|
1068
|
-
feedbackForm:FormStructureState<IdVariable, Valor, IdFin>,
|
|
1069
|
-
respuestasAumentadas:Respuestas,
|
|
1070
|
-
casillero:{despliegueOculta?:boolean|null, expresion_habilitar_js?:string, aclaracion:string|null, expresion_habilitar?:string, nombre?:string, salto:string|null, especial?:any},
|
|
1079
|
+
defBoton: DefinicionFormularioAbrir,
|
|
1080
|
+
feedbackForm: FormStructureState<IdVariable, Valor, IdFin>,
|
|
1081
|
+
respuestasAumentadas: Respuestas,
|
|
1082
|
+
casillero: { despliegueOculta?: boolean | null, expresion_habilitar_js?: string, aclaracion: string | null, expresion_habilitar?: string, nombre?: string, salto: string | null, especial?: any },
|
|
1071
1083
|
forPkPadre: ForPk,
|
|
1072
|
-
idButton:string,
|
|
1073
|
-
formularioAAbrir:Formulario
|
|
1074
|
-
)=>{
|
|
1075
|
-
var forPk:ForPk = defBoton.forPk;
|
|
1076
|
-
var sufijoIdElemento = toPlainForPk(forPk)+(defBoton.esConfirmar?'-listo':'');
|
|
1084
|
+
idButton: string,
|
|
1085
|
+
formularioAAbrir: Formulario
|
|
1086
|
+
) => {
|
|
1087
|
+
var forPk: ForPk = defBoton.forPk;
|
|
1088
|
+
var sufijoIdElemento = toPlainForPk(forPk) + (defBoton.esConfirmar ? '-listo' : '');
|
|
1077
1089
|
var id = `div-boton-formulario-${sufijoIdElemento}`;
|
|
1078
1090
|
var estado = feedbackForm.resumen;
|
|
1079
1091
|
return html.tr({
|
|
1080
|
-
id,
|
|
1081
|
-
class:"seccion-boton-formulario"
|
|
1082
|
-
$attrs:{
|
|
1083
|
-
"nuestro-validator":defBoton.actual?'actual':defBoton.previo?'valida':'todavia_no',
|
|
1084
|
-
"ocultar-salteada":casillero.despliegueOculta?(casillero.expresion_habilitar_js?'INHABILITAR':'SI'):'NO',
|
|
1085
|
-
"tiene-valor":"NO",
|
|
1086
|
-
"def-button":JSON.stringify(defBoton)
|
|
1092
|
+
id,
|
|
1093
|
+
class: "seccion-boton-formulario",
|
|
1094
|
+
$attrs: {
|
|
1095
|
+
"nuestro-validator": defBoton.actual ? 'actual' : defBoton.previo ? 'valida' : 'todavia_no',
|
|
1096
|
+
"ocultar-salteada": casillero.despliegueOculta ? (casillero.expresion_habilitar_js ? 'INHABILITAR' : 'SI') : 'NO',
|
|
1097
|
+
"tiene-valor": "NO",
|
|
1098
|
+
"def-button": JSON.stringify(defBoton)
|
|
1087
1099
|
}
|
|
1088
1100
|
}, [
|
|
1089
|
-
casillero.aclaracion?
|
|
1090
|
-
html.td({class:"aclaracion"}, [breakeableText(casillero.aclaracion)])
|
|
1091
|
-
|
|
1092
|
-
html.td({
|
|
1093
|
-
|
|
1094
|
-
|
|
1101
|
+
casillero.aclaracion ?
|
|
1102
|
+
html.td({ class: "aclaracion" }, [breakeableText(casillero.aclaracion)])
|
|
1103
|
+
: null,
|
|
1104
|
+
html.td({
|
|
1105
|
+
colspan: (defBoton.esAgregar || defBoton.esConfirmar) ?
|
|
1106
|
+
(casillero.especial?.camposResumen.length ?? 1) + (casillero.aclaracion ? 0 : 1)
|
|
1107
|
+
: null
|
|
1108
|
+
}, [
|
|
1095
1109
|
Button2({
|
|
1096
1110
|
// id:`var-${idVariable}`,
|
|
1097
|
-
id
|
|
1098
|
-
variant:"outlined",
|
|
1111
|
+
id: `boton-formulario-${sufijoIdElemento}`,
|
|
1112
|
+
variant: defBoton.actual ? "contained" : "outlined",
|
|
1099
1113
|
disabled: defBoton.disabled,
|
|
1100
|
-
color:"inherit",
|
|
1101
|
-
onClick:()=>{
|
|
1102
|
-
if(defBoton.esConfirmar){
|
|
1103
|
-
if(defBoton.num != null){
|
|
1104
|
-
if(casillero.salto){
|
|
1105
|
-
var
|
|
1106
|
-
|
|
1114
|
+
color: defBoton.actual ? "primary" : "inherit",
|
|
1115
|
+
onClick: () => {
|
|
1116
|
+
if (defBoton.esConfirmar) {
|
|
1117
|
+
if (defBoton.num != null) {
|
|
1118
|
+
if (casillero.salto) {
|
|
1119
|
+
var armoNomSalto = casillero.salto.substring(0, 2) == 'F:' ? casillero.salto.slice(2) : casillero.salto;
|
|
1120
|
+
var BF_varname = '$B.F:' + armoNomSalto as IdVariable
|
|
1121
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: BF_varname, respuesta: defBoton.num as Valor });
|
|
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 });
|
|
1107
1125
|
}
|
|
1108
|
-
if(casillero.expresion_habilitar){
|
|
1109
|
-
dispatchByPass(accion_registrar_respuesta,{forPk:forPkPadre, variable:casillero.expresion_habilitar as IdVariable, respuesta:defBoton.num as Valor});
|
|
1126
|
+
if (casillero.expresion_habilitar) {
|
|
1127
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: casillero.expresion_habilitar as IdVariable, respuesta: defBoton.num as Valor });
|
|
1110
1128
|
}
|
|
1111
1129
|
}
|
|
1112
|
-
}else{
|
|
1130
|
+
} else {
|
|
1113
1131
|
var button = document.getElementById(idButton)! as HTMLButtonElement;
|
|
1114
1132
|
button.setAttribute('def-button', JSON.stringify(defBoton));
|
|
1115
1133
|
button.click();
|
|
1116
1134
|
}
|
|
1117
1135
|
},
|
|
1118
|
-
$attrs:{
|
|
1119
|
-
"resumen-estado":estado!='vacio'?estado: defBoton.actual?'actual':defBoton.previo?estado:'todavia_no',
|
|
1136
|
+
$attrs: {
|
|
1137
|
+
"resumen-estado": estado != 'vacio' ? estado : defBoton.actual ? 'actual' : defBoton.previo ? estado : 'todavia_no',
|
|
1120
1138
|
}
|
|
1121
|
-
, children:[
|
|
1122
|
-
(defBoton.esAgregar?'agregar':defBoton.esConfirmar?'Listo':casillero.nombre + ' ' + (defBoton.num||'')),
|
|
1123
|
-
html.svg({focusable:false, viewbox:"0 0 24 24", "aria-hidden":"true"},[
|
|
1124
|
-
html.path({d:(defBoton.esAgregar?materialIoIconsSvgPath.Add:defBoton.esConfirmar?materialIoIconsSvgPath.Check:casillero.salto?materialIoIconsSvgPath.Forward:materialIoIconsSvgPath.ExitToApp)})
|
|
1139
|
+
, children: [
|
|
1140
|
+
(defBoton.esAgregar ? 'agregar' : defBoton.esConfirmar ? 'Listo' : casillero.nombre + ' ' + (defBoton.num || '')),
|
|
1141
|
+
html.svg({ focusable: false, viewbox: "0 0 24 24", "aria-hidden": "true", style: styleToCss({ fill: "currentColor" }) }, [
|
|
1142
|
+
html.path({ d: (defBoton.esAgregar ? materialIoIconsSvgPath.Add : defBoton.esConfirmar ? materialIoIconsSvgPath.Check : casillero.salto ? materialIoIconsSvgPath.Forward : materialIoIconsSvgPath.ExitToApp), style: styleToCss({ fill: 'currentColor' }) })
|
|
1125
1143
|
])
|
|
1126
1144
|
]
|
|
1127
1145
|
}),
|
|
1128
|
-
(defBoton.permiteBorrar?
|
|
1146
|
+
(defBoton.permiteBorrar ?
|
|
1129
1147
|
Button2({
|
|
1130
|
-
className:"boton-borrar-ua-vacia",
|
|
1131
|
-
color:"default",
|
|
1132
|
-
variant:"outlined",
|
|
1148
|
+
className: "boton-borrar-ua-vacia",
|
|
1149
|
+
color: "default",
|
|
1150
|
+
variant: "outlined",
|
|
1133
1151
|
children:
|
|
1134
|
-
html.svg({focusable:false, viewbox:"0 0 24 24", "aria-hidden":"true"},[
|
|
1135
|
-
html.path({d:materialIoIconsSvgPath.DeleteForever})
|
|
1136
|
-
]),
|
|
1137
|
-
onClick:()=>
|
|
1138
|
-
|
|
1152
|
+
html.svg({ focusable: false, viewbox: "0 0 24 24", "aria-hidden": "true", style: styleToCss({ fill: "currentColor" }) }, [
|
|
1153
|
+
html.path({ d: materialIoIconsSvgPath.DeleteForever, style: styleToCss({ fill: 'currentColor' }) })
|
|
1154
|
+
]),
|
|
1155
|
+
onClick: () => {
|
|
1156
|
+
accion_borrar_formulario({ forPk, forPkPadre });
|
|
1157
|
+
var armoNomSalto = casillero.salto!.substring(0, 2) == 'F:' ? casillero.salto!.slice(2) : casillero.salto!;
|
|
1158
|
+
var BF_varname_agregar = '$B.F:' + armoNomSalto + '_agregar' as IdVariable;
|
|
1159
|
+
var BF_varname_listo = '$B.F:' + armoNomSalto as IdVariable;
|
|
1160
|
+
if (defBoton.num === 1) {
|
|
1161
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: BF_varname_agregar, respuesta: null as unknown as Valor });
|
|
1162
|
+
}
|
|
1163
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: BF_varname_listo, respuesta: null as unknown as Valor });
|
|
1164
|
+
if (casillero.expresion_habilitar) {
|
|
1165
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: casillero.expresion_habilitar as IdVariable, respuesta: null as unknown as Valor });
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
})
|
|
1169
|
+
: null),
|
|
1170
|
+
(defBoton.esConfirmar && casillero.salto && respuestasAumentadas['$B.F:' + (casillero.salto.substring(0, 2) == 'F:' ? casillero.salto.slice(2) : casillero.salto) as IdVariable] != null ?
|
|
1171
|
+
Button2({
|
|
1172
|
+
className: "boton-deshacer-listo",
|
|
1173
|
+
color: "default",
|
|
1174
|
+
variant: "outlined",
|
|
1175
|
+
style: { marginLeft: '8px' },
|
|
1176
|
+
children: [
|
|
1177
|
+
"Deshacer Listo",
|
|
1178
|
+
html.svg({ focusable: false, viewbox: "0 0 24 24", "aria-hidden": "true", style: styleToCss({ marginLeft: '4px', height: '20px', verticalAlign: 'middle' }) }, [
|
|
1179
|
+
html.path({ d: materialIoIconsSvgPath.DeleteForever, style: styleToCss({ fill: 'currentColor' }) })
|
|
1180
|
+
]),
|
|
1181
|
+
],
|
|
1182
|
+
onClick: () => {
|
|
1183
|
+
var armoNomSalto = casillero.salto!.substring(0, 2) == 'F:' ? casillero.salto!.slice(2) : casillero.salto!;
|
|
1184
|
+
var BF_varname_agregar = '$B.F:' + armoNomSalto + '_agregar' as IdVariable;
|
|
1185
|
+
var BF_varname_listo = '$B.F:' + armoNomSalto as IdVariable;
|
|
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 });
|
|
1188
|
+
if (casillero.expresion_habilitar) {
|
|
1189
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: casillero.expresion_habilitar as IdVariable, respuesta: null as unknown as Valor });
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
})
|
|
1193
|
+
: null)
|
|
1139
1194
|
]),
|
|
1140
|
-
(defBoton.num !== false && !defBoton.esAgregar && !defBoton.esConfirmar?
|
|
1141
|
-
(casillero.especial?.camposResumen??[/*defBoton.num.toString()*/]).map(
|
|
1142
|
-
(campo:string)=>html.td(respuestasAumentadas[formularioAAbrir.unidad_analisis][defBoton.num-1][campo as IdVariable])
|
|
1195
|
+
(defBoton.num !== false && !defBoton.esAgregar && !defBoton.esConfirmar ?
|
|
1196
|
+
(casillero.especial?.camposResumen ?? [/*defBoton.num.toString()*/]).map(
|
|
1197
|
+
(campo: string) => html.td(respuestasAumentadas[formularioAAbrir.unidad_analisis][defBoton.num - 1][campo as IdVariable])
|
|
1143
1198
|
)
|
|
1144
|
-
|
|
1199
|
+
: null)
|
|
1145
1200
|
// html.div({class:'inline-dialog', $attrs:{"inline-dialog-open": confirmarForzarIr == defBoton.num?'visible':'hidden'}},[ ])
|
|
1146
|
-
|
|
1201
|
+
|
|
1147
1202
|
/*
|
|
1148
1203
|
{defBoton.esAgregar?<> <span> </span> <Button
|
|
1149
1204
|
variant="outlined"
|
|
@@ -1156,38 +1211,38 @@ var botonFormularioConResumen = (
|
|
|
1156
1211
|
]).create()
|
|
1157
1212
|
}
|
|
1158
1213
|
|
|
1159
|
-
var buscarHnosFormulario = (idFormularioDestino:IdFormulario)=>{
|
|
1214
|
+
var buscarHnosFormulario = (idFormularioDestino: IdFormulario) => {
|
|
1160
1215
|
var estructura = getEstructura();
|
|
1161
1216
|
var ua = estructura.formularios[idFormularioDestino].casilleros.unidad_analisis;
|
|
1162
1217
|
return likeAr(estructura.formularios)
|
|
1163
|
-
.filter((infoFormulario:InfoFormulario, idForm:IdFormulario)=>
|
|
1218
|
+
.filter((infoFormulario: InfoFormulario, idForm: IdFormulario) =>
|
|
1164
1219
|
infoFormulario.casilleros.unidad_analisis == ua
|
|
1165
|
-
).map((_infoFormulario:InfoFormulario, idForm:IdFormulario)=>
|
|
1220
|
+
).map((_infoFormulario: InfoFormulario, idForm: IdFormulario) =>
|
|
1166
1221
|
idForm
|
|
1167
1222
|
).array()
|
|
1168
1223
|
}
|
|
1169
1224
|
|
|
1170
|
-
var checkFormsVacios = (forms:IdFormulario[], feedbackAll:{
|
|
1171
|
-
[formulario in PlainForPk]:FormStructureState<IdVariable, Valor, IdFin> // resultado del rowValidator para estado.forPk
|
|
1172
|
-
}, forPk:ForPk)=>{
|
|
1173
|
-
return forms.filter((form:IdFormulario)=>{
|
|
1174
|
-
let myforPk={...forPk, formulario:form};
|
|
1225
|
+
var checkFormsVacios = (forms: IdFormulario[], feedbackAll: {
|
|
1226
|
+
[formulario in PlainForPk]: FormStructureState<IdVariable, Valor, IdFin> // resultado del rowValidator para estado.forPk
|
|
1227
|
+
}, forPk: ForPk) => {
|
|
1228
|
+
return forms.filter((form: IdFormulario) => {
|
|
1229
|
+
let myforPk = { ...forPk, formulario: form };
|
|
1175
1230
|
var feedback = feedbackAll[toPlainForPk(myforPk)];
|
|
1176
1231
|
return feedback.resumen != 'vacio'
|
|
1177
1232
|
}).length == 0
|
|
1178
1233
|
}
|
|
1179
1234
|
|
|
1180
|
-
function BotonFormularioDespliegue(props:{casillero:BotonFormulario, formulario:Formulario, forPk:ForPk}){
|
|
1181
|
-
var {casillero, forPk} = props;
|
|
1182
|
-
var habilitador = casillero.expresion_habilitar_js?getFuncionHabilitar(casillero.expresion_habilitar_js):()=>true;
|
|
1183
|
-
var {opciones} = useSelectorVivienda(forPk);
|
|
1235
|
+
function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formulario: Formulario, forPk: ForPk }) {
|
|
1236
|
+
var { casillero, forPk } = props;
|
|
1237
|
+
var habilitador = casillero.expresion_habilitar_js ? getFuncionHabilitar(casillero.expresion_habilitar_js) : () => true;
|
|
1238
|
+
var { opciones } = useSelectorVivienda(forPk);
|
|
1184
1239
|
//var idFormularioDestino = 'F:'+casillero.salto! as IdFormulario; //original
|
|
1185
|
-
var armoNomSalto=casillero.salto?.substring(0,2)=='F:'?casillero.salto.slice(2):casillero.salto;
|
|
1240
|
+
var armoNomSalto = casillero.salto?.substring(0, 2) == 'F:' ? casillero.salto.slice(2) : casillero.salto;
|
|
1186
1241
|
//console.log('BotonFormularioDespliegue armoNomSalto ' +armoNomSalto);
|
|
1187
|
-
var idFormularioDestino = 'F:'+armoNomSalto! as IdFormulario;
|
|
1242
|
+
var idFormularioDestino = 'F:' + armoNomSalto! as IdFormulario;
|
|
1188
1243
|
var estructura = getEstructura();
|
|
1189
|
-
var {formularioAAbrir} = useSelector((_state:CasoState)=>({
|
|
1190
|
-
formularioAAbrir:estructura.formularios[idFormularioDestino].casilleros,
|
|
1244
|
+
var { formularioAAbrir } = useSelector((_state: CasoState) => ({
|
|
1245
|
+
formularioAAbrir: estructura.formularios[idFormularioDestino].casilleros,
|
|
1191
1246
|
}));
|
|
1192
1247
|
var sufijoIdElemento = toPlainForPk(forPk);
|
|
1193
1248
|
/*
|
|
@@ -1205,272 +1260,294 @@ function BotonFormularioDespliegue(props:{casillero:BotonFormulario, formulario:
|
|
|
1205
1260
|
});
|
|
1206
1261
|
*/
|
|
1207
1262
|
const dispatch = useDispatch();
|
|
1208
|
-
var [confirmarForzarIr, setConfirmarForzarIr] = useState<DefinicionFormularioAbrir|false|null>(null);
|
|
1209
|
-
var multipleFormularios=formularioAAbrir.unidad_analisis != props.formulario.unidad_analisis;
|
|
1263
|
+
var [confirmarForzarIr, setConfirmarForzarIr] = useState<DefinicionFormularioAbrir | false | null>(null);
|
|
1264
|
+
var multipleFormularios = formularioAAbrir.unidad_analisis != props.formulario.unidad_analisis;
|
|
1210
1265
|
var nuevoCampoPk = defOperativo.defUA[formularioAAbrir.unidad_analisis].pk;
|
|
1211
|
-
|
|
1212
|
-
var var_name='$B.F:'+armoNomSalto;
|
|
1213
|
-
var idSeccion
|
|
1214
|
-
var idButton
|
|
1266
|
+
// var var_name='$B.'+casillero.salto; //original
|
|
1267
|
+
var var_name = '$B.F:' + armoNomSalto;
|
|
1268
|
+
var idSeccion = `seccion-boton-formulario-${var_name}`;
|
|
1269
|
+
var idButton = `special-button-${idSeccion}`;
|
|
1270
|
+
var var_name_registro = multipleFormularios ? (var_name + '_agregar' as IdVariable) : (var_name as IdVariable);
|
|
1215
1271
|
registrarElemento<HTMLDivElement>({
|
|
1216
|
-
id:idSeccion,
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
var
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1272
|
+
id: idSeccion,
|
|
1273
|
+
variable: var_name_registro,
|
|
1274
|
+
forPk: forPk,
|
|
1275
|
+
direct: true,
|
|
1276
|
+
fun: (respuestasAumentadas: Respuestas, feedbackRow: FormStructureState<IdVariable, Valor, IdFin>, div: HTMLDivElement,
|
|
1277
|
+
feedbackAll: {
|
|
1278
|
+
[formulario in PlainForPk]: FormStructureState<IdVariable, Valor, IdFin> // resultado del rowValidator para estado.forPk
|
|
1279
|
+
}
|
|
1280
|
+
) => {
|
|
1281
|
+
try {
|
|
1282
|
+
var estado_listo = feedbackRow.feedback['$B.F:' + armoNomSalto as IdVariable]?.estado || 'valida';
|
|
1283
|
+
var estado_agregar = multipleFormularios ? (feedbackRow.feedback['$B.F:' + armoNomSalto + '_agregar' as IdVariable]?.estado || 'valida') : 'valida';
|
|
1284
|
+
var estado_general = estado_agregar !== 'valida' ? estado_agregar : estado_listo;
|
|
1285
|
+
setAttrDistinto(div, 'nuestro-validator', estado_general);
|
|
1286
|
+
setAttrDistinto(div, 'tiene-valor', estado_general === 'valida' ? 'valido' : 'NO');
|
|
1287
|
+
|
|
1288
|
+
var listaDeBotonesAbrir: DefinicionFormularioAbrir[] = [];
|
|
1289
|
+
// var esVarActual = feedbackRow.actual == '$B.F:'+casillero.salto; //original
|
|
1290
|
+
var esVarActual = !!feedbackRow.actual?.startsWith('$B.F:' + armoNomSalto);
|
|
1291
|
+
// console.log('BotonFormularioDespliegue esVarActual ' +esVarActual );
|
|
1292
|
+
if (multipleFormularios && casillero.salto != null) {
|
|
1293
|
+
// let defFormulario:InfoFormulario = estructura.formularios['F:'+casillero.salto as IdFormulario]; //original
|
|
1294
|
+
let defFormulario: InfoFormulario = estructura.formularios['F:' + armoNomSalto as IdFormulario];
|
|
1231
1295
|
let defUA = estructura.unidades_analisis[defFormulario.casilleros.unidad_analisis!];
|
|
1232
1296
|
let conjunto = respuestasAumentadas[defFormulario.casilleros.unidad_analisis!];
|
|
1233
1297
|
let cantidadEsperada = respuestasAumentadas[casillero.expresion_habilitar as IdVariable];
|
|
1234
|
-
var numActual:number|null = null;
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
var configSorteoFormulario = estructura.configSorteo?estructura.configSorteo[getMainFormForVivienda(forPk[estructura.pkAgregadaUaPpal])]:null
|
|
1298
|
+
var numActual: number | null = null;
|
|
1299
|
+
// var estadoDelBoton = feedbackRow.feedback['$B.F:'+casillero.salto as IdVariable].estado //original
|
|
1300
|
+
var estadoDelBoton = feedbackRow.feedback['$B.F:' + armoNomSalto as IdVariable].estado
|
|
1301
|
+
// console.log('BotonFormularioDespliegue estadoDelBoton ' +estadoDelBoton );
|
|
1302
|
+
var configSorteoFormulario = estructura.configSorteo ? estructura.configSorteo[getMainFormForVivienda(forPk[estructura.pkAgregadaUaPpal])] : null
|
|
1239
1303
|
var habilitacionBotonFormulario = estructura.habilitacionBotonFormulario;
|
|
1240
|
-
listaDeBotonesAbrir = likeAr(conjunto).map((_, i)=>{
|
|
1241
|
-
let num:number = numberOrStringIncIfArray(i, conjunto) as number;
|
|
1242
|
-
let forPk={...props.forPk, formulario:idFormularioDestino, [nuevoCampoPk]:num};
|
|
1304
|
+
listaDeBotonesAbrir = likeAr(conjunto).map((_, i) => {
|
|
1305
|
+
let num: number = numberOrStringIncIfArray(i, conjunto) as number;
|
|
1306
|
+
let forPk = { ...props.forPk, formulario: idFormularioDestino, [nuevoCampoPk]: num };
|
|
1243
1307
|
var formHnos = buscarHnosFormulario(idFormularioDestino)
|
|
1244
1308
|
var feedback = feedbackAll[toPlainForPk(forPk)];
|
|
1245
|
-
if(numActual == null && feedback.resumen == "vacio" && estadoDelBoton =='valida'){
|
|
1309
|
+
if (numActual == null && feedback.resumen == "vacio" && estadoDelBoton == 'valida') {
|
|
1246
1310
|
numActual = num;
|
|
1247
1311
|
}
|
|
1248
1312
|
return {
|
|
1249
|
-
forPk,
|
|
1250
|
-
resumen:null,
|
|
1251
|
-
num,
|
|
1313
|
+
forPk,
|
|
1314
|
+
resumen: null,
|
|
1315
|
+
num,
|
|
1252
1316
|
actual: calcularActualBF(configSorteoFormulario, num, numActual, idFormularioDestino, respuestasAumentadas),
|
|
1253
|
-
previo: numActual == null,
|
|
1254
|
-
permiteBorrar: likeAr(conjunto).array().length == Number(i) + 1 &&
|
|
1317
|
+
previo: numActual == null,
|
|
1318
|
+
permiteBorrar: likeAr(conjunto).array().length == Number(i) + 1 &&
|
|
1255
1319
|
checkFormsVacios(formHnos, feedbackAll, forPk) &&
|
|
1256
|
-
calcularPermiteBorrarBF(configSorteoFormulario,idFormularioDestino),
|
|
1320
|
+
calcularPermiteBorrarBF(configSorteoFormulario, idFormularioDestino),
|
|
1257
1321
|
disabled: calcularDisabledBF(configSorteoFormulario, habilitacionBotonFormulario, num, idFormularioDestino, respuestasAumentadas)
|
|
1258
1322
|
}
|
|
1259
1323
|
}).array();
|
|
1260
|
-
if("puede agregar //TODO VER ESTO" && (conjunto instanceof Array || conjunto == null)){
|
|
1261
|
-
let nuevoValorPk=(conjunto==null ? 0 : conjunto.length) + 1;
|
|
1262
|
-
let forPk={...props.forPk, formulario:idFormularioDestino, [nuevoCampoPk]:nuevoValorPk};
|
|
1263
|
-
let debeAgregarOlisto = numActual == null && (cantidadEsperada == null || cantidadEsperada != (conjunto !=null && conjunto.length))
|
|
1264
|
-
&& (estadoDelBoton =='valida' || esVarActual);
|
|
1324
|
+
if ("puede agregar //TODO VER ESTO" && (conjunto instanceof Array || conjunto == null)) {
|
|
1325
|
+
let nuevoValorPk = (conjunto == null ? 0 : conjunto.length) + 1;
|
|
1326
|
+
let forPk = { ...props.forPk, formulario: idFormularioDestino, [nuevoCampoPk]: nuevoValorPk };
|
|
1327
|
+
let debeAgregarOlisto = numActual == null && (cantidadEsperada == null || cantidadEsperada != (conjunto != null && conjunto.length))
|
|
1328
|
+
&& (estadoDelBoton == 'valida' || esVarActual);
|
|
1265
1329
|
listaDeBotonesAbrir.push({
|
|
1266
|
-
forPk,
|
|
1267
|
-
num:nuevoValorPk,
|
|
1268
|
-
esAgregar:true,
|
|
1269
|
-
actual:debeAgregarOlisto,
|
|
1270
|
-
previo: false,
|
|
1330
|
+
forPk,
|
|
1331
|
+
num: nuevoValorPk,
|
|
1332
|
+
esAgregar: true,
|
|
1333
|
+
actual: debeAgregarOlisto,
|
|
1334
|
+
previo: false,
|
|
1271
1335
|
disabled: calcularDisabledBFAgregarListo(configSorteoFormulario, habilitacionBotonFormulario, idFormularioDestino)
|
|
1272
1336
|
});
|
|
1273
1337
|
listaDeBotonesAbrir.push({
|
|
1274
|
-
forPk,
|
|
1275
|
-
num:nuevoValorPk - 1,
|
|
1276
|
-
esConfirmar:true,
|
|
1277
|
-
actual:debeAgregarOlisto
|
|
1278
|
-
previo: false,
|
|
1338
|
+
forPk,
|
|
1339
|
+
num: nuevoValorPk - 1,
|
|
1340
|
+
esConfirmar: true,
|
|
1341
|
+
actual: debeAgregarOlisto,
|
|
1342
|
+
previo: false,
|
|
1279
1343
|
disabled: calcularDisabledBFAgregarListo(configSorteoFormulario, habilitacionBotonFormulario, idFormularioDestino)
|
|
1280
1344
|
});
|
|
1281
1345
|
}
|
|
1282
|
-
}else{
|
|
1283
|
-
let forPk={...props.forPk, formulario:idFormularioDestino};
|
|
1284
|
-
listaDeBotonesAbrir = [{forPk, num:false, unico:true, actual:esVarActual, previo:true}]
|
|
1346
|
+
} else {
|
|
1347
|
+
let forPk = { ...props.forPk, formulario: idFormularioDestino };
|
|
1348
|
+
listaDeBotonesAbrir = [{ forPk, num: false, unico: true, actual: esVarActual, previo: true }]
|
|
1285
1349
|
}
|
|
1286
|
-
var todosLosBotones = listaDeBotonesAbrir.map(defBoton=>
|
|
1287
|
-
botonFormularioConResumen(defBoton, feedbackAll[toPlainForPk(defBoton.forPk)]??{resumen:'vacio'}, respuestasAumentadas,
|
|
1350
|
+
var todosLosBotones = listaDeBotonesAbrir.map(defBoton =>
|
|
1351
|
+
botonFormularioConResumen(defBoton, feedbackAll[toPlainForPk(defBoton.forPk)] ?? { resumen: 'vacio' }, respuestasAumentadas,
|
|
1288
1352
|
casillero, props.forPk, idButton, formularioAAbrir
|
|
1289
1353
|
)
|
|
1290
1354
|
)
|
|
1291
|
-
let nombresCamposResumen = likeAr((casillero.especial?.camposResumen||[])).array().map(c=>c);
|
|
1292
|
-
var htmlSeccion=document.getElementById(idSeccion)!;
|
|
1293
|
-
htmlSeccion.innerHTML="";
|
|
1294
|
-
htmlSeccion.appendChild(html.table({class
|
|
1355
|
+
let nombresCamposResumen = likeAr((casillero.especial?.camposResumen || [])).array().map(c => c);
|
|
1356
|
+
var htmlSeccion = document.getElementById(idSeccion)!;
|
|
1357
|
+
htmlSeccion.innerHTML = "";
|
|
1358
|
+
htmlSeccion.appendChild(html.table({ class: `table table-striped ${nombresCamposResumen.length ? 'w-auto' : ''}` }, [
|
|
1295
1359
|
html.thead([
|
|
1296
1360
|
html.tr([
|
|
1297
|
-
casillero.aclaracion?html.th():null,
|
|
1361
|
+
casillero.aclaracion ? html.th() : null,
|
|
1298
1362
|
html.th(casillero.nombre),
|
|
1299
|
-
nombresCamposResumen.map((nombreCampo)=>html.th(nombreCampo)),
|
|
1363
|
+
nombresCamposResumen.map((nombreCampo) => html.th(nombreCampo)),
|
|
1300
1364
|
])
|
|
1301
1365
|
]),
|
|
1302
1366
|
html.tbody([
|
|
1303
1367
|
todosLosBotones
|
|
1304
1368
|
])
|
|
1305
1369
|
]).create());
|
|
1306
|
-
}catch(err){
|
|
1370
|
+
} catch (err) {
|
|
1307
1371
|
var error = unexpected(err);
|
|
1308
1372
|
console.log("entra al catch")
|
|
1309
|
-
div.textContent='esto, FALLÉ '+error.message;
|
|
1373
|
+
div.textContent = 'esto, FALLÉ ' + error.message;
|
|
1310
1374
|
}
|
|
1311
1375
|
}
|
|
1312
1376
|
});
|
|
1313
|
-
const ir = (defBoton:DefinicionFormularioAbrir)=>{
|
|
1314
|
-
if(!casillero.salto){
|
|
1315
|
-
opciones.modoDirecto?
|
|
1377
|
+
const ir = (defBoton: DefinicionFormularioAbrir) => {
|
|
1378
|
+
if (!casillero.salto) {
|
|
1379
|
+
opciones.modoDirecto ?
|
|
1316
1380
|
null
|
|
1317
|
-
|
|
1381
|
+
:
|
|
1318
1382
|
dispatch(dispatchers.VOLVER_HDR({}));
|
|
1319
|
-
}else{
|
|
1320
|
-
var nuevaForPk={...forPk, formulario:idFormularioDestino};
|
|
1321
|
-
|
|
1383
|
+
} else {
|
|
1384
|
+
var nuevaForPk = { ...forPk, formulario: idFormularioDestino };
|
|
1385
|
+
var BF_varname = '$B.F:' + armoNomSalto as IdVariable;
|
|
1386
|
+
if (multipleFormularios) {
|
|
1322
1387
|
// @ts-ignore forPk y sus componentes
|
|
1323
1388
|
nuevaForPk[nuevoCampoPk] = defBoton.num
|
|
1324
|
-
if(defBoton.esAgregar){
|
|
1325
|
-
dispatchByPass(accion_agregar_formulario,{forPk:nuevaForPk});
|
|
1326
|
-
|
|
1327
|
-
dispatchByPass(
|
|
1389
|
+
if (defBoton.esAgregar) {
|
|
1390
|
+
dispatchByPass(accion_agregar_formulario, { forPk: nuevaForPk });
|
|
1391
|
+
var BF_varname_agregar = '$B.F:' + armoNomSalto + '_agregar' as IdVariable;
|
|
1392
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: BF_varname_agregar, respuesta: 1 as Valor });
|
|
1393
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: BF_varname, respuesta: null as unknown as Valor });
|
|
1394
|
+
if (casillero.expresion_habilitar) {
|
|
1395
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: casillero.expresion_habilitar as IdVariable, respuesta: null as unknown as Valor });
|
|
1396
|
+
}
|
|
1397
|
+
} else {
|
|
1398
|
+
dispatchByPass(accion_abrir_formulario, { forPk: nuevaForPk });
|
|
1399
|
+
// 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: BF_varname, respuesta: null as unknown as Valor });
|
|
1328
1401
|
}
|
|
1402
|
+
} else {
|
|
1403
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: BF_varname, respuesta: 1 as Valor });
|
|
1329
1404
|
}
|
|
1330
|
-
dispatch(dispatchers.CAMBIAR_FORMULARIO({forPk:nuevaForPk, apilarVuelta:true}));
|
|
1405
|
+
dispatch(dispatchers.CAMBIAR_FORMULARIO({ forPk: nuevaForPk, apilarVuelta: true }));
|
|
1331
1406
|
}
|
|
1332
|
-
if(confirmarForzarIr){setConfirmarForzarIr(false)}
|
|
1407
|
+
if (confirmarForzarIr) { setConfirmarForzarIr(false) }
|
|
1333
1408
|
};
|
|
1334
1409
|
return <DesplegarCasillero casillero={casillero}>
|
|
1410
|
+
{multipleFormularios && <span id={'var-' + var_name + '_agregar'} style={{ position: 'absolute', marginTop: '-60px' }}></span>}
|
|
1411
|
+
<span id={'var-' + var_name} style={{ position: 'absolute', marginTop: '-60px' }}></span>
|
|
1335
1412
|
<div id={idSeccion}>
|
|
1336
1413
|
</div>
|
|
1337
1414
|
<Button className="special-button" id={idButton}
|
|
1338
|
-
onClick={(event)=>{
|
|
1415
|
+
onClick={(event) => {
|
|
1339
1416
|
ir(JSON.parse((event.target! as unknown as HTMLButtonElement).getAttribute('def-button')!))
|
|
1340
1417
|
}}
|
|
1341
1418
|
>ir (interno)</Button>
|
|
1342
|
-
<Dialog
|
|
1419
|
+
<Dialog
|
|
1343
1420
|
className="nuestro-dialogo"
|
|
1344
1421
|
open={!!confirmarForzarIr}
|
|
1345
|
-
onClose={()=>setConfirmarForzarIr(null)}
|
|
1422
|
+
onClose={() => setConfirmarForzarIr(null)}
|
|
1346
1423
|
>
|
|
1347
1424
|
<div className="nuestro-dialogo">
|
|
1348
1425
|
<Typography>No se puede avanzar al siguiente formulario.</Typography>
|
|
1349
1426
|
<Typography>Quizás no terminó de contestar las preguntas correspondientes</Typography>
|
|
1350
1427
|
<Typography>Quizás no corresponde en base a las respuestas obtenidas</Typography>
|
|
1351
1428
|
</div>
|
|
1352
|
-
<Button color="secondary" onClick={()=>confirmarForzarIr && ir(confirmarForzarIr)}>forzar</Button>
|
|
1353
|
-
<Button color="primary" variant="contained" onClick={()=>setConfirmarForzarIr(null)}>Entendido</Button>
|
|
1429
|
+
<Button color="secondary" onClick={() => confirmarForzarIr && ir(confirmarForzarIr)}>forzar</Button>
|
|
1430
|
+
<Button color="primary" variant="contained" onClick={() => setConfirmarForzarIr(null)}>Entendido</Button>
|
|
1354
1431
|
</Dialog>
|
|
1355
1432
|
</DesplegarCasillero>
|
|
1356
1433
|
}
|
|
1357
1434
|
|
|
1358
|
-
function CasilleroDesconocido(props:{casillero:CasilleroBase, forPk:ForPk}){
|
|
1359
|
-
return <DesplegarCasillero
|
|
1435
|
+
function CasilleroDesconocido(props: { casillero: CasilleroBase, forPk: ForPk }) {
|
|
1436
|
+
return <DesplegarCasillero
|
|
1360
1437
|
id={`casillerodesconocido-${props.casillero.id_casillero}`}
|
|
1361
1438
|
casillero={props.casillero as Bloque}
|
|
1362
|
-
style={{display:'none'}}
|
|
1439
|
+
style={{ display: 'none' }}
|
|
1363
1440
|
>
|
|
1364
1441
|
<Typography>Tipo de casillero no implementado: "{props.casillero.tipoc}" para "{props.casillero.casillero}"</Typography>
|
|
1365
|
-
<EncabezadoDespliegue casillero={props.casillero as CasilleroEncabezable} leer={false} forPk={props.forPk}/>
|
|
1442
|
+
<EncabezadoDespliegue casillero={props.casillero as CasilleroEncabezable} leer={false} forPk={props.forPk} />
|
|
1366
1443
|
</DesplegarCasillero>
|
|
1367
1444
|
}
|
|
1368
1445
|
|
|
1369
|
-
function useSelectorVivienda(forPk:ForPk){
|
|
1370
|
-
return useSelector((state:CasoState)=>{
|
|
1446
|
+
function useSelectorVivienda(forPk: ForPk) {
|
|
1447
|
+
return useSelector((state: CasoState) => {
|
|
1371
1448
|
var estructura = getEstructura();
|
|
1372
1449
|
return {
|
|
1373
1450
|
formulario: estructura.formularios[forPk.formulario].casilleros,
|
|
1374
|
-
modoDespliegue: true || state.modo.demo?state.opciones.modoDespliegue:'relevamiento',
|
|
1451
|
+
modoDespliegue: true || state.modo.demo ? state.opciones.modoDespliegue : 'relevamiento',
|
|
1375
1452
|
modo: state.modo,
|
|
1376
1453
|
opciones: state.opciones,
|
|
1377
1454
|
}
|
|
1378
1455
|
})
|
|
1379
1456
|
}
|
|
1380
1457
|
|
|
1381
|
-
function ConjuntoPreguntasDespliegue(props:{casillero:ConjuntoPreguntas, formulario:Formulario, forPk:ForPk}){
|
|
1382
|
-
let {casillero, forPk} = props;
|
|
1458
|
+
function ConjuntoPreguntasDespliegue(props: { casillero: ConjuntoPreguntas, formulario: Formulario, forPk: ForPk }) {
|
|
1459
|
+
let { casillero, forPk } = props;
|
|
1383
1460
|
var id = `conjunto-preguntas-${casillero.id_casillero}`;
|
|
1384
1461
|
registrarElemento({
|
|
1385
|
-
id,
|
|
1386
|
-
direct:true,
|
|
1462
|
+
id,
|
|
1463
|
+
direct: true,
|
|
1387
1464
|
fun: registradorDeVariable(casillero)
|
|
1388
1465
|
})
|
|
1389
1466
|
let modoDespliegue = "normal";
|
|
1390
1467
|
let habilitado = true;
|
|
1391
|
-
return habilitado || modoDespliegue=='metadatos'
|
|
1392
|
-
<EncabezadoDespliegue casillero={casillero} forPk={forPk} leer={casillero.leer!==false}/>
|
|
1393
|
-
<DesplegarContenidoInternoBloqueOFormulario bloqueOFormulario={casillero} formulario={props.formulario} forPk={forPk} multiple={false}/>
|
|
1394
|
-
</DesplegarCasillero
|
|
1468
|
+
return habilitado || modoDespliegue == 'metadatos' ? <DesplegarCasillero id={id} casillero={casillero}>
|
|
1469
|
+
<EncabezadoDespliegue casillero={casillero} forPk={forPk} leer={casillero.leer !== false} />
|
|
1470
|
+
<DesplegarContenidoInternoBloqueOFormulario bloqueOFormulario={casillero} formulario={props.formulario} forPk={forPk} multiple={false} />
|
|
1471
|
+
</DesplegarCasillero> : null;
|
|
1395
1472
|
}
|
|
1396
1473
|
|
|
1397
|
-
function DesplegarContenidoInternoBloqueOFormulario(props:{bloqueOFormulario:Bloque|Formulario|ConjuntoPreguntas, formulario:Formulario, forPk:ForPk, multiple:boolean}){
|
|
1398
|
-
var parcializable = props.bloqueOFormulario.tipoc=='F';
|
|
1474
|
+
function DesplegarContenidoInternoBloqueOFormulario(props: { bloqueOFormulario: Bloque | Formulario | ConjuntoPreguntas, formulario: Formulario, forPk: ForPk, multiple: boolean }) {
|
|
1475
|
+
var parcializable = props.bloqueOFormulario.tipoc == 'F';
|
|
1399
1476
|
const [verTodo, setVerTodo] = useState(!parcializable);
|
|
1400
|
-
const [forPkActual, setForPkActual] = useState<IdCasillero|null>(null);
|
|
1401
|
-
if(parcializable){
|
|
1402
|
-
if(forPkActual != props.bloqueOFormulario.casillero){
|
|
1477
|
+
const [forPkActual, setForPkActual] = useState<IdCasillero | null>(null);
|
|
1478
|
+
if (parcializable) {
|
|
1479
|
+
if (forPkActual != props.bloqueOFormulario.casillero) {
|
|
1403
1480
|
setVerTodo(false)
|
|
1404
1481
|
setForPkActual(props.bloqueOFormulario.casillero)
|
|
1405
1482
|
}
|
|
1406
|
-
useEffect(()=>{
|
|
1407
|
-
var timer = setTimeout(()=>{
|
|
1483
|
+
useEffect(() => {
|
|
1484
|
+
var timer = setTimeout(() => {
|
|
1408
1485
|
setVerTodo(true);
|
|
1409
|
-
},250)
|
|
1410
|
-
return ()=>{
|
|
1411
|
-
if(timer){
|
|
1486
|
+
}, 250)
|
|
1487
|
+
return () => {
|
|
1488
|
+
if (timer) {
|
|
1412
1489
|
clearTimeout(timer);
|
|
1413
1490
|
}
|
|
1414
1491
|
}
|
|
1415
1492
|
})
|
|
1416
1493
|
}
|
|
1417
1494
|
const limiteNoVerTodo = 3;
|
|
1418
|
-
useEffect(()=>{
|
|
1419
|
-
if(props.bloqueOFormulario.tipoc=='F'){
|
|
1495
|
+
useEffect(() => {
|
|
1496
|
+
if (props.bloqueOFormulario.tipoc == 'F') {
|
|
1420
1497
|
volcadoInicialElementosRegistrados(props.forPk);
|
|
1421
1498
|
}
|
|
1422
|
-
},[toPlainForPk(props.forPk),verTodo])
|
|
1499
|
+
}, [toPlainForPk(props.forPk), verTodo])
|
|
1423
1500
|
useEffect(() => {
|
|
1424
|
-
if(props.bloqueOFormulario.tipoc=='F' && verTodo){
|
|
1425
|
-
var {siguienteVariable, variableActual} = dispatchByPass(accion_registrar_respuesta, {respuesta:null, variable:NO_CAMBIAR__SOLO_TRAER_STATUS, forPk:props.forPk});
|
|
1426
|
-
if(variableActual || siguienteVariable){
|
|
1427
|
-
enfocarElementoDeVariable(coalesce(variableActual as string|null,siguienteVariable as string|null) as IdVariable)
|
|
1428
|
-
}else{
|
|
1501
|
+
if (props.bloqueOFormulario.tipoc == 'F' && verTodo) {
|
|
1502
|
+
var { siguienteVariable, variableActual } = dispatchByPass(accion_registrar_respuesta, { respuesta: null, variable: NO_CAMBIAR__SOLO_TRAER_STATUS, forPk: props.forPk });
|
|
1503
|
+
if (variableActual || siguienteVariable) {
|
|
1504
|
+
enfocarElementoDeVariable(coalesce(variableActual as string | null, siguienteVariable as string | null) as IdVariable)
|
|
1505
|
+
} else {
|
|
1429
1506
|
var feedbackRowValidator = getFeedbackRowValidator()
|
|
1430
|
-
if(feedbackRowValidator[toPlainForPk(props.forPk)].resumen=='ok'){
|
|
1507
|
+
if (feedbackRowValidator[toPlainForPk(props.forPk)].resumen == 'ok') {
|
|
1431
1508
|
scrollToTop()
|
|
1432
|
-
}else{
|
|
1509
|
+
} else {
|
|
1433
1510
|
scrollToTop()
|
|
1434
1511
|
}
|
|
1435
1512
|
}
|
|
1436
1513
|
}
|
|
1437
1514
|
});
|
|
1438
1515
|
return <div className="contenido">
|
|
1439
|
-
{verTodo?null
|
|
1440
|
-
{props.bloqueOFormulario.casilleros.map((casillero, i)=>{
|
|
1441
|
-
var key = casillero.tipoc+'-'+casillero.id_casillero+'-'+i;
|
|
1442
|
-
return (verTodo || i < limiteNoVerTodo?
|
|
1516
|
+
{verTodo ? null : <div style={{ height: "500px", textAlign: 'center', verticalAlign: 'middle', width: '100%', position: "fixed", backgroundColor: 'rgba(100,100,100,0.3)', fontSize: '200%' }} >cargando...</div>}
|
|
1517
|
+
{props.bloqueOFormulario.casilleros.map((casillero, i) => {
|
|
1518
|
+
var key = casillero.tipoc + '-' + casillero.id_casillero + '-' + i;
|
|
1519
|
+
return (verTodo || i < limiteNoVerTodo ?
|
|
1443
1520
|
(
|
|
1444
|
-
casillero.tipoc == "P"
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1521
|
+
casillero.tipoc == "P" ? <PreguntaDespliegue key={key} pregunta={casillero} forPk={props.forPk} despliegueEncabezado={casillero.despliegueEncabezado ?? (props.bloqueOFormulario.tipoc == 'CP' ? 'lateral' : 'superior')} /> :
|
|
1522
|
+
casillero.tipoc == "B" ? <BloqueDespliegue key={key} bloque={casillero} formulario={props.formulario} forPk={props.forPk} /> :
|
|
1523
|
+
casillero.tipoc == "FILTRO" ? <FiltroDespliegue key={key} filtro={casillero} forPk={props.forPk} /> :
|
|
1524
|
+
casillero.tipoc == "BF" ? <BotonFormularioDespliegue key={key} casillero={casillero} formulario={props.formulario} forPk={props.forPk} /> :
|
|
1525
|
+
casillero.tipoc == "CONS" ? <ConsistenciaDespliegue key={key} casillero={casillero} forPk={props.forPk} /> :
|
|
1526
|
+
casillero.tipoc == "CP" ? <ConjuntoPreguntasDespliegue key={key} casillero={casillero} formulario={props.formulario} forPk={props.forPk} /> :
|
|
1527
|
+
casillero.tipoc == "TEXTO" ? <TextoDespliegue key={key} casillero={casillero} forPk={props.forPk} /> :
|
|
1528
|
+
casillero.tipoc == "PMATRIZ" ? <PMatrizDespliegue key={key} casillero={casillero} forPk={props.forPk} /> :
|
|
1529
|
+
casillero.tipoc == "LIBRE" ? <LibreDespliegue key={key} casillero={casillero} formulario={props.formulario} forPk={props.forPk} /> :
|
|
1530
|
+
<CasilleroDesconocido key={key} casillero={casillero} forPk={props.forPk} />
|
|
1454
1531
|
)
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1532
|
+
: i == limiteNoVerTodo ?
|
|
1533
|
+
<div key='$spinner' className="spinner-border" role="status">
|
|
1534
|
+
<span>cargando bloque...</span>
|
|
1535
|
+
</div>
|
|
1536
|
+
: null
|
|
1460
1537
|
)
|
|
1461
1538
|
})
|
|
1462
|
-
|
|
1539
|
+
}</div>
|
|
1463
1540
|
}
|
|
1464
1541
|
|
|
1465
|
-
function BloqueDespliegue(props:{bloque:Bloque, formulario:Formulario, forPk:ForPk}){
|
|
1466
|
-
var {bloque, forPk} = props;
|
|
1467
|
-
var key=bloque.ver_id!='-' && bloque.ver_id || bloque.casillero;
|
|
1468
|
-
var activeStep=0;
|
|
1542
|
+
function BloqueDespliegue(props: { bloque: Bloque, formulario: Formulario, forPk: ForPk }) {
|
|
1543
|
+
var { bloque, forPk } = props;
|
|
1544
|
+
var key = bloque.ver_id != '-' && bloque.ver_id || bloque.casillero;
|
|
1545
|
+
var activeStep = 0;
|
|
1469
1546
|
var multiple = !!bloque.unidad_analisis;
|
|
1470
|
-
var lista = [{forPk, key:0, multiple:false}];
|
|
1471
|
-
var habilitador = bloque.expresion_habilitar_js?getFuncionHabilitar(bloque.expresion_habilitar_js):()=>true;
|
|
1472
|
-
var {modoDespliegue} = useSelectorVivienda(forPk);
|
|
1473
|
-
if(multiple){
|
|
1547
|
+
var lista = [{ forPk, key: 0, multiple: false }];
|
|
1548
|
+
var habilitador = bloque.expresion_habilitar_js ? getFuncionHabilitar(bloque.expresion_habilitar_js) : () => true;
|
|
1549
|
+
var { modoDespliegue } = useSelectorVivienda(forPk);
|
|
1550
|
+
if (multiple) {
|
|
1474
1551
|
// TODO: GENERALIZAR
|
|
1475
1552
|
// @ts-ignore
|
|
1476
1553
|
// lista=respuestas.personas.map((_persona, i)=>(
|
|
@@ -1480,75 +1557,75 @@ function BloqueDespliegue(props:{bloque:Bloque, formulario:Formulario, forPk:For
|
|
|
1480
1557
|
var id = `bloque-${bloque.id_casillero}`;
|
|
1481
1558
|
registrarElemento({
|
|
1482
1559
|
id,
|
|
1483
|
-
style:'display',
|
|
1484
|
-
fun: (respuestas:Respuestas)=> habilitador(respuestas) || modoDespliegue=='metadatos'?'unset':'none'
|
|
1560
|
+
style: 'display',
|
|
1561
|
+
fun: (respuestas: Respuestas) => habilitador(respuestas) || modoDespliegue == 'metadatos' ? 'unset' : 'none'
|
|
1485
1562
|
})
|
|
1486
|
-
return <DesplegarCasillero casillero={bloque} nuestro-bloque={bloque.id_casillero} es-multiple={multiple?'SI':'NO'} id={id}>
|
|
1487
|
-
<EncabezadoDespliegue casillero={bloque} forPk={forPk}/>
|
|
1488
|
-
{lista.map(({key, forPk, multiple})=>
|
|
1489
|
-
<DesplegarContenidoInternoBloqueOFormulario key={key} bloqueOFormulario={bloque} formulario={props.formulario} forPk={forPk} multiple={multiple}/>
|
|
1563
|
+
return <DesplegarCasillero casillero={bloque} nuestro-bloque={bloque.id_casillero} es-multiple={multiple ? 'SI' : 'NO'} id={id}>
|
|
1564
|
+
<EncabezadoDespliegue casillero={bloque} forPk={forPk} />
|
|
1565
|
+
{lista.map(({ key, forPk, multiple }) =>
|
|
1566
|
+
<DesplegarContenidoInternoBloqueOFormulario key={key} bloqueOFormulario={bloque} formulario={props.formulario} forPk={forPk} multiple={multiple} />
|
|
1490
1567
|
)}
|
|
1491
1568
|
</DesplegarCasillero>;
|
|
1492
1569
|
}
|
|
1493
1570
|
|
|
1494
1571
|
const FormularioEncabezado = DespliegueEncabezado;
|
|
1495
1572
|
|
|
1496
|
-
function MenuLetra(props:{tamannio:number, denominacion:string}){
|
|
1497
|
-
const cambiarLetra = (tamannio:number)=>{
|
|
1573
|
+
function MenuLetra(props: { tamannio: number, denominacion: string }) {
|
|
1574
|
+
const cambiarLetra = (tamannio: number) => {
|
|
1498
1575
|
var root = document.documentElement;
|
|
1499
|
-
root.style.fontSize=tamannio+"px";
|
|
1576
|
+
root.style.fontSize = tamannio + "px";
|
|
1500
1577
|
}
|
|
1501
1578
|
return <MenuItem
|
|
1502
|
-
onClick={()=>cambiarLetra(props.tamannio)} style={{fontSize:props.tamannio+'px'}}
|
|
1579
|
+
onClick={() => cambiarLetra(props.tamannio)} style={{ fontSize: props.tamannio + 'px' }}
|
|
1503
1580
|
>letra {props.denominacion}</MenuItem>
|
|
1504
1581
|
}
|
|
1505
1582
|
|
|
1506
|
-
function FastSettup(){
|
|
1583
|
+
function FastSettup() {
|
|
1507
1584
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
1508
1585
|
const [open, setOpen] = React.useState(false);
|
|
1509
|
-
const handleClick = (event:any) => {
|
|
1586
|
+
const handleClick = (event: any) => {
|
|
1510
1587
|
setAnchorEl(event.currentTarget);
|
|
1511
1588
|
setOpen((prev) => !prev);
|
|
1512
1589
|
};
|
|
1513
1590
|
const dispatch = useDispatch();
|
|
1514
|
-
const cambiar = (modoDespliegue:ModoDespliegue)=>{
|
|
1515
|
-
dispatch(dispatchers.MODO_DESPLIEGUE({modoDespliegue}));
|
|
1591
|
+
const cambiar = (modoDespliegue: ModoDespliegue) => {
|
|
1592
|
+
dispatch(dispatchers.MODO_DESPLIEGUE({ modoDespliegue }));
|
|
1516
1593
|
setOpen(false)
|
|
1517
1594
|
}
|
|
1518
|
-
const opciones = useSelector((state:CasoState)=>state.opciones)
|
|
1595
|
+
const opciones = useSelector((state: CasoState) => state.opciones)
|
|
1519
1596
|
return <>
|
|
1520
1597
|
<Button onClick={handleClick}>
|
|
1521
|
-
<ICON.Settings/>
|
|
1598
|
+
<ICON.Settings />
|
|
1522
1599
|
</Button>
|
|
1523
|
-
<Menu open={open} anchorEl={anchorEl} onClose={()=>setOpen(false)}>
|
|
1524
|
-
<MenuItem onClick={()=>cambiar("relevamiento")}>normal</MenuItem>
|
|
1525
|
-
<MenuItem onClick={()=>cambiar("PDF"
|
|
1526
|
-
<MenuItem onClick={()=>cambiar("metadatos"
|
|
1527
|
-
<Divider/>
|
|
1528
|
-
<MenuLetra tamannio={12} denominacion
|
|
1529
|
-
<MenuLetra tamannio={14} denominacion
|
|
1530
|
-
<MenuLetra tamannio={16} denominacion
|
|
1531
|
-
<MenuLetra tamannio={19} denominacion
|
|
1532
|
-
<MenuLetra tamannio={22} denominacion
|
|
1533
|
-
<Divider/>
|
|
1600
|
+
<Menu open={open} anchorEl={anchorEl} onClose={() => setOpen(false)}>
|
|
1601
|
+
<MenuItem onClick={() => cambiar("relevamiento")}>normal</MenuItem>
|
|
1602
|
+
<MenuItem onClick={() => cambiar("PDF")}>PDF para relevamiento</MenuItem>
|
|
1603
|
+
<MenuItem onClick={() => cambiar("metadatos")}>revisar metadatos</MenuItem>
|
|
1604
|
+
<Divider />
|
|
1605
|
+
<MenuLetra tamannio={12} denominacion="muy chica" />
|
|
1606
|
+
<MenuLetra tamannio={14} denominacion="chica" />
|
|
1607
|
+
<MenuLetra tamannio={16} denominacion="normal" />
|
|
1608
|
+
<MenuLetra tamannio={19} denominacion="grande" />
|
|
1609
|
+
<MenuLetra tamannio={22} denominacion="enorme" />
|
|
1610
|
+
<Divider />
|
|
1534
1611
|
<MenuItem><label><Checkbox checked={opciones.conCampoOpciones} onChange={
|
|
1535
|
-
()=>dispatch(dispatchers.SET_OPCION({opcion:'conCampoOpciones', valor
|
|
1536
|
-
} inputProps={{ 'aria-label': 'primary checkbox' }}/>campo opciones</label></MenuItem>
|
|
1612
|
+
() => dispatch(dispatchers.SET_OPCION({ opcion: 'conCampoOpciones', valor: !opciones.conCampoOpciones }))
|
|
1613
|
+
} inputProps={{ 'aria-label': 'primary checkbox' }} />campo opciones</label></MenuItem>
|
|
1537
1614
|
<MenuItem><label><Checkbox checked={opciones.saltoAutomatico} onChange={
|
|
1538
|
-
()=>dispatch(dispatchers.SET_OPCION({opcion:'saltoAutomatico', valor
|
|
1539
|
-
} inputProps={{ 'aria-label': 'primary checkbox' }}/>salto automático</label></MenuItem>
|
|
1615
|
+
() => dispatch(dispatchers.SET_OPCION({ opcion: 'saltoAutomatico', valor: !opciones.saltoAutomatico }))
|
|
1616
|
+
} inputProps={{ 'aria-label': 'primary checkbox' }} />salto automático</label></MenuItem>
|
|
1540
1617
|
</Menu>
|
|
1541
1618
|
</>;
|
|
1542
1619
|
}
|
|
1543
1620
|
|
|
1544
|
-
function BarraDeNavegacion(props:{forPk:ForPk, soloLectura:boolean, modoDirecto:boolean}){
|
|
1621
|
+
function BarraDeNavegacion(props: { forPk: ForPk, soloLectura: boolean, modoDirecto: boolean }) {
|
|
1545
1622
|
const dispatch = useDispatch();
|
|
1546
1623
|
const forPk = props.forPk;
|
|
1547
|
-
const {opciones} = useSelectorVivienda(forPk);
|
|
1548
|
-
const [confirmaCerrar, setConfirmaCerrar] = useState<boolean|null>(false);
|
|
1624
|
+
const { opciones } = useSelectorVivienda(forPk);
|
|
1625
|
+
const [confirmaCerrar, setConfirmaCerrar] = useState<boolean | null>(false);
|
|
1549
1626
|
var estructura = getEstructura();
|
|
1550
1627
|
var dominio = getDatosByPass().informacionHdr[forPk[estructura.pkAgregadaUaPpal]].tem.dominio;
|
|
1551
|
-
var cerrarDirecto = async function(){
|
|
1628
|
+
var cerrarDirecto = async function () {
|
|
1552
1629
|
removeCSSById(BOOTSTRAP_5_1_3_SRC);
|
|
1553
1630
|
gotoConsistir(
|
|
1554
1631
|
estructura.operativo as IdOperativo,
|
|
@@ -1560,39 +1637,40 @@ function BarraDeNavegacion(props:{forPk:ForPk, soloLectura:boolean, modoDirecto:
|
|
|
1560
1637
|
//close();
|
|
1561
1638
|
//location.hash=hash.toString();
|
|
1562
1639
|
}
|
|
1563
|
-
var botonesFormulario=[];
|
|
1564
|
-
if(!opciones.modoDirecto){
|
|
1565
|
-
botonesFormulario.push({que: 'hdr'
|
|
1640
|
+
var botonesFormulario = [];
|
|
1641
|
+
if (!opciones.modoDirecto) {
|
|
1642
|
+
botonesFormulario.push({ que: 'hdr', abr: 'HdR', id: ID_BOTON_VOLVER_HDR, label: 'hoja de ruta', retroceso: 0 })
|
|
1566
1643
|
}
|
|
1567
|
-
opciones.pilaForPk.forEach((forPk,i)=>
|
|
1568
|
-
botonesFormulario.push({que:'volver', abr:forPk.formulario.replace(/^F:/,''), label:forPk.formulario, retroceso:opciones.pilaForPk.length-i})
|
|
1644
|
+
opciones.pilaForPk.forEach((forPk, i) =>
|
|
1645
|
+
botonesFormulario.push({ que: 'volver', abr: forPk.formulario.replace(/^F:/, ''), label: forPk.formulario, retroceso: opciones.pilaForPk.length - i })
|
|
1569
1646
|
)
|
|
1570
|
-
botonesFormulario.push({que:'', abr:forPk.formulario.replace(/^F:/,''), label:forPk.formulario, retroceso:0});
|
|
1571
|
-
registrarElemento({
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1647
|
+
botonesFormulario.push({ que: '', abr: forPk.formulario.replace(/^F:/, ''), label: forPk.formulario, retroceso: 0 });
|
|
1648
|
+
registrarElemento({
|
|
1649
|
+
id: props.modoDirecto ? ID_BOTON_CERRAR : ID_BOTON_VOLVER_HDR, direct: true,
|
|
1650
|
+
fun: (
|
|
1651
|
+
r: Respuestas,
|
|
1652
|
+
_feedbackForm: FormStructureState<IdVariable, Valor, IdFin>,
|
|
1653
|
+
elemento: HTMLDivElement,
|
|
1654
|
+
feedbackAll: { [formulario in PlainForPk]: FormStructureState<IdVariable, Valor, IdFin> },
|
|
1655
|
+
_estructura: Estructura
|
|
1656
|
+
) => {
|
|
1657
|
+
elemento.setAttribute('resumen-estado', calcularResumenVivienda(forPk, feedbackAll, r).resumenEstado);
|
|
1580
1658
|
}
|
|
1581
1659
|
})
|
|
1582
1660
|
return <>
|
|
1583
|
-
<ButtonGroup key="formularios" className="barra-navegacion" solo-lectura={props.soloLectura?'si':'no'} >
|
|
1584
|
-
{botonesFormulario.map((b,i)=>
|
|
1585
|
-
<Button color={b.que==forPk.formulario?"primary":"inherit"} variant="outlined"
|
|
1661
|
+
<ButtonGroup key="formularios" className="barra-navegacion" solo-lectura={props.soloLectura ? 'si' : 'no'} >
|
|
1662
|
+
{botonesFormulario.map((b, i) =>
|
|
1663
|
+
<Button color={b.que == forPk.formulario ? "primary" : "inherit"} variant="outlined"
|
|
1586
1664
|
id={b.id}
|
|
1587
1665
|
key={`${i}-${b.que}-${b.retroceso}`}
|
|
1588
1666
|
disabled={!b.que}
|
|
1589
|
-
onClick={()=>{
|
|
1667
|
+
onClick={() => {
|
|
1590
1668
|
dispatch(
|
|
1591
|
-
b.que=='hdr'?dispatchers.VOLVER_HDR({}):
|
|
1592
|
-
|
|
1669
|
+
b.que == 'hdr' ? dispatchers.VOLVER_HDR({}) :
|
|
1670
|
+
dispatchers.VOLVER_DE_FORMULARIO({ magnitudRetroceso: b.retroceso })
|
|
1593
1671
|
);
|
|
1594
|
-
b.que=='hdr'?null:
|
|
1595
|
-
dispatchByPass(accion_abrir_formulario,{forPk:opciones.pilaForPk[opciones.pilaForPk.length-b.retroceso]});
|
|
1672
|
+
b.que == 'hdr' ? null :
|
|
1673
|
+
dispatchByPass(accion_abrir_formulario, { forPk: opciones.pilaForPk[opciones.pilaForPk.length - b.retroceso] });
|
|
1596
1674
|
}}
|
|
1597
1675
|
>
|
|
1598
1676
|
<span className="abr">{b.abr}</span>
|
|
@@ -1600,28 +1678,28 @@ function BarraDeNavegacion(props:{forPk:ForPk, soloLectura:boolean, modoDirecto:
|
|
|
1600
1678
|
</Button>
|
|
1601
1679
|
)}
|
|
1602
1680
|
</ButtonGroup>
|
|
1603
|
-
{props.soloLectura
|
|
1604
|
-
{props.modoDirecto?
|
|
1681
|
+
{props.soloLectura ? <Typography component="span" style={{ margin: '0 10px' }}> (Solo Lectura) </Typography> : null}
|
|
1682
|
+
{props.modoDirecto ?
|
|
1605
1683
|
<>
|
|
1606
|
-
<ButtonGroup key="volver_y_grabar" style={{margin:'0 0 0 30px'}}>
|
|
1684
|
+
<ButtonGroup key="volver_y_grabar" style={{ margin: '0 0 0 30px' }}>
|
|
1607
1685
|
<Button
|
|
1608
1686
|
id={ID_BOTON_CERRAR}
|
|
1609
1687
|
color="inherit"
|
|
1610
1688
|
variant="outlined"
|
|
1611
|
-
onClick={async ()=>{
|
|
1612
|
-
if(props.soloLectura || !getDirty()){
|
|
1689
|
+
onClick={async () => {
|
|
1690
|
+
if (props.soloLectura || !getDirty()) {
|
|
1613
1691
|
cerrarDirecto();
|
|
1614
|
-
}else{
|
|
1692
|
+
} else {
|
|
1615
1693
|
setConfirmaCerrar(true)
|
|
1616
1694
|
}
|
|
1617
1695
|
}}
|
|
1618
1696
|
>
|
|
1619
|
-
<ICON.ExitToApp/>
|
|
1697
|
+
<ICON.ExitToApp />
|
|
1620
1698
|
</Button>
|
|
1621
1699
|
<Dialog
|
|
1622
1700
|
open={!!confirmaCerrar}
|
|
1623
1701
|
//hace que no se cierre el mensaje
|
|
1624
|
-
onClose={()=>setConfirmaCerrar(false)}
|
|
1702
|
+
onClose={() => setConfirmaCerrar(false)}
|
|
1625
1703
|
aria-labelledby="alert-dialog-title"
|
|
1626
1704
|
aria-describedby="alert-dialog-description"
|
|
1627
1705
|
>
|
|
@@ -1632,159 +1710,160 @@ function BarraDeNavegacion(props:{forPk:ForPk, soloLectura:boolean, modoDirecto:
|
|
|
1632
1710
|
</DialogContentText>
|
|
1633
1711
|
</DialogContent>
|
|
1634
1712
|
<DialogActions>
|
|
1635
|
-
<Button
|
|
1636
|
-
onClick={()=>{
|
|
1713
|
+
<Button
|
|
1714
|
+
onClick={() => {
|
|
1637
1715
|
cerrarDirecto()
|
|
1638
|
-
}}
|
|
1639
|
-
color="secondary"
|
|
1716
|
+
}}
|
|
1717
|
+
color="secondary"
|
|
1640
1718
|
variant="outlined"
|
|
1641
1719
|
>
|
|
1642
1720
|
descartar cambios y cerrar
|
|
1643
1721
|
</Button>
|
|
1644
|
-
<Button
|
|
1645
|
-
onClick={()=>{
|
|
1722
|
+
<Button
|
|
1723
|
+
onClick={() => {
|
|
1646
1724
|
setConfirmaCerrar(false)
|
|
1647
|
-
}}
|
|
1648
|
-
color="primary"
|
|
1725
|
+
}}
|
|
1726
|
+
color="primary"
|
|
1649
1727
|
variant="contained"
|
|
1650
1728
|
>
|
|
1651
1729
|
continuar editando encuesta
|
|
1652
1730
|
</Button>
|
|
1653
|
-
|
|
1731
|
+
|
|
1654
1732
|
</DialogActions>
|
|
1655
1733
|
</Dialog>
|
|
1656
|
-
{props.soloLectura?null:
|
|
1734
|
+
{props.soloLectura ? null :
|
|
1657
1735
|
<Button
|
|
1658
1736
|
id={"save-button"}
|
|
1659
1737
|
color="inherit"
|
|
1660
1738
|
variant="outlined"
|
|
1661
1739
|
disabled={true}
|
|
1662
|
-
onClick={async ()=>true}
|
|
1740
|
+
onClick={async () => true}
|
|
1663
1741
|
>
|
|
1664
|
-
<ICON.Save/>
|
|
1742
|
+
<ICON.Save />
|
|
1665
1743
|
</Button>
|
|
1666
1744
|
}
|
|
1667
1745
|
</ButtonGroup>
|
|
1668
1746
|
</>
|
|
1669
|
-
|
|
1670
|
-
<Typography className="mostrar-forPk" component="span" style={{margin:'0 10px'}}>
|
|
1671
|
-
{VER_DOMINIO
|
|
1672
|
-
{likeAr(props.forPk).filter((_,k)=>k!='formulario').map((v,k)=>
|
|
1747
|
+
: null}
|
|
1748
|
+
<Typography className="mostrar-forPk" component="span" style={{ margin: '0 10px' }}>
|
|
1749
|
+
{VER_DOMINIO ? <div key={dominio}><span>dominio</span><span>{dominio}</span></div> : ''}
|
|
1750
|
+
{likeAr(props.forPk).filter((_, k) => k != 'formulario').map((v, k) =>
|
|
1673
1751
|
<div key={k}><span>{k}</span><span>{v}</span></div>
|
|
1674
|
-
).array()}
|
|
1752
|
+
).array()}
|
|
1675
1753
|
</Typography>
|
|
1676
|
-
<FastSettup/>
|
|
1754
|
+
<FastSettup />
|
|
1677
1755
|
</>
|
|
1678
1756
|
}
|
|
1679
1757
|
|
|
1680
|
-
function BotonVolverEnDiv({id}:{id:string}){
|
|
1681
|
-
var {opciones} = useSelector((state:CasoState)=>({opciones:state.opciones}));
|
|
1758
|
+
function BotonVolverEnDiv({ id }: { id: string }) {
|
|
1759
|
+
var { opciones } = useSelector((state: CasoState) => ({ opciones: state.opciones }));
|
|
1682
1760
|
const dispatch = useDispatch();
|
|
1683
|
-
var esVolver = opciones.pilaForPk.length>0;
|
|
1761
|
+
var esVolver = opciones.pilaForPk.length > 0;
|
|
1684
1762
|
return <div className="div-boton-volver">
|
|
1685
1763
|
<Button id={id} className="boton-volver"
|
|
1686
|
-
onClick={()=>{
|
|
1687
|
-
if (esVolver) {
|
|
1688
|
-
dispatchByPass(accion_abrir_formulario,{forPk:opciones.pilaForPk[opciones.pilaForPk.length-1]});
|
|
1689
|
-
dispatch(dispatchers.VOLVER_DE_FORMULARIO({magnitudRetroceso:1}))
|
|
1764
|
+
onClick={() => {
|
|
1765
|
+
if (esVolver) {
|
|
1766
|
+
dispatchByPass(accion_abrir_formulario, { forPk: opciones.pilaForPk[opciones.pilaForPk.length - 1] });
|
|
1767
|
+
dispatch(dispatchers.VOLVER_DE_FORMULARIO({ magnitudRetroceso: 1 }))
|
|
1690
1768
|
} else {
|
|
1691
|
-
var botonCerrar = document.getElementById(ID_BOTON_CERRAR) || document.getElementById(ID_BOTON_VOLVER_HDR)
|
|
1769
|
+
var botonCerrar = document.getElementById(ID_BOTON_CERRAR) || document.getElementById(ID_BOTON_VOLVER_HDR)
|
|
1692
1770
|
if (botonCerrar) {
|
|
1693
1771
|
botonCerrar.click();
|
|
1694
1772
|
}
|
|
1695
1773
|
}
|
|
1696
1774
|
}}
|
|
1697
|
-
> <ICON.ChevronLeft/>{esVolver ? " Volver" : " Cerrar"}</Button>
|
|
1775
|
+
> <ICON.ChevronLeft />{esVolver ? " Volver" : " Cerrar"}</Button>
|
|
1698
1776
|
</div>
|
|
1699
1777
|
}
|
|
1700
1778
|
|
|
1701
|
-
function FormularioDespliegue(props:{forPk:ForPk}){
|
|
1779
|
+
function FormularioDespliegue(props: { forPk: ForPk }) {
|
|
1702
1780
|
var forPk = props.forPk;
|
|
1703
|
-
var {formulario, modoDespliegue, modo, opciones}
|
|
1781
|
+
var { formulario, modoDespliegue, modo, opciones }
|
|
1704
1782
|
= useSelectorVivienda(props.forPk);
|
|
1705
1783
|
var soloLectura = getDatosByPass().soloLectura;
|
|
1706
1784
|
const dispatch = useDispatch();
|
|
1707
|
-
var esVolver = opciones.pilaForPk.length>0;
|
|
1708
|
-
useEffect(()=>{
|
|
1709
|
-
var controlScroll=()=>{
|
|
1785
|
+
var esVolver = opciones.pilaForPk.length > 0;
|
|
1786
|
+
useEffect(() => {
|
|
1787
|
+
var controlScroll = () => {
|
|
1710
1788
|
var arriba = document.getElementById('fab-activo-arriba');
|
|
1711
|
-
if(arriba){
|
|
1789
|
+
if (arriba) {
|
|
1712
1790
|
setValorDistinto(arriba.style, 'visibility',
|
|
1713
1791
|
// @ts-ignore
|
|
1714
|
-
arriba.elTopVisibilizar !=null && arriba.elTopVisibilizar + 10
|
|
1715
|
-
|
|
1792
|
+
arriba.elTopVisibilizar != null && arriba.elTopVisibilizar + 10
|
|
1793
|
+
< document.documentElement.scrollTop ? 'visible' : 'hidden'
|
|
1716
1794
|
);
|
|
1717
1795
|
}
|
|
1718
1796
|
var abajo = document.getElementById('fab-activo-abajo');
|
|
1719
|
-
if(abajo){
|
|
1720
|
-
setValorDistinto(abajo.style, 'visibility',
|
|
1797
|
+
if (abajo) {
|
|
1798
|
+
setValorDistinto(abajo.style, 'visibility',
|
|
1721
1799
|
// @ts-ignore
|
|
1722
1800
|
abajo.elBottomVisibilizar != null && abajo.elBottomVisibilizar - 20
|
|
1723
|
-
|
|
1801
|
+
> document.documentElement.scrollTop + window.innerHeight * 0.7 ? 'visible' : 'hidden'
|
|
1724
1802
|
);
|
|
1725
1803
|
}
|
|
1726
1804
|
}
|
|
1727
|
-
const idCaso = likeAr(props.forPk).find((_,k)=>{
|
|
1728
|
-
return k!='formulario'
|
|
1805
|
+
const idCaso = likeAr(props.forPk).find((_, k) => {
|
|
1806
|
+
return k != 'formulario'
|
|
1729
1807
|
})?.toString();
|
|
1730
1808
|
window.document.title = getEstructura().operativo + '- ' + idCaso;
|
|
1731
1809
|
window.addEventListener('scroll', controlScroll);
|
|
1732
1810
|
controlScroll();
|
|
1733
|
-
return ()=>{
|
|
1811
|
+
return () => {
|
|
1734
1812
|
window.removeEventListener('scroll', controlScroll);
|
|
1735
1813
|
}
|
|
1736
1814
|
})
|
|
1737
1815
|
// TODO Volver a poner el movimiento a la actual
|
|
1738
|
-
var actual:any
|
|
1739
|
-
var completo:any
|
|
1740
|
-
var onClickSaltarActual = ()=>{
|
|
1741
|
-
var {variableActual} = dispatchByPass(accion_registrar_respuesta, {respuesta:null, variable:NO_CAMBIAR__SOLO_TRAER_STATUS, forPk:props.forPk});
|
|
1742
|
-
if(variableActual){
|
|
1816
|
+
var actual: any
|
|
1817
|
+
var completo: any
|
|
1818
|
+
var onClickSaltarActual = () => {
|
|
1819
|
+
var { variableActual } = dispatchByPass(accion_registrar_respuesta, { respuesta: null, variable: NO_CAMBIAR__SOLO_TRAER_STATUS, forPk: props.forPk });
|
|
1820
|
+
if (variableActual) {
|
|
1743
1821
|
enfocarElementoDeVariable(variableActual)
|
|
1744
1822
|
}
|
|
1745
1823
|
}
|
|
1746
|
-
var listaModos:ModoDespliegue[]=['metadatos','relevamiento','PDF'];
|
|
1747
|
-
['boton-volver-1', 'boton-volver-2'].forEach(id=>{
|
|
1748
|
-
registrarElemento({
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1824
|
+
var listaModos: ModoDespliegue[] = ['metadatos', 'relevamiento', 'PDF'];
|
|
1825
|
+
['boton-volver-1', 'boton-volver-2'].forEach(id => {
|
|
1826
|
+
registrarElemento({
|
|
1827
|
+
id, direct: true,
|
|
1828
|
+
fun: (
|
|
1829
|
+
r: Respuestas,
|
|
1830
|
+
feedbackForm: FormStructureState<IdVariable, Valor, IdFin>,
|
|
1831
|
+
elemento: HTMLDivElement,
|
|
1832
|
+
feedbackAll: { [formulario in PlainForPk]: FormStructureState<IdVariable, Valor, IdFin> },
|
|
1833
|
+
_estructura: Estructura
|
|
1834
|
+
) => {
|
|
1835
|
+
elemento.setAttribute('resumen-estado', esVolver ? feedbackForm.resumen : calcularResumenVivienda(forPk, feedbackAll, r).resumenEstado);
|
|
1757
1836
|
}
|
|
1758
1837
|
})
|
|
1759
1838
|
})
|
|
1760
1839
|
// @ts-expect-error especial hay que leerlo en el parser de casilleros si esto termina quedando así
|
|
1761
1840
|
var pantallaCompleta = formulario.especial?.pantallaCompleta;
|
|
1762
|
-
const modoDM:ModoDM = my.getLocalVar(MODO_DM_LOCALSTORAGE_KEY);
|
|
1841
|
+
const modoDM: ModoDM = my.getLocalVar(MODO_DM_LOCALSTORAGE_KEY);
|
|
1763
1842
|
return (
|
|
1764
1843
|
<>
|
|
1765
|
-
<AppBar position="fixed" color={soloLectura?'secondary':(modoDM=='capa'?'success':'primary')}>
|
|
1844
|
+
<AppBar position="fixed" color={soloLectura ? 'secondary' : (modoDM == 'capa' ? 'success' : 'primary')}>
|
|
1766
1845
|
<Toolbar>
|
|
1767
|
-
<BarraDeNavegacion forPk={forPk} soloLectura={soloLectura || false} modoDirecto={opciones.modoDirecto}/>
|
|
1768
|
-
<Typography><span style={{marginLeft:'5px'}}>{modoDM=='capa'?' MODO CAPACITACIÓN':''}</span></Typography>
|
|
1846
|
+
<BarraDeNavegacion forPk={forPk} soloLectura={soloLectura || false} modoDirecto={opciones.modoDirecto} />
|
|
1847
|
+
<Typography><span style={{ marginLeft: '5px' }}>{modoDM == 'capa' ? ' MODO CAPACITACIÓN' : ''}</span></Typography>
|
|
1769
1848
|
</Toolbar>
|
|
1770
1849
|
<div id="mini-console"></div>
|
|
1771
1850
|
</AppBar>
|
|
1772
1851
|
<main>
|
|
1773
|
-
<Paper className="formulario" modo-despliegue={modoDespliegue} ver-num-opciones={opciones.conCampoOpciones?'SI':'NO'}>
|
|
1774
|
-
{modo.demo
|
|
1852
|
+
<Paper className="formulario" modo-despliegue={modoDespliegue} ver-num-opciones={opciones.conCampoOpciones ? 'SI' : 'NO'}>
|
|
1853
|
+
{modo.demo ? <div>
|
|
1775
1854
|
<Typography component="span">Modo de despliegue:</Typography>
|
|
1776
1855
|
<ButtonGroup>
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1856
|
+
{listaModos.map(modo =>
|
|
1857
|
+
<Button key={modo} variant={modo == modoDespliegue ? "contained" : "outlined"} onClick={
|
|
1858
|
+
() => dispatch(dispatchers.MODO_DESPLIEGUE({ modoDespliegue: modo }))
|
|
1859
|
+
}>{modo}</Button>
|
|
1860
|
+
)}
|
|
1782
1861
|
</ButtonGroup>
|
|
1783
|
-
</div
|
|
1784
|
-
{pantallaCompleta?null
|
|
1785
|
-
{pantallaCompleta?null
|
|
1786
|
-
<DesplegarContenidoInternoBloqueOFormulario bloqueOFormulario={formulario} formulario={formulario} forPk={forPk} multiple={false}/>
|
|
1787
|
-
{pantallaCompleta?null
|
|
1862
|
+
</div> : null}
|
|
1863
|
+
{pantallaCompleta ? null : <BotonVolverEnDiv id="boton-volver-1" />}
|
|
1864
|
+
{pantallaCompleta ? null : <FormularioEncabezado casillero={formulario} />}
|
|
1865
|
+
<DesplegarContenidoInternoBloqueOFormulario bloqueOFormulario={formulario} formulario={formulario} forPk={forPk} multiple={false} />
|
|
1866
|
+
{pantallaCompleta ? null : <BotonVolverEnDiv id="boton-volver-2" />}
|
|
1788
1867
|
</Paper>
|
|
1789
1868
|
<Fab id='fab-activo-arriba' color="primary" aria-label="add" onClick={onClickSaltarActual}>
|
|
1790
1869
|
<ICON.KeyboardArrowUp />
|
|
@@ -1795,99 +1874,100 @@ function FormularioDespliegue(props:{forPk:ForPk}){
|
|
|
1795
1874
|
<Fab id='fab-error-arriba' variant="extended" color="secondary" aria-label="edit">
|
|
1796
1875
|
<ICON.Navigation />
|
|
1797
1876
|
Error
|
|
1798
|
-
</Fab>
|
|
1877
|
+
</Fab>
|
|
1799
1878
|
<Fab id='fab-error-abajo' variant="extended" color="secondary" aria-label="edit">
|
|
1800
1879
|
<ICON.NavigationDown />
|
|
1801
1880
|
Error
|
|
1802
|
-
</Fab>
|
|
1881
|
+
</Fab>
|
|
1803
1882
|
<div className='espacio-final-formulario'></div>
|
|
1804
|
-
{opciones.modoBorrarRespuesta && opciones.forPk
|
|
1883
|
+
{opciones.modoBorrarRespuesta && opciones.forPk ? <DesplegarConfirmarBorrarRespuesta forPk={opciones.forPk} variableBorrar={opciones.modoBorrarRespuesta} /> : null}
|
|
1805
1884
|
</main>
|
|
1806
1885
|
</>
|
|
1807
1886
|
);
|
|
1808
1887
|
}
|
|
1809
1888
|
|
|
1810
|
-
export function Atributo(props:{nombre:string, valor:any}){
|
|
1811
|
-
return props.valor!=null && props.valor!=''
|
|
1812
|
-
{props.nombre
|
|
1813
|
-
|
|
1814
|
-
</span
|
|
1889
|
+
export function Atributo(props: { nombre: string, valor: any }) {
|
|
1890
|
+
return props.valor != null && props.valor != '' ? <span className="atributo-par">
|
|
1891
|
+
{props.nombre ? <span className="atributo-nombre">{props.nombre}</span> : null}
|
|
1892
|
+
<span className="atributo-valor">{props.valor.toString()}</span>
|
|
1893
|
+
</span> : null
|
|
1815
1894
|
}
|
|
1816
1895
|
|
|
1817
|
-
export const listaEstadosCarga:EstadoCarga[]=['resumen','relevamiento','recibo'];
|
|
1896
|
+
export const listaEstadosCarga: EstadoCarga[] = ['resumen', 'relevamiento', 'recibo'];
|
|
1818
1897
|
export var resumidores = [
|
|
1819
|
-
{nombre:'REA'
|
|
1820
|
-
{nombre:'Cita pactada', f:(rr:RespuestasRaiz)=>rr.resumenEstado=="cita pactada"},
|
|
1821
|
-
{nombre:'Pendientes'
|
|
1898
|
+
{ nombre: 'REA', f: (rr: RespuestasRaiz) => rr.resumenEstado == "ok" },
|
|
1899
|
+
{ nombre: 'Cita pactada', f: (rr: RespuestasRaiz) => rr.resumenEstado == "cita pactada" },
|
|
1900
|
+
{ nombre: 'Pendientes', f: (rr: RespuestasRaiz) => rr.resumenEstado == "vacio" },
|
|
1822
1901
|
];
|
|
1823
1902
|
|
|
1824
1903
|
resumidores.push(
|
|
1825
|
-
{nombre:'Otros', f:resumidores.reduce((g,r)=>(rr
|
|
1904
|
+
{ nombre: 'Otros', f: resumidores.reduce((g, r) => (rr => !r.f(rr) && g(rr)), (_: RespuestasRaiz) => true) }
|
|
1826
1905
|
)
|
|
1827
1906
|
|
|
1828
|
-
export type DesplegarLineaResumenUAPrincipalType = (props:{
|
|
1829
|
-
numVivienda:IdEnc,
|
|
1830
|
-
formPrincipal:IdFormulario,
|
|
1907
|
+
export type DesplegarLineaResumenUAPrincipalType = (props: {
|
|
1908
|
+
numVivienda: IdEnc,
|
|
1909
|
+
formPrincipal: IdFormulario,
|
|
1831
1910
|
tarea: string,
|
|
1832
|
-
respuestas:RespuestasRaiz,
|
|
1833
|
-
})=>JSX.Element;
|
|
1911
|
+
respuestas: RespuestasRaiz,
|
|
1912
|
+
}) => JSX.Element;
|
|
1834
1913
|
|
|
1835
1914
|
export var DesplegarLineaResumenUAPrincipal: DesplegarLineaResumenUAPrincipalType
|
|
1836
1915
|
|
|
1837
|
-
export const setDesplegarLineaResumenUAPrincipal = (lineaResumenUAPrincipal:DesplegarLineaResumenUAPrincipalType)=>DesplegarLineaResumenUAPrincipal = lineaResumenUAPrincipal;
|
|
1916
|
+
export const setDesplegarLineaResumenUAPrincipal = (lineaResumenUAPrincipal: DesplegarLineaResumenUAPrincipalType) => DesplegarLineaResumenUAPrincipal = lineaResumenUAPrincipal;
|
|
1838
1917
|
|
|
1839
|
-
setDesplegarLineaResumenUAPrincipal((props:{
|
|
1840
|
-
numVivienda:IdEnc,
|
|
1841
|
-
formPrincipal:IdFormulario,
|
|
1918
|
+
setDesplegarLineaResumenUAPrincipal((props: {
|
|
1919
|
+
numVivienda: IdEnc,
|
|
1920
|
+
formPrincipal: IdFormulario,
|
|
1842
1921
|
tarea: string,
|
|
1843
|
-
respuestas:RespuestasRaiz,
|
|
1844
|
-
})=>{
|
|
1845
|
-
const {numVivienda, respuestas, formPrincipal, tarea} = props;
|
|
1846
|
-
const id='viv-'+numVivienda;
|
|
1922
|
+
respuestas: RespuestasRaiz,
|
|
1923
|
+
}) => {
|
|
1924
|
+
const { numVivienda, respuestas, formPrincipal, tarea } = props;
|
|
1925
|
+
const id = 'viv-' + numVivienda;
|
|
1847
1926
|
const estructura = getEstructura();
|
|
1848
|
-
const forPk:ForPk={formulario:formPrincipal, [estructura.pkAgregadaUaPpal]:Number(numVivienda) as IdEnc} as ForPk; //no quitar el casteo porque viene como texto y necesito que sea número
|
|
1927
|
+
const forPk: ForPk = { formulario: formPrincipal, [estructura.pkAgregadaUaPpal]: Number(numVivienda) as IdEnc } as ForPk; //no quitar el casteo porque viene como texto y necesito que sea número
|
|
1849
1928
|
var tem = getDatosByPass().informacionHdr[numVivienda].tem;
|
|
1850
1929
|
const dispatch = useDispatch();
|
|
1851
|
-
useEffect(()=>{
|
|
1930
|
+
useEffect(() => {
|
|
1852
1931
|
volcadoInicialElementosRegistrados(forPk);
|
|
1853
1932
|
intentarBackup(forPk)
|
|
1854
1933
|
})
|
|
1855
|
-
registrarElemento({
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1934
|
+
registrarElemento({
|
|
1935
|
+
id, direct: true,
|
|
1936
|
+
fun: (
|
|
1937
|
+
r: Respuestas,
|
|
1938
|
+
_feedbackForm: FormStructureState<IdVariable, Valor, IdFin>,
|
|
1939
|
+
elemento: HTMLDivElement,
|
|
1940
|
+
feedbackAll: { [formulario in PlainForPk]: FormStructureState<IdVariable, Valor, IdFin> },
|
|
1941
|
+
_estructura: Estructura
|
|
1942
|
+
) => {
|
|
1863
1943
|
//pregunto si es la misma vivienda porque la funcion se dispara
|
|
1864
1944
|
//con todas las combinaciones de respuestas para cada forPk
|
|
1865
1945
|
//@ts-ignore vivienda existe
|
|
1866
|
-
if(r[estructura.pkAgregadaUaPpal] == forPk[estructura.pkAgregadaUaPpal]){
|
|
1867
|
-
elemento.setAttribute('resumen-estado',calcularResumenVivienda(forPk, feedbackAll, r).resumenEstado);
|
|
1946
|
+
if (r[estructura.pkAgregadaUaPpal] == forPk[estructura.pkAgregadaUaPpal]) {
|
|
1947
|
+
elemento.setAttribute('resumen-estado', calcularResumenVivienda(forPk, feedbackAll, r).resumenEstado);
|
|
1868
1948
|
}
|
|
1869
1949
|
}
|
|
1870
|
-
|
|
1950
|
+
|
|
1871
1951
|
})
|
|
1872
1952
|
return <TableRow key={numVivienda}>
|
|
1873
1953
|
<TableCell>
|
|
1874
|
-
{tem?
|
|
1954
|
+
{tem ?
|
|
1875
1955
|
<>
|
|
1876
|
-
<DesplegarTem tem={tem}/>
|
|
1877
|
-
{respuestas['resumenEstado' as IdVariable]=="cita pactada"?
|
|
1878
|
-
<DesplegarCitaPactada respuestas={respuestas}/>
|
|
1879
|
-
|
|
1880
|
-
<DesplegarCitaPactadaYSeleccionadoAnteriorTem tem={tem}/>
|
|
1956
|
+
<DesplegarTem tem={tem} />
|
|
1957
|
+
{respuestas['resumenEstado' as IdVariable] == "cita pactada" ?
|
|
1958
|
+
<DesplegarCitaPactada respuestas={respuestas} />
|
|
1959
|
+
:
|
|
1960
|
+
<DesplegarCitaPactadaYSeleccionadoAnteriorTem tem={tem} />
|
|
1881
1961
|
}
|
|
1882
1962
|
</>
|
|
1883
|
-
|
|
1963
|
+
: null}
|
|
1884
1964
|
</TableCell>
|
|
1885
1965
|
<TableCell>
|
|
1886
1966
|
{tarea}
|
|
1887
1967
|
</TableCell>
|
|
1888
1968
|
<TableCell>
|
|
1889
|
-
<Button id={id} onClick={()=>
|
|
1890
|
-
dispatch(dispatchers.CAMBIAR_FORMULARIO({forPk, apilarVuelta:false}))
|
|
1969
|
+
<Button id={id} onClick={() =>
|
|
1970
|
+
dispatch(dispatchers.CAMBIAR_FORMULARIO({ forPk, apilarVuelta: false }))
|
|
1891
1971
|
}>
|
|
1892
1972
|
{numVivienda.toString()}
|
|
1893
1973
|
</Button>
|
|
@@ -1895,38 +1975,38 @@ setDesplegarLineaResumenUAPrincipal((props:{
|
|
|
1895
1975
|
</TableRow>
|
|
1896
1976
|
});
|
|
1897
1977
|
|
|
1898
|
-
export type DesplegarCargaType = (props:{
|
|
1899
|
-
carga:Carga,
|
|
1900
|
-
idCarga:IdCarga,
|
|
1901
|
-
posicion:number,
|
|
1902
|
-
informacionHdr:InformacionHdr,
|
|
1978
|
+
export type DesplegarCargaType = (props: {
|
|
1979
|
+
carga: Carga,
|
|
1980
|
+
idCarga: IdCarga,
|
|
1981
|
+
posicion: number,
|
|
1982
|
+
informacionHdr: InformacionHdr,
|
|
1903
1983
|
respuestas: RespuestaLasUA,
|
|
1904
|
-
feedbackRowValidator:{
|
|
1905
|
-
[formulario in PlainForPk]:FormStructureState<IdVariable, Valor, IdFin>
|
|
1984
|
+
feedbackRowValidator: {
|
|
1985
|
+
[formulario in PlainForPk]: FormStructureState<IdVariable, Valor, IdFin>
|
|
1906
1986
|
}
|
|
1907
|
-
})=>JSX.Element;
|
|
1987
|
+
}) => JSX.Element;
|
|
1908
1988
|
|
|
1909
1989
|
export var DesplegarCarga: DesplegarCargaType
|
|
1910
1990
|
|
|
1911
|
-
export const setDesplegarCarga = (despliegueCarga:DesplegarCargaType)=>DesplegarCarga = despliegueCarga;
|
|
1991
|
+
export const setDesplegarCarga = (despliegueCarga: DesplegarCargaType) => DesplegarCarga = despliegueCarga;
|
|
1912
1992
|
|
|
1913
|
-
setDesplegarCarga((props:{
|
|
1914
|
-
carga:Carga,
|
|
1915
|
-
idCarga:IdCarga,
|
|
1916
|
-
posicion:number,
|
|
1917
|
-
informacionHdr:InformacionHdr,
|
|
1993
|
+
setDesplegarCarga((props: {
|
|
1994
|
+
carga: Carga,
|
|
1995
|
+
idCarga: IdCarga,
|
|
1996
|
+
posicion: number,
|
|
1997
|
+
informacionHdr: InformacionHdr,
|
|
1918
1998
|
respuestas: RespuestaLasUA,
|
|
1919
|
-
feedbackRowValidator:{
|
|
1920
|
-
[formulario in PlainForPk]:FormStructureState<IdVariable, Valor, IdFin>
|
|
1999
|
+
feedbackRowValidator: {
|
|
2000
|
+
[formulario in PlainForPk]: FormStructureState<IdVariable, Valor, IdFin>
|
|
1921
2001
|
}
|
|
1922
|
-
})=>{
|
|
2002
|
+
}) => {
|
|
1923
2003
|
const [newSurvey, setNewSurvey] = useState(0);
|
|
1924
|
-
const {carga, idCarga, informacionHdr, respuestas} = props;
|
|
2004
|
+
const { carga, idCarga, informacionHdr, respuestas } = props;
|
|
1925
2005
|
var estructura = getEstructura();
|
|
1926
|
-
let cantLineasResumen = likeAr(informacionHdr).filter((informacion)=>informacion.tem.carga==idCarga).array().length;
|
|
2006
|
+
let cantLineasResumen = likeAr(informacionHdr).filter((informacion) => informacion.tem.carga == idCarga).array().length;
|
|
1927
2007
|
const dispatch = useDispatch();
|
|
1928
|
-
const modoDM:ModoDM = my.getLocalVar(MODO_DM_LOCALSTORAGE_KEY);
|
|
1929
|
-
return <Paper className="carga" style={{marginBottom: '10px', padding: '10px'}}>
|
|
2008
|
+
const modoDM: ModoDM = my.getLocalVar(MODO_DM_LOCALSTORAGE_KEY);
|
|
2009
|
+
return <Paper className="carga" style={{ marginBottom: '10px', padding: '10px' }}>
|
|
1930
2010
|
<div className="informacion-carga">
|
|
1931
2011
|
<div className="carga">Área: {idCarga}</div>
|
|
1932
2012
|
<div className="observaciones">{carga.observaciones}</div>
|
|
@@ -1943,181 +2023,181 @@ setDesplegarCarga((props:{
|
|
|
1943
2023
|
</ButtonGroup>
|
|
1944
2024
|
*/}
|
|
1945
2025
|
</div>
|
|
1946
|
-
{carga.estado_carga==null && !props.posicion || carga.estado_carga=='relevamiento'?
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
2026
|
+
{carga.estado_carga == null && !props.posicion || carga.estado_carga == 'relevamiento' ?
|
|
2027
|
+
<Table className="tabla-carga-hoja-de-ruta">
|
|
2028
|
+
<colgroup>
|
|
2029
|
+
<col style={{ width: "75%" }} />
|
|
2030
|
+
<col style={{ width: "10%" }} />
|
|
2031
|
+
<col style={{ width: "15%" }} />
|
|
2032
|
+
</colgroup>
|
|
2033
|
+
{cantLineasResumen ?
|
|
2034
|
+
<TableHead style={{ fontSize: "1.2rem" }}>
|
|
2035
|
+
<TableRow className="tr-carga">
|
|
2036
|
+
<TableCell>domicilio</TableCell>
|
|
2037
|
+
<TableCell>tarea</TableCell>
|
|
2038
|
+
<TableCell>enc</TableCell>
|
|
2039
|
+
</TableRow>
|
|
2040
|
+
</TableHead>
|
|
2041
|
+
: null}
|
|
2042
|
+
<TableBody>
|
|
2043
|
+
<>
|
|
2044
|
+
{likeAr(informacionHdr).filter((informacion) => informacion.tem.carga == idCarga).map((informacion, numVivienda) =>
|
|
2045
|
+
<DesplegarLineaResumenUAPrincipal
|
|
2046
|
+
key={numVivienda}
|
|
2047
|
+
numVivienda={numVivienda}
|
|
2048
|
+
tarea={informacion.tarea.tarea}
|
|
2049
|
+
formPrincipal={informacion.tarea.main_form}
|
|
2050
|
+
respuestas={respuestas[estructura.uaPpal][numVivienda] as RespuestasRaiz}
|
|
2051
|
+
/>
|
|
2052
|
+
).array()}
|
|
2053
|
+
{estructura.permiteGenerarMuestra ?
|
|
2054
|
+
<TableRow className="tr-carga-nuevo">
|
|
2055
|
+
<TableCell colSpan={3}>
|
|
2056
|
+
<Button
|
|
2057
|
+
variant="contained"
|
|
2058
|
+
color={modoDM == "capa" ? "success" : "primary"}
|
|
2059
|
+
onClick={() =>
|
|
2060
|
+
crearEncuesta(idCarga, (forPkRaiz: ForPkRaiz) => {
|
|
2061
|
+
dispatch(dispatchers.CAMBIAR_FORMULARIO({ forPk: forPkRaiz, apilarVuelta: false }));
|
|
2062
|
+
})
|
|
2063
|
+
}
|
|
2064
|
+
>
|
|
2065
|
+
<ICON.Add />
|
|
2066
|
+
</Button>
|
|
2067
|
+
</TableCell>
|
|
2068
|
+
</TableRow>
|
|
2069
|
+
: null}
|
|
2070
|
+
</>
|
|
2071
|
+
</TableBody>
|
|
2072
|
+
</Table> :
|
|
2073
|
+
<Table>
|
|
2074
|
+
<TableHead style={{ fontSize: "1.2rem" }}>
|
|
1955
2075
|
<TableRow className="tr-carga">
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
2076
|
+
{resumidores.map((resumidor: typeof resumidores[0], i: number) =>
|
|
2077
|
+
<TableCell key={i}>
|
|
2078
|
+
{resumidor.nombre}
|
|
2079
|
+
</TableCell>
|
|
2080
|
+
)}
|
|
1959
2081
|
</TableRow>
|
|
1960
2082
|
</TableHead>
|
|
1961
|
-
|
|
1962
|
-
<TableBody>
|
|
1963
|
-
<>
|
|
1964
|
-
{likeAr(informacionHdr).filter((informacion)=>informacion.tem.carga==idCarga).map((informacion, numVivienda)=>
|
|
1965
|
-
<DesplegarLineaResumenUAPrincipal
|
|
1966
|
-
key={numVivienda}
|
|
1967
|
-
numVivienda={numVivienda}
|
|
1968
|
-
tarea={informacion.tarea.tarea}
|
|
1969
|
-
formPrincipal={informacion.tarea.main_form}
|
|
1970
|
-
respuestas={respuestas[estructura.uaPpal][numVivienda] as RespuestasRaiz}
|
|
1971
|
-
/>
|
|
1972
|
-
).array()}
|
|
1973
|
-
{estructura.permiteGenerarMuestra?
|
|
1974
|
-
<TableRow className="tr-carga-nuevo">
|
|
1975
|
-
<TableCell colSpan={3}>
|
|
1976
|
-
<Button
|
|
1977
|
-
variant="contained"
|
|
1978
|
-
color={modoDM=="capa"?"success":"primary"}
|
|
1979
|
-
onClick={()=>
|
|
1980
|
-
crearEncuesta(idCarga,(forPkRaiz:ForPkRaiz)=>{
|
|
1981
|
-
dispatch(dispatchers.CAMBIAR_FORMULARIO({forPk:forPkRaiz, apilarVuelta:false}));
|
|
1982
|
-
})
|
|
1983
|
-
}
|
|
1984
|
-
>
|
|
1985
|
-
<ICON.Add/>
|
|
1986
|
-
</Button>
|
|
1987
|
-
</TableCell>
|
|
1988
|
-
</TableRow>
|
|
1989
|
-
:null}
|
|
1990
|
-
</>
|
|
1991
|
-
</TableBody>
|
|
1992
|
-
</Table>:
|
|
1993
|
-
<Table>
|
|
1994
|
-
<TableHead style={{fontSize: "1.2rem"}}>
|
|
1995
|
-
<TableRow className="tr-carga">
|
|
1996
|
-
{resumidores.map((resumidor: typeof resumidores[0], i:number)=>
|
|
1997
|
-
<TableCell key={i}>
|
|
1998
|
-
{resumidor.nombre}
|
|
1999
|
-
</TableCell>
|
|
2000
|
-
)}
|
|
2001
|
-
</TableRow>
|
|
2002
|
-
</TableHead>
|
|
2003
|
-
</Table>
|
|
2083
|
+
</Table>
|
|
2004
2084
|
}
|
|
2005
2085
|
</Paper>
|
|
2006
2086
|
});
|
|
2007
2087
|
|
|
2008
|
-
export function DesplegarCitaPactada(props:{respuestas:Respuestas}){
|
|
2009
|
-
const {respuestas} = props;
|
|
2088
|
+
export function DesplegarCitaPactada(props: { respuestas: Respuestas }) {
|
|
2089
|
+
const { respuestas } = props;
|
|
2010
2090
|
return <div className="cita-pactada">
|
|
2011
|
-
<div><Atributo nombre="Cita pactada con " valor={respuestas[p12]}/></div>
|
|
2012
|
-
<div><Atributo nombre="Cel.:" valor={respuestas[sp2]}/></div>
|
|
2013
|
-
<div><Atributo nombre="Tel.:" valor={respuestas[sp3]}/></div>
|
|
2014
|
-
<div><Atributo nombre="Fecha:" valor={respuestas[sp4]}/></div>
|
|
2015
|
-
<div><Atributo nombre="Hora:" valor={respuestas[sp5]}/></div>
|
|
2091
|
+
<div><Atributo nombre="Cita pactada con " valor={respuestas[p12]} /></div>
|
|
2092
|
+
<div><Atributo nombre="Cel.:" valor={respuestas[sp2]} /></div>
|
|
2093
|
+
<div><Atributo nombre="Tel.:" valor={respuestas[sp3]} /></div>
|
|
2094
|
+
<div><Atributo nombre="Fecha:" valor={respuestas[sp4]} /></div>
|
|
2095
|
+
<div><Atributo nombre="Hora:" valor={respuestas[sp5]} /></div>
|
|
2016
2096
|
</div>
|
|
2017
2097
|
}
|
|
2018
2098
|
|
|
2019
|
-
export function DesplegarCitaPactadaYSeleccionadoAnteriorTem(props:{tem:TEM}){
|
|
2020
|
-
const {tem} = props;
|
|
2099
|
+
export function DesplegarCitaPactadaYSeleccionadoAnteriorTem(props: { tem: TEM }) {
|
|
2100
|
+
const { tem } = props;
|
|
2021
2101
|
return <div>
|
|
2022
2102
|
<div className="tem-cita">
|
|
2023
|
-
<Atributo nombre="Cita:" valor={tem.cita}/>
|
|
2103
|
+
<Atributo nombre="Cita:" valor={tem.cita} />
|
|
2024
2104
|
</div>
|
|
2025
2105
|
</div>
|
|
2026
2106
|
}
|
|
2027
2107
|
|
|
2028
|
-
export function DesplegarTem(props:{tem:TEM}){
|
|
2029
|
-
const {tem} = props;
|
|
2108
|
+
export function DesplegarTem(props: { tem: TEM }) {
|
|
2109
|
+
const { tem } = props;
|
|
2030
2110
|
return <div>
|
|
2031
|
-
<div className="tem-domicilio">{tem.nomcalle} {tem.nrocatastral} <Atributo nombre="piso" valor={tem.piso}/> <Atributo nombre="dpto" valor={tem.departamento}/> </div>
|
|
2111
|
+
<div className="tem-domicilio">{tem.nomcalle} {tem.nrocatastral} <Atributo nombre="piso" valor={tem.piso} /> <Atributo nombre="dpto" valor={tem.departamento} /> </div>
|
|
2032
2112
|
<div>
|
|
2033
|
-
<Atributo nombre="sector" valor={tem.sector}/>
|
|
2034
|
-
<Atributo nombre="edificio" valor={tem.edificio}/>
|
|
2035
|
-
<Atributo nombre="casa" valor={tem.casa}/>
|
|
2036
|
-
<Atributo nombre="entrada" valor={tem.entrada}/>
|
|
2037
|
-
<Atributo nombre="habitacion" valor={tem.habitacion}/>
|
|
2113
|
+
<Atributo nombre="sector" valor={tem.sector} />
|
|
2114
|
+
<Atributo nombre="edificio" valor={tem.edificio} />
|
|
2115
|
+
<Atributo nombre="casa" valor={tem.casa} />
|
|
2116
|
+
<Atributo nombre="entrada" valor={tem.entrada} />
|
|
2117
|
+
<Atributo nombre="habitacion" valor={tem.habitacion} />
|
|
2038
2118
|
</div>
|
|
2039
2119
|
<div className="tem-observaciones">
|
|
2040
|
-
{tem.observaciones}
|
|
2120
|
+
{tem.observaciones}
|
|
2041
2121
|
</div>
|
|
2042
2122
|
</div>
|
|
2043
2123
|
}
|
|
2044
2124
|
|
|
2045
|
-
export type HojaDeRutaDespliegueType = (props:{})=>JSX.Element;
|
|
2125
|
+
export type HojaDeRutaDespliegueType = (props: {}) => JSX.Element;
|
|
2046
2126
|
|
|
2047
2127
|
export var HojaDeRutaDespliegue: HojaDeRutaDespliegueType
|
|
2048
2128
|
|
|
2049
|
-
export const setHojaDeRutaDespliegue = (hojaDeRuta:HojaDeRutaDespliegueType)=>HojaDeRutaDespliegue = hojaDeRuta
|
|
2129
|
+
export const setHojaDeRutaDespliegue = (hojaDeRuta: HojaDeRutaDespliegueType) => HojaDeRutaDespliegue = hojaDeRuta
|
|
2050
2130
|
|
|
2051
|
-
setHojaDeRutaDespliegue((_props:{})=>{
|
|
2052
|
-
var {cargas, num_sincro, informacionHdr, respuestas} = getDatosByPass();
|
|
2053
|
-
var {modo} = useSelector((state:CasoState)=>({modo:state.modo}));
|
|
2131
|
+
setHojaDeRutaDespliegue((_props: {}) => {
|
|
2132
|
+
var { cargas, num_sincro, informacionHdr, respuestas } = getDatosByPass();
|
|
2133
|
+
var { modo } = useSelector((state: CasoState) => ({ modo: state.modo }));
|
|
2054
2134
|
var feedbackRowValidator = getFeedbackRowValidator()
|
|
2055
2135
|
const dispatch = useDispatch();
|
|
2056
2136
|
const online = useOnlineStatus();
|
|
2057
|
-
const modoDM:ModoDM = my.getLocalVar(MODO_DM_LOCALSTORAGE_KEY);
|
|
2137
|
+
const modoDM: ModoDM = my.getLocalVar(MODO_DM_LOCALSTORAGE_KEY);
|
|
2058
2138
|
return (
|
|
2059
2139
|
<>
|
|
2060
|
-
<AppBar position="fixed" color={modoDM=='capa'?'success':'primary'}>
|
|
2140
|
+
<AppBar position="fixed" color={modoDM == 'capa' ? 'success' : 'primary'}>
|
|
2061
2141
|
<Toolbar>
|
|
2062
2142
|
<Typography>
|
|
2063
2143
|
HOJA DE RUTA
|
|
2064
2144
|
</Typography>
|
|
2065
2145
|
{
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2146
|
+
//<IconButton style={{marginTop:'3px'}}
|
|
2147
|
+
// color="inherit"
|
|
2148
|
+
// //onClick={/*dispatch que lleva a pantalla opciones*/}
|
|
2149
|
+
//>
|
|
2150
|
+
// <ICON.Settings/>
|
|
2151
|
+
//</IconButton>
|
|
2072
2152
|
}
|
|
2073
|
-
{online?
|
|
2153
|
+
{online ?
|
|
2074
2154
|
<>
|
|
2075
2155
|
<IconButton
|
|
2076
2156
|
color="inherit"
|
|
2077
|
-
onClick={()=>{
|
|
2157
|
+
onClick={() => {
|
|
2078
2158
|
gotoSincronizar()
|
|
2079
2159
|
}}
|
|
2080
2160
|
>
|
|
2081
|
-
<ICON.SyncAlt/>
|
|
2161
|
+
<ICON.SyncAlt />
|
|
2082
2162
|
</IconButton>
|
|
2083
2163
|
</>
|
|
2084
|
-
|
|
2085
|
-
<Typography><span style={{marginLeft:'5px'}}>{modoDM=='capa'?' MODO CAPACITACIÓN':''}</span></Typography>
|
|
2164
|
+
: null}
|
|
2165
|
+
<Typography><span style={{ marginLeft: '5px' }}>{modoDM == 'capa' ? ' MODO CAPACITACIÓN' : ''}</span></Typography>
|
|
2086
2166
|
</Toolbar>
|
|
2087
2167
|
</AppBar>
|
|
2088
2168
|
<div className="hoja-de-ruta">
|
|
2089
|
-
<Paper style={{marginBottom: '10px', padding: '10px'}}>
|
|
2090
|
-
{modo.demo
|
|
2169
|
+
<Paper style={{ marginBottom: '10px', padding: '10px' }}>
|
|
2170
|
+
{modo.demo ? <div>
|
|
2091
2171
|
<Typography>Modo demo </Typography>
|
|
2092
2172
|
<Button variant="outlined" color="secondary"
|
|
2093
|
-
onClick={()=>dispatch(dispatchers.REINICIAR_DEMO({}))}
|
|
2173
|
+
onClick={() => dispatch(dispatchers.REINICIAR_DEMO({}))}
|
|
2094
2174
|
>
|
|
2095
2175
|
reiniciar
|
|
2096
2176
|
</Button>
|
|
2097
|
-
</div
|
|
2177
|
+
</div> : null}
|
|
2098
2178
|
<div className="nombre-version">
|
|
2099
2179
|
<div>Instituto de Estadística y Censos de la Ciudad Autónoma de Buenos Aires - IDECBA</div>
|
|
2100
|
-
<div>{my.getLocalVar('app-version')} sincro {num_sincro}
|
|
2180
|
+
<div>versión {my.getLocalVar('app-cache-version')} - sincro {num_sincro}</div>
|
|
2101
2181
|
</div>
|
|
2102
2182
|
</Paper>
|
|
2103
|
-
{likeAr(cargas).map((carga, idCarga, _, posicion)=>
|
|
2104
|
-
<DesplegarCarga key={idCarga} carga={carga} idCarga={idCarga} posicion={posicion} informacionHdr={informacionHdr} feedbackRowValidator={feedbackRowValidator} respuestas={respuestas}/>
|
|
2183
|
+
{likeAr(cargas).map((carga, idCarga, _, posicion) =>
|
|
2184
|
+
<DesplegarCarga key={idCarga} carga={carga} idCarga={idCarga} posicion={posicion} informacionHdr={informacionHdr} feedbackRowValidator={feedbackRowValidator} respuestas={respuestas} />
|
|
2105
2185
|
).array()}
|
|
2106
2186
|
</div>
|
|
2107
2187
|
</>
|
|
2108
2188
|
);
|
|
2109
2189
|
});
|
|
2110
2190
|
|
|
2111
|
-
export function ListaTextos(props:{textos:string[]}){
|
|
2191
|
+
export function ListaTextos(props: { textos: string[] }) {
|
|
2112
2192
|
return <ul>
|
|
2113
|
-
{props.textos.map(t
|
|
2193
|
+
{props.textos.map(t => <li><Typography>{t}</Typography></li>)}
|
|
2114
2194
|
</ul>;
|
|
2115
2195
|
}
|
|
2116
2196
|
|
|
2117
|
-
export function BienvenidaDespliegue(props:{modo:CasoState["modo"]}){
|
|
2118
|
-
const dispatch=useDispatch();
|
|
2197
|
+
export function BienvenidaDespliegue(props: { modo: CasoState["modo"] }) {
|
|
2198
|
+
const dispatch = useDispatch();
|
|
2119
2199
|
return <Paper className="bienvenida">
|
|
2120
|
-
{props.modo.demo?
|
|
2200
|
+
{props.modo.demo ?
|
|
2121
2201
|
<>
|
|
2122
2202
|
<Typography>DEMO del sistema de relevamiento de DMENCU</Typography>
|
|
2123
2203
|
<Typography>En esta demo:</Typography>
|
|
@@ -2128,95 +2208,95 @@ export function BienvenidaDespliegue(props:{modo:CasoState["modo"]}){
|
|
|
2128
2208
|
"Todavía hay cosas que faltan o pueden cambiar",
|
|
2129
2209
|
]} />
|
|
2130
2210
|
</>
|
|
2131
|
-
|
|
2211
|
+
: <>
|
|
2132
2212
|
<Typography>Encuesta de Seroprevalencia de COVID-19</Typography>
|
|
2133
2213
|
</>
|
|
2134
2214
|
}
|
|
2135
2215
|
<Button
|
|
2136
2216
|
variant="contained"
|
|
2137
2217
|
color="secondary"
|
|
2138
|
-
onClick={()=>{ gotoSincronizar(); }}
|
|
2218
|
+
onClick={() => { gotoSincronizar(); }}
|
|
2139
2219
|
>
|
|
2140
|
-
<span>Sincronizar </span> <ICON.SyncAlt/>
|
|
2220
|
+
<span>Sincronizar </span> <ICON.SyncAlt />
|
|
2141
2221
|
</Button>
|
|
2142
2222
|
<Button
|
|
2143
2223
|
variant="contained"
|
|
2144
2224
|
color="primary"
|
|
2145
|
-
onClick={()=>dispatch(dispatchers.SET_OPCION({opcion:'bienvenido', valor:true}))}
|
|
2225
|
+
onClick={() => dispatch(dispatchers.SET_OPCION({ opcion: 'bienvenido', valor: true }))}
|
|
2146
2226
|
>
|
|
2147
|
-
<span>Continuar </span> <ICON.Send/>
|
|
2227
|
+
<span>Continuar </span> <ICON.Send />
|
|
2148
2228
|
</Button>
|
|
2149
2229
|
</Paper>
|
|
2150
2230
|
}
|
|
2151
2231
|
|
|
2152
2232
|
//CONTROL DE PESTAÑAS
|
|
2153
|
-
var allOpenedTabs:{[x:string]:number}={};
|
|
2154
|
-
var infoOpenedTabs={
|
|
2233
|
+
var allOpenedTabs: { [x: string]: number } = {};
|
|
2234
|
+
var infoOpenedTabs = {
|
|
2155
2235
|
allOpenedTabs,
|
|
2156
|
-
myId:'calculando...',
|
|
2157
|
-
otherTabsNames:''
|
|
2236
|
+
myId: 'calculando...',
|
|
2237
|
+
otherTabsNames: ''
|
|
2158
2238
|
}
|
|
2159
2239
|
|
|
2160
|
-
export function OpenedTabs(){
|
|
2240
|
+
export function OpenedTabs() {
|
|
2161
2241
|
const [tabs, setTabs] = useState(infoOpenedTabs.otherTabsNames);
|
|
2162
|
-
var {modoDirecto} = useSelector((state:CasoState)=>({modoDirecto:state.opciones.modoDirecto}));
|
|
2163
|
-
const updateTabsStatus = function(){
|
|
2242
|
+
var { modoDirecto } = useSelector((state: CasoState) => ({ modoDirecto: state.opciones.modoDirecto }));
|
|
2243
|
+
const updateTabsStatus = function () {
|
|
2164
2244
|
setTabs(infoOpenedTabs.otherTabsNames);
|
|
2165
2245
|
}
|
|
2166
|
-
useEffect(()=>{
|
|
2167
|
-
window.addEventListener('my-tabs',updateTabsStatus);
|
|
2168
|
-
return () => window.removeEventListener('my-tabs',updateTabsStatus);
|
|
2169
|
-
},[])
|
|
2170
|
-
return modoDirecto?null:(tabs)?
|
|
2246
|
+
useEffect(() => {
|
|
2247
|
+
window.addEventListener('my-tabs', updateTabsStatus);
|
|
2248
|
+
return () => window.removeEventListener('my-tabs', updateTabsStatus);
|
|
2249
|
+
}, [])
|
|
2250
|
+
return modoDirecto ? null : (tabs) ?
|
|
2171
2251
|
<div className="tab-counter tab-error">¡ATENCIÓN! Hay más de una ventana abierta. Se pueden perder datos: {tabs}</div>
|
|
2172
|
-
|
|
2252
|
+
:
|
|
2173
2253
|
<div className="tab-counter">✔</div>
|
|
2174
2254
|
}
|
|
2175
2255
|
|
|
2176
|
-
export function AppDmEncu(){
|
|
2177
|
-
var {forPk, bienvenido, modo} = useSelector((state:CasoState)=>({...state.opciones, ...state.modo, ...state}));
|
|
2178
|
-
if(!bienvenido){
|
|
2179
|
-
return <BienvenidaDespliegue modo={modo}/>
|
|
2180
|
-
}else if(forPk==null){
|
|
2181
|
-
return <HojaDeRutaDespliegue />
|
|
2182
|
-
}else{
|
|
2183
|
-
return <FormularioDespliegue forPk={forPk}/>
|
|
2256
|
+
export function AppDmEncu() {
|
|
2257
|
+
var { forPk, bienvenido, modo } = useSelector((state: CasoState) => ({ ...state.opciones, ...state.modo, ...state }));
|
|
2258
|
+
if (!bienvenido) {
|
|
2259
|
+
return <BienvenidaDespliegue modo={modo} />
|
|
2260
|
+
} else if (forPk == null) {
|
|
2261
|
+
return <HojaDeRutaDespliegue />
|
|
2262
|
+
} else {
|
|
2263
|
+
return <FormularioDespliegue forPk={forPk} />
|
|
2184
2264
|
}
|
|
2185
2265
|
}
|
|
2186
2266
|
|
|
2187
|
-
function PantallaInicialSinCarga(_props:{}){
|
|
2267
|
+
function PantallaInicialSinCarga(_props: {}) {
|
|
2188
2268
|
const online = useOnlineStatus();
|
|
2189
2269
|
|
|
2190
|
-
const paragraphStyles={fontSize:"1.2rem", fontWeight:600, padding: "5px 10px"};
|
|
2191
|
-
const modoDM:ModoDM = my.getLocalVar(MODO_DM_LOCALSTORAGE_KEY);
|
|
2270
|
+
const paragraphStyles = { fontSize: "1.2rem", fontWeight: 600, padding: "5px 10px" };
|
|
2271
|
+
const modoDM: ModoDM = my.getLocalVar(MODO_DM_LOCALSTORAGE_KEY);
|
|
2192
2272
|
return (
|
|
2193
2273
|
<>
|
|
2194
|
-
<AppBar position="fixed" color={modoDM=='capa'?'success':'primary'}>
|
|
2195
|
-
<Typography variant="h6" style={{margin:25}}>
|
|
2196
|
-
Dispositivo sin carga - {modoDM=='capa'?'MODO CAPACITACIÓN':''}
|
|
2274
|
+
<AppBar position="fixed" color={modoDM == 'capa' ? 'success' : 'primary'}>
|
|
2275
|
+
<Typography variant="h6" style={{ margin: 25 }}>
|
|
2276
|
+
Dispositivo sin carga - {modoDM == 'capa' ? 'MODO CAPACITACIÓN' : ''}
|
|
2197
2277
|
</Typography>
|
|
2198
2278
|
</AppBar>
|
|
2199
2279
|
<main>
|
|
2200
|
-
<Paper style={{height:'600px', padding:"15px", marginTop:75}}>
|
|
2280
|
+
<Paper style={{ height: '600px', padding: "15px", marginTop: 75 }}>
|
|
2201
2281
|
<div>
|
|
2202
|
-
{online?
|
|
2282
|
+
{online ?
|
|
2203
2283
|
<>
|
|
2204
2284
|
<Typography component="p" style={paragraphStyles}>
|
|
2205
2285
|
Sincronizar dispositivo
|
|
2206
|
-
<span style={{padding:'5px'}}>
|
|
2286
|
+
<span style={{ padding: '5px' }}>
|
|
2207
2287
|
<Button
|
|
2208
|
-
color={modoDM=='capa'?'success':"primary"}
|
|
2288
|
+
color={modoDM == 'capa' ? 'success' : "primary"}
|
|
2209
2289
|
variant="contained"
|
|
2210
|
-
onClick={()=>{
|
|
2290
|
+
onClick={() => {
|
|
2211
2291
|
gotoSincronizar()
|
|
2212
2292
|
}}
|
|
2213
2293
|
>
|
|
2214
|
-
<ICON.SyncAlt/>
|
|
2294
|
+
<ICON.SyncAlt />
|
|
2215
2295
|
</Button>
|
|
2216
2296
|
</span>
|
|
2217
2297
|
</Typography>
|
|
2218
2298
|
</>
|
|
2219
|
-
|
|
2299
|
+
:
|
|
2220
2300
|
<Typography component="p" style={paragraphStyles}>
|
|
2221
2301
|
No hay conexión a internet, por favor conécte el dispositivo a una red para sincronizar una hoja de ruta.
|
|
2222
2302
|
</Typography>
|
|
@@ -2228,49 +2308,49 @@ function PantallaInicialSinCarga(_props:{}){
|
|
|
2228
2308
|
);
|
|
2229
2309
|
}
|
|
2230
2310
|
|
|
2231
|
-
export function PantallaInicial(){
|
|
2232
|
-
var {forPk, bienvenido, modo} = useSelector((state:CasoState)=>({...state.opciones, ...state.modo, ...state}));
|
|
2233
|
-
if(!bienvenido){
|
|
2234
|
-
return <BienvenidaDespliegue modo={modo}/>
|
|
2235
|
-
}else if(forPk==null){
|
|
2236
|
-
return <HojaDeRutaDespliegue />
|
|
2237
|
-
}else{
|
|
2238
|
-
return <FormularioDespliegue forPk={forPk}/>
|
|
2311
|
+
export function PantallaInicial() {
|
|
2312
|
+
var { forPk, bienvenido, modo } = useSelector((state: CasoState) => ({ ...state.opciones, ...state.modo, ...state }));
|
|
2313
|
+
if (!bienvenido) {
|
|
2314
|
+
return <BienvenidaDespliegue modo={modo} />
|
|
2315
|
+
} else if (forPk == null) {
|
|
2316
|
+
return <HojaDeRutaDespliegue />
|
|
2317
|
+
} else {
|
|
2318
|
+
return <FormularioDespliegue forPk={forPk} />
|
|
2239
2319
|
}
|
|
2240
2320
|
}
|
|
2241
2321
|
|
|
2242
|
-
export async function dmPantallaInicialSinCarga(){
|
|
2243
|
-
try{
|
|
2322
|
+
export async function dmPantallaInicialSinCarga() {
|
|
2323
|
+
try {
|
|
2244
2324
|
await loadCSS(BOOTSTRAP_5_1_3_SRC);
|
|
2245
|
-
}catch(err){
|
|
2246
|
-
throw(err)
|
|
2325
|
+
} catch (err) {
|
|
2326
|
+
throw (err)
|
|
2247
2327
|
}
|
|
2248
2328
|
ReactDOM.render(
|
|
2249
|
-
<PantallaInicialSinCarga/>,
|
|
2329
|
+
<PantallaInicialSinCarga />,
|
|
2250
2330
|
document.getElementById('main_layout')
|
|
2251
2331
|
)
|
|
2252
2332
|
}
|
|
2253
2333
|
|
|
2254
|
-
export async function desplegarFormularioActual(opts:{modoDemo:boolean, forPkRaiz?:ForPkRaiz, operativo:IdOperativo}){
|
|
2334
|
+
export async function desplegarFormularioActual(opts: { modoDemo: boolean, forPkRaiz?: ForPkRaiz, operativo: IdOperativo }) {
|
|
2255
2335
|
// traer los metadatos en una "estructura"
|
|
2256
2336
|
// traer los datos de localStorage
|
|
2257
2337
|
// verificar el main Layout
|
|
2258
2338
|
const store = await dmTraerDatosFormulario(opts)
|
|
2259
|
-
try{
|
|
2339
|
+
try {
|
|
2260
2340
|
await loadCSS(BOOTSTRAP_5_1_3_SRC);
|
|
2261
|
-
}catch(err){
|
|
2262
|
-
throw(err)
|
|
2341
|
+
} catch (err) {
|
|
2342
|
+
throw (err)
|
|
2263
2343
|
}
|
|
2264
2344
|
ReactDOM.render(
|
|
2265
|
-
<RenderPrincipal store={store} dispatchers={dispatchers} mensajeRetorno={opts.forPkRaiz?"Volver al formulario":"Volver a la hoja de ruta"}>
|
|
2266
|
-
<OpenedTabs/>
|
|
2267
|
-
<AppDmEncu/>
|
|
2345
|
+
<RenderPrincipal store={store} dispatchers={dispatchers} mensajeRetorno={opts.forPkRaiz ? "Volver al formulario" : "Volver a la hoja de ruta"}>
|
|
2346
|
+
<OpenedTabs />
|
|
2347
|
+
<AppDmEncu />
|
|
2268
2348
|
</RenderPrincipal>,
|
|
2269
2349
|
document.getElementById('main_layout')
|
|
2270
2350
|
)
|
|
2271
2351
|
}
|
|
2272
2352
|
|
|
2273
|
-
if(typeof window !== 'undefined'){
|
|
2353
|
+
if (typeof window !== 'undefined') {
|
|
2274
2354
|
// @ts-ignore para hacerlo
|
|
2275
2355
|
window.desplegarFormularioActual = desplegarFormularioActual;
|
|
2276
2356
|
// @ts-ignore para hacerlo
|
|
@@ -2278,51 +2358,51 @@ if(typeof window !== 'undefined'){
|
|
|
2278
2358
|
}
|
|
2279
2359
|
|
|
2280
2360
|
|
|
2281
|
-
function loadInstance(){
|
|
2282
|
-
if(typeof BroadcastChannel === 'undefined'){
|
|
2361
|
+
function loadInstance() {
|
|
2362
|
+
if (typeof BroadcastChannel === 'undefined') {
|
|
2283
2363
|
return;
|
|
2284
2364
|
}
|
|
2285
2365
|
var bc = new BroadcastChannel('contador');
|
|
2286
|
-
var myId=String.fromCodePoint(100+Math.floor(Math.random()*1000))+Math.floor(Math.random()*100)//+'-'+new Date().getTime();
|
|
2287
|
-
allOpenedTabs[myId]=1;
|
|
2288
|
-
infoOpenedTabs.myId=myId;
|
|
2366
|
+
var myId = String.fromCodePoint(100 + Math.floor(Math.random() * 1000)) + Math.floor(Math.random() * 100)//+'-'+new Date().getTime();
|
|
2367
|
+
allOpenedTabs[myId] = 1;
|
|
2368
|
+
infoOpenedTabs.myId = myId;
|
|
2289
2369
|
var event = new Event('my-tabs');
|
|
2290
|
-
bc.onmessage=function(ev){
|
|
2291
|
-
if(ev.data.que=='soy'){
|
|
2292
|
-
if(!allOpenedTabs[ev.data.id]){
|
|
2293
|
-
allOpenedTabs[ev.data.id]=0;
|
|
2370
|
+
bc.onmessage = function (ev) {
|
|
2371
|
+
if (ev.data.que == 'soy') {
|
|
2372
|
+
if (!allOpenedTabs[ev.data.id]) {
|
|
2373
|
+
allOpenedTabs[ev.data.id] = 0;
|
|
2294
2374
|
}
|
|
2295
2375
|
allOpenedTabs[ev.data.id]++;
|
|
2296
2376
|
}
|
|
2297
|
-
if(ev.data.que=='unload'){
|
|
2377
|
+
if (ev.data.que == 'unload') {
|
|
2298
2378
|
delete allOpenedTabs[ev.data.id];
|
|
2299
2379
|
}
|
|
2300
|
-
if(ev.data.que=='load'){
|
|
2301
|
-
allOpenedTabs[ev.data.id]=1;
|
|
2302
|
-
bc.postMessage({que:'soy',id:myId});
|
|
2380
|
+
if (ev.data.que == 'load') {
|
|
2381
|
+
allOpenedTabs[ev.data.id] = 1;
|
|
2382
|
+
bc.postMessage({ que: 'soy', id: myId });
|
|
2303
2383
|
}
|
|
2304
|
-
infoOpenedTabs.otherTabsNames=likeAr(allOpenedTabs).filter((_,id)=>id!=myId).join(',');
|
|
2384
|
+
infoOpenedTabs.otherTabsNames = likeAr(allOpenedTabs).filter((_, id) => id != myId).join(',');
|
|
2305
2385
|
window.dispatchEvent(event);
|
|
2306
2386
|
};
|
|
2307
|
-
bc.postMessage({que:'load',id:myId});
|
|
2387
|
+
bc.postMessage({ que: 'load', id: myId });
|
|
2308
2388
|
window.dispatchEvent(event);
|
|
2309
|
-
window.addEventListener('unload',function(){
|
|
2310
|
-
bc.postMessage({que:'unload',id:myId});
|
|
2389
|
+
window.addEventListener('unload', function () {
|
|
2390
|
+
bc.postMessage({ que: 'unload', id: myId });
|
|
2311
2391
|
window.dispatchEvent(event);
|
|
2312
2392
|
})
|
|
2313
2393
|
//mostrarQuienesSomos();
|
|
2314
2394
|
}
|
|
2315
2395
|
|
|
2316
|
-
export const setLibreDespliegue = (libre:LibreDespliegueType)=>LibreDespliegue = libre
|
|
2396
|
+
export const setLibreDespliegue = (libre: LibreDespliegueType) => LibreDespliegue = libre
|
|
2317
2397
|
|
|
2318
|
-
setLibreDespliegue((props:{
|
|
2319
|
-
key:string
|
|
2320
|
-
casillero:Libre
|
|
2321
|
-
formulario:Formulario
|
|
2322
|
-
forPk:ForPk
|
|
2323
|
-
})
|
|
2398
|
+
setLibreDespliegue((props: {
|
|
2399
|
+
key: string
|
|
2400
|
+
casillero: Libre
|
|
2401
|
+
formulario: Formulario
|
|
2402
|
+
forPk: ForPk
|
|
2403
|
+
}) => <div key={props.key} id={props.casillero.id_casillero}>este casillero debe redefinirse en la APP final y su uso es exclusivo del área informática</div>)
|
|
2324
2404
|
|
|
2325
|
-
setCalcularVariables((respuestasRaiz:RespuestasRaiz, forPk:ForPk)=>{
|
|
2405
|
+
setCalcularVariables((respuestasRaiz: RespuestasRaiz, forPk: ForPk) => {
|
|
2326
2406
|
type ConfigPadre = {
|
|
2327
2407
|
uaPersonas: IdUnidadAnalisis
|
|
2328
2408
|
varSexoPersona: IdVariable
|
|
@@ -2330,98 +2410,98 @@ setCalcularVariables((respuestasRaiz:RespuestasRaiz, forPk:ForPk)=>{
|
|
|
2330
2410
|
varLosNombres: IdVariable
|
|
2331
2411
|
}
|
|
2332
2412
|
var estructura = getEstructura();
|
|
2333
|
-
var autoCargarPersonas = (configPadre: ConfigPadre
|
|
2334
|
-
var leerNombres = (respuestasUAPadre:Respuestas, configPadre:ConfigPadre)=>{
|
|
2335
|
-
if(!respuestasUAPadre[configPadre.uaPersonas] || empty(respuestasUAPadre[configPadre.uaPersonas]) || respuestasUAPadre[configPadre.uaPersonas][0][configPadre.varSexoPersona] == null){
|
|
2413
|
+
var autoCargarPersonas = (configPadre: ConfigPadre, uaPadrePersonas: IdUnidadAnalisis, estructura: Estructura) => {
|
|
2414
|
+
var leerNombres = (respuestasUAPadre: Respuestas, configPadre: ConfigPadre) => {
|
|
2415
|
+
if (!respuestasUAPadre[configPadre.uaPersonas] || empty(respuestasUAPadre[configPadre.uaPersonas]) || respuestasUAPadre[configPadre.uaPersonas][0][configPadre.varSexoPersona] == null) {
|
|
2336
2416
|
var losNombres = respuestasUAPadre[configPadre.varLosNombres] as string
|
|
2337
|
-
if(losNombres != null){
|
|
2338
|
-
if(!respuestasUAPadre[configPadre.uaPersonas]){
|
|
2339
|
-
respuestasUAPadre[configPadre.uaPersonas]=[];
|
|
2417
|
+
if (losNombres != null) {
|
|
2418
|
+
if (!respuestasUAPadre[configPadre.uaPersonas]) {
|
|
2419
|
+
respuestasUAPadre[configPadre.uaPersonas] = [];
|
|
2340
2420
|
}
|
|
2341
2421
|
losNombres
|
|
2342
2422
|
.split(',')
|
|
2343
|
-
.filter((nombre:string)=>nombre.trim().length > 0)
|
|
2344
|
-
.forEach((nombre:string, i:number)=>{
|
|
2423
|
+
.filter((nombre: string) => nombre.trim().length > 0)
|
|
2424
|
+
.forEach((nombre: string, i: number) => {
|
|
2345
2425
|
respuestasUAPadre[configPadre.uaPersonas][i] = respuestasUAPadre[configPadre.uaPersonas][i] || {};
|
|
2346
2426
|
respuestasUAPadre[configPadre.uaPersonas][i][configPadre.varNombrePersona] = nombre.trim();
|
|
2347
2427
|
})
|
|
2348
2428
|
}
|
|
2349
2429
|
}
|
|
2350
2430
|
}
|
|
2351
|
-
if(estructura.unidades_analisis[uaPadrePersonas]){
|
|
2352
|
-
if(uaPadrePersonas == 'viviendas'){
|
|
2353
|
-
leerNombres(respuestasRaiz,configPadre)
|
|
2354
|
-
}else{
|
|
2355
|
-
for(var respuestasUAPadre of iterator(respuestasRaiz[uaPadrePersonas]??[])){
|
|
2356
|
-
leerNombres(respuestasUAPadre,configPadre)
|
|
2357
|
-
}
|
|
2431
|
+
if (estructura.unidades_analisis[uaPadrePersonas]) {
|
|
2432
|
+
if (uaPadrePersonas == 'viviendas') {
|
|
2433
|
+
leerNombres(respuestasRaiz, configPadre)
|
|
2434
|
+
} else {
|
|
2435
|
+
for (var respuestasUAPadre of iterator(respuestasRaiz[uaPadrePersonas] ?? [])) {
|
|
2436
|
+
leerNombres(respuestasUAPadre, configPadre)
|
|
2437
|
+
}
|
|
2358
2438
|
}
|
|
2359
2439
|
}
|
|
2360
2440
|
}
|
|
2361
2441
|
var uasIterar: {
|
|
2362
|
-
[key in IdUnidadAnalisis]:ConfigPadre
|
|
2363
|
-
};
|
|
2364
|
-
var configEncu
|
|
2442
|
+
[key in IdUnidadAnalisis]: ConfigPadre
|
|
2443
|
+
};
|
|
2444
|
+
var configEncu: ConfigPadre = {
|
|
2365
2445
|
uaPersonas: 'personas',
|
|
2366
2446
|
varSexoPersona: 'sexo' as IdVariable,
|
|
2367
2447
|
varNombrePersona: 'nombre' as IdVariable,
|
|
2368
2448
|
varLosNombres: "los_nombres" as IdVariable
|
|
2369
2449
|
};
|
|
2370
|
-
var configSupe
|
|
2450
|
+
var configSupe: ConfigPadre = {
|
|
2371
2451
|
uaPersonas: 'personas_sup' as IdUnidadAnalisis,
|
|
2372
|
-
varSexoPersona: 'sexo_sup'
|
|
2373
|
-
varNombrePersona: 'nombre_sup'
|
|
2374
|
-
varLosNombres: "nombres_componentes_sup"
|
|
2452
|
+
varSexoPersona: 'sexo_sup' as IdVariable,
|
|
2453
|
+
varNombrePersona: 'nombre_sup' as IdVariable,
|
|
2454
|
+
varLosNombres: "nombres_componentes_sup" as IdVariable
|
|
2375
2455
|
};
|
|
2376
2456
|
|
|
2377
|
-
if(estructura.conReaHogar){
|
|
2457
|
+
if (estructura.conReaHogar) {
|
|
2378
2458
|
uasIterar = {
|
|
2379
2459
|
hogares: configEncu,
|
|
2380
|
-
["hogares_sup" as IdUnidadAnalisis]
|
|
2460
|
+
["hogares_sup" as IdUnidadAnalisis]: configSupe
|
|
2381
2461
|
}
|
|
2382
|
-
likeAr(uasIterar).forEach((configPadre,uaPadre)=>{
|
|
2383
|
-
autoCargarPersonas(configPadre,uaPadre, estructura)
|
|
2384
|
-
|
|
2462
|
+
likeAr(uasIterar).forEach((configPadre, uaPadre) => {
|
|
2463
|
+
autoCargarPersonas(configPadre, uaPadre, estructura)
|
|
2464
|
+
|
|
2465
|
+
})
|
|
2466
|
+
} else {
|
|
2467
|
+
var configPadres: ConfigPadre[] = [configEncu, configSupe];
|
|
2468
|
+
configPadres.forEach((configPadre) => {
|
|
2469
|
+
autoCargarPersonas(configPadre, 'viviendas', estructura)
|
|
2385
2470
|
})
|
|
2386
|
-
}else{
|
|
2387
|
-
var configPadres: ConfigPadre[] = [configEncu,configSupe];
|
|
2388
|
-
configPadres.forEach((configPadre)=>{
|
|
2389
|
-
autoCargarPersonas(configPadre,'viviendas', estructura)
|
|
2390
|
-
})
|
|
2391
2471
|
}
|
|
2392
|
-
respuestasRaiz.vdominio=getDatosByPass().informacionHdr[forPk[estructura.pkAgregadaUaPpal]].tem.dominio;
|
|
2472
|
+
respuestasRaiz.vdominio = getDatosByPass().informacionHdr[forPk[estructura.pkAgregadaUaPpal]].tem.dominio;
|
|
2393
2473
|
//TODO: MEJORAR EN ALGUN MOMENTO EL BOTON LISTO
|
|
2394
2474
|
let totalH = respuestasRaiz['total_h' as IdVariable];
|
|
2395
|
-
respuestasRaiz['$B.F:S1' as IdVariable] = (respuestasRaiz['hogares'] || []).length == totalH?'ok':null;
|
|
2475
|
+
respuestasRaiz['$B.F:S1' as IdVariable] = (respuestasRaiz['hogares'] || []).length == totalH ? 'ok' : null;
|
|
2396
2476
|
let totalHsup = respuestasRaiz['total_h_sup' as IdVariable];
|
|
2397
|
-
respuestasRaiz['$B.F:S1_SUP' as IdVariable] = (respuestasRaiz['hogares_sup' as IdUnidadAnalisis] || []).length == totalHsup?'ok':null;
|
|
2477
|
+
respuestasRaiz['$B.F:S1_SUP' as IdVariable] = (respuestasRaiz['hogares_sup' as IdUnidadAnalisis] || []).length == totalHsup ? 'ok' : null;
|
|
2398
2478
|
})
|
|
2399
2479
|
|
|
2400
|
-
window.addEventListener('load', function(){
|
|
2480
|
+
window.addEventListener('load', function () {
|
|
2401
2481
|
loadInstance()
|
|
2402
2482
|
})
|
|
2403
2483
|
//FIN CONTROL PESTAÑAS
|
|
2404
2484
|
|
|
2405
|
-
function loadCSS(cssURL:string, id?:string):Promise<void>{
|
|
2406
|
-
return new Promise((
|
|
2407
|
-
var link = document.createElement(
|
|
2408
|
-
link.rel
|
|
2485
|
+
function loadCSS(cssURL: string, id?: string): Promise<void> {
|
|
2486
|
+
return new Promise((resolve, reject) => {
|
|
2487
|
+
var link = document.createElement('link');
|
|
2488
|
+
link.rel = 'stylesheet';
|
|
2409
2489
|
link.href = cssURL;
|
|
2410
2490
|
link.id = id || cssURL;
|
|
2411
|
-
document.head.appendChild(
|
|
2412
|
-
link.onload = ()=>{
|
|
2413
|
-
resolve();
|
|
2491
|
+
document.head.appendChild(link);
|
|
2492
|
+
link.onload = () => {
|
|
2493
|
+
resolve();
|
|
2414
2494
|
console.log(`trae ${cssURL}`);
|
|
2415
2495
|
};
|
|
2416
|
-
link.onerror=(err)=>{
|
|
2496
|
+
link.onerror = (err) => {
|
|
2417
2497
|
console.log('error cargando el estilo', err)
|
|
2418
2498
|
reject(new Error(`problema cargando estilo ${cssURL}`))
|
|
2419
2499
|
}
|
|
2420
2500
|
});
|
|
2421
2501
|
}
|
|
2422
2502
|
|
|
2423
|
-
function removeCSSById(id:string){
|
|
2424
|
-
var linkNode =
|
|
2503
|
+
function removeCSSById(id: string) {
|
|
2504
|
+
var linkNode = document.getElementById(id);
|
|
2425
2505
|
linkNode?.parentNode?.removeChild(linkNode);
|
|
2426
2506
|
}
|
|
2427
2507
|
|