There’s always something different going on at Lodge St. Olaf, and on Friday 28th March they are planning something ‘very’ different they will be hosting a Poker Night in the Lodge Rooms, and up for grabs will be the G.O.A.T trophy. It’s open to anyone, experienced or not, and all of the details, including how to register, can be found below.

Nov 21, 2025

Poker Night - Friday 21st November 2025

November 21, 2025

7:00 pm – 11:55 pm

Lodge St Olaf - Serlad Lane,Cruden Bay

Contact details available upon registration

About The Event

LODGE ST OLAF 1188 PRESENTS: TEXAS HOLD'EM POKER NIGHT!

DO YOU HAVE WHAT IT TAKES TO WIN BIG? Join us on Friday, November 25, 2025, for an electrifying night of Texas Hold’em Poker! Get ready to shuffle up and deal at one of the most thrilling poker events of the year! ⏳ Time: 7:00 PM for a 7:30 PM Start 📍 Location: Lodge St Olaf 1188 💰 Buy-In: £20 Initial – Rebuy-Ins £10 (Limited to Round 1 and First Half of Round 2) 🎭 BONUS PRIZE for Best Vegas-Inspired Outfit!

PROGRAMME OF THE EVENING 🃏 7:15 PM – Player registration, buy-in, and chair assignment. Introduction to the game rules and evening schedule. 🃏 7:30 PM – Round 1 kicks off! Time to test your skills and strategy. 🃏 9:00 PM – Round 1 ends. Take a 30-minute break and prepare for the final showdown! 🃏 9:30 PM – Round 2 begins! Only the sharpest players will make it to the top! 🃏 11:00 PM – Round 2 concludes (subject to player count). 🃏 11:15 PMWINNER PRESENTATION! The best of the best will lift the Greatest Of All Texas Hold’Em (G.O.A.T)! Introducing the G.O.A.T. Trophy – Who Will Claim the Title? With the excitement building for our second Lodge St Olaf Texas Hold’Em Poker Match, we are thrilled to continue our prestigious award: The G.O.A.T. Trophy! This distinguished award will be presented to the G.O.A.T. champion of the night—recognizing the player who outwits, outplays, and outlasts the competition to claim ultimate victory. More than just a trophy, it will be a symbol of skill, strategy, and a little bit of luck! Will you be the first to etch your name into Lodge St Olaf history as our G.O.A.T - Greatest Of All Texas Hold’Em player? There’s only one way to find out - scroll down and register now and take your seat at the table!

PRIZES FOR THE CHAMPIONS! Table A – 1st Prize: £50 – The G.O.A.T.! Table B – 2nd Prize: £25 & a bottle – A strong contender! Table C – 3rd Prize: Bottle – A worthy competitor! Think you’ve got the poker face and the skills to dominate the table? Prove it! Gather your friends, bring your best game, and let’s see who takes home the winnings! ALL IN OR FOLD – THE CHOICE IS YOURS! Secure your spot now by scrolling down and hitting the 'Registration' button – but do it quick as seats are limited! You can also help by 'Buying In' you can do that right now using the 'Buy Now' button.

Event Schedule

9:00 am

Registration & Welcome

Check-in and networking with fellow attendees

📍 Main Hall

10:00 am

Opening Keynote

Welcome address and event overview

👤 Event Host 📍 Main Stage

Organiser

AC

Andrew Crawley

07388018649 | acrawley001@gmail.com

O2

Organizer 2

+11234567890 | abc@gmail.com

Event Partners

Poker Night - Friday 21st November 2025

Complete the steps below to secure your spot.

Total Amount $0.00

${title}

${message}

`; // Find the modal body to insert the success message var $modalBody = $(targetModal).find('.em-modal-body'); if ($modalBody.length > 0) { console.log("✅ Appending success message to modal body"); $modalBody.append(successHtml); } else { console.log("⚠️ Fallback: Appending to target modal"); $(targetModal).append(successHtml); } console.log("✅ Success message displayed (all form content hidden)"); } // Show modal error message by replacing modal content function showModalErrorMessage(title, message) { console.log("❌ showModalErrorMessage called:", title, message); // Prevent any page reloads if (window.event) { window.event.preventDefault(); window.event.stopPropagation(); } // Check if we're in a calendar modal context var inCalendarModal = $('#em-event-modal').length > 0 && $('#em-event-modal').is(':visible'); console.log("🔍 Calendar modal context:", inCalendarModal); if (inCalendarModal) { // If in calendar modal, replace the entire calendar modal content with error message console.log("📅 Replacing calendar modal content with error message"); $('#em-event-modal .em-modal-body').html(`

${title}

${message}

