Skip to content

Commit

Permalink
Reformat/indent javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
rechner committed Feb 13, 2024
1 parent 9406fd6 commit 1136535
Showing 1 changed file with 68 additions and 68 deletions.
136 changes: 68 additions & 68 deletions registration/templates/registration/checkout.html
Original file line number Diff line number Diff line change
Expand Up @@ -362,81 +362,81 @@ <h3>There are no attendees in your order</h3>
{% endif %}
<script type="text/javascript">
$(document).ready(function () {
//$("#donateCharity").change(setTwoNumberDecimal);
//$("#donateOrg").change(setTwoNumberDecimal);

$(".deleteAttendee").click(function (e) {
const id = this.id.split('_')[1];
const data = {'id': id};
$.ajax({
"type": "POST",
"dataType": "json",
"contentType": "application/json; charset=utf-8",
"url": URL_REGISTRATION_REMOVE_FROM_CART,
"data": JSON.stringify(data),
"beforeSend": function (xhr, settings) {
console.log("Before Send");
$.ajaxSettings.beforeSend(xhr, settings);
},
"error": function (result, status, error) {
alert(`An error has occurred. If this error continues, please contact ${EVENT_REGISTRATION_EMAIL} for assistance.`);
},
"success": function (result, status) {
if (result.success) {
window.location.reload();
} else {
alert(`An error has occurred: ${result.message}. If this error continues, please contact ${EVENT_REGISTRATION_EMAIL} for assistance.`);
}
}
});
});
//$("#donateCharity").change(setTwoNumberDecimal);
//$("#donateOrg").change(setTwoNumberDecimal);

$(".deleteAttendee").click(function (e) {
const id = this.id.split('_')[1];
const data = {'id': id};
$.ajax({
"type": "POST",
"dataType": "json",
"contentType": "application/json; charset=utf-8",
"url": URL_REGISTRATION_REMOVE_FROM_CART,
"data": JSON.stringify(data),
"beforeSend": function (xhr, settings) {
console.log("Before Send");
$.ajaxSettings.beforeSend(xhr, settings);
},
"error": function (result, status, error) {
alert(`An error has occurred. If this error continues, please contact ${EVENT_REGISTRATION_EMAIL} for assistance.`);
},
"success": function (result, status) {
if (result.success) {
window.location.reload();
} else {
alert(`An error has occurred: ${result.message}. If this error continues, please contact ${EVENT_REGISTRATION_EMAIL} for assistance.`);
}
}
});
});

$("#addAnother").click(function () {
window.location = URL_REGISTRATION_INDEX;
});
$("#addAnother").click(function () {
window.location = URL_REGISTRATION_INDEX;
});

$("#cancel").click(function () {
const cancel = window.confirm("Are you sure you want to cancel your registration? This will remove all attendees from your order.");
if (cancel == false) {
return;
}
$("#cancel").click(function () {
const cancel = window.confirm("Are you sure you want to cancel your registration? This will remove all attendees from your order.");
if (cancel == false) {
return;
}

$.getJSON(URL_REGISTRATION_CANCEL_ORDER, function (data) {
window.location = URL_REGISTRATION_INDEX;
});
});
$.getJSON(URL_REGISTRATION_CANCEL_ORDER, function (data) {
window.location = URL_REGISTRATION_INDEX;
});
});


$("#apply_discount").click(function (e) {
const discount = $("#discount").val();
if (discount == '') {
alert("You must enter a discount to apply.");
return;
}
const data = {'discount': discount};
$.ajax({
"type": "POST",
"dataType": "json",
"contentType": "application/json; charset=utf-8",
"url": URL_REGISTRATION_DISCOUNT,
"data": JSON.stringify(data),
"beforeSend": function (xhr, settings) {
console.log("Before Send");
$.ajaxSettings.beforeSend(xhr, settings);
},
"error": function (result, status, error) {
alert(`An error has occurred. If this error continues, please contact ${EVENT_REGISTRATION_EMAIL} for assistance.`);
},
"success": function (result, status) {
if (result.success) {
window.location.reload();
} else {
alert(`An error has occurred: ${result.message} If this error continues, please contact ` +
`${EVENT_REGISTRATION_EMAIL} for assistance.`);
}
$("#apply_discount").click(function (e) {
const discount = $("#discount").val();
if (discount == '') {
alert("You must enter a discount to apply.");
return;
}
const data = {'discount': discount};
$.ajax({
"type": "POST",
"dataType": "json",
"contentType": "application/json; charset=utf-8",
"url": URL_REGISTRATION_DISCOUNT,
"data": JSON.stringify(data),
"beforeSend": function (xhr, settings) {
console.log("Before Send");
$.ajaxSettings.beforeSend(xhr, settings);
},
"error": function (result, status, error) {
alert(`An error has occurred. If this error continues, please contact ${EVENT_REGISTRATION_EMAIL} for assistance.`);
},
"success": function (result, status) {
if (result.success) {
window.location.reload();
} else {
alert(`An error has occurred: ${result.message} If this error continues, please contact ` +
`${EVENT_REGISTRATION_EMAIL} for assistance.`);
}
}
});
});
});
});
</script>
{% endblock %}

0 comments on commit 1136535

Please sign in to comment.