<?php
/**
 * Mageplaza
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Mageplaza.com license that is
 * available through the world-wide-web at this URL:
 * https://www.mageplaza.com/LICENSE.txt
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade this extension to newer
 * version in the future.
 *
 * @category    Mageplaza
 * @package     Mageplaza_FrequentlyBought
 * @copyright   Copyright (c) Mageplaza (https://www.mageplaza.com/)
 * @license     https://www.mageplaza.com/LICENSE.txt
 */

declare(strict_types=1);

use Hyva\Theme\Model\ViewModelRegistry;
use Hyva\Theme\ViewModel\CustomOption;


/** @var Magento\Catalog\Block\Product\View\Options\Type\Select $block */
/** @var Magento\Framework\Escaper $escaper */
/** @var ViewModelRegistry $viewModels */

$option = $block->getOption();
$product = $block->getProduct();

/** @var CustomOption $customOptionsViewModel */
$customOptionsViewModel = $viewModels->require(CustomOption::class);

?>
<div class="flex flex-col sm:flex-row border-t border-gray-300 py-2 last:mb-6 last:border-b w-full items-center">
    <label class="label text-gray-700 text-left w-full sm:w-1/2"
           for="select_<?= $escaper->escapeHtmlAttr($option->getId()) ?>"
    >
        <span><?= $escaper->escapeHtml($option->getTitle()) ?></span>
        <?php if ($option->getIsRequire()): ?>
            <span class="sup text-sm">*</span>
        <?php endif; ?>
    </label>
    <div class="sm:ml-2 text-gray-900 text-left w-full sm:w-1/2">
        <?= $customOptionsViewModel->getOptionHtml($option, $product); ?>
    </div>
</div>
