Merge branch 'fix/ser_solapas_repetido_en_admin' into 'main'

arreglado. añadida comprobación para los demás servicios

See merge request jjimenez/safekat!579
This commit is contained in:
2025-02-27 15:41:02 +00:00
2 changed files with 87 additions and 76 deletions

View File

@ -390,6 +390,7 @@ class PresupuestoAdminEdit {
self.tiradasAlternativas.cargar(response.data.tiradasAlternativas); self.tiradasAlternativas.cargar(response.data.tiradasAlternativas);
self.resumen.cargar(response.data.resumen); self.resumen.cargar(response.data.resumen);
self.datosLibro.calcular_mermas();
setTimeout(() => { setTimeout(() => {

View File

@ -116,66 +116,76 @@ class Servicios {
} }
else if (servicio == 'ferro') { else if (servicio == 'ferro') {
const id = $('#ferro').attr('service-id'); const id = $('#ferro').attr('service-id');
if(!this.checkServiceInTable(this.serviciosExtra.table, id))
this.serviciosExtra.getPresupuestoExtra(id); this.serviciosExtra.getPresupuestoExtra(id);
} }
else if (servicio == 'prototipo') { else if (servicio == 'prototipo') {
const id = $('#prototipo').attr('service-id'); const id = $('#prototipo').attr('service-id');
if (!this.checkServiceInTable(this.serviciosExtra.table, id))
this.serviciosExtra.getPresupuestoExtra(id); this.serviciosExtra.getPresupuestoExtra(id);
} }
else if (servicio == 'retractilado') { else if (servicio == 'retractilado') {
const id = $('#retractilado').attr('service-id'); const id = $('#retractilado').attr('service-id');
if (!this.checkServiceInTable(this.serviciosAcabado.table, id))
this.serviciosAcabado.getPresupuestoAcabado(id); this.serviciosAcabado.getPresupuestoAcabado(id);
} }
else if (servicio == 'retractilado5') { else if (servicio == 'retractilado5') {
const id = $('#retractilado5').attr('service-id'); const id = $('#retractilado5').attr('service-id');
if (!this.checkServiceInTable(this.serviciosAcabado.table, id))
this.serviciosAcabado.getPresupuestoAcabado(id); this.serviciosAcabado.getPresupuestoAcabado(id);
} }
else if (servicio == 'plegado_guardas') { else if (servicio == 'plegado_guardas') {
const id = $('#plegado_guardas').attr('service-id'); const id = $('#plegado_guardas').attr('service-id');
for(let i = 0; i < this.ServiciosManipulado.table.rows().count(); i++){ if (!this.checkServiceInTable(this.ServiciosManipulado.table, id))
var data = this.ServiciosManipulado.table.row(i).data();
if (data.tarifa_id == id) {
return;
}
};
this.ServiciosManipulado.getPresupuestoManipulado(id); this.ServiciosManipulado.getPresupuestoManipulado(id);
} }
else if (servicio == 'solapas_cubierta') { else if (servicio == 'solapas_cubierta') {
const id = $('#serv_solapas_cubierta').attr('service-id'); const id = $('#serv_solapas_cubierta').attr('service-id');
if (!this.checkServiceInTable(this.ServiciosManipulado.table, id))
this.ServiciosManipulado.getPresupuestoManipulado(id); this.ServiciosManipulado.getPresupuestoManipulado(id);
} }
else if (servicio == 'solapas_sobrecubierta') { else if (servicio == 'solapas_sobrecubierta') {
const id = $('#serv_solapas_sobrecubierta').attr('service-id'); const id = $('#serv_solapas_sobrecubierta').attr('service-id');
if (!this.checkServiceInTable(this.ServiciosManipulado.table, id))
this.ServiciosManipulado.getPresupuestoManipulado(id); this.ServiciosManipulado.getPresupuestoManipulado(id);
} }
else if (servicio == 'solapas_faja') { else if (servicio == 'solapas_faja') {
const id = $('#solapas_faja').attr('service-id'); const id = $('#solapas_faja').attr('service-id');
if (!this.checkServiceInTable(this.ServiciosManipulado.table, id))
this.ServiciosManipulado.getPresupuestoManipulado(id); this.ServiciosManipulado.getPresupuestoManipulado(id);
} }
else if (servicio == 'solapas_grandes_cubierta') { else if (servicio == 'solapas_grandes_cubierta') {
const id = $('#solapas_grandes_cubierta').attr('service-id'); const id = $('#solapas_grandes_cubierta').attr('service-id');
if (!this.checkServiceInTable(this.ServiciosManipulado.table, id))
this.ServiciosManipulado.getPresupuestoManipulado(id); this.ServiciosManipulado.getPresupuestoManipulado(id);
} }
else if (servicio == 'solapas_grandes_sobrecubierta') { else if (servicio == 'solapas_grandes_sobrecubierta') {
const id = $('#solapas_grandes_sobrecubierta').attr('service-id'); const id = $('#solapas_grandes_sobrecubierta').attr('service-id');
if (!this.checkServiceInTable(this.ServiciosManipulado.table, id))
this.ServiciosManipulado.getPresupuestoManipulado(id); this.ServiciosManipulado.getPresupuestoManipulado(id);
} }
else if (servicio == 'solapas_grandes_faja') { else if (servicio == 'solapas_grandes_faja') {
const id = $('#solapas_grandes_faja').attr('service-id'); const id = $('#solapas_grandes_faja').attr('service-id');
if (!this.checkServiceInTable(this.ServiciosManipulado.table, id))
this.ServiciosManipulado.getPresupuestoManipulado(id); this.ServiciosManipulado.getPresupuestoManipulado(id);
} }
else if (servicio == 'lomo_redondo') { else if (servicio == 'lomo_redondo') {
const id = $('#compLomoRedondo').attr('service-id'); const id = $('#compLomoRedondo').attr('service-id');
for(let i = 0; i < this.ServiciosManipulado.table.rows().count(); i++){ if (!this.checkServiceInTable(this.ServiciosManipulado.table, id))
var data = this.ServiciosManipulado.table.row(i).data();
if (data.tarifa_id == id) {
return;
}
};
this.ServiciosManipulado.getPresupuestoManipulado(id); this.ServiciosManipulado.getPresupuestoManipulado(id);
} }
} }
checkServiceInTable(table, id) {
for (let i = 0; i < table.rows().count(); i++) {
let data = table.row(i).data();
if (data && data.tarifa_id == id) {
return true;
}
}
return false;
}
removeServicio(event, servicio) { removeServicio(event, servicio) {
if (servicio == 'ferro') { if (servicio == 'ferro') {