<?php
/**
 * Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
 */
?>
<?php // @codingStandardsIgnoreFile ?>
<?php
/** @var \Temando\Shipping\Block\Adminhtml\ComponentContainer $block */
/** @var \Temando\Shipping\ViewModel\Rma\DispatchCreate $viewModel */
$viewModel = $block->getViewModel();
?>
<div id="temando-componentry"
     data-bind="scope:'temando-componentry'"
     data-component-init='[
     {
        "entrypoint":"ReturnDispatchCreate",
        "assetsUrl":"<?= $block->escapeUrl($block->getAssetsUrl());?>",
        "elements": {
            "main": "domElement",
            "m2PageActionsButtonsId": "temando-page-actions-buttons"
        },
        "data" : {
            "temandoApiEndpoint": "<?= $block->escapeUrl($viewModel->getShippingApiAccess()->getApiEndpoint()); ?>",
            "temandoApiToken": "<?= $block->escapeHtml($viewModel->getShippingApiAccess()->getSessionToken()); ?>",
            "temandoApiTokenTtl": "<?= $block->escapeHtml($viewModel->getShippingApiAccess()->getSessionTokenExpiry()); ?>",
            "m2ApiTemandoTokenRefreshEndpoint": "<?= $block->escapeUrl($viewModel->getShippingApiAccess()->getSessionTokenRefreshEndpoint()); ?>",
            "ipAddress": "<?= $block->escapeHtml($block->getIpAddress()); ?>",
            "lang": "<?= $block->escapeHtml($block->getLanguage()); ?>",
            "locale": "<?= $block->escapeHtml($block->getLocale()) ?>",
            "returnShipmentId": "<?= /* @noEscape */ $viewModel->getRmaShipmentId(); ?>",
            "dispatchListPageUrl": "<?= $block->escapeUrl($viewModel->getDispatchGridPageUrl()); ?>",
            "returnShipmentPageUrl": "<?= $block->escapeUrl($viewModel->getRmaShipmentPageUrl()); ?>"
        }
     }]'
>

    <!-- ko template: getTemplate() --><!-- /ko -->
    <script type="text/x-magento-init">
    {
        "#temando-componentry": {
            "Magento_Ui/js/core/app":  <?= /* @noEscape */ $block->getJsLayout(); ?>
        }
    }
    </script>
</div>
