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 cec4fae0..55c514b4 100644 --- a/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelImpresionForm.php +++ b/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelImpresionForm.php @@ -503,39 +503,53 @@ }, { name: "negro", attr: { - type: "number" + type: "text", + name : "negro", + class :"autonumeric" } },{ name: "cyan", attr: { - type: "number" + type: "text", + name : "cyan", + class :"autonumeric" } },{ name: "magenta", attr: { - type: "number" + type: "text", + name : "magenta", + class :"autonumeric" } },{ name: "amarillo", attr: { - type: "number" + type: "text", + name : "amarillo", + class :"autonumeric" } },{ name: "cg", attr: { - type: "number" + type: "text", + name : "cg", + class :"autonumeric" }, def: 0, }, { name: "gota_negro", attr: { - type: "number" + type: "text", + name : "gota_negro", + class :"autonumeric" } },{ name: "gota_color", attr: { - type: "number" + type: "text", + name : "gota_color", + class :"autonumeric" } }, { "name": "papel_impresion_id", @@ -583,13 +597,13 @@ return ''; } }, - { 'data': 'negro' }, - { 'data': 'cyan' }, - { 'data': 'magenta' }, - { 'data': 'amarillo' }, - { 'data': 'cg' }, - { 'data': 'gota_negro' }, - { 'data': 'gota_color' }, + { 'data': 'negro',render : (d) => `${d}` }, + { 'data': 'cyan',render : (d) => `${d}` }, + { 'data': 'magenta',render : (d) => `${d}` }, + { 'data': 'amarillo',render : (d) => `${d}` }, + { 'data': 'cg',render : (d) => `${d}` }, + { 'data': 'gota_negro',render : (d) => `${d}` }, + { 'data': 'gota_color',render : (d) => `${d}` }, { data: actionBtns, className: 'row-edit dt-center'} ], @@ -614,7 +628,22 @@ } }); + 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, + }); + }) + }) // Notificar que no se pueden añadir más tipologías editor.on( 'initCreate', function () { @@ -642,6 +671,19 @@ // Obtención del id para editar editor.on( 'preSubmit', function ( 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 + } + }); + }); + } if ( type === 'create'){ d.data[0]['papel_impresion_id'] = id; }