<?php $this->extend('block_unsearchable'); ?>

<?php $this->block('content'); ?>

<?php if ($this->coupons): ?>
<table>
    <tbody>
        <?php foreach ($this->coupons as $coupon): ?>
        <tr>
            <td class="coupon"><?= $coupon ?></td>
            <td class="action">
                <form action="<?= $this->action ?>" method="post">
                    <input type="hidden" name="FORM_SUBMIT" value="remove_coupon_<?= $this->id ?>">
                    <input type="hidden" name="REQUEST_TOKEN" value="{{request_token}}">
                    <button class="submit" name="coupon" value="<?= $coupon ?>">Remove</button>
                </form>
            </td>
        </tr>
        <?php endforeach; ?>
    </tbody>
</table>
<?php endif; ?>

<form action="<?= $this->action; ?>" method="post">
    <div class="formbody">
        <input type="hidden" name="FORM_SUBMIT" value="add_coupon_<?= $this->id; ?>">
        <input type="hidden" name="REQUEST_TOKEN" value="{{request_token}}">

        <div class="widget widget-text">
            <label for="ctrl_coupon_<?php echo $this->id; ?>">
                <span class="invisible"><?= $GLOBALS['TL_LANG']['MSC']['mandatory'] ?> </span><?= $GLOBALS['TL_LANG']['MSC']['couponLabel'] ?><span class="mandatory">*</span>
            </label>
            <input type="text" name="coupon" id="ctrl_coupon_<?= $this->id; ?>" class="text">
        </div>

        <div class="widget widget-submit">
            <button class="submit"><?= $this->sLabel; ?></button>
        </div>
    </div>
</form>

<?php $this->endblock(); ?>
