Skip to content

Commit

Permalink
Display relevant fields for TXC and FD on edit
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipMitrovski committed Aug 15, 2024
1 parent 34e84b6 commit 277f627
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions ckanext/scheming/templates/scheming/form_snippets/radio.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@
// Customize visibility based on the selected option
if (selectedOption === 'txc_data'){
document.querySelector("#content > div.row.wrapper > div.primary > section.module > div.module-content > form.dataset-form > div:nth-child(3 of .form-group)").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div.primary > section.module > div:nth-child(1 of .form-group.control-medium)").style.display = 'none';

}
if (selectedOption === 'financial_data') {
// Hide specific fields for Financial Data
document.querySelector("#content > div.row.wrapper > div.primary > section.module > div.module-content > form.dataset-form > div:nth-child(3 of .form-group)").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div.primary > section.module > div:nth-child(2 of .form-group.control-medium)").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div.primary > section.module > div:nth-child(3 of .form-group.control-medium)").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div.primary > section.module > div:nth-child(5 of .form-group.control-medium)").style.display = 'none';
Expand All @@ -82,27 +84,18 @@
document.getElementById('field-type_of_dataset').disabled=true;

if (selectedOption === 'txc_data'){
document.querySelector("#content > div.row.wrapper > div.primary > section.module > div.module-content > form.dataset-form > div:nth-child(3 of .form-group)").style.display = 'none'; // create a dataset


document.querySelector("#content > div.row.wrapper > div.primary > section.module > div:nth-child(2 of .form-group.control-medium)").style.display = 'block';
document.querySelector("#content > div.row.wrapper > div.primary > section.module > div:nth-child(3 of .form-group.control-medium)").style.display = 'block';
document.querySelector("#content > div.row.wrapper > div.primary > section.module > div:nth-child(5 of .form-group.control-medium)").style.display = 'block';
document.querySelector("#content > div.row.wrapper > div.primary > section.module > div:nth-child(6 of .form-group.control-medium)").style.display = 'block';

document.querySelector("#content > div.row.wrapper > div.primary > article.module > div.module-content > form.dataset-form > div:nth-child(3 of .form-group)").style.display = 'none'; // create a dataset
document.querySelector("#content > div.row.wrapper > div.primary > article.module > div:nth-child(1 of .form-group.control-medium)").style.display = 'none';

}
// Customize visibility based on the selected option
if (selectedOption === 'financial_data') {
// Hide specific fields for Financial Data
document.querySelector("#content > div.row.wrapper > div.primary > section.module > div:nth-child(2 of .form-group.control-medium)").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div.primary > section.module > div:nth-child(3 of .form-group.control-medium)").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div.primary > section.module > div:nth-child(5 of .form-group.control-medium)").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div.primary > section.module > div:nth-child(6 of .form-group.control-medium)").style.display = 'none';


document.querySelector("#content > div.row.wrapper > div.primary > section.module > div.module-content > form.dataset-form > div:nth-child(3 of .form-group)").style.display = 'block'; // create a dataset

// Hide specific fields for Financial Data
document.querySelector("#content > div.row.wrapper > div.primary > article.module > div.module-content > form.dataset-form > div:nth-child(3 of .form-group)").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div.primary > article.module > div:nth-child(2 of .form-group.control-medium)").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div.primary > article.module > div:nth-child(3 of .form-group.control-medium)").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div.primary > article.module > div:nth-child(5 of .form-group.control-medium)").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div.primary > article.module > div:nth-child(6 of .form-group.control-medium)").style.display = 'none';

}
}
Expand Down

0 comments on commit 277f627

Please sign in to comment.