<?php
/**
 * @var array<string, string> $parcelshop_data .
 * @var WC_Order              $order           .
 *
 * @package DhlPolska\Point
 */

defined( 'ABSPATH' ) || exit;

if ( empty( $parcelshop_data['id'] ) ) {
	return;
}

$street_line = trim( $parcelshop_data['street'] . ' ' . $parcelshop_data['streetNo'] );
$city_line   = trim( $parcelshop_data['zip'] . ' ' . $parcelshop_data['city'] );
?>
<section class="woocommerce-order-details dhl-polska-parcelshop">
	<h2 class="woocommerce-order-details__title">
		<?php esc_html_e( 'Wybrany punkt odbioru DHL', 'dhl-polska' ); ?>
	</h2>
	<address>
		<?php if ( ! empty( $parcelshop_data['name'] ) ) : ?>
			<strong><?php echo esc_html( $parcelshop_data['name'] ); ?></strong><br/>
		<?php endif; ?>
		<?php if ( ! empty( $parcelshop_data['postnummer'] ) ) : ?>
			<?php esc_html_e( 'Postnummer:', 'dhl-polska' ); ?>
			<?php echo esc_html( $parcelshop_data['postnummer'] ); ?><br/>
		<?php endif; ?>
		<?php if ( '' !== $street_line ) : ?>
			<?php echo esc_html( $street_line ); ?><br/>
		<?php endif; ?>
		<?php if ( '' !== $city_line ) : ?>
			<?php echo esc_html( $city_line ); ?><br/>
		<?php endif; ?>
		<?php if ( ! empty( $parcelshop_data['sap'] ) ) : ?>
			(<?php echo esc_html( $parcelshop_data['sap'] ); ?>)
		<?php endif; ?>
	</address>
</section>
