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:
@ -1,5 +1,6 @@
|
||||
|
||||
class previewFormas {
|
||||
|
||||
constructor(container, tipoLibro, tipoTapa, size, datos) {
|
||||
|
||||
this.container = container;
|
||||
@ -19,10 +20,211 @@ class previewFormas {
|
||||
this.solapa = datos.solapas;
|
||||
this.offsetSolapa = 3.0;
|
||||
}
|
||||
if (datos.solapas_sobrecubierta == undefined || datos.solapas_sobrecubierta == null || datos.solapas_sobrecubierta == false) {
|
||||
this.solapas_sobrecubierta = 0;
|
||||
this.offsetSolapa_sobrecubierta = 0.0;
|
||||
}
|
||||
else {
|
||||
this.solapa_sobrecubierta = datos.solapas_sobrecubierta;
|
||||
this.offsetSolapa_sobrecubierta = 3.0;
|
||||
}
|
||||
this.lomoRedondo = datos.lomoRedondo;
|
||||
|
||||
}
|
||||
|
||||
setContainer(container) {
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
setData(datos) {
|
||||
|
||||
this.ancho = datos.ancho;
|
||||
this.alto = datos.alto;
|
||||
this.lomo = datos.lomo;
|
||||
|
||||
if (datos.solapas == undefined || datos.solapas == null || datos.solapas == false) {
|
||||
this.solapa = 0;
|
||||
this.offsetSolapa = 0.0;
|
||||
}
|
||||
else {
|
||||
this.solapa = datos.solapas;
|
||||
this.offsetSolapa = 3.0;
|
||||
}
|
||||
this.lomoRedondo = datos.lomoRedondo;
|
||||
}
|
||||
|
||||
previewInteriorPlana(lpTagName, isCosido, isTapaDura) {
|
||||
|
||||
// Local parameters
|
||||
let guardaV = 0;
|
||||
let guardaH = 0;
|
||||
let styleText = {size: 12, family: 'Public Sans'};
|
||||
|
||||
// Get the preview Object parameters
|
||||
getObjetoLP(lpTagName, isCosido, isTapaDura);
|
||||
|
||||
// Configuracion de las guardas
|
||||
// Guarda vertical
|
||||
if (pvObj.nFormasV > 1) {
|
||||
guardaV = 3;
|
||||
}
|
||||
// Guarda horizontal
|
||||
if (pvObj.nFormasH > 1) {
|
||||
guardaH = 3;
|
||||
}
|
||||
// Constantes relativas a las dimnesiones de la forma
|
||||
let LVo = pvObj.altoForma / 2;
|
||||
let LHo = pvObj.anchoForma / 2;
|
||||
|
||||
// Clear the canvas element
|
||||
$('#pv_' + pvObj.idIndex + '_shape').empty();
|
||||
// Get the element for placing the graphical elements
|
||||
var divPlana = document.getElementById('pv_' + pvObj.idIndex + '_shape');
|
||||
var _pvPlana = new Two({fitted: true}).appendTo(divPlana);
|
||||
// Calculate the center of the canvas element
|
||||
var origenPlana = new Two.Vector(_pvPlana.width / 2, _pvPlana.height / 2);
|
||||
|
||||
var areaMaquinaPlana = _pvPlana.makeRectangle(
|
||||
origenPlana.x,
|
||||
origenPlana.y,
|
||||
pvObj.anchoMaquina,
|
||||
pvObj.altoMaquina);
|
||||
areaMaquinaPlana.stroke = 'black';
|
||||
areaMaquinaPlana.fill = '#E69F6E';
|
||||
areaMaquinaPlana.linewidth = 1;
|
||||
|
||||
var areaImpresionPlana = _pvPlana.makeRectangle(
|
||||
origenPlana.x,
|
||||
origenPlana.y,
|
||||
pvObj.anchoImpresion,
|
||||
pvObj.altoImpresion);
|
||||
areaImpresionPlana.stroke = 'red';
|
||||
areaImpresionPlana.fill = '#FCEAF1';
|
||||
areaImpresionPlana.linewidth = 1;
|
||||
|
||||
var formas = [];
|
||||
|
||||
for (let iV = 0; iV < pvObj.nFormasV; iV++) {
|
||||
|
||||
for (let iH = 0; iH < pvObj.nFormasH; iH++) {
|
||||
|
||||
let _offsetX = ((((pvObj.nFormasH - 1) - 2 * iH) * LHo) + (((pvObj.nFormasH - 1) / 2 - iH) * guardaH));
|
||||
let _offsetY = ((((pvObj.nFormasV - 1) - 2 * iV) * LVo) + (((pvObj.nFormasV - 1) / 2 - iV) * guardaV));
|
||||
|
||||
formas[iV + iH] = _pvPlana.makeRectangle(
|
||||
origenPlana.x + _offsetX,
|
||||
origenPlana.y + _offsetY,
|
||||
pvObj.anchoForma,
|
||||
pvObj.altoForma);
|
||||
formas[iV + iH].stroke = 'grey';
|
||||
formas[iV + iH].fill = '#F4F8F2';
|
||||
formas[iV + iH].linewidth = 1;
|
||||
|
||||
// Texts
|
||||
_pvPlana.makeText(pvObj.altoForma, (origenPlana.x + _offsetX) + (pvObj.anchoForma / 2 - 25), (origenPlana.y + _offsetY), styleText);
|
||||
_pvPlana.makeText(pvObj.anchoForma, (origenPlana.x + _offsetX), (origenPlana.y + _offsetY) + (pvObj.altoForma / 2 - 15), styleText);
|
||||
|
||||
}
|
||||
}
|
||||
_pvPlana.update();
|
||||
}
|
||||
|
||||
previewRotativa(lpTagName, isCosido, isTapaDura) {
|
||||
|
||||
// Local parameters
|
||||
let styleText = {size: 12, family: 'Public Sans'};
|
||||
let margenTop = 3;
|
||||
let guardaV = 0;
|
||||
let guardaH = 0;
|
||||
|
||||
// Get the preview Object parameters
|
||||
getObjetoLP(lpTagName, isCosido, isTapaDura);
|
||||
|
||||
// Calculos
|
||||
// Configuracion de las guardas
|
||||
// Guarda vertical
|
||||
if (pvObj.nFormasV > 1) {
|
||||
guardaV = 3;
|
||||
}
|
||||
// Guarda horizontal
|
||||
if (pvObj.nFormasH > 1) {
|
||||
guardaH = 3;
|
||||
}
|
||||
// Constantes relativas al libro
|
||||
let LVo = pvObj.altoForma / 2;
|
||||
let LHo = pvObj.anchoForma / 2;
|
||||
|
||||
// offset Y
|
||||
let nTopForms = (pvObj.altoImpresion / 2.0 - margenTop) / (LVo + guardaV);
|
||||
let yOffset = LVo * getDecimalPart(nTopForms);
|
||||
|
||||
//console.log(yOffset);
|
||||
|
||||
// Clear the canvas element
|
||||
$('#pv_' + pvObj.idIndex + '_shape').empty();
|
||||
// Get the element for placing the graphical elements
|
||||
var divRotativa = document.getElementById('pv_' + pvObj.idIndex + '_shape');
|
||||
var _pvRotativa = new Two({fitted: true}).appendTo(divRotativa);
|
||||
// Calculate the center of the canvas element
|
||||
var origenRotativa = new Two.Vector(_pvRotativa.width / 2, _pvRotativa.height / 2);
|
||||
|
||||
var areaMaquinaRotativa = _pvRotativa.makeRectangle(
|
||||
origenRotativa.x,
|
||||
origenRotativa.y,
|
||||
pvObj.anchoMaquina,
|
||||
pvObj.altoMaquina);
|
||||
areaMaquinaRotativa.stroke = 'black';
|
||||
areaMaquinaRotativa.fill = '#E69F6E';
|
||||
areaMaquinaRotativa.linewidth = 1;
|
||||
|
||||
var areaImpresionRotativa = _pvRotativa.makeRectangle(
|
||||
origenRotativa.x,
|
||||
origenRotativa.y,
|
||||
pvObj.anchoImpresion,
|
||||
pvObj.altoImpresion);
|
||||
areaImpresionRotativa.stroke = 'red';
|
||||
areaImpresionRotativa.fill = '#FCEAF1';
|
||||
areaImpresionRotativa.linewidth = 1;
|
||||
|
||||
var areaClickRotativa = _pvRotativa.makeRectangle(
|
||||
origenRotativa.x,
|
||||
origenRotativa.y - (pvObj.altoImpresion / 2 - pvObj.altoClick / 2),
|
||||
pvObj.anchoImpresion - 10,
|
||||
pvObj.altoClick);
|
||||
areaClickRotativa.stroke = 'blue';
|
||||
//areaClickRotativa.fill = '#FCEAF1';
|
||||
areaClickRotativa.linewidth = 2;
|
||||
|
||||
var formas = [];
|
||||
|
||||
for (let iV = 0; iV < pvObj.nFormasV; iV++) {
|
||||
|
||||
for (let iH = 0; iH < pvObj.nFormasH; iH++) {
|
||||
|
||||
let _offsetX = ((((pvObj.nFormasH - 1) - 2 * iH) * LHo) + (((pvObj.nFormasH - 1) / 2 - iH) * guardaH));
|
||||
let _offsetY = ((((pvObj.nFormasV - 1) - 2 * iV) * LVo) + (((pvObj.nFormasV - 1) / 2 - iV) * guardaV));
|
||||
|
||||
formas[iV + iH] = _pvRotativa.makeRectangle(
|
||||
origenRotativa.x + _offsetX,
|
||||
(origenRotativa.y - yOffset) + _offsetY,
|
||||
pvObj.anchoForma,
|
||||
pvObj.altoForma);
|
||||
formas[iV + iH].stroke = 'grey';
|
||||
formas[iV + iH].fill = '#F4F8F2';
|
||||
formas[iV + iH].linewidth = 1;
|
||||
|
||||
// Texts
|
||||
_pvRotativa.makeText(pvObj.altoForma, (origenRotativa.x + _offsetX) + (pvObj.anchoForma / 2 - 25), ((origenRotativa.y - yOffset) + _offsetY), styleText);
|
||||
_pvRotativa.makeText(pvObj.anchoForma, (origenRotativa.x + _offsetX), ((origenRotativa.y - yOffset) + _offsetY) + (pvObj.altoForma / 2 - 15), styleText);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_pvRotativa.update();
|
||||
|
||||
}
|
||||
|
||||
previewEsquemaCubierta() {
|
||||
|
||||
if (this.tipoLibro.includes("cosido") || this.tipoLibro.includes("fresado")) {
|
||||
@ -242,8 +444,8 @@ class previewFormas {
|
||||
let sangradoTexto = "Sangrado 20 mm";
|
||||
let sangradoValor = parseFloat(20); // mm
|
||||
if (this.ancho >= 210 || this.alto >= 297) {
|
||||
sangradoValor = parseFloat(15); // mm
|
||||
sangradoTexto = "Sangrado 15 mm";
|
||||
sangradoValor = parseFloat(10); // mm
|
||||
sangradoTexto = "Sangrado 10 mm";
|
||||
}
|
||||
let anchoPliegue = parseFloat(7); // mm cajo
|
||||
let altoPliegue = parseFloat(7); // mm
|
||||
|
||||
@ -5,6 +5,7 @@ import DatosGenerales from './sections/datosGenerales.js';
|
||||
import DatosLibro from './sections/datosLibro.js';
|
||||
import Comparador from './sections/comparador.js';
|
||||
import LineasPresupuesto from './sections/lineasPresupuesto.js';
|
||||
import PreviewFormasAdmin from './sections/previewFormasAdmin.js';
|
||||
|
||||
class PresupuestoAdminEdit {
|
||||
|
||||
@ -19,7 +20,6 @@ class PresupuestoAdminEdit {
|
||||
this.lsc = $("#lomo_sobrecubierta");
|
||||
this.cosido = $("#isCosido");
|
||||
this.tipo_impresion = $("#tipo_impresion_id");
|
||||
this.cosido = $("#isCosido");
|
||||
this.POD = $("#POD");
|
||||
|
||||
this.datosGenerales = new DatosGenerales(this.domItem.find('#accordionDatosPresupuestoTip'));
|
||||
@ -34,7 +34,8 @@ class PresupuestoAdminEdit {
|
||||
{
|
||||
getDimensionLibro: this.getDimensionLibro,
|
||||
});
|
||||
|
||||
|
||||
this.previewFormasAdmin = null;
|
||||
this.calcularPresupuesto = false;
|
||||
}
|
||||
|
||||
@ -45,11 +46,43 @@ class PresupuestoAdminEdit {
|
||||
document.querySelector('.select2-search__field').focus();
|
||||
});
|
||||
|
||||
const impresion_id = $('#tipo_impresion_id').val();
|
||||
let tipoLibro = '';
|
||||
if (impresion_id == 1 || impresion_id == 2) {
|
||||
tipoLibro = 'fresado';
|
||||
} else if (impresion_id == 3 || impresion_id == 4) {
|
||||
tipoLibro ='cosido';
|
||||
} else if (impresion_id == 5 || impresion_id == 6) {
|
||||
tipoLibro ='espiral';
|
||||
} else if (impresion_id == 7 || impresion_id == 8) {
|
||||
tipoLibro = 'wireo';
|
||||
} else if (impresion_id == 21) {
|
||||
tipoLibro = 'grapado';
|
||||
}
|
||||
|
||||
|
||||
this.datosGenerales.init();
|
||||
this.datosLibro.init();
|
||||
this.comparador.init();
|
||||
this.lineasPresupuesto.init();
|
||||
|
||||
this.previewFormasAdmin = new PreviewFormasAdmin(tipoLibro, this.tipoTapa,
|
||||
{
|
||||
ancho: ()=>{return this.getDimensionLibro().ancho},
|
||||
alto: ()=>{return this.getDimensionLibro().alto},
|
||||
lomo: ()=>{$('#lc').val() === '' ? parseFloat('0.0') : parseFloat($('#lc').val())},
|
||||
solapas: ()=>{
|
||||
$('#solapas').prop('checked')?parseFloat($('#solapas_ancho').val()):0
|
||||
},
|
||||
solapas_sobrecubierta: ()=>{
|
||||
$('#solapas_sobrecubierta').prop('checked')?parseFloat($('#solapas_ancho_sobrecubierta').val()):0
|
||||
},
|
||||
lomoRedondo: ()=>{
|
||||
(self.tipo_impresion == 1 || $self.tipo_impresion == 3)?parseFloat($('#compLomoRedondo').val()):0
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (window.location.href.includes("edit")) {
|
||||
|
||||
setTimeout(() => {
|
||||
@ -88,7 +121,7 @@ class PresupuestoAdminEdit {
|
||||
self.datosGenerales.cargarDatos(response.data.datosGenerales);
|
||||
self.datosLibro.cargarDatos(response.data.datosLibro);
|
||||
self.comparador.cargarDatos(response.data.comparador);
|
||||
|
||||
self.lineasPresupuesto.cargarDatos(response.data.lineasPresupuesto);
|
||||
/*self.direcciones.handleChangeCliente();
|
||||
|
||||
self.direcciones.cargarDatos(response.data.direcciones, response.data.datosGenerales);
|
||||
|
||||
@ -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;
|
||||
@ -461,12 +461,166 @@ class LineasPresupuesto {
|
||||
row.child(self.formatRow(row.data())).show();
|
||||
|
||||
self.#addEventosLineas(lp.tipo, lp.maquina_tipo == 'inkjet' ? true : false);
|
||||
if (lp.tipo=='lp_guardas')
|
||||
lp['paginas_impresion'] = lp.paginas_impresion;
|
||||
|
||||
if (lp.tipo == 'lp_guardas')
|
||||
lp['paginas_impresion'] = lp.paginas_impresion;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
guardarLineasPresupuesto() {
|
||||
|
||||
data = [];
|
||||
|
||||
this.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
|
||||
var rowData = this.data();
|
||||
|
||||
const formas = {
|
||||
maquina_ancho: rowData.maquina_ancho,
|
||||
maquina_alto: rowData.maquina_alto,
|
||||
maquina_impresion_ancho: rowData.maquina_impresion_ancho,
|
||||
maquina_impresion_alto: rowData.maquina_impresion_alto,
|
||||
formas: rowData.formas,
|
||||
formas_v: rowData.formas_v,
|
||||
formas_h: rowData.formas_h,
|
||||
formas_orientacion: rowData.formas_orientacion,
|
||||
}
|
||||
|
||||
var t_maq_str = rowData.tiempo.split(':'); // split it at the colons
|
||||
var t_maq = 0
|
||||
|
||||
if (t_maq_str.length == 3)
|
||||
t_maq = (+t_maq_str[0]) * 3600 + (+t_maq_str[1]) * 60 + (+t_maq_str[2]);
|
||||
|
||||
linea_data = {
|
||||
presupuesto_id: presupuesto_id,
|
||||
tipo: rowData.row_id,
|
||||
paginas: (rowData.row_id == 'lp_guardas') ? (($('#tipo_impresion_id').val() == 1 || $('#tipo_impresion_id').val() == 3) ? 8 : 4) : rowData.paginas,
|
||||
papel_id: rowData.papel,
|
||||
gramaje: rowData.gramaje,
|
||||
papel_impresion_id: rowData.papel_impresion_id,
|
||||
papel_impresion: rowData.papel_impresion,
|
||||
maquina_id: rowData.maquina_id,
|
||||
maquina: rowData.maquina,
|
||||
maquina_tipo: rowData.maquinaTipo,
|
||||
tiempo_maquina: t_maq,
|
||||
pliegos_libro: rowData.numeroPliegos,
|
||||
pliegos_pedido: rowData.pliegosPedido,
|
||||
pliegos_precio: rowData.precioPliego,
|
||||
libro: rowData.libro,
|
||||
total_papel_pedido: rowData.totalPapelPedido,
|
||||
margen_papel_pedido: rowData.margenPapelPedido,
|
||||
mano: rowData.lomo,
|
||||
peso: rowData.peso,
|
||||
precio_click: rowData.click,
|
||||
precio_click_pedido: rowData.totalClicks,
|
||||
margen_click_pedido: rowData.margenClicks,
|
||||
check_papel_total: $('#' + rowData.row_id + '_checkPapel').is(":checked") ? 1 : 0,
|
||||
check_impresion_total: $('#' + rowData.row_id + '_checkClicks').is(":checked") ? 1 : 0,
|
||||
tarifa_impresion_id: rowData.tarifa_impresion_id,
|
||||
formas: JSON.stringify(formas),
|
||||
|
||||
horas_maquina: rowData.horasMaquina,
|
||||
precio_hora: rowData.precioHora,
|
||||
precio_impresion: rowData.precioImpresion,
|
||||
margen_impresion: rowData.margenImpresion,
|
||||
total_linea: rowData.total_linea,
|
||||
}
|
||||
|
||||
if (rowData.row_id == 'lp_guardas')
|
||||
linea_data.paginas_impresion = rowData.paginas_impresion
|
||||
|
||||
// maquina rotativa o inkjet
|
||||
if (linea_data.maquina_tipo == 'inkjet') {
|
||||
|
||||
linea_data.rotativa_pag_color = rowData.numPagColor
|
||||
|
||||
linea_data.rotativa_total_impresion = rowData.totalImpresion
|
||||
linea_data.rotativa_a_favor_fibra = rowData.aFavorFibra,
|
||||
linea_data.rotativa_negro = rowData.cobNegro
|
||||
linea_data.rotativa_cyan = rowData.cobCyan
|
||||
linea_data.rotativa_magenta = rowData.cobMagenta
|
||||
linea_data.rotativa_amarillo = rowData.cobAmarillo
|
||||
linea_data.rotativa_cg = rowData.cobCG
|
||||
linea_data.rotativa_gota_negro = rowData.gotaNegro
|
||||
linea_data.rotativa_gota_color = rowData.gotaColor
|
||||
|
||||
|
||||
linea_data.rotativa_resolucion = rowData.resolucion
|
||||
linea_data.rotativa_area_paginas = rowData.areaPaginas
|
||||
|
||||
linea_data.rotativa_num_gotas_negro = rowData.gotaNegro
|
||||
linea_data.rotativa_num_gotas_cyan = rowData.gotasCyan
|
||||
linea_data.rotativa_num_gotas_magenta = rowData.gotasMagenta
|
||||
linea_data.rotativa_num_gotas_amarillo = rowData.gotasAmarillo
|
||||
linea_data.rotativa_num_gotas_cg = rowData.gotasCG
|
||||
|
||||
linea_data.rotativa_precio_pag_negro = rowData.precioPagNegro
|
||||
linea_data.rotativa_precio_pag_color = rowData.precioPagColor
|
||||
linea_data.rotativa_factor_altura = rowData.factorAltura
|
||||
linea_data.rotativa_factor_anchura = rowData.factorAnchura
|
||||
linea_data.rotativa_pag_por_pliego = rowData.paginasPliego
|
||||
|
||||
linea_data.rotativa_clicks_libro = rowData.clicksLibro
|
||||
linea_data.rotativa_peso_gotas_negro = rowData.gTintaNegro
|
||||
linea_data.rotativa_peso_gotas_cyan = rowData.gTintaCyan
|
||||
linea_data.rotativa_peso_gotas_magenta = rowData.gTintaMagenta
|
||||
linea_data.rotativa_peso_gotas_amarillo = rowData.gTintaAmarillo
|
||||
linea_data.rotativa_peso_gotas_cg = rowData.gTintaCG
|
||||
linea_data.rotativa_clicks_total = rowData.clicksPedido
|
||||
linea_data.precio_click_pedido = rowData.totalClicksPedido
|
||||
linea_data.rotativa_precio_tinta = rowData.totalTinta
|
||||
|
||||
|
||||
linea_data.rotativa_peso_gotas_negro_pedido = rowData.gTintaNegroPed
|
||||
linea_data.rotativa_peso_gotas_cyan_pedido = rowData.gTintaCyanPed
|
||||
linea_data.rotativa_peso_gotas_magenta_pedido = rowData.gTintaMagentaPed
|
||||
linea_data.rotativa_peso_gotas_amarillo_pedido = rowData.gTintaAmarilloPed
|
||||
linea_data.rotativa_peso_gotas_cg_pedido = rowData.gTintaCGPed
|
||||
|
||||
}
|
||||
if (linea_data.tipo.includes('rot')) {
|
||||
|
||||
linea_data.rotativa_mxm = rowData.metrosMinuto
|
||||
linea_data.rotativa_metros_libro = rowData.metrosPapelLibro
|
||||
linea_data.rotativa_metros_total = rowData.metrosPapelTotal
|
||||
linea_data.rotativa_velocidad_corte = rowData.velocidadCorte
|
||||
linea_data.rotativa_precio_hora_corte = rowData.precioHoraCorte
|
||||
linea_data.rotativa_tiempo_corte = rowData.tiempoCorte
|
||||
linea_data.rotativa_total_corte = rowData.totalCorte
|
||||
linea_data.rotativa_a_favor_fibra = rowData.aFavorFibra == true ? 1 : 0
|
||||
}
|
||||
|
||||
data.push(linea_data)
|
||||
});
|
||||
|
||||
/*
|
||||
var datos = {
|
||||
tipo: 'lineasPresupuesto',
|
||||
datos: data,
|
||||
presupuesto_id: presupuesto_id,
|
||||
}
|
||||
datos = Object.assign(datos, window.token_ajax);
|
||||
|
||||
await $.ajax({
|
||||
type: 'post',
|
||||
url: window.routes_lp.updateDataOfPresupuestoAdmin,
|
||||
|
||||
data: datos,
|
||||
dataType: 'json',
|
||||
success: function (response) {
|
||||
|
||||
token = response[window.csrf_token];
|
||||
yeniden(token);
|
||||
}
|
||||
}).fail(function (jqXHR, textStatus, error) {
|
||||
// Handle error here
|
||||
console.log(jqXHR)
|
||||
});*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
mostrarTabsPreview() {
|
||||
|
||||
@ -1009,7 +1163,7 @@ class LineasPresupuesto {
|
||||
'<input readonly type="text" id="' + d.row_id + '_factorAnchura" name="' + d.row_id + '_factorAnchura" class="lp-cell lp-cell-disabled lp-input ' + d.row_class + '-input" readonly value="' + d.factorAnchura + '">' +
|
||||
'</div>' : '') +
|
||||
(d.row_id.includes('rot') ? '<div class="col-md-12 col-lg-1">' : '<div class="col-md-12 col-lg-1" style="display:none;">') +
|
||||
window.language.Presupuestos.metrosMinuto +
|
||||
window.language.Presupuestos.clicksMinuto +
|
||||
'<input readonly type="text" id="' + d.row_id + '_metrosMinuto" name="' + d.row_id + '_metrosMinuto" class="lp-cell lp-cell-disabled lp-input ' + d.row_class + '-input" readonly value="' + d.metrosMinuto + '">' +
|
||||
'</div>' +
|
||||
|
||||
|
||||
@ -0,0 +1,85 @@
|
||||
import previewFormas from '../../../components/preview.js';
|
||||
import preview from '../../../components/preview.js';
|
||||
|
||||
class PreviewFormasAdmin{
|
||||
|
||||
constructor(tipoLibro, tipoTapa, data){
|
||||
|
||||
this.data = data;
|
||||
this.isCosido = $("#isCosido").val();
|
||||
this.tipoTapa = tipoTapa;
|
||||
|
||||
this.preview = new previewFormas(null, tipoLibro, tipoTapa, "thumbnail", data);
|
||||
}
|
||||
|
||||
setData(data){
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
init(){
|
||||
|
||||
const self = this;
|
||||
|
||||
$('#tab-pv-bn').on( "click", function() {
|
||||
|
||||
self.preview.setData(data);
|
||||
self.preview.previewInteriorPlana('bn', self.isCosido, self.tipoTapa.constains("dura")?1:0);
|
||||
} );
|
||||
/*
|
||||
$('#tab-pv-bnhq').on( "click", function() {
|
||||
|
||||
previewInteriorPlana('bnhq', <?php echo $isCosido; ?>, <?php echo $isTapaDura; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-color').on( "click", function() {
|
||||
|
||||
previewInteriorPlana('color', <?php echo $isCosido; ?>, <?php echo $isTapaDura; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-colorhq').on( "click", function() {
|
||||
|
||||
|
||||
previewInteriorPlana('colorhq', <?php echo $isCosido; ?>, <?php echo $isTapaDura; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-rot-bn').on( "click", function() {
|
||||
|
||||
previewRotativa('rot_bn', <?php echo $isCosido; ?>, <?php echo $isTapaDura; ?>);
|
||||
|
||||
} );*/
|
||||
|
||||
$('#tab-pv-rot-color').on( "click", function() {
|
||||
|
||||
self.preview.setData(data);
|
||||
self.preview.previewRotativa('rot_color', self.isCosido, self.tipoTapa.constains("dura")?1:0);
|
||||
|
||||
} );
|
||||
/*
|
||||
$('#tab-pv-guardas').on( "click", function() {
|
||||
|
||||
previewInteriorPlana('guardas', <?php echo $isCosido; ?>, <?php echo $isTapaDura; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-cubierta').on( "click", function() {
|
||||
|
||||
previewInteriorPlana('cubierta', <?php echo $isCosido; ?>, <?php echo $isTapaDura; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-esquema-cubierta').on( "click", function() {
|
||||
|
||||
previewEsquemaCubierta('ec', <?php echo $isCosido; ?>, <?php echo $isTapaDura; ?>);
|
||||
|
||||
} );
|
||||
|
||||
$('#tab-pv-sobrecubierta').on( "click", function() {
|
||||
|
||||
previewInteriorPlana('sobrecubierta', <?php echo $isCosido; ?>, <?php echo $isTapaDura; ?>);
|
||||
|
||||
} );*/
|
||||
}
|
||||
}
|
||||
@ -561,17 +561,17 @@ class PresupuestoCliente {
|
||||
|
||||
popAlert2Hide();
|
||||
|
||||
for (let i = 0; i < tiradas.length; i++) {
|
||||
for (let i = 0; i < response.tiradas.length; i++) {
|
||||
new tarjetaTiradasPrecio(
|
||||
this.divTiradasPrecios,
|
||||
('precio-tiradas-' + response.tiradas[i]),
|
||||
tiradas[i],
|
||||
(parseFloat(response.precio_u[i]) * parseInt(tiradas[i])).toFixed(2),
|
||||
response.tiradas[i],
|
||||
(parseFloat(response.precio_u[i]) * parseInt(response.tiradas[i])).toFixed(2),
|
||||
response.precio_u[i]
|
||||
);
|
||||
|
||||
if (this.actualizarTiradasEnvio) {
|
||||
this.direcciones.insertTirada(tiradas[i]);
|
||||
this.direcciones.insertTirada(response.tiradas[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user