<?php
/**
 * Hyvä Themes - https://hyva.io
 * Copyright © Hyvä Themes 2020-present. All rights reserved.
 * This product is licensed per Magento install
 * See https://hyva.io/license
 */

use Hyva\Theme\Model\ViewModelRegistry;
use Hyva\Theme\ViewModel\Sales\PaymentInfo;
use Magento\Framework\Escaper;
use Magento\Sales\Block\Order\Info;

/** @var Info $block */
/** @var Escaper $escaper */
/** @var PaymentInfo $paymentInfo */
/** @var ViewModelRegistry $viewModels */

$order = $block->getOrder();
$paymentInfo = $viewModels->require(PaymentInfo::class);
?>
<div class="p-2 md:p-4 lg:p-6 border rounded bg-white">
    <div class="text-2xl font-inter font-semibold hidden md:block"> Billing Method</div>
    <div class="flex justify-between ">
        <div class="w-full py-4">
            <p class="text-sm md:text-base font-inter font-semibold mb-2"><?= $escaper->escapeHtml(__('Payment Information')) ?></p>
            <div class="text-sm md:text-base font-inter" >
                <?= $escaper->escapeHtml($paymentInfo->getPaymentTitle($order)) ?>
            </div>
        </div>
        <div class="w-full py-4">
            <p class="text-sm md:text-base font-inter font-semibold mb-2"><?= $escaper->escapeHtml(__('Billing Address')) ?></p>
            <div class="text-sm md:text-base font-inter" >
                <div class="font-inter text-sm md:text-base text-black"><?= /* @noEscape */
                    $block->getFormattedAddress($order->getBillingAddress()) ?></div>
            </div>
        </div>
        <div class="w-full py-4">
            <p class="text-sm md:text-base font-inter font-semibold mb-2"><?= $escaper->escapeHtml(__('Delivery Address')) ?></p>
            <div class="text-sm md:text-base font-inter" >
                <div class="font-inter text-sm md:text-base text-black"><?= /* @noEscape */
                    $block->getFormattedAddress($order->getShippingAddress()) ?></div>
            </div>
        </div>
    </div>
</div>
<?php if (!$order->getIsVirtual()): ?>

    <div class="w-full py-4 hidden">
        <p class="font-semibold mb-2"><?= $escaper->escapeHtml(__('Shipping Method')) ?></p>
        <div class="text-sm md:text-base font-inter" >
            <?php if ($order->getShippingDescription()): ?>
                <?= $escaper->escapeHtml($order->getShippingDescription()) ?>
            <?php else: ?>
                <?= $escaper->escapeHtml(__('No shipping information available')) ?>
            <?php endif; ?>
        </div>
    </div>
<?php endif; ?>

