<div class="rm-cart-block">
    <div class="rm-content-title rm-cart-block-title d-flex align-items-center justify-content-between justify-content-md-start">{{ heading_title }}</div>
    <div class="row rm-cart-block-row">
        <div class="col-lg-7">
			<div id="collapse-coupon" class="form-group rm-cart-block-group">
		    	<label for="input-coupon" class="rm-control-label">{{ entry_coupon }}</label>
		    	<div class="input-group flex-column flex-md-row">
			    	<input type="text" name="coupon" value="{{ coupon }}" placeholder="{{ entry_coupon }}" id="input-coupon" class="form-control" />
			    	<span class="input-group-btn">
			        	<button type="button" id="button-coupon" data-loading-text="{{ text_loading }}"  class="rm-btn rm-input-with-btn dark" />{{ button_coupon }}</button>
			    	</span>
		    	</div>
				<script>
				$('#button-coupon').on('click', function() {
					$.ajax({
						url: 'index.php?route=extension/total/coupon/coupon',
						type: 'post',
						data: 'coupon=' + encodeURIComponent($('input[name=\'coupon\']').val()),
						dataType: 'json',
						cache: false,
						beforeSend: function() {
							$('#button-coupon').button('loading');
						},
						complete: function() {
							$('#button-coupon').button('reset');
						},
						success: function(json) {
							$('.alert-dismissible').remove();

							if (json['error']) {
								rmNotify('danger', json['error']);
							}

							if (json['redirect']) {
								location = json['redirect'];
							}
						},
						error: function(xhr, ajaxOptions, thrownError) {
							alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
						}
					});
				});
				</script>
			</div>
		</div>
	</div>
</div>
