📋

order_lists(); ?>
'; print_r($booking_items); echo ''; $count_foot_left_col = 0; $count_foot_right_col = 0; ?>
$status) { ?>

0 ? wp_kses_post(ABPTB_WC >= 2 ? wc_price($price) : number_format_i18n((float)$price, 2)) : esc_html__('FREE', 'abp-transport-booking'); ?> 0 ? wp_kses_post(ABPTB_WC >= 2 ? wc_price($ex_price) : number_format_i18n((float)$ex_price, 2)) : esc_html__('FREE', 'abp-transport-booking'); ?> 0 ? wp_kses_post(ABPTB_WC >= 2 ? wc_price($item_total) : number_format_i18n((float)$item_total, 2)) : esc_html__('FREE', 'abp-transport-booking'); ?>
0) ? wp_kses_post(ABPTB_WC >= 2 ? wc_price($total_price) : number_format_i18n((float)$total_price, 2)) : esc_html__('FREE', 'abp-transport-booking'); ?> 0) ? wp_kses_post(ABPTB_WC >= 2 ? wc_price($total_additional) : number_format_i18n((float)$total_additional, 2)) : esc_html__('FREE', 'abp-transport-booking'); ?> 0) ? wp_kses_post(ABPTB_WC >= 2 ? wc_price($total_sale) : number_format_i18n((float)$total_sale, 2)) : esc_html__('FREE', 'abp-transport-booking'); ?>
$limit, 'page_number' => $page_number, 'total' => $total_order, 'style' => 'ajax']); ?> __('Invalid security token or Insufficient permissions.', 'abp-transport-booking'), 'type' => 'warn'], 403); } ob_start(); $filter_args = isset($_POST) ? array_map('sanitize_text_field', wp_unslash($_POST)) : []; $limit = isset($filter_args['page_item']) ? (int)$filter_args['page_item'] : 20; $data_limit = (int)ABPTB_Function::get_option('abptb_per_page_item', 20); $filter_args['page_item'] = $limit > 0 ? $limit : $data_limit; if ($limit > 0 && $data_limit !== $limit) { update_option('abptb_per_page_item', $limit); } $this->order_lists($filter_args); $html = ob_get_clean(); wp_send_json_success(['html' => $html, 'msg' => esc_html__('Order Loaded Successfully !', 'abp-transport-booking'), 'type' => 'success']); } public function item_cancel(): void { if (!check_ajax_referer('abptb_admin_ajax_nonce', 'nonce', false) || !current_user_can('manage_options')) { wp_send_json_error(['msg' => __('Invalid security token or Insufficient permissions.', 'abp-transport-booking'), 'type' => 'warn'], 403); } $item_id = isset($_POST['item_id']) ? sanitize_text_field(wp_unslash($_POST['item_id'])) : ''; if (!empty($item_id)) { global $wpdb; $table_name = $wpdb->prefix . 'abptb_orders'; $booking_items = ABPTB_Query::get_booking_query(['id' => $item_id]); if (!empty($booking_items) && is_array($booking_items)) { $value = current($booking_items); $others = $value['others'] ?? ''; if (!empty($others)) { $others = json_decode($others, true) ?: []; $user_id = get_current_user_id(); $others['cancel_by'] = $user_id; $data = [ 'others' => wp_json_encode($others), 'order_status' => 'wc-cancelled', 'updated_at' => current_time('Y-m-d H:i:s') ]; $where = ['id' => (int)$item_id]; // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching $wpdb->update($table_name, $data, $where, ['%s', '%s', '%s'], ['%d']); } } wp_send_json_success(['html' => '', 'msg' => esc_html__('Deleted Successfully !', 'abp-transport-booking'), 'type' => 'success']); } wp_send_json_error(['html' => '', 'msg' => esc_html__('Something Error Occurred !', 'abp-transport-booking'), 'type' => 'warn']); } public function load_route(): void { if (!check_ajax_referer('abptb_admin_ajax_nonce', 'nonce', false) || !current_user_can('manage_options')) { wp_send_json_error(['msg' => esc_html__('You do not have permission to perform this action.', 'abp-transport-booking')], 403); } $post_int = fn($key, $default = '') => isset($_POST[$key]) ? absint($_POST[$key]) : $default; $post_id = $post_int('post_id'); if (!empty($post_id) && $post_id > 0) { ob_start(); if (ABPTB_Function::on_off('return')) { $route_direction = ABPTB_Function::get_post_info($post_id, 'route_direction', []); $bp = $dp = $r_bp = $r_dp = $text = $r_text = ''; if (!empty($route_direction)) { $bp = current($route_direction); $dp = end($route_direction); $text = ABPTB_Function::location_value($bp) . ' - ' . ABPTB_Function::location_value($dp); } $return_route_direction = ABPTB_Function::get_post_info($post_id, 'return_route_direction', []); if (!empty($route_direction)) { $r_bp = current($return_route_direction); $r_dp = end($return_route_direction); $r_text = ABPTB_Function::location_value($r_bp) . ' - ' . ABPTB_Function::location_value($r_dp); } ?> $html, 'msg' => get_the_title($post_id) . ' : ' . esc_html__('Route Data Loaded Successfully !', 'abp-transport-booking'), 'type' => 'success']); } wp_send_json_success(['html' => '', 'msg' => esc_html__('Route Data Loaded Successfully !', 'abp-transport-booking'), 'type' => 'success']); } public function load_time_list(): void { if (!check_ajax_referer('abptb_admin_ajax_nonce', 'nonce', false) || !current_user_can('manage_options')) { wp_send_json_error(['msg' => __('Invalid security token or Insufficient permissions.', 'abp-transport-booking'), 'type' => 'warn'], 403); } $post_val = fn($key, $default = '') => isset($_POST[$key]) ? sanitize_text_field(wp_unslash($_POST[$key])) : $default; $start_time = $post_val('_start_time'); if (!empty($start_time)) { $filter_args['post_id'] = $post_val('post_id'); $filter_args['_bp_dp'] = $post_val('_bp_dp'); $filter_args['_start_time'] = $start_time; $booking_items = ABPTB_Query::get_booking_query($filter_args); $times = []; if (!empty($booking_items) && is_array($booking_items)) { foreach ($booking_items as $booking_item) { $times[] = $booking_item['start_time'] ?? ''; } $times = array_filter($times); $times = array_unique($times); } //echo '
';                    print_r($filter_args);                    echo '
'; if (!empty($times)) { ob_start(); usort($times, "ABPTB_Function::sort_date"); ?> $html, 'msg' => esc_html__('Time List Loaded Successfully !', 'abp-transport-booking'), 'type' => 'success']); } } wp_send_json_success(['msg' => esc_html__('Time Not Found !', 'abp-transport-booking'), 'type' => 'success']); } } new ABPTB_Orders(); }