mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
solucionado el problema al insertar lineas con los acabados en presupuesto admin
This commit is contained in:
@ -532,7 +532,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
|||||||
$data['datosLibro']['fajaColorSolapasAncho'] = $presupuesto->solapas_ancho_faja_color;
|
$data['datosLibro']['fajaColorSolapasAncho'] = $presupuesto->solapas_ancho_faja_color;
|
||||||
$data['datosLibro']['fajaColorAlto'] = $presupuesto->alto_faja_color;
|
$data['datosLibro']['fajaColorAlto'] = $presupuesto->alto_faja_color;
|
||||||
|
|
||||||
$modelAcabado = model("App\Models\Tarifas\Acabados\TarifaAcabadoModel");
|
$modelAcabado = model("App\Models\Tarifas\Acabados\ServicioAcabadoModel");
|
||||||
$data['datosLibro']['acabadoCubierta']['id'] = $presupuesto->acabado_cubierta_id;
|
$data['datosLibro']['acabadoCubierta']['id'] = $presupuesto->acabado_cubierta_id;
|
||||||
if ($presupuesto->acabado_cubierta_id == 0) {
|
if ($presupuesto->acabado_cubierta_id == 0) {
|
||||||
$data['datosLibro']['acabadoCubierta']['text'] = "Ninguno";
|
$data['datosLibro']['acabadoCubierta']['text'] = "Ninguno";
|
||||||
|
|||||||
@ -279,14 +279,10 @@
|
|||||||
<select id="compSobrecubierta" name="comp_sobrecubierta"
|
<select id="compSobrecubierta" name="comp_sobrecubierta"
|
||||||
class="form-control select2bs2 comp_sobrecubierta_items" style="width: 100%;">
|
class="form-control select2bs2 comp_sobrecubierta_items" style="width: 100%;">
|
||||||
<option value="0">
|
<option value="0">
|
||||||
<p>
|
<?= lang('Presupuestos.no') ?>
|
||||||
<?= lang('Presupuestos.no') ?>
|
|
||||||
</p>
|
|
||||||
</option>
|
</option>
|
||||||
<option value="1">
|
<option value="1">
|
||||||
<p>
|
<?= lang('Presupuestos.si') ?>
|
||||||
<?= lang('Presupuestos.si') ?>
|
|
||||||
</p>
|
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -360,10 +360,10 @@ class Comparador {
|
|||||||
});
|
});
|
||||||
this.sobrecubierta.on('change', () => {
|
this.sobrecubierta.on('change', () => {
|
||||||
if (this.sobrecubierta.select2('data')[0].id == 1) {
|
if (this.sobrecubierta.select2('data')[0].id == 1) {
|
||||||
if ($('#solapas_sobrecubierta').prop('checked') == false) {
|
/*if ($('#solapas_sobrecubierta').prop('checked') == false) {
|
||||||
this.sobrecubierta.val(0);
|
this.sobrecubierta.val('0').trigger('change');
|
||||||
popErrorAlert(window.language.Presupuestos.errores.error_sobrecubierta_sin_solapas, 'divAlarmasComparador')
|
popErrorAlert(window.language.Presupuestos.errores.error_sobrecubierta_sin_solapas, 'divAlarmasComparador')
|
||||||
}
|
}*/
|
||||||
$('#solapas_sobrecubierta').prop('checked', true);
|
$('#solapas_sobrecubierta').prop('checked', true);
|
||||||
$('#div_solapas_ancho_sobrecubierta').removeClass('d-none');
|
$('#div_solapas_ancho_sobrecubierta').removeClass('d-none');
|
||||||
$('#solapas_ancho_sobrecubierta').val(60);
|
$('#solapas_ancho_sobrecubierta').val(60);
|
||||||
@ -1458,7 +1458,7 @@ class Comparador {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.tipo_impresion_id != 5 && this.tipo_impresion_id != 6 && this.tipo_impresion_id != 7 && this.tipo_impresion_id != 8 && this.tipo_impresion_id != 21) {
|
if (this.tipo_impresion_id != 5 && this.tipo_impresion_id != 6 && this.tipo_impresion_id != 7 && this.tipo_impresion_id != 8 && this.tipo_impresion_id != 21) {
|
||||||
if (this.sobrecubierta.val() == 1) {
|
if (this.sobrecubierta.select2('data').length >0 && parseInt(this.sobrecubierta.select2('data')[0].id) == 1) {
|
||||||
datosComp.sobrecubierta = this.getDataForComp('sobrecubierta');
|
datosComp.sobrecubierta = this.getDataForComp('sobrecubierta');
|
||||||
if (datosComp.sobrecubierta.error) {
|
if (datosComp.sobrecubierta.error) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -92,7 +92,15 @@ class DatosLibro {
|
|||||||
$(document).trigger('remove-servicio-lineas', 'acabadoCubierta');
|
$(document).trigger('remove-servicio-lineas', 'acabadoCubierta');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$(document).trigger('add-servicio-lineas', 'acabadoCubierta');
|
const table = $('#tableLineasPresupuesto').DataTable();
|
||||||
|
const rows = table.rows().data();
|
||||||
|
for (let i = 0; i < rows.length; i++) {
|
||||||
|
const rowData = rows[i];
|
||||||
|
if (rowData.row_id === 'lp_cubierta') {
|
||||||
|
$(document).trigger('add-servicio-lineas', 'acabadoCubierta');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -106,7 +114,15 @@ class DatosLibro {
|
|||||||
$(document).trigger('remove-servicio-lineas', 'acabadoSobrecubierta');
|
$(document).trigger('remove-servicio-lineas', 'acabadoSobrecubierta');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$(document).trigger('add-servicio-lineas', 'acabadoSobrecubierta');
|
const table = $('#tableLineasPresupuesto').DataTable();
|
||||||
|
const rows = table.rows().data();
|
||||||
|
for (let i = 0; i < rows.length; i++) {
|
||||||
|
const rowData = rows[i];
|
||||||
|
if (rowData.row_id === 'lp_sobrecubierta') {
|
||||||
|
$(document).trigger('add-servicio-lineas', 'acabadoSobrecubierta');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -119,7 +135,15 @@ class DatosLibro {
|
|||||||
$(document).trigger('remove-servicio-lineas', 'acabadoFaja');
|
$(document).trigger('remove-servicio-lineas', 'acabadoFaja');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$(document).trigger('add-servicio-lineas', 'acabadoFaja');
|
const table = $('#tableLineasPresupuesto').DataTable();
|
||||||
|
const rows = table.rows().data();
|
||||||
|
for (let i = 0; i < rows.length; i++) {
|
||||||
|
const rowData = rows[i];
|
||||||
|
if (rowData.row_id === 'lp_faja') {
|
||||||
|
$(document).trigger('add-servicio-lineas', 'acabadoFaja');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1699,7 +1699,7 @@ class LineasPresupuesto {
|
|||||||
|
|
||||||
$(document).trigger('update-presupuesto', {
|
$(document).trigger('update-presupuesto', {
|
||||||
update_lineas: false,
|
update_lineas: false,
|
||||||
update_servicios: true,
|
update_servicios: false,
|
||||||
update_envios: true,
|
update_envios: true,
|
||||||
update_resumen: true,
|
update_resumen: true,
|
||||||
update_tiradas_alternativas: true
|
update_tiradas_alternativas: true
|
||||||
@ -2044,12 +2044,14 @@ class LineasPresupuesto {
|
|||||||
for (const row of rows) {
|
for (const row of rows) {
|
||||||
this.rellenarDatosLinea('lp_faja', row, true);
|
this.rellenarDatosLinea('lp_faja', row, true);
|
||||||
}
|
}
|
||||||
|
if ($('#acabado_faja_id').val() > 0)
|
||||||
|
$(document).trigger('add-servicio-lineas', 'acabadoFaja');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$(document).trigger('update-presupuesto', {
|
$(document).trigger('update-presupuesto', {
|
||||||
update_lineas: false,
|
update_lineas: false,
|
||||||
update_servicios: true,
|
update_servicios: false,
|
||||||
update_envios: true,
|
update_envios: true,
|
||||||
update_resumen: true,
|
update_resumen: true,
|
||||||
update_tiradas_alternativas: true
|
update_tiradas_alternativas: true
|
||||||
|
|||||||
@ -435,9 +435,9 @@ class ServiciosAcabado {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ data: 'margen' },
|
{ data: 'margen' },
|
||||||
{ data: 'cubierta', visible: false },
|
{ data: 'cubierta', visible: true },
|
||||||
{ data: 'sobrecubierta', visible: false },
|
{ data: 'sobrecubierta', visible: true },
|
||||||
{ data: 'faja', visible: false },
|
{ data: 'faja', visible: true },
|
||||||
{
|
{
|
||||||
data: function (row) {
|
data: function (row) {
|
||||||
return `
|
return `
|
||||||
@ -555,13 +555,6 @@ class ServiciosAcabado {
|
|||||||
|
|
||||||
updateAcabadosExteriores(cubierta, sobrecubierta, faja) {
|
updateAcabadosExteriores(cubierta, sobrecubierta, faja) {
|
||||||
|
|
||||||
for (let i = this.table.rows().count() - 1; i >= 0; i--) {
|
|
||||||
let data = this.table.row(i).data();
|
|
||||||
if (data && (data.cubierta == cubierta && data.sobrecubierta == sobrecubierta && data.faja == faja)) {
|
|
||||||
this.table.row(i).remove().draw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let tarifa_id = 0;
|
let tarifa_id = 0;
|
||||||
let uso = 'cubierta';
|
let uso = 'cubierta';
|
||||||
if (cubierta == 1) {
|
if (cubierta == 1) {
|
||||||
@ -603,6 +596,32 @@ class ServiciosAcabado {
|
|||||||
new Ajax('/serviciosacabados/getvalues', datos, {},
|
new Ajax('/serviciosacabados/getvalues', datos, {},
|
||||||
function (response) {
|
function (response) {
|
||||||
if (response.values) {
|
if (response.values) {
|
||||||
|
if(uso=='cubierta'){
|
||||||
|
for (let i = self.table.rows().count() - 1; i >= 0; i--) {
|
||||||
|
let data = self.table.row(i).data();
|
||||||
|
if (data && (data.cubierta == 1)) {
|
||||||
|
self.table.row(i).remove().draw(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(uso=='sobrecubierta'){
|
||||||
|
for (let i = self.table.rows().count() - 1; i >= 0; i--) {
|
||||||
|
let data = self.table.row(i).data();
|
||||||
|
if (data && (data.sobrecubierta == 1)) {
|
||||||
|
self.table.row(i).remove().draw(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(uso=='faja'){
|
||||||
|
for (let i = self.table.rows().count() - 1; i >= 0; i--) {
|
||||||
|
let data = self.table.row(i).data();
|
||||||
|
if (data && (data.faja == 1)) {
|
||||||
|
self.table.row(i).remove().draw(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < response.values.length; i++) {
|
for (let i = 0; i < response.values.length; i++) {
|
||||||
response.values[i].cubierta = 0;
|
response.values[i].cubierta = 0;
|
||||||
response.values[i].sobrecubierta = 0;
|
response.values[i].sobrecubierta = 0;
|
||||||
@ -617,12 +636,14 @@ class ServiciosAcabado {
|
|||||||
response.values[i].faja = 1;
|
response.values[i].faja = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateSelect != null) {
|
if (updateSelect != null) {
|
||||||
self.table.row(updateSelect.closest('tr')).data(response.values[0]).draw();
|
self.table.row(updateSelect.closest('tr')).data(response.values[0]).draw();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
self.table.rows.add(response.values).draw();
|
self.table.rows.add(response.values).draw(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user