Fixed FTU checkboxes

This commit is contained in:
Frank Schubert
2021-11-10 21:07:00 +01:00
parent 3ac134c378
commit afb6167501
2 changed files with 72 additions and 12 deletions

View File

@@ -361,7 +361,26 @@ $(document).ready(function() {
var id_match = $(this).attr("id").match(/wfitem_abschlusstyp_(\d+)$/);
var id = id_match[1];
if($('#wfitem_ist_abschlusstyp_' + id).val() == "SC/APC in FTU") {
if($('#wfitem_ist_abschlusstyp_' + id).val() == "") {
if($(this).val() == "SC/APC in FTU") {
$('#workflow-item-inhouse_cabling_supplied-' + id + ' .wf-content').show();
$('#workflow-item-inhouse_cabling_deployed-' + id + ' .wf-content').show();
} else {
$('#workflow-item-inhouse_cabling_supplied-' + id + ' .wf-content').hide();
$('#workflow-item-inhouse_cabling_deployed-' + id + ' .wf-content').hide();
}
} else {
console.log("ist not empty");
if($('#wfitem_ist_abschlusstyp_' + id).val() == "SC/APC in FTU") {
$('#workflow-item-inhouse_cabling_supplied-' + id + ' .wf-content').show();
$('#workflow-item-inhouse_cabling_deployed-' + id + ' .wf-content').show();
} else {
$('#workflow-item-inhouse_cabling_supplied-' + id + ' .wf-content').hide();
$('#workflow-item-inhouse_cabling_deployed-' + id + ' .wf-content').hide();
}
}
/*
if($('#wfitem_ist_abschlusstyp_' + id).val().length && $('#wfitem_ist_abschlusstyp_' + id).val() != "SC/APC in FTU") {
$('#workflow-item-inhouse_cabling_supplied-' + id + ' .wf-content').hide();
$('#workflow-item-inhouse_cabling_deployed-' + id + ' .wf-content').hide();
} else {
@@ -372,7 +391,7 @@ $(document).ready(function() {
$('#workflow-item-inhouse_cabling_supplied-' + id + ' .wf-content').show();
$('#workflow-item-inhouse_cabling_deployed-' + id + ' .wf-content').show();
}
}
}*/
});
$(elem).change();
});
@@ -384,20 +403,22 @@ $(document).ready(function() {
var id = id_match[1];
if($(this).val() == "") {
console.log("ist empty");
if($('#wfitem_abschlusstyp_' + id).val() == "SC/APC in FTU") {
$('#workflow-item-inhouse_cabling_supplied-' + id + ' .wf-content').hide();
$('#workflow-item-inhouse_cabling_deployed-' + id + ' .wf-content').hide();
} else {
$('#workflow-item-inhouse_cabling_supplied-' + id + ' .wf-content').show();
$('#workflow-item-inhouse_cabling_deployed-' + id + ' .wf-content').show();
} else {
$('#workflow-item-inhouse_cabling_supplied-' + id + ' .wf-content').hide();
$('#workflow-item-inhouse_cabling_deployed-' + id + ' .wf-content').hide();
}
} else {
if($(this).val() == "SC/APC in FTU") {
$('#workflow-item-inhouse_cabling_supplied-' + id + ' .wf-content').hide();
$('#workflow-item-inhouse_cabling_deployed-' + id + ' .wf-content').hide();
} else {
console.log("ist not empty");
if($('#wfitem_ist_abschlusstyp_' + id).val() == "SC/APC in FTU") {
$('#workflow-item-inhouse_cabling_supplied-' + id + ' .wf-content').show();
$('#workflow-item-inhouse_cabling_deployed-' + id + ' .wf-content').show();
} else {
$('#workflow-item-inhouse_cabling_supplied-' + id + ' .wf-content').hide();
$('#workflow-item-inhouse_cabling_deployed-' + id + ' .wf-content').hide();
}
}
});
@@ -449,11 +470,13 @@ function validateWorkflowItem(id) {
console.log("abschlusstyp: " + $("#wfitem_abschlusstyp_" + id).val());
console.log("ist abschlusstyp: " + $("#wfitem_ist_abschlusstyp_" + id).val());
if($("#wfitem_abschlusstyp_" + id).val() != "SC/APC in FTU" && $("#wfitem_ist_abschlusstyp_" + id).val() != "SC/APC in FTU") {
if($("#wfitem_ist_abschlusstyp_" + id).val() == "SC/APC in FTU") {
required_fields["inhouse_cabling_supplied"] = "bool";
required_fields["inhouse_cabling_deployed"] = "bool";
}
} else if($("#wfitem_abschlusstyp_" + id).val() == "SC/APC in FTU") {
required_fields["inhouse_cabling_supplied"] = "bool";
required_fields["inhouse_cabling_deployed"] = "bool";
}
var missing = false;
for(var field1 in required_fields) {