ref(js): utilise parseInt plutôt que Number

pull/54/head
François Poulain 2022-02-18 14:37:55 +01:00
parent 3951926a92
commit 407894c8f7
3 changed files with 4 additions and 4 deletions

View File

@ -113,11 +113,11 @@ jquery__WEBPACK_IMPORTED_MODULE_0___default()(function () {
var error = wrapper.parent().find('.invalid-feedback:contains(mandats disponibles)');
var inputs = wrapper.find('input');
jquery__WEBPACK_IMPORTED_MODULE_0___default()(inputs).on('change', function () {
var availableInt = Number(available[0].textContent);
var availableInt = parseInt(available[0].textContent, 10);
var affected = inputs.map(function (idx, elem) {
return elem.value;
}).get().reduce(function (pv, cv) {
return pv + (Number(cv) || 0);
return pv + (parseInt(cv, 10) || 0);
}, 0);
if (availableInt - affected >= 0) {

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,7 @@
/*!*********************************!*\
!*** ./assets/js/ponderated.js ***!
\*********************************/
/*! no exports provided */function(e,t,n){"use strict";n.r(t);var r=n(/*! jquery */"./node_modules/jquery/dist/jquery.js"),i=n.n(r);window.jQuery=window.$=i.a,i()((function(){i()(".ponderatedwidget").each((function(e,t){var n=i()(t),r=n.find(".ponderatedwidget--remaining"),o=n.find(".ponderatedwidget--available"),a=n.find(".ponderatedwidget--warning"),s=n.parent().find(".invalid-feedback:contains(mandats disponibles)"),u=n.find("input");i()(u).on("change",(function(){var e=Number(o[0].textContent),t=u.map((function(e,t){return t.value})).get().reduce((function(e,t){return e+(Number(t)||0)}),0);e-t>=0?(r[0].textContent=e-t,i()(s).addClass("d-none"),i()(a).addClass("d-none")):(i()(s).removeClass("d-none"),i()(a).removeClass("d-none"))}))}))}))},"./node_modules/jquery/dist/jquery.js":
/*! no exports provided */function(e,t,n){"use strict";n.r(t);var r=n(/*! jquery */"./node_modules/jquery/dist/jquery.js"),i=n.n(r);window.jQuery=window.$=i.a,i()((function(){i()(".ponderatedwidget").each((function(e,t){var n=i()(t),r=n.find(".ponderatedwidget--remaining"),o=n.find(".ponderatedwidget--available"),a=n.find(".ponderatedwidget--warning"),s=n.parent().find(".invalid-feedback:contains(mandats disponibles)"),u=n.find("input");i()(u).on("change",(function(){var e=parseInt(o[0].textContent,10),t=u.map((function(e,t){return t.value})).get().reduce((function(e,t){return e+(parseInt(t,10)||0)}),0);e-t>=0?(r[0].textContent=e-t,i()(s).addClass("d-none"),i()(a).addClass("d-none")):(i()(s).removeClass("d-none"),i()(a).removeClass("d-none"))}))}))}))},"./node_modules/jquery/dist/jquery.js":
/*!********************************************!*\
!*** ./node_modules/jquery/dist/jquery.js ***!
\********************************************/