Skip to content

Commit

Permalink
♻️ refactor(Status Rules): validation update based on previous methods
Browse files Browse the repository at this point in the history
  • Loading branch information
MetalPrime committed May 10, 2024
1 parent 41aa052 commit 193a15b
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,7 @@ function justificationByStatus(statusId) {
var $newExpectedYearSelect = $newExpectedYearBlock.find('select');
var newExpectedYear = $newExpectedYearSelect.val();

var hasExpectedYear =
((newExpectedYear != "") && newExpectedYear != "-1") && (typeof newExpectedYear !== 'undefined');
var isCompletedWithoutExpectedYear = ((!reportingActive) && isStatusComplete(statusId) && hasExpectedYear);
var hasExpectedYear = ((newExpectedYear != "") && newExpectedYear != "-1") && (typeof newExpectedYear !== 'undefined');

// Validate the justification
if (isStatusCancelled(statusId) || isStatusExtended(statusId)) {
Expand All @@ -573,6 +571,7 @@ function justificationByStatus(statusId) {
} else {
$statusDescription.slideUp(400);
}

// Validate the new extended year
if (isDeliverableNew) {
showNewExpectedComponent(isStatusExtended(statusId) && upKeepActive);
Expand All @@ -585,11 +584,10 @@ function justificationByStatus(statusId) {
$statusDescription.find('textarea').val("");
} else {
console.log("else");
if (statusId == 4) {
if (isStatusExtended(statusId)) {
showNewExpectedComponent(true);
$('.expectedDisabled').hide("slow");
} else if (statusId == 2 || statusId == 3 || statusId == 5 || statusId == 6) {

} else if ( isStatusComplete(statusId) || isStatusComplete(statusId) || statusId == 6) {
if (($('.yearNewExpected').val() != '-1') && ($('.yearNewExpected').val() != $('.yearExpected').val())) {
showNewExpectedComponent(true);
} else {
Expand All @@ -601,7 +599,6 @@ function justificationByStatus(statusId) {
}
}
}

}

//Display the overlay that block the possibility to change the expected year
Expand Down

0 comments on commit 193a15b

Please sign in to comment.