<?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
 */
?>
<?php /** @var \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option\Multi $block */ ?>
<?php $_option = $block->getOption() ?>
<?php $productId = $block->getProduct()->getId();?>
<?php $_selections = $_option->getSelections() ?>
<div class="mg-fbt-field-option field option <?php /* @noEscape */ echo ($_option->getRequired()) ? ' required': ''; ?>" id="mp-fbt-bundle-option-<?php /* @noEscape */ echo $productId; ?>-<?php /* @noEscape */ echo $_option->getId();?>" data-price-amount="0">
    <label class="label" for="bundle-option-<?php /* @noEscape */ echo $productId; ?>-<?php /* @escapeNotVerified */ echo $_option->getId() ?>">
        <span><?php echo $block->escapeHtml($_option->getTitle()) ?></span>
    </label>
    <div class="control">
        <?php if ($block->showSingle()): ?>
            <?php /* @escapeNotVerified */ echo $block->getSelectionQtyTitlePrice($_selections[0]) ?>
            <input type="hidden"
                   name="bundle_option[<?php /* @noEscape */ echo $productId; ?>][<?php /* @escapeNotVerified */ echo $_option->getId() ?>]"
                   value="<?php /* @escapeNotVerified */ echo $_selections[0]->getSelectionId() ?>"/>
        <?php else: ?>
            <select multiple="multiple"
                    size="5"
                    id="bundle-option-<?php /* @noEscape */ echo $productId; ?>-<?php /* @escapeNotVerified */ echo $_option->getId() ?>"
                    data-option-id="<?php /* @escapeNotVerified */ echo $_option->getId() ?>"
                    name="bundle_option[<?php /* @noEscape */ echo $productId; ?>][<?php /* @escapeNotVerified */ echo $_option->getId() ?>][]"
                    data-selector="bundle_option[<?php /* @noEscape */ echo $productId; ?>][<?php /* @escapeNotVerified */ echo $_option->getId() ?>][]"
                    class="bundle-option-<?php /* @noEscape */ echo $productId; ?>-<?php /* @escapeNotVerified */ echo $_option->getId() ?> multiselect product bundle option change-container-classname"
                    <?php if ($_option->getRequired()) { echo 'data-validate={required:true}'; } ?>>
                <?php if (!$_option->getRequired()): ?>
                    <option value=""><?php /* @escapeNotVerified */ echo __('None') ?></option>
                <?php endif; ?>
                <?php foreach ($_selections as $_selection): ?>
                    <option value="<?php /* @escapeNotVerified */ echo $_selection->getSelectionId() ?>"
                            <?php if ($block->isSelected($_selection)) { echo ' selected="selected"'; } ?>
                            <?php if (!$_selection->isSaleable()) { echo ' disabled="disabled"'; } ?>>
                        <?php /* @escapeNotVerified */ echo $block->getSelectionQtyTitlePrice($_selection, false) ?>
                    </option>
                <?php endforeach; ?>
            </select>
        <?php endif; ?>
    </div>
</div>
