<div class="modal-header">
  <button type="button" class="pull-right btn btn-danger btn-sm" data-dismiss="modal" aria-hidden="true"><i class="fa fa-close"></i></button>
  <h4 class="modal-title">{{ heading_generator_products }}</h4>
</div>
<div class="modal-body">
  <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-seo-data" class="form-horizontal">
	<div class="form-group">
	  <div class="col-sm-6">
        <label class="control-label" for="template-url-alias">{{ heading_seo_url }}</label>
        <div class="input-group">
		  <span class="input-group-addon" data-toggle="tooltip" title="{{ help_template_seo_url }}"><i class="fa fa-exclamation-circle"></i> {{ column_template }}</span>
		  <input type="text" name="seo_template_product_seo_url" value="{{ seo_template_product_seo_url }}" id="template-seo-url" class="form-control" />
        </div>
		{{ text_products_tags }}
      </div>
	  <div class="col-sm-6">
        <label class="control-label" for="input-overwrite"><span data-toggle="tooltip" title="{{ help_warning_overwrite }}">{{ column_overwrite }}</span></label>
		<div class="input-group">
		  <select name="overwrite_product" id="input-overwrite" class="form-control">
            <option value="dont_overwrite" selected="selected">{{ text_no_overwrite }}</option>
		    <option value="overwrite">{{ text_overwrite }}</option>
          </select>
		  <span class="input-group-btn">
		    <a onclick="generateSeoData('Products', 'seo_url');" data-toggle="tooltip" title="{{ button_generate }}" class="btn btn-primary"><i class="fa fa-random"></i></a>
		  </span>
		</div>
      </div>
	</div>
	<div class="form-group">
	  <div class="col-sm-12">
        <label class="control-label" for="template-meta-title">{{ heading_meta_title }}</label>
        <div class="input-group">
		  <span class="input-group-addon" data-toggle="tooltip" title="{{ help_template_meta_title }}"><i class="fa fa-exclamation-circle"></i> {{ column_template }}</span>
		  <input type="text" name="seo_template_product_meta_title" value="{{ seo_template_product_meta_title }}" id="template-meta-title" class="form-control" />
		   <span class="input-group-btn">
		    <a onclick="generateSeoData('Products', 'meta_title');" data-toggle="tooltip" title="{{ button_generate }}" class="btn btn-primary"><i class="fa fa-random"></i></a>
			<a onclick="deleteSeoData('Products', 'meta_title');" data-toggle="tooltip" title="{{ button_del_meta_title }}" class="btn btn-danger"><i class="fa fa-trash-o"></i></a>
		   </span>
        </div>
		{{ text_meta_title_products_tags }}
      </div>
	</div>
	<div class="form-group{% if presence_column_meta_h1 == 'meta-tag-h1-not-in-opencart' %} hidden{% endif %}">
	  <div class="col-sm-12">
        <label class="control-label" for="template-meta-title">{{ heading_meta_h1 }}</label>
        <div class="input-group">
		  <span class="input-group-addon" data-toggle="tooltip" title="{{ help_template_meta_h1 }}"><i class="fa fa-exclamation-circle"></i> {{ column_template }}</span>
		  <input type="text" name="seo_template_product_meta_h1" value="{{ seo_template_product_meta_h1 }}" id="template-meta-h1" class="form-control" />
		   <span class="input-group-btn">
		    <a onclick="generateSeoData('Products', 'meta_h1');" data-toggle="tooltip" title="{{ button_generate }}" class="btn btn-primary"><i class="fa fa-random"></i></a>
			<a onclick="deleteSeoData('Products', 'meta_h1');" data-toggle="tooltip" title="{{ button_del_meta_h1 }}" class="btn btn-danger"><i class="fa fa-trash-o"></i></a>
		   </span>
        </div>
		{{ text_meta_h1_products_tags }}
      </div>
	</div>
	<div class="form-group">
	  <div class="col-sm-12">
        <label class="control-label" for="template-meta-description">{{ heading_meta_description }}</label>
        <div class="input-group">
		  <span class="input-group-addon" data-toggle="tooltip" title="{{ help_template_meta_description }}"><i class="fa fa-exclamation-circle"></i> {{ column_template }}</span>
		  <input type="text" name="seo_template_product_meta_description" value="{{ seo_template_product_meta_description }}" id="template-meta-description" class="form-control" />
		   <span class="input-group-btn">
		    <a onclick="generateSeoData('Products', 'meta_description');" data-toggle="tooltip" title="{{ button_generate }}" class="btn btn-primary"><i class="fa fa-random"></i></a>
			<a onclick="deleteSeoData('Products', 'meta_description');" data-toggle="tooltip" title="{{ button_del_meta_description }}" class="btn btn-danger"><i class="fa fa-trash-o"></i></a>
		   </span>
        </div>
		{{ text_products_meta_description }}
      </div>
	</div>
	<div class="form-group">
	  <div class="col-sm-12">
        <label class="control-label" for="template-meta-keywords">{{ heading_meta_keywords }}</label>
        <div class="input-group">
		  <span class="input-group-addon" data-toggle="tooltip" title="{{ help_template_meta_keywords }}"><i class="fa fa-exclamation-circle"></i> {{ column_template }}</span>
		  <input type="text" name="seo_template_product_meta_keyword" value="{{ seo_template_product_meta_keyword }}" id="template-meta-keyword" class="form-control" />
		   <span class="input-group-btn">
		    <a onclick="generateSeoData('Products', 'meta_keyword');" data-toggle="tooltip" title="{{ button_generate }}" class="btn btn-primary"><i class="fa fa-random"></i></a>
			<a onclick="deleteSeoData('Products', 'meta_keyword');" data-toggle="tooltip" title="{{ button_del_meta_keywords }}" class="btn btn-danger"><i class="fa fa-trash-o"></i></a>
		   </span>
        </div>
		{{ text_meta_keywords_products_tags }}
      </div>
	</div>
	<div class="form-group">
	  <div class="col-sm-12">
        <label class="control-label" for="template-meta-tag">{{ heading_tags }}</label>
        <div class="input-group">
		  <span class="input-group-addon" data-toggle="tooltip" title="{{ help_template_meta_keywords }}"><i class="fa fa-exclamation-circle"></i> {{ column_template }}</span>
		  <input type="text" name="seo_template_product_tag" value="{{ seo_template_product_tag }}" id="template-tag" class="form-control" />
		   <span class="input-group-btn">
		    <a onclick="generateSeoData('Products', 'tag');" data-toggle="tooltip" title="{{ button_generate }}" class="btn btn-primary"><i class="fa fa-random"></i></a>
			<a onclick="deleteSeoData('Products', 'tag');" data-toggle="tooltip" title="{{ button_del_meta_tags }}" class="btn btn-danger"><i class="fa fa-trash-o"></i></a>
		   </span>
        </div>
		{{ text_tags_products }}
      </div>
	</div>
  </form>
</div>
<div class="modal-footer">
  <div class="text-center"><a data-form="form-seo-data" class="button-save btn btn-primary"><i class="fa fa-save"></i> {{ button_save_templates }}</a></div>
</div>
<script type="text/javascript"><!--
$(".button-save").on('click', function(){
	$.ajax({
		url: $('#' + $(this).data('form')).attr('action'),
		type: 'post',
		dataType: 'json',
		data: $('#' + $(this).data('form') + ' input[type=\'text\']'),
		success: function(json) {
			if (json['error']) {
				$('#form-seo-data').before('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + '</div>');
				
				$('.alert-danger').delay(1500).fadeOut(500);
			}
			
			if (json['success']) {
				$('#form-seo-data').before('<div class="alert alert-success"><i class="fa fa-exclamation-circle"></i> ' + json['success'] + '</div>');	
				
				$('.alert-success').delay(1500).fadeOut(500);
			}
		},
		error: function(xhr, ajaxOptions, thrownError) {
			alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
		}
	});
});   
//--></script>