Merge branch 'fix/cambio_cubierta_guardar_valores' of https://git.imnavajas.es/jjimenez/safekat into fix/cambio_cubierta_guardar_valores

This commit is contained in:
2025-02-09 13:31:22 +01:00
36 changed files with 766 additions and 183 deletions

View File

@ -1,5 +1,4 @@
export function getToken()
{
export function getToken() {
const scriptUrl = new URL(import.meta.url);
const params = new URLSearchParams(scriptUrl.search);
@ -10,3 +9,67 @@ export function getToken()
export function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
export const initAutonumeric = () => {
$(document).on('draw.dt', (event) => {
$("span.autonumeric").each(function () {
let autoNumericInstance = AutoNumeric.getAutoNumericElement(this)
if (!autoNumericInstance) {
new AutoNumeric(this, {
digitGroupSeparator: ".",
decimalCharacter: ",",
allowDecimalPadding : 'floats',
decimalPlaces: 2,
unformatOnSubmit: true,
});
}
})
// $(':input[type="number"]').each(function(){
// $(this).attr('type','text')
// let autoNumericInstance = AutoNumeric.getAutoNumericElement(this)
// if (!autoNumericInstance) {
// new AutoNumeric(this, {
// digitGroupSeparator: ".",
// decimalCharacter: ",",
// allowDecimalPadding : 'floats',
// decimalPlaces: 2,
// unformatOnSubmit: true,
// });
// }
// })
})
// 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
// }
// });
// });
// }
// })
}

View File

@ -14,7 +14,7 @@ class OrdenTrabajoDatatable {
{ data: 'cliente_nombre', searchable: false, sortable: false },
{ data: 'presupuesto_titulo', searchable: false, sortable: false },
{ data: 'ubicacion_nombre', searchable: false, sortable: false },
{ data: 'total_tirada', searchable: false, sortable: false },
{ data: 'total_tirada', searchable: false, sortable: false ,render : (d) => `<span class="autonumeric">${d}</span>`},
{ data: 'tipo_presupuesto_impresion', searchable: false, sortable: false },
{
data: 'logo', searchable: false, sortable: false, render: (d, t) => {

View File

@ -0,0 +1,4 @@
import { initAutonumeric } from "../common/common.js";
initAutonumeric()

View File

@ -91,10 +91,10 @@ class MaquinasList {
{ 'data': 'id' },
{ 'data': 'nombre' },
{ 'data': 'tipo' },
{ 'data': 'ancho_impresion' },
{ 'data': 'alto_impresion' },
{ 'data': 'min' },
{ 'data': 'max' }
{ 'data': 'ancho_impresion',render : (d) => `<span class="autonumeric">${d}</span>` },
{ 'data': 'alto_impresion',render : (d) => `<span class="autonumeric">${d}</span>` },
{ 'data': 'min',render : (d) => `<span class="autonumeric">${d}</span>` },
{ 'data': 'max',render : (d) => `<span class="autonumeric">${d}</span>` }
];
const actions = ['edit', 'delete'];

File diff suppressed because one or more lines are too long