trabajando en meter los datos en las lineas de presupuesto

This commit is contained in:
Jaime Jiménez Ortega
2023-11-07 08:38:49 +01:00
parent 65b5f59c40
commit 02133bf0b9
3 changed files with 75 additions and 23 deletions

View File

@ -35,7 +35,7 @@
</tr>
</thead>
<tbody>
<tr id="lp_bn">
<tr id="lp_bn" style="display: none;">
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_bn.png') ?>" /></td>
<td class="lp-td"><input id="lp_bn_paginas" name="lp_bn_paginas" class="lp-cell lp-input lp-bn-input" type="text" value="0"></td>
<td class="lp-td">
@ -75,10 +75,10 @@
<td class="lp-td"><input id="lp_bn_click" name="lp_bn_click" readonly class="lp-input lp-cell lp-cell-disabled lp-bn-input" value="0"></td>
<td class="lp-td"><input id="lp_bn_totalClicks" name="lp_bn_totalClicks" class="lp-input lp-cell lp-cell-disabled lp-bn-input" type="text" value="0"></td>
<td class="lp-td"><input id="lp_bn_checkClicks" name="lp_bn_checkClicks" style="width: 15px; padding: 0; margin:0;" type="checkbox" checked></td>
<td style="padding: 0; margin:0;"><a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2"></i></a></td>
<td style="padding: 0; margin:0;"><a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a></td>
</tr>
<tr id="lp_bnhq">
<tr id="lp_bnhq" style="display: none;">
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_bnhq.png') ?>" /></td>
<td class="lp-td"><input id="lp_bnhq_paginas" name="lp_bnhq_paginas" class="lp-cell lp-input" type="text" value="0"></td>
<td class="lp-td">
@ -118,10 +118,10 @@
<td class="lp-td"><input id="lp_bnhq_click" name="lp_bnhq_click" readonly class="lp-input lp-cell lp-cell-disabled" value="0"></td>
<td class="lp-td"><input id="lp_bnhq_totalClicks" name="lp_bnhq_totalClicks" class="lp-input lp-cell lp-cell-disabled" type="text" value="0"></td>
<td class="lp-td"><input id="lp_bnhq_checkClicks" name="lp_bnhq_checkClicks" style="width: 15px; padding: 0; margin:0;" type="checkbox" checked></td>
<td style="padding: 0; margin:0;"><a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2"></i></a></td>
<td style="padding: 0; margin:0;"><a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a></td>
</tr>
<tr id="lp_color">
<tr id="lp_color" style="display: none;">
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_color.png') ?>" /></td>
<td class="lp-td"><input id="lp_color_paginas" name="lp_color_paginas" class="lp-cell lp-input" type="text" value="0"></td>
<td class="lp-td">
@ -161,10 +161,10 @@
<td class="lp-td"><input id="lp_color_click" name="lp_color_click" readonly class="lp-input lp-cell lp-cell-disabled" value="0"></td>
<td class="lp-td"><input id="lp_color_totalClicks" name="lp_color_totalClicks" class="lp-input lp-cell lp-cell-disabled" type="text" value="0"></td>
<td class="lp-td"><input id="lp_color_checkClicks" name="lp_color_checkClicks" style="width: 15px; padding: 0; margin:0;" type="checkbox" checked></td>
<td style="padding: 0; margin:0;"><a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2"></i></a></td>
<td style="padding: 0; margin:0;"><a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a></td>
</tr>
<tr id="lp_colorhq">
<tr id="lp_colorhq" style="display: none;">
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_colorhq.png') ?>" /></td>
<td class="lp-td"><input id="lp_colorhq_paginas" name="lp_colorhq_paginas" class="lp-cell lp-input" type="text" value="0"></td>
<td class="lp-td">
@ -204,10 +204,10 @@
<td class="lp-td"><input id="lp_colorhq_click" name="lp_colorhq_click" readonly class="lp-input lp-cell lp-cell-disabled" value="0"></td>
<td class="lp-td"><input id="lp_colorhq_totalClicks" name="lp_colorhq_totalClicks" class="lp-input lp-cell lp-cell-disabled" type="text" value="0"></td>
<td class="lp-td"><input id="lp_colorhq_checkClicks" name="lp_colorhq_checkClicks" style="width: 15px; padding: 0; margin:0;" type="checkbox" checked></td>
<td style="padding: 0; margin:0;"><a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2"></i></a></td>
<td style="padding: 0; margin:0;"><a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a></td>
</tr>
<tr id="lp_rot_bn" style="border-bottom-color: white;">
<tr id="lp_rot_bn" style="border-bottom-color: white; display: none;" >
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_rotativa_bn.png') ?>" /></td>
<td class="lp-td"><input id="lp_rot_bn_paginas" name="lp_rot_bn_paginas" class="lp-cell lp-input" type="text" value="0"></td>
<td class="lp-td">
@ -247,9 +247,9 @@
<td class="lp-td"><input id="lp_rot_bn_click" name="lp_rot_bn_click" readonly class="lp-input lp-cell lp-cell-disabled" value="0"></td>
<td class="lp-td"><input id="lp_rot_bn_totalClicks" name="lp_rot_bn_totalClicks" class="lp-input lp-cell lp-cell-disabled" type="text" value="0"></td>
<td class="lp-td"><input id="lp_rot_bn_checkClicks" name="lp_rot_bn_checkClicks" style="width: 15px; padding: 0; margin:0;" type="checkbox" checked></td>
<td style="padding: 0; margin:0;"><a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2"></i></a></td>
<td style="padding: 0; margin:0;"><a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a></td>
</tr>
<tr id="lp_rot_bn_data" >
<tr id="lp_rot_bn_data" style="display: none;">
<td class="lp-td"></td>
<td class="lp-td" colspan="18" style="padding-top: 0px;">
<div class="row">
@ -456,7 +456,7 @@
<tr id="lp_rot_color" style="border-bottom-color: white;">
<tr id="lp_rot_color" style="border-bottom-color: white; display:none;">
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_rotativa_color.png') ?>" /></td>
<td class="lp-td"><input id="lp_rot_color_paginas" name="lp_rot_color_paginas" class="lp-cell lp-input" type="text" value="0"></td>
<td class="lp-td">
@ -496,10 +496,10 @@
<td class="lp-td"><input id="lp_rot_color_click" name="lp_rot_color_click" readonly class="lp-input lp-cell lp-cell-disabled" value="0"></td>
<td class="lp-td"><input id="lp_rot_color_totalClicks" name="lp_rot_color_totalClicks" class="lp-input lp-cell lp-cell-disabled" type="text" value="0"></td>
<td class="lp-td"><input id="lp_rot_color_checkClicks" name="lp_rot_color_checkClicks" style="width: 15px; padding: 0; margin:0;" type="checkbox" checked></td>
<td style="padding: 0; margin:0;"><a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2"></i></a></td>
<td style="padding: 0; margin:0;"><a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a></td>
</tr>
<tr id="lp_rot_color_data" >
<tr id="lp_rot_color_data" style="display: none;">
<td class="lp-td"></td>
<td class="lp-td" colspan="18" style="padding-top: 0px;">
<div class="row">
@ -704,7 +704,7 @@
<td style="display: none;"></td>
</tr>
<tr id="lp_cubierta">
<tr id="lp_cubierta" style="display: none;">
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_cubierta.png') ?>" /></td>
<td class="lp-td"><input id="lp_cubierta_paginas" name="lp_cubierta_paginas" class="lp-cell lp-input" type="text" value="0"></td>
<td class="lp-td">
@ -744,10 +744,10 @@
<td class="lp-td"><input id="lp_cubierta_click" name="lp_cubierta_click" readonly class="lp-input lp-cell lp-cell-disabled" value="0"></td>
<td class="lp-td"><input id="lp_cubierta_totalClicks" name="lp_cubierta_totalClicks" class="lp-input lp-cell lp-cell-disabled" type="text" value="0"></td>
<td class="lp-td"><input id="lp_cubierta_checkClicks" name="lp_cubierta_checkClicks" style="width: 15px; padding: 0; margin:0;" type="checkbox" checked></td>
<td style="padding: 0; margin:0;"><a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2"></i></a></td>
<td style="padding: 0; margin:0;"><a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a></td>
</tr>
<tr id="lp_sobrecubierta">
<tr id="lp_sobrecubierta" style="display: none;">
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_sobrecubierta.png') ?>" /></td>
<td class="lp-td"><input id="lp_sobrecubierta_paginas" name="lp_sobrecubierta_paginas" class="lp-cell lp-input" type="text" value="0"></td>
<td class="lp-td">
@ -787,7 +787,7 @@
<td class="lp-td"><input id="lp_sobrecubierta_click" name="lp_sobrecubierta_click" readonly class="lp-input lp-cell lp-cell-disabled" value="0"></td>
<td class="lp-td"><input id="lp_sobrecubierta_totalClicks" name="lp_sobrecubierta_totalClicks" class="lp-input lp-cell lp-cell-disabled" type="text" value="0"></td>
<td class="lp-td"><input id="lp_sobrecubierta_checkClicks" name="lp_sobrecubierta_checkClicks" style="width: 15px; padding: 0; margin:0;" type="checkbox" checked></td>
<td style="padding: 0; margin:0;"><a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2"></i></a></td>
<td style="padding: 0; margin:0;"><a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a></td>
</tr>
</tbody>
@ -1013,4 +1013,29 @@ function calcularPresupuesto_bn(){
})
}
// Delete row
$(document).on('click', '.btn-delete', function(e) {
const row_id = $(this).closest('tr')[0].id;
$(".btn-remove").attr('row-id', row_id);
});
$(document).on('click', '.btn-remove', function(e) {
const row_id = $(this).attr('row-id');
switch(row_id) {
case 'lp_bn':
clear_lp_bn(true);
row = $('#' + row_id).css('display', 'none');
break;
case 'lp_bn_hq':
// code block
break;
default:
// code block
}
$('#confirm2delete').modal('toggle');
});
<?= $this->endSection() ?>

