1var RegistrationCheckin = function () { 2 return { 3 init: function () { 4 jQuery(".wpem-attendee-modal").on("click", ".registration-checkin", RegistrationCheckin.actions.updateCheckin); 5 jQuery(".wpem-attendee-modal").on("click", ".registration-uncheckin", RegistrationCheckin.actions.updateCheckin); 6 7 jQuery(".registration-checkin").on("click", RegistrationCheckin.actions.updateCheckin); 8 jQuery(".registration-uncheckin").on("click", RegistrationCheckin.actions.updateCheckin); 9 }, 10 actions: { 11 updateCheckin: function (n) { 12 var check_in_value = jQuery(this).data("value"); 13 registration_id = jQuery(this).data("registration-id"); 14 event_id = jQuery("input[name=event_id]").val(); 15 source = jQuery(this).data("source"); 16 var attendee_id = jQuery("#attendee_id-"+registration_id).html(); 17 jQuery.ajax({ 18 type: "POST", 19 url: event_registration_checkin.ajaxUrl.toString().replace("%%endpoint%%", "update_event_registration_checkin_data"), 20 data: { check_in_value: check_in_value, registration_id: registration_id, event_id: event_id, source: source }, 21 beforeSend: function (n, e) { 22 if (jQuery(".wpem-attendee-modal.wpem-modal-open").length) { 23 jQuery("#attendee_id-"+registration_id).html("Loading..."); 24 } else { 25 jQuery("#registration-"+registration_id).find(".wpem-event-regi-checkin-out").html("Loading..."); 26 } 27 }, 28 success: function (response) { 29 console.error("Error:", response.data.message); 30 if(response.success) { 31 if (jQuery(".wpem-attendee-modal.wpem-modal-open").length) { 32 if(check_in_value == '1'){ 33 jQuery("#attendee_id-"+registration_id).html("<span><a href='#' class='button-secondary registration-uncheckin' data-source='' data-value='0' data-registration-id='"+registration_id+"'>Undo Check in</a></span>"); 34 jQuery(".registration-uncheckin").on("click", RegistrationCheckin.actions.updateCheckin); 35 } else { 36 jQuery("#attendee_id-"+registration_id).html("<span><a href='#' class='button-secondary registration-checkin' data-source='' data-value='1' data-registration-id='"+registration_id+"'>Check in</a></span>"); 37 jQuery(".registration-checkin").on("click", RegistrationCheckin.actions.updateCheckin); 38 } 39 } else { 40 if(check_in_value == '1'){ 41 jQuery("#registration-"+registration_id).find(".wpem-event-regi-checkin-out").html("<span><a href='#' class='button-secondary registration-uncheckin' data-source='' data-value='0' data-registration-id='"+registration_id+"'>Undo Check in</a></span>"); 42 jQuery(".registration-uncheckin").on("click", RegistrationCheckin.actions.updateCheckin); 43 } else { 44 jQuery("#registration-"+registration_id).find(".wpem-event-regi-checkin-out").html("<span><a href='#' class='button-secondary registration-checkin' data-source='' data-value='1' data-registration-id='"+registration_id+"'>Check in</a></span>"); 45 jQuery(".registration-checkin").on("click", RegistrationCheckin.actions.updateCheckin); 46 } 47 } 48 jQuery(".check_in_total").html(response); 49 } else { 50 jQuery(".wpem-event-regi-list-body").prepend('<div class="wpem-alert wpem-alert-danger">'+response.data.message+'</div>'); 51 } 52 53 }, 54 error: function(jqXHR, textStatus, errorThrown) { 55 // Try to parse the response JSON to get the error message 56 try { 57 jQuery("#attendee_id-"+registration_id).html(attendee_id); 58 var response = JSON.parse(jqXHR.responseText); 59 if (jQuery(".wpem-attendee-modal.wpem-modal-open").length) { 60 if (response.data && response.data.message) { 61 jQuery(".wpem-attendee-modal-content").prepend('<div class="wpem-alert wpem-alert-danger">'+response.data.message+'</div>'); 62 } else { 63 jQuery(".wpem-attendee-modal-content").prepend('<div class="wpem-alert wpem-alert-danger">Something went wrong. Please try again!</div>'); 64 } 65 } else { 66 if (response.data && response.data.message) { 67 jQuery(".wpem-event-regi-list-body").prepend('<div class="wpem-alert wpem-alert-danger">'+response.data.message+'</div>'); 68 } else { 69 jQuery(".wpem-event-regi-list-body").prepend('<div class="wpem-alert wpem-alert-danger">Something went wrong. Please try again!</div>'); 70 } 71 } 72 } catch (e) { 73 console.error("Failed to parse error response.", e); 74 } 75 }, 76 complete: function (n, e) { 77 }, 78 }), 79 n.preventDefault(); 80 }, 81 }, 82 }; 83}; 84(RegistrationCheckin = RegistrationCheckin()), 85 jQuery(document).ready(function (n) { 86 RegistrationCheckin.init(); 87});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.