/** * @param Bring_WC_Order_Adapter $order * @return string */ static function get_booking_status_info($order) { $result = ['text' => __('No', 'bring-fraktguiden'), 'icon' => 'dashicons-minus']; if (self::is_step2()) { $result = ['text' => __('In progress', 'bring-fraktguiden'), 'icon' => '']; } if ($order->is_booked()) { $result = ['text' => __('Booked', 'bring-fraktguiden'), 'icon' => 'dashicons-yes']; } if ($order->has_booking_errors()) { $result = ['text' => __('Failed', 'bring-fraktguiden'), 'icon' => 'dashicons-warning']; } return $result; }
/** * Display tracking on Order/Mail etc. * * @param string $content * @param WC_Order $wc_order * @return string */ static function order_display_tracking_info($content, $wc_order) { $order = new Bring_WC_Order_Adapter($wc_order); if ($order->is_booked()) { $content .= '<div class="bring-order-details-booking">'; $content .= '<strong>' . __('Your tracking number: ', 'bring-fraktguiden') . '</strong>'; $content .= '<ul>'; foreach ($order->get_booking_consignments() as $consignment) { $confirmation = $consignment->confirmation; $consignment_number = $confirmation->consignmentNumber; $content .= '<li><a href="' . $confirmation->links->tracking . '">' . $consignment_number . '</a></li>'; } $content .= '</ul>'; $content .= '</div>'; } return $content; }
/** * @param Bring_WC_Order_Adapter $order */ static function render_progress_tracker($order) { $step2 = Bring_Booking_Common_View::is_step2(); $booked = $order->is_booked(); ?> <div class="bring-progress-tracker bring-flex-box"> <span class="<?php echo !$step2 && !$booked ? 'bring-progress-active' : ''; ?> ">1 ) <?php _e('Start', 'bring-fraktguiden'); ?> </span> <span class="<?php echo $step2 ? 'bring-progress-active' : ''; ?> ">2 ) <?php _e('Create and submit consignment', 'bring-fraktguiden'); ?> </span> <span class="<?php echo $booked ? 'bring-progress-active' : ''; ?> ">3 ) <?php _e('Submitted', 'bring-fraktguiden'); ?> </span> </div> <?php }
/** * Load admin javascript */ static function admin_load_javascript() { $screen = get_current_screen(); // Only for order edit screen if ($screen->id == 'shop_order') { global $post; $order = new Bring_WC_Order_Adapter(new WC_Order($post->ID)); $make_items_editable = !$order->order->is_editable(); if (isset($_GET['booking_step'])) { $make_items_editable = false; } if ($order->is_booked()) { $make_items_editable = false; } wp_register_script('fraktguiden-common', plugins_url('assets/js/pickup-point-common.js', dirname(__FILE__)), array('jquery'), '##VERSION##', true); wp_register_script('fraktguiden-pickup-point-admin', plugins_url('assets/js/pickup-point-admin.js', dirname(__FILE__)), array('jquery'), '##VERSION##', true); wp_localize_script('fraktguiden-pickup-point-admin', '_fraktguiden_data', ['ajaxurl' => admin_url('admin-ajax.php'), 'services' => Fraktguiden_Helper::get_all_services(), 'i18n' => self::get_i18n(), 'make_items_editable' => $make_items_editable]); wp_enqueue_script('fraktguiden-common'); wp_enqueue_script('fraktguiden-pickup-point-admin'); } }