mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-14 05:29:43 +02:00
parent
1fae782399
commit
084d56d32a
1 changed files with 6 additions and 10 deletions
|
@ -405,16 +405,12 @@ function initializeWidgetOnList(list, parentId) {
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
let statusSelect = document.getElementById('id_status');
|
let statusSelect = document.getElementById('id_status');
|
||||||
|
|
||||||
function moveStatusChangelog(actionNeededReasonFormGroup, rejectionReasonFormGroup, statusSelect) {
|
function moveStatusChangelog(actionNeededReasonFormGroup, statusSelect) {
|
||||||
let flexContainerActionNeeded = actionNeededReasonFormGroup.querySelector('.flex-container');
|
let flexContainer = actionNeededReasonFormGroup.querySelector('.flex-container');
|
||||||
let flexContainerRejected = rejectionReasonFormGroup.querySelector('.flex-container');
|
|
||||||
let statusChangelog = document.getElementById('dja-status-changelog');
|
let statusChangelog = document.getElementById('dja-status-changelog');
|
||||||
if (statusSelect.value === "action needed") {
|
if (statusSelect.value === "action needed") {
|
||||||
flexContainerActionNeeded.parentNode.insertBefore(statusChangelog, flexContainerActionNeeded.nextSibling);
|
flexContainer.parentNode.insertBefore(statusChangelog, flexContainer.nextSibling);
|
||||||
} else if (statusSelect.value === "rejected"){
|
} else {
|
||||||
flexContainerRejected.parentNode.insertBefore(statusChangelog, flexContainerRejected.nextSibling);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Move the changelog back to its original location
|
// Move the changelog back to its original location
|
||||||
let statusFlexContainer = statusSelect.closest('.flex-container');
|
let statusFlexContainer = statusSelect.closest('.flex-container');
|
||||||
statusFlexContainer.parentNode.insertBefore(statusChangelog, statusFlexContainer.nextSibling);
|
statusFlexContainer.parentNode.insertBefore(statusChangelog, statusFlexContainer.nextSibling);
|
||||||
|
@ -422,11 +418,11 @@ function initializeWidgetOnList(list, parentId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call the function on page load
|
// Call the function on page load
|
||||||
moveStatusChangelog(actionNeededReasonFormGroup, rejectionReasonFormGroup, statusSelect);
|
moveStatusChangelog(actionNeededReasonFormGroup, statusSelect);
|
||||||
|
|
||||||
// Add event listener to handle changes to the selector itself
|
// Add event listener to handle changes to the selector itself
|
||||||
statusSelect.addEventListener('change', function() {
|
statusSelect.addEventListener('change', function() {
|
||||||
moveStatusChangelog(actionNeededReasonFormGroup, rejectionReasonFormGroup, statusSelect);
|
moveStatusChangelog(actionNeededReasonFormGroup, statusSelect);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue