<?php
/**
 * @var array<int, array{tracking_number: string, tracking_url: string}> $tracking_data .
 * @var WC_Order                                                          $order         .
 *
 * @package DhlPolska\Shipment
 */

defined( 'ABSPATH' ) || exit;

if ( [] === $tracking_data ) {
	return;
}
?>
<section class="woocommerce-order-details dhl-polska-shipment-tracking">
	<h2 class="woocommerce-order-details__title">
		<?php esc_html_e( 'Śledzenie przesyłki DHL', 'dhl-polska' ); ?>
	</h2>
	<ul>
		<?php foreach ( $tracking_data as $tracking_item ) : ?>
			<li>
				<?php esc_html_e( 'Numer śledzenia:', 'dhl-polska' ); ?>
				<a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url( $tracking_item['tracking_url'] ); ?>">
					<?php echo esc_html( $tracking_item['tracking_number'] ); ?>
				</a>
			</li>
		<?php endforeach; ?>
	</ul>
</section>
