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,25 @@
<?php
namespace Elementor\Modules\Checklist;
use Elementor\Core\Isolation\Wordpress_Adapter;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
interface Checklist_Module_Interface {
public function get_name() : string;
public function is_experiment_active() : bool;
public function get_user_progress_from_db() : array;
public function get_step_progress( $step_id ) : ?array;
public function set_step_progress( $step_id, $step_progress ) : void;
public function get_steps_manager() : Steps_Manager;
public function get_wordpress_adapter() : Wordpress_Adapter;
}

View File

@@ -0,0 +1,169 @@
<?php
namespace Elementor\Modules\Checklist;
use Elementor\Core\Base\Module as BaseModule;
use Elementor\Core\Experiments\Manager;
use Elementor\Core\Isolation\Wordpress_Adapter;
use Elementor\Core\Isolation\Wordpress_Adapter_Interface;
use Elementor\Plugin;
use Elementor\Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Module extends BaseModule implements Checklist_Module_Interface {
const EXPERIMENT_ID = 'launchpad-checklist';
const DB_OPTION_KEY = 'elementor_checklist';
private $user_progress = null;
private Steps_Manager $steps_manager;
private Wordpress_Adapter_Interface $wordpress_adapter;
/**
* @param ?Wordpress_Adapter_Interface $wordpress_adapter
*
* @return void
*/
public function __construct( ?Wordpress_Adapter_Interface $wordpress_adapter = null ) {
$this->wordpress_adapter = $wordpress_adapter ?? new Wordpress_Adapter();
parent::__construct();
$this->register_experiment();
if ( ! $this->is_experiment_active() ) {
return;
}
$this->init_user_progress();
$this->user_progress = $this->user_progress ?? $this->get_user_progress_from_db();
$this->steps_manager = new Steps_Manager( $this );
$this->enqueue_editor_scripts();
}
/**
* Get the module name.
*
* @return string
*/
public function get_name() : string {
return 'e-checklist';
}
/**
* Checks if the experiment is active
*
* @return bool
*/
public function is_experiment_active() : bool {
return Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_ID );
}
/**
* Gets user's progress from db
*
* @return array {
* @type bool $is_hidden
* @type int $last_opened_timestamp
* @type array $steps {
* @type string $step_id => {
* @type bool $is_marked_completed
* @type bool $is_completed
* }
* }
* }
*/
public function get_user_progress_from_db() : array {
return json_decode( $this->wordpress_adapter->get_option( self::DB_OPTION_KEY ), true );
}
/**
* Using the step's ID, get the progress of the step should it exist
*
* @param $step_id
*
* @return null|array {
* @type bool $is_marked_completed
* @type bool $is_completed
* }
*/
public function get_step_progress( $step_id ) : ?array {
return $this->user_progress['steps'][ $step_id ] ?? null;
}
/**
* Update the progress of a step
*
* @param $step_id
* @param $step_progress
*
* @return void
*/
public function set_step_progress( $step_id, $step_progress ) : void {
$this->user_progress['steps'][ $step_id ] = $step_progress;
$this->update_user_progress_in_db();
}
/**
* @return Steps_Manager
*/
public function get_steps_manager() : Steps_Manager {
return $this->steps_manager;
}
/**
* @return Wordpress_Adapter
*/
public function get_wordpress_adapter() : Wordpress_Adapter {
return $this->wordpress_adapter;
}
public function enqueue_editor_scripts() : void {
add_action( 'elementor/editor/before_enqueue_scripts', function () {
$min_suffix = Utils::is_script_debug() ? '' : '.min';
wp_enqueue_script(
$this->get_name(),
ELEMENTOR_ASSETS_URL . 'js/checklist' . $min_suffix . '.js',
[
'react',
'react-dom',
'elementor-common',
'elementor-v2-ui',
'elementor-v2-icons',
'elementor-v2-editor-app-bar',
'elementor-web-cli',
],
ELEMENTOR_VERSION,
true
);
wp_set_script_translations( $this->get_name(), 'elementor' );
} );
}
private function register_experiment() : void {
Plugin::$instance->experiments->add_feature( [
'name' => self::EXPERIMENT_ID,
'title' => esc_html__( 'Launchpad Checklist', 'elementor' ),
'description' => esc_html__( 'Launchpad Checklist feature to boost productivity and deliver your site faster', 'elementor' ),
'release_status' => Manager::RELEASE_STATUS_ALPHA,
'hidden' => true,
] );
}
private function init_user_progress() : void {
$default_settings = [
'is_hidden' => false,
'last_opened_timestamp' => time(),
'steps' => [],
];
$this->wordpress_adapter->add_option( self::DB_OPTION_KEY, wp_json_encode( $default_settings ) );
}
private function update_user_progress_in_db() : void {
$this->wordpress_adapter->update_option( self::DB_OPTION_KEY, wp_json_encode( $this->user_progress ) );
}
}

