Hotel Raxa - Advanced Booking System Implementation

🏨 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>
This commit is contained in:
Hotel Raxa Dev
2025-07-11 07:43:22 +02:00
commit 5b1e2453c7
9816 changed files with 2784509 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?php
/*---------------------------------------------------------------------------------
@ Coupons Metaboxes
@ Since 1.1.0
-----------------------------------------------------------------------------------*/
add_action('cmb2_admin_init', 'eagle_booking_coupons');
function eagle_booking_coupons() {
$prefix = 'eagle_booking_mtb_coupon_';
$cmb = new_cmb2_box(array(
'id' => $prefix.'meta',
'title' => esc_html__('Eagle Booking', 'eagle-booking'),
'object_types' => array('eagle_coupons'),
));
$cmb->add_field(array(
'name' => esc_html__('Code', 'eagle-booking'),
'desc' => esc_html__('Insert the coupon code ( e.g. SUMMER30 )', 'eagle-booking'),
'id' => $prefix.'code',
'type' => 'text_small',
));
$cmb->add_field(array(
'name' => esc_html__('Value', 'eagle-booking'),
'desc' => esc_html__('Insert the coupon value ( e.g. 30 for -30% )', 'eagle-booking'),
'id' => $prefix.'value',
'type' => 'text_small',
));
}

View File

@@ -0,0 +1,95 @@
<?php
/*---------------------------------------------------------------------------------
@ Exceptions Metaboxes
@ Since 1.1.0
-----------------------------------------------------------------------------------*/
add_action('cmb2_admin_init', 'eagle_booking_exceptions');
function eagle_booking_exceptions() {
$prefix = 'eagle_booking_mtb_exception_';
$cmb = new_cmb2_box(array(
'id' => $prefix.'meta',
'title' => esc_html__('Eagle Booking', 'eagle-booking'),
'object_types' => array('eagle_exceptions'),
));
$cmb->add_field(array(
'name' => esc_html__('Type', 'eagle-booking'),
'id' => $prefix.'type',
'type' => 'select',
'default' => 'normal',
'options' => array(
'price' => __( 'Custom Price', 'eagle-booking' ),
'block' => __( 'Block Dates', 'eagle-booking' ),
),
));
$cmb->add_field(array(
'name' => esc_html__('New Price', 'eagle-booking'),
'desc' => esc_html__('Insert the new room price (only number)', 'eagle-booking'),
'id' => $prefix.'price',
'type' => 'text_small',
'attributes' => array(
'required' => 'required',
'data-conditional-id' => $prefix.'type',
'data-conditional-value' => 'price',
'type' => 'number',
'pattern' => '\d*',
),
));
$cmb->add_field(array(
'name' => esc_html__('Date From', 'eagle-booking'),
'id' => $prefix.'date_from',
'type' => 'text_date',
'default' => time(),
'attributes' => array(
'readonly' => 'readonly',
'required' => 'required',
),
));
$cmb->add_field(array(
'name' => esc_html__('Date To', 'eagle-booking'),
'id' => $prefix.'date_to',
'type' => 'text_date',
'default' => time() + 432000,
'attributes' => array(
'readonly' => 'readonly',
'required' => 'required',
),
// 'date_format' => 'd/m/Y',
));
// $cmb->add_field( array(
// 'name' => esc_html__('Every Year?', 'eagle-booking'),
// 'id' => $prefix.'repeat',
// 'type' => 'checkbox',
// ) );
// $cmb->add_field( array(
// 'name' => esc_html__('Every Year?', 'eagle-booking'),
// 'id' => $prefix.'repeat',
// 'type' => 'switch',
// 'default' => true,
// 'label' => array(
// 'true'=> 'Yes',
// 'false'=> 'No'
// ),
// 'attributes' => array(
// 'data-conditional-id' => $prefix.'type',
// 'data-conditional-value' => 'block',
// ),
// ));
$cmb->add_field( array(
'id' => $prefix.'note',
'desc' => esc_html__('Note: Date From and Date To must be in the same year.', 'eagle-booking'),
'type' => 'title',
) );
}

View File

