').append(
$('| ').append($('').text(resumen)),
- $(' | ').text(price)
+ $(' | ').text(price)
);
$tbody.append($row);
});
@@ -161,4 +161,5 @@ export function updateExtras() {
} else {
$table.addClass('d-none');
}
-}
\ No newline at end of file
+}
+
diff --git a/src/main/resources/static/assets/js/pages/imprimelibros/utils.js b/src/main/resources/static/assets/js/pages/imprimelibros/utils.js
index 15a4a3a..01ace58 100644
--- a/src/main/resources/static/assets/js/pages/imprimelibros/utils.js
+++ b/src/main/resources/static/assets/js/pages/imprimelibros/utils.js
@@ -1,14 +1,13 @@
-function formateaMoneda(valor, digits = 2, locale = 'es-ES', currency = 'EUR') {
+export function formateaMoneda(valor, digits = 2, locale = 'es-ES', currency = 'EUR') {
try {
return new Intl.NumberFormat(locale, { style: 'currency', currency, minimumFractionDigits: digits, useGrouping: true }).format(valor);
} catch {
return valor;
}
}
-export { formateaMoneda };
-function formateaNumero({
+export function formateaNumero({
valor,
digits = 2,
style = 'decimal',
@@ -31,10 +30,38 @@ function formateaNumero({
return new Intl.NumberFormat(locale, opts).format(n);
}
-export { formateaNumero };
-function isNumber(value) {
- return !isNaN(Number(value)) && value.trim() !== '';
+export function isNumber(value) {
+
+ if(typeof value === 'string') {
+ if(value.trim() === '') return false;
+ }
+ return !isNaN(Number(value));
}
-export { isNumber };
\ No newline at end of file
+
+// Aplana un objeto a "prefijo.clave" (sin arrays)
+export function dotify(obj, prefix = '') {
+ const out = {};
+ const walk = (o, path) => {
+ Object.entries(o).forEach(([k, v]) => {
+ const key = path ? `${path}.${k}` : k;
+ if (v !== null && typeof v === 'object' && !Array.isArray(v)) {
+ walk(v, key);
+ } else {
+ out[key] = v;
+ }
+ });
+ };
+ walk(obj, prefix);
+ return out;
+}
+
+// Convierte {a:1, b:2} en {"summary[a]":1, "summary[b]":2}
+export function bracketPrefix(obj, prefix) {
+ const out = {};
+ Object.entries(obj).forEach(([k, v]) => {
+ out[`${prefix}[${k}]`] = v;
+ });
+ return out;
+}
\ No newline at end of file
diff --git a/src/main/resources/templates/imprimelibros/presupuestos/presupuestador-items/_resumen.html b/src/main/resources/templates/imprimelibros/presupuestos/presupuestador-items/_resumen.html
deleted file mode 100644
index 50330b6..0000000
--- a/src/main/resources/templates/imprimelibros/presupuestos/presupuestador-items/_resumen.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/resources/templates/imprimelibros/presupuestos/presupuestador-items/_resumen_final.html b/src/main/resources/templates/imprimelibros/presupuestos/presupuestador-items/_resumen_final.html
new file mode 100644
index 0000000..e976517
--- /dev/null
+++ b/src/main/resources/templates/imprimelibros/presupuestos/presupuestador-items/_resumen_final.html
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+ |
+ Descripción |
+ Cantidad |
+ Precio unitario |
+ Precio total |
+
+
+
+
+
+
+ | Total |
+ 0,00 € |
+
+
+ | IVA (4%) |
+ 0,00 € |
+
+
+ | Total con IVA |
+ 0,00 € |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/templates/imprimelibros/presupuestos/presupuestador-items/_summary.html b/src/main/resources/templates/imprimelibros/presupuestos/presupuestador-items/_summary.html
index d181f17..ab5fd02 100644
--- a/src/main/resources/templates/imprimelibros/presupuestos/presupuestador-items/_summary.html
+++ b/src/main/resources/templates/imprimelibros/presupuestos/presupuestador-items/_summary.html
@@ -1,4 +1,4 @@
- |