<link href="catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css" type="text/css" rel="stylesheet" media="screen" />
<script src="catalog/view/javascript/jquery/datetimepicker/moment/moment.min.js"></script>
<script src="catalog/view/javascript/jquery/datetimepicker/moment/moment-with-locales.min.js"></script>
<script src="catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js"></script>

        <div class="product-quickview">
            <div class="row">
					 <div class="col-sm-5 product-images"> 
						{% if thumb %}
							<div class="thumbnails">
							<div class="product-image">
								<a class="thumbnail" title="{{ heading_title }}">
									<img src="{{ thumb }}" title="{{ heading_title }}" alt="{{ heading_title }}" />
								</a>
							</div>
										
							<div class="additional-images-container">
								{% if images %}
								<div class="additional-images">
								{% for image in images %}
								<div class="image-additional"> 
									<img src="{{ image.thumb }}" title="{{ heading_title }}" data-image-large-src="{{ image.popup }}" alt="{{ heading_title }}" />
								</div>
								{% endfor %}
								</div>
								{% endif %}
						  	</div>
						  	</div>
						{% endif %}
					 </div><!-- block-1 -->
					
					<div class="col-sm-7 product-details">
						<h1 class="product-name">{{ heading_title }}</h1>
						<table class="product-info">
							{% if manufacturer %}
							<tr><td>{{ text_manufacturer }}</td><td class="product-info-value"><a href="{{ manufacturers }}">{{ manufacturer }}</a></td></tr>
							{% endif %}
							<tr><td>{{ text_model }}</td><td class="product-info-value">{{ model }}</td></tr>
							{% if reward %}
							<tr><td>{{ text_reward }}</td><td class="product-info-value">{{ reward }}</td></tr>
							{% endif %}
							<tr><td>{{ text_stock }}</td><td class="product-info-value">{{ stock }}</td></tr>
					  	</table>
						
						{% if review_status %}
							<div class="rating">
								<div class="product-rating">
								{% for i in 1..5 %}
								  {% if rating < i %}
									<span class="fa fa-stack"><i class="fa fa-star off fa-stack-1x"></i></span>
								  {% else %}
									<span class="fa fa-stack"><i class="fa fa-star fa-stack-1x"></i></span>
								  {% endif %}
								{% endfor %}
								</div>
								<a class="product-total-review" href="{{ products }}/#tab-review">
								<i class="fa fa-comment"></i>{{ reviews }}</a>
								<a class="product-write-review" href="{{ products }}/#tab-review">
								<i class="fa fa-pencil"></i>{{ text_write }}</a>
							</div>												            
						{% endif %}
						
						{% if price %}
						    <ul class="list-unstyled product-price">
							{% if not special %}
							<li>
							  <h2>{{ price }}</h2>
							</li>
							{% else %}
							<li>
							  <h2 class="price-new">{{ special }}</h2>
							</li>
							<li><span class="price-old">{{ price }}</span></li>
							{% endif %}
							{% if tax %}
							<li class="product-tax">{{ text_tax }} {{ tax }}</li>
							{% endif %}
							
							{% if points %}
							<li class="product-reward-points">{{ text_points }} {{ points }}</li>
							{% endif %}
							
							{% if discounts %}
							<li>
							<ul class="product-discounts">
								{% for discount in discounts %}
								<li>{{ discount.quantity }}{{ text_discount }}{{ discount.price }}</li>
								{% endfor %}
							</ul>
							</li>
							{% endif %}
						  </ul>
					    {% endif %}	
						
						<!-- Product Options START -->
						<div id="product" class="product-options">
						  {% if options %}
							<h3>{{ text_option }}</h3>
							{{ option }}
							{% for option in options %}
							{% if option.type == 'select' %}
							<div class="form-group{% if option.required %} required {% endif %}">
							  <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
							  <select name="option[{{ option.product_option_id }}]" id="input-option{{ option.product_option_id }}" class="form-control">
								<option value="">{{ text_select }}</option>
								{% for option_value in option.product_option_value %}
								<option value="{{ option_value.product_option_value_id }}">
								{{ option_value.name }}
								{% if option_value.price %}
								({{ option_value.price_prefix }}{{ option_value.price }})
								{% endif %} 
								</option>
								{% endfor %}
							  </select>
							</div>
							{% endif %}
							
							{% if option.type == 'radio' %}
							<div class="form-group{% if option.required %} required {% endif %}">
							  <label class="control-label">{{ option.name }}</label>
							  <div id="input-option{{ option.product_option_id }}"> 
								{% for option_value in option.product_option_value %}
								<div class="radio">
								  <label>
									<input type="radio" name="option[{{ option.product_option_id }}]" value="{{ option_value.product_option_value_id }}" />
									{% if option_value.image %} 
									<img src="{{ option_value.image }}" alt="{{ option_value.name }} {% if option_value.price %} {{ option_value.price_prefix }} {{ option_value.price }} {% endif %}" class="img-thumbnail" /> 
									{% endif %} 
													 
									{{ option_value.name }}
									{% if option_value.price %}
									({{ option_value.price_prefix }}{{ option_value.price }})
									{% endif %} 
								  </label>
								</div>
								{% endfor %} 
							  </div>
							</div>
							{% endif %}
							
							{% if option.type == 'checkbox' %}
							<div class="form-group{% if option.required %} required {% endif %}">
							  <label class="control-label">{{ option.name }}</label>
							  <div id="input-option{{ option.product_option_id }}"> 
								{% for option_value in option.product_option_value %}
								<div class="checkbox">
								  <label>
									<input type="checkbox" name="option[{{ option.product_option_id }}][]" value="{{ option_value.product_option_value_id }}" />
									{% if option_value.image %} 
									<img src="{{ option_value.image }}" alt="{{ option_value.name }} {% if option_value.price %} {{ option_value.price_prefix }} {{ option_value.price }} {% endif %}" class="img-thumbnail" /> 
									{% endif %}
									
									{{ option_value.name }}
									{% if option_value.price %}
									({{ option_value.price_prefix }}{{ option_value.price }})
									{% endif %} 
								  </label>
								</div>
								{% endfor %} 
							  </div>
							</div>
							{% endif %}
							
							{% if option.type == 'text' %}
							<div class="form-group{% if option.required %} required {% endif %}">
							  <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
							  <input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" placeholder="{{ option.name }}" id="input-option{{ option.product_option_id }}" class="form-control" />
							</div>
							{% endif %}
							
							{% if option.type == 'textarea' %}
							<div class="form-group{% if option.required %} required {% endif %}">
							  <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
							  <textarea name="option[{{ option.product_option_id }}]" rows="5" placeholder="{{ option.name }}" id="input-option{{ option.product_option_id }}" class="form-control">{{ option.value }}</textarea>
							</div>
							{% endif %}
							
							{% if option.type == 'file' %}
							<div class="form-group{% if option.required %} required {% endif %}">
							  <label class="control-label">{{ option.name }}</label>
							  <button type="button" id="button-upload{{ option.product_option_id }}" data-loading-text="{{ text_loading }}" class="btn btn-default btn-block"><i class="fa fa-upload"></i> {{ button_upload }}</button>
							  <input type="hidden" name="option[{{ option.product_option_id }}]" value="" id="input-option{{ option.product_option_id }}" />
							</div>
							{% endif %}
							
							{% if option.type == 'date' %}
							<div class="form-group{% if option.required %} required {% endif %}">
							  <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
							  <div class="input-group date" id="datetimepicker">
								<input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" data-date-format="YYYY-MM-DD" id="input-option{{ option.product_option_id }}" class="form-control" />
								<span class="input-group-btn">
								<button class="btn btn-default" type="button"><i class="fa fa-calendar"></i></button>
								</span>
							  </div>
							</div>
							{% endif %}
							
							{% if option.type == 'datetime' %}
							<div class="form-group{% if option.required %} required {% endif %}">
							  <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
							  <div class="input-group Datetime" id="datetime">
								<input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" data-date-format="YYYY-MM-DD HH:mm" id="input-option{{ option.product_option_id }}" class="form-control" />
								<span class="input-group-btn">
								<button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
								</span></div>
							</div>
							{% endif %}
							
							{% if option.type == 'time' %}
							<div class="form-group{% if option.required %} required {% endif %}">
							  <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
							  <div class="input-group time" id="Time">
								<input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" data-date-format="HH:mm" id="input-option{{ option.product_option_id }}" class="form-control" />
								<span class="input-group-btn">
								<button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
								</span>
							  </div>
							</div>
							{% endif %}
							
							{% endfor %}
							{% endif %}
							
							{% if recurrings %}
							<h3>{{ text_payment_recurring }}</h3>
							<div class="form-group required">
							  <select name="recurring_id" class="form-control">
								<option value="">{{ text_select }}</option>
								{% for recurring in recurrings %}
								<option value="{{ recurring.recurring_id }}">{{ recurring.name }}</option>
								{% endfor %}
							  </select>
							  <div class="help-block" id="recurring-description"></div>
							</div>
							{% endif %}
							
							<div class="form-group product-quantity">
							  <label class="control-label" for="input-quantity">{{ entry_qty }}</label>
							  <input type="text" name="quantity" value="{{ minimum }}" size="2" id="input-quantity" class="form-control" />
							  <input type="hidden" name="product_id" value="{{ product_id }}" />
							  <button type="button" id="quick-cart" data-loading-text="{{ text_loading }}" class="btn {% if stock_quantity<=0 %} {{ "btn-info" }} 
							  {% else %} btn-primary {% endif %} btn-lg btn-block" {% if stock_quantity<=0 %} {{ "disabled" }} {% endif %}>
			  					{% if stock_quantity<=0 %} {{ stock }} {% else %}{{ button_cart }} {% endif %}</button>
							</div>
							
							{% if minimum > 1 %}
							<div class="alert alert-info"><i class="fa fa-info-circle"></i> {{ text_minimum }}</div>
							{% endif %}
							</div>
						<!-- Product Options END -->					  
						<!-- Product Wishlist Compare START -->
						  <div class="btn-group">
							<button class="btn btn-default product-btn-wishlist" type="button" class="btn btn-default" title="{{ button_wishlist }}" onclick="addWishlist('{{ product_id }}');"><i class="fa fa-heart"></i>
							{{ button_wishlist }} 
							</button> 
							<button class="btn btn-default product-btn-compare" type="button" class="btn btn-default" title="{{ button_compare }}" onclick="addCompare('{{ product_id }}');"><i class="fa fa-exchange"></i>
							{{ button_compare }}
							</button>
						  </div>
						<!-- Product Wishlist Compare END -->
	
			
				<div class="clearfix"></div>
				{% if tags %}
					<p>{{ text_tags }}
						{% for i in 0..tags|length %}
							{% if i < (tags|length - 1) %} <a href="{{ tags[i].href }}">{{ tags[i].tag }}</a>,
							{% else %} <a href="{{ tags[i].href }}">{{ tags[i].tag }}</a> {% endif %}
						{% endfor %} </p>
				{% endif %}
			</div><!-- block-2 -->                    
            </div>            
        </div>
