<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

/** @var \Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Cart $block */

/** @var \Magento\Wishlist\Model\Item $item */
$item = $block->getItem();
$product = $item->getProduct();
?>
<?php foreach ($block->getChildNames() as $childName): ?>
    <?= /* @noEscape */
    $block->getLayout()->renderElement($childName, false) ?>
<?php endforeach; ?>
<div class="box-tocart">
    <fieldset class="fieldset">
        <?php if ($item->canHaveQty() && $product->isVisibleInSiteVisibility()): ?>
            <div class="form-inline field qty mb-4">
                <label class="label mr-3" for="qty[<?= $block->escapeHtmlAttr($item->getId()) ?>]"><span><?= $block->escapeHtml(__('Qty')) ?></span></label>
                <div class="control">
                    <input type="number" data-role="qty" id="qty[<?= $block->escapeHtmlAttr($item->getId()) ?>]" class="input-text qty form-control"
                           data-validate="{'required-number':true,'validate-greater-than-zero':true}"
                           name="qty[<?= $block->escapeHtmlAttr($item->getId()) ?>]" value="<?= /* @noEscape */
                    (int)($block->getAddToCartQty($item) * 1) ?>">
                </div>
            </div>
        <?php endif; ?>
        <?php if ($product->isSaleable()): ?>
            <div class="product-item-actions">
                <div class="form-group">
                    <div class="actions-primary">
                        <button type="button" data-role="tocart" data-post='<?= /* @noEscape */
                        $block->getItemAddToCartParams($item) ?>' title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"
                                data-item-id="<?= $block->escapeHtmlAttr($item->getId()) ?>" class="btn btn-primary action tocart primary">
                            <span><?= $block->escapeHtml(__('Add to Cart')) ?></span>
                        </button>
                    </div>
                </div>
            </div>
        <?php else: ?>
            <?php if ($product->getIsSalable()): ?>
                <p class="available stock" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>">
                    <span><?= $block->escapeHtml(__('In stock')) ?></span>
                </p>
            <?php else: ?>
                <p class="unavailable stock" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>">
                    <span><?= $block->escapeHtml(__('Out of stock')) ?></span>
                </p>
            <?php endif; ?>
        <?php endif; ?>
    </fieldset>
</div>
