<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

$order_id = ! empty( $args['order_id'] ) ? intval( $args['order_id'] ) : 0;

if ( empty( $order_id ) ) {
	return;
}

$profile_type = ! empty( $args['profile_type'] ) ? $args['profile_type'] : '';

$current_activity_stage = get_post_meta( $order_id, '_gigneo_pm_activity_stage', true );
$current_activity_stage = ! empty( $current_activity_stage ) ? $current_activity_stage : 'order_placed';

$tracking_stages = gigneo_order_stages( $order_id, $profile_type );

$price_plan = get_post_meta( $order_id, '_gigneo_pm_price_plan', true );
?>
<div class="gn-order-section gn-order-tacking">
	<div class="gn-head">
		<h3 class="gn-title"><?php echo esc_html__( 'Order tracking', 'gigneo' ); ?></h3>
	</div>
	<div class="gn-body">
		<ul class="gn-tracking-steps">
			<?php
			foreach ( $tracking_stages as $key => $track ) {
				if ( empty( $track['title'] ) ) {
					continue;
				}
				$tracking_status = ! empty( $track['status'] ) ? $track['status'] : 'pending';
				?>
				<li class="gn-tracking-step gn-<?php echo esc_attr( $tracking_status ); ?>">
					<div class="gn-icon">
						<i class="hi hi-<?php echo esc_attr( $key ); ?>" aria-hidden="true"></i>
					</div>
					<div class="gn-content">
						<h4 class="gn-title"><?php echo esc_html( $track['title'] ); ?></h4>
						<?php if ( 'active' === $tracking_status && ! empty( $track['description'] ) ) { ?>
							<p class="gn-description"><?php echo esc_html( $track['description'] ); ?></p>
						<?php } ?>
					</div>
				</li>
			<?php } ?>
		</ul>
	</div>
</div>
