<?php $this->extend('block_unsearchable'); ?>

<?php $this->block('content'); ?>

<?php if ($this->coupons): ?>
<table class="w-100 mb-1">
    <tbody>
        <?php foreach ($this->coupons as $coupon): ?>
        <tr>
            <td class="action p-0 text-right">
                <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}}">
                    <div class="widget input-group w-100">
                    <div class="input-group-prepend w-75"><label class="input-group-text w-100"><span><i class="fas fa-check"></i> <strong><?= $coupon ?></strong></span></label></div>
                    <button class="submit btn-secondary w-25 form-control" name="coupon" value="<?= $coupon ?>"><i class="fas fa-times"></i></button>
                    </div>
                </form>
            </td>
        </tr>
        <?php endforeach; ?>
        <tr><td class="pb-3"></td></tr>
    </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}}">
        <label for="ctrl_coupon_<?php echo $this->id; ?>" class="pr-2">
            <span class="invisible"><?= $GLOBALS['TL_LANG']['MSC']['mandatory'] ?> </span><?= $GLOBALS['TL_LANG']['MSC']['couponLabel'] ?><span class="mandatory">*</span>
        </label><br>

        <div class="widget widget-text input-group">
            <input type="text" name="coupon" id="ctrl_coupon_<?= $this->id; ?>" class="form-control text">
            <div class="widget widget-submit input-group-append">
                <button class="submit btn btn-success"><i class="fas fa-check"></i></button>
            </div>
        </div>
    </div>
</form>

<?php $this->endblock(); ?>
