🏨 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>
142 lines
3.6 KiB
JavaScript
142 lines
3.6 KiB
JavaScript
/* global redux_change, wp, redux */
|
|
|
|
(function( $ ) {
|
|
'use strict';
|
|
|
|
redux.field_objects = redux.field_objects || {};
|
|
redux.field_objects.gallery = redux.field_objects.gallery || {};
|
|
|
|
redux.field_objects.gallery.init = function( selector ) {
|
|
selector = $.redux.getSelector( selector, 'gallery' );
|
|
|
|
$( selector ).each(
|
|
function() {
|
|
var el = $( this );
|
|
var parent = el;
|
|
|
|
if ( ! el.hasClass( 'redux-field-container' ) ) {
|
|
parent = el.parents( '.redux-field-container:first' );
|
|
}
|
|
|
|
if ( parent.is( ':hidden' ) ) {
|
|
return;
|
|
}
|
|
|
|
if ( parent.hasClass( 'redux-field-init' ) ) {
|
|
parent.removeClass( 'redux-field-init' );
|
|
} else {
|
|
return;
|
|
}
|
|
|
|
// When the user clicks on the Add/Edit gallery button, we need to display the gallery editing.
|
|
el.on(
|
|
{
|
|
click: function( event ) {
|
|
var current_gallery;
|
|
var final;
|
|
var val;
|
|
var frame;
|
|
var uploader;
|
|
var spinner;
|
|
var inline;
|
|
|
|
// Hide gallery settings used for posts/pages.
|
|
wp.media.view.Settings.Gallery = wp.media.view.Settings.Gallery.extend(
|
|
{
|
|
template: function() {
|
|
return;
|
|
}
|
|
}
|
|
);
|
|
|
|
current_gallery = $( this ).closest( 'fieldset' );
|
|
|
|
if ( 'clear-gallery' === event.currentTarget.id ) {
|
|
|
|
// Remove value from input.
|
|
current_gallery.find( '.gallery_values' ).val( '' );
|
|
|
|
// Remove preview images.
|
|
current_gallery.find( '.screenshot' ).html( '' );
|
|
|
|
return;
|
|
}
|
|
|
|
// Make sure the media gallery API exists.
|
|
if ( 'undefined' === typeof wp || ! wp.media || ! wp.media.gallery ) {
|
|
return;
|
|
}
|
|
|
|
event.preventDefault();
|
|
|
|
// Activate the media editor.
|
|
val = current_gallery.find( '.gallery_values' ).val();
|
|
|
|
if ( ! val ) {
|
|
final = '[gallery ids="0"]';
|
|
} else {
|
|
final = '[gallery ids="' + val + '"]';
|
|
}
|
|
|
|
frame = wp.media.gallery.edit( final );
|
|
|
|
if ( ! val ) {
|
|
uploader = $( 'body' ).find( '#' + frame.el.id );
|
|
inline = uploader.find( '.uploader-inline' );
|
|
spinner = uploader.find( '.media-toolbar .spinner' );
|
|
|
|
setTimeout(
|
|
function() {
|
|
if ( inline.hasClass( 'hidden' ) ) {
|
|
inline.removeClass( 'hidden' );
|
|
spinner.removeClass( 'is-active' );
|
|
}
|
|
},
|
|
400
|
|
);
|
|
}
|
|
|
|
// When the gallery-edit state is updated, copy the attachment ids across.
|
|
frame.state( 'gallery-edit' ).on(
|
|
'update',
|
|
function( selection ) {
|
|
var ids;
|
|
var element;
|
|
var preview_img;
|
|
|
|
var preview_html = '';
|
|
|
|
// Clear screenshot div so we can append new selected images.
|
|
current_gallery.find( '.screenshot' ).html( '' );
|
|
|
|
ids = selection.models.map(
|
|
function( e ) {
|
|
element = e.toJSON();
|
|
|
|
preview_img = ( 'undefined' !== typeof element.sizes && 'undefined' !== typeof element.sizes.thumbnail ) ? element.sizes.thumbnail.url : element.url;
|
|
|
|
preview_html = '<a class="of-uploaded-image" href="' + preview_img + '"><img class="redux-option-image" src="' + preview_img + '" alt="" /></a>';
|
|
current_gallery.find( '.screenshot' ).append( preview_html );
|
|
|
|
return e.id;
|
|
}
|
|
);
|
|
|
|
current_gallery.find( '.gallery_values' ).val( ids.join( ',' ) );
|
|
|
|
redux_change( current_gallery.find( '.gallery_values' ) );
|
|
|
|
frame.detach();
|
|
}
|
|
);
|
|
|
|
return false;
|
|
}
|
|
},
|
|
'.gallery-attachments'
|
|
);
|
|
}
|
|
);
|
|
};
|
|
})( jQuery );
|