get_eshb_currency_symbol()); $accomodation_id = $booking_metaboxes['booking_accomodation_id']; $accomodation_title = get_the_title($accomodation_id); $booking_start_date = $booking_metaboxes['booking_start_date']; $booking_end_date = $booking_metaboxes['booking_end_date']; $time_slot = !empty($booking_metaboxes['booking_start_time']) && !empty($booking_metaboxes['booking_end_time']) ? ESHB_Helper::format_to_wp_time($booking_metaboxes['booking_start_time']) . ' - ' . ESHB_Helper::format_to_wp_time($booking_metaboxes['booking_end_time']) : ''; $adult_quantity = !empty($booking_metaboxes['adult_quantity']) ? $booking_metaboxes['adult_quantity'] : 0; $children_quantity = !empty($booking_metaboxes['children_quantity']) ? $booking_metaboxes['children_quantity'] : 0; $room_quantity = !empty($booking_metaboxes['room_quantity']) ? $booking_metaboxes['room_quantity'] : 1; $extra_bed_quantity = !empty($booking_metaboxes['extra_bed_quantity']) ? $booking_metaboxes['extra_bed_quantity'] : 0; $extra_services = !empty($booking_metaboxes['extra_services_html']) ? $booking_metaboxes['extra_services_html'] : ''; $base_price = !empty($booking_metaboxes['base_price']) ? $booking_metaboxes['base_price'] : 0; $subtotal_price = !empty($booking_metaboxes['subtotal_price']) ? $booking_metaboxes['subtotal_price'] : 0; $extra_bed_price = !empty($booking_metaboxes['extra_bed_price']) ? $booking_metaboxes['extra_bed_price'] : 0; $total_price = !empty($booking_metaboxes['total_price']) ? $booking_metaboxes['total_price'] : $subtotal_price; $total_paid = !empty($booking_metaboxes['total_paid']) ? $booking_metaboxes['total_paid'] : 0; $deposit_amount = !empty($booking_metaboxes['deposit_amount']) ? $booking_metaboxes['deposit_amount'] : 0; $due_amount = $subtotal_price - $total_paid; $extra_services_charge = !empty($booking_metaboxes['extra_service_price']) ? $booking_metaboxes['extra_service_price'] : 0; // Customer Details $order_id = !empty($booking_metaboxes['order_id']) ? $booking_metaboxes['order_id'] : ''; $order = ''; $billing_data = []; if(class_exists('WooCommerce') && wc_get_order($order_id)){ $order = wc_get_order($order_id); if($order){ $billing_data['order_status'] = $order->get_status(); $billing_data['first_name'] = $order->get_billing_first_name(); $billing_data['last_name'] = $order->get_billing_last_name(); $billing_data['customer_name'] = trim($billing_data['first_name'] . ' ' . $billing_data['last_name']); // Concatenate first and last name $payment_gateways = WC()->payment_gateways->payment_gateways(); $payment_method_code = $order->get_payment_method(); $payment_gateway = $payment_gateways[ $payment_method_code ]; $billing_data['payment_method_name'] = $payment_gateway->get_title(); $billing_data['billing_email'] = $order->get_billing_email(); $billing_data['billing_phone'] = $order->get_billing_phone(); $billing_data['billing_company'] = $order->get_billing_company(); $billing_data['billing_city'] = $order->get_billing_city(); $billing_data['billing_state'] = $order->get_billing_state(); $billing_data['billing_postcode'] = $order->get_billing_postcode(); $billing_data['billing_country'] = $order->get_billing_country(); $billing_data['billing_address_1'] = $order->get_billing_address_1(); $billing_data['billing_address_2'] = $order->get_billing_address_2(); } }else { $order = $booking_metaboxes; $customer = !empty($booking_metaboxes['customer']) ? $booking_metaboxes['customer'] : []; if(!empty($customer)){ $billing_data['order_status'] = $booking_metaboxes['booking_status']; $billing_data['customer_name'] = $customer['name']; // Concatenate first and last name $billing_data['payment_method_name'] = esc_html__('N/A', 'easy-hotel'); $billing_data['billing_email'] = $customer['email']; $billing_data['billing_phone'] = $customer['phone']; } } $billing_data = apply_filters( 'eshb_billing_data_booking_view', $billing_data, $order_id, $booking_type); $hotel_core = new ESHB_Core(); ?>
| eshb_price($base_price)); ?> | |
| eshb_price($extra_bed_price)); ?> | |
| eshb_price($extra_services_charge)); ?> | |
| eshb_price($subtotal_price)); ?> | |
| eshb_price($deposit_amount)); ?> | |
| eshb_price($due_amount)); ?> | |
| eshb_price($total_paid)); ?> |
' . esc_html__('Invalid post type.', 'easy-hotel') . '
'; } wp_die(); // This is required to terminate immediately and return a proper response } public function eshb_get_accomodation_meta(){ check_ajax_referer( ESHB_Helper::generate_secure_nonce_action('eshb_global_nonce_action'), 'nonce' ); if (isset($_REQUEST['accomodationId']) && get_post_type(sanitize_text_field(wp_unslash($_REQUEST['accomodationId']))) == 'eshb_accomodation') { $accomodation_id = intval(sanitize_text_field(wp_unslash($_REQUEST['accomodationId']))); $eshb_min_max_settings = get_option( 'eshb_min_max_settings', []); $required_min_nights = !empty($eshb_min_max_settings['required_min_nights']) ? $eshb_min_max_settings['required_min_nights'] : 1; $required_max_nights = !empty($eshb_min_max_settings['required_max_nights']) ? $eshb_min_max_settings['required_max_nights'] : 999; $eshb_week_settings = get_option( 'eshb_week_settings', [] ); $string_check_in_day_error_msg = !empty($eshb_week_settings['string_check_in_day_error_msg']) ? $eshb_week_settings['string_check_in_day_error_msg'] : ''; // accomodation details metadata $eshb_booking = new ESHB_Booking(); $eshb_accomodation_metaboxes = []; $start_date = isset($_POST['startDate']) ? sanitize_text_field( wp_unslash($_POST['startDate']) ) : ''; $end_date = isset($_POST['endDate']) ? sanitize_text_field( wp_unslash($_POST['endDate']) ) : ''; $eshb_accomodation_metaboxes = get_post_meta($accomodation_id, 'eshb_accomodation_metaboxes', true); $available_rooms = $eshb_booking->get_available_room_count_by_date_range($accomodation_id, $start_date, $end_date); $eshb_accomodation_metaboxes['available_rooms'] = $available_rooms; $eshb_translations = [ 'maximumCapacity' => __('Maximum Capacity', 'easy-hotel'), 'availableCapacity' => __('Available Capacity', 'easy-hotel'), 'availableRoom' => __('Available Room', 'easy-hotel'), 'maximumAdultAndChildrenCapacity' => __('Maximum Adult and Children Capacity', 'easy-hotel'), ]; wp_send_json_success( [ 'requiredMinNights' => $required_min_nights, 'requiredMaxNights' => $required_max_nights, 'checkInDayErrorMsg' => $string_check_in_day_error_msg, 'currentAccomodationMeta' => $eshb_accomodation_metaboxes, 'translations' => $eshb_translations ]); die(); }else{ wp_send_json_error( 'invalid accomodation id' ); } } } new ESHB_Booking_Calendar_Ajax();