<?php
/** @var \FiloBlu\Rma\Block\Returns\View $block */

$orderAddressData = [];
$orderAddress = $block->getPickupAddress();

if($orderAddress) {
    $orderAddressData = $orderAddress->getData();
}

if(isset($orderAddressData['firstname'])){
    ?>

    <script>
        require(
            ['jquery'],
            function($) {
                $(document).ready(function () {
                    if($('body').hasClass('adminhtml-rma-edit')){

                        $(".order-return-address").after("<div style='margin-top:180px;' class='admin__page-section-item-title'><span class='title'><?= /* @escapeNotVerified */ __('Pickup Address') ?></span></div>"+
                            "<div class='box-content'>"+
                            "<?= /* @escapeNotVerified */ __('Name') ?>: <?= $block->escapeHtml($orderAddressData['firstname']) ?><br>"+
                            "<?= /* @escapeNotVerified */ __('Surname') ?>: <?= $block->escapeHtml($orderAddressData['lastname']) ?><br>"+
                            "<?= /* @escapeNotVerified */ __('Address') ?>:<?= $block->escapeHtml($orderAddressData['street']) ?><br>"+
                            "<?= /* @escapeNotVerified */ __('City') ?>: <?= $block->escapeHtml($orderAddressData['city']) ?><br>"+
                            "<?= /* @escapeNotVerified */ __('State/Province') ?>: <?php if(isset($orderAddressData['region'])){echo $block->escapeHtml($orderAddressData['region']);} ?><br>"+
                            "<?= /* @escapeNotVerified */ __('Zip/Postal Code') ?>: <?= $block->escapeHtml($orderAddressData['postcode']) ?><br>"+
                            "<?= /* @escapeNotVerified */ __('Country') ?>: <?= $block->escapeHtml($orderAddressData['country_id']) ?><br>"+
                            '</div>');

                    }
                });
            });
    </script>
    <?php
}
?>
