<?php
/**
 * Copyright © 2016 maijindou.com All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<div class="block discount" id="block-discount" data-mage-init='{"collapsible":{"openedState": "active", "saveState": false}}'>
    <div class="title" data-role="title">
        <strong id="block-discount-heading" role="heading" aria-level="2"><?php /* @escapeNotVerified */ echo __('Apply Discount Code') ?></strong>
    </div>
    <div class="content" data-role="content" aria-labelledby="block-discount-heading">
        <form id="discount-coupon-form"
              action="<?php /* @escapeNotVerified */ echo $block->getUrl('checkout/cart/couponPost') ?>"
              method="post"
              data-mage-init='{"discountCode":{"couponCodeSelector": "#coupon_code",
                                               "removeCouponSelector": "#remove-coupon",
                                               "applyButton": "button.action.apply",
                                               "cancelButton": "button.action.cancel"}}'>
            <div class="fieldset coupon<?php strlen($block->getCouponCode()) ? ' applied' : ''?>">
                <input type="hidden" name="remove" id="remove-coupon" value="0" />
                <div class="field">
                    <label for="coupon_code" class="label"><span><?php /* @escapeNotVerified */ echo __('Enter discount code') ?></span></label>
                    <div class="control">
                        <input type="text" class="input-text" id="coupon_code" name="coupon_code" value="<?php echo $block->escapeHtml($block->getCouponCode()) ?>" placeholder="<?php echo $block->escapeHtml(__('Enter discount code'));?>" />
                    </div>
                </div>
                <div class="actions-toolbar">
                    <?php if (!strlen($block->getCouponCode())): ?>
                    <div class="primary">
                        <button class="action apply primary" type="button" value="<?php /* @escapeNotVerified */ echo __('Apply Discount') ?>">
                            <span><?php /* @escapeNotVerified */ echo __('Apply Discount') ?></span>
                        </button>
                    </div>
                    <?php else: ?>
                        <div class="primary">
                            <button  type="button" class="action cancel primary" value="<?php /* @escapeNotVerified */ echo __('Cancel Coupon') ?>"><span><?php /* @escapeNotVerified */ echo __('Cancel Coupon') ?></span></button>
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        </form>
    </div>
</div>
