PageSourceSearch

https://queeraffirmingkc.com/wp-content/plugins/wp-event-manager-r…/registration-frontend.min.js?m=1772235245

js queeraffirmingkc.com collected 2026-10-09 17:52:36 UTC 72,056 bytes, 1,801 lines download raw bytes

1var FrontendRegistration = function () {
2	let currentDate = new Date();
3    let eventStartDate = null;
4    let eventEndDate = null;
5    return {
6        init: function () {
7			
8			FrontendRegistration.actions.initCalendar();
9			
10			if(jQuery(".wpem-matchmaking-chat-container").length) {
11				 var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
12        		 var receiver_id = results ? decodeURIComponent(results[1]) : null;
13				 if (receiver_id) {
14					// Wait for UI to load
15					setTimeout(function () {
16						var $chatItem = jQuery('.wpem-matchmaking-chat-user-list-item[data-receiver-id="' + receiver_id + '"]');
17						if ($chatItem.length) {
18							$chatItem.trigger('click');
19						} else {
20							console.warn('Chat user not found for receiver_id:', receiver_id);
21						}
22					}, 800); // Adjust delay if needed
23				}
24			}
25			FrontendRegistration.actions.ToggleMeetingAvailabilityTimeSlots();
26			jQuery('#available_for_meeting').on("change", function(e) {
27				FrontendRegistration.actions.ToggleMeetingAvailabilityTimeSlots();	
28			});
29            jQuery(document).on("click", ".tickets_checkin",FrontendRegistration.actions.updateCheckin), jQuery(document).on("click", ".tickets_uncheckin", FrontendRegistration.actions.updateCheckin);
30            jQuery(document).on("click", '.wp-view-registration-btn', function(e) {
31                e.preventDefault();
32                var event_id = jQuery(this).attr('id');
33                localStorage.setItem('current_event_id', event_id);
34                FrontendRegistration.actions.getAttendees(event_id, 1, true);
35            });
36            jQuery('body').on('click', '.event-manager-remove-uploaded-file', function () {
37                jQuery(this).closest('.event-manager-uploaded-file').remove();
38                return false;
39            });
40            jQuery('div.date-rule input[data-picker="datepicker"]').datepicker({
41                minDate: null,
42            });
43
44            jQuery(document).on("click", ".wpem-attendee-modal-content .wpem-filter-submit .button-filter", function(e) {
45                e.preventDefault();
46                var event_id = localStorage.getItem('current_event_id');
47                FrontendRegistration.actions.getAttendees(event_id, 1, false);
48            });
49            jQuery('.modal-toggle').on("click", function(e) {
50                e.preventDefault();
51                jQuery('.wpem-attendee-modal').addClass('wpem-modal-open');
52            });
53            jQuery(document).on("click", ".wpem-attendee-modal-content .wpem-filter-submit .button-reset", function(e) {
54                e.preventDefault();
55                var event_id = localStorage.getItem('current_event_id');
56                jQuery(".registration_byname").val("");
57                jQuery(".registration_status").val("").trigger("change");
58                jQuery(".attendee_status").val("").trigger("change");
59                jQuery(".registration_orderby").val("").trigger("change");
60                FrontendRegistration.actions.getAttendees(event_id);
61            });
62            jQuery(document).on("click", ".wpem-registrations-pagination .wpem-pagination-link", function(e) {
63                e.preventDefault();
64                var page = jQuery(this).data("paged");
65                jQuery(".wpem-registrations-pagination .wpem-pagination-link").removeClass('active disabled');
66                jQuery(this).addClass('active disabled');
67                var event_id = localStorage.getItem('current_event_id');
68                FrontendRegistration.actions.getAttendees(event_id, page);
69            });
70            // Handle form profile create submission via AJAX
71            jQuery(document).on("submit", "#submit-match-making-form", function (e) {
72                e.preventDefault(); 
73                FrontendRegistration.actions.submitProfileForm();
74            });
75			// Match making atendee list filter 
76            jQuery(document).on("submit", "#matchmaking-filter-form", function (e) {
77				e.preventDefault();
78				FrontendRegistration.actions.filterAttendees(1,'all');
79			});
80			// Reset Filters for Match making attendee lists
81			jQuery('.wpem-matchmaking-filter-reset-action').hide();
82			jQuery('.wpem-matchmaking-filter-reset-action').click(function (e) {
83                 e.preventDefault();
84    
85				jQuery('#matchmaking-filter-form')[0].reset();
86				jQuery('#search_matchmaking_country, #user_interests, #user_skills').trigger('chosen:updated');
87	
88				FrontendRegistration.actions.filterAttendees(1,'all');
89			});
90            //Message button on Match Making attendee list 
91			jQuery(document).on("click", '.wpme-chat-button', function() {
92				
93				var $btn = jQuery(this);
94				var username = $btn.data('user-name');
95				var userid = $btn.data('reciever-user-id');
96				var user_email = $btn.data('user-email');
97				jQuery('#conversation-info-popup').removeClass('wpem-modal-open');
98
99				jQuery('.chat_email_msg').html("");
100				jQuery("#submit-match-making-contact-form")[0].reset();
101
102				// Check via AJAX if conversation exists
103				jQuery.ajax({
104					type: 'POST',
105					url: wpem_registrations_frontend.ajaxUrl,
106					data: {
107						action: 'wpem_chat_conversation_exists',
108						receiver_id: userid,
109						wpem_nonce: wpem_registrations_frontend.nonce,
110					},
111					success: function (response) {
112						if (response.success && response.data.exists) {
113							var redirectUrl = window.location.origin + window.location.pathname+'/?tab=chats';
114							window.location.href = redirectUrl;
115						} else {
116							// No conversation: open contact modal
117							jQuery('.wpem-modal-header-title-text').text("Send Message " + username);
118							jQuery('.user_chat_email').val(user_email);
119							jQuery('.message_reciever_user_id').val(userid);
120							jQuery('.attendee_chat_btn').addClass('wpem-modal-open');
121						}
122					}
123				});
124			});
125			if (window.location.search.indexOf('tab=chats') !== -1) {
126				setTimeout(function() {
127					var $firstItem = jQuery('.wpem-matchmaking-chat-user-list .wpem-matchmaking-chat-user-list-item').first();
128					if ($firstItem.length) {
129						$firstItem.trigger('click');
130					}
131				}, 2000); // 2 seconds delay
132			}
133			//Contact Form Submission to send email notification
134			jQuery(document).on("submit", "#submit-match-making-contact-form", function (e) {
135				e.preventDefault();
136				FrontendRegistration.actions.ChatMessageFormSubmission();
137			});
138			// Create Meeting popup modal open
139			jQuery(document).on("click", '#wpem_add_meeting_participant', function() {
140				const userId = jQuery(this).data('user-id').toString();
141				const userName = jQuery(this).data('user-name');
142				const userPhoto = jQuery(this).data('profile-pic');
143
144				// Prevent duplicate
145				if (!selectedParticipants.includes(userId)) {
146					selectedParticipants.push(userId);
147					jQuery('#selected_participant_ids').val(selectedParticipants.join(','));
148
149					const avatarHtml = ` 
150						<div class="wpem-meeting-schedule-participant-avatar" data-user-id="${userId}">
151							<img class="wpem-active-participant" src="${userPhoto}" alt="${userName}" title="${userName}">
152							<span class="wpem-remove-participant-meeting"><i class="wpem-icon-close"></i></span>
153						</div>`;
154					jQuery(avatarHtml).insertBefore('.wpem-meeting-schedule-add-participant');
155				}
156
157				// Set participant details in modal
158				jQuery('#participant-name').text(userName);
159				jQuery('.wpem-meeting-schedule-participant-name').text(userName);
160				jQuery('#meeting-request-popup').addClass('wpem-modal-open');
161				jQuery('#conversation-info-popup').removeClass('wpem-modal-open');
162			});
163
164			// add selected participant at meeting create button time
165			jQuery(document).on("click", '#wpem_meeting_participant', function() {
166				// if popup already open of selected participant then return
167				if(jQuery('#conversation-info-popup').hasClass('wpem-modal-open')){
168					jQuery('#conversation-info-popup').removeClass('wpem-modal-open');
169				}
170
171				const userId = jQuery(this).data('user-id').toString();
172    			const userName = jQuery(this).data('user-name');
173    			const userPhoto = jQuery(this).data('profile-pic');
174				selectedParticipants.push(userId);
175				jQuery('#selected_participant_ids').val(selectedParticipants);
176				// Remove any existing participant avatar
177				jQuery('.wpem-meeting-schedule-participant-avatar').remove();
178
179				const avatarHtml = ` 
180					<div class="wpem-meeting-schedule-participant-avatar" data-user-id="${userId}">
181						<img class="wpem-active-participant" src="${userPhoto}" alt="${userName}" title="${userName}">
182						<span class="wpem-remove-participant-meeting"><i class="wpem-icon-close"></i></span>
183					</div>`;
184
185				// Insert new one
186				jQuery(avatarHtml).insertBefore('.wpem-meeting-schedule-add-participant');
187
188				// Modal updates
189				jQuery('#participant-name').text(userName);
190				jQuery('.wpem-meeting-schedule-participant-name').text(userName);
191				jQuery('#meeting-request-popup').addClass('wpem-modal-open');
192			});
193			
194			// Approve-Disapprove button
195			jQuery(document).on("click", ".approve-attendee-btn", function() {
196				var id = jQuery(this).data('id');
197				FrontendRegistration.actions.AttendeeVisibilityApproved(id);
198			});
199			// 0 count user message 
200			if(jQuery('.wpem-matchmaking-filter-show-results').text() == '0 Results'){
201				jQuery('.matchmaking-list').html('<div><p class="event-manager-message wpem-alert wpem-alert-danger wpem-text-center"><i class="wpem-icon-user-check"></i> We don’t have any attendees to show right now</p></div>');
202			}
203			if (jQuery('.wpem-matchmaking-container').length) {
204				jQuery('body').addClass('matchmaking-page');
205			}
206
207           // Numbered page buttons
208            jQuery(document).on('click', '.pagination-number', function (e) {
209                e.preventDefault();
210                const page = parseInt(jQuery(this).data('page'));
211				const selectedTab = jQuery('.wpem-matchmaking-tab.active').data('tab') || 'all';
212                FrontendRegistration.actions.filterAttendees(page,selectedTab);
213            });
214
215            jQuery(document).on('click', '.pagination-prev', function (e) {
216				e.preventDefault();
217				let current = parseInt(jQuery('.matchmaking-pagination').data('current'));
218				const selectedTab = jQuery('.wpem-matchmaking-tab.active').data('tab') || 'all';
219				if (current > 1) {
220					FrontendRegistration.actions.filterAttendees(current - 1, selectedTab);
221				}
222			});
223
224			jQuery(document).on('click', '.pagination-next', function (e) {
225				e.preventDefault();
226				let current = parseInt(jQuery('.matchmaking-pagination').data('current'));
227				let total = jQuery('.pagination-number').length;
228				const selectedTab = jQuery('.wpem-matchmaking-tab.active').data('tab') || 'all';
229				if (current < total) {
230					FrontendRegistration.actions.filterAttendees(current + 1, selectedTab);
231				}
232			});
233			// Intial pagination 
234			totalPages = parseInt(jQuery('.wpem-matchmaking-pagination').data('maxpages'));
235			if (totalPages > 1) {
236				var paginationHtml = FrontendRegistration.actions.generatePagination(totalPages, 1);
237				jQuery('.wpem-matchmaking-pagination').html(paginationHtml).show();
238			} else {
239				jQuery('.wpem-matchmaking-pagination').empty().hide(); // Hide if only one page
240			}
241			// Add active to "All" tab only if none is already active
242			if (jQuery('.wpem-matchmaking-tab.active').length === 0) {
243				jQuery('.wpem-matchmaking-tab.all').addClass('active');
244			}
245	
246			//Chat tab click handle
247			jQuery(document).on('click', '.wpem-matchmaking-chat-user-list-item', function () {
248				FrontendRegistration.actions.GetChatConversation(jQuery(this), true);
249			});
250			// send message button in single chat section 
251			jQuery(document).on('click', '.wpem-matchmaking-chat-send-message-btn', function(){
252				FrontendRegistration.actions.ChatSendMessageBtn();
253			});
254			// meeting edit popup
255			jQuery(document).on('click', '.wpem-meeting-menu-btn', function(e) {
256				e.preventDefault();
257				e.stopPropagation();
258
259				// Close other open dropdowns
260				jQuery('.wpem-matchmaking-meeting-actions-dropdown-menu').not(jQuery(this).next()).slideUp();
261
262				// Toggle current one
263				jQuery(this).next('.wpem-matchmaking-meeting-actions-dropdown-menu').slideToggle();
264			});
265
266			// Close dropdown when clicking outside
267			jQuery(document).on('click', function() {
268				jQuery('.wpem-matchmaking-meeting-actions-dropdown-menu').slideUp();
269			});
270
271			// Prevent closing when clicking inside the menu
272			jQuery(document).on('click', '.wpem-matchmaking-meeting-actions-dropdown-menu', function(e) {
273				e.stopPropagation();
274			});
275			// Accept meeting request
276			jQuery(document).on('click', '.wpem-meeting-accept-btn', function(){
277				FrontendRegistration.actions.AcceptMeetingRequest(jQuery(this));
278			});
279			// Chat refresh button
280			jQuery(document).on('click', '.wpem-matchmaking-chat-detail-header-action-btn', function (e) {
281				e.preventDefault();
282				var receiverId = jQuery('.wpem-matchmaking-chat-send-message-btn').data('receiver-id');
283				if (!receiverId) {
284					alert('No conversation selected.');
285					return;
286				}
287				// Find the corresponding chat user item in the list
288				var $chatItem = jQuery('.wpem-matchmaking-chat-user-list-item[data-receiver-id="' + receiverId + '"]');
289				if ($chatItem.length) {
290					FrontendRegistration.actions.GetChatConversation($chatItem, true); 
291				}
292			});
293			// Cancell meeting
294			jQuery(document).on('click', '.cancel_meeting', function (e) {
295				FrontendRegistration.actions.CancelMeeting(e);
296			});
297			// Edit Meeting
298			jQuery(document).on('click', '.edit_meeting', function (e) {
299				const meetingId = jQuery(e.currentTarget).closest('.wpem-matchmaking-meeting-actions-dropdown').find('.cancel_meeting').data('meeting-id');
300				FrontendRegistration.actions.EditMeeting(e, meetingId);
301			});
302			jQuery(document).on('click', '.wpem-reschedule-meeting-btn', function (e) {
303				const meetingId = jQuery(this).data('meeting-id');
304				FrontendRegistration.actions.EditMeeting(e, meetingId);
305			});
306			
307			// Tab handling
308			var currentMeetingStatus = 'upcoming';
309			function filterMeetings(status) {
310				jQuery('.wpem-matchmaking-meeting-wrapper[data-meeting-status="' + status + '"]').show();
311			}
312
313			// Store last selected tab for fallback
314			var lastSelectedTab = '#participants';
315
316			// Handle main tab switch (Participants, Meetings, Chats)
317			jQuery(document).on('click', '.tab-links a', function (e) {
318
319				var target = jQuery(this).data('target');
320				if (!target) return;
321				e.preventDefault();
322
323				lastSelectedTab = target;
324
325				jQuery('.tab-links a').removeClass('active');
326				jQuery(this).addClass('active');
327
328				jQuery('.tab-content').hide();
329
330				// If switching to Participants
331				if (target === '#participants') {
332					jQuery(target).show();
333					location.reload();
334					if (jQuery('.wpem-matchmaking-tab.your-matches').hasClass('active')) {
335						FrontendRegistration.actions.YourMatches(function () {
336							jQuery(target).show(); // Re-show after AJAX or update
337						});
338					} else {
339						jQuery('.wpem-matchmaking-filter-reset-action')[0].click();
340					}
341				}
342
343				// If Meetings
344				if (target === '#meetings') {
345					jQuery(target).show();
346					filterMeetings(currentMeetingStatus);
347					jQuery('.wpem-matchmaking-tab[data-status="upcoming"]').addClass('active');
348				}
349
350				// If Chats
351				if (target === '#chats') {
352					jQuery(target).show();
353					var firstChatItem = jQuery('.wpem-matchmaking-chat-user-list-item').first();
354					if (firstChatItem.length) {
355						firstChatItem.trigger('click');
356					}
357				}
358			});
359
360			// Meeting Status Tabs (Upcoming / Past / Canceled)
361			jQuery(document).on('click', '.wpem-matchmaking-tab-filter-rights .wpem-matchmaking-tab', function (e) {
362				e.preventDefault();
363				jQuery('.wpem-matchmaking-tab-filter-rights .wpem-matchmaking-tab').removeClass('active');
364				jQuery(this).addClass('active');
365				currentMeetingStatus = jQuery(this).data('status');
366				filterMeetings(currentMeetingStatus);
367			});
368
369			// All tab
370			jQuery(document).on('click', '.wpem-matchmaking-tab.all', function () {
371				jQuery('.wpem-matchmaking-tab').removeClass('active');
372				jQuery(this).addClass('active');
373				jQuery('#your-matches-settings').hide();
374				// Reset all filter fields to blank or default
375				jQuery('#search_user_keywords').val('');
376				jQuery('#search_profession').val('');
377				jQuery('#search_matchmaking_country').val([])  .attr('data-placeholder', '') .removeAttr('data-multiple_text') .trigger('chosen:updated');
378				jQuery('#experience').val(''); 
379				jQuery('#user_interests').val('').trigger('change'); 
380				jQuery('#user_skills').val('').trigger('change');
381				jQuery('#search_event').val('').trigger('change');
382				FrontendRegistration.actions.filterAttendees(1,'all');
383			});
384
385			// Your Matches tab
386			jQuery(document).on('click', '.wpem-matchmaking-tab.your-matches', function (e) {
387				e.preventDefault();
388				jQuery('.wpem-matchmaking-tab').removeClass('active');
389				jQuery(this).addClass('active');
390				jQuery('#your-matches-settings').show();
391
392				// Override YourMatches to accept callback
393				FrontendRegistration.actions.YourMatches(e);
394			});
395			// Initial
396			filterMeetings(currentMeetingStatus);
397
398			jQuery(document).on('change', '#meeting_start_time', function () {
399				const startTime = jQuery(this).val();
400				const disabledRange = ['12:00am', startTime];
401				jQuery('#meeting_end_time').timepicker('option', {
402					disableTimeRanges: [disabledRange]
403				});
404			});
405			// Toggle meeting popup modal fields based on select event
406			jQuery(document).on('change', '#meeting_event_id', function() {
407				if (jQuery(this).val()) {
408					jQuery('#meeting_fields').slideDown(); // show meeting fields
409					const selected = jQuery(this).find('option:selected');
410					const startDateStr = selected.data('start');
411					const endDateStr = selected.data('end');
412
413					if (startDateStr && endDateStr) {
414						const minDate = new Date(startDateStr);
415						const maxDate = new Date(endDateStr);
416						const startTime = startDateStr.split(' ')[1].substring(0, 5);
417						const endTime = endDateStr.split(' ')[1].substring(0, 5); 
418
419						jQuery('#meeting_date').datepicker('destroy').datepicker({
420							dateFormat: 'yy-mm-dd',
421							changeMonth: true,
422							changeYear: true,
423							minDate: minDate,
424							maxDate: maxDate
425						});
426						jQuery('#meeting_start_time, #meeting_end_time').timepicker('option', {
427							minTime: startTime,
428							maxTime: endTime
429						});
430					} 
431					
432				} else {
433					jQuery('#meeting_fields').slideUp();   // hide meeting fields
434					
435				}
436			});
437			
438			//Availability popup
439			jQuery(document).on('click', '.wpem_meeting_availability_btn', function() {
440				//jQuery('.wpem-availability-meetings-date-item-body').slideUp();
441				jQuery('#availability_meeting_event_id').val('');
442				jQuery('.wpem-availability-meetings-date-list').html('');
443				jQuery('.availability_setting_update_msg').hide();
444				jQuery('.attendee-create-meeting').addClass('wpem-modal-open');
445			});
446			jQuery(document).on('click', '.wpem-availability-meetings-time-slot-item input[type="checkbox"][data-booked="1"]', function (e) {
447				e.preventDefault();
448				return false;
449			});
450			
451			jQuery(document).on('submit', '#availability_form', function (e) {
452				e.preventDefault();
453				FrontendRegistration.actions.SavedAvailability(this);
454			});
455			
456			// ========== Participant Selection Logic ==========
457			let selectedParticipants = [];
458			const participantLimit = parseInt(jQuery('#meeting-request-popup').data('participant-limit'));
459			
460			// Update selected participants from hidden input
461			function updateSelectedParticipants() {
462				const existing = jQuery('#selected_participant_ids').val();
463				selectedParticipants = existing ? existing.split(',').map(id => id.trim()) : [];
464			}
465
466			// Update UI states
467			function updateUIState() {
468				// Update hidden field
469				jQuery('#selected_participant_ids').val(selectedParticipants.join(','));
470				
471				// Update limit message and button state
472				if (selectedParticipants.length >= participantLimit) {
473					jQuery('.wpem-participant-limit-msg').show().text(`Maximum ${participantLimit} participants reached`);
474					jQuery('.wpem-meeting-schedule-add-participant').prop('disabled', true);
475					jQuery('.wpem-meeting-schedule-participant-dropdown').hide();
476				} else {
477					jQuery('.wpem-participant-limit-msg').hide();
478					jQuery('.wpem-meeting-schedule-add-participant').prop('disabled', false);
479				}
480			}
481
482			// Initialize on page load
483			updateSelectedParticipants();
484			updateUIState();
485
486			// Add participant handler - keeps your original behavior
487			jQuery(document).on('click', '.wpem-meeting-schedule-participant-dropdown-list-item', function() {
488				const $this = jQuery(this);
489				const userId = $this.data('user-id').toString();
490				const userName = $this.find('span').text();
491				const userAvatar = $this.find('img').attr('src');
492
493				// Check if already selected
494				if (selectedParticipants.includes(userId)) return;
495				
496				// Check limit
497				if (selectedParticipants.length >= participantLimit) return;
498
499				// Add participant
500				selectedParticipants.push(userId);
501				
502				// Create and insert avatar HTML
503				const avatarHtml = `
504					<div class="wpem-meeting-schedule-participant-avatar" data-user-id="${userId}">
505						<img class="wpem-active-participant" src="${userAvatar}" alt="${userName}" title="${userName}">
506						<span class="wpem-remove-participant-meeting"><i class="wpem-icon-close"></i></span>
507					</div>`;
508				jQuery(avatarHtml).insertBefore('.wpem-meeting-schedule-add-participant');
509				
510				// Hide from dropdown (your original behavior)
511				$this.attr('style', 'display:none !important');
512				
513				// Update UI state
514				updateUIState();
515			});
516
517			jQuery(document).on('click', '.wpem-remove-participant-meeting', function(e) {
518				e.stopPropagation();
519				const $wrapper = jQuery(this).closest('.wpem-meeting-schedule-participant-avatar');
520				const userId = $wrapper.data('user-id').toString();
521			
522				selectedParticipants = selectedParticipants.filter(id => id !== userId);
523			
524				$wrapper.remove();
525				jQuery(`.wpem-meeting-schedule-participant-dropdown-list-item[data-user-id="${userId}"]`).removeAttr('style');
526				
527				updateUIState();
528			});
529
530			jQuery(document).on('click', '.wpem-meeting-schedule-add-participant', function(e) {
531				e.stopPropagation();
532				// Hide already selected participants in dropdown on load
533				selectedParticipants.forEach(userId => {
534					jQuery(`.wpem-meeting-schedule-participant-dropdown-list-item[data-user-id="${userId}"]`).attr('style', 'display:none !important');
535				});
536				if (selectedParticipants.length >= participantLimit) return;
537				jQuery('.wpem-meeting-schedule-participant-dropdown').toggle();
538			});
539
540			jQuery(document).on('click', function(e) {
541				if (!jQuery(e.target).closest('.wpem-meeting-schedule-participant-dropdown').length && 
542					!jQuery(e.target).hasClass('wpem-meeting-schedule-add-participant')) {
543					jQuery('.wpem-meeting-schedule-participant-dropdown').hide();
544				}
545			});
546			jQuery(document).on('click', '.wpem-meeting-schedule-participant-close', function (e) {
547				e.preventDefault();
548				jQuery('.wpem-meeting-schedule-participant-dropdown').hide();
549			});
550			jQuery(document).on('click', '.wpem-remove-participant-meeting', function () {
551				const $wrapper = jQuery(this).closest('.wpem-meeting-schedule-participant-avatar');
552				const userId = $wrapper.data('user-id').toString();
553
554				selectedParticipants = selectedParticipants.filter(id => id !== userId);
555				jQuery('#selected_participant_ids').val(selectedParticipants.join(','));
556
557				jQuery(`.wpem-meeting-schedule-participant-dropdown-list-item[data-user-id="${userId}"]`)
558					.removeAttr('style');
559
560				$wrapper.remove();
561			});
562			// ========== Calendar Logic ========== /
563			
564			const $calendarBody = jQuery('.wpem-meeting-schedule-calendar-table tbody');
565			const $monthLabel = jQuery('.wpem-meeting-schedule-datepicker-current');
566			// Handle calendar day click
567			jQuery(document).on('click', '.calendar-day-container', function () {
568				const $dayNumber = jQuery(this).find('.day-number');
569
570				// Skip empty cells (no day number)
571				if ($dayNumber.length === 0) return;
572
573				// Skip if the day is disabled (e.g., past date logic applied)
574				if ($dayNumber.css('pointer-events') === 'none') return;
575
576				// Get selected day, month, year
577				const dateNum = parseInt($dayNumber.text());
578				const monthYear = jQuery('.wpem-meeting-schedule-datepicker-current').text().trim();
579				const formattedDate = moment(`${monthYear} ${dateNum}`, 'MMMM YYYY DD').format('YYYY-MM-DD');
580
581				// Set hidden input value
582				jQuery('#selected_meeting_date').val(formattedDate);
583
584				// Visually mark active day
585				jQuery('.calendar-day-container').removeClass('active-date');
586				jQuery(this).addClass('active-date');
587
588				// Trigger any logic needed
589				const eventId = jQuery('#meeting_create_event_id').val();
590				const participants = getSelectedParticipantIds();
591				// Optional: Add condition if needed
592				if (eventId && formattedDate && participants.length > 0) {
593					FrontendRegistration.actions.ShowCommonMeetingSlots(eventId, formattedDate, participants);
594				}
595			});
596
597			jQuery(document).on('click', '.wpem-meeting-schedule-datepicker-prev', function () {
598				currentDate.setMonth(currentDate.getMonth() - 1);
599				FrontendRegistration.actions.renderCalendar(currentDate);
600			});
601
602			jQuery(document).on('click', '.wpem-meeting-schedule-datepicker-next', function () {
603				currentDate.setMonth(currentDate.getMonth() + 1);
604				FrontendRegistration.actions.renderCalendar(currentDate);
605			});
606
607			// Show meeting time slot as per the selection of event, participant and date
608			function getSelectedParticipantIds() {
609				var ids = jQuery('#selected_participant_ids').val();
610				if (!ids) return [];
611				return ids.split(',').map(function (id) {
612					return parseInt(id.trim(), 10);
613				}).filter(Boolean);
614			}
615
616			// Optional: Keep #selected_participant_ids in sync if participants are added dynamically
617			jQuery(document).on('click', '.wpem-meeting-schedule-participant-dropdown-list-item', function () {
618				var userId = jQuery(this).data('user-id');
619				var existing = jQuery('.wpem-meeting-schedule-participant[data-user-id="' + userId + '"]');
620				if (existing.length === 0) {
621					var avatar = jQuery(this).find('img').attr('src');
622					var name = jQuery(this).find('span').text();
623					var html = '<div class="wpem-meeting-schedule-participant wpem-d-flex wpem-align-items-center wpem-justify-content-center wpem-mb-1" data-user-id="' + userId + '">' +
624						'<div class="wpem-meeting-schedule-participant-avatar">' +
625						'<img class="wpem-active-participant" src="' + avatar + '" alt="' + name + '">' +
626						'<span class="wpem-remove-participant-meeting"><i class="wpem-icon-close"></i></span>' +
627						'</div>' +
628						'</div>';
629					jQuery('.wpem-meeting-schedule-participant-add-participant').before(html);
630				}
631
632				// Update hidden input
633				var updatedIds = getSelectedParticipantIds();
634				updatedIds.push(userId);
635				updatedIds = Array.from(new Set(updatedIds)); // remove duplicates
636				jQuery('#selected_participant_ids').val(updatedIds.join(','));
637
638				var eventId = jQuery('#meeting_create_event_id').val();
639				var date = jQuery('#selected_meeting_date').val();
640				if (eventId && date && updatedIds.length > 0) {
641					FrontendRegistration.actions.ShowCommonMeetingSlots(eventId, date, updatedIds);
642				}
643			});
644
645			jQuery(document).on('click', '.wpem-remove-participant-meeting', function () {
646				var removedUserId = jQuery(this).closest('.wpem-meeting-schedule-participant').data('user-id');
647				jQuery(this).closest('.wpem-meeting-schedule-participant').remove();
648
649				var updatedIds = getSelectedParticipantIds().filter(function (id) {
650					return id !== removedUserId;
651				});
652
653				jQuery('#selected_participant_ids').val(updatedIds.join(','));
654
655				var eventId = jQuery('#meeting_create_event_id').val();
656				var date = jQuery('#selected_meeting_date').val();
657				if (eventId && date && updatedIds.length > 0) {
658					FrontendRegistration.actions.ShowCommonMeetingSlots(eventId, date, userIds);
659				}
660			});
661
662			jQuery(document).on('change', 'input[name="time_slot"]', function () {
663				var selectedSlot = jQuery(this).val();
664				jQuery('#selected_time_slot').val(selectedSlot);
665			});
666
667			//Submit Meeting request
668			jQuery(document).on('click', '.wpem-send-meeting-request', function(){
669				FrontendRegistration.actions.CreateMeetingRequestSubmit();
670			});
671			
672			jQuery('#chat-file-upload').on('change', function () {
673				const file = this.files[0];
674				if (file) {
675					const fileName = file.name;
676					const $textarea = jQuery('.wpem-matchmaking-chat-send-message-textarea');
677					let currentText = $textarea.val();
678					$textarea.val(currentText + (currentText ? '\n' : '') + fileName);
679				}
680			});
681			// Conversation Info button
682			jQuery(document).on('click', '.wpem_conversation_info', function () {
683				FrontendRegistration.actions.ConversationInfoBtn(this);
684			});
685			//Meeting tabs handle with event title
686			jQuery(document).on('click', '.wpem-matchmaking-tab[data-status]', function(e) {
687				e.preventDefault();	
688				var targetStatus = jQuery(this).data('status');
689				jQuery('.wpem-matchmaking-tab').removeClass('active');
690				jQuery(this).addClass('active');	
691				jQuery('.wpem-meetings-status-container').hide();
692				jQuery('.wpem-meetings-status-container[data-status="' + targetStatus + '"]').show();
693			});
694			// Mark all slot checkbox in availability popup
695			jQuery(document).on('change', '.check-all-slots', function () {
696				const container = jQuery(this).closest('.wpem-availability-meetings-date-item-body');
697				const isChecked = jQuery(this).is(':checked');
698				container.find('.wpem-availability-meetings-time-slot-item input[type="checkbox"]').prop('checked', isChecked);
699			});
700			jQuery(document).on('change', '.wpem-availability-meetings-time-slot-item input[type="checkbox"]', function () {
701				const container = jQuery(this).closest('.wpem-availability-meetings-date-item-body');
702				const allCheckboxes = container.find('.wpem-availability-meetings-time-slot-item input[type="checkbox"]');
703				const allChecked = allCheckboxes.length === allCheckboxes.filter(':checked').length;
704				container.find('.check-all-slots').prop('checked', allChecked);
705			});
706			jQuery('#user-profile-settings-form').on('submit', function (e) {
707				e.preventDefault();
708				FrontendRegistration.actions.SaveUserProfileSettings();
709			});
710			// Search participants in create meeting popup 
711			jQuery(document).on('input', '#participantSearch', function () {
712				FrontendRegistration.actions.SearchMeetingParticipants(this);	
713			});
714			// Timezone dropdown toggle in User Prifile Page
715			FrontendRegistration.actions.toggleTimezoneDropdown();
716			jQuery('input[name="timezone_settings"]').on('change', function(){
717				FrontendRegistration.actions.toggleTimezoneDropdown();
718			});
719			//Your Matches filter mode settings change
720			jQuery(document).on('change', 'input[name="match_filter"]', FrontendRegistration.actions.YourMatches);
721		
722			//add new participants in conversation popup
723			jQuery(document).on('click', '.wpem-matchmaking-chat-user-list-header-add-conversation-btn', function() {
724				jQuery('.wpem-add-new-conversation-participant-modal').addClass('wpem-modal-open');
725			});
726
727			jQuery(document).on('change', '#new_receiver_id', function () {
728				let new_receiver_id = jQuery(this).val();
729				jQuery('#message_reciever_user_id').val(new_receiver_id); // set hidden input
730			});
731		
732			jQuery(document).on("submit", "#submit-add-new-conversation", function (e) {
733				e.preventDefault();
734				FrontendRegistration.actions.AddNewConverasation(e, jQuery(this)); // Pass the form
735			});
736			// Matchmaking participant filter toggle 
737			jQuery("#wpem-matchmaking-filter-action").click(function(){
738				jQuery("#wpem-matchmaking-filter-dropdown").toggle();
739			});
740			// Conversation info popup in conversation tab
741			jQuery('.wpem-tab-button').on('click', function() {
742				var target = jQuery(this).data('tab');
743				// Remove 'active' from all buttons and contents
744				jQuery('.wpem-tab-button').removeClass('wpem-tab-active');
745				jQuery('.wpem-tab-content').removeClass('wpem-tab-active');
746				// Add 'active' to the clicked tab and corresponding content
747				jQuery(this).addClass('wpem-tab-active');
748				jQuery('#' + target).addClass('wpem-tab-active');
749			});
750			jQuery(".wpem-matchmaking-chat-mobile-device-back-btn").click(function() {
751				jQuery(".wpem-matchmaking-chat-wrapper").removeClass("active"); // remove to clicked
752			});
753			// Delete meetings
754			jQuery(document).on('click', '.delete_meeting', function (e) {
755				FrontendRegistration.actions.DeleteMeeting(e);
756			});
757			
758        },
759        actions: {
760			// Initialize the calendar on page load
761			initCalendar: function () {
762				if (typeof moment === 'undefined') {
763					return;
764				}
765				// Get current date using moment
766				const currentDate = moment(); // current date
767
768				// Format to "Month Year" (e.g., "July 2025")
769				const monthYear = currentDate.format('MMMM YYYY');
770
771				// Set it in the calendar label span
772				jQuery('#calendar-month-label').text(monthYear);
773
774				// const monthLabel = document.getElementById('calendar-month-label');
775				const prevBtn = document.querySelector('.wpem-meeting-schedule-datepicker-prev');
776				const nextBtn = document.querySelector('.wpem-meeting-schedule-datepicker-next');
777				// const currentDate = new Date();
778				prevBtn.addEventListener('click', () => {
779					currentDate.subtract(1, 'month');
780					this.renderCalendar(currentDate);
781				});
782
783				nextBtn.addEventListener('click', () => {
784					currentDate.add(1, 'month');
785					this.renderCalendar(currentDate);
786				});
787
788				this.renderCalendar(currentDate); // Initial load
789			},
790
791			/**
792			 * This function renders the calendar to the specified date.
793			 * @param {*} date 
794			 */
795			renderCalendar: function (date) {
796				const momentDate = moment(date); // ensures it's a Moment.js object
797
798				const year = momentDate.year(); // ✅ safe now
799				const month = momentDate.month(); // 0-based
800				const firstDay = new Date(year, month, 1).getDay();
801				const daysInMonth = new Date(year, month + 1, 0).getDate();
802				const monthLabel = document.querySelector('.wpem-meeting-schedule-datepicker-current');
803				const calendarBody = document.querySelector('.wpem-meeting-schedule-calendar-table tbody'); // ✅ THIS LINE
804
805				// Update month label
806				const monthNames = ["January", "February", "March", "April", "May", "June",
807									"July", "August", "September", "October", "November", "December"];
808				monthLabel.textContent = `${monthNames[month]} ${year}`;
809
810				calendarBody.innerHTML = '';
811				let row = document.createElement('tr');
812
813				// Empty cells before first day
814				for (let i = 0; i < firstDay; i++) {
815					row.appendChild(document.createElement('td'));
816				}
817
818				// Fill the days
819				for (let day = 1; day <= daysInMonth; day++) {
820					const cell = document.createElement('td');
821					cell.className = 'calendar-day-container';
822					const div = document.createElement('div');
823					div.className = 'day-number';
824					div.textContent = day;
825
826					// Highlight today
827					const today = new Date();
828					const cellDate = new Date(year, month, day);
829
830					// Add "today" highlight
831					if (
832						day === today.getDate() &&
833						month === today.getMonth() &&
834						year === today.getFullYear()
835					) {
836						cell.classList.add('today');
837					}
838
839					// Disable past dates
840					if (cellDate < new Date(today.getFullYear(), today.getMonth(), today.getDate())) {
841						cell.classList.add('disabled');
842						cell.style.pointerEvents = 'none';
843						cell.style.opacity = '0.5';
844					}
845
846					cell.appendChild(div);
847					row.appendChild(cell);
848
849					if ((row.children.length % 7) === 0) {
850						calendarBody.appendChild(row);
851						row = document.createElement('tr');
852					}
853				}
854
855				// Fill remaining cells
856				if (row.children.length > 0) {
857					while (row.children.length < 7) {
858						row.appendChild(document.createElement('td'));
859					}
860					calendarBody.appendChild(row);
861				}
862			},
863
864            updateCheckin: function (t) {
865                jQuery(this).closest("span").add(jQuery(this).closest("td").find(".registration-checkin-hidden")).toggleClass("registration-checkin-hidden");
866                var e = jQuery(this).data("value"),
867                    i = jQuery(this).data("post-id"),
868                    n = localStorage.getItem('current_event_id');
869                    s = jQuery(this).data("source");
870                jQuery.ajax({
871                    type: "POST",
872                    url: wpem_registrations_frontend.ajaxUrl,
873                    data: {
874                        check_in_value: e,
875                        registration_id: i,
876                        event_id: n,
877                        source: s,
878                        action: "update_event_registration_checkin_data"
879                    },
880                    beforeSend: function (t, e) {},
881                    success: function (t) {
882                        jQuery(".check_in_total").html(t);
883                    },
884                    error: function (t, e, i) {},
885                    complete: function (t, e) {},
886                }),
887                t.preventDefault();
888            },
889
890            getAttendees: function(event_id, page = 1, open_modal = true) {
891                var registration_byname = jQuery(".registration_byname").val();
892                var registration_status = jQuery(".registration_status").val();
893                var attendee_status = jQuery(".attendee_status").val();
894                var registration_orderby = jQuery(".registration_orderby").val();
895                jQuery('.wpem-attendee-modal').addClass('wpem-modal-open');
896                jQuery(".wpem-attendee-modal-content").html("<p class='loading-text'>Loading...</p>");
897                jQuery.ajax({
898                    type: "get",
899                    url: wpem_registrations_frontend.ajaxUrl,
900                    data: {
901                        action: 'get_event_attendees',
902                        event_id: event_id,
903                        registration_byname: registration_byname,
904                        registration_status: registration_status,
905                        attendee_status: attendee_status,
906                        registration_orderby: registration_orderby,
907                        paged: page,
908						wpem_nonce: wpem_registrations_frontend.nonce
909                    },
910                    success: function(response) {
911                        jQuery(".wpem-attendee-modal-content").html(response.html);
912                        jQuery('.wpem-attendee-modal').addClass('wpem-modal-open');
913                    }
914                });        
915            },
916
917            submitProfileForm: function () {
918                var form = jQuery("#submit-match-making-form");
919                var formData = form.serialize(); // Serialize form data
920                
921                formData += "&action=submit_match_making_profile"; 
922
923                jQuery.ajax({
924                    type: "POST",
925                    url: wpem_registrations_frontend.ajaxUrl, 
926                    data: formData,
927					dataType: "json",
928                    beforeSend: function () {
929                        form.find("input[type='submit']").prop("disabled", true).val("Submitting...");
930                    },
931                    success: function (response) {
932						
933                        if (response.success) {
934							const url = new URL(window.location.href);
935							url.searchParams.delete('action');
936							window.location.href = url.toString(); // Redirect to the cleaned URL
937							
938                        } else {
939							jQuery('html, body').animate({
940								scrollTop: 0
941							}, 1000);
942							jQuery('.wpem-alert-success').show().text(response.data.message).css({'color': '#721c24','background-color': '#f8d7da','border-color': '#f5c6cb'});
943                           
944                        }
945                    },
946                    error: function () {
947                        alert("An error occurred. Please try again.");
948                    },
949                    complete: function () {
950                        form.find("input[type='submit']").prop("disabled", false).val("Submit");
951                    }
952                });
953            },
954
955			filterAttendees: function (page = 1) {
956				jQuery("#matchmaking-filter-form").show();
957				if (typeof page !== 'number' || isNaN(page)) {
958					page = 1;
959				}
960				let form = jQuery('#matchmaking-filter-form');
961				let currentPage = parseInt(jQuery('.matchmaking-pagination .current-page').val() || 1);
962				let perPage = jQuery('.matchmaking-list').data('per-page');
963				
964				let experienceValue = form.find('#experience').val();
965				let experienceRange = {};
966
967				if (experienceValue === "entry") {
968					experienceRange = { min: 0, max: 2 };
969				} else if (experienceValue === "mid") {
970					experienceRange = { min: 3, max: 5 };
971				} else if (experienceValue === "senior") {
972					experienceRange = { min: 6, max: 100 };
973				}
974				// get match mode setting in your matches tab
975				let matchMode = jQuery('input[name="match_filter"]:checked').val() || 'exact';
976				var filters = {
977					name: form.find('#search_user_keywords').val(),
978					profession: form.find('#search_profession').val(),
979					country: form.find('#search_matchmaking_country').val(),
980					experience: experienceRange,
981					interests: form.find('#user_interests').val(),
982					skills: form.find('#user_skills').val(),
983					event_id: form.find('#search_event').val(),
984					match_mode: matchMode,
985				};
986
987				jQuery.ajax({
988					url: wpem_registrations_frontend.ajaxUrl,
989					type: 'POST',
990					data: {
991						action: 'wpem_get_match_making_filter_user',
992						wpem_nonce: wpem_registrations_frontend.nonce,
993						filters: filters,
994						page: page,
995						per_page: perPage
996					},
997					beforeSend: function () {
998						jQuery('.matchmaking-list').css('position', 'relative');
999						jQuery('.matchmaking-list').append('<div class="loader-overlay" style="position:absolute;top:0;left:0;width:100%;height: 400px;background:rgba(255,255,255,0.6);display:flex;justify-content:center;align-items:center;z-index:99;"><i class="fa fa-spinner fa-spin fa-2x"></i></div>');
1000						jQuery('.matchmaking-list').children().not('.loader-overlay').css('filter', 'blur(3px)');
1001					},
1002					success: function (response) {
1003						if (response.success == true) {
1004							jQuery('.matchmaking-list .loader-overlay').remove();
1005							jQuery("#wpem-matchmaking-filter-dropdown").slideUp();
1006							const tempHTML = jQuery('<div>').html(response.data.html);
1007							const updatedList = tempHTML.find('.matchmaking-list');
1008							jQuery('.matchmaking-list').replaceWith(updatedList);
1009						
1010							const isFilterActive =
1011								(filters.name && filters.name.trim() !== '') ||
1012								(filters.profession && filters.profession.trim() !== '') ||
1013								(Array.isArray(filters.country) && filters.country.length > 0) ||
1014								(Array.isArray(filters.skills) && filters.skills.length > 0) ||
1015								(Array.isArray(filters.interests) && filters.interests.length > 0) ||
1016								(filters.experience && Object.keys(filters.experience).length > 0) ||
1017								(filters.event_id && filters.event_id.toString().trim() !== '');
1018
1019							if (isFilterActive) {
1020								jQuery('.wpem-matchmaking-filter-reset-action').show();
1021							} else {
1022								jQuery('.wpem-matchmaking-filter-reset-action').hide();
1023							}
1024
1025							jQuery("#search_event").val(filters.event_id);
1026							if (jQuery.trim(jQuery('.wpem-matchmaking-lists').html()) === '') {
1027								jQuery('.wpem-matchmaking-lists').html('<p>No users found.</p>');
1028							}
1029
1030							jQuery("#search_user_keywords").val(filters.name);
1031							jQuery("#search_profession").val(filters.profession);
1032							jQuery("#experience").val(experienceValue);
1033
1034							// Show count
1035							jQuery('.wpem-matchmaking-filter-show-results').text(response.data.total_users + ' Results');
1036							// Pagination
1037							if (response.data.total_users > perPage) {
1038								let paginationHTML = FrontendRegistration.actions.generatePagination(response.data.total_pages, response.data.current_page);
1039								jQuery('.wpem-matchmaking-pagination').html(paginationHTML);
1040							} else {
1041								jQuery('.wpem-matchmaking-pagination').empty();
1042							}
1043					
1044							if (response.data.total_users === 0 || jQuery.trim(jQuery('.matchmaking-list').html()) === '') {
1045								jQuery('.matchmaking-list').html('<div><p class="event-manager-message wpem-alert wpem-alert-danger wpem-text-center"><i class="wpem-icon-user-check"></i> There are no Attendees found with your match</p></div>');
1046								jQuery('.wpem-matchmaking-filter-show-results').text('0 Results');
1047							}
1048							jQuery('.wpem-matchmaking-container .wpem-matchmaking-main-header').remove();
1049							// Restore active tab class
1050							jQuery('.wpem-matchmaking-tab').removeClass('active');
1051							jQuery('.wpem-matchmaking-tab[data-tab="all"]').addClass('active');
1052							jQuery("#search_matchmaking_country").val(filters.country).chosen().trigger("chosen:updated");
1053							jQuery("#user_interests").val(filters.interests).chosen().trigger("chosen:updated");
1054							jQuery("#user_skills").val(filters.skills).chosen().trigger("chosen:updated");
1055							
1056						} else {
1057							jQuery('.matchmaking-list .loader-overlay').remove();
1058							jQuery('.matchmaking-list').children().css('filter', '');
1059							jQuery('.wpem-matchmaking-filter-show-results').text('0 Results');
1060							jQuery('.matchmaking-list').html('<div><p class="event-manager-message wpem-alert wpem-alert-danger wpem-text-center"><i class="wpem-icon-user-check"></i> ' + response.data.message + '</p></div>');
1061						}
1062					}
1063				});
1064			},
1065
1066            ChatMessageFormSubmission : function (e) {
1067				
1068				var form = jQuery("#submit-match-making-contact-form");
1069				var formData = form.serialize();
1070				var receiver_id = jQuery('#message_reciever_user_id').val();
1071				jQuery.ajax({
1072					type: "POST",
1073					url: wpem_registrations_frontend.ajaxUrl, 
1074					data: formData + "&action=wpem_send_matchmaking_user_message",
1075					beforeSend: function () {
1076						jQuery('#submit-match-making-form').val("Sending...").prop("disabled", true);
1077					},
1078					success: function (response) {
1079						if (receiver_id != null || receiver_id != undefined || receiver_id != '' || receiver_id != 0) {
1080							// Select the chat user with matching receiver ID
1081							// Build redirect URL
1082							//var redirectUrl = "http://localhost/wpem-latest/match-making-list/?tab=chats";
1083							var redirectUrl = window.location.origin + window.location.pathname+'/?tab=chats';
1084							if (receiver_id) {
1085								redirectUrl += "&receiver_id=" + receiver_id;
1086							}
1087
1088							// Redirect to chat tab with receiver_id
1089							window.location.href = redirectUrl;
1090							$chatUserItem = jQuery('.wpem-matchmaking-chat-user-list-item[data-receiver-id="' + receiver_id + '"]');
1091						} else {
1092							// Fallback to first user
1093							$chatUserItem = jQuery('.wpem-matchmaking-chat-user-list-item').first();
1094						}
1095
1096						if ($chatUserItem.length) {
1097							$chatUserItem.trigger('click');
1098						} 
1099						jQuery("#submit-match-making-contact-form")[0].reset();  
1100						jQuery('.attendee_chat_btn').removeClass('wpem-modal-open'); 
1101						jQuery('[data-target="#chats"]').addClass('active').trigger('click');
1102						// Wait for chat UI to be ready
1103						setTimeout(function () {
1104							var $firstChatItem = jQuery('.wpem-matchmaking-chat-user-list-item').first();
1105							var receiverId = $firstChatItem.data('receiver-id'); 
1106							if ($firstChatItem.length && receiverId) {
1107								$firstChatItem.trigger('click');
1108							} else {
1109								console.warn('No chat user found or missing receiver ID.');
1110							}
1111						}, 1000);
1112					}
1113				});
1114			},
1115
1116			AddNewConverasation : function(e, form) { // Accept form parameter
1117				e.preventDefault();
1118
1119				// Use the passed form instead of jQuery(this)
1120				let formData = form.serialize();
1121
1122				jQuery.ajax({
1123					type: "POST",
1124					url: wpem_registrations_frontend.ajaxUrl,
1125					data: formData,
1126					beforeSend: function () {
1127						jQuery('.wpem-matchmaking-new-chat-send-message-btn').text("Sending...").prop("disabled", true);
1128					},
1129					success: function (response) {
1130						if (response.success) {
1131							//alert("Message sent successfully!");
1132							form[0].reset();
1133							jQuery('.wpem-matchmaking-new-chat-send-message-btn').text("Send Message").prop("disabled", false);
1134							
1135							// Close modal if needed
1136							jQuery('.wpem-add-new-conversation-participant-modal').removeClass('wpem-modal-open'); 
1137							location.reload();
1138							
1139						} else {
1140							alert("Error: " + response.data);
1141							jQuery('.wpem-matchmaking-new-chat-send-message-btn').text("Send Message").prop("disabled", false);
1142						}
1143					},
1144					error: function(xhr, status, error) {
1145						alert("AJAX Error: " + error);
1146						jQuery('.wpem-matchmaking-new-chat-send-message-btn').text("Send Message").prop("disabled", false);
1147					}
1148				});
1149			},
1150
1151			AttendeeVisibilityApproved : function(id) {
1152				var $this = jQuery('#approve_attendee_' + id); 
1153				var registrationId = id;
1154				var isApproved = $this.hasClass("approved") ? 1 : 0;
1155
1156				var userId = $this.data('user-id');
1157				var email = $this.data('email');
1158
1159				// Determine new state
1160				var newApproved = isApproved ? 0 : 1;
1161				var newText = newApproved ? "Disapprove" : "Approve";
1162				var newTooltip = newApproved ? wpem_registrations_frontend.declineTooltip : wpem_registrations_frontend.approveTooltip;
1163				var newClass = newApproved ? "approved" : "disapproved";
1164				var oldClass = newApproved ? "disapproved" : "approved";
1165
1166				// Update all matching buttons in UI (same user or same email)
1167				jQuery('.approve-attendee-btn').each(function() {
1168					var $btn = jQuery(this);
1169					if ($btn.data('user-id') === userId || $btn.data('email') === email) {
1170						$btn.text(newText).removeClass(oldClass).addClass(newClass);
1171					}
1172				});
1173
1174				// Send AJAX request to backend
1175				jQuery.ajax({
1176					url: wpem_registrations_frontend.ajaxUrl,
1177					type: "POST",
1178					data: {
1179						action: "toggle_attendee_matchmaking_approval",
1180						registration_id: registrationId,
1181						approved: newApproved
1182					},
1183					success: function(response) {
1184						if (response.success) {
1185						} else {
1186							console.error("Error:", response.data);
1187						}
1188					},
1189					error: function() {
1190						alert("Something went wrong! Please try again.");
1191					}
1192				});
1193			},
1194
1195			generatePagination: function(totalPages, currentPage) {
1196				let html = '<nav class="event-manager-pagination-2">';
1197				html += '<ul class="matchmaking-pagination page-numbers" data-current="' + currentPage + '" data-total="' + totalPages + '">';
1198
1199				// Only show Prev if not on first page
1200				if (currentPage > 1) {
1201					html += '<li><a class="pagination-prev page-numbers prev" href="#" data-page="' + (currentPage - 1) + '">←</a></li>';
1202				}
1203
1204				// Numbered links
1205				for (let i = 1; i <= totalPages; i++) {
1206					let activeClass = i === currentPage ? 'active current' : '';
1207					html += '<li><a class="pagination-number page-numbers ' + activeClass + '" href="#" data-page="' + i + '">' + i + '</a></li>';
1208				}
1209
1210				// Only show Next if not on last page
1211				if (currentPage < totalPages) {
1212					html += '<li><a class="pagination-next page-numbers next" href="#" data-page="' + (currentPage + 1) + '">→</a></li>';
1213				}
1214
1215				html += '</ul>';
1216				html += '</nav>';
1217				return html;
1218			},
1219
1220			YourMatches: function (e, page = 1) {
1221				jQuery("#matchmaking-filter-form").hide();
1222				if (typeof page !== 'number' || isNaN(page)) {
1223					page = 1;
1224				}
1225				let perPage = jQuery('.matchmaking-list').data('per-page');
1226				
1227				jQuery.ajax({
1228					url: wpem_registrations_frontend.ajaxUrl,
1229					type: 'POST',
1230					data: {
1231						action: 'wpem_get_match_making_filter_user',
1232						filters_type: jQuery('input[name="match_filter"]:checked').val(),
1233						wpem_nonce: wpem_registrations_frontend.nonce,
1234						page: page,
1235						per_page: perPage
1236					},
1237					beforeSend: function () {
1238						jQuery('.matchmaking-list').css('position', 'relative');
1239						jQuery('.matchmaking-list').append('<div class="loader-overlay" style="position:absolute;top:0;left:0;width:100%;height: 400px;background:rgba(255,255,255,0.6);display:flex;justify-content:center;align-items:center;z-index:99;"><i class="fa fa-spinner fa-spin fa-2x"></i></div>');
1240						jQuery('.matchmaking-list').children().not('.loader-overlay').css('filter', 'blur(3px)');
1241					},
1242					success: function (response) {
1243						if (response.success == true) {
1244							jQuery('.matchmaking-list .loader-overlay').remove();
1245							jQuery('.matchmaking-list').css('position', '');
1246							jQuery('.matchmaking-list').html(response.data.html);
1247							
1248							if (jQuery.trim(jQuery('.wpem-matchmaking-lists').html()) === '') {
1249								jQuery('.wpem-matchmaking-lists').html('<p>No users found.</p>');
1250							}
1251
1252							// Show count
1253							jQuery('.wpem-matchmaking-filter-show-results').text(response.data.total_users + ' Results');
1254							// Pagination
1255							if (response.data.total_users > perPage) {
1256								let paginationHTML = FrontendRegistration.actions.generatePagination(response.data.total_pages, response.data.current_page);
1257								jQuery('.wpem-matchmaking-pagination').html(paginationHTML);
1258							} else {
1259								jQuery('.wpem-matchmaking-pagination').empty();
1260							}
1261							
1262							if (response.data.total_users === 0 || jQuery.trim(jQuery('.matchmaking-list').html()) === '') {
1263								jQuery('.matchmaking-list').html('<div><p class="event-manager-message wpem-alert wpem-alert-danger wpem-text-center"><i class="wpem-icon-user-check"></i> There are no Attendees found with your match</p></div>');
1264								jQuery('.wpem-matchmaking-filter-show-results').text('0 Results');
1265							}
1266							jQuery('.wpem-matchmaking-container .wpem-matchmaking-main-header').remove();
1267							// Restore active tab class
1268							jQuery('.wpem-matchmaking-tab').removeClass('active');
1269							jQuery('.wpem-matchmaking-tab[data-tab="your-matches"]').addClass('active');
1270						} else {
1271							jQuery('.matchmaking-list .loader-overlay').remove();
1272							jQuery('.matchmaking-list').children().css('filter', '');
1273							jQuery('.wpem-matchmaking-filter-show-results').text('0 Results');
1274							jQuery('.matchmaking-list').html('<div><p class="event-manager-message wpem-alert wpem-alert-danger wpem-text-center"><i class="wpem-icon-user-check"></i> ' + response.data.message + '</p></div>');
1275						}
1276					}
1277				});
1278			},
1279
1280			GetChatConversation: function ($this, preventLoop = false) {
1281				var receiverId = $this.attr('data-receiver-id');
1282				var parentId = $this.attr('data-parent-id');
1283				var profileUrl = $this.attr('data-profile-url'); // already available
1284				
1285				jQuery('.wpem-matchmaking-chat-user-list-item').removeClass('active');
1286				$this.addClass('active');
1287
1288				var userName = $this.find('.wpem-matchmaking-chat-user-list-name-text').text();
1289				jQuery('.wpem-matchmaking-chat-detail-header-profile-name')
1290					.html('<a href="' + profileUrl + '">' + userName + '</a>');
1291				
1292				jQuery('.wpem-matchmaking-chat-detail-header-profile-designation')
1293					.text($this.data('profession'));
1294				jQuery('.wpem-matchmaking-chat-send-message-btn')
1295					.data('receiver-id', receiverId);
1296				
1297				jQuery.ajax({
1298					url: wpem_registrations_frontend.ajaxUrl,
1299					type: 'POST',
1300					data: {
1301						action: 'get_chat_conversation',
1302						receiver_id: receiverId,
1303						parent_id: parentId,
1304					},
1305					success: function (response) {
1306						if (response.success) {
1307							jQuery('.wpem-matchmaking-chat-detail-content').html(response.data.html);
1308							jQuery('.wpem-matchmaking-chat-wrapper').addClass('active');
1309							jQuery('.wpem_conversation_info').attr('data-receiver-id', receiverId);
1310
1311							if (response.data.user_list) {
1312								jQuery('.wpem-matchmaking-chat-user-list').html(response.data.user_list);
1313
1314								if (!preventLoop) {
1315									var first = jQuery('.wpem-matchmaking-chat-user-list-item').first();
1316									if (first.data('receiver-id') !== receiverId) {
1317										FrontendRegistration.actions.GetChatConversation(first, true);
1318									}
1319								}
1320							}
1321						} else {
1322							jQuery('.wpem-matchmaking-chat-detail-content').html('<p>No conversation found.</p>');
1323						}
1324					}
1325				});
1326			},
1327			
1328			ChatSendMessageBtn: function () {
1329				const message     = jQuery('.wpem-matchmaking-chat-send-message-textarea').val();
1330				const receiver_id = jQuery('.wpem-matchmaking-chat-send-message-btn').data('receiver-id');
1331				const fileInput   = document.getElementById('chat-file-upload'); // Changed from chat-image-upload
1332				const file        = fileInput.files[0];
1333
1334				if (!message.trim() && !file) {
1335					return;
1336				}
1337
1338				const formData = new FormData();
1339				formData.append('action', 'wpem_send_match_making_chat_message');
1340				formData.append('message', message);
1341				formData.append('receiver_id', receiver_id);
1342
1343				if (file) {
1344					formData.append('file', file); // Changed from 'image' to 'file'
1345				}
1346
1347				jQuery.ajax({
1348					url: wpem_registrations_frontend.ajaxUrl,
1349					type: 'POST',
1350					data: formData,
1351					processData: false,
1352					contentType: false,
1353					beforeSend: function () {
1354						jQuery('.wpem-matchmaking-chat-send-message-btn').prop('disabled', true);
1355					},
1356					success: function (response) {
1357						if (response.success) {
1358							jQuery('.wpem-matchmaking-chat-send-message-textarea').val('');
1359							document.getElementById('chat-file-upload').value = ''; // Reset file input
1360							const $userItem = jQuery('.wpem-matchmaking-chat-user-list-item[data-receiver-id="' + receiver_id + '"]');
1361							if (message) {
1362								$userItem.find('.wpem-matchmaking-chat-user-list-message').text(message);
1363							} else if (file) {
1364								$userItem.find('.wpem-matchmaking-chat-user-list-message').text('File: ' + file.name);
1365							}
1366							jQuery('.wpem-matchmaking-chat-detail-content').append(response.data.html);
1367							// Scroll to bottom
1368							jQuery('.wpem-matchmaking-chat-detail-content').scrollTop(jQuery('.wpem-matchmaking-chat-detail-content')[0].scrollHeight);
1369						} else {
1370							alert(response.data.message || 'Failed to send message.');
1371						}
1372					},
1373					complete: function () {
1374						jQuery('.wpem-matchmaking-chat-send-message-btn').prop('disabled', false);
1375					}
1376				});
1377			},
1378
1379			AcceptMeetingRequest : function ($button) {
1380				var meetingId = $button.attr('data-meeting-id');
1381				var nextStatus = parseInt($button.attr('data-next-status'));
1382
1383				jQuery.ajax({
1384					url: wpem_registrations_frontend.ajaxUrl,
1385					type: 'POST',
1386					data: {
1387						action: 'wpem_accept_meeting',
1388						meeting_id: meetingId,
1389						status: nextStatus,
1390						wpem_nonce: wpem_registrations_frontend.nonce,
1391					},
1392					success: function (response) {
1393						if (response.success) {
1394							window.location.reload(); // ← THIS LINE IS NEW
1395						} else {
1396							alert(response.data?.message || 'Something went wrong.');
1397						}
1398					},
1399					error: function () {
1400						alert('AJAX request failed.');
1401					}
1402				});
1403			},
1404
1405			CancelMeeting : function (e) {
1406				e.preventDefault();
1407
1408				if (!confirm('Are you sure you want to cancel this meeting?')) return;
1409				var meetingId = jQuery(e.currentTarget).data('meeting-id');
1410				var button = jQuery(this);
1411
1412				jQuery.ajax({
1413					url: wpem_registrations_frontend.ajaxUrl,
1414					type: 'POST',
1415					data: {
1416						action: 'wpem_cancel_matchmaking_meeting',
1417						meeting_id: meetingId,
1418						wpem_nonce: wpem_registrations_frontend.nonce,
1419					},
1420					success: function (response) {
1421						if (response.success) {
1422							jQuery(e.currentTarget).text('Cancelled').closest('.wpem-matchmaking-meeting-actions-dropdown-menu').hide();
1423							location.reload();
1424						} else {
1425							alert('Failed to cancel meeting. Try again.');
1426						}
1427					}
1428				});
1429			},
1430
1431			EditMeeting : function (e, meetingId = null) {
1432				 e.preventDefault();
1433				
1434				jQuery.ajax({
1435					url: wpem_registrations_frontend.ajaxUrl,
1436					type: 'POST',
1437					data: {
1438						action: 'wpem_get_meeting_details',
1439						meeting_id: meetingId,
1440						
1441					},
1442					success: function(response) {
1443            
1444						if (response.success) {
1445							const m = response.data;
1446							const formattedStartTime = m.meeting_start_time.substring(0, 5); // HH:MM format
1447
1448							// Set modal values
1449							jQuery('#meeting_id').val(m.id);
1450							// Ensure the container exists
1451							if (jQuery('.wpem-meeting-schedule-container').length) {
1452								// Append a hidden input field
1453								jQuery('.wpem-meeting-schedule-container').append(
1454									'<input type="hidden" id="meeting_id" name="meeting_id" value="' + m.i
1454d + '">'
1455								);
1456							}
1457							jQuery('.meeting-modal-header').text('Edit Meeting');
1458							jQuery('#meeting_date').val(m.meeting_date);
1459							jQuery('#meeting_create_event_id').val(m.event_id).trigger('change');
1460							jQuery('#meeting_start_time').val(m.meeting_start_time);
1461							jQuery('#meeting_end_time').val(m.meeting_end_time);
1462							jQuery('#meeting_description').val(m.message);
1463
1464							// Handle participants
1465							m.participant_ids.forEach(function(participantId) {
1466								const $participantElement = jQuery(`.wpem-meeting-schedule-participant-dropdown-list-item[data-user-id="${participantId}"]`);
1467								if ($participantElement.length) {
1468									$participantElement.trigger('click');
1469								}
1470							});
1471
1472							// Calendar handling
1473							const selectedDate = new Date(m.meeting_date);
1474							currentDate = new Date(selectedDate.getFullYear(), selectedDate.getMonth(), 1);
1475							FrontendRegistration.actions.renderCalendar(currentDate);
1476
1477							setTimeout(function() {
1478								const day = selectedDate.getDate();
1479								jQuery('.calendar-day-container .day-number').each(function() {
1480									if (parseInt(jQuery(this).text()) === day) {
1481										jQuery(this).trigger('click');
1482									}
1483								});
1484							}, 100);
1485
1486							// ========== Show Booked Time Slot ==========
1487							jQuery('.wpem-booked-slot-container').show();
1488							jQuery('.wpem-booked-slot').html(`
1489								<div class="wpem-booked-slot-item">
1490									<span class="wpem-booked-slot-time">${formattedStartTime}</span>
1491									<span class="wpem-booked-slot-badge">(Booked)</span>
1492								</div>
1493							`);
1494
1495							// ========== Time Slot Selection ==========
1496							function checkTimeSlotWhenReady() {
1497								const $slot = jQuery(`input[name="time_slot"][value="${formattedStartTime}"]`);
1498
1499								if ($slot.length) {
1500									$slot.prop('checked', true);
1501								} else {
1502									setTimeout(checkTimeSlotWhenReady, 100);
1503								}
1504							}
1505							setTimeout(checkTimeSlotWhenReady, 200);
1506							
1507							jQuery('#meeting-request-popup').addClass('wpem-modal-open');
1508						} else {
1509							alert('Could not fetch meeting details');
1510						}
1511					}
1512				});
1513			},
1514
1515			SavedAvailability : function(selectElement) {
1516				const $select = jQuery(selectElement);
1517				const formData = $select.serialize();
1518				const nonce = jQuery('#wpem_save_meeting_availability_nonce').val();
1519				jQuery.ajax({
1520					url: wpem_registrations_frontend.ajaxUrl,
1521					type: 'POST',
1522					data: {
1523						action: 'wpem_save_meeting_availability',
1524						form_data: formData,
1525						wpem_save_meeting_availability_nonce: nonce
1526					},
1527					success: function (response) {
1528						if (response.success) {
1529							jQuery('.availability_setting_msg').show();
1530							jQuery('.availability_setting_update_msg').text(response.data);
1531							setTimeout(function () {
1532								jQuery('#availability-popup').removeClass('wpem-modal-open');
1533							}, 2000);
1534						} else {
1535							alert('Error: ' + response.data);
1536						}
1537					}
1538				});
1539			},
1540
1541			ShowCommonMeetingSlots : function(eventId, date, userIds){
1542				jQuery.ajax({
1543					url: wpem_registrations_frontend.ajaxUrl,
1544					type: 'POST',
1545					data: {
1546						action: 'wpem_get_common_available_slots_for_meeting',
1547						event_id: eventId,
1548						date: date,
1549						user_ids: userIds,
1550						wpem_nonce: wpem_registrations_frontend.nonce,
1551
1552					},
1553					success: function (res) {
1554						var wrapper = jQuery('.wpem-availability-meeting-request-time-slot');
1555						wrapper.empty();
1556						if (res.data && res.data.common_slots && res.data.common_slots.length > 0) {
1557							res.data.common_slots.forEach(function (slotObj, index) {
1558								const slot     = slotObj.time;
1559								const isBooked = slotObj.is_booked;
1560								const inputId  = 'time_slot_' + index;
1561
1562								const html = `
1563									<div class="wpem-availability-meetings-time-slot-item wpem-mb-2">
1564										<input type="radio" name="time_slot" id="${inputId}" value="${slot}" ${isBooked ? 'disabled' : ''}>
1565										<label for="${inputId}" ${isBooked ? 'style="color: #aaa; text-decoration: line-through;" title="Slot already booked"' : ''}>
1566											${slot}
1567										</label>
1568									</div>
1569								`;
1570
1571								wrapper.append(html);
1572							});
1573						} else {
1574							wrapper.html('<div class="wpem-text-muted" style="padding: 1rem; text-align: center; color: #888;">No slots found</div>');
1575						}
1576					}
1577				});
1578			},
1579
1580			CreateMeetingRequestSubmit: function () {
1581				const selectedIdsRaw = jQuery('#selected_participant_ids').val();
1582				const allIds = selectedIdsRaw
1583					? selectedIdsRaw.split(',').map(id => parseInt(id.trim())).filter(id => !isNaN(id))
1584					: [];
1585
1586				if (allIds.length === 0) {
1587					alert('Please select at least one participant.');
1588					return;
1589				}
1590
1591				const userId       = allIds[0]; // First participant becomes host
1592				const participantIds = allIds; // Rest are participants
1593				const eventId      = jQuery('#meeting_create_event_id').val();
1594				if (jQuery('#meeting_id').length) {
1595					var meetingId    = jQuery('#meeting_id').val();
1596				} else {
1597					var meetingId = 0; // No meeting ID if not editing
1598				}
1599				const meetingDate  = jQuery('#selected_meeting_date').val();
1600				const selectedSlot = jQuery('input[name="time_slot"]:checked').val();
1601				const meeting_description = jQuery('#meeting_description').val();
1602				if (!eventId || !meetingDate || !selectedSlot || participantIds.length === 0) {
1603
1604					alert('Please select all required fields.');
1605					return;
1606				}
1607
1608				const data = {
1609					action: 'wpem_create_matchmaking_meeting_submission',
1610					user_id: userId,
1611					meeting_id: meetingId,
1612					event_id: eventId,
1613					meeting_date: meetingDate,
1614					meeting_slot: selectedSlot,
1615					participant_ids: participantIds,
1616					meeting_description: meeting_description
1617				};
1618
1619				jQuery.ajax({
1620					type: 'POST',
1621					url: wpem_registrations_frontend.ajaxUrl,
1622					data: data,
1623					dataType: 'json',
1624					success: function (response) {
1625						if (response.success) {
1626							jQuery('.wpem-meeting-create-msg').show();
1627							setTimeout(function () {
1628								jQuery('#meeting-request-popup').removeClass('wpem-modal-open');
1629							}, 2000);
1630							//jQuery('a[data-target="#meetings"]').trigger('click');
1631							const url = new URL(window.location);
1632							url.searchParams.set('tab', 'meetings');
1633							window.location.href = url.toString();
1634						} else {
1635							alert("Error: " + (response.data?.message || 'Unknown error'));
1636						}
1637					},
1638					error: function (xhr, status, error) {
1639						console.error("AJAX Error:", status, error);
1640					}
1641				});
1642			},
1643			
1644			ConversationInfoBtn: function (el) {
1645
1646				var ids = jQuery(el);
1647				const currentUserId = ids.data('current-user');
1648				const receiverId = jQuery(el).attr('data-receiver-id');
1649
1650				const $popup = jQuery('.conversation-info-popup');
1651				const $container = $popup.find('.wpem-conversation-members-container');
1652				const $aboutContainer = jQuery('#tab2 .wpem-conversation-about-container ul');
1653
1654				// Step 1: Clear previous content
1655				$container.empty();
1656				$aboutContainer.empty();
1657
1658				// Step 2: Make AJAX call
1659				jQuery.ajax({
1660					url: wpem_registrations_frontend.ajaxUrl,
1661					type: 'POST',
1662					data: {
1663						action: 'wpem_get_conversation_members',
1664						current_user_id: currentUserId,
1665						receiver_user_id: receiverId
1666					},
1667					success: function (response) {
1668						if (response.success) {
1669							// Step 3: Inject fresh content
1670							$container.html(response.data.html);
1671							$aboutContainer.html(response.data.about_html);
1672							$popup.addClass('wpem-modal-open');
1673						} else {
1674							alert('Failed to load conversation info.');
1675						}
1676					}
1677				});
1678			},
1679
1680			/**
1681			 * Save User Profile Settings from user profile page
1682			 */
1683			SaveUserProfileSettings: function() { 
1684				var $button = jQuery("#save-settings-btn");
1685				var originalText = $button.text();
1686				var $messageBox = jQuery(".event-manager-message.wpem-alert-success");
1687				var formData = jQuery("#user-profile-settings-form").serializeArray();
1688
1689				jQuery.ajax({
1690					url: wpem_registrations_frontend.ajaxUrl,
1691					type: 'POST',
1692					data: {
1693						action: 'wpem_save_matchmaking_profile',
1694						formData : formData,
1695						wpem_nonce: wpem_registrations_frontend.nonce,
1696					},
1697					success: function (response) {
1698						if (response.success) {
1699							
1700							$messageBox
1701								.text("Settings saved successfully.")
1702								.fadeIn();
1703								  jQuery('html, body').animate({
1704								scrollTop: $messageBox.offset().top - 100
1705							}, 500);
1706
1707						} else {
1708							alert(response.data?.message || 'Error saving settings.');
1709							$button.prop("disabled", false).text(originalText);
1710						}
1711					},
1712					error: function () {
1713						alert('AJAX request failed.');
1714						$button.prop("disabled", false).text(originalText);
1715					}
1716				});
1717			},
1718			ToggleMeetingAvailabilityTimeSlots: function() {
1719				let value = jQuery('#available_for_meeting').is(':checked') ? 1 : 0;
1720				if(value == 1) {
1721					jQuery('.wpem-availability-meetings-date-item').show();
1722				} else {
1723					jQuery('.wpem-availability-meetings-date-item').hide();
1724				}
1725			},
1726			SearchMeetingParticipants : function(inputEl){
1727				var search_keyword = jQuery(inputEl).val().toLowerCase().trim();
1728
1729				jQuery('.wpem-meeting-schedule-participant-dropdown-list-item').each(function () {
1730					var name = jQuery(this).attr('data-user-name') || jQuery(this).text();
1731					name = name.toLowerCase().trim();
1732					var match = (search_keyword === '') || (name.indexOf(search_keyword) !== -1);
1733					jQuery(this).toggleClass('wpem-hidden', !match);
1734				});
1735			},
1736			 toggleTimezoneDropdown : function() {
1737				if (jQuery('input[name="timezone_settings"]:checked').val() === 'custom') {
1738					jQuery('.wpem-timezone-dropdown').slideDown();
1739				} else {
1740					jQuery('.wpem-timezone-dropdown').slideUp();
1741				}
1742			},
1743
1744			/**
1745			 * Delete matchmaking meeting (only meeting, not chat messages)
1746			 */
1747			DeleteMeeting: function (e) {
1748				e.preventDefault();
1749				
1750				var $btn = jQuery(e.currentTarget);
1751				var meetingId = $btn.data('meeting-id');
1752				
1753				if (!meetingId) {
1754					return;
1755				}
1756				
1757				if (!confirm('Are you sure you want to delete this meeting? This action cannot be undone.')) {
1758					return;
1759				}
1760				
1761				jQuery.ajax({
1762					url: wpem_registrations_frontend.ajaxUrl,
1763					type: 'POST',
1764					data: {
1765						action: 'wpem_delete_matchmaking_meeting', 
1766						meeting_id: meetingId,
1767						wpem_nonce: wpem_registrations_frontend.nonce,
1768					},
1769					success: function (response) {
1770						if (response.success) {
1771							// meeting wrapper
1772							var $meetingElement = $btn.closest('.wpem-matchmaking-meeting-wrapper');
1773							var $dateGroup = $meetingElement.closest('.wpem-matchmaking-date-group');
1774			
1775							$meetingElement.fadeOut(300, function() {
1776								jQuery(this).remove();
1777			
1778								// check if group is empty now
1779								if ($dateGroup.find('.wpem-matchmaking-meeting-wrapper').length === 0) {
1780									$dateGroup.fadeOut(300, function() {
1781										jQuery(this).remove();
1782									});
1783								}
1784							});
1785						} else {
1786							alert(response.data?.message || 'Error deleting meeting.');
1787						}
1788					},
1789					error: function () {
1790						alert('Error deleting meeting.');
1791					}
1792				});
1793			},			
1794        },
1795    };
1796};
1797
1798(FrontendRegistration = FrontendRegistration()),
1799    jQuery(document).ready(function (t) {
1800        FrontendRegistration.init();
1801});

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.