@@ -0,0 +1,15 @@
<?php
/* --------------------------------------------------------------------------
* Include all MTB required by EB
* @since 1.2.9.1
---------------------------------------------------------------------------*/
defined('ABSPATH') || exit;
require_once EB_PATH . '/core/admin/metabox/coupons.php';
require_once EB_PATH . '/core/admin/metabox/exceptions.php';
require_once EB_PATH . '/core/admin/metabox/places.php';
require_once EB_PATH . '/core/admin/metabox/reviews.php';
require_once EB_PATH . '/core/admin/metabox/rooms.php';
require_once EB_PATH . '/core/admin/metabox/services.php';
require_once EB_PATH . '/core/admin/metabox/taxes_fees.php';

View File

@@ -0,0 +1,39 @@
<?php
/*---------------------------------------------------------------------------------
@ Places Metaboxes
@ Since 1.1.0
@ Modified 1.2.7
-----------------------------------------------------------------------------------*/
add_action('cmb2_admin_init', 'eagle_booking_places');
function eagle_booking_places() {
$prefix = 'eagle_booking_mtb_place_';
$cmb = new_cmb2_box(array(
'id' => $prefix.'meta',
'title' => esc_html__('Eagle Booking', 'eagle-booking'),
'object_types' => array('eagle_places'),
));
$cmb->add_field( array(
'name' => __( 'Sidebar', 'eagle-booking' ),
'id' => $prefix.'sidebar',
'type' => 'radio_image',
'default' => 'none',
'options' => array(
'left' => __('Left', 'eagle-booking'),
'none' => __('None', 'eagle-booking'),
'right' => __('Right', 'eagle-booking'),
),
'images_path' => get_template_directory_uri(),
'images' => array(
'left' => 'assets/images/admin/sidebar-left.png',
'none' => 'assets/images/admin/sidebar-none.png',
'right' => 'assets/images/admin/sidebar-right.png',
),
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
)
);
}

View File

@@ -0,0 +1,61 @@
<?php
/*---------------------------------------------------------------------------------
@ Testimonials Metaboxes
@ Since 1.0.0
-----------------------------------------------------------------------------------*/
add_action('cmb2_admin_init', 'eb_reviews_meta');
function eb_reviews_meta() {
$prefix = 'eagle_booking_mtb_review_';
$cmb = new_cmb2_box(array(
'id' => $prefix.'meta',
'title' => esc_html__('Eagle Booking', 'eagle-booking'),
'object_types' => array('eagle_reviews'),
));
$cmb->add_field( array(
'name' => esc_html__('Avatar of author', 'eagle-booking' ),
'id' => $prefix.'image',
'type' => 'file',
'options' => array(
'url' => false,
),
) );
$cmb->add_field( array(
'name'=> esc_html__('Quote', 'eagle-booking'),
'desc' => esc_html__('quote said by the author.', 'eagle-booking'),
'id' => $prefix.'quote',
'type' => 'textarea_small',
) );
$cmb->add_field( array(
'name'=> esc_html__('Author Name', 'eagle-booking'),
'id' => $prefix.'author',
'type' => 'text_small',
) );
$cmb->add_field( array(
'name'=> esc_html__('Author Location', 'eagle-booking'),
'id' => $prefix.'author_location',
'type' => 'text_small',
) );
$cmb->add_field( array(
'name' => 'Rating',
'desc' => 'Select an option',
'id' => $prefix.'rating',
'type' => 'select',
'show_option_none' => true,
'default' => '5',
'options' => array(
'1' => __( '1 Star', 'eagle-booking' ),
'2' => __( '2 Stars', 'eagle-booking' ),
'3' => __( '3 Stars', 'eagle-booking' ),
'4' => __( '4 Stars', 'eagle-booking' ),
'5' => __( '5 Stars', 'eagle-booking' ),
),
) );
}

View File

