mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en la preview
This commit is contained in:
@ -162,7 +162,7 @@ class Comparador {
|
||||
this.btnInsertarGuardas = $('#insertarGuardasBtn');
|
||||
}
|
||||
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3){
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3) {
|
||||
this.lomoRedondo = $('#compLomoRedondo');
|
||||
this.cabezada = $('#cabezada');
|
||||
}
|
||||
@ -221,7 +221,7 @@ class Comparador {
|
||||
this.papelCubierta.init();
|
||||
this.gramajeCubierta.init();
|
||||
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3){
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3) {
|
||||
this.lomoRedondo.select2({
|
||||
allowClear: false,
|
||||
minimumResultsForSearch: Infinity,
|
||||
@ -355,21 +355,33 @@ class Comparador {
|
||||
this.papelNegro.setOption(datos.json_data.bn.papel_id, datos.json_data.bn.papel_nombre);
|
||||
this.gramajeNegro.setOption(datos.json_data.bn.gramaje, datos.json_data.bn.gramaje);
|
||||
}
|
||||
else {
|
||||
this.paginasNegro.val(0);
|
||||
}
|
||||
if (datos.json_data.bnhq) {
|
||||
this.paginasNegrohq.val(datos.json_data.bnhq.paginas);
|
||||
this.papelNegrohq.setOption(datos.json_data.bnhq.papel_id, datos.json_data.bnhq.papel_nombre);
|
||||
this.gramajeNegrohq.setOption(datos.json_data.bnhq.gramaje, datos.json_data.bnhq.gramaje);
|
||||
}
|
||||
else {
|
||||
this.paginasNegrohq.val(0);
|
||||
}
|
||||
if (datos.json_data.color) {
|
||||
this.paginasColor.val(datos.json_data.color.paginas);
|
||||
this.papelColor.setOption(datos.json_data.color.papel_id, datos.json_data.color.papel_nombre);
|
||||
this.gramajeColor.setOption(datos.json_data.color.gramaje, datos.json_data.color.gramaje);
|
||||
}
|
||||
else {
|
||||
this.paginasColor.val(0);
|
||||
}
|
||||
if (datos.json_data.colorhq) {
|
||||
this.paginasColorhq.val(datos.json_data.colorhq.paginas);
|
||||
this.papelColorhq.setOption(datos.json_data.colorhq.papel_id, datos.json_data.colorhq.papel_nombre);
|
||||
this.gramajeColorhq.setOption(datos.json_data.colorhq.gramaje, datos.json_data.colorhq.gramaje);
|
||||
}
|
||||
else {
|
||||
this.paginasColorhq.val(0);
|
||||
}
|
||||
if (datos.json_data.cubierta) {
|
||||
this.paginasCubierta.val(datos.json_data.cubierta.paginas);
|
||||
this.papelCubierta.setOption(datos.json_data.cubierta.papel_id, datos.json_data.cubierta.papel_nombre);
|
||||
@ -386,8 +398,8 @@ class Comparador {
|
||||
this.gramajeGuardas.setOption(datos.json_data.guardas.gramaje, datos.json_data.guardas.gramaje);
|
||||
}
|
||||
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3){
|
||||
this.lomoRedondo.val(datos.lomoRedondo?1:0).trigger('change');
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3) {
|
||||
this.lomoRedondo.val(datos.lomoRedondo ? 1 : 0).trigger('change');
|
||||
this.cabezada.val(datos.cabezada).trigger('change');
|
||||
}
|
||||
|
||||
@ -397,7 +409,18 @@ class Comparador {
|
||||
}
|
||||
|
||||
this.cargando = false;
|
||||
this.paginasNegro.trigger('change');
|
||||
if (this.paginasNegro.val() > 0) {
|
||||
this.paginasNegro.trigger('change');
|
||||
}
|
||||
else if (this.paginasNegrohq.val() > 0) {
|
||||
this.paginasNegrohq.trigger('change');
|
||||
}
|
||||
else if (this.paginasColor.val() > 0) {
|
||||
this.paginasColor.trigger('change');
|
||||
}
|
||||
else if (this.paginasColorhq.val() > 0) {
|
||||
this.paginasColorhq.trigger('change');
|
||||
}
|
||||
this.paginasCubierta.trigger('change');
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3 || this.tipo_impresion_id == 5 || this.tipo_impresion_id == 7) {
|
||||
this.carasGuardas.trigger('change');
|
||||
@ -789,7 +812,7 @@ class Comparador {
|
||||
}
|
||||
}
|
||||
|
||||
if(!this.cargando)
|
||||
if (!this.cargando)
|
||||
$('#paginas').trigger('change');
|
||||
}
|
||||
|
||||
@ -854,15 +877,21 @@ class Comparador {
|
||||
}
|
||||
for (let element of papeles) {
|
||||
if (element.getVal() == 0 || element.getVal() == null) {
|
||||
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
|
||||
return { error: true, data: {} };
|
||||
const tipo = element.item.attr('id').split('Papel')[1];
|
||||
if ($('#compPaginas' + tipo).val() > 0) {
|
||||
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
|
||||
return { error: true, data: {} };
|
||||
}
|
||||
}
|
||||
};
|
||||
for (let element of gramajes) {
|
||||
|
||||
if (element.getVal() == 0 || element.getVal() == null) {
|
||||
popErrorAlert(window.language.Presupuestos.errores.seleccioneGramaje, 'divAlarmasComparador');
|
||||
return { error: true, data: {} };
|
||||
const tipo = element.item.attr('id').split('Papel')[1];
|
||||
if ($('#compPaginas' + tipo).val() > 0) {
|
||||
popErrorAlert(window.language.Presupuestos.errores.seleccioneGramaje, 'divAlarmasComparador');
|
||||
return { error: true, data: {} };
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -961,8 +990,8 @@ class Comparador {
|
||||
cliente_id: $('#clienteId').select2('data')[0].id,
|
||||
papel_generico: papel_generico,
|
||||
gramaje: gramaje,
|
||||
isColor: this.tipo_impresion.val().includes('color')?1:0,
|
||||
isHq: this.tipo_impresion.val().includes('hq')?1:0,
|
||||
isColor: this.tipo_impresion.val().includes('color') ? 1 : 0,
|
||||
isHq: this.tipo_impresion.val().includes('hq') ? 1 : 0,
|
||||
paginas_color: paginasColor
|
||||
}
|
||||
|
||||
@ -970,12 +999,12 @@ class Comparador {
|
||||
datos.datosPedido.lomo = $("#lomo_cubierta").val();
|
||||
datos.datosPedido.solapas = $('#solapas').prop('checked') ? 1 : 0;
|
||||
datos.datosPedido.solapas_ancho = $('#solapas').prop('checked') ? parseInt($('#solapas_ancho').val()) : 0;
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3){
|
||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3) {
|
||||
datos.lomoRedondo = this.lomoRedondo.val();
|
||||
}
|
||||
}
|
||||
else if (uso == 'sobrecubierta') {
|
||||
datos.datosPedido.lomo = $("#lomo_sobrecubierta");
|
||||
datos.datosPedido.lomo = $("#lomo_sobrecubierta").val();
|
||||
datos.datosPedido.solapas = $('#solapas_sobrecubierta').prop('checked') ? 1 : 0;
|
||||
datos.datosPedido.solapas_ancho = $('#solapas_sobrecubierta').prop('checked') ? parseInt($('#solapas_ancho_sobrecubierta').val()) : 0;
|
||||
}
|
||||
@ -1041,8 +1070,8 @@ class Comparador {
|
||||
}
|
||||
else {
|
||||
|
||||
const isHq = this.tipo_impresion.val().includes('hq')?1:0;
|
||||
const isColor = this.tipo_impresion.val().includes('color')?1:0;
|
||||
const isHq = this.tipo_impresion.val().includes('hq') ? 1 : 0;
|
||||
const isColor = this.tipo_impresion.val().includes('color') ? 1 : 0;
|
||||
|
||||
datosComp.data['tipo_maquina'] = 'plana';
|
||||
datosComp.data[this.csrf_token] = this.csrf_hash;
|
||||
@ -1085,13 +1114,24 @@ class Comparador {
|
||||
|
||||
// Rotativa
|
||||
if (!isHq) {
|
||||
if (!isColor || (isColor && datosComp.data.papel_generico.negro.id == datosComp.data.papel_generico.color.id &&
|
||||
datosComp.data.gramaje.negro == datosComp.data.gramaje.color)) {
|
||||
if (!isColor ||
|
||||
(isColor && datosComp.data.papel_generico.negro.id == datosComp.data.papel_generico.color.id &&
|
||||
datosComp.data.gramaje.negro == datosComp.data.gramaje.color) ||
|
||||
(isColor && datosComp.data.datosPedido.paginas == parseInt(datosComp.data.paginas_color))) {
|
||||
|
||||
datosComp.data['tipo_maquina'] = 'rotativa';
|
||||
datosComp.data.papel_generico.id = datosComp.data.papel_generico.negro.id;
|
||||
datosComp.data.papel_generico.nombre = datosComp.data.papel_generico.negro.nombre;
|
||||
datosComp.data.gramaje = datosComp.data.gramaje.negro;
|
||||
if (isColor && datosComp.data.datosPedido.paginas == parseInt(datosComp.data.paginas_color)) {
|
||||
datosComp.data.papel_generico.id = datosComp.data.papel_generico.color.id;
|
||||
datosComp.data.papel_generico.nombre = datosComp.data.papel_generico.color.nombre;
|
||||
datosComp.data.gramaje = datosComp.data.gramaje.color;
|
||||
}
|
||||
else {
|
||||
datosComp.data.papel_generico.id = datosComp.data.papel_generico.negro.id;
|
||||
datosComp.data.papel_generico.nombre = datosComp.data.papel_generico.negro.nombre;
|
||||
datosComp.data.gramaje = datosComp.data.gramaje.negro;
|
||||
}
|
||||
|
||||
|
||||
new Ajax('/presupuestoadmin/comparadorinterior',
|
||||
datosComp.data,
|
||||
{},
|
||||
@ -1252,9 +1292,9 @@ class Comparador {
|
||||
if (datosComp.error) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
datosComp.data[this.csrf_token] = this.csrf_hash;
|
||||
|
||||
|
||||
new Ajax('/presupuestoadmin/comparadorguardas',
|
||||
datosComp.data,
|
||||
{},
|
||||
@ -1271,7 +1311,7 @@ class Comparador {
|
||||
.draw();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
self.selectLineas('guardas');
|
||||
if (self.tableCompGuardas.rows().count() > 0) {
|
||||
$('#title_guardas').html(window.language.Presupuestos.Guardas +
|
||||
@ -1543,7 +1583,7 @@ class Comparador {
|
||||
data_str = JSON.stringify(data)
|
||||
$('#comparador_json_data').val(data_str)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default Comparador;
|
||||
Reference in New Issue
Block a user