<"mt-4 mb-3"p>',
ajax : $.fn.dataTable.pipeline( {
url: '= route_to('dataTableOfTarifaManipuladoLineas') ?>',
data: {
diff --git a/ci4/app/Views/themes/vuexy/form/tarifas/preimpresion/viewTarifapreimpresionForm.php b/ci4/app/Views/themes/vuexy/form/tarifas/preimpresion/viewTarifapreimpresionForm.php
index 8eb895fa..a3f3f0dc 100644
--- a/ci4/app/Views/themes/vuexy/form/tarifas/preimpresion/viewTarifapreimpresionForm.php
+++ b/ci4/app/Views/themes/vuexy/form/tarifas/preimpresion/viewTarifapreimpresionForm.php
@@ -1,4 +1,5 @@
= $this->include("themes/_commonPartialsBs/select2bs5") ?>
+= $this->include("themes/_commonPartialsBs/datatables") ?>
= $this->include("themes/_commonPartialsBs/sweetalert") ?>
= $this->extend('themes/vuexy/main/defaultlayout') ?>
= $this->section("content") ?>
@@ -26,25 +27,6 @@
-
-
-
-
-
-
- = view("themes/vuexy/components/forms/tarifa_maquinas", ["id" => "tarifa_maquina_component", "tarifaId" => $tarifapreimpresionEntity?->id]) ?>
-
-
-
-
-
-= $this->endSection() ?>
-= $this->section("additionalExternalJs") ?>
-
= $this->endSection() ?>
\ No newline at end of file
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js
index 5cf763c8..8b9e7cf3 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js
@@ -382,14 +382,35 @@ class PresupuestoAdminEdit {
).get();
}
+ /*
+ calcularSolapas() {
+
+
+ this.#getDatos(false, true);
+ if (Object.values(this.datos).every(this.#isValidDataForm)) {
+ new Ajax('/presupuestocliente/calcularsolapas',
+ this.datos,
+ {},
+ (response) => {
+ if (response === null || response === undefined || response === "") {
+ console.error("Error en el calculo máximo de solapas.");
+ return;
+ }
+ this.disenioCubierta.tamanioSolapasCubierta.attr('max', response);
+ this.disenioCubierta.solapasSobrecubierta.attr('max', response);
+ this.disenioCubierta.textoSolapasCubierta.text("Entre 60 y " + response + " mm");
+ this.disenioCubierta.textoSolapasSobrecubierta.text("Entre 60 y " + response + " mm");
+ },
+ () => { }
+ ).post();
+ }
+ }*/
checkPaginasPresupuesto() {
let cantidad_total = 0;
- // TO-DO
- /*
- tableLineasPresupuesto.rows().every(function (rowIdx, tableLoop, rowLoop) {
+ this.lineasPresupuesto.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
var rowData = this.data();
if (rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta' && rowData.row_id != 'lp_guardas')
cantidad_total += parseInt(rowData.paginas)
@@ -409,7 +430,54 @@ class PresupuestoAdminEdit {
`;
}
- $('#divAlarmasLineasPresupuesto').html(htmlString)*/
+ $('#divAlarmasLineasPresupuesto').html(htmlString)
+ }
+
+
+ getPaginasColor(){
+
+ let paginasColor = 0;
+ this.lineasPresupuesto.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
+ var rowData = this.data();
+ if (rowData.row_id === 'lp_color' || rowData.row_id === 'lp_colorhq') {
+ return parseInt(rowData.paginas);
+ }
+ if(rowData.row_id === 'lp_rot_color'){
+ return parseInt(rowData.numPagColor);
+ }
+ });
+ return paginasColor;
+ }
+
+ calcularSolapas() {
+
+ let datos = {
+ cliente_id: this.datosGenerales.cliente.getVal(),
+ tirada: this.datosGenerales.tirada.val(),
+ tamanio: this.getDimensionLibro(),
+ paginas: this.datosLibro.paginas.val(),
+ //paginasColor:
+
+
+ }
+
+ /*if (Object.values(this.datos).every(this.#isValidDataForm)) {
+ new Ajax('/presupuestocliente/calcularsolapas',
+ this.datos,
+ {},
+ (response) => {
+ if (response === null || response === undefined || response === "") {
+ console.error("Error en el calculo máximo de solapas.");
+ return;
+ }
+ this.disenioCubierta.tamanioSolapasCubierta.attr('max', response);
+ this.disenioCubierta.solapasSobrecubierta.attr('max', response);
+ this.disenioCubierta.textoSolapasCubierta.text("Entre 60 y " + response + " mm");
+ this.disenioCubierta.textoSolapasSobrecubierta.text("Entre 60 y " + response + " mm");
+ },
+ () => { }
+ ).post();
+ }*/
}
getDimensionLibro() {
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js
index 8bd7c1bc..099f08d0 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js
@@ -225,7 +225,7 @@ class DatosLibro {
}, 100);
// para que se actualice el comparador
- $('paginas').trigger('change');
+ this.updateComparador();
}
changeAnchoSolapasCubierta(){
@@ -238,7 +238,7 @@ class DatosLibro {
}
// para que se actualice el comparador
- $('paginas').trigger('change');
+ this.updateComparador();
}
@@ -269,7 +269,7 @@ class DatosLibro {
}
// para que se actualice el comparador
- $('paginas').trigger('change');
+ this.updateComparador();
}
@@ -332,10 +332,29 @@ class DatosLibro {
}
}
+ updateComparador(){
+
+ if($("#compPaginasNegro").hasClass('d-none')){
+ $('#compPaginasNegrohq').trigger('change');
+ }
+ else{
+ $('#compPaginasNegro').trigger('change');
+ }
+ $('#compCarasCubierta').trigger('change');
+
+ if($('#compSobrecubierta').length){
+ $('#compSobrecubierta').trigger('change');
+ }
+ if($('#compCarasGuardas').length){
+ $('#compCarasGuardas').trigger('change');
+ }
+ }
changeTirada(update_tiradas_alternativas = true) {
- this.calcular_mermas()
+ this.calcular_mermas();
+
+ this.updateComparador();
const url2 = window.location.href;
const url_parts2 = url2.split('/');
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/envios.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/envios.js
index e4126ce3..4217cc10 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/envios.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/envios.js
@@ -108,7 +108,7 @@ class Envios {
$("#costeEnvios").text(total.toFixed(2) + "€" || "0€");
- self.check_unidades_enviadas();
+ self.check_unidades_enviadas(null, self.recogerTaller.prop('checked'));
}
});
@@ -169,11 +169,10 @@ class Envios {
self.modalYesNo.init();
self.modalYesNo.show(() => {
self.table.clear().draw();
- self.check_unidades_enviadas();
+ self.check_unidades_enviadas(null, true);
self.recogerTaller.prop('checked', true);
- self.modalYesNo.hide();
self.insertarEnvio.addClass('d-none');
-
+ self.modalYesNo.hide();
});
}
else {
@@ -641,7 +640,11 @@ class Envios {
}
}
- check_unidades_enviadas() {
+ check_unidades_enviadas(event, recogerTaller = null) {
+
+ if(recogerTaller === null) {
+ recogerTaller = this.recogerTaller.prop('checked');
+ }
let cantidad_total = 0
this.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
@@ -650,7 +653,7 @@ class Envios {
const tirada = parseInt($('#tirada').val());
let htmlString = '';
- if (cantidad_total < tirada && this.recogerTaller.prop('checked') === false) {
+ if (cantidad_total < tirada && recogerTaller === false) {
htmlString = `
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js
index bdb46ae2..c7e25b1b 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js
@@ -320,7 +320,9 @@ class ServiciosAcabado {
},
{
data: 'precio_total', render: function (data, type, row) {
- const total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
+ let total = 0;
+ if(data !==undefined)
+ total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
return `
`;
}
@@ -644,9 +646,11 @@ class ServiciosPreimpresion {
{
data: 'precio', render: function (data, type, row) {
- const total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
+ let total = 0;
+ if(data !==undefined)
+ total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
return `
- `;
+ `;
}
},
@@ -675,6 +679,22 @@ class ServiciosPreimpresion {
});
+ $('#tableOfServiciosPreimpresion tbody').on('change', '.totales-preimpresion', function () {
+
+ let input = $(this);
+ let tarifa_id = input.attr('id').replace('precio_preimpresion_', '');
+ let newValue = parseFloat(input.val().replace(/\./g, '').replace(',', '.')) || 0;
+
+ let table = $('#tableOfServiciosPreimpresion').DataTable();
+ let row = table.rows().data().toArray().find(r => r.tarifa_id == tarifa_id);
+
+ if (row) {
+ row.precio = newValue;
+ table.row($(this).closest('tr')).data(row).draw(false);
+ self.check_serv_preimpresion_error();
+ }
+ });
+
$(document).on('click', '.btn-delete-servpreimpresion', function () {
const rowId = $(this).closest('td').parent()[0].sectionRowIndex;
@@ -743,7 +763,7 @@ class ServiciosPreimpresion {
const rows = this.table.rows().data().toArray();
for (let i = 0; i < rows.length; i++) {
- if (rows[i]['precio_total'] == 0) {
+ if (rows[i]['precio'] == 0) {
error = true;
break;
}
@@ -860,7 +880,9 @@ class ServiciosEncuadernacion {
},
{
data: 'precio_total', render: function (data, type, row) {
- const total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
+ let total = 0;
+ if(data !==undefined)
+ total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
return `
`;
}
@@ -1287,9 +1309,13 @@ class ServiciosManipulado {
},
{
data: 'precio_total', render: function (data, type, row) {
- const total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
+ let total = 0;
+ if(data !==undefined)
+ total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
+ else
+ data = 0;
return `
- `;
+ `;
}
},
{ data: 'margen' },
@@ -1315,6 +1341,21 @@ class ServiciosManipulado {
}
});
+ $('#tableOfServiciosManipulado tbody').on('change', '.totales-manipulado', function () {
+ let input = $(this);
+ let tarifa_id = input.attr('id').replace('precio_manipulado_', '');
+ let newValue = parseFloat(input.val().replace(/\./g, '').replace(',', '.')) || 0;
+
+ let table = $('#tableOfServiciosManipulado').DataTable();
+ let row = table.rows().data().toArray().find(r => r.tarifa_id == tarifa_id);
+
+ if (row) {
+ row.precio_total = newValue;
+ table.row($(this).closest('tr')).data(row).draw(false);
+ self.check_serv_manipulado_error();
+ }
+ });
+
this.addServicio.on('click', this.addServicioManipulado.bind(this));
$(document).on('click', '.btn-delete-servmanipulado', function () {
@@ -1534,9 +1575,11 @@ class ServiciosExtra {
{
data: 'precio', render: function (data, type, row) {
- const total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
+ let total = 0;
+ if(data !==undefined)
+ total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
return `
- `;
+ `;
}
},
@@ -1563,6 +1606,22 @@ class ServiciosExtra {
}
});
+ $('#tableOfServiciosExtra tbody').on('change', '.totales-extra', function () {
+
+ let input = $(this);
+ let tarifa_id = input.attr('id').replace('precio_extra_', '');
+ let newValue = parseFloat(input.val().replace(/\./g, '').replace(',', '.')) || 0;
+
+ let table = $('#tableOfServiciosExtra').DataTable();
+ let row = table.rows().data().toArray().find(r => r.tarifa_id == tarifa_id);
+
+ if (row) {
+ row.precio = newValue;
+ table.row($(this).closest('tr')).data(row).draw(false);
+ self.check_serv_extra_error();
+ }
+ });
+
$(document).on('click', '.btn-delete-servextra', function () {
const rowId = $(this).closest('td').parent()[0].sectionRowIndex;
self.table.row(rowId).remove().draw();
@@ -1644,7 +1703,7 @@ class ServiciosExtra {
const rows = this.table.rows().data().toArray();
for (let i = 0; i < rows.length; i++) {
- if (rows[i]['precio_total'] == 0) {
+ if (rows[i]['precio'] == 0) {
error = true;
break;
}
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js
index 2476ba59..2623ce40 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js
@@ -171,7 +171,7 @@ class PresupuestoCliente {
{},
(response) => {
if (response === null || response === undefined || response === "") {
- console.log("Error en el calculo máximo de solapas.");
+ console.error("Error en el calculo máximo de solapas.");
return;
}
this.disenioCubierta.tamanioSolapasCubierta.attr('max', response);