View File

@ -151,20 +151,47 @@ $('.accordion-button').on('click', function (e) {
/*******************************
* Metodos
*******************************/
function fill_lp_bn(row){
$('#lp_bn_paginas').val(row['paginas'])
$.when($('#lp_bn_papel').val('').change())
.then(function(){
$.when($('#lp_bn_papel').val(row['papelGenericoId']).change())
.then(function() {
$.when($('#lp_bn_gramaje').val(1).change())
.then(function() {
$('#lp_bn_maquina').val(row['maquinaId']).change();
})
})
})
/*
$('#lp_bn_gramaje').val(row['gramaje']).change();
$('#lp_bn_papelImpresion').val(row['papelImpresionId']).change();
$('#lp_bn_maquina').val(row['maquinaId']).change();*/
$('#lp_bn').css('display', '')
$("#tableLineasPresupuesto").DataTable().columns.adjust();
}
$('.insertarLinea').on("click", function (e) {
if(e.target.id.includes("Plana")){
// Se borran todas las líneas que no sean cubierta y sobrecubierta
$('#tableLineasPresupuesto').DataTable()
/*$('#tableLineasPresupuesto').DataTable()
.rows( function ( idx, data, node ) {
return data[0] !== 'cubierta' && data[0] !== 'sobrecubierta';
} )
.remove()
.draw();
.draw();*/
var rows = $("#tableCompIntPlana").DataTable().rows( '.selected' ).data().toArray();
console.log(rows);
for(row of rows){
if(row['tipo'] =='bn'){
fill_lp_bn(row);
}/*
$('#tableLineasPresupuesto').DataTable().row.add({
'tipo': row['tipo'],
'paginas': row['paginas'],
@ -189,7 +216,7 @@ $('.insertarLinea').on("click", function (e) {
'papelGenericoId': row['papelGenericoId'],
'papelImpresionId': row['papelImpresionId'],
}
).draw();
).draw();*/
}
}
});

View File

@ -358,7 +358,7 @@
},
});
$('.comp_negro_items').on('change', function (e) {