File: /var/www/html/video-rental/wp-content/themes/video-rental-olds/footer.php
<!-- Logout Modal -->
<div class="modal fade logout-modal custom-modal" id="logoutModal" tabindex="-1" aria-labelledby="logoutModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-md modal-dialog-centered">
<div class="modal-content">
<div class="modal-header border-0">
<button type="button" class="close-btn" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<!-- Hidden real logout link with secure nonce -->
<a id="trueLogout" href="<?php echo wp_logout_url(add_query_arg('logged_out', 'true', home_url('/'))); ?>"
style="display:none;"></a>
<div class="modal-body">
<div class="logout-modal-block">
<div class="img-block text-center">
<img src="<?php echo get_template_directory_uri(); ?>/img/logout-img.svg" alt="">
</div>
<div class="txt-block text-center">
<h3>You’re <span>Logged Out</span></h3>
<p>For your security, we’ve ended your session.</p>
</div>
</div>
<div class="modal-footer d-flex justify-content-between">
<button class="btn back-btn verify-btn">Back to Home</button>
<button class="btn verify-btn" id="loggedOut-btn">Submit</button>
</div>
</div>
</div>
</div>
</div>
<!-- Login Prompt Modal -->
<div class="modal custom-modal failed-modal" id="thankYouModal" tabindex="-1" aria-labelledby="thankYouModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header border-0">
<button type="button" class="close-btn" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<!-- Modal Body -->
<div class="modal-body justify-content-center border-0 text-center d-flex flex-column align-items-center">
<span class="modal-icon">
<img src="<?php echo get_template_directory_uri(); ?>/img/logout-img.svg" alt="Failed" />
</span>
<h3 class="text-danger">Thank You!</h3>
<p id="thankYouMessage">
</p>
</div>
<!-- Modal Footer -->
<div class="modal-footer d-flex justify-content-center border-0">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<a href="/" class="btn btn-primary proceed-login">Back to Home</a>
<!-- <button type="button" class="btn btn-primary proceed-login">Back to Home</button> -->
</div>
</div>
</div>
</div>
<footer class="site-footer">
<div class="container custom-container">
<div class="row ft-inner">
<div class="lef-sec">
<div class="logo-footer"><img src="<?php echo get_template_directory_uri(); ?>/img/footer-logo.svg"
alt="footer-logo"></div>
<div class="footer-description">
<div>Tisha B'Av:</div>
<div>Stories That Inspire, Messages That Matter</div>
</div>
</div>
<div class="footer-rt">
<ul class="footer-nav">
<li><a href="<?= home_url() ?>"
class="footer-link <?php echo (is_front_page()) ? 'active' : ''; ?>">Home</a></li>
<li><a href="<?= site_url('about-us') ?>"
class="footer-link <?php echo is_page('about-us') ? 'active' : ''; ?>">About</a></li>
<li><a href="<?= site_url('contact-us') ?>"
class="footer-link <?php echo is_page('contact-us') ? 'active' : ''; ?>">Contact Us</a></li>
<!-- <li><a href="#" class="footer-link">Help</a></li> -->
</ul>
</div>
</div>
</div>
</footer>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
<!-- scripts -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/js/bootstrap.bundle.min.js"
integrity="sha512-7Pi/otdlbbCR+LnW+F7PwFcSDJOuUJB3OxtEHbg4vSMvzvJjde4Po1v4BR9Gdc9aXNUNFVUY+SK51wWT8WF0Gg=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdn.jsdelivr.net/npm/parsleyjs@2.9.2/dist/parsley.min.js"></script>
<script>
$(document).ready(function () {
$('.banner-slider').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
dots: false,
autoplay: false,
});
});
$('a[href^="#"]').click(function (e) {
e.preventDefault();
var href = $(this).attr('href');
// Skip if href is exactly "#" or empty
if (href === '#' || href === '') {
return;
}
var target = $(href); // use href directly as selector
if (target.length) {
$('html, body').animate({
scrollTop: target.offset().top
}, 100);
}
});
// Menu
$('[data-toggle="offcanvas"]').on('click', function () {
$('.offcanvas-collapse').toggleClass('open');
$('body').toggleClass('nav-active');
})
$(window).scroll(function () {
if ($(this).scrollTop() > 80) {
$('.header').addClass('shrink');
} else {
$('.header').removeClass('shrink');
}
});
$(document).ready(function () {
$(".hamburger").click(function () {
$(this).toggleClass("is-active");
});
});
$('.navbar-nav .nav-item a').click(function (e) {
// Check if the clicked link has the 'dropdown-toggle' class
if (!$(this).hasClass('dropdown-toggle')) {
$('.navbar-collapse').removeClass('open');
$('.hamburger').removeClass('is-active');
}
$('.navbar-nav .nav-item a').removeClass('active');
$(this).addClass('active');
// Smooth scrolling
$('html, body').animate({
scrollTop: $($(this).attr('href')).offset().top - 60
}, 100);
});
// $(".user-wrap .link").click(function(){ alert('sd')
// $(".user-list").toggleClass("main");
// });
$(document).ready(function () {
$("#userClick").click(function () {
$('.user-list').slideToggle();
});
});
</script>
<script>
jQuery(document).ready(function ($) {
$('.send-affiliate-link').on('click', function () {
const userId = $(this).data('user-id');
const button = $(this);
button.prop('disabled', true).text('Sending...');
$.post(sendAffiliateAjax.ajax_url, {
action: 'send_affiliate_email',
user_id: userId,
nonce: sendAffiliateAjax.nonce
}, function (response) {
if (response.success) {
alert('Affiliate link sent!');
} else {
alert('Error: ' + (response.data.message || 'Something went wrong.'));
}
button.prop('disabled', false).text('Send');
});
});
});
document.addEventListener('DOMContentLoaded', function () {
// Get affiliate code from cookie or URL
function getAffiliateCode() {
// Check cookie
const cookieMatch = document.cookie.match(/(?:^|; )affiliate_ref=([^;]+)/);
if (cookieMatch) {
return decodeURIComponent(cookieMatch[1]);
}
// Check URL (fallback)
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get('aff') || '';
}
const affCode = getAffiliateCode();
if (affCode) {
const affInput = document.getElementById('affiliateCode');
if (affInput) affInput.value = affCode;
}
});
document.addEventListener('DOMContentLoaded', function () {
const radios = document.querySelectorAll('input[name="package_types"]');
const amountDisplay = document.getElementById('amountDisplay');
const amountInput = document.getElementById('amount');
function updateAmount(packageType) {
fetch('<?php echo admin_url('admin-ajax.php'); ?>?action=get_package_price&type=' + packageType)
.then(response => response.json())
.then(data => {
if (data.success) {
const price = parseFloat(data.data.amount).toFixed(2);
amountDisplay.textContent = `$${price}`;
amountInput.value = price;
} else {
alert('Error fetching price: ' + data.data.message);
}
})
.catch(error => {
console.error('AJAX error:', error);
alert('Something went wrong.');
});
}
// On radio change
radios.forEach(function (radio) {
radio.addEventListener('change', function () {
updateAmount(this.value);
});
});
// Trigger default on page load (assuming "single" is checked by default)
const defaultChecked = document.querySelector('input[name="package_types"]:checked');
if (defaultChecked) {
updateAmount(defaultChecked.value);
}
});
jQuery(document).ready(function ($) {
$('#step1Form').parsley();
});
document.addEventListener('DOMContentLoaded', function () {
const expiryInput = document.getElementById('expiry');
if (expiryInput) {
expiryInput.addEventListener('input', function () {
let val = expiryInput.value.replace(/\D/g, ''); // Remove non-digits
if (val.length >= 2) {
val = val.substring(0, 2) + '/' + val.substring(2, 4);
}
expiryInput.value = val.substring(0, 5); // Enforce MM/YY format
});
} else {
console.warn("Element with ID 'expiry' not found.");
}
});
const states = [
"Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut",
"Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa",
"Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan",
"Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada",
"New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota",
"Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina",
"South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington",
"West Virginia", "Wisconsin", "Wyoming"
];
const select = document.getElementById('stateSelect');
// states.forEach(state => {
// const option = document.createElement('option');
// option.value = state;
// option.textContent = state;
// select.appendChild(option);
// });
if (select) {
states.forEach(state => {
const option = document.createElement('option');
option.value = state;
option.textContent = state;
select.appendChild(option);
});
} else {
console.warn('Select element not found!');
}
if (window.location.search.includes('aff=')) {
setTimeout(() => {
const url = new URL(window.location.href);
url.searchParams.delete('aff');
window.history.replaceState({}, document.title, url.pathname + url.search);
}, 2000); // wait 2 seconds before removing from URL
}
document.addEventListener('DOMContentLoaded', function () {
const modal = new bootstrap.Modal(document.getElementById('videoPlayerModal'));
const iframe = document.getElementById('videoIframe');
document.querySelectorAll('.play-video').forEach(el => {
el.addEventListener('click', function (e) {
e.preventDefault();
const videoUrl = this.getAttribute('data-video-url');
if (videoUrl) {
iframe.src = videoUrl + '?autoplay=1';
modal.show();
}
});
});
// Stop video on modal close
document.getElementById('videoPlayerModal').addEventListener('hidden.bs.modal', () => {
iframe.src = '';
});
});
jQuery(document).ready(function ($) {
const isUserLoggedIn = <?php echo is_user_logged_in() ? 'true' : 'false'; ?>;
$('.rent-now-btn').on('click', function () {
const postId = $(this).data('post-id');
if (isUserLoggedIn) {
const modal = new bootstrap.Modal(document.getElementById('modalStep1'));
modal.show();
const selectedInput = $('input[name="radio-group"]:checked').attr('id');
const selectedPackage = $('input[name="radio-group"]:checked').val();
// const selectedPrice = prices[selectedPackage];
// $('input[name="package_types"][value="' + selectedPackage + '"]').prop('checked', true);
// $('#amountDisplay').text(`$${selectedPrice.toFixed(2)}`);
// $('#amount').val(selectedPrice);
// Pass video ID
const videoId = $(this).data('post-id');
$('#rentalVideoId').val(videoId);
} else {
const loginPrompt = new bootstrap.Modal(document.getElementById('loginPromptModal'));
loginPrompt.show();
const selectedPackage = $('input[name="radio-group"]:checked').val();
$('.proceed-login').off('click').on('click', function () {
// Redirect with post ID and continue flag
window.location.href = `/login/?continue_rent=1&licence=${selectedPackage}`;
});
}
});
// After login, if ?continue_rent=1 is present, show rent modal
const urlParams = new URLSearchParams(window.location.search);
if (isUserLoggedIn && urlParams.get('continue_rent') === '1') {
const modal = new bootstrap.Modal(document.getElementById('modalStep1'));
modal.show();
const selectedLicence = urlParams.get('licence'); // 'single' or 'family'
const amountDisplay = document.getElementById('amountDisplay');
const amountInput = document.getElementById('amount');
function updateAmount(selectedLicence) {
fetch('<?php echo admin_url('admin-ajax.php'); ?>?action=get_package_price&type=' + selectedLicence)
.then(response => response.json())
.then(data => {
if (data.success) {
const price = parseFloat(data.data.amount).toFixed(2);
amountDisplay.textContent = `$${price}`;
amountInput.value = price;
} else {
alert('Error fetching price: ' + data.data.message);
}
})
.catch(error => {
console.error('AJAX error:', error);
alert('Something went wrong.');
});
}
if (selectedLicence === 'single' || selectedLicence === 'family') {
$(`input[name="package_types"][value="${selectedLicence}"]`).prop('checked', true);
updateAmount(selectedLicence);
}
// Optionally clear query params after showing modal
const newUrl = window.location.origin + window.location.pathname;
window.history.replaceState({}, document.title, newUrl);
}
});
jQuery(document).ready(function ($) {
$('#applyCouponBtn').on('click', function () {
let code = $('#coupon_code').val().trim();
let videoId = $('#rentalVideoId').val(); // or get package type
let packageType = $('input[name="package_types"]:checked').val();
if (!code) return;
$.ajax({
url: '<?php echo admin_url("admin-ajax.php"); ?>',
method: 'POST',
data: {
action: 'validate_discount_code',
code: code,
video_id: videoId,
package_type: packageType,
},
success: function (response) {
if (response.success) {
$('#couponMessage')
.text(response.data.message)
.removeClass('text-danger')
.addClass('text-success')
.show();
// Show new discounted amount
let newAmount = parseFloat(response.data.discounted_amount).toFixed(2);
$('#amountDisplay').text(`$${newAmount}`);
$('#amount').val(newAmount);
console.log("Coupon applied, setting value:", code);
$('#coupon_value').val(code);
// Save code for submission
if (!$('#discount_applied').length) {
$('<input>').attr({
type: 'hidden',
id: 'discount_applied',
name: 'discount_applied',
value: code
}).appendTo('#step1Form');
}
} else {
$('#couponMessage')
.text(response.data.message)
.removeClass('text-success')
.addClass('text-danger')
.show();
}
}
});
});
});
</script>
<style>
button#applyCouponBtn {
color: #fff;
background: #f9b548 radial-gradient(circle, rgb(249, 181, 72) 40%, rgb(200, 133, 25) 100%) !important;
}
</style>
<?php wp_footer(); ?>
</body>
</html>