@@ -0,0 +1,601 @@
<?php
/*---------------------------------------------------------------------------------
* Package: Eagle-Booking/Core
* Room Metaboxes
* Since 1.0.0
-----------------------------------------------------------------------------------*/
add_action('cmb2_admin_init', 'eagle_booking_rooms_metabox');
function eagle_booking_rooms_metabox() {
$prefix = 'eagle_booking_mtb_room_';
$cmb = new_cmb2_box(array(
'id' => $prefix.'meta',
'title' => esc_html__('Eagle Booking', 'eagle-booking'),
'object_types' => array('eagle_rooms'),
'tabs' => array(
'settings' => array(
'label' => __('Main Settings', 'eagle-booking'),
'icon' => 'dashicons-admin-generic',
),
'price' => array(
'label' => __('Price', 'eagle-booking'),
'icon' => 'dashicons-money',
),
'slider' => array(
'label' => __('Slider', 'eagle-booking'),
'icon' => 'dashicons-images-alt2',
),
'services' => array(
'label' => __('Services', 'eagle-booking'),
'icon' => 'dashicons-star-filled',
),
'reviews' => array(
'label' => __('Reviews', 'eagle-booking'),
'icon' => 'dashicons-testimonial',
),
'exceptions' => array(
'label' => __('Exceptions', 'eagle-booking'),
'icon' => 'dashicons-forms',
),
'integration' => array(
'label' => __('External Integration', 'eagle-booking'),
'icon' => 'dashicons-admin-plugins',
),
'layout' => array(
'label' => __('Layout', 'eagle-booking'),
'icon' => 'dashicons-format-aside',
)
),
));
// Main Settings Tab
$cmb->add_field(array(
'name' => esc_html__('Max Guests', 'eagle-booking'),
'desc' => esc_html__('Required - Insert the max guests number for the room', 'eagle-booking'),
'id' => $prefix.'maxguests',
'type' => 'text',
'show_on_cb' => "eb_show_guests_room_mtb",
'tab' => 'settings',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'attributes' => array(
'required' => 'required',
'type' => 'number',
'pattern' => '\d*',
),
));
$cmb->add_field(array(
'name' => esc_html__('Max Adults', 'eagle-booking'),
'desc' => esc_html__('Required - Insert the max adults number for the room', 'eagle-booking'),
'id' => $prefix.'max_adults',
'type' => 'text',
'show_on_cb' => 'eb_show_adults_children_room_mtb',
'tab' => 'settings',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'attributes' => array(
'required' => 'required',
'type' => 'number',
'pattern' => '\d*',
),
));
$cmb->add_field(array(
'name' => esc_html__('Max Children', 'eagle-booking'),
'desc' => esc_html__('Required - Insert the max children number for the room', 'eagle-booking'),
'id' => $prefix.'max_children',
'type' => 'text',
'show_on_cb' => 'eb_show_adults_children_room_mtb',
'tab' => 'settings',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'attributes' => array(
'required' => 'required',
'type' => 'number',
'pattern' => '\d*',
),
));
$cmb->add_field(array(
'name' => esc_html__('Quantity', 'eagle-booking'),
'desc' => esc_html__('Required - Insert the room quantity', 'eagle-booking'),
'id' => $prefix.'quantity',
'type' => 'text',
'tab' => 'settings',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'attributes' => array(
'required' => 'required',
'type' => 'number',
'pattern' => '\d*',
),
));
$cmb->add_field(array(
'name' => esc_html__('Min Booking Nights', 'eagle-booking'),
'desc' => esc_html__('Insert the minimum nights number to make a reservation. (empty = no minimum booking nights)', 'eagle-booking'),
'id' => $prefix.'min_booking_nights',
'type' => 'text',
'tab' => 'settings',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'attributes' => array(
'type' => 'number',
'pattern' => '\d*',
),
));
$cmb->add_field(array(
'name' => esc_html__('Max Booking Nights', 'eagle-booking'),
'desc' => esc_html__('Insert the maximum nights number to make a reservation. (empty = no maximum booking nights)', 'eagle-booking'),
'id' => $prefix.'max_booking_nights',
'type' => 'text',
'tab' => 'settings',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'attributes' => array(
'type' => 'number',
'pattern' => '\d*',
),
));
$cmb->add_field(array(
'name' => esc_html__('Description', 'eagle-booking'),
'desc' => __('Set the description to display on the search & rooms archive pages.', 'eagle-booking'),
'id' => $prefix.'description',
'type' => 'text',
'tab' => 'settings',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
));
$cmb->add_field(array(
'name' => esc_html__('Room Size', 'eagle-booking'),
'desc' => esc_html__('Only number ', 'eagle-booking'),
'id' => $prefix.'size',
'type' => 'text',
'tab' => 'settings',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'attributes' => array(
'type' => 'number',
'pattern' => '\d*',
),
));
$cmb->add_field(array(
'name' => esc_html__('Bed Type', 'eagle-booking'),
'desc' => __('Set the displayed bed type', 'eagle-booking'),
'id' => $prefix.'bed_type',
'type' => 'text',
'tab' => 'settings',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
));
$cmb->add_field(array(
'name' => esc_html__('Exclude from the search page', 'eagle-booking'),
'id' => $prefix.'excluded',
'type' => 'checkbox',
'tab' => 'settings',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
));
$cmb->add_field(array(
'name' => esc_html__('Featured', 'eagle-booking'),
'id' => $prefix.'featured',
'type' => 'checkbox',
'tab' => 'settings',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
));
// Price Tab
$cmb->add_field(array(
'name' => esc_html__('Room Price', 'eagle-booking'),
'desc' => esc_html__('Required - Default price, Only number.', 'eagle-booking'),
'id' => $prefix.'price',
'type' => 'text',
'tab' => 'price',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'attributes' => array(
'required' => 'required',
'type' => 'number',
'pattern' => '\d*',
),
));
$day1 = $cmb->add_field(array(
'desc' => esc_html__('Monday', 'eagle-booking'),
'id' => $prefix.'price_mon',
'type' => 'text_small',
'tab' => 'price',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'attributes' => array(
'type' => 'number',
'pattern' => '\d*',
),
));
$day2 = $cmb->add_field(array(
'desc' => esc_html__('Tuesday', 'eagle-booking'),
'id' => $prefix.'price_tue',
'type' => 'text_small',
'tab' => 'price',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'attributes' => array(
'type' => 'number',
'pattern' => '\d*',
),
));
$day3 = $cmb->add_field(array(
'desc' => esc_html__('Wednesday', 'eagle-booking'),
'id' => $prefix.'price_wed',
'type' => 'text_small',
'tab' => 'price',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'attributes' => array(
'type' => 'number',
'pattern' => '\d*',
),
));
$day4 = $cmb->add_field(array(
'desc' => esc_html__('Thursday', 'eagle-booking'),
'id' => $prefix.'price_thu',
'type' => 'text_small',
'tab' => 'price',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'attributes' => array(
'type' => 'number',
'pattern' => '\d*',
),
));
$day5 = $cmb->add_field(array(
'desc' => esc_html__('Friday', 'eagle-booking'),
'id' => $prefix.'price_fri',
'type' => 'text_small',
'tab' => 'price',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'attributes' => array(
'type' => 'number',
'pattern' => '\d*',
),
));
$day6 = $cmb->add_field(array(
'desc' => esc_html__('Saturday', 'eagle-booking'),
'id' => $prefix.'price_sat',
'type' => 'text_small',
'tab' => 'price',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'attributes' => array(
'type' => 'number',
'pattern' => '\d*',
),
));
$day7 = $cmb->add_field(array(
'desc' => esc_html__('Sunday', 'eagle-booking'),
'id' => $prefix.'price_sun',
'type' => 'text_small',
'tab' => 'price',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'attributes' => array(
'type' => 'number',
'pattern' => '\d*',
),
));
$final = $cmb->add_field(array(
'id' => $prefix.'price_min',
'type' => 'hidden',
'tab' => 'price',
'default' => eagle_booking_room_min_price(eagle_booking_get_the_edit_post_id()),
'display_cb' => 'eagle_booking_room_min_price(eagle_booking_get_the_edit_post_id())',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
));
// UPDATE ROOM MIN PRICE
add_action( 'save_post', 'eagle_booking_update_room_price_min', 11 );
function eagle_booking_update_room_price_min() {
if (get_post_type(eagle_booking_get_the_edit_post_id()) == "eagle_rooms"){
update_post_meta( eagle_booking_get_the_edit_post_id(), 'eagle_booking_mtb_room_price_min', eagle_booking_room_min_price(eagle_booking_get_the_edit_post_id()));
return;
}
}
$cmb->add_field(array(
'name' => esc_html__('Price Type', 'eagle-booking'),
'desc' => esc_html__('Select the room price type', 'eagle-booking'),
'id' => $prefix.'price_type',
'type' => 'select',
'show_option_none' => false,
'default' => eb_get_option('eb_room_price_type'),
'options' => array(
'room_price_nights' => __( 'Room Price x Booking Nights', 'eagle-booking' ),
'room_price_nights_guests' => __( 'Room Price x Booking Nights x Guests (or adults + children)', 'eagle-booking' ),
'room_price_nights_guests_custom' => __( 'Room Price x Booking Nights + Price per guest (or adults + children) x Booking Nights', 'eagle-booking' ),
),
'tab' => 'price',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
));
$cmb->add_field(array(
'name' => esc_html__('Price per guest', 'eagle-booking'),
'desc' => esc_html__('Only number', 'eagle-booking'),
'id' => $prefix.'guests_price',
'type' => 'text',
'show_on_cb' => 'eb_show_guests_room_mtb',
'tab' => 'price',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'attributes' => array(
'data-conditional-id' => $prefix.'price_type',
'data-conditional-value' => wp_json_encode( array( 'room_price_nights_guests', 'room_price_nights_guests_custom' ) ),
)
));
$cmb->add_field(array(
'name' => esc_html__('Guests price starts after', 'eagle-booking'),
'desc' => esc_html__('Start applying the guests price after [number] guests. Only number.', 'eagle-booking'),
'id' => $prefix.'guests_price_start',
'type' => 'text',
'show_on_cb' => 'eb_show_guests_room_mtb',
'tab' => 'price',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'default' => '1',
'attributes' => array(
'data-conditional-id' => $prefix.'price_type',
'data-conditional-value' => wp_json_encode( array( 'room_price_nights_guests', 'room_price_nights_guests_custom' ) ),
)
));
// If adults & children option is enabled
$cmb->add_field(array(
'name' => esc_html__('Price per adult', 'eagle-booking'),
'desc' => esc_html__('Only number', 'eagle-booking'),
'id' => $prefix.'adult_price',
'type' => 'text',
'default' => '',
'show_on_cb' => 'eb_show_adults_children_room_mtb',
'tab' => 'price',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'attributes' => array(
'data-conditional-id' => $prefix.'price_type',
'data-conditional-value' => wp_json_encode( array( 'room_price_nights_guests', 'room_price_nights_guests_custom' ) ),
)
));
$cmb->add_field(array(
'name' => esc_html__('Price per children', 'eagle-booking'),
'desc' => esc_html__('Only number', 'eagle-booking'),
'id' => $prefix.'children_price',
'type' => 'text',
'default' => '',
'show_on_cb' => 'eb_show_adults_children_room_mtb',
'tab' => 'price',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'attributes' => array(
'data-conditional-id' => $prefix.'price_type',
'data-conditional-value' => wp_json_encode( array( 'room_price_nights_guests', 'room_price_nights_guests_custom' ) ),
)
));
$cmb->add_field(array(
'name' => esc_html__('Adults price starts after', 'eagle-booking'),
'desc' => esc_html__('Start applying the adults price after [number] of adults. Only number.', 'eagle-booking'),
'id' => $prefix.'adults_price_start',
'type' => 'text',
'show_on_cb' => 'eb_show_adults_children_room_mtb',
'tab' => 'price',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'default' => '1',
'attributes' => array(
'data-conditional-id' => $prefix.'price_type',
'data-conditional-value' => wp_json_encode( array( 'room_price_nights_guests', 'room_price_nights_guests_custom' ) ),
)
));
$cmb->add_field(array(
'name' => esc_html__('Children price starts after', 'eagle-booking'),
'desc' => esc_html__('Start applying the children price after [number] of children. Only number.', 'eagle-booking'),
'id' => $prefix.'children_price_start',
'type' => 'text',
'show_on_cb' => 'eb_show_adults_children_room_mtb',
'tab' => 'price',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'default' => '1',
'attributes' => array(
'data-conditional-id' => $prefix.'price_type',
'data-conditional-value' => wp_json_encode( array( 'room_price_nights_guests', 'room_price_nights_guests_custom' ) ),
)
));
$cmb->add_field( array(
'name' => 'Taxes',
'id' => $prefix.'taxes',
'desc' => 'Global Taxes are applied by default.',
'type' => 'pw_multiselect',
'tab' => 'price',
'default' => '',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'options_cb' => 'eb_taxes',
)
);
$cmb->add_field( array(
'name' => 'Fees',
'id' => $prefix.'fees',
'desc' => 'Global Fees are applied by default.',
'type' => 'pw_multiselect',
'tab' => 'price',
'default' => '',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'options_cb' => 'eb_fees',
)
);
// Slider Tab
$cmb->add_field(array(
'name' => esc_html__('Slider Images', 'eagle-booking'),
'desc' => esc_html__('Select Images to display in the slider', 'eagle-booking'),
'id' => $prefix.'slider_images',
'type' => 'file_list',
'tab' => 'slider',
'preview_size' => array( 150, 100 ),
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
));
// Services Tab
$cmb->add_field( array(
'name' => 'Services',
'id' => $prefix.'services',
'desc' => 'Drag to reorder.',
'type' => 'pw_multiselect',
'tab' => 'services',
'default' => '',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'options_cb' => 'eagle_booking_normal_services',
) );
$cmb->add_field( array(
'name' => 'Addition Services',
'id' => $prefix.'additional_services',
'desc' => 'Drag to reorder.',
'type' => 'pw_multiselect',
'tab' => 'services',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'options_cb' => 'eagle_booking_additional_services',
) );
// Reviews Tab
$cmb->add_field( array(
'name' => esc_html__('Reviews', 'eagle-booking'),
'desc' => esc_html__('Drag to reorder.', 'eagle-booking'),
'id' => $prefix.'reviews',
'type' => 'pw_multiselect',
'tab' => 'reviews',
'default' => '',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'options_cb' => 'eagle_booking_get_reviews',
) );
// Integration tab
$cmb->add_field(array(
'name' => esc_html__('Room External Link', 'eagle-booking'),
'desc' => esc_html__('Insert the room external link (the room external link will override the form action, check-in, check-out and guests parameters will pass if that is possible)', 'eagle-booking'),
'id' => $prefix.'integration_link',
'type' => 'text',
'tab' => 'integration',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
));
$cmb->add_field(array(
'name' => esc_html__('Room External ID', 'eagle-booking'),
'desc' => esc_html__('Insert the room external ID (the room external ID will be passed as a form parameter)', 'eagle-booking'),
'id' => $prefix.'integration_id',
'type' => 'text',
'tab' => 'integration',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
));
$cmb->add_field( array(
'name' => __( 'Page Layout', 'eagle-booking' ),
'id' => $prefix.'page_layout',
'type' => 'radio_image',
'tab' => 'layout',
'options' => array(
'full-slider' => __('Full Slider', 'eagle-booking'),
'normal-slider' => __('Normal Slider', 'eagle-booking'),
),
'default' => 'normal-slider',
'images_path' => EB_URL,
'images' => array(
'full-slider' => 'assets/images/admin/room-page-layout-full-slider.png',
'normal-slider' => 'assets/images/admin/room-page-layout-normal-slider.png',
),
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
) );
$cmb->add_field( array(
'name' => __('Header Background Image', 'eagle-booking'),
'id' => $prefix.'header_image',
'type' => 'file',
'tab' => 'layout',
'options' => array(
'url' => false,
),
'attributes' => array(
'data-conditional-id' => $prefix.'page_layout',
'data-conditional-value' => 'normal-slider',
),
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
) );
$cmb->add_field( array(
'name' => __( 'Sidebar', 'eagle-booking' ),
'id' => $prefix.'sidebar',
'type' => 'radio_image',
'tab' => 'layout',
'default' => 'right',
'options' => array(
'left' => __('Left', 'eagle-booking'),
'none' => __('None', 'eagle-booking'),
'right' => __('Right', 'eagle-booking'),
),
'images_path' => EB_URL,
'images' => array(
'left' => 'assets/images/admin/sidebar-left.png',
'none' => 'assets/images/admin/sidebar-none.png',
'right' => 'assets/images/admin/sidebar-right.png',
),
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
) );
$cmb->add_field( array(
'name' => 'Price Exceptions',
'id' => $prefix.'price_exceptions',
'type' => 'pw_multiselect',
'tab' => 'exceptions',
'default' => '',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'options_cb' => 'eagle_booking_get_price_exceptions',
) );
$cmb->add_field( array(
'name' => 'Dates Exceptions (Blocked Dates)',
'id' => $prefix.'block_exceptions',
'type' => 'pw_multiselect',
'tab' => 'exceptions',
'default' => '',
'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
'options_cb' => 'eagle_booking_get_block_exceptions',
) );
// CMB2 GRID
$cmb2Grid = new \Cmb2Grid\Grid\Cmb2Grid($cmb);
$row = $cmb2Grid->addRow();
// $row->addColumns(array($day1, $day2, $day3, $day4, $day5, $day6, $day7));
$row->addColumns(array(
array($day1, 'class' => 'col-day'),
array($day2, 'class' => 'col-day'),
array($day3, 'class' => 'col-day'),
array($day4, 'class' => 'col-day'),
array($day5, 'class' => 'col-day'),
array($day6, 'class' => 'col-day'),
array($day7, 'class' => 'col-day'),
// array($final, 'class' => 'col-day'),
));
}

