Skip to content

Commit d8e6fa6

Browse files
committed
Add a check so its not possible delete last Condition form.
1 parent 560d2ec commit d8e6fa6

File tree

1 file changed

+6
-2
lines changed
  • src/main/resources/static/js

1 file changed

+6
-2
lines changed

src/main/resources/static/js/main.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,12 @@ $(document).ready(function() {
459459
var indexToRemove = context.$index();
460460

461461
// Removing Requirement(Condition), based on index position, from Requirement form in Add_Subscription window.
462-
vm.subscription()[0].requirements.splice(indexToRemove,1);
463-
462+
if (indexToRemove > 0 ){
463+
vm.subscription()[0].requirements.splice(indexToRemove,1);
464+
}
465+
else {
466+
$.alert("You need to have atleast one Condition.");
467+
}
464468
});
465469
// /Stop ## Delete Condition ################################################
466470

0 commit comments

Comments
 (0)