<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ use Magento\Framework\View\Element\Template; /** * @var $block \Magento\Shipping\Block\Tracking\Popup * @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */ $results = $block->getTrackingInfo(); ?> <div class="page tracking"><?php if (!empty($results)): ?> <?php foreach ($results as $shipId => $result): ?> <?php if ($shipId): ?> <div class="order subtitle caption"><?= /* @noEscape */ $block->escapeHtml(__('Shipment #')) . $shipId ?></div><?php endif; ?> <?php if (!empty($result)): ?> <?php foreach ($result as $counter => $track): ?> <div class="table-wrapper"><?php $shipmentBlockIdentifier = $shipId . '.' . $counter; $block->addChild('shipping.tracking.details.' . $shipmentBlockIdentifier, Template::class, [ 'track' => $track, 'template' => 'Magento_Shipping::tracking/details.phtml', 'storeSupportEmail' => $block->getStoreSupportEmail() ]); ?> <?= /* @noEscape */ $block->getChildHtml('shipping.tracking.details.' . $shipmentBlockIdentifier) ?></div><?php if (is_object($track) && !empty($track->getProgressdetail())): ?> <?php $block->addChild( 'shipping.tracking.progress.' . $shipmentBlockIdentifier, Template::class, ['track' => $track, 'template' => 'Magento_Shipping::tracking/progress.phtml'] ); ?> <?= /* @noEscape */ $block->getChildHtml('shipping.tracking.progress.' . $shipmentBlockIdentifier) ?> <?php endif; ?> <?php endforeach; ?> <?php else: ?> <div class="message info empty"><div><?= $block->escapeHtml(__('There is no tracking available for this shipment.')) ?></div></div><?php endif; ?> <?php endforeach; ?> <?php else: ?> <div class="message info empty"><div><?= $block->escapeHtml(__('There is no tracking available.')) ?></div></div><?php endif; ?> <div class="actions"><button type="button" title="<?= $block->escapeHtml(__('Close Window')) ?>" class="action close"><span><?= $block->escapeHtml(__('Close Window')) ?></span></button> <?= /* @noEscape */ $secureRenderer->renderEventListenerAsTag( 'onclick', "window.close(); window.opener.focus();", 'button.action.close' ) ?></div></div><?php $scriptString = <<<script

    require([
        'jquery'
    ], function (jQuery) {
        /* hide the close button when the content doesn't open in a modal window */
        if (window.opener === null || typeof window.opener === "undefined") {
            jQuery('.actions button.close').hide();
        }
    });

script; ?> <?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>