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

// @codingStandardsIgnoreFile

/** @var $block \Magento\Catalog\Block\Product\View */
?>
<?php $_product = $block->getProduct(); ?>
<?php $buttonTitle = __('Update Cart'); ?>
<?php if ($_product->isSaleable()): ?>
	<div class="box-tocart update">
		<fieldset class="fieldset">
			<?php if ($block->shouldRenderQuantity()): ?>
				<label for="qty" class="mr-2"><span><?php /* @escapeNotVerified */
						echo __('Qty') ?></span></label>
			<?php endif; ?>
			<div class="input-group">
				<?php if ($block->shouldRenderQuantity()): ?>
					<input type="number"
						   name="qty"
						   id="qty"
						   value="<?php /* @escapeNotVerified */
						   echo $block->getProductDefaultQty() * 1 ?>"
						   title="<?php /* @escapeNotVerified */
						   echo __('Qty') ?>" class="form-control input-text qty"
						   data-validate="<?php echo $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>"
					/>
				<?php endif; ?>
				<div class="input-group-append">
					<button type="submit"
							title="<?= /* @escapeNotVerified */
							$buttonTitle ?>"
							class="btn btn-primary action primary tocart"
							id="product-updatecart-button">
						<span><?= /* @escapeNotVerified */
							$buttonTitle ?></span>
					</button>
				</div>
			</div>
			<?= $block->getChildHtml('', true) ?>
		</fieldset>
	</div>
	<script type="text/x-magento-init">
        {
            "#product_addtocart_form": {
                "validation": {},
                "addToCart": {
                    "cartButtonId": "#product-updatecart-button",
                    "cartForm": "#product_addtocart_form"
                }
            }
        }

	</script>
<?php endif; ?>
