mostra condizione di default AND solo quando necessario

This commit is contained in:
Luca Trupiano 2023-01-09 16:58:22 +01:00
parent 56462d56a6
commit 606b8aabea
2 changed files with 18 additions and 8 deletions

View File

@ -1073,14 +1073,13 @@
<div id="cla-Advanced" style="display: d-flex">
<div class=" p-1 border bg-light well" id="cla-list">
<div class="row mx-0 justify-content-between">
<div class="col-12 px-0 pb-1 small font-weight-bold text-muted">AND</div>
<div id="cla-list-row" class="row mx-0 justify-content-between">
<div class="col-12 p-0">
<ul id="sortable0" class="condLIand list-group ui-sortable">
<li id="li-cla0"
class="list-group-item align-items-center mb-1 ui-state-default ui-state-disabled border text-muted bg-white ui-state-disabled-opacity-06 small">Nessuna
clausola aggiunta.</li>
</ul>
<ul id="sortable0" class="condLIand list-group ui-sortable">
<li id="li-cla0"
class="list-group-item align-items-center my-1 ui-state-default ui-state-disabled border text-muted bg-white ui-state-disabled-opacity-06 small">Nessuna
clausola aggiunta.</li>
</ul>
</div>
</div>
</div>

View File

@ -85,6 +85,7 @@ $(document).ready(function() {
};
})
// Evento: click sulsullo switch di ricerca avanzata
$('#searchToggle').on('change', function() {
if ($(this).prop('checked')) {
queryJson.QueryAvanzata = "1";
@ -150,6 +151,7 @@ $(document).ready(function() {
$('#sortable0').on('click', '.removeCond', function() {
$(this).closest('ul').parent().remove();
condListLen--;
refreshClaList();
refreshSortables();
refreshConnectWith();
if (claListLen == 0 && condListLen == 0) {
@ -190,6 +192,7 @@ $(document).ready(function() {
opacity: 0.6,
cursor: 'move',
update: function() {
refreshClaList();
refreshSortables();
}
});
@ -494,7 +497,8 @@ $(document).ready(function() {
// Variabili testuali per compattezza
var iconReset = '<div class="text-right text-primary radioReset"><ion-icon name="refresh-circle"></ion-icon></div>';
var iconCloseCond = '<div class="p-0 mr-3 mt-1 text-right text-primary"><span class="iconClClass removeCond"><ion-icon name="close-circle"></ion-icon></span></div>';
var emptyClaList = '<li id="li-cla0" class="list-group-item align-items-center mb-1 ui-state-default ui-state-disabled border text-muted bg-white ui-state-disabled-opacity-06 small">Nessuna clausola aggiunta.</li>';
var emptyClaList = '<li id="li-cla0" class="list-group-item align-items-center my-1 ui-state-default ui-state-disabled border text-muted bg-white ui-state-disabled-opacity-06 small">Nessuna clausola aggiunta.</li>';
var defaultCond = '<div id="cla-defaultCond" class="col-12 px-0 pb-1 small font-weight-bold text-muted">AND</div>';
var condLIplaceholderText1 = 'Trascina qui almeno 1 clausola o condizione';
var condLIplaceholderText2 = 'Trascina qui almeno 2 clausole o condizioni';
@ -815,6 +819,13 @@ $(document).ready(function() {
};
queryJson.Clausola0 = JSON.parse('{"queryText": "' + qText + '", "lemma_forma": "' + l_f + '", "opzioni_testo": "' + optText + '", "TipoClausola": "0", "Attiva": "' + claActive + '"}');
var tabsContent = $("#sortable0").find(".claLI");
if ($('#sortable0').children("li").length <= 1) {
$("#cla-defaultCond").remove();
} else {
if ($('#cla-defaultCond').length == 0) {
$("#cla-list-row").prepend($(defaultCond));
}
};
if ($(tabsContent).length) {
if ($("#li-cla0")[0]) {
$("#li-cla0")[0].remove();