diff --git a/ci4/app/Views/themes/vuexy/form/configuracion/maquinas/viewMaquinaPorDefectoList.php b/ci4/app/Views/themes/vuexy/form/configuracion/maquinas/viewMaquinaPorDefectoList.php index d6d31e0c..5dc87547 100644 --- a/ci4/app/Views/themes/vuexy/form/configuracion/maquinas/viewMaquinaPorDefectoList.php +++ b/ci4/app/Views/themes/vuexy/form/configuracion/maquinas/viewMaquinaPorDefectoList.php @@ -107,12 +107,12 @@ } }, { 'data': 'maquina' }, - { 'data': 'ancho_min' }, - { 'data': 'ancho_max' }, - { 'data': 'alto_min' }, - { 'data': 'alto_max' }, - { 'data': 'tirada_min' }, - { 'data': 'tirada_max' }, + { 'data': 'ancho_min',render : (d) => `${d}` }, + { 'data': 'ancho_max',render : (d) => `${d}` }, + { 'data': 'alto_min',render : (d) => `${d}` }, + { 'data': 'alto_max',render : (d) => `${d}` }, + { 'data': 'tirada_min',render : (d) => `${d}` }, + { 'data': 'tirada_max',render : (d) => `${d}` }, { 'data': actionBtns } ] }); diff --git a/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelGenericoForm.php b/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelGenericoForm.php index 0d231599..b9b1b815 100644 --- a/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelGenericoForm.php +++ b/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelGenericoForm.php @@ -113,7 +113,7 @@ columns : [ { 'data': 'defecto' }, { 'data': 'nombre' }, - { 'data': 'gramaje' }, + { 'data': 'gramaje',render : (d) => `${d}` }, { 'data': actionBtns } ] }); diff --git a/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelImpresionForm.php b/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelImpresionForm.php index 1786fe29..cec4fae0 100644 --- a/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelImpresionForm.php +++ b/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelImpresionForm.php @@ -290,7 +290,9 @@ },{ name: "margen", attr: { - type: "number" + type: "text", + name : "margen", + class :"autonumeric" } }, { "name": "papel_impresion_id", @@ -352,7 +354,7 @@ columns : [ { 'data': 'paginas_min' , render : (d) => `${d}` }, { 'data': 'paginas_max' , render : (d) => `${d}`}, - { 'data': 'margen' }, + { 'data': 'margen', render : (d) => `${d}`}, { data: actionBtns3, className: 'row-edit dt-center'} ], @@ -375,13 +377,7 @@ } ] }); - theTable3.on('draw',() => { - AutoNumeric.multiple("span.autonumeric", { - digitGroupSeparator: ".", - decimalCharacter: ",", - unformatOnSubmit: true - }); - }) + // Activate an inline edit on click of a table cell $(document).on('click', '.btn-edit3', function(e) { editor3.inline( @@ -739,10 +735,10 @@ className: 'dt-body-center' }, { 'data': 'maquina'}, - { 'data': 'ancho'}, - { 'data': 'alto'}, - { 'data': 'anchoimpresion'}, - { 'data': 'altoimpresion'}, + { 'data': 'ancho',render : (d) => `${d}`}, + { 'data': 'alto',render : (d) => `${d}`}, + { 'data': 'anchoimpresion',render : (d) => `${d}`}, + { 'data': 'altoimpresion',render : (d) => `${d}`}, { data: actionBtns2, className: 'row-edit dt-center'} ], diff --git a/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelImpresionList.php b/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelImpresionList.php index 5dcf2c20..3702621a 100644 --- a/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelImpresionList.php +++ b/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelImpresionList.php @@ -100,7 +100,7 @@ columns : [ { 'data': 'nombre' }, { 'data': 'papel_generico_id' }, - { 'data': 'gramaje' }, + { 'data': 'gramaje', render : (d) => `${d}`}, { 'data': 'interior' }, { 'data': 'bn' }, { 'data': 'color' }, diff --git a/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidosList.php b/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidosList.php index f582f5aa..1bbb709e 100644 --- a/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidosList.php +++ b/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidosList.php @@ -72,10 +72,10 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) { var title = $(this).text(); if($(this).hasClass("totalizador")){ if(i==9){ - $(this).html(''); + $(this).html(''); } else if(i==10){ - $(this).html(''); + $(this).html(''); } } else{ @@ -220,9 +220,9 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) { { 'data': 'titulo' }, { 'data': 'ubicacion' }, { 'data': 'inc_rei' }, - { 'data': 'paginas' }, - { 'data': 'tirada' }, - { 'data': 'total_presupuesto' }, + { 'data': 'paginas',render : (d) => `${d}` }, + { 'data': 'tirada',render : (d) => `${d}` }, + { 'data': 'total_presupuesto',render : (d) => `${d}`}, { 'data': 'estado', render: function(data, type, row, meta) { switch(data){ @@ -278,12 +278,6 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) { }); } - for (let coln of priceCols) { - theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) { - cell.innerHTML = parseFloat(cell.innerHTML).toFixed(2); - - }); - } if(= $cliente_id ?> != -1){ // Se oculta la columna de cliente (3) diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/viewPresupuestoAdminList.php b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/viewPresupuestoAdminList.php index 3b93c509..33fbe781 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/viewPresupuestoAdminList.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/viewPresupuestoAdminList.php @@ -187,9 +187,9 @@ theTable = $('#tableOfPresupuestos').DataTable({ { 'data': 'titulo' }, { 'data': 'pais' }, { 'data': 'inc_rei' }, - { 'data': 'paginas' }, - { 'data': 'tirada' }, - { 'data': 'total_presupuesto' }, + { 'data': 'paginas',render : (d) => `${d}` }, + { 'data': 'tirada',render : (d) => `${d}` }, + { 'data': 'total_presupuesto',render : (d) => `${d}` }, { 'data': 'estado' , 'render': function ( data, type, row, meta ) { if(data=='borrador') diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/buscador/viewBuscadorList.php b/ci4/app/Views/themes/vuexy/form/presupuestos/buscador/viewBuscadorList.php index 3d7ee781..51e70074 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/buscador/viewBuscadorList.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/buscador/viewBuscadorList.php @@ -245,9 +245,9 @@ theTable = $('#tableOfPresupuestos').DataTable({ { 'data': 'titulo' }, { 'data': 'pais' }, { 'data': 'inc_rei' }, - { 'data': 'paginas' }, - { 'data': 'tirada' }, - { 'data': 'total_presupuesto' }, + { 'data': 'paginas',render : (d) => `${d}` }, + { 'data': 'tirada' ,render : (d) => `${d}` }, + { 'data': 'total_presupuesto',render : (d) => `${d}` }, { 'data': 'estado' , 'render': function ( data, type, row, meta ) { if(data=='borrador') @@ -279,12 +279,7 @@ theTable.on( 'draw.dt', function () { }); } - for (let coln of priceCols) { - theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) { - cell.innerHTML = parseFloat(cell.innerHTML).toFixed(2); - }); - } }); diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoList.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoList.php index f2532954..0b24a64e 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoList.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoList.php @@ -277,9 +277,9 @@ theTable = $('#tableOfPresupuestos').DataTable({ { 'data': 'titulo' }, - { 'data': 'paginas' }, - { 'data': 'tirada' }, - { 'data': 'total_presupuesto' }, + { 'data': 'paginas',render : (d) => `${d}` }, + { 'data': 'tirada',render : (d) => `${d}` }, + { 'data': 'total_presupuesto',render : (d) => `${d}` }, { 'data': 'estado' , 'render': function ( data, type, row, meta ) { if(data=='borrador') diff --git a/ci4/app/Views/themes/vuexy/form/tarifas/encuadernacion/viewTarifaEncuadernacionForm.php b/ci4/app/Views/themes/vuexy/form/tarifas/encuadernacion/viewTarifaEncuadernacionForm.php index 2be75a28..04ca3d8b 100644 --- a/ci4/app/Views/themes/vuexy/form/tarifas/encuadernacion/viewTarifaEncuadernacionForm.php +++ b/ci4/app/Views/themes/vuexy/form/tarifas/encuadernacion/viewTarifaEncuadernacionForm.php @@ -312,7 +312,8 @@ id = -1; {name: "id", "type": "readonly"}, { - name: "tiempo_min" + name: "tiempo_min", + }, { name: "tiempo_max" }, { @@ -512,7 +513,12 @@ id = -1; class :"autonumeric" } }, { - name: "precio_min" + name: "precio_min", + attr: { + type: "text", + name : "precio_min", + class :"autonumeric" + } }, { name: "paginas_libro_max", attr: { @@ -521,11 +527,26 @@ id = -1; class :"autonumeric" } }, { - name: "precio_max" + name: "precio_max", + attr: { + type: "text", + name : "precio_min", + class :"autonumeric" + } }, { - name: "total_min" + name: "total_min", + attr: { + type: "text", + name : "total_min", + class :"autonumeric" + } }, { - name: "margen" + name: "margen", + attr: { + type: "text", + name : "margen", + class :"autonumeric" + } }, { "name": "tirada_encuadernacion_id", "type": "hidden" @@ -552,7 +573,8 @@ id = -1; new AutoNumeric(this, { alwaysAllowDecimalCharacter: true, decimalCharacter: ",", -decimalPlaces : 0, + decimalPlaces : 2, + allowDecimalPadding : 'floats', digitGroupSeparator: ".", unformatOnSubmit : true, }); @@ -628,11 +650,11 @@ decimalPlaces : 0, }, }, { 'data': 'paginas_libro_min',render : (d) => `${d}` }, - { 'data': 'precio_max' }, + { 'data': 'precio_max',render : (d) => `${d}` }, { 'data': 'paginas_libro_max',render : (d) => `${d}` }, - { 'data': 'precio_min' }, - { 'data': 'total_min' }, - { 'data': 'margen' }, + { 'data': 'precio_min',render : (d) => `${d}` }, + { 'data': 'total_min',render : (d) => `${d}` }, + { 'data': 'margen' ,render : (d) => `${d}`}, { data: actionBtns, className: 'row-edit dt-center' @@ -702,14 +724,7 @@ decimalPlaces : 0, } ); } ); - theTable.on('draw',() => { - AutoNumeric.multiple("span.autonumeric", { - digitGroupSeparator: ".", - decimalCharacter: ",", -decimalPlaces : 0, - unformatOnSubmit: true - }); - }) + // Delete row function remove_lineas(dataId, row){ @@ -754,11 +769,26 @@ decimalPlaces : 0, name: "proveedor_id", "type": "select" }, { - name: "tirada_min" + name: "tirada_min", + attr: { + type: "text", + name : "tirada_min", + class :"autonumeric" + } }, { - name: "tirada_max" + name: "tirada_max", + attr: { + type: "text", + name : "tirada_max", + class :"autonumeric" + } }, { - name: "importe_fijo" + name: "importe_fijo", + attr: { + type: "text", + name : "importe_fijo", + class :"autonumeric" + } }, { "name": "tarifa_encuadernacion_id", "type": "hidden" @@ -780,7 +810,37 @@ decimalPlaces : 0, const suppliersList = ; editor2.field( 'proveedor_id' ).update( suppliersList ); + editor2.on('open', (event) => { + $("input.autonumeric").each(function () { + let autoNumericInstance = AutoNumeric.getAutoNumericElement(this) + if (autoNumericInstance) { + autoNumericInstance.remove() + } + new AutoNumeric(this, { + decimalCharacter: ",", + digitGroupSeparator: ".", + allowDecimalPadding : 'floats', + decimalPlaces: 2, + unformatOnSubmit: true, + }); + }) + }) + editor2.on('preSubmit', (e, d, type) => { + if (d.data) { + Object.keys(d.data).forEach(function (key) { + // Find all elements with class .autonumeric + $("input.autonumeric").each(function () { + let autoNumericInstance = AutoNumeric.getAutoNumericElement(this) + if (autoNumericInstance) { + // Get raw value and update the corresponding field + let rawValue = autoNumericInstance.getNumericString(); + d.data[key][this.name] = rawValue; // Ensure the correct name attribute is used + } + }); + }); + } + }) editor2.on( 'preSubmit', function ( e, d, type ) { if ( type === 'create'){ d.data[0]['tarifa_encuadernacion_id'] = id; @@ -838,9 +898,9 @@ decimalPlaces : 0, return value['label']; }, }, - { 'data': 'tirada_min' }, - { 'data': 'tirada_max' }, - { 'data': 'importe_fijo' }, + { 'data': 'tirada_min',render : (d) => `${d}` }, + { 'data': 'tirada_max',render : (d) => `${d}` }, + { 'data': 'importe_fijo',render : (d) => `${d}` }, { data: actionBtns, className: 'row-edit dt-center' diff --git a/ci4/app/Views/themes/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php b/ci4/app/Views/themes/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php index eebcfc00..49f41938 100644 --- a/ci4/app/Views/themes/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php +++ b/ci4/app/Views/themes/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php @@ -182,7 +182,12 @@ }, { name: "cp_final" }, { - name: "importe_fijo" + name: "importe_fijo", + attr: { + type: "text", + name : "importe_fijo", + class :"autonumeric" + } }, { "name": "tarifa_envio_id", "type": "hidden" @@ -195,7 +200,37 @@ }, ] } ); + editor.on('open', (event) => { + $("input.autonumeric").each(function () { + let autoNumericInstance = AutoNumeric.getAutoNumericElement(this) + if (autoNumericInstance) { + autoNumericInstance.remove() + } + new AutoNumeric(this, { + decimalCharacter: ",", + digitGroupSeparator: ".", + allowDecimalPadding : 'floats', + decimalPlaces: 2, + unformatOnSubmit: true, + }); + }) + }) + editor.on('preSubmit', (e, d, type) => { + if (d.data) { + Object.keys(d.data).forEach(function (key) { + // Find all elements with class .autonumeric + $("input.autonumeric").each(function () { + let autoNumericInstance = AutoNumeric.getAutoNumericElement(this) + if (autoNumericInstance) { + // Get raw value and update the corresponding field + let rawValue = autoNumericInstance.getNumericString(); + d.data[key][this.name] = rawValue; // Ensure the correct name attribute is used + } + }); + }); + } + }) editor.on( 'preSubmit', function ( e, d, type ) { if ( type === 'create'){ @@ -255,7 +290,7 @@ { 'data': 'nombre' }, { 'data': 'cp_inicial' }, { 'data': 'cp_final' }, - { 'data': 'importe_fijo' }, + { 'data': 'importe_fijo',render : (d) => `${d}` }, { data: actionBtns, className: 'row-edit dt-center' @@ -346,18 +381,48 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; name: "tipo_envio", "type": "select" }, { - name: "peso_min" + name: "peso_min", + attr: { + type: "text", + name : "peso_min", + class :"autonumeric" + } }, { - name: "peso_max" + name: "peso_max", + attr: { + type: "text", + name : "peso_max", + class :"autonumeric" + } }, { - name: "precio_min" + name: "precio_min", + attr: { + type: "text", + name : "precio_min", + class :"autonumeric" + } }, { - name: "precio_max" + name: "precio_max", + attr: { + type: "text", + name : "precio_max", + class :"autonumeric" + } }, { name: "precio_adicional", - def: 0 + def: 0, + attr: { + type: "text", + name : "precio_adicional", + class :"autonumeric" + } }, { - name: "margen" + name: "margen", + attr: { + type: "text", + name : "margen", + class :"autonumeric" + } }, { "name": "tarifa_envio_id", "type": "hidden" @@ -370,7 +435,37 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; }, ] } ); + editor2.on('open', (event) => { + $("input.autonumeric").each(function () { + let autoNumericInstance = AutoNumeric.getAutoNumericElement(this) + if (autoNumericInstance) { + autoNumericInstance.remove() + } + new AutoNumeric(this, { + decimalCharacter: ",", + digitGroupSeparator: ".", + allowDecimalPadding : 'floats', + decimalPlaces: 2, + unformatOnSubmit: true, + }); + }) + }) + editor2.on('preSubmit', (e, d, type) => { + if (d.data) { + Object.keys(d.data).forEach(function (key) { + // Find all elements with class .autonumeric + $("input.autonumeric").each(function () { + let autoNumericInstance = AutoNumeric.getAutoNumericElement(this) + if (autoNumericInstance) { + // Get raw value and update the corresponding field + let rawValue = autoNumericInstance.getNumericString(); + d.data[key][this.name] = rawValue; // Ensure the correct name attribute is used + } + }); + }); + } + }) // Generación de la lista de proveedores (id, nombre) const suppliersList = ; editor2.field( 'proveedor_id' ).update( suppliersList ); @@ -455,12 +550,12 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; return '= lang('TarifasEnviosPrecios.palets') ?>'; } }, - { 'data': 'peso_min' }, - { 'data': 'peso_max' }, - { 'data': 'precio_min' }, - { 'data': 'precio_max' }, - { 'data': 'precio_adicional' }, - { 'data': 'margen' }, + { 'data': 'peso_min',render : (d) => `${d}` }, + { 'data': 'peso_max',render : (d) => `${d}` }, + { 'data': 'precio_min',render : (d) => `${d}` }, + { 'data': 'precio_max',render : (d) => `${d}` }, + { 'data': 'precio_adicional',render : (d) => `${d}` }, + { 'data': 'margen',render : (d) => `${d}` }, { data: actionBtns, className: 'row-edit dt-center' diff --git a/ci4/app/Views/themes/vuexy/form/tarifas/extra/viewTarifaextraList.php b/ci4/app/Views/themes/vuexy/form/tarifas/extra/viewTarifaextraList.php index 97db3ec3..13b5d264 100644 --- a/ci4/app/Views/themes/vuexy/form/tarifas/extra/viewTarifaextraList.php +++ b/ci4/app/Views/themes/vuexy/form/tarifas/extra/viewTarifaextraList.php @@ -33,10 +33,15 @@ = esc($item->code) ?>