managing filters, in progress

This commit is contained in:
cesare 2022-04-26 18:27:15 +02:00
parent 1ba6ed56de
commit 6a7a29a3d3
2 changed files with 46 additions and 3 deletions

View File

@ -224,7 +224,7 @@
<div class="flex flex-column">
<nav class="pa1 pa1-ns">
<a class="link dim gray f6 f2-ns dib mr0 delete-written-filter" href="#"
title="Remove"><img src="./images/chiudi1.png"
title="RemoveFilter"><img src="./images/chiudi1.png"
style="width: 22px; height: 20px;"></a>
<select id="andor" style="display: none;"
class="w-100 db h2 f6 bg-near-white ba b--sliver gray andorconditions"

View File

@ -6,6 +6,7 @@
$(document).ready(function() {
grammarconditions = 0
sintconditions=0
filterconditions=0
@ -449,6 +450,7 @@ $(document).ready(function() {
});
/**
Il Filtro viene scritto
@ -462,12 +464,18 @@ $(document).ready(function() {
var didConfirm = confirm("Sei sicuro di voler definire il filtro?");
if (didConfirm == true) {
var content = jQuery('#filtro'),
size = jQuery('#filtri >div').length + 1,
element = null,
element = content.clone();
element.attr('id', 'filtro-' + size);
element.find('.delete-written-filter').attr('target','filtro-'+size);
if (size==1)
filterconditions=1;
else
filterconditions=filterconditions+1;
element.attr('id', 'filtro-' + filterconditions);
element.find('.delete-written-filter').attr('target','filtro-'+filterconditions);
var keys = Object.keys(condizioniFiltro)
@ -484,6 +492,7 @@ $(document).ready(function() {
//element.find('.listacondizioni').append(dlclass);
element.attr('style','display.block');
element.appendTo('#filtri');
if (size>1){
element.find('.andorconditions').attr('style', 'display.block');
}
@ -506,6 +515,40 @@ $(document).ready(function() {
})
/**
Il Filtro scritto viene eliminato
*/
jQuery(document).delegate('a.delete-written-filter', 'click', function (e) {
e.preventDefault();
var didConfirm = confirm("Sei sicuro di voler cancellare il filtro?");
if (didConfirm == true) {
var targetDiv = jQuery(this).attr('target');
rmel=jQuery('#'+targetDiv)
rmeldetail=jQuery('#' + targetDiv)
jQuery(rmel).remove();
jQuery(rmeldetail).remove();
// se c'è un solo filtro, mi assicuro che non sia visibile il dropbox and/or
size = jQuery('#filtri >div').length
if (size==1){
jQuery('#filtri >div').find('.andorconditions').attr('style', 'display.block');
}
return true;
} else {
return false;
}
});
jQuery(document).delegate('a.add-details', 'click', function(e) {
e.preventDefault();