View File

@@ -0,0 +1,130 @@
<?php
/*---------------------------------------------------------------------------------
@ Services Metaboxes
@ Since 1.0.0
-----------------------------------------------------------------------------------*/
add_action('cmb2_admin_init', 'eagle_booking_services');
function eagle_booking_services() {
$prefix = 'eagle_booking_mtb_service_';
$cmb = new_cmb2_box(array(
'id' => $prefix.'meta',
'title' => esc_html__('Eagle Booking', 'eagle-booking'),
'object_types' => array('eagle_services'),
));
$cmb->add_field(array(
'name' => esc_html__('Description', 'eagle-booking'),
'id' => $prefix.'description',
'type' => 'text',
));
$cmb->add_field(array(
'name' => esc_html__('Icon Type', 'eagle-booking'),
'id' => $prefix.'icon_type',
'type' => 'select',
'default' => 'fontawesome',
'options' => array(
'fonticon' => __( 'Font Awesome 4 (Deprecated)', 'eagle-booking' ),
'fontawesome' => __( 'Font Awesome 5', 'eagle-booking' ),
'customicon' => __( 'Custom Icon (Image)', 'eagle-booking' ),
),
));
$cmb->add_field( array(
'name' => esc_html__( 'Font Awesome 4 Icon (Deprecated)', 'eagle-booking' ),
'desc' => esc_html__( 'Deprecated: Please use Font Awesome 5', 'eagle-booking' ),
'id' => $prefix . 'icon',
'type' => 'faiconselect',
'default' => 'fa fa-check',
'options_cb' => 'returnRayFaPre',
'attributes' => array(
'data-conditional-id' => $prefix.'icon_type',
'data-conditional-value' => 'fonticon',
),
) );
$cmb->add_field( array(
'name' => __( 'Font Awesome 5 Icon', 'eagle-booking' ),
'id' => $prefix . 'icon_fontawesome',
'type' => 'faiconselect',
// 'default' => 'fas fa-check',
'options_cb' => 'returnRayFapsa',
'attributes' => array(
'data-conditional-id' => $prefix.'icon_type',
'data-conditional-value' => 'fontawesome',
'faver' => 5
)
) );
$cmb->add_field( array(
'name' => esc_html__('Custom Icon', 'eagle-booking' ),
'id' => $prefix.'image',
'type' => 'file',
'options' => array(
'url' => false,
),
'attributes' => array(
'data-conditional-id' => $prefix.'icon_type',
'data-conditional-value' => 'customicon',
),
) );
$cmb->add_field(array(
'name' => esc_html__('Type', 'eagle-booking'),
'id' => $prefix.'type',
'type' => 'select',
'default' => 'normal',
'options' => array(
'normal' => __( 'Normal', 'eagle-booking' ),
'additional' => __( 'Additional', 'eagle-booking' ),
),
));
$cmb->add_field(array(
'name' => esc_html__('Price', 'eagle-booking'),
'desc' => esc_html__('0 = free', 'eagle-booking'),
'id' => $prefix.'price',
'type' => 'text_small',
'attributes' => array(
'required' => 'required',
'type' => 'number',
'pattern' => '\d*',
'data-conditional-id' => $prefix.'type',
'data-conditional-value' => 'additional',
),
));
$cmb->add_field(array(
'name' => esc_html__('Price Type', 'eagle-booking'),
'id' => $prefix.'price_type',
'type' => 'select',
'options_cb' => 'eb_service_price_type',
'attributes' => array(
'data-conditional-id' => $prefix.'type',
'data-conditional-value' => 'additional',
),
));
$cmb->add_field(array(
'name' => esc_html__('Price Type 2', 'eagle-booking'),
'id' => $prefix.'price_type_2',
'type' => 'select',
'default' => 'day',
'options' => array(
'night' => __( 'Night', 'eagle-booking' ),
'trip' => __( 'Trip', 'eagle-booking' ),
),
'attributes' => array(
'data-conditional-id' => $prefix.'type',
'data-conditional-value' => 'additional',
),
));
}

