Current File : /home/digitaw/www/wp-content/plugins/event-tickets/build/js/tickets-attendees.js
(()=>{var t,e,n=n||{};t=jQuery,(e=n).count_columns=function(e){let n=0;const i=e.find("td, th");return i.length?(i.each((function(){let e=parseInt(t(this).attr("colspan"),10);e=e>1?e-1:0,n+=1+e})),n):0},e.remove_tickets=function(e){t("#the-list").find("tr").each((function(){const n=t(this),i=n.find(".check-column").find("input").val();if("string"!=typeof i)return;const o=i.match(/^[0-9]+/);o.length&&-1!==e.indexOf(parseInt(o[0],10))&&n.remove()}))},t((function(){function n(e,n=null){t.isArray(e)||(e=[e]);let i=parseInt(.7*t(window).width(),10);i=i>800?800:i;let o=parseInt(.9*t(window).height(),10);o=o>800?800:o;let s="&ticket_ids="+e.join("|")+"&width="+i+"&height="+o;if(n)s+="&event_id="+n;else if(!Attendees.move_url.includes("event_id"))return;const c=Attendees.move_url.replace("&TB_",s+"&TB_");tb_show(null,c,!1)}"undefined"!=typeof AttendeesPointer&&AttendeesPointer.length&&(options=t.extend(AttendeesPointer.options,{close(){t.post(Attendees.ajaxurl,{pointer:AttendeesPointer.pointer_id,action:"dismiss-wp-pointer"})},open(t,e){e.pointer.css({top:parseInt(e.pointer.css("top").replace("px",""),10)+5}).find(".wp-pointer-arrow").css({right:"50px",left:"auto"}),e.element.on({click(){e.element.pointer("close")}})}}),t(AttendeesPointer.target).pointer(options).pointer("open").pointer("widget")),t("input.print").on("click",(function(){t(window).trigger("attendees-report-before-print.tribe-tickets");const e=t("table.wp-list-table.attendees"),n=e.find("thead th:visible").length,i=e.find("th,td");i.css({width:100/(n-3)+"%"}),window.print(),i.css({width:""}),t(window).trigger("attendees-report-after-print.tribe-tickets")})),t(".tribe-attendees-email").on({submit(e){t(".tribe-attendees-email").hide(),t(document.getElementById("tribe-loading")).show()}}),t("span.trash a").on("click",(function(e){const n=t(this).closest("tr").data("ticket-type");let i=Attendees.confirmation_singular;return Attendees.confirmation&&Attendees.confirmation[n]&&Attendees.confirmation[n].singular&&(i=Attendees.confirmation[n].singular||i),confirm(i)})),t(".event-tickets__attendees-admin-form").on("submit",(function(e){if("delete_attendee"!==t("#bulk-action-selector-top").val())return;if(!t(this).serialize().includes("&attendee"))return;const n=this.querySelectorAll('tr:has(input[name="attendee[]"]:checked)'),i=Array.from(n).map((t=>t.dataset.ticketType)),o=new Set(i).size>1,s=n.length>1,c=i[0];let a=s?Attendees.confirmation_plural:Attendees.confirmation_singular;return!o&&Attendees.confirmation&&Attendees.confirmation[c]&&(a=s?Attendees.confirmation[c].plural||a:Attendees.confirmation[c].singular||a),confirm(a)})),t(".tickets_checkin").on("click",(function(e){const n=jQuery(this);n.prop("disabled",!0),n.addClass("is-busy");const i={action:"tribe-ticket-checkin",provider:n.attr("data-provider"),attendee_id:n.attr("data-attendee-id"),nonce:Attendees.checkin_nonce};n.attr("data-event-id")&&(i.event_ID=n.attr("data-event-id")),t.post(Attendees.ajaxurl,i,(function(e){if(e.success){n.closest("tr").addClass("tickets_checked");const i=parseInt(t("#percent_checkedin").data("total-attendees")),o=parseInt(t("#total_checkedin").text())+1,s=Math.round(o/i*100).toString()+"%";t("#total_checkedin").text(o),t("#percent_checkedin").text(s),e?.data?.reload&&window.location.reload()}n.prop("disabled",!1),n.removeClass("is-busy")}),"json"),e.preventDefault()})),t(".tickets_uncheckin").on("click",(function(e){const n=jQuery(this);n.prop("disabled",!0),n.addClass("is-busy");const i={action:"tribe-ticket-uncheckin",provider:n.attr("data-provider"),attendee_id:n.attr("data-attendee-id"),nonce:Attendees.uncheckin_nonce};n.attr("data-event-id")&&(i.event_ID=n.attr("data-event-id")),t.post(Attendees.ajaxurl,i,(function(e){e.success&&(n.closest("tr").removeClass("tickets_checked"),t("#total_checkedin").text(parseInt(t("#total_checkedin").text())-1),e?.data?.reload&&window.location.reload()),n.prop("disabled",!1),n.removeClass("is-busy")}),"json"),e.preventDefault()})),t("table.wp-list-table").on("click",".row-actions .move-ticket",(function(e){const i=t(this).data("attendee-id"),o=t(this).data("event-id");return i&&n(i,o),e.stopPropagation(),!1})),t("#doaction, #doaction2").on("click",(function(e){let i;switch(t(e.currentTarget).attr("id")){case"doaction":i="action";break;case"doaction2":i="action2"}if(void 0===i)return;if("move"!==t('select[name="'+i+'"]').val())return;const o=jQuery('input[name="attendee[]"]:checked');if(o.length){const e=[];o.each((function(){const n=t(this).val().match(/^[0-9]+/);n&&e.push(n.toString())})),n(e)}else alert(Attendees.cannot_move);return e.stopPropagation(),!1})),function(){const n=t(".ticket-history"),i=t(".hide-ticket-history");i.hide(),n.on("click",(function(n){const i=t(this),o=i.siblings(".hide-ticket-history"),s=parseInt(i.data("ticket-id"),10),c=i.data("check");if(!s||!c)return;const a=t(document.getElementById("ticket-history-"+s));return a.length?(a.show(),i.hide(),o.show()):function(){const n={action:"get_ticket_history",check:c,ticket_id:s};t.post(Attendees.ajaxurl,n,(function(n){if(void 0===n.data||"string"!=typeof n.data.html)return;const c=i.parents("tr"),a=e.count_columns(c);t('<tr id="ticket-history-'+s+'"> <td colspan="'+a+'">'+n.data.html+"</td></tr>").hide().insertAfter(c).slideDown(),i.hide(),o.show()}))}(),n.stopPropagation(),!1})),i.on("click",(function(e){const n=t(this),i=n.siblings(".ticket-history"),o=parseInt(i.data("ticket-id"),10);t(document.getElementById("ticket-history-"+o)).hide(),i.show(),n.hide()}))}()})),window.tec=window.tec||{},window.tec.tickets=window.tec.tickets||{},window.tec.tickets.ticketsAttendees={}})();