<?php
/**
 * @author Aitoc Team
 * @copyright Copyright (c) 2020 Aitoc (https://www.aitoc.com)
 * @package Aitoc_PreOrders
 */
?>
<?php
/**
 * Copyright © 2018 Aitoc. All rights reserved.
 * Developed by Alex Yakimovich
 */

/** @var Aitoc\PreOrders\Block\Product\View\SubscribeToNotification $this */
?>
<?php if ($this->canShow()): ?>
<div id="popup-modal">
    <h1><?= __("Notify Me") ?></h1>

    <form action="<?php echo $this->getFormAction() ?>" method="post" data-mage-init='{"validation":{}}'>
        <fieldset class="fieldset">
            <input type="hidden" name="product_id" value="<?= $this->getProductId() ?>">
            <div class="field required">
                <label for="customer_name" class="label"><span><?= __('Name') ?></span></label>
                <div class="control">
                    <input type="text" name="customer_name" id="customer_name" value="" title="<?= __('Name') ?>" class="input-text" data-validate="{required:true}">
                </div>
            </div>
            <div class="field required">
                <label for="email_address" class="label"><span><?= __('Email') ?></span></label>
                <div class="control">
                    <input type="email" name="email" autocomplete="email" id="email_address" value="" title="<?= __('Email') ?>" class="input-text" data-validate="{required:true, 'validate-email':true}">
                </div>
            </div>
        </fieldset>
        <div class="actions-toolbar">
            <div class="primary">
                <button type="submit" class="action submit primary" title="<?= __('Submit') ?>"><span><?= __('Submit') ?></span></button>
            </div>
        </div>
    </form>
</div>
<div class="actions">
    <button title="Notify Me When Product Back In Stock"
            class="action primary tocart"
            id="product-preorder-notification-button"
            type="button">
        <span>Notify Me When Product Back In Stock</span>
    </button>
</div>

<script type="text/x-magento-init">
    {
        "*": {
            "aitoc_preorders_product": {"popupBlockId": "popup-modal", "buttonId": "product-preorder-notification-button"}
        }
    }
</script>
<?php endif; ?>
