:: **Zploit** v1.0 | Current Path: **/home/kreativepixelz/soulmeetvivah.com/member/**
:: Editing File: matches.php
<?php include('header.php'); ?> <div style="height: 100px;"></div> <!-- ==========Matches Section Start Here========== --> <div class="page-content"> <div class="container"> <!-- Matches Header --> <div class="block-box user-about mb-4"> <div class="widget-heading" style="background: linear-gradient(135deg, #cd4252 0%, #b83847 100%); padding: 25px; border-radius: 15px 15px 0 0;"> <h3 style="color: #fff; margin: 0; font-size: 28px; font-weight: 600;"> <i class="icofont-heart" style="margin-right: 10px;"></i>Your Matches </h3> <p style="color: rgba(255,255,255,0.9); margin: 10px 0 0 0; font-size: 16px;">Discover profiles that match your preferences</p> </div> </div> <!-- Search Bar --> <div class="block-box user-about mb-4"> <div class="matches-search-container"> <form id="matchesSearchForm" action="javascript:void(0);"> <div class="search-input-wrapper"> <i class="icofont-search-2 search-icon"></i> <input type="text" id="matchesSearchInput" class="matches-search-input" placeholder="Search by Name or SV ID..." autocomplete="off"> <button type="submit" class="matches-search-btn"> <i class="icofont-search-2"></i> Search </button> </div> </form> </div> </div> <!-- Quick Filters --> <div class="block-box user-about mb-4"> <div class="matches-search-container"> <form id="matchesFilterForm" action="javascript:void(0);"> <div class="row g-3 align-items-end"> <div class="col-6 col-md-2"> <label class="form-label">Age From</label> <input type="number" class="form-control" id="filterAgeFrom" min="18" placeholder="18"> </div> <div class="col-6 col-md-2"> <label class="form-label">Age To</label> <input type="number" class="form-control" id="filterAgeTo" min="18" placeholder="40"> </div> <div class="col-12 col-md-4"> <label class="form-label">Location</label> <input type="text" class="form-control" id="filterLocation" placeholder="City / State / Country"> </div> <div class="col-12 col-md-3"> <label class="form-label">Marital Status</label> <select class="form-control" id="filterMaritalStatus"> <option value="">All</option> <option value="Never Married">Never Married</option> <option value="Divorced">Divorced</option> <option value="Widowed">Widowed</option> <option value="Separated">Separated</option> <option value="Awaiting Divorce">Awaiting Divorce</option> <option value="Annulled">Annulled</option> </select> </div> <div class="col-6 col-md-1 d-grid"> <button type="submit" class="matches-search-btn" style="padding: 12px 12px;"> Apply </button> </div> </div> </form> </div> </div> <!-- Matches Container --> <div class="matches-wrapper"> <div class="row g-4" id="fetchMatches"> <!-- Matches will be loaded here --> </div> </div> <!-- Empty State --> <div id="matchesEmpty" class="text-center py-5" style="display: none;"> <div class="block-box user-about"> <div class="widget-heading text-center py-5"> <i class="icofont-heart-alt" style="font-size: 80px; color: #ddd; margin-bottom: 20px;"></i> <h4 style="color: #999; font-weight: 400;">No matches found</h4> <p style="color: #bbb; margin-top: 10px;">Try adjusting your search or check back later</p> </div> </div> </div> </div> </div> <!-- ==========Matches Section End Here========== --> <style type="text/css"> body { background-color: #f5f5f5; } /* Search Container */ .matches-search-container { background: #fff; padding: 25px; border-radius: 15px; box-shadow: 0 3px 15px rgba(0,0,0,0.08); } .search-input-wrapper { display: flex; align-items: center; gap: 15px; position: relative; } .search-icon { position: absolute; left: 20px; color: #cd4252; font-size: 20px; z-index: 1; } .matches-search-input { flex: 1; padding: 15px 15px 15px 50px; border: 2px solid #e0e0e0; border-radius: 10px; font-size: 15px; transition: all 0.3s ease; background: #fff; } .matches-search-input:focus { border-color: #cd4252; box-shadow: 0 0 0 0.2rem rgba(205, 66, 82, 0.15); outline: none; } .matches-search-btn { background: linear-gradient(135deg, #cd4252 0%, #b83847 100%); color: #fff; border: none; padding: 15px 30px; border-radius: 10px; font-weight: 600; font-size: 15px; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(205, 66, 82, 0.3); white-space: nowrap; } .matches-search-btn:hover { background: linear-gradient(135deg, #b83847 0%, #a83242 100%); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(205, 66, 82, 0.4); } .matches-search-btn i { margin-right: 5px; } /* Match Card Styles */ .match-card { background: #fff; border-radius: 15px; box-shadow: 0 3px 15px rgba(0,0,0,0.08); transition: all 0.3s ease; overflow: hidden; border: 2px solid transparent; height: 100%; } .match-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(205, 66, 82, 0.15); border-color: #cd4252; } .match-card-content { padding: 25px; display: flex; gap: 20px; align-items: flex-start; } .match-avatar { flex-shrink: 0; } .match-avatar img { width: 120px; height: 120px; object-fit: cover; border-radius: 15px; border: 3px solid #cd4252; box-shadow: 0 3px 10px rgba(205, 66, 82, 0.2); } .match-info { flex: 1; min-width: 0; } .match-name { color: #333; font-size: 22px; font-weight: 600; margin: 0 0 15px 0; } .match-details { margin-bottom: 15px; } .match-item { color: #666; font-size: 14px; margin: 8px 0; display: flex; align-items: center; } .match-item strong { color: #333; margin-right: 8px; min-width: 120px; } .match-item i { color: #cd4252; margin-right: 8px; width: 20px; text-align: center; } .match-view-btn { background: linear-gradient(135deg, #cd4252 0%, #b83847 100%); color: #fff; padding: 12px 30px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 14px; display: inline-block; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(205, 66, 82, 0.3); margin-top: 10px; } .match-view-btn:hover { background: linear-gradient(135deg, #b83847 0%, #a83242 100%); color: #fff; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(205, 66, 82, 0.4); } /* Save and Interest Buttons */ .match-save-btn, .match-interest-btn { background: #fff; color: #cd4252; border: 2px solid #cd4252; padding: 10px 20px; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer; transition: all 0.3s ease; display: inline-flex; align-items: center; gap: 5px; } .match-save-btn:hover, .match-interest-btn:hover { background: #cd4252; color: #fff; transform: translateY(-2px); box-shadow: 0 4px 15px rgba(205, 66, 82, 0.3); } .match-save-btn.saved, .match-interest-btn.interested { background: #cd4252; color: #fff; border-color: #cd4252; } .match-save-btn.saved:hover, .match-interest-btn.interested:hover { background: #b83847; border-color: #b83847; } .match-save-btn:disabled, .match-interest-btn:disabled { opacity: 0.6; cursor: not-allowed; } /* Loading Spinner */ .lds-spinner, .lds-spinner div, .lds-spinner div:after { box-sizing: border-box; } .lds-spinner { color: #cd4252; display: inline-block; position: relative; width: 80px; height: 80px; } .lds-spinner div { transform-origin: 40px 40px; animation: lds-spinner 1.2s linear infinite; } .lds-spinner div:after { content: " "; display: block; position: absolute; top: 3.2px; left: 36.8px; width: 6.4px; height: 17.6px; border-radius: 20%; background: currentColor; } .lds-spinner div:nth-child(1) { transform: rotate(0deg); animation-delay: -1.1s; } .lds-spinner div:nth-child(2) { transform: rotate(30deg); animation-delay: -1s; } .lds-spinner div:nth-child(3) { transform: rotate(60deg); animation-delay: -0.9s; } .lds-spinner div:nth-child(4) { transform: rotate(90deg); animation-delay: -0.8s; } .lds-spinner div:nth-child(5) { transform: rotate(120deg); animation-delay: -0.7s; } .lds-spinner div:nth-child(6) { transform: rotate(150deg); animation-delay: -0.6s; } .lds-spinner div:nth-child(7) { transform: rotate(180deg); animation-delay: -0.5s; } .lds-spinner div:nth-child(8) { transform: rotate(210deg); animation-delay: -0.4s; } .lds-spinner div:nth-child(9) { transform: rotate(240deg); animation-delay: -0.3s; } .lds-spinner div:nth-child(10) { transform: rotate(270deg); animation-delay: -0.2s; } .lds-spinner div:nth-child(11) { transform: rotate(300deg); animation-delay: -0.1s; } .lds-spinner div:nth-child(12) { transform: rotate(330deg); animation-delay: 0s; } @keyframes lds-spinner { 0% { opacity: 1; } 100% { opacity: 0; } } #loading { text-align: center; margin: 30px 0; padding: 30px; } #loading p { margin-top: 15px; color: #cd4252; font-weight: 600; } /* Responsive */ @media (max-width: 768px) { .search-input-wrapper { flex-direction: column; } .matches-search-input { width: 100%; padding-left: 50px; } .matches-search-btn { width: 100%; } .match-card-content { flex-direction: column; text-align: center; } .match-avatar { margin: 0 auto; } .match-avatar img { width: 100px; height: 100px; } .match-name { text-align: center; } .match-item { justify-content: center; } .match-item strong { min-width: auto; } } </style> <div id="loading" style="display:none;text-align:center;margin:20px;"> <div class="lds-spinner"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div> <p>Loading matches...</p> </div> <?php include('footer.php'); ?> <!-- <script type="text/javascript"> fetchMyMatches(); function fetchMyMatches(){ $.ajax({ url:'php/fetch_matches.php', method:'POST', data:{}, success:function(data){ $('#fetchMatches').html(data); } }) } </script> --> <script type="text/javascript"> let offset = 0; const limit = 20; let loading = false; let endReached = false; let searchQuery = ''; let filterAgeFrom = ''; let filterAgeTo = ''; let filterLocation = ''; let filterMaritalStatus = ''; // Fetch matches function function fetchMembers() { if (loading || endReached) return; loading = true; $('#loading').show(); $('#matchesEmpty').hide(); $.ajax({ url: 'php/fetch_matches.php', method: 'POST', data: { offset: offset, limit: limit, search: searchQuery, age_from: filterAgeFrom, age_to: filterAgeTo, living_in: filterLocation, marital_status: filterMaritalStatus }, success: function (res) { if (res.trim() === '') { if (offset === 0) { $('#matchesEmpty').show(); } endReached = true; $('#loading').hide(); loading = false; return; } $('#fetchMatches').append(res); offset += limit; loading = false; $('#loading').hide(); // Hide empty state if we have results if ($('#fetchMatches').children().length > 0) { $('#matchesEmpty').hide(); } // Check and update button states for newly loaded profiles (batched) updateButtonStates(); }, error: function(xhr, status, error) { console.error('Error fetching matches:', error); $('#loading').hide(); loading = false; if (offset === 0) { $('#matchesEmpty').show(); } } }); } // Search form handler $('#matchesSearchForm').on('submit', function(e) { e.preventDefault(); searchQuery = $('#matchesSearchInput').val().trim(); offset = 0; endReached = false; $('#fetchMatches').html(''); fetchMembers(); }); // Filter form handler $('#matchesFilterForm').on('submit', function(e) { e.preventDefault(); filterAgeFrom = $('#filterAgeFrom').val().trim(); filterAgeTo = $('#filterAgeTo').val().trim(); filterLocation = $('#filterLocation').val().trim(); filterMaritalStatus = $('#filterMaritalStatus').val(); offset = 0; endReached = false; $('#fetchMatches').html(''); fetchMembers(); }); // Clear search on input change (optional - can be removed if you want to keep search) $('#matchesSearchInput').on('input', function() { if ($(this).val().trim() === '') { searchQuery = ''; offset = 0; endReached = false; $('#fetchMatches').html(''); fetchMembers(); } }); // Scroll detection for infinite scroll $(window).scroll(function () { if ($(window).scrollTop() + $(window).height() >= $(document).height() - 100) { fetchMembers(); } }); // Initial load fetchMembers(); // Function to update button states based on interested status function updateButtonStates() { const ids = []; $('.match-interest-btn').each(function() { const pid = $(this).data('profile-id'); if (pid) ids.push(pid); }); if (ids.length === 0) return; $.ajax({ url: 'php/check_profiles_status.php', method: 'POST', data: { profile_ids: ids }, dataType: 'json', success: function(response) { const statuses = (response && response.statuses) ? response.statuses : {}; $('.match-interest-btn').each(function() { const $btn = $(this); const pid = String($btn.data('profile-id')); const st = statuses[pid]; if (!st) return; if (st.interested) { $btn.addClass('interested').find('.interest-text').text('Interested'); } else { $btn.removeClass('interested').find('.interest-text').text('Interest'); } }); } }); } // Handle Interest button clicks $(document).on('click', '.match-interest-btn', function(e) { e.preventDefault(); const $btn = $(this); const profileId = $btn.data('profile-id'); const isInterested = $btn.hasClass('interested'); if ($btn.prop('disabled')) return; $btn.prop('disabled', true); $.ajax({ url: 'php/show_interest.php', method: 'POST', data: { profile_id: profileId, action: isInterested ? 'remove' : 'show' }, dataType: 'json', success: function(response) { if (response.status === 'success') { if (response.interested) { $btn.addClass('interested').find('.interest-text').text('Interested'); } else { $btn.removeClass('interested').find('.interest-text').text('Interest'); } showNotification(response.message, 'success'); } else { showNotification(response.message || 'An error occurred', 'error'); } }, error: function(xhr, status, error) { console.error('Interest error:', error); showNotification('An error occurred. Please try again.', 'error'); }, complete: function() { $btn.prop('disabled', false); } }); }); // Show notification toast function showNotification(message, type) { const bgColor = type === 'success' ? '#28a745' : '#dc3545'; const $toast = $('<div>') .css({ position: 'fixed', top: '20px', right: '20px', background: bgColor, color: '#fff', padding: '15px 25px', borderRadius: '8px', boxShadow: '0 4px 15px rgba(0,0,0,0.2)', zIndex: 10000, fontSize: '14px', fontWeight: '600' }) .text(message) .appendTo('body'); setTimeout(function() { $toast.fadeOut(300, function() { $(this).remove(); }); }, 3000); } // Initial button state check on page load $(document).ready(function() { updateButtonStates(); }); </script>