Miglioramento della gestione JS dei campi di input

Correzioni per inizializzazione dei campi dalla funzione input
This commit is contained in:
Dasc3er 2020-10-06 09:21:06 +02:00
parent 7e1c4d0b01
commit cfc8c5512b
10 changed files with 392 additions and 285 deletions

View File

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
function start_datepickers() {
var icons = {
function getCalendarIcons(){
return {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
up: 'fa fa-chevron-up',
@ -28,64 +28,79 @@ function start_datepickers() {
clear: 'fa fa-trash',
close: 'fa fa-times'
};
}
var date_format = dateFormatMoment(globals.date_format);
var timestamp_format = dateFormatMoment(globals.timestamp_format);
var time_format = dateFormatMoment(globals.time_format);
function initDateInput(input) {
let date_format = dateFormatMoment(globals.date_format);
let calendar_icons = getCalendarIcons();
$('.timestamp-picker').each(function () {
$this = $(this);
$this.datetimepicker({
format: timestamp_format,
locale: globals.locale,
icons: icons,
collapse: false,
sideBySide: true,
useCurrent: false,
stepping: 5,
widgetPositioning: {
horizontal: 'left',
vertical: 'auto'
},
minDate: moment($this.attr('min-date')).isValid() ? $this.attr('min-date') : false,
maxDate: moment($this.attr('max-date')).isValid() ? $this.attr('max-date') : false,
});
$(input).datetimepicker({
format: date_format,
locale: globals.locale,
icons: calendar_icons,
useCurrent: false,
minDate: moment($this.attr('min-date')).isValid() ? $this.attr('min-date') : false,
maxDate: moment($this.attr('max-date')).isValid() ? $this.attr('max-date') : false,
});
}
function initTimestampInput(input) {
let $this = $(input);
let timestamp_format = dateFormatMoment(globals.timestamp_format);
let calendar_icons = getCalendarIcons();
$this.datetimepicker({
format: timestamp_format,
locale: globals.locale,
icons: calendar_icons,
collapse: false,
sideBySide: true,
useCurrent: false,
stepping: 5,
widgetPositioning: {
horizontal: 'left',
vertical: 'auto'
},
minDate: moment($this.attr('min-date')).isValid() ? $this.attr('min-date') : false,
maxDate: moment($this.attr('max-date')).isValid() ? $this.attr('max-date') : false,
});
//fix per timestamp-picker non visibile con la classe table-responsive
// fix per timestamp-picker non visibile con la classe table-responsive
$this.on("dp.show", function (e) {
$('#tecnici > div').removeClass('table-responsive');
});
$this.on("dp.hide", function (e) {
$('#tecnici > div').addClass('table-responsive');
})
}
function initTimeInput(input) {
let time_format = dateFormatMoment(globals.time_format);
let calendar_icons = getCalendarIcons();
$(input).datetimepicker({
format: time_format,
locale: globals.locale,
icons: calendar_icons,
useCurrent: false,
stepping: 5,
minDate: moment($this.attr('min-date')).isValid() ? $this.attr('min-date') : false,
maxDate: moment($this.attr('max-date')).isValid() ? $this.attr('max-date') : false,
});
}
function start_datepickers() {
$('.timestamp-picker').each(function () {
$this = $(this);
$this.on("dp.show", function (e) {
$('#tecnici > div').removeClass('table-responsive');
});
$this.on("dp.hide", function (e) {
$('#tecnici > div').addClass('table-responsive');
})
initTimestampInput(this);
});
$('.datepicker').each(function () {
$this = $(this);
$this.datetimepicker({
format: date_format,
locale: globals.locale,
icons: icons,
useCurrent: false,
minDate: moment($this.attr('min-date')).isValid() ? $this.attr('min-date') : false,
maxDate: moment($this.attr('max-date')).isValid() ? $this.attr('max-date') : false,
});
initDateInput(this);
});
$('.timepicker').each(function () {
$this = $(this);
$this.datetimepicker({
format: time_format,
locale: globals.locale,
icons: icons,
useCurrent: false,
stepping: 5,
minDate: moment($this.attr('min-date')).isValid() ? $this.attr('min-date') : false,
maxDate: moment($this.attr('max-date')).isValid() ? $this.attr('max-date') : false,
});
initTimeInput(this);
});
}

View File

@ -515,7 +515,7 @@ function restart_inputs() {
start_superselect();
// Autosize per le textarea
autosize($('.autosize'));
initTextareaInput($('.autosize'));
}
/**
@ -552,7 +552,7 @@ function alertPush() {
}
/**
*
*
* @param button
* @param form
* @param data
@ -648,3 +648,7 @@ function hideTableColumn(table, column) {
}
}
}
function initTextareaInput(input){
autosize($(input));
}

View File

@ -17,29 +17,79 @@
*/
function input(name) {
return new Input(name);
}
let element;
function Input(name) {
// Selezione tramite jQuery
if (name instanceof jQuery) {
this.element = name.last();
element = name.last();
}
// Selezione tramite JS diretto
else if (isElement(name)) {
element = $(name);
}
// Selezione per nome
else {
this.element = $("[name='" + name + "']").last();
element = $("[name='" + name + "']").last();
// Fix per select multipli
if (this.element.length === 0) {
this.element = $("[name='" + name + "[]']").last();
if (element.length === 0) {
element = $("[name='" + name + "[]']").last();
}
}
if (!element.data("input-controller")) {
return new Input(element);
} else {
return element.data("input-controller");
}
}
/**
*
* @constructor
* @param {jQuery} element
*/
function Input(element) {
this.element = element;
// Controllo sulla gestione precedente
if (!this.element.data("input-set")) {
this.element.data("input-set", 1);
this.element.data("required", this.element.attr("required"));
return;
}
this.element.data("input-set", 1);
this.element.data("required", this.element.attr("required"));
// Operazioni di inizializzazione per input specifici
// Inizializzazione per date
if (this.element.hasClass('timestamp-picker')) {
initTimestampInput(this.element);
} else if (this.element.hasClass('datepicker')) {
initDateInput(this.element);
} else if (this.element.hasClass('timepicker')) {
initTimeInput(this.element);
}
// Inizializzazione per campi numerici
else if (this.element.hasClass('decimal-number')) {
initNumberInput(this.element);
}
// Inizializzazione per textarea
else if (this.element.hasClass('autosize')) {
initTextareaInput(this.element);
}
// Inizializzazione per select
else if (this.element.hasClass('superselect') || this.element.hasClass('superselectajax')) {
initSelectInput(this.element);
}
// Inizializzazione alternativa per maschere
else {
initMaskInput(this.element);
}
}
@ -111,24 +161,42 @@ Input.prototype.getData = function () {
};
}
/**
* Restituisce il valore corrente dell'input.
*
* @returns {string|number}
*/
Input.prototype.get = function () {
let value = this.element.val();
// Conversione del valore per le checkbox
let group = this.element.closest(".form-group");
if (group.find("input[type=checkbox]").length) {
value = parseInt(value) ? 1 : 0;
return parseInt(value) ? 1 : 0;
}
// Gestione dei valori numerici
const autonumeric = this.element.data("autonumeric");
if (autonumeric) {
value = parseFloat(autonumeric.rawValue);
if (this.element.hasClass("decimal-number")) {
const autonumeric = this.element.data("autonumeric");
if (autonumeric) {
return parseFloat(autonumeric.rawValue);
}
// In attesa dell'inizializzazione per autonumeric, il valore registrato è interpretabile
else {
return parseFloat(value);
}
}
return value;
}
/**
* Imposta il valore per l'input.
*
* @param value
* @returns {Input}
*/
Input.prototype.set = function (value) {
this.element.val(value).trigger("change");
@ -154,3 +222,33 @@ Input.prototype.on = function (event, action) {
Input.prototype.off = function (event) {
return this.element.off(event);
}
/**
* Returns true if it is a DOM node.
*
* @param o
* @returns boolean
*
* @source https://stackoverflow.com/a/384380
*/
function isNode(o) {
return (
typeof Node === "object" ? o instanceof Node :
o && typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName === "string"
);
}
/**
* Returns true if it is a DOM element.
*
* @param o
* @returns boolean
*
* @source https://stackoverflow.com/a/384380
*/
function isElement(o) {
return (
typeof HTMLElement === "object" ? o instanceof HTMLElement : // DOM2
o && typeof o === "object" && o.nodeType === 1 && typeof o.nodeName === "string"
);
}

View File

@ -16,82 +16,54 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// Inputmask
function initMaskInput(input) {
let $input = $(input);
if ($input.hasClass('bound')){
return;
}
$input.addClass('bound');
if ($input.hasClass('email-mask')){
$input.inputmask('Regex', {
regex: "^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^-]+(?:\\.[a-zA-Z0-9_!#$%&'*+/=?`{|}~^-]+)*@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$",
});
} else if ($input.hasClass('rea-mask')){
$input.inputmask({
mask: "AA-999999{1,15}",
casing: "upper",
});
} else if ($input.hasClass('provincia-mask')){
$input.inputmask({
mask: "AA",
casing: "upper",
});
} else if ($input.hasClass('alphanumeric-mask')){
$input.inputmask('Regex', {
regex: "[A-Za-z0-9#_|\/\\-.]*",
});
} else if ($input.hasClass('math-mask')){
$input.inputmask('Regex', {
regex: "[0-9,.+\-]*",
});
}
}
/**
* Inputmask
* @param element
*/
function start_inputmask(element) {
if (element == undefined) {
if (element === undefined) {
element = '';
} else {
element = element + ' ';
}
var date = dateFormatMoment(globals.date_format).toLowerCase();
let masks = ['math-mask','alphanumeric-mask', 'provincia-mask','rea-mask', 'email-mask'];
$(element + ".date-mask").not('.bound').inputmask(date, {
placeholder: date
}).addClass('bound');
$(element + '.email-mask').not('.bound').inputmask('Regex', {
regex: "^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^-]+(?:\\.[a-zA-Z0-9_!#$%&'*+/=?`{|}~^-]+)*@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$",
}).addClass('bound');
$(element + '.rea-mask').not('.bound').inputmask( {
mask: "AA-999999{1,15}",
casing: "upper",
}).addClass('bound');
$(element + '.provincia-mask').not('.bound').inputmask( {
mask: "AA",
casing: "upper",
}).addClass('bound');
$(element + '.alphanumeric-mask').not('.bound').inputmask('Regex', {
regex: "[A-Za-z0-9#_|\/\\-.]*",
}).addClass('bound');
$(element + '.math-mask').not('.bound').inputmask('Regex', {
regex: "[0-9,.+\-]*",
}).addClass('bound');
if (globals.is_mobile) {
$(element + '.inputmask-decimal, ' + element + '.date-mask, ' + element + '.timestamp-mask').each(function () {
$(this).attr('type', 'tel');
}).addClass('bound');
} else {
$(element + '.inputmask-decimal').not('.bound').each(function () {
var $this = $(this);
var min = $this.attr('min-value');
if (min == 'undefined') {
min = false;
}
var max = $this.attr('max-value');
if (max == 'undefined') {
max = false;
}
$this.inputmask("decimal", {
min: min ? min : undefined,
allowMinus: !min || min < 0 ? true : false,
max: max ? max : undefined,
allowPlus: !max || max < 0 ? true : false,
digits: $this.attr('decimals') ? $this.attr('decimals') : globals.cifre_decimali,
digitsOptional: true, // Necessario per un problema di inputmask con i numeri negativi durante l'init
enforceDigitsOnBlur: true,
rightAlign: true,
autoGroup: true,
radixPoint: globals.decimals,
groupSeparator: globals.thousands,
onUnMask: function (maskedValue, unmaskedValue) {
return maskedValue.toEnglish();
},
});
$this.on('keyup', function () {
if (min && $(this).val().toEnglish() < min) {
$(this).val(min);
}
});
}).addClass('bound');
}
let selector = element + '.' + masks.join(', ' + element + '.')
$(selector).each(function () {
initMaskInput(this);
});
}

View File

@ -23,37 +23,41 @@ function initNumbers() {
let inputs = $('.decimal-number').not('.bound');
for (const input of inputs) {
let $input = $(input);
initNumberInput(input);
if (AutoNumeric.isManagedByAutoNumeric(input)) {
continue;
}
let min = $input.attr('min-value') && $input.attr('min-value') !== "undefined" ? $input.attr('min-value') : null;
let max = $input.attr('max-value') && $input.attr('max-value') !== "undefined" ? $input.attr('max-value') : null;
let decimals = $input.attr('decimals') ? $input.attr('decimals') : globals.cifre_decimali;
let autonumeric = new AutoNumeric(input, {
caretPositionOnFocus: "decimalLeft",
allowDecimalPadding: true,
currencySymbolPlacement: "s",
negativePositiveSignPlacement: "p",
decimalCharacter: globals.decimals,
decimalCharacterAlternative: ".",
digitGroupSeparator: globals.thousands,
emptyInputBehavior: min ? min : "zero",
overrideMinMaxLimits: "ignore",
modifyValueOnWheel: false,
outputFormat: "string",
unformatOnSubmit: true,
watchExternalChanges: true,
minimumValue: min ? min : "-10000000000000",
maximumValue: max ? max : "10000000000000",
decimalPlaces: decimals,
});
$input.data("autonumeric", autonumeric)
.addClass('bound');
$(input).addClass('bound');
}
}
function initNumberInput(input){
let $input = $(input);
if (AutoNumeric.isManagedByAutoNumeric(input)) {
return;
}
let min = $input.attr('min-value') && $input.attr('min-value') !== "undefined" ? $input.attr('min-value') : null;
let max = $input.attr('max-value') && $input.attr('max-value') !== "undefined" ? $input.attr('max-value') : null;
let decimals = $input.attr('decimals') ? $input.attr('decimals') : globals.cifre_decimali;
let autonumeric = new AutoNumeric(input, {
caretPositionOnFocus: "decimalLeft",
allowDecimalPadding: true,
currencySymbolPlacement: "s",
negativePositiveSignPlacement: "p",
decimalCharacter: globals.decimals,
decimalCharacterAlternative: ".",
digitGroupSeparator: globals.thousands,
emptyInputBehavior: min ? min : "zero",
overrideMinMaxLimits: "ignore",
modifyValueOnWheel: false,
outputFormat: "string",
unformatOnSubmit: true,
watchExternalChanges: true,
minimumValue: min ? min : "-10000000000000",
maximumValue: max ? max : "10000000000000",
decimalPlaces: decimals,
});
$input.data("autonumeric", autonumeric);
}

View File

@ -16,87 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// Select
/**
* Select.
*/
function start_superselect() {
// Statico
$('.superselect').each(function () {
let $this = $(this);
$(this).select2({
theme: "bootstrap",
language: "it",
width: '100%',
maximumSelectionLength: $this.data('maximum') ? $this.data('maximum') : -1,
minimumResultsForSearch: $this.hasClass('no-search') ? -1 : 0,
allowClear: !$this.hasClass('no-search'),
escapeMarkup: function (text) {
return text;
},
templateResult: selectBackground,
});
});
// Dinamico (AJAX, per tabelle con molti record)
$('.superselectajax').each(function () {
let $this = $(this);
$(this).select2({
theme: "bootstrap",
language: "it",
maximumSelectionLength: $this.data('maximum') ? $this.data('maximum') : -1,
minimumInputLength: $this.data('heavy') ? 3 : 0,
allowClear: true,
escapeMarkup: function (text) {
return text;
},
templateResult: selectBackground,
ajax: {
url: globals.rootdir + "/ajax_select.php?op=" + $this.data('source'),
dataType: 'json',
delay: 250,
data: function (params) {
return {
search: params.term,
page: params.page || 0,
length: params.length || 100,
options: this.data('select-options'), // Dati aggiuntivi
};
},
processResults: function (data, params) {
params.page = params.page || 0;
params.length = params.length || 100;
let results = data.results;
// Interpretazione forzata per campi optgroup
if (results && results[0] && [0]['optgroup']) {
let groups = results.reduce(function (r, a) {
r[a.optgroup] = r[a.optgroup] || [];
r[a.optgroup].push(a);
return r;
}, {});
let results_groups = [];
for (const key in groups) {
results_groups.push({
text: key,
children: groups[key],
});
}
results = results_groups;
}
return {
results: results,
pagination: {
more: (params.page + 1) * params.length < data.recordsFiltered,
}
};
},
cache: false
},
width: '100%'
});
$('.superselect, .superselectajax').each(function () {
initSelectInput(this);
});
}
@ -242,3 +167,99 @@ function updateSelectOption(name, value) {
$(this).setSelectOption(name, value);
})
}
function initSelectInput(input){
if ($(input).hasClass('superselect')){
initStaticSelectInput(input);
} else {
initDynamicSelectInput(input);
}
}
/**
* Statico.
* @param input
*/
function initStaticSelectInput(input){
let $input = $(input);
$input.select2({
theme: "bootstrap",
language: "it",
width: '100%',
maximumSelectionLength: $input.data('maximum') ? $input.data('maximum') : -1,
minimumResultsForSearch: $input.hasClass('no-search') ? -1 : 0,
allowClear: !$input.hasClass('no-search'),
escapeMarkup: function (text) {
return text;
},
templateResult: selectBackground,
});
}
/**
* Dinamico.
* @param input
*/
function initDynamicSelectInput(input){
let $input = $(input);
$input.select2({
theme: "bootstrap",
language: "it",
maximumSelectionLength: $input.data('maximum') ? $input.data('maximum') : -1,
minimumInputLength: $input.data('heavy') ? 3 : 0,
allowClear: true,
escapeMarkup: function (text) {
return text;
},
templateResult: selectBackground,
ajax: {
url: globals.rootdir + "/ajax_select.php?op=" + $input.data('source'),
dataType: 'json',
delay: 250,
data: function (params) {
return {
search: params.term,
page: params.page || 0,
length: params.length || 100,
options: this.data('select-options'), // Dati aggiuntivi
};
},
processResults: function (data, params) {
params.page = params.page || 0;
params.length = params.length || 100;
let results = data.results;
// Interpretazione forzata per campi optgroup
if (results && results[0] && [0]['optgroup']) {
let groups = results.reduce(function (r, a) {
r[a.optgroup] = r[a.optgroup] || [];
r[a.optgroup].push(a);
return r;
}, {});
let results_groups = [];
for (const key in groups) {
results_groups.push({
text: key,
children: groups[key],
});
}
results = results_groups;
}
return {
results: results,
pagination: {
more: (params.page + 1) * params.length < data.recordsFiltered,
}
};
},
cache: false
},
width: '100%'
});
}

View File

@ -171,7 +171,7 @@ echo '
echo '
<script>
var formatted_zero = "'.Translator::numberToLocale(0).'";
var formatted_zero = "'.numberFormat(0).'";
var n = '.$counter.';
function addRiga(btn) {
@ -196,25 +196,25 @@ function addRiga(btn) {
* @returns {boolean}
*/
function controllaConti() {
var continuare = true;
let continuare = true;
// Controlli sullo stato dei raggruppamenti
$(".raggruppamento_primanota").each(function() {
var bilancio = calcolaBilancio(this);
let bilancio = calcolaBilancio(this);
continuare &= bilancio == 0;
continuare &= bilancio === 0;
});
// Blocco degli input con valore non impostato
$("input[id*=dare], input[id*=avere]").each(function() {
var conto_relativo = $(this).parent().parent().find("select").val();
let conto_relativo = $(this).parent().parent().find("select").val();
if (!conto_relativo) {
$(this).prop("disabled", true);
}
if ($(this).val().toEnglish()){
continuare &= conto_relativo ? true : false;
continuare &= !!conto_relativo;
}
});
@ -237,38 +237,37 @@ function controllaConti() {
* @returns {number}
*/
function calcolaBilancio(gruppo) {
var raggruppamento = $(gruppo);
let raggruppamento = $(gruppo);
var totale_dare = 0.00;
var totale_avere = 0.00;
let totale_dare = 0.00;
let totale_avere = 0.00;
// Calcolo il totale dare
raggruppamento.find("input[id*=dare]").each(function() {
valore = $(this).val() ? $(this).val().toEnglish() : 0;
totale_dare += valore;
totale_dare += input(this).get();
});
// Calcolo il totale avere
raggruppamento.find("input[id*=avere]").each(function() {
valore = $(this).val() ? $(this).val().toEnglish() : 0;
totale_avere += valore;
totale_avere += input(this).get();
});
totale_dare = parseFloat(totale_dare);
totale_avere = parseFloat(totale_avere);
// Visualizzazione dei totali
raggruppamento.find(".totale_dare").text(totale_dare.toLocale());
raggruppamento.find(".totale_avere").text(totale_avere.toLocale());
// Calcolo il bilancio
var bilancio = totale_dare.toFixed(2) - totale_avere.toFixed(2);
let bilancio = totale_dare.toFixed(2) - totale_avere.toFixed(2);
// Visualizzazione dello sbilancio eventuale
var sbilancio = raggruppamento.find(".sbilancio");
var valore_sbilancio = sbilancio.find(".money");
let sbilancio = raggruppamento.find(".sbilancio");
let valore_sbilancio = sbilancio.find(".money");
valore_sbilancio.text(bilancio.toLocale());
if (bilancio == 0) {
if (bilancio === 0) {
sbilancio.addClass("hide");
} else {
sbilancio.removeClass("hide");
@ -282,7 +281,7 @@ $(document).ready(function() {
// Fix per l\'inizializzazione degli input
$("input[id*=dare], input[id*=avere]").each(function() {
if ($(this).val() == formatted_zero) {
if (input(this).get() === 0) {
$(this).prop("disabled", true);
} else {
$(this).prop("disabled", false);
@ -298,30 +297,30 @@ $(document).ready(function() {
});
$(document).on("change", "select", function() {
var row = $(this).parent().parent();
let row = $(this).parent().parent();
if ($(this).parent().parent().find("input[disabled]").length != 1) {
row.find("input").prop("disabled", $(this).val() ? false : true);
if (row.find("input[disabled]").length > 1) {
row.find("input").prop("disabled", !$(this).val());
}
controllaConti();
});
$(document).on("keyup change", "input[id*=dare]", function() {
var row = $(this).parent().parent();
let row = $(this).parent().parent();
if (!$(this).prop("disabled")) {
row.find("input[id*=avere]").prop("disabled", $(this).val() ? true : false);
row.find("input[id*=avere]").prop("disabled", !!$(this).val());
controllaConti();
}
});
$(document).on("keyup change", "input[id*=avere]", function() {
var row = $(this).parent().parent();
let row = $(this).parent().parent();
if (!$(this).prop("disabled")) {
row.find("input[id*=dare]").prop("disabled", $(this).val() ? true : false);
row.find("input[id*=dare]").prop("disabled", !!$(this).val());
controllaConti();
}

View File

@ -31,7 +31,6 @@ include_once __DIR__.'/../../core.php';
{[ "type": "select", "label": "<?php echo tr('Tipo'); ?>", "name": "tipo", "required": 1, "ajax-source": "tipi_scadenze", "icon-after": "add|<?php echo Modules::get('Tipi scadenze')['id']; ?>" ]}
</div>
<div class="col-md-4">
{[ "type": "date", "label": "<?php echo tr('Data scadenza'); ?>", "name": "data", "required": 1, "value": "-now-" ]}
</div>
@ -52,5 +51,4 @@ include_once __DIR__.'/../../core.php';
</div>
<div class='clearfix'></div>
</form>

View File

@ -137,11 +137,11 @@ foreach ($scadenze as $i => $scadenza) {
</td>
<td class="text-right">
{[ "type": "number", "name": "da_pagare['.$i.']", "decimals": 2, "value": "'.Translator::numberToLocale($scadenza['da_pagare'], 2).'", "onchange": "controlloTotale()" ]}
{[ "type": "number", "name": "da_pagare['.$i.']", "decimals": 2, "value": "'.numberFormat($scadenza['da_pagare'], 2).'", "onchange": "controlloTotale()" ]}
</td>
<td class="text-right">
{[ "type": "number", "name": "pagato['.$i.']", "decimals": 2, "value": "'.Translator::numberToLocale($scadenza['pagato']).'" ]}
{[ "type": "number", "name": "pagato['.$i.']", "decimals": 2, "value": "'.numberFormat($scadenza['pagato']).'" ]}
</td>
<td align="center">
@ -155,7 +155,7 @@ echo '
<tfoot>
<tr>
<td class="text-right"><b>'.tr('Totale').'</b></td>
<td class="text-right" id="totale_utente">'.Translator::numberToLocale($totale_da_pagare).'</td>
<td class="text-right" id="totale_utente">'.numberFormat($totale_da_pagare).'</td>
<td class="text-right"></td>
</tr>
</tfoot>';
@ -179,7 +179,7 @@ echo '
]); ?>.
</div>
<input type="hidden" id="totale_da_pagare" value="<?php echo Translator::numberToLocale($totale_da_pagare, 2); ?>">
<input type="hidden" id="totale_da_pagare" value="<?php echo numberFormat($totale_da_pagare, 2); ?>">
</div>
</div>
</div>
@ -253,13 +253,11 @@ if (!empty($documento)) {
});
function controlloTotale() {
totale_da_pagare = $("#totale_da_pagare").val().toEnglish();
totale_da_pagare = input("totale_da_pagare").get();
totale_utente = 0;
$("input[name*=da_pagare]").each(function() {
totale_utente += $(this).val().toEnglish();
totale_utente += input(this).get();
});
if (isNaN(totale_utente)) {

View File

@ -112,7 +112,6 @@ class DateHandler implements HandlerInterface
{
$values['class'][] = 'text-center';
$values['class'][] = 'timestamp-picker';
$values['class'][] = 'timestamp-mask';
}
/**
@ -128,7 +127,6 @@ class DateHandler implements HandlerInterface
{
$values['class'][] = 'text-center';
$values['class'][] = 'datepicker';
$values['class'][] = 'date-mask';
}
/**