<?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 Magento\Framework\Escaper;
use Magento\GiftMessage\Helper\Message;
use Magento\Sales\Block\Order\View;

// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundHelper

/** @var View $block */
/** @var Escaper $escaper */

$giftMessageHelper = $this->helper(Message::class);

$order = $block->getOrder();
?>
<div class="card p-2 md:p-4 lg:p-6 border rounded bg-white ">
    <div class="md:flex justify-between">
        <div class="lg:inline-block">
            <div class="text-2xl"><?= $escaper->escapeHtml(__('Order # %1', $order->getRealOrderId())) ?></div>
            <?= $block->getChildHtml('order.date') ?>
        </div>
        <div class="mt-3 md:mt-0 lg:ml-5 hidden">
            <?= $block->getChildHtml('order.status') ?>

        </div>
        <div class="flex flex-col lg:ml-5 md:mt-0 mt-3">
            <?= $block->getChildHtml('order_totals') ?>
        </div>
    </div>

</div>
<div class="order-details-items ordered  ">
    <div >

        <div class="py-4  mb-4">
        <div class="card p-2 md:p-4 lg:p-6 border rounded">
            <div class="text-3xl font-sen font-semibold hidden md:block"> Order detail</div>
           <?= $block->getChildHtml('order_items') ?>
       </div>
            <div class=" mt-4">
                <?= $block->getChildHtml('sales.order.info') ?>
            </div>


            <?= $block->getChildHtml('order.comments') ?>

            <?php if (!$block->getData('is_context_shipment')): ?>
                <div class="order-title hidden">
                    <?php if (!empty($order->getTracksCollection()->getItems())): ?>
                        <?= $block->getChildHtml('tracking-info-link') ?>
                    <?php endif; ?>
                </div>
            <?php endif; ?>


            <?php if ($giftMessageHelper->isMessagesAllowed('order', $order) && $order->getGiftMessageId()): ?>
                <div class="block block-order-details-gift-message">
                    <div class="block-title">
                        <strong><?= $escaper->escapeHtml(__('Gift Message for This Order')) ?></strong>
                    </div>
                    <?php
                    $giftMessage =
                        $giftMessageHelper->getGiftMessageForEntity($order);
                    ?>
                    <div class="block-content">
                        <dl class="item-options">
                            <dt class="item-sender">
                                <strong class="label">
                                    <?= $escaper->escapeHtml(__('From')) ?>
                                </strong>
                                <?= $escaper->escapeHtml($giftMessage->getSender()) ?>
                            </dt>
                            <dt class="item-recipient">
                                <strong class="label">
                                    <?= $escaper->escapeHtml(__('To')) ?>
                                </strong>
                                <?= $escaper->escapeHtml($giftMessage->getRecipient()) ?>
                            </dt>
                            <dd class="item-message">
                                <?= /* @noEscape */
                                $giftMessageHelper->getEscapedGiftMessage($order) ?>
                            </dd>
                        </dl>
                    </div>
                </div>
            <?php endif; ?>
            <div class="actions-toolbar">
                <div class="secondary hidden">
                    <a class="action back" href="<?= $escaper->escapeUrl($block->getBackUrl()) ?>">
                        <span><?= $escaper->escapeHtml($block->getBackTitle()) ?></span>
                    </a>
                </div>
                <?php if (!$block->getData('is_context_shipment')): ?>
                    <?= $block->getChildHtml('sales.order.buttons') ?>
                <?php else: ?>
                    <?= $block->getChildHtml('sales.shipment.buttons') ?>
                <?php endif; ?>
            </div>
        </div>
    </div>
</div>
