dettagli visibili quando si sceglie la cat gramm

This commit is contained in:
cesare 2022-05-13 11:03:53 +02:00
parent aa2e856c20
commit aeb31da7ca
3 changed files with 31 additions and 36 deletions

View File

@ -12,7 +12,7 @@
<script type="text/javascript" src="https://bundle.run/sparqljs@3.4.1"></script> <script type="text/javascript" src="https://bundle.run/sparqljs@3.4.1"></script>
<script <script
src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="js/guimanager.js"></script> <script type="text/javascript" src="js/guimanager_good2.js"></script>
<script type="text/javascript"> <script type="text/javascript">
/* function mostra() { /* function mostra() {
var x = document.getElementById("divContentId"); var x = document.getElementById("divContentId");

View File

@ -150,7 +150,7 @@
</div> </div>
</div> </div>
<div class="fl w-100 w-20-ns pa4" id='tuttiFiltri'> <div class="fl w-100 w-20-ns pa4" id='tuttiFiltri'>
<div class="bg-washed-blue pv2" id='filtri' style="display: none;" > <div class="bg-washed-blue pv2" id='filtri' style="display:block;" >
<img <img
src="./images/filters1.png" style="width: 40px; height: 48px; " alt="Filtri"> src="./images/filters1.png" style="width: 40px; height: 48px; " alt="Filtri">
<input type="hidden" id="IdFiltro" type="text" value=""> <input type="hidden" id="IdFiltro" type="text" value="">

View File

@ -140,6 +140,8 @@ $(document).ready(function() {
var condizioniFiltro = {} var condizioniFiltro = {}
var clausolaVisibile= false //contiene il valore true se una clausola è gia visibile e quindi non se ne può visualizzare una seconda
$('.tabs__menu-item').on('click', function() { $('.tabs__menu-item').on('click', function() {
$(this).addClass('bg-white').addClass('red'); $(this).addClass('bg-white').addClass('red');
@ -150,6 +152,10 @@ $(document).ready(function() {
jQuery(document).delegate('a.add-record-sint', 'click', function(e) { jQuery(document).delegate('a.add-record-sint', 'click', function(e) {
e.preventDefault(); e.preventDefault();
if (clausolaVisibile)
return true;
else
clausolaVisibile=true
var content = jQuery('#tiposintattico >div'), var content = jQuery('#tiposintattico >div'),
size = jQuery('#condizioni >div').length + 1, size = jQuery('#condizioni >div').length + 1,
element = null, element = null,
@ -287,7 +293,7 @@ $(document).ready(function() {
flexdiv1.appendTo(rbfieldset); flexdiv1.appendTo(rbfieldset);
flexdiv2.appendTo(rbfieldset); flexdiv2.appendTo(rbfieldset);
rbfieldset.appendTo(element); rbfieldset.appendTo(element);
element.attr('style', 'display:none') element.attr('style', 'display:block')
element.appendTo('#dettaglifiltri'); element.appendTo('#dettaglifiltri');
} }
} }
@ -316,7 +322,7 @@ $(document).ready(function() {
label1.appendTo(flexdiv1); label1.appendTo(flexdiv1);
flexdiv1.appendTo(rbfieldset); flexdiv1.appendTo(rbfieldset);
rbfieldset.appendTo(element); rbfieldset.appendTo(element);
element.attr('style', 'display:none') element.attr('style', 'display:block')
element.appendTo('#dettaglifiltri'); element.appendTo('#dettaglifiltri');
} }
} }
@ -337,7 +343,7 @@ $(document).ready(function() {
seloption.appendTo(select) seloption.appendTo(select)
} }
select.appendTo(element) select.appendTo(element)
element.attr('style', 'display:none') element.attr('style', 'display:block')
element.appendTo('#dettaglifiltri'); element.appendTo('#dettaglifiltri');
@ -346,15 +352,16 @@ $(document).ready(function() {
} }
} }
if (element === undefined) { if (element === undefined) {
var test = jQuery('#' + containerid) var test = jQuery('#' + containerid)
sbs.find(".add-details").attr('style', 'display.none') sbs.find(".add-details").attr('style', 'display:block')
sbs.find(".set-filter").attr('style', 'display.none') sbs.find(".set-filter").attr('style', 'display:block')
test.remove() test.remove()
} }
else { else {
element.attr('style', "display: none;") element.attr('style', "display: block;")
//element.appendTo('#dettaglifiltri'); //element.appendTo('#dettaglifiltri');
@ -393,29 +400,11 @@ $(document).ready(function() {
}); });
jQuery(document).delegate('input.delete-record', 'click', function(e) {
e.preventDefault();
var didConfirm = confirm("Sei sicuro di voler eliminare la clausola?");
if (didConfirm == true) {
var id = jQuery(this).attr('data-id');
var targetDiv = jQuery(this).attr('targetDiv');
jQuery('#rec-' + id).remove();
if (jQuery('#condizioni >tbody >tr').length == 0)
jQuery('#grammarbutton').attr('style', "display:none;")
//regnerate index number on table
$('#condizioni_body tr').each(function(index) {
$(this).find('span.sn').html(index + 1);
});
return true;
} else {
return false;
}
});
jQuery(document).delegate('a.remove-filter', 'click', function(e) { jQuery(document).delegate('a.remove-filter', 'click', function(e) {
e.preventDefault(); e.preventDefault();
var didConfirm = confirm("Sei sicuro di voler eliminare la clausola?"); var didConfirm = confirm("Sei sicuro di voler eliminare la clausola?");
if (didConfirm == true) { if (didConfirm == true) {
@ -425,7 +414,7 @@ $(document).ready(function() {
rmeldetail = jQuery('#' + 'dettaglio_' + targetDiv) rmeldetail = jQuery('#' + 'dettaglio_' + targetDiv)
jQuery(rmel).remove(); jQuery(rmel).remove();
jQuery(rmeldetail).remove(); jQuery(rmeldetail).remove();
clausolaVisibile=false;
return true; return true;
} else { } else {
return false; return false;
@ -454,7 +443,7 @@ $(document).ready(function() {
if (size == 1){ if (size == 1){
filterconditions = 1; filterconditions = 1;
var divFiltri = $('#divfiltri').attr('style', "display:block;"); var divFiltri = $('#divfiltri').attr('style', "display:block;");
divFiltri.appenTo('#tuttiFiltri'); divFiltri.appendTo('#tuttiFiltri');
} }
else else
filterconditions = filterconditions + 1; filterconditions = filterconditions + 1;
@ -489,7 +478,7 @@ $(document).ready(function() {
rmeldetail = jQuery('#' + 'dettaglio_' + targetDiv) rmeldetail = jQuery('#' + 'dettaglio_' + targetDiv)
jQuery(rmel).remove(); jQuery(rmel).remove();
jQuery(rmeldetail).remove(); jQuery(rmeldetail).remove();
clausolaVisibile=false;
condizioniFiltro = {} condizioniFiltro = {}
return true; return true;
@ -533,6 +522,10 @@ $(document).ready(function() {
jQuery(document).delegate('a.add-record', 'click', function(e) { jQuery(document).delegate('a.add-record', 'click', function(e) {
e.preventDefault(); e.preventDefault();
if (clausolaVisibile)
return true;
else
clausolaVisibile=true;
showCategoriaGrammaticale(); showCategoriaGrammaticale();
}); });
@ -564,20 +557,22 @@ $(document).ready(function() {
function showCategoriaGrammaticale() { function showCategoriaGrammaticale() {
$("#types").val("verbovolgare").trigger("change");
// Per Cesare... il valore viene cambiato infatti se aggiungo il filtro è corretto, ma nella dropdown non è visibile
var content = jQuery('#categoriagrammaticale >div'), var content = jQuery('#categoriagrammaticale >div'),
size = jQuery('#condizioni >div').length + 1, size = jQuery('#condizioni >div').length + 1,
element = null, element = null,
element = content.clone(); element = content.clone();
alert("Value: " + $("#types").val()); //alert("Value: " + $("#types").val());
element.attr('id', 'cg-' + size); element.attr('id', 'cg-' + size);
element.find('.remove-filter').attr('target', 'cg-' + size); element.find('.remove-filter').attr('target', 'cg-' + size);
element.find('.set-filter').attr('targetfilter', 'cg-' + size); element.find('.set-filter').attr('targetfilter', 'cg-' + size);
element.appendTo('#condizioni'); element.appendTo('#condizioni');
//per NICOLA: il cambiamento va fatto dopo che l'elemento è stato aggiunto al DOM
$("#types").val("verbovolgare").trigger("change");
element.find('.sn').html(size); element.find('.sn').html(size);
grammarconditions = grammarconditions + 1 grammarconditions = grammarconditions + 1