<script><!--
 $('select[name=\'recurring_id\'], input[name="quantity"]').change(function(){
	$.ajax({
		url: 'index.php?route=product/product/getRecurringDescription',
		type: 'post',
		data: $('input[name=\'product_id\'], input[name=\'quantity\'], select[name=\'recurring_id\']'),
		dataType: 'json',
		beforeSend: function() {
			$('#recurring-description').html('');
		},
		success: function(json) {
			$('.alert-dismissible, .text-danger').remove();

			if (json['success']) {
				$('#recurring-description').html(json['success']);
			}
		}
	});
});

//--></script>
<script><!--
    $('#quick-cart').on('click', function() {
	$.ajax({
		url: 'index.php?route=checkout/cart/add',
		type: 'post',
		data: $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea'),
		dataType: 'json',
		beforeSend: function() {
			$('#button-cart').button('loading');
		},
		complete: function() {
			$('#button-cart').button('reset');
		},
		success: function(json) {
			$('.alert-dismissible, .text-danger').remove();
			$('.form-group').removeClass('has-error');

			if (json['error']) {
				if (json['error']['option']) {
					for (i in json['error']['option']) {
						var element = $('#input-option' + i.replace('_', '-'));

						if (element.parent().hasClass('input-group')) {
							element.parent().after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
						} else {
							element.after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
						}
					}
				}

				if (json['error']['recurring']) {
					$('select[name=\'recurring_id\']').after('<div class="text-danger">' + json['error']['recurring'] + '</div>');
				}

				// Highlight any found errors
				$('.text-danger').parent().addClass('has-error');
			}

			if (json['success']) {			
				if (json['redirect']) {
					location = json['redirect'];
				}
				
				if (json['success']) {
				     $.notify({
				     	message: json['success'],
				     	target: '_blank'
				     },{
				     	// settings
				     	element: 'body',
				     	position: null,
				     	type: "info",
				     	allow_dismiss: true,
				     	newest_on_top: false,
				     	placement: {
				     		from: "top",
				     		align: "right"
				     	},
				     	offset: 20,
				     	spacing: 10,
				     	z_index: 2031,
				     	delay: 5000,
				     	timer: 1000,
				     	url_target: '_blank',
				     	mouse_over: null,
				     	animate: {
				     		enter: 'animated fadeInDown',
				     		exit: 'animated fadeOutUp'
				     	},
				     	onShow: null,
				     	onShown: null,
				     	onClose: null,
				     	onClosed: null,
				     	icon_type: 'class',
				     	template: '<div data-notify="container" class="col-xs-11 col-sm-3 alert alert-success" role="alert">' +
				     		'<button type="button" aria-hidden="true" class="close" data-notify="dismiss">×</button>' +
				     		'<span data-notify="message"><i class="fa fa-check-circle"></i>&nbsp; {2}</span>' +
				     		'<div class="progress" data-notify="progressbar">' +
				     			'<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' +
				     		'</div>' +
				     		'<a href="{3}" target="{4}" data-notify="url"></a>' +
				     	'</div>' 
				     });
					 
					  // Need to set timeout otherwise it wont update the total
					setTimeout(function () {
						$('#cart > button').html('<i class="fa fa-shopping-cart"></i><span id="cart-total"> ' + json['total'] + '</span>');
					}, 100);
				     					
					$('#cart > ul').load('index.php?route=common/cart/info ul li');
				}
			}
		},
        error: function(xhr, ajaxOptions, thrownError) {
            alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
        }
	});
});
//--></script>
<script><!--
$('button[id^=\'button-upload\']').on('click', function() {
	var node = this;

	$('#form-upload').remove();

	$('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" /></form>');

	$('#form-upload input[name=\'file\']').trigger('click');

	if (typeof timer != 'undefined') {
    	clearInterval(timer);
	}

	timer = setInterval(function() {
		if ($('#form-upload input[name=\'file\']').val() != '') {
			clearInterval(timer);

			$.ajax({
				url: 'index.php?route=tool/upload',
				type: 'post',
				dataType: 'json',
				data: new FormData($('#form-upload')[0]),
				cache: false,
				contentType: false,
				processData: false,
				beforeSend: function() {
					$(node).button('loading');
				},
				complete: function() {
					$(node).button('reset');
				},
				success: function(json) {
					$('.text-danger').remove();

					if (json['error']) {
						$(node).parent().find('input').after('<div class="text-danger">' + json['error'] + '</div>');
					}

					if (json['success']) {
						alert(json['success']);

						$(node).parent().find('input').val(json['code']);
					}
				},
				error: function(xhr, ajaxOptions, thrownError) {
					alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
				}
			});
		}
	}, 500);
});
    //--></script>
