| Current File : /home/d/i/g/digitaw/www/wp-content/plugins/event-tickets/build/js/v2/rsvp-block.js |
tribe.tickets=tribe.tickets||{},tribe.tickets.rsvp=tribe.tickets.rsvp||{},tribe.tickets.rsvp.block={},function(t,e){const n=t(document);e.selectors={container:".tribe-tickets__rsvp-wrapper",rsvpForm:'form[name~="tribe-tickets-rsvp-form"]',goingButton:".tribe-tickets__rsvp-actions-button-going",notGoingButton:".tribe-tickets__rsvp-actions-button-not-going",cancelButton:".tribe-tickets__rsvp-form-button--cancel",errorMessage:".tribe-tickets__form-message--error",hiddenElement:".tribe-common-a11y-hidden",displayToggle:".tribe-tickets__rsvp-actions-success-going-toggle-input"},e.bindGoing=function(n){let i={};const s=n.data("rsvp-id");n.find(e.selectors.goingButton).each((function(e,o){t(o).on("click",(function(){i={action:"tribe_tickets_rsvp_handle",ticket_id:s,step:"going",nonce:TribeRsvp.nonces.rsvpHandle},tribe.tickets.rsvp.manager.request(i,n)}))}))},e.bindNotGoing=function(n){let i={};const s=n.data("rsvp-id");n.find(e.selectors.notGoingButton).each((function(e,o){t(o).on("click",(function(){i={action:"tribe_tickets_rsvp_handle",ticket_id:s,step:"not-going",nonce:TribeRsvp.nonces.rsvpHandle},tribe.tickets.rsvp.manager.request(i,n)}))}))},e.bindCancel=function(n){let i={};const s=n.data("rsvp-id");n.find(e.selectors.cancelButton).each((function(e,o){t(o).on("click",(function(){confirm(TribeRsvp.cancelText)&&(i={action:"tribe_tickets_rsvp_handle",ticket_id:s,step:null,nonce:TribeRsvp.nonces.rsvpHandle},tribe.tickets.rsvp.manager.request(i,n))}))}))},e.handleDisplayToggle=function(e){e.preventDefault();const n=t(e.target),i=n.data("rsvp-id"),s=n.prop("checked"),o=n.data("attendee-ids"),c=n.data("opt-in-nonce"),r=e.data.container,a={action:"tribe_tickets_rsvp_handle",ticket_id:i,step:"opt-in",opt_in:s,opt_in_nonce:c,attendee_ids:o,nonce:TribeRsvp.nonces.rsvpHandle};tribe.tickets.rsvp.manager.request(a,r)},e.handleSubmission=function(n){n.preventDefault();const i=t(this),s=i.closest(e.selectors.container),o=i.data("rsvp-id"),c=i.serializeArray(),r={action:"tribe_tickets_rsvp_handle",ticket_id:o,step:"success",nonce:TribeRsvp.nonces.rsvpHandle};t(c).each((function(t,e){r[e.name]=e.value})),tribe.tickets.rsvp.manager.request(r,s)},e.bindForm=function(n){n.find(e.selectors.rsvpForm).each((function(n,i){t(i).on("submit",e.handleSubmission)}))},e.bindDisplayToggle=function(t){t.find(e.selectors.displayToggle).on("input",{container:t},e.handleDisplayToggle)},e.unbindEvents=function(t,n,i){const s=t.data.container,o=s.find(e.selectors.goingButton),c=s.find(e.selectors.notGoingButton),r=s.find(e.selectors.cancelButton),a=s.find(e.selectors.rsvpForm),d=s.find(e.selectors.displayToggle);o.off(),c.off(),r.off(),a.off(),d.off()},e.bindEvents=function(t){e.bindGoing(t),e.bindNotGoing(t),e.bindCancel(t),e.bindForm(t),e.bindDisplayToggle(t),t.on("beforeAjaxSuccess.tribeTicketsRsvp",{container:t},e.unbindEvents)},e.init=function(t,n,i){e.bindEvents(i)},e.ready=function(){n.on("afterSetup.tribeTicketsRsvp",tribe.tickets.rsvp.manager.selectors.container,e.init)},t(e.ready)}(jQuery,tribe.tickets.rsvp.block),window.tec=window.tec||{},window.tec.tickets=window.tec.tickets||{},window.tec.tickets.v2=window.tec.tickets.v2||{},window.tec.tickets.v2.rsvpBlock={};