dmencu 3.2.10 → 3.2.12
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.
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
ModoDM,
|
|
31
31
|
IdComodin,
|
|
32
32
|
IdSemana,
|
|
33
|
+
UnidadAnalisis,
|
|
33
34
|
} from "./tipos";
|
|
34
35
|
import {
|
|
35
36
|
accion_abrir_formulario,
|
|
@@ -1194,55 +1195,90 @@ function botonesDelFormulario(r: Respuestas, unidad_analisis: IdUnidadAnalisis,
|
|
|
1194
1195
|
var formsVivienda = getFormulariosForValuePkRaiz(forPkPadre[estructura.pkAgregadaUaPpal]);
|
|
1195
1196
|
var uaDef = estructura.unidades_analisis[unidad_analisis];
|
|
1196
1197
|
var arrayEstructuraFormularios = (likeAr(estructura.formularios)).array();
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1198
|
+
|
|
1199
|
+
var casillerosPadre = estructura.formularios[forPkPadre.formulario]?.casilleros?.casilleros || [];
|
|
1200
|
+
var ordenFormulariosBfPadre: IdFormulario[] = [];
|
|
1201
|
+
for (var casillero of casillerosPadre) {
|
|
1202
|
+
if (casillero.tipoc == 'BF' && casillero.salto) {
|
|
1203
|
+
var formHijo = (casillero.salto.startsWith('F:') ? casillero.salto : 'F:' + casillero.salto) as IdFormulario;
|
|
1204
|
+
if (!ordenFormulariosBfPadre.includes(formHijo)) {
|
|
1205
|
+
ordenFormulariosBfPadre.push(formHijo);
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
var obtenerPosicionFormulario = (formulario: IdFormulario): number => {
|
|
1211
|
+
var idxBf = ordenFormulariosBfPadre.indexOf(formulario);
|
|
1212
|
+
if (idxBf >= 0) {
|
|
1213
|
+
return idxBf;
|
|
1214
|
+
}
|
|
1215
|
+
var idxEstructura = arrayEstructuraFormularios.findIndex((infoFormulario) => infoFormulario.casilleros.id_casillero == formulario);
|
|
1216
|
+
return idxEstructura >= 0 ? 1000 + idxEstructura : 9999;
|
|
1217
|
+
};
|
|
1218
|
+
|
|
1219
|
+
var obtenerPosicionFormularioUa = (ua: UnidadAnalisis): number => {
|
|
1220
|
+
var posiciones = arrayEstructuraFormularios
|
|
1221
|
+
.filter((infoFormulario) => infoFormulario.casilleros.unidad_analisis == ua.unidad_analisis)
|
|
1222
|
+
.map((infoFormulario) => obtenerPosicionFormulario(infoFormulario.casilleros.id_casillero as IdFormulario));
|
|
1223
|
+
return posiciones.length > 0 ? Math.min(...posiciones) : 9999;
|
|
1224
|
+
};
|
|
1225
|
+
|
|
1226
|
+
var hijasFiltradasYOrdenadas = (likeAr(uaDef.hijas))
|
|
1227
|
+
.array()
|
|
1228
|
+
.filter((uaHija): uaHija is UnidadAnalisis =>
|
|
1229
|
+
uaHija != null &&
|
|
1230
|
+
arrayEstructuraFormularios.some((infoFormulario) =>
|
|
1231
|
+
infoFormulario.casilleros.unidad_analisis == uaHija.unidad_analisis && formsVivienda.includes(infoFormulario.casilleros.id_casillero as IdFormulario)
|
|
1232
|
+
)
|
|
1233
|
+
)
|
|
1234
|
+
.sort((a, b) => obtenerPosicionFormularioUa(a) - obtenerPosicionFormularioUa(b));
|
|
1235
|
+
|
|
1236
|
+
var x = hijasFiltradasYOrdenadas.map(uaHija => (
|
|
1237
|
+
html.div({ class: 'ua-hijas' }, [
|
|
1238
|
+
html.div(uaHija.unidad_analisis),
|
|
1239
|
+
html.div(
|
|
1240
|
+
likeAr(r[uaHija.unidad_analisis] || []).map((respuestasHija, i) => {
|
|
1241
|
+
var num = Number(i) + 1
|
|
1242
|
+
var forPkHijaParcial = { ...forPkPadre, [uaHija.pk_agregada]: num };
|
|
1243
|
+
var configSorteoFormulario = estructura.configSorteo ? estructura.configSorteo[getMainFormForVivienda(forPkPadre[estructura.pkAgregadaUaPpal])] : null
|
|
1244
|
+
var habilitacionBotonFormulario = estructura.habilitacionBotonFormulario;
|
|
1245
|
+
return html.div({ class: 'numerador-ua' }, [
|
|
1246
|
+
html.div({ class: 'botones-ua' }, [
|
|
1247
|
+
html.div({ class: 'numero-ua' }, num.toString()),
|
|
1248
|
+
...likeAr(estructura.formularios)
|
|
1249
|
+
.filter(formDef => formDef.casilleros.unidad_analisis == uaHija.unidad_analisis && formsVivienda.includes(formDef.casilleros.id_casillero as IdFormulario))
|
|
1250
|
+
.array()
|
|
1251
|
+
.sort((a, b) => obtenerPosicionFormulario(a.casilleros.id_casillero as IdFormulario) - obtenerPosicionFormulario(b.casilleros.id_casillero as IdFormulario))
|
|
1252
|
+
.map((infoFormulario) => {
|
|
1253
|
+
var formulario = infoFormulario.casilleros.id_casillero as IdFormulario;
|
|
1254
|
+
var forPk = { ...forPkHijaParcial, formulario };
|
|
1255
|
+
var feedbackForm = feedbackAll[toPlainForPk(forPk)];
|
|
1256
|
+
return feedbackForm ? html.div({}, [
|
|
1257
|
+
// html.button((uaHija!).pk_agregada+" ok: "+(Number(i)+1)),
|
|
1258
|
+
botonFormularioConResumen(
|
|
1259
|
+
{
|
|
1260
|
+
forPk,
|
|
1261
|
+
num,
|
|
1262
|
+
actual: calcularActualBF(configSorteoFormulario, num, null, formulario, r),
|
|
1263
|
+
previo: false,
|
|
1264
|
+
disabled: calcularDisabledBF(configSorteoFormulario, habilitacionBotonFormulario, num, formulario, r)
|
|
1265
|
+
},
|
|
1266
|
+
feedbackForm,
|
|
1267
|
+
r,
|
|
1268
|
+
{ despliegueOculta: false, expresion_habilitar_js: '', nombre: formulario, aclaracion: null, salto: formulario },
|
|
1269
|
+
forPkPadre,
|
|
1270
|
+
"boton-ir-resumen-formulario",
|
|
1271
|
+
estructura.formularios[formulario].casilleros
|
|
1272
|
+
)
|
|
1273
|
+
]) : null
|
|
1274
|
+
}),
|
|
1241
1275
|
])
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1276
|
+
, botonesDelFormulario(respuestasHija, uaHija.unidad_analisis, estructura, forPkHijaParcial, feedbackAll)
|
|
1277
|
+
])
|
|
1278
|
+
}).array().map(x => x == null ? null : x)
|
|
1279
|
+
)
|
|
1280
|
+
])
|
|
1281
|
+
));
|
|
1246
1282
|
return html.div(/*{style:'display:flex; flex-direction:row'},*/x);
|
|
1247
1283
|
}
|
|
1248
1284
|
|