Fix query listini

Migliorate logiche charcounter
This commit is contained in:
Luca 2021-03-27 14:17:32 +01:00
parent 88be00875b
commit ced647be7c
6 changed files with 40 additions and 18 deletions

View File

@ -108,8 +108,8 @@ Input.prototype.init = function () {
if (this.element.hasClass('autosize')) if (this.element.hasClass('autosize'))
initCompleted = initTextareaInput(htmlElement); initCompleted = initTextareaInput(htmlElement);
if (htmlElement.hasAttribute('maxlength')) if (htmlElement.hasAttribute('charcounter'))
initCompleted = initCharsCounter(htmlElement); initCompleted = initCharCounter(htmlElement);
} }

View File

@ -26,20 +26,42 @@ function initTextareaInput(input) {
return true; return true;
} }
function initCharsCounter(input) { function initCharCounter(input) {
let $input = $(input); let $input = $(input);
$input.maxlength({ if (input.hasAttribute('maxlength')){
warningClass: "label label-info",
limitReachedClass: "label label-warning", $input.maxlength({
preText: 'usati ', warningClass: "label label-default",
separator: ' di ', limitReachedClass: "label label-warning",
postText: ' caratteri.', preText: '',
showMaxLength: false, separator: ' / ',
placement: 'bottom-right-inside', postText: '',
utf8: true, showMaxLength: true,
appendToParent: 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; return true;
} }

View File

@ -672,7 +672,7 @@ if ($is_cliente or $is_fornitore or $is_tecnico) {
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{[ "type": "textarea", "label": "<?php echo tr('Note'); ?>", "name": "note", "value": "$note$", "maxlength": 255 ]} {[ "type": "textarea", "label": "<?php echo tr('Note'); ?>", "name": "note", "value": "$note$", "maxlength": 255, "charcounter": 1 ]}
</div> </div>
</div> </div>

View File

@ -63,7 +63,7 @@ include_once __DIR__.'/../../core.php';
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{[ "type": "textarea", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "required": 1, "value": "$descrizione$" ]} {[ "type": "textarea", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "required": 1, "value": "$descrizione$", "charcounter": 1 ]}
</div> </div>
</div> </div>

View File

@ -8,7 +8,7 @@
"bootstrap": "^3.3.7", "bootstrap": "^3.3.7",
"bootstrap-colorpicker": "2.5.1", "bootstrap-colorpicker": "2.5.1",
"bootstrap-daterangepicker": "^2.1.25", "bootstrap-daterangepicker": "^2.1.25",
"bootstrap-maxlength": "1.10.0", "bootstrap-maxlength": "^1.10.0",
"chart.js": "^2.7.0", "chart.js": "^2.7.0",
"ckeditor4-dev": "^4.14.1", "ckeditor4-dev": "^4.14.1",
"components-jqueryui": "^1.12.1", "components-jqueryui": "^1.12.1",

View File

@ -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') (NULL, 'app-v1', 'retrieve', 'revisione', 'API\\App\\v1\\Revisione', '1')
-- Fix query listini -- 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 -- Cambiato title al plugin prezzi specifici
UPDATE `zz_plugins` SET `title` = 'Prezzi di listino' WHERE `zz_plugins`.`name` = 'Prezzi specifici articolo'; UPDATE `zz_plugins` SET `title` = 'Prezzi di listino' WHERE `zz_plugins`.`name` = 'Prezzi specifici articolo';