50 lines
2.5 KiB
PHP
50 lines
2.5 KiB
PHP
<?php
|
|
if (!defined('ABSPATH')) exit;
|
|
/**
|
|
* Variables available from class-order-timeline.php:
|
|
* @var WC_Order $order
|
|
* @var string $odoo_status
|
|
* @var string $tracking_number
|
|
* @var string $shipping_carrier
|
|
* @var int $current_index
|
|
* @var array $stage_keys (from Fusion_WooDoo_Order_Timeline::STAGES)
|
|
*/
|
|
$stages = Fusion_WooDoo_Order_Timeline::STAGES;
|
|
?>
|
|
<div class="fusion-woodoo-timeline-wrap">
|
|
<h3><?php esc_html_e('Order Status', 'fusion-woodoo'); ?></h3>
|
|
<div class="fusion-woodoo-timeline">
|
|
<?php foreach ($stages as $key => $label):
|
|
$idx = array_search($key, array_keys($stages));
|
|
$is_done = $idx < $current_index;
|
|
$is_active = $idx === $current_index;
|
|
$state_class = $is_done ? 'done' : ($is_active ? 'active' : 'pending');
|
|
?>
|
|
<div class="fusion-woodoo-timeline__step fusion-woodoo-timeline__step--<?php echo esc_attr($state_class); ?>">
|
|
<div class="fusion-woodoo-timeline__dot">
|
|
<?php if ($is_done): ?>
|
|
<svg viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 6l3 3 5-5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="fusion-woodoo-timeline__label">
|
|
<?php echo esc_html(__($label, 'fusion-woodoo')); ?>
|
|
<?php if ($is_active && $key === 'shipped' && ($tracking_number || $shipping_carrier)): ?>
|
|
<span class="fusion-woodoo-timeline__tracking">
|
|
<?php if ($shipping_carrier): ?>
|
|
<?php echo esc_html($shipping_carrier); ?>
|
|
<?php endif; ?>
|
|
<?php if ($tracking_number): ?>
|
|
— <?php esc_html_e('Tracking:', 'fusion-woodoo'); ?>
|
|
<strong><?php echo esc_html($tracking_number); ?></strong>
|
|
<?php endif; ?>
|
|
</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<?php if ($idx < count($stages) - 1): ?>
|
|
<div class="fusion-woodoo-timeline__connector fusion-woodoo-timeline__connector--<?php echo $is_done ? 'done' : 'pending'; ?>"></div>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|