From 95ab901367aaaa0ad1ab85a7721d5222cf2fced3 Mon Sep 17 00:00:00 2001 From: imnavajas Date: Sun, 7 Jan 2024 23:39:27 +0100 Subject: [PATCH 1/4] Desarrollo de funcionalidad: pruebas!! --- ci4/.env | 4 +- .../Models/Presupuestos/PresupuestoModel.php | 4 +- .../themes/_commonPartialsBs/datatables.php | 2 +- .../_lineasPresupuestoItems.php | 5 ++- .../cosidotapablanda/_previewItems.php | 3 ++ .../presupuestos/cosidotapablanda/previews.js | 40 +++++++++---------- .../viewCosidotapablandaForm.php | 2 +- 7 files changed, 31 insertions(+), 29 deletions(-) diff --git a/ci4/.env b/ci4/.env index 7541e4d4..bedc3119 100755 --- a/ci4/.env +++ b/ci4/.env @@ -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 diff --git a/ci4/app/Models/Presupuestos/PresupuestoModel.php b/ci4/app/Models/Presupuestos/PresupuestoModel.php index d263785f..ced65214 100755 --- a/ci4/app/Models/Presupuestos/PresupuestoModel.php +++ b/ci4/app/Models/Presupuestos/PresupuestoModel.php @@ -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"); diff --git a/ci4/app/Views/themes/_commonPartialsBs/datatables.php b/ci4/app/Views/themes/_commonPartialsBs/datatables.php index 65b97e9a..65842d67 100755 --- a/ci4/app/Views/themes/_commonPartialsBs/datatables.php +++ b/ci4/app/Views/themes/_commonPartialsBs/datatables.php @@ -118,7 +118,7 @@ $('.dataTables_processing').hide(); const theData = jqXHR.responseJSON; drawCallback(theData); - popErrorAlert(jqXHR.responseJSON.messages.error) + popErrorAlert(jqXHR.responseJSON.message) } }); } else { diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php index 60c50cf3..2036534a 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php @@ -364,7 +364,7 @@ const actionBtns_lp = function(data) { `; }; -var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{ + window.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/i18n ?>.json" }, + initComplete: function (settings, json) { + //getVisibleTabs(); + }, columnDefs: [ { targets: 0, diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_previewItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_previewItems.php index 2285f1d9..70704f57 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_previewItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_previewItems.php @@ -739,8 +739,11 @@ getVisibleTabs(); + + $('#tab-pv-bn').on( "click", function() { + previewInteriorPlana('bn'); } ); diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/previews.js b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/previews.js index d4088b2f..dec08b47 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/previews.js +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/previews.js @@ -463,6 +463,24 @@ function getObjetoLP(lpName) { function getVisibleTabs() { + window.tableLineasPresupuesto.rows().every( function ( rowIdx, tableLoop, rowLoop ) { + var rowData = this.data(); + console.log(rowData.row_id); + $("#tab-pv-bn").show(); + } ); + + /* + tableLineasPresupuesto.rows().data().every( function ( rowIdx, tableLoop, rowLoop ) { + var rowData = this.data(); + console.log(rowData.row_id); + if ($('#' + rowData.row_id + '_checkPapel').prop('checked')) { + totalPapel += parseFloat($('#' + rowData.row_id + '_totalPapelPedido').val()) + margenPapel += parseFloat($('#' + rowData.row_id + '_margenPapelPedido').val()) + } + });*/ + + + /* $("#tableLineasPresupuesto tbody tr").each(function () { let isVisible = $(this).is(":visible"); let lpName = $(this).attr('id').replace('lp_', ''); @@ -514,30 +532,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"); - } - }); */ - } diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php index c0455cd0..e75f9812 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php @@ -22,7 +22,7 @@ - + From a05c717c9fbc16d8c047b30055ba4199a5087cf3 Mon Sep 17 00:00:00 2001 From: imnavajas Date: Mon, 8 Jan 2024 09:02:21 +0100 Subject: [PATCH 2/4] Resuelto el bug de POD en el add --- ci4/app/Controllers/Presupuestos/Cosidotapablanda.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php b/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php index 51521292..df1594fb 100755 --- a/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php +++ b/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php @@ -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'); From f85dfc1cfc7f6547bf38e3acf6cb23432aa7f5f2 Mon Sep 17 00:00:00 2001 From: imnavajas Date: Mon, 8 Jan 2024 09:17:54 +0100 Subject: [PATCH 3/4] Arreglados bugs de warning numero de paginas --- .../_lineasPresupuestoItems.php | 43 ++++++++++--------- .../presupuestos/cosidotapablanda/previews.js | 2 +- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php index 2036534a..b27764df 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php @@ -364,7 +364,7 @@ const actionBtns_lp = function(data) { `; }; - window.tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{ + var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{ scrollX: true, searching: false, paging: false, @@ -3285,27 +3285,29 @@ async function fill_bbdd_from_lp(presupuesto_id){ data.push(linea_data) } ); - - await $.ajax({ - type: 'post', - url: '', + if(data.lengh > 0){ - data: { - tipo: 'lineasPresupuesto', - datos: data, - presupuesto_id: presupuesto_id, - : v - }, - dataType: 'json', - success:function(response){ + await $.ajax({ + type: 'post', + url: '', - token=response.; - yeniden(token); - } - }).fail(function (jqXHR, textStatus, error) { - // Handle error here - console.log(jqXHR) - }); + data: { + tipo: 'lineasPresupuesto', + datos: data, + presupuesto_id: presupuesto_id, + : v + }, + dataType: 'json', + success:function(response){ + + token=response.; + yeniden(token); + } + }).fail(function (jqXHR, textStatus, error) { + // Handle error here + console.log(jqXHR) + }); + } } function updateLineasPresupuesto(){ @@ -3344,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 }) diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/previews.js b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/previews.js index dec08b47..e1174633 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/previews.js +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/previews.js @@ -463,7 +463,7 @@ function getObjetoLP(lpName) { function getVisibleTabs() { - window.tableLineasPresupuesto.rows().every( function ( rowIdx, tableLoop, rowLoop ) { + $('#tableLineasPresupuesto').DataTable().rows().every( function ( rowIdx, tableLoop, rowLoop ) { var rowData = this.data(); console.log(rowData.row_id); $("#tab-pv-bn").show(); From 23a50e6bc218ba7eb4fee962efa0d81111c41526 Mon Sep 17 00:00:00 2001 From: imnavajas Date: Mon, 8 Jan 2024 12:16:42 +0100 Subject: [PATCH 4/4] Desarrollo intermedio --- .../cosidotapablanda/_previewItems.php | 1 - .../presupuestos/cosidotapablanda/previews.js | 96 +++++++++++++------ 2 files changed, 65 insertions(+), 32 deletions(-) diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_previewItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_previewItems.php index 70704f57..94b55442 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_previewItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_previewItems.php @@ -743,7 +743,6 @@ getVisibleTabs(); $('#tab-pv-bn').on( "click", function() { - previewInteriorPlana('bn'); } ); diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/previews.js b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/previews.js index e1174633..58214bfa 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/previews.js +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/previews.js @@ -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,21 +475,43 @@ function getObjetoLP(lpName) { function getVisibleTabs() { - $('#tableLineasPresupuesto').DataTable().rows().every( function ( rowIdx, tableLoop, rowLoop ) { - var rowData = this.data(); - console.log(rowData.row_id); - $("#tab-pv-bn").show(); - } ); + // Clear all existing tabs + $('*[id*=tab-pv-]').each(function () { + $(this).hide(); + $(this).children('.active').each(function () { + $(this).removeClass('active'); + }); - /* - tableLineasPresupuesto.rows().data().every( function ( rowIdx, tableLoop, rowLoop ) { - var rowData = this.data(); - console.log(rowData.row_id); - if ($('#' + rowData.row_id + '_checkPapel').prop('checked')) { - totalPapel += parseFloat($('#' + rowData.row_id + '_totalPapelPedido').val()) - margenPapel += parseFloat($('#' + rowData.row_id + '_margenPapelPedido').val()) + /*$("#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; } - });*/ + + }); /*