mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-14 21:44:08 +02:00
fix fed agency bug
This commit is contained in:
parent
2260269e3d
commit
81e76fe04a
1 changed files with 7 additions and 4 deletions
|
@ -860,10 +860,13 @@ function initializeWidgetOnList(list, parentId) {
|
||||||
let organizationType = document.getElementById("id_organization_type");
|
let organizationType = document.getElementById("id_organization_type");
|
||||||
let readonlyOrganizationType = document.querySelector(".field-organization_type .readonly");
|
let readonlyOrganizationType = document.querySelector(".field-organization_type .readonly");
|
||||||
|
|
||||||
|
let organizationNameContainer = document.querySelector(".field-organization_name");
|
||||||
|
let federalType = document.querySelector(".field-federal_type");
|
||||||
|
|
||||||
if ($federalAgency && (organizationType || readonlyOrganizationType)) {
|
if ($federalAgency && (organizationType || readonlyOrganizationType)) {
|
||||||
// Attach the change event listener
|
// Attach the change event listener
|
||||||
$federalAgency.on("change", function() {
|
$federalAgency.on("change", function() {
|
||||||
handleFederalAgencyChange($federalAgency, organizationType, readonlyOrganizationType);
|
handleFederalAgencyChange($federalAgency, organizationType, readonlyOrganizationType, organizationNameContainer, federalType);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -882,8 +885,6 @@ function initializeWidgetOnList(list, parentId) {
|
||||||
|
|
||||||
// Handle hiding the organization name field when the organization_type is federal.
|
// Handle hiding the organization name field when the organization_type is federal.
|
||||||
// Run this first one page load, then secondly on a change event.
|
// Run this first one page load, then secondly on a change event.
|
||||||
let organizationNameContainer = document.querySelector(".field-organization_name");
|
|
||||||
let federalType = document.querySelector(".field-federal_type");
|
|
||||||
handleOrganizationTypeChange(organizationType, organizationNameContainer, federalType);
|
handleOrganizationTypeChange(organizationType, organizationNameContainer, federalType);
|
||||||
organizationType.addEventListener("change", function() {
|
organizationType.addEventListener("change", function() {
|
||||||
handleOrganizationTypeChange(organizationType, organizationNameContainer, federalType);
|
handleOrganizationTypeChange(organizationType, organizationNameContainer, federalType);
|
||||||
|
@ -907,7 +908,7 @@ function initializeWidgetOnList(list, parentId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleFederalAgencyChange(federalAgency, organizationType, readonlyOrganizationType) {
|
function handleFederalAgencyChange(federalAgency, organizationType, readonlyOrganizationType, organizationNameContainer, federalType) {
|
||||||
// Don't do anything on page load
|
// Don't do anything on page load
|
||||||
if (isInitialPageLoad) {
|
if (isInitialPageLoad) {
|
||||||
isInitialPageLoad = false;
|
isInitialPageLoad = false;
|
||||||
|
@ -941,6 +942,8 @@ function initializeWidgetOnList(list, parentId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleOrganizationTypeChange(organizationType, organizationNameContainer, federalType);
|
||||||
|
|
||||||
// Determine if any changes are necessary to the display of portfolio type or federal type
|
// Determine if any changes are necessary to the display of portfolio type or federal type
|
||||||
// based on changes to the Federal Agency
|
// based on changes to the Federal Agency
|
||||||
let federalPortfolioApi = document.getElementById("federal_and_portfolio_types_from_agency_json_url").value;
|
let federalPortfolioApi = document.getElementById("federal_and_portfolio_types_from_agency_json_url").value;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue