<?php $_shipment = $block->getShipment() ?>
<?php $_order = $block->getOrder() ?>
<?php if ($_shipment && $_order && $_shipment->getAllTracks()): ?>
<br />
<table class="shipment-track">
    <thead>
        <tr>
            <th><?= $block->escapeHtml(('Shipped By')) ?></th>
            <th><?= $block->escapeHtml(('Tracking Number')) ?></th>
        </tr>
    </thead>
    <tbody>
    <?php foreach ($_shipment->getAllTracks() as $_item): ?>
        <?php
        if (class_exists(\Meetanshi\OrderTracking\Helper\Data::class)) {
            $trackingUrl = $this->helper('Meetanshi\OrderTracking\Helper\Data')->
            prepareTrackingUrl($_item);
        } else {
            $trackingUrl = '';
        }
        ?>
        <tr>
            <td><?= $block->escapeHtml($_item->getTitle()) ?></td>
            <?php if ($trackingUrl === ''): ?>
                <td><?= $block->escapeHtml($_item->getNumber()) ?></td>
            <?php else: ?>
                <td><a href="<?= $block->escapeHtmlAttr(__($trackingUrl)) ?>">
                    <?= $block->escapeHtmlAttr(__($_item->getNumber())) ?></a></td>
            <?php endif; ?>
        </tr>
    <?php endforeach ?>
    </tbody>
</table>
<?php endif; ?>
