Merge branch 'dev/new_preview' into 'main'

Dev/new preview

See merge request jjimenez/safekat!112
This commit is contained in:
Ignacio Martinez Navajas
2024-01-08 11:17:48 +00:00
8 changed files with 106 additions and 68 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

@ -153,8 +153,8 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$this->viewData['incReiList'] = array('incidencia' => lang('Presupuestos.incidencia'), 'reimpresion' => lang('Presupuestos.reimpresion'), 'sin_cargo' => lang('Presupuestos.sinCargo'));
$this->viewData['paisList'] = $this->getPaisListItems();
$this->viewData['papelFormatoList'] = $this->getPapelFormatoListItems($presupuestoEntity->papel_formato_id ?? null);
$this->viewData['POD'] = $this->getPOD();
$this->viewData['formAction'] = route_to('createCosidotapablanda');

View File

@ -22,7 +22,7 @@ class PresupuestoModel extends \App\Models\GoBaseModel
6 => "t1.inc_rei",
7 => "t1.paginas",
8 => "t1.tirada",
9 => "t1.total_pedido",
9 => "t1.total_presupuesto",
10 => "t6.estado",
];
@ -314,7 +314,7 @@ class PresupuestoModel extends \App\Models\GoBaseModel
"t1.id AS id, t1.created_at AS fecha, t2.nombre AS cliente,
CONCAT(t3.first_name, ' ', t3.last_name) AS comercial, t1.titulo AS titulo,
t5.nombre AS pais, t1.inc_rei AS inc_rei, t1.paginas AS paginas, t1.tirada AS tirada,
t1.total_pedido AS total_pedido, t1.total_presupuesto AS total_presupuesto, t6.estado AS estado"
t1.total_presupuesto AS total_presupuesto, t1.total_presupuesto AS total_presupuesto, t6.estado AS estado"
);
$builder->join("clientes t2", "t1.cliente_id = t2.id", "left");
$builder->join("auth_user t3", "t1.user_update_id = t3.id_user", "left");

View File

