diff --git a/marlo-web/src/main/webapp/crp/js/projects/deliverables/deliverableInfo.js b/marlo-web/src/main/webapp/crp/js/projects/deliverables/deliverableInfo.js index 3bc1584ecd..16de81f59a 100644 --- a/marlo-web/src/main/webapp/crp/js/projects/deliverables/deliverableInfo.js +++ b/marlo-web/src/main/webapp/crp/js/projects/deliverables/deliverableInfo.js @@ -558,10 +558,6 @@ function validateCurrentDate() { function justificationByStatus(statusId) { - const $expectedYearBlock = $('#deliverableYear'); - const $expectedYearSelect = $expectedYearBlock.find('select'); - const expectedYear = $expectedYearSelect.val(); - var $newExpectedYearBlock = $('#newExpectedYear'); var $newExpectedYearSelect = $newExpectedYearBlock.find('select'); var newExpectedYear = $newExpectedYearSelect.val(); @@ -585,6 +581,8 @@ function justificationByStatus(statusId) { if (isStatusOnGoing(statusId)) { console.log("if"); showNewExpectedComponent(false); + $newExpectedYearSelect.val("-1").trigger("change.select2"); + $statusDescription.find('textarea').val(""); } else { console.log("else"); if (statusId == 4) { @@ -606,7 +604,7 @@ function justificationByStatus(statusId) { } -//Display the overlay thaty block the possibility to change the expected year +//Display the overlay that block the possibility to change the expected year function showNewExpectedComponent(state) { var $newExpectedYearBlock = $('#newExpectedYear'); var $yearOverlay = $('#deliverableYear .overlay'); @@ -628,10 +626,6 @@ function validateDeliverableStatus(canChangeStatus) { const $expectedYearSelect = $expectedYearBlock.find('select'); const expectedYear = $expectedYearSelect.val(); - var $newExpectedYearBlock = $('#newExpectedYear'); - var $newExpectedYearSelect = $newExpectedYearBlock.find('select'); - var newExpectedYear = $newExpectedYearSelect.val(); - var isAdmin = document.getElementById("adminRole").value; // New Expected year should be greater than current reporting cycle year