mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
fix autonumeric datatable & editor datatable consumo tintas
This commit is contained in:
@ -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 '<?= lang('ImpresionTipologias.bicolor') ?>';
|
||||
}
|
||||
},
|
||||
{ 'data': 'negro' },
|
||||
{ 'data': 'cyan' },
|
||||
{ 'data': 'magenta' },
|
||||
{ 'data': 'amarillo' },
|
||||
{ 'data': 'cg' },
|
||||
{ 'data': 'gota_negro' },
|
||||
{ 'data': 'gota_color' },
|
||||
{ 'data': 'negro',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'cyan',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'magenta',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'amarillo',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'cg',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'gota_negro',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'gota_color',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ data: actionBtns,
|
||||
className: 'row-edit dt-center'}
|
||||
],
|
||||
@ -614,7 +628,22 @@
|
||||
<?php } ?>
|
||||
}
|
||||
});
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user