comparador cubiertas terminado

This commit is contained in:
Jaime Jimenez
2023-10-18 21:26:04 +02:00
parent 453226b811
commit 721e234849
5 changed files with 230 additions and 86 deletions

View File

@ -86,39 +86,6 @@ $("#solapas").on("click", function () {
}
});
$('#tipoImpresion').on("change", function () {
updatePapelesComparador();
$('#paginas').change();
if (($('#tipoImpresion').select2('data')[0].id == 'negro' ||
$('#tipoImpresion').select2('data')[0].id == 'color')){
$('#tableCompIntRotativa').DataTable().clear().draw();
$('#total_comp_rot').html("0.00");
if( $('#tableCompIntPlana').DataTable().rows().count() > 0 &&
$('#tableCompIntPlana').DataTable().cell(0, 0).data().includes('hq')) {
$('#tableCompIntPlana').DataTable().clear().draw();
$('#total_comp_plana').html("0.00");
}
}
else if (($('#tipoImpresion').select2('data')[0].id == 'negrohq' ||
$('#tipoImpresion').select2('data')[0].id == 'colorhq')){
$('#tableCompIntRotativa').DataTable().clear().draw();
$('#total_comp_rot').html("0.00");
if($('#tableCompIntPlana').DataTable().rows().count() > 0 &&
!$('#tableCompIntPlana').DataTable().cell(0, 0).data().includes('hq')) {
$('#tableCompIntPlana').DataTable().clear().draw();
$('#total_comp_plana').html("0.00");
}
}
});
$('#compRetractilado').on("change", function () {
@ -441,6 +408,21 @@ function selectIntRotLineas(){
$('#total_comp_rot').html(value_total.toFixed(2));
}
function selectCubiertaLineas(){
$("#tableCompCubierta").DataTable().rows( '.selected' ).deselect();
let value_total = 0.00;
if($("#tableCompCubierta").DataTable().rows().count()>0) {
$("#tableCompCubierta").DataTable().row( 0 ).nodes().to$().toggleClass( 'selected' );
value_total = parseFloat($("#tableCompCubierta").DataTable().rows( 0 ).data()[0]['total'])
};
$('#total_comp_cubierta').html(value_total.toFixed(2));
}
function getIDsComparador(is_color, is_hq){
@ -549,6 +531,7 @@ function fillIntRot(data){
}
function fillCubierta(data, is_color, is_hq){
let sorted = data.lineas.sort(
(p1, p2) => ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) < (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ?
-1 : ((p1.fields.precio_pedido+p1.fields.precio_click_pedido) > (p2.fields.precio_pedido+p2.fields.precio_click_pedido)) ? 1 : 0);

View File

@ -273,14 +273,10 @@
columns: [
{ 'data': 'tipo',
'render': function ( data, type, row, meta ) {
if(data=='bn')
return '<?= lang('Presupuestos.bn') ?>';
else if(data=='bnhq')
return '<?= lang('Presupuestos.bnhq') ?>';
else if(data=='color')
return '<?= lang('Presupuestos.color') ?>';
else if(data=='colorhq')
return '<?= lang('Presupuestos.colorhq') ?>';
if(data=='cubierta')
return '<?= lang('Presupuestos.cubierta') ?>';
else if(data=='sobrecubierta')
return '<?= lang('Presupuestos.sobrecubierta') ?>';
}
},
{ 'data': 'paginas' },
@ -393,6 +389,9 @@
selectIntLineas();
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>' + ' (' + tableCompIntPlana.rows().count() + ')');
}
else{
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>');
}
yeniden(data.<?= csrf_token() ?>);
return true;
},
@ -442,6 +441,9 @@
selectIntRotLineas();
$('#title_int_rot').html('<?= lang("Presupuestos.compInteriorRotativa") ?>' + ' (' + tableCompIntRotativa.rows().count() + ')');
}
else{
$('#title_int_rot').html('<?= lang("Presupuestos.compInteriorRotativa") ?>');
}
yeniden(data.<?= csrf_token() ?>);
return true;
},
@ -454,7 +456,7 @@
return false;
}
$('.comp_cubierta_items').on('change', function (){
if ($('#compCarasCubierta').select2('data').length > 0 &&
@ -491,8 +493,11 @@
console.log(data.lineas);
fillCubierta(data);
//selectIntLineas();
//$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>' + ' (' + tableCompIntPlana.rows().count() + ')');
selectCubiertaLineas();
$('#title_cubierta').html('<?= lang("Presupuestos.cubierta") ?>' + ' (' + tableCompCubierta.rows().count() + ')');
}
else{
$('#title_cubierta').html('<?= lang("Presupuestos.cubierta") ?>');
}
yeniden(data.<?= csrf_token() ?>);
return true;
@ -509,6 +514,43 @@
});
$('#tipoImpresion').on("change", function () {
updatePapelesComparador();
$('#title_int_rot').html('<?= lang("Presupuestos.compInteriorRotativa") ?>');
$('#title_int_plana').html('<?= lang("Presupuestos.compInteriorPlana") ?>');
$('#paginas').change();
if (($('#tipoImpresion').select2('data')[0].id == 'negro' ||
$('#tipoImpresion').select2('data')[0].id == 'color')){
$('#tableCompIntRotativa').DataTable().clear().draw();
$('#total_comp_rot').html("0.00");
if( $('#tableCompIntPlana').DataTable().rows().count() > 0 &&
$('#tableCompIntPlana').DataTable().cell(0, 0).data().includes('hq')) {
$('#tableCompIntPlana').DataTable().clear().draw();
$('#total_comp_plana').html("0.00");
}
}
else if (($('#tipoImpresion').select2('data')[0].id == 'negrohq' ||
$('#tipoImpresion').select2('data')[0].id == 'colorhq')){
$('#tableCompIntRotativa').DataTable().clear().draw();
$('#total_comp_rot').html("0.00");
if($('#tableCompIntPlana').DataTable().rows().count() > 0 &&
!$('#tableCompIntPlana').DataTable().cell(0, 0).data().includes('hq')) {
$('#tableCompIntPlana').DataTable().clear().draw();
$('#total_comp_plana').html("0.00");
}
}
});
function checkComparadorInt(is_color, is_hq) {
elementos = getIDsComparador(is_color, is_hq)