<script><!--   
    function addWishlist(product_id) {
        $.ajax({
            url: 'index.php?route=account/wishlist/add',
            type: 'post',
            data: 'product_id=' + product_id,
            dataType: 'json',
            success: function(json) {
                $('.alert-dismissible').remove();

                if (json['redirect']) {
                    location = json['redirect'];
                }

                if (json['success']) {							
				if (json['success']) {
					$.notify({
						message: json['success'],
						target: '_blank'
					},{
						// settings
						element: 'body',
						position: null,
						type: "info",
						allow_dismiss: true,
						newest_on_top: false,
						placement: {
							from: "top",
							align: "right"
						},
						offset: 20,
						spacing: 10,
						z_index: 2031,
						delay: 5000,
						timer: 1000,
						url_target: '_blank',
						mouse_over: null,
						animate: {
							enter: 'animated fadeInDown',
							exit: 'animated fadeOutUp'
						},
						onShow: null,
						onShown: null,
						onClose: null,
						onClosed: null,
						icon_type: 'class',
						template: '<div data-notify="container" class="col-xs-11 col-sm-3 alert alert-success" role="alert">' +
							'<button type="button" aria-hidden="true" class="close" data-notify="dismiss">×</button>' +
							'<span data-notify="message"><i class="fa fa-check-circle"></i>&nbsp; {2}</span>' +
							'<div class="progress" data-notify="progressbar">' +
								'<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' +
							'</div>' +
							'<a href="{3}" target="{4}" data-notify="url"></a>' +
						'</div>' 
					});
				}   
				
				if (json['info']) {
					$.notify({
						message: json['info'],
						target: '_blank'
					},{
						// settings
						element: 'body',
						position: null,
						type: "info",
						allow_dismiss: true,
						newest_on_top: false,
						placement: {
							from: "top",
							align: "right"
						},
						offset: 20,
						spacing: 10,
						z_index: 2031,
						delay: 5000,
						timer: 1000,
						url_target: '_blank',
						mouse_over: null,
						animate: {
							enter: 'animated fadeInDown',
							exit: 'animated fadeOutUp'
						},
						onShow: null,
						onShown: null,
						onClose: null,
						onClosed: null,
						icon_type: 'class',
						template: '<div data-notify="container" class="col-xs-11 col-sm-3 alert alert-info" role="alert">' +
							'<button type="button" aria-hidden="true" class="close" data-notify="dismiss">×</button>' +
							'<span data-notify="message"><i class="fa fa-info"></i>&nbsp; {2}</span>' +
							'<div class="progress" data-notify="progressbar">' +
								'<div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' +
							'</div>' +
							'<a href="{3}" target="{4}" data-notify="url"></a>' +
						'</div>' 
					});
				}   
				
				$('#wishlist-total span').html(json['total']);
				$('#wishlist-total').attr('title', json['total']);
			}
            },
            error: function(xhr, ajaxOptions, thrownError) {
                alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
            }
        });
    }
    
    function addCompare(product_id) {
        $.ajax({
            url: 'index.php?route=product/compare/add',
            type: 'post',
            data: 'product_id=' + product_id,
            dataType: 'json',
            success: function(json) {
                $('.alert-dismissible').remove();

                if (json['success']) {							
				if (json['success']) {
					$.notify({
						message: json['success'],
						target: '_blank'
					},{
						// settings
						element: 'body',
						position: null,
						type: "info",
						allow_dismiss: true,
						newest_on_top: false,
						placement: {
							from: "top",
							align: "right"
						},
						offset: 20,
						spacing: 10,
						z_index: 2031,
						delay: 5000,
						timer: 1000,
						url_target: '_blank',
						mouse_over: null,
						animate: {
							enter: 'animated fadeInDown',
							exit: 'animated fadeOutUp'
						},
						onShow: null,
						onShown: null,
						onClose: null,
						onClosed: null,
						icon_type: 'class',
						template: '<div data-notify="container" class="col-xs-11 col-sm-3 alert alert-success" role="alert">' +
							'<button type="button" aria-hidden="true" class="close" data-notify="dismiss">×</button>' +
							'<span data-notify="message"><i class="fa fa-check-circle"></i>&nbsp; {2}</span>' +
							'<div class="progress" data-notify="progressbar">' +
								'<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' +
							'</div>' +
							'<a href="{3}" target="{4}" data-notify="url"></a>' +
						'</div>' 
					});
					
					$('#compare-total').html(json['total']);
				}   
			}
            },
            error: function(xhr, ajaxOptions, thrownError) {
                alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
            }
        });
    }
