🏨 Hotel Booking Enhancements: - Implemented Eagle Booking Advanced Pricing add-on - Added Booking.com-style rate management system - Created professional calendar interface for pricing - Integrated deals and discounts functionality 💰 Advanced Pricing Features: - Dynamic pricing models (per room, per person, per adult) - Base rates, adult rates, and child rates management - Length of stay discounts and early bird deals - Mobile rates and secret deals implementation - Seasonal promotions and flash sales 📅 Availability Management: - Real-time availability tracking - Stop sell and restriction controls - Closed to arrival/departure functionality - Minimum/maximum stay requirements - Automatic sold-out management 💳 Payment Integration: - Maintained Redsys payment gateway integration - Seamless integration with existing Eagle Booking - No modifications to core Eagle Booking plugin 🛠️ Technical Implementation: - Custom database tables for advanced pricing - WordPress hooks and filters integration - AJAX-powered admin interface - Data migration from existing Eagle Booking - Professional calendar view for revenue management 📊 Admin Interface: - Booking.com-style management dashboard - Visual rate and availability calendar - Bulk operations for date ranges - Statistics and analytics dashboard - Modal dialogs for quick editing 🔧 Code Quality: - WordPress coding standards compliance - Secure database operations with prepared statements - Proper input validation and sanitization - Error handling and logging - Responsive admin interface 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
110 lines
3.6 KiB
JavaScript
110 lines
3.6 KiB
JavaScript
/**
|
|
* Preauthorization Admin JavaScript
|
|
*
|
|
* Handles preauthorization capture and cancellation
|
|
*
|
|
* 🤖 Generated with Claude Code (https://claude.ai/code)
|
|
*/
|
|
|
|
jQuery(document).ready(function($) {
|
|
|
|
// Capture preauthorization
|
|
$(document).on('click', '.capture-preauth', function() {
|
|
if (!confirm(ebPreauth.strings.confirmCapture)) {
|
|
return;
|
|
}
|
|
|
|
var $button = $(this);
|
|
var preauthId = $button.data('preauth-id');
|
|
var bookingId = $button.data('booking-id');
|
|
var originalText = $button.text();
|
|
|
|
$button.text('Capturing...').prop('disabled', true);
|
|
|
|
$.ajax({
|
|
url: ebPreauth.ajaxurl,
|
|
type: 'POST',
|
|
data: {
|
|
action: 'capture_preauth',
|
|
nonce: ebPreauth.nonce,
|
|
preauth_id: preauthId,
|
|
booking_id: bookingId
|
|
},
|
|
success: function(response) {
|
|
if (response.success) {
|
|
showNotice('Preauthorization captured successfully!', 'success');
|
|
location.reload();
|
|
} else {
|
|
showNotice('Error: ' + response.data, 'error');
|
|
}
|
|
},
|
|
error: function() {
|
|
showNotice('An error occurred while capturing the preauthorization.', 'error');
|
|
},
|
|
complete: function() {
|
|
$button.text(originalText).prop('disabled', false);
|
|
}
|
|
});
|
|
});
|
|
|
|
// Cancel preauthorization
|
|
$(document).on('click', '.cancel-preauth', function() {
|
|
if (!confirm(ebPreauth.strings.confirmCancel)) {
|
|
return;
|
|
}
|
|
|
|
var $button = $(this);
|
|
var preauthId = $button.data('preauth-id');
|
|
var bookingId = $button.data('booking-id');
|
|
var originalText = $button.text();
|
|
|
|
$button.text('Cancelling...').prop('disabled', true);
|
|
|
|
$.ajax({
|
|
url: ebPreauth.ajaxurl,
|
|
type: 'POST',
|
|
data: {
|
|
action: 'cancel_preauth',
|
|
nonce: ebPreauth.nonce,
|
|
preauth_id: preauthId,
|
|
booking_id: bookingId
|
|
},
|
|
success: function(response) {
|
|
if (response.success) {
|
|
showNotice('Preauthorization cancelled successfully!', 'success');
|
|
location.reload();
|
|
} else {
|
|
showNotice('Error: ' + response.data, 'error');
|
|
}
|
|
},
|
|
error: function() {
|
|
showNotice('An error occurred while cancelling the preauthorization.', 'error');
|
|
},
|
|
complete: function() {
|
|
$button.text(originalText).prop('disabled', false);
|
|
}
|
|
});
|
|
});
|
|
|
|
// Show admin notices
|
|
function showNotice(message, type) {
|
|
var noticeClass = type === 'success' ? 'notice-success' : 'notice-error';
|
|
var $notice = $('<div class="notice ' + noticeClass + ' is-dismissible"><p>' + message + '</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>');
|
|
|
|
$('.wrap h1').after($notice);
|
|
|
|
// Auto-dismiss after 5 seconds
|
|
setTimeout(function() {
|
|
$notice.fadeOut(function() {
|
|
$(this).remove();
|
|
});
|
|
}, 5000);
|
|
|
|
// Handle manual dismiss
|
|
$notice.find('.notice-dismiss').on('click', function() {
|
|
$notice.fadeOut(function() {
|
|
$(this).remove();
|
|
});
|
|
});
|
|
}
|
|
}); |