View File

@@ -0,0 +1,72 @@
<?php
/*---------------------------------------------------------------------------------
@ Taxes & Fees Metaboxes
@ Since 1.2.9.1
-----------------------------------------------------------------------------------*/
add_action('cmb2_admin_init', 'eb_taxes_fees_mtb');
function eb_taxes_fees_mtb() {
$prefix = 'eb_mbt_taxes_fees_';
$cmb = new_cmb2_box(array(
'id' => $prefix.'meta',
'title' => esc_html__('Eagle Booking', 'eagle-booking'),
'object_types' => array('eagle_taxes_fees'),
));
$cmb->add_field(array(
'name' => esc_html__('Type', 'eagle-booking'),
'id' => $prefix.'type',
'type' => 'select',
'default' => 'tax',
'options' => array(
'tax' => __( 'Tax', 'eagle-booking' ),
'fee' => __( 'Fee', 'eagle-booking' ),
),
));
$cmb->add_field(array(
'name' => esc_html__('Value Type', 'eagle-booking'),
'id' => $prefix.'value_type',
'type' => 'select',
'default' => 'fixed',
'options' => array(
'fixed' => __( 'Fixed', 'eagle-booking' ),
'percentage' => __( 'Percentage', 'eagle-booking' ),
),
));
$cmb->add_field(array(
'name' => esc_html__('Price Type', 'eagle-booking'),
'id' => $prefix.'price_type',
'type' => 'select',
'default' => 'booking',
'options' => array(
'booking' => __( 'Per Booking', 'eagle-booking' ),
'person' => __( 'Per Person', 'eagle-booking' ),
'night' => __( 'Per Booking Night', 'eagle-booking' ),
),
));
$cmb->add_field(array(
'name' => esc_html__('Applied', 'eagle-booking'),
'id' => $prefix.'applied',
'type' => 'select',
'default' => 'total_price',
'options' => array(
'total_price' => __( 'On Total Price', 'eagle-booking' ),
'accomodation_price' => __( 'On Accomodation Price', 'eagle-booking' ),
),
));
$cmb->add_field(array(
'name' => esc_html__('Value', 'eagle-booking'),
// 'desc' => esc_html__('Insert the coupon value ( e.g. 30 for -30% )', 'eagle-booking'),
'id' => $prefix.'value',
'type' => 'text_small',
));
}