diff --git a/assets/src/js/functions/input.js b/assets/src/js/functions/input.js index 081c30e8c..c50831a97 100644 --- a/assets/src/js/functions/input.js +++ b/assets/src/js/functions/input.js @@ -108,8 +108,8 @@ Input.prototype.init = function () { if (this.element.hasClass('autosize')) initCompleted = initTextareaInput(htmlElement); - if (htmlElement.hasAttribute('maxlength')) - initCompleted = initCharsCounter(htmlElement); + if (htmlElement.hasAttribute('charcounter')) + initCompleted = initCharCounter(htmlElement); } diff --git a/assets/src/js/functions/textarea.js b/assets/src/js/functions/textarea.js index bba5c5438..f9dedf485 100644 --- a/assets/src/js/functions/textarea.js +++ b/assets/src/js/functions/textarea.js @@ -26,20 +26,42 @@ function initTextareaInput(input) { return true; } -function initCharsCounter(input) { +function initCharCounter(input) { let $input = $(input); - $input.maxlength({ - warningClass: "label label-info", - limitReachedClass: "label label-warning", - preText: 'usati ', - separator: ' di ', - postText: ' caratteri.', - showMaxLength: false, - placement: 'bottom-right-inside', - utf8: true, - appendToParent: true - }); + if (input.hasAttribute('maxlength')){ + + $input.maxlength({ + warningClass: "label label-default", + limitReachedClass: "label label-warning", + preText: '', + separator: ' / ', + postText: '', + showMaxLength: true, + alwaysShow: false, + placement: 'bottom-right-inside', + utf8: true, + appendToParent: true, + threshold: 150 + }); + + }else{ + + $input.attr('maxlength','65535'); + + $input.maxlength({ + warningClass: "label label-default", + limitReachedClass: "label label-warning", + showMaxLength: false, + alwaysShow: false, + placement: 'bottom-right-inside', + utf8: true, + appendToParent: true, + threshold: 150 + }); + + } + return true; } diff --git a/modules/anagrafiche/edit.php b/modules/anagrafiche/edit.php index b47a87fb5..98a73e47e 100755 --- a/modules/anagrafiche/edit.php +++ b/modules/anagrafiche/edit.php @@ -672,7 +672,7 @@ if ($is_cliente or $is_fornitore or $is_tecnico) {
- {[ "type": "textarea", "label": "", "name": "note", "value": "$note$", "maxlength": 255 ]} + {[ "type": "textarea", "label": "", "name": "note", "value": "$note$", "maxlength": 255, "charcounter": 1 ]}
diff --git a/modules/articoli/edit.php b/modules/articoli/edit.php index 4eb76eddb..09812a324 100755 --- a/modules/articoli/edit.php +++ b/modules/articoli/edit.php @@ -63,7 +63,7 @@ include_once __DIR__.'/../../core.php';
- {[ "type": "textarea", "label": "", "name": "descrizione", "required": 1, "value": "$descrizione$" ]} + {[ "type": "textarea", "label": "", "name": "descrizione", "required": 1, "value": "$descrizione$", "charcounter": 1 ]}
diff --git a/package.json b/package.json index a7a5d090d..77b7733a4 100755 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "bootstrap": "^3.3.7", "bootstrap-colorpicker": "2.5.1", "bootstrap-daterangepicker": "^2.1.25", - "bootstrap-maxlength": "1.10.0", + "bootstrap-maxlength": "^1.10.0", "chart.js": "^2.7.0", "ckeditor4-dev": "^4.14.1", "components-jqueryui": "^1.12.1", diff --git a/update/2_4_23.sql b/update/2_4_23.sql index 875e1166e..5049086d2 100644 --- a/update/2_4_23.sql +++ b/update/2_4_23.sql @@ -63,7 +63,7 @@ INSERT INTO `zz_api_resources` (`id`, `version`, `type`, `resource`, `class`, `e (NULL, 'app-v1', 'retrieve', 'revisione', 'API\\App\\v1\\Revisione', '1') -- Fix query listini -UPDATE `zz_modules` SET `options` = 'SELECT |select| FROM mg_prezzi_articoli\n INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica = mg_prezzi_articoli.id_anagrafica\n INNER JOIN mg_articoli ON mg_articoli.id = mg_prezzi_articoli.id_articolo\n LEFT JOIN mg_categorie AS categoria ON mg_articoli.id_categoria=categoria.id\n LEFT JOIN mg_categorie AS sottocategoria ON mg_articoli.id_sottocategoria=sottocategoria.id\nWHERE 1=1 AND mg_articoli.deleted_at IS NULL AND an_anagrafiche.deleted_at IS NULL\nHAVING 2=2\nORDER BY an_anagrafiche.ragione_sociale' WHERE `zz_modules`.`name` = 'Listini'; +UPDATE `zz_modules` SET `options` = 'SELECT |select| FROM mg_prezzi_articoli INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica = mg_prezzi_articoli.id_anagrafica INNER JOIN mg_articoli ON mg_articoli.id = mg_prezzi_articoli.id_articolo LEFT JOIN mg_categorie AS categoria ON mg_articoli.id_categoria=categoria.id LEFT JOIN mg_categorie AS sottocategoria ON mg_articoli.id_sottocategoria=sottocategoria.id WHERE 1=1 AND mg_articoli.deleted_at IS NULL AND an_anagrafiche.deleted_at IS NULL HAVING 2=2 ORDER BY an_anagrafiche.ragione_sociale' WHERE `zz_modules`.`name` = 'Listini'; -- Cambiato title al plugin prezzi specifici UPDATE `zz_plugins` SET `title` = 'Prezzi di listino' WHERE `zz_plugins`.`name` = 'Prezzi specifici articolo';