`); } else { // Replace the registration modal body content with error message console.log("📝 Replacing registration modal content with error message"); $('#em-registration-modal-2049 .em-modal-body').html(`

${title}

${message}

`); } console.log("✅ Modal content replaced with error message"); } // Show modal message (success/error) - Keep for backward compatibility function showModalMessage(type, title, message) { console.log("showModalMessage called:", type, title, message); if (type === 'success') { showModalSuccessMessage(title, message); } else { showModalErrorMessage(title, message); } } // Show modal payment section function showModalPaymentSection(bookingId, amount) { console.log("💳 showModalPaymentSection called:", {bookingId, amount}); // SAFETY CHECK: Ensure required variables are available if (typeof $ === 'undefined') { console.error("❌ jQuery not available in showModalPaymentSection"); return; } // Check if we're in a calendar modal context var inCalendarModal = $('#em-event-modal').length > 0 && $('#em-event-modal').is(':visible'); var targetModal = inCalendarModal ? '#em-event-modal' : '#em-registration-modal-2049'; console.log("🔍 Payment section context:", { inCalendarModal: inCalendarModal, targetModal: targetModal, modalExists: $(targetModal).length > 0, modalVisible: $(targetModal).is(':visible') }); // FIXED: Use same approach as single page - append payment section instead of replacing content var paypalEnabled = true; var stripeEnabled = false; var razorpayEnabled = false; var squareEnabled = false; var paymentHtml = ` `; // ENHANCED: Find the registration form with comprehensive debugging console.log("🔍 Searching for registration form in:", targetModal); console.log("🔍 Available forms in modal:", $(targetModal).find('form').map(function() { return this.id || this.className; }).get()); console.log("🔍 Available divs with registration classes:", $(targetModal).find('div[class*="registration"]').map(function() { return this.id || this.className; }).get()); // Try multiple selectors in order of preference var $registrationForm = $(targetModal).find('#em-modal-booking-form-2049'); if ($registrationForm.length === 0) { $registrationForm = $(targetModal).find('#em-booking-form-2049'); } if ($registrationForm.length === 0) { $registrationForm = $(targetModal).find('.em-registration-form'); } if ($registrationForm.length === 0) { $registrationForm = $(targetModal).find('form[id*="booking-form"]'); } if ($registrationForm.length === 0) { $registrationForm = $(targetModal).find('div[id*="registration-form"]'); } if ($registrationForm.length > 0) { console.log("✅ Found registration form:", { selector: $registrationForm.attr('id') || $registrationForm.attr('class'), tagName: $registrationForm.prop('tagName'), isVisible: $registrationForm.is(':visible'), display: $registrationForm.css('display') }); $registrationForm.after(paymentHtml); // ENHANCED: Force hide with multiple methods $registrationForm.hide().addClass('em-hidden').css({ 'display': 'none ', 'visibility': 'hidden' }); console.log("🔒 Registration form hidden:", { isVisible: $registrationForm.is(':visible'), display: $registrationForm.css('display'), hasHiddenClass: $registrationForm.hasClass('em-hidden') }); } else { console.log("❌ Registration form not found, appending to modal body"); console.log("🔍 Modal body content:", $(targetModal + ' .em-modal-body').html().substring(0, 200) + '...'); // Fallback: append to modal body if form not found $(targetModal + ' .em-modal-body').append(paymentHtml); } // ENHANCED: Hide ticket selection and total amount sections when showing payment console.log("🔒 Hiding ticket selection and total amount for payment view"); // Find and hide ticket selection section var $ticketSection = $(targetModal).find('.modal-ticket-checkbox, .ticket-checkbox').closest('div').parent(); $ticketSection.hide().addClass('em-hidden-for-payment'); // Find and hide total amount display var $totalSection = $(targetModal).find('#modal-total-price, #total-price').closest('.em-mb-6'); $totalSection.hide().addClass('em-hidden-for-payment'); // ENHANCED: Hide coupon section (input field, message, and discount display) var $couponSection = $(targetModal).find('#modal-coupon-code-2049, #coupon-code-2049').closest('.em-mb-6'); $couponSection.hide().addClass('em-hidden-for-payment'); console.log("🔒 Coupon section hidden:", $couponSection.length); console.log("✅ Ticket selection and total amount hidden"); console.log("✅ Payment section HTML appended (not replaced)"); // Handle back button with enhanced form restoration $('#em-modal-pay-back-2049').on('click', function() { console.log("🔙 Back button clicked - restoring registration form"); $('#modal-payment-section-2049').remove(); // ENHANCED: Restore form visibility with multiple methods $registrationForm.show().removeClass('em-hidden').css({ 'display': '', 'visibility': 'visible' }); // ENHANCED: Restore ticket selection and total amount visibility $(targetModal).find('.em-hidden-for-payment').show().removeClass('em-hidden-for-payment'); console.log("🔓 Registration form, ticket selection, and total amount restored:", { isVisible: $registrationForm.is(':visible'), display: $registrationForm.css('display'), hasHiddenClass: $registrationForm.hasClass('em-hidden') }); }); // Initialize PayPal buttons for modal if enabled if (paypalEnabled && typeof paypal !== 'undefined') { initializeModalPayPal(bookingId, amount); } // Initialize Stripe for modal if enabled if (stripeEnabled && typeof window.emStripe !== 'undefined') { initializeModalStripe(bookingId, amount); } // Initialize Razorpay for modal if enabled if (razorpayEnabled && typeof Razorpay !== 'undefined') { initializeModalRazorpay(bookingId, amount); } // Initialize Square for modal if enabled if (squareEnabled && typeof Square !== 'undefined' && typeof window.emSquarePayments !== 'undefined') { initializeModalSquare(bookingId, amount); } } // Show payment section with PayPal and Stripe options function showPaymentSection(bookingId, amount) { var stripeEnabled = false; var paymentHtml = `

