Añadido a eventos la visualizacion de pestañas

This commit is contained in:
imnavajas
2023-12-30 00:37:38 +01:00
parent 463aa51a35
commit fed05de5bf
4 changed files with 70 additions and 30 deletions

View File

@ -22,8 +22,8 @@ CI_ENVIRONMENT = development
# APP
#--------------------------------------------------------------------
app.baseURL = 'https://sk-jjo.imnavajas.es'
# app.baseURL = 'https://sk-imn.imnavajas.es'
# app.baseURL = 'https://sk-jjo.imnavajas.es'
app.baseURL = 'https://sk-imn.imnavajas.es'
# app.baseURL = "http://safekat.test/"
# app.forceGlobalSecureRequests = false

View File

@ -1401,9 +1401,11 @@ function fill_lp_bn(row, fromComparator=false){
updateTotales()
}
$('#lp_bn').css('display', '')
$("#tableLineasPresupuesto").DataTable().columns.adjust();
getVisibleTabs(); // Update preview UI
}
<?= $this->endSection() ?>
@ -1642,6 +1644,9 @@ function fill_lp_color(row, fromComparator=false){
$('#lp_color').css('display', '')
$("#tableLineasPresupuesto").DataTable().columns.adjust();
getVisibleTabs(); // Update preview UI
}
<?= $this->endSection() ?>
@ -1879,6 +1884,8 @@ function fill_lp_bnhq(row, fromComparator=false){
$('#lp_bnhq').css('display', '')
$("#tableLineasPresupuesto").DataTable().columns.adjust();
getVisibleTabs(); // Update preview UI
}
<?= $this->endSection() ?>
@ -2118,6 +2125,9 @@ function fill_lp_colorhq(row, fromComparator=false){
$('#lp_colorhq').css('display', '')
$("#tableLineasPresupuesto").DataTable().columns.adjust();
getVisibleTabs(); // Update preview UI
}
<?= $this->endSection() ?>
@ -2465,6 +2475,9 @@ function fill_lp_rot_bn(row, fromComparador=false){
$('.lp_rot_bn').css('display', '')
$("#tableLineasPresupuesto").DataTable().columns.adjust();
getVisibleTabs(); // Update preview UI
}
<?= $this->endSection() ?>
@ -2822,6 +2835,9 @@ function fill_lp_rot_color(row, fromComparador=false){
$('.lp_rot_color').css('display', '')
$("#tableLineasPresupuesto").DataTable().columns.adjust();
getVisibleTabs(); // Update preview UI
}
<?= $this->endSection() ?>
@ -3102,6 +3118,9 @@ function fill_lp_cubierta(row, fromComparador=false){
$('.lp_cubierta').css('display', '')
$("#tableLineasPresupuesto").DataTable().columns.adjust();
getVisibleTabs(); // Update preview UI
}

View File

@ -16,7 +16,7 @@
<li id="tab-pv-bn" class="nav-item" style="display: none">
<button
type="button"
class="nav-link active"
class="nav-link"
role="tab"
data-bs-toggle="tab"
data-bs-target="#pv_bn"
@ -737,13 +737,10 @@
<!------------------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
var cubiertaObjeto = 0;
getVisibleTabs();
$('#tab-pv-bn').on( "click", function() {
previewInteriorPlana('bn');
} );
@ -792,6 +789,13 @@ $('#tab-pv-esquema-cubierta').on( "click", function() {
} );
$('#confirmDelete').on( "click", function() {
setTimeout(function (){
getVisibleTabs();
}, 1000);
} );
<?= $this->endSection() ?>

View File

