<?php /** @var \Magento\Backend\Block\Template $block */ ?>
<?php
    /** @var \Temando\Shipping\ViewModel\Rma\RmaView $rmaViewModel */
    $rmaViewModel = $block->getData('rmaViewModel');
    /** @var \Temando\Shipping\ViewModel\Order\OrderDetails $orderViewModel */
    $orderViewModel = $block->getData('orderViewModel');
    /** @var \Magento\Rma\Model\Rma $rma */
    $rma = $rmaViewModel->getRma();
    $order = $rma->getOrder();

    $rmaDateRequested = $block->formatDate(
        $rma->getDateRequested(),
        \IntlDateFormatter::MEDIUM,
        true,
        $orderViewModel->getOrderTimezone($order)
    );
?>

<div class="admin__page-section-item-title">
    <span class="title">
        <?= $block->escapeHtml(__('RMA # %1', $rma->getIncrementId())) ?>
    </span>
</div>
<div class="admin__page-section-item-content">
    <table class="admin__table-secondary order-information-table">
        <tr>
            <th><?= $block->escapeHtml(__('RMA Date')) ?></th>
            <td><?= $block->escapeHtml($rmaDateRequested) ?></td>
        </tr>
        <tr>
            <th><?= $block->escapeHtml(__('RMA Status')) ?></th>
            <td><span id="order_status"><?= $block->escapeHtml($rma->getStatusLabel()) ?></span></td>
        </tr>
        <tr>
            <th><?= $block->escapeHtml(__('Order ID')) ?></th>
            <td><?= /* @noEscape */ $order->getRealOrderId() ?></td>
        </tr>
        <?php if ($orderViewModel->isSingleStoreMode() == false) : ?>
            <tr>
                <th><?= $block->escapeHtml(__('Purchased From')) ?></th>
                <td><?= $block->escapeHtml($orderViewModel->getOrderStoreName($order), ['br']) ?></td>
            </tr>
        <?php endif; ?>
        <?php if ($extOrderId = $orderViewModel->getExtOrderId($order)) : ?>
            <tr>
                <th><?= $block->escapeHtml(__('Magento Shipping Order ID')) ?></th>
                <td><?= $block->escapeHtml($extOrderId) ?></td>
            </tr>
        <?php endif; ?>
        <?php if ($extShipmentId = $rmaViewModel->getReturnShipmentId()) : ?>
            <tr>
                <th><?= $block->escapeHtml(__('Magento Shipping Return Shipment ID')) ?></th>
                <td><?= $block->escapeHtml($extShipmentId) ?></td>
            </tr>
        <?php endif; ?>
    </table>
</div>