Complete Your Payment

Total Amount: ` + currencySymbol + amount + `

Choose Payment Method:

` + (paypalEnabled ? `
PayPal
` : '') + ` ` + (stripeEnabled ? `
Stripe
` : '') + `

Processing payment...

`; $('#em-registration-form-2049').after(paymentHtml); $('#em-registration-form-2049').addClass('em-hidden'); // Initialize PayPal buttons if enabled var paypalEnabled = true; if (paypalEnabled && typeof paypal !== 'undefined') { initializePayPal(bookingId, amount); } // Initialize Stripe if enabled if (stripeEnabled && typeof window.emStripe !== 'undefined') { initializeStripe(bookingId, amount); } // Initialize Razorpay if enabled var razorpayEnabled = false; if (razorpayEnabled && typeof Razorpay !== 'undefined') { initializeRazorpay(bookingId, amount); } // Initialize Square if enabled var squareEnabled = false; if (squareEnabled && typeof Square !== 'undefined' && typeof window.emSquarePayments !== 'undefined') { initializeSquare(bookingId, amount); } // Handle back button $('#em-pay-back-2049').on('click', function() { $('#payment-section-2049').remove(); $('#em-registration-form-2049').removeClass('em-hidden'); }); } // Initialize PayPal payment function initializePayPal(bookingId, amount) { if (typeof paypal === 'undefined') { console.error('PayPal SDK not loaded'); alert('PayPal is not available. Please refresh the page and try again.'); $('#payment-section-2049').remove(); $('#em-registration-form-2049').removeClass('em-hidden'); return; } paypal.Buttons({ createOrder: function(data, actions) { return actions.order.create({ purchase_units: [{ amount: { value: amount, currency_code: 'USD' }, description: "Poker Night - Friday 21st November 2025" }] }); }, onApprove: function(data, actions) { $('#payment-loading-2049').removeClass('em-hidden'); return actions.order.capture().then(function(details) { console.log('PayPal payment details:', details); // Send payment data to server $.post(ajaxUrl, { action: 'em_capture_payment', txn_id: details.purchase_units[0].payments.captures[0].id, mc_gross: details.purchase_units[0].payments.captures[0].amount.value, payment_gross: details.purchase_units[0].payments.captures[0].amount.value, payer_status: details.status, payment_status: details.status, payment_date: details.purchase_units[0].payments.captures[0].create_time, mc_currency: details.purchase_units[0].payments.captures[0].amount.currency_code, payer_email: details.payer.email_address, payer_name: details.payer.name.given_name + ' ' + details.payer.name.surname, order_id: data.orderID, payer_id: data.payerID, amount: amount, event_id: 2049, booking_id: bookingId }, function(response) { $('#payment-loading-2049').addClass('em-hidden'); console.log("Payment response:", response); if (response.success) { // Show success message showBookingSuccess(); $('#payment-section-2049').remove(); // Don't disable button - allow multiple bookings } else { alert('Payment failed. Please try again.'); } }).fail(function(xhr, status, error) { $('#payment-loading-2049').addClass('em-hidden'); console.error("Payment AJAX Error:", status, error); alert('Payment processing failed. Please try again.'); }); }); }, onCancel: function() { alert('Payment was cancelled.'); }, onError: function(err) { console.error("PayPal error:", err); alert('Something went wrong. Please try again.'); } }).render('#paypal-button-container-2049'); } // Initialize PayPal payment for modal function initializeModalPayPal(bookingId, amount) { if (typeof paypal === 'undefined') { console.error('PayPal SDK not loaded'); showModalMessage('error', 'Payment Error', 'PayPal is not available. Please refresh the page and try again.'); return; } paypal.Buttons({ createOrder: function(data, actions) { return actions.order.create({ purchase_units: [{ amount: { value: amount, currency_code: 'USD' }, description: "Poker Night - Friday 21st November 2025" }] }); }, onApprove: function(data, actions) { $('#modal-payment-loading-2049').removeClass('em-hidden'); return actions.order.capture().then(function(details) { console.log('PayPal payment details:', details); // Add timeout to prevent infinite loading var paymentTimeout = setTimeout(function() { console.log("Payment processing timeout"); $('#modal-payment-loading-2049').addClass('em-hidden'); showModalErrorMessage('Payment Timeout', 'Payment processing timed out. Please check your booking status.'); }, 30000); // 30 second timeout // Send payment data to server $.post(ajaxUrl, { action: 'em_capture_payment', txn_id: details.purchase_units[0].payments.captures[0].id, mc_gross: details.purchase_units[0].payments.captures[0].amount.value, payment_gross: details.purchase_units[0].payments.captures[0].amount.value, payer_status: details.status, payment_status: details.status, payment_date: details.purchase_units[0].payments.captures[0].create_time, mc_currency: details.purchase_units[0].payments.captures[0].amount.currency_code, payer_email: details.payer.email_address, payer_name: details.payer.name.given_name + ' ' + details.payer.name.surname, order_id: data.orderID, payer_id: data.payerID, amount: amount, event_id: 2049, booking_id: bookingId }, function(response) { clearTimeout(paymentTimeout); console.log("Modal PayPal success callback triggered"); console.log("Payment response:", response); $('#modal-payment-loading-2049').addClass('em-hidden'); if (response.success) { console.log("🎉 Payment successful, showing success message"); // FIXED: Remove payment section and show success message (like single page version) $('#modal-payment-section-2049').remove(); // Show success message in the modal showModalSuccessMessage('Payment Successful!', 'Your booking has been confirmed and you will receive a confirmation email shortly.'); // Don't disable button - allow multiple bookings console.log("✅ Payment section removed and success message displayed"); } else { console.log("❌ Payment failed, showing error message"); showModalErrorMessage('Payment Failed', 'Payment failed. Please try again.'); } }).fail(function(xhr, status, error) { clearTimeout(paymentTimeout); console.log("Modal PayPal AJAX failed"); $('#modal-payment-loading-2049').addClass('em-hidden'); console.error("Payment AJAX Error:", status, error); showModalErrorMessage('Payment Error', 'Payment processing failed. Please try again.'); }); }); }, onCancel: function() { showModalErrorMessage('Payment Cancelled', 'Payment was cancelled.'); }, onError: function(err) { console.error("PayPal error:", err); showModalErrorMessage('Payment Error', 'Something went wrong. Please try again.'); } }).render('#modal-paypal-button-container-2049'); } // Initialize Stripe payment for inline form function initializeStripe(bookingId, amount) { if (typeof window.emStripe === 'undefined') { console.error('Stripe.js not loaded'); return; } console.log('🔧 Initializing Stripe Elements for inline form'); // Create Stripe Elements instance var elements = window.emStripe.elements(); // Create card element with styling var cardElement = elements.create('card', { style: { base: { fontSize: '16px', color: '#32325d', fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', lineHeight: '24px', '::placeholder': { color: '#aab7c4' } }, invalid: { color: '#fa755a', iconColor: '#fa755a' } }, hidePostalCode: false }); // Mount card element to the DOM cardElement.mount('#stripe-card-element-2049'); // Handle real-time validation errors cardElement.on('change', function(event) { var displayError = $('#stripe-card-errors-2049'); if (event.error) { displayError.text(event.error.message).removeClass('em-hidden'); } else { displayError.text('').addClass('em-hidden'); } }); // Handle form submission $('#stripe-pay-button-2049').on('click', function() { var button = $(this); button.prop('disabled', true).html('Processing...'); $('#payment-loading-2049').removeClass('em-hidden'); // Create payment intent $.post(ajaxUrl, { action: 'em_create_stripe_payment_intent', booking_id: bookingId, amount: amount, event_id: 2049 }, function(response) { if (response.success) { console.log('✅ Payment intent created:', response.data.payment_intent_id); // Confirm payment with card element window.emStripe.confirmCardPayment(response.data.client_secret, { payment_method: { card: cardElement } }).then(function(result) { if (result.error) { console.error('❌ Stripe payment error:', result.error); $('#payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Card'); var displayError = $('#stripe-card-errors-2049'); displayError.text(result.error.message).removeClass('em-hidden'); } else { console.log('✅ Payment confirmed:', result.paymentIntent.id); // Payment succeeded, capture on server $.post(ajaxUrl, { action: 'em_capture_stripe_payment', payment_intent_id: result.paymentIntent.id, booking_id: bookingId, event_id: 2049, amount: amount }, function(captureResponse) { $('#payment-loading-2049').addClass('em-hidden'); if (captureResponse.success) { console.log('✅ Payment captured successfully'); $('#payment-section-2049').remove(); showBookingSuccess(); } else { console.error('❌ Payment capture failed'); button.prop('disabled', false).html('Pay with Card'); alert('Payment processing failed. Please try again.'); } }).fail(function() { $('#payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Card'); alert('Payment processing failed. Please try again.'); }); } }); } else { console.error('❌ Failed to create payment intent'); $('#payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Card'); alert('Failed to initialize payment. Please try again.'); } }).fail(function() { $('#payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Card'); alert('Failed to initialize payment. Please try again.'); }); }); } // Initialize Stripe payment for modal function initializeModalStripe(bookingId, amount) { if (typeof window.emStripe === 'undefined') { console.error('Stripe.js not loaded'); return; } console.log('🔧 Initializing Stripe Elements for modal'); // Create Stripe Elements instance var elements = window.emStripe.elements(); // Create card element with styling var cardElement = elements.create('card', { style: { base: { fontSize: '16px', color: '#32325d', fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', lineHeight: '24px', '::placeholder': { color: '#aab7c4' } }, invalid: { color: '#fa755a', iconColor: '#fa755a' } }, hidePostalCode: false }); // Mount card element to the DOM cardElement.mount('#modal-stripe-card-element-2049'); // Handle real-time validation errors cardElement.on('change', function(event) { var displayError = $('#modal-stripe-card-errors-2049'); if (event.error) { displayError.text(event.error.message).removeClass('em-hidden'); } else { displayError.text('').addClass('em-hidden'); } }); // Handle form submission $('#modal-stripe-pay-button-2049').on('click', function() { var button = $(this); button.prop('disabled', true).html('Processing...'); $('#modal-payment-loading-2049').removeClass('em-hidden'); // Create payment intent $.post(ajaxUrl, { action: 'em_create_stripe_payment_intent', booking_id: bookingId, amount: amount, event_id: 2049 }, function(response) { if (response.success) { console.log('✅ Payment intent created:', response.data.payment_intent_id); // Confirm payment with card element window.emStripe.confirmCardPayment(response.data.client_secret, { payment_method: { card: cardElement } }).then(function(result) { if (result.error) { console.error('❌ Stripe payment error:', result.error); $('#modal-payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Card'); var displayError = $('#modal-stripe-card-errors-2049'); displayError.text(result.error.message).removeClass('em-hidden'); showModalErrorMessage('Payment Failed', result.error.message); } else { console.log('✅ Payment confirmed:', result.paymentIntent.id); // Payment succeeded, capture on server $.post(ajaxUrl, { action: 'em_capture_stripe_payment', payment_intent_id: result.paymentIntent.id, booking_id: bookingId, event_id: 2049, amount: amount }, function(captureResponse) { $('#modal-payment-loading-2049').addClass('em-hidden'); if (captureResponse.success) { console.log('✅ Payment captured successfully'); $('#modal-payment-section-2049').remove(); showModalSuccessMessage('Booking Confirmed!', 'Your payment was successful! You will receive a confirmation email shortly.'); } else { console.error('❌ Payment capture failed'); button.prop('disabled', false).html('Pay with Card'); showModalErrorMessage('Payment Error', 'Payment processing failed. Please try again.'); } }).fail(function() { $('#modal-payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Card'); showModalErrorMessage('Payment Error', 'Payment processing failed. Please try again.'); }); } }); } else { console.error('❌ Failed to create payment intent'); $('#modal-payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Card'); showModalErrorMessage('Payment Error', 'Failed to initialize payment. Please try again.'); } }).fail(function() { $('#modal-payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Card'); showModalErrorMessage('Payment Error', 'Failed to initialize payment. Please try again.'); }); }); } // Show booking success message function showBookingSuccess() { var successHtml = `