@ -1,18 +1,10 @@
// Global parameters
var _isCosido = true;
var _offsetSolapas = 2; // millimeters
var pvObj;
var styles = {
size: 13,
family: 'Public Sans',
}
var sangradoTexto = "Sangrado 5 mm";
var sangradoValor = parseFloat(5); // mm
var offsetSolapaValor = parseFloat(3); // mm
var offsetSolapaValor = parseFloat(0); // mm
function previewInteriorPlana(lpTagName) {
@ -99,7 +91,7 @@ function previewRotativa(lpTagName) {
let styleText = {size: 12, family: 'Public Sans'};
let margenTop = 3;
let guardaV = 0;
guardaH = 0;
let guardaH = 0;
// Get the preview Object parameters
getObjetoLP(lpTagName);
@ -122,7 +114,7 @@ function previewRotativa(lpTagName) {
let nTopForms = (pvObj.altoImpresion / 2.0 - margenTop) / (LVo + guardaV);
let yOffset = LVo * getDecimalPart(nTopForms);
//console.log(yOffset);
console.log(yOffset);
// Clear the canvas element
$('#pv_' + pvObj.idIndex + '_shape').empty();
@ -195,8 +187,8 @@ function previewRotativa(lpTagName) {
}
function getDecimalPart(floatNumber) {
let int_part = Math.trunc(floatNumber); // returns 3
let float_part = Number((floatNumber - int_part).toFixed(2)); // return 0.2
let int_part = Math.trunc(floatNumber);
let float_part = Number((floatNumber - int_part).toFixed(2));
return float_part;
}
@ -421,12 +413,19 @@ function getObjetoLP(lpName) {
$(pvName + '_forma').text(pvObj.anchoForma + "x" + pvObj.altoForma);
$(pvName + '_nFormas').text(pvObj.nFormas);
(pvObj.anchoSolapa != 0) ? $('.pv-solapas').show() : $('.pv-solapas').hide();
if(pvObj.anchoSolapa != 0){
$('.pv-solapas').show();
offsetSolapaValor = parseFloat(3); // 3mm
}else{
$('.pv-solapas').hide();
offsetSolapaValor = parseFloat(0); // No offset
}
// Custom overwrites
switch (pvObj.idIndex) {
case 'cubierta':
pvObj.anchoForma = ((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + _offsetSolapas)) + pvObj.lomoLibro);
pvObj.anchoForma = ((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + offsetSolapaValor)) + pvObj.lomoLibro);
$(pvName + '_forma').text(pvObj.anchoForma + "x" + pvObj.altoForma);
break;
case 'ec':
@ -438,13 +437,8 @@ function getObjetoLP(lpName) {
case 'rot_bn':
case 'rot_color':
pvObj.anchoMaquina = 520;
pvObj.altoMaquina= 800;
pvObj.anchoImpresion= 515;
pvObj.altoImpresion= 800;
pvObj.nFormasH = 1;
pvObj.nFormasV = 3;
pvObj.altoClick = 305;
pvObj.altoClick = 305; //parseFloat($('#lp_' + lpName + '_alto_click').val());
pvObj.nFormasV = Math.trunc(pvObj.altoImpresion / pvObj.altoForma);
break;
default:
@ -457,20 +451,43 @@ function getVisibleTabs() {
$("#tableLineasPresupuesto tbody tr:visible").each(function () {
console.log($(this).attr('id'));
//console.log("Visible: " + $(this).attr('id'));
if ($(this).attr('id').indexOf('cubierta') > -1) {
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-')).show();
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-esquema-')).show();
$("#pv_cubierta").addClass("active show");
$("#pv_esquema-cubierta").addClass("active show");
} else if ($(this).attr('id').indexOf('_data') > -1) {
// Do nothing here
} else if ($(this).attr('id').indexOf('_rot') > -1) {
$("#" + $(this).attr('id').replace('lp_rot_', 'tab-pv-rot-')).show();
$("#" + $(this).attr('id').replace('lp_', '')).addClass("active show");
} else {
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-')).show();
$("#" + $(this).attr('id').replace('lp_', '')).addClass("active show");
}
});
$("#tableLineasPresupuesto tbody tr:hidden").each(function () {
//console.log("Hidden: " + $(this).attr('id'));
if ($(this).attr('id').indexOf('cubierta') > -1) {
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-')).hide();
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-esquema-')).hide();
$("#pv_cubierta").removeClass("active show");
$("#pv_esquema-cubierta").removeClass("active show");
} else if ($(this).attr('id').indexOf('_data') > -1) {
// Do nothing here
} else if ($(this).attr('id').indexOf('_rot') > -1) {
$("#" + $(this).attr('id').replace('lp_rot_', 'tab-pv-rot-')).hide();
$("#" + $(this).attr('id').replace('lp_', '')).removeClass("active show");
} else {
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-')).hide();
$("#" + $(this).attr('id').replace('lp_', '')).removeClass("active show");
}
});
}