$(document).ready(function() {			
		  var thumbnails_owl = $('.product-quickview .additional-images').owlCarousel({
				items : 3, //1 items above 1000px browser width
				nav : true,
				dots : false,
				loop: false,
				autoplay:false,	
				rtl:false,
				responsive: {
					0:{
						items:2
					},
					481:{
						items:3
					},
					768:{
						items:2
					},
					992:{
						items:3
					},
					1200:{
						items:3
					}
				}
			});

	$('.image-additional img').on(
      'click',
      (event) => {
        $('.product-image img').attr('src',$(event.target).data('image-large-src'));
        $('.selected').removeClass('selected');
        $(event.target).addClass('selected');
        $('.product-image img').prop('src', $(event.currentTarget).data('image-large-src'));
      }
	  
    );
	var minimum = {{ minimum }};
	$(".product-quickview #input-quantity").change(function(){
		if ($(this).val() < minimum) {
		  alert("Minimum Quantity: "+minimum);
		  $(".product-quickview #input-quantity").val(minimum);
		}
	});
	  // increase number of product
	function minus(minimum){
		var currentval = parseInt($(".product-quickview #input-quantity").val());
		$(".product-quickview #input-quantity").val(currentval-1);
		if($(".product-quickview #input-quantity").val() <= 0 || $(".product-quickview #input-quantity").val() < minimum){
		  alert("Minimum Quantity: "+minimum);
		  $(".product-quickview #input-quantity").val(minimum);
		}
	  };
	  // decrease of product
	function plus(){
		var currentval = parseInt($(".product-quickview #input-quantity").val());
		$(".product-quickview #input-quantity").val(currentval+1);
	};
	$('.product-quickview #minus').click(function(){
		minus(minimum);
	});
	$('.product-quickview #plus').click(function(){
		plus();
	});
});
//--></script>