View File

@@ -0,0 +1,163 @@
<?php
namespace Elementor\Modules\Checklist;
use Elementor\Modules\Checklist\Steps\Create_Pages;
use Elementor\Modules\Checklist\Steps\Step_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Steps_Manager {
/** @var Step_Base[] $step_instances */
private array $step_instances = [];
private Checklist_Module_Interface $module;
public function __construct( Checklist_Module_Interface $module ) {
$this->module = $module;
$this->register_steps();
}
/**
* Gets formatted and ordered array of step ( step data, is_marked_completed and is_completed )
*
* @return array
*/
public function get_steps_for_frontend() : array {
$formatted_steps = [];
foreach ( $this->get_step_ids() as $step_id ) {
$instance = $this->step_instances[ $step_id ];
$is_marked_as_completed = $instance->is_marked_as_completed();
$step = [
'should_allow_undo' => $is_marked_as_completed,
'is_completed' => $instance->is_immutable_completed() || $instance->is_marked_as_completed() || $instance->is_absolute_completed(),
'config' => $this->get_step_config( $step_id ),
];
$formatted_steps[] = $step;
}
return $formatted_steps;
}
/**
* Marks a step as completed, returns true if the step was found and marked or false otherwise
*
* @param string $step_id
*
* @return void
*/
public function mark_step_as_completed( string $step_id ) : void {
foreach ( $this->step_instances as $step ) {
if ( $step->get_id() === $step_id ) {
$step->mark_as_completed();
return;
}
}
}
/**
* Unmarks a step as completed, returns true if the step was found and unmarked or false otherwise
*
* @param string $step_id
*
* @return void
*/
public function unmark_step_as_completed( string $step_id ) : void {
foreach ( $this->step_instances as $step ) {
if ( $step->get_id() === $step_id ) {
$step->unmark_as_completed();
return;
}
}
}
/**
* Maybe marks a step as completed (depending on if source allows it), returns true if the step was found and marked or false otherwise
*
* @param $step_id
*
* @return void
*/
public function maybe_set_step_as_immutable_completed( string $step_id ) : void {
foreach ( $this->step_instances as $step ) {
if ( $step->get_id() === $step_id ) {
$step->maybe_mark_as_completed();
return;
}
}
}
public function get_step_by_id( string $step_id ) : ?Step_Base {
return $this->step_instances[ $step_id ] ?? null;
}
/**
* @return array
*/
public function get_step_config( $step_id ) : array {
$step_instance = $this->step_instances[ $step_id ];
return $step_instance
? [
'id' => $step_instance->get_id(),
'title' => $step_instance->get_title(),
'description' => $step_instance->get_description(),
'learn_more_text' => $step_instance->get_learn_more_text(),
'learn_more_url' => $step_instance->get_learn_more_url(),
'cta_text' => $step_instance->get_cta_text(),
'cta_url' => $step_instance->get_cta_url(),
Step_Base::IS_COMPLETION_IMMUTABLE => $step_instance->get_is_completion_immutable(),
]
: [];
}
/**
* Getting the step instances array based on source's order
*
* @return void
*/
private function register_steps() : void {
foreach ( $this->get_step_ids() as $step_id ) {
$step_instance = $this->get_step_instance( $step_id );
if ( $step_instance && ! isset( $this->step_instances[ $step_id ] ) ) {
$this->step_instances[ $step_id ] = $step_instance;
}
}
}
/**
* Using step data->id, instanciates and returns the step class or null if the class does not exist
*
* @param $step_data
*
* @return Step_Base|null
*/
private function get_step_instance( string $step_id ) : ?Step_Base {
$class_name = '\\Elementor\\Modules\\Checklist\\Steps\\' . $step_id;
if ( ! class_exists( $class_name ) ) {
return null;
}
/** @var Step_Base $step */
return new $class_name( $this->module, $this->module->get_wordpress_adapter() );
}
/**
* Returns the steps config from source
*
* @return array
*/
private static function get_step_ids() : array {
return [ Create_Pages::STEP_ID ];
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace Elementor\Modules\Checklist\Steps;
use Elementor\Plugin;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Create_Pages extends Step_Base {
const STEP_ID = 'create_pages';
public function get_id() : string {
return self::STEP_ID;
}
public function is_absolute_completed() : bool {
$pages = $this->wordpress_adapter->get_pages( [
'meta_key' => '_elementor_version',
'number' => 3,
] ) ?? [];
return count( $pages ) >= 3;
}
public function get_title() : string {
return esc_html__( 'Create your first 3 pages', 'elementor' );
}
public function get_description() : string {
return esc_html__( 'Jumpstart your creation with professional designs form the Template Library or start from scratch.', 'elementor' );
}
public function get_cta_text() : string {
return esc_html__( 'Create a new page', 'elementor' );
}
public function get_cta_url() : string {
return Plugin::$instance->documents->get_create_new_post_url( 'page' );
}
public function get_is_completion_immutable() : bool {
return true;
}
}

View File

@@ -0,0 +1,163 @@
<?php
namespace Elementor\Modules\Checklist\Steps;
use Elementor\Core\Isolation\Wordpress_Adapter;
use Elementor\Core\Isolation\Wordpress_Adapter_Interface;
use Elementor\Modules\Checklist\Module as Checklist_Module;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
abstract class Step_Base {
/**
* @var string
* This is the key to be set to true if the step can be completed, and still be considered completed even if the user later did something to the should have it marked as not completed
*/
const IS_COMPLETION_IMMUTABLE = 'is_completion_immutable';
const MARKED_AS_COMPLETED_KEY = 'is_marked_completed';
const IMMUTABLE_COMPLETION_KEY = 'is_completed';
protected array $user_progress;
protected Wordpress_Adapter_Interface $wordpress_adapter;
protected Checklist_Module $module;
/**
* Returns a steps current completion status
*
* @return bool
*/
abstract protected function is_absolute_completed() : bool;
/**
* @return string
*/
abstract public function get_id() : string;
/**
* @return string
*/
abstract public function get_title() : string;
/**
* @return string
*/
abstract public function get_description() : string;
/**
* For instance; 'Create 3 pages'
* @return string
*/
abstract public function get_cta_text() : string;
/**
* @return string
*/
abstract public function get_cta_url() : string;
/**
* @return bool
*/
abstract public function get_is_completion_immutable() : bool;
/**
* Step_Base constructor.
*
* @param Checklist_Module $module
* @param ?Wordpress_Adapter_Interface $wordpress_adapter
* @return void
*/
public function __construct( Checklist_Module $module, ?Wordpress_Adapter_Interface $wordpress_adapter = null ) {
$this->module = $module;
$this->wordpress_adapter = $wordpress_adapter ?? new Wordpress_Adapter();
$this->user_progress = $module->get_step_progress( $this->get_id() ) ?? $this->get_step_initial_progress();
}
public function get_learn_more_text() : string {
return esc_html__( 'Learn more', 'elementor' );
}
public function get_learn_more_url() : string {
return 'https://go.elementor.com/getting-started-with-elementor/';
}
/**
* Marking a step as completed based on user's desire
*
* @return void
*/
public function mark_as_completed() : void {
$this->user_progress[ self::MARKED_AS_COMPLETED_KEY ] = true;
$this->set_step_progress();
}
/**
* Unmarking a step as completed based on user's desire
*
* @return void
*/
public function unmark_as_completed() : void {
$this->user_progress[ self::MARKED_AS_COMPLETED_KEY ] = false;
$this->set_step_progress();
}
/**
* Marking a step as completed if it was completed once, and it's suffice to marketing's requirements
*
* @return void
*/
public function maybe_mark_as_completed() : void {
$is_immutable_completed = $this->user_progress[ self::IMMUTABLE_COMPLETION_KEY ] ?? false;
if ( ! $is_immutable_completed && $this->get_is_completion_immutable() && $this->is_absolute_completed() ) {
$this->user_progress[ self::IMMUTABLE_COMPLETION_KEY ] = true;
$this->set_step_progress();
}
}
/**
* Returns the step marked as completed value
*
* @return bool
*/
public function is_marked_as_completed() : bool {
return $this->user_progress[ self::MARKED_AS_COMPLETED_KEY ];
}
/**
* Returns the step completed value
*
* @return bool
*/
public function is_immutable_completed() : bool {
return $this->user_progress[ self::IMMUTABLE_COMPLETION_KEY ];
}
/**
* Sets and returns the initial progress of the step
*
* @return array
*/
public function get_step_initial_progress() : array {
$initial_progress = [
self::MARKED_AS_COMPLETED_KEY => false,
self::IMMUTABLE_COMPLETION_KEY => false,
];
$this->module->set_step_progress( $this->get_id(), $initial_progress );
return $initial_progress;
}
/**
* Sets the step progress
*
* @return void
*/
private function set_step_progress() : void {
$this->module->set_step_progress( $this->get_id(), $this->user_progress );
}
}