{{ header }}
<div id="information-tracking" class="container-xl flex-grow-1">
	<nav aria-label="breadcrumb">
		<ul class="breadcrumb pr-breadcrumb fsz-12">
		{% for breadcrumb in breadcrumbs %}
			{% if loop.last %}
				<li class="breadcrumb-item pr-breadcrumb-item">{{ breadcrumb.text }}</li>
			{% else %}
				<li class="breadcrumb-item pr-breadcrumb-item"><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
			{% endif %}
		{% endfor %}
		</ul>
    </nav>
	<main>
		<div class="row">
			<div class="col-12 pr-page-title pb-3">
				<h1>{{ heading_title }}</h1>
			</div>
		</div>
		<div class="content-top-box">{{ content_top }}</div>
		<div class="row g-3 g-xxl-4">
			{{ column_left }}
			{% if column_left and column_right %}
		    	{% set class = 'col-xl-6' %}
		    {% elseif column_left or column_right %}
		    	{% set class = 'col-xl-9' %}
		    {% else %}
		    	{% set class = 'col-xl-12' %}
		    {% endif %}
		    <div id="content" class="{{ class }}">
			    <div class="content-block">
					<p>Please enter your shipping tracking No. below:</p>
					<div class="form-group required">
						<label class="pr-control-label fw-600 dark-text fsz-14" for="input-code">{{ entry_code }} </label>
						<input type="text" name="code" value="{{ code }}" placeholder="{{ entry_code }}" id="input-code" class="form-control" />
					</div>
			    </div>
		    </div>
		    {{ column_right }}
		</div>
		{{ content_bottom }}
	</main>
</div>
<script>
$('#button-tracking').on('click', function() {
	$.ajax({
		url: 'index.php?route=information/tracking/tracking&code=' + $('input[name="code"]').val(),
		dataType: 'json',
		cache: false,
		beforeSend: function() {
			$('#button-login').button('loading');
		},
		complete: function() {
			$('#button-login').button('reset');
		},
		success: function(json) {
			$('.alert-dismissible, .text-danger').remove();
			$('.form-group').removeClass('has-error');

			if (json['redirect']) {
				location = json['redirect'];
			} else if (json['error']) {
				$('#collapse-checkout-option .panel-body').prepend('<div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> ' + json['error']['warning'] + '<button type="button" class="close" data-dismiss="alert">&times;</button></div>');

				// Highlight any found errors
				$('input[name=\'email\']').parent().addClass('has-error');
				$('input[name=\'password\']').parent().addClass('has-error');
			}
		},
		error: function(xhr, ajaxOptions, thrownError) {
			alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
		}
	});
});
</script>
{{ footer }}
