Commit e814cc64 authored by Théo GUILLON's avatar Théo GUILLON
Browse files

Ajout : lors de la suppression d'un champ, si un condition comporte le champs...

Ajout : lors de la suppression d'un champ, si un condition comporte le champs supprimer alors la condition est supprimer
parent e76b6bce
......@@ -717,6 +717,28 @@ var createForm = function(typeCreateForm) {
// On supprime le champ en question au clic sur le bouton "Poubelle"
$('#'+idbtnCloser).click(function () {
var fieldRemoveId = $(idContainer).find('.ui-selected').find('[id]').attr('id');
// On supprimer les conditions sur les autres champs si le champ en question fait partie de la condition
$(idContainer).find('[data-virtual-conditions]').not(".ui-selected").each(function (k, dataVitualContions) {
var conditions = $(dataVitualContions).attr('data-virtual-conditions');
if (conditions) {
conditions = JSON.parse(conditions);
$.each(conditions, function (uuid, condition) {
$.each(condition, function (key, value) {
if (jQuery.inArray(key, ['ifTheField', 'thenTheField']) !== -1) {
if (fieldRemoveId == value) {
delete conditions[uuid];
}
}
});
});
$(dataVitualContions).attr('data-virtual-conditions', '');
$(dataVitualContions).attr('data-virtual-conditions', JSON.stringify(conditions));
}
});
$(idContainer).find('.ui-selected').remove();
hideDetails();
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment