mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en direcciones!
This commit is contained in:
@ -66,8 +66,8 @@ class DatosLibro {
|
||||
this.acabadoSobrecubierta.init();
|
||||
|
||||
this.acabadoCubierta.item.on('select2:select', function () {
|
||||
|
||||
$(document).trigger('add-servicio-lineas', 'acabadoCubierta');
|
||||
|
||||
$(document).trigger('add-servicio-lineas', 'acabadoCubierta');
|
||||
});
|
||||
this.acabadoSobrecubierta.item.on('select2:select', function () {
|
||||
$(document).trigger('add-servicio-lineas', 'acabadoSobrecubierta');
|
||||
@ -96,9 +96,10 @@ class DatosLibro {
|
||||
|
||||
$('.formato-libro').on('change', function () {
|
||||
$(document).trigger('update-lineas-presupuesto');
|
||||
$(document).trigger('update-servicios');
|
||||
|
||||
/* TO-DO
|
||||
updatePresupuesto({
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
@ -116,7 +117,7 @@ class DatosLibro {
|
||||
$(document).trigger('remove-servicio-lineas', 'fajaColor');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
changeFerro() {
|
||||
|
||||
if (this.ferro.prop('checked')) {
|
||||
@ -130,7 +131,7 @@ class DatosLibro {
|
||||
changePrototipo() {
|
||||
|
||||
if (this.prototipo.prop('checked')) {
|
||||
|
||||
|
||||
$(document).trigger('add-servicio-lineas', 'prototipo');
|
||||
this.ferro.prop('checked', true).trigger('change');
|
||||
}
|
||||
@ -183,33 +184,32 @@ class DatosLibro {
|
||||
this.checkPaginasPresupuesto();
|
||||
|
||||
$(document).trigger('update-lineas-presupuesto');
|
||||
|
||||
$(document).trigger('update-servicios');
|
||||
// TO-DO
|
||||
/*updatePresupuesto({
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})*/
|
||||
}
|
||||
|
||||
|
||||
changeTipoTamanio(){
|
||||
|
||||
if(this.tamanioPersonalizado.prop('checked')){
|
||||
|
||||
changeTipoTamanio() {
|
||||
|
||||
if (this.tamanioPersonalizado.prop('checked')) {
|
||||
$('.tamanio-personalizado').removeClass('d-none');
|
||||
$('.tamanio-estandar').addClass('d-none');
|
||||
this.tamanio.setVal('');
|
||||
$("#label_papelFormatoId").text(
|
||||
$("#label_papelFormatoId").text(
|
||||
window.language.Presupuestos.papelFormatoId + " (" +
|
||||
window.language.Presupuestos.papelFormatoAncho + " x " + window.language.Presupuestos.papelFormatoAncho + ")*");
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.anchoPersonalizado.val("");
|
||||
this.altoPersonalizado.val("");
|
||||
$('.tamanio-personalizado').addClass('d-none');
|
||||
$('.tamanio-estandar').removeClass('d-none');
|
||||
$("#label_papelFormatoId").text(
|
||||
$("#label_papelFormatoId").text(
|
||||
window.language.Presupuestos.papelFormatoId + '*');
|
||||
}
|
||||
$(document).trigger('update-lineas-presupuesto');
|
||||
@ -218,59 +218,67 @@ class DatosLibro {
|
||||
|
||||
changeSolapasCubierta() {
|
||||
|
||||
if (this.solapasCubierta.prop('checked')) {
|
||||
$('#div_solapas_ancho').removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
$('#div_solapas_ancho').divSolapasCubierta.addClass('d-none');
|
||||
this.anchoSolapasCubierta.val(0);
|
||||
}
|
||||
$('#serv_default').trigger('click');
|
||||
setTimeout(() => {
|
||||
if (this.solapasCubierta.prop('checked')) {
|
||||
$('#div_solapas_ancho').removeClass('d-none');
|
||||
$(document).trigger('add-servicio-lineas', 'solapas');
|
||||
}
|
||||
else {
|
||||
$('#div_solapas_ancho').addClass('d-none');
|
||||
this.anchoSolapasCubierta.val(60);
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas');
|
||||
}
|
||||
}, 100);
|
||||
$(document).trigger('update-servicios');
|
||||
}
|
||||
|
||||
|
||||
changeSolapasSobrecubierta() {
|
||||
|
||||
|
||||
if (this.solapasSobrecubierta.prop('checked')) {
|
||||
this.divSolapasSobrecubierta.removeClass('d-none');
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas');
|
||||
}
|
||||
else {
|
||||
this.divSolapasSobrecubierta.addClass('d-none');
|
||||
this.anchoSolapasSobrecubierta.val(0);
|
||||
this.anchoSolapasSobrecubierta.val(60);
|
||||
$(document).trigger('add-servicio-lineas', 'solapas');
|
||||
}
|
||||
$('#serv_default').trigger('click');
|
||||
$(document).trigger('update-servicios');
|
||||
|
||||
}
|
||||
|
||||
changePaginas() {
|
||||
|
||||
if($('#tipo_impresion_id').val() == 21){
|
||||
if(parseInt($('#paginas').val()) > 80){
|
||||
|
||||
if ($('#tipo_impresion_id').val() == 21) {
|
||||
if (parseInt($('#paginas').val()) > 80) {
|
||||
$('#paginas').val(80)
|
||||
}
|
||||
}
|
||||
|
||||
if(window.location.href.includes('edit')){
|
||||
|
||||
|
||||
if (window.location.href.includes('edit')) {
|
||||
|
||||
this.checkPaginasPresupuesto();
|
||||
|
||||
|
||||
// Si es negro o color
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'color') {
|
||||
$('#compPaginasNegro').val(parseInt($('#paginas').val())-parseInt($('#compPaginasColor').val()));
|
||||
$('#compPaginasNegro').val(parseInt($('#paginas').val()) - parseInt($('#compPaginasColor').val()));
|
||||
$('#compPaginasNegro').trigger('change')
|
||||
}
|
||||
// Si es negrohq o colorhq
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negrohq' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'colorhq') {
|
||||
$('#compPaginasNegrohq').val(parseInt($('#paginas').val())-parseInt($('#compPaginasColorhq').val()));
|
||||
$('#compPaginasNegrohq').val(parseInt($('#paginas').val()) - parseInt($('#compPaginasColorhq').val()));
|
||||
$('#compPaginasNegrohq').trigger('change');
|
||||
}
|
||||
|
||||
|
||||
$(document).trigger('update-lineas-presupuesto');
|
||||
$(document).trigger('update-servicios');
|
||||
|
||||
// TO-DO
|
||||
/*
|
||||
updatePresupuesto({
|
||||
update_lineas: true,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
@ -278,16 +286,16 @@ class DatosLibro {
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
changeTirada(update_tiradas_alternativas = true) {
|
||||
|
||||
|
||||
this.calcular_mermas()
|
||||
|
||||
|
||||
const url2 = window.location.href;
|
||||
const url_parts2 = url2.split('/');
|
||||
|
||||
if(url_parts2[url_parts2.length-2] == 'edit'){
|
||||
|
||||
if (url_parts2[url_parts2.length - 2] == 'edit') {
|
||||
$(document).trigger('update-lineas-presupuesto');
|
||||
//update_servicios(false)
|
||||
//updateLineasPresupuesto()
|
||||
@ -314,35 +322,35 @@ class DatosLibro {
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
calcular_mermas(){
|
||||
|
||||
|
||||
calcular_mermas() {
|
||||
|
||||
const tirada = parseInt($('#tirada').val());
|
||||
const POD = parseInt($('#POD').val());
|
||||
let merma = 0;
|
||||
let htmlString = '';
|
||||
|
||||
if(tirada> POD){
|
||||
merma = tirada*0.1<=POD ? tirada*0.1 : POD;
|
||||
|
||||
if (tirada > POD) {
|
||||
merma = tirada * 0.1 <= POD ? tirada * 0.1 : POD;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
let merma_lineas = []
|
||||
$('#tableLineasPresupuesto').DataTable().rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||
$('#tableLineasPresupuesto').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
var rowData = this.data();
|
||||
if(rowData.row_id != 'lp_guardas' && rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta'){
|
||||
const formas_linea = parseInt($('#isCosido').val())==0?parseInt(rowData.formas):parseInt(rowData.formas)/2
|
||||
if(formas_linea > tirada)
|
||||
merma_lineas.push(formas_linea-tirada)
|
||||
if (rowData.row_id != 'lp_guardas' && rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta') {
|
||||
const formas_linea = parseInt($('#isCosido').val()) == 0 ? parseInt(rowData.formas) : parseInt(rowData.formas) / 2
|
||||
if (formas_linea > tirada)
|
||||
merma_lineas.push(formas_linea - tirada)
|
||||
else
|
||||
merma_lineas.push(tirada%formas_linea)
|
||||
merma_lineas.push(tirada % formas_linea)
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
if(merma_lineas.length>0)
|
||||
|
||||
|
||||
if (merma_lineas.length > 0)
|
||||
merma = Math.max(...merma_lineas)
|
||||
else{
|
||||
else {
|
||||
htmlString = `
|
||||
<div class="alert alert-warning d-flex align-items-baseline" role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
@ -350,16 +358,16 @@ class DatosLibro {
|
||||
</span>
|
||||
<div class="d-flex flex-column ps-1">
|
||||
<h5 class="alert-heading mb-2">` +
|
||||
window.language.Presupuestos.validation.no_lp_for_merma +
|
||||
`</h5>
|
||||
window.language.Presupuestos.validation.no_lp_for_merma +
|
||||
`</h5>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
|
||||
</div>`;
|
||||
|
||||
|
||||
merma = 0
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
$('#mermacubierta').val(parseInt(merma))
|
||||
$('#merma').val(parseInt(merma))
|
||||
@ -392,15 +400,15 @@ class DatosLibro {
|
||||
$('#tipo_impresion_id').val() == 5 || $('#tipo_impresion_id').val() == 7) {
|
||||
$(".solapas-cubierta-div").addClass('d-none');
|
||||
}
|
||||
else{
|
||||
else {
|
||||
if (datos.solapasCubierta) {
|
||||
this.solapasCubierta.prop('checked', true);
|
||||
this.anchoSolapasCubierta.val(datos.solapasCubiertaAncho);
|
||||
this.divSolapasSobrecubierta.removeClass('d-none');
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.solapasCubierta.prop('checked', false);
|
||||
this.anchoSolapasCubierta.val(0);
|
||||
this.anchoSolapasCubierta.val(60);
|
||||
this.divSolapasSobrecubierta.addClass('d-none');
|
||||
}
|
||||
}
|
||||
@ -409,12 +417,12 @@ class DatosLibro {
|
||||
this.anchoSolapasSobrecubierta.val(datos.solapasSobrecubiertaAncho);
|
||||
$('#div_solapas_ancho_sobrecubierta').removeClass('d-none');
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.solapasSobrecubierta.prop('checked', false);
|
||||
this.anchoSolapasSobrecubierta.val(60);
|
||||
$('#div_solapas_ancho_sobrecubierta').addClass('d-none');
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.acabadoCubierta.setOption(datos.acabadoCubierta.id, datos.acabadoCubierta.text);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user