<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-reward" class="form-group rm-cart-block-group">
		    	<label for="input-reward" class="rm-control-label">{{ entry_reward }}</label>
		    	<div class="input-group flex-column flex-md-row">
			    	<input type="text" name="reward" value="{{ reward }}" placeholder="{{ entry_reward }}" id="input-reward" class="form-control" />
			    	<span class="input-group-btn">
			        	<button type="button" id="button-reward" data-loading-text="{{ text_loading }}"  class="rm-btn rm-input-with-btn dark" />{{ button_reward }}</button>
			    	</span>
		    	</div>
		        <script>
				$('#button-reward').on('click', function() {
					$.ajax({
						url: 'index.php?route=extension/total/reward/reward',
						type: 'post',
						data: 'reward=' + encodeURIComponent($('input[name=\'reward\']').val()),
						dataType: 'json',
						cache: false,
						beforeSend: function() {
							$('#button-reward').button('loading');
						},
						complete: function() {
							$('#button-reward').button('reset');
						},
						success: function(json) {
							$('.alert-dismissible').remove();

							if (json['error']) {
								$('.breadcrumb').after('<div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + '<button type="button" class="close" data-dismiss="alert">&times;</button></div>');

								$('html, body').animate({ scrollTop: 0 }, 'slow');
							}

							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>
