Skip to content

Commit

Permalink
fixed the functionality of edit button
Browse files Browse the repository at this point in the history
  • Loading branch information
dixita9 committed Jul 17, 2024
1 parent 3417737 commit 53f1479
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions app/static/js/createEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,15 @@ $(document).ready(function() {
$(this).find("input[type=submit]").prop("disabled", true);
});

$("#checkIsRecurring, #checkIsMultipleOffering").click(function(event) { //#checkIsRecurring, #checkIsMultipleOffering are attributes for the toggle buttons on create event page
var modalOpenedByEditButton = false;

$("#checkIsRecurring, #checkIsMultipleOffering, #edit_modal").click(function(event) { //#checkIsRecurring, #checkIsMultipleOffering are attributes for the toggle buttons on create event page
if(!(document.getElementById('inputEventName').value === '')){
document.getElementById('eventName').value = document.getElementById('inputEventName').value; //keeps main page event name for multiple event modal
}
var recurringStatus = $("input[id='checkIsRecurring']:checked").val(); //this line function is to retrive ON when its toggle for recurring event on createEvent.html line 158
var multipleOfferingStatus = $("input[id='checkIsMultipleOffering']:checked").val();// this line function is to retrive ON when toggle for multiple offering event button createEvent.html line 160

modalOpenedByEditButton = ($(this).attr('id') === 'edit_modal');
if (multipleOfferingStatus == 'on' && recurringStatus == 'on'){
console.log("Both recurring and multiple offering are on. Showing message...");
msgFlash("You may not toggle recurring event and multiple time offering event at the same time!", "danger");
Expand Down Expand Up @@ -196,11 +198,13 @@ $(document).ready(function() {
});

$("#cancelModalPreview, #multipleOfferingXbutton").click(function(){ //this function is to untoggle the button when the modal has cancel or close button being clicked
if (modalOpenedByEditButton == false) {
$("#checkIsMultipleOffering").prop('checked', false);
$('#nonMultipleOfferingTime, #nonMultipleOfferingDate').removeClass('d-none');
$("#multipleOfferingTableDiv").addClass('d-none');
$('#modalMultipleOffering').modal('hide');
$('.extraSlots').children().not(':first').remove();
}
});

/*cloning the div with ID multipleOfferingEvent and cloning, changing the ID of each clone going up by 1. This also changes the ID of the deleteMultipleOfferingEvent so that when the trash icon is clicked,
Expand Down Expand Up @@ -334,8 +338,3 @@ $(document).ready(function() {
setCharacterLimit($("#inputCharacters"), "#remainingCharacters");
});

$("#edit_modal").click(function(){
$('#modalMultipleOffering').modal('show');


})

0 comments on commit 53f1479

Please sign in to comment.