@ -118,7 +118,7 @@
$('.dataTables_processing').hide();
const theData = jqXHR.responseJSON;
drawCallback(theData);
popErrorAlert(jqXHR.responseJSON.messages.error)
popErrorAlert(jqXHR.responseJSON.message)
}
});
} else {

View File

@ -364,7 +364,7 @@ const actionBtns_lp = function(data) {
`;
};
var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{
var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{
scrollX: true,
searching: false,
paging: false,
@ -376,6 +376,9 @@ var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
initComplete: function (settings, json) {
//getVisibleTabs();
},
columnDefs: [
{
targets: 0,
@ -3282,27 +3285,29 @@ async function fill_bbdd_from_lp(presupuesto_id){
data.push(linea_data)
} );
await $.ajax({
type: 'post',
url: '<?= route_to("updateDataOfCosidotapablanda") ?>',
if(data.lengh > 0){
data: {
tipo: 'lineasPresupuesto',
datos: data,
presupuesto_id: presupuesto_id,
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v
},
dataType: 'json',
success:function(response){
await $.ajax({
type: 'post',
url: '<?= route_to("updateDataOfCosidotapablanda") ?>',
token=response.<?= csrf_token() ?>;
yeniden(token);
}
}).fail(function (jqXHR, textStatus, error) {
// Handle error here
console.log(jqXHR)
});
data: {
tipo: 'lineasPresupuesto',
datos: data,
presupuesto_id: presupuesto_id,
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v
},
dataType: 'json',
success:function(response){
token=response.<?= csrf_token() ?>;
yeniden(token);
}
}).fail(function (jqXHR, textStatus, error) {
// Handle error here
console.log(jqXHR)
});
}
}
function updateLineasPresupuesto(){
@ -3341,6 +3346,7 @@ function checkPaginasPresupuesto(){
tableLineasPresupuesto.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
var rowData = this.data();
if((rowData.row_id != 'lp_cubierta') && (rowData.row_id != 'lp_sobrecubierta'))
cantidad_total += rowData.paginas
})

View File

@ -739,6 +739,8 @@
getVisibleTabs();
$('#tab-pv-bn').on( "click", function() {
previewInteriorPlana('bn');

View File

@ -369,20 +369,32 @@ function getLomoLibro() {
function getObjetoLP(lpName) {
let rowData = null;
$('#tableLineasPresupuesto').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
if (this.data().row_id.indexOf(lpName) >= 0) {
rowData = this.data();
}
console.log(rowData);
});
pvObj = {
idIndex: lpName,
gramajeLibro: parseInt($('#lp_' + lpName + '_gramaje').text()),
manoLP: parseFloat($('#lp_' + lpName + '_lomo').val()),
gramajeLibro: parseInt(rowData.gramaje),
manoLP: parseFloat(rowData.lomo),
lomoLibro: getLomoLibro(),
anchoSolapa: parseFloat($('#solapas_ancho').val()),
nFormas: parseInt($('#lp_' + lpName + '_formas').val()),
nFormasH: parseInt($('#lp_' + lpName + '_formas_h').val()),
nFormasV: parseInt($('#lp_' + lpName + '_formas_v').val()),
orientacionFormas: $('#lp_' + lpName + '_formas_orientacion').val(),
altoMaquina: parseFloat($('#lp_' + lpName + '_maquina_alto').val()),
anchoMaquina: parseFloat($('#lp_' + lpName + '_maquina_ancho').val()),
altoImpresion: parseFloat($('#lp_' + lpName + '_maquina_impresion_alto').val()),
anchoImpresion: parseFloat($('#lp_' + lpName + '_maquina_impresion_ancho').val()),
nFormas: parseInt(rowData.formas),
nFormasH: parseInt(rowData.formas_h),
nFormasV: parseInt(rowData.formas_v),
orientacionFormas: rowData.formas_orientacion,
altoMaquina: parseFloat(rowData.maquina_alto),
anchoMaquina: parseFloat(rowData.maquina_ancho),
altoImpresion: parseFloat(rowData.maquina_impresion_alto),
anchoImpresion: parseFloat(rowData.maquina_impresion_ancho),
altoLibro: getDimensionLibro().alto,
anchoLibro: getDimensionLibro().ancho
};
@ -393,9 +405,9 @@ function getObjetoLP(lpName) {
// Update preview info fields
let pvName = '#pv_' + lpName;
$(pvName + '_pg').attr("href", $(pvName + '_pg').attr('sk-url') + $('#lp_' + lpName + '_papel').val());
$(pvName + '_pi').attr("href", $(pvName + '_pi').attr('sk-url') + $('#lp_' + lpName + '_papelImpresion').val());
$(pvName + '_mi').attr("href", $(pvName + '_mi').attr('sk-url') + $('#lp_' + lpName + '_maquina').val());
$(pvName + '_pg').attr("href", $(pvName + '_pg').attr('sk-url') + rowData.papel);
$(pvName + '_pi').attr("href", $(pvName + '_pi').attr('sk-url') + rowData.papel_impresion_id);
$(pvName + '_mi').attr("href", $(pvName + '_mi').attr('sk-url') + rowData.maquina_id);
$(pvName + '_gramaje').text(pvObj.gramajeLibro);
$(pvName + '_mano').text(pvObj.manoLP);
@ -406,11 +418,11 @@ function getObjetoLP(lpName) {
$(pvName + '_forma').text(pvObj.anchoForma + "x" + pvObj.altoForma);
$(pvName + '_nFormas').text(pvObj.nFormas);
if(pvObj.anchoSolapa != 0){
if (pvObj.anchoSolapa != 0) {
$('.pv-solapas').show();
offsetSolapaValor = parseFloat(3); // 3mm
}else{
} else {
$('.pv-solapas').hide();
offsetSolapaValor = parseFloat(0); // No offset
}
@ -430,8 +442,8 @@ function getObjetoLP(lpName) {
case 'rot_bn':
case 'rot_color':
if((pvObj.anchoImpresion / pvObj.altoForma) > (pvObj.anchoImpresion / pvObj.anchoForma)){
let auxReg = pvObj.anchoForma;
if ((pvObj.anchoImpresion / pvObj.altoForma) > (pvObj.anchoImpresion / pvObj.anchoForma)) {
let auxReg = pvObj.anchoForma;
pvObj.anchoForma = pvObj.altoForma;
pvObj.altoForma = auxReg;
}
@ -439,7 +451,7 @@ function getObjetoLP(lpName) {
pvObj.altoClick = 305; //parseFloat($('#lp_' + lpName + '_alto_click').val());
pvObj.nFormasH = Math.trunc(pvObj.anchoImpresion / pvObj.anchoForma);
pvObj.nFormasV = Math.trunc((pvObj.altoImpresion - 3) / (pvObj.altoForma + 4));
console.log( )
console.log()
break;
case 'bn':
@ -463,6 +475,46 @@ function getObjetoLP(lpName) {
function getVisibleTabs() {
// Clear all existing tabs
$('*[id*=tab-pv-]').each(function () {
$(this).hide();
$(this).children('.active').each(function () {
$(this).removeClass('active');
});
/*$("#pv_" + lpName).removeClass("active show");
$("#pv_esquema_" + lpName).removeClass("active show");*/
});
// Enable active tabs
$('#tableLineasPresupuesto').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
let lpName = this.data().row_id.replace('lp_', '');
let tabName = lpName.replace('_', '-');
//console.log(lpName);
switch (lpName) {
case 'bn':
case 'bnhq':
case 'color':
case 'colorhq':
case 'rot_bn':
case 'rot_color':
$("#tab-pv-" + tabName).show();
break;
case 'cubierta':
$("#tab-pv-" + tabName).show();
$("#tab-pv-esquema-" + tabName).show();
break;
default:
break;
}
});
/*
$("#tableLineasPresupuesto tbody tr").each(function () {
let isVisible = $(this).is(":visible");
let lpName = $(this).attr('id').replace('lp_', '');
@ -514,30 +566,8 @@ function getVisibleTabs() {
});
/*
$("#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_', 'pv_')).removeClass("active show");
} else {
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-')).hide();
$("#" + $(this).attr('id').replace('lp_', 'pv_')).removeClass("active show");
}
});
*/
}

View File

@ -22,7 +22,7 @@
<?php if(str_contains($formAction,'edit')): ?>
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems") ?>
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems") ?>
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_previewItems") ?>
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems") ?>
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosEnvios") ?>
<?= view("themes/backend/vuexy/form/presupuestos/cosidotapablanda/_comentariosItems") ?>