Add additional services system (v0.5.0)
All checks were successful
Create Release Package / build-release (push) Successful in 1m0s
All checks were successful
Create Release Package / build-release (push) Successful in 1m0s
- Service CPT with pricing types: Included, Per Booking, Per Night - ServiceCategory taxonomy with default categories - Booking-services integration with service selector - Real-time price calculation based on nights and quantity - Services total and grand total display in booking admin Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,10 +18,12 @@ use Magdev\WpBnb\PostTypes\Booking;
|
||||
use Magdev\WpBnb\PostTypes\Building;
|
||||
use Magdev\WpBnb\PostTypes\Guest;
|
||||
use Magdev\WpBnb\PostTypes\Room;
|
||||
use Magdev\WpBnb\PostTypes\Service;
|
||||
use Magdev\WpBnb\Privacy\Manager as PrivacyManager;
|
||||
use Magdev\WpBnb\Pricing\Season;
|
||||
use Magdev\WpBnb\Taxonomies\Amenity;
|
||||
use Magdev\WpBnb\Taxonomies\RoomType;
|
||||
use Magdev\WpBnb\Taxonomies\ServiceCategory;
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\FilesystemLoader;
|
||||
|
||||
@@ -95,6 +97,7 @@ final class Plugin {
|
||||
Room::init();
|
||||
Booking::init();
|
||||
Guest::init();
|
||||
Service::init();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,6 +109,7 @@ final class Plugin {
|
||||
// Taxonomies must be registered before post types that use them.
|
||||
Amenity::init();
|
||||
RoomType::init();
|
||||
ServiceCategory::init();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -188,7 +192,7 @@ final class Plugin {
|
||||
|
||||
// Check if we're on plugin pages or editing our custom post types.
|
||||
$is_plugin_page = strpos( $hook_suffix, 'wp-bnb' ) !== false;
|
||||
$is_our_post_type = in_array( $post_type, array( Building::POST_TYPE, Room::POST_TYPE, Booking::POST_TYPE, Guest::POST_TYPE ), true );
|
||||
$is_our_post_type = in_array( $post_type, array( Building::POST_TYPE, Room::POST_TYPE, Booking::POST_TYPE, Guest::POST_TYPE, Service::POST_TYPE ), true );
|
||||
$is_edit_screen = in_array( $hook_suffix, array( 'post.php', 'post-new.php' ), true );
|
||||
|
||||
if ( ! $is_plugin_page && ! ( $is_our_post_type && $is_edit_screen ) ) {
|
||||
@@ -226,26 +230,28 @@ final class Plugin {
|
||||
'nonce' => wp_create_nonce( 'wp_bnb_admin_nonce' ),
|
||||
'postType' => $post_type,
|
||||
'i18n' => array(
|
||||
'validating' => __( 'Validating...', 'wp-bnb' ),
|
||||
'activating' => __( 'Activating...', 'wp-bnb' ),
|
||||
'error' => __( 'An error occurred. Please try again.', 'wp-bnb' ),
|
||||
'selectImages' => __( 'Select Images', 'wp-bnb' ),
|
||||
'addToGallery' => __( 'Add to Gallery', 'wp-bnb' ),
|
||||
'confirmRemove' => __( 'Are you sure you want to remove this image?', 'wp-bnb' ),
|
||||
'increase' => __( 'increase', 'wp-bnb' ),
|
||||
'discount' => __( 'discount', 'wp-bnb' ),
|
||||
'normalPrice' => __( 'Normal price', 'wp-bnb' ),
|
||||
'checking' => __( 'Checking availability...', 'wp-bnb' ),
|
||||
'available' => __( 'Available', 'wp-bnb' ),
|
||||
'notAvailable' => __( 'Not available - conflicts with existing booking', 'wp-bnb' ),
|
||||
'selectRoomAndDates' => __( 'Select room and dates to check availability', 'wp-bnb' ),
|
||||
'nights' => __( 'nights', 'wp-bnb' ),
|
||||
'night' => __( 'night', 'wp-bnb' ),
|
||||
'calculating' => __( 'Calculating price...', 'wp-bnb' ),
|
||||
'searchingGuests' => __( 'Searching...', 'wp-bnb' ),
|
||||
'noGuestsFound' => __( 'No guests found', 'wp-bnb' ),
|
||||
'selectGuest' => __( 'Select', 'wp-bnb' ),
|
||||
'guestBlocked' => __( 'Blocked', 'wp-bnb' ),
|
||||
'validating' => __( 'Validating...', 'wp-bnb' ),
|
||||
'activating' => __( 'Activating...', 'wp-bnb' ),
|
||||
'error' => __( 'An error occurred. Please try again.', 'wp-bnb' ),
|
||||
'selectImages' => __( 'Select Images', 'wp-bnb' ),
|
||||
'addToGallery' => __( 'Add to Gallery', 'wp-bnb' ),
|
||||
'confirmRemove' => __( 'Are you sure you want to remove this image?', 'wp-bnb' ),
|
||||
'increase' => __( 'increase', 'wp-bnb' ),
|
||||
'discount' => __( 'discount', 'wp-bnb' ),
|
||||
'normalPrice' => __( 'Normal price', 'wp-bnb' ),
|
||||
'checking' => __( 'Checking availability...', 'wp-bnb' ),
|
||||
'available' => __( 'Available', 'wp-bnb' ),
|
||||
'notAvailable' => __( 'Not available - conflicts with existing booking', 'wp-bnb' ),
|
||||
'selectRoomAndDates' => __( 'Select room and dates to check availability', 'wp-bnb' ),
|
||||
'nights' => __( 'nights', 'wp-bnb' ),
|
||||
'night' => __( 'night', 'wp-bnb' ),
|
||||
'calculating' => __( 'Calculating price...', 'wp-bnb' ),
|
||||
'searchingGuests' => __( 'Searching...', 'wp-bnb' ),
|
||||
'noGuestsFound' => __( 'No guests found', 'wp-bnb' ),
|
||||
'selectGuest' => __( 'Select', 'wp-bnb' ),
|
||||
'guestBlocked' => __( 'Blocked', 'wp-bnb' ),
|
||||
'perNightDescription' => __( 'This price will be charged per night of the stay.', 'wp-bnb' ),
|
||||
'perBookingDescription' => __( 'This price will be charged once for the booking.', 'wp-bnb' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user