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",
|
name: "negro",
|
||||||
attr: {
|
attr: {
|
||||||
type: "number"
|
type: "text",
|
||||||
|
name : "negro",
|
||||||
|
class :"autonumeric"
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
name: "cyan",
|
name: "cyan",
|
||||||
attr: {
|
attr: {
|
||||||
type: "number"
|
type: "text",
|
||||||
|
name : "cyan",
|
||||||
|
class :"autonumeric"
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
name: "magenta",
|
name: "magenta",
|
||||||
attr: {
|
attr: {
|
||||||
type: "number"
|
type: "text",
|
||||||
|
name : "magenta",
|
||||||
|
class :"autonumeric"
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
name: "amarillo",
|
name: "amarillo",
|
||||||
attr: {
|
attr: {
|
||||||
type: "number"
|
type: "text",
|
||||||
|
name : "amarillo",
|
||||||
|
class :"autonumeric"
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
name: "cg",
|
name: "cg",
|
||||||
attr: {
|
attr: {
|
||||||
type: "number"
|
type: "text",
|
||||||
|
name : "cg",
|
||||||
|
class :"autonumeric"
|
||||||
},
|
},
|
||||||
def: 0,
|
def: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "gota_negro",
|
name: "gota_negro",
|
||||||
attr: {
|
attr: {
|
||||||
type: "number"
|
type: "text",
|
||||||
|
name : "gota_negro",
|
||||||
|
class :"autonumeric"
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
name: "gota_color",
|
name: "gota_color",
|
||||||
attr: {
|
attr: {
|
||||||
type: "number"
|
type: "text",
|
||||||
|
name : "gota_color",
|
||||||
|
class :"autonumeric"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"name": "papel_impresion_id",
|
"name": "papel_impresion_id",
|
||||||
@ -583,13 +597,13 @@
|
|||||||
return '<?= lang('ImpresionTipologias.bicolor') ?>';
|
return '<?= lang('ImpresionTipologias.bicolor') ?>';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ 'data': 'negro' },
|
{ 'data': 'negro',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||||
{ 'data': 'cyan' },
|
{ 'data': 'cyan',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||||
{ 'data': 'magenta' },
|
{ 'data': 'magenta',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||||
{ 'data': 'amarillo' },
|
{ 'data': 'amarillo',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||||
{ 'data': 'cg' },
|
{ 'data': 'cg',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||||
{ 'data': 'gota_negro' },
|
{ 'data': 'gota_negro',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||||
{ 'data': 'gota_color' },
|
{ 'data': 'gota_color',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||||
{ data: actionBtns,
|
{ data: actionBtns,
|
||||||
className: 'row-edit dt-center'}
|
className: 'row-edit dt-center'}
|
||||||
],
|
],
|
||||||
@ -614,7 +628,22 @@
|
|||||||
<?php } ?>
|
<?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
|
// Notificar que no se pueden añadir más tipologías
|
||||||
editor.on( 'initCreate', function () {
|
editor.on( 'initCreate', function () {
|
||||||
@ -642,6 +671,19 @@
|
|||||||
|
|
||||||
// Obtención del id para editar
|
// Obtención del id para editar
|
||||||
editor.on( 'preSubmit', function ( e, d, type ) {
|
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'){
|
if ( type === 'create'){
|
||||||
d.data[0]['papel_impresion_id'] = id;
|
d.data[0]['papel_impresion_id'] = id;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user