aggiunto edit clausola sintattica, in progress

This commit is contained in:
cesare 2022-05-20 18:34:49 +02:00
parent aee0dc1beb
commit 7c7531ec63
1 changed files with 196 additions and 147 deletions

View File

@ -437,9 +437,6 @@ $(document).ready(function() {
jQuery(document).delegate('a.set-filter', 'click', function(e) { jQuery(document).delegate('a.set-filter', 'click', function(e) {
e.preventDefault(); e.preventDefault();
var content = jQuery('#filtro'), var content = jQuery('#filtro'),
size = jQuery('#filtri >div').length + 1, size = jQuery('#filtri >div').length + 1,
element = null, element = null,
@ -456,7 +453,7 @@ $(document).ready(function() {
element.find('.edit-written-filter').attr('target', 'filtro-' + filterconditions); element.find('.edit-written-filter').attr('target', 'filtro-' + filterconditions);
var condizioni = $("#filterform").serialize().split('&'); var condizioni = $("#filterform").serialize().split('&');
//alert (condizioni) alert (condizioni)
//trasformo il filtro in un oggetto JSON //trasformo il filtro in un oggetto JSON
filtro = {} filtro = {}
@ -570,6 +567,14 @@ $(document).ready(function() {
showCategoriaGrammaticale(tempfiltro) showCategoriaGrammaticale(tempfiltro)
}
if (tempfiltro['tipoClausola'].trim() == 'sintattica') {
clausolaVisibile = true;
tipoClausola = 'sintattica'
showClausolaSintattica(tempfiltro)
} }
} }
@ -612,7 +617,7 @@ $(document).ready(function() {
var edelement = $("[name='" + myname + "'"); var edelement = $("[name='" + myname + "'");
var edeltype = edelement.attr('type') var edeltype = edelement.attr('type')
alert (edeltype) //alert(edeltype)
if (edeltype !== undefined & (edeltype == 'radio' | edeltype == 'checkbox')) { if (edeltype !== undefined & (edeltype == 'radio' | edeltype == 'checkbox')) {
$('[value="' + myval + '"]').prop('checked', true); $('[value="' + myval + '"]').prop('checked', true);
} }
@ -635,6 +640,50 @@ $(document).ready(function() {
} }
/**
Visualizza Clausola Sintattica
*/
function showClausolaSintattica(valoriFiltro = {}) {
var content = jQuery('#tiposintattico >div'),
size = jQuery('#condizioni >div').length + 1,
element = null,
element = content.clone();
element.attr('id', 'ts-' + size);
element.find('.remove-filter').attr('target', 'ts-' + size);
element.find('.set-filter').attr('targetfilter', 'ts-' + size);
element.appendTo('#condizioni');
if (!jQuery.isEmptyObject(valoriFiltro)) { // sto facendo l'edit di un filtro
$("#types").val(valoriFiltro['categoria']).trigger("change");
var keys = Object.keys(valoriFiltro)//condizioniFiltro)
for (key in keys) {
myname = keys[key]
myval = valoriFiltro[keys[key]]
var edelement = $("[name='" + myname + "'");
var edeltype = edelement.attr('type')
//alert(edeltype)
if (edeltype !== undefined & (edeltype == 'radio' | edeltype == 'checkbox')) {
$('[value="' + myval + '"]').prop('checked', true);
}
else {
$("[name='" + myname + "'").val(myval)
}
}
}
element.find('.sn').html(size);
sintconditions = sintconditions + 1
if (size == 1)
jQuery('#grammarbutton').attr('style', "display:block;")
}
jQuery(document).delegate('a.add-details', 'click', function(e) { jQuery(document).delegate('a.add-details', 'click', function(e) {
e.preventDefault(); e.preventDefault();