Booking Confirmed!

Your ticket has been booked successfully!

You will receive a confirmation email shortly.

`; $('#em-registration-form-2049').after(successHtml); // Handle close button - reset form for new booking $('#close-success-2049').on('click', function() { console.log("🔄 Resetting form for new booking"); // Remove success message $('#booking-success-2049').remove(); // Show registration form again $('#em-registration-form-2049').removeClass('em-hidden').show(); // Reset the form $('#em-registration-form-2049')[0].reset(); // Uncheck all tickets $('.ticket-checkbox').prop('checked', false); // Reset total price $('#total-price').text('0'); // Re-enable registration button $('#em-show-registration-2049').text('Register Now').prop('disabled', false); console.log("✅ Form reset for new booking"); }); } // FIXED: Use event delegation for dynamically inserted close button (MOVED INSIDE DOCUMENT READY) $(document).off('click.successClose').on('click.successClose', '#em-success-close-2049, #modal-success-close-2049', function() { console.log("🚪 Success close button clicked"); var inCalendarModal = $('#em-event-modal').length > 0 && $('#em-event-modal').is(':visible'); if (inCalendarModal) { console.log("📅 Closing calendar modal and resetting form"); // Remove success message $('#modal-success-message-2049').remove(); // Show all hidden form elements $('#em-event-modal').find('#modal-payment-section-2049').show(); $('#em-event-modal').find('#em-modal-booking-form-2049, #em-booking-form-2049, .em-registration-form').show(); $('#em-event-modal').find('.modal-ticket-checkbox, .ticket-checkbox').closest('div').parent().show(); $('#em-event-modal').find('#modal-total-price, #total-price').closest('.em-mb-6').show(); $('#em-event-modal').find('label[for^="modal-ticket-"], label[for^="ticket-"]').parent().show(); // Reset form $('#em-modal-booking-form-2049')[0].reset(); $('#em-booking-form-2049')[0].reset(); // Uncheck all tickets $('.modal-ticket-checkbox').prop('checked', false); // Reset total price $('#modal-total-price').text('0'); // Re-enable registration button $('#em-show-registration-modal-2049').text('Register Now').prop('disabled', false); // Close modal $('#em-event-modal').addClass('em-hidden').hide(); console.log("✅ Calendar modal form reset and closed"); } else { console.log("📝 Closing registration modal"); $('#em-registration-modal-2049').addClass('em-hidden'); } $('body, html').removeClass('em-modal-open'); console.log("✅ Modal closed successfully"); }); // ==================== RAZORPAY PAYMENT FUNCTIONS ==================== // Initialize Razorpay payment for inline form function initializeRazorpay(bookingId, amount) { if (typeof Razorpay === 'undefined') { console.error('Razorpay SDK not loaded'); alert('Razorpay is not available. Please refresh the page and try again.'); return; } console.log('🔧 Initializing Razorpay for inline form'); $('#razorpay-pay-button-2049').on('click', function() { var button = $(this); button.prop('disabled', true).html('Processing...'); $('#payment-loading-2049').removeClass('em-hidden'); // Create Razorpay order $.post(ajaxUrl, { action: 'em_create_razorpay_order', booking_id: bookingId, amount: amount, event_id: 2049 }, function(response) { if (response.success) { console.log('✅ Razorpay order created:', response.data.order_id); var options = { key: response.data.key_id, amount: response.data.amount, currency: response.data.currency, order_id: response.data.order_id, name: 'Lodge St Olaf', description: 'Event Booking Payment', handler: function(razorpayResponse) { console.log('✅ Razorpay payment successful:', razorpayResponse); // Verify payment $.post(ajaxUrl, { action: 'em_verify_razorpay_payment', razorpay_payment_id: razorpayResponse.razorpay_payment_id, razorpay_order_id: razorpayResponse.razorpay_order_id, razorpay_signature: razorpayResponse.razorpay_signature, booking_id: bookingId, amount: amount }, function(verifyResponse) { $('#payment-loading-2049').addClass('em-hidden'); if (verifyResponse.success) { console.log('✅ Payment verified successfully'); $('#payment-section-2049').remove(); showBookingSuccess(); } else { console.error('❌ Payment verification failed'); button.prop('disabled', false).html('Pay with Razorpay'); alert('Payment verification failed. Please contact support.'); } }).fail(function() { $('#payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Razorpay'); alert('Payment verification failed. Please try again.'); }); }, modal: { ondismiss: function() { console.log('Razorpay payment cancelled'); $('#payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Razorpay'); } }, theme: { color: '#4F46E5' } }; var rzp = new Razorpay(options); rzp.open(); } else { console.error('❌ Failed to create Razorpay order'); $('#payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Razorpay'); alert('Failed to initialize payment. Please try again.'); } }).fail(function() { $('#payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Razorpay'); alert('Failed to initialize payment. Please try again.'); }); }); } // Initialize Razorpay payment for modal function initializeModalRazorpay(bookingId, amount) { if (typeof Razorpay === 'undefined') { console.error('Razorpay SDK not loaded'); showModalMessage('error', 'Payment Error', 'Razorpay is not available. Please refresh the page and try again.'); return; } console.log('🔧 Initializing Razorpay for modal'); $('#modal-razorpay-pay-button-2049').on('click', function() { var button = $(this); button.prop('disabled', true).html('Processing...'); $('#modal-payment-loading-2049').removeClass('em-hidden'); // Create Razorpay order $.post(ajaxUrl, { action: 'em_create_razorpay_order', booking_id: bookingId, amount: amount, event_id: 2049 }, function(response) { if (response.success) { console.log('✅ Razorpay order created:', response.data.order_id); var options = { key: response.data.key_id, amount: response.data.amount, currency: response.data.currency, order_id: response.data.order_id, name: 'Lodge St Olaf', description: 'Event Booking Payment', handler: function(razorpayResponse) { console.log('✅ Razorpay payment successful:', razorpayResponse); // Verify payment $.post(ajaxUrl, { action: 'em_verify_razorpay_payment', razorpay_payment_id: razorpayResponse.razorpay_payment_id, razorpay_order_id: razorpayResponse.razorpay_order_id, razorpay_signature: razorpayResponse.razorpay_signature, booking_id: bookingId, amount: amount }, function(verifyResponse) { $('#modal-payment-loading-2049').addClass('em-hidden'); if (verifyResponse.success) { console.log('✅ Payment verified successfully'); $('#modal-payment-section-2049').remove(); showModalSuccessMessage('Payment Successful!', 'Your booking has been confirmed and you will receive a confirmation email shortly.'); } else { console.error('❌ Payment verification failed'); button.prop('disabled', false).html('Pay with Razorpay'); showModalErrorMessage('Payment Error', 'Payment verification failed. Please contact support.'); } }).fail(function() { $('#modal-payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Razorpay'); showModalErrorMessage('Payment Error', 'Payment verification failed. Please try again.'); }); }, modal: { ondismiss: function() { console.log('Razorpay payment cancelled'); $('#modal-payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Razorpay'); } }, theme: { color: '#4F46E5' } }; var rzp = new Razorpay(options); rzp.open(); } else { console.error('❌ Failed to create Razorpay order'); $('#modal-payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Razorpay'); showModalErrorMessage('Payment Error', 'Failed to initialize payment. Please try again.'); } }).fail(function() { $('#modal-payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Razorpay'); showModalErrorMessage('Payment Error', 'Failed to initialize payment. Please try again.'); }); }); } // ==================== SQUARE PAYMENT FUNCTIONS ==================== // Initialize Square payment for inline form async function initializeSquare(bookingId, amount) { // Check if we're on HTTP (not HTTPS) if (window.location.protocol === 'http:') { console.error('Square requires HTTPS'); var $button = $('#square-pay-button-2049'); $button.prop('disabled', true).html('HTTPS Required'); $('#square-card-errors-2049').html('Square requires HTTPS (secure connection). Please enable SSL in Local by Flywheel. Learn how').removeClass('em-hidden'); return; } if (typeof Square === 'undefined' || typeof window.emSquarePayments === 'undefined') { console.error('Square SDK not loaded'); alert('Square is not available. Please refresh the page and try again.'); return; } console.log('🔧 Initializing Square for inline form'); // Disable button initially var $button = $('#square-pay-button-2049'); $button.prop('disabled', true).html('Loading...'); try { // Create card payment method const card = await window.emSquarePayments.card(); await card.attach('#square-card-container-2049'); console.log('✅ Square card input attached successfully'); // Enable button after card is ready $button.prop('disabled', false).html('Pay with Square'); // Handle card errors card.addEventListener('errorClassAdded', (event) => { console.error('Square card error:', event); $('#square-card-errors-2049').text('Please check your card details').removeClass('em-hidden'); }); card.addEventListener('errorClassRemoved', () => { $('#square-card-errors-2049').text('').addClass('em-hidden'); }); // Handle payment button click $('#square-pay-button-2049').on('click', async function() { var button = $(this); button.prop('disabled', true).html('Processing...'); $('#payment-loading-2049').removeClass('em-hidden'); try { // Tokenize card const result = await card.tokenize(); if (result.status === 'OK') { console.log('✅ Square card tokenized:', result.token); // Process payment $.post(ajaxUrl, { action: 'em_create_square_payment', source_id: result.token, booking_id: bookingId, amount: amount, event_id: 2049 }, function(response) { $('#payment-loading-2049').addClass('em-hidden'); if (response.success) { console.log('✅ Square payment successful'); $('#payment-section-2049').remove(); showBookingSuccess(); } else { console.error('❌ Square payment failed:', response.data.message); button.prop('disabled', false).html('Pay with Square'); alert(response.data.message || 'Payment failed. Please try again.'); } }).fail(function() { $('#payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Square'); alert('Payment processing failed. Please try again.'); }); } else { console.error('Square tokenization failed:', result.errors); $('#payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Square'); let errorMessage = 'Card validation failed. Please check your card details.'; if (result.errors && result.errors.length > 0) { errorMessage = result.errors[0].message; } $('#square-card-errors-2049').text(errorMessage).removeClass('em-hidden'); } } catch (error) { console.error('Square payment error:', error); $('#payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Square'); alert('Payment processing failed. Please try again.'); } }); } catch (error) { console.error('Square initialization error:', error); $button.prop('disabled', false).html('Initialization Failed'); $('#square-card-errors-2049').text('Failed to initialize Square payment. Please refresh the page.').removeClass('em-hidden'); } } // Initialize Square payment for modal async function initializeModalSquare(bookingId, amount) { // Check if we're on HTTP (not HTTPS) if (window.location.protocol === 'http:') { console.error('Square requires HTTPS'); var $button = $('#modal-square-pay-button-2049'); $button.prop('disabled', true).html('HTTPS Required'); $('#modal-square-card-errors-2049').html('Square requires HTTPS (secure connection). Please enable SSL in Local by Flywheel. Learn how').removeClass('em-hidden'); return; } if (typeof Square === 'undefined' || typeof window.emSquarePayments === 'undefined') { console.error('Square SDK not loaded'); showModalMessage('error', 'Payment Error', 'Square is not available. Please refresh the page and try again.'); return; } console.log('🔧 Initializing Square for modal'); // Disable button initially var $button = $('#modal-square-pay-button-2049'); $button.prop('disabled', true).html('Loading...'); try { // Create card payment method const card = await window.emSquarePayments.card(); await card.attach('#modal-square-card-container-2049'); console.log('✅ Square card input attached successfully'); // Enable button after card is ready $button.prop('disabled', false).html('Pay with Square'); // Handle card errors card.addEventListener('errorClassAdded', (event) => { console.error('Square card error:', event); $('#modal-square-card-errors-2049').text('Please check your card details').removeClass('em-hidden'); }); card.addEventListener('errorClassRemoved', () => { $('#modal-square-card-errors-2049').text('').addClass('em-hidden'); }); // Handle payment button click $('#modal-square-pay-button-2049').on('click', async function() { var button = $(this); button.prop('disabled', true).html('Processing...'); $('#modal-payment-loading-2049').removeClass('em-hidden'); try { // Tokenize card const result = await card.tokenize(); if (result.status === 'OK') { console.log('✅ Square card tokenized:', result.token); // Process payment $.post(ajaxUrl, { action: 'em_create_square_payment', source_id: result.token, booking_id: bookingId, amount: amount, event_id: 2049 }, function(response) { $('#modal-payment-loading-2049').addClass('em-hidden'); if (response.success) { console.log('✅ Square payment successful'); $('#modal-payment-section-2049').remove(); showModalSuccessMessage('Payment Successful!', 'Your booking has been confirmed and you will receive a confirmation email shortly.'); } else { console.error('❌ Square payment failed:', response.data.message); button.prop('disabled', false).html('Pay with Square'); showModalErrorMessage('Payment Error', response.data.message || 'Payment failed. Please try again.'); } }).fail(function() { $('#modal-payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Square'); showModalErrorMessage('Payment Error', 'Payment processing failed. Please try again.'); }); } else { console.error('Square tokenization failed:', result.errors); $('#modal-payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Square'); let errorMessage = 'Card validation failed. Please check your card details.'; if (result.errors && result.errors.length > 0) { errorMessage = result.errors[0].message; } $('#modal-square-card-errors-2049').text(errorMessage).removeClass('em-hidden'); } } catch (error) { console.error('Square payment error:', error); $('#modal-payment-loading-2049').addClass('em-hidden'); button.prop('disabled', false).html('Pay with Square'); showModalErrorMessage('Payment Error', 'Payment processing failed. Please try again.'); } }); } catch (error) { console.error('Square initialization error:', error); $button.prop('disabled', false).html('Initialization Failed'); $('#modal-square-card-errors-2049').text('Failed to initialize Square payment. Please refresh the page.').removeClass('em-hidden'); } } });

Copyright © 2025 April | Powered by Astra WordPress Theme

Buy In Now for £20

blackmask