Skip to content

Commit

Permalink
Hide unnecessary fields from Financial dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
taleksovska committed Jul 31, 2024
1 parent d6c5e54 commit 77e4ef9
Showing 1 changed file with 19 additions and 48 deletions.
67 changes: 19 additions & 48 deletions ckanext/scheming/templates/scheming/form_snippets/radio.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,76 +62,47 @@
// in other hand it is update dataset page
var fileId = document.getElementById('field-id').value;


if(fileId === null || fileId === ''){

// Customize visibility based on the selected option
if (selectedOption === 'txc_data'){
document.querySelector("#dataset-edit > div:nth-child(13)").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div > section > div:nth-child(2)").style.display = 'none';

}
if (selectedOption === 'financial_data') {
// Hide specific fields for Financial Data
document.querySelector("#dataset-edit > div:nth-child(15)").style.display = 'none';
document.querySelector("#dataset-edit > div:nth-child(17)").style.display = 'none';
document.querySelector("#dataset-edit > div:nth-child(21)").style.display = 'none';
document.querySelector("#dataset-edit > div:nth-child(22)").style.display = 'none';
// document.querySelector("#dataset-edit > div:nth-child(24)").style.display = 'none';
// document.querySelector("#dataset-edit > div:nth-child(26)").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div > section > div:nth-child(4))").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div > section > div:nth-child(6))").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div > section > div.form-group.control-medium.control-select").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div > section > div:nth-child(11)").style.display = 'none';

}
}

else{
document.getElementById('field-type_of_dataset').disabled=true;

if (selectedOption === 'txc_data'){
document.querySelector("#dataset-edit > div:nth-child(13)").style.display = 'none'; // create a dataset
// document.querySelector("#dataset-edit > div:nth-child(11)").style.display = 'none'; // edit dataset


document.querySelector("#dataset-edit > div:nth-child(15)").style.display = 'block';
document.querySelector("#dataset-edit > div:nth-child(17)").style.display = 'block';
document.querySelector("#dataset-edit > div:nth-child(21)").style.display = 'block';
document.querySelector("#dataset-edit > div:nth-child(22)").style.display = 'block';
// document.querySelector("#dataset-edit > div:nth-child(24)").style.display = 'block';
// document.querySelector("#dataset-edit > div:nth-child(26)").style.display = 'block';
document.querySelector("#content > div.row.wrapper > div > section > div:nth-child(2)").style.display = 'none'; // create a dataset


document.querySelector("#content > div.row.wrapper > div > section > div:nth-child(4))").style.display = 'block';
document.querySelector("#content > div.row.wrapper > div > section > div:nth-child(6))").style.display = 'block';
document.querySelector("#content > div.row.wrapper > div > section > div.form-group.control-medium.control-select").style.display = 'block';
document.querySelector("#content > div.row.wrapper > div > section > div:nth-child(11)").style.display = 'block';

// document.querySelector("#dataset-edit > div:nth-child(11)").style.display = 'block';
// document.querySelector("#dataset-edit > div:nth-child(16)").style.display = 'block';
// document.querySelector("#dataset-edit > div:nth-child(18)").style.display = 'block';
// document.querySelector("#dataset-edit > div:nth-child(22)").style.display = 'block';
// document.querySelector("#dataset-edit > div:nth-child(23)").style.display = 'block';
// document.querySelector("#dataset-edit > div:nth-child(25)").style.display = 'block';



}


// Customize visibility based on the selected option
if (selectedOption === 'financial_data') {
// Hide specific fields for Financial Data
document.querySelector("#dataset-edit > div:nth-child(15)").style.display = 'none';
document.querySelector("#dataset-edit > div:nth-child(17)").style.display = 'none';
document.querySelector("#dataset-edit > div:nth-child(21)").style.display = 'none';
document.querySelector("#dataset-edit > div:nth-child(22)").style.display = 'none';
// document.querySelector("#dataset-edit > div:nth-child(24)").style.display = 'none';
// document.querySelector("#dataset-edit > div:nth-child(26)").style.display = 'none';


// document.querySelector("#dataset-edit > div:nth-child(11)").style.display = 'none';
// document.querySelector("#dataset-edit > div:nth-child(16)").style.display = 'none';
// document.querySelector("#dataset-edit > div:nth-child(18)").style.display = 'none';
// document.querySelector("#dataset-edit > div:nth-child(22)").style.display = 'none';
// document.querySelector("#dataset-edit > div:nth-child(23)").style.display = 'none';
// document.querySelector("#dataset-edit > div:nth-child(25)").style.display = 'none';

document.querySelector("#dataset-edit > div:nth-child(13)").style.display = 'block'; // create a dataset
//document.querySelector("#dataset-edit > div:nth-child(11)").style.display = 'block'; // edit dataset


document.querySelector("#content > div.row.wrapper > div > section > div:nth-child(4))").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div > section > div:nth-child(6))").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div > section > div.form-group.control-medium.control-select").style.display = 'none';
document.querySelector("#content > div.row.wrapper > div > section > div:nth-child(11)").style.display = 'none';


document.querySelector("#content > div.row.wrapper > div > section > div:nth-child(2)").style.display = 'block'; // create a dataset


}
}
Expand Down

0 comments on commit 77e4ef9

Please sign in to comment.