mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
autonumeric format in tableOfTarifaencuadernacionlineasHoras
This commit is contained in:
@ -313,15 +313,39 @@ id = -1;
|
||||
"type": "readonly"},
|
||||
{
|
||||
name: "tiempo_min",
|
||||
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "tiempo_min",
|
||||
class :"autonumeric"
|
||||
}
|
||||
}, {
|
||||
name: "tiempo_max"
|
||||
name: "tiempo_max",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "tiempo_max",
|
||||
class :"autonumeric"
|
||||
}
|
||||
}, {
|
||||
name: "precio_hora"
|
||||
name: "precio_hora",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "precio_hora",
|
||||
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"
|
||||
@ -334,7 +358,37 @@ id = -1;
|
||||
},
|
||||
]
|
||||
} );
|
||||
editor3.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,
|
||||
});
|
||||
})
|
||||
})
|
||||
editor3.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
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
editor3.on( 'preSubmit', function ( e, d, type ) {
|
||||
if ( type === 'create'){
|
||||
d.data[0]['tirada_encuadernacion_id'] = selected_tirada_id;
|
||||
@ -385,11 +439,11 @@ id = -1;
|
||||
}),
|
||||
columns: [
|
||||
{ 'data': 'id' },
|
||||
{ 'data': 'tiempo_min' },
|
||||
{ 'data': 'tiempo_max' },
|
||||
{ 'data': 'precio_hora' },
|
||||
{ 'data': 'total_min' },
|
||||
{ 'data': 'margen' },
|
||||
{ 'data': 'tiempo_min',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'tiempo_max',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'precio_hora',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'total_min',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'margen',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{
|
||||
data: actionBtns,
|
||||
className: 'row-edit dt-center'
|
||||
|
||||
Reference in New Issue
Block a user