<?php
declare(strict_types=1);
/**
 * Copyright © MageWorx. All rights reserved.
 * See https://www.mageworx.com/terms-and-conditions for license details.
 */
?>

<?php
use Magento\Framework\View\Element\Template;
use Magento\Framework\Escaper;

/** @var Template $block */
/** @var Escaper $escaper */
?>

<template x-if="option.__typename === 'CustomizableFieldOption' && option.isShow">
    <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" :class="option.div_class">
        <?= $block->getChildHtml('mageworx.apo.product.form.text_option.label') ?>
        <div class="sm:ml-2 text-gray-900 text-left w-full sm:w-1/2 mw-apo-control">
            <template x-if="!option.isDynamicOption">
                <input x-model="option.value" :placeholder="option.title" :readonly="isLoading"
                    type="text" class="product-custom-option form-input w-full" @change="onChangeNonDepField()"
                    :id="'options_' + option.option_id + '_text'" :required="option.required"
                    form="product_addtocart_form" :name="'options[' + option.option_id + ']'">
            </template>
            <template x-if="option.isDynamicOption">
                <input x-model="option.value" :placeholder="option.title" :readonly="isLoading"
                    type="number" class="product-custom-option form-input w-full" @change="onChangeDynamicField(option.option_id)"
                    :id="'options_' + option.option_id + '_text'" :required="option.required"
                    :min="option.dynamicOptionData.min" :max="option.dynamicOptionData.max || 'any'" :step="option.dynamicOptionData.step || 'any'"
                    form="product_addtocart_form" :name="'options[' + option.option_id + ']'">
            </template>
        </div>
    </div>
</template>
